s5p4418_nanopi2.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /* SPDX-License-Identifier: GPL-2.0+
  2. *
  3. * Copyright (C) Guangzhou FriendlyARM Computer Tech. Co., Ltd.
  4. * (http://www.friendlyarm.com)
  5. *
  6. * (C) Copyright 2016 Nexell
  7. * Hyejung Kwon <cjscld15@nexell.co.kr>
  8. *
  9. * Copyright (C) 2019 Stefan Bosch <stefan_b@posteo.net>
  10. */
  11. #ifndef __CONFIG_H__
  12. #define __CONFIG_H__
  13. #include <linux/sizes.h>
  14. #include <asm/arch/nexell.h>
  15. /*-----------------------------------------------------------------------
  16. * System memory Configuration
  17. */
  18. #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE
  19. #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE
  20. #define CONFIG_SYS_MEM_SIZE 0x40000000
  21. #define CONFIG_SYS_SDRAM_BASE 0x71000000
  22. /*
  23. * "(CONFIG_SYS_MEM_SIZE - CONFIG_SYS_RESERVE_MEM_SIZE)" has been used in
  24. * u-boot nanopi2-v2016.01.
  25. * This is not working anymore because boot_fdt_add_mem_rsv_regions() in
  26. * common/image-fdt.c has been extended:
  27. * Also reserved-memory sections are marked as unusable.
  28. *
  29. * In friendlyArm Ubuntu 16.04 source arch/arm/boot/dts/s5p4418.dtsi:
  30. * reserved-memory {
  31. * #address-cells = <1>;
  32. * #size-cells = <1>;
  33. * ranges;
  34. *
  35. * secure_memory@b0000000 {
  36. * reg = <0xB0000000 0x1000000>;
  37. * nop-map;
  38. * };
  39. * };
  40. *
  41. * arch_lmb_reserve() of arch/arm/lib/bootm.c:
  42. * "Allocate space for command line and board info - ... below the current
  43. * stack pointer."
  44. * --> Memory allocated would overlap with "secure_memory@b0000000"
  45. * --> lmb_add_region(rgn, base==0xb0000000, size==0x1000000) fails,
  46. * boot output:
  47. * ...
  48. * Kernel image @ 0x71080000 [ 0x000000 - 0x60e628 ]
  49. * ## Flattened Device Tree blob at 7a000000
  50. * Booting using the fdt blob at 0x7a000000
  51. * ERROR: reserving fdt memory region failed (addr=b0000000 size=1000000)
  52. * Using Device Tree in place at 7a000000, end 7a00fbf0
  53. *
  54. * Starting kernel ...
  55. * ...
  56. */
  57. #define CONFIG_SYS_SDRAM_SIZE (0xb0000000 - CONFIG_SYS_SDRAM_BASE)
  58. #define CONFIG_SYS_MALLOC_LEN (32 * 1024 * 1024)
  59. #define BMP_LOAD_ADDR 0x78000000
  60. /* kernel load address */
  61. #define CONFIG_SYS_LOAD_ADDR 0x71080000
  62. #define INITRD_START 0x79000000
  63. #define KERNEL_DTB_ADDR 0x7A000000
  64. /*-----------------------------------------------------------------------
  65. * High Level System Configuration
  66. */
  67. /* Not used: not need IRQ/FIQ stuff */
  68. #undef CONFIG_USE_IRQ
  69. /* decrementer freq: 1ms ticks */
  70. #define CONFIG_SYS_HZ 1000
  71. /*-----------------------------------------------------------------------
  72. * System initialize options (board_init_f)
  73. */
  74. /* board_init_f->init_sequence, call arch_cpu_init */
  75. #define CONFIG_ARCH_CPU_INIT
  76. /*-----------------------------------------------------------------------
  77. * Miscellaneous configurable options
  78. */
  79. #ifdef CONFIG_SYS_PROMPT
  80. #undef CONFIG_SYS_PROMPT
  81. /* Monitor Command Prompt */
  82. #define CONFIG_SYS_PROMPT "nanopi2# "
  83. #endif
  84. /* Console I/O Buffer Size */
  85. #define CONFIG_SYS_CBSIZE 1024
  86. /* Print Buffer Size */
  87. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
  88. sizeof(CONFIG_SYS_PROMPT) + 16)
  89. /* max number of command args */
  90. #define CONFIG_SYS_MAXARGS 16
  91. /* Boot Argument Buffer Size */
  92. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  93. /*-----------------------------------------------------------------------
  94. * allow to overwrite serial and ethaddr
  95. */
  96. #define CONFIG_ENV_OVERWRITE
  97. #ifdef CONFIG_HUSH_PARSER
  98. #define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
  99. #endif
  100. /*-----------------------------------------------------------------------
  101. * Etc Command definition
  102. */
  103. #undef CONFIG_BOOTM_NETBSD
  104. #undef CONFIG_BOOTM_RTEMS
  105. /*-----------------------------------------------------------------------
  106. * serial console configuration
  107. */
  108. #define CONFIG_PL011_CLOCK 50000000
  109. #define CONFIG_PL01x_PORTS {(void *)PHY_BASEADDR_UART0, \
  110. (void *)PHY_BASEADDR_UART1, \
  111. (void *)PHY_BASEADDR_UART2, \
  112. (void *)PHY_BASEADDR_UART3}
  113. #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  114. /*-----------------------------------------------------------------------
  115. * PLL
  116. */
  117. #define CONFIG_SYS_PLLFIN 24000000UL
  118. /*-----------------------------------------------------------------------
  119. * Timer
  120. */
  121. #define CONFIG_TIMER_SYS_TICK_CH 0
  122. /*-----------------------------------------------------------------------
  123. * BACKLIGHT
  124. */
  125. #ifndef CONFIG_S5P4418_ONEWIRE
  126. #ifdef CONFIG_PWM_NX
  127. /* fallback to pwm */
  128. #define BACKLIGHT_CH 0
  129. #define BACKLIGHT_DIV 0
  130. #define BACKLIGHT_INV 0
  131. #define BACKLIGHT_DUTY 50
  132. #define BACKLIGHT_HZ 1000
  133. #endif
  134. #endif
  135. /*-----------------------------------------------------------------------
  136. * SD/MMC
  137. */
  138. #if defined(CONFIG_MMC)
  139. /* eMMC = 0, SD-card = 2 */
  140. #define CONFIG_SYS_MMC_DEV 2
  141. #define CONFIG_SYS_MMC_ENV_DEV CONFIG_SYS_MMC_DEV
  142. #endif
  143. /*-----------------------------------------------------------------------
  144. * Default environment organization
  145. */
  146. #if !defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_IS_IN_NAND) && \
  147. !defined(CONFIG_ENV_IS_IN_FLASH) && !defined(CONFIG_ENV_IS_IN_EEPROM)
  148. /* default: CONFIG_ENV_IS_NOWHERE */
  149. #define CONFIG_ENV_IS_NOWHERE
  150. #define CONFIG_ENV_OFFSET 1024
  151. #define CONFIG_ENV_SIZE (4 * 1024) /* env size */
  152. #endif
  153. /*-----------------------------------------------------------------------
  154. * VIDEO
  155. */
  156. #define CONFIG_VIDEO_LOGO
  157. #define CONFIG_SPLASH_SCREEN
  158. #ifdef CONFIG_VIDEO_LOGO
  159. #ifdef CONFIG_DM_VIDEO
  160. #define CONFIG_BMP_24BPP
  161. #endif
  162. #ifdef CONFIG_SPLASH_SCREEN
  163. #define CONFIG_SPLASH_SOURCE 1
  164. #define CONFIG_SPLASH_SCREEN_ALIGN 1
  165. #define SPLASH_FILE logo.bmp
  166. #endif
  167. #endif
  168. /*-----------------------------------------------------------------------
  169. * ENV
  170. */
  171. #define BLOADER_MMC \
  172. "ext4load mmc ${rootdev}:${bootpart} "
  173. #ifdef CONFIG_OF_BOARD_SETUP
  174. #define EXTRA_ENV_DTB_RESERVE \
  175. "dtb_reserve=" \
  176. "if test -n \"$dtb_addr\"; then fdt addr $dtb_addr; fi\0"
  177. #else
  178. #define EXTRA_ENV_DTB_RESERVE \
  179. "dtb_reserve=" \
  180. "if test -n \"$fb_addr\"; then " \
  181. "fdt addr $dtb_addr;" \
  182. "fdt resize;" \
  183. "fdt mk /reserved-memory display_reserved;" \
  184. "fdt set /reserved-memory/display_reserved " \
  185. "reg <$fb_addr 0x800000>;" \
  186. "fi;\0"
  187. #endif
  188. #ifdef CONFIG_SPLASH_SCREEN
  189. #define EXTRA_ENV_BOOT_LOGO \
  190. "splashimage=" __stringify(BMP_LOAD_ADDR)"\0" \
  191. "splashfile=" __stringify(SPLASH_FILE)"\0" \
  192. "splashpos=m,m\0" \
  193. "fb_addr=\0" \
  194. EXTRA_ENV_DTB_RESERVE
  195. #else
  196. #define EXTRA_ENV_BOOT_LOGO EXTRA_ENV_DTB_RESERVE
  197. #endif
  198. #define CONFIG_EXTRA_ENV_SETTINGS \
  199. "fdt_high=0xffffffff\0" \
  200. "initrd_high=0xffffffff\0" \
  201. "rootdev=" __stringify(CONFIG_ROOT_DEV) "\0" \
  202. "rootpart=" __stringify(CONFIG_ROOT_PART) "\0" \
  203. "bootpart=" __stringify(CONFIG_BOOT_PART) "\0" \
  204. "kernel=zImage\0" \
  205. "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
  206. "dtb_name=s5p4418-nanopi2-rev01.dtb\0" \
  207. "dtb_addr=" __stringify(KERNEL_DTB_ADDR) "\0" \
  208. "initrd_name=ramdisk.img\0" \
  209. "initrd_addr=" __stringify(INITRD_START) "\0" \
  210. "initrd_size=0x600000\0" \
  211. "load_dtb=" \
  212. BLOADER_MMC "${dtb_addr} ${dtb_name}; " \
  213. "run dtb_reserve\0" \
  214. "load_kernel=" \
  215. BLOADER_MMC "${loadaddr} ${kernel}\0" \
  216. "load_initrd=" \
  217. BLOADER_MMC "${initrd_addr} ${initrd_name}; " \
  218. "setenv initrd_size 0x${filesize}\0" \
  219. "mmcboot=" \
  220. "run load_kernel; run load_initrd; run load_dtb; " \
  221. "bootz ${loadaddr} ${initrd_addr}:${initrd_size} " \
  222. "${dtb_addr}\0" \
  223. "bootcmd=run mmcboot\0" \
  224. EXTRA_ENV_BOOT_LOGO
  225. #endif /* __CONFIG_H__ */