1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/arm/mach-iop32x/glantank.c
5 * Board support code for the GLAN Tank.
7 * Copyright (C) 2006, 2007 Martin Michlmayr <tbm@cyrius.com>
8 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
12 #include <linux/init.h>
13 #include <linux/f75375s.h>
14 #include <linux/kernel.h>
15 #include <linux/pci.h>
17 #include <linux/string.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_8250.h>
20 #include <linux/mtd/physmap.h>
21 #include <linux/i2c.h>
22 #include <linux/platform_device.h>
24 #include <mach/hardware.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/pci.h>
29 #include <asm/mach/time.h>
30 #include <asm/mach-types.h>
32 #include <mach/time.h>
33 #include "gpio-iop32x.h"
36 * GLAN Tank timer tick configuration.
38 static void __init
glantank_timer_init(void)
40 /* 33.333 MHz crystal. */
41 iop_init_time(200000000);
48 static struct map_desc glantank_io_desc
[] __initdata
= {
49 { /* on-board devices */
50 .virtual = GLANTANK_UART
,
51 .pfn
= __phys_to_pfn(GLANTANK_UART
),
57 void __init
glantank_map_io(void)
60 iotable_init(glantank_io_desc
, ARRAY_SIZE(glantank_io_desc
));
67 #define INTA IRQ_IOP32X_XINT0
68 #define INTB IRQ_IOP32X_XINT1
69 #define INTC IRQ_IOP32X_XINT2
70 #define INTD IRQ_IOP32X_XINT3
73 glantank_pci_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
75 static int pci_irq_table
[][4] = {
77 * PCI IDSEL/INTPIN->INTLINE
80 {INTD
, INTD
, INTD
, INTD
}, /* UART (8250) */
81 {INTA
, INTA
, INTA
, INTA
}, /* Ethernet (E1000) */
82 {INTB
, INTB
, INTB
, INTB
}, /* IDE (AEC6280R) */
83 {INTC
, INTC
, INTC
, INTC
}, /* USB (NEC) */
86 BUG_ON(pin
< 1 || pin
> 4);
88 return pci_irq_table
[slot
% 4][pin
- 1];
91 static struct hw_pci glantank_pci __initdata
= {
94 .setup
= iop3xx_pci_setup
,
95 .preinit
= iop3xx_pci_preinit
,
96 .map_irq
= glantank_pci_map_irq
,
99 static int __init
glantank_pci_init(void)
101 if (machine_is_glantank())
102 pci_common_init(&glantank_pci
);
107 subsys_initcall(glantank_pci_init
);
111 * GLAN Tank machine initialization.
113 static struct physmap_flash_data glantank_flash_data
= {
117 static struct resource glantank_flash_resource
= {
120 .flags
= IORESOURCE_MEM
,
123 static struct platform_device glantank_flash_device
= {
124 .name
= "physmap-flash",
127 .platform_data
= &glantank_flash_data
,
130 .resource
= &glantank_flash_resource
,
133 static struct plat_serial8250_port glantank_serial_port
[] = {
135 .mapbase
= GLANTANK_UART
,
136 .membase
= (char *)GLANTANK_UART
,
137 .irq
= IRQ_IOP32X_XINT3
,
138 .flags
= UPF_SKIP_TEST
,
146 static struct resource glantank_uart_resource
= {
147 .start
= GLANTANK_UART
,
148 .end
= GLANTANK_UART
+ 7,
149 .flags
= IORESOURCE_MEM
,
152 static struct platform_device glantank_serial_device
= {
153 .name
= "serial8250",
154 .id
= PLAT8250_DEV_PLATFORM
,
156 .platform_data
= glantank_serial_port
,
159 .resource
= &glantank_uart_resource
,
162 static struct f75375s_platform_data glantank_f75375s
= {
164 .pwm_enable
= { 0, 0 },
167 static struct i2c_board_info __initdata glantank_i2c_devices
[] = {
169 I2C_BOARD_INFO("rs5c372a", 0x32),
172 I2C_BOARD_INFO("f75375", 0x2e),
173 .platform_data
= &glantank_f75375s
,
177 static void glantank_power_off(void)
179 __raw_writeb(0x01, IOMEM(0xfe8d0004));
185 static void __init
glantank_init_machine(void)
187 register_iop32x_gpio();
188 platform_device_register(&iop3xx_i2c0_device
);
189 platform_device_register(&iop3xx_i2c1_device
);
190 platform_device_register(&glantank_flash_device
);
191 platform_device_register(&glantank_serial_device
);
192 platform_device_register(&iop3xx_dma_0_channel
);
193 platform_device_register(&iop3xx_dma_1_channel
);
195 i2c_register_board_info(0, glantank_i2c_devices
,
196 ARRAY_SIZE(glantank_i2c_devices
));
198 pm_power_off
= glantank_power_off
;
201 MACHINE_START(GLANTANK
, "GLAN Tank")
202 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
203 .atag_offset
= 0x100,
204 .map_io
= glantank_map_io
,
205 .init_irq
= iop32x_init_irq
,
206 .init_time
= glantank_timer_init
,
207 .init_machine
= glantank_init_machine
,
208 .restart
= iop3xx_restart
,