blob: 8fa079d2e3c380f8f1d2b3bb0fec5124c0cc5a0e [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Lennert Buytenhekc680b772006-09-18 23:24:52 +01002/*
Lennert Buytenhekc852ac82006-09-18 23:26:25 +01003 * arch/arm/mach-iop33x/uart.c
Lennert Buytenhekc680b772006-09-18 23:24:52 +01004 *
5 * Author: Dave Jiang (dave.jiang@intel.com)
6 * Copyright (C) 2004 Intel Corporation.
Lennert Buytenhekc680b772006-09-18 23:24:52 +01007 */
8
9#include <linux/mm.h>
10#include <linux/init.h>
11#include <linux/major.h>
12#include <linux/fs.h>
13#include <linux/platform_device.h>
14#include <linux/serial.h>
15#include <linux/tty.h>
16#include <linux/serial_8250.h>
Russell Kingfced80c2008-09-06 12:10:45 +010017#include <linux/io.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010018#include <asm/pgtable.h>
19#include <asm/page.h>
20#include <asm/mach/map.h>
21#include <asm/setup.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010022#include <asm/memory.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010023#include <mach/hardware.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010024#include <asm/hardware/iop3xx.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010025#include <asm/mach/arch.h>
26
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010027#define IOP33X_UART_XTAL 33334000
Lennert Buytenhekc680b772006-09-18 23:24:52 +010028
29static struct plat_serial8250_port iop33x_uart0_data[] = {
30 {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010031 .membase = (char *)IOP33X_UART0_VIRT,
32 .mapbase = IOP33X_UART0_PHYS,
33 .irq = IRQ_IOP33X_UART0,
34 .uartclk = IOP33X_UART_XTAL,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010035 .regshift = 2,
36 .iotype = UPIO_MEM,
37 .flags = UPF_SKIP_TEST,
38 },
39 { },
40};
41
42static struct resource iop33x_uart0_resources[] = {
43 [0] = {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010044 .start = IOP33X_UART0_PHYS,
45 .end = IOP33X_UART0_PHYS + 0x3f,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010046 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010049 .start = IRQ_IOP33X_UART0,
50 .end = IRQ_IOP33X_UART0,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010051 .flags = IORESOURCE_IRQ,
52 },
53};
54
55struct platform_device iop33x_uart0_device = {
56 .name = "serial8250",
57 .id = PLAT8250_DEV_PLATFORM,
58 .dev = {
59 .platform_data = iop33x_uart0_data,
60 },
61 .num_resources = 2,
62 .resource = iop33x_uart0_resources,
63};
64
65
66static struct resource iop33x_uart1_resources[] = {
67 [0] = {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010068 .start = IOP33X_UART1_PHYS,
69 .end = IOP33X_UART1_PHYS + 0x3f,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010070 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010073 .start = IRQ_IOP33X_UART1,
74 .end = IRQ_IOP33X_UART1,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010075 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct plat_serial8250_port iop33x_uart1_data[] = {
80 {
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010081 .membase = (char *)IOP33X_UART1_VIRT,
82 .mapbase = IOP33X_UART1_PHYS,
83 .irq = IRQ_IOP33X_UART1,
84 .uartclk = IOP33X_UART_XTAL,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010085 .regshift = 2,
86 .iotype = UPIO_MEM,
87 .flags = UPF_SKIP_TEST,
88 },
89 { },
90};
91
92struct platform_device iop33x_uart1_device = {
93 .name = "serial8250",
94 .id = PLAT8250_DEV_PLATFORM1,
95 .dev = {
96 .platform_data = iop33x_uart1_data,
97 },
98 .num_resources = 2,
99 .resource = iop33x_uart1_resources,
100};