diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2010-09-30 09:15:03 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2010-10-20 02:27:18 -0500 |
commit | a1964ea5c25238fdad254dbe88d1e4ed9cd84061 (patch) | |
tree | a69b11d110cddfd003674577e199c847faa21eb3 /arch | |
parent | f8c42495e08b270dbeb47c5dd79e9564fa4b5ec2 (diff) |
powerpc/8xxx: Add fdt_fixup_phy_connection helper
Add a common helper that will set the PHY connection type based on enum.
We use this on eTSEC, UCC, and will with Fman in the future.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/cpu/mpc8xxx/fdt.c | 24 | ||||
-rw-r--r-- | arch/powerpc/include/asm/fsl_enet.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index 88c47d1aede..54e60bb1aef 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -27,6 +27,7 @@ #include <libfdt.h> #include <fdt_support.h> #include <asm/mp.h> +#include <asm/fsl_enet.h> #if defined(CONFIG_MP) && (defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)) static int ft_del_cpuhandle(void *blob, int cpuhandle) @@ -215,3 +216,26 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev) fdt_del_node_and_alias(blob, "crypto"); } #endif + +int fdt_fixup_phy_connection(void *blob, int offset, enum fsl_phy_enet_if phyc) +{ + static const char *fsl_phy_enet_if_str[] = { + [MII] = "mii", + [RMII] = "rmii", + [GMII] = "gmii", + [RGMII] = "rgmii", + [RGMII_ID] = "rgmii-id", + [RGMII_RXID] = "rgmii-rxid", + [SGMII] = "sgmii", + [TBI] = "tbi", + [RTBI] = "rtbi", + [XAUI] = "xgmii", + [FSL_ETH_IF_NONE] = "", + }; + + if (phyc > ARRAY_SIZE(fsl_phy_enet_if_str)) + return fdt_setprop_string(blob, offset, "phy-connection-type", ""); + + return fdt_setprop_string(blob, offset, "phy-connection-type", + fsl_phy_enet_if_str[phyc]); +} diff --git a/arch/powerpc/include/asm/fsl_enet.h b/arch/powerpc/include/asm/fsl_enet.h index 85961573ba3..4fb2857f3e5 100644 --- a/arch/powerpc/include/asm/fsl_enet.h +++ b/arch/powerpc/include/asm/fsl_enet.h @@ -28,4 +28,6 @@ enum fsl_phy_enet_if { FSL_ETH_IF_NONE, }; +int fdt_fixup_phy_connection(void *blob, int offset, enum fsl_phy_enet_if phyc); + #endif /* __ASM_PPC_FSL_ENET_H */ |