2 * Copyright (C) 2000 Deep Blue Solutions Ltd
3 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
4 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
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.
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.
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
21 #include <linux/platform_device.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/physmap.h>
24 #include <linux/gpio.h>
25 #include <mach/common.h>
26 #include <mach/hardware.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/time.h>
30 #include <asm/mach/map.h>
31 #include <mach/imx-uart.h>
32 #include <mach/imxfb.h>
33 #include <mach/iomux.h>
34 #include <mach/mxc_nand.h>
36 #include <mach/board-mx21ads.h>
40 static unsigned int mx21ads_pins[] = {
43 (GPIO_PORTE | GPIO_GPIO | GPIO_IN | 11),
51 /* UART3 (IrDA) - only TXD and RXD */
80 PA24_PF_REV, /* Sharp panel dedicated signal */
81 PA25_PF_CLS, /* Sharp panel dedicated signal */
82 PA26_PF_PS, /* Sharp panel dedicated signal */
83 PA27_PF_SPL_SPR, /* Sharp panel dedicated signal */
115 /* ADS's NOR flash: 2x AM29BDS128HE9VKI on 32-bit bus */
116 static struct physmap_flash_data mx21ads_flash_data = {
120 static struct resource mx21ads_flash_resource = {
121 .start = CS0_BASE_ADDR,
122 .end = CS0_BASE_ADDR + 0x02000000 - 1,
123 .flags = IORESOURCE_MEM,
126 static struct platform_device mx21ads_nor_mtd_device = {
127 .name = "physmap-flash",
130 .platform_data = &mx21ads_flash_data,
133 .resource = &mx21ads_flash_resource,
136 static struct imxuart_platform_data uart_pdata = {
137 .flags = IMXUART_HAVE_RTSCTS,
140 static struct imxuart_platform_data uart_norts_pdata = {
144 static int mx21ads_fb_init(struct platform_device *pdev)
148 tmp = __raw_readw(MX21ADS_IO_REG);
149 tmp |= MX21ADS_IO_LCDON;
150 __raw_writew(tmp, MX21ADS_IO_REG);
154 static void mx21ads_fb_exit(struct platform_device *pdev)
158 tmp = __raw_readw(MX21ADS_IO_REG);
159 tmp &= ~MX21ADS_IO_LCDON;
160 __raw_writew(tmp, MX21ADS_IO_REG);
164 * Connected is a portrait Sharp-QVGA display
165 * of type: LQ035Q7DB02
167 static struct imx_fb_videomode mx21ads_modes[] = {
170 .name = "Sharp-LQ035Q7",
174 .pixclock = 188679, /* in ps (5.3MHz) */
187 static struct imx_fb_platform_data mx21ads_fb_data = {
188 .mode = mx21ads_modes,
189 .num_modes = ARRAY_SIZE(mx21ads_modes),
195 .init = mx21ads_fb_init,
196 .exit = mx21ads_fb_exit,
199 static int mx21ads_sdhc_get_ro(struct device *dev)
201 return (__raw_readw(MX21ADS_IO_REG) & MX21ADS_IO_SD_WP) ? 1 : 0;
204 static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
209 ret = request_irq(IRQ_GPIOD(25), detect_irq,
210 IRQF_TRIGGER_FALLING, "mmc-detect", data);
218 static void mx21ads_sdhc_exit(struct device *dev, void *data)
220 free_irq(IRQ_GPIOD(25), data);
223 static struct imxmmc_platform_data mx21ads_sdhc_pdata = {
224 .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */
225 .get_ro = mx21ads_sdhc_get_ro,
226 .init = mx21ads_sdhc_init,
227 .exit = mx21ads_sdhc_exit,
230 static struct mxc_nand_platform_data mx21ads_nand_board_info = {
235 static struct map_desc mx21ads_io_desc[] __initdata = {
237 * Memory-mapped I/O on MX21ADS Base board:
238 * - CS8900A Ethernet controller
240 * - CPU and Base board version
241 * - Base board I/O register
244 .virtual = MX21ADS_MMIO_BASE_ADDR,
245 .pfn = __phys_to_pfn(CS1_BASE_ADDR),
246 .length = MX21ADS_MMIO_SIZE,
251 static void __init mx21ads_map_io(void)
254 iotable_init(mx21ads_io_desc, ARRAY_SIZE(mx21ads_io_desc));
257 static struct platform_device *platform_devices[] __initdata = {
258 &mx21ads_nor_mtd_device,
261 static void __init mx21ads_board_init(void)
263 mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins),
266 mxc_register_device(&mxc_uart_device0, &uart_pdata);
267 mxc_register_device(&mxc_uart_device2, &uart_norts_pdata);
268 mxc_register_device(&mxc_uart_device3, &uart_pdata);
269 mxc_register_device(&mxc_fb_device, &mx21ads_fb_data);
270 mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata);
271 mxc_register_device(&mxc_nand_device, &mx21ads_nand_board_info);
273 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
276 static void __init mx21ads_timer_init(void)
278 mx21_clocks_init(32768, 26000000);
281 static struct sys_timer mx21ads_timer = {
282 .init = mx21ads_timer_init,
285 MACHINE_START(MX21ADS, "Freescale i.MX21ADS")
286 /* maintainer: Freescale Semiconductor, Inc. */
287 .phys_io = AIPI_BASE_ADDR,
288 .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
289 .boot_params = PHYS_OFFSET + 0x100,
290 .map_io = mx21ads_map_io,
291 .init_irq = mx21_init_irq,
292 .init_machine = mx21ads_board_init,
293 .timer = &mx21ads_timer,