[U-Boot] [RFC PATCH 00/13] Nexell S5P6818 SoC support

Andre Przywara
2017-11-30T10:52:37Z

Hi Lukasz,

thanks for having a look!

On 30/11/17 10:22, Lukasz Majewski wrote:
> Hi,
>
>> Hi Andre,
>>
>>> 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.
>>
>> 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.

> Sorry.

No worries, this isn't really obvious.

>>
>> 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.

>> 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.

>>
>> +CC Jaehoon - who may have some comments 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
>>>
>
>
>
> 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
>