Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 1 | /* |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 2 | * arch/arm/mach-iop33x/uart.c |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [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> |
| 14 | #include <linux/major.h> |
| 15 | #include <linux/fs.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/serial.h> |
| 18 | #include <linux/tty.h> |
| 19 | #include <linux/serial_8250.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 20 | #include <linux/io.h> |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 21 | #include <asm/pgtable.h> |
| 22 | #include <asm/page.h> |
| 23 | #include <asm/mach/map.h> |
| 24 | #include <asm/setup.h> |
| 25 | #include <asm/system.h> |
| 26 | #include <asm/memory.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 27 | #include <mach/hardware.h> |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 28 | #include <asm/hardware/iop3xx.h> |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 29 | #include <asm/mach/arch.h> |
| 30 | |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 31 | #define IOP33X_UART_XTAL 33334000 |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 32 | |
| 33 | static struct plat_serial8250_port iop33x_uart0_data[] = { |
| 34 | { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 35 | .membase = (char *)IOP33X_UART0_VIRT, |
| 36 | .mapbase = IOP33X_UART0_PHYS, |
| 37 | .irq = IRQ_IOP33X_UART0, |
| 38 | .uartclk = IOP33X_UART_XTAL, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 39 | .regshift = 2, |
| 40 | .iotype = UPIO_MEM, |
| 41 | .flags = UPF_SKIP_TEST, |
| 42 | }, |
| 43 | { }, |
| 44 | }; |
| 45 | |
| 46 | static struct resource iop33x_uart0_resources[] = { |
| 47 | [0] = { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 48 | .start = IOP33X_UART0_PHYS, |
| 49 | .end = IOP33X_UART0_PHYS + 0x3f, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 50 | .flags = IORESOURCE_MEM, |
| 51 | }, |
| 52 | [1] = { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 53 | .start = IRQ_IOP33X_UART0, |
| 54 | .end = IRQ_IOP33X_UART0, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 55 | .flags = IORESOURCE_IRQ, |
| 56 | }, |
| 57 | }; |
| 58 | |
| 59 | struct platform_device iop33x_uart0_device = { |
| 60 | .name = "serial8250", |
| 61 | .id = PLAT8250_DEV_PLATFORM, |
| 62 | .dev = { |
| 63 | .platform_data = iop33x_uart0_data, |
| 64 | }, |
| 65 | .num_resources = 2, |
| 66 | .resource = iop33x_uart0_resources, |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | static struct resource iop33x_uart1_resources[] = { |
| 71 | [0] = { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 72 | .start = IOP33X_UART1_PHYS, |
| 73 | .end = IOP33X_UART1_PHYS + 0x3f, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 74 | .flags = IORESOURCE_MEM, |
| 75 | }, |
| 76 | [1] = { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 77 | .start = IRQ_IOP33X_UART1, |
| 78 | .end = IRQ_IOP33X_UART1, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 79 | .flags = IORESOURCE_IRQ, |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | static struct plat_serial8250_port iop33x_uart1_data[] = { |
| 84 | { |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 85 | .membase = (char *)IOP33X_UART1_VIRT, |
| 86 | .mapbase = IOP33X_UART1_PHYS, |
| 87 | .irq = IRQ_IOP33X_UART1, |
| 88 | .uartclk = IOP33X_UART_XTAL, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 89 | .regshift = 2, |
| 90 | .iotype = UPIO_MEM, |
| 91 | .flags = UPF_SKIP_TEST, |
| 92 | }, |
| 93 | { }, |
| 94 | }; |
| 95 | |
| 96 | struct platform_device iop33x_uart1_device = { |
| 97 | .name = "serial8250", |
| 98 | .id = PLAT8250_DEV_PLATFORM1, |
| 99 | .dev = { |
| 100 | .platform_data = iop33x_uart1_data, |
| 101 | }, |
| 102 | .num_resources = 2, |
| 103 | .resource = iop33x_uart1_resources, |
| 104 | }; |