[U-Boot] [RFC PATCH 12/13] arm: add NanoPi M3 board support

Andre Przywara
2017-11-30T01:25:10Z

The NanoPi M3 is a single board computer containing a
Nexell S5P6818 SoC (with 8 ARMv8 Cortex-A53 cores).
Add the respective defconfig and a (preliminary) device tree listing
the devices that we support so far.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/Kconfig | 6 ++++++
arch/arm/dts/s5p6818-nanopi-m3.dts | 30 ++++++++++++++++++++++++++++++
arch/arm/include/asm/arch-nexell/clk.h | 1 +
arch/arm/mach-nexell/board.c | 10 ++++++++++
configs/nanopi_m3_defconfig | 12 ++++++++++++
include/configs/s5p6818.h | 2 ++
6 files changed, 61 insertions(+)
create mode 100644 arch/arm/dts/s5p6818-nanopi-m3.dts
create mode 100644 configs/nanopi_m3_defconfig

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 56f6179fe3..5c52344ca6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -660,6 +660,12 @@ config ARCH_NEXELL
select DM
select DM_SERIAL
select SAMSUNG_UART
+ select DM_RESET
+ select GENERIC_RESET
+ select DM_MMC
+ select DM_MMC_OPS
+ select MMC_DW
+ select MMC_DW_NEXELL

config ARCH_QEMU
bool "QEMU Virtual Platform"
diff --git a/arch/arm/dts/s5p6818-nanopi-m3.dts b/arch/arm/dts/s5p6818-nanopi-m3.dts
new file mode 100644
index 0000000000..c95c40120e
--- /dev/null
+++ b/arch/arm/dts/s5p6818-nanopi-m3.dts
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+#include "s5p6818.dtsi"
+
+/ {
+ model = "Nano Pi M3";
+ compatible = "FriendlyARM,NanoPi-M3";
+
+ chosen {
+ stdout-path = "serial0:115200";
+ bootargs = "console=ttySAC0,115200n8 earlycon=s5pv210,0xc00a1000";
+ };
+
+ aliases {
+ mmc0 = &mmc_0;
+ serial0 = &serial_0;
+ };
+
+ memory {
+ reg = <0x40000000 0x40000000>;
+ };
+};
+
+&serial_0 {
+ status = "okay";
+};
+
+&mmc_0 {
+ status = "okay";
+};
diff --git a/arch/arm/include/asm/arch-nexell/clk.h b/arch/arm/include/asm/arch-nexell/clk.h
index 8cf56ef52c..792aabfffb 100644
--- a/arch/arm/include/asm/arch-nexell/clk.h
+++ b/arch/arm/include/asm/arch-nexell/clk.h
@@ -9,6 +9,7 @@
#define __ASM_ARCH_CLK_H_

unsigned long get_uart_clk(int dev_index);
+unsigned long get_mmc_clk(int dev_index);
unsigned long get_pwm_clk(void);

#endif
diff --git a/arch/arm/mach-nexell/board.c b/arch/arm/mach-nexell/board.c
index e9b4f94630..a968863e14 100644
--- a/arch/arm/mach-nexell/board.c
+++ b/arch/arm/mach-nexell/board.c
@@ -112,6 +112,16 @@ unsigned long get_pwm_clk(void)
return get_pll_freq(pll_index) / div;
}

+unsigned long get_mmc_clk(int dev_index)
+{
+ uintptr_t clock_ofs[3] = {0xc00c5000, 0xc00cc000, 0xc00cd000};
+
+ if (dev_index < 0 || dev_index >= 3)
+ return 0;
+
+ return get_level1_clk_freq(clock_ofs[dev_index]);
+}
+
int board_init(void)
{
return 0;
diff --git a/configs/nanopi_m3_defconfig b/configs/nanopi_m3_defconfig
new file mode 100644
index 0000000000..148ff1a8b9
--- /dev/null
+++ b/configs/nanopi_m3_defconfig
@@ -0,0 +1,12 @@
+CONFIG_ARM=y
+CONFIG_ARCH_NEXELL=y
+# CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_DEFAULT_DEVICE_TREE="s5p6818-nanopi-m3"
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
diff --git a/include/configs/s5p6818.h b/include/configs/s5p6818.h
index 4d394dbec9..dff4736e20 100644
--- a/include/configs/s5p6818.h
+++ b/include/configs/s5p6818.h
@@ -30,4 +30,6 @@

#define CONFIG_SYS_TIMER_COUNTER 0xc0017040 /* TCNTO4 */

+#define CONFIG_BOUNCE_BUFFER
+
#endif /* __CONFIG_H */
--
2.14.1