i.MX6 SabreSD and SabreAUTO bmode support
cover i.MX6 SabreSD and SabreAUTO bmode support
This adds the bmode support for i.MX6 SabreSD and SabreAUTO boards. This allows user to choose the boot mode at runtime making it easy to boot from USB or other media.
Otavio Salvador (3):
mx6qsabresd: Fix card detection for invalid card id case
mx6qsabresd: Document the mapping of USDHC[2-4] mx6qsabre{sd,auto}: Add boot mode select
board/freescale/mx6qsabreauto/mx6qsabreauto.c | 17 ++++++++++++++++ board/freescale/mx6qsabresd/mx6qsabresd.c | 28 ++++++++++++++++++++++++++- include/configs/mx6qsabre_common.h | 4 +++- 3 files changed, 47 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.1
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
board/freescale/mx6qsabresd/mx6qsabresd.c +3 -1
@@ -151,9 +151,11 @@ int board_mmc_getcd(struct mmc *mmc)return !gpio_get_value (USDHC2_CD_GPIO );case USDHC3_BASE_ADDR :return !gpio_get_value (USDHC3_CD_GPIO ); -default : +case USDHC4_BASE_ADDR :return 1 ;/* eMMC/uSDHC4 is always present */ } + +return 0 ; }int board_mmc_init (bd_t *bis)
Signature · 1 line
1.8.1
PATCH 2/3 mx6qsabresd: Document the mapping of USDHC[2-4]
In reply to Otavio Salvador--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 ++++ 1 file changed, 4 insertions(+)
board/freescale/mx6qsabresd/mx6qsabresd.c +4 -0
@@ -26,6 +26,7 @@#include <asm/errno.h> #include <asm/gpio.h> #include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/boot_mode.h> #include <mmc.h> #include <fsl_esdhc.h> #include <miiphy.h>
@@ -164,18 +165,21 @@ int board_mmc_init(bd_t *bis)for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) {switch (i) { +/* SD2 - mmc0 */ case 0 :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 ; +/* SD3 - mmc1 */ case 1 :imx_iomux_v3_setup_multiple_pads ( usdhc3_pads,ARRAY_SIZE (usdhc3_pads));gpio_direction_input (USDHC3_CD_GPIO ); usdhc_cfg[1 ].sdhc_clk =mxc_get_clock (MXC_ESDHC3_CLK );break ; +/* eMMC - mmc2 */ case 2 :imx_iomux_v3_setup_multiple_pads ( usdhc4_pads,ARRAY_SIZE (usdhc4_pads));
Signature · 1 line
1.8.1
PATCH 3/3 mx6qsabre{sd,auto}: Add boot mode select
In reply to Otavio SalvadorAdds support for 'bmode' command which let user to choose where to boot from; this allows U-Boot to load system from another storage without messing with jumpers.
--- board/freescale/mx6qsabreauto/mx6qsabreauto.c | 17 +++++++++++++++++ board/freescale/mx6qsabresd/mx6qsabresd.c | 20 ++++++++++++++++++++ include/configs/mx6qsabre_common.h | 4 +++- 3 files changed, 40 insertions(+), 1 deletion(-)
board/freescale/mx6qsabreauto/mx6qsabreauto.c +17 -0
@@ -216,6 +216,23 @@ int board_init(void)return 0 ; } +#ifdef CONFIG_CMD_BMODE +static const struct boot_mode board_boot_modes[] = { +/* 4 bit bus width */ + {"mmc0" ,MAKE_CFGVAL (0x40 ,0x30 ,0x00 ,0x00 )}, + {NULL ,0 }, +}; +#endif + +int board_late_init (void ) +{ +#ifdef CONFIG_CMD_BMODE +add_board_boot_modes (board_boot_modes); +#endif + +return 0 ; +} +int checkboard (void ) {int rev =mx6sabre_rev ();
board/freescale/mx6qsabresd/mx6qsabresd.c +20 -0
@@ -265,6 +265,26 @@ int board_init(void)return 0 ; } +#ifdef CONFIG_CMD_BMODE +static const struct boot_mode board_boot_modes[] = { +/* 4 bit bus width */ + {"sd2" ,MAKE_CFGVAL (0x40 ,0x28 ,0x00 ,0x00 )}, + {"sd3" ,MAKE_CFGVAL (0x40 ,0x30 ,0x00 ,0x00 )}, +/* 8 bit bus width */ + {"emmc" ,MAKE_CFGVAL (0x40 ,0x38 ,0x00 ,0x00 )}, + {NULL ,0 }, +}; +#endif + +int board_late_init (void ) +{ +#ifdef CONFIG_CMD_BMODE +add_board_boot_modes (board_boot_modes); +#endif + +return 0 ; +} +int checkboard (void ) {puts ("Board: MX6Q-SabreSD\n" );
include/configs/mx6qsabre_common.h +3 -1
@@ -33,6 +33,7 @@#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * 1024 * 1024)#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_BOARD_LATE_INIT #define CONFIG_MXC_GPIO #define CONFIG_MXC_UART
@@ -72,10 +73,11 @@/* Command definition */ #include <config_cmd_default.h> +#define CONFIG_CMD_BMODE #define CONFIG_CMD_BOOTZ #undef CONFIG_CMD_IMLS -#define CONFIG_BOOTDELAY 1 +#define CONFIG_BOOTDELAY 10#define CONFIG_LOADADDR 0x12000000#define CONFIG_SYS_TEXT_BASE 0x17800000
Signature · 1 line
1.8.1
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
In reply to Otavio SalvadorOn Sat, Mar 2, 2013 at 6:49 PM, Otavio Salvador <[email protected]> wrote:
Please provide a commit log.
Quoted 10 lines
Signed-off-by Otavio Salvador <[email protected]>--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)board/freescale/mx6qsabresd/mx6qsabresd.c +0
-0
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 155
Quoted 6 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +1
-1@@ -151,9 +151,11 @@ int board_mmc_getcd(struct mmc *mmc)return !gpio_get_value (USDHC2_CD_GPIO );case USDHC3_BASE_ADDR :return !gpio_get_value (USDHC3_CD_GPIO ); -default : +case USDHC4_BASE_ADDR :return 1 ;/* eMMC/uSDHC4 is always present */
This looks good.
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 158
Quoted 3 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +2
-0} + +return 0 ;
,but why do we need this?
PATCH 2/3 mx6qsabresd: Document the mapping of USDHC[2-4]
In reply to Otavio SalvadorQuoted 1 line · Otavio Salvador
Signed-off-by Otavio Salvador <[email protected]>
No commit log. It is really hard for someone to understand why you need this patch if you do not explain it.
Quoted 17 lines
--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 ++++ 1 file changed, 4 insertions(+)board/freescale/mx6qsabresd/mx6qsabresd.c +1
-0@@ -26,6 +26,7 @@#include <asm/errno.h> #include <asm/gpio.h> #include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/boot_mode.h> #include <mmc.h> #include <fsl_esdhc.h> #include <miiphy.h>
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_init(bd_t *bis) · line 168
Quoted 4 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +1
-0@@ -164,18 +165,21 @@ int board_mmc_init(bd_t *bis)for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) {switch (i) { +/* SD2 - mmc0 */
This mapping is dependent on the kernel. Does it make sense to describe this in the bootloader?
PATCH 2/3 mx6qsabresd: Document the mapping of USDHC[2-4]
Quoted 5 lines · Fabio Estevam
Quoted 1 line · Otavio Salvador
Signed-off-by Otavio Salvador <[email protected]>No commit log. It is really hard for someone to understand why you need this patch if you do not explain it.
Right; I can extend it.
Quoted 18 lines
Quoted 18 lines
--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 ++++ 1 file changed, 4 insertions(+)board/freescale/mx6qsabresd/mx6qsabresd.c +1
-0@@ -26,6 +26,7 @@#include <asm/errno.h> #include <asm/gpio.h> #include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/boot_mode.h> #include <mmc.h> #include <fsl_esdhc.h> #include <miiphy.h> @@ -164,18 +165,21 @@ int board_mmc_init(bd_t *bis)
Quoted 6 lines
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_init(bd_t *bis) · line 168
Quoted 3 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +1
-0for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) {switch (i) { +/* SD2 - mmc0 */ This mapping is dependent on the kernel. Does it make sense to describe this in the bootloader?
It does not matter if it changes in the kernel later; I'd like to have it here so people can know which one to use if need to choose one.
It is hard to know which one the bootloader will use without it.
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: otavio at ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
In reply to Fabio EstevamQuoted 23 lines · Fabio Estevam
On Sat, Mar 2, 2013 at 6:49 PM, Otavio Salvador <[email protected]> wrote:
Please provide a commit log.
Quoted 10 lines
Signed-off-by Otavio Salvador <[email protected]>--- board/freescale/mx6qsabresd/mx6qsabresd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)board/freescale/mx6qsabresd/mx6qsabresd.c +0
-0board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 155
Quoted 6 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +1
-1@@ -151,9 +151,11 @@ int board_mmc_getcd(struct mmc *mmc)return !gpio_get_value (USDHC2_CD_GPIO );case USDHC3_BASE_ADDR :return !gpio_get_value (USDHC3_CD_GPIO ); -default : +case USDHC4_BASE_ADDR :return 1 ;/* eMMC/uSDHC4 is always present */ This looks good.
Quoted 5 lines
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 158
Quoted 3 lines
board/freescale/mx6qsabresd/mx6qsabresd.c +2
-0} + +return 0 ;,but why do we need this?
Fail by default?
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: otavio at ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
Quoted 7 lines · Otavio Salvador
Quoted 5 lines
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 158
Quoted 3 lines
}board/freescale/mx6qsabresd/mx6qsabresd.c +2
-0+ +return 0 ;,but why do we need this?
Fail by default?
No, just do like mx53loco and mx6qsabrelite, where we always 'return ret'
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
Quoted 11 lines · Fabio Estevam
Quoted 7 lines · Otavio Salvador
Quoted 5 lines
board/freescale/mx6qsabresd/mx6qsabresd.c int board_mmc_getcd(struct mmc *mmc) · line 158
Quoted 3 lines
}board/freescale/mx6qsabresd/mx6qsabresd.c +2
-0+ +return 0 ;,but why do we need this?
Fail by default?
No, just do like mx53loco and mx6qsabrelite, where we always 'return ret'
Ok; will fix it
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: otavio at ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
Quoted 7 lines · Otavio Salvador
Quoted 6 lines · Fabio Estevam
Quoted 4 lines · Otavio Salvador
Quoted 4 lines
Quoted 3 lines
}board/freescale/mx6qsabresd/mx6qsabresd.c +2
-0+ +return 0 ;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
,but why do we need this?
Fail by default?
No, just do like mx53loco and mx6qsabrelite, where we always 'return ret'
Ok; will fix it
Well, we don't have ret here.
int board_mmc_getcd(struct mmc *mmc)
{
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
switch (cfg->esdhc_base) {
case USDHC2_BASE_ADDR:
return !gpio_get_value(USDHC2_CD_GPIO);
case USDHC3_BASE_ADDR:
return !gpio_get_value(USDHC3_CD_GPIO);
case USDHC4_BASE_ADDR:
return 1; /* eMMC/uSDHC4 is always present */
}
return 0;
}So I think the default ought to be 0;
--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
Quoted 1 line · Otavio Salvador
Well, we don't have ret here.
Yes, exactly. My suggestion is to add a return value, just like mx53loco and sabresd.
PATCH 1/3 mx6qsabresd: Fix card detection for invalid card id case
Quoted 6 lines · Fabio Estevam
Quoted 1 line · Otavio Salvador
Well, we don't have ret here.
Yes, exactly. My suggestion is to add a return value, just like mx53loco and sabresd.
Great; did it for v2.
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: otavio at ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br