27 #include <linux/kernel.h>
28 #include <linux/netdevice.h>
48 static int number_rgmii_ports;
53 unsigned long flags = 0;
55 int use_global_register_lock = (priv->
phydev ==
NULL);
58 if (use_global_register_lock) {
84 gmxx_rxx_int_reg.
u64 =
85 cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
87 if (gmxx_rxx_int_reg.s.pcterr) {
101 gmxx_rxx_frm_ctl.
u64 =
102 cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL
104 gmxx_rxx_frm_ctl.s.pre_chk = 0;
105 cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL
107 gmxx_rxx_frm_ctl.u64);
110 ipd_sub_port_fcs.u64 =
112 ipd_sub_port_fcs.s.port_bit &=
113 0xffffffffull ^ (1ull << priv->
port);
115 ipd_sub_port_fcs.u64);
118 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG
120 gmxx_rxx_int_reg.u64);
122 "preamble removal\n",
127 if (use_global_register_lock)
128 spin_unlock_irqrestore(&global_register_lock, flags);
147 gmxx_rxx_frm_ctl.u64 =
148 cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index,
interface));
149 gmxx_rxx_frm_ctl.s.pre_chk = 1;
150 cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(index,
interface),
151 gmxx_rxx_frm_ctl.u64);
154 ipd_sub_port_fcs.s.port_bit |= 1ull << priv->
port;
157 gmxx_rxx_int_reg.u64 =
158 cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(index,
interface));
159 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index,
interface),
160 gmxx_rxx_int_reg.u64);
167 if (use_global_register_lock)
168 spin_unlock_irqrestore(&global_register_lock, flags);
175 if (link_info.
s.link_up) {
176 if (!netif_carrier_ok(dev))
178 if (priv->
queue != -1)
180 "port %2d, queue %2d\n",
181 dev->
name, link_info.
s.speed,
182 (link_info.
s.full_duplex) ?
188 dev->
name, link_info.
s.speed,
189 (link_info.
s.full_duplex) ?
193 if (netif_carrier_ok(dev))
209 if (rsl_int_blocks.s.gmx0) {
220 cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
222 gmx_rx_int_reg.u64 &=
223 cvmx_read_csr(CVMX_GMXX_RXX_INT_EN
226 if (gmx_rx_int_reg.s.phy_dupx
227 || gmx_rx_int_reg.s.phy_link
228 || gmx_rx_int_reg.s.phy_spd) {
238 gmx_rx_int_reg.u64 = 0;
239 gmx_rx_int_reg.s.phy_dupx = 1;
240 gmx_rx_int_reg.s.phy_link = 1;
241 gmx_rx_int_reg.s.phy_spd = 1;
242 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG
251 if (rsl_int_blocks.s.gmx1) {
262 cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
264 gmx_rx_int_reg.u64 &=
265 cvmx_read_csr(CVMX_GMXX_RXX_INT_EN
268 if (gmx_rx_int_reg.s.phy_dupx
269 || gmx_rx_int_reg.s.phy_link
270 || gmx_rx_int_reg.s.phy_spd) {
280 gmx_rx_int_reg.u64 = 0;
281 gmx_rx_int_reg.s.phy_dupx = 1;
282 gmx_rx_int_reg.s.phy_link = 1;
283 gmx_rx_int_reg.s.phy_spd = 1;
284 cvmx_write_csr(CVMX_GMXX_RXX_INT_REG
291 return return_status;
299 int index =
INDEX(priv->port);
302 gmx_cfg.
u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index,
interface));
304 cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index,
interface), gmx_cfg.
u64);
308 if (!link_info.
s.link_up)
320 int index =
INDEX(priv->port);
322 gmx_cfg.
u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index,
interface));
324 cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index,
interface), gmx_cfg.
u64);
350 if (number_rgmii_ports == 0) {
356 number_rgmii_ports++;
363 && (priv->
port == 0))
370 int index =
INDEX(priv->port);
377 cvmx_read_csr(CVMX_GMXX_RXX_INT_EN
379 gmx_rx_int_en.
s.phy_dupx = 1;
380 gmx_rx_int_en.
s.phy_link = 1;
381 gmx_rx_int_en.
s.phy_spd = 1;
382 cvmx_write_csr(CVMX_GMXX_RXX_INT_EN(index,
interface),
384 priv->poll = cvm_oct_rgmii_poll;
401 && (priv->
port == 0))
408 int index =
INDEX(priv->port);
415 cvmx_read_csr(CVMX_GMXX_RXX_INT_EN
417 gmx_rx_int_en.
s.phy_dupx = 0;
418 gmx_rx_int_en.
s.phy_link = 0;
419 gmx_rx_int_en.
s.phy_spd = 0;
420 cvmx_write_csr(CVMX_GMXX_RXX_INT_EN(index,
interface),
426 number_rgmii_ports--;
427 if (number_rgmii_ports == 0)