add chaos_calmer branch
[15.05/openwrt.git] / package / boot / uboot-lantiq / patches / 0028-MIPS-add-board-support-for-AudioCodes-MP-252.patch
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
6 Signed-off-by: Daniel Golle <dgolle@allnet.de>
7
8 --- /dev/null
9 +++ b/board/audiocodes/acmp252/Makefile
10 @@ -0,0 +1,27 @@
11 +#
12 +# Copyright (C) 2000-2011 Wolfgang Denk, DENX Software Engineering, wd@denx.de
13 +#
14 +# SPDX-License-Identifier:     GPL-2.0+
15 +#
16 +
17 +include $(TOPDIR)/config.mk
18 +
19 +LIB    = $(obj)lib$(BOARD).o
20 +
21 +COBJS  = $(BOARD).o
22 +
23 +SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
24 +OBJS   := $(addprefix $(obj),$(COBJS))
25 +SOBJS  := $(addprefix $(obj),$(SOBJS))
26 +
27 +$(LIB):        $(obj).depend $(OBJS) $(SOBJS)
28 +       $(call cmd_link_o_target, $(OBJS) $(SOBJS))
29 +
30 +#########################################################################
31 +
32 +# defines $(obj).depend target
33 +include $(SRCTREE)/rules.mk
34 +
35 +sinclude $(obj).depend
36 +
37 +#########################################################################
38 --- /dev/null
39 +++ b/board/audiocodes/acmp252/acmp252.c
40 @@ -0,0 +1,66 @@
41 +/*
42 + * Copyright (C) 2013 Daniel Golle <daniel.golle@gmail.com>
43 + * Copyright (C) 2011 Luka Perkov <luka@openwrt.org>
44 + *
45 + * SPDX-License-Identifier:    GPL-2.0+
46 + */
47 +
48 +#include <common.h>
49 +#include <switch.h>
50 +#include <asm/gpio.h>
51 +#include <asm/lantiq/eth.h>
52 +#include <asm/lantiq/reset.h>
53 +#include <asm/lantiq/chipid.h>
54 +
55 +static void gpio_init(void)
56 +{
57 +       /* Activate reset line of ADM6996I switch */
58 +       gpio_direction_output(19, 0);
59 +}
60 +
61 +int board_early_init_f(void)
62 +{
63 +       gpio_init();
64 +
65 +       return 0;
66 +}
67 +
68 +int checkboard(void)
69 +{
70 +       puts("Board: " CONFIG_BOARD_NAME "\n");
71 +       ltq_chip_print_info();
72 +
73 +       return 0;
74 +}
75 +
76 +static const struct ltq_eth_port_config eth_port_config[] = {
77 +       /* MAC0: Lantiq ADM6996I switch */
78 +       { 0, 0x0, LTQ_ETH_PORT_SWITCH, PHY_INTERFACE_MODE_RMII },
79 +};
80 +
81 +static const struct ltq_eth_board_config eth_board_config = {
82 +       .ports = eth_port_config,
83 +       .num_ports = ARRAY_SIZE(eth_port_config),
84 +};
85 +
86 +int board_eth_init(bd_t *bis)
87 +{
88 +       return ltq_eth_initialize(&eth_board_config);
89 +}
90 +
91 +static struct switch_device adm6996i_dev = {
92 +       .name = "adm6996i",
93 +       .cpu_port = 5,
94 +       .port_mask = 0xF,
95 +};
96 +
97 +int board_switch_init(void)
98 +{
99 +       /* Deactivate reset line of ADM6996I switch */
100 +       gpio_set_value(19, 1);
101 +
102 +       /* ADM6996I needs some time to come out of reset */
103 +       __udelay(50000);
104 +
105 +       return switch_device_register(&adm6996i_dev);
106 +}
107 --- /dev/null
108 +++ b/board/audiocodes/acmp252/config.mk
109 @@ -0,0 +1,7 @@
110 +#
111 +# Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
112 +#
113 +# SPDX-License-Identifier:     GPL-2.0+
114 +#
115 +
116 +PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(BOARDDIR)
117 --- /dev/null
118 +++ b/board/audiocodes/acmp252/ddr_settings.h
119 @@ -0,0 +1,55 @@
120 +/*
121 + * Copyright (C) 2011-2013 Luka Perkov <luka@openwrt.org>
122 + *
123 + * This file has been generated with lantiq_ram_extract_magic.awk script.
124 + *
125 + * SPDX-License-Identifier:    GPL-2.0+
126 + */
127 +
128 +#define MC_DC00_VALUE  0x1B1B
129 +#define MC_DC01_VALUE  0x0
130 +#define MC_DC02_VALUE  0x0
131 +#define MC_DC03_VALUE  0x0
132 +#define MC_DC04_VALUE  0x0
133 +#define MC_DC05_VALUE  0x200
134 +#define MC_DC06_VALUE  0x605
135 +#define MC_DC07_VALUE  0x403
136 +#define MC_DC08_VALUE  0x103
137 +#define MC_DC09_VALUE  0x80B
138 +#define MC_DC10_VALUE  0x304
139 +#define MC_DC11_VALUE  0xD03
140 +#define MC_DC12_VALUE  0x2C8
141 +#define MC_DC13_VALUE  0x1
142 +#define MC_DC14_VALUE  0x0
143 +#define MC_DC15_VALUE  0x13C
144 +#define MC_DC16_VALUE  0xC800
145 +#define MC_DC17_VALUE  0xD
146 +#define MC_DC18_VALUE  0x402
147 +#define MC_DC19_VALUE  0x200
148 +#define MC_DC20_VALUE  0xA03
149 +#define MC_DC21_VALUE  0x1700
150 +#define MC_DC22_VALUE  0x1717
151 +#define MC_DC23_VALUE  0x0
152 +#define MC_DC24_VALUE  0x5C
153 +#define MC_DC25_VALUE  0x0
154 +#define MC_DC26_VALUE  0x0
155 +#define MC_DC27_VALUE  0x0
156 +#define MC_DC28_VALUE  0x510
157 +#define MC_DC29_VALUE  0x2D93
158 +#define MC_DC30_VALUE  0x8300
159 +#define MC_DC31_VALUE  0x0
160 +#define MC_DC32_VALUE  0x0
161 +#define MC_DC33_VALUE  0x0
162 +#define MC_DC34_VALUE  0x0
163 +#define MC_DC35_VALUE  0x0
164 +#define MC_DC36_VALUE  0x0
165 +#define MC_DC37_VALUE  0x0
166 +#define MC_DC38_VALUE  0x0
167 +#define MC_DC39_VALUE  0x0
168 +#define MC_DC40_VALUE  0x0
169 +#define MC_DC41_VALUE  0x0
170 +#define MC_DC42_VALUE  0x0
171 +#define MC_DC43_VALUE  0x0
172 +#define MC_DC44_VALUE  0x0
173 +#define MC_DC45_VALUE  0x500
174 +#define MC_DC46_VALUE  0x0
175 --- a/boards.cfg
176 +++ b/boards.cfg
177 @@ -508,6 +508,8 @@ Active  mips        mips32         danub
178  Active  mips        mips32         danube      arcadyan        arv7518pw           arv7518pw_brn                        arv7518pw:SYS_BOOT_BRN                                                                                                            Luka Perkov <luka@openwrt.org>
179  Active  mips        mips32         danube      arcadyan        arv7518pw           arv7518pw_nor                        arv7518pw:SYS_BOOT_NOR                                                                                                            Luka Perkov <luka@openwrt.org>
180  Active  mips        mips32         danube      arcadyan        arv7518pw           arv7518pw_ram                        arv7518pw:SYS_BOOT_RAM                                                                                                            Luka Perkov <luka@openwrt.org>
181 +Active  mips        mips32         danube      audiocodes      acmp252             acmp252_nor                          acmp252:SYS_BOOT_NOR                                                                                                              Daniel Golle <daniel.golle@gmail.com>
182 +Active  mips        mips32         danube      audiocodes      acmp252             acmp252_ram                          acmp252:SYS_BOOT_RAM                                                                                                              Daniel Golle <daniel.golle@gmail.com>
183  Active  mips        mips32         danube      lantiq          easy50712           easy50712_nor                        easy50712:SYS_BOOT_NOR                                                                                                            Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
184  Active  mips        mips32         danube      lantiq          easy50712           easy50712_norspl                     easy50712:SYS_BOOT_NORSPL                                                                                                         Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
185  Active  mips        mips32         danube      lantiq          easy50712           easy50712_ram                        easy50712:SYS_BOOT_RAM                                                                                                            Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
186 --- /dev/null
187 +++ b/include/configs/acmp252.h
188 @@ -0,0 +1,60 @@
189 +/*
190 + * Copyright (C) 2013 Daniel Golle <daniel.golle@gmail.com>
191 + * Copyright (C) 2011 Luka Perkov <luka@openwrt.org>
192 + *
193 + * SPDX-License-Identifier:    GPL-2.0+
194 + */
195 +
196 +#ifndef __CONFIG_H
197 +#define __CONFIG_H
198 +
199 +#define CONFIG_MACH_TYPE       "ACMP252"
200 +#define CONFIG_IDENT_STRING    " "CONFIG_MACH_TYPE
201 +#define CONFIG_BOARD_NAME      "AudioCodes MP-252"
202 +
203 +/* Configure SoC */
204 +#define CONFIG_LTQ_SUPPORT_UART                /* Enable ASC and UART */
205 +
206 +#define CONFIG_LTQ_SUPPORT_ETHERNET    /* Enable ethernet */
207 +
208 +#define CONFIG_LTQ_SUPPORT_NOR_FLASH   /* Have a parallel NOR flash */
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 */