1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/mm.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/pci.h>
20#include <linux/pm.h>
21#include <linux/serial_core.h>
22#include <linux/serial_8250.h>
23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h>
25#include <linux/i2c.h>
26#include <mach/hardware.h>
27#include <linux/io.h>
28#include <linux/irq.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>
34#include <mach/time.h>
35
36static void __init em7210_timer_init(void)
37{
38
39
40 iop_init_time(200000000);
41}
42
43static struct sys_timer em7210_timer = {
44 .init = em7210_timer_init,
45};
46
47
48
49
50static struct i2c_board_info __initdata em7210_i2c_devices[] = {
51 {
52 I2C_BOARD_INFO("rs5c372a", 0x32),
53 },
54};
55
56
57
58
59static struct map_desc em7210_io_desc[] __initdata = {
60 {
61 .virtual = IQ31244_UART,
62 .pfn = __phys_to_pfn(IQ31244_UART),
63 .length = 0x00100000,
64 .type = MT_DEVICE,
65 },
66};
67
68void __init em7210_map_io(void)
69{
70 iop3xx_map_io();
71 iotable_init(em7210_io_desc, ARRAY_SIZE(em7210_io_desc));
72}
73
74
75
76
77
78#define INTA IRQ_IOP32X_XINT0
79#define INTB IRQ_IOP32X_XINT1
80#define INTC IRQ_IOP32X_XINT2
81#define INTD IRQ_IOP32X_XINT3
82
83static int __init
84em7210_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
85{
86 static int pci_irq_table[][4] = {
87
88
89
90
91 {INTB, INTB, INTB, INTB},
92 {INTA, INTA, INTA, INTA},
93 {INTD, INTD, INTD, INTD},
94 {INTC, INTC, INTC, INTC},
95 {INTD, INTA, INTA, INTA},
96 {INTD, INTC, INTA, INTA},
97 };
98
99 if (pin < 1 || pin > 4)
100 return -1;
101
102 return pci_irq_table[slot % 6][pin - 1];
103}
104
105static struct hw_pci em7210_pci __initdata = {
106 .swizzle = pci_std_swizzle,
107 .nr_controllers = 1,
108 .setup = iop3xx_pci_setup,
109 .preinit = iop3xx_pci_preinit,
110 .scan = iop3xx_pci_scan_bus,
111 .map_irq = em7210_pci_map_irq,
112};
113
114static int __init em7210_pci_init(void)
115{
116 if (machine_is_em7210())
117 pci_common_init(&em7210_pci);
118
119 return 0;
120}
121
122subsys_initcall(em7210_pci_init);
123
124
125
126
127
128static struct physmap_flash_data em7210_flash_data = {
129 .width = 2,
130};
131
132static struct resource em7210_flash_resource = {
133 .start = 0xf0000000,
134 .end = 0xf1ffffff,
135 .flags = IORESOURCE_MEM,
136};
137
138static struct platform_device em7210_flash_device = {
139 .name = "physmap-flash",
140 .id = 0,
141 .dev = {
142 .platform_data = &em7210_flash_data,
143 },
144 .num_resources = 1,
145 .resource = &em7210_flash_resource,
146};
147
148
149
150
151
152
153
154static struct plat_serial8250_port em7210_serial_port[] = {
155 {
156 .mapbase = IQ31244_UART,
157 .membase = (char *)IQ31244_UART,
158 .irq = IRQ_IOP32X_XINT1,
159 .flags = UPF_SKIP_TEST,
160 .iotype = UPIO_MEM,
161 .regshift = 0,
162 .uartclk = 1843200,
163 },
164 { },
165};
166
167static struct resource em7210_uart_resource = {
168 .start = IQ31244_UART,
169 .end = IQ31244_UART + 7,
170 .flags = IORESOURCE_MEM,
171};
172
173static struct platform_device em7210_serial_device = {
174 .name = "serial8250",
175 .id = PLAT8250_DEV_PLATFORM,
176 .dev = {
177 .platform_data = em7210_serial_port,
178 },
179 .num_resources = 1,
180 .resource = &em7210_uart_resource,
181};
182
183void em7210_power_off(void)
184{
185 *IOP3XX_GPOE &= 0xfe;
186 *IOP3XX_GPOD |= 0x01;
187}
188
189static void __init em7210_init_machine(void)
190{
191 platform_device_register(&em7210_serial_device);
192 platform_device_register(&iop3xx_i2c0_device);
193 platform_device_register(&iop3xx_i2c1_device);
194 platform_device_register(&em7210_flash_device);
195 platform_device_register(&iop3xx_dma_0_channel);
196 platform_device_register(&iop3xx_dma_1_channel);
197
198 i2c_register_board_info(0, em7210_i2c_devices,
199 ARRAY_SIZE(em7210_i2c_devices));
200
201
202 pm_power_off = em7210_power_off;
203}
204
205MACHINE_START(EM7210, "Lanner EM7210")
206 .atag_offset = 0x100,
207 .map_io = em7210_map_io,
208 .init_irq = iop32x_init_irq,
209 .timer = &em7210_timer,
210 .init_machine = em7210_init_machine,
211MACHINE_END
212