| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 17 | #include <linux/platform_device.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/system.h> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 19 | #include <mach/hardware.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> | 
| Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 28 | #include <mach/mmc.h> | 
|  | 29 | #include <mach/imx-uart.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <linux/interrupt.h> | 
|  | 31 | #include "generic.h" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 |  | 
| Sascha Hauer | 6a2273d | 2006-01-05 20:44:58 +0000 | [diff] [blame] | 33 | static struct resource cs89x0_resources[] = { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | [0] = { | 
| Sascha Hauer | 6a2273d | 2006-01-05 20:44:58 +0000 | [diff] [blame] | 35 | .start	= IMX_CS4_PHYS + 0x300, | 
|  | 36 | .end	= IMX_CS4_PHYS + 0x300 + 16, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | .flags	= IORESOURCE_MEM, | 
|  | 38 | }, | 
|  | 39 | [1] = { | 
| Sascha Hauer | 6a2273d | 2006-01-05 20:44:58 +0000 | [diff] [blame] | 40 | .start	= IRQ_GPIOC(17), | 
|  | 41 | .end	= IRQ_GPIOC(17), | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | .flags	= IORESOURCE_IRQ, | 
|  | 43 | }, | 
|  | 44 | }; | 
|  | 45 |  | 
| Sascha Hauer | 6a2273d | 2006-01-05 20:44:58 +0000 | [diff] [blame] | 46 | static struct platform_device cs89x0_device = { | 
|  | 47 | .name		= "cirrus-cs89x0", | 
|  | 48 | .num_resources	= ARRAY_SIZE(cs89x0_resources), | 
|  | 49 | .resource	= cs89x0_resources, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | }; | 
|  | 51 |  | 
| Sascha Hauer | 5b80234 | 2006-05-04 14:07:42 +0100 | [diff] [blame] | 52 | static struct imxuart_platform_data uart_pdata = { | 
|  | 53 | .flags = IMXUART_HAVE_RTSCTS, | 
|  | 54 | }; | 
|  | 55 |  | 
|  | 56 | static 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 | }, | 
| Sascha Hauer | dbff4e9 | 2008-07-05 10:02:45 +0200 | [diff] [blame] | 72 | [3] = { | 
|  | 73 | .start	= UART1_MINT_RTS, | 
|  | 74 | .end	= UART1_MINT_RTS, | 
|  | 75 | .flags	= IORESOURCE_IRQ, | 
|  | 76 | }, | 
| Sascha Hauer | 5b80234 | 2006-05-04 14:07:42 +0100 | [diff] [blame] | 77 | }; | 
|  | 78 |  | 
|  | 79 | static struct platform_device imx_uart1_device = { | 
|  | 80 | .name		= "imx-uart", | 
|  | 81 | .id		= 0, | 
|  | 82 | .num_resources	= ARRAY_SIZE(imx_uart1_resources), | 
|  | 83 | .resource	= imx_uart1_resources, | 
|  | 84 | .dev = { | 
|  | 85 | .platform_data = &uart_pdata, | 
|  | 86 | } | 
|  | 87 | }; | 
|  | 88 |  | 
|  | 89 | static struct resource imx_uart2_resources[] = { | 
|  | 90 | [0] = { | 
|  | 91 | .start	= 0x00207000, | 
|  | 92 | .end	= 0x002070FF, | 
|  | 93 | .flags	= IORESOURCE_MEM, | 
|  | 94 | }, | 
|  | 95 | [1] = { | 
|  | 96 | .start	= (UART2_MINT_RX), | 
|  | 97 | .end	= (UART2_MINT_RX), | 
|  | 98 | .flags	= IORESOURCE_IRQ, | 
|  | 99 | }, | 
|  | 100 | [2] = { | 
|  | 101 | .start	= (UART2_MINT_TX), | 
|  | 102 | .end	= (UART2_MINT_TX), | 
|  | 103 | .flags	= IORESOURCE_IRQ, | 
|  | 104 | }, | 
| Sascha Hauer | dbff4e9 | 2008-07-05 10:02:45 +0200 | [diff] [blame] | 105 | [3] = { | 
|  | 106 | .start	= UART2_MINT_RTS, | 
|  | 107 | .end	= UART2_MINT_RTS, | 
|  | 108 | .flags	= IORESOURCE_IRQ, | 
|  | 109 | }, | 
| Sascha Hauer | 5b80234 | 2006-05-04 14:07:42 +0100 | [diff] [blame] | 110 | }; | 
|  | 111 |  | 
|  | 112 | static struct platform_device imx_uart2_device = { | 
|  | 113 | .name		= "imx-uart", | 
|  | 114 | .id		= 1, | 
|  | 115 | .num_resources	= ARRAY_SIZE(imx_uart2_resources), | 
|  | 116 | .resource	= imx_uart2_resources, | 
|  | 117 | .dev = { | 
|  | 118 | .platform_data = &uart_pdata, | 
|  | 119 | } | 
|  | 120 | }; | 
|  | 121 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | static struct platform_device *devices[] __initdata = { | 
| Sascha Hauer | 6a2273d | 2006-01-05 20:44:58 +0000 | [diff] [blame] | 123 | &cs89x0_device, | 
| Sascha Hauer | 5b80234 | 2006-05-04 14:07:42 +0100 | [diff] [blame] | 124 | &imx_uart1_device, | 
|  | 125 | &imx_uart2_device, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | }; | 
|  | 127 |  | 
| Sascha Hauer | 2809fc0 | 2008-07-18 08:33:26 +0200 | [diff] [blame] | 128 | #if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE) | 
| Pavel Pisa | faf39ed | 2007-09-23 22:59:01 +0200 | [diff] [blame] | 129 | static int mx1ads_mmc_card_present(struct device *dev) | 
| Pavel Pisa | d66e35f | 2006-04-02 16:58:38 +0100 | [diff] [blame] | 130 | { | 
|  | 131 | /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */ | 
|  | 132 | return (SSR(1) & (1 << 20) ? 0 : 1); | 
|  | 133 | } | 
|  | 134 |  | 
|  | 135 | static struct imxmmc_platform_data mx1ads_mmc_info = { | 
|  | 136 | .card_present = mx1ads_mmc_card_present, | 
|  | 137 | }; | 
|  | 138 | #endif | 
|  | 139 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | static void __init | 
|  | 141 | mx1ads_init(void) | 
|  | 142 | { | 
|  | 143 | #ifdef CONFIG_LEDS | 
| Sascha Hauer | 0a5b0aa | 2005-10-04 23:17:52 +0100 | [diff] [blame] | 144 | imx_gpio_mode(GPIO_PORTA | GPIO_OUT | 2); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | #endif | 
| Sascha Hauer | 2809fc0 | 2008-07-18 08:33:26 +0200 | [diff] [blame] | 146 | #if defined(CONFIG_MMC_IMX) || defined(CONFIG_MMC_IMX_MODULE) | 
| Pavel Pisa | d66e35f | 2006-04-02 16:58:38 +0100 | [diff] [blame] | 147 | /* SD/MMC card detect */ | 
|  | 148 | imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20); | 
|  | 149 | imx_set_mmc_info(&mx1ads_mmc_info); | 
|  | 150 | #endif | 
| Sascha Hauer | 5b80234 | 2006-05-04 14:07:42 +0100 | [diff] [blame] | 151 |  | 
|  | 152 | imx_gpio_mode(PC9_PF_UART1_CTS); | 
|  | 153 | imx_gpio_mode(PC10_PF_UART1_RTS); | 
|  | 154 | imx_gpio_mode(PC11_PF_UART1_TXD); | 
|  | 155 | imx_gpio_mode(PC12_PF_UART1_RXD); | 
|  | 156 |  | 
|  | 157 | imx_gpio_mode(PB28_PF_UART2_CTS); | 
|  | 158 | imx_gpio_mode(PB29_PF_UART2_RTS); | 
|  | 159 | imx_gpio_mode(PB30_PF_UART2_TXD); | 
|  | 160 | imx_gpio_mode(PB31_PF_UART2_RXD); | 
|  | 161 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 
|  | 163 | } | 
|  | 164 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | static void __init | 
|  | 166 | mx1ads_map_io(void) | 
|  | 167 | { | 
|  | 168 | imx_map_io(); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | } | 
|  | 170 |  | 
|  | 171 | MACHINE_START(MX1ADS, "Motorola MX1ADS") | 
| Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 172 | /* Maintainer: Sascha Hauer, Pengutronix */ | 
| Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 173 | .phys_io	= 0x00200000, | 
| Sascha Hauer | 216251c | 2006-05-07 18:56:27 +0100 | [diff] [blame] | 174 | .io_pg_offst	= ((0xe0000000) >> 18) & 0xfffc, | 
| Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 175 | .boot_params	= 0x08000100, | 
|  | 176 | .map_io		= mx1ads_map_io, | 
|  | 177 | .init_irq	= imx_init_irq, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | .timer		= &imx_timer, | 
| Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 179 | .init_machine	= mx1ads_init, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | MACHINE_END |