2 * arch/arm/mach-iop32x/glantank.c
4 * Board support code for the GLAN Tank.
6 * Copyright (C) 2006, 2007 Martin Michlmayr <tbm@cyrius.com>
7 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
16 #include <linux/init.h>
17 #include <linux/kernel.h>
18 #include <linux/pci.h>
19 #include <linux/string.h>
20 #include <linux/slab.h>
21 #include <linux/serial_core.h>
22 #include <linux/serial_8250.h>
23 #include <linux/mtd/physmap.h>
24 #include <linux/i2c.h>
25 #include <linux/platform_device.h>
26 #include <asm/hardware.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/pci.h>
32 #include <asm/mach/time.h>
33 #include <asm/mach-types.h>
35 #include <asm/arch/time.h>
38 * GLAN Tank timer tick configuration.
40 static void __init
glantank_timer_init(void)
42 /* 33.333 MHz crystal. */
43 iop_init_time(200000000);
46 static struct sys_timer glantank_timer
= {
47 .init
= glantank_timer_init
,
48 .offset
= iop_gettimeoffset
,
55 static struct map_desc glantank_io_desc
[] __initdata
= {
56 { /* on-board devices */
57 .virtual = GLANTANK_UART
,
58 .pfn
= __phys_to_pfn(GLANTANK_UART
),
64 void __init
glantank_map_io(void)
67 iotable_init(glantank_io_desc
, ARRAY_SIZE(glantank_io_desc
));
74 #define INTA IRQ_IOP32X_XINT0
75 #define INTB IRQ_IOP32X_XINT1
76 #define INTC IRQ_IOP32X_XINT2
77 #define INTD IRQ_IOP32X_XINT3
80 glantank_pci_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
82 static int pci_irq_table
[][4] = {
84 * PCI IDSEL/INTPIN->INTLINE
87 {INTD
, INTD
, INTD
, INTD
}, /* UART (8250) */
88 {INTA
, INTA
, INTA
, INTA
}, /* Ethernet (E1000) */
89 {INTB
, INTB
, INTB
, INTB
}, /* IDE (AEC6280R) */
90 {INTC
, INTC
, INTC
, INTC
}, /* USB (NEC) */
93 BUG_ON(pin
< 1 || pin
> 4);
95 return pci_irq_table
[slot
% 4][pin
- 1];
98 static struct hw_pci glantank_pci __initdata
= {
99 .swizzle
= pci_std_swizzle
,
101 .setup
= iop3xx_pci_setup
,
102 .preinit
= iop3xx_pci_preinit
,
103 .scan
= iop3xx_pci_scan_bus
,
104 .map_irq
= glantank_pci_map_irq
,
107 static int __init
glantank_pci_init(void)
109 if (machine_is_glantank())
110 pci_common_init(&glantank_pci
);
115 subsys_initcall(glantank_pci_init
);
119 * GLAN Tank machine initialization.
121 static struct physmap_flash_data glantank_flash_data
= {
125 static struct resource glantank_flash_resource
= {
128 .flags
= IORESOURCE_MEM
,
131 static struct platform_device glantank_flash_device
= {
132 .name
= "physmap-flash",
135 .platform_data
= &glantank_flash_data
,
138 .resource
= &glantank_flash_resource
,
141 static struct plat_serial8250_port glantank_serial_port
[] = {
143 .mapbase
= GLANTANK_UART
,
144 .membase
= (char *)GLANTANK_UART
,
145 .irq
= IRQ_IOP32X_XINT3
,
146 .flags
= UPF_SKIP_TEST
,
154 static struct resource glantank_uart_resource
= {
155 .start
= GLANTANK_UART
,
156 .end
= GLANTANK_UART
+ 7,
157 .flags
= IORESOURCE_MEM
,
160 static struct platform_device glantank_serial_device
= {
161 .name
= "serial8250",
162 .id
= PLAT8250_DEV_PLATFORM
,
164 .platform_data
= glantank_serial_port
,
167 .resource
= &glantank_uart_resource
,
170 static struct i2c_board_info __initdata glantank_i2c_devices
[] = {
172 I2C_BOARD_INFO("rtc-rs5c372", 0x32),
177 static void glantank_power_off(void)
179 __raw_writeb(0x01, 0xfe8d0004);
185 static void __init
glantank_init_machine(void)
187 platform_device_register(&iop3xx_i2c0_device
);
188 platform_device_register(&iop3xx_i2c1_device
);
189 platform_device_register(&glantank_flash_device
);
190 platform_device_register(&glantank_serial_device
);
191 platform_device_register(&iop3xx_dma_0_channel
);
192 platform_device_register(&iop3xx_dma_1_channel
);
194 i2c_register_board_info(0, glantank_i2c_devices
,
195 ARRAY_SIZE(glantank_i2c_devices
));
197 pm_power_off
= glantank_power_off
;
200 MACHINE_START(GLANTANK
, "GLAN Tank")
201 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
202 .phys_io
= GLANTANK_UART
,
203 .io_pg_offst
= ((GLANTANK_UART
) >> 18) & 0xfffc,
204 .boot_params
= 0xa0000100,
205 .map_io
= glantank_map_io
,
206 .init_irq
= iop32x_init_irq
,
207 .timer
= &glantank_timer
,
208 .init_machine
= glantank_init_machine
,