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