[U-Boot] [PATCH] mx6: Fix SPL boot device detection

Stefano Babic sbabic at denx.de
Sun Dec 17 10:01:09 UTC 2017


Hi Jiri,when

On 29/11/2017 19:13, Jiri Luznicky wrote:
> The boot device is selected according to BOOT_CFG1[7:4] fuse.
> Any value equal or higher then 0x8 is used for nand.
> 
> Currently, only values up to 0x8 are handled by the switch.
> Add rest of the values up to 0xf to cover all nand cases.
> 
> Signed-off-by: Jiri Luznicky <jiri at luznicky.cz>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
>  arch/arm/include/asm/mach-imx/sys_proto.h | 9 ++++++++-
>  arch/arm/mach-imx/spl.c                   | 9 ++++++++-
>  board/engicam/common/board.c              | 9 ++++++++-
>  3 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
> index a80a392a73..455d5e291d 100644
> --- a/arch/arm/include/asm/mach-imx/sys_proto.h
> +++ b/arch/arm/include/asm/mach-imx/sys_proto.h
> @@ -81,7 +81,14 @@ enum imx6_bmode {
>  	IMX6_BMODE_ESD,
>  	IMX6_BMODE_MMC,
>  	IMX6_BMODE_EMMC,
> -	IMX6_BMODE_NAND,
> +	IMX6_BMODE_NAND1,
> +	IMX6_BMODE_NAND2,
> +	IMX6_BMODE_NAND3,
> +	IMX6_BMODE_NAND4,
> +	IMX6_BMODE_NAND5,
> +	IMX6_BMODE_NAND6,
> +	IMX6_BMODE_NAND7,
> +	IMX6_BMODE_NAND8,

It makes no sense to add a full list if we need to check for a range.

>  };
>  
>  static inline u8 imx6_is_bmode_from_gpr9(void)
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index d0d1b73aa6..a91fffad93 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -91,7 +91,14 @@ u32 spl_boot_device(void)
>  	case IMX6_BMODE_EMMC:
>  		return BOOT_DEVICE_MMC1;
>  	/* NAND Flash: 8.5.2, Table 8-10 */
> -	case IMX6_BMODE_NAND:
> +	case IMX6_BMODE_NAND1:
> +	case IMX6_BMODE_NAND2:
> +	case IMX6_BMODE_NAND3:
> +	case IMX6_BMODE_NAND4:
> +	case IMX6_BMODE_NAND5:
> +	case IMX6_BMODE_NAND6:
> +	case IMX6_BMODE_NAND7:
> +	case IMX6_BMODE_NAND8:

Instead of this, it should be simply checked the value, for example in a
default case.

>  		return BOOT_DEVICE_NAND;
>  	}
>  	return BOOT_DEVICE_NONE;
> diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
> index f633c71916..b70ce0b8ad 100644
> --- a/board/engicam/common/board.c
> +++ b/board/engicam/common/board.c
> @@ -69,7 +69,14 @@ int board_late_init(void)
>  #endif
>  		env_set("modeboot", "mmcboot");
>  		break;
> -	case IMX6_BMODE_NAND:
> +	case IMX6_BMODE_NAND1:
> +	case IMX6_BMODE_NAND2:
> +	case IMX6_BMODE_NAND3:
> +	case IMX6_BMODE_NAND4:
> +	case IMX6_BMODE_NAND5: value 
> +	case IMX6_BMODE_NAND6:
> +	case IMX6_BMODE_NAND7:
> +	case IMX6_BMODE_NAND8:>  		env_set("modeboot", "nandboot");
>  		break;
>  	default:
> 

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list