diff options
author | Christian Lamparter <chunkeey@gmail.com> | 2018-10-17 22:37:37 +0200 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-11-26 12:05:46 +0100 |
commit | a9839fe638d3902f7fb1d770ce6fece15bdc5c6d (patch) | |
tree | db7ee5ec254f1799e5519c680298c2b3c86c8dd6 /target/linux/generic/files/drivers | |
parent | 910c2f9e68554ed36f622d005c76f39780b367ab (diff) | |
download | upstream-a9839fe638d3902f7fb1d770ce6fece15bdc5c6d.tar.gz upstream-a9839fe638d3902f7fb1d770ce6fece15bdc5c6d.tar.bz2 upstream-a9839fe638d3902f7fb1d770ce6fece15bdc5c6d.zip |
generic: rtl8367b: make it possible to specify cpu_port via DT
This patch adds the feature to parse the existing cpu_port DT
property, which is used to specify which port is the cpu port
of the switch.
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8367b.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c index cd8de810b5..be9f74f888 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c @@ -1401,7 +1401,7 @@ static int rtl8367b_switch_init(struct rtl8366_smi *smi) int err; dev->name = "RTL8367B"; - dev->cpu_port = RTL8367B_CPU_PORT_NUM; + dev->cpu_port = smi->cpu_port; dev->ports = RTL8367B_NUM_PORTS; dev->vlans = RTL8367B_NUM_VIDS; dev->ops = &rtl8367b_sw_ops; @@ -1534,8 +1534,10 @@ static int rtl8367b_probe(struct platform_device *pdev) smi->cmd_read = 0xb9; smi->cmd_write = 0xb8; smi->ops = &rtl8367b_smi_ops; - smi->cpu_port = RTL8367B_CPU_PORT_NUM; smi->num_ports = RTL8367B_NUM_PORTS; + if (of_property_read_u32(pdev->dev.of_node, "cpu_port", &smi->cpu_port) + || smi->cpu_port >= smi->num_ports) + smi->cpu_port = RTL8367B_CPU_PORT_NUM; smi->num_vlan_mc = RTL8367B_NUM_VLANS; smi->mib_counters = rtl8367b_mib_counters; smi->num_mib_counters = ARRAY_SIZE(rtl8367b_mib_counters); |