octeon: add support for kernel 4.14
[openwrt/staging/chunkeey.git] / target / linux / octeon / patches-4.14 / 110-er200-ethernet_probe_order.patch
1 --- a/drivers/staging/octeon/ethernet.c
2 +++ b/drivers/staging/octeon/ethernet.c
3 @@ -684,6 +684,7 @@ static int cvm_oct_probe(struct platform
4 int interface;
5 int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
6 int qos;
7 + int i;
8 struct device_node *pip;
9
10 octeon_mdiobus_force_mod_depencency();
11 @@ -800,13 +801,19 @@ static int cvm_oct_probe(struct platform
12 }
13
14 num_interfaces = cvmx_helper_get_number_of_interfaces();
15 - for (interface = 0; interface < num_interfaces; interface++) {
16 - cvmx_helper_interface_mode_t imode =
17 - cvmx_helper_interface_get_mode(interface);
18 - int num_ports = cvmx_helper_ports_on_interface(interface);
19 + for (i = 0; i < num_interfaces; i++) {
20 + cvmx_helper_interface_mode_t imode;
21 + int interface;
22 + int num_ports;
23 int port;
24 int port_index;
25
26 + interface = i;
27 + if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_UBNT_E200)
28 + interface = num_interfaces - (i + 1);
29 +
30 + num_ports = cvmx_helper_ports_on_interface(interface);
31 + imode = cvmx_helper_interface_get_mode(interface);
32 for (port_index = 0,
33 port = cvmx_helper_get_ipd_port(interface, 0);
34 port < cvmx_helper_get_ipd_port(interface, num_ports);