[oe-commits] Mario Schuknecht : linux-2.6.24: phy handling fixed for hipox machine

git version control git at git.openembedded.org
Wed Feb 16 12:09:26 UTC 2011


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 37832a34748ad96888137c2901289cd519be09a0
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=37832a34748ad96888137c2901289cd519be09a0

Author: Mario Schuknecht <m.schuknecht at dresearch.de>
Date:   Tue Feb  1 13:34:47 2011 +0000

linux-2.6.24: phy handling fixed for hipox machine

* phy switching enabled
* link status handling fixed

Signed-off-by: Mario Schuknecht <m.schuknecht at dresearch.de>
Acked-by: Steffen Sledz <sledz at dresearch.de>

---

 recipes/linux/linux-2.6.24/hipox/hipox-phy.patch |   90 ++++++++++++++++++++++
 recipes/linux/linux_2.6.24.bb                    |    1 +
 2 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/recipes/linux/linux-2.6.24/hipox/hipox-phy.patch b/recipes/linux/linux-2.6.24/hipox/hipox-phy.patch
new file mode 100644
index 0000000..156e31c
--- /dev/null
+++ b/recipes/linux/linux-2.6.24/hipox/hipox-phy.patch
@@ -0,0 +1,90 @@
+diff -Nurd linux-2.6.24.orig/arch/arm/mach-hipox/gmac-napi.c linux-2.6.24/arch/arm/mach-hipox/gmac-napi.c
+--- linux-2.6.24.orig/arch/arm/mach-hipox/gmac-napi.c	2011-02-07 13:19:51.000000000 +0100
++++ linux-2.6.24/arch/arm/mach-hipox/gmac-napi.c	2011-02-07 12:47:23.000000000 +0100
+@@ -2290,7 +2290,7 @@
+     }
+ 
+     // Power down the PHY
+-    phy_powerdown(dev);
++//    phy_powerdown(dev);
+ }
+ 
+ static int stop(struct net_device *dev)
+@@ -2489,6 +2489,10 @@
+     } else {
+         DBG(1, KERN_INFO "open() %s: PHY in 1000Mb mode\n", dev->name);
+     }
++
++    // MST 7.2.2011: On hipox board OXE is directly connected (full duplex) with the switch.
++    priv->mii.full_duplex = 1;
++
+     if (priv->mii.full_duplex) {
+         reg_contents |= (1UL << MAC_CONFIG_DM_BIT);
+     }
+@@ -2705,8 +2709,8 @@
+                            (1UL << DMA_INT_ENABLE_TS_BIT)));
+ 
+     // (Re)start the link/PHY state monitoring timer
+-    start_watchdog_timer(priv);
+-
++//    start_watchdog_timer(priv);
++    netif_carrier_on(priv->mii.dev);
+     // Allow the network stack to call hard_start_xmit()
+     netif_start_queue(dev);
+ 
+@@ -2937,11 +2941,11 @@
+ 
+     // Reset the PHY to get it into a known state and ensure we have TX/RX clocks
+     // to allow the GMAC reset to complete
+-    if (phy_reset(priv->netdev)) {
+-        DBG(1, KERN_ERR "open() %s: Failed to reset PHY\n", dev->name);
+-        status = -EIO;
+-        goto open_err_out;
+-    }
++//    if (phy_reset(priv->netdev)) {
++//        DBG(1, KERN_ERR "open() %s: Failed to reset PHY\n", dev->name);
++//        status = -EIO;
++//        goto open_err_out;
++//    }
+ 
+ 	// Set PHY specfic features
+ 	initialise_phy(priv);
+@@ -3282,6 +3286,19 @@
+ }
+ #endif // CONFIG_NET_POLL_CONTROLLER
+ 
++static int hipox_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
++{
++    gmac_priv_t* priv = netdev_priv(netdev);
++
++    if(netif_carrier_ok(netdev))
++    {
++        printk("hipox_do_ioctl() %s phy_id: %d reg: %d val: 0x%X\n", netdev->name, if_mii(ifr)->phy_id, if_mii(ifr)->reg_num, if_mii(ifr)->val_in);
++        return generic_mii_ioctl(&priv->mii, if_mii(ifr), cmd, NULL);
++    }
++    printk(KERN_WARNING "hipox_do_ioctl() gmac is down\n");
++    return -ENETDOWN; 
++}
++
+ static int probe(
+     struct net_device *netdev,
+     u32                vaddr,
+@@ -3410,6 +3427,7 @@
+     netdev->stop               = &stop;
+     netdev->get_stats          = &get_stats;
+     netdev->change_mtu         = &change_mtu;
++    netdev->do_ioctl           = hipox_do_ioctl;
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+     netdev->poll_controller    = &netpoll;
+ #endif // CONFIG_NET_POLL_CONTROLLER
+@@ -3446,8 +3464,8 @@
+     priv->mii.reg_num_mask  = 0x1f;
+     priv->mii.force_media   = 0;
+     priv->mii.full_duplex   = 1;
+-    priv->mii.using_100     = 0;
+-    priv->mii.using_1000    = 1;
++    priv->mii.using_100     = 1;
++    priv->mii.using_1000    = 0;
+ 	priv->mii.using_pause   = 1;
+     priv->mii.dev           = netdev;
+     priv->mii.mdio_read     = phy_read;
diff --git a/recipes/linux/linux_2.6.24.bb b/recipes/linux/linux_2.6.24.bb
index bfcdda9..d03d2b7 100644
--- a/recipes/linux/linux_2.6.24.bb
+++ b/recipes/linux/linux_2.6.24.bb
@@ -103,6 +103,7 @@ SRC_URI_append_hipox = " \
 	file://ox810-gmac-without-leon.patch \
 	file://hipox-poe-enable.patch \
 	file://siocoutqsnd.patch \
+	file://hipox-phy.patch \
 	"
 
 EXTRA_OEMAKE_smartq5 = " OBJCOPY=${OBJCOPY}"





More information about the Openembedded-commits mailing list