blob: d5008d8fc9a5af2eb24b85ff804410e4469f2ece [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/arm/mach-ixp4xx/ixdp425-setup.c
3 *
4 * IXDP425/IXCDP1100 board-setup
5 *
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>
Deepak Saxena54e269e2006-01-05 20:59:29 +000017#include <linux/slab.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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23#include <asm/types.h>
24#include <asm/setup.h>
25#include <asm/memory.h>
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/irq.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/flash.h>
Vladimir Barinov4ad48b42007-05-16 20:39:02 +010031#include <asm/delay.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033static struct flash_platform_data ixdp425_flash_data = {
34 .map_name = "cfi_probe",
35 .width = 2,
36};
37
38static struct resource ixdp425_flash_resource = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device ixdp425_flash = {
43 .name = "IXP4XX-Flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &ixdp425_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &ixdp425_flash_resource,
50};
51
Vladimir Barinov4ad48b42007-05-16 20:39:02 +010052#if defined(CONFIG_MTD_NAND_PLATFORM) || \
53 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
54
55#ifdef CONFIG_MTD_PARTITIONS
56const char *part_probes[] = { "cmdlinepart", NULL };
57
58static struct mtd_partition ixdp425_partitions[] = {
59 {
60 .name = "ixp400 NAND FS 0",
61 .offset = 0,
62 .size = SZ_8M
63 }, {
64 .name = "ixp400 NAND FS 1",
65 .offset = MTDPART_OFS_APPEND,
66 .size = MTDPART_SIZ_FULL
67 },
68};
69#endif
70
71static void
72ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
73{
74 struct nand_chip *this = mtd->priv;
75 int offset = (int)this->priv;
76
77 if (ctrl & NAND_CTRL_CHANGE) {
78 if (ctrl & NAND_NCE) {
79 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW);
80 udelay(5);
81 } else
82 gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH);
83
84 offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
85 offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
86 this->priv = (void *)offset;
87 }
88
89 if (cmd != NAND_CMD_NONE)
90 writeb(cmd, this->IO_ADDR_W + offset);
91}
92
93static struct platform_nand_data ixdp425_flash_nand_data = {
94 .chip = {
95 .chip_delay = 30,
96 .options = NAND_NO_AUTOINCR,
97#ifdef CONFIG_MTD_PARTITIONS
98 .part_probe_types = part_probes,
99 .partitions = ixdp425_partitions,
100 .nr_partitions = ARRAY_SIZE(ixdp425_partitions),
101#endif
102 },
103 .ctrl = {
104 .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl
105 }
106};
107
108static struct resource ixdp425_flash_nand_resource = {
109 .flags = IORESOURCE_MEM,
110};
111
112static struct platform_device ixdp425_flash_nand = {
113 .name = "gen_nand",
114 .id = -1,
115 .dev = {
116 .platform_data = &ixdp425_flash_nand_data,
117 },
118 .num_resources = 1,
119 .resource = &ixdp425_flash_nand_resource,
120};
121#endif /* CONFIG_MTD_NAND_PLATFORM */
122
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = {
124 .sda_pin = IXDP425_SDA_PIN,
125 .scl_pin = IXDP425_SCL_PIN,
126};
127
128static struct platform_device ixdp425_i2c_controller = {
129 .name = "IXP4XX-I2C",
130 .id = 0,
131 .dev = {
132 .platform_data = &ixdp425_i2c_gpio_pins,
133 },
134 .num_resources = 0
135};
136
137static struct resource ixdp425_uart_resources[] = {
138 {
139 .start = IXP4XX_UART1_BASE_PHYS,
140 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
141 .flags = IORESOURCE_MEM
142 },
143 {
144 .start = IXP4XX_UART2_BASE_PHYS,
145 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
146 .flags = IORESOURCE_MEM
147 }
148};
149
150static struct plat_serial8250_port ixdp425_uart_data[] = {
151 {
152 .mapbase = IXP4XX_UART1_BASE_PHYS,
153 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
154 .irq = IRQ_IXP4XX_UART1,
Deepak Saxena8c741ed2005-08-03 19:58:21 +0100155 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 .iotype = UPIO_MEM,
157 .regshift = 2,
158 .uartclk = IXP4XX_UART_XTAL,
159 },
160 {
161 .mapbase = IXP4XX_UART2_BASE_PHYS,
162 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
Jeff Hansena35d6c92005-12-01 15:50:35 +0000163 .irq = IRQ_IXP4XX_UART2,
Deepak Saxena8c741ed2005-08-03 19:58:21 +0100164 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 .iotype = UPIO_MEM,
166 .regshift = 2,
167 .uartclk = IXP4XX_UART_XTAL,
Stefan Sorensenbcaafbe2005-07-06 23:06:04 +0100168 },
169 { },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170};
171
172static struct platform_device ixdp425_uart = {
173 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +0100174 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 .dev.platform_data = ixdp425_uart_data,
176 .num_resources = 2,
177 .resource = ixdp425_uart_resources
178};
179
180static struct platform_device *ixdp425_devices[] __initdata = {
181 &ixdp425_i2c_controller,
182 &ixdp425_flash,
Vladimir Barinov4ad48b42007-05-16 20:39:02 +0100183#if defined(CONFIG_MTD_NAND_PLATFORM) || \
184 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
185 &ixdp425_flash_nand,
186#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 &ixdp425_uart
188};
189
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190static void __init ixdp425_init(void)
191{
192 ixp4xx_sys_init();
193
Deepak Saxena54e269e2006-01-05 20:59:29 +0000194 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
195 ixdp425_flash_resource.end =
196 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
Vladimir Barinov4ad48b42007-05-16 20:39:02 +0100198#if defined(CONFIG_MTD_NAND_PLATFORM) || \
199 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
200 ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
201 ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
202
203 gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT);
204
205 /* Configure expansion bus for NAND Flash */
206 *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
207 IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */
208 IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */
209 IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/
210 IXP4XX_EXP_BUS_WR_EN |
211 IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */
212#endif
213
Ruslan V. Sushko45fba082007-04-06 15:00:31 +0100214 if (cpu_is_ixp43x()) {
215 ixdp425_uart.num_resources = 1;
216 ixdp425_uart_data[1].flags = 0;
217 }
218
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
220}
221
Deepak Saxenab38708f2005-09-28 18:07:01 -0700222#ifdef CONFIG_ARCH_IXDP425
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100224 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100225 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
226 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100227 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100228 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100230 .boot_params = 0x0100,
231 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100233#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234
Deepak Saxenae0a20082005-09-18 21:11:56 +0100235#ifdef CONFIG_MACH_IXDP465
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100237 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100238 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
239 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100240 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100241 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100243 .boot_params = 0x0100,
244 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100246#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247
Deepak Saxenae0a20082005-09-18 21:11:56 +0100248#ifdef CONFIG_ARCH_PRPMC1100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100250 /* Maintainer: MontaVista Software, Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100251 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
252 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
Deepak Saxenae605ecd2005-08-29 22:46:29 +0100253 .map_io = ixp4xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100254 .init_irq = ixp4xx_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 .timer = &ixp4xx_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100256 .boot_params = 0x0100,
257 .init_machine = ixdp425_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258MACHINE_END
Deepak Saxenae0a20082005-09-18 21:11:56 +0100259#endif
Ruslan V. Sushko45fba082007-04-06 15:00:31 +0100260
261#ifdef CONFIG_MACH_KIXRP435
262MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
263 /* Maintainer: MontaVista Software, Inc. */
264 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
265 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
266 .map_io = ixp4xx_map_io,
267 .init_irq = ixp4xx_init_irq,
268 .timer = &ixp4xx_timer,
269 .boot_params = 0x0100,
270 .init_machine = ixdp425_init,
271MACHINE_END
272#endif