[U-Boot] [PATCH 7/9] ARM: sunxi: Allow specifying module in prcm apb0 init function

Ian Campbell ijc at hellion.org.uk
Sat Oct 11 18:13:01 CEST 2014


On Sat, 2014-10-11 at 17:11 +0100, Ian Campbell wrote:
> On Tue, 2014-10-07 at 15:11 +0800, Chen-Yu Tsai wrote:
> > The prcm apb0 controls multiple modules. Allow specifying which
> > modules to enable clocks and de-assert resets so the function
> > can be reused.
> 
> How come this isn't actually called on sun6i?
> 
> (naughty of me not to notice this when it was submitted!)
> 
> Is it going to be called by anything in this series? I have a feeling
> this is a precursor for SPL which should have been left out of the sun6i
> series, but oh well what's done is done.
> 
> Without a caller it's hard to make a judgement call on parameters vs
> #ifdef in the function, although my inclination would generally be
> towards parameters, if there's just going to be an ifdef at the call
> site instead it's not really buying us much.

I should have read the next patch more carefully before commenting...

> > Signed-off-by: Chen-Yu Tsai <wens at csie.org>

Acked-by: Ian Campbell <ijc at hellion.org.uk>

> > ---
> >  arch/arm/cpu/armv7/sunxi/prcm.c        | 12 +++++++-----
> >  arch/arm/include/asm/arch-sunxi/prcm.h |  2 +-
> >  2 files changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/armv7/sunxi/prcm.c b/arch/arm/cpu/armv7/sunxi/prcm.c
> > index 7b3ee89..19b4938 100644
> > --- a/arch/arm/cpu/armv7/sunxi/prcm.c
> > +++ b/arch/arm/cpu/armv7/sunxi/prcm.c
> > @@ -21,13 +21,15 @@
> >  #include <asm/arch/prcm.h>
> >  #include <asm/arch/sys_proto.h>
> >  
> > -void prcm_init_apb0(void)
> > +/* APB0 clock gate and reset bit offsets are the same. */
> 
> Is this absolutely guaranteed?
> 
> > +void prcm_apb0_enable(u32 flags)
> >  {
> >  	struct sunxi_prcm_reg *prcm =
> >  		(struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
> >  
> > -	setbits_le32(&prcm->apb0_gate, PRCM_APB0_GATE_P2WI |
> > -				       PRCM_APB0_GATE_PIO);
> > -	setbits_le32(&prcm->apb0_reset, PRCM_APB0_RESET_P2WI |
> > -					PRCM_APB0_RESET_PIO);
> > +	/* open the clock for module */
> > +	setbits_le32(&prcm->apb0_gate, flags);
> > +
> > +	/* deassert reset for module */
> > +	setbits_le32(&prcm->apb0_reset, flags);
> >  }
> > diff --git a/arch/arm/include/asm/arch-sunxi/prcm.h b/arch/arm/include/asm/arch-sunxi/prcm.h
> > index 1b40f09..3d3bfa6 100644
> > --- a/arch/arm/include/asm/arch-sunxi/prcm.h
> > +++ b/arch/arm/include/asm/arch-sunxi/prcm.h
> > @@ -233,6 +233,6 @@ struct sunxi_prcm_reg {
> >  	u32 dram_tst;		/* 0x190 */
> >  };
> >  
> > -void prcm_init_apb0(void);
> > +void prcm_apb0_enable(u32 flags);
> >  #endif /* __ASSEMBLY__ */
> >  #endif /* _PRCM_H */
> 
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 




More information about the U-Boot mailing list