Skip to contentSkip to conversation

arm64: mvebu: Linux kernel boot support

PATCH New kostap at marvell.com 2 participants 5 messages Dec 4, 2016 – Dec 12, 2016

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

cover arm64: mvebu: Linux kernel boot support

From: Konstantin Porotchkin <[email protected]>

This set of patches adds features for allowing Linux kernel boot and root on NFS for Marvell A8K family boards.
These changes were tested when applied on top of previously sent series of patches named:
"arm64: mvebu: Armada-8K family patches" version 2.

Changes in this patch series:
- Add support for L3 cache flush preventing from data corruption after turning off d-cache and MMU as part of the boot cleanup
- Add support for PCIe on Armada-7040 DB (required for NFS support using PCIe NIC due to yet missing port for the PPv2 ETH driver)
- Add hush parser support on A8K boards for allowing bootcmd configuration using CLI scripting

Konstantin Porotchkin (3):
arm64: mvebu: Add L3 cache flush functionality to A8K family
arm64: mvebu: Enable PCIe support in Armada-7040 configuration
arm64: mvebu: Enable hush parser in A8K default configuration

 arch/arm/include/asm/arch-armada8k/cache_llc.h | 21 ++++++++++++++
 arch/arm/mach-mvebu/armada8k/Makefile          |  1 +
 arch/arm/mach-mvebu/armada8k/cache_llc.S       | 39 ++++++++++++++++++++++++++
 configs/mvebu_db-88f7040_defconfig             |  4 +++
 configs/mvebu_db-88f8040_defconfig             |  1 +
 5 files changed, 66 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-armada8k/cache_llc.h
 create mode 100644 arch/arm/mach-mvebu/armada8k/cache_llc.S
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 arm64: mvebu: Add L3 cache flush functionality to A8K family

From: Konstantin Porotchkin <[email protected]>

Add missing L3 cache flush functionality which absence prevents Linux kernel from normal boot in case the L3 cache is enabled by ATF.
The L3 cache is named the "last level" cache in order to keep the terminology similar to the ATF code.
This cache should not be disabled by u-boot since the Linux kernel cannot activate it, so it is activates at ATF stage. However the cache flush is required for preventing data corruption after disabling the MMU and the data cache before passing control to the loaded Linux image.

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]>
---
 arch/arm/include/asm/arch-armada8k/cache_llc.h | 21 ++++++++++++++
 arch/arm/mach-mvebu/armada8k/Makefile          |  1 +
 arch/arm/mach-mvebu/armada8k/cache_llc.S       | 39 ++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-armada8k/cache_llc.h
 create mode 100644 arch/arm/mach-mvebu/armada8k/cache_llc.S
arch/arm/include/asm/arch-armada8k/cache_llc.h new file +21 -0
new file mode 100644
index 0000000..8f97e6d
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2016 Marvell International Ltd.
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ * https://spdx.org/licenses
+ */
+
+#ifndef _CACHE_LLC_H_
+#define _CACHE_LLC_H_
+
+/* Armada-7K/8K last level cache */
+
+#define MVEBU_A8K_REGS_BASE_MSB		0xf000
+#define LLC_BASE_ADDR			0x8000
+#define LLC_CACHE_SYNC			0x700
+#define LLC_CACHE_SYNC_COMPLETE		0x730
+#define LLC_FLUSH_BY_WAY		0x7fc
+#define LLC_WAY_MASK			0xffffffff
+#define LLC_CACHE_SYNC_MASK		0x1
+
+#endif	/* _CACHE_LLC_H_ */
arch/arm/mach-mvebu/armada8k/Makefile +1 -0
index 84c69d9..0facf14 100644
@@ -5,3 +5,4 @@
 #
 
 obj-y = cpu.o
+obj-y += cache_llc.o
arch/arm/mach-mvebu/armada8k/cache_llc.S new file +39 -0
new file mode 100644
index 0000000..71aecb2
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 Marvell International Ltd.
+ *
+ * SPDX-License-Identifier:	GPL-2.0
+ * https://spdx.org/licenses
+ */
+
+#include <asm/arch-armada8k/cache_llc.h>
+#include <linux/linkage.h>
+
+/*
+ * int __asm_flush_l3_dcache
+ *
+ * flush Armada-8K last level cache.
+ *
+ */
+ENTRY(__asm_flush_l3_dcache)
+	/* flush cache */
+	mov     x0, #LLC_BASE_ADDR
+	add	x0, x0, #LLC_FLUSH_BY_WAY
+	movk    x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
+	mov     w1, #LLC_WAY_MASK
+	str     w1, [x0]
+	/* sync cache */
+	mov     x0, #LLC_BASE_ADDR
+	add	x0, x0, #LLC_CACHE_SYNC
+	movk    x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
+	str     wzr, [x0]
+	/* check that cache sync completed */
+	mov     x0, #LLC_BASE_ADDR
+	add	x0, x0, #LLC_CACHE_SYNC_COMPLETE
+	movk    x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
+1:	ldr	w1, [x0]
+	and	w1, w1, #LLC_CACHE_SYNC_MASK
+	cbnz	w1, 1b
+	/* return success */
+	mov	x0, #0
+	ret
+ENDPROC(__asm_flush_l3_dcache)
Signature · 1 line
2.7.4
#3 lore raw

PATCH 2/3 arm64: mvebu: Enable PCIe support in Armada-7040 configuration

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Enable PCIe bus support in Armada-7040 DB default configuration

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]>
---
 configs/mvebu_db-88f7040_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/mvebu_db-88f7040_defconfig +3 -0
index e3bdda6..d9de252 100644
@@ -37,6 +37,9 @@ CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_PHYLIB=y
+CONFIG_PCI=y
+CONFIG_DM_PCI=y
+CONFIG_PCIE_DW_MVEBU=y
 CONFIG_MVEBU_COMPHY_SUPPORT=y
 # CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DEBUG_UART=y
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/3 arm64: mvebu: Enable hush parser in A8K default configuration

In reply to kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Enable hush parser in Armada-7040 and Armada-8040 DB default configurations.

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]>
---
 configs/mvebu_db-88f7040_defconfig | 1 +
 configs/mvebu_db-88f8040_defconfig | 1 +
 2 files changed, 2 insertions(+)
configs/mvebu_db-88f7040_defconfig +1 -0
index d9de252..a2bb97a 100644
@@ -55,3 +55,4 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_SMBIOS_MANUFACTURER=""
 CONFIG_PINCTRL=y
+CONFIG_HUSH_PARSER=y
configs/mvebu_db-88f8040_defconfig +1 -0
index 5d5be64..1e92e9f 100644
@@ -55,3 +55,4 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_SMBIOS_MANUFACTURER=""
 CONFIG_PINCTRL=y
+CONFIG_HUSH_PARSER=y
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/3 arm64: mvebu: Add L3 cache flush functionality to A8K family

In reply to kostap at marvell.com
Quoted 13 lines · kostap at marvell.com

From: Konstantin Porotchkin <[email protected]>

Add missing L3 cache flush functionality which absence prevents Linux kernel from normal boot in case the L3 cache is enabled by ATF.
The L3 cache is named the "last level" cache in order to keep the terminology similar to the ATF code.
This cache should not be disabled by u-boot since the Linux kernel cannot activate it, so it is activates at ATF stage. However the cache flush is required for preventing data corruption after disabling the MMU and the data cache before passing control to the loaded Linux image.

Quoted 8 lines
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]>

Patchset applied to u-boot-marvell/master.

Thanks,
Stefan