Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7132ab7f6e0309bb8e0424e395ba149aee0c750e
Commit:     7132ab7f6e0309bb8e0424e395ba149aee0c750e
Parent:     af2d940df2b60b15c271033d381c2f3ead655562
Author:     Andy Fleming <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 11 11:43:07 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 18:29:37 2007 -0400

    Fix RGMII-ID handling in gianfar
    
    The TSEC/eTSEC can detect the interface to the PHY automatically,
    but it isn't able to detect whether the RGMII connection needs internal
    delay.  So we need to detect that change in the device tree, propagate
    it to the platform data, and then check it if we're in RGMII.  This fixes
    a bug on the 8641D HPCN board where the Vitesse PHY doesn't use the delay
    for RGMII.
    
    Signed-off-by: Andy Fleming <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/fsl_soc.c |    9 +++++++++
 drivers/net/gianfar.c         |   12 +++++++++++-
 include/linux/fsl_devices.h   |    1 +
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index c0ddc80..3289fab 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -197,6 +197,7 @@ static int __init gfar_of_init(void)
                struct gianfar_platform_data gfar_data;
                const unsigned int *id;
                const char *model;
+               const char *ctype;
                const void *mac_addr;
                const phandle *ph;
                int n_res = 2;
@@ -254,6 +255,14 @@ static int __init gfar_of_init(void)
                            FSL_GIANFAR_DEV_HAS_VLAN |
                            FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
 
+               ctype = of_get_property(np, "phy-connection-type", NULL);
+
+               /* We only care about rgmii-id.  The rest are autodetected */
+               if (ctype && !strcmp(ctype, "rgmii-id"))
+                       gfar_data.interface = PHY_INTERFACE_MODE_RGMII_ID;
+               else
+                       gfar_data.interface = PHY_INTERFACE_MODE_MII;
+
                ph = of_get_property(np, "phy-handle", NULL);
                phy = of_find_node_by_phandle(*ph);
 
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d7a1a58..f926905 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -420,8 +420,18 @@ static phy_interface_t gfar_get_interface(struct 
net_device *dev)
        if (ecntrl & ECNTRL_REDUCED_MODE) {
                if (ecntrl & ECNTRL_REDUCED_MII_MODE)
                        return PHY_INTERFACE_MODE_RMII;
-               else
+               else {
+                       phy_interface_t interface = priv->einfo->interface;
+
+                       /*
+                        * This isn't autodetected right now, so it must
+                        * be set by the device tree or platform code.
+                        */
+                       if (interface == PHY_INTERFACE_MODE_RGMII_ID)
+                               return PHY_INTERFACE_MODE_RGMII_ID;
+
                        return PHY_INTERFACE_MODE_RGMII;
+               }
        }
 
        if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT)
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 695741b..1831b19 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -53,6 +53,7 @@ struct gianfar_platform_data {
        u32     bus_id;
        u32     phy_id;
        u8      mac_addr[6];
+       phy_interface_t interface;
 };
 
 struct gianfar_mdio_data {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to