]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
uniphier: make on-chip SRAM region configurable
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 3 Feb 2020 10:46:26 +0000 (19:46 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 12 Feb 2020 04:36:58 +0000 (13:36 +0900)
The on-chip SRAM region will be changed in the next SoC. Make it
configurable. Also, split the mmap code into a new helper function
so that it can be re-used for another boot mode.

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

index 96180f159a677a452136065f824085bde659bbdc..e89c8358c25f8b38105b81ad66daa17dfadc0d58 100644 (file)
@@ -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 @@ static int uniphier_io_nor_setup(unsigned int soc_id, size_t buffer_offset)
        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 @@ static int uniphier_io_usb_setup(unsigned int soc_id, size_t buffer_offset)
         * 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;