1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * NEC VR4100 series SIU platform device.
5 * Copyright (C) 2007-2008 Yoichi Yuasa <yuasa@linux-mips.org>
7 #include <linux/errno.h>
8 #include <linux/init.h>
9 #include <linux/ioport.h>
10 #include <linux/platform_device.h>
11 #include <linux/serial_core.h>
12 #include <linux/irq.h>
15 #include <asm/vr41xx/siu.h>
17 static unsigned int siu_type1_ports
[SIU_PORTS_MAX
] __initdata
= {
22 static struct resource siu_type1_resource
[] __initdata
= {
26 .flags
= IORESOURCE_MEM
,
31 .flags
= IORESOURCE_IRQ
,
35 static unsigned int siu_type2_ports
[SIU_PORTS_MAX
] __initdata
= {
40 static struct resource siu_type2_resource
[] __initdata
= {
44 .flags
= IORESOURCE_MEM
,
49 .flags
= IORESOURCE_MEM
,
54 .flags
= IORESOURCE_IRQ
,
59 .flags
= IORESOURCE_IRQ
,
63 static int __init
vr41xx_siu_add(void)
65 struct platform_device
*pdev
;
70 pdev
= platform_device_alloc("SIU", -1);
74 switch (current_cpu_type()) {
77 pdev
->dev
.platform_data
= siu_type1_ports
;
78 res
= siu_type1_resource
;
79 num
= ARRAY_SIZE(siu_type1_resource
);
84 pdev
->dev
.platform_data
= siu_type2_ports
;
85 res
= siu_type2_resource
;
86 num
= ARRAY_SIZE(siu_type2_resource
);
93 retval
= platform_device_add_resources(pdev
, res
, num
);
97 retval
= platform_device_add(pdev
);
104 platform_device_put(pdev
);
108 device_initcall(vr41xx_siu_add
);
110 void __init
vr41xx_siu_setup(void)
112 struct uart_port port
;
113 struct resource
*res
;
117 switch (current_cpu_type()) {
120 type
= siu_type1_ports
;
121 res
= siu_type1_resource
;
126 type
= siu_type2_ports
;
127 res
= siu_type2_resource
;
133 for (i
= 0; i
< SIU_PORTS_MAX
; i
++) {
136 if (port
.type
== PORT_UNKNOWN
)
138 port
.mapbase
= res
[i
].start
;
139 port
.membase
= (unsigned char __iomem
*)KSEG1ADDR(res
[i
].start
);
140 vr41xx_siu_early_setup(&port
);