blob: 7cf5015436f3de44c15e8119b4f910b3bdc2e1df [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 Buytenhek863753a2006-09-18 23:19:02 +010031#include <asm/mach/time.h>
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +010032#include <asm/hardware/iop3xx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34#define IOP331_UART_XTAL 33334000
35
Dan Williams2b9ac7c2006-01-05 20:53:02 +000036static struct resource iop33x_uart0_resources[] = {
37 [0] = {
38 .start = IOP331_UART0_PHYS,
39 .end = IOP331_UART0_PHYS + 0x3f,
40 .flags = IORESOURCE_MEM,
41 },
42 [1] = {
43 .start = IRQ_IOP331_UART0,
44 .end = IRQ_IOP331_UART0,
45 .flags = IORESOURCE_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 }
47};
48
Dan Williams2b9ac7c2006-01-05 20:53:02 +000049static struct resource iop33x_uart1_resources[] = {
50 [0] = {
51 .start = IOP331_UART1_PHYS,
52 .end = IOP331_UART1_PHYS + 0x3f,
53 .flags = IORESOURCE_MEM,
54 },
55 [1] = {
56 .start = IRQ_IOP331_UART1,
57 .end = IRQ_IOP331_UART1,
58 .flags = IORESOURCE_IRQ
59 }
60};
61
62static struct plat_serial8250_port iop33x_uart0_data[] = {
63 {
64 .membase = (char*)(IOP331_UART0_VIRT),
65 .mapbase = (IOP331_UART0_PHYS),
66 .irq = IRQ_IOP331_UART0,
67 .uartclk = IOP331_UART_XTAL,
68 .regshift = 2,
69 .iotype = UPIO_MEM,
70 .flags = UPF_SKIP_TEST,
71 },
72 { },
73};
74
75static struct plat_serial8250_port iop33x_uart1_data[] = {
76 {
77 .membase = (char*)(IOP331_UART1_VIRT),
78 .mapbase = (IOP331_UART1_PHYS),
79 .irq = IRQ_IOP331_UART1,
80 .uartclk = IOP331_UART_XTAL,
81 .regshift = 2,
82 .iotype = UPIO_MEM,
83 .flags = UPF_SKIP_TEST,
84 },
85 { },
86};
87
88static struct platform_device iop33x_uart0 = {
89 .name = "serial8250",
Lennert Buytenhek7d420892006-03-23 12:59:08 +000090 .id = PLAT8250_DEV_PLATFORM,
Dan Williams2b9ac7c2006-01-05 20:53:02 +000091 .dev.platform_data = iop33x_uart0_data,
92 .num_resources = 2,
93 .resource = iop33x_uart0_resources,
94};
95
96static struct platform_device iop33x_uart1 = {
97 .name = "serial8250",
Lennert Buytenhek7d420892006-03-23 12:59:08 +000098 .id = PLAT8250_DEV_PLATFORM1,
Dan Williams2b9ac7c2006-01-05 20:53:02 +000099 .dev.platform_data = iop33x_uart1_data,
100 .num_resources = 2,
101 .resource = iop33x_uart1_resources,
102};
103
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104static struct platform_device *iop33x_devices[] __initdata = {
Dan Williams2b9ac7c2006-01-05 20:53:02 +0000105 &iop33x_uart0,
106 &iop33x_uart1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107};
108
109void __init iop33x_init(void)
110{
111 if(iop_is_331())
112 {
113 platform_add_devices(iop33x_devices,
114 ARRAY_SIZE(iop33x_devices));
115 }
Lennert Buytenheke25d64f2006-09-18 23:15:21 +0100116 platform_device_register(&iop3xx_i2c0_device);
117 platform_device_register(&iop3xx_i2c1_device);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118}
119
Lennert Buytenhek98954df2006-09-18 23:02:25 +0100120#ifdef CONFIG_ARCH_IOP33X
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121extern void iop331_init_irq(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122#endif
123
Lennert Buytenhek863753a2006-09-18 23:19:02 +0100124static void __init iop3xx_timer_init(void)
125{
126 iop3xx_init_time(IOP331_TICK_RATE);
127}
128
129struct sys_timer iop331_timer = {
130 .init = iop3xx_timer_init,
131 .offset = iop3xx_gettimeoffset,
132};
133
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134#if defined(CONFIG_ARCH_IQ80331)
135MACHINE_START(IQ80331, "Intel IQ80331")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100136 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100137 .phys_io = 0xfefff000,
138 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +0100139 .map_io = iop3xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100140 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100142 .boot_params = 0x0100,
143 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144MACHINE_END
145
146#elif defined(CONFIG_MACH_IQ80332)
147MACHINE_START(IQ80332, "Intel IQ80332")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100148 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100149 .phys_io = 0xfefff000,
150 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
Lennert Buytenhek7ae1f7e2006-09-18 23:12:53 +0100151 .map_io = iop3xx_map_io,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100152 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100154 .boot_params = 0x0100,
155 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156MACHINE_END
157
158#else
159#error No machine descriptor defined for this IOP3XX implementation
160#endif
161
162