4 * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
5 * updates in http://alberdroid.blogspot.com/
7 * Based on Atmark Techno, Inc. armadillo 500 BSP 2008
8 * Based on mx31ads.c and pcm037.c Great Work!
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 #include <linux/types.h>
27 #include <linux/init.h>
28 #include <linux/clk.h>
29 #include <linux/platform_device.h>
30 #include <linux/gpio.h>
31 #include <linux/smsc911x.h>
32 #include <linux/interrupt.h>
33 #include <linux/irq.h>
35 #include <mach/hardware.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/time.h>
39 #include <asm/memory.h>
40 #include <asm/mach/map.h>
42 #include <mach/common.h>
43 #include <mach/imx-uart.h>
44 #include <mach/iomux-mx3.h>
45 #include <mach/board-armadillo5x0.h>
48 #include <mach/mx3fb.h>
52 static int armadillo5x0_pins
[] = {
64 IOMUX_MODE(MX31_PIN_GPIO1_0
, IOMUX_CONFIG_GPIO
),
66 MX31_PIN_SD1_DATA3__SD1_DATA3
,
67 MX31_PIN_SD1_DATA2__SD1_DATA2
,
68 MX31_PIN_SD1_DATA1__SD1_DATA1
,
69 MX31_PIN_SD1_DATA0__SD1_DATA0
,
70 MX31_PIN_SD1_CLK__SD1_CLK
,
71 MX31_PIN_SD1_CMD__SD1_CMD
,
91 MX31_PIN_VSYNC3__VSYNC3
,
92 MX31_PIN_HSYNC__HSYNC
,
93 MX31_PIN_FPSHIFT__FPSHIFT
,
94 MX31_PIN_DRDY0__DRDY0
,
95 IOMUX_MODE(MX31_PIN_LCS1
, IOMUX_CONFIG_GPIO
), /*ADV7125_PSAVE*/
102 static const struct fb_videomode fb_modedb
[] = {
103 { /* 640x480 @ 60 Hz */
115 .sync
= FB_SYNC_OE_ACT_HIGH
,
116 .vmode
= FB_VMODE_NONINTERLACED
,
118 }, {/* 800x600 @ 56 Hz */
130 .sync
= FB_SYNC_OE_ACT_HIGH
| FB_SYNC_HOR_HIGH_ACT
|
131 FB_SYNC_VERT_HIGH_ACT
,
132 .vmode
= FB_VMODE_NONINTERLACED
,
137 static struct ipu_platform_data mx3_ipu_data
= {
138 .irq_base
= MXC_IPU_IRQ_START
,
141 static struct mx3fb_platform_data mx3fb_pdata
= {
142 .dma_dev
= &mx3_ipu
.dev
,
145 .num_modes
= ARRAY_SIZE(fb_modedb
),
152 static int armadillo5x0_sdhc1_get_ro(struct device
*dev
)
154 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B
));
157 static int armadillo5x0_sdhc1_init(struct device
*dev
,
158 irq_handler_t detect_irq
, void *data
)
161 int gpio_det
, gpio_wp
;
163 gpio_det
= IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK
);
164 gpio_wp
= IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B
);
166 ret
= gpio_request(gpio_det
, "sdhc-card-detect");
170 gpio_direction_input(gpio_det
);
172 ret
= gpio_request(gpio_wp
, "sdhc-write-protect");
176 gpio_direction_input(gpio_wp
);
178 /* When supported the trigger type have to be BOTH */
179 ret
= request_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK
), detect_irq
,
180 IRQF_DISABLED
| IRQF_TRIGGER_FALLING
,
181 "sdhc-detect", data
);
184 goto err_gpio_free_2
;
198 static void armadillo5x0_sdhc1_exit(struct device
*dev
, void *data
)
200 free_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK
), data
);
201 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK
));
202 gpio_free(IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B
));
205 static struct imxmmc_platform_data sdhc_pdata
= {
206 .get_ro
= armadillo5x0_sdhc1_get_ro
,
207 .init
= armadillo5x0_sdhc1_init
,
208 .exit
= armadillo5x0_sdhc1_exit
,
215 static struct resource armadillo5x0_smc911x_resources
[] = {
217 .start
= CS3_BASE_ADDR
,
218 .end
= CS3_BASE_ADDR
+ SZ_32M
- 1,
219 .flags
= IORESOURCE_MEM
,
221 .start
= IOMUX_TO_IRQ(MX31_PIN_GPIO1_0
),
222 .end
= IOMUX_TO_IRQ(MX31_PIN_GPIO1_0
),
223 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
227 static struct smsc911x_platform_config smsc911x_info
= {
228 .flags
= SMSC911X_USE_32BIT
,
229 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
230 .irq_type
= SMSC911X_IRQ_TYPE_PUSH_PULL
,
233 static struct platform_device armadillo5x0_smc911x_device
= {
236 .num_resources
= ARRAY_SIZE(armadillo5x0_smc911x_resources
),
237 .resource
= armadillo5x0_smc911x_resources
,
239 .platform_data
= &smsc911x_info
,
243 /* UART device data */
244 static struct imxuart_platform_data uart_pdata
= {
245 .flags
= IMXUART_HAVE_RTSCTS
,
248 static struct platform_device
*devices
[] __initdata
= {
249 &armadillo5x0_smc911x_device
,
253 * Perform board specific initializations
255 static void __init
armadillo5x0_init(void)
257 mxc_iomux_setup_multiple_pins(armadillo5x0_pins
,
258 ARRAY_SIZE(armadillo5x0_pins
), "armadillo5x0");
260 platform_add_devices(devices
, ARRAY_SIZE(devices
));
263 mxc_register_device(&mxc_uart_device0
, &uart_pdata
);
264 mxc_register_device(&mxc_uart_device1
, &uart_pdata
);
266 /* SMSC9118 IRQ pin */
267 gpio_direction_input(MX31_PIN_GPIO1_0
);
270 mxc_register_device(&mxcsdhc_device0
, &sdhc_pdata
);
273 mxc_register_device(&mx3_ipu
, &mx3_ipu_data
);
274 mxc_register_device(&mx3_fb
, &mx3fb_pdata
);
277 static void __init
armadillo5x0_timer_init(void)
279 mx31_clocks_init(26000000);
282 static struct sys_timer armadillo5x0_timer
= {
283 .init
= armadillo5x0_timer_init
,
286 MACHINE_START(ARMADILLO5X0
, "Armadillo-500")
287 /* Maintainer: Alberto Panizzo */
288 .phys_io
= AIPS1_BASE_ADDR
,
289 .io_pg_offst
= ((AIPS1_BASE_ADDR_VIRT
) >> 18) & 0xfffc,
290 .boot_params
= PHYS_OFFSET
+ 0x00000100,
291 .map_io
= mx31_map_io
,
292 .init_irq
= mxc_init_irq
,
293 .timer
= &armadillo5x0_timer
,
294 .init_machine
= armadillo5x0_init
,