Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[sfrench/cifs-2.6.git] / arch / arm / mach-ixp4xx / coyote-setup.c
1 /*
2  * arch/arm/mach-ixp4xx/coyote-setup.c
3  *
4  * Board setup for ADI Engineering and IXDGP425 boards
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 <mach/hardware.h>
23 #include <asm/irq.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/flash.h>
27
28 #define COYOTE_IDE_BASE_PHYS    IXP4XX_EXP_BUS_BASE(3)
29 #define COYOTE_IDE_BASE_VIRT    0xFFFE1000
30 #define COYOTE_IDE_REGION_SIZE  0x1000
31
32 #define COYOTE_IDE_DATA_PORT    0xFFFE10E0
33 #define COYOTE_IDE_CTRL_PORT    0xFFFE10FC
34 #define COYOTE_IDE_ERROR_PORT   0xFFFE10E2
35 #define IRQ_COYOTE_IDE          IRQ_IXP4XX_GPIO5
36
37 static struct flash_platform_data coyote_flash_data = {
38         .map_name       = "cfi_probe",
39         .width          = 2,
40 };
41
42 static struct resource coyote_flash_resource = {
43         .flags          = IORESOURCE_MEM,
44 };
45
46 static struct platform_device coyote_flash = {
47         .name           = "IXP4XX-Flash",
48         .id             = 0,
49         .dev            = {
50                 .platform_data = &coyote_flash_data,
51         },
52         .num_resources  = 1,
53         .resource       = &coyote_flash_resource,
54 };
55
56 static struct resource coyote_uart_resource = {
57         .start  = IXP4XX_UART2_BASE_PHYS,
58         .end    = IXP4XX_UART2_BASE_PHYS + 0x0fff,
59         .flags  = IORESOURCE_MEM,
60 };
61
62 static struct plat_serial8250_port coyote_uart_data[] = {
63         {
64                 .mapbase        = IXP4XX_UART2_BASE_PHYS,
65                 .membase        = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
66                 .irq            = IRQ_IXP4XX_UART2,
67                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
68                 .iotype         = UPIO_MEM,
69                 .regshift       = 2,
70                 .uartclk        = IXP4XX_UART_XTAL,
71         },
72         { },
73 };
74
75 static struct platform_device coyote_uart = {
76         .name           = "serial8250",
77         .id             = PLAT8250_DEV_PLATFORM,
78         .dev                    = {
79                 .platform_data  = coyote_uart_data,
80         },
81         .num_resources  = 1,
82         .resource       = &coyote_uart_resource,
83 };
84
85 static struct platform_device *coyote_devices[] __initdata = {
86         &coyote_flash,
87         &coyote_uart
88 };
89
90 static void __init coyote_init(void)
91 {
92         ixp4xx_sys_init();
93
94         coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
95         coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
96
97         *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
98         *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
99
100         if (machine_is_ixdpg425()) {
101                 coyote_uart_data[0].membase =
102                         (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
103                 coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
104                 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
105         }
106
107         platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
108 }
109
110 #ifdef CONFIG_ARCH_ADI_COYOTE
111 MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
112         /* Maintainer: MontaVista Software, Inc. */
113         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
114         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
115         .map_io         = ixp4xx_map_io,
116         .init_irq       = ixp4xx_init_irq,
117         .timer          = &ixp4xx_timer,
118         .boot_params    = 0x0100,
119         .init_machine   = coyote_init,
120 MACHINE_END
121 #endif
122
123 /*
124  * IXDPG425 is identical to Coyote except for which serial port
125  * is connected.
126  */
127 #ifdef CONFIG_MACH_IXDPG425
128 MACHINE_START(IXDPG425, "Intel IXDPG425")
129         /* Maintainer: MontaVista Software, Inc. */
130         .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
131         .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
132         .map_io         = ixp4xx_map_io,
133         .init_irq       = ixp4xx_init_irq,
134         .timer          = &ixp4xx_timer,
135         .boot_params    = 0x0100,
136         .init_machine   = coyote_init,
137 MACHINE_END
138 #endif
139