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 timer8_platform_data = {
67 .mode = H8300_TMR8_CLKSRC,
68 .div = H8300_TMR8_DIV_64,
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 = &timer8_platform_data,
84 .resource = tm8_unit0_resources,
85 .num_resources = ARRAY_SIZE(tm8_unit0_resources),
88 static struct resource tm8_unit1_resources[] = {
89 DEFINE_RES_MEM(0xffff90, 9),
94 static struct platform_device timer8_unit1_device = {
95 .name = "h8300-8timer",
98 .platform_data = &timer8_platform_data,
100 .resource = tm8_unit1_resources,
101 .num_resources = ARRAY_SIZE(tm8_unit1_resources),
105 static struct h8300_timer16_config timer16data0 = {
112 static struct h8300_timer16_config timer16data1 = {
119 static struct h8300_timer16_config timer16data2 = {
126 static struct resource tm16ch0_resources[] = {
127 DEFINE_RES_MEM(0xffff68, 8),
128 DEFINE_RES_MEM(0xffff60, 7),
132 static struct resource tm16ch1_resources[] = {
133 DEFINE_RES_MEM(0xffff70, 8),
134 DEFINE_RES_MEM(0xffff60, 7),
138 static struct resource tm16ch2_resources[] = {
139 DEFINE_RES_MEM(0xffff78, 8),
140 DEFINE_RES_MEM(0xffff60, 7),
144 static struct platform_device timer16_ch0_device = {
145 .name = "h8300h-16timer",
148 .platform_data = &timer16data0,
150 .resource = tm16ch0_resources,
151 .num_resources = ARRAY_SIZE(tm16ch0_resources),
154 static struct platform_device timer16_ch1_device = {
155 .name = "h8300h-16timer",
158 .platform_data = &timer16data1,
160 .resource = tm16ch1_resources,
161 .num_resources = ARRAY_SIZE(tm16ch1_resources),
164 static struct platform_device timer16_ch2_device = {
165 .name = "h8300h-16timer",
168 .platform_data = &timer16data2,
170 .resource = tm16ch2_resources,
171 .num_resources = ARRAY_SIZE(tm16ch2_resources),
174 static struct platform_device *devices[] __initdata = {
175 &timer8_unit0_device,
176 &timer8_unit1_device,
183 static struct platform_device *early_devices[] __initdata = {
189 static int __init devices_register(void)
191 return platform_add_devices(devices,
192 ARRAY_SIZE(devices));
195 arch_initcall(devices_register);
197 void __init early_device_register(void)
199 early_platform_add_devices(early_devices,
200 ARRAY_SIZE(devices));
201 /* All interrupt priority high */
202 ctrl_outb(0xff, 0xfee018);
203 ctrl_outb(0xff, 0xfee019);