tqma6.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. /*
  2. * Copyright (C) 2013, 2014 Markus Niebel <Markus.Niebel@tq-group.com>
  3. *
  4. * Configuration settings for the TQ Systems TQMa6<Q,S> module.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #ifndef __CONFIG_H
  9. #define __CONFIG_H
  10. #include <linux/kconfig.h>
  11. /* SPL */
  12. /* #if defined(CONFIG_SPL_BUILD) */
  13. /* common IMX6 SPL configuration */
  14. #include "imx6_spl.h"
  15. /* #endif */
  16. /* place code in last 4 MiB of RAM */
  17. #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
  18. #define CONFIG_SYS_TEXT_BASE 0x2fc00000
  19. #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
  20. #define CONFIG_SYS_TEXT_BASE 0x4fc00000
  21. #endif
  22. #include "mx6_common.h"
  23. #if defined(CONFIG_MX6DL) || defined(CONFIG_MX6S)
  24. #define PHYS_SDRAM_SIZE (512u * SZ_1M)
  25. #elif defined(CONFIG_MX6Q) || defined(CONFIG_MX6D)
  26. #define PHYS_SDRAM_SIZE (1024u * SZ_1M)
  27. #endif
  28. #define CONFIG_BOARD_EARLY_INIT_F
  29. #define CONFIG_BOARD_LATE_INIT
  30. #define CONFIG_MXC_UART
  31. /* SPI */
  32. #define CONFIG_MXC_SPI
  33. /* SPI Flash */
  34. #define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K
  35. #define CONFIG_SF_DEFAULT_BUS 0
  36. #define CONFIG_SF_DEFAULT_CS 0
  37. #define CONFIG_SF_DEFAULT_SPEED 50000000
  38. #define CONFIG_SF_DEFAULT_MODE (SPI_MODE_0)
  39. /* I2C Configs */
  40. #define CONFIG_SYS_I2C
  41. #define CONFIG_SYS_I2C_MXC
  42. #define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
  43. #define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
  44. #define CONFIG_SYS_I2C_MXC_I2C3 /* enable I2C bus 3 */
  45. #define CONFIG_I2C_MULTI_BUS
  46. #define CONFIG_SYS_I2C_SPEED 100000
  47. /* I2C SYSMON (LM75) */
  48. #define CONFIG_DTT_LM75
  49. #define CONFIG_DTT_MAX_TEMP 70
  50. #define CONFIG_DTT_MIN_TEMP -30
  51. #define CONFIG_DTT_HYSTERESIS 3
  52. #define CONFIG_CMD_DTT
  53. /* I2C EEPROM (M24C64) */
  54. #define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
  55. #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
  56. #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_BITS 5 /* 32 Bytes */
  57. #define CONFIG_SYS_I2C_EEPROM_PAGE_WRITE_DELAY_MS 20
  58. #define CONFIG_CMD_EEPROM
  59. #define CONFIG_POWER
  60. #define CONFIG_POWER_I2C
  61. #define CONFIG_POWER_PFUZE100
  62. #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
  63. #define TQMA6_PFUZE100_I2C_BUS 2
  64. /* MMC Configs */
  65. #define CONFIG_SYS_FSL_ESDHC_ADDR 0
  66. /* USB Configs */
  67. #define CONFIG_USB_EHCI
  68. #define CONFIG_USB_EHCI_MX6
  69. #define CONFIG_USB_HOST_ETHER
  70. #define CONFIG_USB_ETHER_SMSC95XX
  71. #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
  72. #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
  73. #define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
  74. #define CONFIG_FEC_MXC
  75. #define IMX_FEC_BASE ENET_BASE_ADDR
  76. #define CONFIG_PHYLIB
  77. #define CONFIG_MII
  78. #define CONFIG_ARP_TIMEOUT 200UL
  79. /* Network config - Allow larger/faster download for TFTP/NFS */
  80. #define CONFIG_IP_DEFRAG
  81. #define CONFIG_TFTP_BLOCKSIZE 4096
  82. #define CONFIG_NFS_READ_SIZE 4096
  83. /* Command definition */
  84. #define CONFIG_CMD_BMODE
  85. #define CONFIG_ENV_SIZE (SZ_8K)
  86. /* Size of malloc() pool */
  87. #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2 * SZ_1M)
  88. #if defined(CONFIG_TQMA6X_MMC_BOOT)
  89. #define CONFIG_ENV_IS_IN_MMC
  90. #define TQMA6_UBOOT_OFFSET SZ_1K
  91. #define TQMA6_UBOOT_SECTOR_START 0x2
  92. #define TQMA6_UBOOT_SECTOR_COUNT 0x7fe
  93. #define CONFIG_ENV_OFFSET SZ_1M
  94. #define CONFIG_SYS_MMC_ENV_DEV 0
  95. #define TQMA6_FDT_OFFSET (2 * SZ_1M)
  96. #define TQMA6_FDT_SECTOR_START 0x1000
  97. #define TQMA6_FDT_SECTOR_COUNT 0x800
  98. #define TQMA6_KERNEL_SECTOR_START 0x2000
  99. #define TQMA6_KERNEL_SECTOR_COUNT 0x2000
  100. #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
  101. "uboot_start="__stringify(TQMA6_UBOOT_SECTOR_START)"\0" \
  102. "uboot_size="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
  103. "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
  104. "fdt_size="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
  105. "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
  106. "kernel_size="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
  107. "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
  108. "loadimage=mmc dev ${mmcdev}; " \
  109. "mmc read ${loadaddr} ${kernel_start} ${kernel_size};\0" \
  110. "loadfdt=mmc dev ${mmcdev}; " \
  111. "mmc read ${fdt_addr} ${fdt_start} ${fdt_size};\0" \
  112. "update_uboot=if tftp ${uboot}; then " \
  113. "if itest ${filesize} > 0; then " \
  114. "mmc dev ${mmcdev}; mmc rescan; " \
  115. "setexpr blkc ${filesize} / 0x200; " \
  116. "setexpr blkc ${blkc} + 1; " \
  117. "if itest ${blkc} <= ${uboot_size}; then " \
  118. "mmc write ${loadaddr} ${uboot_start} " \
  119. "${blkc}; " \
  120. "fi; " \
  121. "fi; fi; " \
  122. "setenv filesize; setenv blkc \0" \
  123. "update_kernel=run kernel_name; " \
  124. "if tftp ${kernel}; then " \
  125. "if itest ${filesize} > 0; then " \
  126. "mmc dev ${mmcdev}; mmc rescan; " \
  127. "setexpr blkc ${filesize} / 0x200; " \
  128. "setexpr blkc ${blkc} + 1; " \
  129. "if itest ${blkc} <= ${kernel_size}; then " \
  130. "mmc write ${loadaddr} " \
  131. "${kernel_start} ${blkc}; " \
  132. "fi; " \
  133. "fi; " \
  134. "fi; " \
  135. "setenv filesize; setenv blkc \0" \
  136. "update_fdt=if tftp ${fdt_file}; then " \
  137. "if itest ${filesize} > 0; then " \
  138. "mmc dev ${mmcdev}; mmc rescan; " \
  139. "setexpr blkc ${filesize} / 0x200; " \
  140. "setexpr blkc ${blkc} + 1; " \
  141. "if itest ${blkc} <= ${fdt_size}; then " \
  142. "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
  143. "fi; " \
  144. "fi; fi; " \
  145. "setenv filesize; setenv blkc \0" \
  146. #define CONFIG_BOOTCOMMAND \
  147. "run mmcboot; run netboot; run panicboot"
  148. #elif defined(CONFIG_TQMA6X_SPI_BOOT)
  149. #define TQMA6_UBOOT_OFFSET 0x400
  150. #define TQMA6_UBOOT_SECTOR_START 0x0
  151. /* max u-boot size: 512k */
  152. #define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
  153. #define TQMA6_UBOOT_SECTOR_COUNT 0x8
  154. #define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \
  155. TQMA6_UBOOT_SECTOR_COUNT)
  156. #define CONFIG_ENV_IS_IN_SPI_FLASH
  157. #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
  158. #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE)
  159. #define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE
  160. #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
  161. CONFIG_ENV_SECT_SIZE)
  162. #define CONFIG_ENV_SPI_BUS (CONFIG_SF_DEFAULT_BUS)
  163. #define CONFIG_ENV_SPI_CS (CONFIG_SF_DEFAULT_CS)
  164. #define CONFIG_ENV_SPI_MAX_HZ (CONFIG_SF_DEFAULT_SPEED)
  165. #define CONFIG_ENV_SPI_MODE (CONFIG_SF_DEFAULT_MODE)
  166. #define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \
  167. CONFIG_ENV_SECT_SIZE)
  168. #define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)
  169. #define TQMA6_FDT_SECTOR_START 0x0a /* 8 Sector u-boot, 2 Sector env */
  170. #define TQMA6_FDT_SECTOR_COUNT 0x01
  171. #define TQMA6_KERNEL_SECTOR_START 0x10
  172. #define TQMA6_KERNEL_SECTOR_COUNT 0x60
  173. #define TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
  174. "mmcblkdev=0\0" \
  175. "uboot_offset="__stringify(TQMA6_UBOOT_OFFSET)"\0" \
  176. "uboot_sectors="__stringify(TQMA6_UBOOT_SECTOR_COUNT)"\0" \
  177. "fdt_start="__stringify(TQMA6_FDT_SECTOR_START)"\0" \
  178. "fdt_sectors="__stringify(TQMA6_FDT_SECTOR_COUNT)"\0" \
  179. "kernel_start="__stringify(TQMA6_KERNEL_SECTOR_START)"\0" \
  180. "kernel_sectors="__stringify(TQMA6_KERNEL_SECTOR_COUNT)"\0" \
  181. "update_uboot=if tftp ${uboot}; then " \
  182. "if itest ${filesize} > 0; then " \
  183. "setexpr blkc ${filesize} + " \
  184. __stringify(TQMA6_UBOOT_OFFSET) "; " \
  185. "setexpr size ${uboot_sectors} * " \
  186. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  187. "if itest ${blkc} <= ${size}; then " \
  188. "sf probe; " \
  189. "sf erase 0 ${size}; " \
  190. "sf write ${loadaddr} ${uboot_offset} " \
  191. "${filesize}; " \
  192. "fi; " \
  193. "fi; fi; " \
  194. "setenv filesize 0; setenv blkc; setenv size \0" \
  195. "update_kernel=run kernel_name; if tftp ${kernel}; then " \
  196. "if itest ${filesize} > 0; then " \
  197. "setexpr size ${kernel_sectors} * " \
  198. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  199. "setexpr offset ${kernel_start} * " \
  200. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  201. "if itest ${filesize} <= ${size}; then " \
  202. "sf probe; " \
  203. "sf erase ${offset} ${size}; " \
  204. "sf write ${loadaddr} ${offset} " \
  205. "${filesize}; " \
  206. "fi; " \
  207. "fi; fi; " \
  208. "setenv filesize 0; setenv size ; setenv offset\0" \
  209. "update_fdt=if tftp ${fdt_file}; then " \
  210. "if itest ${filesize} > 0; then " \
  211. "setexpr size ${fdt_sectors} * " \
  212. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  213. "setexpr offset ${fdt_start} * " \
  214. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  215. "if itest ${filesize} <= ${size}; then " \
  216. "sf probe; " \
  217. "sf erase ${offset} ${size}; " \
  218. "sf write ${loadaddr} ${offset} " \
  219. "${filesize}; " \
  220. "fi; " \
  221. "fi; fi; " \
  222. "setenv filesize 0; setenv size ; setenv offset\0" \
  223. "loadimage=sf probe; " \
  224. "setexpr size ${kernel_sectors} * " \
  225. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  226. "setexpr offset ${kernel_start} * " \
  227. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  228. "sf read ${loadaddr} ${offset} ${size}; " \
  229. "setenv size ; setenv offset\0" \
  230. "loadfdt=sf probe; " \
  231. "setexpr size ${fdt_sectors} * " \
  232. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  233. "setexpr offset ${fdt_start} * " \
  234. __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \
  235. "sf read ${${fdt_addr}} ${offset} ${size}; " \
  236. "setenv size ; setenv offset\0" \
  237. #define CONFIG_BOOTCOMMAND \
  238. "sf probe; run mmcboot; run netboot; run panicboot" \
  239. #else
  240. #error "need to define boot source"
  241. #endif
  242. /* 128 MiB offset as in ARM related docu for linux suggested */
  243. #define TQMA6_FDT_ADDRESS 0x18000000
  244. #define CONFIG_EXTRA_ENV_SETTINGS \
  245. "board=tqma6\0" \
  246. "uimage=uImage\0" \
  247. "zimage=zImage\0" \
  248. "boot_type=bootz\0" \
  249. "kernel_name=if test \"${boot_type}\" != bootz; then " \
  250. "setenv kernel ${uimage}; " \
  251. "else setenv kernel ${zimage}; fi\0" \
  252. "uboot=u-boot.imx\0" \
  253. "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
  254. "fdt_addr="__stringify(TQMA6_FDT_ADDRESS)"\0" \
  255. "console=" CONSOLE_DEV "\0" \
  256. "fdt_high=0xffffffff\0" \
  257. "initrd_high=0xffffffff\0" \
  258. "addtty=setenv bootargs ${bootargs} console=${console},${baudrate}\0" \
  259. "addfb=setenv bootargs ${bootargs} " \
  260. "imx-fbdev.legacyfb_depth=32 consoleblank=0\0" \
  261. "mmcpart=2\0" \
  262. "mmcblkdev=0\0" \
  263. "mmcargs=run addmmc addtty addfb\0" \
  264. "addmmc=setenv bootargs ${bootargs} " \
  265. "root=/dev/mmcblk${mmcblkdev}p${mmcpart} rw rootwait\0" \
  266. "mmcboot=echo Booting from mmc ...; " \
  267. "setenv bootargs; " \
  268. "run mmcargs; " \
  269. "run loadimage; " \
  270. "if run loadfdt; then " \
  271. "echo boot device tree kernel ...; " \
  272. "${boot_type} ${loadaddr} - ${fdt_addr}; " \
  273. "else " \
  274. "${boot_type}; " \
  275. "fi;\0" \
  276. "setenv bootargs \0" \
  277. "netdev=eth0\0" \
  278. "rootpath=/srv/nfs/tqma6\0" \
  279. "ipmode=static\0" \
  280. "netargs=run addnfs addip addtty addfb\0" \
  281. "addnfs=setenv bootargs ${bootargs} " \
  282. "root=/dev/nfs rw " \
  283. "nfsroot=${serverip}:${rootpath},v3,tcp;\0" \
  284. "addip_static=setenv bootargs ${bootargs} " \
  285. "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
  286. "${hostname}:${netdev}:off\0" \
  287. "addip_dynamic=setenv bootargs ${bootargs} ip=dhcp\0" \
  288. "addip=if test \"${ipmode}\" != static; then " \
  289. "run addip_dynamic; else run addip_static; fi\0" \
  290. "set_getcmd=if test \"${ipmode}\" != static; then " \
  291. "setenv getcmd dhcp; setenv autoload yes; " \
  292. "else setenv getcmd tftp; setenv autoload no; fi\0" \
  293. "netboot=echo Booting from net ...; " \
  294. "run kernel_name; " \
  295. "run set_getcmd; " \
  296. "setenv bootargs; " \
  297. "run netargs; " \
  298. "if ${getcmd} ${kernel}; then " \
  299. "if ${getcmd} ${fdt_addr} ${fdt_file}; then " \
  300. "${boot_type} ${loadaddr} - ${fdt_addr}; " \
  301. "fi; " \
  302. "fi; " \
  303. "echo ... failed\0" \
  304. "panicboot=echo No boot device !!! reset\0" \
  305. TQMA6_EXTRA_BOOTDEV_ENV_SETTINGS \
  306. #define CONFIG_STACKSIZE (128u * SZ_1K)
  307. /* Physical Memory Map */
  308. #define CONFIG_NR_DRAM_BANKS 1
  309. #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
  310. #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
  311. #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
  312. #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
  313. #define CONFIG_SYS_INIT_SP_OFFSET \
  314. (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
  315. #define CONFIG_SYS_INIT_SP_ADDR \
  316. (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  317. /*
  318. * All the defines above are for the TQMa6 SoM
  319. *
  320. * Now include the baseboard specific configuration
  321. */
  322. #ifdef CONFIG_MBA6
  323. #include "tqma6_mba6.h"
  324. #elif CONFIG_WRU4
  325. #include "tqma6_wru4.h"
  326. #else
  327. #error "No baseboard for the TQMa6 defined!"
  328. #endif
  329. /* Support at least the sensor on TQMa6 SOM */
  330. #if !defined(CONFIG_DTT_SENSORS)
  331. #define CONFIG_DTT_SENSORS { 0 }
  332. #endif
  333. #endif /* __CONFIG_H */