[U-Boot] [NEXT PATCH v1 4/7] MX35: Add soc_boot_mode and soc_boot_device to MX35

Eric Bénard eric at eukrea.com
Sun Sep 23 21:25:43 CEST 2012


Hi Stefano,

Le Thu,  6 Sep 2012 10:04:57 +0200,
Stefano Babic <sbabic at denx.de> a écrit :
> +#define RCSR_MEM_CTL_WEIM	0
> +#define RCSR_MEM_CTL_NAND	1
> +#define RCSR_MEM_CTL_SD		2
> +#define RCSR_MEM_TYPE_NOR	0
> +#define RCSR_MEM_TYPE_ONENAND	2
> +#define RCSR_MEM_TYPE_SD	0
> +#define RCSR_MEM_TYPE_I2C	2
> +#define RCSR_MEM_TYPE_SPI	3
> +
> +u32 spl_boot_device(void)
> +{
> +	puts("spl_boot_device\n");
> +	struct ccm_regs *ccm =
> +		(struct ccm_regs *)IMX_CCM_BASE;
> +
> +#if 1
> +	return BOOT_DEVICE_MMC1;
> +#endif

thisseems not clean and seems caused by the fact that the define
RCSR_MEM_CTL_SD should be 3 and not 2 so in your tests the function
spl_boot_device was not detecting the right boot mode. Also IMHO this
define should be named RCSR_MEM_CTL_EXPANSION as in the app note AN3996
at end of page 3 (there is a typo in the reference manual which seems
to be a copy'n paste from i.MX25 as it doesn't take in acount the ATA
HDD case) :
http://cache.freescale.com/files/dsp/doc/app_note/AN3996.pdf

> +
> +	u32 rcsr = readl(&ccm->rcsr);
> +	u32 mem_type, mem_ctl;
> +
> +	/* In external mode, no boot device is returned */
> +	if ((rcsr >> 10) & 0x03)
> +		return BOOT_DEVICE_NONE;
> +
> +	mem_ctl = (rcsr >> 25) & 0x03;
> +	mem_type = (rcsr >> 23) & 0x03;
> +
> +	switch (mem_ctl) {
> +	case RCSR_MEM_CTL_WEIM:
> +		switch (mem_type) {
> +		case RCSR_MEM_TYPE_NOR:
> +			return BOOT_DEVICE_NOR;
> +		case RCSR_MEM_TYPE_ONENAND:
> +			return BOOT_DEVICE_ONE_NAND;
> +		default:
> +			return BOOT_DEVICE_NONE;
> +		}
> +	case RCSR_MEM_CTL_NAND:
> +		return BOOT_DEVICE_NAND;
> +	case RCSR_MEM_CTL_SD:
> +		switch (mem_type) {
> +		case RCSR_MEM_TYPE_SD:
> +			return BOOT_DEVICE_MMC1;
> +		case RCSR_MEM_TYPE_I2C:
> +			return BOOT_DEVICE_I2C;
> +		case RCSR_MEM_TYPE_SPI:
> +			return BOOT_DEVICE_SPI;
> +		default:
> +			return BOOT_DEVICE_NONE;
> +		}
> +	}
> +
> +	return BOOT_DEVICE_NONE;
> +}
> +

Eric


More information about the U-Boot mailing list