blob: 827cbc4402f4dff37ce8b8dff110e45598d8b4e4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/arm/mach-ixp4xx/ixdp425-setup.c
3 *
Krzysztof Hałasa9bf4d672009-11-16 15:24:41 +01004 * IXDP425/IXCDP1100 board-setup
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Copyright (C) 2003-2005 MontaVista Software, Inc.
7 *
8 * Author: Deepak Saxena <dsaxena@plexity.net>
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/device.h>
14#include <linux/serial.h>
15#include <linux/tty.h>
16#include <linux/serial_8250.h>
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +010017#include <linux/i2c-gpio.h>
Vladimir Barinov4ad48b42007-05-16 20:39:02 +010018#include <linux/io.h>
19#include <linux/mtd/mtd.h>
20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h>
Russell King8029db12008-09-06 12:11:37 +010022#include <linux/delay.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/types.h>
24#include <asm/setup.h>
25#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/mach-types.h>
28#include <asm/irq.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/flash.h>
31
Krzysztof Hałasa9bf4d672009-11-16 15:24:41 +010032#define IXDP425_SDA_PIN 7
33#define IXDP425_SCL_PIN 6
34
35/* NAND Flash pins */
36#define IXDP425_NAND_NCE_PIN 12
37
38#define IXDP425_NAND_CMD_BYTE 0x01
39#define IXDP425_NAND_ADDR_BYTE 0x02
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041static struct flash_platform_data ixdp425_flash_data = {
42 .map_name = "cfi_probe",
43 .width = 2,
44};
45
46static struct resource ixdp425_flash_resource = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 .flags = IORESOURCE_MEM,
48};
49
50static struct platform_device ixdp425_flash = {
51 .name = "IXP4XX-Flash",
52 .id = 0,
53 .dev = {
54 .platform_data = &ixdp425_flash_data,
55 },
56 .num_resources = 1,
57 .resource = &ixdp425_flash_resource,
58};
59
Vladimir Barinov4ad48b42007-05-16 20:39:02 +010060#if defined(CONFIG_MTD_NAND_PLATFORM) || \
61 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
62
63#ifdef CONFIG_MTD_PARTITIONS
64const char *part_probes[] = { "cmdlinepart", NULL };
65
66static struct mtd_partition ixdp425_partitions[] = {
67 {
68 .name = "ixp400 NAND FS 0",
69 .offset = 0,
70 .size = SZ_8M
71 }, {
72 .name = "ixp400 NAND FS 1",
73 .offset = MTDPART_OFS_APPEND,
74 .size = MTDPART_SIZ_FULL
75 },
76};
77#endif
78
79static void
80ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
81{
82 struct nand_chip *this = mtd->priv;
83 int offset = (int)this->priv;
84
85 if (ctrl & NAND_CTRL_CHANGE) {
86 if (ctrl & NAND_NCE) {
87 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW);
88 udelay(5);
89 } else
90 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH);
91
92 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
93 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
94 this->priv = (void *)offset;
95 }
96
97 if (cmd != NAND_CMD_NONE)
98 writeb(cmd, this->IO_ADDR_W + offset);
99}
100
101static struct platform_nand_data ixdp425_flash_nand_data = {
102 .chip = {
103 .chip_delay = 30,
104 .options = NAND_NO_AUTOINCR,
105#ifdef CONFIG_MTD_PARTITIONS
106 .part_probe_types = part_probes,
107 .partitions = ixdp425_partitions,
108 .nr_partitions = ARRAY_SIZE(ixdp425_partitions),
109#endif
110 },
111 .ctrl = {
112 .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl
113 }
114};
115
116static struct resource ixdp425_flash_nand_resource = {
117 .flags = IORESOURCE_MEM,
118};
119
120static struct platform_device ixdp425_flash_nand = {
121 .name = "gen_nand",
122 .id = -1,
123 .dev = {
124 .platform_data = &ixdp425_flash_nand_data,
125 },
126 .num_resources = 1,
127 .resource = &ixdp425_flash_nand_resource,
128};
129#endif /* CONFIG_MTD_NAND_PLATFORM */
130
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100131static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 .sda_pin = IXDP425_SDA_PIN,
133 .scl_pin = IXDP425_SCL_PIN,
134};
135
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100136static struct platform_device ixdp425_i2c_gpio = {
137 .name = "i2c-gpio",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 .id = 0,
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100139 .dev = {
140 .platform_data = &ixdp425_i2c_gpio_data,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142};
143
144static struct resource ixdp425_uart_resources[] = {
145 {
146 .start = IXP4XX_UART1_BASE_PHYS,
147 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
148 .flags = IORESOURCE_MEM
149 },
150 {
151 .start = IXP4XX_UART2_BASE_PHYS,
152 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
153 .flags = IORESOURCE_MEM
154 }
155};
156
157static struct plat_serial8250_port ixdp425_uart_data[] = {
158 {
159 .mapbase = IXP4XX_UART1_BASE_PHYS,
160 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
161 .irq = IRQ_IXP4XX_UART1,
Deepak Saxena8c741ed2005-08-03 19:58:21 +0100162 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 .iotype = UPIO_MEM,
164 .regshift = 2,
165 .uartclk = IXP4XX_UART_XTAL,
166 },
167 {
168 .mapbase = IXP4XX_UART2_BASE_PHYS,
169 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
Jeff Hansena35d6c92005-12-01 15:50:35 +0000170 .irq = IRQ_IXP4XX_UART2,
Deepak Saxena8c741ed2005-08-03 19:58:21 +0100171 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 .iotype = UPIO_MEM,
173 .regshift = 2,
174 .uartclk = IXP4XX_UART_XTAL,
Stefan Sorensenbcaafbe2005-07-06 23:06:04 +0100175 },
176 { },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177};
178
179static struct platform_device ixdp425_uart = {
180 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100181 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 .dev.platform_data = ixdp425_uart_data,
183 .num_resources = 2,
184 .resource = ixdp425_uart_resources
185};
186
Rod Whitby78225912008-01-31 12:44:03 +0100187/* Built-in 10/100 Ethernet MAC interfaces */
188static struct eth_plat_info ixdp425_plat_eth[] = {
189 {
190 .phy = 0,
191 .rxq = 3,
192 .txreadyq = 20,
193 }, {
194 .phy = 1,
195 .rxq = 4,
196 .txreadyq = 21,
197 }
198};
199
200static struct platform_device ixdp425_eth[] = {
201 {
202 .name = "ixp4xx_eth",
203 .id = IXP4XX_ETH_NPEB,
204 .dev.platform_data = ixdp425_plat_eth,
205 }, {
206 .name = "ixp4xx_eth",
207 .id = IXP4XX_ETH_NPEC,
208 .dev.platform_data = ixdp425_plat_eth + 1,
209 }
210};
211
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212static struct platform_device *ixdp425_devices[] __initdata = {
Michael-Luke Jones5a4a2382008-01-27 18:14:46 +0100213 &ixdp425_i2c_gpio,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 &ixdp425_flash,
Vladimir Barinov4ad48b42007-05-16 20:39:02 +0100215#if defined(CONFIG_MTD_NAND_PLATFORM) || \
216 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
217 &ixdp425_flash_nand,
218#endif
Rod Whitby78225912008-01-31 12:44:03 +0100219 &ixdp425_uart,
220 &ixdp425_eth[0],
221 &ixdp425_eth[1],
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222};
223
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224static void __init ixdp425_init(void)
225{
226 ixp4xx_sys_init();
227
Deepak Saxena54e269e2006-01-05 20:59:29 +0000228 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
229 ixdp425_flash_resource.end =
230 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231
Vladimir Barinov4ad48b42007-05-16 20:39:02 +0100232#if defined(CONFIG_MTD_NAND_PLATFORM) || \
233 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
234 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
235 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
236
237 gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT);
238
239 /* Configure expansion bus for NAND Flash */
240 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
241 IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */
242 IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */
243 IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/
244 IXP4XX_EXP_BUS_WR_EN |
245 IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */
246#endif
247
Ruslan V. Sushko45fba082007-04-06 15:00:31 +0100248 if (cpu_is_ixp43x()) {
249 ixdp425_uart.num_resources = 1;
250 ixdp425_uart_data[1].flags = 0;
251 }
252
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
254}
255
Deepak Saxenab38708f2005-09-28 18:07:01 -0700256#ifdef CONFIG_ARCH_IXDP425
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100258 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100259 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
260 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100261 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100262 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100264 .boot_params = 0x0100,
265 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100267#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268
Deepak Saxenae0a20082005-09-18 21:11:56 +0100269#ifdef CONFIG_MACH_IXDP465
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100271 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100272 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
273 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100274 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100275 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100277 .boot_params = 0x0100,
278 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100280#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
Deepak Saxenae0a20082005-09-18 21:11:56 +0100282#ifdef CONFIG_ARCH_PRPMC1100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100284 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100285 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
286 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100287 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100288 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100290 .boot_params = 0x0100,
291 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100293#endif
Ruslan V. Sushko45fba082007-04-06 15:00:31 +0100294
295#ifdef CONFIG_MACH_KIXRP435
296MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
297 /* Maintainer: MontaVista Software, Inc. */
298 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
299 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
300 .map_io = ixp4xx_map_io,
301 .init_irq = ixp4xx_init_irq,
302 .timer = &ixp4xx_timer,
303 .boot_params = 0x0100,
304 .init_machine = ixdp425_init,
305MACHINE_END
306#endif