0104-MIPS-add-board-support-for-AudioCodes-MP-252.patch 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. From 4bacfc80eae768be45f9ddf7588ec55281354648 Mon Sep 17 00:00:00 2001
  2. From: Daniel Golle <daniel.golle@gmail.com>
  3. Date: Fri, 8 Mar 2013 13:29:04 +0200
  4. Subject: MIPS: add board support for AudioCodes MP-252
  5. Signed-off-by: Daniel Golle <dgolle@allnet.de>
  6. --- /dev/null
  7. +++ b/board/audiocodes/acmp252/Makefile
  8. @@ -0,0 +1,27 @@
  9. +#
  10. +# Copyright (C) 2000-2011 Wolfgang Denk, DENX Software Engineering, wd@denx.de
  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/audiocodes/acmp252/acmp252.c
  38. @@ -0,0 +1,66 @@
  39. +/*
  40. + * Copyright (C) 2013 Daniel Golle <daniel.golle@gmail.com>
  41. + * Copyright (C) 2011 Luka Perkov <luka@openwrt.org>
  42. + *
  43. + * SPDX-License-Identifier: GPL-2.0+
  44. + */
  45. +
  46. +#include <common.h>
  47. +#include <switch.h>
  48. +#include <asm/gpio.h>
  49. +#include <asm/lantiq/eth.h>
  50. +#include <asm/lantiq/reset.h>
  51. +#include <asm/lantiq/chipid.h>
  52. +
  53. +static void gpio_init(void)
  54. +{
  55. + /* Activate reset line of ADM6996I switch */
  56. + gpio_direction_output(19, 0);
  57. +}
  58. +
  59. +int board_early_init_f(void)
  60. +{
  61. + gpio_init();
  62. +
  63. + return 0;
  64. +}
  65. +
  66. +int checkboard(void)
  67. +{
  68. + puts("Board: " CONFIG_BOARD_NAME "\n");
  69. + ltq_chip_print_info();
  70. +
  71. + return 0;
  72. +}
  73. +
  74. +static const struct ltq_eth_port_config eth_port_config[] = {
  75. + /* MAC0: Lantiq ADM6996I switch */
  76. + { 0, 0x0, LTQ_ETH_PORT_SWITCH, PHY_INTERFACE_MODE_RMII },
  77. +};
  78. +
  79. +static const struct ltq_eth_board_config eth_board_config = {
  80. + .ports = eth_port_config,
  81. + .num_ports = ARRAY_SIZE(eth_port_config),
  82. +};
  83. +
  84. +int board_eth_init(bd_t *bis)
  85. +{
  86. + return ltq_eth_initialize(&eth_board_config);
  87. +}
  88. +
  89. +static struct switch_device adm6996i_dev = {
  90. + .name = "adm6996i",
  91. + .cpu_port = 5,
  92. + .port_mask = 0xF,
  93. +};
  94. +
  95. +int board_switch_init(void)
  96. +{
  97. + /* Deactivate reset line of ADM6996I switch */
  98. + gpio_set_value(19, 1);
  99. +
  100. + /* ADM6996I needs some time to come out of reset */
  101. + __udelay(50000);
  102. +
  103. + return switch_device_register(&adm6996i_dev);
  104. +}
  105. --- /dev/null
  106. +++ b/board/audiocodes/acmp252/config.mk
  107. @@ -0,0 +1,7 @@
  108. +#
  109. +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
  110. +#
  111. +# SPDX-License-Identifier: GPL-2.0+
  112. +#
  113. +
  114. +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
  115. --- /dev/null
  116. +++ b/board/audiocodes/acmp252/ddr_settings.h
  117. @@ -0,0 +1,55 @@
  118. +/*
  119. + * Copyright (C) 2011-2013 Luka Perkov <luka@openwrt.org>
  120. + *
  121. + * This file has been generated with lantiq_ram_extract_magic.awk script.
  122. + *
  123. + * SPDX-License-Identifier: GPL-2.0+
  124. + */
  125. +
  126. +#define MC_DC00_VALUE 0x1B1B
  127. +#define MC_DC01_VALUE 0x0
  128. +#define MC_DC02_VALUE 0x0
  129. +#define MC_DC03_VALUE 0x0
  130. +#define MC_DC04_VALUE 0x0
  131. +#define MC_DC05_VALUE 0x200
  132. +#define MC_DC06_VALUE 0x605
  133. +#define MC_DC07_VALUE 0x403
  134. +#define MC_DC08_VALUE 0x103
  135. +#define MC_DC09_VALUE 0x80B
  136. +#define MC_DC10_VALUE 0x304
  137. +#define MC_DC11_VALUE 0xD03
  138. +#define MC_DC12_VALUE 0x2C8
  139. +#define MC_DC13_VALUE 0x1
  140. +#define MC_DC14_VALUE 0x0
  141. +#define MC_DC15_VALUE 0x13C
  142. +#define MC_DC16_VALUE 0xC800
  143. +#define MC_DC17_VALUE 0xD
  144. +#define MC_DC18_VALUE 0x402
  145. +#define MC_DC19_VALUE 0x200
  146. +#define MC_DC20_VALUE 0xA03
  147. +#define MC_DC21_VALUE 0x1700
  148. +#define MC_DC22_VALUE 0x1717
  149. +#define MC_DC23_VALUE 0x0
  150. +#define MC_DC24_VALUE 0x5C
  151. +#define MC_DC25_VALUE 0x0
  152. +#define MC_DC26_VALUE 0x0
  153. +#define MC_DC27_VALUE 0x0
  154. +#define MC_DC28_VALUE 0x510
  155. +#define MC_DC29_VALUE 0x2D93
  156. +#define MC_DC30_VALUE 0x8300
  157. +#define MC_DC31_VALUE 0x0
  158. +#define MC_DC32_VALUE 0x0
  159. +#define MC_DC33_VALUE 0x0
  160. +#define MC_DC34_VALUE 0x0
  161. +#define MC_DC35_VALUE 0x0
  162. +#define MC_DC36_VALUE 0x0
  163. +#define MC_DC37_VALUE 0x0
  164. +#define MC_DC38_VALUE 0x0
  165. +#define MC_DC39_VALUE 0x0
  166. +#define MC_DC40_VALUE 0x0
  167. +#define MC_DC41_VALUE 0x0
  168. +#define MC_DC42_VALUE 0x0
  169. +#define MC_DC43_VALUE 0x0
  170. +#define MC_DC44_VALUE 0x0
  171. +#define MC_DC45_VALUE 0x500
  172. +#define MC_DC46_VALUE 0x0
  173. --- a/boards.cfg
  174. +++ b/boards.cfg
  175. @@ -508,6 +508,8 @@ Active mips mips32 danub
  176. Active mips mips32 danube arcadyan arv7518pw arv7518pw_brn arv7518pw:SYS_BOOT_BRN Luka Perkov <luka@openwrt.org>
  177. Active mips mips32 danube arcadyan arv7518pw arv7518pw_nor arv7518pw:SYS_BOOT_NOR Luka Perkov <luka@openwrt.org>
  178. Active mips mips32 danube arcadyan arv7518pw arv7518pw_ram arv7518pw:SYS_BOOT_RAM Luka Perkov <luka@openwrt.org>
  179. +Active mips mips32 danube audiocodes acmp252 acmp252_nor acmp252:SYS_BOOT_NOR Daniel Golle <daniel.golle@gmail.com>
  180. +Active mips mips32 danube audiocodes acmp252 acmp252_ram acmp252:SYS_BOOT_RAM Daniel Golle <daniel.golle@gmail.com>
  181. Active mips mips32 danube lantiq easy50712 easy50712_nor easy50712:SYS_BOOT_NOR Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  182. Active mips mips32 danube lantiq easy50712 easy50712_norspl easy50712:SYS_BOOT_NORSPL Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  183. Active mips mips32 danube lantiq easy50712 easy50712_ram easy50712:SYS_BOOT_RAM Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  184. --- /dev/null
  185. +++ b/include/configs/acmp252.h
  186. @@ -0,0 +1,62 @@
  187. +/*
  188. + * Copyright (C) 2013 Daniel Golle <daniel.golle@gmail.com>
  189. + * Copyright (C) 2011 Luka Perkov <luka@openwrt.org>
  190. + *
  191. + * SPDX-License-Identifier: GPL-2.0+
  192. + */
  193. +
  194. +#ifndef __CONFIG_H
  195. +#define __CONFIG_H
  196. +
  197. +#define CONFIG_MACH_TYPE "ACMP252"
  198. +#define CONFIG_IDENT_STRING " "CONFIG_MACH_TYPE
  199. +#define CONFIG_BOARD_NAME "AudioCodes MP-252"
  200. +
  201. +/* Configure SoC */
  202. +#define CONFIG_LTQ_SUPPORT_UART /* Enable ASC and UART */
  203. +
  204. +#define CONFIG_LTQ_SUPPORT_ETHERNET /* Enable ethernet */
  205. +
  206. +#define CONFIG_LTQ_SUPPORT_NOR_FLASH /* Have a parallel NOR flash */
  207. +
  208. +#define CONFIG_SYS_BOOTM_LEN 0x1000000 /* 16 MB */
  209. +
  210. +/* Switch devices */
  211. +#define CONFIG_SWITCH_MULTI
  212. +#define CONFIG_SWITCH_ADM6996I
  213. +
  214. +/* Environment */
  215. +#if defined(CONFIG_SYS_BOOT_NOR)
  216. +#define CONFIG_ENV_IS_IN_FLASH
  217. +#define CONFIG_ENV_OVERWRITE
  218. +#define CONFIG_ENV_OFFSET (256 * 1024)
  219. +#define CONFIG_ENV_SECT_SIZE (128 * 1024)
  220. +#else
  221. +#define CONFIG_ENV_IS_NOWHERE
  222. +#endif
  223. +
  224. +#define CONFIG_ENV_SIZE (8 * 1024)
  225. +#define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR
  226. +
  227. +/* Console */
  228. +#define CONFIG_LTQ_ADVANCED_CONSOLE
  229. +#define CONFIG_BAUDRATE 115200
  230. +#define CONFIG_CONSOLE_ASC 1
  231. +#define CONFIG_CONSOLE_DEV "ttyLTQ1"
  232. +
  233. +/* Pull in default board configs for Lantiq XWAY Danube */
  234. +#include <asm/lantiq/config.h>
  235. +#include <asm/arch/config.h>
  236. +
  237. +/* Pull in default OpenWrt configs for Lantiq SoC */
  238. +#include "openwrt-lantiq-common.h"
  239. +
  240. +#define CONFIG_ENV_UPDATE_UBOOT_NOR \
  241. + "update-uboot-nor=run load-uboot-nor write-uboot-nor\0"
  242. +
  243. +#define CONFIG_EXTRA_ENV_SETTINGS \
  244. + CONFIG_ENV_LANTIQ_DEFAULTS \
  245. + CONFIG_ENV_UPDATE_UBOOT_NOR \
  246. + "kernel_addr=0xB0040000\0"
  247. +
  248. +#endif /* __CONFIG_H */