0036-MIPS-add-board-support-for-Arcadyan-Easybox-904.patch 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. From 60856fa8f9866f292df740ea98752a70738eb59a Mon Sep 17 00:00:00 2001
  2. From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  3. Date: Fri, 9 Aug 2013 18:11:07 +0200
  4. Subject: MIPS: add board support for Arcadyan Easybox 904
  5. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  6. --- /dev/null
  7. +++ b/board/arcadyan/easybox904/Makefile
  8. @@ -0,0 +1,27 @@
  9. +#
  10. +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  11. +#
  12. +# SPDX-License-Identifier: GPL-2.0+
  13. +#
  14. +
  15. +include $(TOPDIR)/config.mk
  16. +
  17. +LIB = $(obj)lib$(BOARD).o
  18. +
  19. +COBJS = $(BOARD).o
  20. +
  21. +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
  22. +OBJS := $(addprefix $(obj),$(COBJS))
  23. +SOBJS := $(addprefix $(obj),$(SOBJS))
  24. +
  25. +$(LIB): $(obj).depend $(OBJS) $(SOBJS)
  26. + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
  27. +
  28. +#########################################################################
  29. +
  30. +# defines $(obj).depend target
  31. +include $(SRCTREE)/rules.mk
  32. +
  33. +sinclude $(obj).depend
  34. +
  35. +#########################################################################
  36. --- /dev/null
  37. +++ b/board/arcadyan/easybox904/config.mk
  38. @@ -0,0 +1,7 @@
  39. +#
  40. +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  41. +#
  42. +# SPDX-License-Identifier: GPL-2.0+
  43. +#
  44. +
  45. +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
  46. --- /dev/null
  47. +++ b/board/arcadyan/easybox904/ddr_settings.h
  48. @@ -0,0 +1,68 @@
  49. +/*
  50. + * Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  51. + *
  52. + * SPDX-License-Identifier: GPL-2.0+
  53. + */
  54. +
  55. +#define MC_CCR00_VALUE 0x101
  56. +#define MC_CCR01_VALUE 0x1000100
  57. +#define MC_CCR02_VALUE 0x1010000
  58. +#define MC_CCR03_VALUE 0x101
  59. +#define MC_CCR04_VALUE 0x1000000
  60. +#define MC_CCR05_VALUE 0x1000101
  61. +#define MC_CCR06_VALUE 0x1000100
  62. +#define MC_CCR07_VALUE 0x1010000
  63. +#define MC_CCR08_VALUE 0x1000101
  64. +#define MC_CCR09_VALUE 0x1000000
  65. +#define MC_CCR10_VALUE 0x2000100
  66. +#define MC_CCR11_VALUE 0x2000300
  67. +#define MC_CCR12_VALUE 0x30000
  68. +#define MC_CCR13_VALUE 0x202
  69. +#define MC_CCR14_VALUE 0x7080A0F
  70. +#define MC_CCR15_VALUE 0x2040F
  71. +#define MC_CCR16_VALUE 0x40000
  72. +#define MC_CCR17_VALUE 0x70102
  73. +#define MC_CCR18_VALUE 0x4020002
  74. +#define MC_CCR19_VALUE 0x30302
  75. +#define MC_CCR20_VALUE 0x8000700
  76. +#define MC_CCR21_VALUE 0x40F020A
  77. +#define MC_CCR22_VALUE 0x0
  78. +#define MC_CCR23_VALUE 0xC020000
  79. +#define MC_CCR24_VALUE 0x4401503
  80. +#define MC_CCR25_VALUE 0x0
  81. +#define MC_CCR26_VALUE 0x0
  82. +#define MC_CCR27_VALUE 0x6420000
  83. +#define MC_CCR28_VALUE 0x0
  84. +#define MC_CCR29_VALUE 0x0
  85. +#define MC_CCR30_VALUE 0x798
  86. +#define MC_CCR31_VALUE 0x0
  87. +#define MC_CCR32_VALUE 0x0
  88. +#define MC_CCR33_VALUE 0x650000
  89. +#define MC_CCR34_VALUE 0x200C8
  90. +#define MC_CCR35_VALUE 0x1536B0
  91. +#define MC_CCR36_VALUE 0xC8
  92. +#define MC_CCR37_VALUE 0xC351
  93. +#define MC_CCR38_VALUE 0x0
  94. +#define MC_CCR39_VALUE 0x142404
  95. +#define MC_CCR40_VALUE 0x142604
  96. +#define MC_CCR41_VALUE 0x141B42
  97. +#define MC_CCR42_VALUE 0x141B42
  98. +#define MC_CCR43_VALUE 0x566504
  99. +#define MC_CCR44_VALUE 0x566504
  100. +#define MC_CCR45_VALUE 0x565F17
  101. +#define MC_CCR46_VALUE 0x565F17
  102. +#define MC_CCR47_VALUE 0x0
  103. +#define MC_CCR48_VALUE 0x0
  104. +#define MC_CCR49_VALUE 0x0
  105. +#define MC_CCR50_VALUE 0x0
  106. +#define MC_CCR51_VALUE 0x0
  107. +#define MC_CCR52_VALUE 0x133
  108. +#define MC_CCR53_VALUE 0xF3014B27
  109. +#define MC_CCR54_VALUE 0xF3014B27
  110. +#define MC_CCR55_VALUE 0xF3014B27
  111. +#define MC_CCR56_VALUE 0xF3014B27
  112. +#define MC_CCR57_VALUE 0x7C00301
  113. +#define MC_CCR58_VALUE 0x7C00301
  114. +#define MC_CCR59_VALUE 0x7C00301
  115. +#define MC_CCR60_VALUE 0x7C00301
  116. +#define MC_CCR61_VALUE 0x4
  117. --- /dev/null
  118. +++ b/board/arcadyan/easybox904/easybox904.c
  119. @@ -0,0 +1,98 @@
  120. +/*
  121. + * Copyright (C) 2012-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  122. + *
  123. + * SPDX-License-Identifier: GPL-2.0+
  124. + */
  125. +
  126. +#include <common.h>
  127. +#include <spi.h>
  128. +#include <asm/gpio.h>
  129. +#include <asm/lantiq/eth.h>
  130. +#include <asm/lantiq/chipid.h>
  131. +#include <asm/lantiq/cpu.h>
  132. +#include <asm/arch/gphy.h>
  133. +
  134. +#if defined(CONFIG_SPL_BUILD)
  135. +#define do_gpio_init 1
  136. +#define do_pll_init 1
  137. +#define do_dcdc_init 0
  138. +#elif defined(CONFIG_SYS_BOOT_RAM)
  139. +#define do_gpio_init 1
  140. +#define do_pll_init 0
  141. +#define do_dcdc_init 1
  142. +#else
  143. +#define do_gpio_init 0
  144. +#define do_pll_init 0
  145. +#define do_dcdc_init 1
  146. +#endif
  147. +
  148. +static inline void gpio_init(void)
  149. +{
  150. + /* EBU.FL_CS1 as output for NAND CE */
  151. + gpio_set_altfunc(23, GPIO_ALTSEL_SET, GPIO_ALTSEL_CLR, GPIO_DIR_OUT);
  152. + /* EBU.FL_A23 as output for NAND CLE */
  153. + gpio_set_altfunc(24, GPIO_ALTSEL_SET, GPIO_ALTSEL_CLR, GPIO_DIR_OUT);
  154. + /* EBU.FL_A24 as output for NAND ALE */
  155. + gpio_set_altfunc(13, GPIO_ALTSEL_SET, GPIO_ALTSEL_CLR, GPIO_DIR_OUT);
  156. + /* GPIO 3.0 as input for NAND Ready Busy */
  157. + gpio_set_altfunc(48, GPIO_ALTSEL_SET, GPIO_ALTSEL_CLR, GPIO_DIR_IN);
  158. + /* GPIO 3.1 as output for NAND Read */
  159. + gpio_set_altfunc(49, GPIO_ALTSEL_SET, GPIO_ALTSEL_CLR, GPIO_DIR_OUT);
  160. +}
  161. +
  162. +int board_early_init_f(void)
  163. +{
  164. + if (do_gpio_init)
  165. + gpio_init();
  166. +
  167. + if (do_pll_init)
  168. + ltq_pll_init();
  169. +
  170. + if (do_dcdc_init)
  171. + ltq_dcdc_init(0x7F);
  172. +
  173. + return 0;
  174. +}
  175. +
  176. +int checkboard(void)
  177. +{
  178. + puts("Board: " CONFIG_BOARD_NAME "\n");
  179. + ltq_chip_print_info();
  180. +
  181. + return 0;
  182. +}
  183. +
  184. +static const struct ltq_eth_port_config eth_port_config[] = {
  185. + /* GMAC0: ??? */
  186. + { 0, 0x0, LTQ_ETH_PORT_NONE, LTQ_ETH_PORT_NONE },
  187. + /* GMAC1: ??? */
  188. + { 1, 0x1, LTQ_ETH_PORT_NONE, LTQ_ETH_PORT_NONE },
  189. + /* GMAC2: ??? */
  190. + { 2, 0x11, LTQ_ETH_PORT_NONE, LTQ_ETH_PORT_NONE },
  191. + /* GMAC3: unused */
  192. + { 3, 0x0, LTQ_ETH_PORT_NONE, LTQ_ETH_PORT_NONE },
  193. + /* GMAC4: internal GPHY1 with 10/100/1000 firmware for WANoE port */
  194. + { 4, 0x13, LTQ_ETH_PORT_PHY, PHY_INTERFACE_MODE_GMII },
  195. + /* GMAC5: ??? */
  196. + { 5, 0x5, LTQ_ETH_PORT_NONE, LTQ_ETH_PORT_NONE },
  197. +};
  198. +
  199. +static const struct ltq_eth_board_config eth_board_config = {
  200. + .ports = eth_port_config,
  201. + .num_ports = ARRAY_SIZE(eth_port_config),
  202. +};
  203. +
  204. +int board_eth_init(bd_t * bis)
  205. +{
  206. + const enum ltq_gphy_clk clk = LTQ_GPHY_CLK_25MHZ_PLL0;
  207. + const ulong fw_ge_addr = 0x80FE0000;
  208. +
  209. + ltq_gphy_phy11g_a2x_load(fw_ge_addr);
  210. +
  211. + ltq_cgu_gphy_clk_src(clk);
  212. +
  213. + ltq_rcu_gphy_boot(0, fw_ge_addr);
  214. + ltq_rcu_gphy_boot(1, fw_ge_addr);
  215. +
  216. + return ltq_eth_initialize(&eth_board_config);
  217. +}
  218. --- a/boards.cfg
  219. +++ b/boards.cfg
  220. @@ -529,6 +529,7 @@ Active mips mips32 incai
  221. Active mips mips32 incaip - incaip incaip_100MHz incaip:CPU_CLOCK_RATE=100000000 Wolfgang Denk <wd@denx.de>
  222. Active mips mips32 incaip - incaip incaip_133MHz incaip:CPU_CLOCK_RATE=133000000 Wolfgang Denk <wd@denx.de>
  223. Active mips mips32 incaip - incaip incaip_150MHz incaip:CPU_CLOCK_RATE=150000000 Wolfgang Denk <wd@denx.de>
  224. +Active mips mips32 vrx200 arcadyan easybox904 easybox904_ram easybox904:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  225. Active mips mips32 vrx200 avm fb3370 fb3370_eva fb3370:SYS_BOOT_EVA Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  226. Active mips mips32 vrx200 avm fb3370 fb3370_ram fb3370:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  227. Active mips mips32 vrx200 avm fb3370 fb3370_sfspl fb3370:SYS_BOOT_SFSPL Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  228. --- /dev/null
  229. +++ b/include/configs/easybox904.h
  230. @@ -0,0 +1,45 @@
  231. +/*
  232. + * Copyright (C) 2012-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  233. + *
  234. + * SPDX-License-Identifier: GPL-2.0+
  235. + */
  236. +
  237. +#ifndef __CONFIG_H
  238. +#define __CONFIG_H
  239. +
  240. +#define CONFIG_MACH_TYPE "EASYBOX904"
  241. +#define CONFIG_IDENT_STRING " "CONFIG_MACH_TYPE
  242. +#define CONFIG_BOARD_NAME "Arcadyan EasyBox 904"
  243. +
  244. +/* Configure SoC */
  245. +#define CONFIG_LTQ_SUPPORT_UART /* Enable ASC and UART */
  246. +
  247. +#define CONFIG_LTQ_SUPPORT_ETHERNET /* Enable ethernet */
  248. +
  249. +#define CONFIG_LTQ_SUPPORT_NAND_FLASH
  250. +
  251. +#define CONFIG_SYS_DRAM_PROBE
  252. +
  253. +/* Environment */
  254. +#define CONFIG_ENV_IS_NOWHERE
  255. +
  256. +#define CONFIG_ENV_SIZE (8 * 1024)
  257. +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
  258. +
  259. +/* Console */
  260. +#define CONFIG_LTQ_ADVANCED_CONSOLE
  261. +#define CONFIG_BAUDRATE 115200
  262. +#define CONFIG_CONSOLE_ASC 1
  263. +#define CONFIG_CONSOLE_DEV "ttyLTQ1"
  264. +
  265. +/* Pull in default board configs for Lantiq XWAY VRX200 */
  266. +#include <asm/lantiq/config.h>
  267. +#include <asm/arch/config.h>
  268. +
  269. +/* Pull in default OpenWrt configs for Lantiq SoC */
  270. +#include "openwrt-lantiq-common.h"
  271. +
  272. +#define CONFIG_EXTRA_ENV_SETTINGS \
  273. + CONFIG_ENV_LANTIQ_DEFAULTS
  274. +
  275. +#endif /* __CONFIG_H */