diff --git a/plat/socionext/uniphier/uniphier_io_storage.c b/plat/socionext/uniphier/uniphier_io_storage.c index 96180f1..e89c835 100644 --- a/plat/socionext/uniphier/uniphier_io_storage.c +++ b/plat/socionext/uniphier/uniphier_io_storage.c @@ -23,7 +23,6 @@ #define UNIPHIER_ROM_REGION_BASE 0x00000000ULL #define UNIPHIER_ROM_REGION_SIZE 0x10000000ULL -#define UNIPHIER_OCM_REGION_BASE 0x30000000ULL #define UNIPHIER_OCM_REGION_SIZE 0x00040000ULL #define UNIPHIER_BLOCK_BUF_OFFSET 0x04200000UL @@ -278,12 +277,20 @@ return uniphier_io_memmap_setup(0x70000); } -static int uniphier_io_usb_setup(unsigned int soc_id, size_t buffer_offset) +static const uintptr_t uniphier_ocm_base[] = { + [UNIPHIER_SOC_LD11] = 0x30000000, + [UNIPHIER_SOC_LD20] = 0x30000000, + [UNIPHIER_SOC_PXS3] = 0x30000000, +}; + +static int uniphier_io_rom_api_setup(unsigned int soc) { - struct io_block_dev_spec *block_dev_spec; + uintptr_t ocm_base; int ret; - /* use ROM API for loading images from USB storage */ + assert(soc < ARRAY_SIZE(uniphier_ocm_base)); + ocm_base = uniphier_ocm_base[soc]; + ret = mmap_add_dynamic_region(UNIPHIER_ROM_REGION_BASE, UNIPHIER_ROM_REGION_BASE, UNIPHIER_ROM_REGION_SIZE, @@ -296,14 +303,26 @@ * load functions provided by the ROM use this memory region as a work * area, but do not cater to cache coherency. */ - ret = mmap_add_dynamic_region(UNIPHIER_OCM_REGION_BASE, - UNIPHIER_OCM_REGION_BASE, + ret = mmap_add_dynamic_region(ocm_base, ocm_base, UNIPHIER_OCM_REGION_SIZE, MT_DEVICE | MT_RW | MT_SECURE); if (ret) return ret; - ret = uniphier_usb_init(soc_id, &block_dev_spec); + return 0; +} + +static int uniphier_io_usb_setup(unsigned int soc, size_t buffer_offset) +{ + struct io_block_dev_spec *block_dev_spec; + int ret; + + /* use ROM API for loading images from USB storage */ + ret = uniphier_io_rom_api_setup(soc); + if (ret) + return ret; + + ret = uniphier_usb_init(soc, &block_dev_spec); if (ret) return ret;