]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: mx7: move get_boot_device to cpu.c
authorPeng Fan <peng.fan@nxp.com>
Wed, 10 Jan 2018 05:20:34 +0000 (13:20 +0800)
committerStefano Babic <sbabic@denx.de>
Sun, 4 Feb 2018 11:00:58 +0000 (12:00 +0100)
Move get_boot_device to cpu.c to prepare adding i.MX8M support,
because i.MX8M share same code with i.MX7.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
arch/arm/include/asm/arch-mx7/imx-regs.h
arch/arm/include/asm/mach-imx/boot_mode.h
arch/arm/mach-imx/cpu.c
arch/arm/mach-imx/mx7/soc.c

index a421b9bc0455795d8c2f9a8e6313d6cbbbb29f2a..3726f02af54d744d7a8b22ab47148b19f349e28f 100644 (file)
@@ -1210,14 +1210,6 @@ extern void pcie_power_off(void);
        readl(USBOTG2_IPS_BASE_ADDR + 0x158))
 #define        disconnect_from_pc(void) writel(0x0, USBOTG1_IPS_BASE_ADDR + 0x140)
 
-/* Boot device type */
-#define BOOT_TYPE_SD           0x1
-#define BOOT_TYPE_MMC          0x2
-#define BOOT_TYPE_NAND         0x3
-#define BOOT_TYPE_QSPI         0x4
-#define BOOT_TYPE_WEIM         0x5
-#define BOOT_TYPE_SPINOR       0x6
-
 struct bootrom_sw_info {
        u8 reserved_1;
        u8 boot_dev_instance;
index e3ed046b251185219fb3a0f6f8f97a2df6177482..300868a45e6f2536428e601444bc8cf143583c6f 100644 (file)
@@ -31,6 +31,15 @@ enum boot_device {
        BOOT_DEV_NUM = UNKNOWN_BOOT,
 };
 
+/* Boot device type */
+#define BOOT_TYPE_SD           0x1
+#define BOOT_TYPE_MMC          0x2
+#define BOOT_TYPE_NAND         0x3
+#define BOOT_TYPE_QSPI         0x4
+#define BOOT_TYPE_WEIM         0x5
+#define BOOT_TYPE_SPINOR       0x6
+#define BOOT_TYPE_USB          0xF
+
 struct boot_mode {
        const char *name;
        unsigned cfg_val;
index fd6d08c533c8d014ceae0e645aba9e7b11e71ae9..a7d89f20338c92bff322d9614f9210811798a31f 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/mach-imx/boot_mode.h>
 #include <imx_thermal.h>
 #include <ipu_pixfmt.h>
 #include <thermal.h>
@@ -409,6 +410,43 @@ u32 get_cpu_temp_grade(int *minc, int *maxc)
 }
 #endif
 
+#if defined(CONFIG_MX7)
+enum boot_device get_boot_device(void)
+{
+       struct bootrom_sw_info **p =
+               (struct bootrom_sw_info **)(ulong)ROM_SW_INFO_ADDR;
+
+       enum boot_device boot_dev = SD1_BOOT;
+       u8 boot_type = (*p)->boot_dev_type;
+       u8 boot_instance = (*p)->boot_dev_instance;
+
+       switch (boot_type) {
+       case BOOT_TYPE_SD:
+               boot_dev = boot_instance + SD1_BOOT;
+               break;
+       case BOOT_TYPE_MMC:
+               boot_dev = boot_instance + MMC1_BOOT;
+               break;
+       case BOOT_TYPE_NAND:
+               boot_dev = NAND_BOOT;
+               break;
+       case BOOT_TYPE_QSPI:
+               boot_dev = QSPI_BOOT;
+               break;
+       case BOOT_TYPE_WEIM:
+               boot_dev = WEIM_NOR_BOOT;
+               break;
+       case BOOT_TYPE_SPINOR:
+               boot_dev = SPI_NOR_BOOT;
+               break;
+       default:
+               break;
+       }
+
+       return boot_dev;
+}
+#endif
+
 #ifdef CONFIG_NXP_BOARD_REVISION
 int nxp_board_rev(void)
 {
index 72dbd625c9a1cf19f9f562cc187a6189564ec2b2..62bd3a0e5f13405add133403f34d4218f436063a 100644 (file)
@@ -250,41 +250,6 @@ const struct boot_mode soc_boot_modes[] = {
        {NULL,          0},
 };
 
-enum boot_device get_boot_device(void)
-{
-       struct bootrom_sw_info **p =
-               (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
-
-       enum boot_device boot_dev = SD1_BOOT;
-       u8 boot_type = (*p)->boot_dev_type;
-       u8 boot_instance = (*p)->boot_dev_instance;
-
-       switch (boot_type) {
-       case BOOT_TYPE_SD:
-               boot_dev = boot_instance + SD1_BOOT;
-               break;
-       case BOOT_TYPE_MMC:
-               boot_dev = boot_instance + MMC1_BOOT;
-               break;
-       case BOOT_TYPE_NAND:
-               boot_dev = NAND_BOOT;
-               break;
-       case BOOT_TYPE_QSPI:
-               boot_dev = QSPI_BOOT;
-               break;
-       case BOOT_TYPE_WEIM:
-               boot_dev = WEIM_NOR_BOOT;
-               break;
-       case BOOT_TYPE_SPINOR:
-               boot_dev = SPI_NOR_BOOT;
-               break;
-       default:
-               break;
-       }
-
-       return boot_dev;
-}
-
 #ifdef CONFIG_ENV_IS_IN_MMC
 __weak int board_mmc_get_env_dev(int devno)
 {