Patchwork [U-Boot] mx6qsabresd: Fix mmc boot by making USDHC3 be 'dev 0'

login
register
mail settings
Submitter Fabio Estevam
Date Jan. 10, 2013, 2:32 p.m.
Message ID <1357828345-9076-1-git-send-email-fabio.estevam@freescale.com>
Download mbox | patch
Permalink /patch/211020/
State Changes Requested
Delegated to: Stefano Babic
Headers show

Comments

Fabio Estevam - Jan. 10, 2013, 2:32 p.m.
By default, we boot from USDHC3 on mx6qsabresd, so let it be mmc dev 0.

Without this fix kernel cannot be retrieved from mmc with the default 
environment.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 board/freescale/mx6qsabresd/mx6qsabresd.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Benoît Thébaudeau - Jan. 10, 2013, 2:43 p.m.
Hi Fabio,

On Thursday, January 10, 2013 3:32:25 PM, Fabio Estevam wrote:
> By default, we boot from USDHC3 on mx6qsabresd, so let it be mmc dev
> 0.
> 
> Without this fix kernel cannot be retrieved from mmc with the default
> environment.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  board/freescale/mx6qsabresd/mx6qsabresd.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c
> b/board/freescale/mx6qsabresd/mx6qsabresd.c
> index 65c4a1a..fbcb6cd 100644
> --- a/board/freescale/mx6qsabresd/mx6qsabresd.c
> +++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
> @@ -134,8 +134,8 @@ static void setup_iomux_uart(void)
>  
>  #ifdef CONFIG_FSL_ESDHC
>  struct fsl_esdhc_cfg usdhc_cfg[3] = {
> -	{USDHC2_BASE_ADDR},
>  	{USDHC3_BASE_ADDR},
> +	{USDHC2_BASE_ADDR},
>  	{USDHC4_BASE_ADDR},
>  };
>  
> @@ -162,13 +162,13 @@ int board_mmc_init(bd_t *bis)
>  
>  	for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
>  		switch (i) {
> -		case 0:
> +		case 1:
>  			imx_iomux_v3_setup_multiple_pads(
>  				usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
>  			gpio_direction_input(USDHC2_CD_GPIO);
>  			usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
                                  ^ should be changed to 1 or i

>  			break;
> -		case 1:
> +		case 0:
>  			imx_iomux_v3_setup_multiple_pads(
>  				usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
>  			gpio_direction_input(USDHC3_CD_GPIO);

Ditto (with 0 or i) for the following hidden lines.

Best regards,
Benoît
Fabio Estevam - Jan. 10, 2013, 3:44 p.m.
Hi Benoît,

On Thu, Jan 10, 2013 at 12:43 PM, Benoît Thébaudeau
<benoit.thebaudeau@advansee.com> wrote:

>>               switch (i) {
>> -             case 0:
>> +             case 1:
>>                       imx_iomux_v3_setup_multiple_pads(
>>                               usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
>>                       gpio_direction_input(USDHC2_CD_GPIO);
>>                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
>                                   ^ should be changed to 1 or i

Good catch, thanks.

I just found out a proper fix for this and will submit shortly.

Regards,

Fabio Estevam

Patch

diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c b/board/freescale/mx6qsabresd/mx6qsabresd.c
index 65c4a1a..fbcb6cd 100644
--- a/board/freescale/mx6qsabresd/mx6qsabresd.c
+++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
@@ -134,8 +134,8 @@  static void setup_iomux_uart(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg usdhc_cfg[3] = {
-	{USDHC2_BASE_ADDR},
 	{USDHC3_BASE_ADDR},
+	{USDHC2_BASE_ADDR},
 	{USDHC4_BASE_ADDR},
 };
 
@@ -162,13 +162,13 @@  int board_mmc_init(bd_t *bis)
 
 	for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
 		switch (i) {
-		case 0:
+		case 1:
 			imx_iomux_v3_setup_multiple_pads(
 				usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
 			gpio_direction_input(USDHC2_CD_GPIO);
 			usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
 			break;
-		case 1:
+		case 0:
 			imx_iomux_v3_setup_multiple_pads(
 				usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
 			gpio_direction_input(USDHC3_CD_GPIO);