1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/arm/mach-iop32x/iq31244.c
5 * Board support code for the Intel EP80219 and IQ31244 platforms.
7 * Author: Rory Bolt <rorybolt@pacbell.net>
8 * Copyright (C) 2002 Rory Bolt
9 * Copyright 2003 (c) MontaVista, Software, Inc.
10 * Copyright (C) 2004 Intel Corp.
14 #include <linux/init.h>
15 #include <linux/delay.h>
16 #include <linux/kernel.h>
17 #include <linux/pci.h>
19 #include <linux/string.h>
20 #include <linux/serial_core.h>
21 #include <linux/serial_8250.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/platform_device.h>
25 #include <linux/gpio/machine.h>
26 #include <asm/cputype.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/pci.h>
31 #include <asm/mach/time.h>
32 #include <asm/mach-types.h>
34 #include <asm/pgtable.h>
38 #include "gpio-iop32x.h"
41 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
42 * same machine id, and the processor type was used to select board type.
43 * However this assumption breaks for an iq80219 board which is an iop219
44 * processor on an iq31244 board. The force_ep80219 flag has been added
45 * for old boot loaders using the iq31244 machine id for an ep80219 platform.
47 static int force_ep80219
;
49 static int is_80219(void)
51 return !!((read_cpuid_id() & 0xffffffe0) == 0x69052e20);
54 static int is_ep80219(void)
56 if (machine_is_ep80219() || force_ep80219
)
64 * EP80219/IQ31244 timer tick configuration.
66 static void __init
iq31244_timer_init(void)
69 /* 33.333 MHz crystal. */
70 iop_init_time(200000000);
72 /* 33.000 MHz crystal. */
73 iop_init_time(198000000);
81 static struct map_desc iq31244_io_desc
[] __initdata
= {
82 { /* on-board devices */
83 .virtual = IQ31244_UART
,
84 .pfn
= __phys_to_pfn(IQ31244_UART
),
90 void __init
iq31244_map_io(void)
93 iotable_init(iq31244_io_desc
, ARRAY_SIZE(iq31244_io_desc
));
98 * EP80219/IQ31244 PCI.
101 ep80219_pci_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
107 irq
= IRQ_IOP32X_XINT1
;
108 } else if (slot
== 1) {
110 irq
= IRQ_IOP32X_XINT0
;
111 } else if (slot
== 2) {
113 irq
= IRQ_IOP32X_XINT3
;
114 } else if (slot
== 3) {
116 irq
= IRQ_IOP32X_XINT2
;
118 printk(KERN_ERR
"ep80219_pci_map_irq() called for unknown "
119 "device PCI:%d:%d:%d\n", dev
->bus
->number
,
120 PCI_SLOT(dev
->devfn
), PCI_FUNC(dev
->devfn
));
127 static struct hw_pci ep80219_pci __initdata
= {
130 .setup
= iop3xx_pci_setup
,
131 .preinit
= iop3xx_pci_preinit
,
132 .map_irq
= ep80219_pci_map_irq
,
136 iq31244_pci_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
142 irq
= IRQ_IOP32X_XINT1
;
143 } else if (slot
== 1) {
145 irq
= IRQ_IOP32X_XINT2
;
146 } else if (slot
== 2) {
148 irq
= IRQ_IOP32X_XINT3
;
149 } else if (slot
== 3) {
151 irq
= IRQ_IOP32X_XINT0
;
153 printk(KERN_ERR
"iq31244_pci_map_irq called for unknown "
154 "device PCI:%d:%d:%d\n", dev
->bus
->number
,
155 PCI_SLOT(dev
->devfn
), PCI_FUNC(dev
->devfn
));
162 static struct hw_pci iq31244_pci __initdata
= {
165 .setup
= iop3xx_pci_setup
,
166 .preinit
= iop3xx_pci_preinit
,
167 .map_irq
= iq31244_pci_map_irq
,
170 static int __init
iq31244_pci_init(void)
173 pci_common_init(&ep80219_pci
);
174 else if (machine_is_iq31244()) {
176 printk("note: iq31244 board type has been selected\n");
177 printk("note: to select ep80219 operation:\n");
178 printk("\t1/ specify \"force_ep80219\" on the kernel"
180 printk("\t2/ update boot loader to pass"
181 " the ep80219 id: %d\n", MACH_TYPE_EP80219
);
183 pci_common_init(&iq31244_pci
);
189 subsys_initcall(iq31244_pci_init
);
193 * IQ31244 machine initialisation.
195 static struct physmap_flash_data iq31244_flash_data
= {
199 static struct resource iq31244_flash_resource
= {
202 .flags
= IORESOURCE_MEM
,
205 static struct platform_device iq31244_flash_device
= {
206 .name
= "physmap-flash",
209 .platform_data
= &iq31244_flash_data
,
212 .resource
= &iq31244_flash_resource
,
215 static struct plat_serial8250_port iq31244_serial_port
[] = {
217 .mapbase
= IQ31244_UART
,
218 .membase
= (char *)IQ31244_UART
,
219 .irq
= IRQ_IOP32X_XINT1
,
220 .flags
= UPF_SKIP_TEST
,
228 static struct resource iq31244_uart_resource
= {
229 .start
= IQ31244_UART
,
230 .end
= IQ31244_UART
+ 7,
231 .flags
= IORESOURCE_MEM
,
234 static struct platform_device iq31244_serial_device
= {
235 .name
= "serial8250",
236 .id
= PLAT8250_DEV_PLATFORM
,
238 .platform_data
= iq31244_serial_port
,
241 .resource
= &iq31244_uart_resource
,
245 * This function will send a SHUTDOWN_COMPLETE message to the PIC
246 * controller over I2C. We are not using the i2c subsystem since
247 * we are going to power off and it may be removed
249 void ep80219_power_off(void)
252 * Send the Address byte w/ the start condition
254 *IOP3XX_IDBR1
= 0x60;
259 * Send the START_MSG byte w/ no start or stop condition
261 *IOP3XX_IDBR1
= 0x0F;
266 * Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or
269 *IOP3XX_IDBR1
= 0x03;
274 * Send an ignored byte w/ stop condition
276 *IOP3XX_IDBR1
= 0x00;
283 static void __init
iq31244_init_machine(void)
285 register_iop32x_gpio();
286 gpiod_add_lookup_table(&iop3xx_i2c0_gpio_lookup
);
287 gpiod_add_lookup_table(&iop3xx_i2c1_gpio_lookup
);
288 platform_device_register(&iop3xx_i2c0_device
);
289 platform_device_register(&iop3xx_i2c1_device
);
290 platform_device_register(&iq31244_flash_device
);
291 platform_device_register(&iq31244_serial_device
);
292 platform_device_register(&iop3xx_dma_0_channel
);
293 platform_device_register(&iop3xx_dma_1_channel
);
296 pm_power_off
= ep80219_power_off
;
299 platform_device_register(&iop3xx_aau_channel
);
302 static int __init
force_ep80219_setup(char *str
)
308 __setup("force_ep80219", force_ep80219_setup
);
310 MACHINE_START(IQ31244
, "Intel IQ31244")
311 /* Maintainer: Intel Corp. */
312 .atag_offset
= 0x100,
313 .map_io
= iq31244_map_io
,
314 .init_irq
= iop32x_init_irq
,
315 .init_time
= iq31244_timer_init
,
316 .init_machine
= iq31244_init_machine
,
317 .restart
= iop3xx_restart
,
320 /* There should have been an ep80219 machine identifier from the beginning.
321 * Boot roms older than March 2007 do not know the ep80219 machine id. Pass
322 * "force_ep80219" on the kernel command line, otherwise iq31244 operation
325 MACHINE_START(EP80219
, "Intel EP80219")
326 /* Maintainer: Intel Corp. */
327 .atag_offset
= 0x100,
328 .map_io
= iq31244_map_io
,
329 .init_irq
= iop32x_init_irq
,
330 .init_time
= iq31244_timer_init
,
331 .init_machine
= iq31244_init_machine
,
332 .restart
= iop3xx_restart
,