Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Lennert Buytenhek | 3f7e581 | 2006-09-18 23:10:26 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-iop33x/setup.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/major.h> |
| 15 | #include <linux/fs.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 16 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/serial.h> |
| 18 | #include <linux/tty.h> |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 19 | #include <linux/serial_8250.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 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 Buytenhek | 863753a | 2006-09-18 23:19:02 +0100 | [diff] [blame] | 31 | #include <asm/mach/time.h> |
Lennert Buytenhek | 7ae1f7e | 2006-09-18 23:12:53 +0100 | [diff] [blame] | 32 | #include <asm/hardware/iop3xx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | #define IOP331_UART_XTAL 33334000 |
| 35 | |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 36 | static 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | } |
| 47 | }; |
| 48 | |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 49 | static 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 | |
| 62 | static 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 | |
| 75 | static 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 | |
| 88 | static struct platform_device iop33x_uart0 = { |
| 89 | .name = "serial8250", |
Lennert Buytenhek | 7d42089 | 2006-03-23 12:59:08 +0000 | [diff] [blame] | 90 | .id = PLAT8250_DEV_PLATFORM, |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 91 | .dev.platform_data = iop33x_uart0_data, |
| 92 | .num_resources = 2, |
| 93 | .resource = iop33x_uart0_resources, |
| 94 | }; |
| 95 | |
| 96 | static struct platform_device iop33x_uart1 = { |
| 97 | .name = "serial8250", |
Lennert Buytenhek | 7d42089 | 2006-03-23 12:59:08 +0000 | [diff] [blame] | 98 | .id = PLAT8250_DEV_PLATFORM1, |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 99 | .dev.platform_data = iop33x_uart1_data, |
| 100 | .num_resources = 2, |
| 101 | .resource = iop33x_uart1_resources, |
| 102 | }; |
| 103 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | static struct platform_device *iop33x_devices[] __initdata = { |
Dan Williams | 2b9ac7c | 2006-01-05 20:53:02 +0000 | [diff] [blame] | 105 | &iop33x_uart0, |
| 106 | &iop33x_uart1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | void __init iop33x_init(void) |
| 110 | { |
| 111 | if(iop_is_331()) |
| 112 | { |
| 113 | platform_add_devices(iop33x_devices, |
| 114 | ARRAY_SIZE(iop33x_devices)); |
| 115 | } |
Lennert Buytenhek | e25d64f | 2006-09-18 23:15:21 +0100 | [diff] [blame] | 116 | platform_device_register(&iop3xx_i2c0_device); |
| 117 | platform_device_register(&iop3xx_i2c1_device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | } |
| 119 | |
Lennert Buytenhek | 98954df | 2006-09-18 23:02:25 +0100 | [diff] [blame] | 120 | #ifdef CONFIG_ARCH_IOP33X |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | extern void iop331_init_irq(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | #endif |
| 123 | |
Lennert Buytenhek | 863753a | 2006-09-18 23:19:02 +0100 | [diff] [blame] | 124 | static void __init iop3xx_timer_init(void) |
| 125 | { |
| 126 | iop3xx_init_time(IOP331_TICK_RATE); |
| 127 | } |
| 128 | |
| 129 | struct sys_timer iop331_timer = { |
| 130 | .init = iop3xx_timer_init, |
| 131 | .offset = iop3xx_gettimeoffset, |
| 132 | }; |
| 133 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | #if defined(CONFIG_ARCH_IQ80331) |
| 135 | MACHINE_START(IQ80331, "Intel IQ80331") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 136 | /* Maintainer: Intel Corp. */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 137 | .phys_io = 0xfefff000, |
| 138 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
Lennert Buytenhek | 7ae1f7e | 2006-09-18 23:12:53 +0100 | [diff] [blame] | 139 | .map_io = iop3xx_map_io, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 140 | .init_irq = iop331_init_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | .timer = &iop331_timer, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 142 | .boot_params = 0x0100, |
| 143 | .init_machine = iop33x_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | MACHINE_END |
| 145 | |
| 146 | #elif defined(CONFIG_MACH_IQ80332) |
| 147 | MACHINE_START(IQ80332, "Intel IQ80332") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 148 | /* Maintainer: Intel Corp. */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 149 | .phys_io = 0xfefff000, |
| 150 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical |
Lennert Buytenhek | 7ae1f7e | 2006-09-18 23:12:53 +0100 | [diff] [blame] | 151 | .map_io = iop3xx_map_io, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 152 | .init_irq = iop331_init_irq, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | .timer = &iop331_timer, |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 154 | .boot_params = 0x0100, |
| 155 | .init_machine = iop33x_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | MACHINE_END |
| 157 | |
| 158 | #else |
| 159 | #error No machine descriptor defined for this IOP3XX implementation |
| 160 | #endif |
| 161 | |
| 162 | |