sunxi-common.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. /*
  2. * (C) Copyright 2012-2012 Henrik Nordstrom <henrik@henriknordstrom.net>
  3. *
  4. * (C) Copyright 2007-2011
  5. * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
  6. * Tom Cubie <tangliang@allwinnertech.com>
  7. *
  8. * Configuration settings for the Allwinner sunxi series of boards.
  9. *
  10. * SPDX-License-Identifier: GPL-2.0+
  11. */
  12. #ifndef _SUNXI_COMMON_CONFIG_H
  13. #define _SUNXI_COMMON_CONFIG_H
  14. #include <asm/arch/cpu.h>
  15. #include <linux/stringify.h>
  16. #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
  17. /*
  18. * The U-Boot workarounds bugs in the outdated buggy sunxi-3.4 kernels at the
  19. * expense of restricting some features, so the regular machine id values can
  20. * be used.
  21. */
  22. # define CONFIG_MACH_TYPE_COMPAT_REV 0
  23. #else
  24. /*
  25. * A compatibility guard to prevent loading outdated buggy sunxi-3.4 kernels.
  26. * Only sunxi-3.4 kernels with appropriate fixes applied are able to pass
  27. * beyond the machine id check.
  28. */
  29. # define CONFIG_MACH_TYPE_COMPAT_REV 1
  30. #endif
  31. /*
  32. * High Level Configuration Options
  33. */
  34. #define CONFIG_SUNXI /* sunxi family */
  35. #ifdef CONFIG_SPL_BUILD
  36. #define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */
  37. #endif
  38. /* Serial & console */
  39. #define CONFIG_SYS_NS16550_SERIAL
  40. /* ns16550 reg in the low bits of cpu reg */
  41. #define CONFIG_SYS_NS16550_CLK 24000000
  42. #ifndef CONFIG_DM_SERIAL
  43. # define CONFIG_SYS_NS16550_REG_SIZE -4
  44. # define CONFIG_SYS_NS16550_COM1 SUNXI_UART0_BASE
  45. # define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE
  46. # define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE
  47. # define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE
  48. # define CONFIG_SYS_NS16550_COM5 SUNXI_R_UART_BASE
  49. #endif
  50. /* CPU */
  51. #define CONFIG_DISPLAY_CPUINFO
  52. #define CONFIG_SYS_CACHELINE_SIZE 64
  53. #define CONFIG_TIMER_CLK_FREQ 24000000
  54. /*
  55. * The DRAM Base differs between some models. We cannot use macros for the
  56. * CONFIG_FOO defines which contain the DRAM base address since they end
  57. * up unexpanded in include/autoconf.mk .
  58. *
  59. * So we have to have this #ifdef #else #endif block for these.
  60. */
  61. #ifdef CONFIG_MACH_SUN9I
  62. #define SDRAM_OFFSET(x) 0x2##x
  63. #define CONFIG_SYS_SDRAM_BASE 0x20000000
  64. #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* default load address */
  65. #define CONFIG_SYS_TEXT_BASE 0x2a000000
  66. #define CONFIG_PRE_CON_BUF_ADDR 0x2f000000
  67. /* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
  68. * since it needs to fit in with the other values. By also #defining it
  69. * we get warnings if the Kconfig value mismatches. */
  70. #define CONFIG_SPL_STACK_R_ADDR 0x2fe00000
  71. #define CONFIG_SPL_BSS_START_ADDR 0x2ff80000
  72. #else
  73. #define SDRAM_OFFSET(x) 0x4##x
  74. #define CONFIG_SYS_SDRAM_BASE 0x40000000
  75. #define CONFIG_SYS_LOAD_ADDR 0x42000000 /* default load address */
  76. #define CONFIG_SYS_TEXT_BASE 0x4a000000
  77. #define CONFIG_PRE_CON_BUF_ADDR 0x4f000000
  78. /* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here
  79. * since it needs to fit in with the other values. By also #defining it
  80. * we get warnings if the Kconfig value mismatches. */
  81. #define CONFIG_SPL_STACK_R_ADDR 0x4fe00000
  82. #define CONFIG_SPL_BSS_START_ADDR 0x4ff80000
  83. #endif
  84. #define CONFIG_SPL_BSS_MAX_SIZE 0x00080000 /* 512 KiB */
  85. #if defined(CONFIG_MACH_SUN9I) || defined(CONFIG_MACH_SUN50I)
  86. /*
  87. * The A80's A1 sram starts at 0x00010000 rather then at 0x00000000 and is
  88. * slightly bigger. Note that it is possible to map the first 32 KiB of the
  89. * A1 at 0x00000000 like with older SoCs by writing 0x16aa0001 to the
  90. * undocumented 0x008000e0 SYS_CTRL register. Where the 16aa is a key and
  91. * the 1 actually activates the mapping of the first 32 KiB to 0x00000000.
  92. */
  93. #define CONFIG_SYS_INIT_RAM_ADDR 0x10000
  94. #define CONFIG_SYS_INIT_RAM_SIZE 0xA000 /* 40 KiB */
  95. #else
  96. #define CONFIG_SYS_INIT_RAM_ADDR 0x0
  97. #define CONFIG_SYS_INIT_RAM_SIZE 0x8000 /* 32 KiB */
  98. #endif
  99. #define CONFIG_SYS_INIT_SP_OFFSET \
  100. (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
  101. #define CONFIG_SYS_INIT_SP_ADDR \
  102. (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  103. #define CONFIG_NR_DRAM_BANKS 1
  104. #define PHYS_SDRAM_0 CONFIG_SYS_SDRAM_BASE
  105. #define PHYS_SDRAM_0_SIZE 0x80000000 /* 2 GiB */
  106. #ifdef CONFIG_AHCI
  107. #define CONFIG_LIBATA
  108. #define CONFIG_SCSI_AHCI
  109. #define CONFIG_SCSI_AHCI_PLAT
  110. #define CONFIG_SUNXI_AHCI
  111. #define CONFIG_SYS_64BIT_LBA
  112. #define CONFIG_SYS_SCSI_MAX_SCSI_ID 1
  113. #define CONFIG_SYS_SCSI_MAX_LUN 1
  114. #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
  115. CONFIG_SYS_SCSI_MAX_LUN)
  116. #define CONFIG_SCSI
  117. #endif
  118. #define CONFIG_SETUP_MEMORY_TAGS
  119. #define CONFIG_CMDLINE_TAG
  120. #define CONFIG_INITRD_TAG
  121. #define CONFIG_SERIAL_TAG
  122. #ifdef CONFIG_NAND_SUNXI
  123. #define CONFIG_SPL_NAND_SUPPORT 1
  124. #endif
  125. #ifdef CONFIG_SPL_SPI_SUNXI
  126. #define CONFIG_SPL_SPI_FLASH_SUPPORT 1
  127. #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000
  128. #endif
  129. /* mmc config */
  130. #ifdef CONFIG_MMC
  131. #define CONFIG_GENERIC_MMC
  132. #define CONFIG_MMC_SUNXI
  133. #define CONFIG_MMC_SUNXI_SLOT 0
  134. #define CONFIG_ENV_IS_IN_MMC
  135. #define CONFIG_SYS_MMC_ENV_DEV 0 /* first detected MMC controller */
  136. #endif
  137. /* 64MB of malloc() pool */
  138. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (64 << 20))
  139. /*
  140. * Miscellaneous configurable options
  141. */
  142. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  143. #define CONFIG_SYS_PBSIZE 1024 /* Print Buffer Size */
  144. #define CONFIG_SYS_MAXARGS 16 /* max number of command args */
  145. /* Boot Argument Buffer Size */
  146. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  147. /* standalone support */
  148. #define CONFIG_STANDALONE_LOAD_ADDR CONFIG_SYS_LOAD_ADDR
  149. /* baudrate */
  150. #define CONFIG_BAUDRATE 115200
  151. /* The stack sizes are set up in start.S using the settings below */
  152. #define CONFIG_STACKSIZE (256 << 10) /* 256 KiB */
  153. /* FLASH and environment organization */
  154. #define CONFIG_SYS_NO_FLASH
  155. #define CONFIG_SYS_MONITOR_LEN (768 << 10) /* 768 KiB */
  156. #define CONFIG_IDENT_STRING " Allwinner Technology"
  157. #define CONFIG_DISPLAY_BOARDINFO
  158. #define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */
  159. #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */
  160. #define CONFIG_FAT_WRITE /* enable write access */
  161. #define CONFIG_SPL_FRAMEWORK
  162. #define CONFIG_SPL_LIBCOMMON_SUPPORT
  163. #define CONFIG_SPL_SERIAL_SUPPORT
  164. #define CONFIG_SPL_LIBGENERIC_SUPPORT
  165. #define CONFIG_SPL_BOARD_LOAD_IMAGE
  166. #if defined(CONFIG_MACH_SUN9I)
  167. #define CONFIG_SPL_TEXT_BASE 0x10040 /* sram start+header */
  168. #define CONFIG_SPL_MAX_SIZE 0x5fc0 /* ? KiB on sun9i */
  169. #elif defined(CONFIG_MACH_SUN50I)
  170. #define CONFIG_SPL_TEXT_BASE 0x10040 /* sram start+header */
  171. #define CONFIG_SPL_MAX_SIZE 0x7fc0 /* 32 KiB on sun50i */
  172. #else
  173. #define CONFIG_SPL_TEXT_BASE 0x40 /* sram start+header */
  174. #define CONFIG_SPL_MAX_SIZE 0x5fc0 /* 24KB on sun4i/sun7i */
  175. #endif
  176. #define CONFIG_SPL_LIBDISK_SUPPORT
  177. #ifdef CONFIG_MMC
  178. #define CONFIG_SPL_MMC_SUPPORT
  179. #endif
  180. #ifndef CONFIG_ARM64
  181. #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds"
  182. #endif
  183. #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 80 /* 40KiB */
  184. #define CONFIG_SPL_PAD_TO 32768 /* decimal for 'dd' */
  185. #if defined(CONFIG_MACH_SUN9I) || defined(CONFIG_MACH_SUN50I)
  186. #define LOW_LEVEL_SRAM_STACK 0x0001A000
  187. #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
  188. #else
  189. /* end of 32 KiB in sram */
  190. #define LOW_LEVEL_SRAM_STACK 0x00008000 /* End of sram */
  191. #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
  192. #endif
  193. /* I2C */
  194. #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
  195. defined CONFIG_SY8106A_POWER
  196. #define CONFIG_SPL_I2C_SUPPORT
  197. #endif
  198. #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \
  199. defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \
  200. defined CONFIG_I2C4_ENABLE || defined CONFIG_R_I2C_ENABLE
  201. #define CONFIG_SYS_I2C
  202. #define CONFIG_SYS_I2C_MVTWSI
  203. #define CONFIG_SYS_I2C_SPEED 400000
  204. #define CONFIG_SYS_I2C_SLAVE 0x7f
  205. #endif
  206. #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
  207. #define CONFIG_SYS_I2C_SOFT
  208. #define CONFIG_SYS_I2C_SOFT_SPEED 50000
  209. #define CONFIG_SYS_I2C_SOFT_SLAVE 0x00
  210. /* We use pin names in Kconfig and sunxi_name_to_gpio() */
  211. #define CONFIG_SOFT_I2C_GPIO_SDA soft_i2c_gpio_sda
  212. #define CONFIG_SOFT_I2C_GPIO_SCL soft_i2c_gpio_scl
  213. #ifndef __ASSEMBLY__
  214. extern int soft_i2c_gpio_sda;
  215. extern int soft_i2c_gpio_scl;
  216. #endif
  217. #define CONFIG_VIDEO_LCD_I2C_BUS 0 /* The lcd panel soft i2c is bus 0 */
  218. #define CONFIG_SYS_SPD_BUS_NUM 1 /* And the axp209 i2c bus is bus 1 */
  219. #else
  220. #define CONFIG_SYS_SPD_BUS_NUM 0 /* The axp209 i2c bus is bus 0 */
  221. #define CONFIG_VIDEO_LCD_I2C_BUS -1 /* NA, but necessary to compile */
  222. #endif
  223. /* PMU */
  224. #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
  225. defined CONFIG_AXP221_POWER || defined CONFIG_AXP818_POWER || \
  226. defined CONFIG_SY8106A_POWER
  227. #define CONFIG_SPL_POWER_SUPPORT
  228. #endif
  229. #ifndef CONFIG_CONS_INDEX
  230. #define CONFIG_CONS_INDEX 1 /* UART0 */
  231. #endif
  232. #ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
  233. #if CONFIG_CONS_INDEX == 1
  234. #ifdef CONFIG_MACH_SUN9I
  235. #define OF_STDOUT_PATH "/soc/serial@07000000:115200"
  236. #else
  237. #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28000:115200"
  238. #endif
  239. #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I)
  240. #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200"
  241. #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I)
  242. #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28800:115200"
  243. #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
  244. #define OF_STDOUT_PATH "/soc@01c00000/serial@01f02800:115200"
  245. #else
  246. #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h.
  247. #endif
  248. #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */
  249. /* GPIO */
  250. #define CONFIG_SUNXI_GPIO
  251. #define CONFIG_SPL_GPIO_SUPPORT
  252. #ifdef CONFIG_VIDEO
  253. /*
  254. * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  255. * to use as framebuffer. This must be a multiple of 4096.
  256. */
  257. #define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
  258. /* Do we want to initialize a simple FB? */
  259. #define CONFIG_VIDEO_DT_SIMPLEFB
  260. #define CONFIG_VIDEO_SUNXI
  261. #define CONFIG_CFB_CONSOLE
  262. #define CONFIG_VIDEO_SW_CURSOR
  263. #define CONFIG_VIDEO_LOGO
  264. #define CONFIG_VIDEO_STD_TIMINGS
  265. #define CONFIG_I2C_EDID
  266. #define VIDEO_LINE_LEN (pGD->plnSizeX)
  267. /* allow both serial and cfb console. */
  268. #define CONFIG_CONSOLE_MUX
  269. /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */
  270. #define CONFIG_VGA_AS_SINGLE_DEVICE
  271. #endif /* CONFIG_VIDEO */
  272. /* Ethernet support */
  273. #ifdef CONFIG_SUNXI_EMAC
  274. #define CONFIG_PHY_ADDR 1
  275. #define CONFIG_MII /* MII PHY management */
  276. #define CONFIG_PHYLIB
  277. #endif
  278. #ifdef CONFIG_SUNXI_GMAC
  279. #define CONFIG_PHY_GIGE /* GMAC can use gigabit PHY */
  280. #define CONFIG_PHY_ADDR 1
  281. #define CONFIG_MII /* MII PHY management */
  282. #define CONFIG_PHY_REALTEK
  283. #endif
  284. #ifdef CONFIG_USB_EHCI_HCD
  285. #define CONFIG_USB_OHCI_NEW
  286. #define CONFIG_USB_OHCI_SUNXI
  287. #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
  288. #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1
  289. #endif
  290. #ifdef CONFIG_USB_MUSB_SUNXI
  291. #define CONFIG_USB_MUSB_PIO_ONLY
  292. #endif
  293. #ifdef CONFIG_USB_MUSB_GADGET
  294. #define CONFIG_USB_FUNCTION_DFU
  295. #define CONFIG_USB_FUNCTION_FASTBOOT
  296. #define CONFIG_USB_FUNCTION_MASS_STORAGE
  297. #endif
  298. #ifdef CONFIG_USB_FUNCTION_DFU
  299. #define CONFIG_DFU_RAM
  300. #endif
  301. #ifdef CONFIG_USB_FUNCTION_FASTBOOT
  302. #define CONFIG_CMD_FASTBOOT
  303. #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR
  304. #define CONFIG_FASTBOOT_BUF_SIZE 0x2000000
  305. #define CONFIG_ANDROID_BOOT_IMAGE
  306. #define CONFIG_FASTBOOT_FLASH
  307. #ifdef CONFIG_MMC
  308. #define CONFIG_FASTBOOT_FLASH_MMC_DEV 0
  309. #define CONFIG_EFI_PARTITION
  310. #endif
  311. #endif
  312. #ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
  313. #endif
  314. #ifdef CONFIG_USB_KEYBOARD
  315. #define CONFIG_CONSOLE_MUX
  316. #define CONFIG_PREBOOT
  317. #define CONFIG_SYS_STDIO_DEREGISTER
  318. #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
  319. #endif
  320. #if !defined CONFIG_ENV_IS_IN_MMC && \
  321. !defined CONFIG_ENV_IS_IN_NAND && \
  322. !defined CONFIG_ENV_IS_IN_FAT && \
  323. !defined CONFIG_ENV_IS_IN_SPI_FLASH
  324. #define CONFIG_ENV_IS_NOWHERE
  325. #endif
  326. #define CONFIG_MISC_INIT_R
  327. #define CONFIG_SYS_CONSOLE_IS_IN_ENV
  328. #ifndef CONFIG_SPL_BUILD
  329. #include <config_distro_defaults.h>
  330. /* Enable pre-console buffer to get complete log on the VGA console */
  331. #define CONFIG_PRE_CONSOLE_BUFFER
  332. #define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */
  333. #ifdef CONFIG_ARM64
  334. /*
  335. * Boards seem to come with at least 512MB of DRAM.
  336. * The kernel should go at 512K, which is the default text offset (that will
  337. * be adjusted at runtime if needed).
  338. * There is no compression for arm64 kernels (yet), so leave some space
  339. * for really big kernels, say 256MB for now.
  340. * Scripts, PXE and DTBs should go afterwards, leaving the rest for the initrd.
  341. * Align the initrd to a 2MB page.
  342. */
  343. #define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(0080000))
  344. #define FDT_ADDR_R __stringify(SDRAM_OFFSET(FA00000))
  345. #define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(FC00000))
  346. #define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(FD00000))
  347. #define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(FE00000))
  348. #else
  349. /*
  350. * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
  351. * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
  352. * 1M script, 1M pxe and the ramdisk at the end.
  353. */
  354. #define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(2000000))
  355. #define FDT_ADDR_R __stringify(SDRAM_OFFSET(3000000))
  356. #define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(3100000))
  357. #define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(3200000))
  358. #define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(3300000))
  359. #endif
  360. #define MEM_LAYOUT_ENV_SETTINGS \
  361. "bootm_size=0xa000000\0" \
  362. "kernel_addr_r=" KERNEL_ADDR_R "\0" \
  363. "fdt_addr_r=" FDT_ADDR_R "\0" \
  364. "scriptaddr=" SCRIPT_ADDR_R "\0" \
  365. "pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
  366. "ramdisk_addr_r=" RAMDISK_ADDR_R "\0"
  367. #define DFU_ALT_INFO_RAM \
  368. "dfu_alt_info_ram=" \
  369. "kernel ram " KERNEL_ADDR_R " 0x1000000;" \
  370. "fdt ram " FDT_ADDR_R " 0x100000;" \
  371. "ramdisk ram " RAMDISK_ADDR_R " 0x4000000\0"
  372. #ifdef CONFIG_MMC
  373. #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
  374. #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
  375. #define BOOT_TARGET_DEVICES_MMC_EXTRA(func) func(MMC, mmc, 1)
  376. #else
  377. #define BOOT_TARGET_DEVICES_MMC_EXTRA(func)
  378. #endif
  379. #else
  380. #define BOOT_TARGET_DEVICES_MMC(func)
  381. #define BOOT_TARGET_DEVICES_MMC_EXTRA(func)
  382. #endif
  383. #ifdef CONFIG_AHCI
  384. #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
  385. #else
  386. #define BOOT_TARGET_DEVICES_SCSI(func)
  387. #endif
  388. #ifdef CONFIG_USB_STORAGE
  389. #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
  390. #else
  391. #define BOOT_TARGET_DEVICES_USB(func)
  392. #endif
  393. /* FEL boot support, auto-execute boot.scr if a script address was provided */
  394. #define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
  395. "bootcmd_fel=" \
  396. "if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
  397. "echo '(FEL boot)'; " \
  398. "source ${fel_scriptaddr}; " \
  399. "fi\0"
  400. #define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
  401. "fel "
  402. #define BOOT_TARGET_DEVICES(func) \
  403. func(FEL, fel, na) \
  404. BOOT_TARGET_DEVICES_MMC(func) \
  405. BOOT_TARGET_DEVICES_MMC_EXTRA(func) \
  406. BOOT_TARGET_DEVICES_SCSI(func) \
  407. BOOT_TARGET_DEVICES_USB(func) \
  408. func(PXE, pxe, na) \
  409. func(DHCP, dhcp, na)
  410. #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
  411. #define BOOTCMD_SUNXI_COMPAT \
  412. "bootcmd_sunxi_compat=" \
  413. "setenv root /dev/mmcblk0p3 rootwait; " \
  414. "if ext2load mmc 0 0x44000000 uEnv.txt; then " \
  415. "echo Loaded environment from uEnv.txt; " \
  416. "env import -t 0x44000000 ${filesize}; " \
  417. "fi; " \
  418. "setenv bootargs console=${console} root=${root} ${extraargs}; " \
  419. "ext2load mmc 0 0x43000000 script.bin && " \
  420. "ext2load mmc 0 0x48000000 uImage && " \
  421. "bootm 0x48000000\0"
  422. #else
  423. #define BOOTCMD_SUNXI_COMPAT
  424. #endif
  425. #include <config_distro_bootcmd.h>
  426. #ifdef CONFIG_USB_KEYBOARD
  427. #define CONSOLE_STDIN_SETTINGS \
  428. "preboot=usb start\0" \
  429. "stdin=serial,usbkbd\0"
  430. #else
  431. #define CONSOLE_STDIN_SETTINGS \
  432. "stdin=serial\0"
  433. #endif
  434. #ifdef CONFIG_VIDEO
  435. #define CONSOLE_STDOUT_SETTINGS \
  436. "stdout=serial,vga\0" \
  437. "stderr=serial,vga\0"
  438. #else
  439. #define CONSOLE_STDOUT_SETTINGS \
  440. "stdout=serial\0" \
  441. "stderr=serial\0"
  442. #endif
  443. #define CONSOLE_ENV_SETTINGS \
  444. CONSOLE_STDIN_SETTINGS \
  445. CONSOLE_STDOUT_SETTINGS
  446. #define CONFIG_EXTRA_ENV_SETTINGS \
  447. CONSOLE_ENV_SETTINGS \
  448. MEM_LAYOUT_ENV_SETTINGS \
  449. DFU_ALT_INFO_RAM \
  450. "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \
  451. "console=ttyS0,115200\0" \
  452. BOOTCMD_SUNXI_COMPAT \
  453. BOOTENV
  454. #else /* ifndef CONFIG_SPL_BUILD */
  455. #define CONFIG_EXTRA_ENV_SETTINGS
  456. #endif
  457. #endif /* _SUNXI_COMMON_CONFIG_H */