[U-Boot] [PATCH] mmc: access mxcmmc from mx31 boards

Stefano Babic sbabic at denx.de
Tue Oct 25 11:43:49 CEST 2011


On 10/24/2011 06:45 PM, Helmut Raiger wrote:
> This patch modifies mxcmmc.c to be used
> not only by i.MX27 but also by i.MX31 boards.
> Both use the same SD controller, but have different
> clock set-ups.
> The clock access was renamed to imx_get_mmcclk() to
> allow both architectures to provide their respective
> clock. Pins, base address and prototypes for board_init_mmc()
> are provided.
> 
> Signed-off-by: Helmut Raiger <helmut.raiger at hale.at>
> ---
>  arch/arm/cpu/arm1136/mx31/generic.c        |    5 +++++
>  arch/arm/include/asm/arch-mx27/clock.h     |    1 +
>  arch/arm/include/asm/arch-mx31/clock.h     |    1 +
>  arch/arm/include/asm/arch-mx31/imx-regs.h  |   11 +++++++++++
>  arch/arm/include/asm/arch-mx31/sys_proto.h |    3 ++-
>  drivers/mmc/mxcmmc.c                       |    8 +++-----
>  6 files changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c
> index 7ab5631..3008099 100644
> --- a/arch/arm/cpu/arm1136/mx31/generic.c
> +++ b/arch/arm/cpu/arm1136/mx31/generic.c
> @@ -99,6 +99,11 @@ u32 imx_get_uartclk(void)
>  	return mxc_get_clock(MXC_UART_CLK);
>  }
>  
> +u32 imx_get_mmcclk(void)
> +{
> +	return mxc_get_clock(MXC_IPG_PERCLK);
> +}

This introduces a new function and does not use the mxc_get_clock() that
hides the specific implementation for each SOC (if any).

The common way to get a clock for a i.MX SOC is to call the
mxc_get_clock() passing as parameter the peripheral (in this case, the
MMC) you need. In this way we hide if a SOC is using perclk and another
one perclk2 or maybe something else. We have MXC_CSPI_CLK, MXC_UART_CLK,
MXC_FEC_CLK,MXC_USB_CLK.

There is already MXC_ESDHC_CLK (check in the mx35 directory). Please use
the same interface and add only the case for MXC_ESDHC_CLK to the SOC
you requires.

> +
>  void mx31_gpio_mux(unsigned long mode)
>  {
>  	unsigned long reg, shift, tmp;
> diff --git a/arch/arm/include/asm/arch-mx27/clock.h b/arch/arm/include/asm/arch-mx27/clock.h
> index 7e9c7aa..2c078d5 100644
> --- a/arch/arm/include/asm/arch-mx27/clock.h
> +++ b/arch/arm/include/asm/arch-mx27/clock.h
> @@ -38,5 +38,6 @@ ulong imx_get_ahbclk(void);
>  
>  #define imx_get_uartclk imx_get_perclk1
>  #define imx_get_fecclk imx_get_ahbclk
> +#define imx_get_mmcclk imx_get_perclk2

also for i.mx27 we should call mxc_get_clk()

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list