gw_ventana.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. /*
  2. * Copyright (C) 2013 Gateworks Corporation
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #ifndef __CONFIG_H
  7. #define __CONFIG_H
  8. /* SPL */
  9. #define CONFIG_SPL_BOARD_INIT
  10. #define CONFIG_SPL_NAND_SUPPORT
  11. #define CONFIG_SPL_MMC_SUPPORT
  12. #define CONFIG_SPL_POWER_SUPPORT
  13. /* Location in NAND to read U-Boot from */
  14. #define CONFIG_SYS_NAND_U_BOOT_OFFS (14 * SZ_1M)
  15. /* Falcon Mode */
  16. #define CONFIG_CMD_SPL
  17. #define CONFIG_SPL_OS_BOOT
  18. #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
  19. #define CONFIG_CMD_SPL_WRITE_SIZE (128 * SZ_1K)
  20. /* Falcon Mode - NAND support: args@17MB kernel@18MB */
  21. #define CONFIG_CMD_SPL_NAND_OFS (17 * SZ_1M)
  22. #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS (18 * SZ_1M)
  23. /* Falcon Mode - MMC support: args@1MB kernel@2MB */
  24. #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */
  25. #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512)
  26. #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */
  27. #include "imx6_spl.h" /* common IMX6 SPL configuration */
  28. #include "mx6_common.h"
  29. #undef CONFIG_SPL_EXT_SUPPORT
  30. #undef CONFIG_DISPLAY_BOARDINFO
  31. #define CONFIG_DISPLAY_BOARDINFO_LATE
  32. #define CONFIG_MACH_TYPE 4520 /* Gateworks Ventana Platform */
  33. /* Serial ATAG */
  34. #define CONFIG_SERIAL_TAG
  35. /* Size of malloc() pool */
  36. #define CONFIG_SYS_MALLOC_LEN (10 * SZ_1M)
  37. /* Init Functions */
  38. #define CONFIG_BOARD_EARLY_INIT_F
  39. #define CONFIG_MISC_INIT_R
  40. /* Driver Model */
  41. #ifndef CONFIG_SPL_BUILD
  42. #define CONFIG_DM_GPIO
  43. #define CONFIG_DM_THERMAL
  44. #endif
  45. /* Thermal */
  46. #define CONFIG_IMX_THERMAL
  47. /* Serial */
  48. #define CONFIG_MXC_UART
  49. #define CONFIG_MXC_UART_BASE UART2_BASE
  50. #ifdef CONFIG_SPI_FLASH
  51. /* SPI */
  52. #ifdef CONFIG_CMD_SF
  53. #define CONFIG_MXC_SPI
  54. #define CONFIG_SPI_FLASH_MTD
  55. #define CONFIG_SPI_FLASH_BAR
  56. #define CONFIG_SF_DEFAULT_BUS 0
  57. #define CONFIG_SF_DEFAULT_CS 0
  58. /* GPIO 3-19 (21248) */
  59. #define CONFIG_SF_DEFAULT_SPEED 30000000
  60. #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
  61. #endif
  62. #else
  63. /* Enable NAND support */
  64. #define CONFIG_CMD_NAND
  65. #define CONFIG_CMD_NAND_TRIMFFS
  66. #ifdef CONFIG_CMD_NAND
  67. #define CONFIG_NAND_MXS
  68. #define CONFIG_SYS_MAX_NAND_DEVICE 1
  69. #define CONFIG_SYS_NAND_BASE 0x40000000
  70. #define CONFIG_SYS_NAND_5_ADDR_CYCLE
  71. #define CONFIG_SYS_NAND_ONFI_DETECTION
  72. /* DMA stuff, needed for GPMI/MXS NAND support */
  73. #define CONFIG_APBH_DMA
  74. #define CONFIG_APBH_DMA_BURST
  75. #define CONFIG_APBH_DMA_BURST8
  76. #endif
  77. #endif /* CONFIG_SPI_FLASH */
  78. /* I2C Configs */
  79. #define CONFIG_SYS_I2C
  80. #define CONFIG_SYS_I2C_MXC
  81. #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
  82. #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
  83. #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
  84. #define CONFIG_SYS_I2C_SPEED 100000
  85. #define CONFIG_I2C_GSC 0
  86. #define CONFIG_I2C_PMIC 1
  87. #define CONFIG_I2C_EDID
  88. /* MMC Configs */
  89. #define CONFIG_SYS_FSL_ESDHC_ADDR 0
  90. #define CONFIG_SYS_FSL_USDHC_NUM 1
  91. /* Filesystem support */
  92. #define CONFIG_CMD_UBIFS
  93. /*
  94. * SATA Configs
  95. */
  96. #define CONFIG_CMD_SATA
  97. #ifdef CONFIG_CMD_SATA
  98. #define CONFIG_DWC_AHSATA
  99. #define CONFIG_SYS_SATA_MAX_DEVICE 1
  100. #define CONFIG_DWC_AHSATA_PORT_ID 0
  101. #define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR
  102. #define CONFIG_LBA48
  103. #define CONFIG_LIBATA
  104. #endif
  105. /*
  106. * PCI express
  107. */
  108. #define CONFIG_CMD_PCI
  109. #ifdef CONFIG_CMD_PCI
  110. #define CONFIG_PCI
  111. #define CONFIG_PCI_PNP
  112. #define CONFIG_PCI_SCAN_SHOW
  113. #define CONFIG_PCI_FIXUP_DEV
  114. #define CONFIG_PCIE_IMX
  115. #endif
  116. /*
  117. * PMIC
  118. */
  119. #define CONFIG_POWER
  120. #define CONFIG_POWER_I2C
  121. #define CONFIG_POWER_PFUZE100
  122. #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
  123. #define CONFIG_POWER_LTC3676
  124. #define CONFIG_POWER_LTC3676_I2C_ADDR 0x3c
  125. /* Various command support */
  126. #define CONFIG_CMD_BMODE /* set eFUSE shadow for a boot dev and reset */
  127. #define CONFIG_CMD_HDMIDETECT /* detect HDMI output device */
  128. #define CONFIG_CMD_GSC
  129. #define CONFIG_CMD_EECONFIG /* Gateworks EEPROM config cmd */
  130. #define CONFIG_CMD_UBI
  131. #define CONFIG_RBTREE
  132. /* Ethernet support */
  133. #define CONFIG_FEC_MXC
  134. #define CONFIG_MII
  135. #define IMX_FEC_BASE ENET_BASE_ADDR
  136. #define CONFIG_FEC_XCV_TYPE RGMII
  137. #define CONFIG_FEC_MXC_PHYADDR 0
  138. #define CONFIG_PHYLIB
  139. #define CONFIG_ARP_TIMEOUT 200UL
  140. /* USB Configs */
  141. #define CONFIG_USB_EHCI
  142. #define CONFIG_USB_EHCI_MX6
  143. #define CONFIG_USB_STORAGE
  144. #define CONFIG_USB_HOST_ETHER
  145. #define CONFIG_USB_ETHER_ASIX
  146. #define CONFIG_USB_ETHER_SMSC95XX
  147. #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
  148. #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
  149. #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
  150. #define CONFIG_MXC_USB_FLAGS 0
  151. #define CONFIG_USB_KEYBOARD
  152. #define CONFIG_USBD_HS
  153. #define CONFIG_USB_ETHER
  154. #define CONFIG_USB_ETH_CDC
  155. #define CONFIG_NETCONSOLE
  156. #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP
  157. /* USB Mass Storage Gadget */
  158. #define CONFIG_USB_FUNCTION_MASS_STORAGE
  159. /* Framebuffer and LCD */
  160. #define CONFIG_VIDEO
  161. #define CONFIG_VIDEO_IPUV3
  162. #define CONFIG_CFB_CONSOLE
  163. #define CONFIG_VGA_AS_SINGLE_DEVICE
  164. #define CONFIG_SYS_CONSOLE_IS_IN_ENV
  165. #define CONFIG_VIDEO_LOGO
  166. #define CONFIG_IPUV3_CLK 260000000
  167. #define CONFIG_CMD_HDMIDETECT
  168. #define CONFIG_CONSOLE_MUX
  169. #define CONFIG_IMX_HDMI
  170. #define CONFIG_IMX_VIDEO_SKIP
  171. #define CONFIG_VIDEO_BMP_LOGO
  172. #define CONFIG_SPLASH_SCREEN_ALIGN
  173. #define CONFIG_HIDE_LOGO_VERSION /* Custom config to hide U-boot version */
  174. /* Miscellaneous configurable options */
  175. #define CONFIG_HWCONFIG
  176. #define CONFIG_PREBOOT
  177. /* Print Buffer Size */
  178. #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  179. /* Memory configuration */
  180. #define CONFIG_SYS_MEMTEST_START 0x10000000
  181. #define CONFIG_SYS_MEMTEST_END 0x10010000
  182. #define CONFIG_SYS_MEMTEST_SCRATCH 0x10800000
  183. /* Physical Memory Map */
  184. #define CONFIG_NR_DRAM_BANKS 1
  185. #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
  186. #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
  187. #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
  188. #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
  189. #define CONFIG_SYS_INIT_SP_OFFSET \
  190. (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
  191. #define CONFIG_SYS_INIT_SP_ADDR \
  192. (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  193. /*
  194. * MTD Command for mtdparts
  195. */
  196. #define CONFIG_LZO
  197. #define CONFIG_CMD_MTDPARTS
  198. #define CONFIG_MTD_DEVICE
  199. #define CONFIG_MTD_PARTITIONS
  200. #ifdef CONFIG_SPI_FLASH
  201. #define MTDIDS_DEFAULT "nor0=nor"
  202. #define MTDPARTS_DEFAULT \
  203. "mtdparts=nor:512k(uboot),64k(env),2m(kernel),-(rootfs)"
  204. #else
  205. #define MTDIDS_DEFAULT "nand0=nand"
  206. #define MTDPARTS_DEFAULT "mtdparts=nand:16m(uboot),1m(env),-(rootfs)"
  207. #endif
  208. /* Persistent Environment Config */
  209. #ifdef CONFIG_SPI_FLASH
  210. #define CONFIG_ENV_IS_IN_SPI_FLASH
  211. #else
  212. #define CONFIG_ENV_IS_IN_NAND
  213. #endif
  214. #if defined(CONFIG_ENV_IS_IN_MMC)
  215. #define CONFIG_SYS_MMC_ENV_DEV 0
  216. #define CONFIG_ENV_OFFSET (709 * SZ_1K)
  217. #define CONFIG_ENV_SIZE (128 * SZ_1K)
  218. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + (128 * SZ_1K))
  219. #elif defined(CONFIG_ENV_IS_IN_NAND)
  220. #define CONFIG_ENV_OFFSET (16 * SZ_1M)
  221. #define CONFIG_ENV_SECT_SIZE (128 * SZ_1K)
  222. #define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
  223. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + (512 * SZ_1K))
  224. #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
  225. #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
  226. #define CONFIG_ENV_OFFSET (512 * SZ_1K)
  227. #define CONFIG_ENV_SECT_SIZE (64 * SZ_1K)
  228. #define CONFIG_ENV_SIZE (8 * SZ_1K)
  229. #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
  230. #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
  231. #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
  232. #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
  233. #endif
  234. /* Environment */
  235. #define CONFIG_IPADDR 192.168.1.1
  236. #define CONFIG_SERVERIP 192.168.1.146
  237. #define CONFIG_EXTRA_ENV_SETTINGS_COMMON \
  238. "pcidisable=1\0" \
  239. "splashpos=m,m\0" \
  240. "usb_pgood_delay=2000\0" \
  241. "console=ttymxc1\0" \
  242. "bootdevs=usb mmc sata flash\0" \
  243. "hwconfig=_UNKNOWN_\0" \
  244. "video=\0" \
  245. \
  246. "mtdparts=" MTDPARTS_DEFAULT "\0" \
  247. "mtdids=" MTDIDS_DEFAULT "\0" \
  248. "disk=0\0" \
  249. "part=1\0" \
  250. \
  251. "fdt_high=0xffffffff\0" \
  252. "fdt_addr=0x18000000\0" \
  253. "initrd_high=0xffffffff\0" \
  254. "fixfdt=" \
  255. "fdt addr ${fdt_addr}\0" \
  256. "bootdir=boot\0" \
  257. "loadfdt=" \
  258. "if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then " \
  259. "echo Loaded DTB from ${bootdir}/${fdt_file}; " \
  260. "run fixfdt; " \
  261. "elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then " \
  262. "echo Loaded DTB from ${bootdir}/${fdt_file1}; " \
  263. "run fixfdt; " \
  264. "elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then " \
  265. "echo Loaded DTB from ${bootdir}/${fdt_file2}; " \
  266. "run fixfdt; " \
  267. "fi\0" \
  268. \
  269. "fs=ext4\0" \
  270. "script=6x_bootscript-ventana\0" \
  271. "loadscript=" \
  272. "if ${fsload} ${loadaddr} ${bootdir}/${script}; then " \
  273. "source ${loadaddr}; " \
  274. "fi\0" \
  275. \
  276. "uimage=uImage\0" \
  277. "mmc_root=/dev/mmcblk0p1 rootfstype=${fs} rootwait rw\0" \
  278. "mmc_boot=" \
  279. "setenv fsload \"${fs}load mmc ${disk}:${part}\"; " \
  280. "mmc dev ${disk} && mmc rescan && " \
  281. "setenv dtype mmc; run loadscript; " \
  282. "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
  283. "setenv bootargs console=${console},${baudrate} " \
  284. "root=/dev/mmcblk0p1 rootfstype=${fs} " \
  285. "rootwait rw ${video} ${extra}; " \
  286. "if run loadfdt; then " \
  287. "bootm ${loadaddr} - ${fdt_addr}; " \
  288. "else " \
  289. "bootm; " \
  290. "fi; " \
  291. "fi\0" \
  292. \
  293. "sata_boot=" \
  294. "setenv fsload \"${fs}load sata ${disk}:${part}\"; " \
  295. "sata init && " \
  296. "setenv dtype sata; run loadscript; " \
  297. "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
  298. "setenv bootargs console=${console},${baudrate} " \
  299. "root=/dev/sda1 rootfstype=${fs} " \
  300. "rootwait rw ${video} ${extra}; " \
  301. "if run loadfdt; then " \
  302. "bootm ${loadaddr} - ${fdt_addr}; " \
  303. "else " \
  304. "bootm; " \
  305. "fi; " \
  306. "fi\0" \
  307. "usb_boot=" \
  308. "setenv fsload \"${fs}load usb ${disk}:${part}\"; " \
  309. "usb start && usb dev ${disk} && " \
  310. "setenv dtype usb; run loadscript; " \
  311. "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
  312. "setenv bootargs console=${console},${baudrate} " \
  313. "root=/dev/sda1 rootfstype=${fs} " \
  314. "rootwait rw ${video} ${extra}; " \
  315. "if run loadfdt; then " \
  316. "bootm ${loadaddr} - ${fdt_addr}; " \
  317. "else " \
  318. "bootm; " \
  319. "fi; " \
  320. "fi\0"
  321. #ifdef CONFIG_SPI_FLASH
  322. #define CONFIG_EXTRA_ENV_SETTINGS \
  323. CONFIG_EXTRA_ENV_SETTINGS_COMMON \
  324. "image_os=ventana/openwrt-imx6-imx6q-gw5400-a-squashfs.bin\0" \
  325. "image_uboot=ventana/u-boot_spi.imx\0" \
  326. \
  327. "spi_koffset=0x90000\0" \
  328. "spi_klen=0x200000\0" \
  329. \
  330. "spi_updateuboot=echo Updating uboot from " \
  331. "${serverip}:${image_uboot}...; " \
  332. "tftpboot ${loadaddr} ${image_uboot} && " \
  333. "sf probe && sf erase 0 80000 && " \
  334. "sf write ${loadaddr} 400 ${filesize}\0" \
  335. "spi_update=echo Updating OS from ${serverip}:${image_os} " \
  336. "to ${spi_koffset} ...; " \
  337. "tftp ${loadaddr} ${image_os} && " \
  338. "sf probe && " \
  339. "sf update ${loadaddr} ${spi_koffset} ${filesize}\0" \
  340. \
  341. "flash_boot=" \
  342. "if sf probe && " \
  343. "sf read ${loadaddr} ${spi_koffset} ${spi_klen}; then " \
  344. "setenv bootargs console=${console},${baudrate} " \
  345. "root=/dev/mtdblock3 " \
  346. "rootfstype=squashfs,jffs2 " \
  347. "${video} ${extra}; " \
  348. "bootm; " \
  349. "fi\0"
  350. #else
  351. #define CONFIG_EXTRA_ENV_SETTINGS \
  352. CONFIG_EXTRA_ENV_SETTINGS_COMMON \
  353. \
  354. "image_rootfs=openwrt-imx6-ventana-rootfs.ubi\0" \
  355. "nand_update=echo Updating NAND from ${serverip}:${image_rootfs}...; " \
  356. "tftp ${loadaddr} ${image_rootfs} && " \
  357. "nand erase.part rootfs && " \
  358. "nand write ${loadaddr} rootfs ${filesize}\0" \
  359. \
  360. "flash_boot=" \
  361. "setenv fsload 'ubifsload'; " \
  362. "ubi part rootfs; " \
  363. "if ubi check boot; then " \
  364. "ubifsmount ubi0:boot; " \
  365. "setenv root ubi0:rootfs ubi.mtd=2 " \
  366. "rootfstype=squashfs,ubifs; " \
  367. "setenv bootdir; " \
  368. "elif ubi check rootfs; then " \
  369. "ubifsmount ubi0:rootfs; " \
  370. "setenv root ubi0:rootfs ubi.mtd=2 " \
  371. "rootfstype=ubifs; " \
  372. "fi; " \
  373. "setenv dtype nand; run loadscript; " \
  374. "if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
  375. "setenv bootargs console=${console},${baudrate} " \
  376. "root=${root} ${video} ${extra}; " \
  377. "if run loadfdt; then " \
  378. "ubifsumount; " \
  379. "bootm ${loadaddr} - ${fdt_addr}; " \
  380. "else " \
  381. "ubifsumount; bootm; " \
  382. "fi; " \
  383. "fi\0"
  384. #endif
  385. #define CONFIG_BOOTCOMMAND \
  386. "for btype in ${bootdevs}; do " \
  387. "echo; echo Attempting ${btype} boot...; " \
  388. "if run ${btype}_boot; then; fi; " \
  389. "done"
  390. /* Device Tree Support */
  391. #define CONFIG_FDT_FIXUP_PARTITIONS
  392. #endif /* __CONFIG_H */