0043-MIPS-add-board-support-for-Arcadyan-VGV7510KW22.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. --- /dev/null
  2. +++ b/board/arcadyan/vgv7510kw22/Makefile
  3. @@ -0,0 +1,27 @@
  4. +#
  5. +# Copyright (C) 2000-2011 Wolfgang Denk, DENX Software Engineering, wd@denx.de
  6. +#
  7. +# SPDX-License-Identifier: GPL-2.0+
  8. +#
  9. +
  10. +include $(TOPDIR)/config.mk
  11. +
  12. +LIB = $(obj)lib$(BOARD).o
  13. +
  14. +COBJS = $(BOARD).o
  15. +
  16. +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
  17. +OBJS := $(addprefix $(obj),$(COBJS))
  18. +SOBJS := $(addprefix $(obj),$(SOBJS))
  19. +
  20. +$(LIB): $(obj).depend $(OBJS) $(SOBJS)
  21. + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
  22. +
  23. +#########################################################################
  24. +
  25. +# defines $(obj).depend target
  26. +include $(SRCTREE)/rules.mk
  27. +
  28. +sinclude $(obj).depend
  29. +
  30. +#########################################################################
  31. --- /dev/null
  32. +++ b/board/arcadyan/vgv7510kw22/vgv7510kw22.c
  33. @@ -0,0 +1,133 @@
  34. +/*
  35. + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  36. + *
  37. + * SPDX-License-Identifier: GPL-2.0+
  38. + */
  39. +
  40. +#include <common.h>
  41. +#include <spi.h>
  42. +#include <asm/gpio.h>
  43. +#include <asm/lantiq/eth.h>
  44. +#include <asm/lantiq/chipid.h>
  45. +#include <asm/lantiq/cpu.h>
  46. +#include <asm/arch/gphy.h>
  47. +
  48. +#if defined(CONFIG_SPL_BUILD)
  49. +#define do_gpio_init 1
  50. +#define do_pll_init 1
  51. +#define do_dcdc_init 0
  52. +#elif defined(CONFIG_SYS_BOOT_RAM)
  53. +#define do_gpio_init 1
  54. +#define do_pll_init 0
  55. +#define do_dcdc_init 1
  56. +#elif defined(CONFIG_SYS_BOOT_NOR)
  57. +#define do_gpio_init 1
  58. +#define do_pll_init 1
  59. +#define do_dcdc_init 1
  60. +#else
  61. +#define do_gpio_init 0
  62. +#define do_pll_init 0
  63. +#define do_dcdc_init 1
  64. +#endif
  65. +
  66. +#define GPIO_POWER_GREEN 14
  67. +
  68. +static void gpio_init(void)
  69. +{
  70. + /* SPI CS 0.4 to serial flash */
  71. + gpio_direction_output(10, 1);
  72. +
  73. + /* Turn on the green power LED */
  74. + gpio_direction_output(GPIO_POWER_GREEN, 0);
  75. + gpio_set_value(GPIO_POWER_GREEN, 0);
  76. +}
  77. +
  78. +int board_early_init_f(void)
  79. +{
  80. + if (do_gpio_init)
  81. + gpio_init();
  82. +
  83. + if (do_pll_init)
  84. + ltq_pll_init();
  85. +
  86. + if (do_dcdc_init)
  87. + ltq_dcdc_init(0x7F);
  88. +
  89. + return 0;
  90. +}
  91. +
  92. +int checkboard(void)
  93. +{
  94. + puts("Board: " CONFIG_BOARD_NAME "\n");
  95. + ltq_chip_print_info();
  96. +
  97. + return 0;
  98. +}
  99. +
  100. +static const struct ltq_eth_port_config eth_port_config[] = {
  101. + /* unused */
  102. + { 0, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
  103. + /* unused */
  104. + { 1, 0x0, LTQ_ETH_PORT_NONE, PHY_INTERFACE_MODE_NONE },
  105. + /* Internal GPHY0 with 10/100 firmware for LAN port 2 */
  106. + { 2, 0x11, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
  107. + /* Internal GPHY0 with 10/100 firmware for LAN port 1 */
  108. + { 3, 0x12, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
  109. + /* Internal GPHY1 with 10/100 firmware for LAN port 4 */
  110. + { 4, 0x13, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
  111. + /* Internal GPHY1 with 10/100 firmware for LAN port 3 */
  112. + { 5, 0x14, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_MII },
  113. +};
  114. +
  115. +static const struct ltq_eth_board_config eth_board_config = {
  116. + .ports = eth_port_config,
  117. + .num_ports = ARRAY_SIZE(eth_port_config),
  118. +};
  119. +
  120. +int board_eth_init(bd_t * bis)
  121. +{
  122. + const enum ltq_gphy_clk clk = LTQ_GPHY_CLK_25MHZ_PLL0;
  123. + const ulong fw_addr = 0x80FF0000;
  124. +
  125. + ltq_gphy_phy22f_a1x_load(fw_addr);
  126. +
  127. + ltq_cgu_gphy_clk_src(clk);
  128. +
  129. + ltq_rcu_gphy_boot(0, fw_addr);
  130. + ltq_rcu_gphy_boot(1, fw_addr);
  131. +
  132. + return ltq_eth_initialize(&eth_board_config);
  133. +}
  134. +
  135. +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
  136. +{
  137. + if (bus)
  138. + return 0;
  139. +
  140. + if (cs == 4)
  141. + return 1;
  142. +
  143. + return 0;
  144. +}
  145. +
  146. +void spi_cs_activate(struct spi_slave *slave)
  147. +{
  148. + switch (slave->cs) {
  149. + case 4:
  150. + gpio_set_value(10, 0);
  151. + break;
  152. + default:
  153. + break;
  154. + }
  155. +}
  156. +
  157. +void spi_cs_deactivate(struct spi_slave *slave)
  158. +{
  159. + switch (slave->cs) {
  160. + case 4:
  161. + gpio_set_value(10, 1);
  162. + break;
  163. + default:
  164. + break;
  165. + }
  166. +}
  167. --- /dev/null
  168. +++ b/board/arcadyan/vgv7510kw22/config.mk
  169. @@ -0,0 +1,7 @@
  170. +#
  171. +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  172. +#
  173. +# SPDX-License-Identifier: GPL-2.0+
  174. +#
  175. +
  176. +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
  177. --- /dev/null
  178. +++ b/board/arcadyan/vgv7510kw22/ddr_settings.h
  179. @@ -0,0 +1,71 @@
  180. +/*
  181. + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  182. + * Based on code by:
  183. + * Daniel Schwierzeck, daniel.schwierzeck@googlemail.com
  184. + * and Lantiq Deutschland GmbH
  185. + *
  186. + * SPDX-License-Identifier: GPL-2.0+
  187. + */
  188. +
  189. +#define MC_CCR00_VALUE 0x101
  190. +#define MC_CCR01_VALUE 0x1000100
  191. +#define MC_CCR02_VALUE 0x1010000
  192. +#define MC_CCR03_VALUE 0x100
  193. +#define MC_CCR04_VALUE 0x1000000
  194. +#define MC_CCR05_VALUE 0x1000101
  195. +#define MC_CCR06_VALUE 0x1000100
  196. +#define MC_CCR07_VALUE 0x1010000
  197. +#define MC_CCR08_VALUE 0x1000101
  198. +#define MC_CCR09_VALUE 0x0
  199. +#define MC_CCR10_VALUE 0x2000100
  200. +#define MC_CCR11_VALUE 0x2000401
  201. +#define MC_CCR12_VALUE 0x30000
  202. +#define MC_CCR13_VALUE 0x202
  203. +#define MC_CCR14_VALUE 0x7080A0F
  204. +#define MC_CCR15_VALUE 0x2040F
  205. +#define MC_CCR16_VALUE 0x40000
  206. +#define MC_CCR17_VALUE 0x70102
  207. +#define MC_CCR18_VALUE 0x4020002
  208. +#define MC_CCR19_VALUE 0x30302
  209. +#define MC_CCR20_VALUE 0x8000700
  210. +#define MC_CCR21_VALUE 0x40F020A
  211. +#define MC_CCR22_VALUE 0x0
  212. +#define MC_CCR23_VALUE 0xC020000
  213. +#define MC_CCR24_VALUE 0x4401B04
  214. +#define MC_CCR25_VALUE 0x0
  215. +#define MC_CCR26_VALUE 0x0
  216. +#define MC_CCR27_VALUE 0x6420000
  217. +#define MC_CCR28_VALUE 0x0
  218. +#define MC_CCR29_VALUE 0x0
  219. +#define MC_CCR30_VALUE 0x798
  220. +#define MC_CCR31_VALUE 0x0
  221. +#define MC_CCR32_VALUE 0x0
  222. +#define MC_CCR33_VALUE 0x650000
  223. +#define MC_CCR34_VALUE 0x200C8
  224. +#define MC_CCR35_VALUE 0x1D445D
  225. +#define MC_CCR36_VALUE 0xC8
  226. +#define MC_CCR37_VALUE 0xC351
  227. +#define MC_CCR38_VALUE 0x0
  228. +#define MC_CCR39_VALUE 0x141F04
  229. +#define MC_CCR40_VALUE 0x142704
  230. +#define MC_CCR41_VALUE 0x141B42
  231. +#define MC_CCR42_VALUE 0x141B42
  232. +#define MC_CCR43_VALUE 0x566504
  233. +#define MC_CCR44_VALUE 0x566504
  234. +#define MC_CCR45_VALUE 0x565F17
  235. +#define MC_CCR46_VALUE 0x565F17
  236. +#define MC_CCR47_VALUE 0x0
  237. +#define MC_CCR48_VALUE 0x0
  238. +#define MC_CCR49_VALUE 0x0
  239. +#define MC_CCR50_VALUE 0x0
  240. +#define MC_CCR51_VALUE 0x0
  241. +#define MC_CCR52_VALUE 0x133
  242. +#define MC_CCR53_VALUE 0xF3014B27
  243. +#define MC_CCR54_VALUE 0xF3014B27
  244. +#define MC_CCR55_VALUE 0xF3014B27
  245. +#define MC_CCR56_VALUE 0xF3014B27
  246. +#define MC_CCR57_VALUE 0x7800301
  247. +#define MC_CCR58_VALUE 0x7800301
  248. +#define MC_CCR59_VALUE 0x7800301
  249. +#define MC_CCR60_VALUE 0x7800301
  250. +#define MC_CCR61_VALUE 0x4
  251. --- a/boards.cfg
  252. +++ b/boards.cfg
  253. @@ -542,6 +542,9 @@
  254. Active mips mips32 incaip - incaip incaip_133MHz incaip:CPU_CLOCK_RATE=133000000 Wolfgang Denk <wd@denx.de>
  255. Active mips mips32 incaip - incaip incaip_150MHz incaip:CPU_CLOCK_RATE=150000000 Wolfgang Denk <wd@denx.de>
  256. Active mips mips32 vrx200 arcadyan easybox904 easybox904_ram easybox904:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  257. +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_brn vgv7510kw22:SYS_BOOT_BRN Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  258. +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_nor vgv7510kw22:SYS_BOOT_NOR Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  259. +Active mips mips32 vrx200 arcadyan vgv7510kw22 vgv7510kw22_ram vgv7510kw22:SYS_BOOT_RAM Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  260. Active mips mips32 vrx200 avm fb3370 fb3370_eva fb3370:SYS_BOOT_EVA Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  261. Active mips mips32 vrx200 avm fb3370 fb3370_ram fb3370:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  262. Active mips mips32 vrx200 avm fb3370 fb3370_sfspl fb3370:SYS_BOOT_SFSPL Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  263. --- /dev/null
  264. +++ b/include/configs/vgv7510kw22.h
  265. @@ -0,0 +1,78 @@
  266. +/*
  267. + * Copyright (C) 2015 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  268. + *
  269. + * SPDX-License-Identifier: GPL-2.0+
  270. + */
  271. +
  272. +#ifndef __CONFIG_H
  273. +#define __CONFIG_H
  274. +
  275. +#define CONFIG_MACH_TYPE "VGV7510KW22"
  276. +#define CONFIG_IDENT_STRING " "CONFIG_MACH_TYPE
  277. +#define CONFIG_BOARD_NAME "Arcadyan VGV7510KW22"
  278. +
  279. +/* Configure SoC */
  280. +#define CONFIG_LTQ_SUPPORT_UART /* Enable ASC and UART */
  281. +
  282. +#define CONFIG_LTQ_SUPPORT_ETHERNET /* Enable ethernet */
  283. +
  284. +#define CONFIG_LTQ_SUPPORT_NOR_FLASH /* Have a parallel NOR flash */
  285. +
  286. +#define CONFIG_LTQ_SUPPORT_SPI_FLASH
  287. +#define CONFIG_SPI_FLASH_MACRONIX /* Have a MX29GL128EL parallel flash */
  288. +
  289. +#define CONFIG_LTQ_SUPPORT_SPL_SPI_FLASH /* Build SPI flash SPL */
  290. +#define CONFIG_LTQ_SPL_COMP_LZO /* Compress SPL with LZO */
  291. +#define CONFIG_LTQ_SPL_CONSOLE /* Enable SPL console */
  292. +
  293. +#define CONFIG_SPL_SPI_BUS 0
  294. +#define CONFIG_SPL_SPI_CS 4
  295. +#define CONFIG_SPL_SPI_MAX_HZ 25000000
  296. +#define CONFIG_SPL_SPI_MODE 0
  297. +
  298. +#define CONFIG_LTQ_SUPPORT_SPL_NOR_FLASH /* Build NOR flash SPL */
  299. +
  300. +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16 MB */
  301. +
  302. +/* Environment */
  303. +#define CONFIG_ENV_SPI_BUS CONFIG_SPL_SPI_BUS
  304. +#define CONFIG_ENV_SPI_CS CONFIG_SPL_SPI_CS
  305. +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SPL_SPI_MAX_HZ
  306. +#define CONFIG_ENV_SPI_MODE CONFIG_SPL_SPI_MODE
  307. +
  308. +#if defined(CONFIG_SYS_BOOT_BRN)
  309. +#define CONFIG_SYS_TEXT_BASE 0x80002000
  310. +#define CONFIG_SKIP_LOWLEVEL_INIT
  311. +#define CONFIG_SYS_DISABLE_CACHE
  312. +#define CONFIG_ENV_IS_NOWHERE
  313. +#elif defined(CONFIG_SYS_BOOT_NOR)
  314. +#define CONFIG_ENV_IS_IN_FLASH
  315. +#define CONFIG_ENV_OVERWRITE
  316. +#define CONFIG_ENV_OFFSET (384 * 1024)
  317. +#define CONFIG_ENV_SECT_SIZE (128 * 1024)
  318. +#else
  319. +#define CONFIG_ENV_IS_NOWHERE
  320. +#endif
  321. +
  322. +#define CONFIG_ENV_SIZE (128 * 1024)
  323. +
  324. +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
  325. +
  326. +/* Console */
  327. +#define CONFIG_LTQ_ADVANCED_CONSOLE
  328. +#define CONFIG_BAUDRATE 115200
  329. +#define CONFIG_CONSOLE_ASC 1
  330. +#define CONFIG_CONSOLE_DEV "ttyLTQ1"
  331. +
  332. +/* Pull in default board configs for Lantiq XWAY VRX200 */
  333. +#include <asm/lantiq/config.h>
  334. +#include <asm/arch/config.h>
  335. +
  336. +/* Pull in default OpenWrt configs for Lantiq SoC */
  337. +#include "openwrt-lantiq-common.h"
  338. +
  339. +#define CONFIG_EXTRA_ENV_SETTINGS \
  340. + CONFIG_ENV_LANTIQ_DEFAULTS \
  341. + "kernel_addr=0xB0080000\0"
  342. +
  343. +#endif /* __CONFIG_H */