From patchwork Fri Jul 10 17:07:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bosch X-Patchwork-Id: 241323 List-Id: U-Boot discussion From: stefan_b at posteo.net (Stefan Bosch) Date: Fri, 10 Jul 2020 19:07:24 +0200 Subject: [PATCH v4 00/14] arm: add support for SoC S5P4418 Message-ID: <1594400858-3140-1-git-send-email-stefan_b@posteo.net> This patch adds support for SAMSUNG's/NEXELL's ARM Cortex-A9 based S5P4418 SoC, especially FriendlyARM's NanoPi2 and NanoPC-T2 boards. It is based on the following FriendlyARM's U-Boot version: https://github.com/friendlyarm/u-boot/tree/nanopi2-v2016.01. Main changes in relation to nanopi2-v2016.01: - Cosmetic changes due to patman warnings/errors. - MMC and Video drivers changed to DM. - Configs reworked (e.g. "CONFIG_..." moved from s5p4418_nanopi2.h to s5p4418_nanopi2_defconfig) - SPL related files are not included. - MACH_TYPE_S5P4418 is not defined/used anymore. - arch/arm/mach-nexell/include/mach/boot0.h added to generate the NSIH (Nexell System Information Header), substitudes tools/nexell. - board/s5p4418/ renamed to board/friendlyarm/ - Only the NanoPi2 and NanoPC-T2 boards are supported yet because I do only have the NanoPC-T2 board to test the code (this board uses the NanoPi2 code). - USB is not supported yet. - pinctrl-driver/dt is used for mmc and i2c now instead of configuring the I/O-pins in the drivers. - '#ifdef CONFIG...' changed to 'if (IS_ENABLED(CONFIG...))' where possible (and similar). - livetree API (dev_read_...) is used instead of fdt one (fdt...). The patch-series has been checked by buildman (all arm boards and two m68k boards = M5235EVB): buildman --step 0 -b master arm buildman --step 0 -b master M5235EVB There have been no new warnings or errors. Changes in v4: - cosmetic changes in nx_i2c.c: if-else block simplified, defines used for constant values. Changes in v3: - arch/arm/mach-nexell/Kconfig: "NEXELL_COMMON" removed, has not been used at all. NEXELL_ARMV7_COMMON and NEXELL_ARMV8_COMMON removed, has been used only in the Kconfig at ARCH_S5P4418 and ARCH_S5P6818. Used "select ..."-statements moved appropriately. Missing helps added. - arch/arm/mach-nexell/timer.c: '#include ' inserted because it has been removed from common.h. - '#ifdef...' changed to 'if (IS_ENABLED(CONFIG...))' where possible because of appropriate warnings of patman. - Changed to livetree API as proposed by patman: fdtdec_get_int() --> dev_read_s32_default() fdt_getprop() --> dev_read_string() - pinctrl-driver/dt is used now instead of configuring the i2c I/O-pins in the i2c-driver. - drivers/i2c/nx_i2c.c: '#include ' inserted because it has been removed from common.h. - Changed to livetree API as proposed by patman: fdtdec_get_int() --> dev_read_s32_default() - nexell_dw_mmc_dm.c renamed (back) to nexell_dw_mmc.c - pinctrl-driver/dt is used now instead of configuring the mmc I/O-pins in the mmc-driver. - nexell_dwmmc_ofdata_to_platdata() reworked, i.e. valid default values are used now (where possible) and the appropriate if-blocks have been removed. - "nexell," removed from dt-properties, e.g. "nexell,bus-width" changed to "bus-width". - new dt-property "mmcboost" is used now instead of "CONFIG_BOOST_MMC" which was not defined anywhere. - Boot error "Loading Environment from MMC... *** Warning - No block device, using default environment" after updating local repository. Bugfix in drivers/mmc/nexell_dw_mmc.c: "#include " changed to "#include ". This Bug showed up now because of the commit "dm: clk: add stub when CONFIG_CLK is deactivated" where include/clk.h has been changed. - drivers/mmc/nexell_dw_mmc.c: '#include ' inserted because it has been removed from common.h. - Kconfig: Missing helps added. - Changed to livetree API as proposed by patman: fdt_stringlist_count() --> dev_read_string_count() fdt_stringlist_get() --> dev_read_string_index() fdtdec_get_int() --> dev_read_s32_default() - doc/device-tree-bindings/pinctrl/nexell,s5pxx18-pinctrl.txt added. - Handling of Configs for LCD backlight control reworked because (among others) not setting CONFIG_S5P4418_ONEWIRE and/or CONFIG_PWM_NX has caused errors when compiling board/friendlyarm/nanopi2/onewire.c. - pwm.h: () around macro argument x added to avoid precedence issues. - drivers/video/nexell/s5pxx18_dp_hdmi.c: '#include ' and '#include ' inserted because it has been removed from common.h. - drivers/video/nexell_display.c: '#include ' inserted because '#include ' (includes command.h) has been removed from common.h. - Changed to livetree API as proposed by patman: fdtdec_get_int() --> ofnode_read_s32_default() for (node = ...) --> ofnode_for_each_subnode() fdt_get_name() --> ofnode_get_name() fdt_getprop() --> dev_read_string() - nx_display_probe() removed, nx_display_dev_probe_uclass() renamed to nx_display_probe(). - dts: pinctrl is supported now, therefore s5p4418-pinctrl.dtsi added, mmc- and i2c-entries extended appropriately. New mmc-property "mmcboost" added. - Handling of Configs for LCD backlight control reworked because (among others) not setting CONFIG_S5P4418_ONEWIRE and/or CONFIG_PWM_NX has caused errors when compiling board/friendlyarm/nanopi2/onewire.c. - arch/arm/cpu/armv7/s5p4418/cpu.c: '#include ' inserted because it has been removed from common.h. - board/friendlyarm/nanopi2/board.c: Several includes inserted because some includes have been removed from common.h. - Several initialisations of static variables to 0 removed because of appropriate errors of patman. - CONFIG_SYS_RESERVE_MEM_SIZE removed, has not been used anymore - s5p4418_nanopi2_defconfig: "CONFIG_PINCTRL=y" added because pinctrl is supported now. "CONFIG_EFI_LOADER=n" removed (there have been boot errors "efi_runtime_relocate: Unknown relocation type 0" at a previous U-Boot Version without this). "CONFIG_DM_I2C_GPIO=y" removed because I2C-peripherial is used (Nexell I2C driver). Some configs moved down for cosmetic reason. - Handling of Configs for LCD backlight control reworked because (among others) not setting CONFIG_S5P4418_ONEWIRE and/or CONFIG_PWM_NX has caused errors when compiling board/friendlyarm/nanopi2/onewire.c. - CONFIG_SYS_MEMTEST_START, CONFIG_SYS_MEMTEST_END, CONFIG_CMDLINE_TAG and CONFIG_CMD_BMP moved from s5p4418_nanopi2.h to s5p4418_nanopi2_defconfig. - "#undef CONFIG_CMD_IMLS" removed in s5p4418_nanopi2.h Changes in v2: - arch/arm/mach-nexell/serial.c removed because this is for the UARTs of the S5P6818 SoC which is not supported yet. S5P4418 UARTs are different, here the (existing) PL011-code is used. - line '... += spl/' in in arch/arm/mach-nexell/Makefile deleted, this change has already been stated in the commit message but was missing nethertheless. - commit "i2c: mmc: add nexell driver (gpio, i2c, mmc, pwm)" splitted into separate commits for gpio, i2c, mmc, pwm. - cosmetic: line "obj-$(CONFIG_NX_GPIO) += nx_gpio.o" in drivers/gpio/Makefile moved up. - several Bugfixes in nx_i2c.c. - the i2c-driver has been for s5p6818 only. Code extended approriately in order s5p4418 is also working. - "probe_chip" added to the i2c-driver. - doc/device-tree-bindings/i2c/nx_i2c.txt added. - Since drivers/pwm/pwm-nexell.c is an adapted version of s5p-common/pwm.c an appropriately changed version of s5p-common/pwm.c is used now. Therefore arch/arm/mach-s5pc1xx/include/mach/pwm.h copied to arch/arm/mach-nexell/include/mach and s5p-common/Makefile changed appropriately. - i2c: "nexell,s5pxx18-i2c"-driver is used now instead of "i2c-gpio". i2c0 and i2c1 added. I.e. dts files changed appropriately. - dts: gmac-, ehci- and dwc2otg-entries removed because the appropriate functionality is not supported yet. - s5p4418-pinctrl.dtsi removed because there is no pinctrl-driver available. - "obj-$(CONFIG_ARCH_NEXELL) += s5p-common/" added to arch/arm/cpu/armv7/Makefile since s5p-common/pwm.c is used now instead of drivers/pwm/pwm-nexell.c. - cosmetic: additional GPL license text removed, SPDX-License-Identifier is enough. Furthermore file path removed (two files). - USB related configs removed because USB is not supported yet. - CONFIG_CMD_MEMTEST moved from s5p4418_nanopi2.h to s5p4418_nanopi2_defconfig. - MAINTAINERS: "F: drivers/pwm/pwm-nexell*" deleted because arch/arm/cpu/armv7/s5p-common/pwm.c is used now. Furthermore double line "F: drivers/video/nexell/" deleted. Stefan Bosch (14): arm: add mach-nexell (header files) arm: add mach-nexell (all files except header files) gpio: add nexell driver i2c: add nexell driver mmc: add nexell driver pinctrl: add nexell driver pwm: add driver for nexell video: add nexell video driver (soc: displaytop) video: add nexell video driver (soc: mlc, mipi) video: add nexell video driver (soc: lvds, hdmi) video: add nexell video driver (soc: dpc, makefile) video: add nexell video driver (display/video driver) arm: add support for SoC s5p4418 (cpu) / nanopi2 board arm: add (default) config for nanopi2 board MAINTAINERS | 17 + arch/arm/Kconfig | 7 + arch/arm/Makefile | 1 + arch/arm/cpu/armv7/Makefile | 2 + arch/arm/cpu/armv7/s5p-common/Makefile | 13 +- arch/arm/cpu/armv7/s5p-common/pwm.c | 57 +- arch/arm/cpu/armv7/s5p4418/Makefile | 6 + arch/arm/cpu/armv7/s5p4418/cpu.c | 121 ++ arch/arm/dts/Makefile | 3 + arch/arm/dts/s5p4418-nanopi2.dts | 110 ++ arch/arm/dts/s5p4418-pinctrl.dtsi | 135 ++ arch/arm/dts/s5p4418.dtsi | 170 ++ arch/arm/mach-nexell/Kconfig | 58 + arch/arm/mach-nexell/Makefile | 13 + arch/arm/mach-nexell/clock.c | 869 +++++++++ arch/arm/mach-nexell/cmd_boot_linux.c | 144 ++ arch/arm/mach-nexell/config.mk | 11 + arch/arm/mach-nexell/include/mach/boot0.h | 40 + arch/arm/mach-nexell/include/mach/clk.h | 24 + arch/arm/mach-nexell/include/mach/display.h | 273 +++ arch/arm/mach-nexell/include/mach/display_dev.h | 37 + arch/arm/mach-nexell/include/mach/ehci.h | 106 ++ arch/arm/mach-nexell/include/mach/gpio.h | 17 + arch/arm/mach-nexell/include/mach/mipi_display.h | 215 +++ arch/arm/mach-nexell/include/mach/nexell.h | 352 ++++ arch/arm/mach-nexell/include/mach/nx_gpio.h | 103 ++ arch/arm/mach-nexell/include/mach/pwm.h | 54 + arch/arm/mach-nexell/include/mach/reset.h | 19 + arch/arm/mach-nexell/include/mach/sec_reg.h | 15 + arch/arm/mach-nexell/include/mach/tieoff.h | 423 +++++ arch/arm/mach-nexell/nx_gpio.c | 352 ++++ arch/arm/mach-nexell/nx_sec_reg.c | 82 + arch/arm/mach-nexell/reg-call.S | 23 + arch/arm/mach-nexell/reset.c | 33 + arch/arm/mach-nexell/tieoff.c | 107 ++ arch/arm/mach-nexell/timer.c | 299 ++++ board/friendlyarm/Kconfig | 37 + board/friendlyarm/nanopi2/Kconfig | 12 + board/friendlyarm/nanopi2/MAINTAINERS | 7 + board/friendlyarm/nanopi2/Makefile | 7 + board/friendlyarm/nanopi2/board.c | 575 ++++++ board/friendlyarm/nanopi2/hwrev.c | 108 ++ board/friendlyarm/nanopi2/hwrev.h | 15 + board/friendlyarm/nanopi2/lcds.c | 697 ++++++++ board/friendlyarm/nanopi2/nxp-fb.h | 94 + board/friendlyarm/nanopi2/onewire.c | 307 ++++ board/friendlyarm/nanopi2/onewire.h | 15 + configs/s5p4418_nanopi2_defconfig | 147 ++ doc/README.s5p4418 | 63 + doc/device-tree-bindings/i2c/nx_i2c.txt | 28 + .../pinctrl/nexell,s5pxx18-pinctrl.txt | 78 + drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/nx_gpio.c | 250 +++ drivers/i2c/Kconfig | 9 + drivers/i2c/Makefile | 1 + drivers/i2c/nx_i2c.c | 626 +++++++ drivers/mmc/Kconfig | 8 + drivers/mmc/Makefile | 1 + drivers/mmc/nexell_dw_mmc.c | 237 +++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/nexell/Kconfig | 18 + drivers/pinctrl/nexell/Makefile | 7 + drivers/pinctrl/nexell/pinctrl-nexell.c | 66 + drivers/pinctrl/nexell/pinctrl-nexell.h | 68 + drivers/pinctrl/nexell/pinctrl-s5pxx18.c | 220 +++ drivers/pinctrl/nexell/pinctrl-s5pxx18.h | 53 + drivers/video/Kconfig | 10 + drivers/video/Makefile | 1 + drivers/video/nexell/Kconfig | 27 + drivers/video/nexell/Makefile | 12 + drivers/video/nexell/s5pxx18_dp.c | 341 ++++ drivers/video/nexell/s5pxx18_dp_hdmi.c | 545 ++++++ drivers/video/nexell/s5pxx18_dp_lvds.c | 274 +++ drivers/video/nexell/s5pxx18_dp_mipi.c | 677 +++++++ drivers/video/nexell/s5pxx18_dp_rgb.c | 69 + drivers/video/nexell/soc/Makefile | 11 + drivers/video/nexell/soc/s5pxx18_soc_disptop.c | 185 ++ drivers/video/nexell/soc/s5pxx18_soc_disptop.h | 385 ++++ drivers/video/nexell/soc/s5pxx18_soc_disptop_clk.c | 309 ++++ drivers/video/nexell/soc/s5pxx18_soc_disptop_clk.h | 59 + drivers/video/nexell/soc/s5pxx18_soc_disptype.h | 23 + drivers/video/nexell/soc/s5pxx18_soc_dpc.c | 1569 +++++++++++++++++ drivers/video/nexell/soc/s5pxx18_soc_dpc.h | 444 +++++ drivers/video/nexell/soc/s5pxx18_soc_hdmi.c | 50 + drivers/video/nexell/soc/s5pxx18_soc_hdmi.h | 488 +++++ drivers/video/nexell/soc/s5pxx18_soc_lvds.c | 278 +++ drivers/video/nexell/soc/s5pxx18_soc_lvds.h | 83 + drivers/video/nexell/soc/s5pxx18_soc_mipi.c | 580 ++++++ drivers/video/nexell/soc/s5pxx18_soc_mipi.h | 291 +++ drivers/video/nexell/soc/s5pxx18_soc_mlc.c | 1861 ++++++++++++++++++++ drivers/video/nexell/soc/s5pxx18_soc_mlc.h | 429 +++++ drivers/video/nexell_display.c | 651 +++++++ include/configs/s5p4418_nanopi2.h | 257 +++ 95 files changed, 17981 insertions(+), 5 deletions(-) create mode 100644 arch/arm/cpu/armv7/s5p4418/Makefile create mode 100644 arch/arm/cpu/armv7/s5p4418/cpu.c create mode 100644 arch/arm/dts/s5p4418-nanopi2.dts create mode 100644 arch/arm/dts/s5p4418-pinctrl.dtsi create mode 100644 arch/arm/dts/s5p4418.dtsi create mode 100644 arch/arm/mach-nexell/Kconfig create mode 100644 arch/arm/mach-nexell/Makefile create mode 100644 arch/arm/mach-nexell/clock.c create mode 100644 arch/arm/mach-nexell/cmd_boot_linux.c create mode 100644 arch/arm/mach-nexell/config.mk create mode 100644 arch/arm/mach-nexell/include/mach/boot0.h create mode 100644 arch/arm/mach-nexell/include/mach/clk.h create mode 100644 arch/arm/mach-nexell/include/mach/display.h create mode 100644 arch/arm/mach-nexell/include/mach/display_dev.h create mode 100644 arch/arm/mach-nexell/include/mach/ehci.h create mode 100644 arch/arm/mach-nexell/include/mach/gpio.h create mode 100644 arch/arm/mach-nexell/include/mach/mipi_display.h create mode 100644 arch/arm/mach-nexell/include/mach/nexell.h create mode 100644 arch/arm/mach-nexell/include/mach/nx_gpio.h create mode 100644 arch/arm/mach-nexell/include/mach/pwm.h create mode 100644 arch/arm/mach-nexell/include/mach/reset.h create mode 100644 arch/arm/mach-nexell/include/mach/sec_reg.h create mode 100644 arch/arm/mach-nexell/include/mach/tieoff.h create mode 100644 arch/arm/mach-nexell/nx_gpio.c create mode 100644 arch/arm/mach-nexell/nx_sec_reg.c create mode 100644 arch/arm/mach-nexell/reg-call.S create mode 100644 arch/arm/mach-nexell/reset.c create mode 100644 arch/arm/mach-nexell/tieoff.c create mode 100644 arch/arm/mach-nexell/timer.c create mode 100644 board/friendlyarm/Kconfig create mode 100644 board/friendlyarm/nanopi2/Kconfig create mode 100644 board/friendlyarm/nanopi2/MAINTAINERS create mode 100644 board/friendlyarm/nanopi2/Makefile create mode 100644 board/friendlyarm/nanopi2/board.c create mode 100644 board/friendlyarm/nanopi2/hwrev.c create mode 100644 board/friendlyarm/nanopi2/hwrev.h create mode 100644 board/friendlyarm/nanopi2/lcds.c create mode 100644 board/friendlyarm/nanopi2/nxp-fb.h create mode 100644 board/friendlyarm/nanopi2/onewire.c create mode 100644 board/friendlyarm/nanopi2/onewire.h create mode 100644 configs/s5p4418_nanopi2_defconfig create mode 100644 doc/README.s5p4418 create mode 100644 doc/device-tree-bindings/i2c/nx_i2c.txt create mode 100644 doc/device-tree-bindings/pinctrl/nexell,s5pxx18-pinctrl.txt create mode 100644 drivers/gpio/nx_gpio.c create mode 100644 drivers/i2c/nx_i2c.c create mode 100644 drivers/mmc/nexell_dw_mmc.c create mode 100644 drivers/pinctrl/nexell/Kconfig create mode 100644 drivers/pinctrl/nexell/Makefile create mode 100644 drivers/pinctrl/nexell/pinctrl-nexell.c create mode 100644 drivers/pinctrl/nexell/pinctrl-nexell.h create mode 100644 drivers/pinctrl/nexell/pinctrl-s5pxx18.c create mode 100644 drivers/pinctrl/nexell/pinctrl-s5pxx18.h create mode 100644 drivers/video/nexell/Kconfig create mode 100644 drivers/video/nexell/Makefile create mode 100644 drivers/video/nexell/s5pxx18_dp.c create mode 100644 drivers/video/nexell/s5pxx18_dp_hdmi.c create mode 100644 drivers/video/nexell/s5pxx18_dp_lvds.c create mode 100644 drivers/video/nexell/s5pxx18_dp_mipi.c create mode 100644 drivers/video/nexell/s5pxx18_dp_rgb.c create mode 100644 drivers/video/nexell/soc/Makefile create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_disptop.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_disptop.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_disptop_clk.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_disptop_clk.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_disptype.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_dpc.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_dpc.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_hdmi.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_hdmi.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_lvds.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_lvds.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_mipi.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_mipi.h create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_mlc.c create mode 100644 drivers/video/nexell/soc/s5pxx18_soc_mlc.h create mode 100644 drivers/video/nexell_display.c create mode 100644 include/configs/s5p4418_nanopi2.h