]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
uniphier: extend boot device detection for future SoCs
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 3 Feb 2020 10:28:13 +0000 (19:28 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 12 Feb 2020 04:36:58 +0000 (13:36 +0900)
The next SoC will have:
  - No boot swap
  - SD boot
  - No USB boot

Add new fields to handle this.

Change-Id: I772395f2c5dfc612e575b0cbd0657a5fa9611c25
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
plat/socionext/uniphier/uniphier.h
plat/socionext/uniphier/uniphier_boot_device.c

index 729dc5caad0501b83e77ccfb9c8db011d5a01663..9deb3163b3b6f6cb40d6f15fc382e8e95594e107 100644 (file)
@@ -25,7 +25,8 @@ unsigned int uniphier_get_boot_device(unsigned int soc);
 #define UNIPHIER_BOOT_DEVICE_EMMC      0
 #define UNIPHIER_BOOT_DEVICE_NAND      1
 #define UNIPHIER_BOOT_DEVICE_NOR       2
-#define UNIPHIER_BOOT_DEVICE_USB       3
+#define UNIPHIER_BOOT_DEVICE_SD                3
+#define UNIPHIER_BOOT_DEVICE_USB       4
 #define UNIPHIER_BOOT_DEVICE_RSV       0xffffffff
 
 unsigned int uniphier_get_boot_master(unsigned int soc);
index ce9caa98508c3b1919b635769d9138d435703c57..517ec96a48bbd035f09cc2541f074090bcbc7ca0 100644 (file)
@@ -106,20 +106,25 @@ static unsigned int uniphier_pxs3_get_boot_device(uint32_t pinmon)
 }
 
 struct uniphier_boot_device_info {
+       bool have_boot_swap;
+       bool (*is_sd_boot)(uint32_t pinmon);
        bool (*is_usb_boot)(uint32_t pinmon);
        unsigned int (*get_boot_device)(uint32_t pinmon);
 };
 
 static const struct uniphier_boot_device_info uniphier_boot_device_info[] = {
        [UNIPHIER_SOC_LD11] = {
+               .have_boot_swap = true,
                .is_usb_boot = uniphier_ld11_is_usb_boot,
                .get_boot_device = uniphier_ld11_get_boot_device,
        },
        [UNIPHIER_SOC_LD20] = {
+               .have_boot_swap = true,
                .is_usb_boot = uniphier_ld20_is_usb_boot,
                .get_boot_device = uniphier_ld11_get_boot_device,
        },
        [UNIPHIER_SOC_PXS3] = {
+               .have_boot_swap = true,
                .is_usb_boot = uniphier_pxs3_is_usb_boot,
                .get_boot_device = uniphier_pxs3_get_boot_device,
        },
@@ -135,10 +140,13 @@ unsigned int uniphier_get_boot_device(unsigned int soc)
 
        pinmon = mmio_read_32(UNIPHIER_PINMON0);
 
-       if (!(pinmon & BIT(29)))
+       if (info->have_boot_swap && !(pinmon & BIT(29)))
                return UNIPHIER_BOOT_DEVICE_NOR;
 
-       if (info->is_usb_boot(pinmon))
+       if (info->is_sd_boot && info->is_sd_boot(pinmon))
+               return UNIPHIER_BOOT_DEVICE_SD;
+
+       if (info->is_usb_boot && info->is_usb_boot(pinmon))
                return UNIPHIER_BOOT_DEVICE_USB;
 
        return info->get_boot_device(pinmon);