ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0057-sdk_fman-fix-probing-of-10G-ports-on-T102x.patch
1 From 7dd27606d9b7f28a7367e4b9444bed7d573f4b6c Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Fri, 23 Mar 2018 16:33:19 +0200
4 Subject: [PATCH] sdk_fman: fix probing of 10G ports on T102x
5
6 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
7 ---
8  .../sdk_fman/src/wrapper/lnxwrp_fm_port.c          | 24 +++++++++++++++++-----
9  1 file changed, 19 insertions(+), 5 deletions(-)
10
11 --- a/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
12 +++ b/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm_port.c
13 @@ -388,7 +388,14 @@ static t_LnxWrpFmPortDev *ReadFmPortDevT
14                         settings.param.specificParams.nonRxParams.qmChannel =
15                         p_LnxWrpFmPortDev->txCh;
16         } else if (of_device_is_compatible(port_node, "fsl,fman-port-10g-tx")) {
17 +#ifndef CONFIG_FMAN_ARM
18 +               /* On T102x, the 10G TX port IDs start from 0x28 */
19 +               if (IS_T1023_T1024)
20 +                       tmp_prop -= 0x28;
21 +               else
22 +#endif
23                 tmp_prop -= 0x30;
24 +
25                 if (unlikely(tmp_prop>= FM_MAX_NUM_OF_10G_TX_PORTS)) {
26                         REPORT_ERROR(MAJOR, E_INVALID_VALUE,
27                                         ("of_get_property(%s, cell-index) failed",
28 @@ -399,7 +406,7 @@ static t_LnxWrpFmPortDev *ReadFmPortDevT
29                         FM_MAX_NUM_OF_1G_TX_PORTS];
30  #ifndef CONFIG_FMAN_ARM
31                 if (IS_T1023_T1024)
32 -                       p_LnxWrpFmPortDev = &p_LnxWrpFmDev->txPorts[*uint32_prop];
33 +                       p_LnxWrpFmPortDev = &p_LnxWrpFmDev->txPorts[tmp_prop];
34  #endif
35  
36                 p_LnxWrpFmPortDev->id = tmp_prop;
37 @@ -437,7 +444,14 @@ static t_LnxWrpFmPortDev *ReadFmPortDevT
38                 if (p_LnxWrpFmDev->pcdActive)
39                         p_LnxWrpFmPortDev->defPcd = p_LnxWrpFmDev->defPcd;
40         } else if (of_device_is_compatible(port_node, "fsl,fman-port-10g-rx")) {
41 +#ifndef CONFIG_FMAN_ARM
42 +               /* On T102x, the 10G RX port IDs start from 0x08 */
43 +               if (IS_T1023_T1024)
44 +                       tmp_prop -= 0x8;
45 +               else
46 +#endif
47                 tmp_prop -= 0x10;
48 +
49                 if (unlikely(tmp_prop >= FM_MAX_NUM_OF_10G_RX_PORTS)) {
50                         REPORT_ERROR(MAJOR, E_INVALID_VALUE,
51                                         ("of_get_property(%s, cell-index) failed",
52 @@ -449,7 +463,7 @@ static t_LnxWrpFmPortDev *ReadFmPortDevT
53  
54  #ifndef CONFIG_FMAN_ARM
55                 if (IS_T1023_T1024)
56 -                       p_LnxWrpFmPortDev = &p_LnxWrpFmDev->rxPorts[*uint32_prop];
57 +                       p_LnxWrpFmPortDev = &p_LnxWrpFmDev->rxPorts[tmp_prop];
58  #endif
59  
60                 p_LnxWrpFmPortDev->id = tmp_prop;
61 @@ -637,7 +651,7 @@ static t_Error CheckNConfigFmPortAdvArgs
62      uint32_prop = (uint32_t *)of_get_property(port_node, "ar-tables-sizes",
63         &lenp);
64      if (uint32_prop) {
65 -    
66 +
67         if (WARN_ON(lenp != sizeof(uint32_t)*8))
68              RETURN_ERROR(MINOR, E_INVALID_VALUE, NO_MSG);
69         if (WARN_ON(p_LnxWrpFmPortDev->settings.param.portType !=
70 @@ -671,7 +685,7 @@ static t_Error CheckNConfigFmPortAdvArgs
71          if (uint32_prop) {
72                 if (WARN_ON(lenp != sizeof(uint32_t)*3))
73                  RETURN_ERROR(MINOR, E_INVALID_VALUE, NO_MSG);
74 -         
75 +
76              p_LnxWrpFmPortDev->dsar_table_sizes.max_num_of_ip_prot_filtering  =
77                 (uint16_t)be32_to_cpu(uint32_prop[0]);
78              p_LnxWrpFmPortDev->dsar_table_sizes.max_num_of_tcp_port_filtering =
79 @@ -679,7 +693,7 @@ static t_Error CheckNConfigFmPortAdvArgs
80              p_LnxWrpFmPortDev->dsar_table_sizes.max_num_of_udp_port_filtering =
81                 (uint16_t)be32_to_cpu(uint32_prop[2]);
82          }
83 -        
84 +
85          if ((err = FM_PORT_ConfigDsarSupport(p_LnxWrpFmPortDev->h_Dev,
86                 (t_FmPortDsarTablesSizes*)&p_LnxWrpFmPortDev->dsar_table_sizes)) != E_OK)
87                 RETURN_ERROR(MINOR, err, NO_MSG);