Nexell S5P6818 SoC support
Subsystems (6)
cover Nexell S5P6818 SoC support
Hi,
this is a first draft of the things Amit and I have been working on in the last months. It introduces support for an SoC called "Nexell S5P6818". This is an Octa-core ARMv8 SoC with Cortex-A53 cores, which apparently is closely related to (older) Samsung SoCs. Many peripherals are compatible to Samsung IP (UART, MMC, Ethernet, timers, ...), but some core peripherals like the clocks and the pin controller seem to be completely different. We used the NanoPi M3 board [1] for testing, which uses this SoC along with the usual suspects of on-board components and connectors.
This port is done completely from scratch, by just looking at the manual. This allows a much cleaner and modern U-Boot support than the BSP code.
The ARM Generic Timer (aka. arch timer) does not seem to work on this SoC. Ideally there would be some (hidden?) register enabling the right clock source, though we haven't found one (yet). But as also other code for this SoC out there on the net does not seem to be able to use the arch timer, I am not too hopeful here. While this does not impose a real problem to U-Boot (patch 3/13 takes care of that), it is a showstopper for mainline arm64 Linux, which heavily relies on the arch timer (since it's a mandatory part of the ARMv8 architecture). There is only a very small chance that the arch timer ever becomes optional in the mainline arm64 kernel. However our arm(32) kernel ports works quite nicely so far, also a (hacked) arm64 kernel boots to the prompt. We will submit Linux patches at a later time.
We would be grateful to get some comments on the patches.
The first five patches adapt existing code to simplify support for this SoC. The following six patches then successively enable and add SoC support, culmulating in the addition of a nanopi_m3_defconfig file in patch 11/13. The SoC support code is actually architecture agnostic, though up until the last patch it generates an AArch64 binary. To overcome the problems with the arch timer mentioned above, the final patch switches the port over to AArch32, which can more naturally launch arm kernels.
This code so far does not include an SPL, instead it relies on some vendor provided code to initialise the DRAM and load U-Boot proper. The original BSP code provided a binary blob for that (called "secondboot"), although there is some GPLed version of that available on github([2]). We can load a 32-bit U-Boot with both the vendor blob and Rafaello's GPL version, the 64-bit version is only usable with the GPL code. Instruction on how to create a bootable SD card are contained in the arch/arm/mach-nexell/README file.
We would be very grateful to get some first feedback on those patches and the approach in general taken here.
Cheers,
Andre.
[1] http://nanopi.io/nanopi-m3.html
[2] https://github.com/rafaello7/bl1-nanopi-m3
Amit Singh Tomar (4):
reset: add driver for generic reset controllers
mmc: add MMC (glue) driver for Nexell SoCs
arm: nexell: add ARM64 MMU regions
arm: nexell: add timer support
Andre Przywara (9):
serial: s5p: rework Samsung UART driver to get rid of uart.h
serial: S5P/Samsung: refactor and Kconfig-ize UART selection
arm: move SYS_ARCH_TIMER to KConfig
arm: add basic framework for Nexell S5P6818 support
arm: nexell: embed NSIH header
arm: nexell: add UART support
arm: nexell: add preliminary S5P6818 SoC device tree
arm: add NanoPi M3 board support
arm: nexell: switch to 32-bit
arch/arm/Kconfig | 29 +++++ arch/arm/Makefile | 1 + arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/dts/s5p6818-nanopi-m3.dts | 30 +++++ arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++ arch/arm/include/asm/arch-nexell/clk.h | 15 +++ arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++ arch/arm/mach-exynos/include/mach/uart.h | 44 ------- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + arch/arm/mach-nexell/Kconfig | 9 ++ arch/arm/mach-nexell/Makefile | 10 ++ arch/arm/mach-nexell/README | 49 ++++++++ arch/arm/mach-nexell/board.c | 128 +++++++++++++++++++ arch/arm/mach-nexell/mmu-arm64.c | 39 ++++++ arch/arm/mach-s5pc1xx/Kconfig | 2 + arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------- configs/nanopi_m3_defconfig | 12 ++ drivers/mmc/Kconfig | 8 ++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++ drivers/reset/Kconfig | 6 + drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 +++++++++++++++++ drivers/serial/Kconfig | 6 + drivers/serial/Makefile | 2 +- drivers/serial/serial_s5p.c | 45 ++++++- include/configs/mx7ulp_evk.h | 1 - include/configs/s5p6818.h | 35 ++++++ include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 33 files changed, 989 insertions(+), 100 deletions(-) create mode 100644 arch/arm/dts/s5p6818-nanopi-m3.dts create mode 100644 arch/arm/dts/s5p6818.dtsi create mode 100644 arch/arm/include/asm/arch-nexell/boot0.h create mode 100644 arch/arm/include/asm/arch-nexell/clk.h create mode 100644 arch/arm/include/asm/arch-nexell/pwm.h delete mode 100644 arch/arm/mach-exynos/include/mach/uart.h create mode 100644 arch/arm/mach-nexell/Kconfig create mode 100644 arch/arm/mach-nexell/Makefile create mode 100644 arch/arm/mach-nexell/README create mode 100644 arch/arm/mach-nexell/board.c create mode 100644 arch/arm/mach-nexell/mmu-arm64.c delete mode 100644 arch/arm/mach-s5pc1xx/include/mach/uart.h create mode 100644 configs/nanopi_m3_defconfig create mode 100644 drivers/mmc/nexell_dw_mmc.c create mode 100644 drivers/reset/reset-generic.c create mode 100644 include/configs/s5p6818.h
Signature · 1 line
2.14.1
RFC PATCH 1/13 serial: s5p: rework Samsung UART driver to get rid of uart.h
At the moment the serial_s5p driver takes care of both Exynos UARTs as well as those from older Samsung SoCs (s3c/s5p series). Looking more closely the only difference between those two groups is how the fractional baud rate is programmed: via a "divslot" (s3c) or as a proper fractional value (Exynos).
Instead of intricately expressing this via a special header file (which is otherwise identical), let's use the blessings of DT to tackle this:
The S5P series of SoCs use their own compatible string, in line with what the official DTs from the Linux kernel do. We then switch between divslot and fractional value based on the compatible string used. This allows us to get rid of the uart.h header files and make the driver more flexible.
--- arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/mach-exynos/include/mach/uart.h | 44 ------------------------------ arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------------------------------ drivers/serial/serial_s5p.c | 45 +++++++++++++++++++++++++++---- 5 files changed, 42 insertions(+), 95 deletions(-) delete mode 100644 arch/arm/mach-exynos/include/mach/uart.h delete mode 100644 arch/arm/mach-s5pc1xx/include/mach/uart.h
arch/arm/dts/s5pc1xx-goni.dts +1 -1
@@ -28,7 +28,7 @@ }; serial at e2900800 { - compatible = "samsung,exynos4210-uart"; + compatible = "samsung,s5pv210-uart"; reg = <0xe2900800 0x400>; id = <2>; };
arch/arm/dts/s5pc1xx-smdkc100.dts +1 -1
@@ -27,7 +27,7 @@ }; serial at ec000000 { - compatible = "samsung,exynos4210-uart"; + compatible = "samsung,s5pv210-uart"; reg = <0xec000000 0x100>; interrupts = <0 51 0>; id = <0>;
arch/arm/mach-exynos/include/mach/uart.h deleted +0 -44
44 lines not on this page · raw message
arch/arm/mach-s5pc1xx/include/mach/uart.h deleted +0 -44
44 lines not on this page · raw message
drivers/serial/serial_s5p.c +40 -5
102 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 1/13 serial: s5p: rework Samsung UART driver to get rid of uart.h
Quoted 29 lines · Andre Przywara
At the moment the
serial_s5pdriver takes care of both Exynos UARTs as well as those from older Samsung SoCs (s3c/s5p series). Looking more closely the only difference between those two groups is how the fractional baud rate is programmed: via a "divslot" (s3c) or as a proper fractional value (Exynos).
Instead of intricately expressing this via a special header file (which is otherwise identical), let's use the blessings of DT to tackle this:
The S5P series of SoCs use their own compatible string, in line with what the official DTs from the Linux kernel do. We then switch between divslot and fractional value based on the compatible string used. This allows us to get rid of theuart.hheader files and make the driver more flexible.Signed-off-by Andre Przywara <[email protected]>--- arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/mach-exynos/include/mach/uart.h | 44 ------------------------------ arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------------------------------ drivers/serial/serial_s5p.c | 45 +++++++++++++++++++++++++++---- 5 files changed, 42 insertions(+), 95 deletions(-) delete mode 100644 arch/arm/mach-exynos/include/mach/uart.h delete mode 100644 arch/arm/mach-s5pc1xx/include/mach/uart.harch/arm/dts/s5pc1xx-goni.dts +0
-0
arch/arm/dts/s5pc1xx-goni.dts line 31
Quoted 5 lines
arch/arm/dts/s5pc1xx-goni.dts +1
-1@@ -28,7 +28,7 @@ }; serial at e2900800 { - compatible = "samsung,exynos4210-uart"; + compatible = "samsung,s5pv210-uart";
Does this match linux?
Apart from that:
RFC PATCH 1/13 serial: s5p: rework Samsung UART driver to get rid of uart.h
Hi Simon,
Quoted 32 lines · Simon Glass
Quoted 31 lines · Andre Przywara
At the moment the
serial_s5pdriver takes care of both Exynos UARTs as well as those from older Samsung SoCs (s3c/s5p series). Looking more closely the only difference between those two groups is how the fractional baud rate is programmed: via a "divslot" (s3c) or as a proper fractional value (Exynos).
Instead of intricately expressing this via a special header file (which is otherwise identical), let's use the blessings of DT to tackle this:
The S5P series of SoCs use their own compatible string, in line with what the official DTs from the Linux kernel do. We then switch between divslot and fractional value based on the compatible string used. This allows us to get rid of theuart.hheader files and make the driver more flexible.Signed-off-by Andre Przywara <[email protected]>--- arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/mach-exynos/include/mach/uart.h | 44 ------------------------------ arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------------------------------ drivers/serial/serial_s5p.c | 45 +++++++++++++++++++++++++++---- 5 files changed, 42 insertions(+), 95 deletions(-) delete mode 100644 arch/arm/mach-exynos/include/mach/uart.h delete mode 100644 arch/arm/mach-s5pc1xx/include/mach/uart.harch/arm/dts/s5pc1xx-goni.dts +0
-0@@ -28,7 +28,7 @@ };
Quoted 5 lines
arch/arm/dts/s5pc1xx-goni.dts line 31
Quoted 3 lines
arch/arm/dts/s5pc1xx-goni.dts +1
-1serial at e2900800 { - compatible = "samsung,exynos4210-uart"; + compatible = "samsung,s5pv210-uart";Does this match linux?
Yes, this is where I got the compatible from:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/s5pv210.dtsi#n331
And s5pv210.dtsi is included by s5pv210-goni.dts.
Quoted 3 lines
Apart from that:
Reviewed-by Simon Glass <[email protected]>
Thanks a ton for the complete review! This is much appreciated!
Cheers,
Andre.
RFC PATCH 2/13 serial: S5P/Samsung: refactor and Kconfig-ize UART selection
In reply to Andre PrzywaraCurrently the UART used by some Samsung SoCs is selected by the generic CONFIG_S5P define. This makes it hard to re-use that UART without pulling in the whole of the S5P code. Also the Exynos SoCs use this driver, which is in fact a generic Samsung UART driver.
So create a new Kconfig symbol CONFIG_SAMSUNG_UART to reflect this and change the existing boards to use this symbol.
--- arch/arm/Kconfig | 1 + arch/arm/mach-s5pc1xx/Kconfig | 2 ++ drivers/serial/Kconfig | 6 ++++++ drivers/serial/Makefile | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -0
@@ -557,6 +557,7 @@ config ARCH_EXYNOS select DM_I2C select DM_SPI_FLASH select DM_SERIAL + select SAMSUNG_UART select DM_SPI select DM_GPIO select DM_KEYBOARD
arch/arm/mach-s5pc1xx/Kconfig +2 -0
@@ -7,10 +7,12 @@ choice config TARGET_S5P_GONI bool "S5P Goni board" select OF_CONTROL + select SAMSUNG_UART config TARGET_SMDKC100 bool "Support smdkc100 board" select OF_CONTROL + select SAMSUNG_UART endchoice
drivers/serial/Kconfig +6 -0
@@ -428,6 +428,12 @@ config PIC32_SERIAL help Support for the UART found on Microchip PIC32 SoC's. +config SAMSUNG_UART + bool "Samsung S5P/Nexell UART support" + help + Support for the UART found on various Samsung SoCs, for instance + in the Exynos series or the S5P chips. + config SYS_NS16550 bool "NS16550 UART or compatible" help
drivers/serial/Makefile +1 -1
@@ -25,7 +25,7 @@ obj-$(CONFIG_EFI_APP) += serial_efi.o obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o obj-$(CONFIG_MCFUART) += mcfuart.o obj-$(CONFIG_SYS_NS16550) += ns16550.o -obj-$(CONFIG_S5P) += serial_s5p.o +obj-$(CONFIG_SAMSUNG_UART) += serial_s5p.o obj-$(CONFIG_MXC_UART) += serial_mxc.o obj-$(CONFIG_PXA_SERIAL) += serial_pxa.o obj-$(CONFIG_MESON_SERIAL) += serial_meson.o
Signature · 1 line
2.14.1
RFC PATCH 2/13 serial: S5P/Samsung: refactor and Kconfig-ize UART selection
Quoted 8 lines · Andre Przywara
Currently the UART used by some Samsung SoCs is selected by the generic
CONFIG_S5Pdefine. This makes it hard to re-use that UART without pulling in the whole of the S5P code. Also the Exynos SoCs use this driver, which is in fact a generic Samsung UART driver.So create a new
KconfigsymbolCONFIG_SAMSUNG_UARTto reflect this and change the existing boards to use this symbol.
Quoted 7 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mach-s5pc1xx/Kconfig | 2 ++ drivers/serial/Kconfig | 6 ++++++ drivers/serial/Makefile | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-)
RFC PATCH 3/13 arm: move SYS_ARCH_TIMER to KConfig
In reply to Andre PrzywaraSYS_ARCH_TIMER guards the usage of the ARM Generic Timer (aka arch timer) in U-Boot.
At the moment it is mandatory for ARMv8 and used by two ARMv7 boards. Add a proper Kconfig symbol to express this dependency properly, allowing certain board configuration to later disable arch timer in case there are any problems with it.
--- arch/arm/Kconfig | 11 +++++++++++ arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + include/configs/mx7ulp_evk.h | 1 - include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 6 files changed, 13 insertions(+), 4 deletions(-)
arch/arm/Kconfig +11 -0
@@ -209,6 +209,16 @@ config SYS_CACHELINE_SIZE default 64 if SYS_CACHE_SHIFT_6 default 32 if SYS_CACHE_SHIFT_5 +config SYS_ARCH_TIMER + bool "ARM Generic Timer support" + depends on CPU_V7 || ARM64 + default y if ARM64 + help + The ARM Generic Timer (aka arch-timer) provides an architected + interface to a timer source on an SoC. + It is mandantory for ARMv8 implementation and widely available + on ARMv7 systems. + config ARM_SMCCC bool "Support for ARM SMC Calling Convention (SMCCC)" depends on CPU_V7 || ARM64
@@ -586,6 +596,7 @@ config ARCH_KEYSTONE select SUPPORT_SPL select SYS_THUMB_BUILD select CMD_POWEROFF + select SYS_ARCH_TIMER imply CMD_MTDPARTS imply FIT imply CMD_SAVES
arch/arm/cpu/armv8/Makefile +1 -1
@@ -9,7 +9,7 @@ extra-y := start.o obj-y += cpu.o ifndef CONFIG_$(SPL_TPL_)TIMER -obj-y += generic_timer.o +obj-$(CONFIG_SYS_ARCH_TIMER) += generic_timer.o endif obj-y += cache_v8.o obj-y += exceptions.o
arch/arm/mach-imx/mx7ulp/Kconfig +1 -0
@@ -9,6 +9,7 @@ choice config TARGET_MX7ULP_EVK bool "Support mx7ulp EVK board" + select SYS_ARCH_TIMER endchoice
include/configs/mx7ulp_evk.h +0 -1
@@ -47,7 +47,6 @@/* Using ULP WDOG for reset */ #define WDOG_BASE_ADDR WDG1_RBASE -#define CONFIG_SYS_ARCH_TIMER #define CONFIG_SYS_HZ_CLOCK 1000000/* Fixed at 1Mhz from TSTMR */ #define CONFIG_INITRD_TAG
include/configs/ti_armv7_keystone2.h +0 -1
@@ -17,7 +17,6 @@/* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT -#define CONFIG_SYS_ARCH_TIMER #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0x0c000000#endif
scripts/config_whitelist.txt +0 -1
@@ -2285,7 +2285,6 @@ CONFIG_SYS_APP1_BASE CONFIG_SYS_APP1_SIZE CONFIG_SYS_APP2_BASE CONFIG_SYS_APP2_SIZE -CONFIG_SYS_ARCH_TIMER CONFIG_SYS_ARM_CACHE_WRITETHROUGH CONFIG_SYS_AT91_CPU_NAME CONFIG_SYS_AT91_MAIN_CLOCK
Signature · 1 line
2.14.1
RFC PATCH 3/13 arm: move SYS_ARCH_TIMER to KConfig
Quoted 8 lines · Andre Przywara
SYS_ARCH_TIMERguards the usage of the ARM Generic Timer (aka arch timer) in U-Boot.
At the moment it is mandatory for ARMv8 and used by two ARMv7 boards. Add a properKconfigsymbol to express this dependency properly, allowing certain board configuration to later disable arch timer in case there are any problems with it.Signed-off-by Andre Przywara <[email protected]>
Quoted 8 lines
--- arch/arm/Kconfig | 11 +++++++++++ arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + include/configs/mx7ulp_evk.h | 1 - include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 6 files changed, 13 insertions(+), 4 deletions(-)
RFC PATCH 3/13 arm: move SYS_ARCH_TIMER to KConfig
In reply to Andre PrzywaraHi Andre,
Quoted 8 lines · Andre Przywara
SYS_ARCH_TIMERguards the usage of the ARM Generic Timer (aka arch timer) in U-Boot.
At the moment it is mandatory for ARMv8 and used by two ARMv7 boards. Add a properKconfigsymbol to express this dependency properly, allowing certain board configuration to later disable arch timer in case there are any problems with it.Signed-off-by Andre Przywara <[email protected]>
Quoted 8 lines
--- arch/arm/Kconfig | 11 +++++++++++ arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + include/configs/mx7ulp_evk.h | 1 - include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 6 files changed, 13 insertions(+), 4 deletions(-)
This patch needs refreshing, as on master there are more usages of the symbol that need conversion:
include/configs/qemu-arm.h:#define CONFIG_SYS_ARCH_TIMER include/configs/stm32h743-disco.h:#define CONFIG_SYS_ARCH_TIMER include/configs/stm32h743-eval.h:#define CONFIG_SYS_ARCH_TIMER
Otherwise looks good.
RFC PATCH 3/13 arm: move SYS_ARCH_TIMER to KConfig
Hi Tuomas,
Quoted 20 lines · Tuomas Tynkkynen
Hi Andre,
Quoted 8 lines · Andre Przywara
SYS_ARCH_TIMERguards the usage of the ARM Generic Timer (aka arch timer) in U-Boot.
At the moment it is mandatory for ARMv8 and used by two ARMv7 boards. Add a properKconfigsymbol to express this dependency properly, allowing certain board configuration to later disable arch timer in case there are any problems with it.Signed-off-by Andre Przywara <[email protected]>Quoted 8 lines
---
arch/arm/Kconfig | 11 +++++++++++ arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + include/configs/mx7ulp_evk.h | 1 -include/configs/ti_armv7_keystone2.h| 1 - scripts/config_whitelist.txt | 1 -6 files changed, 13 insertions(+), 4 deletions(-)
Quoted 8 lines
This patch needs refreshing, as on master there are more usages of the symbol that need conversion:
include/configs/qemu-arm.h:#define
CONFIG_SYS_ARCH_TIMERinclude/configs/stm32h743-disco.h:#defineCONFIG_SYS_ARCH_TIMERinclude/configs/stm32h743-eval.h:#defineCONFIG_SYS_ARCH_TIMEROtherwise looks good.
Thanks for the heads up!
Will include this in the next version.
Cheers,
Andre.
RFC PATCH 3/13 arm: move SYS_ARCH_TIMER to KConfig
In reply to Andre PrzywaraHi,
Quoted 8 lines · On Thu, 30 Nov 2017 01:25:01 +0000 Andre Przywara <[email protected]>…
SYS_ARCH_TIMERguards the usage of the ARM Generic Timer (aka arch timer) in U-Boot.
At the moment it is mandatory for ARMv8 and used by two ARMv7 boards. Add a properKconfigsymbol to express this dependency properly, allowing certain board configuration to later disable arch timer in case there are any problems with it.Signed-off-by Andre Przywara <[email protected]>
I was doing some SYS_ARCH_TIMER related cleanup to qemu-arm, so I took the opportunity to test + send a rebased + resynced version of this patch at the same time. Hope that it doesn't conflict or cause any problems with upgrading this Nexell patchset.
- Tuomas
RFC PATCH 4/13 reset: add driver for generic reset controllers
In reply to Andre PrzywaraFrom: Amit Singh Tomar <[email protected]>
The simplest and most generic form of a reset controller just exposes multiple MMIO registers, where each bit toggles a separate reset line. Add a generic driver to describe this kind of reset controller.
This is used on the Nexell S5P6818, for instance, but also by other SoCs.
--- drivers/reset/Kconfig | 6 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 drivers/reset/reset-generic.c
drivers/reset/Kconfig +6 -0
@@ -12,6 +12,12 @@ config DM_RESET although driving such reset isgnals using GPIOs may be more appropriate in this case. +config GENERIC_RESET + bool "Generic Reset controller driver" + depends on DM_RESET + help + Support Generic reset controller. + config SANDBOX_RESET bool "Enable the sandbox reset test driver" depends on DM_MAILBOX && SANDBOX
drivers/reset/Makefile +1 -0
@@ -12,3 +12,4 @@ obj-$(CONFIG_TEGRA186_RESET) += tegra186-reset.o obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o +obj-$(CONFIG_GENERIC_RESET) += reset-generic.o
drivers/reset/reset-generic.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 4/13 reset: add driver for generic reset controllers
Hi Andre,
Quoted 12 lines · Andre Przywara
From: Amit Singh Tomar <[email protected]>
The simplest and most generic form of a reset controller just exposes multiple MMIO registers, where each bit toggles a separate reset line. Add a generic driver to describe this kind of reset controller.
This is used on the Nexell S5P6818, for instance, but also by other SoCs.
Signed-off-by Amit Singh Tomar <[email protected]>[Andre: make more generic, let it cover multiple registers, slight rework]Signed-off-by Andre Przywara <[email protected]>
Quoted 6 lines
--- drivers/reset/Kconfig | 6 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 drivers/reset/reset-generic.c
Is there a DT binding for this?
Also please see below.
Quoted 6 lines
drivers/reset/Kconfig +0
-0
drivers/reset/Kconfig config DM_RESET · line 19
Quoted 8 lines
drivers/reset/Kconfig +5
-0@@ -12,6 +12,12 @@ config DM_RESET although driving such reset isgnals using GPIOs may be more appropriate in this case. +config GENERIC_RESET + bool "Generic Reset controller driver" + depends on DM_RESET + help + Support Generic reset controller.
What is this? This help needs to be expanded with details.
Quoted 28 lines
drivers/reset/Kconfig +1
-0+ config SANDBOX_RESET bool "Enable the sandbox reset test driver" depends on DM_MAILBOX && SANDBOXdrivers/reset/Makefile +1
-0@@ -12,3 +12,4 @@ obj-$(CONFIG_TEGRA186_RESET) += tegra186-reset.o obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o +obj-$(CONFIG_GENERIC_RESET) += reset-generic.odrivers/reset/reset-generic.c new file +9
-0@@ -0,0 +1,111 @@ +/* +* Copyright (C) 2017 Amit Singh Tomar <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <errno.h>
drivers/reset/reset-generic.c line 19
Quoted 10 lines
drivers/reset/reset-generic.c new file +10
-0+#include <reset-uclass.h> +#include <linux/bitops.h> +#include <linux/io.h> +#include <linux/sizes.h> + +DECLARE_GLOBAL_DATA_PTR ; + +struct generic_reset_priv { +void __iomem *membase; +int max_reset;
comment
drivers/reset/reset-generic.c line 22
Quoted 3 lines
drivers/reset/reset-generic.c new file +3
-0+}; + +#define BITS_PER_BYTE 8
blank line here
Quoted 4 lines
drivers/reset/reset-generic.c new file +4
-0+static int generic_reset_toggle (struct reset_ctl *rst,bool assert) +{ +struct generic_reset_priv *priv =dev_get_priv (rst->dev); +int reg_width =sizeof (u32);
drivers/reset/reset-generic.c line 36
Quoted 10 lines
drivers/reset/reset-generic.c new file +10
-0+int bank, offset; +u32 reg; + +if (rst->id >= priv->max_reset) +return -EINVAL ; + + bank = rst->id / (reg_width *BITS_PER_BYTE ); + offset = rst->id % (reg_width *BITS_PER_BYTE ); + + reg =readl (priv->membase + (bank * reg_width));
Can you put that expression in a local var?
Quoted 19 lines
drivers/reset/reset-generic.c new file +19
-0+if (assert) +writel (reg & ~BIT (offset), priv->membase + (bank * reg_width)); +else +writel (reg |BIT (offset), priv->membase + (bank * reg_width)); + +return 0 ; +} + +static int generic_reset_assert (struct reset_ctl *rst) +{ +return generic_reset_toggle (rst, true); +} + +static int generic_reset_deassert (struct reset_ctl *rst) +{ +return generic_reset_toggle (rst, false); +} + +static int generic_reset_free (struct reset_ctl *rst)
drivers/reset/reset-generic.c line 65
Quoted 10 lines
drivers/reset/reset-generic.c new file +10
-0+{ +return 0 ; +} + +static int generic_reset_request (struct reset_ctl *rst) +{ +struct generic_reset_priv *priv =dev_get_priv (rst->dev); + +if (rst->id >= priv->max_reset) +return -EINVAL ;
OK I suppose. How about -ENOENT?
Quoted 14 lines
drivers/reset/reset-generic.c new file +14
-0+ +return generic_reset_assert (rst); +} + +struct reset_ops generic_reset_reset_ops = { + .free = generic_reset_free, + .request = generic_reset_request, + .rst_assert = generic_reset_assert, + .rst_deassert = generic_reset_deassert, +}; + +static const struct udevice_id generic_reset_ids[] = { + { .compatible ="generic-reset" }, + { .compatible ="nexell,s5p6818-reset" },
drivers/reset/reset-generic.c line 89
Quoted 10 lines
drivers/reset/reset-generic.c new file +10
-0+ { } +}; + +static int generic_reset_probe (struct udevice *dev) +{ +struct generic_reset_priv *priv =dev_get_priv (dev); +fdt_addr_t addr; +fdt_size_t size; + + addr =devfdt_get_addr_size_index (dev,0 , &size);
Can we use dev_read_... here?
Quoted 23 lines
drivers/reset/reset-generic.c new file +22
-1+if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + priv->max_reset =dev_read_u32_default (dev,"num-resets" ,-1 ); +if (priv->max_reset ==-1 ) + priv->max_reset = size *BITS_PER_BYTE ; + + priv->membase =devm_ioremap (dev, addr, size); +if (!priv->membase) +return -EFAULT ; + +return 0 ; +} + +U_BOOT_DRIVER (generic_reset) = { + .name ="generic_reset" , + .id =UCLASS_RESET , + .of_match = generic_reset_ids, + .ops = &generic_reset_reset_ops, + .probe = generic_reset_probe, + .priv_auto_alloc_size =sizeof (struct generic_reset_priv ), +}; --
Quoted 2 lines
2.14.1
Regards,
Simon
RFC PATCH 5/13 mmc: add MMC (glue) driver for Nexell SoCs
In reply to Andre PrzywaraFrom: Amit Singh Tomar <[email protected]>
The Nexell SoCs contain multiple MMC devices, which can be driven by U-Boot's DesignWare MMC driver, if supported by the required glue driver file.
Provide that file along with the Makefile/Kconfig changes.
--- drivers/mmc/Kconfig | 8 +++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/mmc/nexell_dw_mmc.c
drivers/mmc/Kconfig +8 -0
@@ -91,6 +91,14 @@ config MMC_DW_K3 Synopsys DesignWare Memory Card Interface driver. Select this option for platforms based on Hisilicon K3 SoC's. +config MMC_DW_NEXELL + bool "NEXELL SD/MMC controller support" + depends on ARCH_NEXELL && DM_MMC && OF_CONTROL + depends on MMC_DW + help + This enables support for the Nexell SD/MMM controller, which is + based on Designware IP. + config MMC_DW_ROCKCHIP bool "Rockchip SD/MMC controller support" depends on DM_MMC && OF_CONTROL
drivers/mmc/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o obj-$(CONFIG_MMC_DW) += dw_mmc.o obj-$(CONFIG_MMC_DW_EXYNOS) += exynos_dw_mmc.o obj-$(CONFIG_MMC_DW_K3) += hi6220_dw_mmc.o +obj-$(CONFIG_MMC_DW_NEXELL) += nexell_dw_mmc.o obj-$(CONFIG_MMC_DW_ROCKCHIP) += rockchip_dw_mmc.o obj-$(CONFIG_MMC_DW_SOCFPGA) += socfpga_dw_mmc.o obj-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
drivers/mmc/nexell_dw_mmc.c new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 5/13 mmc: add MMC (glue) driver for Nexell SoCs
Hi Andre,
Quoted 83 lines · Andre Przywara
From: Amit Singh Tomar <[email protected]>
The Nexell SoCs contain multiple MMC devices, which can be driven by U-Boot's DesignWare MMC driver, if supported by the required glue driver file.
Provide that file along with the Makefile/Kconfig changes.Signed-off-by Amit Singh Tomar <[email protected]>Signed-off-by Andre Przywara <[email protected]>--- drivers/mmc/Kconfig | 8 +++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 drivers/mmc/nexell_dw_mmc.cdrivers/mmc/Kconfig +8
-0@@ -91,6 +91,14 @@ config MMC_DW_K3 Synopsys DesignWare Memory Card Interface driver. Select this option for platforms based on Hisilicon K3 SoC's. +config MMC_DW_NEXELL + bool "NEXELL SD/MMC controller support" + depends on ARCH_NEXELL && DM_MMC && OF_CONTROL + depends on MMC_DW + help + This enables support for the Nexell SD/MMM controller, which is + based on Designware IP. + config MMC_DW_ROCKCHIP bool "Rockchip SD/MMC controller support" depends on DM_MMC && OF_CONTROLdrivers/mmc/Makefile +1
-0@@ -26,6 +26,7 @@ obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o obj-$(CONFIG_MMC_DW) += dw_mmc.o obj-$(CONFIG_MMC_DW_EXYNOS) += exynos_dw_mmc.o obj-$(CONFIG_MMC_DW_K3) += hi6220_dw_mmc.o +obj-$(CONFIG_MMC_DW_NEXELL) += nexell_dw_mmc.o obj-$(CONFIG_MMC_DW_ROCKCHIP) += rockchip_dw_mmc.o obj-$(CONFIG_MMC_DW_SOCFPGA) += socfpga_dw_mmc.o obj-$(CONFIG_FSL_ESDHC) += fsl_esdhc.odrivers/mmc/nexell_dw_mmc.c new file +30
-0@@ -0,0 +1,159 @@ +/* +* Copyright (C) 2017 Amit Singh Tomar <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dt-structs.h> +#include <dwmmc.h> +#include <errno.h> +#include <mapmem.h> +#include <linux/err.h> +#include <reset.h> +#include <asm/arch/clk.h> + +#define SDMMCCLKENB 0xC00C5000 +#define SDMMCCLKGEN0L 0xC00C5004 +#define PLL_SEL_MASK GENMASK(4, 2) +#define CLK_DIV_MASK GENMASK(12, 5) +#define PLLSEL_SHIFT 0x2 +#define PLL0_SEL 0 +#define PLL1_SEL 1 +#define PLL2_SEL 2 +#define SDMMC_CLK_ENB 0xc/* Magic bit to enable/generate SDMMC clock */ + +DECLARE_GLOBAL_DATA_PTR ; + +struct nexell_mmc_plat {
drivers/mmc/nexell_dw_mmc.c line 40
Quoted 10 lines
drivers/mmc/nexell_dw_mmc.c new file +10
-0+struct mmc_config cfg; +struct mmc mmc; +}; + +struct nexell_dwmmc_priv { +struct clk clk; +struct dwmci_host host; +struct reset_ctl reset_ctl; +int fifo_depth; +bool fifo_mode;
comments
drivers/mmc/nexell_dw_mmc.c line 51
Quoted 11 lines
drivers/mmc/nexell_dw_mmc.c new file +11
-0+}; + +/* Should this be done from CCF ? */ +static void nexell_dwmci_clksel (struct dwmci_host *host) +{ +u32 val; + +/* Enable SDMMC clock */ + val =readl (SDMMCCLKENB ); + val |=SDMMC_CLK_ENB ; +writel (val,SDMMCCLKENB );
How about using setbits_le32() ?
drivers/mmc/nexell_dw_mmc.c line 57
Quoted 6 lines
drivers/mmc/nexell_dw_mmc.c new file +6
-0+ +/* Select PLL1 as clock source */ + val =readl (SDMMCCLKGEN0L ); + val = val & ~(PLL_SEL_MASK ); + val |= (PLL1_SEL <<PLLSEL_SHIFT ) &PLL_SEL_MASK ; +writel (val,SDMMCCLKGEN0L );
clrsetbits_le32
drivers/mmc/nexell_dw_mmc.c line 68
Quoted 11 lines
drivers/mmc/nexell_dw_mmc.c new file +11
-0+} + +static int nexell_dwmmc_ofdata_to_platdata (struct udevice *dev) +{ +struct nexell_dwmmc_priv *priv =dev_get_priv (dev); +struct dwmci_host *host = &priv->host; +int fifo_depth, ret; + + ret =reset_get_by_name (dev,"mmc" , &priv->reset_ctl); +if (ret) { +printf ("reset_get_by_name(rst) failed: %d" , ret);
debug() ? And below
drivers/mmc/nexell_dw_mmc.c line 73
Quoted 5 lines
drivers/mmc/nexell_dw_mmc.c new file +5
-0+return ret; + } + + fifo_depth =fdtdec_get_int (gd->fdt_blob,dev_of_offset (dev), +"fifo-depth" ,0 );
dev_read_...()
and below
Quoted 22 lines
drivers/mmc/nexell_dw_mmc.c new file +22
-0+if (fifo_depth <0 ) { +printf ("DWMMC: Can't get FIFO depth\n" ); +return -EINVAL ; + } + + host->name = dev->name; + host->ioaddr = (void *)devfdt_get_addr (dev); + host->buswidth =fdtdec_get_int (gd->fdt_blob,dev_of_offset (dev), +"bus-width" ,4 ); + + ret =reset_assert (&priv->reset_ctl); +if (ret) +return ret; + + host->clksel = nexell_dwmci_clksel; + + ret =reset_deassert (&priv->reset_ctl); +if (ret) +return ret; + + host->dev_index =0 ; + host->bus_hz =get_mmc_clk (host->dev_index);
drivers/mmc/nexell_dw_mmc.c line 105
Quoted 10 lines
drivers/mmc/nexell_dw_mmc.c new file +10
-0+ host->fifoth_val =MSIZE (0x2 ) |RX_WMARK (fifo_depth /2 -1 ) | +TX_WMARK (fifo_depth /2 ); + host->priv = priv; + +return 0 ; +} + +static int nexell_dwmmc_probe (struct udevice *dev) +{ +#ifdef CONFIG_BLK
Do we need to support non-BLK? It is going away in March anyway.
Quoted 55 lines
drivers/mmc/nexell_dw_mmc.c new file +54
-1+struct nexell_mmc_plat *plat =dev_get_platdata (dev); +#endif +struct mmc_uclass_priv *upriv =dev_get_uclass_priv (dev); +struct nexell_dwmmc_priv *priv =dev_get_priv (dev); +struct dwmci_host *host = &priv->host; + +#ifdef CONFIG_BLK +dwmci_setup_cfg (&plat->cfg, host, host->bus_hz,400000 ); + host->mmc = &plat->mmc; +#else +int ret; + + ret =add_dwmci (host, host->bus_hz,400000 ); +if (ret) +return ret; +#endif + + host->mmc->priv = &priv->host; + upriv->mmc = host->mmc; + host->mmc->dev = dev; + +return 0 ; +} + +static int nexell_dwmmc_bind (struct udevice *dev) +{ +#ifdef CONFIG_BLK +struct nexell_mmc_plat *plat =dev_get_platdata (dev); +int ret; + + ret =dwmci_bind (dev, &plat->mmc, &plat->cfg); +if (ret) +return ret; +#endif + +return 0 ; +} + +static const struct udevice_id nexell_dwmmc_ids[] = { + { .compatible ="nexell,s5p6818-dw-mshc" }, + { } +}; + +U_BOOT_DRIVER (nexell_dwmmc_drv) = { + .name ="nexell_s5p6818_dw_mshc" , + .id =UCLASS_MMC , + .of_match = nexell_dwmmc_ids, + .ops = &dm_dwmci_ops, + .ofdata_to_platdata = nexell_dwmmc_ofdata_to_platdata, + .bind = nexell_dwmmc_bind, + .probe = nexell_dwmmc_probe, + .priv_auto_alloc_size =sizeof (struct nexell_dwmmc_priv ), + .platdata_auto_alloc_size =sizeof (struct nexell_mmc_plat ), +}; --
Quoted 2 lines
2.14.1
Regards,
Simon
RFC PATCH 6/13 arm: add basic framework for Nexell S5P6818 support
In reply to Andre PrzywaraThe Nexell S5P6818 is a typical SoC with ARM Cortex-A53 cores. It has many peripherals derived from Samsung SoCs (MMC, serial, I2C, Ethernet, ...).
Add the required files to introduce this new SoC (family?) to U-Boot.
--- arch/arm/Kconfig | 6 ++++++ arch/arm/Makefile | 1 + arch/arm/mach-nexell/Kconfig | 9 +++++++++ arch/arm/mach-nexell/Makefile | 7 +++++++ arch/arm/mach-nexell/board.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/configs/s5p6818.h | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 arch/arm/mach-nexell/Kconfig create mode 100644 arch/arm/mach-nexell/Makefile create mode 100644 arch/arm/mach-nexell/board.c create mode 100644 include/configs/s5p6818.h
arch/arm/Kconfig +6 -0
@@ -652,6 +652,10 @@ config ARCH_MX5 select CPU_V7 select BOARD_EARLY_INIT_F +config ARCH_NEXELL + bool "Nexell S5P support" + select ARM64 + config ARCH_QEMU bool "QEMU Virtual Platform" select CPU_V7
@@ -1197,6 +1201,8 @@ source "arch/arm/mach-imx/mx6/Kconfig" source "arch/arm/mach-imx/mx5/Kconfig" +source "arch/arm/mach-nexell/Kconfig" + source "arch/arm/mach-omap2/Kconfig" source "arch/arm/cpu/armv8/fsl-layerscape/Kconfig"
arch/arm/Makefile +1 -0
@@ -61,6 +61,7 @@ machine-$(CONFIG_ARCH_KEYSTONE) += keystone machine-$(CONFIG_KIRKWOOD) += kirkwood machine-$(CONFIG_ARCH_MESON) += meson machine-$(CONFIG_ARCH_MVEBU) += mvebu +machine-$(CONFIG_ARCH_NEXELL) += nexell # TODO: rename CONFIG_TEGRA -> CONFIG_ARCH_TEGRA # TODO: rename CONFIG_ORION5X -> CONFIG_ARCH_ORION5X machine-$(CONFIG_ORION5X) += orion5x
arch/arm/mach-nexell/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +if ARCH_NEXELL + +config SYS_SOC + default "nexell" + +config SYS_CONFIG_NAME + default "s5p6818" + +endif
arch/arm/mach-nexell/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# (C) Copyright 2017 Andre Przywara <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y := board.o
arch/arm/mach-nexell/board.c new file +41 -0
41 lines not on this page · raw message
include/configs/s5p6818.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __CONFIG_S5P6818_H +#define __CONFIG_S5P6818_H + +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_CBSIZE 1024 +#define CONFIG_ENV_SIZE (128 << 10) +#define CONFIG_SYS_MAX_FLASH_BANKS 0 +#define CONFIG_SKIP_LOWLEVEL_INIT + + +#define CONFIG_EXTRA_ENV_SETTINGS "fdt_high=0xffffffffffffffff" + +/* using SRAM for SPL init here */ +#define CONFIG_SYS_INIT_RAM_ADDR 0xffff0000 +#define CONFIG_SYS_INIT_RAM_SIZE 0x10000/* 64 KiB */ + +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE 0x40000000 +#define PHYS_SDRAM_0 CONFIG_SYS_SDRAM_BASE +#define PHYS_SDRAM_0_SIZE 0x80000000/* 2 GiB */ + +#define CONFIG_SYS_TEXT_BASE 0x42c00000 +#define CONFIG_SYS_LOAD_ADDR 0x41000000 +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (64 << 20)) + +#define CONFIG_SYS_TIMER_COUNTER 0xc0017040/* TCNTO4 */ + +#endif /* __CONFIG_H */
Signature · 1 line
2.14.1
RFC PATCH 6/13 arm: add basic framework for Nexell S5P6818 support
Quoted 6 lines · Andre Przywara
The Nexell S5P6818 is a typical SoC with ARM Cortex-A53 cores. It has many peripherals derived from Samsung SoCs (MMC, serial, I2C, Ethernet, ...).
Add the required files to introduce this new SoC (family?) to U-Boot.Signed-off-by Andre Przywara <[email protected]>
Quoted 12 lines
--- arch/arm/Kconfig | 6 ++++++ arch/arm/Makefile | 1 + arch/arm/mach-nexell/Kconfig | 9 +++++++++ arch/arm/mach-nexell/Makefile | 7 +++++++ arch/arm/mach-nexell/board.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/configs/s5p6818.h | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 arch/arm/mach-nexell/Kconfig create mode 100644 arch/arm/mach-nexell/Makefile create mode 100644 arch/arm/mach-nexell/board.c create mode 100644 include/configs/s5p6818.h
RFC PATCH 7/13 arm: nexell: embed NSIH header
In reply to Andre PrzywaraThe primary boot loaders provided by the SoC vendor or derived from that use an image format called "NSIH" to learn the load address and size of the boot payload. This header occupies 512 bytes, but contains only a few essential words of information.
Use the boot0 feature to prepend this header before the actual U-Boot proper. We automatically fill it with the required information, also add a branch instruction to be able to enter at the beginning of the header.
--- arch/arm/Kconfig | 1 + arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 arch/arm/include/asm/arch-nexell/boot0.h
arch/arm/Kconfig +1 -0
@@ -655,6 +655,7 @@ config ARCH_MX5 config ARCH_NEXELL bool "Nexell S5P support" select ARM64 + select ENABLE_ARM_SOC_BOOT0_HOOK config ARCH_QEMU bool "QEMU Virtual Platform"
arch/arm/include/asm/arch-nexell/boot0.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Nexell NSIH header, to allow loading U-Boot from secondboot. +* +* Both the proprietary and the GPL version of the first stage boot loader +* look for this magic header to determine the size and load address of +* the payload (similar to the information in an U-Boot image header). +* Make them happy by providing the essential bits: +* @0x040: device address: 0 for SDMMC +* @0x044: load size +* @0x048: load address +* @0x04c: launch address (entry point) +* @0x1fc: "NSIH" magic +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifdef CONFIG_ARM64 + b reset // jump over the header + .space 0x3c // fast forward to 0x40 +#else +_start: + ARM_VECTORS + .space 0x20 // fill up from 0x20 till 0x40 +#endif + .word 0 // device "address" (device ID) + .word (_end - _start) + 32768 // binary size + space for .dtb + .word CONFIG_SYS_TEXT_BASE // load address + .word CONFIG_SYS_TEXT_BASE // launch address + .space 0x1ac // fast forward till 0x1fc + .word 0x4849534e // "NSIH" magic + + // In case someone enters right after the header: +#ifdef CONFIG_ARM64 + b reset +#endif
Signature · 1 line
2.14.1
RFC PATCH 7/13 arm: nexell: embed NSIH header
Quoted 9 lines · Andre Przywara
The primary boot loaders provided by the SoC vendor or derived from that use an image format called "NSIH" to learn the load address and size of the boot payload. This header occupies 512 bytes, but contains only a few essential words of information.
Use the boot0 feature to prepend this header before the actual U-Boot proper. We automatically fill it with the required information, also add a branch instruction to be able to enter at the beginning of the header.
Quoted 6 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 arch/arm/include/asm/arch-nexell/boot0.h
RFC PATCH 8/13 arm: nexell: add ARM64 MMU regions
In reply to Andre PrzywaraFrom: Amit Singh Tomar <[email protected]>
ARMv8 boards require a struct describing the memory regions for the mandatory MMU setup.
Add the respective data for the Nexell S5P6818 SoC.
--- arch/arm/mach-nexell/Makefile | 1 + arch/arm/mach-nexell/mmu-arm64.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/mach-nexell/mmu-arm64.c
arch/arm/mach-nexell/Makefile +1 -0
@@ -5,3 +5,4 @@ # obj-y := board.o +obj-$(CONFIG_ARM64) += mmu-arm64.o
arch/arm/mach-nexell/mmu-arm64.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright (C) 2017 Amit Singh Tomar <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/armv8/mmu.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static struct mm_region nexell_s5p6818_mem_map[] = { + { + .virt =0xc0000000UL , + .phys =0xc0000000UL , + .size =0x20000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_INNER_SHARE | +PTE_BLOCK_PXN |PTE_BLOCK_UXN , + }, { + .virt =0x40000000UL , + .phys =0x40000000UL , + .size =0x80000000UL , + .attrs =PTE_BLOCK_MEMTYPE (MT_NORMAL ) | +PTE_BLOCK_OUTER_SHARE , + }, { + .virt =0xFFFF0000ULL , + .phys =0xFFFF0000ULL , + .size =0x00010000ULL , + .attrs =PTE_BLOCK_MEMTYPE (MT_DEVICE_NGNRNE ) | +PTE_BLOCK_INNER_SHARE | +PTE_BLOCK_PXN |PTE_BLOCK_UXN + }, { +/* List terminator */ +0 , + }, +}; + +struct mm_region *mem_map = nexell_s5p6818_mem_map;
Signature · 1 line
2.14.1
RFC PATCH 8/13 arm: nexell: add ARM64 MMU regions
Quoted 6 lines · Andre Przywara
From: Amit Singh Tomar <[email protected]>
ARMv8 boards require a struct describing the memory regions for the mandatory MMU setup.
Add the respective data for the Nexell S5P6818 SoC.
Quoted 7 lines
Signed-off-by Amit Singh Tomar <[email protected]>Signed-off-by Andre Przywara <[email protected]>--- arch/arm/mach-nexell/Makefile | 1 + arch/arm/mach-nexell/mmu-arm64.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 arch/arm/mach-nexell/mmu-arm64.c
RFC PATCH 9/13 arm: nexell: add UART support
In reply to Andre PrzywaraThe Nexell S5P6818 SoC uses a UART very similar to those used in the Samsung S5P SoCs.
Enable the driver in the config and add the necessary glue headers and clock functions to make the S5P driver happy.
--- arch/arm/Kconfig | 3 ++ arch/arm/include/asm/arch-nexell/clk.h | 13 +++++++++ arch/arm/mach-nexell/board.c | 50 ++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 arch/arm/include/asm/arch-nexell/clk.h
arch/arm/Kconfig +3 -0
@@ -656,6 +656,9 @@ config ARCH_NEXELL bool "Nexell S5P support" select ARM64 select ENABLE_ARM_SOC_BOOT0_HOOK + select DM + select DM_SERIAL + select SAMSUNG_UART config ARCH_QEMU bool "QEMU Virtual Platform"
arch/arm/include/asm/arch-nexell/clk.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* (C) Copyright 2017 ARM Ltd. +* Andre Przywara <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARCH_CLK_H_ +#define __ASM_ARCH_CLK_H_ + +unsigned long get_uart_clk (int dev_index); + +#endif
arch/arm/mach-nexell/board.c +50 -0
65 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 9/13 arm: nexell: add UART support
Quoted 5 lines · Andre Przywara
The Nexell S5P6818 SoC uses a UART very similar to those used in the Samsung S5P SoCs.
Enable the driver in the config and add the necessary glue headers and clock functions to make the S5P driver happy.
Quoted 7 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/Kconfig | 3 ++ arch/arm/include/asm/arch-nexell/clk.h | 13 +++++++++ arch/arm/mach-nexell/board.c | 50 ++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 arch/arm/include/asm/arch-nexell/clk.h
Q below
Quoted 39 lines
arch/arm/Kconfig +3
-0@@ -656,6 +656,9 @@ config ARCH_NEXELL bool "Nexell S5P support" select ARM64 select ENABLE_ARM_SOC_BOOT0_HOOK + select DM + select DM_SERIAL + select SAMSUNG_UART config ARCH_QEMU bool "QEMU Virtual Platform"arch/arm/include/asm/arch-nexell/clk.h new file +13
-0@@ -0,0 +1,13 @@ +/* +* (C) Copyright 2017 ARM Ltd. +* Andre Przywara <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __ASM_ARCH_CLK_H_ +#define __ASM_ARCH_CLK_H_ + +unsigned long get_uart_clk (int dev_index); + +#endif arch/arm/mach-nexell/board.c +0
-0
arch/arm/mach-nexell/board.c line 12
Quoted 8 lines
arch/arm/mach-nexell/board.c +2
-0@@ -5,9 +5,14 @@*/ #include <common.h> +#include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ; +#define NEXELL_PLLSETREG0 0xc0010008UL
Is this not in the DT?
Do you need the UL?
RFC PATCH 10/13 arm: nexell: add timer support
In reply to Andre PrzywaraFrom: Amit Singh Tomar <[email protected]>
Nexell based SoCs (S5P4414 and S5P6818) contain the same timer block as present on Samsungs SoCs.
Add this timer code when compiling for Nexell SoC and provide the necessary glue functions to make the Samsung timer driver happy.
--- arch/arm/include/asm/arch-nexell/clk.h | 1 + arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++++++++++++++++++++++++++ arch/arm/mach-nexell/Makefile | 2 ++ arch/arm/mach-nexell/board.c | 37 +++++++++++++++++--- 4 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 arch/arm/include/asm/arch-nexell/pwm.h
arch/arm/include/asm/arch-nexell/clk.h +1 -0
@@ -9,5 +9,6 @@#define __ASM_ARCH_CLK_H_unsigned long get_uart_clk (int dev_index); +unsigned long get_pwm_clk (void );#endif
arch/arm/include/asm/arch-nexell/pwm.h new file +62 -0
62 lines not on this page · raw message
arch/arm/mach-nexell/Makefile +2 -0
@@ -6,3 +6,5 @@ obj-y := board.o obj-$(CONFIG_ARM64) += mmu-arm64.o +obj-y += ../cpu/armv7/s5p-common/timer.o +obj-y += ../cpu/armv7/s5p-common/pwm.o
arch/arm/mach-nexell/board.c +32 -5
@@ -10,9 +10,27 @@DECLARE_GLOBAL_DATA_PTR ;#define NEXELL_PLLSETREG0 0xc0010008UL +#define NEXELL_CLKDIVREG1 0xc0010024UL +#define IP_RESET1 0xc0012004UL#define OSC_FREQ 24000000 +int arch_cpu_init (void ) +{ +u32 val; + +/* +* Reset timer block #4. +* Ideally this should be done through the reset driver, but +* unfortunately our timer driver is not DM driven. +*/ + val =readl (IP_RESET1 ); + val |=BIT (4 ); +writel (val,IP_RESET1 ); + +return 0 ; +} +/* TODO: dummy implementation for now, add proper reset code */ void reset_cpu (ulong addr) {
@@ -35,11 +53,6 @@ int dram_init(void)return 0 ; } -ulong get_tbclk (void ) -{ -return CONFIG_SYS_HZ ; -} -static unsigned long get_pll_freq (int pll_index) {uint32_t reg;
@@ -85,6 +98,20 @@ unsigned long get_uart_clk(int dev_index)return get_level1_clk_freq (clock_ofs[dev_index]); } +/* This is reading the PCLK frequency, which drives the PWM timer. */ +unsigned long get_pwm_clk (void ) +{ +uint32_t reg; +unsigned int pll_index, div; + + reg =readl (NEXELL_CLKDIVREG1 ); + pll_index = reg &0x7 ; + div = ((reg >>3 ) &0x3f ) +1 ;/* BCLK divider */ + div *= ((reg >>9 ) &0x3f ) +1 ;/* PCLK divider */ + +return get_pll_freq (pll_index) / div; +} +int board_init (void ) {return 0 ;
Signature · 1 line
2.14.1
RFC PATCH 10/13 arm: nexell: add timer support
Quoted 10 lines · Andre Przywara
From: Amit Singh Tomar <[email protected]>
Nexell based SoCs (S5P4414 and S5P6818) contain the same timer block as present on Samsungs SoCs.
Add this timer code when compiling for Nexell SoC and provide the necessary glue functions to make the Samsung timer driver happy.
Signed-off-by Amit Singh Tomar <[email protected]>Signed-off-by Andre Przywara <[email protected]>
Quoted 7 lines
--- arch/arm/include/asm/arch-nexell/clk.h | 1 + arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++++++++++++++++++++++++++ arch/arm/mach-nexell/Makefile | 2 ++ arch/arm/mach-nexell/board.c | 37 +++++++++++++++++--- 4 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 arch/arm/include/asm/arch-nexell/pwm.h
But I encourage use of setclrbits_le32()
RFC PATCH 11/13 arm: nexell: add preliminary S5P6818 SoC device tree
In reply to Andre PrzywaraThe Nexell S5P6818 SoC is an octa-core SoC with ARM Cortex-A53 cores. The chip contains the usual peripherals for an smartphone/tablet/set-top box SoC.
Add the .dtsi file describing the peripherals supported so far, but keep them still disabled.
--- arch/arm/Kconfig | 1 + arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 arch/arm/dts/s5p6818.dtsi
arch/arm/Kconfig +1 -0
@@ -656,6 +656,7 @@ config ARCH_NEXELL bool "Nexell S5P support" select ARM64 select ENABLE_ARM_SOC_BOOT0_HOOK + select OF_CONTROL select DM select DM_SERIAL select SAMSUNG_UART
arch/arm/dts/s5p6818.dtsi new file +196 -0
196 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 11/13 arm: nexell: add preliminary S5P6818 SoC device tree
Quoted 6 lines · Andre Przywara
The Nexell S5P6818 SoC is an octa-core SoC with ARM Cortex-A53 cores. The chip contains the usual peripherals for an smartphone/tablet/set-top box SoC.
Add the .dtsi file describing the peripherals supported so far, but keep them still disabled.
Quoted 6 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 arch/arm/dts/s5p6818.dtsi
RFC PATCH 12/13 arm: add NanoPi M3 board support
In reply to Andre PrzywaraThe 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.
--- 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
arch/arm/Kconfig +6 -0
@@ -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"
arch/arm/dts/s5p6818-nanopi-m3.dts new file +30 -0
@@ -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"; +};
arch/arm/include/asm/arch-nexell/clk.h +1 -0
@@ -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
arch/arm/mach-nexell/board.c +10 -0
@@ -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 ;
configs/nanopi_m3_defconfig new file +12 -0
@@ -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
include/configs/s5p6818.h +2 -0
@@ -30,4 +30,6 @@#define CONFIG_SYS_TIMER_COUNTER 0xc0017040/* TCNTO4 */ +#define CONFIG_BOUNCE_BUFFER +#endif /* __CONFIG_H */
Signature · 1 line
2.14.1
RFC PATCH 12/13 arm: add NanoPi M3 board support
Quoted 6 lines · Andre Przywara
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 <[email protected]>
Quoted 10 lines
--- 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
I think this needs a clock driver.
RFC PATCH 13/13 arm: nexell: switch to 32-bit
In reply to Andre PrzywaraThe vendor provided SPL blob (called "secondboot") runs completely in AArch32, so expects U-Boot to be AArch32 as well.
Also the lack of a working arch timer limits Linux to 32-bits, as the mainline arm64 kernel heavily relies on the arch timer.
This commit switches the NanoPiM3 board over to generate an ARM(32) binary, to allow easy testing for now. Also this adds a README file to describe the generation of a bootable SD card image.
--- arch/arm/Kconfig | 2 +- arch/arm/mach-nexell/README | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-nexell/README
arch/arm/Kconfig +1 -1
@@ -654,7 +654,7 @@ config ARCH_MX5 config ARCH_NEXELL bool "Nexell S5P support" - select ARM64 + select CPU_V7 select ENABLE_ARM_SOC_BOOT0_HOOK select OF_CONTROL select DM
arch/arm/mach-nexell/README new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.14.1
RFC PATCH 13/13 arm: nexell: switch to 32-bit
Quoted 9 lines · Andre Przywara
The vendor provided SPL blob (called "secondboot") runs completely in AArch32, so expects U-Boot to be AArch32 as well.
Also the lack of a working arch timer limits Linux to 32-bits, as the mainline arm64 kernel heavily relies on the arch timer.This commit switches the NanoPiM3 board over to generate an ARM(32) binary, to allow easy testing for now. Also this adds a README file to describe the generation of a bootable SD card image.
Quoted 6 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/Kconfig | 2 +- arch/arm/mach-nexell/README | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-nexell/README
cover Nexell S5P6818 SoC support
In reply to Andre PrzywaraHi Andre,
Quoted 47 lines
Hi,
this is a first draft of the things Amit and I have been working on in the last months. It introduces support for an SoC called "Nexell S5P6818". This is an Octa-core ARMv8 SoC with Cortex-A53 cores, which apparently is closely related to (older) Samsung SoCs. Many peripherals are compatible to Samsung IP (UART, MMC, Ethernet, timers, ...), but some core peripherals like the clocks and the pin controller seem to be completely different. We used the NanoPi M3 board [1] for testing, which uses this SoC along with the usual suspects of on-board components and connectors. This port is done completely from scratch, by just looking at the manual. This allows a much cleaner and modern U-Boot support than the BSP code.
The ARM Generic Timer (aka. arch timer) does not seem to work on this SoC. Ideally there would be some (hidden?) register enabling the right clock source, though we haven't found one (yet). But as also other code for this SoC out there on the net does not seem to be able to use the arch timer, I am not too hopeful here. While this does not impose a real problem to U-Boot (patch 3/13 takes care of that), it is a showstopper for mainline arm64 Linux, which heavily relies on the arch timer (since it's a mandatory part of the ARMv8 architecture). There is only a very small chance that the arch timer ever becomes optional in the mainline arm64 kernel. However our arm(32) kernel ports works quite nicely so far, also a (hacked) arm64 kernel boots to the prompt. We will submit Linux patches at a later time.
We would be grateful to get some comments on the patches. The first five patches adapt existing code to simplify support for this SoC. The following six patches then successively enable and add SoC support, culmulating in the addition of a
nanopi_m3_defconfigfile in patch 11/13. The SoC support code is actually architecture agnostic, though up until the last patch it generates an AArch64 binary. To overcome the problems with the arch timer mentioned above, the final patch switches the port over to AArch32, which can more naturally launch arm kernels.This code so far does not include an SPL, instead it relies on some vendor provided code to initialise the DRAM and load U-Boot proper. The original BSP code provided a binary blob for that (called "secondboot"), although there is some GPLed version of that available on
github([2]). We can load a 32-bit U-Boot with both the vendor blob and Rafaello's GPL version, the 64-bit version is only usable with the GPL code. Instruction on how to create a bootable SD card are contained in thearch/arm/mach-nexell/READMEfile.
Quoted 2 lines
We would be very grateful to get some first feedback on those patches and the approach in general taken here.
Just to ask - why it is not possible to add this to:
/arch/arm/mach-exynos ? And start new mach-nexell ?
As fair as I remember, many Samsung SoCs (especially S5P) share IP blocks, so maybe there is a place for unification?
Also, it would be quite challenging to support first armv8 Samsung soc in the current directory structure.....
+CC Jaehoon - who may have some comments here.
Quoted 67 lines
Cheers,
Andre.[1] http://nanopi.io/nanopi-m3.html
[2] https://github.com/rafaello7/bl1-nanopi-m3Amit Singh Tomar (4):
reset: add driver for generic reset controllers
mmc: add MMC (glue) driver for Nexell SoCs
arm: nexell: add ARM64 MMU regions
arm: nexell: add timer supportAndre Przywara (9):
serial: s5p: rework Samsung UART driver to get rid ofuart.h
serial: S5P/Samsung: refactor and Kconfig-ize UART selection
arm: moveSYS_ARCH_TIMERto KConfig
arm: add basic framework for Nexell S5P6818 support
arm: nexell: embed NSIH header
arm: nexell: add UART support
arm: nexell: add preliminary S5P6818 SoC device tree
arm: add NanoPi M3 board support
arm: nexell: switch to 32-bitarch/arm/Kconfig | 29 +++++ arch/arm/Makefile | 1 + arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/dts/s5p6818-nanopi-m3.dts | 30 +++++ arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++ arch/arm/include/asm/arch-nexell/clk.h | 15 +++ arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++ arch/arm/mach-exynos/include/mach/uart.h | 44 ------- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + arch/arm/mach-nexell/Kconfig | 9 ++ arch/arm/mach-nexell/Makefile | 10 ++ arch/arm/mach-nexell/README | 49 ++++++++ arch/arm/mach-nexell/board.c | 128 +++++++++++++++++++ arch/arm/mach-nexell/mmu-arm64.c | 39 ++++++ arch/arm/mach-s5pc1xx/Kconfig | 2 + arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------- configs/nanopi_m3_defconfig | 12 ++ drivers/mmc/Kconfig | 8 ++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++ drivers/reset/Kconfig | 6 + drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 +++++++++++++++++ drivers/serial/Kconfig | 6 + drivers/serial/Makefile | 2 +- drivers/serial/serial_s5p.c | 45 ++++++- include/configs/mx7ulp_evk.h | 1 - include/configs/s5p6818.h | 35 ++++++ include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 33 files changed,989 insertions(+), 100 deletions(-) create mode 100644
arch/arm/dts/s5p6818-nanopi-m3.dtscreate mode 100644arch/arm/dts/s5p6818.dtsicreate mode 100644arch/arm/include/asm/arch-nexell/boot0.hcreate mode 100644arch/arm/include/asm/arch-nexell/clk.hcreate mode 100644arch/arm/include/asm/arch-nexell/pwm.hdelete mode 100644arch/arm/mach-exynos/include/mach/uart.hcreate mode 100644arch/arm/mach-nexell/Kconfigcreate mode 100644arch/arm/mach-nexell/Makefilecreate mode 100644
Quoted 9 lines
arch/arm/mach-nexell/READMEcreate mode 100644arch/arm/mach-nexell/board.ccreate mode 100644arch/arm/mach-nexell/mmu-arm64.cdelete mode 100644arch/arm/mach-s5pc1xx/include/mach/uart.hcreate mode 100644 configs/nanopi_m3_defconfig create mode 100644drivers/mmc/nexell_dw_mmc.ccreate mode 100644drivers/reset/reset-generic.ccreate mode 100644include/configs/s5p6818.h
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/d8c73e53/attachment.sig>
cover Nexell S5P6818 SoC support
Hi,
Quoted 49 lines
Hi Andre,
Quoted 47 lines
Hi,
this is a first draft of the things Amit and I have been working on in the last months. It introduces support for an SoC called "Nexell S5P6818". This is an Octa-core ARMv8 SoC with Cortex-A53 cores, which apparently is closely related to (older) Samsung SoCs. Many peripherals are compatible to Samsung IP (UART, MMC, Ethernet, timers, ...), but some core peripherals like the clocks and the pin controller seem to be completely different. We used the NanoPi M3 board [1] for testing, which uses this SoC along with the usual suspects of on-board components and connectors. This port is done completely from scratch, by just looking at the manual. This allows a much cleaner and modern U-Boot support than the BSP code.
The ARM Generic Timer (aka. arch timer) does not seem to work on this SoC. Ideally there would be some (hidden?) register enabling the right clock source, though we haven't found one (yet). But as also other code for this SoC out there on the net does not seem to be able to use the arch timer, I am not too hopeful here. While this does not impose a real problem to U-Boot (patch 3/13 takes care of that), it is a showstopper for mainline arm64 Linux, which heavily relies on the arch timer (since it's a mandatory part of the ARMv8 architecture). There is only a very small chance that the arch timer ever becomes optional in the mainline arm64 kernel. However our arm(32) kernel ports works quite nicely so far, also a (hacked) arm64 kernel boots to the prompt. We will submit Linux patches at a later time.
We would be grateful to get some comments on the patches. The first five patches adapt existing code to simplify support for this SoC. The following six patches then successively enable and add SoC support, culmulating in the addition of a
nanopi_m3_defconfigfile in patch 11/13. The SoC support code is actually architecture agnostic, though up until the last patch it generates an AArch64 binary. To overcome the problems with the arch timer mentioned above, the final patch switches the port over to AArch32, which can more naturally launch arm kernels.This code so far does not include an SPL, instead it relies on some vendor provided code to initialise the DRAM and load U-Boot proper. The original BSP code provided a binary blob for that (called "secondboot"), although there is some GPLed version of that available on
github([2]). We can load a 32-bit U-Boot with both the vendor blob and Rafaello's GPL version, the 64-bit version is only usable with the GPL code. Instruction on how to create a bootable SD card are contained in thearch/arm/mach-nexell/READMEfile.
Quoted 6 lines
Quoted 2 lines
We would be very grateful to get some first feedback on those patches and the approach in general taken here.
Just to ask - why it is not possible to add this to:
/arch/arm/mach-exynos ? And start new mach-nexell ?
Ok. I was too fast :-)
Nexell is a separate company - also from Korea - so mach-nexell is a correct approach.
Sorry.
Quoted 3 lines
As fair as I remember, many Samsung SoCs (especially S5P) share IP blocks, so maybe there is a place for unification?
But unification if possible is more than welcome - as it was done in this patch set with uart code.
Quoted 3 lines
Also, it would be quite challenging to support first armv8 Samsung soc in the current directory structure.....
Considering above - mach-nexell is probably the way to go.
Quoted 85 lines
+CC Jaehoon - who may have some comments here.
Quoted 67 lines
Cheers,
Andre.[1] http://nanopi.io/nanopi-m3.html
[2] https://github.com/rafaello7/bl1-nanopi-m3Amit Singh Tomar (4):
reset: add driver for generic reset controllers
mmc: add MMC (glue) driver for Nexell SoCs
arm: nexell: add ARM64 MMU regions
arm: nexell: add timer supportAndre Przywara (9):
serial: s5p: rework Samsung UART driver to get rid ofuart.h
serial: S5P/Samsung: refactor and Kconfig-ize UART selection
arm: moveSYS_ARCH_TIMERto KConfig
arm: add basic framework for Nexell S5P6818 support
arm: nexell: embed NSIH header
arm: nexell: add UART support
arm: nexell: add preliminary S5P6818 SoC device tree
arm: add NanoPi M3 board support
arm: nexell: switch to 32-bitarch/arm/Kconfig | 29 +++++ arch/arm/Makefile | 1 + arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/dts/s5p6818-nanopi-m3.dts | 30 +++++ arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++ arch/arm/include/asm/arch-nexell/clk.h | 15 +++ arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++ arch/arm/mach-exynos/include/mach/uart.h | 44 ------- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + arch/arm/mach-nexell/Kconfig | 9 ++ arch/arm/mach-nexell/Makefile | 10 ++ arch/arm/mach-nexell/README | 49 ++++++++ arch/arm/mach-nexell/board.c | 128 +++++++++++++++++++ arch/arm/mach-nexell/mmu-arm64.c | 39 ++++++ arch/arm/mach-s5pc1xx/Kconfig | 2 + arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------- configs/nanopi_m3_defconfig | 12 ++ drivers/mmc/Kconfig | 8 ++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++ drivers/reset/Kconfig | 6 + drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 +++++++++++++++++ drivers/serial/Kconfig | 6 + drivers/serial/Makefile | 2 +- drivers/serial/serial_s5p.c | 45 ++++++- include/configs/mx7ulp_evk.h | 1 - include/configs/s5p6818.h | 35 ++++++ include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 33 files changed,989 insertions(+), 100 deletions(-) create mode 100644
arch/arm/dts/s5p6818-nanopi-m3.dtscreate mode 100644arch/arm/dts/s5p6818.dtsicreate mode 100644arch/arm/include/asm/arch-nexell/boot0.hcreate mode 100644arch/arm/include/asm/arch-nexell/clk.hcreate mode 100644arch/arm/include/asm/arch-nexell/pwm.hdelete mode 100644arch/arm/mach-exynos/include/mach/uart.hcreate mode 100644arch/arm/mach-nexell/Kconfigcreate mode 100644arch/arm/mach-nexell/Makefilecreate mode 100644Quoted 9 lines
arch/arm/mach-nexell/READMEcreate mode 100644arch/arm/mach-nexell/board.ccreate mode 100644arch/arm/mach-nexell/mmu-arm64.cdelete mode 100644arch/arm/mach-s5pc1xx/include/mach/uart.hcreate mode 100644 configs/nanopi_m3_defconfig create mode 100644drivers/mmc/nexell_dw_mmc.ccreate mode 100644drivers/reset/reset-generic.ccreate mode 100644include/configs/s5p6818.hBest regards,
Quoted 7 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/523e10d9/attachment.sig>
cover Nexell S5P6818 SoC support
Hi Lukasz,
thanks for having a look!
Quoted 54 lines · Lukasz Majewski
Hi,
Quoted 52 lines
Hi Andre,
Quoted 49 lines
Hi,
this is a first draft of the things Amit and I have been working on in the last months. It introduces support for an SoC called "Nexell S5P6818". This is an Octa-core ARMv8 SoC with Cortex-A53 cores, which apparently is closely related to (older) Samsung SoCs. Many peripherals are compatible to Samsung IP (UART, MMC, Ethernet, timers, ...), but some core peripherals like the clocks and the pin controller seem to be completely different. We used the NanoPi M3 board [1] for testing, which uses this SoC along with the usual suspects of on-board components and connectors. This port is done completely from scratch, by just looking at the manual. This allows a much cleaner and modern U-Boot support than the BSP code.
The ARM Generic Timer (aka. arch timer) does not seem to work on this SoC. Ideally there would be some (hidden?) register enabling the right clock source, though we haven't found one (yet). But as also other code for this SoC out there on the net does not seem to be able to use the arch timer, I am not too hopeful here. While this does not impose a real problem to U-Boot (patch 3/13 takes care of that), it is a showstopper for mainline arm64 Linux, which heavily relies on the arch timer (since it's a mandatory part of the ARMv8 architecture). There is only a very small chance that the arch timer ever becomes optional in the mainline arm64 kernel. However our arm(32) kernel ports works quite nicely so far, also a (hacked) arm64 kernel boots to the prompt. We will submit Linux patches at a later time.
We would be grateful to get some comments on the patches. The first five patches adapt existing code to simplify support for this SoC. The following six patches then successively enable and add SoC support, culmulating in the addition of a
nanopi_m3_defconfigfile in patch 11/13. The SoC support code is actually architecture agnostic, though up until the last patch it generates an AArch64 binary. To overcome the problems with the arch timer mentioned above, the final patch switches the port over to AArch32, which can more naturally launch arm kernels.This code so far does not include an SPL, instead it relies on some vendor provided code to initialise the DRAM and load U-Boot proper. The original BSP code provided a binary blob for that (called "secondboot"), although there is some GPLed version of that available on
github([2]). We can load a 32-bit U-Boot with both the vendor blob and Rafaello's GPL version, the 64-bit version is only usable with the GPL code. Instruction on how to create a bootable SD card are contained in thearch/arm/mach-nexell/READMEfile.We would be very grateful to get some first feedback on those patches and the approach in general taken here.
Quoted 8 lines
Quoted 3 lines
Just to ask - why it is not possible to add this to:
/arch/arm/mach-exynos ? And start new mach-nexell ?
Ok. I was too fast :-)
Nexell is a separate company - also from Korea - so mach-nexell is a correct approach.
Yes, I was thinking the same. Though the companies seem to be somewhat related, but I couldn't find any more information about that. My best guess is that either Nexell licensed some (older?) IP from Samsung or it's some kind of spin-off or contractor for Samsung.
But apart from that company relationship I think we should look at the hardware. And here we have the core peripherals (pinctrl, clocks) and the system boot and bringup sequence being actually different from Samsung, so I found a new directory the way to go.
Quoted 1 line
Sorry.
No worries, this isn't really obvious.
Quoted 6 lines
Quoted 3 lines
As fair as I remember, many Samsung SoCs (especially S5P) share IP blocks, so maybe there is a place for unification?
But unification if possible is more than welcome - as it was done in this patch set with uart code.
Indeed, I think we should do it for the timer as well, I just didn't get around it yet and wanted to have some feedback early.
Quoted 4 lines
Quoted 2 lines
Also, it would be quite challenging to support first armv8 Samsung soc in the current directory structure.....
Considering above - mach-nexell is probably the way to go.
In the long run I want to keep this directory as empty as possible. Right now we do some clock setup for instance in board.c, which could be moved somewhere else. But this is something for the future. If this directory turns out to be only sparsely populated, I am open to merging the code somewhere else.
Cheers,
Andre.
Quoted 92 lines
Quoted 79 lines
+CC Jaehoon - who may have some comments here.
Quoted 76 lines
Cheers,
Andre.[1] http://nanopi.io/nanopi-m3.html
[2] https://github.com/rafaello7/bl1-nanopi-m3Amit Singh Tomar (4):
reset: add driver for generic reset controllers
mmc: add MMC (glue) driver for Nexell SoCs
arm: nexell: add ARM64 MMU regions
arm: nexell: add timer supportAndre Przywara (9):
serial: s5p: rework Samsung UART driver to get rid ofuart.h
serial: S5P/Samsung: refactor and Kconfig-ize UART selection
arm: moveSYS_ARCH_TIMERto KConfig
arm: add basic framework for Nexell S5P6818 support
arm: nexell: embed NSIH header
arm: nexell: add UART support
arm: nexell: add preliminary S5P6818 SoC device tree
arm: add NanoPi M3 board support
arm: nexell: switch to 32-bitarch/arm/Kconfig | 29 +++++ arch/arm/Makefile | 1 + arch/arm/cpu/armv8/Makefile | 2 +- arch/arm/dts/s5p6818-nanopi-m3.dts | 30 +++++ arch/arm/dts/s5p6818.dtsi | 196 ++++++++++++++++++++++++++++++ arch/arm/dts/s5pc1xx-goni.dts | 2 +- arch/arm/dts/s5pc1xx-smdkc100.dts | 2 +- arch/arm/include/asm/arch-nexell/boot0.h | 35 ++++++ arch/arm/include/asm/arch-nexell/clk.h | 15 +++ arch/arm/include/asm/arch-nexell/pwm.h | 62 ++++++++++ arch/arm/mach-exynos/include/mach/uart.h | 44 ------- arch/arm/mach-imx/mx7ulp/Kconfig | 1 + arch/arm/mach-nexell/Kconfig | 9 ++ arch/arm/mach-nexell/Makefile | 10 ++ arch/arm/mach-nexell/README | 49 ++++++++ arch/arm/mach-nexell/board.c | 128 +++++++++++++++++++ arch/arm/mach-nexell/mmu-arm64.c | 39 ++++++ arch/arm/mach-s5pc1xx/Kconfig | 2 + arch/arm/mach-s5pc1xx/include/mach/uart.h | 44 ------- configs/nanopi_m3_defconfig | 12 ++ drivers/mmc/Kconfig | 8 ++ drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 159 ++++++++++++++++++++++++ drivers/reset/Kconfig | 6 + drivers/reset/Makefile | 1 + drivers/reset/reset-generic.c | 111 +++++++++++++++++ drivers/serial/Kconfig | 6 + drivers/serial/Makefile | 2 +- drivers/serial/serial_s5p.c | 45 ++++++- include/configs/mx7ulp_evk.h | 1 - include/configs/s5p6818.h | 35 ++++++ include/configs/ti_armv7_keystone2.h | 1 - scripts/config_whitelist.txt | 1 - 33 files changed,989 insertions(+), 100 deletions(-) create mode 100644
arch/arm/dts/s5p6818-nanopi-m3.dtscreate mode 100644arch/arm/dts/s5p6818.dtsicreate mode 100644arch/arm/include/asm/arch-nexell/boot0.hcreate mode 100644arch/arm/include/asm/arch-nexell/clk.hcreate mode 100644arch/arm/include/asm/arch-nexell/pwm.hdelete mode 100644arch/arm/mach-exynos/include/mach/uart.hcreate mode 100644arch/arm/mach-nexell/Kconfigcreate mode 100644arch/arm/mach-nexell/Makefilecreate mode 100644arch/arm/mach-nexell/READMEcreate mode 100644arch/arm/mach-nexell/board.ccreate mode 100644arch/arm/mach-nexell/mmu-arm64.cdelete mode 100644arch/arm/mach-s5pc1xx/include/mach/uart.hcreate mode 100644 configs/nanopi_m3_defconfig create mode 100644drivers/mmc/nexell_dw_mmc.ccreate mode 100644drivers/reset/reset-generic.ccreate mode 100644include/configs/s5p6818.hBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de