aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r--drivers/net/gianfar.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4ae1d259fced..e212f2c5448b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -156,6 +156,8 @@ static const struct net_device_ops gfar_netdev_ops = {
156 .ndo_tx_timeout = gfar_timeout, 156 .ndo_tx_timeout = gfar_timeout,
157 .ndo_do_ioctl = gfar_ioctl, 157 .ndo_do_ioctl = gfar_ioctl,
158 .ndo_vlan_rx_register = gfar_vlan_rx_register, 158 .ndo_vlan_rx_register = gfar_vlan_rx_register,
159 .ndo_set_mac_address = eth_mac_addr,
160 .ndo_validate_addr = eth_validate_addr,
159#ifdef CONFIG_NET_POLL_CONTROLLER 161#ifdef CONFIG_NET_POLL_CONTROLLER
160 .ndo_poll_controller = gfar_netpoll, 162 .ndo_poll_controller = gfar_netpoll,
161#endif 163#endif
@@ -262,15 +264,6 @@ static int gfar_of_init(struct net_device *dev)
262 priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET; 264 priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
263 265
264 priv->phy_node = of_parse_phandle(np, "phy-handle", 0); 266 priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
265 if (!priv->phy_node) {
266 u32 *fixed_link;
267
268 fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
269 if (!fixed_link) {
270 err = -ENODEV;
271 goto err_out;
272 }
273 }
274 267
275 /* Find the TBI PHY. If it's not there, we don't support SGMII */ 268 /* Find the TBI PHY. If it's not there, we don't support SGMII */
276 priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0); 269 priv->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
@@ -657,13 +650,14 @@ static int init_phy(struct net_device *dev)
657 650
658 interface = gfar_get_interface(dev); 651 interface = gfar_get_interface(dev);
659 652
660 if (priv->phy_node) { 653 priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 0,
661 priv->phydev = of_phy_connect(dev, priv->phy_node, &adjust_link, 654 interface);
662 0, interface); 655 if (!priv->phydev)
663 if (!priv->phydev) { 656 priv->phydev = of_phy_connect_fixed_link(dev, &adjust_link,
664 dev_err(&dev->dev, "error: Could not attach to PHY\n"); 657 interface);
665 return -ENODEV; 658 if (!priv->phydev) {
666 } 659 dev_err(&dev->dev, "could not attach to PHY\n");
660 return -ENODEV;
667 } 661 }
668 662
669 if (interface == PHY_INTERFACE_MODE_SGMII) 663 if (interface == PHY_INTERFACE_MODE_SGMII)
@@ -942,6 +936,7 @@ int startup_gfar(struct net_device *dev)
942 struct gfar __iomem *regs = priv->regs; 936 struct gfar __iomem *regs = priv->regs;
943 int err = 0; 937 int err = 0;
944 u32 rctrl = 0; 938 u32 rctrl = 0;
939 u32 tctrl = 0;
945 u32 attrs = 0; 940 u32 attrs = 0;
946 941
947 gfar_write(&regs->imask, IMASK_INIT_CLEAR); 942 gfar_write(&regs->imask, IMASK_INIT_CLEAR);
@@ -1117,11 +1112,19 @@ int startup_gfar(struct net_device *dev)
1117 rctrl |= RCTRL_PADDING(priv->padding); 1112 rctrl |= RCTRL_PADDING(priv->padding);
1118 } 1113 }
1119 1114
1115 /* keep vlan related bits if it's enabled */
1116 if (priv->vlgrp) {
1117 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
1118 tctrl |= TCTRL_VLINS;
1119 }
1120
1120 /* Init rctrl based on our settings */ 1121 /* Init rctrl based on our settings */
1121 gfar_write(&priv->regs->rctrl, rctrl); 1122 gfar_write(&priv->regs->rctrl, rctrl);
1122 1123
1123 if (dev->features & NETIF_F_IP_CSUM) 1124 if (dev->features & NETIF_F_IP_CSUM)
1124 gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); 1125 tctrl |= TCTRL_INIT_CSUM;
1126
1127 gfar_write(&priv->regs->tctrl, tctrl);
1125 1128
1126 /* Set the extraction length and index */ 1129 /* Set the extraction length and index */
1127 attrs = ATTRELI_EL(priv->rx_stash_size) | 1130 attrs = ATTRELI_EL(priv->rx_stash_size) |
@@ -1456,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
1456 1459
1457 /* Enable VLAN tag extraction */ 1460 /* Enable VLAN tag extraction */
1458 tempval = gfar_read(&priv->regs->rctrl); 1461 tempval = gfar_read(&priv->regs->rctrl);
1459 tempval |= RCTRL_VLEX;
1460 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); 1462 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT);
1461 gfar_write(&priv->regs->rctrl, tempval); 1463 gfar_write(&priv->regs->rctrl, tempval);
1462 } else { 1464 } else {