Skip to contentSkip to conversation

arm64: mvebu: Fix A8K memory mapping and add documentation

PATCH New kostap at marvell.com 2 participants 2 messages Dec 19, 2016 – Dec 21, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: mvebu: Fix A8K memory mapping and add documentation

From: Konstantin Porotchkin <[email protected]>

Fix the MMU mapping for A8K device family:
- Separate A7K and A8K memory mappings
- Fix memory regions by including IO mapping for all 3 PCIe interfaces existing on each connected CP110 controller
Add A8K memory mapping documentation with all regions configured by Marvell ATF.

Change-Id I9c930569b1853900f5fba2d5db319b092cc7a2a6
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Omri Itach <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Cc Hanna Hawa <[email protected]>

---
Changes for v2:
- Exclude CP1 memory regions from A7K MMU map
- Dynamically adjust the MMU regions list according to the platform type

 arch/arm/mach-mvebu/armada8k/cpu.c | 58 +++++++++++++++++++++++++++++---------
 doc/mvebu/armada-8k-memory.txt     | 56 ++++++++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+), 13 deletions(-)
 create mode 100644 doc/mvebu/armada-8k-memory.txt
arch/arm/mach-mvebu/armada8k/cpu.c +45 -13
index 2719d68..2325e9a 100644
@@ -21,7 +21,33 @@ DECLARE_GLOBAL_DATA_PTR;
 #define RFU_GLOBAL_SW_RST		(MVEBU_RFU_BASE + 0x84)
 #define RFU_SW_RESET_OFFSET		0
 
+/*
+ * The following table includes all memory regions for Armada 7k and
+ * 8k SoCs. The Armada 7k is missing the CP110 slave regions here. Lets
+ * define these regions at the beginning of the struct so that they
+ * can be easier removed later dynamically if an Armada 7k device is detected.
+ * For a detailed memory map, please see doc/mvebu/armada-8k-memory.txt
+ */
+#define ARMADA_7K8K_COMMON_REGIONS_START	2
 static struct mm_region mvebu_mem_map[] = {
+	/* Armada 80x0 memory regions include the CP1 (slave) units */
+	{
+		/* SRAM, MMIO regions - CP110 slave region */
+		.phys = 0xf4000000UL,
+		.virt = 0xf4000000UL,
+		.size = 0x02000000UL,	/* 32MiB internal registers */
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE
+	},
+	{
+		/* PCI CP1 regions */
+		.phys = 0xfa000000UL,
+		.virt = 0xfa000000UL,
+		.size = 0x04000000UL,	/* 64MiB CP110 slave PCI space */
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE
+	},
+	/* Armada 80x0 and 70x0 common memory regions start here */
 	{
 		/* RAM */
 		.phys = 0x0UL,
@@ -47,29 +73,35 @@ static struct mm_region mvebu_mem_map[] = {
 			 PTE_BLOCK_NON_SHARE
 	},
 	{
-		/* SRAM, MMIO regions - CP110 slave region */
-		.phys = 0xf4000000UL,
-		.virt = 0xf4000000UL,
-		.size = 0x02000000UL,	/* 32MiB internal registers */
+		/* PCI CP0 regions */
+		.phys = 0xf6000000UL,
+		.virt = 0xf6000000UL,
+		.size = 0x04000000UL,	/* 64MiB CP110 master PCI space */
 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 			 PTE_BLOCK_NON_SHARE
 	},
 	{
-		/* PCI regions */
-		.phys = 0xf8000000UL,
-		.virt = 0xf8000000UL,
-		.size = 0x08000000UL,	/* 128MiB PCI space (master & slave) */
-		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
-			 PTE_BLOCK_NON_SHARE
-	},
-	{
-		/* List terminator */
 		0,
 	}
 };
 
 struct mm_region *mem_map = mvebu_mem_map;
 
+void enable_caches(void)
+{
+	/*
+	 * Armada 7k is not equipped with the CP110 slave CP. In case this
+	 * code runs on an Armada 7k device, lets remove the CP110 slave
+	 * entries from the memory mapping by moving the start to the
+	 * common regions.
+	 */
+	if (of_machine_is_compatible("marvell,armada7040"))
+		mem_map = &mvebu_mem_map[ARMADA_7K8K_COMMON_REGIONS_START];
+
+	icache_enable();
+	dcache_enable();
+}
+
 void reset_cpu(ulong ignored)
 {
 	u32 reg;
doc/mvebu/armada-8k-memory.txt new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 arm64: mvebu: Fix A8K memory mapping and add documentation

Quoted 9 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Fix the MMU mapping for A8K device family:
- Separate A7K and A8K memory mappings
- Fix memory regions by including IO mapping for all 3 PCIe interfaces existing on each connected CP110 controller
Add A8K memory mapping documentation with all regions configured by Marvell ATF.

Quoted 10 lines
Change-Id I9c930569b1853900f5fba2d5db319b092cc7a2a6
Cc Stefan Roese <[email protected]>
Cc Nadav Haklai <[email protected]>
Cc Neta Zur Hershkovits <[email protected]>
Cc Omri Itach <[email protected]>
Cc Igal Liberman <[email protected]>
Cc Haim Boot <[email protected]>
Cc Hanna Hawa <[email protected]>

Applied to u-boot-marvell/master.

Thanks,
Stefan