| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [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 |  | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 15 | #include <linux/i2c.h> | 
|  | 16 | #include <linux/i2c/pcf857x.h> | 
| Sascha Hauer | 5b68421 | 2009-04-29 13:14:19 +0200 | [diff] [blame] | 17 | #include <linux/init.h> | 
|  | 18 | #include <linux/kernel.h> | 
|  | 19 | #include <linux/platform_device.h> | 
|  | 20 | #include <linux/mtd/physmap.h> | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 21 |  | 
|  | 22 | #include <asm/mach-types.h> | 
|  | 23 | #include <asm/mach/arch.h> | 
|  | 24 | #include <asm/mach/time.h> | 
|  | 25 |  | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 26 | #include <mach/common.h> | 
| Sascha Hauer | 5b68421 | 2009-04-29 13:14:19 +0200 | [diff] [blame] | 27 | #include <mach/hardware.h> | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 28 | #include <mach/i2c.h> | 
| Sascha Hauer | 5b68421 | 2009-04-29 13:14:19 +0200 | [diff] [blame] | 29 | #include <mach/imx-uart.h> | 
| Holger Schurig | ccfe30a | 2009-01-29 10:07:50 +0100 | [diff] [blame] | 30 | #include <mach/iomux.h> | 
| Sascha Hauer | 5b68421 | 2009-04-29 13:14:19 +0200 | [diff] [blame] | 31 | #include <mach/irqs.h> | 
|  | 32 |  | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 33 | #include "devices.h" | 
|  | 34 |  | 
| Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 35 | static int mx1ads_pins[] = { | 
|  | 36 | /* UART1 */ | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 37 | PC9_PF_UART1_CTS, | 
|  | 38 | PC10_PF_UART1_RTS, | 
|  | 39 | PC11_PF_UART1_TXD, | 
|  | 40 | PC12_PF_UART1_RXD, | 
| Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 41 | /* UART2 */ | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 42 | PB28_PF_UART2_CTS, | 
|  | 43 | PB29_PF_UART2_RTS, | 
|  | 44 | PB30_PF_UART2_TXD, | 
|  | 45 | PB31_PF_UART2_RXD, | 
| Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 46 | /* I2C */ | 
|  | 47 | PA15_PF_I2C_SDA, | 
|  | 48 | PA16_PF_I2C_SCL, | 
|  | 49 | /* SPI */ | 
|  | 50 | PC13_PF_SPI1_SPI_RDY, | 
|  | 51 | PC14_PF_SPI1_SCLK, | 
|  | 52 | PC15_PF_SPI1_SS, | 
|  | 53 | PC16_PF_SPI1_MISO, | 
|  | 54 | PC17_PF_SPI1_MOSI, | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 55 | }; | 
|  | 56 |  | 
| Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 57 | /* | 
|  | 58 | * UARTs platform data | 
|  | 59 | */ | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 60 |  | 
|  | 61 | static struct imxuart_platform_data uart_pdata[] = { | 
|  | 62 | { | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 63 | .flags = IMXUART_HAVE_RTSCTS, | 
|  | 64 | }, { | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 65 | .flags = IMXUART_HAVE_RTSCTS, | 
|  | 66 | }, | 
|  | 67 | }; | 
|  | 68 |  | 
|  | 69 | /* | 
|  | 70 | * Physmap flash | 
|  | 71 | */ | 
|  | 72 |  | 
|  | 73 | static struct physmap_flash_data mx1ads_flash_data = { | 
|  | 74 | .width		= 4,		/* bankwidth in bytes */ | 
|  | 75 | }; | 
|  | 76 |  | 
|  | 77 | static struct resource flash_resource = { | 
|  | 78 | .start	= IMX_CS0_PHYS, | 
|  | 79 | .end	= IMX_CS0_PHYS + SZ_32M - 1, | 
|  | 80 | .flags	= IORESOURCE_MEM, | 
|  | 81 | }; | 
|  | 82 |  | 
|  | 83 | static struct platform_device flash_device = { | 
|  | 84 | .name	= "physmap-flash", | 
|  | 85 | .id	= 0, | 
|  | 86 | .resource = &flash_resource, | 
|  | 87 | .num_resources = 1, | 
|  | 88 | }; | 
|  | 89 |  | 
|  | 90 | /* | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 91 | * I2C | 
|  | 92 | */ | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 93 | static struct pcf857x_platform_data pcf857x_data[] = { | 
|  | 94 | { | 
|  | 95 | .gpio_base = 4 * 32, | 
|  | 96 | }, { | 
|  | 97 | .gpio_base = 4 * 32 + 16, | 
|  | 98 | } | 
|  | 99 | }; | 
|  | 100 |  | 
|  | 101 | static struct imxi2c_platform_data mx1ads_i2c_data = { | 
|  | 102 | .bitrate = 100000, | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 103 | }; | 
|  | 104 |  | 
|  | 105 | static struct i2c_board_info mx1ads_i2c_devices[] = { | 
|  | 106 | { | 
| Sascha Hauer | cf87a6e | 2009-07-20 08:18:47 +0200 | [diff] [blame] | 107 | I2C_BOARD_INFO("pcf8575", 0x22), | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 108 | .platform_data = &pcf857x_data[0], | 
|  | 109 | }, { | 
| Sascha Hauer | cf87a6e | 2009-07-20 08:18:47 +0200 | [diff] [blame] | 110 | I2C_BOARD_INFO("pcf8575", 0x24), | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 111 | .platform_data = &pcf857x_data[1], | 
|  | 112 | }, | 
|  | 113 | }; | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 114 |  | 
|  | 115 | /* | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 116 | * Board init | 
|  | 117 | */ | 
|  | 118 | static void __init mx1ads_init(void) | 
|  | 119 | { | 
| Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 120 | mxc_gpio_setup_multiple_pins(mx1ads_pins, | 
|  | 121 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); | 
|  | 122 |  | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 123 | /* UART */ | 
|  | 124 | mxc_register_device(&imx_uart1_device, &uart_pdata[0]); | 
|  | 125 | mxc_register_device(&imx_uart2_device, &uart_pdata[1]); | 
|  | 126 |  | 
|  | 127 | /* Physmap flash */ | 
|  | 128 | mxc_register_device(&flash_device, &mx1ads_flash_data); | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 129 |  | 
|  | 130 | /* I2C */ | 
| Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 131 | i2c_register_board_info(0, mx1ads_i2c_devices, | 
|  | 132 | ARRAY_SIZE(mx1ads_i2c_devices)); | 
|  | 133 |  | 
|  | 134 | mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data); | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 135 | } | 
|  | 136 |  | 
|  | 137 | static void __init mx1ads_timer_init(void) | 
|  | 138 | { | 
| Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 139 | mx1_clocks_init(32000); | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 140 | } | 
|  | 141 |  | 
|  | 142 | struct sys_timer mx1ads_timer = { | 
|  | 143 | .init	= mx1ads_timer_init, | 
|  | 144 | }; | 
|  | 145 |  | 
|  | 146 | MACHINE_START(MX1ADS, "Freescale MX1ADS") | 
|  | 147 | /* Maintainer: Sascha Hauer, Pengutronix */ | 
|  | 148 | .phys_io	= IMX_IO_PHYS, | 
|  | 149 | .io_pg_offst	= (IMX_IO_BASE >> 18) & 0xfffc, | 
|  | 150 | .boot_params	= PHYS_OFFSET + 0x100, | 
| Sascha Hauer | 74fe030e | 2009-04-29 13:41:40 +0200 | [diff] [blame] | 151 | .map_io		= mx1_map_io, | 
| Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 152 | .init_irq	= mx1_init_irq, | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 153 | .timer		= &mx1ads_timer, | 
|  | 154 | .init_machine	= mx1ads_init, | 
|  | 155 | MACHINE_END | 
|  | 156 |  | 
|  | 157 | MACHINE_START(MXLADS, "Freescale MXLADS") | 
|  | 158 | .phys_io	= IMX_IO_PHYS, | 
|  | 159 | .io_pg_offst	= (IMX_IO_BASE >> 18) & 0xfffc, | 
|  | 160 | .boot_params	= PHYS_OFFSET + 0x100, | 
| Sascha Hauer | cd4a05f | 2009-04-02 22:32:10 +0200 | [diff] [blame] | 161 | .map_io		= mx1_map_io, | 
| Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 162 | .init_irq	= mx1_init_irq, | 
| Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 163 | .timer		= &mx1ads_timer, | 
|  | 164 | .init_machine	= mx1ads_init, | 
|  | 165 | MACHINE_END |