gw_ventana.h 12 KB

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