aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2007-07-11 12:43:07 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-18 18:29:37 -0400
commit7132ab7f6e0309bb8e0424e395ba149aee0c750e (patch)
treeb947434ef6edefdbe683b4a6c5740ccec977bc4e
parentaf2d940df2b60b15c271033d381c2f3ead655562 (diff)
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 <afleming@freescale.com>
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c9
-rw-r--r--drivers/net/gianfar.c12
-rw-r--r--include/linux/fsl_devices.h1
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index c0ddc80d8160..3289fab01e92 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)
197 struct gianfar_platform_data gfar_data; 197 struct gianfar_platform_data gfar_data;
198 const unsigned int *id; 198 const unsigned int *id;
199 const char *model; 199 const char *model;
200 const char *ctype;
200 const void *mac_addr; 201 const void *mac_addr;
201 const phandle *ph; 202 const phandle *ph;
202 int n_res = 2; 203 int n_res = 2;
@@ -254,6 +255,14 @@ static int __init gfar_of_init(void)
254 FSL_GIANFAR_DEV_HAS_VLAN | 255 FSL_GIANFAR_DEV_HAS_VLAN |
255 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 256 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
256 257
258 ctype = of_get_property(np, "phy-connection-type", NULL);
259
260 /* We only care about rgmii-id. The rest are autodetected */
261 if (ctype && !strcmp(ctype, "rgmii-id"))
262 gfar_data.interface = PHY_INTERFACE_MODE_RGMII_ID;
263 else
264 gfar_data.interface = PHY_INTERFACE_MODE_MII;
265
257 ph = of_get_property(np, "phy-handle", NULL); 266 ph = of_get_property(np, "phy-handle", NULL);
258 phy = of_find_node_by_phandle(*ph); 267 phy = of_find_node_by_phandle(*ph);
259 268
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index d7a1a58de766..f92690555dd9 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)
420 if (ecntrl & ECNTRL_REDUCED_MODE) { 420 if (ecntrl & ECNTRL_REDUCED_MODE) {
421 if (ecntrl & ECNTRL_REDUCED_MII_MODE) 421 if (ecntrl & ECNTRL_REDUCED_MII_MODE)
422 return PHY_INTERFACE_MODE_RMII; 422 return PHY_INTERFACE_MODE_RMII;
423 else 423 else {
424 phy_interface_t interface = priv->einfo->interface;
425
426 /*
427 * This isn't autodetected right now, so it must
428 * be set by the device tree or platform code.
429 */
430 if (interface == PHY_INTERFACE_MODE_RGMII_ID)
431 return PHY_INTERFACE_MODE_RGMII_ID;
432
424 return PHY_INTERFACE_MODE_RGMII; 433 return PHY_INTERFACE_MODE_RGMII;
434 }
425 } 435 }
426 436
427 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT) 437 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 695741b0e420..1831b196c70a 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -53,6 +53,7 @@ struct gianfar_platform_data {
53 u32 bus_id; 53 u32 bus_id;
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface;
56}; 57};
57 58
58struct gianfar_mdio_data { 59struct gianfar_mdio_data {