blob: ad737d6582b529be80a98275777ce2b5df96b38a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Lennert Buytenhek3f7e5812006-09-18 23:10:26 +01002 * linux/arch/arm/mach-iop33x/setup.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright (C) 2004 Intel Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#include <linux/mm.h>
13#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/major.h>
15#include <linux/fs.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010016#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <linux/serial.h>
18#include <linux/tty.h>
Dan Williams2b9ac7c2006-01-05 20:53:02 +000019#include <linux/serial_8250.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#include <asm/io.h>
22#include <asm/pgtable.h>
23#include <asm/page.h>
24#include <asm/mach/map.h>
25#include <asm/setup.h>
26#include <asm/system.h>
27#include <asm/memory.h>
28#include <asm/hardware.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +010031#include <asm/hardware/iop3xx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33#define IOP331_UART_XTAL 33334000
34
Dan Williams2b9ac7c2006-01-05 20:53:02 +000035static struct resource iop33x_uart0_resources[] = {
36 [0] = {
37 .start = IOP331_UART0_PHYS,
38 .end = IOP331_UART0_PHYS + 0x3f,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = IRQ_IOP331_UART0,
43 .end = IRQ_IOP331_UART0,
44 .flags = IORESOURCE_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 }
46};
47
Dan Williams2b9ac7c2006-01-05 20:53:02 +000048static struct resource iop33x_uart1_resources[] = {
49 [0] = {
50 .start = IOP331_UART1_PHYS,
51 .end = IOP331_UART1_PHYS + 0x3f,
52 .flags = IORESOURCE_MEM,
53 },
54 [1] = {
55 .start = IRQ_IOP331_UART1,
56 .end = IRQ_IOP331_UART1,
57 .flags = IORESOURCE_IRQ
58 }
59};
60
61static struct plat_serial8250_port iop33x_uart0_data[] = {
62 {
63 .membase = (char*)(IOP331_UART0_VIRT),
64 .mapbase = (IOP331_UART0_PHYS),
65 .irq = IRQ_IOP331_UART0,
66 .uartclk = IOP331_UART_XTAL,
67 .regshift = 2,
68 .iotype = UPIO_MEM,
69 .flags = UPF_SKIP_TEST,
70 },
71 { },
72};
73
74static struct plat_serial8250_port iop33x_uart1_data[] = {
75 {
76 .membase = (char*)(IOP331_UART1_VIRT),
77 .mapbase = (IOP331_UART1_PHYS),
78 .irq = IRQ_IOP331_UART1,
79 .uartclk = IOP331_UART_XTAL,
80 .regshift = 2,
81 .iotype = UPIO_MEM,
82 .flags = UPF_SKIP_TEST,
83 },
84 { },
85};
86
87static struct platform_device iop33x_uart0 = {
88 .name = "serial8250",
Lennert Buytenhek7d420892006-03-23 12:59:08 +000089 .id = PLAT8250_DEV_PLATFORM,
Dan Williams2b9ac7c2006-01-05 20:53:02 +000090 .dev.platform_data = iop33x_uart0_data,
91 .num_resources = 2,
92 .resource = iop33x_uart0_resources,
93};
94
95static struct platform_device iop33x_uart1 = {
96 .name = "serial8250",
Lennert Buytenhek7d420892006-03-23 12:59:08 +000097 .id = PLAT8250_DEV_PLATFORM1,
Dan Williams2b9ac7c2006-01-05 20:53:02 +000098 .dev.platform_data = iop33x_uart1_data,
99 .num_resources = 2,
100 .resource = iop33x_uart1_resources,
101};
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103static struct platform_device *iop33x_devices[] __initdata = {
Dan Williams2b9ac7c2006-01-05 20:53:02 +0000104 &iop33x_uart0,
105 &iop33x_uart1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106};
107
108void __init iop33x_init(void)
109{
110 if(iop_is_331())
111 {
112 platform_add_devices(iop33x_devices,
113 ARRAY_SIZE(iop33x_devices));
114 }
Lennert Buytenheke25d64f2006-09-18 23:15:21 +0100115 platform_device_register(&iop3xx_i2c0_device);
116 platform_device_register(&iop3xx_i2c1_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117}
118
Lennert Buytenhek98954df2006-09-18 23:02:25 +0100119#ifdef CONFIG_ARCH_IOP33X
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120extern void iop331_init_irq(void);
121extern struct sys_timer iop331_timer;
122#endif
123
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124#if defined(CONFIG_ARCH_IQ80331)
125MACHINE_START(IQ80331, "Intel IQ80331")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100126 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100127 .phys_io = 0xfefff000,
128 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +0100129 .map_io = iop3xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100130 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100132 .boot_params = 0x0100,
133 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134MACHINE_END
135
136#elif defined(CONFIG_MACH_IQ80332)
137MACHINE_START(IQ80332, "Intel IQ80332")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100138 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100139 .phys_io = 0xfefff000,
140 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +0100141 .map_io = iop3xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100142 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100144 .boot_params = 0x0100,
145 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146MACHINE_END
147
148#else
149#error No machine descriptor defined for this IOP3XX implementation
150#endif
151
152