mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-04 13:31:37 +00:00
imx: Use IMX6_BMODE_* macros instead of numericals
Use meaningful macros IMX6_BMODE_*, instead of numerical number in boot mode detection code. Cc: Tim Harvey <tharvey@gateworks.com> Acked-by: Stefano Babic <sbabic@denx.de> Signed-off-by: Jagan Teki <jagan@openedev.com>
This commit is contained in:
parent
20f1471416
commit
96aac843b6
2 changed files with 60 additions and 15 deletions
|
@ -29,42 +29,52 @@ u32 spl_boot_device(void)
|
||||||
*/
|
*/
|
||||||
if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
|
if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */
|
||||||
return BOOT_DEVICE_UART;
|
return BOOT_DEVICE_UART;
|
||||||
|
|
||||||
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
|
/* BOOT_CFG1[7:4] - see IMX6DQRM Table 8-8 */
|
||||||
switch ((reg & 0x000000FF) >> 4) {
|
switch ((reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT) {
|
||||||
/* EIM: See 8.5.1, Table 8-9 */
|
/* EIM: See 8.5.1, Table 8-9 */
|
||||||
case 0x0:
|
case IMX6_BMODE_EMI:
|
||||||
/* BOOT_CFG1[3]: NOR/OneNAND Selection */
|
/* BOOT_CFG1[3]: NOR/OneNAND Selection */
|
||||||
if ((reg & 0x00000008) >> 3)
|
switch ((reg & IMX6_BMODE_EMI_MASK) >> IMX6_BMODE_EMI_SHIFT) {
|
||||||
|
case IMX6_BMODE_ONENAND:
|
||||||
return BOOT_DEVICE_ONENAND;
|
return BOOT_DEVICE_ONENAND;
|
||||||
else
|
case IMX6_BMODE_NOR:
|
||||||
return BOOT_DEVICE_NOR;
|
return BOOT_DEVICE_NOR;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
/* Reserved: Used to force Serial Downloader */
|
/* Reserved: Used to force Serial Downloader */
|
||||||
case 0x1:
|
case IMX6_BMODE_UART:
|
||||||
return BOOT_DEVICE_UART;
|
return BOOT_DEVICE_UART;
|
||||||
/* SATA: See 8.5.4, Table 8-20 */
|
/* SATA: See 8.5.4, Table 8-20 */
|
||||||
case 0x2:
|
case IMX6_BMODE_SATA:
|
||||||
return BOOT_DEVICE_SATA;
|
return BOOT_DEVICE_SATA;
|
||||||
/* Serial ROM: See 8.5.5.1, Table 8-22 */
|
/* Serial ROM: See 8.5.5.1, Table 8-22 */
|
||||||
case 0x3:
|
case IMX6_BMODE_SERIAL_ROM:
|
||||||
/* BOOT_CFG4[2:0] */
|
/* BOOT_CFG4[2:0] */
|
||||||
switch ((reg & 0x07000000) >> 24) {
|
switch ((reg & IMX6_BMODE_SERIAL_ROM_MASK) >>
|
||||||
case 0x0 ... 0x4:
|
IMX6_BMODE_SERIAL_ROM_SHIFT) {
|
||||||
|
case IMX6_BMODE_ECSPI1:
|
||||||
|
case IMX6_BMODE_ECSPI2:
|
||||||
|
case IMX6_BMODE_ECSPI3:
|
||||||
|
case IMX6_BMODE_ECSPI4:
|
||||||
|
case IMX6_BMODE_ECSPI5:
|
||||||
return BOOT_DEVICE_SPI;
|
return BOOT_DEVICE_SPI;
|
||||||
case 0x5 ... 0x7:
|
case IMX6_BMODE_I2C1:
|
||||||
|
case IMX6_BMODE_I2C2:
|
||||||
|
case IMX6_BMODE_I2C3:
|
||||||
return BOOT_DEVICE_I2C;
|
return BOOT_DEVICE_I2C;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* SD/eSD: 8.5.3, Table 8-15 */
|
/* SD/eSD: 8.5.3, Table 8-15 */
|
||||||
case 0x4:
|
case IMX6_BMODE_SD:
|
||||||
case 0x5:
|
case IMX6_BMODE_ESD:
|
||||||
return BOOT_DEVICE_MMC1;
|
return BOOT_DEVICE_MMC1;
|
||||||
/* MMC/eMMC: 8.5.3 */
|
/* MMC/eMMC: 8.5.3 */
|
||||||
case 0x6:
|
case IMX6_BMODE_MMC:
|
||||||
case 0x7:
|
case IMX6_BMODE_EMMC:
|
||||||
return BOOT_DEVICE_MMC1;
|
return BOOT_DEVICE_MMC1;
|
||||||
/* NAND Flash: 8.5.2, Table 8-10 */
|
/* NAND Flash: 8.5.2, Table 8-10 */
|
||||||
case 0x8:
|
case IMX6_BMODE_NAND:
|
||||||
return BOOT_DEVICE_NAND;
|
return BOOT_DEVICE_NAND;
|
||||||
}
|
}
|
||||||
return BOOT_DEVICE_NONE;
|
return BOOT_DEVICE_NONE;
|
||||||
|
|
|
@ -44,6 +44,41 @@
|
||||||
#ifdef CONFIG_MX6
|
#ifdef CONFIG_MX6
|
||||||
#define IMX6_SRC_GPR10_BMODE BIT(28)
|
#define IMX6_SRC_GPR10_BMODE BIT(28)
|
||||||
|
|
||||||
|
#define IMX6_BMODE_MASK GENMASK(7, 0)
|
||||||
|
#define IMX6_BMODE_SHIFT 4
|
||||||
|
#define IMX6_BMODE_EMI_MASK BIT(3)
|
||||||
|
#define IMX6_BMODE_EMI_SHIFT 3
|
||||||
|
#define IMX6_BMODE_SERIAL_ROM_MASK GENMASK(26, 24)
|
||||||
|
#define IMX6_BMODE_SERIAL_ROM_SHIFT 24
|
||||||
|
|
||||||
|
enum imx6_bmode_serial_rom {
|
||||||
|
IMX6_BMODE_ECSPI1,
|
||||||
|
IMX6_BMODE_ECSPI2,
|
||||||
|
IMX6_BMODE_ECSPI3,
|
||||||
|
IMX6_BMODE_ECSPI4,
|
||||||
|
IMX6_BMODE_ECSPI5,
|
||||||
|
IMX6_BMODE_I2C1,
|
||||||
|
IMX6_BMODE_I2C2,
|
||||||
|
IMX6_BMODE_I2C3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum imx6_bmode_emi {
|
||||||
|
IMX6_BMODE_ONENAND,
|
||||||
|
IMX6_BMODE_NOR,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum imx6_bmode {
|
||||||
|
IMX6_BMODE_EMI,
|
||||||
|
IMX6_BMODE_UART,
|
||||||
|
IMX6_BMODE_SATA,
|
||||||
|
IMX6_BMODE_SERIAL_ROM,
|
||||||
|
IMX6_BMODE_SD,
|
||||||
|
IMX6_BMODE_ESD,
|
||||||
|
IMX6_BMODE_MMC,
|
||||||
|
IMX6_BMODE_EMMC,
|
||||||
|
IMX6_BMODE_NAND,
|
||||||
|
};
|
||||||
|
|
||||||
static inline u8 imx6_is_bmode_from_gpr9(void)
|
static inline u8 imx6_is_bmode_from_gpr9(void)
|
||||||
{
|
{
|
||||||
struct src *psrc = (struct src *)SRC_BASE_ADDR;
|
struct src *psrc = (struct src *)SRC_BASE_ADDR;
|
||||||
|
|
Loading…
Add table
Reference in a new issue