Commit 2cb26005 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 1046c1ca
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment