blob: a9778c1587abcede102e26aa304e854d4649c4a9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/arm/mach-imx/mx1ads.c
3 *
4 * Initially based on:
5 * linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
6 * Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
7 *
8 * 2004 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#include <linux/device.h>
16#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010017#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/system.h>
19#include <asm/hardware.h>
20#include <asm/irq.h>
21#include <asm/pgtable.h>
22#include <asm/page.h>
23
24#include <asm/mach/map.h>
25#include <asm/mach-types.h>
26
27#include <asm/mach/arch.h>
Pavel Pisad66e35f2006-04-02 16:58:38 +010028#include <asm/arch/mmc.h>
Sascha Hauer5b802342006-05-04 14:07:42 +010029#include <asm/arch/imx-uart.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/interrupt.h>
31#include "generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Sascha Hauer6a2273d2006-01-05 20:44:58 +000033static struct resource cs89x0_resources[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 [0] = {
Sascha Hauer6a2273d2006-01-05 20:44:58 +000035 .start = IMX_CS4_PHYS + 0x300,
36 .end = IMX_CS4_PHYS + 0x300 + 16,
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
Sascha Hauer6a2273d2006-01-05 20:44:58 +000040 .start = IRQ_GPIOC(17),
41 .end = IRQ_GPIOC(17),
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 .flags = IORESOURCE_IRQ,
43 },
44};
45
Sascha Hauer6a2273d2006-01-05 20:44:58 +000046static struct platform_device cs89x0_device = {
47 .name = "cirrus-cs89x0",
48 .num_resources = ARRAY_SIZE(cs89x0_resources),
49 .resource = cs89x0_resources,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050};
51
Sascha Hauer5b802342006-05-04 14:07:42 +010052static struct imxuart_platform_data uart_pdata = {
53 .flags = IMXUART_HAVE_RTSCTS,
54};
55
56static struct resource imx_uart1_resources[] = {
57 [0] = {
58 .start = 0x00206000,
59 .end = 0x002060FF,
60 .flags = IORESOURCE_MEM,
61 },
62 [1] = {
63 .start = (UART1_MINT_RX),
64 .end = (UART1_MINT_RX),
65 .flags = IORESOURCE_IRQ,
66 },
67 [2] = {
68 .start = (UART1_MINT_TX),
69 .end = (UART1_MINT_TX),
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device imx_uart1_device = {
75 .name = "imx-uart",
76 .id = 0,
77 .num_resources = ARRAY_SIZE(imx_uart1_resources),
78 .resource = imx_uart1_resources,
79 .dev = {
80 .platform_data = &uart_pdata,
81 }
82};
83
84static struct resource imx_uart2_resources[] = {
85 [0] = {
86 .start = 0x00207000,
87 .end = 0x002070FF,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = (UART2_MINT_RX),
92 .end = (UART2_MINT_RX),
93 .flags = IORESOURCE_IRQ,
94 },
95 [2] = {
96 .start = (UART2_MINT_TX),
97 .end = (UART2_MINT_TX),
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102static struct platform_device imx_uart2_device = {
103 .name = "imx-uart",
104 .id = 1,
105 .num_resources = ARRAY_SIZE(imx_uart2_resources),
106 .resource = imx_uart2_resources,
107 .dev = {
108 .platform_data = &uart_pdata,
109 }
110};
111
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112static struct platform_device *devices[] __initdata = {
Sascha Hauer6a2273d2006-01-05 20:44:58 +0000113 &cs89x0_device,
Sascha Hauer5b802342006-05-04 14:07:42 +0100114 &imx_uart1_device,
115 &imx_uart2_device,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116};
117
Pavel Pisad66e35f2006-04-02 16:58:38 +0100118#ifdef CONFIG_MMC_IMX
Pavel Pisafaf39ed2007-09-23 22:59:01 +0200119static int mx1ads_mmc_card_present(struct device *dev)
Pavel Pisad66e35f2006-04-02 16:58:38 +0100120{
121 /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
122 return (SSR(1) & (1 << 20) ? 0 : 1);
123}
124
125static struct imxmmc_platform_data mx1ads_mmc_info = {
126 .card_present = mx1ads_mmc_card_present,
127};
128#endif
129
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130static void __init
131mx1ads_init(void)
132{
133#ifdef CONFIG_LEDS
Sascha Hauer0a5b0aa2005-10-04 23:17:52 +0100134 imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135#endif
Pavel Pisad66e35f2006-04-02 16:58:38 +0100136#ifdef CONFIG_MMC_IMX
137 /* SD/MMC card detect */
138 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
139 imx_set_mmc_info(&mx1ads_mmc_info);
140#endif
Sascha Hauer5b802342006-05-04 14:07:42 +0100141
142 imx_gpio_mode(PC9_PF_UART1_CTS);
143 imx_gpio_mode(PC10_PF_UART1_RTS);
144 imx_gpio_mode(PC11_PF_UART1_TXD);
145 imx_gpio_mode(PC12_PF_UART1_RXD);
146
147 imx_gpio_mode(PB28_PF_UART2_CTS);
148 imx_gpio_mode(PB29_PF_UART2_RTS);
149 imx_gpio_mode(PB30_PF_UART2_TXD);
150 imx_gpio_mode(PB31_PF_UART2_RXD);
151
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 platform_add_devices(devices, ARRAY_SIZE(devices));
153}
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155static void __init
156mx1ads_map_io(void)
157{
158 imx_map_io();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159}
160
161MACHINE_START(MX1ADS, "Motorola MX1ADS")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100162 /* Maintainer: Sascha Hauer, Pengutronix */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100163 .phys_io = 0x00200000,
Sascha Hauer216251c2006-05-07 18:56:27 +0100164 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100165 .boot_params = 0x08000100,
166 .map_io = mx1ads_map_io,
167 .init_irq = imx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 .timer = &imx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100169 .init_machine = mx1ads_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170MACHINE_END