Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 1 | /* |
| 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. |
| 5 | * |
| 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. |
| 10 | * |
| 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. |
| 15 | * |
| 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 |
| 19 | */ |
| 20 | |
| 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/mtd/mtd.h> |
| 23 | #include <linux/mtd/map.h> |
| 24 | #include <linux/mtd/partitions.h> |
| 25 | #include <linux/mtd/physmap.h> |
Vladimir Barinov | c981214 | 2009-04-29 04:00:50 +0400 | [diff] [blame^] | 26 | #include <linux/i2c.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/common.h> |
| 28 | #include <mach/hardware.h> |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/time.h> |
| 32 | #include <asm/mach/map.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/gpio.h> |
| 34 | #include <mach/imx-uart.h> |
Holger Schurig | ccfe30a | 2009-01-29 10:07:50 +0100 | [diff] [blame] | 35 | #include <mach/iomux.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 36 | #include <mach/board-mx27ads.h> |
Vladimir Barinov | 8d4fd25 | 2009-04-29 04:00:49 +0400 | [diff] [blame] | 37 | #include <mach/mxc_nand.h> |
Vladimir Barinov | c981214 | 2009-04-29 04:00:50 +0400 | [diff] [blame^] | 38 | #include <mach/i2c.h> |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 39 | |
Sascha Hauer | 7e90534 | 2008-09-09 10:19:41 +0200 | [diff] [blame] | 40 | #include "devices.h" |
| 41 | |
Vladimir Barinov | c1a6f12 | 2009-04-29 04:00:48 +0400 | [diff] [blame] | 42 | static unsigned int mx27ads_pins[] = { |
| 43 | /* UART0 */ |
| 44 | PE12_PF_UART1_TXD, |
| 45 | PE13_PF_UART1_RXD, |
| 46 | PE14_PF_UART1_CTS, |
| 47 | PE15_PF_UART1_RTS, |
| 48 | /* UART1 */ |
| 49 | PE3_PF_UART2_CTS, |
| 50 | PE4_PF_UART2_RTS, |
| 51 | PE6_PF_UART2_TXD, |
| 52 | PE7_PF_UART2_RXD, |
| 53 | /* UART2 */ |
| 54 | PE8_PF_UART3_TXD, |
| 55 | PE9_PF_UART3_RXD, |
| 56 | PE10_PF_UART3_CTS, |
| 57 | PE11_PF_UART3_RTS, |
| 58 | /* UART3 */ |
| 59 | PB26_AF_UART4_RTS, |
| 60 | PB28_AF_UART4_TXD, |
| 61 | PB29_AF_UART4_CTS, |
| 62 | PB31_AF_UART4_RXD, |
| 63 | /* UART4 */ |
| 64 | PB18_AF_UART5_TXD, |
| 65 | PB19_AF_UART5_RXD, |
| 66 | PB20_AF_UART5_CTS, |
| 67 | PB21_AF_UART5_RTS, |
| 68 | /* UART5 */ |
| 69 | PB10_AF_UART6_TXD, |
| 70 | PB12_AF_UART6_CTS, |
| 71 | PB11_AF_UART6_RXD, |
| 72 | PB13_AF_UART6_RTS, |
| 73 | /* FEC */ |
| 74 | PD0_AIN_FEC_TXD0, |
| 75 | PD1_AIN_FEC_TXD1, |
| 76 | PD2_AIN_FEC_TXD2, |
| 77 | PD3_AIN_FEC_TXD3, |
| 78 | PD4_AOUT_FEC_RX_ER, |
| 79 | PD5_AOUT_FEC_RXD1, |
| 80 | PD6_AOUT_FEC_RXD2, |
| 81 | PD7_AOUT_FEC_RXD3, |
| 82 | PD8_AF_FEC_MDIO, |
| 83 | PD9_AIN_FEC_MDC, |
| 84 | PD10_AOUT_FEC_CRS, |
| 85 | PD11_AOUT_FEC_TX_CLK, |
| 86 | PD12_AOUT_FEC_RXD0, |
| 87 | PD13_AOUT_FEC_RX_DV, |
| 88 | PD14_AOUT_FEC_RX_CLK, |
| 89 | PD15_AOUT_FEC_COL, |
| 90 | PD16_AIN_FEC_TX_ER, |
| 91 | PF23_AIN_FEC_TX_EN, |
Vladimir Barinov | c981214 | 2009-04-29 04:00:50 +0400 | [diff] [blame^] | 92 | /* I2C2 */ |
| 93 | PC5_PF_I2C2_SDA, |
| 94 | PC6_PF_I2C2_SCL, |
Vladimir Barinov | c1a6f12 | 2009-04-29 04:00:48 +0400 | [diff] [blame] | 95 | }; |
| 96 | |
Vladimir Barinov | 8d4fd25 | 2009-04-29 04:00:49 +0400 | [diff] [blame] | 97 | static struct mxc_nand_platform_data mx27ads_nand_board_info = { |
| 98 | .width = 1, |
| 99 | .hw_ecc = 1, |
| 100 | }; |
| 101 | |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 102 | /* ADS's NOR flash */ |
| 103 | static struct physmap_flash_data mx27ads_flash_data = { |
| 104 | .width = 2, |
| 105 | }; |
| 106 | |
| 107 | static struct resource mx27ads_flash_resource = { |
| 108 | .start = 0xc0000000, |
| 109 | .end = 0xc0000000 + 0x02000000 - 1, |
| 110 | .flags = IORESOURCE_MEM, |
| 111 | |
| 112 | }; |
| 113 | |
| 114 | static struct platform_device mx27ads_nor_mtd_device = { |
| 115 | .name = "physmap-flash", |
| 116 | .id = 0, |
| 117 | .dev = { |
| 118 | .platform_data = &mx27ads_flash_data, |
| 119 | }, |
| 120 | .num_resources = 1, |
| 121 | .resource = &mx27ads_flash_resource, |
| 122 | }; |
| 123 | |
Vladimir Barinov | c981214 | 2009-04-29 04:00:50 +0400 | [diff] [blame^] | 124 | static struct imxi2c_platform_data mx27ads_i2c_data = { |
| 125 | .bitrate = 100000, |
| 126 | }; |
| 127 | |
| 128 | static struct i2c_board_info mx27ads_i2c_devices[] = { |
| 129 | }; |
| 130 | |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 131 | static struct platform_device *platform_devices[] __initdata = { |
| 132 | &mx27ads_nor_mtd_device, |
Sascha Hauer | 879fea1 | 2009-01-26 17:26:02 +0100 | [diff] [blame] | 133 | &mxc_fec_device, |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 134 | }; |
| 135 | |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 136 | static struct imxuart_platform_data uart_pdata[] = { |
| 137 | { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 138 | .flags = IMXUART_HAVE_RTSCTS, |
| 139 | }, { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 140 | .flags = IMXUART_HAVE_RTSCTS, |
| 141 | }, { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 142 | .flags = IMXUART_HAVE_RTSCTS, |
| 143 | }, { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 144 | .flags = IMXUART_HAVE_RTSCTS, |
| 145 | }, { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 146 | .flags = IMXUART_HAVE_RTSCTS, |
| 147 | }, { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 148 | .flags = IMXUART_HAVE_RTSCTS, |
| 149 | }, |
| 150 | }; |
| 151 | |
| 152 | static void __init mx27ads_board_init(void) |
| 153 | { |
Vladimir Barinov | c1a6f12 | 2009-04-29 04:00:48 +0400 | [diff] [blame] | 154 | mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins), |
| 155 | "mx27ads"); |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 156 | |
Sascha Hauer | 7e90534 | 2008-09-09 10:19:41 +0200 | [diff] [blame] | 157 | mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); |
| 158 | mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); |
| 159 | mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); |
| 160 | mxc_register_device(&mxc_uart_device3, &uart_pdata[3]); |
| 161 | mxc_register_device(&mxc_uart_device4, &uart_pdata[4]); |
| 162 | mxc_register_device(&mxc_uart_device5, &uart_pdata[5]); |
Vladimir Barinov | 8d4fd25 | 2009-04-29 04:00:49 +0400 | [diff] [blame] | 163 | mxc_register_device(&mxc_nand_device, &mx27ads_nand_board_info); |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 164 | |
Vladimir Barinov | c981214 | 2009-04-29 04:00:50 +0400 | [diff] [blame^] | 165 | /* only the i2c master 1 is used on this CPU card */ |
| 166 | i2c_register_board_info(1, mx27ads_i2c_devices, |
| 167 | ARRAY_SIZE(mx27ads_i2c_devices)); |
| 168 | mxc_register_device(&mxc_i2c_device1, &mx27ads_i2c_data); |
| 169 | |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 170 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
| 171 | } |
| 172 | |
| 173 | static void __init mx27ads_timer_init(void) |
| 174 | { |
| 175 | unsigned long fref = 26000000; |
| 176 | |
| 177 | if ((__raw_readw(PBC_VERSION_REG) & CKIH_27MHZ_BIT_SET) == 0) |
| 178 | fref = 27000000; |
| 179 | |
Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 180 | mx27_clocks_init(fref); |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 181 | } |
| 182 | |
Holger Schurig | 058b7a6 | 2009-01-26 16:34:51 +0100 | [diff] [blame] | 183 | static struct sys_timer mx27ads_timer = { |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 184 | .init = mx27ads_timer_init, |
| 185 | }; |
| 186 | |
| 187 | static struct map_desc mx27ads_io_desc[] __initdata = { |
| 188 | { |
| 189 | .virtual = PBC_BASE_ADDRESS, |
| 190 | .pfn = __phys_to_pfn(CS4_BASE_ADDR), |
| 191 | .length = SZ_1M, |
| 192 | .type = MT_DEVICE, |
| 193 | }, |
| 194 | }; |
| 195 | |
Holger Schurig | 058b7a6 | 2009-01-26 16:34:51 +0100 | [diff] [blame] | 196 | static void __init mx27ads_map_io(void) |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 197 | { |
Sascha Hauer | cd4a05f | 2009-04-02 22:32:10 +0200 | [diff] [blame] | 198 | mx27_map_io(); |
Juergen Beisert | 80eedae | 2008-07-05 10:03:00 +0200 | [diff] [blame] | 199 | iotable_init(mx27ads_io_desc, ARRAY_SIZE(mx27ads_io_desc)); |
| 200 | } |
| 201 | |
| 202 | MACHINE_START(MX27ADS, "Freescale i.MX27ADS") |
| 203 | /* maintainer: Freescale Semiconductor, Inc. */ |
| 204 | .phys_io = AIPI_BASE_ADDR, |
| 205 | .io_pg_offst = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc, |
| 206 | .boot_params = PHYS_OFFSET + 0x100, |
| 207 | .map_io = mx27ads_map_io, |
| 208 | .init_irq = mxc_init_irq, |
| 209 | .init_machine = mx27ads_board_init, |
| 210 | .timer = &mx27ads_timer, |
| 211 | MACHINE_END |
| 212 | |