]> git.sur5r.net Git - u-boot/commitdiff
Merge git://git.denx.de/u-boot-fsl-qoriq
authorTom Rini <trini@konsulko.com>
Thu, 16 Mar 2017 20:43:32 +0000 (16:43 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 16 Mar 2017 20:43:32 +0000 (16:43 -0400)
42 files changed:
arch/arm/cpu/armv8/cache_v8.c
arch/arm/cpu/armv8/fsl-layerscape/Kconfig
arch/arm/cpu/armv8/fsl-layerscape/cpu.c
arch/arm/cpu/armv8/fsl-layerscape/soc.c
arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/include/asm/arch-fsl-layerscape/config.h
arch/arm/include/asm/arch-fsl-layerscape/cpu.h
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
arch/arm/include/asm/arch-fsl-layerscape/mmu.h
arch/arm/include/asm/armv8/mmu.h
arch/arm/include/asm/fsl_secure_boot.h
arch/arm/include/asm/global_data.h
arch/arm/include/asm/system.h
board/freescale/common/vid.c
board/freescale/ls1012afrdm/ls1012afrdm.c
board/freescale/ls1012aqds/ls1012aqds.c
board/freescale/ls1012ardb/ls1012ardb.c
board/freescale/ls1043aqds/ddr.c
board/freescale/ls1043aqds/ls1043aqds.c
board/freescale/ls1043ardb/ddr.c
board/freescale/ls1043ardb/ls1043ardb.c
board/freescale/ls1046aqds/ddr.c
board/freescale/ls1046aqds/ls1046aqds.c
board/freescale/ls1046ardb/ddr.c
board/freescale/ls1046ardb/ls1046ardb.c
board/freescale/ls2080a/ddr.c
board/freescale/ls2080a/ls2080a.c
board/freescale/ls2080aqds/ddr.c
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ddr.c
board/freescale/ls2080ardb/ls2080ardb.c
cmd/bdinfo.c
common/board_f.c
drivers/net/fsl-mc/mc.c
include/configs/ls1021atwr.h
include/configs/ls1043aqds.h
include/configs/ls1043ardb.h
include/configs/ls1046aqds.h
include/configs/ls1046ardb.h
include/configs/ls2080a_common.h
lib/efi_loader/efi_memory.c
scripts/config_whitelist.txt

index 6c5630c0a84c5c49162e414247ea3e9a5ccf755e..bd1c3e0335d4630f8367581fb88a864a0964b621 100644 (file)
@@ -501,7 +501,8 @@ static bool is_aligned(u64 addr, u64 size, u64 align)
        return !(addr & (align - 1)) && !(size & (align - 1));
 }
 
-static u64 set_one_region(u64 start, u64 size, u64 attrs, int level)
+/* Use flag to indicate if attrs has more than d-cache attributes */
+static u64 set_one_region(u64 start, u64 size, u64 attrs, bool flag, int level)
 {
        int levelshift = level2shift(level);
        u64 levelsize = 1ULL << levelshift;
@@ -509,8 +510,13 @@ static u64 set_one_region(u64 start, u64 size, u64 attrs, int level)
 
        /* Can we can just modify the current level block PTE? */
        if (is_aligned(start, size, levelsize)) {
-               *pte &= ~PMD_ATTRINDX_MASK;
-               *pte |= attrs;
+               if (flag) {
+                       *pte &= ~PMD_ATTRMASK;
+                       *pte |= attrs & PMD_ATTRMASK;
+               } else {
+                       *pte &= ~PMD_ATTRINDX_MASK;
+                       *pte |= attrs & PMD_ATTRINDX_MASK;
+               }
                debug("Set attrs=%llx pte=%p level=%d\n", attrs, pte, level);
 
                return levelsize;
@@ -560,7 +566,8 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
                u64 r;
 
                for (level = 1; level < 4; level++) {
-                       r = set_one_region(start, size, attrs, level);
+                       /* Set d-cache attributes only */
+                       r = set_one_region(start, size, attrs, false, level);
                        if (r) {
                                /* PTE successfully replaced */
                                size -= r;
@@ -581,6 +588,63 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
        flush_dcache_range(real_start, real_start + real_size);
 }
 
+/*
+ * Modify MMU table for a region with updated PXN/UXN/Memory type/valid bits.
+ * The procecess is break-before-make. The target region will be marked as
+ * invalid during the process of changing.
+ */
+void mmu_change_region_attr(phys_addr_t addr, size_t siz, u64 attrs)
+{
+       int level;
+       u64 r, size, start;
+
+       start = addr;
+       size = siz;
+       /*
+        * Loop through the address range until we find a page granule that fits
+        * our alignment constraints, then set it to "invalid".
+        */
+       while (size > 0) {
+               for (level = 1; level < 4; level++) {
+                       /* Set PTE to fault */
+                       r = set_one_region(start, size, PTE_TYPE_FAULT, true,
+                                          level);
+                       if (r) {
+                               /* PTE successfully invalidated */
+                               size -= r;
+                               start += r;
+                               break;
+                       }
+               }
+       }
+
+       flush_dcache_range(gd->arch.tlb_addr,
+                          gd->arch.tlb_addr + gd->arch.tlb_size);
+       __asm_invalidate_tlb_all();
+
+       /*
+        * Loop through the address range until we find a page granule that fits
+        * our alignment constraints, then set it to the new cache attributes
+        */
+       start = addr;
+       size = siz;
+       while (size > 0) {
+               for (level = 1; level < 4; level++) {
+                       /* Set PTE to new attributes */
+                       r = set_one_region(start, size, attrs, true, level);
+                       if (r) {
+                               /* PTE successfully updated */
+                               size -= r;
+                               start += r;
+                               break;
+                       }
+               }
+       }
+       flush_dcache_range(gd->arch.tlb_addr,
+                          gd->arch.tlb_addr + gd->arch.tlb_size);
+       __asm_invalidate_tlb_all();
+}
+
 #else  /* CONFIG_SYS_DCACHE_OFF */
 
 /*
index b5609ff7a67f018de78f622c99ab4f7d1fd7d9d9..a99b1c6a99b2ce036c9c4b5c430d06c5392d5907 100644 (file)
@@ -89,6 +89,14 @@ config FSL_LSCH3
        select SYS_FSL_SRDS_1
        select SYS_HAS_SERDES
 
+config FSL_MC_ENET
+       bool "Management Complex network"
+       depends on ARCH_LS2080A
+       default y
+       select RESV_RAM
+       help
+         Enable Management Complex (MC) network
+
 menu "Layerscape architecture"
        depends on FSL_LSCH2 || FSL_LSCH3
 
@@ -277,6 +285,16 @@ config SYS_FSL_SDHC_CLK_DIV
          clock, in another word SDHC_clk = Platform_clk / this_divider.
 endmenu
 
+config RESV_RAM
+       bool
+       help
+         Reserve memory from the top, tracked by gd->arch.resv_ram. This
+         reserved RAM can be used by special driver that resides in memory
+         after U-Boot exits. It's up to implementation to allocate and allow
+         access to this reserved memory. For example, the reserved RAM can
+         be at the high end of physical memory. The reserve RAM may be
+         excluded from memory bank(s) passed to OS, or marked as reserved.
+
 config SYS_FSL_ERRATUM_A008336
        bool
 
@@ -297,3 +315,11 @@ config SYS_FSL_ERRATUM_A009660
 
 config SYS_FSL_ERRATUM_A009929
        bool
+
+config SYS_MC_RSV_MEM_ALIGN
+       hex "Management Complex reserved memory alignment"
+       depends on RESV_RAM
+       default 0x20000000
+       help
+         Reserved memory needs to be aligned for MC to use. Default value
+         is 512MB.
index 335f2251816807da6e1f734a95a5991c218a847f..7e66ee08b56d70573505f1f9e6e72437cc66017b 100644 (file)
@@ -101,12 +101,50 @@ static inline void final_mmu_setup(void)
 {
        u64 tlb_addr_save = gd->arch.tlb_addr;
        unsigned int el = current_el();
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
        int index;
-#endif
 
        mem_map = final_map;
 
+       /* Update mapping for DDR to actual size */
+       for (index = 0; index < ARRAY_SIZE(final_map) - 2; index++) {
+               /*
+                * Find the entry for DDR mapping and update the address and
+                * size. Zero-sized mapping will be skipped when creating MMU
+                * table.
+                */
+               switch (final_map[index].virt) {
+               case CONFIG_SYS_FSL_DRAM_BASE1:
+                       final_map[index].virt = gd->bd->bi_dram[0].start;
+                       final_map[index].phys = gd->bd->bi_dram[0].start;
+                       final_map[index].size = gd->bd->bi_dram[0].size;
+                       break;
+#ifdef CONFIG_SYS_FSL_DRAM_BASE2
+               case CONFIG_SYS_FSL_DRAM_BASE2:
+#if (CONFIG_NR_DRAM_BANKS >= 2)
+                       final_map[index].virt = gd->bd->bi_dram[1].start;
+                       final_map[index].phys = gd->bd->bi_dram[1].start;
+                       final_map[index].size = gd->bd->bi_dram[1].size;
+#else
+                       final_map[index].size = 0;
+#endif
+               break;
+#endif
+#ifdef CONFIG_SYS_FSL_DRAM_BASE3
+               case CONFIG_SYS_FSL_DRAM_BASE3:
+#if (CONFIG_NR_DRAM_BANKS >= 3)
+                       final_map[index].virt = gd->bd->bi_dram[2].start;
+                       final_map[index].phys = gd->bd->bi_dram[2].start;
+                       final_map[index].size = gd->bd->bi_dram[2].size;
+#else
+                       final_map[index].size = 0;
+#endif
+               break;
+#endif
+               default:
+                       break;
+               }
+       }
+
 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
        if (gd->arch.secure_ram & MEM_RESERVE_SECURE_MAINTAINED) {
                if (el == 3) {
@@ -143,21 +181,14 @@ static inline void final_mmu_setup(void)
        setup_pgtables();
        gd->arch.tlb_addr = tlb_addr_save;
 
-       /* flush new MMU table */
-       flush_dcache_range(gd->arch.tlb_addr,
-                          gd->arch.tlb_addr + gd->arch.tlb_size);
+       /* Disable cache and MMU */
+       dcache_disable();       /* TLBs are invalidated */
+       invalidate_icache_all();
 
        /* point TTBR to the new table */
        set_ttbr_tcr_mair(el, gd->arch.tlb_addr, get_tcr(el, NULL, NULL),
                          MEMORY_ATTRIBUTES);
-       /*
-        * EL3 MMU is already enabled, just need to invalidate TLB to load the
-        * new table. The new table is compatible with the current table, if
-        * MMU somehow walks through the new table before invalidation TLB,
-        * it still works. So we don't need to turn off MMU here.
-        * When EL2 MMU table is created by calling this function, MMU needs
-        * to be enabled.
-        */
+
        set_sctlr(get_sctlr() | CR_M);
 }
 
@@ -524,15 +555,277 @@ phys_size_t board_reserve_ram_top(phys_size_t ram_size)
 {
        phys_size_t ram_top = ram_size;
 
-#ifdef CONFIG_SYS_MEM_TOP_HIDE
-#error CONFIG_SYS_MEM_TOP_HIDE not to be used together with this function
-#endif
-
-/* Carve the MC private DRAM block from the end of DRAM */
 #ifdef CONFIG_FSL_MC_ENET
+       /* The start address of MC reserved memory needs to be aligned. */
        ram_top -= mc_get_dram_block_size();
        ram_top &= ~(CONFIG_SYS_MC_RSV_MEM_ALIGN - 1);
 #endif
 
-       return ram_top;
+       return ram_size - ram_top;
+}
+
+phys_size_t get_effective_memsize(void)
+{
+       phys_size_t ea_size, rem = 0;
+
+       /*
+        * For ARMv8 SoCs, DDR memory is split into two or three regions. The
+        * first region is 2GB space at 0x8000_0000. If the memory extends to
+        * the second region (or the third region if applicable), the secure
+        * memory and Management Complex (MC) memory should be put into the
+        * highest region, i.e. the end of DDR memory. CONFIG_MAX_MEM_MAPPED
+        * is set to the size of first region so U-Boot doesn't relocate itself
+        * into higher address. Should DDR be configured to skip the first
+        * region, this function needs to be adjusted.
+        */
+       if (gd->ram_size > CONFIG_MAX_MEM_MAPPED) {
+               ea_size = CONFIG_MAX_MEM_MAPPED;
+               rem = gd->ram_size - ea_size;
+       } else {
+               ea_size = gd->ram_size;
+       }
+
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+       /* Check if we have enough space for secure memory */
+       if (rem > CONFIG_SYS_MEM_RESERVE_SECURE) {
+               rem -= CONFIG_SYS_MEM_RESERVE_SECURE;
+       } else {
+               if (ea_size > CONFIG_SYS_MEM_RESERVE_SECURE) {
+                       ea_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
+                       rem = 0;        /* Presume MC requires more memory */
+               } else {
+                       printf("Error: No enough space for secure memory.\n");
+               }
+       }
+#endif
+       /* Check if we have enough memory for MC */
+       if (rem < board_reserve_ram_top(rem)) {
+               /* Not enough memory in high region to reserve */
+               if (ea_size > board_reserve_ram_top(rem))
+                       ea_size -= board_reserve_ram_top(rem);
+               else
+                       printf("Error: No enough space for reserved memory.\n");
+       }
+
+       return ea_size;
+}
+
+void dram_init_banksize(void)
+{
+#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
+       phys_size_t dp_ddr_size;
+#endif
+
+       /*
+        * gd->ram_size has the total size of DDR memory, less reserved secure
+        * memory. The DDR extends from low region to high region(s) presuming
+        * no hole is created with DDR configuration. gd->arch.secure_ram tracks
+        * the location of secure memory. gd->arch.resv_ram tracks the location
+        * of reserved memory for Management Complex (MC).
+        */
+       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
+               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
+               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
+               gd->bd->bi_dram[1].size = gd->ram_size -
+                                         CONFIG_SYS_DDR_BLOCK1_SIZE;
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+               if (gd->bi_dram[1].size > CONFIG_SYS_DDR_BLOCK2_SIZE) {
+                       gd->bd->bi_dram[2].start = CONFIG_SYS_DDR_BLOCK3_BASE;
+                       gd->bd->bi_dram[2].size = gd->bd->bi_dram[1].size -
+                                                 CONFIG_SYS_DDR_BLOCK2_SIZE;
+                       gd->bd->bi_dram[1].size = CONFIG_SYS_DDR_BLOCK2_SIZE;
+               }
+#endif
+       } else {
+               gd->bd->bi_dram[0].size = gd->ram_size;
+       }
+#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+       if (gd->bd->bi_dram[2].size >= CONFIG_SYS_MEM_RESERVE_SECURE) {
+               gd->bd->bi_dram[2].size -= CONFIG_SYS_MEM_RESERVE_SECURE;
+               gd->arch.secure_ram = gd->bd->bi_dram[2].start +
+                                     gd->bd->bi_dram[2].size;
+               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
+               gd->ram_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
+       } else
+#endif
+       {
+               if (gd->bd->bi_dram[1].size >= CONFIG_SYS_MEM_RESERVE_SECURE) {
+                       gd->bd->bi_dram[1].size -=
+                                       CONFIG_SYS_MEM_RESERVE_SECURE;
+                       gd->arch.secure_ram = gd->bd->bi_dram[1].start +
+                                             gd->bd->bi_dram[1].size;
+                       gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
+                       gd->ram_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
+               } else if (gd->bd->bi_dram[0].size >
+                                       CONFIG_SYS_MEM_RESERVE_SECURE) {
+                       gd->bd->bi_dram[0].size -=
+                                       CONFIG_SYS_MEM_RESERVE_SECURE;
+                       gd->arch.secure_ram = gd->bd->bi_dram[0].start +
+                                             gd->bd->bi_dram[0].size;
+                       gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
+                       gd->ram_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
+               }
+       }
+#endif /* CONFIG_SYS_MEM_RESERVE_SECURE */
+
+#ifdef CONFIG_FSL_MC_ENET
+       /* Assign memory for MC */
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+       if (gd->bd->bi_dram[2].size >=
+           board_reserve_ram_top(gd->bd->bi_dram[2].size)) {
+               gd->arch.resv_ram = gd->bd->bi_dram[2].start +
+                           gd->bd->bi_dram[2].size -
+                           board_reserve_ram_top(gd->bd->bi_dram[2].size);
+       } else
+#endif
+       {
+               if (gd->bd->bi_dram[1].size >=
+                   board_reserve_ram_top(gd->bd->bi_dram[1].size)) {
+                       gd->arch.resv_ram = gd->bd->bi_dram[1].start +
+                               gd->bd->bi_dram[1].size -
+                               board_reserve_ram_top(gd->bd->bi_dram[1].size);
+               } else if (gd->bd->bi_dram[0].size >
+                          board_reserve_ram_top(gd->bd->bi_dram[0].size)) {
+                       gd->arch.resv_ram = gd->bd->bi_dram[0].start +
+                               gd->bd->bi_dram[0].size -
+                               board_reserve_ram_top(gd->bd->bi_dram[0].size);
+               }
+       }
+#endif /* CONFIG_FSL_MC_ENET */
+
+#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+#error "This SoC shouldn't have DP DDR"
+#endif
+       if (soc_has_dp_ddr()) {
+               /* initialize DP-DDR here */
+               puts("DP-DDR:  ");
+               /*
+                * DDR controller use 0 as the base address for binding.
+                * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
+                */
+               dp_ddr_size = fsl_other_ddr_sdram(CONFIG_SYS_DP_DDR_BASE_PHY,
+                                         CONFIG_DP_DDR_CTRL,
+                                         CONFIG_DP_DDR_NUM_CTRLS,
+                                         CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR,
+                                         NULL, NULL, NULL);
+               if (dp_ddr_size) {
+                       gd->bd->bi_dram[2].start = CONFIG_SYS_DP_DDR_BASE;
+                       gd->bd->bi_dram[2].size = dp_ddr_size;
+               } else {
+                       puts("Not detected");
+               }
+       }
+#endif
+}
+
+#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD)
+void efi_add_known_memory(void)
+{
+       int i;
+       phys_addr_t ram_start, start;
+       phys_size_t ram_size;
+       u64 pages;
+
+       /* Add RAM */
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+#error "This SoC shouldn't have DP DDR"
+#endif
+               if (i == 2)
+                       continue;       /* skip DP-DDR */
+#endif
+               ram_start = gd->bd->bi_dram[i].start;
+               ram_size = gd->bd->bi_dram[i].size;
+#ifdef CONFIG_RESV_RAM
+               if (gd->arch.resv_ram >= ram_start &&
+                   gd->arch.resv_ram < ram_start + ram_size)
+                       ram_size = gd->arch.resv_ram - ram_start;
+#endif
+               start = (ram_start + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
+               pages = (ram_size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
+
+               efi_add_memory_map(start, pages, EFI_CONVENTIONAL_MEMORY,
+                                  false);
+       }
+}
+#endif
+
+/*
+ * Before DDR size is known, early MMU table have DDR mapped as device memory
+ * to avoid speculative access. To relocate U-Boot to DDR, "normal memory"
+ * needs to be set for these mappings.
+ * If a special case configures DDR with holes in the mapping, the holes need
+ * to be marked as invalid. This is not implemented in this function.
+ */
+void update_early_mmu_table(void)
+{
+       if (!gd->arch.tlb_addr)
+               return;
+
+       if (gd->ram_size <= CONFIG_SYS_FSL_DRAM_SIZE1) {
+               mmu_change_region_attr(
+                                       CONFIG_SYS_SDRAM_BASE,
+                                       gd->ram_size,
+                                       PTE_BLOCK_MEMTYPE(MT_NORMAL)    |
+                                       PTE_BLOCK_OUTER_SHARE           |
+                                       PTE_BLOCK_NS                    |
+                                       PTE_TYPE_VALID);
+       } else {
+               mmu_change_region_attr(
+                                       CONFIG_SYS_SDRAM_BASE,
+                                       CONFIG_SYS_DDR_BLOCK1_SIZE,
+                                       PTE_BLOCK_MEMTYPE(MT_NORMAL)    |
+                                       PTE_BLOCK_OUTER_SHARE           |
+                                       PTE_BLOCK_NS                    |
+                                       PTE_TYPE_VALID);
+#ifdef CONFIG_SYS_DDR_BLOCK3_BASE
+#ifndef CONFIG_SYS_DDR_BLOCK2_SIZE
+#error "Missing CONFIG_SYS_DDR_BLOCK2_SIZE"
+#endif
+               if (gd->ram_size - CONFIG_SYS_DDR_BLOCK1_SIZE >
+                   CONFIG_SYS_DDR_BLOCK2_SIZE) {
+                       mmu_change_region_attr(
+                                       CONFIG_SYS_DDR_BLOCK2_BASE,
+                                       CONFIG_SYS_DDR_BLOCK2_SIZE,
+                                       PTE_BLOCK_MEMTYPE(MT_NORMAL)    |
+                                       PTE_BLOCK_OUTER_SHARE           |
+                                       PTE_BLOCK_NS                    |
+                                       PTE_TYPE_VALID);
+                       mmu_change_region_attr(
+                                       CONFIG_SYS_DDR_BLOCK3_BASE,
+                                       gd->ram_size -
+                                       CONFIG_SYS_DDR_BLOCK1_SIZE -
+                                       CONFIG_SYS_DDR_BLOCK2_SIZE,
+                                       PTE_BLOCK_MEMTYPE(MT_NORMAL)    |
+                                       PTE_BLOCK_OUTER_SHARE           |
+                                       PTE_BLOCK_NS                    |
+                                       PTE_TYPE_VALID);
+               } else
+#endif
+               {
+                       mmu_change_region_attr(
+                                       CONFIG_SYS_DDR_BLOCK2_BASE,
+                                       gd->ram_size -
+                                       CONFIG_SYS_DDR_BLOCK1_SIZE,
+                                       PTE_BLOCK_MEMTYPE(MT_NORMAL)    |
+                                       PTE_BLOCK_OUTER_SHARE           |
+                                       PTE_BLOCK_NS                    |
+                                       PTE_TYPE_VALID);
+               }
+       }
+}
+
+__weak int dram_init(void)
+{
+       gd->ram_size = initdram(0);
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
+
+       return 0;
 }
index 9489f85c642c0f30c18f83a8456af1d6cee4e4b8..b54a9379711752e1dd78184121884954b08d4ff5 100644 (file)
@@ -233,10 +233,8 @@ int sata_init(void)
 {
        struct ccsr_ahci __iomem *ccsr_ahci = (void *)CONFIG_SYS_SATA;
 
-#ifdef CONFIG_ARCH_LS1046A
        /* Disable SATA ECC */
        out_le32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + 0x520, 0x80000000);
-#endif
        out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG);
        out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG);
        out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG);
index 1dabdbb3058165dbc6bdde5a883a0fc5618e97ad..73a8680741741f501bd4ee84f9cffb98c7d7cba5 100644 (file)
@@ -45,9 +45,6 @@ void board_init_f(ulong dummy)
 {
        /* Clear global data */
        memset((void *)gd, 0, sizeof(gd_t));
-#ifdef CONFIG_LS2080A
-       arch_cpu_init();
-#endif
        board_early_init_f();
        timer_init();
 #ifdef CONFIG_LS2080A
index 586ce17215291a0c8c9a969ae0d26fb1d7c975ad..b5b08aae23255c927f64a32a204e2f71b309c276 100644 (file)
@@ -33,8 +33,8 @@
 #define CONFIG_SYS_FSL_OCRAM_SIZE      0x00020000 /* Real size 128K */
 
 /* DDR */
-#define CONFIG_SYS_LS2_DDR_BLOCK1_SIZE ((phys_size_t)2 << 30)
-#define CONFIG_MAX_MEM_MAPPED          CONFIG_SYS_LS2_DDR_BLOCK1_SIZE
+#define CONFIG_SYS_DDR_BLOCK1_SIZE     ((phys_size_t)2 << 30)
+#define CONFIG_MAX_MEM_MAPPED          CONFIG_SYS_DDR_BLOCK1_SIZE
 
 #define CONFIG_SYS_FSL_CCSR_GUR_LE
 #define CONFIG_SYS_FSL_CCSR_SCFG_LE
index 4ea4aeaf4c238886da0d8389eba131ab539ec4e3..bcf3e3863e6f08e1dc39b1e4dc3f8ec1fff61fa2 100644 (file)
@@ -115,7 +115,11 @@ static struct mm_region early_map[] = {
        },
        { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
          CONFIG_SYS_FSL_DRAM_SIZE1,
+#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
          PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+#else  /* Start with nGnRnE and PXN and UXN to prevent speculative access */
+         PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
+#endif
          PTE_BLOCK_OUTER_SHARE | PTE_BLOCK_NS
        },
        /* Map IFC region #2 up to CONFIG_SYS_FLASH_BASE for NAND boot */
@@ -130,7 +134,7 @@ static struct mm_region early_map[] = {
        },
        { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
          CONFIG_SYS_FSL_DRAM_SIZE2,
-         PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+         PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
          PTE_BLOCK_OUTER_SHARE | PTE_BLOCK_NS
        },
 #elif defined(CONFIG_FSL_LSCH2)
@@ -158,12 +162,16 @@ static struct mm_region early_map[] = {
        },
        { CONFIG_SYS_FSL_DRAM_BASE1, CONFIG_SYS_FSL_DRAM_BASE1,
          CONFIG_SYS_FSL_DRAM_SIZE1,
+#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
          PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+#else  /* Start with nGnRnE and PXN and UXN to prevent speculative access */
+         PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
+#endif
          PTE_BLOCK_OUTER_SHARE | PTE_BLOCK_NS
        },
        { CONFIG_SYS_FSL_DRAM_BASE2, CONFIG_SYS_FSL_DRAM_BASE2,
          CONFIG_SYS_FSL_DRAM_SIZE2,
-         PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+         PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
          PTE_BLOCK_OUTER_SHARE | PTE_BLOCK_NS
        },
 #endif
index 43ae686a295c452b9e3956c0d184dd2974eadab9..08ea8fb8eff68b6c29f0c5a660a095e29ddba5e8 100644 (file)
@@ -177,21 +177,23 @@ struct ccsr_gur {
        u8      res_008[0x20-0x8];
        u32     gpporcr1;       /* General-purpose POR configuration */
        u32     gpporcr2;       /* General-purpose POR configuration 2 */
-#define FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT     25
+       u32     gpporcr3;
+       u32     gpporcr4;
+       u8      res_030[0x60-0x30];
+#define FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT     2
 #define FSL_CHASSIS3_DCFG_FUSESR_VID_MASK      0x1F
-#define FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT  20
+#define FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT  7
 #define FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK   0x1F
        u32     dcfg_fusesr;    /* Fuse status register */
-       u32     gpporcr3;
-       u32     gpporcr4;
-       u8      res_034[0x70-0x34];
-       u32     devdisr;        /* Device disable control */
+       u8      res_064[0x70-0x64];
+       u32     devdisr;        /* Device disable control 1 */
        u32     devdisr2;       /* Device disable control 2 */
        u32     devdisr3;       /* Device disable control 3 */
        u32     devdisr4;       /* Device disable control 4 */
        u32     devdisr5;       /* Device disable control 5 */
        u32     devdisr6;       /* Device disable control 6 */
-       u32     devdisr7;       /* Device disable control 7 */
+       u8      res_088[0x94-0x88];
+       u32     coredisr;       /* Device disable control 7 */
 #define FSL_CHASSIS3_DEVDISR2_DPMAC1   0x00000001
 #define FSL_CHASSIS3_DEVDISR2_DPMAC2   0x00000002
 #define FSL_CHASSIS3_DEVDISR2_DPMAC3   0x00000004
@@ -216,15 +218,11 @@ struct ccsr_gur {
 #define FSL_CHASSIS3_DEVDISR2_DPMAC22  0x00200000
 #define FSL_CHASSIS3_DEVDISR2_DPMAC23  0x00400000
 #define FSL_CHASSIS3_DEVDISR2_DPMAC24  0x00800000
-       u8      res_08c[0x90-0x8c];
-       u32     coredisru;      /* uppper portion for support of 64 cores */
-       u32     coredisrl;      /* lower portion for support of 64 cores */
        u8      res_098[0xa0-0x98];
        u32     pvr;            /* Processor version */
        u32     svr;            /* System version */
-       u32     mvr;            /* Manufacturing version */
-       u8      res_0ac[0x100-0xac];
-       u32     rcwsr[32];      /* Reset control word status */
+       u8      res_0a8[0x100-0xa8];
+       u32     rcwsr[30];      /* Reset control word status */
 
 #define FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_SHIFT  2
 #define FSL_CHASSIS3_RCWSR0_SYS_PLL_RAT_MASK   0x1f
@@ -239,24 +237,53 @@ struct ccsr_gur {
 #define RCW_SB_EN_REG_INDEX    9
 #define RCW_SB_EN_MASK         0x00000400
 
-       u8      res_180[0x200-0x180];
-       u32     scratchrw[32];  /* Scratch Read/Write */
-       u8      res_280[0x300-0x280];
+       u8      res_178[0x200-0x178];
+       u32     scratchrw[16];  /* Scratch Read/Write */
+       u8      res_240[0x300-0x240];
        u32     scratchw1r[4];  /* Scratch Read (Write once) */
        u8      res_310[0x400-0x310];
        u32     bootlocptrl;    /* Boot location pointer low-order addr */
        u32     bootlocptrh;    /* Boot location pointer high-order addr */
-       u8      res_408[0x500-0x408];
-       u8      res_500[0x740-0x500];   /* add more registers when needed */
+       u8      res_408[0x520-0x408];
+       u32     usb1_amqr;
+       u32     usb2_amqr;
+       u8      res_528[0x530-0x528];   /* add more registers when needed */
+       u32     sdmm1_amqr;
+       u8      res_534[0x550-0x534];   /* add more registers when needed */
+       u32     sata1_amqr;
+       u32     sata2_amqr;
+       u8      res_558[0x570-0x558];   /* add more registers when needed */
+       u32     misc1_amqr;
+       u8      res_574[0x590-0x574];   /* add more registers when needed */
+       u32     spare1_amqr;
+       u32     spare2_amqr;
+       u8      res_598[0x620-0x598];   /* add more registers when needed */
+       u32     gencr[7];       /* General Control Registers */
+       u8      res_63c[0x640-0x63c];   /* add more registers when needed */
+       u32     cgensr1;        /* Core General Status Register */
+       u8      res_644[0x660-0x644];   /* add more registers when needed */
+       u32     cgencr1;        /* Core General Control Register */
+       u8      res_664[0x740-0x664];   /* add more registers when needed */
        u32     tp_ityp[64];    /* Topology Initiator Type Register */
        struct {
                u32     upper;
                u32     lower;
-       } tp_cluster[3];        /* Core Cluster n Topology Register */
-       u8      res_858[0x1000-0x858];
+       } tp_cluster[4];        /* Core cluster n Topology Register */
+       u8      res_864[0x920-0x864];   /* add more registers when needed */
+       u32 ioqoscr[8]; /*I/O Quality of Services Register */
+       u32 uccr;
+       u8      res_944[0x960-0x944];   /* add more registers when needed */
+       u32 ftmcr;
+       u8      res_964[0x990-0x964];   /* add more registers when needed */
+       u32 coredisablesr;
+       u8      res_994[0xa00-0x994];   /* add more registers when needed */
+       u32 sdbgcr; /*Secure Debug Confifuration Register */
+       u8      res_a04[0xbf8-0xa04];   /* add more registers when needed */
+       u32 ipbrr1;
+       u32 ipbrr2;
+       u8      res_858[0x1000-0xc00];
 };
 
-
 struct ccsr_clk_cluster_group {
        struct {
                u8      res_00[0x10];
index d54eacd4a038044518407870eeb4351b0fe195a4..d232bec1e4d8c60eedd79fb952ba3918670ab905 100644 (file)
@@ -6,5 +6,5 @@
 
 #ifndef _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
 #define _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_
-#include <asm/arch-armv8/mmu.h>
+void update_early_mmu_table(void);
 #endif /* _ASM_ARMV8_FSL_LAYERSCAPE_MMU_H_ */
index e9b4cdbbcd5ac7656737ba9683779b0ba48c950d..a34990368e4b61f023d84da95966aff15efa998c 100644 (file)
@@ -53,6 +53,7 @@
 #define PTE_TYPE_FAULT         (0 << 0)
 #define PTE_TYPE_TABLE         (3 << 0)
 #define PTE_TYPE_BLOCK         (1 << 0)
+#define PTE_TYPE_VALID         (1 << 0)
 
 #define PTE_TABLE_PXN          (1UL << 59)
 #define PTE_TABLE_XN           (1UL << 60)
  */
 #define PMD_ATTRINDX(t)                ((t) << 2)
 #define PMD_ATTRINDX_MASK      (7 << 2)
+#define PMD_ATTRMASK           (PTE_BLOCK_PXN          | \
+                                PTE_BLOCK_UXN          | \
+                                PMD_ATTRINDX_MASK      | \
+                                PTE_TYPE_VALID)
 
 /*
  * TCR flags.
index ccb513fba24b7542b8cb35151443d5eb27991dbd..fd627c0874e969723dc99cf599fc2dadaac95391 100644 (file)
@@ -86,8 +86,8 @@
 /* For SD boot address and size are assigned in terms of sector
  * offset and no. of sectors respectively.
  */
-#define CONFIG_BS_HDR_ADDR_DEVICE      0x00000800
-#define CONFIG_BS_ADDR_DEVICE          0x00000840
+#define CONFIG_BS_HDR_ADDR_DEVICE      0x00000900
+#define CONFIG_BS_ADDR_DEVICE          0x00000940
 #define CONFIG_BS_HDR_SIZE             0x00000010
 #define CONFIG_BS_SIZE                 0x00000008
 #else
index aee87cdcbf9e1b0c81a287475131476bc7ae01fc..dfcbcceba3bd849ab6d1ace17fced5b2583cfd6b 100644 (file)
@@ -59,6 +59,13 @@ struct arch_global_data {
        phys_addr_t secure_ram;
        unsigned long tlb_allocated;
 #endif
+#ifdef CONFIG_RESV_RAM
+       /*
+        * Reserved RAM for memory resident, eg. Management Complex (MC)
+        * driver which continues to run after U-Boot exits.
+        */
+       phys_addr_t resv_ram;
+#endif
 
 #ifdef CONFIG_ARCH_OMAP2
        u32 omap_boot_device;
index 766e929d462c9b6102896618882fdd5957f71ae9..9c3261c8847e9ef0c01a2e48c63f372ae86c2cc1 100644 (file)
@@ -226,6 +226,7 @@ void protect_secure_region(void);
 void smp_kick_all_cpus(void);
 
 void flush_l3_cache(void);
+void mmu_change_region_attr(phys_addr_t start, size_t size, u64 attrs);
 
 /*
  *Issue a secure monitor call in accordance with ARM "SMC Calling convention",
index 1a503042f0405645b3fa2cef04b7b35110d22602..9b65c13b1ab5a7f4c95004c8d59c8ae9e87dc97b 100644 (file)
@@ -284,10 +284,170 @@ static int set_voltage(int i2caddress, int vdd)
        return vdd_last;
 }
 
+#ifdef CONFIG_FSL_LSCH3
 int adjust_vdd(ulong vdd_override)
 {
        int re_enable = disable_interrupts();
-#if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3)
+       struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+       u32 fusesr;
+       u8 vid, buf;
+       int vdd_target, vdd_current, vdd_last;
+       int ret, i2caddress;
+       unsigned long vdd_string_override;
+       char *vdd_string;
+       static const uint16_t vdd[32] = {
+               10500,
+               0,      /* reserved */
+               9750,
+               0,      /* reserved */
+               9500,
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               10000,  /* 1.0000V */
+               0,      /* reserved */
+               10250,
+               0,      /* reserved */
+               10500,
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+               0,      /* reserved */
+       };
+       struct vdd_drive {
+               u8 vid;
+               unsigned voltage;
+       };
+
+       ret = i2c_multiplexer_select_vid_channel(I2C_MUX_CH_VOL_MONITOR);
+       if (ret) {
+               debug("VID: I2C failed to switch channel\n");
+               ret = -1;
+               goto exit;
+       }
+       ret = find_ir_chip_on_i2c();
+       if (ret < 0) {
+               printf("VID: Could not find voltage regulator on I2C.\n");
+               ret = -1;
+               goto exit;
+       } else {
+               i2caddress = ret;
+               debug("VID: IR Chip found on I2C address 0x%02x\n", i2caddress);
+       }
+
+       /* check IR chip work on Intel mode*/
+       ret = i2c_read(i2caddress,
+                      IR36021_INTEL_MODE_OOFSET,
+                      1, (void *)&buf, 1);
+       if (ret) {
+               printf("VID: failed to read IR chip mode.\n");
+               ret = -1;
+               goto exit;
+       }
+       if ((buf & IR36021_MODE_MASK) != IR36021_INTEL_MODE) {
+               printf("VID: IR Chip is not used in Intel mode.\n");
+               ret = -1;
+               goto exit;
+       }
+
+       /* get the voltage ID from fuse status register */
+       fusesr = in_le32(&gur->dcfg_fusesr);
+       vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT) &
+               FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK;
+       if ((vid == 0) || (vid == FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK)) {
+               vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT) &
+                       FSL_CHASSIS3_DCFG_FUSESR_VID_MASK;
+       }
+       vdd_target = vdd[vid];
+
+       /* check override variable for overriding VDD */
+       vdd_string = getenv(CONFIG_VID_FLS_ENV);
+       if (vdd_override == 0 && vdd_string &&
+           !strict_strtoul(vdd_string, 10, &vdd_string_override))
+               vdd_override = vdd_string_override;
+
+       if (vdd_override >= VDD_MV_MIN && vdd_override <= VDD_MV_MAX) {
+               vdd_target = vdd_override * 10; /* convert to 1/10 mV */
+               debug("VDD override is %lu\n", vdd_override);
+       } else if (vdd_override != 0) {
+               printf("Invalid value.\n");
+       }
+
+       /* divide and round up by 10 to get a value in mV */
+       vdd_target = DIV_ROUND_UP(vdd_target, 10);
+       if (vdd_target == 0) {
+               debug("VID: VID not used\n");
+               ret = 0;
+               goto exit;
+       } else if (vdd_target < VDD_MV_MIN || vdd_target > VDD_MV_MAX) {
+               /* Check vdd_target is in valid range */
+               printf("VID: Target VID %d mV is not in range.\n",
+                      vdd_target);
+               ret = -1;
+               goto exit;
+       } else {
+               debug("VID: vid = %d mV\n", vdd_target);
+       }
+
+       /*
+        * Read voltage monitor to check real voltage.
+        */
+       vdd_last = read_voltage(i2caddress);
+       if (vdd_last < 0) {
+               printf("VID: Couldn't read sensor abort VID adjustment\n");
+               ret = -1;
+               goto exit;
+       }
+       vdd_current = vdd_last;
+       debug("VID: Core voltage is currently at %d mV\n", vdd_last);
+       /*
+         * Adjust voltage to at or one step above target.
+         * As measurements are less precise than setting the values
+         * we may run through dummy steps that cancel each other
+         * when stepping up and then down.
+         */
+       while (vdd_last > 0 &&
+              vdd_last < vdd_target) {
+               vdd_current += IR_VDD_STEP_UP;
+               vdd_last = set_voltage(i2caddress, vdd_current);
+       }
+       while (vdd_last > 0 &&
+              vdd_last > vdd_target + (IR_VDD_STEP_DOWN - 1)) {
+               vdd_current -= IR_VDD_STEP_DOWN;
+               vdd_last = set_voltage(i2caddress, vdd_current);
+       }
+
+       if (vdd_last > 0)
+               printf("VID: Core voltage after adjustment is at %d mV\n",
+                      vdd_last);
+       else
+               ret = -1;
+exit:
+       if (re_enable)
+               enable_interrupts();
+       i2c_multiplexer_select_vid_channel(I2C_MUX_CH_DEFAULT);
+       return ret;
+}
+#else /* !CONFIG_FSL_LSCH3 */
+int adjust_vdd(ulong vdd_override)
+{
+       int re_enable = disable_interrupts();
+#if defined(CONFIG_FSL_LSCH2)
        struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
 #else
        ccsr_gur_t __iomem *gur =
@@ -364,11 +524,7 @@ int adjust_vdd(ulong vdd_override)
        }
 
        /* get the voltage ID from fuse status register */
-#ifdef CONFIG_FSL_LSCH3
-       fusesr = in_le32(&gur->dcfg_fusesr);
-#else
        fusesr = in_be32(&gur->dcfg_fusesr);
-#endif
        /*
         * VID is used according to the table below
         *                ---------------------------------------
@@ -393,13 +549,6 @@ int adjust_vdd(ulong vdd_override)
                vid = (fusesr >> FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT) &
                        FSL_CHASSIS2_DCFG_FUSESR_VID_MASK;
        }
-#elif defined(CONFIG_FSL_LSCH3)
-       vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT) &
-               FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK;
-       if ((vid == 0) || (vid == FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK)) {
-               vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT) &
-                       FSL_CHASSIS3_DCFG_FUSESR_VID_MASK;
-       }
 #else
        vid = (fusesr >> FSL_CORENET_DCFG_FUSESR_ALTVID_SHIFT) &
                FSL_CORENET_DCFG_FUSESR_ALTVID_MASK;
@@ -472,6 +621,7 @@ exit:
 
        return ret;
 }
+#endif
 
 static int print_vdd(void)
 {
index 789cae225b7f7f39f912895057c4581e18660852..25d22d25bf80ca7857a050c79af52ade7c8e1a82 100644 (file)
@@ -12,6 +12,7 @@
 #ifdef CONFIG_FSL_LS_PPA
 #include <asm/arch/ppa.h>
 #endif
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <hwconfig.h>
 #include <environment.h>
@@ -48,6 +49,10 @@ int dram_init(void)
        mmdc_init(&mparam);
 
        gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
 
        return 0;
 }
@@ -91,32 +96,3 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        return 0;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                       gd->arch.secure_ram -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                       gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index 4281790426c15a3d971f2d98c640ad58ceca88be..97ab3400ad211fe0a2b2cc52a56032156b3842ac 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/ppa.h>
 #endif
 #include <asm/arch/fdt.h>
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <ahci.h>
 #include <hwconfig.h>
@@ -76,6 +77,10 @@ int dram_init(void)
        mmdc_init(&mparam);
 
        gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
 
        return 0;
 }
@@ -166,32 +171,3 @@ int ft_board_setup(void *blob, bd_t *bd)
        return 0;
 }
 #endif
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                       gd->arch.secure_ram -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                       gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index e3a8a7631b8f51309a8e0a7cf2acb8fb8958adc0..a23a23be1f0218cdbd5d11c4e31073c82165106f 100644 (file)
@@ -12,6 +12,7 @@
 #ifdef CONFIG_FSL_LS_PPA
 #include <asm/arch/ppa.h>
 #endif
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <hwconfig.h>
 #include <ahci.h>
@@ -80,6 +81,10 @@ int dram_init(void)
        mmdc_init(&mparam);
 
        gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
 
        return 0;
 }
@@ -165,32 +170,3 @@ int ft_board_setup(void *blob, bd_t *bd)
 
        return 0;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                       gd->arch.secure_ram -
-                       CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                       gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index 7882a9a9a1d27761b456f08d85fe85b81c70d4f3..c74006288700aad4784ad6feccbb44a01230aa1e 100644 (file)
@@ -127,32 +127,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                     gd->arch.secure_ram -
-                                     CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                     gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index 8835a49bb508193a66559aa9412e36fb9f0198e8..6507c0914342de4a99ddd33af787e5143eee6ad7 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/fdt.h>
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <ahci.h>
 #include <hwconfig.h>
@@ -153,6 +154,10 @@ int dram_init(void)
         */
        select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
        gd->ram_size = initdram(0);
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
 
        return 0;
 }
index 849f1d1b66d99041f5ebd016706f8fce5039926e..f90b85df1a041775144e2ebff8f64ff8f9c992c1 100644 (file)
@@ -188,32 +188,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                     gd->arch.secure_ram -
-                                     CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                     gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index e213128c1b9c270c96080f138d9d634fc27bd10f..2333843958fdb614940fcccff212cbcbc8447403 100644 (file)
@@ -67,13 +67,6 @@ int checkboard(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->ram_size = initdram(0);
-
-       return 0;
-}
-
 int board_early_init_f(void)
 {
        fsl_lsch2_early_init_f();
index 4ea8b236bf7e785ea3ec2b85b067521c015c1a9d..dc4d689adc1286288c97e8002c79a429a0917b5d 100644 (file)
@@ -112,32 +112,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                gd->arch.secure_ram -
-                                CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index 552365b9d88854afd9d529e21739a8d828352675..af3f70a38b70089177632b0c6c15a7d5d9cb7fde 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/fdt.h>
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <ahci.h>
 #include <hwconfig.h>
@@ -149,6 +150,10 @@ int dram_init(void)
         */
        select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
        gd->ram_size = initdram(0);
+#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
+       /* This will break-before-make MMU for DDR */
+       update_early_mmu_table();
+#endif
 
        return 0;
 }
index dd3b5d0e6b2e92cd507d8fd5d55ff78d34b63a44..efe2ba6eb1b213dc3a17fdf5919c3d4f1ef9aa22 100644 (file)
@@ -112,32 +112,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                gd->arch.secure_ram -
-                                CONFIG_SYS_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-}
index 33a58cf4404e223ca727c74756ce4139effdfc55..02b6c4c3752240afe210c0d0c793efe891970edb 100644 (file)
@@ -56,13 +56,6 @@ int checkboard(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->ram_size = initdram(0);
-
-       return 0;
-}
-
 int board_early_init_f(void)
 {
        fsl_lsch2_early_init_f();
index e6130ec709309b0ecf716c4c5f0cbbc3cb6a9117..5ed9e1461b06c89f4d6fc9f14734ac8615b0b882 100644 (file)
@@ -169,58 +169,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       phys_size_t dp_ddr_size;
-#endif
-
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_LS2_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                     gd->arch.secure_ram -
-                                     CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                     gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       if (soc_has_dp_ddr()) {
-               /* initialize DP-DDR here */
-               puts("DP-DDR:  ");
-               /*
-                * DDR controller use 0 as the base address for binding.
-                * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
-                */
-               dp_ddr_size = fsl_other_ddr_sdram(CONFIG_SYS_DP_DDR_BASE_PHY,
-                                         CONFIG_DP_DDR_CTRL,
-                                         CONFIG_DP_DDR_NUM_CTRLS,
-                                         CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR,
-                                         NULL, NULL, NULL);
-               if (dp_ddr_size) {
-                       gd->bd->bi_dram[2].start = CONFIG_SYS_DP_DDR_BASE;
-                       gd->bd->bi_dram[2].size = dp_ddr_size;
-               } else {
-                       puts("Not detected");
-               }
-       }
-#endif
-}
index 4f9b9c8a7739525e0c84209fed9b9a1319120cbd..9e7701d81ff517edddacf08e046b204e62393bbe 100644 (file)
@@ -49,13 +49,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-int dram_init(void)
-{
-       gd->ram_size = initdram(0);
-
-       return 0;
-}
-
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
 {
@@ -123,6 +116,16 @@ int ft_board_setup(void *blob, bd_t *bd)
        base[1] = gd->bd->bi_dram[1].start;
        size[1] = gd->bd->bi_dram[1].size;
 
+#ifdef CONFIG_RESV_RAM
+       /* reduce size if reserved memory is within this bank */
+       if (gd->arch.resv_ram >= base[0] &&
+           gd->arch.resv_ram < base[0] + size[0])
+               size[0] = gd->arch.resv_ram - base[0];
+       else if (gd->arch.resv_ram >= base[1] &&
+                gd->arch.resv_ram < base[1] + size[1])
+               size[1] = gd->arch.resv_ram - base[1];
+#endif
+
        fdt_fixup_memory_banks(blob, base, size, 2);
 
 #ifdef CONFIG_FSL_MC_ENET
index 9c6f477c7f4cabd719011cf37c582d04fa2fd78c..0408c0fc251b0ea6024d8b0ec261cc21bbbae7d3 100644 (file)
@@ -169,58 +169,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       phys_size_t dp_ddr_size;
-#endif
-
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_LS2_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                     gd->arch.secure_ram -
-                                     CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                     gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       if (soc_has_dp_ddr()) {
-               /* initialize DP-DDR here */
-               puts("DP-DDR:  ");
-               /*
-                * DDR controller use 0 as the base address for binding.
-                * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
-                */
-               dp_ddr_size = fsl_other_ddr_sdram(CONFIG_SYS_DP_DDR_BASE_PHY,
-                                         CONFIG_DP_DDR_CTRL,
-                                         CONFIG_DP_DDR_NUM_CTRLS,
-                                         CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR,
-                                         NULL, NULL, NULL);
-               if (dp_ddr_size) {
-                       gd->bd->bi_dram[2].start = CONFIG_SYS_DP_DDR_BASE;
-                       gd->bd->bi_dram[2].size = dp_ddr_size;
-               } else {
-                       puts("Not detected");
-               }
-       }
-#endif
-}
index 73a61fd75aa12a3c6f7f2dfcbfca7a9b34bea5e6..277013bfcc6f74aff33d41f28dc80777c28c85df 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "../common/qixis.h"
 #include "ls2080aqds_qixis.h"
+#include "../common/vid.h"
 
 #define PIN_MUX_SEL_SDHC       0x00
 #define PIN_MUX_SEL_DSPI       0x0a
@@ -240,6 +241,14 @@ int board_early_init_f(void)
        return 0;
 }
 
+int misc_init_r(void)
+{
+       if (adjust_vdd(0))
+               printf("Warning: Adjusting core voltage failed.\n");
+
+       return 0;
+}
+
 void detail_board_ddr_info(void)
 {
        puts("\nDDR    ");
@@ -254,13 +263,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-int dram_init(void)
-{
-       gd->ram_size = initdram(0);
-
-       return 0;
-}
-
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
 {
@@ -313,6 +315,16 @@ int ft_board_setup(void *blob, bd_t *bd)
        base[1] = gd->bd->bi_dram[1].start;
        size[1] = gd->bd->bi_dram[1].size;
 
+#ifdef CONFIG_RESV_RAM
+       /* reduce size if reserved memory is within this bank */
+       if (gd->arch.resv_ram >= base[0] &&
+           gd->arch.resv_ram < base[0] + size[0])
+               size[0] = gd->arch.resv_ram - base[0];
+       else if (gd->arch.resv_ram >= base[1] &&
+                gd->arch.resv_ram < base[1] + size[1])
+               size[1] = gd->arch.resv_ram - base[1];
+#endif
+
        fdt_fixup_memory_banks(blob, base, size, 2);
 
        fsl_fdt_fixup_dr_usb(blob, bd);
index 959dfeb02b6ac9e01325bbc915a8472d2b64d78a..2851d5b44385494f2474e25e2d648b3d849eb4d0 100644 (file)
@@ -172,58 +172,3 @@ phys_size_t initdram(int board_type)
 
        return dram_size;
 }
-
-void dram_init_banksize(void)
-{
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       phys_size_t dp_ddr_size;
-#endif
-
-       /*
-        * gd->arch.secure_ram tracks the location of secure memory.
-        * It was set as if the memory starts from 0.
-        * The address needs to add the offset of its bank.
-        */
-       gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
-       if (gd->ram_size > CONFIG_SYS_LS2_DDR_BLOCK1_SIZE) {
-               gd->bd->bi_dram[0].size = CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
-               gd->bd->bi_dram[1].size = gd->ram_size -
-                                         CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[1].start +
-                                     gd->arch.secure_ram -
-                                     CONFIG_SYS_LS2_DDR_BLOCK1_SIZE;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       } else {
-               gd->bd->bi_dram[0].size = gd->ram_size;
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-               gd->arch.secure_ram = gd->bd->bi_dram[0].start +
-                                     gd->arch.secure_ram;
-               gd->arch.secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
-#endif
-       }
-
-#ifdef CONFIG_SYS_DP_DDR_BASE_PHY
-       if (soc_has_dp_ddr()) {
-               /* initialize DP-DDR here */
-               puts("DP-DDR:  ");
-               /*
-                * DDR controller use 0 as the base address for binding.
-                * It is mapped to CONFIG_SYS_DP_DDR_BASE for core to access.
-                */
-               dp_ddr_size = fsl_other_ddr_sdram(CONFIG_SYS_DP_DDR_BASE_PHY,
-                                         CONFIG_DP_DDR_CTRL,
-                                         CONFIG_DP_DDR_NUM_CTRLS,
-                                         CONFIG_DP_DDR_DIMM_SLOTS_PER_CTLR,
-                                         NULL, NULL, NULL);
-               if (dp_ddr_size) {
-                       gd->bd->bi_dram[2].start = CONFIG_SYS_DP_DDR_BASE;
-                       gd->bd->bi_dram[2].size = dp_ddr_size;
-               } else {
-                       puts("Not detected");
-               }
-       }
-#endif
-}
index 02954ef6d760964a04a1c4d69b9572132ec757ad..4c01f560bcde815006decb1fa2c6ea68a6b85b61 100644 (file)
@@ -17,6 +17,7 @@
 #include <environment.h>
 #include <efi_loader.h>
 #include <i2c.h>
+#include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
 #include <fsl_sec.h>
 
@@ -202,14 +203,6 @@ int misc_init_r(void)
        if (adjust_vdd(0))
                printf("Warning: Adjusting core voltage failed.\n");
 
-#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD)
-       if (soc_has_dp_ddr() && gd->bd->bi_dram[2].size) {
-               efi_add_memory_map(gd->bd->bi_dram[2].start,
-                                  gd->bd->bi_dram[2].size >> EFI_PAGE_SHIFT,
-                                  EFI_RESERVED_MEMORY_TYPE, false);
-       }
-#endif
-
        return 0;
 }
 
@@ -227,13 +220,6 @@ void detail_board_ddr_info(void)
 #endif
 }
 
-int dram_init(void)
-{
-       gd->ram_size = initdram(0);
-
-       return 0;
-}
-
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
 {
@@ -286,6 +272,16 @@ int ft_board_setup(void *blob, bd_t *bd)
        base[1] = gd->bd->bi_dram[1].start;
        size[1] = gd->bd->bi_dram[1].size;
 
+#ifdef CONFIG_RESV_RAM
+       /* reduce size if reserved memory is within this bank */
+       if (gd->arch.resv_ram >= base[0] &&
+           gd->arch.resv_ram < base[0] + size[0])
+               size[0] = gd->arch.resv_ram - base[0];
+       else if (gd->arch.resv_ram >= base[1] &&
+                gd->arch.resv_ram < base[1] + size[1])
+               size[1] = gd->arch.resv_ram - base[1];
+#endif
+
        fdt_fixup_memory_banks(blob, base, size, 2);
 
        fsl_fdt_fixup_dr_usb(blob, bd);
index ae3027a297bf7eefc1a7d15d0879933d36348e0e..19b8fd88fa3f8b17f00d159c3e06c96835b87acf 100644 (file)
@@ -392,6 +392,10 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
                          gd->arch.secure_ram & MEM_RESERVE_SECURE_ADDR_MASK);
        }
 #endif
+#ifdef CONFIG_RESV_RAM
+       if (gd->arch.resv_ram)
+               print_num("Reserved ram", gd->arch.resv_ram);
+#endif
 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
        print_eths();
 #endif
index ae6cd8528c60a7652421afab2e20a78339e9316e..7d1ede0404df64673f85c9f674b04dde727ec3c0 100644 (file)
@@ -325,15 +325,6 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
        return gd->ram_top;
 }
 
-__weak phys_size_t board_reserve_ram_top(phys_size_t ram_size)
-{
-#ifdef CONFIG_SYS_MEM_TOP_HIDE
-       return ram_size - CONFIG_SYS_MEM_TOP_HIDE;
-#else
-       return ram_size;
-#endif
-}
-
 static int setup_dest_addr(void)
 {
        debug("Monitor len: %08lX\n", gd->mon_len);
@@ -341,26 +332,19 @@ static int setup_dest_addr(void)
         * Ram is setup, size stored in gd !!
         */
        debug("Ram size: %08lX\n", (ulong)gd->ram_size);
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
-       /* Reserve memory for secure MMU tables, and/or security monitor */
-       gd->ram_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
-       /*
-        * Record secure memory location. Need recalcuate if memory splits
-        * into banks, or the ram base is not zero.
-        */
-       gd->arch.secure_ram = gd->ram_size;
-#endif
+#if defined(CONFIG_SYS_MEM_TOP_HIDE)
        /*
         * Subtract specified amount of memory to hide so that it won't
         * get "touched" at all by U-Boot. By fixing up gd->ram_size
         * the Linux kernel should now get passed the now "corrected"
-        * memory size and won't touch it either. This has been used
-        * by arch/powerpc exclusively. Now ARMv8 takes advantage of
-        * thie mechanism. If memory is split into banks, addresses
-        * need to be calculated.
+        * memory size and won't touch it either. This should work
+        * for arch/ppc and arch/powerpc. Only Linux board ports in
+        * arch/powerpc with bootwrapper support, that recalculate the
+        * memory size from the SDRAM controller setup will have to
+        * get fixed.
         */
-       gd->ram_size = board_reserve_ram_top(gd->ram_size);
-
+       gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
+#endif
 #ifdef CONFIG_SYS_SDRAM_BASE
        gd->ram_top = CONFIG_SYS_SDRAM_BASE;
 #endif
index 079082a26fda747d0563b57f66ba5e78d635b256..9f69d75a89d0dbb40b5fa16deb92793909d0c73f 100644 (file)
@@ -154,48 +154,6 @@ int parse_mc_firmware_fit_image(u64 mc_fw_addr,
 }
 #endif
 
-/*
- * Calculates the values to be used to specify the address range
- * for the MC private DRAM block, in the MCFBALR/MCFBAHR registers.
- * It returns the highest 512MB-aligned address within the given
- * address range, in '*aligned_base_addr', and the number of 256 MiB
- * blocks in it, in 'num_256mb_blocks'.
- */
-static int calculate_mc_private_ram_params(u64 mc_private_ram_start_addr,
-                                          size_t mc_ram_size,
-                                          u64 *aligned_base_addr,
-                                          u8 *num_256mb_blocks)
-{
-       u64 addr;
-       u16 num_blocks;
-
-       if (mc_ram_size % MC_RAM_SIZE_ALIGNMENT != 0) {
-               printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n",
-                      mc_ram_size);
-               return -EINVAL;
-       }
-
-       num_blocks = mc_ram_size / MC_RAM_SIZE_ALIGNMENT;
-       if (num_blocks < 1 || num_blocks > 0xff) {
-               printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n",
-                      mc_ram_size);
-               return -EINVAL;
-       }
-
-       addr = (mc_private_ram_start_addr + mc_ram_size - 1) &
-               MC_RAM_BASE_ADDR_ALIGNMENT_MASK;
-
-       if (addr < mc_private_ram_start_addr) {
-               printf("fsl-mc: ERROR: bad start address %#llx\n",
-                      mc_private_ram_start_addr);
-               return -EFAULT;
-       }
-
-       *aligned_base_addr = addr;
-       *num_256mb_blocks = num_blocks;
-       return 0;
-}
-
 static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
                struct eth_device *eth_dev)
 {
@@ -550,17 +508,16 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
        size_t raw_image_size = 0;
 #endif
        struct mc_version mc_ver_info;
-       u64 mc_ram_aligned_base_addr;
        u8 mc_ram_num_256mb_blocks;
        size_t mc_ram_size = mc_get_dram_block_size();
 
-
-       error = calculate_mc_private_ram_params(mc_ram_addr,
-                                               mc_ram_size,
-                                               &mc_ram_aligned_base_addr,
-                                               &mc_ram_num_256mb_blocks);
-       if (error != 0)
+       mc_ram_num_256mb_blocks = mc_ram_size / MC_RAM_SIZE_ALIGNMENT;
+       if (mc_ram_num_256mb_blocks < 1 || mc_ram_num_256mb_blocks > 0xff) {
+               error = -EINVAL;
+               printf("fsl-mc: ERROR: invalid MC private RAM size (%lu)\n",
+                      mc_ram_size);
                goto out;
+       }
 
        /*
         * Management Complex cores should be held at reset out of POR.
@@ -602,11 +559,11 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
        /*
         * Tell MC what is the address range of the DRAM block assigned to it:
         */
-       reg_mcfbalr = (u32)mc_ram_aligned_base_addr |
+       reg_mcfbalr = (u32)mc_ram_addr |
                      (mc_ram_num_256mb_blocks - 1);
        out_le32(&mc_ccsr_regs->reg_mcfbalr, reg_mcfbalr);
        out_le32(&mc_ccsr_regs->reg_mcfbahr,
-                (u32)(mc_ram_aligned_base_addr >> 32));
+                (u32)(mc_ram_addr >> 32));
        out_le32(&mc_ccsr_regs->reg_mcfapr, FSL_BYPASS_AMQ);
 
        /*
@@ -714,21 +671,7 @@ int get_dpl_apply_status(void)
  */
 u64 mc_get_dram_addr(void)
 {
-       u64 mc_ram_addr;
-
-       /*
-        * The MC private DRAM block was already carved at the end of DRAM
-        * by board_init_f() using CONFIG_SYS_MEM_TOP_HIDE:
-        */
-       if (gd->bd->bi_dram[1].start) {
-               mc_ram_addr =
-                       gd->bd->bi_dram[1].start + gd->bd->bi_dram[1].size;
-       } else {
-               mc_ram_addr =
-                       gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size;
-       }
-
-       return mc_ram_addr;
+       return gd->arch.resv_ram;
 }
 
 /**
index 7279c89db56766e94ec0bcce738498bf09578109..fe87ab3c8c17518be791bcaee6a712ecf307745b 100644 (file)
  * size increases then increase this size in case of secure boot as
  * it uses raw u-boot image instead of fit image.
  */
-#define CONFIG_SYS_MONITOR_LEN         (0x80000 + CONFIG_U_BOOT_HDR_SIZE)
+#define CONFIG_SYS_MONITOR_LEN         (0x100000 + CONFIG_U_BOOT_HDR_SIZE)
 #else
-#define CONFIG_SYS_MONITOR_LEN         0x80000
+#define CONFIG_SYS_MONITOR_LEN         0x100000
 #endif /* ifdef CONFIG_U_BOOT_HDR_SIZE */
 #endif
 
index f3b521d7051f4c5321cb48d2f6d370058040cb4d..6a345c04006ed5120dda6890613ace2fb8b0857d 100644 (file)
@@ -38,7 +38,9 @@ unsigned long get_board_ddr_clk(void);
 #define SPD_EEPROM_ADDRESS             0x51
 #define CONFIG_SYS_SPD_BUS_NUM         0
 
+#ifndef CONFIG_SPL
 #define CONFIG_FSL_DDR_INTERACTIVE     /* Interactive debugging */
+#endif
 
 #define CONFIG_DDR_ECC
 #ifdef CONFIG_DDR_ECC
index 8fa3bb3a64829451c5a3b96b712205a3c2ecf7cd..f185380ae3d6673e1efa4f6ca2816ec64ac7aac6 100644 (file)
@@ -29,7 +29,9 @@
 #define CONFIG_SYS_SPD_BUS_NUM         0
 
 #define CONFIG_FSL_DDR_BIST
+#ifndef CONFIG_SPL
 #define CONFIG_FSL_DDR_INTERACTIVE     /* Interactive debugging */
+#endif
 #define CONFIG_SYS_DDR_RAW_TIMING
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
 #define CONFIG_MEM_INIT_VALUE           0xdeadbeef
index cba22ca2b6156973299f0ef978bb8ab4b4fddd92..4b3b21eaa1a63a00fd538ba7f0d1913efb95fce1 100644 (file)
@@ -38,7 +38,9 @@ unsigned long get_board_ddr_clk(void);
 #define SPD_EEPROM_ADDRESS             0x51
 #define CONFIG_SYS_SPD_BUS_NUM         0
 
+#ifndef CONFIG_SPL
 #define CONFIG_FSL_DDR_INTERACTIVE     /* Interactive debugging */
+#endif
 
 #define CONFIG_DDR_ECC
 #ifdef CONFIG_DDR_ECC
index a96aa650f77a3dbdbb03f7e5503acbba782d7092..2141b8299aa4328829c693601fe57040e1082147 100644 (file)
@@ -34,7 +34,9 @@
 #define CONFIG_ECC_INIT_VIA_DDRCONTROLLER
 #define CONFIG_MEM_INIT_VALUE           0xdeadbeef
 #define CONFIG_FSL_DDR_BIST    /* enable built-in memory test */
+#ifndef CONFIG_SPL
 #define CONFIG_FSL_DDR_INTERACTIVE     /* Interactive debugging */
+#endif
 
 #ifdef CONFIG_RAMBOOT_PBL
 #define CONFIG_SYS_FSL_PBL_PBI board/freescale/ls1046ardb/ls1046ardb_pbi.cfg
index 4ba273aeef0f875e2cec9db9518f08c1093bcc00..816d7f5a4c90e99c50805ad5051a3b21e9e66c81 100644 (file)
@@ -141,7 +141,6 @@ unsigned long long get_qixis_addr(void);
 #define CONFIG_SYS_NAND_BASE_PHYS              0x30000000
 
 /* MC firmware */
-#define CONFIG_FSL_MC_ENET
 /* TODO Actual DPL max length needs to be confirmed with the MC FW team */
 #define CONFIG_SYS_LS_MC_DPC_MAX_LENGTH            0x20000
 #define CONFIG_SYS_LS_MC_DRAM_DPC_OFFSET    0x00F00000
@@ -159,7 +158,6 @@ unsigned long long get_qixis_addr(void);
  */
 #ifdef CONFIG_FSL_MC_ENET
 #define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE           (512UL * 1024 * 1024)
-#define CONFIG_SYS_MC_RSV_MEM_ALIGN                    (512UL * 1024 * 1024)
 #endif
 
 /* Command line configuration */
index 95aa590c8af7a4d53697091b4292e2bac59a1f9e..db2ae19f590d1beacfb104533e5807bf7c93b2a2 100644 (file)
@@ -431,11 +431,8 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
        return EFI_SUCCESS;
 }
 
-int efi_memory_init(void)
+__weak void efi_add_known_memory(void)
 {
-       unsigned long runtime_start, runtime_end, runtime_pages;
-       unsigned long uboot_start, uboot_pages;
-       unsigned long uboot_stack_size = 16 * 1024 * 1024;
        int i;
 
        /* Add RAM */
@@ -448,6 +445,15 @@ int efi_memory_init(void)
                efi_add_memory_map(start, pages, EFI_CONVENTIONAL_MEMORY,
                                   false);
        }
+}
+
+int efi_memory_init(void)
+{
+       unsigned long runtime_start, runtime_end, runtime_pages;
+       unsigned long uboot_start, uboot_pages;
+       unsigned long uboot_stack_size = 16 * 1024 * 1024;
+
+       efi_add_known_memory();
 
        /* Add U-Boot */
        uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK;
index f38e56cbe3c8ffc97edb86695815e9bd824efa94..c4e5eb4691864d74fb26971b768b6d5c7d8fc6d9 100644 (file)
@@ -1163,7 +1163,6 @@ CONFIG_FSL_LAYERSCAPE
 CONFIG_FSL_LBC
 CONFIG_FSL_LINFLEXUART
 CONFIG_FSL_MC9SDZ60
-CONFIG_FSL_MC_ENET
 CONFIG_FSL_MEMAC
 CONFIG_FSL_NFC_CHIPS
 CONFIG_FSL_NFC_SPARE_SIZE
@@ -4976,7 +4975,6 @@ CONFIG_SYS_MCKR_VAL
 CONFIG_SYS_MCLINK_MAX
 CONFIG_SYS_MCMEM0_VAL
 CONFIG_SYS_MCMEM1_VAL
-CONFIG_SYS_MC_RSV_MEM_ALIGN
 CONFIG_SYS_MDC1_PIN
 CONFIG_SYS_MDCNFG_VAL
 CONFIG_SYS_MDC_PIN