2 * H8/3069 Internal peripheral setup
4 * Copyright (C) 2009,2014 Yoshinori Sato <ysato@users.sourceforge.jp>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/platform_device.h>
12 #include <linux/serial_sci.h>
13 #include <linux/init.h>
15 #include <asm/timer.h>
17 static struct resource sci0_resources[] = {
18 DEFINE_RES_MEM(0xffffb0, 8),
26 static struct plat_sci_port sci0_platform_data = {
27 .flags = UPF_BOOT_AUTOCONF,
28 .scscr = SCSCR_RE | SCSCR_TE,
32 static struct resource sci1_resources[] = {
33 DEFINE_RES_MEM(0xffffb8, 8),
40 static struct plat_sci_port sci1_platform_data = {
41 .flags = UPF_BOOT_AUTOCONF,
42 .scscr = SCSCR_RE | SCSCR_TE,
46 static struct platform_device sci0_device = {
49 .resource = sci0_resources,
50 .num_resources = ARRAY_SIZE(sci0_resources),
52 .platform_data = &sci0_platform_data,
56 static struct platform_device sci1_device = {
59 .resource = sci1_resources,
60 .num_resources = ARRAY_SIZE(sci1_resources),
62 .platform_data = &sci1_platform_data,
66 static struct h8300_timer8_config tm8_unit0_platform_data = {
67 .mode = H8300_TMR8_CLKEVTDEV,
68 .div = H8300_TMR8_DIV_8,
72 static struct resource tm8_unit0_resources[] = {
73 DEFINE_RES_MEM(0xffff80, 9),
78 static struct platform_device timer8_unit0_device = {
79 .name = "h8300-8timer",
82 .platform_data = &tm8_unit0_platform_data,
84 .resource = tm8_unit0_resources,
85 .num_resources = ARRAY_SIZE(tm8_unit0_resources),
88 static struct h8300_timer8_config tm8_unit1_platform_data = {
89 .mode = H8300_TMR8_CLKSRC,
90 .div = H8300_TMR8_DIV_8,
94 static struct resource tm8_unit1_resources[] = {
95 DEFINE_RES_MEM(0xffff90, 9),
100 static struct platform_device timer8_unit1_device = {
101 .name = "h8300-8timer",
104 .platform_data = &tm8_unit1_platform_data,
106 .resource = tm8_unit1_resources,
107 .num_resources = ARRAY_SIZE(tm8_unit1_resources),
111 static struct h8300_timer16_config timer16data0 = {
118 static struct h8300_timer16_config timer16data1 = {
125 static struct h8300_timer16_config timer16data2 = {
132 static struct resource tm16ch0_resources[] = {
133 DEFINE_RES_MEM(0xffff68, 8),
134 DEFINE_RES_MEM(0xffff60, 7),
138 static struct resource tm16ch1_resources[] = {
139 DEFINE_RES_MEM(0xffff70, 8),
140 DEFINE_RES_MEM(0xffff60, 7),
144 static struct resource tm16ch2_resources[] = {
145 DEFINE_RES_MEM(0xffff78, 8),
146 DEFINE_RES_MEM(0xffff60, 7),
150 static struct platform_device timer16_ch0_device = {
151 .name = "h8300h-16timer",
154 .platform_data = &timer16data0,
156 .resource = tm16ch0_resources,
157 .num_resources = ARRAY_SIZE(tm16ch0_resources),
160 static struct platform_device timer16_ch1_device = {
161 .name = "h8300h-16timer",
164 .platform_data = &timer16data1,
166 .resource = tm16ch1_resources,
167 .num_resources = ARRAY_SIZE(tm16ch1_resources),
170 static struct platform_device timer16_ch2_device = {
171 .name = "h8300h-16timer",
174 .platform_data = &timer16data2,
176 .resource = tm16ch2_resources,
177 .num_resources = ARRAY_SIZE(tm16ch2_resources),
180 static struct platform_device *devices[] __initdata = {
181 &timer8_unit1_device,
189 static struct platform_device *early_devices[] __initdata = {
190 &timer8_unit0_device,
195 static int __init devices_register(void)
197 return platform_add_devices(devices,
198 ARRAY_SIZE(devices));
201 arch_initcall(devices_register);
203 void __init early_device_init(void)
205 /* All interrupt priority high */
206 ctrl_outb(0xff, 0xfee018);
207 ctrl_outb(0xff, 0xfee019);
208 early_platform_add_devices(early_devices,
209 ARRAY_SIZE(early_devices));