summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/platforms/s6105/device.c
blob: 78b08be5a92d5473edf17dc6b7daf79aa3e06988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * s6105 platform devices
 *
 * Copyright (c) 2009 emlix GmbH
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>

#include <variant/hardware.h>

#define UART_INTNUM		4

static const signed char uart_irq_mappings[] = {
	S6_INTC_UART(0),
	S6_INTC_UART(1),
	-1,
};

const signed char *platform_irq_mappings[NR_IRQS] = {
	[UART_INTNUM] = uart_irq_mappings,
};

static struct plat_serial8250_port serial_platform_data[] = {
	{
		.membase = (void *)S6_REG_UART + 0x0000,
		.mapbase = S6_REG_UART + 0x0000,
		.irq = UART_INTNUM,
		.uartclk = S6_SCLK,
		.regshift = 2,
		.iotype = SERIAL_IO_MEM,
		.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
	},
	{
		.membase = (void *)S6_REG_UART + 0x1000,
		.mapbase = S6_REG_UART + 0x1000,
		.irq = UART_INTNUM,
		.uartclk = S6_SCLK,
		.regshift = 2,
		.iotype = SERIAL_IO_MEM,
		.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST,
	},
	{ },
};

static struct platform_device platform_devices[] = {
	{
		.name = "serial8250",
		.id = PLAT8250_DEV_PLATFORM,
		.dev = {
			.platform_data = serial_platform_data,
		},
	},
};

static int __init device_init(void)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(platform_devices); i++)
		platform_device_register(&platform_devices[i]);
	return 0;
}
arch_initcall_sync(device_init);