[OpenWrt-Devel] [PATCH v3 2/7] ath79: dev-eth: initialize clock for id 0 on AR934X

Guenther Kelleter Guenther.Kelleter at devolo.de
Thu Jul 9 07:39:47 EDT 2015


Hi

> -----Original Message-----
> From: John Crispin [mailto:blogic at openwrt.org]
> Sent: Thursday, July 09, 2015 8:32 AM
> To: Guenther Kelleter; openwrt-devel at lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH v3 2/7] ath79: dev-eth: initialize clock
> for id 0 on AR934X
> 
> Hi,
> 
> looking closer at the code i noticed that you need to do this as
> ath79_mdio1_data is not initialized to 0 properly. the reason being that it is
> not static and that in turn is because the header file declares it as extern
> yet there are no users.
> 
> i would suggest you drop this patch and instead make ath79_mdio1_data static
> and remove the prototype from the header file. that should have the same
> effect and will make sure ath79_mdio1_data is properly initialized.


Static or not doesn't change initialization here. ath79_mdio1_data will be in BSS and initialized to 0. And arch/mips/ath79/mach-mynet-n750.c uses ath79_mdio0_data so this cannot be changed to static.
I can remove mdio_data->builtin_switch = 0 though since that's implicit.

The important part of the patch is initializing the *_clock members (that's what I thought before).
But I checked it again without this patch, and now it looks as if it's working.

Günther

> 
> please also fix ath79_mdio0_data while at it.
> 
> 	John
> 
> On 07/07/2015 14:58, Günther Kelleter wrote:
> > Signed-off-by: Günther Kelleter <guenther.kelleter at devolo.de>
> > ---
> >  target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> > b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> > index ff94e2e..c7524be 100644
> > --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> > +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
> > @@ -251,9 +251,11 @@ void __init ath79_register_mdio(unsigned int id, u32
> phy_mask)
> >  	case ATH79_SOC_AR9344:
> >  		if (id == 1) {
> >  			mdio_data->builtin_switch = 1;
> > -			mdio_data->ref_clock = ar934x_get_mdio_ref_clock();
> > -			mdio_data->mdio_clock = 6250000;
> > +		} else {
> > +			mdio_data->builtin_switch = 0;
> >  		}	
> > +		mdio_data->ref_clock = ar934x_get_mdio_ref_clock();
> > +		mdio_data->mdio_clock = 6250000;
> >  		mdio_data->is_ar934x = 1;
> >  		break;
> >
> >
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list