Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 1 | /* |
Uwe Kleine-König | 95c0046 | 2009-12-09 20:12:07 +0100 | [diff] [blame] | 2 | * arch/arm/mach-imx/mach-mx1ads.c |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 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 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 26 | #include "common.h" |
Uwe Kleine-König | 6348e6b | 2010-06-16 15:26:07 +0200 | [diff] [blame] | 27 | #include "devices-imx1.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 28 | #include "hardware.h" |
Shawn Guo | 267dd34 | 2012-09-13 13:26:00 +0800 | [diff] [blame] | 29 | #include "iomux-mx1.h" |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 30 | |
Uwe Kleine-König | 6c80ee5 | 2010-09-28 21:53:31 +0200 | [diff] [blame] | 31 | static const int mx1ads_pins[] __initconst = { |
Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 32 | /* UART1 */ |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 33 | PC9_PF_UART1_CTS, |
| 34 | PC10_PF_UART1_RTS, |
| 35 | PC11_PF_UART1_TXD, |
| 36 | PC12_PF_UART1_RXD, |
Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 37 | /* UART2 */ |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 38 | PB28_PF_UART2_CTS, |
| 39 | PB29_PF_UART2_RTS, |
| 40 | PB30_PF_UART2_TXD, |
| 41 | PB31_PF_UART2_RXD, |
Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 42 | /* I2C */ |
| 43 | PA15_PF_I2C_SDA, |
| 44 | PA16_PF_I2C_SCL, |
| 45 | /* SPI */ |
| 46 | PC13_PF_SPI1_SPI_RDY, |
| 47 | PC14_PF_SPI1_SCLK, |
| 48 | PC15_PF_SPI1_SS, |
| 49 | PC16_PF_SPI1_MISO, |
| 50 | PC17_PF_SPI1_MOSI, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 53 | /* |
| 54 | * UARTs platform data |
| 55 | */ |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 56 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 57 | static const struct imxuart_platform_data uart0_pdata __initconst = { |
| 58 | .flags = IMXUART_HAVE_RTSCTS, |
| 59 | }; |
| 60 | |
| 61 | static const struct imxuart_platform_data uart1_pdata __initconst = { |
| 62 | .flags = IMXUART_HAVE_RTSCTS, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | /* |
| 66 | * Physmap flash |
| 67 | */ |
| 68 | |
Uwe Kleine-König | f2f07be | 2011-07-31 00:19:55 +0200 | [diff] [blame] | 69 | static const struct physmap_flash_data mx1ads_flash_data __initconst = { |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 70 | .width = 4, /* bankwidth in bytes */ |
| 71 | }; |
| 72 | |
Uwe Kleine-König | f2f07be | 2011-07-31 00:19:55 +0200 | [diff] [blame] | 73 | static const struct resource flash_resource __initconst = { |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 74 | .start = MX1_CS0_PHYS, |
| 75 | .end = MX1_CS0_PHYS + SZ_32M - 1, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 76 | .flags = IORESOURCE_MEM, |
| 77 | }; |
| 78 | |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 79 | /* |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 80 | * I2C |
| 81 | */ |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 82 | static struct pcf857x_platform_data pcf857x_data[] = { |
| 83 | { |
| 84 | .gpio_base = 4 * 32, |
| 85 | }, { |
| 86 | .gpio_base = 4 * 32 + 16, |
| 87 | } |
| 88 | }; |
| 89 | |
Uwe Kleine-König | 6348e6b | 2010-06-16 15:26:07 +0200 | [diff] [blame] | 90 | static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = { |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 91 | .bitrate = 100000, |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | static struct i2c_board_info mx1ads_i2c_devices[] = { |
| 95 | { |
Sascha Hauer | cf87a6e | 2009-07-20 08:18:47 +0200 | [diff] [blame] | 96 | I2C_BOARD_INFO("pcf8575", 0x22), |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 97 | .platform_data = &pcf857x_data[0], |
| 98 | }, { |
Sascha Hauer | cf87a6e | 2009-07-20 08:18:47 +0200 | [diff] [blame] | 99 | I2C_BOARD_INFO("pcf8575", 0x24), |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 100 | .platform_data = &pcf857x_data[1], |
| 101 | }, |
| 102 | }; |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 103 | |
| 104 | /* |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 105 | * Board init |
| 106 | */ |
| 107 | static void __init mx1ads_init(void) |
| 108 | { |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 109 | imx1_soc_init(); |
| 110 | |
Sascha Hauer | 5ae07da | 2009-04-29 13:17:21 +0200 | [diff] [blame] | 111 | mxc_gpio_setup_multiple_pins(mx1ads_pins, |
| 112 | ARRAY_SIZE(mx1ads_pins), "mx1ads"); |
| 113 | |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 114 | /* UART */ |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 115 | imx1_add_imx_uart0(&uart0_pdata); |
| 116 | imx1_add_imx_uart1(&uart1_pdata); |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 117 | |
| 118 | /* Physmap flash */ |
Uwe Kleine-König | f2f07be | 2011-07-31 00:19:55 +0200 | [diff] [blame] | 119 | platform_device_register_resndata(NULL, "physmap-flash", 0, |
| 120 | &flash_resource, 1, |
| 121 | &mx1ads_flash_data, sizeof(mx1ads_flash_data)); |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 122 | |
| 123 | /* I2C */ |
Sascha Hauer | b8b19b0 | 2009-01-28 14:06:20 +0100 | [diff] [blame] | 124 | i2c_register_board_info(0, mx1ads_i2c_devices, |
| 125 | ARRAY_SIZE(mx1ads_i2c_devices)); |
| 126 | |
Uwe Kleine-König | 77a406d | 2010-08-25 12:19:50 +0200 | [diff] [blame] | 127 | imx1_add_imx_i2c(&mx1ads_i2c_data); |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | static void __init mx1ads_timer_init(void) |
| 131 | { |
Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 132 | mx1_clocks_init(32000); |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 133 | } |
| 134 | |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 135 | MACHINE_START(MX1ADS, "Freescale MX1ADS") |
| 136 | /* Maintainer: Sascha Hauer, Pengutronix */ |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 137 | .atag_offset = 0x100, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 138 | .map_io = mx1_map_io, |
| 139 | .init_early = imx1_init_early, |
| 140 | .init_irq = mx1_init_irq, |
Sascha Hauer | ffa2ea3 | 2011-09-20 14:31:24 +0200 | [diff] [blame] | 141 | .handle_irq = imx1_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 142 | .init_time = mx1ads_timer_init, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 143 | .init_machine = mx1ads_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 144 | .restart = mxc_restart, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 145 | MACHINE_END |
| 146 | |
| 147 | MACHINE_START(MXLADS, "Freescale MXLADS") |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 148 | .atag_offset = 0x100, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 149 | .map_io = mx1_map_io, |
| 150 | .init_early = imx1_init_early, |
| 151 | .init_irq = mx1_init_irq, |
Sascha Hauer | ffa2ea3 | 2011-09-20 14:31:24 +0200 | [diff] [blame] | 152 | .handle_irq = imx1_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 153 | .init_time = mx1ads_timer_init, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 154 | .init_machine = mx1ads_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 155 | .restart = mxc_restart, |
Paulius Zaleckas | cfca8b5 | 2008-11-14 11:01:38 +0100 | [diff] [blame] | 156 | MACHINE_END |