4859d174631c1078d8ba2e4b378e6887b3592f6f
[openwrt/staging/linusw.git] /
1 From 6864e50946bf92f96b8452d1e47765230a276bb0 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Mon, 6 Jan 2020 14:30:58 +0200
4 Subject: [PATCH] Revert "net: mscc: ocelot: do not force Felix MACs at lower
5 speeds than gigabit"
6
7 This reverts commit f3ebad1269aad8a04710e84dc1cd5de485e5fec4.
8
9 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
10 ---
11 drivers/net/dsa/ocelot/felix.c | 1 -
12 drivers/net/dsa/ocelot/felix.h | 1 -
13 drivers/net/dsa/ocelot/felix_vsc9959.c | 1 -
14 drivers/net/ethernet/mscc/ocelot.c | 32 ++++++++++++++------------------
15 include/soc/mscc/ocelot.h | 7 -------
16 5 files changed, 14 insertions(+), 28 deletions(-)
17
18 --- a/drivers/net/dsa/ocelot/felix.c
19 +++ b/drivers/net/dsa/ocelot/felix.c
20 @@ -249,7 +249,6 @@ static int felix_init_structs(struct fel
21 ocelot->num_stats = felix->info->num_stats;
22 ocelot->shared_queue_sz = felix->info->shared_queue_sz;
23 ocelot->ops = felix->info->ops;
24 - ocelot->quirks = felix->info->quirks;
25
26 base = pci_resource_start(felix->pdev, felix->info->pci_bar);
27
28 --- a/drivers/net/dsa/ocelot/felix.h
29 +++ b/drivers/net/dsa/ocelot/felix.h
30 @@ -18,7 +18,6 @@ struct felix_info {
31 unsigned int num_stats;
32 int num_ports;
33 int pci_bar;
34 - unsigned long quirks;
35 };
36
37 extern struct felix_info felix_info_vsc9959;
38 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
39 +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
40 @@ -584,5 +584,4 @@ struct felix_info felix_info_vsc9959 = {
41 .shared_queue_sz = 128 * 1024,
42 .num_ports = 6,
43 .pci_bar = 4,
44 - .quirks = OCELOT_PCS_PERFORMS_RATE_ADAPTATION,
45 };
46 --- a/drivers/net/ethernet/mscc/ocelot.c
47 +++ b/drivers/net/ethernet/mscc/ocelot.c
48 @@ -409,32 +409,27 @@ static u16 ocelot_wm_enc(u16 value)
49 void ocelot_adjust_link(struct ocelot *ocelot, int port,
50 struct phy_device *phydev)
51 {
52 - int speed, mac_speed, mac_mode = DEV_MAC_MODE_CFG_FDX_ENA;
53 struct ocelot_port *ocelot_port = ocelot->ports[port];
54 + int speed, mode = 0;
55
56 - if (ocelot->quirks & OCELOT_PCS_PERFORMS_RATE_ADAPTATION)
57 - speed = SPEED_1000;
58 - else
59 - speed = phydev->speed;
60 -
61 - switch (speed) {
62 + switch (phydev->speed) {
63 case SPEED_10:
64 - mac_speed = OCELOT_SPEED_10;
65 + speed = OCELOT_SPEED_10;
66 break;
67 case SPEED_100:
68 - mac_speed = OCELOT_SPEED_100;
69 + speed = OCELOT_SPEED_100;
70 break;
71 case SPEED_1000:
72 - mac_speed = OCELOT_SPEED_1000;
73 - mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA;
74 + speed = OCELOT_SPEED_1000;
75 + mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA;
76 break;
77 case SPEED_2500:
78 - mac_speed = OCELOT_SPEED_2500;
79 - mac_mode |= DEV_MAC_MODE_CFG_GIGA_MODE_ENA;
80 + speed = OCELOT_SPEED_2500;
81 + mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA;
82 break;
83 default:
84 dev_err(ocelot->dev, "Unsupported PHY speed on port %d: %d\n",
85 - port, speed);
86 + port, phydev->speed);
87 return;
88 }
89
90 @@ -444,7 +439,8 @@ void ocelot_adjust_link(struct ocelot *o
91 return;
92
93 /* Only full duplex supported for now */
94 - ocelot_port_writel(ocelot_port, mac_mode, DEV_MAC_MODE_CFG);
95 + ocelot_port_writel(ocelot_port, DEV_MAC_MODE_CFG_FDX_ENA |
96 + mode, DEV_MAC_MODE_CFG);
97
98 if (ocelot->ops->pcs_init)
99 ocelot->ops->pcs_init(ocelot, port);
100 @@ -455,11 +451,11 @@ void ocelot_adjust_link(struct ocelot *o
101
102 /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of
103 * reset */
104 - ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(mac_speed),
105 + ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
106 DEV_CLOCK_CFG);
107
108 /* No PFC */
109 - ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(mac_speed),
110 + ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
111 ANA_PFC_PFC_CFG, port);
112
113 /* Core: Enable port for frame transfer */
114 @@ -473,7 +469,7 @@ void ocelot_adjust_link(struct ocelot *o
115 SYS_MAC_FC_CFG_RX_FC_ENA | SYS_MAC_FC_CFG_TX_FC_ENA |
116 SYS_MAC_FC_CFG_ZERO_PAUSE_ENA |
117 SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) |
118 - SYS_MAC_FC_CFG_FC_LINK_SPEED(mac_speed),
119 + SYS_MAC_FC_CFG_FC_LINK_SPEED(speed),
120 SYS_MAC_FC_CFG, port);
121 ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
122 }
123 --- a/include/soc/mscc/ocelot.h
124 +++ b/include/soc/mscc/ocelot.h
125 @@ -404,11 +404,6 @@ enum ocelot_tag_prefix {
126 OCELOT_TAG_PREFIX_LONG,
127 };
128
129 -/* Hardware quirks (differences between switch instantiations) */
130 -enum {
131 - OCELOT_PCS_PERFORMS_RATE_ADAPTATION = BIT(0),
132 -};
133 -
134 struct ocelot;
135
136 struct ocelot_ops {
137 @@ -469,8 +464,6 @@ struct ocelot {
138 struct delayed_work stats_work;
139 struct workqueue_struct *stats_queue;
140
141 - unsigned long quirks;
142 -
143 u8 ptp:1;
144 struct ptp_clock *ptp_clock;
145 struct ptp_clock_info ptp_info;