uniphier: extend boot device detection for future SoCs

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>
This commit is contained in:
Masahiro Yamada 2020-02-03 19:28:13 +09:00
parent 1046c1cae2
commit 2cb260053d
2 changed files with 12 additions and 3 deletions

View 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);

View 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);