summaryrefslogtreecommitdiff
path: root/multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch
diff options
context:
space:
mode:
Diffstat (limited to 'multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch')
-rw-r--r--multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch
new file mode 100644
index 0000000..2ef39a9
--- /dev/null
+++ b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd2/linux-2.6.39.4-macb-force-link.patch
@@ -0,0 +1,87 @@
+Index: linux-2.6.39.4/drivers/net/macb.c
+===================================================================
+--- linux-2.6.39.4.orig/drivers/net/macb.c 2011-08-03 14:43:28.000000000 -0500
++++ linux-2.6.39.4/drivers/net/macb.c 2013-03-12 15:31:34.710687318 -0500
+@@ -193,7 +193,9 @@
+ struct eth_platform_data *pdata;
+ int ret;
+
+- phydev = phy_find_first(bp->mii_bus);
++ // MTR2: use phy 5
++ //phydev = phy_find_first(bp->mii_bus);
++ phydev = bp->mii_bus->phy_map[5];
+ if (!phydev) {
+ printk (KERN_ERR "%s: no PHY found\n", dev->name);
+ return -1;
+@@ -203,14 +205,19 @@
+ /* TODO : add pin_irq */
+
+ /* attach the mac to the phy */
+- ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0,
++ // MTR2: attach directly to phy and set link state ourselves
++ //ret = phy_connect_direct(dev, phydev, &macb_handle_link_change, 0,
++ phy_attach(dev, dev_name(&phydev->dev), 0,
+ pdata && pdata->is_rmii ?
+ PHY_INTERFACE_MODE_RMII :
+ PHY_INTERFACE_MODE_MII);
++
++ /*
+ if (ret) {
+ printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
+ return ret;
+ }
++ */
+
+ /* mask with MAC supported features */
+ phydev->supported &= PHY_BASIC_FEATURES;
+@@ -942,6 +949,7 @@
+ {
+ struct macb *bp = netdev_priv(dev);
+ int err;
++ unsigned long flags;
+
+ dev_dbg(&bp->pdev->dev, "open\n");
+
+@@ -966,8 +974,19 @@
+ macb_init_hw(bp);
+
+ /* schedule a link state check */
+- phy_start(bp->phy_dev);
++ // MTR2: disable link updates
++ //phy_start(bp->phy_dev);
++
++ // MTR2: force link up, 100MB, full duplex
++ printk(KERN_INFO "macb: forcing link to 100, full\n");
++ bp->phy_dev->link = 1;
++ bp->phy_dev->speed = SPEED_100;
++ bp->phy_dev->duplex = 1;
++ macb_handle_link_change(bp->dev);
+
++ spin_lock_irqsave(&bp->lock, flags);
++ netif_carrier_on(dev);
++ spin_unlock_irqrestore(&bp->lock, flags);
+ netif_start_queue(dev);
+
+ return 0;
+@@ -981,8 +1000,19 @@
+ netif_stop_queue(dev);
+ napi_disable(&bp->napi);
+
+- if (bp->phy_dev)
+- phy_stop(bp->phy_dev);
++ // MTR2: disabled since we didn't call phy_start
++ //if (bp->phy_dev)
++ // phy_stop(bp->phy_dev);
++
++ // MTR2: set link down manually
++ if (bp->phy_dev) {
++ printk(KERN_INFO "macb: forcing link down\n");
++ bp->phy_dev->link = 0;
++ bp->phy_dev->speed = 0;
++ bp->phy_dev->duplex = -1;
++ }
++
++ macb_handle_link_change(bp->dev);
+
+ spin_lock_irqsave(&bp->lock, flags);
+ macb_reset_hw(bp);