gxio.c revision 1.26 1 1.26 ryo /* $NetBSD: gxio.c,v 1.26 2018/03/13 06:19:30 ryo Exp $ */
2 1.1 kiyohara /*
3 1.3 kiyohara * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
4 1.1 kiyohara * All rights reserved.
5 1.1 kiyohara *
6 1.1 kiyohara * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM
7 1.1 kiyohara * Corporation.
8 1.1 kiyohara *
9 1.1 kiyohara * Redistribution and use in source and binary forms, with or without
10 1.1 kiyohara * modification, are permitted provided that the following conditions
11 1.1 kiyohara * are met:
12 1.1 kiyohara * 1. Redistributions of source code must retain the above copyright
13 1.1 kiyohara * notice, this list of conditions and the following disclaimer.
14 1.1 kiyohara * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 kiyohara * notice, this list of conditions and the following disclaimer in the
16 1.1 kiyohara * documentation and/or other materials provided with the distribution.
17 1.1 kiyohara * 3. Neither the name of the project nor the name of SOUM Corporation
18 1.1 kiyohara * may be used to endorse or promote products derived from this software
19 1.1 kiyohara * without specific prior written permission.
20 1.1 kiyohara *
21 1.1 kiyohara * THIS SOFTWARE IS PROVIDED BY THE PROJECT and SOUM CORPORATION ``AS IS''
22 1.1 kiyohara * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.1 kiyohara * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 1.1 kiyohara * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT AND SOUM CORPORATION
25 1.1 kiyohara * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 1.1 kiyohara * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 1.1 kiyohara * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 1.1 kiyohara * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 1.1 kiyohara * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 1.1 kiyohara * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 1.1 kiyohara * POSSIBILITY OF SUCH DAMAGE.
32 1.1 kiyohara */
33 1.1 kiyohara #include <sys/cdefs.h>
34 1.26 ryo __KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.26 2018/03/13 06:19:30 ryo Exp $");
35 1.3 kiyohara
36 1.15 kiyohara #include "opt_cputypes.h"
37 1.15 kiyohara #include "opt_gumstix.h"
38 1.3 kiyohara #include "opt_gxio.h"
39 1.17 kiyohara #if defined(OVERO)
40 1.17 kiyohara #include "opt_omap.h"
41 1.17 kiyohara #endif
42 1.1 kiyohara
43 1.1 kiyohara #include <sys/param.h>
44 1.1 kiyohara #include <sys/device.h>
45 1.1 kiyohara #include <sys/errno.h>
46 1.10 kiyohara #include <sys/kernel.h>
47 1.1 kiyohara
48 1.1 kiyohara #include <sys/systm.h>
49 1.1 kiyohara
50 1.1 kiyohara #include <machine/bootconfig.h>
51 1.1 kiyohara
52 1.16 kiyohara #include <arm/omap/omap2_gpmcreg.h>
53 1.21 kiyohara #if defined(OMAP2)
54 1.15 kiyohara #include <arm/omap/omap2_reg.h>
55 1.17 kiyohara #if defined(OMAP3530)
56 1.16 kiyohara #include <arm/omap/omap2_intr.h>
57 1.17 kiyohara #endif
58 1.21 kiyohara #endif
59 1.15 kiyohara #include <arm/omap/omap_var.h>
60 1.21 kiyohara #include <arm/omap/ti_iicreg.h>
61 1.23 kiyohara #include <arm/omap/tifbvar.h>
62 1.21 kiyohara #if defined(CPU_XSCALE)
63 1.1 kiyohara #include <arm/xscale/pxa2x0cpu.h>
64 1.15 kiyohara #endif
65 1.1 kiyohara #include <arm/xscale/pxa2x0reg.h>
66 1.1 kiyohara #include <arm/xscale/pxa2x0var.h>
67 1.1 kiyohara #include <arm/xscale/pxa2x0_gpio.h>
68 1.16 kiyohara #include <evbarm/gumstix/gumstixreg.h>
69 1.1 kiyohara #include <evbarm/gumstix/gumstixvar.h>
70 1.1 kiyohara
71 1.16 kiyohara #include "ioconf.h"
72 1.1 kiyohara #include "locators.h"
73 1.1 kiyohara
74 1.1 kiyohara
75 1.3 kiyohara struct gxioconf {
76 1.3 kiyohara const char *name;
77 1.4 kiyohara void (*config)(void);
78 1.3 kiyohara };
79 1.3 kiyohara
80 1.16 kiyohara #if defined(GUMSTIX)
81 1.10 kiyohara static int gxiomatch(device_t, cfdata_t, void *);
82 1.8 kiyohara static void gxioattach(device_t, device_t, void *);
83 1.10 kiyohara static int gxiosearch(device_t, cfdata_t, const int *, void *);
84 1.1 kiyohara static int gxioprint(void *, const char *);
85 1.16 kiyohara
86 1.16 kiyohara CFATTACH_DECL_NEW(gxio, sizeof(struct gxio_softc),
87 1.16 kiyohara gxiomatch, gxioattach, NULL, NULL);
88 1.15 kiyohara #endif
89 1.1 kiyohara
90 1.21 kiyohara void gxio_config(void);
91 1.25 christos void gxio_config_expansion(const char *);
92 1.16 kiyohara #if defined(GUMSTIX)
93 1.6 kiyohara static void basix_config(void);
94 1.4 kiyohara static void cfstix_config(void);
95 1.4 kiyohara static void etherstix_config(void);
96 1.4 kiyohara static void netcf_config(void);
97 1.14 kiyohara static void netcf_vx_config(void);
98 1.4 kiyohara static void netduommc_config(void);
99 1.4 kiyohara static void netduo_config(void);
100 1.10 kiyohara static void netmicrosd_config(void);
101 1.10 kiyohara static void netwifimicrosd_config(void);
102 1.4 kiyohara static void netmmc_config(void);
103 1.10 kiyohara static void wifistix_config(void);
104 1.4 kiyohara static void wifistix_cf_config(void);
105 1.16 kiyohara #elif defined(OVERO)
106 1.16 kiyohara static void eth0_config(void);
107 1.16 kiyohara static void eth1_config(void);
108 1.21 kiyohara static void dvi_config(void);
109 1.21 kiyohara static void lcd_config(char);
110 1.21 kiyohara static void header_40pin_config(int);
111 1.21 kiyohara
112 1.16 kiyohara static void chestnut_config(void);
113 1.21 kiyohara static void gallop_config(void);
114 1.21 kiyohara static void summit_config(void);
115 1.16 kiyohara static void tobi_config(void);
116 1.16 kiyohara static void tobiduo_config(void);
117 1.21 kiyohara #elif defined(DUOVERO)
118 1.21 kiyohara static void ehci_config(void);
119 1.21 kiyohara
120 1.21 kiyohara static void parlor_config(void);
121 1.21 kiyohara #elif defined(PEPPER)
122 1.21 kiyohara static void lcd_config(void);
123 1.21 kiyohara static void pepper43_config(void);
124 1.21 kiyohara
125 1.21 kiyohara static void pepper_config(void);
126 1.21 kiyohara static void c_config(void);
127 1.21 kiyohara static void dvi_config(void);
128 1.21 kiyohara static void r_config(void);
129 1.21 kiyohara #endif
130 1.21 kiyohara #if defined(OVERO) || defined(DUOVERO)
131 1.21 kiyohara struct omap_mux_conf;
132 1.21 kiyohara static void smsh_config(struct omap_mux_conf *, int, int);
133 1.21 kiyohara #endif
134 1.21 kiyohara #if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
135 1.21 kiyohara static void __udelay(unsigned int);
136 1.21 kiyohara #endif
137 1.21 kiyohara #if defined(PEPPER)
138 1.21 kiyohara static int read_i2c_device(const vaddr_t, uint16_t, uint8_t, int, uint8_t *);
139 1.15 kiyohara #endif
140 1.1 kiyohara
141 1.10 kiyohara #if defined(CPU_XSCALE_PXA250)
142 1.21 kiyohara
143 1.10 kiyohara static struct pxa2x0_gpioconf pxa255dep_gpioconf[] = {
144 1.3 kiyohara /* Bluetooth module configuration */
145 1.3 kiyohara { 7, GPIO_OUT | GPIO_SET }, /* power on */
146 1.3 kiyohara { 12, GPIO_ALT_FN_1_OUT }, /* 32kHz out. required by SingleStone */
147 1.3 kiyohara
148 1.3 kiyohara /* AC97 configuration */
149 1.10 kiyohara { 29, GPIO_ALT_FN_1_IN }, /* SDATA_IN0 */
150 1.10 kiyohara
151 1.10 kiyohara /* FFUART configuration */
152 1.10 kiyohara { 35, GPIO_ALT_FN_1_IN }, /* CTS */
153 1.10 kiyohara { 41, GPIO_ALT_FN_2_OUT }, /* RTS */
154 1.3 kiyohara
155 1.3 kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
156 1.3 kiyohara /* BTUART configuration */
157 1.10 kiyohara { 44, GPIO_ALT_FN_1_IN }, /* BTCTS */
158 1.10 kiyohara { 45, GPIO_ALT_FN_2_OUT }, /* BTRTS */
159 1.3 kiyohara #else
160 1.3 kiyohara /* HWUART configuration */
161 1.3 kiyohara { 42, GPIO_ALT_FN_3_IN }, /* HWRXD */
162 1.3 kiyohara { 43, GPIO_ALT_FN_3_OUT }, /* HWTXD */
163 1.10 kiyohara { 44, GPIO_ALT_FN_3_IN }, /* HWCTS */
164 1.10 kiyohara { 45, GPIO_ALT_FN_3_OUT }, /* HWRTS */
165 1.3 kiyohara #endif
166 1.3 kiyohara
167 1.3 kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
168 1.3 kiyohara /* HWUART configuration */
169 1.3 kiyohara { 48, GPIO_ALT_FN_1_OUT }, /* HWTXD */
170 1.3 kiyohara { 49, GPIO_ALT_FN_1_IN }, /* HWRXD */
171 1.3 kiyohara { 50, GPIO_ALT_FN_1_IN }, /* HWCTS */
172 1.3 kiyohara { 51, GPIO_ALT_FN_1_OUT }, /* HWRTS */
173 1.3 kiyohara #endif
174 1.3 kiyohara
175 1.3 kiyohara { -1 }
176 1.1 kiyohara };
177 1.10 kiyohara #endif
178 1.10 kiyohara #if defined(CPU_XSCALE_PXA270)
179 1.10 kiyohara static struct pxa2x0_gpioconf verdexdep_gpioconf[] = {
180 1.10 kiyohara /* Bluetooth module configuration */
181 1.10 kiyohara { 9, GPIO_ALT_FN_3_OUT }, /* CHOUT<0> */
182 1.13 kiyohara { 12, GPIO_OUT | GPIO_SET },
183 1.10 kiyohara
184 1.12 kiyohara /* LCD configuration */
185 1.12 kiyohara { 17, GPIO_IN }, /* backlight on */
186 1.12 kiyohara
187 1.10 kiyohara /* FFUART configuration */
188 1.10 kiyohara { 34, GPIO_ALT_FN_1_IN }, /* FFRXD */
189 1.10 kiyohara { 39, GPIO_ALT_FN_2_OUT }, /* FFTXD */
190 1.10 kiyohara
191 1.10 kiyohara /* BTUART configuration */
192 1.10 kiyohara { 42, GPIO_ALT_FN_1_IN }, /* BTRXD */
193 1.10 kiyohara { 43, GPIO_ALT_FN_2_OUT }, /* BTTXD */
194 1.10 kiyohara { 44, GPIO_ALT_FN_1_IN }, /* BTCTS */
195 1.10 kiyohara { 45, GPIO_ALT_FN_2_OUT }, /* BTRTS */
196 1.10 kiyohara
197 1.10 kiyohara /* AC97 configuration */
198 1.10 kiyohara { 29, GPIO_ALT_FN_1_IN }, /* SDATA_IN0 */
199 1.10 kiyohara
200 1.10 kiyohara { -1 }
201 1.10 kiyohara };
202 1.21 kiyohara
203 1.21 kiyohara #elif defined(OMAP2)
204 1.21 kiyohara
205 1.21 kiyohara struct omap_mux_conf {
206 1.21 kiyohara int offset;
207 1.21 kiyohara uint32_t value;
208 1.21 kiyohara /* OMAP3/4 register values */
209 1.21 kiyohara #define WAKEUPEVENT (1 << 15)
210 1.21 kiyohara #define WAKEUPENABLE (1 << 14)
211 1.21 kiyohara #define OFFMODEPULLTYPESELECT (1 << 13)
212 1.21 kiyohara #define OFFMODEPULLUDENABLE (1 << 12)
213 1.21 kiyohara #define OFFMODEOUTVALUE (1 << 11)
214 1.21 kiyohara #define OFFMODEOUTENABLE (1 << 10)
215 1.21 kiyohara #define OFFMODEENABLE (1 << 9)
216 1.21 kiyohara #define INPUTENABLE (1 << 8)
217 1.21 kiyohara #define PULLTYPESELECT (1 << 4)
218 1.21 kiyohara #define PULLUDENABLE (1 << 3)
219 1.21 kiyohara #define MUXMODE(n) ((n) & 0x7)
220 1.21 kiyohara
221 1.21 kiyohara /* Sitara AM3xxx register values */
222 1.21 kiyohara #define SLEWCTRL (1 << 6)
223 1.21 kiyohara #define RXACTIVE (1 << 5)
224 1.21 kiyohara #define PUTYPESEL (1 << 4)
225 1.21 kiyohara #define PUDEN (1 << 3)
226 1.21 kiyohara #define MMODE(n) ((n) & 0x7)
227 1.21 kiyohara };
228 1.21 kiyohara struct omap_gpio_conf {
229 1.21 kiyohara int pin;
230 1.21 kiyohara enum {
231 1.21 kiyohara conf_input = -1,
232 1.21 kiyohara conf_output_0,
233 1.21 kiyohara conf_output_1,
234 1.21 kiyohara } conf;
235 1.21 kiyohara };
236 1.21 kiyohara
237 1.21 kiyohara static void gxio_omap_mux_config(const struct omap_mux_conf []);
238 1.21 kiyohara static int gxio_omap_mux_config_address(const char *, unsigned long,
239 1.21 kiyohara const struct omap_mux_conf[],
240 1.21 kiyohara const struct omap_mux_conf[]);
241 1.21 kiyohara static void gxio_omap_gpio_config(const struct omap_gpio_conf[]);
242 1.21 kiyohara void gxio_omap_gpio_write(int, int);
243 1.21 kiyohara
244 1.26 ryo #if defined(OVERO)
245 1.21 kiyohara static const struct omap_mux_conf overo_mux_i2c3_conf[] = {
246 1.21 kiyohara { 0x1c2, MUXMODE(0) | INPUTENABLE }, /* i2c3_scl */
247 1.21 kiyohara { 0x1c4, MUXMODE(0) | INPUTENABLE }, /* i2c3_sda */
248 1.21 kiyohara { -1 }
249 1.21 kiyohara };
250 1.26 ryo #endif
251 1.26 ryo #if defined(OVERO)
252 1.21 kiyohara static const struct omap_mux_conf overo_mux_mmchs2_conf[] = {
253 1.21 kiyohara { 0x158, /* mmc2_clk */
254 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
255 1.21 kiyohara { 0x15a, /* mmc2_cmd */
256 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
257 1.21 kiyohara { 0x15c, /* mmc2_dat0 */
258 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
259 1.21 kiyohara { 0x15e, /* mmc2_dat1 */
260 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
261 1.21 kiyohara { 0x160, /* mmc2_dat2 */
262 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
263 1.21 kiyohara { 0x162, /* mmc2_dat3 */
264 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
265 1.21 kiyohara { -1 }
266 1.21 kiyohara };
267 1.26 ryo #endif
268 1.24 christos #if defined(OVERO)
269 1.21 kiyohara static const struct omap_mux_conf overo_mux_wireless_conf[] = {
270 1.21 kiyohara { 0x0b4, MUXMODE(4) }, /* gpio_54:BT_nPOWERON*/
271 1.21 kiyohara { 0x0bc, MUXMODE(4) | INPUTENABLE }, /* gpio_58: WIFI_IRQ */
272 1.21 kiyohara { 0x19c, MUXMODE(4) }, /* gpio_164:BT_nRESET */
273 1.21 kiyohara { 0x5e0, MUXMODE(4) }, /* gpio_16: W2W_nRESET*/
274 1.21 kiyohara { -1 }
275 1.21 kiyohara };
276 1.21 kiyohara
277 1.24 christos #elif defined(DUOVERO)
278 1.21 kiyohara static const struct omap_mux_conf duovero_mux_led_conf[] = {
279 1.21 kiyohara { 0x116, MUXMODE(3) }, /* GPIO 122 */
280 1.21 kiyohara { -1 }
281 1.21 kiyohara };
282 1.21 kiyohara static const struct omap_mux_conf duovero_mux_button_conf[] = {
283 1.21 kiyohara { 0x114, /* GPIO 121 */
284 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
285 1.21 kiyohara { -1 }
286 1.21 kiyohara };
287 1.21 kiyohara
288 1.24 christos #elif defined(PEPPER)
289 1.21 kiyohara static const struct omap_mux_conf pepper_mux_led_conf[] = {
290 1.21 kiyohara { 0x850, MMODE(7) | PUDEN }, /* GPIO 52: Blue */
291 1.21 kiyohara { 0x854, MMODE(7) | PUDEN }, /* GPIO 53: Red */
292 1.21 kiyohara { -1 }
293 1.21 kiyohara };
294 1.21 kiyohara static const struct omap_mux_conf pepper_mux_button_conf[] = {
295 1.21 kiyohara { 0x858, MMODE(7) | PUTYPESEL | RXACTIVE }, /* GPIO 54 */
296 1.21 kiyohara { -1 }
297 1.21 kiyohara };
298 1.21 kiyohara static const struct omap_mux_conf pepper_mux_mmchs3_conf[] = {
299 1.21 kiyohara { 0x844, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_DAT0 */
300 1.21 kiyohara { 0x848, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_DAT1 */
301 1.21 kiyohara { 0x84c, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_DAT2 */
302 1.21 kiyohara { 0x878, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_DAT3 */
303 1.21 kiyohara { 0x888, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_CMD */
304 1.21 kiyohara { 0x88c, MMODE(3) | PUTYPESEL | RXACTIVE }, /* MMC2_CLK */
305 1.21 kiyohara { -1 }
306 1.21 kiyohara };
307 1.21 kiyohara static const struct omap_mux_conf pepper_mux_audio_codec_conf[] = {
308 1.21 kiyohara { 0x840, MMODE(7) | PUDEN }, /* GPIO 48: #Reset */
309 1.21 kiyohara { -1 }
310 1.21 kiyohara };
311 1.24 christos #endif
312 1.21 kiyohara
313 1.10 kiyohara #endif
314 1.1 kiyohara
315 1.21 kiyohara static const struct gxioconf gxioconflist[] = {
316 1.16 kiyohara #if defined(GUMSTIX)
317 1.6 kiyohara { "basix", basix_config },
318 1.1 kiyohara { "cfstix", cfstix_config },
319 1.1 kiyohara { "etherstix", etherstix_config },
320 1.1 kiyohara { "netcf", netcf_config },
321 1.14 kiyohara { "netcf-vx", netcf_vx_config },
322 1.3 kiyohara { "netduo-mmc", netduommc_config },
323 1.1 kiyohara { "netduo", netduo_config },
324 1.10 kiyohara { "netmicrosd", netmicrosd_config },
325 1.10 kiyohara { "netmicrosd-vx", netmicrosd_config },
326 1.10 kiyohara { "netwifimicrosd", netwifimicrosd_config },
327 1.1 kiyohara { "netmmc", netmmc_config },
328 1.10 kiyohara { "netpro-vx", netwifimicrosd_config },
329 1.4 kiyohara { "wifistix-cf", wifistix_cf_config },
330 1.10 kiyohara { "wifistix", wifistix_config },
331 1.16 kiyohara #elif defined(OVERO)
332 1.16 kiyohara { "chestnut43", chestnut_config },
333 1.21 kiyohara { "gallop43", gallop_config },
334 1.21 kiyohara { "summit", summit_config },
335 1.16 kiyohara { "tobi", tobi_config },
336 1.16 kiyohara { "tobi-duo", tobiduo_config },
337 1.21 kiyohara #elif defined(DUOVERO)
338 1.21 kiyohara { "parlor", parlor_config },
339 1.21 kiyohara #elif defined(PEPPER)
340 1.21 kiyohara { "43c", c_config },
341 1.21 kiyohara { "43r", r_config },
342 1.21 kiyohara { "dvi", dvi_config },
343 1.15 kiyohara #endif
344 1.1 kiyohara { NULL }
345 1.1 kiyohara };
346 1.1 kiyohara
347 1.10 kiyohara int gxpcic_gpio_reset;
348 1.10 kiyohara struct gxpcic_slot_irqs gxpcic_slot_irqs[2] = { { 0, -1, -1 }, { 0, -1, -1 } };
349 1.10 kiyohara
350 1.1 kiyohara
351 1.16 kiyohara #if defined(GUMSTIX)
352 1.1 kiyohara /* ARGSUSED */
353 1.1 kiyohara static int
354 1.10 kiyohara gxiomatch(device_t parent, cfdata_t match, void *aux)
355 1.1 kiyohara {
356 1.16 kiyohara
357 1.10 kiyohara struct pxaip_attach_args *pxa = aux;
358 1.1 kiyohara bus_space_tag_t iot = &pxa2x0_bs_tag;
359 1.1 kiyohara bus_space_handle_t ioh;
360 1.1 kiyohara
361 1.10 kiyohara if (strcmp(pxa->pxa_name, match->cf_name) != 0 ||
362 1.10 kiyohara pxa->pxa_addr != PXAIPCF_ADDR_DEFAULT)
363 1.10 kiyohara return 0;
364 1.10 kiyohara
365 1.1 kiyohara if (bus_space_map(iot,
366 1.1 kiyohara PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &ioh))
367 1.16 kiyohara return 0;
368 1.1 kiyohara bus_space_unmap(iot, ioh, PXA2X0_MEMCTL_SIZE);
369 1.1 kiyohara
370 1.1 kiyohara /* nothing */
371 1.16 kiyohara return 1;
372 1.1 kiyohara }
373 1.1 kiyohara
374 1.1 kiyohara /* ARGSUSED */
375 1.1 kiyohara static void
376 1.8 kiyohara gxioattach(device_t parent, device_t self, void *aux)
377 1.1 kiyohara {
378 1.3 kiyohara struct gxio_softc *sc = device_private(self);
379 1.1 kiyohara
380 1.3 kiyohara aprint_normal("\n");
381 1.3 kiyohara aprint_naive("\n");
382 1.1 kiyohara
383 1.8 kiyohara sc->sc_dev = self;
384 1.1 kiyohara sc->sc_iot = &pxa2x0_bs_tag;
385 1.1 kiyohara
386 1.1 kiyohara if (bus_space_map(sc->sc_iot,
387 1.1 kiyohara PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &sc->sc_ioh))
388 1.1 kiyohara return;
389 1.1 kiyohara
390 1.1 kiyohara /*
391 1.16 kiyohara * Attach each gumstix(busheader)/overo expansion board devices.
392 1.1 kiyohara */
393 1.1 kiyohara config_search_ia(gxiosearch, self, "gxio", NULL);
394 1.1 kiyohara }
395 1.1 kiyohara
396 1.1 kiyohara /* ARGSUSED */
397 1.1 kiyohara static int
398 1.10 kiyohara gxiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
399 1.1 kiyohara {
400 1.3 kiyohara struct gxio_softc *sc = device_private(parent);
401 1.1 kiyohara struct gxio_attach_args gxa;
402 1.1 kiyohara
403 1.1 kiyohara gxa.gxa_sc = sc;
404 1.1 kiyohara gxa.gxa_iot = sc->sc_iot;
405 1.1 kiyohara gxa.gxa_addr = cf->cf_loc[GXIOCF_ADDR];
406 1.1 kiyohara gxa.gxa_gpirq = cf->cf_loc[GXIOCF_GPIRQ];
407 1.1 kiyohara
408 1.1 kiyohara if (config_match(parent, cf, &gxa))
409 1.1 kiyohara config_attach(parent, cf, &gxa, gxioprint);
410 1.1 kiyohara
411 1.16 kiyohara return 0;
412 1.1 kiyohara }
413 1.1 kiyohara
414 1.1 kiyohara /* ARGSUSED */
415 1.1 kiyohara static int
416 1.1 kiyohara gxioprint(void *aux, const char *name)
417 1.1 kiyohara {
418 1.1 kiyohara struct gxio_attach_args *gxa = (struct gxio_attach_args *)aux;
419 1.1 kiyohara
420 1.1 kiyohara if (gxa->gxa_addr != GXIOCF_ADDR_DEFAULT)
421 1.1 kiyohara printf(" addr 0x%lx", gxa->gxa_addr);
422 1.1 kiyohara if (gxa->gxa_gpirq > 0)
423 1.1 kiyohara printf(" gpirq %d", gxa->gxa_gpirq);
424 1.16 kiyohara return UNCONF;
425 1.1 kiyohara }
426 1.15 kiyohara #endif
427 1.1 kiyohara
428 1.1 kiyohara
429 1.21 kiyohara #if defined(GUMSTIX)
430 1.1 kiyohara /*
431 1.3 kiyohara * configure for GPIO pin and expansion boards.
432 1.1 kiyohara */
433 1.1 kiyohara void
434 1.21 kiyohara gxio_config(void)
435 1.3 kiyohara {
436 1.10 kiyohara #if defined(CPU_XSCALE_PXA250)
437 1.5 kiyohara struct pxa2x0_gpioconf *gumstix_gpioconf[] = {
438 1.5 kiyohara pxa25x_com_ffuart_gpioconf,
439 1.5 kiyohara pxa25x_com_stuart_gpioconf,
440 1.5 kiyohara #ifndef GXIO_BLUETOOTH_ON_HWUART
441 1.5 kiyohara pxa25x_com_btuart_gpioconf,
442 1.5 kiyohara #endif
443 1.5 kiyohara pxa25x_com_hwuart_gpioconf,
444 1.5 kiyohara pxa25x_i2c_gpioconf,
445 1.5 kiyohara pxa25x_pxaacu_gpioconf,
446 1.10 kiyohara pxa255dep_gpioconf,
447 1.10 kiyohara NULL
448 1.10 kiyohara };
449 1.10 kiyohara #endif
450 1.10 kiyohara #if defined(CPU_XSCALE_PXA270)
451 1.10 kiyohara struct pxa2x0_gpioconf *verdex_gpioconf[] = {
452 1.10 kiyohara pxa27x_com_ffuart_gpioconf,
453 1.10 kiyohara pxa27x_com_stuart_gpioconf,
454 1.10 kiyohara pxa27x_com_btuart_gpioconf,
455 1.10 kiyohara pxa27x_i2c_gpioconf,
456 1.10 kiyohara pxa27x_pxaacu_gpioconf,
457 1.10 kiyohara pxa27x_pxamci_gpioconf,
458 1.10 kiyohara pxa27x_ohci_gpioconf,
459 1.10 kiyohara verdexdep_gpioconf,
460 1.5 kiyohara NULL
461 1.5 kiyohara };
462 1.10 kiyohara #endif
463 1.3 kiyohara
464 1.3 kiyohara /* XXX: turn off for power of bluetooth module */
465 1.13 kiyohara #if defined(CPU_XSCALE_PXA250)
466 1.3 kiyohara pxa2x0_gpio_set_function(7, GPIO_OUT | GPIO_CLR);
467 1.13 kiyohara #elif defined(CPU_XSCALE_PXA270)
468 1.13 kiyohara pxa2x0_gpio_set_function(12, GPIO_OUT | GPIO_CLR);
469 1.13 kiyohara #endif
470 1.3 kiyohara delay(100);
471 1.3 kiyohara
472 1.10 kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
473 1.10 kiyohara pxa2x0_gpio_config(
474 1.10 kiyohara (CPU_IS_PXA250) ? gumstix_gpioconf : verdex_gpioconf);
475 1.15 kiyohara #elif defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
476 1.10 kiyohara #if defined(CPU_XSCALE_PXA270)
477 1.10 kiyohara pxa2x0_gpio_config(verdex_gpioconf);
478 1.10 kiyohara #else
479 1.5 kiyohara pxa2x0_gpio_config(gumstix_gpioconf);
480 1.10 kiyohara #endif
481 1.10 kiyohara #endif
482 1.3 kiyohara }
483 1.21 kiyohara #elif defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
484 1.21 kiyohara static void
485 1.21 kiyohara gxio_omap_mux_config(const struct omap_mux_conf mux_conf[])
486 1.21 kiyohara {
487 1.21 kiyohara #if defined(OVERO)
488 1.21 kiyohara const vaddr_t ctrlmod_base = OVERO_L4_CORE_VBASE + 0x2000;
489 1.21 kiyohara #elif defined(DUOVERO)
490 1.21 kiyohara const vaddr_t ctrlmod_base = DUOVERO_L4_CM_VBASE;
491 1.21 kiyohara #elif defined(PEPPER)
492 1.21 kiyohara const vaddr_t ctrlmod_base = PEPPER_PRCM_VBASE + 0x10000;
493 1.21 kiyohara #endif
494 1.21 kiyohara int i;
495 1.21 kiyohara
496 1.21 kiyohara for (i = 0; mux_conf[i].offset != -1; i++)
497 1.21 kiyohara #if !defined(TI_AM335X)
498 1.21 kiyohara ioreg16_write(ctrlmod_base + mux_conf[i].offset,
499 1.21 kiyohara mux_conf[i].value);
500 1.21 kiyohara #else
501 1.21 kiyohara ioreg_write(ctrlmod_base + mux_conf[i].offset,
502 1.21 kiyohara mux_conf[i].value);
503 1.21 kiyohara #endif
504 1.21 kiyohara }
505 1.21 kiyohara
506 1.21 kiyohara static int
507 1.21 kiyohara gxio_omap_mux_config_address(const char *name, unsigned long address,
508 1.21 kiyohara const struct omap_mux_conf mux_conf[],
509 1.21 kiyohara const struct omap_mux_conf not_mux_conf[])
510 1.21 kiyohara {
511 1.21 kiyohara extern struct cfdata cfdata[];
512 1.21 kiyohara cfdata_t cf = &cfdata[0];
513 1.21 kiyohara
514 1.21 kiyohara while (cf->cf_name != NULL) {
515 1.21 kiyohara if (strcmp(name, cf->cf_name) == 0 &&
516 1.21 kiyohara address == cf->cf_loc[OBIOCF_ADDR]) {
517 1.21 kiyohara gxio_omap_mux_config(mux_conf);
518 1.21 kiyohara return 0;
519 1.21 kiyohara }
520 1.21 kiyohara cf++;
521 1.21 kiyohara }
522 1.21 kiyohara
523 1.21 kiyohara if (not_mux_conf == NULL)
524 1.21 kiyohara return -1;
525 1.21 kiyohara
526 1.21 kiyohara gxio_omap_mux_config(not_mux_conf);
527 1.21 kiyohara return 0;
528 1.21 kiyohara }
529 1.21 kiyohara
530 1.21 kiyohara #if defined(OVERO)
531 1.21 kiyohara #define gpio_reg_read ioreg_read
532 1.21 kiyohara #define gpio_reg_write ioreg_write
533 1.21 kiyohara #elif defined(DUOVERO) || defined(PEPPER)
534 1.21 kiyohara #define gpio_reg_read(a) ioreg_read((a) + GPIO_SIZE2)
535 1.21 kiyohara #define gpio_reg_write(a, v) ioreg_write((a) + GPIO_SIZE2, (v))
536 1.21 kiyohara #endif
537 1.21 kiyohara
538 1.21 kiyohara static const vaddr_t gpio_bases[] = {
539 1.21 kiyohara #if defined(OVERO)
540 1.21 kiyohara #define OVERO_GPIO_VBASE(n) ((n) == 1 ? BASE(WAKEUP, n) : BASE(PERIPHERAL, n))
541 1.21 kiyohara #define GPIO(n) GPIO ## n ## _BASE_3530
542 1.21 kiyohara #define BASE(a, n) \
543 1.21 kiyohara (OVERO_L4_ ## a ## _VBASE + (GPIO(n) - OMAP3530_L4_ ## a ## _BASE))
544 1.21 kiyohara
545 1.21 kiyohara GPIO1_BASE_3530,
546 1.21 kiyohara GPIO2_BASE_3530,
547 1.21 kiyohara GPIO3_BASE_3530,
548 1.21 kiyohara GPIO4_BASE_3530,
549 1.21 kiyohara GPIO5_BASE_3530,
550 1.21 kiyohara GPIO6_BASE_3530,
551 1.21 kiyohara
552 1.21 kiyohara #elif defined(DUOVERO)
553 1.21 kiyohara #define DUOVERO_GPIO_VBASE(n) ((n) == 1 ? BASE(WAKEUP, n) : BASE(PERIPHERAL, n))
554 1.21 kiyohara #define GPIO(n) GPIO ## n ## _BASE_4430
555 1.21 kiyohara #define BASE(a, n) \
556 1.21 kiyohara (DUOVERO_L4_ ## a ## _VBASE + (GPIO(n) - OMAP4430_L4_ ## a ## _BASE))
557 1.21 kiyohara
558 1.21 kiyohara DUOVERO_GPIO_VBASE(1),
559 1.21 kiyohara DUOVERO_GPIO_VBASE(2),
560 1.21 kiyohara DUOVERO_GPIO_VBASE(3),
561 1.21 kiyohara DUOVERO_GPIO_VBASE(4),
562 1.21 kiyohara DUOVERO_GPIO_VBASE(5),
563 1.21 kiyohara
564 1.21 kiyohara #elif defined(PEPPER)
565 1.21 kiyohara #define PEPPER_GPIO_VBASE(n) ((n) == 0 ? WAKEUP(n) : PERIPHERAL(n))
566 1.21 kiyohara #define GPIO(n) GPIO ## n ## _BASE_TI_AM335X
567 1.21 kiyohara #define WAKEUP(n) (PEPPER_PRCM_VBASE + (GPIO(n) - OMAP2_CM_BASE))
568 1.21 kiyohara #define PERIPHERAL(n) \
569 1.21 kiyohara (PEPPER_L4_PERIPHERAL_VBASE + (GPIO(n) - TI_AM335X_L4_PERIPHERAL_BASE))
570 1.21 kiyohara
571 1.21 kiyohara PEPPER_GPIO_VBASE(0),
572 1.21 kiyohara PEPPER_GPIO_VBASE(1),
573 1.21 kiyohara PEPPER_GPIO_VBASE(2),
574 1.21 kiyohara PEPPER_GPIO_VBASE(3),
575 1.21 kiyohara #endif
576 1.21 kiyohara };
577 1.21 kiyohara
578 1.21 kiyohara static void
579 1.21 kiyohara gxio_omap_gpio_config(const struct omap_gpio_conf gpio_conf[])
580 1.21 kiyohara {
581 1.21 kiyohara vaddr_t gpio_base;
582 1.21 kiyohara int mask, i;
583 1.21 kiyohara
584 1.21 kiyohara for (i = 0; gpio_conf[i].pin != -1; i++) {
585 1.21 kiyohara gpio_base = gpio_bases[gpio_conf[i].pin / 32];
586 1.21 kiyohara mask = 1 << (gpio_conf[i].pin % 32);
587 1.21 kiyohara switch (gpio_conf[i].conf) {
588 1.21 kiyohara case conf_input:
589 1.21 kiyohara ioreg_write(gpio_base + GPIO_OE,
590 1.21 kiyohara ioreg_read(gpio_base + GPIO_OE) | mask);
591 1.21 kiyohara break;
592 1.21 kiyohara case conf_output_0:
593 1.21 kiyohara ioreg_write(gpio_base + GPIO_OE,
594 1.21 kiyohara ioreg_read(gpio_base + GPIO_OE) | ~mask);
595 1.21 kiyohara #if 0
596 1.21 kiyohara ioreg_write(gpio_base + GPIO_CLEARDATAOUT, mask);
597 1.21 kiyohara #else
598 1.21 kiyohara ioreg_write(gpio_base + GPIO_DATAOUT,
599 1.21 kiyohara ioreg_read(gpio_base + GPIO_DATAOUT) & ~mask);
600 1.21 kiyohara #endif
601 1.21 kiyohara break;
602 1.21 kiyohara case conf_output_1:
603 1.21 kiyohara ioreg_write(gpio_base + GPIO_OE,
604 1.21 kiyohara ioreg_read(gpio_base + GPIO_OE) | ~mask);
605 1.21 kiyohara #if 0
606 1.21 kiyohara ioreg_write(gpio_base + GPIO_SETDATAOUT, mask);
607 1.21 kiyohara #else
608 1.21 kiyohara ioreg_write(gpio_base + GPIO_DATAOUT,
609 1.21 kiyohara ioreg_read(gpio_base + GPIO_DATAOUT) | mask);
610 1.21 kiyohara #endif
611 1.21 kiyohara break;
612 1.21 kiyohara }
613 1.21 kiyohara }
614 1.21 kiyohara }
615 1.21 kiyohara
616 1.21 kiyohara void
617 1.21 kiyohara gxio_omap_gpio_write(int pin, int val)
618 1.21 kiyohara {
619 1.21 kiyohara vaddr_t gpio_base;
620 1.21 kiyohara int mask;
621 1.21 kiyohara
622 1.21 kiyohara KASSERT(pin / 32 < __arraycount(gpio_bases));
623 1.21 kiyohara
624 1.21 kiyohara gpio_base = gpio_bases[pin / 32];
625 1.21 kiyohara mask = 1 << (pin % 32);
626 1.21 kiyohara if (val == 0)
627 1.21 kiyohara ioreg_write(gpio_base + GPIO_CLEARDATAOUT, mask);
628 1.21 kiyohara else
629 1.21 kiyohara ioreg_write(gpio_base + GPIO_SETDATAOUT, mask);
630 1.21 kiyohara }
631 1.21 kiyohara
632 1.21 kiyohara /*
633 1.21 kiyohara * configure for MUX, GPIO.
634 1.21 kiyohara */
635 1.21 kiyohara void
636 1.21 kiyohara gxio_config(void)
637 1.21 kiyohara {
638 1.21 kiyohara const struct omap_mux_conf *mux_conf[] = {
639 1.21 kiyohara #if defined(OVERO)
640 1.21 kiyohara overo_mux_i2c3_conf,
641 1.21 kiyohara overo_mux_mmchs2_conf,
642 1.21 kiyohara overo_mux_wireless_conf,
643 1.21 kiyohara #elif defined(DUOVERO)
644 1.21 kiyohara duovero_mux_led_conf,
645 1.21 kiyohara duovero_mux_button_conf,
646 1.21 kiyohara #elif defined(PEPPER)
647 1.21 kiyohara pepper_mux_led_conf,
648 1.21 kiyohara pepper_mux_button_conf,
649 1.21 kiyohara pepper_mux_mmchs3_conf,
650 1.21 kiyohara pepper_mux_audio_codec_conf,
651 1.21 kiyohara #endif
652 1.21 kiyohara };
653 1.21 kiyohara const struct omap_gpio_conf gpio_conf[] = {
654 1.21 kiyohara #if defined(OVERO)
655 1.21 kiyohara { 16, conf_output_0 }, /* Wireless: #Reset */
656 1.21 kiyohara #elif defined(PEPPER)
657 1.21 kiyohara { 48, conf_output_0 }, /* Audio Codec: #Reset */
658 1.21 kiyohara #endif
659 1.21 kiyohara { -1 }
660 1.21 kiyohara };
661 1.21 kiyohara int i;
662 1.21 kiyohara
663 1.21 kiyohara for (i = 0; i < __arraycount(mux_conf); i++)
664 1.21 kiyohara gxio_omap_mux_config(mux_conf[i]);
665 1.21 kiyohara gxio_omap_gpio_config(gpio_conf);
666 1.21 kiyohara }
667 1.21 kiyohara #endif
668 1.3 kiyohara
669 1.25 christos static int
670 1.25 christos gxio_find_default_expansion(void)
671 1.4 kiyohara {
672 1.25 christos #ifdef GXIO_DEFAULT_EXPANSION
673 1.25 christos int i;
674 1.4 kiyohara
675 1.25 christos /* Find out the default expansion */
676 1.21 kiyohara for (i = 0; gxioconflist[i].name != NULL; i++)
677 1.21 kiyohara if (strncasecmp(gxioconflist[i].name, GXIO_DEFAULT_EXPANSION,
678 1.25 christos strlen(gxioconflist[i].name) + 1) == 0)
679 1.21 kiyohara break;
680 1.25 christos return gxioconflist[i].name == NULL ? -1 : i;
681 1.21 kiyohara #else
682 1.25 christos return -1;
683 1.21 kiyohara #endif
684 1.25 christos }
685 1.25 christos
686 1.25 christos void
687 1.25 christos gxio_config_expansion(const char *expansion)
688 1.25 christos {
689 1.25 christos int i, d;
690 1.25 christos
691 1.25 christos d = gxio_find_default_expansion();
692 1.25 christos
693 1.25 christos /* Print information about expansions */
694 1.21 kiyohara printf("supported expansions:\n");
695 1.21 kiyohara for (i = 0; gxioconflist[i].name != NULL; i++)
696 1.25 christos printf(" %s%s\n", gxioconflist[i].name,
697 1.21 kiyohara i == d ? " (DEFAULT)" : "");
698 1.21 kiyohara
699 1.25 christos
700 1.25 christos if (expansion == NULL) {
701 1.25 christos printf("not specified 'expansion=' in the boot args.\n");
702 1.25 christos i = -1;
703 1.25 christos } else {
704 1.25 christos for (i = 0; gxioconflist[i].name != NULL; i++)
705 1.25 christos if (strncasecmp(gxioconflist[i].name, expansion,
706 1.25 christos strlen(gxioconflist[i].name) + 1) == 0)
707 1.25 christos break;
708 1.25 christos if (gxioconflist[i].name == NULL) {
709 1.25 christos printf("unknown expansion specified: %s\n", expansion);
710 1.25 christos i = -1;
711 1.25 christos }
712 1.6 kiyohara }
713 1.4 kiyohara
714 1.25 christos /* Do some magic stuff for PEPPER */
715 1.21 kiyohara #if defined(PEPPER)
716 1.25 christos if (i < 0) {
717 1.21 kiyohara struct pepper_board_id {
718 1.21 kiyohara unsigned int device_vendor;
719 1.21 kiyohara #define GUMSTIX_PEPPER 0x30000200 /* 1st gen */
720 1.21 kiyohara #define GUMSTIX_PEPPER_DVI 0x31000200 /* DVI and newer */
721 1.21 kiyohara unsigned char revision;
722 1.21 kiyohara unsigned char content;
723 1.21 kiyohara char fab_revision[8];
724 1.21 kiyohara char env_var[16];
725 1.21 kiyohara char env_setting[64];
726 1.21 kiyohara } id;
727 1.21 kiyohara const vaddr_t i2c_base = PEPPER_PRCM_VBASE + 0xb000;
728 1.21 kiyohara const uint8_t eeprom = 0x50;
729 1.21 kiyohara const uint8_t len = sizeof(id);
730 1.21 kiyohara int rv;
731 1.21 kiyohara
732 1.21 kiyohara rv = read_i2c_device(i2c_base, eeprom, 0x00, len, (void *)&id);
733 1.21 kiyohara if (rv == 0)
734 1.21 kiyohara if (id.device_vendor == GUMSTIX_PEPPER) {
735 1.21 kiyohara printf("configure auto detected expansion"
736 1.21 kiyohara " (pepper)\n");
737 1.21 kiyohara pepper_config();
738 1.21 kiyohara return;
739 1.21 kiyohara }
740 1.21 kiyohara }
741 1.21 kiyohara #endif
742 1.1 kiyohara
743 1.25 christos /*
744 1.25 christos * Now proceed to configure the default expansion if one was
745 1.25 christos * specified (and found) or return.
746 1.25 christos */
747 1.25 christos const char *toconfigure;
748 1.25 christos if (i < 0) {
749 1.25 christos #ifdef GXIO_DEFAULT_EXPANSION
750 1.25 christos if (d == -1) {
751 1.25 christos printf("default expansion (%s) not found\n",
752 1.25 christos GXIO_DEFAULT_EXPANSION);
753 1.25 christos return;
754 1.25 christos }
755 1.25 christos expansion = GXIO_DEFAULT_EXPANSION;
756 1.25 christos i = d;
757 1.25 christos toconfigure = "default";
758 1.25 christos #else
759 1.25 christos return;
760 1.25 christos #endif
761 1.25 christos } else
762 1.25 christos toconfigure = "specified";
763 1.25 christos
764 1.25 christos printf("configure %s expansion (%s)\n", toconfigure, expansion);
765 1.25 christos gxioconflist[i].config();
766 1.3 kiyohara }
767 1.1 kiyohara
768 1.1 kiyohara
769 1.16 kiyohara #if defined(GUMSTIX)
770 1.16 kiyohara
771 1.1 kiyohara static void
772 1.9 cegger basix_config(void)
773 1.6 kiyohara {
774 1.6 kiyohara
775 1.6 kiyohara pxa2x0_gpio_set_function(8, GPIO_ALT_FN_1_OUT); /* MMCCS0 */
776 1.6 kiyohara pxa2x0_gpio_set_function(53, GPIO_ALT_FN_1_OUT); /* MMCCLK */
777 1.6 kiyohara #if 0
778 1.6 kiyohara /* this configuration set by gxmci.c::pxamci_attach() */
779 1.6 kiyohara pxa2x0_gpio_set_function(11, GPIO_IN); /* nSD_DETECT */
780 1.6 kiyohara pxa2x0_gpio_set_function(22, GPIO_IN); /* nSD_WP */
781 1.6 kiyohara #endif
782 1.6 kiyohara }
783 1.6 kiyohara
784 1.6 kiyohara static void
785 1.9 cegger cfstix_config(void)
786 1.1 kiyohara {
787 1.1 kiyohara u_int gpio, npoe_fn;
788 1.10 kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
789 1.10 kiyohara int bvd = (CPU_IS_PXA250) ? 4 : 111;
790 1.10 kiyohara #else
791 1.10 kiyohara #if defined(CPU_XSCALE_PXA270)
792 1.10 kiyohara const int bvd = 111;
793 1.10 kiyohara #else
794 1.10 kiyohara const int bvd = 4;
795 1.10 kiyohara #endif
796 1.10 kiyohara #endif
797 1.10 kiyohara
798 1.10 kiyohara if (CPU_IS_PXA250) {
799 1.10 kiyohara gxpcic_slot_irqs[0].valid = 1;
800 1.10 kiyohara gxpcic_slot_irqs[0].cd = 11;
801 1.10 kiyohara gxpcic_slot_irqs[0].prdy = 26;
802 1.10 kiyohara gxpcic_gpio_reset = 8;
803 1.10 kiyohara } else {
804 1.10 kiyohara gxpcic_slot_irqs[0].valid = 1;
805 1.10 kiyohara gxpcic_slot_irqs[0].cd = 104;
806 1.10 kiyohara gxpcic_slot_irqs[0].prdy = 96;
807 1.10 kiyohara gxpcic_gpio_reset = 97;
808 1.10 kiyohara }
809 1.1 kiyohara
810 1.4 kiyohara #if 1
811 1.10 kiyohara /* PCD/PRDY set by pxa2x0_pcic.c::pxapcic_attach_common() */
812 1.4 kiyohara #else
813 1.4 kiyohara pxa2x0_gpio_set_function(11, GPIO_IN); /* PCD1 */
814 1.4 kiyohara pxa2x0_gpio_set_function(26, GPIO_IN); /* PRDY1/~IRQ1 */
815 1.4 kiyohara #endif
816 1.10 kiyohara pxa2x0_gpio_set_function(bvd, GPIO_IN); /* BVD1/~STSCHG1 */
817 1.1 kiyohara
818 1.1 kiyohara for (gpio = 48, npoe_fn = 0; gpio <= 53 ; gpio++)
819 1.1 kiyohara npoe_fn |= pxa2x0_gpio_get_function(gpio);
820 1.1 kiyohara npoe_fn &= GPIO_SET;
821 1.1 kiyohara
822 1.1 kiyohara pxa2x0_gpio_set_function(48, GPIO_ALT_FN_2_OUT | npoe_fn); /* nPOE */
823 1.1 kiyohara pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
824 1.1 kiyohara pxa2x0_gpio_set_function(50, GPIO_ALT_FN_2_OUT); /* nPIOR */
825 1.1 kiyohara pxa2x0_gpio_set_function(51, GPIO_ALT_FN_2_OUT); /* nPIOW */
826 1.10 kiyohara if (CPU_IS_PXA250) {
827 1.10 kiyohara pxa2x0_gpio_set_function(52, GPIO_ALT_FN_2_OUT); /* nPCE1 */
828 1.10 kiyohara pxa2x0_gpio_set_function(53, GPIO_ALT_FN_2_OUT); /* nPCE2 */
829 1.10 kiyohara pxa2x0_gpio_set_function(54, GPIO_ALT_FN_2_OUT); /* pSKTSEL */
830 1.10 kiyohara } else {
831 1.10 kiyohara pxa2x0_gpio_set_function(102, GPIO_ALT_FN_1_OUT); /* nPCE1 */
832 1.10 kiyohara pxa2x0_gpio_set_function(105, GPIO_ALT_FN_1_OUT); /* nPCE2 */
833 1.10 kiyohara pxa2x0_gpio_set_function(79, GPIO_ALT_FN_1_OUT); /* pSKTSEL */
834 1.10 kiyohara }
835 1.1 kiyohara pxa2x0_gpio_set_function(55, GPIO_ALT_FN_2_OUT); /* nPREG */
836 1.1 kiyohara pxa2x0_gpio_set_function(56, GPIO_ALT_FN_1_IN); /* nPWAIT */
837 1.1 kiyohara pxa2x0_gpio_set_function(57, GPIO_ALT_FN_1_IN); /* nIOIS16 */
838 1.1 kiyohara }
839 1.1 kiyohara
840 1.1 kiyohara static void
841 1.9 cegger etherstix_config(void)
842 1.1 kiyohara {
843 1.10 kiyohara extern struct cfdata cfdata[];
844 1.10 kiyohara #if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
845 1.10 kiyohara int rst = (CPU_IS_PXA250) ? 80 : 32;
846 1.10 kiyohara int irq = (CPU_IS_PXA250) ? 36 : 99;
847 1.10 kiyohara #else
848 1.10 kiyohara #if defined(CPU_XSCALE_PXA270)
849 1.10 kiyohara const int rst = 32, irq = 99;
850 1.10 kiyohara #else
851 1.10 kiyohara const int rst = 80, irq = 36;
852 1.10 kiyohara #endif
853 1.10 kiyohara #endif
854 1.10 kiyohara int i;
855 1.1 kiyohara
856 1.1 kiyohara pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
857 1.1 kiyohara pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT); /* nCS 1 */
858 1.10 kiyohara pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_SET); /* RESET 1 */
859 1.1 kiyohara delay(1);
860 1.10 kiyohara pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_CLR);
861 1.1 kiyohara delay(50000);
862 1.10 kiyohara
863 1.10 kiyohara for (i = 0; cfdata[i].cf_name != NULL; i++)
864 1.10 kiyohara if (strcmp(cfdata[i].cf_name, "sm") == 0 &&
865 1.10 kiyohara strcmp(cfdata[i].cf_atname, "sm_gxio") == 0 &&
866 1.10 kiyohara cfdata[i].cf_loc[GXIOCF_ADDR] == 0x04000300 &&
867 1.10 kiyohara cfdata[i].cf_loc[GXIOCF_GPIRQ] == GXIOCF_GPIRQ_DEFAULT)
868 1.10 kiyohara cfdata[i].cf_loc[GXIOCF_GPIRQ] = irq;
869 1.1 kiyohara }
870 1.1 kiyohara
871 1.1 kiyohara static void
872 1.9 cegger netcf_config(void)
873 1.1 kiyohara {
874 1.1 kiyohara
875 1.4 kiyohara etherstix_config();
876 1.4 kiyohara cfstix_config();
877 1.14 kiyohara }
878 1.14 kiyohara
879 1.14 kiyohara static void
880 1.14 kiyohara netcf_vx_config(void)
881 1.14 kiyohara {
882 1.14 kiyohara
883 1.14 kiyohara /*
884 1.14 kiyohara * XXXX: More power is necessary for NIC and USB???
885 1.14 kiyohara * (no document. from Linux)
886 1.14 kiyohara */
887 1.14 kiyohara
888 1.14 kiyohara pxa2x0_gpio_set_function(27, GPIO_IN);
889 1.14 kiyohara pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);
890 1.14 kiyohara pxa2x0_gpio_set_function(118, GPIO_ALT_FN_1_IN | GPIO_CLR);
891 1.14 kiyohara
892 1.14 kiyohara etherstix_config();
893 1.14 kiyohara cfstix_config();
894 1.10 kiyohara if (CPU_IS_PXA270) {
895 1.10 kiyohara /* Overwrite */
896 1.10 kiyohara gxpcic_slot_irqs[0].cd = 104;
897 1.10 kiyohara gxpcic_slot_irqs[0].prdy = 109;
898 1.10 kiyohara gxpcic_gpio_reset = 110;
899 1.10 kiyohara };
900 1.1 kiyohara }
901 1.1 kiyohara
902 1.1 kiyohara static void
903 1.9 cegger netduommc_config(void)
904 1.3 kiyohara {
905 1.3 kiyohara
906 1.4 kiyohara netduo_config();
907 1.6 kiyohara basix_config();
908 1.3 kiyohara }
909 1.3 kiyohara
910 1.3 kiyohara static void
911 1.9 cegger netduo_config(void)
912 1.1 kiyohara {
913 1.1 kiyohara
914 1.4 kiyohara etherstix_config();
915 1.1 kiyohara
916 1.1 kiyohara pxa2x0_gpio_set_function(78, GPIO_ALT_FN_2_OUT); /* nCS 2 */
917 1.1 kiyohara pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_SET); /* RESET 2 */
918 1.1 kiyohara delay(1);
919 1.1 kiyohara pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_CLR);
920 1.1 kiyohara delay(50000);
921 1.1 kiyohara }
922 1.1 kiyohara
923 1.1 kiyohara static void
924 1.10 kiyohara netmicrosd_config(void)
925 1.10 kiyohara {
926 1.10 kiyohara
927 1.10 kiyohara /* MicroSD(mci) always configure on PXA270 */
928 1.10 kiyohara
929 1.10 kiyohara pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
930 1.10 kiyohara pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT); /* nCS 1 */
931 1.10 kiyohara pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR); /* RESET 1 */
932 1.10 kiyohara delay(hz / 2);
933 1.10 kiyohara pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_SET);
934 1.10 kiyohara delay(50000);
935 1.10 kiyohara }
936 1.10 kiyohara
937 1.10 kiyohara static void
938 1.10 kiyohara netwifimicrosd_config(void)
939 1.10 kiyohara {
940 1.10 kiyohara
941 1.10 kiyohara netmicrosd_config();
942 1.10 kiyohara
943 1.10 kiyohara cfstix_config();
944 1.10 kiyohara /* However use pxamci. */
945 1.10 kiyohara pxa2x0_gpio_set_function(111, GPIO_CLR | GPIO_ALT_FN_1_IN);
946 1.12 kiyohara /* Power to Marvell 88W8385 */
947 1.10 kiyohara pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
948 1.10 kiyohara }
949 1.10 kiyohara
950 1.10 kiyohara static void
951 1.9 cegger netmmc_config(void)
952 1.1 kiyohara {
953 1.1 kiyohara
954 1.4 kiyohara etherstix_config();
955 1.6 kiyohara basix_config();
956 1.1 kiyohara }
957 1.4 kiyohara
958 1.4 kiyohara static void
959 1.10 kiyohara wifistix_config(void)
960 1.10 kiyohara {
961 1.10 kiyohara
962 1.10 kiyohara cfstix_config();
963 1.10 kiyohara
964 1.12 kiyohara /* Power to Marvell 88W8385 */
965 1.10 kiyohara pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
966 1.10 kiyohara }
967 1.10 kiyohara
968 1.10 kiyohara static void
969 1.9 cegger wifistix_cf_config(void)
970 1.4 kiyohara {
971 1.4 kiyohara
972 1.10 kiyohara gxpcic_slot_irqs[1].valid = 1;
973 1.10 kiyohara gxpcic_slot_irqs[1].cd = 36;
974 1.10 kiyohara gxpcic_slot_irqs[1].prdy = 27;
975 1.10 kiyohara
976 1.4 kiyohara #if 1
977 1.6 kiyohara /* this configuration set by pxa2x0_pcic.c::pxapcic_attach_common() */
978 1.4 kiyohara #else
979 1.4 kiyohara pxa2x0_gpio_set_function(36, GPIO_IN); /* PCD2 */
980 1.4 kiyohara pxa2x0_gpio_set_function(27, GPIO_IN); /* PRDY2/~IRQ2 */
981 1.4 kiyohara #endif
982 1.4 kiyohara pxa2x0_gpio_set_function(18, GPIO_IN); /* BVD2/~STSCHG2 */
983 1.4 kiyohara
984 1.4 kiyohara cfstix_config();
985 1.10 kiyohara
986 1.12 kiyohara /* Power to Marvell 88W8385 */
987 1.10 kiyohara pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
988 1.4 kiyohara }
989 1.16 kiyohara
990 1.16 kiyohara #elif defined(OVERO)
991 1.16 kiyohara
992 1.16 kiyohara static void
993 1.16 kiyohara eth0_config(void)
994 1.16 kiyohara {
995 1.16 kiyohara /*
996 1.16 kiyohara * ETH0 connects via CS5. It use GPIO 176 for IRQ.
997 1.20 kiyohara * Also GPIO 64 is NRESET.
998 1.16 kiyohara */
999 1.16 kiyohara
1000 1.21 kiyohara smsh_config(NULL, 176, 64);
1001 1.21 kiyohara }
1002 1.16 kiyohara
1003 1.21 kiyohara static void
1004 1.21 kiyohara eth1_config(void)
1005 1.21 kiyohara {
1006 1.21 kiyohara struct omap_mux_conf eth1_mux_conf[] = {
1007 1.21 kiyohara { 0x0d2, MUXMODE(4) | INPUTENABLE },
1008 1.21 kiyohara { -1 }
1009 1.21 kiyohara };
1010 1.16 kiyohara
1011 1.16 kiyohara /*
1012 1.21 kiyohara * ETH1 connects via CS4. It use GPIO 65 for IRQ.
1013 1.16 kiyohara */
1014 1.21 kiyohara
1015 1.21 kiyohara smsh_config(eth1_mux_conf, 65, 64);
1016 1.16 kiyohara }
1017 1.16 kiyohara
1018 1.16 kiyohara static void
1019 1.21 kiyohara dvi_config(void)
1020 1.21 kiyohara {
1021 1.21 kiyohara static const struct omap_mux_conf overo_mux_dvi_conf[] = {
1022 1.21 kiyohara { 0x0d4, MUXMODE(0) }, /* dss_pclk */
1023 1.21 kiyohara { 0x0d6, MUXMODE(0) }, /* dss_pclk */
1024 1.21 kiyohara { 0x0d8, MUXMODE(0) }, /* dss_pclk */
1025 1.21 kiyohara { 0x0da, MUXMODE(0) }, /* dss_pclk */
1026 1.21 kiyohara { 0x0dc, MUXMODE(0) }, /* dss_pclk */
1027 1.21 kiyohara { 0x0de, MUXMODE(0) }, /* dss_pclk */
1028 1.21 kiyohara { 0x0e0, MUXMODE(0) }, /* dss_pclk */
1029 1.21 kiyohara { 0x0e2, MUXMODE(0) }, /* dss_pclk */
1030 1.21 kiyohara { 0x0e4, MUXMODE(0) }, /* dss_pclk */
1031 1.21 kiyohara { 0x0e6, MUXMODE(0) }, /* dss_pclk */
1032 1.21 kiyohara { 0x0e8, MUXMODE(0) }, /* dss_pclk */
1033 1.21 kiyohara { 0x0ea, MUXMODE(0) }, /* dss_pclk */
1034 1.21 kiyohara { 0x0ec, MUXMODE(0) }, /* dss_pclk */
1035 1.21 kiyohara { 0x0ee, MUXMODE(0) }, /* dss_pclk */
1036 1.21 kiyohara { 0x0f0, MUXMODE(0) }, /* dss_pclk */
1037 1.21 kiyohara { 0x0f2, MUXMODE(0) }, /* dss_pclk */
1038 1.21 kiyohara { 0x0f4, MUXMODE(0) }, /* dss_pclk */
1039 1.21 kiyohara { 0x0f6, MUXMODE(0) }, /* dss_pclk */
1040 1.21 kiyohara { 0x0f8, MUXMODE(0) }, /* dss_pclk */
1041 1.21 kiyohara { 0x0fa, MUXMODE(0) }, /* dss_pclk */
1042 1.21 kiyohara { 0x0fc, MUXMODE(0) }, /* dss_pclk */
1043 1.21 kiyohara { 0x0fe, MUXMODE(0) }, /* dss_pclk */
1044 1.21 kiyohara { 0x100, MUXMODE(0) }, /* dss_pclk */
1045 1.21 kiyohara { 0x102, MUXMODE(0) }, /* dss_pclk */
1046 1.21 kiyohara { 0x104, MUXMODE(0) }, /* dss_pclk */
1047 1.21 kiyohara { 0x106, MUXMODE(0) }, /* dss_pclk */
1048 1.21 kiyohara { 0x108, MUXMODE(0) }, /* dss_pclk */
1049 1.21 kiyohara { 0x10a, MUXMODE(0) }, /* dss_pclk */
1050 1.21 kiyohara { -1 }
1051 1.21 kiyohara };
1052 1.21 kiyohara
1053 1.21 kiyohara gxio_omap_mux_config(overo_mux_dvi_conf);
1054 1.21 kiyohara }
1055 1.21 kiyohara
1056 1.21 kiyohara static void
1057 1.21 kiyohara lcd_config(char type)
1058 1.16 kiyohara {
1059 1.21 kiyohara static const struct omap_mux_conf overo_mux_mcspi1_conf[] = {
1060 1.21 kiyohara { 0x1c8, MUXMODE(0) | INPUTENABLE }, /* mcspi1_clk */
1061 1.21 kiyohara { 0x1ca, MUXMODE(0) | INPUTENABLE }, /* mcspi1_simo*/
1062 1.21 kiyohara { 0x1cc, MUXMODE(0) | INPUTENABLE }, /* mcspi1_somi*/
1063 1.21 kiyohara { 0x1ce, MUXMODE(0) | INPUTENABLE }, /* mcspi1_cs0 */
1064 1.21 kiyohara { 0x1d0, MUXMODE(0) | INPUTENABLE }, /* mcspi1_cs1 */
1065 1.21 kiyohara { -1 }
1066 1.21 kiyohara };
1067 1.21 kiyohara static const struct omap_mux_conf overo_mux_ads7846_conf[] = {
1068 1.21 kiyohara { 0x138, /* gpio_114: NPENIRQ */
1069 1.21 kiyohara MUXMODE(4) | PULLUDENABLE | INPUTENABLE },
1070 1.21 kiyohara { -1 }
1071 1.21 kiyohara };
1072 1.21 kiyohara static const struct omap_mux_conf overo_mux_lcd_conf[] = {
1073 1.21 kiyohara { 0x174, MUXMODE(4) }, /* gpio_144: DISPLAY_EN */
1074 1.21 kiyohara { 0x176, MUXMODE(4) }, /* gpio_145: Brightness */
1075 1.21 kiyohara { -1 }
1076 1.21 kiyohara };
1077 1.16 kiyohara
1078 1.21 kiyohara static const struct omap_gpio_conf overo_gpio_lcd_conf[] = {
1079 1.21 kiyohara { 144, conf_output_0 }, /* DISPLAY_EN */
1080 1.21 kiyohara { 145, conf_output_0 }, /* Brightness */
1081 1.21 kiyohara { -1 }
1082 1.21 kiyohara };
1083 1.16 kiyohara
1084 1.21 kiyohara dvi_config();
1085 1.21 kiyohara if (type != 'C') {
1086 1.21 kiyohara gxio_omap_mux_config(overo_mux_mcspi1_conf);
1087 1.21 kiyohara gxio_omap_mux_config(overo_mux_ads7846_conf);
1088 1.16 kiyohara }
1089 1.21 kiyohara gxio_omap_mux_config(overo_mux_lcd_conf);
1090 1.16 kiyohara
1091 1.21 kiyohara gxio_omap_gpio_config(overo_gpio_lcd_conf);
1092 1.21 kiyohara }
1093 1.16 kiyohara
1094 1.21 kiyohara enum {
1095 1.21 kiyohara uart1_if_exists = 0,
1096 1.21 kiyohara force_uart1
1097 1.21 kiyohara };
1098 1.21 kiyohara static void
1099 1.21 kiyohara header_40pin_config(int uart1)
1100 1.21 kiyohara {
1101 1.21 kiyohara static const struct omap_mux_conf overo_mux_40pin_header_conf[] = {
1102 1.21 kiyohara /*
1103 1.21 kiyohara * 1: GND
1104 1.21 kiyohara * 2: VCC_3.3
1105 1.21 kiyohara * 3: GPIO171_SPI1_CLK
1106 1.21 kiyohara * 4: GPIO114_SPI1_NIRQ
1107 1.21 kiyohara * 5: GPIO172_SPI1_MOSI
1108 1.21 kiyohara * 6: GPIO174_SPI1_CS0
1109 1.21 kiyohara * 7: GPIO173_SPI1_MISO
1110 1.21 kiyohara * 8: GPIO175_SPI1_CS1
1111 1.21 kiyohara * 9: GPIO151_RXD1
1112 1.21 kiyohara * 10: GPIO148_TXD1
1113 1.21 kiyohara * 11: SYS_EN
1114 1.21 kiyohara * 12: VBACKUP
1115 1.21 kiyohara * 13: GPIO0_WAKEUP
1116 1.21 kiyohara * 14: POWERON
1117 1.21 kiyohara * 15: GND
1118 1.21 kiyohara * 16: VCC_1.8
1119 1.21 kiyohara * 17: GPIO128_GPS_PPS
1120 1.21 kiyohara * 18: GPIO127_TS_IRQ
1121 1.21 kiyohara * 19: GPIO170_HDQ_1WIRE
1122 1.21 kiyohara * 20: GPIO163_IR_CTS3
1123 1.21 kiyohara * 21: GPIO165_IR_RXD3 (console)
1124 1.21 kiyohara * 22: GPIO166_IR_TXD3 (console)
1125 1.21 kiyohara * 23: GPIO184_SCL3 (system eeprom)
1126 1.21 kiyohara * 24: GPIO185_SDA3 (system eeprom)
1127 1.21 kiyohara * 25: GND
1128 1.21 kiyohara * 26: VCC_1.8
1129 1.21 kiyohara * 27: GPIO146_PWM11
1130 1.21 kiyohara * 28: GPIO145_PWM10
1131 1.21 kiyohara * 29: GPIO147_PWM8
1132 1.21 kiyohara * 30: GPIO144_PWM9
1133 1.21 kiyohara * 31: PWM0 (TPS65950)
1134 1.21 kiyohara * 32: PWM1 (TPS65950)
1135 1.21 kiyohara * 33: ADCIN7 (TPS65950)
1136 1.21 kiyohara * 34: ADCIN2 (TPS65950)
1137 1.21 kiyohara * 35: ADCIN6 (TPS65950)
1138 1.21 kiyohara * 36: ADCIN5 (TPS65950)
1139 1.21 kiyohara * 37: AGND (TPS65950)
1140 1.21 kiyohara * 38: ADCIN3 (TPS65950)
1141 1.21 kiyohara * 39: ADCIN4 (TPS65950)
1142 1.21 kiyohara * 40: VIN (TPS65950)
1143 1.21 kiyohara */
1144 1.21 kiyohara
1145 1.21 kiyohara { 0x152, MUXMODE(4) | INPUTENABLE }, /* gpio_127 */
1146 1.21 kiyohara { 0x154, MUXMODE(4) | INPUTENABLE }, /* gpio_128 */
1147 1.21 kiyohara { 0x174, MUXMODE(4) | INPUTENABLE }, /* gpio_144 */
1148 1.21 kiyohara { 0x176, MUXMODE(4) | INPUTENABLE }, /* gpio_145 */
1149 1.21 kiyohara { 0x178, MUXMODE(4) | INPUTENABLE }, /* gpio_146 */
1150 1.21 kiyohara { 0x17a, MUXMODE(4) | INPUTENABLE }, /* gpio_147 */
1151 1.21 kiyohara { 0x19a, MUXMODE(4) | INPUTENABLE }, /* gpio_163 */
1152 1.21 kiyohara { -1 }
1153 1.21 kiyohara };
1154 1.21 kiyohara static const struct omap_mux_conf overo_mux_uart1_conf[] = {
1155 1.21 kiyohara { 0x17c, MUXMODE(0) }, /* uart1_tx */
1156 1.21 kiyohara { 0x182, MUXMODE(0) | INPUTENABLE }, /* uart1_rx */
1157 1.21 kiyohara { -1 }
1158 1.21 kiyohara };
1159 1.21 kiyohara static const struct omap_mux_conf overo_mux_no_uart1_conf[] = {
1160 1.21 kiyohara { 0x17c, MUXMODE(4) | INPUTENABLE }, /* gpio_148 */
1161 1.21 kiyohara { 0x182, MUXMODE(4) | INPUTENABLE }, /* gpio_151 */
1162 1.21 kiyohara { -1 }
1163 1.21 kiyohara };
1164 1.21 kiyohara static const struct omap_mux_conf overo_mux_hdq_conf[] = {
1165 1.21 kiyohara #if 0
1166 1.21 kiyohara { 0x1c4, MUXMODE(0) | ??? | INPUTENABLE }, /* hdq_sio */
1167 1.21 kiyohara #endif
1168 1.21 kiyohara { -1 }
1169 1.21 kiyohara };
1170 1.21 kiyohara static const struct omap_mux_conf overo_mux_no_hdq_conf[] = {
1171 1.21 kiyohara { 0x1c4, MUXMODE(4) | INPUTENABLE }, /* gpio_170 */
1172 1.21 kiyohara { -1 }
1173 1.21 kiyohara };
1174 1.21 kiyohara
1175 1.21 kiyohara gxio_omap_mux_config(overo_mux_40pin_header_conf);
1176 1.21 kiyohara if (uart1 == force_uart1)
1177 1.21 kiyohara gxio_omap_mux_config(overo_mux_uart1_conf);
1178 1.21 kiyohara else
1179 1.21 kiyohara gxio_omap_mux_config_address("com", 0x4806a000,
1180 1.21 kiyohara overo_mux_uart1_conf, overo_mux_no_uart1_conf);
1181 1.21 kiyohara gxio_omap_mux_config_address("hdq", 0x480b2000,
1182 1.21 kiyohara overo_mux_hdq_conf, overo_mux_no_hdq_conf);
1183 1.16 kiyohara }
1184 1.16 kiyohara
1185 1.16 kiyohara static void
1186 1.16 kiyohara chestnut_config(void)
1187 1.16 kiyohara {
1188 1.21 kiyohara static const struct omap_mux_conf chestnut_mux_conf[] = {
1189 1.21 kiyohara { 0x5ec, MUXMODE(4) }, /* gpio_22: LED (Blue)*/
1190 1.21 kiyohara { 0x5ee, MUXMODE(4) | INPUTENABLE }, /* gpio_23: Button */
1191 1.21 kiyohara { 0x5dc, MUXMODE(4) | INPUTENABLE }, /* gpio_14: Button */
1192 1.21 kiyohara { -1 }
1193 1.21 kiyohara };
1194 1.16 kiyohara
1195 1.16 kiyohara eth0_config();
1196 1.21 kiyohara lcd_config('R');
1197 1.21 kiyohara
1198 1.21 kiyohara header_40pin_config(uart1_if_exists);
1199 1.21 kiyohara gxio_omap_mux_config(chestnut_mux_conf);
1200 1.21 kiyohara }
1201 1.21 kiyohara
1202 1.21 kiyohara static void
1203 1.21 kiyohara gallop_config(void)
1204 1.21 kiyohara {
1205 1.21 kiyohara static const struct omap_mux_conf gallop43_mux_conf[] = {
1206 1.21 kiyohara { 0x5ec, MUXMODE(4) }, /* gpio_22: LED (Blue)*/
1207 1.21 kiyohara { 0x5ee, MUXMODE(4) | INPUTENABLE }, /* gpio_23: Button */
1208 1.21 kiyohara { 0x5dc, MUXMODE(4) | INPUTENABLE }, /* gpio_14: Button */
1209 1.21 kiyohara { -1 }
1210 1.21 kiyohara };
1211 1.21 kiyohara
1212 1.21 kiyohara lcd_config('R');
1213 1.21 kiyohara
1214 1.21 kiyohara header_40pin_config(force_uart1);
1215 1.21 kiyohara gxio_omap_mux_config(gallop43_mux_conf);
1216 1.21 kiyohara }
1217 1.21 kiyohara
1218 1.21 kiyohara static void
1219 1.21 kiyohara summit_config(void)
1220 1.21 kiyohara {
1221 1.21 kiyohara
1222 1.21 kiyohara dvi_config();
1223 1.21 kiyohara
1224 1.21 kiyohara header_40pin_config(uart1_if_exists);
1225 1.16 kiyohara }
1226 1.16 kiyohara
1227 1.16 kiyohara static void
1228 1.16 kiyohara tobi_config(void)
1229 1.16 kiyohara {
1230 1.16 kiyohara
1231 1.16 kiyohara eth0_config();
1232 1.21 kiyohara dvi_config();
1233 1.21 kiyohara
1234 1.21 kiyohara header_40pin_config(uart1_if_exists);
1235 1.16 kiyohara }
1236 1.16 kiyohara
1237 1.16 kiyohara static void
1238 1.16 kiyohara tobiduo_config(void)
1239 1.16 kiyohara {
1240 1.16 kiyohara
1241 1.16 kiyohara eth0_config();
1242 1.16 kiyohara eth1_config();
1243 1.16 kiyohara }
1244 1.21 kiyohara
1245 1.21 kiyohara #elif defined(DUOVERO)
1246 1.21 kiyohara
1247 1.21 kiyohara static void
1248 1.21 kiyohara ehci_config(void)
1249 1.21 kiyohara {
1250 1.21 kiyohara uint32_t val;
1251 1.21 kiyohara
1252 1.21 kiyohara #define SCRM_ALTCLKSRC 0xa110
1253 1.21 kiyohara #define ALTCLKSRC_ENABLE_EXT (1 << 3)
1254 1.21 kiyohara #define ALTCLKSRC_ENABLE_INT (1 << 2)
1255 1.21 kiyohara #define ALTCLKSRC_MODE_MASK (3 << 0)
1256 1.21 kiyohara #define ALTCLKSRC_MODE_POWERDOWN (0 << 0)
1257 1.21 kiyohara #define ALTCLKSRC_MODE_ACTIVE (1 << 0)
1258 1.21 kiyohara #define ALTCLKSRC_MODE_BYPASS (2 << 0)
1259 1.21 kiyohara #define SCRM_AUXCLK3 0xa31c
1260 1.21 kiyohara #define AUXCLK3_CLKDIV(n) (((n) - 1) << 16)
1261 1.21 kiyohara #define AUXCLK3_CLKDIV_MASK (0xf << 16)
1262 1.21 kiyohara #define AUXCLK3_ENABLE (1 << 8)
1263 1.21 kiyohara #define AUXCLK3_SRCSELECT_MASK (3 << 1)
1264 1.21 kiyohara #define AUXCLK3_SRCSELECT_SYSCLK (0 << 1)
1265 1.21 kiyohara #define AUXCLK3_SRCSELECT_CORE (1 << 1)
1266 1.21 kiyohara #define AUXCLK3_SRCSELECT_PERDPLL (2 << 1)
1267 1.21 kiyohara #define AUXCLK3_SRCSELECT_ALTCLK (3 << 1)
1268 1.21 kiyohara #define AUXCLK3_POLARITY_LOW (0 << 0)
1269 1.21 kiyohara #define AUXCLK3_POLARITY_HIGH (1 << 0)
1270 1.21 kiyohara
1271 1.21 kiyohara /* Use the 1/2 auxiliary clock #3 of system clock. */
1272 1.21 kiyohara val = ioreg_read(DUOVERO_L4_WAKEUP_VBASE + SCRM_AUXCLK3);
1273 1.21 kiyohara val &= ~(AUXCLK3_CLKDIV_MASK | AUXCLK3_SRCSELECT_MASK);
1274 1.21 kiyohara val |= (AUXCLK3_CLKDIV(2) | AUXCLK3_ENABLE | AUXCLK3_SRCSELECT_SYSCLK);
1275 1.21 kiyohara ioreg_write(DUOVERO_L4_WAKEUP_VBASE + SCRM_AUXCLK3, val);
1276 1.21 kiyohara
1277 1.21 kiyohara val = ioreg_read(DUOVERO_L4_WAKEUP_VBASE + SCRM_ALTCLKSRC);
1278 1.21 kiyohara val &= ~ALTCLKSRC_MODE_MASK;
1279 1.21 kiyohara val |= ALTCLKSRC_MODE_ACTIVE;
1280 1.21 kiyohara val |= (ALTCLKSRC_ENABLE_EXT | ALTCLKSRC_ENABLE_INT);
1281 1.21 kiyohara ioreg_write(DUOVERO_L4_WAKEUP_VBASE + SCRM_ALTCLKSRC, val);
1282 1.21 kiyohara }
1283 1.21 kiyohara
1284 1.21 kiyohara static void
1285 1.21 kiyohara parlor_config(void)
1286 1.21 kiyohara {
1287 1.21 kiyohara #if 0
1288 1.21 kiyohara static const struct omap_mux_conf parlor_mux_40pin_header_conf[] = {
1289 1.21 kiyohara /*
1290 1.21 kiyohara * 1: GND
1291 1.21 kiyohara * 2: GND
1292 1.21 kiyohara * 3: MCSPI1_CLK or GPIO 134
1293 1.21 kiyohara * 4: MCSPI1_CS0 or GPIO 137
1294 1.21 kiyohara * 5: MCSPI1_SIMO or GPIO 136
1295 1.21 kiyohara * 6: MCSPI1_CS1 or GPIO 138
1296 1.21 kiyohara * 7: MCSPI1_SOMI or GPIO 135
1297 1.21 kiyohara * 8: MCSPI1_CS2 or GPIO 139
1298 1.21 kiyohara * 9: HDQ_SIO or GPIO 127
1299 1.21 kiyohara * 10: MCSPI1_CS3 or GPIO 140
1300 1.21 kiyohara * 11: SDMMC3_CMD or GPIO ???
1301 1.21 kiyohara * 12: I2C2_SCL or GPIO 128
1302 1.21 kiyohara * 13: SDMMC3_CLK or GPIO ???
1303 1.21 kiyohara * 14: I2C2_SDA or GPIO 129
1304 1.21 kiyohara * 15: UART2_TX or SDMMC3_DAT1 or GPIO 126
1305 1.21 kiyohara * 16: PMIC_PWM2 (TWL6030)
1306 1.21 kiyohara * 17: UART2_RX or SDMMC3_DAT0 or GPIO 125
1307 1.21 kiyohara * 18: PMIC_PWM1 (TWL6030)
1308 1.21 kiyohara * 19: BSP2_CLKX or GPIO 110
1309 1.21 kiyohara * 20: BSP2_FSX or GPIO 113
1310 1.21 kiyohara * 21: BSP2_DX or GPIO 112
1311 1.21 kiyohara * 22: BSP2_DR or GPIO 111
1312 1.21 kiyohara * 23: BSP2_CLKS or GPIO 118
1313 1.21 kiyohara * 24: FREF1
1314 1.21 kiyohara * 25: MCSPI4_SOMI or GPIO 153
1315 1.21 kiyohara * 26: PMIC_NRESWARN
1316 1.21 kiyohara * 27: MCSPI4_SIMO or GPIO 152
1317 1.21 kiyohara * 28: SYSEN
1318 1.21 kiyohara * 29: MCSPI4_CLK or GPIO 151
1319 1.21 kiyohara * 30: PWRON
1320 1.21 kiyohara * 31: MCSPI4_CS0 or GPIO 154
1321 1.21 kiyohara * 32: REGEN1
1322 1.21 kiyohara * 33: ADCIN3 (TWL6030)
1323 1.21 kiyohara * 34: VCC_1.0
1324 1.21 kiyohara * 35: ADCIN4_VREF (TWL6030)
1325 1.21 kiyohara * 36: VDD_VAUX2
1326 1.21 kiyohara * 37: ADCIN4 (TWL6030)
1327 1.21 kiyohara * 38: VCC_3.3
1328 1.21 kiyohara * 39: ADCIN5 (TWL6030)
1329 1.21 kiyohara * 40: V_BATT_5
1330 1.21 kiyohara */
1331 1.21 kiyohara { -1 }
1332 1.21 kiyohara };
1333 1.21 kiyohara #endif
1334 1.21 kiyohara static const struct omap_mux_conf parlor_mux_mcspi1_conf[] = {
1335 1.21 kiyohara #if 0
1336 1.21 kiyohara { 0x132, /* 3: MCSPI1_CLK */
1337 1.21 kiyohara MUXMODE(0) | ??? },
1338 1.21 kiyohara { 0x138, /* 4: MCSPI1_CS0 */
1339 1.21 kiyohara MUXMODE(0) | ??? },
1340 1.21 kiyohara { 0x136, /* 5: MCSPI1_SIMO */
1341 1.21 kiyohara MUXMODE(0) | ??? },
1342 1.21 kiyohara { 0x13a, /* 6: MCSPI1_CS1 */
1343 1.21 kiyohara MUXMODE(0) | ??? },
1344 1.21 kiyohara { 0x134, /* 7: MCSPI1_SOMI */
1345 1.21 kiyohara MUXMODE(0) | ??? | INPUTENABLE },
1346 1.21 kiyohara { 0x13c, /* 8: MCSPI1_CS2 */
1347 1.21 kiyohara MUXMODE(0) | ??? },
1348 1.21 kiyohara { 0x13e, /* 10: MCSPI1_CS3 */
1349 1.21 kiyohara MUXMODE(0) | ??? },
1350 1.21 kiyohara #endif
1351 1.21 kiyohara { -1 }
1352 1.21 kiyohara };
1353 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_mcspi1_conf[] = {
1354 1.21 kiyohara { 0x132, /* 3: GPIO 134 */
1355 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1356 1.21 kiyohara { 0x138, /* 4: GPIO 137 */
1357 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1358 1.21 kiyohara { 0x136, /* 5: GPIO 136 */
1359 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1360 1.21 kiyohara { 0x13a, /* 6: GPIO 138 */
1361 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1362 1.21 kiyohara { 0x134, /* 7: GPIO 135 */
1363 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1364 1.21 kiyohara { 0x13c, /* 8: GPIO 139 */
1365 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1366 1.21 kiyohara { 0x13e, /* 10: GPIO 140 */
1367 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1368 1.21 kiyohara { -1 }
1369 1.21 kiyohara };
1370 1.21 kiyohara static const struct omap_mux_conf parlor_mux_hdq_conf[] = {
1371 1.21 kiyohara #if 0
1372 1.21 kiyohara { 0x120, /* 9: HDQ_SIO */
1373 1.21 kiyohara MUXMODE(0) | ??? | INPUTENABLE },
1374 1.21 kiyohara #endif
1375 1.21 kiyohara { -1 }
1376 1.21 kiyohara };
1377 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_hdq_conf[] = {
1378 1.21 kiyohara { 0x120, /* 9: GPIO_127 */
1379 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1380 1.21 kiyohara { -1 }
1381 1.21 kiyohara };
1382 1.21 kiyohara static const struct omap_mux_conf parlor_mux_i2c2_conf[] = {
1383 1.21 kiyohara { 0x126, /* 12: I2C2_SCL */
1384 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1385 1.21 kiyohara { 0x128, /* 14: I2C2_SDA */
1386 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1387 1.21 kiyohara { -1 }
1388 1.21 kiyohara };
1389 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_i2c2_conf[] = {
1390 1.21 kiyohara { 0x126, /* 12: GPIO 128 */
1391 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1392 1.21 kiyohara { 0x128, /* 14: GPIO 129 */
1393 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1394 1.21 kiyohara { -1 }
1395 1.21 kiyohara };
1396 1.21 kiyohara static const struct omap_mux_conf parlor_mux_sdmmc3_conf[] = {
1397 1.21 kiyohara #if 0
1398 1.21 kiyohara 11 SDMMC3_CMD DuoVero J2 A15 <- omap pin AG10
1399 1.21 kiyohara MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1400 1.21 kiyohara 13 SDMMC3_CLK DuoVero J2 A16 <- omap pin AE9
1401 1.21 kiyohara MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1402 1.21 kiyohara #endif
1403 1.21 kiyohara { 0x11c, /* 17: SDMMC3_DAT0 */
1404 1.21 kiyohara MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1405 1.21 kiyohara { 0x11e, /* 15: SDMMC3_DAT1 */
1406 1.21 kiyohara MUXMODE(1) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1407 1.21 kiyohara { -1 }
1408 1.21 kiyohara };
1409 1.21 kiyohara static const struct omap_mux_conf parlor_mux_uart2_conf[] = {
1410 1.21 kiyohara { 0x11c, /* 17: UART2_RX */
1411 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1412 1.21 kiyohara { 0x11e,
1413 1.21 kiyohara MUXMODE(0) | PULLUDENABLE }, /* 15: UART2_TX */
1414 1.21 kiyohara { -1 }
1415 1.21 kiyohara };
1416 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_uart2_conf[] = {
1417 1.21 kiyohara { 0x11c, /* 17: GPIO 125 */
1418 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1419 1.21 kiyohara { 0x11e, /* 15: GPIO 126 */
1420 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1421 1.21 kiyohara { -1 }
1422 1.21 kiyohara };
1423 1.21 kiyohara static const struct omap_mux_conf parlor_mux_bsp2_conf[] = {
1424 1.21 kiyohara { 0x0f6, /* 19: BSP2_CLKX */
1425 1.21 kiyohara MUXMODE(0) | INPUTENABLE },
1426 1.21 kiyohara { 0x0fc, /* 20: BSP2_FSX */
1427 1.21 kiyohara MUXMODE(0) | INPUTENABLE },
1428 1.21 kiyohara { 0x0fa, /* 21: BSP2_DX */
1429 1.21 kiyohara MUXMODE(0) | PULLUDENABLE },
1430 1.21 kiyohara { 0x0f8, /* 22: BSP2_DR */
1431 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | INPUTENABLE },
1432 1.21 kiyohara { 0x10e, /* 23: BSP2_CLKS */
1433 1.21 kiyohara MUXMODE(0) | PULLUDENABLE | INPUTENABLE },
1434 1.21 kiyohara { -1 }
1435 1.21 kiyohara };
1436 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_bsp2_conf[] = {
1437 1.21 kiyohara { 0x0f6, /* 19: GPIO 110 */
1438 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1439 1.21 kiyohara { 0x0fc, /* 20: GPIO 113 */
1440 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1441 1.21 kiyohara { 0x0fa, /* 21: GPIO 112 */
1442 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1443 1.21 kiyohara { 0x0f8, /* 22: GPIO 111 */
1444 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1445 1.21 kiyohara { 0x10e, /* 23: GPIO 118 */
1446 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1447 1.21 kiyohara { -1 }
1448 1.21 kiyohara };
1449 1.21 kiyohara static const struct omap_mux_conf parlor_mux_mcspi4_conf[] = {
1450 1.21 kiyohara #if 0
1451 1.21 kiyohara { 0x158, /* 25: MCSPI4_SOMI */
1452 1.21 kiyohara MUXMODE(0) | ??? | INPUTENABLE },
1453 1.21 kiyohara { 0x156, /* 27: MCSPI4_SIMO */
1454 1.21 kiyohara MUXMODE(0) | ??? },
1455 1.21 kiyohara { 0x154, /* 29: MCSPI4_CLK */
1456 1.21 kiyohara MUXMODE(0) | ??? },
1457 1.21 kiyohara { 0x15a, /* 31: MCSPI4_CS0 */
1458 1.21 kiyohara MUXMODE(0) | ??? },
1459 1.21 kiyohara #endif
1460 1.21 kiyohara { -1 }
1461 1.21 kiyohara };
1462 1.21 kiyohara static const struct omap_mux_conf parlor_mux_no_mcspi4_conf[] = {
1463 1.21 kiyohara { 0x158, /* 25: GPIO 153 */
1464 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1465 1.21 kiyohara { 0x156, /* 27: GPIO 152 */
1466 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1467 1.21 kiyohara { 0x154, /* 29: GPIO 151 */
1468 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1469 1.21 kiyohara { 0x15a, /* 31: GPIO 154 */
1470 1.21 kiyohara MUXMODE(3) | PULLUDENABLE | PULLTYPESELECT | INPUTENABLE },
1471 1.21 kiyohara { -1 }
1472 1.21 kiyohara };
1473 1.21 kiyohara
1474 1.21 kiyohara /*
1475 1.21 kiyohara * ETH0 connects via CS5. It use GPIO 44 for IRQ.
1476 1.21 kiyohara * Also GPIO 45 is NRESET.
1477 1.21 kiyohara */
1478 1.21 kiyohara smsh_config(NULL, 44, 45);
1479 1.21 kiyohara
1480 1.21 kiyohara ehci_config();
1481 1.21 kiyohara
1482 1.21 kiyohara gxio_omap_mux_config_address("mcspi", 0x48098000,
1483 1.21 kiyohara parlor_mux_mcspi1_conf, parlor_mux_no_mcspi1_conf);
1484 1.21 kiyohara gxio_omap_mux_config_address("hdq", 0x480b2000,
1485 1.21 kiyohara parlor_mux_hdq_conf, parlor_mux_no_hdq_conf);
1486 1.21 kiyohara gxio_omap_mux_config_address("tiiic", 0x48072000,
1487 1.21 kiyohara parlor_mux_i2c2_conf, parlor_mux_no_i2c2_conf);
1488 1.21 kiyohara if (gxio_omap_mux_config_address("sdhc", 0x480ad000,
1489 1.21 kiyohara parlor_mux_sdmmc3_conf, NULL) != 0)
1490 1.21 kiyohara gxio_omap_mux_config_address("com", 0x4806c000,
1491 1.21 kiyohara parlor_mux_uart2_conf, parlor_mux_no_uart2_conf);
1492 1.21 kiyohara gxio_omap_mux_config_address("mcbsp", 0x49024000,
1493 1.21 kiyohara parlor_mux_bsp2_conf, parlor_mux_no_bsp2_conf);
1494 1.21 kiyohara gxio_omap_mux_config_address("mcspi", 0x480ba000,
1495 1.21 kiyohara parlor_mux_mcspi4_conf, parlor_mux_no_mcspi4_conf);
1496 1.21 kiyohara }
1497 1.21 kiyohara
1498 1.21 kiyohara #elif defined(PEPPER)
1499 1.21 kiyohara
1500 1.21 kiyohara static void
1501 1.21 kiyohara lcd_config(void)
1502 1.21 kiyohara {
1503 1.21 kiyohara static const struct tifb_panel_info panel_lcd = {
1504 1.21 kiyohara .panel_tft = 1,
1505 1.21 kiyohara .panel_mono = false,
1506 1.21 kiyohara .panel_bpp = 24,
1507 1.21 kiyohara
1508 1.21 kiyohara .panel_pxl_clk = 18400000,
1509 1.21 kiyohara .panel_width = 480,
1510 1.21 kiyohara .panel_height = 272,
1511 1.21 kiyohara .panel_hfp = 8,
1512 1.21 kiyohara .panel_hbp = 4,
1513 1.21 kiyohara .panel_hsw = 41,
1514 1.21 kiyohara .panel_vfp = 4,
1515 1.21 kiyohara .panel_vbp = 2,
1516 1.21 kiyohara .panel_vsw = 10,
1517 1.21 kiyohara .panel_invert_hsync = 0,
1518 1.21 kiyohara .panel_invert_vsync = 0,
1519 1.21 kiyohara
1520 1.21 kiyohara .panel_ac_bias = 255,
1521 1.21 kiyohara .panel_ac_bias_intrpt = 0,
1522 1.21 kiyohara .panel_dma_burst_sz = 16,
1523 1.21 kiyohara .panel_fdd = 0x80,
1524 1.21 kiyohara .panel_sync_edge = 0,
1525 1.21 kiyohara .panel_sync_ctrl = 1,
1526 1.21 kiyohara .panel_tft_alt_mode = 0,
1527 1.21 kiyohara .panel_invert_pxl_clk = 0,
1528 1.21 kiyohara };
1529 1.21 kiyohara static const struct omap_mux_conf pepper_mux_lcd_conf[] = {
1530 1.21 kiyohara /*
1531 1.21 kiyohara * LCD_DATA[0-23] configures in tifb.c
1532 1.21 kiyohara */
1533 1.21 kiyohara
1534 1.21 kiyohara { 0x8e0, MMODE(0) | PUDEN }, /* LCD_VSYNC */
1535 1.21 kiyohara { 0x8e4, MMODE(0) | PUDEN }, /* LCD_HSYNC */
1536 1.21 kiyohara { 0x8e8, MMODE(0) | PUDEN }, /* LCD_PCLK */
1537 1.21 kiyohara { 0x8ec, MMODE(0) | PUDEN }, /* LCD_AC_BIAS_EN */
1538 1.21 kiyohara
1539 1.21 kiyohara { 0x86c, MMODE(7) | PUTYPESEL }, /* GPIO 59: Enable */
1540 1.21 kiyohara { -1 }
1541 1.21 kiyohara };
1542 1.21 kiyohara
1543 1.21 kiyohara if (gxio_omap_mux_config_address("tifb", 0x4830e000,
1544 1.21 kiyohara pepper_mux_lcd_conf, NULL) == 0) {
1545 1.21 kiyohara extern const struct tifb_panel_info *tifb_panel_info;
1546 1.21 kiyohara extern bool use_tps65217_wled;
1547 1.21 kiyohara
1548 1.21 kiyohara tifb_panel_info = &panel_lcd;
1549 1.21 kiyohara use_tps65217_wled = true;
1550 1.21 kiyohara }
1551 1.21 kiyohara }
1552 1.21 kiyohara
1553 1.21 kiyohara static void
1554 1.21 kiyohara pepper43_config(void)
1555 1.21 kiyohara {
1556 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_wilink8_conf[] = {
1557 1.21 kiyohara /* TI WiLink 8 */
1558 1.21 kiyohara { 0x800, MMODE(7) | PUTYPESEL }, /* GPIO 32: Bluetooth */
1559 1.21 kiyohara { 0x804, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 33: irq */
1560 1.21 kiyohara { 0x860, MMODE(7) | PUTYPESEL }, /* GPIO 56: WiFi */
1561 1.21 kiyohara { -1 }
1562 1.21 kiyohara };
1563 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_i2c1_conf[] = {
1564 1.21 kiyohara { 0x968, MMODE(3) | PUTYPESEL | RXACTIVE }, /* I2C1_SDA */
1565 1.21 kiyohara { 0x96c, MMODE(3) | PUTYPESEL | RXACTIVE }, /* I2C1_SCL */
1566 1.21 kiyohara { -1 }
1567 1.21 kiyohara };
1568 1.21 kiyohara static const struct omap_mux_conf pepper43_mpu9150_conf[] = {
1569 1.21 kiyohara /* MPU9150 at I2C1 */
1570 1.21 kiyohara { 0x808, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 34: IRQ */
1571 1.21 kiyohara { 0x898, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 68 */
1572 1.21 kiyohara { 0x870, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 30 */
1573 1.21 kiyohara { -1 }
1574 1.21 kiyohara };
1575 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_20pin_header_conf[] = {
1576 1.21 kiyohara { 0x85c, MMODE(7) | PUDEN | RXACTIVE }, /* 1: GPIO 55 */
1577 1.21 kiyohara { 0x80c, MMODE(7) | PUDEN | RXACTIVE }, /* 2: GPIO 35 */
1578 1.21 kiyohara { 0x810, MMODE(7) | PUDEN | RXACTIVE }, /* 3: GPIO 36 */
1579 1.21 kiyohara { 0x814, MMODE(7) | PUDEN | RXACTIVE }, /* 4: GPIO 37 */
1580 1.21 kiyohara { 0x818, MMODE(7) | PUDEN | RXACTIVE }, /* 5: GPIO 38 */
1581 1.21 kiyohara { 0x81c, MMODE(7) | PUDEN | RXACTIVE }, /* 6: GPIO 39 */
1582 1.21 kiyohara { 0x87c, MMODE(7) | PUDEN | RXACTIVE }, /* 7: GPIO 61 */
1583 1.21 kiyohara { 0x880, MMODE(7) | PUDEN | RXACTIVE }, /* 8: GPIO 62 */
1584 1.21 kiyohara { 0x884, MMODE(7) | PUDEN | RXACTIVE }, /* 9: GPIO 63 */
1585 1.21 kiyohara { 0x9e4, MMODE(7) | PUDEN | RXACTIVE }, /* 10: GPIO 103 */
1586 1.21 kiyohara { 0x9e8, MMODE(7) | PUDEN | RXACTIVE }, /* 11: GPIO 104 */
1587 1.21 kiyohara { 0x9b0, MMODE(7) | PUDEN | RXACTIVE }, /* 12: GPIO 19 */
1588 1.21 kiyohara #if 0 /* UART3 or GPIO */
1589 1.21 kiyohara { 0x964, MMODE(7) | PUDEN | RXACTIVE }, /* 13: GPIO 7 */
1590 1.21 kiyohara { 0x960, MMODE(7) | PUDEN | RXACTIVE }, /* 14: GPIO 6 */
1591 1.21 kiyohara #endif
1592 1.21 kiyohara #if 0 /* UART2 or GPIO */
1593 1.21 kiyohara { 0x910, MMODE(7) | PUDEN | RXACTIVE }, /* 15: GPIO 98 */
1594 1.21 kiyohara { 0x90c, MMODE(7) | PUDEN | RXACTIVE }, /* 16: GPIO 97 */
1595 1.21 kiyohara #endif
1596 1.21 kiyohara /* 17: VCC 5v */
1597 1.21 kiyohara /* 18: VCC 3.3v */
1598 1.21 kiyohara /* 19: GND */
1599 1.21 kiyohara /* 20: GND */
1600 1.21 kiyohara { -1 }
1601 1.21 kiyohara };
1602 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_uart2_conf[] = {
1603 1.21 kiyohara { 0x90c, MMODE(6) | PUTYPESEL | RXACTIVE }, /* UART2_RXD */
1604 1.21 kiyohara { 0x910, MMODE(6) | PUDEN }, /* UART2_TXD */
1605 1.21 kiyohara { -1 }
1606 1.21 kiyohara };
1607 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_no_uart2_conf[] = {
1608 1.21 kiyohara { 0x90c, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 97 */
1609 1.21 kiyohara { 0x910, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 98 */
1610 1.21 kiyohara { -1 }
1611 1.21 kiyohara };
1612 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_uart3_conf[] = {
1613 1.21 kiyohara { 0x960, MMODE(1) | PUTYPESEL | RXACTIVE }, /* UART3_RXD */
1614 1.21 kiyohara { 0x964, MMODE(1) | PUDEN }, /* UART3_TXD */
1615 1.21 kiyohara { -1 }
1616 1.21 kiyohara };
1617 1.21 kiyohara static const struct omap_mux_conf pepper43_mux_no_uart3_conf[] = {
1618 1.21 kiyohara { 0x960, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 6 */
1619 1.21 kiyohara { 0x964, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 7 */
1620 1.21 kiyohara { -1 }
1621 1.21 kiyohara };
1622 1.21 kiyohara
1623 1.21 kiyohara static const struct omap_mux_conf *pepper43_mux_conf[] = {
1624 1.21 kiyohara pepper43_mux_wilink8_conf,
1625 1.21 kiyohara pepper43_mux_i2c1_conf,
1626 1.21 kiyohara pepper43_mpu9150_conf,
1627 1.21 kiyohara pepper43_mux_20pin_header_conf,
1628 1.21 kiyohara };
1629 1.21 kiyohara
1630 1.21 kiyohara static const struct omap_gpio_conf pepper43_gpio_wl18xx_conf[] = {
1631 1.21 kiyohara { 32, conf_output_0 }, /* #Reset: Bluetooth */
1632 1.21 kiyohara { 56, conf_output_0 }, /* #Reset: WiFi */
1633 1.21 kiyohara { -1 }
1634 1.21 kiyohara };
1635 1.21 kiyohara int i;
1636 1.21 kiyohara
1637 1.21 kiyohara lcd_config();
1638 1.21 kiyohara
1639 1.21 kiyohara for (i = 0; i < __arraycount(pepper43_mux_conf); i++)
1640 1.21 kiyohara gxio_omap_mux_config(pepper43_mux_conf[i]);
1641 1.21 kiyohara gxio_omap_gpio_config(pepper43_gpio_wl18xx_conf);
1642 1.21 kiyohara
1643 1.21 kiyohara #if 0
1644 1.21 kiyohara ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_OE, /* GPIO 52 (Blue) */
1645 1.21 kiyohara ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_OE) & ~(1 << 20));
1646 1.21 kiyohara ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT,
1647 1.21 kiyohara ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT) | (1 << 20));
1648 1.21 kiyohara ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_OE, /* GPIO 53 (Red) */
1649 1.21 kiyohara ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_OE) & ~(1 << 21));
1650 1.21 kiyohara ioreg_write(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT,
1651 1.21 kiyohara ioreg_read(gpio1_base + GPIO_SIZE2 + GPIO_DATAOUT) | (1 << 21));
1652 1.21 kiyohara #endif
1653 1.21 kiyohara
1654 1.21 kiyohara gxio_omap_mux_config_address("com", 0x48024000,
1655 1.21 kiyohara pepper43_mux_uart2_conf, pepper43_mux_no_uart2_conf);
1656 1.21 kiyohara gxio_omap_mux_config_address("com", 0x481a6000,
1657 1.21 kiyohara pepper43_mux_uart3_conf, pepper43_mux_no_uart3_conf);
1658 1.21 kiyohara }
1659 1.21 kiyohara
1660 1.21 kiyohara static void
1661 1.21 kiyohara pepper_config(void)
1662 1.21 kiyohara {
1663 1.21 kiyohara static const struct omap_mux_conf pepper_mux_button2_conf[] = {
1664 1.21 kiyohara { 0x85c, MMODE(7) | PUTYPESEL | RXACTIVE }, /* GPIO 55 */
1665 1.21 kiyohara { -1 }
1666 1.21 kiyohara };
1667 1.21 kiyohara static const struct omap_mux_conf pepper_mux_i2c1_conf[] = {
1668 1.21 kiyohara { 0x90c, MMODE(3) | PUTYPESEL | RXACTIVE }, /* I2C1_SDA */
1669 1.21 kiyohara { 0x910, MMODE(3) | PUTYPESEL | RXACTIVE }, /* I2C1_SCL */
1670 1.21 kiyohara { -1 }
1671 1.21 kiyohara };
1672 1.21 kiyohara static const struct omap_mux_conf pepper_mux_wi2wi_conf[] = {
1673 1.21 kiyohara { 0x9b4, MMODE(3) | PUDEN }, /* CLKOUT2 */
1674 1.21 kiyohara /* Wi2Wi */
1675 1.21 kiyohara { 0x860, MMODE(7) | PUTYPESEL }, /* GPIO 56: nReset */
1676 1.21 kiyohara { 0x870, MMODE(7) | PUTYPESEL }, /* GPIO 30: nPower */
1677 1.21 kiyohara { -1 }
1678 1.21 kiyohara };
1679 1.21 kiyohara static const struct omap_mux_conf pepper_mux_uart1_conf[] = {
1680 1.21 kiyohara { 0x978, MMODE(0) | PUTYPESEL | RXACTIVE }, /* UART1_CTSn */
1681 1.21 kiyohara { 0x97c, MMODE(0) }, /* UART1_RTSn */
1682 1.21 kiyohara { 0x980, MMODE(0) | PUTYPESEL | RXACTIVE }, /* UART1_RXD */
1683 1.21 kiyohara { 0x984, MMODE(0) }, /* UART1_TXD */
1684 1.21 kiyohara { -1 }
1685 1.21 kiyohara };
1686 1.21 kiyohara static const struct omap_mux_conf pepper_mux_no_uart1_conf[] = {
1687 1.21 kiyohara { 0x978, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 12 */
1688 1.21 kiyohara { 0x97c, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 13 */
1689 1.21 kiyohara { 0x980, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 14 */
1690 1.21 kiyohara { 0x984, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 15 */
1691 1.21 kiyohara { -1 }
1692 1.21 kiyohara };
1693 1.21 kiyohara static const struct omap_mux_conf *pepper_mux_conf[] = {
1694 1.21 kiyohara pepper_mux_button2_conf,
1695 1.21 kiyohara pepper_mux_i2c1_conf,
1696 1.21 kiyohara pepper_mux_wi2wi_conf,
1697 1.21 kiyohara };
1698 1.21 kiyohara
1699 1.21 kiyohara int i;
1700 1.21 kiyohara
1701 1.21 kiyohara lcd_config();
1702 1.21 kiyohara
1703 1.21 kiyohara for (i = 0; i < __arraycount(pepper_mux_conf); i++)
1704 1.21 kiyohara gxio_omap_mux_config(pepper_mux_conf[i]);
1705 1.21 kiyohara gxio_omap_mux_config_address("com", 0x48022000,
1706 1.21 kiyohara pepper_mux_uart1_conf, pepper_mux_no_uart1_conf);
1707 1.21 kiyohara }
1708 1.21 kiyohara
1709 1.21 kiyohara static void
1710 1.21 kiyohara c_config(void)
1711 1.21 kiyohara {
1712 1.21 kiyohara static const struct omap_mux_conf pepper43c_mux_ft5306_conf[] = {
1713 1.21 kiyohara /* FT5306 at I2C2 */
1714 1.21 kiyohara { 0x9b4, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 20 */
1715 1.21 kiyohara { 0x95c, MMODE(7) | PUDEN }, /* GPIO 5 */
1716 1.21 kiyohara { -1 }
1717 1.21 kiyohara };
1718 1.21 kiyohara static const struct omap_mux_conf pepper43c_mux_i2c2_conf[] = {
1719 1.21 kiyohara { 0x950, MMODE(2) | PUTYPESEL | RXACTIVE }, /* I2C2_SDA */
1720 1.21 kiyohara { 0x954, MMODE(2) | PUTYPESEL | RXACTIVE }, /* I2C2_SCL */
1721 1.21 kiyohara { -1 }
1722 1.21 kiyohara };
1723 1.21 kiyohara static const struct omap_mux_conf *pepper43c_mux_conf[] = {
1724 1.21 kiyohara pepper43c_mux_ft5306_conf,
1725 1.21 kiyohara pepper43c_mux_i2c2_conf,
1726 1.21 kiyohara };
1727 1.21 kiyohara
1728 1.21 kiyohara static const struct omap_gpio_conf pepper43c_gpio_ft5306_conf[] = {
1729 1.21 kiyohara { 5, conf_output_0 }, /* #Reset */
1730 1.21 kiyohara { -1 }
1731 1.21 kiyohara };
1732 1.21 kiyohara int i;
1733 1.21 kiyohara
1734 1.21 kiyohara pepper43_config();
1735 1.21 kiyohara
1736 1.21 kiyohara for (i = 0; i < __arraycount(pepper43c_mux_conf); i++)
1737 1.21 kiyohara gxio_omap_mux_config(pepper43c_mux_conf[i]);
1738 1.21 kiyohara gxio_omap_gpio_config(pepper43c_gpio_ft5306_conf);
1739 1.21 kiyohara }
1740 1.21 kiyohara
1741 1.21 kiyohara static void
1742 1.21 kiyohara dvi_config(void)
1743 1.21 kiyohara {
1744 1.21 kiyohara /* XXXX: hmm... mismatch found in Linux's dts and pubs.gumstix.org... */
1745 1.21 kiyohara
1746 1.21 kiyohara extern struct cfdata cfdata[];
1747 1.21 kiyohara extern const struct tifb_panel_info *tifb_panel_info;
1748 1.21 kiyohara
1749 1.21 kiyohara static const struct tifb_panel_info panel_dvi = {
1750 1.21 kiyohara .panel_tft = 1,
1751 1.21 kiyohara .panel_mono = false,
1752 1.21 kiyohara .panel_bpp = 16,
1753 1.21 kiyohara
1754 1.21 kiyohara .panel_pxl_clk = 63500000,
1755 1.21 kiyohara .panel_width = 1024,
1756 1.21 kiyohara .panel_height = 768,
1757 1.21 kiyohara .panel_hfp = 8,
1758 1.21 kiyohara .panel_hbp = 4,
1759 1.21 kiyohara .panel_hsw = 41,
1760 1.21 kiyohara .panel_vfp = 4,
1761 1.21 kiyohara .panel_vbp = 2,
1762 1.21 kiyohara .panel_vsw = 10,
1763 1.21 kiyohara .panel_invert_hsync = 0,
1764 1.21 kiyohara .panel_invert_vsync = 0,
1765 1.21 kiyohara
1766 1.21 kiyohara .panel_ac_bias = 255,
1767 1.21 kiyohara .panel_ac_bias_intrpt = 0,
1768 1.21 kiyohara .panel_dma_burst_sz = 16,
1769 1.21 kiyohara .panel_fdd = 0x80,
1770 1.21 kiyohara .panel_sync_edge = 0,
1771 1.21 kiyohara .panel_sync_ctrl = 1,
1772 1.21 kiyohara .panel_invert_pxl_clk = 0,
1773 1.21 kiyohara };
1774 1.21 kiyohara cfdata_t cf = &cfdata[0];
1775 1.21 kiyohara
1776 1.21 kiyohara /* Disable wireless module. */
1777 1.21 kiyohara while (cf->cf_name != NULL) {
1778 1.21 kiyohara if (strcmp(cf->cf_name, "sdhc") == 0 &&
1779 1.21 kiyohara strcmp(cf->cf_atname, "mainbus") == 0 &&
1780 1.21 kiyohara cf->cf_loc[MAINBUSCF_BASE] == 0x47810000) {
1781 1.21 kiyohara if (cf->cf_fstate == FSTATE_NOTFOUND)
1782 1.21 kiyohara cf->cf_fstate = FSTATE_DNOTFOUND;
1783 1.21 kiyohara else if (cf->cf_fstate == FSTATE_STAR)
1784 1.21 kiyohara cf->cf_fstate = FSTATE_DSTAR;
1785 1.21 kiyohara }
1786 1.21 kiyohara cf++;
1787 1.21 kiyohara }
1788 1.21 kiyohara
1789 1.21 kiyohara tifb_panel_info = &panel_dvi;
1790 1.21 kiyohara }
1791 1.21 kiyohara
1792 1.21 kiyohara static void
1793 1.21 kiyohara r_config(void)
1794 1.21 kiyohara {
1795 1.21 kiyohara static const struct omap_mux_conf pepper43r_mux_ads7846_conf[] = {
1796 1.21 kiyohara /* ADS7846 at McSPI0 */
1797 1.21 kiyohara { 0x9b4, MMODE(7) | PUDEN | RXACTIVE }, /* GPIO 20: IRQ */
1798 1.21 kiyohara { -1 }
1799 1.21 kiyohara };
1800 1.21 kiyohara static const struct omap_mux_conf pepper43r_mux_spi0_conf[] = {
1801 1.21 kiyohara { 0x950, MMODE(0) | PUTYPESEL | RXACTIVE }, /* SPI0_SCLK */
1802 1.21 kiyohara { 0x954, MMODE(0) | PUTYPESEL | RXACTIVE }, /* SPI0_D0 */
1803 1.21 kiyohara { 0x958, MMODE(0) | PUTYPESEL | RXACTIVE }, /* SPI0_D1 */
1804 1.21 kiyohara { 0x95c, MMODE(0) | PUTYPESEL | RXACTIVE }, /* SPI0_CS0 */
1805 1.21 kiyohara { -1 }
1806 1.21 kiyohara };
1807 1.21 kiyohara static const struct omap_mux_conf *pepper43r_mux_conf[] = {
1808 1.21 kiyohara pepper43r_mux_ads7846_conf,
1809 1.21 kiyohara pepper43r_mux_spi0_conf,
1810 1.21 kiyohara };
1811 1.21 kiyohara int i;
1812 1.21 kiyohara
1813 1.21 kiyohara pepper43_config();
1814 1.21 kiyohara
1815 1.21 kiyohara for (i = 0; i < __arraycount(pepper43r_mux_conf); i++)
1816 1.21 kiyohara gxio_omap_mux_config(pepper43r_mux_conf[i]);
1817 1.21 kiyohara }
1818 1.21 kiyohara
1819 1.21 kiyohara #endif
1820 1.21 kiyohara
1821 1.21 kiyohara #if defined(OVERO) || defined(DUOVERO)
1822 1.21 kiyohara static void
1823 1.21 kiyohara smsh_config(struct omap_mux_conf *smsh_mux_conf, int intr, int nreset)
1824 1.21 kiyohara {
1825 1.21 kiyohara struct omap_gpio_conf smsh_gpio_conf[] = {
1826 1.21 kiyohara { intr, conf_input },
1827 1.21 kiyohara { nreset, conf_output_0 },
1828 1.21 kiyohara { -1 }
1829 1.21 kiyohara };
1830 1.21 kiyohara
1831 1.21 kiyohara /*
1832 1.21 kiyohara * Basically use current settings by U-Boot.
1833 1.21 kiyohara * However remap physical address to configured address.
1834 1.21 kiyohara */
1835 1.21 kiyohara
1836 1.21 kiyohara if (smsh_mux_conf != NULL)
1837 1.21 kiyohara gxio_omap_mux_config(smsh_mux_conf);
1838 1.21 kiyohara gxio_omap_gpio_config(smsh_gpio_conf);
1839 1.21 kiyohara __udelay(100000);
1840 1.21 kiyohara gxio_omap_gpio_write(nreset, 1);
1841 1.21 kiyohara }
1842 1.21 kiyohara #endif
1843 1.21 kiyohara
1844 1.21 kiyohara #if defined(OVERO) || defined(DUOVERO) || defined(PEPPER)
1845 1.21 kiyohara /*
1846 1.21 kiyohara * The delay for configuration time.
1847 1.21 kiyohara * This function use initialized timer by U-Boot.
1848 1.21 kiyohara */
1849 1.21 kiyohara static void
1850 1.21 kiyohara __udelay(unsigned int usec)
1851 1.21 kiyohara {
1852 1.21 kiyohara #if defined(OVERO) || defined(DUOVERO)
1853 1.21 kiyohara #define V_SCLK (26000000 >> 1)
1854 1.21 kiyohara #define TCRR 0x28
1855 1.21 kiyohara #elif defined(PEPPER)
1856 1.21 kiyohara #define V_SCLK 24000000
1857 1.21 kiyohara #define TCRR 0x3c
1858 1.21 kiyohara #endif
1859 1.21 kiyohara #define SYS_PTV 2
1860 1.21 kiyohara #define TIMER_CLOCK (V_SCLK / (2 << SYS_PTV))
1861 1.21 kiyohara
1862 1.21 kiyohara const vaddr_t timer_base =
1863 1.21 kiyohara #if defined(OVERO)
1864 1.21 kiyohara OVERO_L4_PERIPHERAL_VBASE + 0x32000;
1865 1.21 kiyohara #elif defined(DUOVERO)
1866 1.21 kiyohara DUOVERO_L4_PERIPHERAL_VBASE + 0x32000;
1867 1.21 kiyohara #elif defined(PEPPER)
1868 1.21 kiyohara PEPPER_L4_PERIPHERAL_VBASE + 0x40000;
1869 1.21 kiyohara #endif
1870 1.21 kiyohara long timo = usec * (TIMER_CLOCK / 1000) / 1000;
1871 1.21 kiyohara uint32_t now, last;
1872 1.21 kiyohara
1873 1.21 kiyohara last = ioreg_read(timer_base + TCRR);
1874 1.21 kiyohara while (timo > 0) {
1875 1.21 kiyohara now = ioreg_read(timer_base + TCRR);
1876 1.21 kiyohara if (last > now)
1877 1.21 kiyohara timo -= __BITS(0, 31) - last + now + 1;
1878 1.21 kiyohara else
1879 1.21 kiyohara timo -= now - last;
1880 1.21 kiyohara last = now;
1881 1.21 kiyohara }
1882 1.21 kiyohara }
1883 1.21 kiyohara #endif
1884 1.21 kiyohara
1885 1.21 kiyohara #if defined(PEPPER)
1886 1.21 kiyohara static int
1887 1.21 kiyohara read_i2c_device(const vaddr_t i2c_base, uint16_t sa, uint8_t addr, int len,
1888 1.21 kiyohara uint8_t *buf)
1889 1.21 kiyohara {
1890 1.21 kiyohara uint16_t v;
1891 1.21 kiyohara int aok = 0, cnt = 0;
1892 1.21 kiyohara
1893 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
1894 1.21 kiyohara v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
1895 1.21 kiyohara while (v & I2C_IRQSTATUS_BB) {
1896 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, v);
1897 1.21 kiyohara __udelay(20);
1898 1.21 kiyohara v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
1899 1.21 kiyohara }
1900 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
1901 1.21 kiyohara
1902 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_SA, sa);
1903 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_CNT, sizeof(addr));
1904 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_CON,
1905 1.21 kiyohara I2C_CON_EN | I2C_CON_MST | I2C_CON_TRX | I2C_CON_STP | I2C_CON_STT);
1906 1.21 kiyohara while (1 /*CONSTCOND*/) {
1907 1.21 kiyohara __udelay(20);
1908 1.21 kiyohara v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
1909 1.21 kiyohara if ((v & I2C_IRQSTATUS_XRDY) && aok == 0) {
1910 1.21 kiyohara aok = 1;
1911 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_DATA, addr);
1912 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
1913 1.21 kiyohara I2C_IRQSTATUS_XRDY);
1914 1.21 kiyohara }
1915 1.21 kiyohara if (v & I2C_IRQSTATUS_ARDY) {
1916 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
1917 1.21 kiyohara I2C_IRQSTATUS_ARDY);
1918 1.21 kiyohara break;
1919 1.21 kiyohara }
1920 1.21 kiyohara }
1921 1.21 kiyohara
1922 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_SA, sa);
1923 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_CNT, len);
1924 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_CON,
1925 1.21 kiyohara I2C_CON_EN | I2C_CON_MST | I2C_CON_STP | I2C_CON_STT);
1926 1.21 kiyohara while (1 /*CONSTCOND*/) {
1927 1.21 kiyohara v = ioreg16_read(i2c_base + OMAP2_I2C_IRQSTATUS_RAW);
1928 1.21 kiyohara if (v & I2C_IRQSTATUS_RRDY &&
1929 1.21 kiyohara cnt < len) {
1930 1.21 kiyohara buf[cnt++] = ioreg16_read(i2c_base + OMAP2_I2C_DATA);
1931 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
1932 1.21 kiyohara I2C_IRQSTATUS_RRDY);
1933 1.21 kiyohara }
1934 1.21 kiyohara if (v & I2C_IRQSTATUS_ARDY) {
1935 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS,
1936 1.21 kiyohara I2C_IRQSTATUS_ARDY);
1937 1.21 kiyohara break;
1938 1.21 kiyohara }
1939 1.21 kiyohara }
1940 1.21 kiyohara ioreg16_write(i2c_base + OMAP2_I2C_IRQSTATUS, 0xffff);
1941 1.21 kiyohara return 0;
1942 1.21 kiyohara }
1943 1.15 kiyohara #endif
1944