diff mbox series

[v3,14/14] arm: add (default) config for nanopi2 board

Message ID 1593452806-8609-15-git-send-email-stefan_b@posteo.net
State New
Delegated to: Tom Rini
Headers show
Series arm: add support for SoC S5P4418 | expand

Commit Message

Stefan Bosch June 29, 2020, 5:46 p.m. UTC
Changes in relation to FriendlyARM's U-Boot nanopi2-v2016.01:
- Configuration changed, mainly several "CONFIG_..." moved from
  s5p4418_nanopi2.h to s5p4418_nanopi2_defconfig and USB related
  configs removed because USB is not supported yet.
- s5p4418_nanopi2.h: "CONFIG_" removed from several s5p4418/nanopi2
  specific defines because the appropriate values do not need to be
  configurable.
- pinctrl is supported now, therefore "CONFIG_PINCTRL=y" added to
  s5p4418_nanopi2_defconfig.


Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
---

Changes in v3:
- 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:
- 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.

 MAINTAINERS                       |  17 +++
 configs/s5p4418_nanopi2_defconfig | 147 ++++++++++++++++++++++
 doc/README.s5p4418                |  63 ++++++++++
 include/configs/s5p4418_nanopi2.h | 257 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 484 insertions(+)
 create mode 100644 configs/s5p4418_nanopi2_defconfig
 create mode 100644 doc/README.s5p4418
 create mode 100644 include/configs/s5p4418_nanopi2.h
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1fd975c..314162c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -270,6 +270,23 @@  F:	arch/arm/mach-at91/
 F:	board/atmel/
 F:	drivers/misc/microchip_flexcom.c
 
+ARM NEXELL S5P4418
+M:	Stefan Bosch <stefan_b@posteo.net>
+S:	Maintained
+F:	arch/arm/cpu/armv7/s5p4418/
+F:	arch/arm/dts/s5p4418*
+F:	arch/arm/mach-nexell/
+F:	board/friendlyarm/
+F:	configs/s5p4418_nanopi2_defconfig
+F:	doc/README.s5p4418
+F:	drivers/gpio/nx_gpio.c
+F:	drivers/i2c/nx_i2c.c
+F:	drivers/mmc/nexell_dw_mmc_dm.c
+F:	drivers/pinctrl/nexell/
+F:	drivers/video/nexell/
+F:	drivers/video/nexell_display.c
+F:	include/configs/s5p4418_nanopi2.h
+
 ARM OWL
 M:	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
 S:	Maintained
diff --git a/configs/s5p4418_nanopi2_defconfig b/configs/s5p4418_nanopi2_defconfig
new file mode 100644
index 0000000..c1cd08a
--- /dev/null
+++ b/configs/s5p4418_nanopi2_defconfig
@@ -0,0 +1,147 @@ 
+CONFIG_ARM=y
+CONFIG_ARCH_NEXELL=y
+CONFIG_ARCH_S5P4418=y
+CONFIG_TARGET_NANOPI2=y
+CONFIG_DEFAULT_DEVICE_TREE="s5p4418-nanopi2"
+CONFIG_FIT=y
+
+CONFIG_SYS_MEMTEST_START=0x71000000
+CONFIG_SYS_MEMTEST_END=0xb0000000
+
+CONFIG_CMD_MEMTEST=y
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NET is not set
+
+# Default is CONFIG_NET=y, in this case:
+#   Loading Environment from MMC... ## Warning: Unknown environment variable type 'm'
+#   OK
+# CONFIG_CMD_NET=y must be set to avoid this Warning. But then:
+#   Net:   Net Initialization Skipped
+#   No ethernet found.
+# If CONFIG_NET=n is set additionally warning at "make s5p4418_nanopi2_defconfig":
+#    arch/../configs/s5p4418_nanopi2_defconfig:24:warning: override: reassigning to symbol CMD_NET
+#
+# --> CONFIG_NET=n set only
+CONFIG_NET=n
+
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_FDISK=y
+CONFIG_CMD_EXT4_IMG_WRITE=y
+CONFIG_CMD_SD_RECOVERY=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+
+CONFIG_PINCTRL=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_NEXELL=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_AXP228=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_AXP228=y
+CONFIG_DM_PWM=n
+
+CONFIG_DISPLAY=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_CONSOLE_BG_COL=0xff
+CONFIG_SYS_CONSOLE_FG_COL=0x00
+CONFIG_VIDEO_NX=y
+CONFIG_VIDEO_NX_RGB=y
+CONFIG_VIDEO_NX_LVDS=y
+CONFIG_VIDEO_NX_HDMI=y
+CONFIG_CMD_BMP=y
+
+## LCD backlight control
+CONFIG_S5P4418_ONEWIRE=y
+CONFIG_PWM_NX is not set
+
+CONFIG_REGEX=y
+CONFIG_ERRNO_STR=y
+
+CONFIG_SYS_TEXT_BASE=0x74C00000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SYS_CACHELINE_SIZE=64
+
+## System initialize options (board_init_f)
+# board_init_f->init_sequence, call board_early_init_f
+CONFIG_BOARD_LATE_INIT=y
+# board_init_f->init_sequence, call print_cpuinfo
+CONFIG_DISPLAY_CPUINFO=y
+# board_init_f->init_sequence, call show_board_info
+CONFIG_DISPLAY_BOARDINFO=y
+# board_init_f, CONFIG_SYS_ICACHE_OFF
+CONFIG_SYS_DCACHE_OFF=y
+# board_init_r, call arch_misc_init
+CONFIG_ARCH_MISC_INIT=y
+
+CONFIG_BOOTDELAY=1
+CONFIG_ZERO_BOOTDELAY_CHECK=y
+
+## U-Boot Environments
+## refer to common/env_common.c
+
+# CONFIG_ENV_IS_IN_MMC must be set here and not in s5p4418_nanopi2.h
+# otherwise CONFIG_ENV_IS_NOWHERE is set by env/Kconfig and environment
+# (bootargs) are not loaded
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_OFFSET=0x2E0200
+CONFIG_ENV_SIZE=0x4000
+CONFIG_CMD_SAVEENV=y
+
+## Etc Command definition
+# image info
+CONFIG_CMD_IMI=y
+# add command line history
+CONFIG_CMDLINE_EDITING=y
+CONFIG_CMDLINE_TAG=y
+CONFIG_INITRD_TAG=y
+CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_REVISION_TAG=y
+CONFIG_CMD_BOOTZ=y
+
+## serial console configuration
+CONFIG_CONS_INDEX=0
+CONFIG_BAUDRATE=115200
+
+## SD/MMC
+CONFIG_BOUNCE_BUFFER=y
+CONFIG_GENERIC_MMC=y
+CONFIG_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_NEXELL_DWMMC=y
+CONFIG_CMD_MMC=y
+CONFIG_DM_MMC=y
+
+CONFIG_DOS_PARTITION=y
+CONFIG_CMD_FAT=y
+CONFIG_FS_FAT=y
+CONFIG_FAT_WRITE=y
+
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_FS_EXT4=y
+CONFIG_EXT4_WRITE=y
+
+## OF_CONTROL
+CONFIG_FIT_BEST_MATCH=y
+CONFIG_OF_LIBFDT=y
+CONFIG_OF_BOARD_SETUP=y
+
+## BOOTCOMMAND
+CONFIG_ROOT_DEV=1
+CONFIG_BOOT_PART=1
+CONFIG_ROOT_PART=2
+
+# necessary for if-cmd
+CONFIG_HUSH_PARSER=y
+
+# set to 'n' to save memory
+CONFIG_SYS_LONGHELP=y
+
+# For debugging (trace) of MMC-CMDs
+CONFIG_MMC_TRACE=n
diff --git a/doc/README.s5p4418 b/doc/README.s5p4418
new file mode 100644
index 0000000..ac724d0
--- /dev/null
+++ b/doc/README.s5p4418
@@ -0,0 +1,63 @@ 
+
+Summary
+=======
+
+This README is about U-Boot support for SAMSUNG's/NEXELL's ARM Cortex-A9 based
+S5P4418 SoC. It is based on FriendlyARM's U-Boot v2016.01 for the NanoPi2
+(and other) boards [1].
+
+Currently the following boards are supported:
+
+* FriendlyArm NanoPi2   [2]
+* FriendlyArm NanoPC-T2 [3]
+
+
+Build
+=====
+
+* NanoPi2 and NanoPC-T2
+
+make s5p4418_nanopi2_defconfig
+make
+
+
+Installation
+============
+
+- Download Official-ROMs-SDCard-20190718.7z from [4] (images files for android,
+  friendlyCore and LUbuntu)
+- Use s5p4418-sd-lubuntu-desktop-xenial-4.4-armhf-20190718.img to make a SD-card
+- Use dd in the directory where U-Boot has been built to update U-Boot:
+  (replace <SD-card> with the device used for the SD-card, e.g. sdc)
+  sudo dd seek=3841 if=u-boot.bin of=/dev/<SD-card>
+- Boot the board from this SD-card
+
+The source code for (the used?) LUbuntu 16.04 can be found at [5].
+
+
+Links
+=====
+
+[1] FriendlyArm U-boot v2016.01:
+
+https://github.com/friendlyarm/u-boot/tree/nanopi2-v2016.01
+
+
+[2] NanoPi2:
+
+http://wiki.friendlyarm.com/wiki/index.php/NanoPi_2
+
+
+[3] NanoPC-T2:
+
+http://wiki.friendlyarm.com/wiki/index.php/NanoPC-T2
+
+
+[4] FriendlyArm image files for NanoPi2:
+
+http://download.friendlyarm.com//NanoPi2
+
+
+[5] FriendlyArm LUbuntu 16.04 Source Code for NanoPi2:
+
+https://github.com/friendlyarm/linux/tree/nanopi2-v4.4.y
diff --git a/include/configs/s5p4418_nanopi2.h b/include/configs/s5p4418_nanopi2.h
new file mode 100644
index 0000000..da5b29a
--- /dev/null
+++ b/include/configs/s5p4418_nanopi2.h
@@ -0,0 +1,257 @@ 
+/* SPDX-License-Identifier: GPL-2.0+
+ *
+ * Copyright (C) Guangzhou FriendlyARM Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * (C) Copyright 2016 Nexell
+ * Hyejung Kwon <cjscld15@nexell.co.kr>
+ *
+ * Copyright (C) 2019  Stefan Bosch <stefan_b@posteo.net>
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <linux/sizes.h>
+#include <asm/arch/nexell.h>
+
+/*-----------------------------------------------------------------------
+ *  System memory Configuration
+ */
+#define CONFIG_SYS_INIT_SP_ADDR		CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_MEM_SIZE		0x40000000
+#define CONFIG_SYS_SDRAM_BASE		0x71000000
+
+/*
+ * "(CONFIG_SYS_MEM_SIZE - CONFIG_SYS_RESERVE_MEM_SIZE)" has been used in
+ * u-boot nanopi2-v2016.01.
+ * This is not working anymore because boot_fdt_add_mem_rsv_regions() in
+ * common/image-fdt.c has been extended:
+ * Also reserved-memory sections are marked as unusable.
+ *
+ * In friendlyArm Ubuntu 16.04 source arch/arm/boot/dts/s5p4418.dtsi:
+ *        reserved-memory {
+ *            #address-cells = <1>;
+ *            #size-cells = <1>;
+ *            ranges;
+ *
+ *            secure_memory@b0000000 {
+ *                reg = <0xB0000000 0x1000000>;
+ *                nop-map;
+ *            };
+ *        };
+ *
+ * arch_lmb_reserve() of arch/arm/lib/bootm.c:
+ *     "Allocate space for command line and board info - ... below the current
+ *      stack pointer."
+ *      --> Memory allocated would overlap with "secure_memory@b0000000"
+ *      --> lmb_add_region(rgn, base==0xb0000000, size==0x1000000) fails,
+ *      boot output:
+ *        ...
+ *        Kernel image @ 0x71080000 [ 0x000000 - 0x60e628 ]
+ *        ## Flattened Device Tree blob at 7a000000
+ *           Booting using the fdt blob at 0x7a000000
+ *        ERROR: reserving fdt memory region failed (addr=b0000000 size=1000000)
+ *           Using Device Tree in place at 7a000000, end 7a00fbf0
+ *
+ *        Starting kernel ...
+ *        ...
+ */
+#define CONFIG_SYS_SDRAM_SIZE		(0xb0000000 - CONFIG_SYS_SDRAM_BASE)
+
+#define CONFIG_SYS_MALLOC_LEN		(32 * 1024 * 1024)
+
+#define BMP_LOAD_ADDR			0x78000000
+
+/* kernel load address */
+#define CONFIG_SYS_LOAD_ADDR		0x71080000
+#define INITRD_START			0x79000000
+#define KERNEL_DTB_ADDR			0x7A000000
+
+/*-----------------------------------------------------------------------
+ *  High Level System Configuration
+ */
+/* Not used: not need IRQ/FIQ stuff */
+#undef  CONFIG_USE_IRQ
+/* decrementer freq: 1ms ticks */
+#define CONFIG_SYS_HZ			1000
+
+/*-----------------------------------------------------------------------
+ *  System initialize options (board_init_f)
+ */
+/* board_init_f->init_sequence, call arch_cpu_init */
+#define CONFIG_ARCH_CPU_INIT
+
+/*-----------------------------------------------------------------------
+ * Miscellaneous configurable options
+ */
+#ifdef CONFIG_SYS_PROMPT
+#undef CONFIG_SYS_PROMPT
+/* Monitor Command Prompt */
+#define CONFIG_SYS_PROMPT		"nanopi2# "
+#endif
+
+/* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE		1024
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE +             \
+					 sizeof(CONFIG_SYS_PROMPT) + 16)
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS		16
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
+
+/*-----------------------------------------------------------------------
+ * allow to overwrite serial and ethaddr
+ */
+#define CONFIG_ENV_OVERWRITE
+
+#ifdef CONFIG_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#endif
+
+/*-----------------------------------------------------------------------
+ * Etc Command definition
+ */
+#undef CONFIG_BOOTM_NETBSD
+#undef CONFIG_BOOTM_RTEMS
+
+/*-----------------------------------------------------------------------
+ * serial console configuration
+ */
+#define CONFIG_PL011_CLOCK		50000000
+#define CONFIG_PL01x_PORTS		{(void *)PHY_BASEADDR_UART0, \
+					 (void *)PHY_BASEADDR_UART1, \
+					 (void *)PHY_BASEADDR_UART2, \
+					 (void *)PHY_BASEADDR_UART3}
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+/*-----------------------------------------------------------------------
+ * PLL
+ */
+#define CONFIG_SYS_PLLFIN		24000000UL
+
+/*-----------------------------------------------------------------------
+ * Timer
+ */
+#define CONFIG_TIMER_SYS_TICK_CH	0
+
+/*-----------------------------------------------------------------------
+ * BACKLIGHT
+ */
+#ifndef CONFIG_S5P4418_ONEWIRE
+#ifdef CONFIG_PWM_NX
+/* fallback to pwm */
+#define BACKLIGHT_CH		0
+#define BACKLIGHT_DIV		0
+#define BACKLIGHT_INV		0
+#define BACKLIGHT_DUTY		50
+#define BACKLIGHT_HZ		1000
+#endif
+#endif
+
+/*-----------------------------------------------------------------------
+ * SD/MMC
+ */
+#if defined(CONFIG_MMC)
+/* eMMC = 0, SD-card = 2 */
+#define CONFIG_SYS_MMC_DEV		2
+#define CONFIG_SYS_MMC_ENV_DEV		CONFIG_SYS_MMC_DEV
+#endif
+
+/*-----------------------------------------------------------------------
+ * Default environment organization
+ */
+#if !defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_IS_IN_NAND) && \
+	!defined(CONFIG_ENV_IS_IN_FLASH) && !defined(CONFIG_ENV_IS_IN_EEPROM)
+	/* default: CONFIG_ENV_IS_NOWHERE */
+	#define CONFIG_ENV_IS_NOWHERE
+	#define CONFIG_ENV_OFFSET	1024
+	#define CONFIG_ENV_SIZE		(4 * 1024)	/* env size */
+#endif
+
+/*-----------------------------------------------------------------------
+ * VIDEO
+ */
+
+#define CONFIG_VIDEO_LOGO
+
+#define CONFIG_SPLASH_SCREEN
+
+#ifdef CONFIG_VIDEO_LOGO
+
+#ifdef CONFIG_DM_VIDEO
+#define CONFIG_BMP_24BPP
+#endif
+
+#ifdef CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SOURCE		1
+#define CONFIG_SPLASH_SCREEN_ALIGN	1
+#define SPLASH_FILE			logo.bmp
+#endif
+
+#endif
+
+/*-----------------------------------------------------------------------
+ * ENV
+ */
+#define BLOADER_MMC						\
+	"ext4load mmc ${rootdev}:${bootpart} "
+
+#ifdef CONFIG_OF_BOARD_SETUP
+#define EXTRA_ENV_DTB_RESERVE					\
+	"dtb_reserve="						\
+	"if test -n \"$dtb_addr\"; then fdt addr $dtb_addr; fi\0"
+#else
+#define EXTRA_ENV_DTB_RESERVE					\
+	"dtb_reserve="						\
+	"if test -n \"$fb_addr\"; then "			\
+	  "fdt addr $dtb_addr;"					\
+	  "fdt resize;"						\
+	  "fdt mk /reserved-memory display_reserved;"		\
+	  "fdt set /reserved-memory/display_reserved "		\
+	    "reg <$fb_addr 0x800000>;"				\
+	"fi;\0"
+#endif
+
+#ifdef CONFIG_SPLASH_SCREEN
+#define EXTRA_ENV_BOOT_LOGO					\
+	"splashimage=" __stringify(BMP_LOAD_ADDR)"\0"		\
+	"splashfile=" __stringify(SPLASH_FILE)"\0"		\
+	"splashpos=m,m\0"					\
+	"fb_addr=\0"						\
+	EXTRA_ENV_DTB_RESERVE
+#else
+	#define EXTRA_ENV_BOOT_LOGO  EXTRA_ENV_DTB_RESERVE
+#endif
+
+#define CONFIG_EXTRA_ENV_SETTINGS				\
+	"fdt_high=0xffffffff\0"					\
+	"initrd_high=0xffffffff\0"				\
+	"rootdev=" __stringify(CONFIG_ROOT_DEV) "\0"		\
+	"rootpart=" __stringify(CONFIG_ROOT_PART) "\0"		\
+	"bootpart=" __stringify(CONFIG_BOOT_PART) "\0"		\
+	"kernel=zImage\0"					\
+	"loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0"	\
+	"dtb_name=s5p4418-nanopi2-rev01.dtb\0"			\
+	"dtb_addr=" __stringify(KERNEL_DTB_ADDR) "\0"		\
+	"initrd_name=ramdisk.img\0"				\
+	"initrd_addr=" __stringify(INITRD_START) "\0"		\
+	"initrd_size=0x600000\0"				\
+	"load_dtb="						\
+		BLOADER_MMC "${dtb_addr} ${dtb_name}; "		\
+		"run dtb_reserve\0"				\
+	"load_kernel="						\
+		BLOADER_MMC "${loadaddr} ${kernel}\0"		\
+	"load_initrd="						\
+		BLOADER_MMC "${initrd_addr} ${initrd_name}; "	\
+		"setenv initrd_size 0x${filesize}\0"		\
+	"mmcboot="						\
+		"run load_kernel; run load_initrd; run load_dtb; "	\
+		"bootz ${loadaddr} ${initrd_addr}:${initrd_size} "	\
+		  "${dtb_addr}\0"				\
+	"bootcmd=run mmcboot\0"					\
+	EXTRA_ENV_BOOT_LOGO
+
+#endif /* __CONFIG_H__ */