blob: ed34b61b52f775e3ce3cc660ae93348a5c715bb0 [file] [log] [blame]
Quinn Jensen52c543f2007-07-09 22:06:53 +01001/*
2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/clk.h>
24#include <linux/serial_8250.h>
Mark Brownfe7316b2009-01-15 16:14:30 +000025#include <linux/gpio.h>
26#include <linux/i2c.h>
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +020027#include <linux/irq.h>
Quinn Jensen52c543f2007-07-09 22:06:53 +010028
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/hardware.h>
Quinn Jensen52c543f2007-07-09 22:06:53 +010030#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
Juergen Beisertd0f349f2008-07-05 10:02:50 +020032#include <asm/mach/time.h>
Quinn Jensen52c543f2007-07-09 22:06:53 +010033#include <asm/memory.h>
34#include <asm/mach/map.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010035#include <mach/common.h>
Gilles Chanteperdrix07417942008-09-09 10:19:41 +020036#include <mach/imx-uart.h>
37#include <mach/iomux-mx3.h>
Quinn Jensen52c543f2007-07-09 22:06:53 +010038
Mark Brownfe7316b2009-01-15 16:14:30 +000039#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
40#include <linux/mfd/wm8350/audio.h>
41#include <linux/mfd/wm8350/core.h>
42#include <linux/mfd/wm8350/pmic.h>
43#endif
44
Sascha Hauer2eca0472008-10-17 16:10:38 +020045#include "devices.h"
46
Uwe Kleine-Königccfa7c22010-03-08 17:10:54 +010047/* Base address of PBC controller */
48#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
49/* Offsets for the PBC Controller register */
50
51/* PBC Board interrupt status register */
52#define PBC_INTSTATUS 0x000016
53
54/* PBC Board interrupt current status register */
55#define PBC_INTCURR_STATUS 0x000018
56
57/* PBC Interrupt mask register set address */
58#define PBC_INTMASK_SET 0x00001A
59
60/* PBC Interrupt mask register clear address */
61#define PBC_INTMASK_CLEAR 0x00001C
62
63/* External UART A */
64#define PBC_SC16C652_UARTA 0x010000
65
66/* External UART B */
67#define PBC_SC16C652_UARTB 0x010010
68
69#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)
70#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
71#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
72#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
73
74#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
75#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
76
77#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
78#define EXPIO_INT_XUART_INTB (MXC_EXP_IO_BASE + 11)
79
80#define MXC_MAX_EXP_IO_LINES 16
81/*
82 * This file contains the board-specific initialization routines.
Quinn Jensen52c543f2007-07-09 22:06:53 +010083 */
84
85#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
86/*!
87 * The serial port definition structure.
88 */
89static struct plat_serial8250_port serial_platform_data[] = {
90 {
91 .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTA),
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +010092 .mapbase = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTA),
Quinn Jensen52c543f2007-07-09 22:06:53 +010093 .irq = EXPIO_INT_XUART_INTA,
94 .uartclk = 14745600,
95 .regshift = 0,
96 .iotype = UPIO_MEM,
97 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
98 }, {
99 .membase = (void *)(PBC_BASE_ADDRESS + PBC_SC16C652_UARTB),
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100100 .mapbase = (unsigned long)(MX31_CS4_BASE_ADDR + PBC_SC16C652_UARTB),
Quinn Jensen52c543f2007-07-09 22:06:53 +0100101 .irq = EXPIO_INT_XUART_INTB,
102 .uartclk = 14745600,
103 .regshift = 0,
104 .iotype = UPIO_MEM,
105 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ,
106 },
107 {},
108};
109
110static struct platform_device serial_device = {
111 .name = "serial8250",
112 .id = 0,
113 .dev = {
114 .platform_data = serial_platform_data,
115 },
116};
117
118static int __init mxc_init_extuart(void)
119{
120 return platform_device_register(&serial_device);
121}
122#else
123static inline int mxc_init_extuart(void)
124{
125 return 0;
126}
127#endif
128
Gilles Chanteperdrix07417942008-09-09 10:19:41 +0200129#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
130static struct imxuart_platform_data uart_pdata = {
131 .flags = IMXUART_HAVE_RTSCTS,
132};
133
Mark Brown9070e7a2009-04-13 13:02:36 +0100134static unsigned int uart_pins[] = {
Valentin Longchamp945c10b2009-01-28 15:13:52 +0100135 MX31_PIN_CTS1__CTS1,
136 MX31_PIN_RTS1__RTS1,
137 MX31_PIN_TXD1__TXD1,
138 MX31_PIN_RXD1__RXD1
139};
140
Gilles Chanteperdrix07417942008-09-09 10:19:41 +0200141static inline void mxc_init_imx_uart(void)
142{
Valentin Longchamp945c10b2009-01-28 15:13:52 +0100143 mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0");
Gilles Chanteperdrix07417942008-09-09 10:19:41 +0200144 mxc_register_device(&mxc_uart_device0, &uart_pdata);
145}
146#else /* !SERIAL_IMX */
147static inline void mxc_init_imx_uart(void)
148{
149}
150#endif /* !SERIAL_IMX */
151
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200152static void mx31ads_expio_irq_handler(u32 irq, struct irq_desc *desc)
153{
154 u32 imr_val;
155 u32 int_valid;
156 u32 expio_irq;
157
158 imr_val = __raw_readw(PBC_INTMASK_SET_REG);
159 int_valid = __raw_readw(PBC_INTSTATUS_REG) & imr_val;
160
161 expio_irq = MXC_EXP_IO_BASE;
162 for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
163 if ((int_valid & 1) == 0)
164 continue;
165
166 generic_handle_irq(expio_irq);
167 }
168}
169
170/*
171 * Disable an expio pin's interrupt by setting the bit in the imr.
172 * @param irq an expio virtual irq number
173 */
174static void expio_mask_irq(u32 irq)
175{
176 u32 expio = MXC_IRQ_TO_EXPIO(irq);
177 /* mask the interrupt */
178 __raw_writew(1 << expio, PBC_INTMASK_CLEAR_REG);
179 __raw_readw(PBC_INTMASK_CLEAR_REG);
180}
181
182/*
183 * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
184 * @param irq an expanded io virtual irq number
185 */
186static void expio_ack_irq(u32 irq)
187{
188 u32 expio = MXC_IRQ_TO_EXPIO(irq);
189 /* clear the interrupt status */
190 __raw_writew(1 << expio, PBC_INTSTATUS_REG);
191}
192
193/*
194 * Enable a expio pin's interrupt by clearing the bit in the imr.
195 * @param irq a expio virtual irq number
196 */
197static void expio_unmask_irq(u32 irq)
198{
199 u32 expio = MXC_IRQ_TO_EXPIO(irq);
200 /* unmask the interrupt */
201 __raw_writew(1 << expio, PBC_INTMASK_SET_REG);
202}
203
204static struct irq_chip expio_irq_chip = {
Mark Brownbd02acd2010-01-05 16:05:15 +0000205 .name = "EXPIO(CPLD)",
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200206 .ack = expio_ack_irq,
207 .mask = expio_mask_irq,
208 .unmask = expio_unmask_irq,
209};
210
211static void __init mx31ads_init_expio(void)
212{
213 int i;
214
215 printk(KERN_INFO "MX31ADS EXPIO(CPLD) hardware\n");
216
217 /*
218 * Configure INT line as GPIO input
219 */
Sascha Hauer4f163eb2009-05-06 12:55:50 +0200220 mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO), "expio");
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200221
222 /* disable the interrupt and clear the status */
223 __raw_writew(0xFFFF, PBC_INTMASK_CLEAR_REG);
224 __raw_writew(0xFFFF, PBC_INTSTATUS_REG);
225 for (i = MXC_EXP_IO_BASE; i < (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES);
226 i++) {
227 set_irq_chip(i, &expio_irq_chip);
228 set_irq_handler(i, handle_level_irq);
229 set_irq_flags(i, IRQF_VALID);
230 }
231 set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_HIGH);
232 set_irq_chained_handler(EXPIO_PARENT_INT, mx31ads_expio_irq_handler);
233}
234
Mark Brownfe7316b2009-01-15 16:14:30 +0000235#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
236/* This section defines setup for the Wolfson Microelectronics
237 * 1133-EV1 PMU/audio board. When other PMU boards are supported the
238 * regulator definitions may be shared with them, but for now they can
239 * only be used with this board so would generate warnings about
240 * unused statics and some of the configuration is specific to this
241 * module.
242 */
243
244/* CPU */
245static struct regulator_consumer_supply sw1a_consumers[] = {
246 {
247 .supply = "cpu_vcc",
248 }
249};
250
251static struct regulator_init_data sw1a_data = {
252 .constraints = {
253 .name = "SW1A",
254 .min_uV = 1275000,
255 .max_uV = 1600000,
256 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
257 REGULATOR_CHANGE_MODE,
258 .valid_modes_mask = REGULATOR_MODE_NORMAL |
259 REGULATOR_MODE_FAST,
260 .state_mem = {
261 .uV = 1400000,
262 .mode = REGULATOR_MODE_NORMAL,
263 .enabled = 1,
264 },
265 .initial_state = PM_SUSPEND_MEM,
266 .always_on = 1,
267 .boot_on = 1,
268 },
269 .num_consumer_supplies = ARRAY_SIZE(sw1a_consumers),
270 .consumer_supplies = sw1a_consumers,
271};
272
273/* System IO - High */
274static struct regulator_init_data viohi_data = {
275 .constraints = {
276 .name = "VIOHO",
277 .min_uV = 2800000,
278 .max_uV = 2800000,
279 .state_mem = {
280 .uV = 2800000,
281 .mode = REGULATOR_MODE_NORMAL,
282 .enabled = 1,
283 },
284 .initial_state = PM_SUSPEND_MEM,
285 .always_on = 1,
286 .boot_on = 1,
287 },
288};
289
290/* System IO - Low */
291static struct regulator_init_data violo_data = {
292 .constraints = {
293 .name = "VIOLO",
294 .min_uV = 1800000,
295 .max_uV = 1800000,
296 .state_mem = {
297 .uV = 1800000,
298 .mode = REGULATOR_MODE_NORMAL,
299 .enabled = 1,
300 },
301 .initial_state = PM_SUSPEND_MEM,
302 .always_on = 1,
303 .boot_on = 1,
304 },
305};
306
307/* DDR RAM */
308static struct regulator_init_data sw2a_data = {
309 .constraints = {
310 .name = "SW2A",
311 .min_uV = 1800000,
312 .max_uV = 1800000,
313 .valid_modes_mask = REGULATOR_MODE_NORMAL,
314 .state_mem = {
315 .uV = 1800000,
316 .mode = REGULATOR_MODE_NORMAL,
317 .enabled = 1,
318 },
319 .state_disk = {
320 .mode = REGULATOR_MODE_NORMAL,
321 .enabled = 0,
322 },
323 .always_on = 1,
324 .boot_on = 1,
325 .initial_state = PM_SUSPEND_MEM,
326 },
327};
328
329static struct regulator_init_data ldo1_data = {
330 .constraints = {
331 .name = "VCAM/VMMC1/VMMC2",
332 .min_uV = 2800000,
333 .max_uV = 2800000,
334 .valid_modes_mask = REGULATOR_MODE_NORMAL,
Mark Brownbecc6702010-01-04 18:24:50 +0000335 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
Mark Brownfe7316b2009-01-15 16:14:30 +0000336 .apply_uV = 1,
337 },
338};
339
340static struct regulator_consumer_supply ldo2_consumers[] = {
Mark Brownedc34a92010-01-04 18:24:49 +0000341 { .supply = "AVDD", .dev_name = "1-001a" },
342 { .supply = "HPVDD", .dev_name = "1-001a" },
Mark Brownfe7316b2009-01-15 16:14:30 +0000343};
344
345/* CODEC and SIM */
346static struct regulator_init_data ldo2_data = {
347 .constraints = {
348 .name = "VESIM/VSIM/AVDD",
349 .min_uV = 3300000,
350 .max_uV = 3300000,
351 .valid_modes_mask = REGULATOR_MODE_NORMAL,
Mark Brownbecc6702010-01-04 18:24:50 +0000352 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
Mark Brownfe7316b2009-01-15 16:14:30 +0000353 .apply_uV = 1,
354 },
355 .num_consumer_supplies = ARRAY_SIZE(ldo2_consumers),
356 .consumer_supplies = ldo2_consumers,
357};
358
359/* General */
360static struct regulator_init_data vdig_data = {
361 .constraints = {
362 .name = "VDIG",
363 .min_uV = 1500000,
364 .max_uV = 1500000,
365 .valid_modes_mask = REGULATOR_MODE_NORMAL,
366 .apply_uV = 1,
367 .always_on = 1,
368 .boot_on = 1,
369 },
370};
371
372/* Tranceivers */
373static struct regulator_init_data ldo4_data = {
374 .constraints = {
375 .name = "VRF1/CVDD_2.775",
376 .min_uV = 2500000,
377 .max_uV = 2500000,
378 .valid_modes_mask = REGULATOR_MODE_NORMAL,
379 .apply_uV = 1,
380 .always_on = 1,
381 .boot_on = 1,
382 },
383};
384
385static struct wm8350_led_platform_data wm8350_led_data = {
386 .name = "wm8350:white",
387 .default_trigger = "heartbeat",
388 .max_uA = 27899,
389};
390
391static struct wm8350_audio_platform_data imx32ads_wm8350_setup = {
392 .vmid_discharge_msecs = 1000,
393 .drain_msecs = 30,
394 .cap_discharge_msecs = 700,
395 .vmid_charge_msecs = 700,
396 .vmid_s_curve = WM8350_S_CURVE_SLOW,
397 .dis_out4 = WM8350_DISCHARGE_SLOW,
398 .dis_out3 = WM8350_DISCHARGE_SLOW,
399 .dis_out2 = WM8350_DISCHARGE_SLOW,
400 .dis_out1 = WM8350_DISCHARGE_SLOW,
401 .vroi_out4 = WM8350_TIE_OFF_500R,
402 .vroi_out3 = WM8350_TIE_OFF_500R,
403 .vroi_out2 = WM8350_TIE_OFF_500R,
404 .vroi_out1 = WM8350_TIE_OFF_500R,
405 .vroi_enable = 0,
406 .codec_current_on = WM8350_CODEC_ISEL_1_0,
407 .codec_current_standby = WM8350_CODEC_ISEL_0_5,
408 .codec_current_charge = WM8350_CODEC_ISEL_1_5,
409};
410
411static int mx31_wm8350_init(struct wm8350 *wm8350)
412{
Mark Brownfe7316b2009-01-15 16:14:30 +0000413 wm8350_gpio_config(wm8350, 0, WM8350_GPIO_DIR_IN,
414 WM8350_GPIO0_PWR_ON_IN, WM8350_GPIO_ACTIVE_LOW,
415 WM8350_GPIO_PULL_UP, WM8350_GPIO_INVERT_OFF,
416 WM8350_GPIO_DEBOUNCE_ON);
417
418 wm8350_gpio_config(wm8350, 3, WM8350_GPIO_DIR_IN,
419 WM8350_GPIO3_PWR_OFF_IN, WM8350_GPIO_ACTIVE_HIGH,
420 WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
421 WM8350_GPIO_DEBOUNCE_ON);
422
423 wm8350_gpio_config(wm8350, 4, WM8350_GPIO_DIR_IN,
424 WM8350_GPIO4_MR_IN, WM8350_GPIO_ACTIVE_HIGH,
425 WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
426 WM8350_GPIO_DEBOUNCE_OFF);
427
428 wm8350_gpio_config(wm8350, 7, WM8350_GPIO_DIR_IN,
429 WM8350_GPIO7_HIBERNATE_IN, WM8350_GPIO_ACTIVE_HIGH,
430 WM8350_GPIO_PULL_DOWN, WM8350_GPIO_INVERT_OFF,
431 WM8350_GPIO_DEBOUNCE_OFF);
432
433 wm8350_gpio_config(wm8350, 6, WM8350_GPIO_DIR_OUT,
434 WM8350_GPIO6_SDOUT_OUT, WM8350_GPIO_ACTIVE_HIGH,
435 WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
436 WM8350_GPIO_DEBOUNCE_OFF);
437
438 wm8350_gpio_config(wm8350, 8, WM8350_GPIO_DIR_OUT,
439 WM8350_GPIO8_VCC_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
440 WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
441 WM8350_GPIO_DEBOUNCE_OFF);
442
443 wm8350_gpio_config(wm8350, 9, WM8350_GPIO_DIR_OUT,
444 WM8350_GPIO9_BATT_FAULT_OUT, WM8350_GPIO_ACTIVE_LOW,
445 WM8350_GPIO_PULL_NONE, WM8350_GPIO_INVERT_OFF,
446 WM8350_GPIO_DEBOUNCE_OFF);
447
Mark Brownfe7316b2009-01-15 16:14:30 +0000448 wm8350_register_regulator(wm8350, WM8350_DCDC_1, &sw1a_data);
449 wm8350_register_regulator(wm8350, WM8350_DCDC_3, &viohi_data);
450 wm8350_register_regulator(wm8350, WM8350_DCDC_4, &violo_data);
451 wm8350_register_regulator(wm8350, WM8350_DCDC_6, &sw2a_data);
452 wm8350_register_regulator(wm8350, WM8350_LDO_1, &ldo1_data);
453 wm8350_register_regulator(wm8350, WM8350_LDO_2, &ldo2_data);
454 wm8350_register_regulator(wm8350, WM8350_LDO_3, &vdig_data);
455 wm8350_register_regulator(wm8350, WM8350_LDO_4, &ldo4_data);
456
457 /* LEDs */
458 wm8350_dcdc_set_slot(wm8350, WM8350_DCDC_5, 1, 1,
459 WM8350_DC5_ERRACT_SHUTDOWN_CONV);
460 wm8350_isink_set_flash(wm8350, WM8350_ISINK_A,
461 WM8350_ISINK_FLASH_DISABLE,
462 WM8350_ISINK_FLASH_TRIG_BIT,
463 WM8350_ISINK_FLASH_DUR_32MS,
464 WM8350_ISINK_FLASH_ON_INSTANT,
465 WM8350_ISINK_FLASH_OFF_INSTANT,
466 WM8350_ISINK_FLASH_MODE_EN);
467 wm8350_dcdc25_set_mode(wm8350, WM8350_DCDC_5,
468 WM8350_ISINK_MODE_BOOST,
469 WM8350_ISINK_ILIM_NORMAL,
470 WM8350_DC5_RMP_20V,
471 WM8350_DC5_FBSRC_ISINKA);
472 wm8350_register_led(wm8350, 0, WM8350_DCDC_5, WM8350_ISINK_A,
473 &wm8350_led_data);
474
475 wm8350->codec.platform_data = &imx32ads_wm8350_setup;
476
Mark Brown0ac402f2009-04-13 13:05:28 +0100477 regulator_has_full_constraints();
478
Mark Brownfe7316b2009-01-15 16:14:30 +0000479 return 0;
480}
481
482static struct wm8350_platform_data __initdata mx31_wm8350_pdata = {
483 .init = mx31_wm8350_init,
Mark Brown3d661ac2010-01-05 16:05:16 +0000484 .irq_base = MXC_BOARD_IRQ_START + MXC_MAX_EXP_IO_LINES,
Mark Brownfe7316b2009-01-15 16:14:30 +0000485};
486#endif
487
488#if defined(CONFIG_I2C_IMX) || defined(CONFIG_I2C_IMX_MODULE)
489static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = {
490#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
491 {
492 I2C_BOARD_INFO("wm8350", 0x1a),
493 .platform_data = &mx31_wm8350_pdata,
494 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
495 },
496#endif
497};
498
499static void mxc_init_i2c(void)
500{
501 i2c_register_board_info(1, mx31ads_i2c1_devices,
502 ARRAY_SIZE(mx31ads_i2c1_devices));
503
504 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1));
505 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1));
506
507 mxc_register_device(&mxc_i2c_device1, NULL);
508}
509#else
510static void mxc_init_i2c(void)
511{
512}
513#endif
514
Mark Browncd6eb982010-02-23 11:05:11 +0000515static unsigned int ssi_pins[] = {
516 MX31_PIN_SFS5__SFS5,
517 MX31_PIN_SCK5__SCK5,
518 MX31_PIN_SRXD5__SRXD5,
519 MX31_PIN_STXD5__STXD5,
520};
521
522static void mxc_init_audio(void)
523{
524 mxc_register_device(&imx_ssi_device0, NULL);
525 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
526}
527
Quinn Jensen52c543f2007-07-09 22:06:53 +0100528/*!
529 * This structure defines static mappings for the i.MX31ADS board.
530 */
531static struct map_desc mx31ads_io_desc[] __initdata = {
532 {
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100533 .virtual = MX31_CS4_BASE_ADDR_VIRT,
534 .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR),
535 .length = MX31_CS4_SIZE / 2,
Quinn Jensen52c543f2007-07-09 22:06:53 +0100536 .type = MT_DEVICE
537 },
538};
539
540/*!
541 * Set up static virtual mappings.
542 */
Mark Brown8b785b92009-01-15 16:14:29 +0000543static void __init mx31ads_map_io(void)
Quinn Jensen52c543f2007-07-09 22:06:53 +0100544{
Sascha Hauercd4a05f2009-04-02 22:32:10 +0200545 mx31_map_io();
Quinn Jensen52c543f2007-07-09 22:06:53 +0100546 iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
547}
548
Mark Brown8b785b92009-01-15 16:14:29 +0000549static void __init mx31ads_init_irq(void)
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200550{
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +0200551 mx31_init_irq();
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200552 mx31ads_init_expio();
553}
554
Quinn Jensen52c543f2007-07-09 22:06:53 +0100555/*!
556 * Board specific initialization.
557 */
558static void __init mxc_board_init(void)
559{
560 mxc_init_extuart();
Gilles Chanteperdrix07417942008-09-09 10:19:41 +0200561 mxc_init_imx_uart();
Mark Brownfe7316b2009-01-15 16:14:30 +0000562 mxc_init_i2c();
Mark Browncd6eb982010-02-23 11:05:11 +0000563 mxc_init_audio();
Quinn Jensen52c543f2007-07-09 22:06:53 +0100564}
565
Juergen Beisertd0f349f2008-07-05 10:02:50 +0200566static void __init mx31ads_timer_init(void)
567{
Sascha Hauer30c730f2009-02-16 14:36:49 +0100568 mx31_clocks_init(26000000);
Juergen Beisertd0f349f2008-07-05 10:02:50 +0200569}
570
Mark Brown8b785b92009-01-15 16:14:29 +0000571static struct sys_timer mx31ads_timer = {
Juergen Beisertd0f349f2008-07-05 10:02:50 +0200572 .init = mx31ads_timer_init,
573};
574
Quinn Jensen52c543f2007-07-09 22:06:53 +0100575/*
576 * The following uses standard kernel macros defined in arch.h in order to
577 * initialize __mach_desc_MX31ADS data structure.
578 */
579MACHINE_START(MX31ADS, "Freescale MX31ADS")
580 /* Maintainer: Freescale Semiconductor, Inc. */
Uwe Kleine-Königf568dd72009-12-09 11:57:21 +0100581 .phys_io = MX31_AIPS1_BASE_ADDR,
Uwe Kleine-König321ed162009-12-10 10:41:26 +0100582 .io_pg_offst = (MX31_AIPS1_BASE_ADDR_VIRT >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100583 .boot_params = MX3x_PHYS_OFFSET + 0x100,
Quinn Jensen52c543f2007-07-09 22:06:53 +0100584 .map_io = mx31ads_map_io,
Gilles Chanteperdrixd7568f72008-09-09 10:19:42 +0200585 .init_irq = mx31ads_init_irq,
Quinn Jensen52c543f2007-07-09 22:06:53 +0100586 .init_machine = mxc_board_init,
Juergen Beisertd0f349f2008-07-05 10:02:50 +0200587 .timer = &mx31ads_timer,
Quinn Jensen52c543f2007-07-09 22:06:53 +0100588MACHINE_END