sh: sh5: convert to SPDX identifiers
[linux-block.git] / arch / sh / kernel / cpu / sh5 / setup-sh5.c
CommitLineData
82e1d037 1// SPDX-License-Identifier: GPL-2.0
0fb849b9
PM
2/*
3 * SH5-101/SH5-103 CPU Setup
4 *
5 * Copyright (C) 2009 Paul Mundt
0fb849b9
PM
6 */
7#include <linux/platform_device.h>
8#include <linux/init.h>
9#include <linux/serial.h>
10#include <linux/serial_sci.h>
11#include <linux/io.h>
12#include <linux/mm.h>
add47067 13#include <linux/sh_timer.h>
0fb849b9
PM
14#include <asm/addrspace.h>
15
d8d3fbb0 16static struct plat_sci_port scif0_platform_data = {
9c21ac50 17 .flags = UPF_IOREMAP,
c3fa400b 18 .scscr = SCSCR_REIE,
d8d3fbb0 19 .type = PORT_SCIF,
d850acf9
LP
20};
21
22static struct resource scif0_resources[] = {
23 DEFINE_RES_MEM(PHYS_PERIPHERAL_BLOCK + 0x01030000, 0x100),
24 DEFINE_RES_IRQ(39),
25 DEFINE_RES_IRQ(40),
26 DEFINE_RES_IRQ(42),
0fb849b9
PM
27};
28
d8d3fbb0 29static struct platform_device scif0_device = {
0fb849b9 30 .name = "sh-sci",
d8d3fbb0 31 .id = 0,
d850acf9
LP
32 .resource = scif0_resources,
33 .num_resources = ARRAY_SIZE(scif0_resources),
0fb849b9 34 .dev = {
d8d3fbb0 35 .platform_data = &scif0_platform_data,
0fb849b9
PM
36 },
37};
38
c2ecb4c4
PM
39static struct resource rtc_resources[] = {
40 [0] = {
41 .start = PHYS_PERIPHERAL_BLOCK + 0x01040000,
42 .end = PHYS_PERIPHERAL_BLOCK + 0x01040000 + 0x58 - 1,
43 .flags = IORESOURCE_IO,
44 },
45 [1] = {
46 /* Period IRQ */
47 .start = IRQ_PRI,
48 .flags = IORESOURCE_IRQ,
49 },
50 [2] = {
51 /* Carry IRQ */
52 .start = IRQ_CUI,
53 .flags = IORESOURCE_IRQ,
54 },
55 [3] = {
56 /* Alarm IRQ */
57 .start = IRQ_ATI,
58 .flags = IORESOURCE_IRQ,
59 },
60};
61
62static struct platform_device rtc_device = {
63 .name = "sh-rtc",
64 .id = -1,
65 .num_resources = ARRAY_SIZE(rtc_resources),
66 .resource = rtc_resources,
67};
68
add47067
PM
69#define TMU_BLOCK_OFF 0x01020000
70#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
add47067
PM
71
72static struct sh_timer_config tmu0_platform_data = {
1399c195 73 .channels_mask = 7,
add47067
PM
74};
75
76static struct resource tmu0_resources[] = {
1399c195
LP
77 DEFINE_RES_MEM(TMU_BASE, 0x30),
78 DEFINE_RES_IRQ(IRQ_TUNI0),
79 DEFINE_RES_IRQ(IRQ_TUNI1),
80 DEFINE_RES_IRQ(IRQ_TUNI2),
add47067
PM
81};
82
83static struct platform_device tmu0_device = {
1399c195 84 .name = "sh-tmu",
add47067
PM
85 .id = 0,
86 .dev = {
87 .platform_data = &tmu0_platform_data,
88 },
89 .resource = tmu0_resources,
90 .num_resources = ARRAY_SIZE(tmu0_resources),
91};
92
add47067 93static struct platform_device *sh5_early_devices[] __initdata = {
d8d3fbb0 94 &scif0_device,
add47067 95 &tmu0_device,
add47067
PM
96};
97
0fb849b9 98static struct platform_device *sh5_devices[] __initdata = {
c2ecb4c4 99 &rtc_device,
0fb849b9
PM
100};
101
102static int __init sh5_devices_setup(void)
103{
add47067
PM
104 int ret;
105
106 ret = platform_add_devices(sh5_early_devices,
107 ARRAY_SIZE(sh5_early_devices));
108 if (unlikely(ret != 0))
109 return ret;
110
0fb849b9
PM
111 return platform_add_devices(sh5_devices,
112 ARRAY_SIZE(sh5_devices));
113}
ba9a6337 114arch_initcall(sh5_devices_setup);
add47067
PM
115
116void __init plat_early_device_setup(void)
117{
118 early_platform_add_devices(sh5_early_devices,
119 ARRAY_SIZE(sh5_early_devices));
120}