]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Fix RGMII-ID handling in gianfar
authorAndy Fleming <afleming@freescale.com>
Wed, 11 Jul 2007 16:43:07 +0000 (11:43 -0500)
committerJeff Garzik <jeff@garzik.org>
Wed, 18 Jul 2007 22:29:37 +0000 (18:29 -0400)
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 <afleming@freescale.com>
arch/powerpc/sysdev/fsl_soc.c
drivers/net/gianfar.c
include/linux/fsl_devices.h

index c0ddc80d8160452238bbf0de29cf23c24340785b..3289fab01e9245a49919a61d5ecdc285a2a49810 100644 (file)
@@ -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);
 
index d7a1a58de7669b3bfefbf062ccb0fd8d98ec60b9..f92690555dd9c0cd46c314e2e53e36c967e87cf3 100644 (file)
@@ -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)
index 695741b0e420c5865b7448de26551abac535efea..1831b196c70a9fe452fb37d605f8a8142b75e42d 100644 (file)
@@ -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 {