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;
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);