POWERPC: add support of the GiGE switch for mpc8313RDB via fixed PHY
PATCH 1/1 POWERPC: add support of the GiGE switch for mpc8313RDB via fixed PHY
This utilises pretend phy, making access to it via device tree. GiGE switch is connected to TSEC1 with fixed gigE link, so we need to emulate it via artificial PHY to make it work.
---
arch/powerpc/boot/dts/mpc8313erdb.dts | 1 + arch/powerpc/platforms/83xx/mpc8313_rdb.c | 43 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8313erdb.dts +1 -0
@@ -100,6 +100,7 @@ #size-cells = <0>; phy1: ethernet-phy@1 { interrupt-parent = < &ipic >; + compatible = "fixed"; interrupts = <13 8>; reg = <1>; device_type = "ethernet-phy";
arch/powerpc/platforms/83xx/mpc8313_rdb.c +43 -0
49 lines not on this page · raw message
Quoted 3 lines
This utilises pretend phy, making access to it via device tree. GiGE switch is connected to TSEC1 with fixed gigE link, so we need to emulate it via artificial PHY to make it work.
Even if "pretend phy" in the device tree would be a good idea (and it's not)...
arch/powerpc/boot/dts/mpc8313erdb.dts line 103
Quoted 4 lines
arch/powerpc/boot/dts/mpc8313erdb.dts +1
-0#size-cells = <0>; phy1: ethernet-phy@1 { interrupt-parent = < &ipic >; + compatible = "fixed";
...you cannot seriously believe you are allowed to claim the name "fixed" for it.
NAK.
Segher
This just comments on code style, not semantics... I agree with Segher that this isn't the way to do it.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 122
Quoted 5 lines · Vitaly Bordug
arch/powerpc/platforms/83xx/mpc8313_rdb.c +5
-0+#if defined(CONFIG_FIXED_MII_1000_FDX ) + +static int fixed_set_link (void ) +{ +struct fixed_info *phyinfo =fixed_mdio_get_phydev (0 );/* only one fixed phy on this platform */
Line length.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 138
Quoted 3 lines
arch/powerpc/platforms/83xx/mpc8313_rdb.c +3
-0+for (np =NULL , i =0 ; + (np =of_find_compatible_node (np,"mdio" ,"gianfar" )) !=NULL ; + i++) {
Can't we just initialize np and i above, and use a while loop?
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 140
Quoted 1 line
arch/powerpc/platforms/83xx/mpc8313_rdb.c +1
-0+memset (&res,0 ,sizeof (res));
Not necessary.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 145
Quoted 4 lines
arch/powerpc/platforms/83xx/mpc8313_rdb.c +4
-0+ ret =of_address_to_resource (np,0 , &res); +if (ret) +return ret; + child =of_find_compatible_node (np,"ethernet-phy" ,"fixed" );
Space after comma.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 148
Quoted 3 lines
arch/powerpc/platforms/83xx/mpc8313_rdb.c +3
-0+if (!child) +return -ENXIO ; + id = (u32 *)of_get_property (child,"reg" ,NULL );
Cast not required.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 151
Quoted 3 lines
arch/powerpc/platforms/83xx/mpc8313_rdb.c +3
-0+if (!id) +return -ENXIO ; +break ;
Why are you using a loop at all if there's a break at the end and no continue?
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 153
Quoted 2 lines
arch/powerpc/platforms/83xx/mpc8313_rdb.c +2
-0+ } +snprintf (phydev->dev.bus_id,BUS_ID_SIZE ,PHY_ID_FMT , res.start, *id);
Only one space before res.start.
arch/powerpc/platforms/83xx/mpc8313_rdb.c static int __init rtc_hookup(void) · line 154
Quoted 1 line
arch/powerpc/platforms/83xx/mpc8313_rdb.c +1
-0+memset (phyinfo->regs,0xff ,sizeof (phyinfo->regs[0 ])*phyinfo->regs_num);
Spaces after commas.
-Scott
Quoted 2 lines · On Tue, 17 Jul 2007 11:43:31 -0500 Scott Wood <[email protected]> wrote:
This just comments on code style, not semantics... I agree with Segher that this isn't the way to do it.
That's nm, I'll rather include specific field into mac node, so the function below will be rewritten.
Signature · 2 lines
Sincerely, Vitaly