1/*
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>
17#include <linux/slab.h>
18
19#include <asm/types.h>
20#include <asm/setup.h>
21#include <asm/memory.h>
22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/irq.h>
25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h>
27
28static struct flash_platform_data ixdp425_flash_data = {
29	.map_name	= "cfi_probe",
30	.width		= 2,
31};
32
33static struct resource ixdp425_flash_resource = {
34	.flags		= IORESOURCE_MEM,
35};
36
37static struct platform_device ixdp425_flash = {
38	.name		= "IXP4XX-Flash",
39	.id		= 0,
40	.dev		= {
41		.platform_data = &ixdp425_flash_data,
42	},
43	.num_resources	= 1,
44	.resource	= &ixdp425_flash_resource,
45};
46
47static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = {
48	.sda_pin	= IXDP425_SDA_PIN,
49	.scl_pin	= IXDP425_SCL_PIN,
50};
51
52static struct platform_device ixdp425_i2c_controller = {
53	.name		= "IXP4XX-I2C",
54	.id		= 0,
55	.dev		= {
56		.platform_data = &ixdp425_i2c_gpio_pins,
57	},
58	.num_resources	= 0
59};
60
61static struct resource ixdp425_uart_resources[] = {
62	{
63		.start		= IXP4XX_UART1_BASE_PHYS,
64		.end		= IXP4XX_UART1_BASE_PHYS + 0x0fff,
65		.flags		= IORESOURCE_MEM
66	},
67	{
68		.start		= IXP4XX_UART2_BASE_PHYS,
69		.end		= IXP4XX_UART2_BASE_PHYS + 0x0fff,
70		.flags		= IORESOURCE_MEM
71	}
72};
73
74static struct plat_serial8250_port ixdp425_uart_data[] = {
75	{
76		.mapbase	= IXP4XX_UART1_BASE_PHYS,
77		.membase	= (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
78		.irq		= IRQ_IXP4XX_UART1,
79		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
80		.iotype		= UPIO_MEM,
81		.regshift	= 2,
82		.uartclk	= IXP4XX_UART_XTAL,
83	},
84	{
85		.mapbase	= IXP4XX_UART2_BASE_PHYS,
86		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
87		.irq		= IRQ_IXP4XX_UART2,
88		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
89		.iotype		= UPIO_MEM,
90		.regshift	= 2,
91		.uartclk	= IXP4XX_UART_XTAL,
92	},
93	{ },
94};
95
96static struct platform_device ixdp425_uart = {
97	.name			= "serial8250",
98	.id			= PLAT8250_DEV_PLATFORM,
99	.dev.platform_data	= ixdp425_uart_data,
100	.num_resources		= 2,
101	.resource		= ixdp425_uart_resources
102};
103
104static struct platform_device *ixdp425_devices[] __initdata = {
105	&ixdp425_i2c_controller,
106	&ixdp425_flash,
107	&ixdp425_uart
108};
109
110static void __init ixdp425_init(void)
111{
112	ixp4xx_sys_init();
113
114	ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
115	ixdp425_flash_resource.end =
116		IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
117
118	if (cpu_is_ixp43x()) {
119		ixdp425_uart.num_resources = 1;
120		ixdp425_uart_data[1].flags = 0;
121	}
122
123	platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
124}
125
126#ifdef CONFIG_ARCH_IXDP425
127MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
128	/* Maintainer: MontaVista Software, Inc. */
129	.phys_io	= IXP4XX_PERIPHERAL_BASE_PHYS,
130	.io_pg_offst	= ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
131	.map_io		= ixp4xx_map_io,
132	.init_irq	= ixp4xx_init_irq,
133	.timer		= &ixp4xx_timer,
134	.boot_params	= 0x0100,
135	.init_machine	= ixdp425_init,
136MACHINE_END
137#endif
138
139#ifdef CONFIG_MACH_IXDP465
140MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
141	/* Maintainer: MontaVista Software, Inc. */
142	.phys_io	= IXP4XX_PERIPHERAL_BASE_PHYS,
143	.io_pg_offst	= ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
144	.map_io		= ixp4xx_map_io,
145	.init_irq	= ixp4xx_init_irq,
146	.timer		= &ixp4xx_timer,
147	.boot_params	= 0x0100,
148	.init_machine	= ixdp425_init,
149MACHINE_END
150#endif
151
152#ifdef CONFIG_ARCH_PRPMC1100
153MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
154	/* Maintainer: MontaVista Software, Inc. */
155	.phys_io	= IXP4XX_PERIPHERAL_BASE_PHYS,
156	.io_pg_offst	= ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
157	.map_io		= ixp4xx_map_io,
158	.init_irq	= ixp4xx_init_irq,
159	.timer		= &ixp4xx_timer,
160	.boot_params	= 0x0100,
161	.init_machine	= ixdp425_init,
162MACHINE_END
163#endif
164
165#ifdef CONFIG_MACH_KIXRP435
166MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
167	/* Maintainer: MontaVista Software, Inc. */
168	.phys_io	= IXP4XX_PERIPHERAL_BASE_PHYS,
169	.io_pg_offst	= ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
170	.map_io		= ixp4xx_map_io,
171	.init_irq	= ixp4xx_init_irq,
172	.timer		= &ixp4xx_timer,
173	.boot_params	= 0x0100,
174	.init_machine	= ixdp425_init,
175MACHINE_END
176#endif
177