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/f75375s.h>
18 #include <linux/kernel.h>
19 #include <linux/pci.h>
21 #include <linux/string.h>
22 #include <linux/serial_core.h>
23 #include <linux/serial_8250.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/i2c.h>
26 #include <linux/platform_device.h>
28 #include <mach/hardware.h>
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/pci.h>
33 #include <asm/mach/time.h>
34 #include <asm/mach-types.h>
36 #include <mach/time.h>
37 #include "gpio-iop32x.h"
40 * GLAN Tank timer tick configuration.
42 static void __init
glantank_timer_init(void)
44 /* 33.333 MHz crystal. */
45 iop_init_time(200000000);
52 static struct map_desc glantank_io_desc
[] __initdata
= {
53 { /* on-board devices */
54 .virtual = GLANTANK_UART
,
55 .pfn
= __phys_to_pfn(GLANTANK_UART
),
61 void __init
glantank_map_io(void)
64 iotable_init(glantank_io_desc
, ARRAY_SIZE(glantank_io_desc
));
71 #define INTA IRQ_IOP32X_XINT0
72 #define INTB IRQ_IOP32X_XINT1
73 #define INTC IRQ_IOP32X_XINT2
74 #define INTD IRQ_IOP32X_XINT3
77 glantank_pci_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
79 static int pci_irq_table
[][4] = {
81 * PCI IDSEL/INTPIN->INTLINE
84 {INTD
, INTD
, INTD
, INTD
}, /* UART (8250) */
85 {INTA
, INTA
, INTA
, INTA
}, /* Ethernet (E1000) */
86 {INTB
, INTB
, INTB
, INTB
}, /* IDE (AEC6280R) */
87 {INTC
, INTC
, INTC
, INTC
}, /* USB (NEC) */
90 BUG_ON(pin
< 1 || pin
> 4);
92 return pci_irq_table
[slot
% 4][pin
- 1];
95 static struct hw_pci glantank_pci __initdata
= {
98 .setup
= iop3xx_pci_setup
,
99 .preinit
= iop3xx_pci_preinit
,
100 .map_irq
= glantank_pci_map_irq
,
103 static int __init
glantank_pci_init(void)
105 if (machine_is_glantank())
106 pci_common_init(&glantank_pci
);
111 subsys_initcall(glantank_pci_init
);
115 * GLAN Tank machine initialization.
117 static struct physmap_flash_data glantank_flash_data
= {
121 static struct resource glantank_flash_resource
= {
124 .flags
= IORESOURCE_MEM
,
127 static struct platform_device glantank_flash_device
= {
128 .name
= "physmap-flash",
131 .platform_data
= &glantank_flash_data
,
134 .resource
= &glantank_flash_resource
,
137 static struct plat_serial8250_port glantank_serial_port
[] = {
139 .mapbase
= GLANTANK_UART
,
140 .membase
= (char *)GLANTANK_UART
,
141 .irq
= IRQ_IOP32X_XINT3
,
142 .flags
= UPF_SKIP_TEST
,
150 static struct resource glantank_uart_resource
= {
151 .start
= GLANTANK_UART
,
152 .end
= GLANTANK_UART
+ 7,
153 .flags
= IORESOURCE_MEM
,
156 static struct platform_device glantank_serial_device
= {
157 .name
= "serial8250",
158 .id
= PLAT8250_DEV_PLATFORM
,
160 .platform_data
= glantank_serial_port
,
163 .resource
= &glantank_uart_resource
,
166 static struct f75375s_platform_data glantank_f75375s
= {
168 .pwm_enable
= { 0, 0 },
171 static struct i2c_board_info __initdata glantank_i2c_devices
[] = {
173 I2C_BOARD_INFO("rs5c372a", 0x32),
176 I2C_BOARD_INFO("f75375", 0x2e),
177 .platform_data
= &glantank_f75375s
,
181 static void glantank_power_off(void)
183 __raw_writeb(0x01, IOMEM(0xfe8d0004));
189 static void __init
glantank_init_machine(void)
191 register_iop32x_gpio();
192 platform_device_register(&iop3xx_i2c0_device
);
193 platform_device_register(&iop3xx_i2c1_device
);
194 platform_device_register(&glantank_flash_device
);
195 platform_device_register(&glantank_serial_device
);
196 platform_device_register(&iop3xx_dma_0_channel
);
197 platform_device_register(&iop3xx_dma_1_channel
);
199 i2c_register_board_info(0, glantank_i2c_devices
,
200 ARRAY_SIZE(glantank_i2c_devices
));
202 pm_power_off
= glantank_power_off
;
205 MACHINE_START(GLANTANK
, "GLAN Tank")
206 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
207 .atag_offset
= 0x100,
208 .map_io
= glantank_map_io
,
209 .init_irq
= iop32x_init_irq
,
210 .init_time
= glantank_timer_init
,
211 .init_machine
= glantank_init_machine
,
212 .restart
= iop3xx_restart
,