[U-Boot] [PATCH 6/7] mx35: Fix eSDHC clocks

Benoît Thébaudeau benoit.thebaudeau at advansee.com
Mon Aug 20 14:27:21 CEST 2012


Hi Stefano,

> On 14/08/2012 22:33, Benoît Thébaudeau wrote:
> > Each eSDHC instance has a dedicated clock.
> > 
> > Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau at advansee.com>
> > Cc: Stefano Babic <sbabic at denx.de>
> > ---
> 
> Hi Benoît,
> 
> >  .../arch/arm/cpu/arm1136/mx35/generic.c            |   14
> >  ++++++++++++--
> >  .../arch/arm/include/asm/arch-mx35/clock.h         |    4 +++-
> >  2 files changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git u-boot-4d3c95f.orig/arch/arm/cpu/arm1136/mx35/generic.c
> > u-boot-4d3c95f/arch/arm/cpu/arm1136/mx35/generic.c
> > index 4af052c..15a0098 100644
> > --- u-boot-4d3c95f.orig/arch/arm/cpu/arm1136/mx35/generic.c
> > +++ u-boot-4d3c95f/arch/arm/cpu/arm1136/mx35/generic.c
> > @@ -368,8 +368,12 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
> >  		return get_ipg_per_clk();
> >  	case MXC_UART_CLK:
> >  		return imx_get_uartclk();
> > -	case MXC_ESDHC_CLK:
> > +	case MXC_ESDHC1_CLK:
> >  		return mxc_get_peri_clock(ESDHC1_CLK);
> > +	case MXC_ESDHC2_CLK:
> > +		return mxc_get_peri_clock(ESDHC2_CLK);
> > +	case MXC_ESDHC3_CLK:
> > +		return mxc_get_peri_clock(ESDHC3_CLK);
> >  	case MXC_USB_CLK:
> >  		return mxc_get_main_clock(USB_CLK);
> >  	case MXC_FEC_CLK:
> 
> Your change let understand that we can have different clocks among
> the
> ESDHC controllers.

Indeed.

> One thing is not clear to me is that the MX35 have
> two ESDHC controllers, and you define here a thitd one. Where is it ?

No, there are 3. See the reference manual. It's referenced in the memory map, in
the interrupts, in the pin multiplexing and in the clocks.

> Even if the two controllers can have different clocks, this is not
> supported by the driver. In fact, in drivers/mmc/fsl_esdhc.c:
> 
> int sdhc_clk = gd->sdhc_clk;
> 
> The driver uses always the same clock, stored in the global
> structure.
> Before extending the code as in this patch, the driver should be
> modified to handle separate clocks. Currently the driver supports
> multiple controller, but they share the same clock or at least the
> same
> frequency.

Indeed, I had seen that. I didn't know what to decide as to the driver clocks,
so I made this change to select the correct clock if a single clock or frequency
is used.

If several clock frequencies are to be supported at once, what kind of API would
you like? gd->sdhc_clk could be changed to an array, then the corresponding
index could be passed to the init function through the fsl_esdhc_cfg struct.

Best regards,
Benoît


More information about the U-Boot mailing list