linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: linux-arch@vger.kernel.org
Subject: [PATCH 05/16] h8300: Target depend (hw define) part
Date: Wed, 21 Jan 2015 13:25:23 +0900	[thread overview]
Message-ID: <87sif4vjyk.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <cover.1421813622.git.ysato@users.sourceforge.jp>

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

 create mode 100644 arch/h8300/kernel/cpu/h83069/Makefile
 create mode 100644 arch/h8300/kernel/cpu/h83069/setup.c
 create mode 100644 arch/h8300/kernel/cpu/h8s2678/Makefile
 create mode 100644 arch/h8300/kernel/cpu/h8s2678/setup.c

diff --git a/arch/h8300/kernel/cpu/h83069/Makefile b/arch/h8300/kernel/cpu/h83069/Makefile
new file mode 100644
index 0000000..49d283e
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h83069/Makefile
@@ -0,0 +1 @@
+obj-y = setup.o
diff --git a/arch/h8300/kernel/cpu/h83069/setup.c b/arch/h8300/kernel/cpu/h83069/setup.c
new file mode 100644
index 0000000..99c2716
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h83069/setup.c
@@ -0,0 +1,202 @@
+/*
+ * H8/3069 Internal peripheral setup
+ *
+ *  Copyright (C) 2009,2014 Yoshinori Sato <ysato@users.sourceforge.jp>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/serial_sci.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <asm/timer.h>
+
+static struct resource sci0_resources[] = {
+	DEFINE_RES_MEM(0xffffb0, 8),
+	DEFINE_RES_IRQ(52),
+	DEFINE_RES_IRQ(53),
+	DEFINE_RES_IRQ(54),
+	DEFINE_RES_IRQ(55),
+};
+
+
+static struct plat_sci_port sci0_platform_data = {
+	.flags		= UPF_BOOT_AUTOCONF,
+	.scscr		= SCSCR_RE | SCSCR_TE,
+	.type		= PORT_SCI,
+};
+
+static struct resource sci1_resources[] = {
+	DEFINE_RES_MEM(0xffffb8, 8),
+	DEFINE_RES_IRQ(56),
+	DEFINE_RES_IRQ(57),
+	DEFINE_RES_IRQ(58),
+	DEFINE_RES_IRQ(59),
+};
+
+static struct plat_sci_port sci1_platform_data = {
+	.flags		= UPF_BOOT_AUTOCONF,
+	.scscr		= SCSCR_RE | SCSCR_TE,
+	.type		= PORT_SCI,
+};
+
+static struct platform_device sci0_device = {
+	.name		= "sh-sci",
+	.id		= 0,
+	.resource	= sci0_resources,
+	.num_resources	= ARRAY_SIZE(sci0_resources),
+	.dev		= {
+		.platform_data	= &sci0_platform_data,
+	},
+};
+
+static struct platform_device sci1_device = {
+	.name		= "sh-sci",
+	.id		= 1,
+	.resource	= sci1_resources,
+	.num_resources	= ARRAY_SIZE(sci1_resources),
+	.dev		= {
+		.platform_data	= &sci1_platform_data,
+	},
+};
+
+static struct h8300_timer8_config tm8_unit0_platform_data = {
+	.mode	= H8300_TMR8_CLKEVTDEV,
+	.div	= H8300_TMR8_DIV_8,
+};
+
+static struct resource tm8_unit0_resources[] = {
+	DEFINE_RES_MEM(0xffff80, 9),
+	DEFINE_RES_IRQ(36),
+	DEFINE_RES_IRQ(39),
+};
+
+static struct platform_device timer8_unit0_device = {
+	.name		= "h8300-8timer",
+	.id		= 0,
+	.dev = {
+		.platform_data	= &tm8_unit0_platform_data,
+	},
+	.resource	= tm8_unit0_resources,
+	.num_resources	= ARRAY_SIZE(tm8_unit0_resources),
+};
+
+static struct h8300_timer8_config tm8_unit1_platform_data = {
+	.mode	= H8300_TMR8_CLKSRC,
+	.div	= H8300_TMR8_DIV_8,
+};
+
+static struct resource tm8_unit1_resources[] = {
+	DEFINE_RES_MEM(0xffff90, 9),
+	DEFINE_RES_IRQ(40),
+	DEFINE_RES_IRQ(43),
+};
+
+static struct platform_device timer8_unit1_device = {
+	.name		= "h8300-8timer",
+	.id		= 1,
+	.dev = {
+		.platform_data	= &tm8_unit1_platform_data,
+	},
+	.resource	= tm8_unit1_resources,
+	.num_resources	= ARRAY_SIZE(tm8_unit1_resources),
+};
+
+
+static struct h8300_timer16_config timer16data0 = {
+	.enb	= 0,
+	.imfa	= 0,
+	.imiea	= 4,
+};
+
+static struct h8300_timer16_config timer16data1 = {
+	.enb	= 1,
+	.imfa	= 1,
+	.imiea	= 5,
+};
+
+static struct h8300_timer16_config timer16data2 = {
+	.enb	= 2,
+	.imfa	= 2,
+	.imiea	= 6,
+};
+
+static struct resource tm16ch0_resources[] = {
+	DEFINE_RES_MEM(0xffff68, 8),
+	DEFINE_RES_MEM(0xffff60, 7),
+	DEFINE_RES_IRQ(24),
+};
+
+static struct resource tm16ch1_resources[] = {
+	DEFINE_RES_MEM(0xffff70, 8),
+	DEFINE_RES_MEM(0xffff60, 7),
+	DEFINE_RES_IRQ(28),
+};
+
+static struct resource tm16ch2_resources[] = {
+	DEFINE_RES_MEM(0xffff78, 8),
+	DEFINE_RES_MEM(0xffff60, 7),
+	DEFINE_RES_IRQ(32),
+};
+
+static struct platform_device timer16_ch0_device = {
+	.name	= "h8300h-16timer",
+	.id		= 0,
+	.dev		= {
+		.platform_data	= &timer16data0,
+	},
+	.resource	= tm16ch0_resources,
+	.num_resources	= ARRAY_SIZE(tm16ch0_resources),
+};
+
+static struct platform_device timer16_ch1_device = {
+	.name	= "h8300h-16timer",
+	.id		= 1,
+	.dev		= {
+		.platform_data	= &timer16data1,
+	},
+	.resource	= tm16ch1_resources,
+	.num_resources	= ARRAY_SIZE(tm16ch1_resources),
+};
+
+static struct platform_device timer16_ch2_device = {
+	.name	= "h8300h-16timer",
+	.id		= 2,
+	.dev		= {
+		.platform_data	= &timer16data2,
+	},
+	.resource	= tm16ch2_resources,
+	.num_resources	= ARRAY_SIZE(tm16ch2_resources),
+};
+
+static struct platform_device *devices[] __initdata = {
+	&timer8_unit1_device,
+	&timer16_ch0_device,
+	&timer16_ch1_device,
+	&timer16_ch2_device,
+	&sci0_device,
+	&sci1_device,
+};
+
+static struct platform_device *early_devices[] __initdata = {
+	&timer8_unit0_device,
+	&sci0_device,
+	&sci1_device,
+};
+
+static int __init devices_register(void)
+{
+	return platform_add_devices(devices,
+				    ARRAY_SIZE(devices));
+}
+
+arch_initcall(devices_register);
+
+void __init early_device_init(void)
+{
+	early_platform_add_devices(early_devices,
+				   ARRAY_SIZE(early_devices));
+}
diff --git a/arch/h8300/kernel/cpu/h8s2678/Makefile b/arch/h8300/kernel/cpu/h8s2678/Makefile
new file mode 100644
index 0000000..49d283e
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h8s2678/Makefile
@@ -0,0 +1 @@
+obj-y = setup.o
diff --git a/arch/h8300/kernel/cpu/h8s2678/setup.c b/arch/h8300/kernel/cpu/h8s2678/setup.c
new file mode 100644
index 0000000..ea743ec
--- /dev/null
+++ b/arch/h8300/kernel/cpu/h8s2678/setup.c
@@ -0,0 +1,161 @@
+/*
+ * H8S2678 Internal peripheral setup
+ *
+ *  Copyright (C) 2014  Yoshinori Sato <ysato@users.sourceforge.jp>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/serial_sci.h>
+#include <asm/timer.h>
+
+static struct resource sci0_resources[] = {
+	DEFINE_RES_MEM(0xffff78, 8),
+	DEFINE_RES_IRQ(88),
+	DEFINE_RES_IRQ(89),
+	DEFINE_RES_IRQ(90),
+	DEFINE_RES_IRQ(91),
+};
+
+
+static struct plat_sci_port sci0_platform_data = {
+	.flags		= UPF_BOOT_AUTOCONF,
+	.scscr		= SCSCR_RE | SCSCR_TE,
+	.type		= PORT_SCI,
+};
+
+static struct resource sci1_resources[] = {
+	DEFINE_RES_MEM(0xffff80, 8),
+	DEFINE_RES_IRQ(92),
+	DEFINE_RES_IRQ(93),
+	DEFINE_RES_IRQ(94),
+	DEFINE_RES_IRQ(95),
+};
+
+static struct plat_sci_port sci1_platform_data = {
+	.flags		= UPF_BOOT_AUTOCONF,
+	.scscr		= SCSCR_RE | SCSCR_TE,
+	.type		= PORT_SCI,
+};
+
+static struct resource sci2_resources[] = {
+	DEFINE_RES_MEM(0xffff88, 8),
+	DEFINE_RES_IRQ(96),
+	DEFINE_RES_IRQ(97),
+	DEFINE_RES_IRQ(98),
+	DEFINE_RES_IRQ(99),
+};
+
+static struct plat_sci_port sci2_platform_data = {
+	.flags		= UPF_BOOT_AUTOCONF,
+	.scscr		= SCSCR_RE | SCSCR_TE,
+	.type		= PORT_SCI,
+};
+
+static struct platform_device sci0_device = {
+	.name		= "sh-sci",
+	.id		= 0,
+	.resource	= sci0_resources,
+	.num_resources	= ARRAY_SIZE(sci0_resources),
+	.dev		= {
+		.platform_data	= &sci0_platform_data,
+	},
+};
+
+static struct platform_device sci1_device = {
+	.name		= "sh-sci",
+	.id		= 1,
+	.resource	= sci1_resources,
+	.num_resources	= ARRAY_SIZE(sci1_resources),
+	.dev		= {
+		.platform_data	= &sci1_platform_data,
+	},
+};
+
+static struct platform_device sci2_device = {
+	.name		= "sh-sci",
+	.id		= 2,
+	.resource	= sci2_resources,
+	.num_resources	= ARRAY_SIZE(sci2_resources),
+	.dev		= {
+		.platform_data	= &sci2_platform_data,
+	},
+};
+
+static struct h8300_timer8_config timer8_platform_data = {
+	.mode	= H8300_TMR8_CLKEVTDEV,
+	.div	= H8300_TMR8_DIV_8,
+};
+
+static struct resource tm8_unit0_resources[] = {
+	DEFINE_RES_MEM(0xffffb0, 10),
+	DEFINE_RES_IRQ(72),
+	DEFINE_RES_IRQ(75),
+};
+
+static struct platform_device tm8_unit0_device = {
+	.name		= "h8300-8timer",
+	.id		= 0,
+	.dev = {
+		.platform_data	= &timer8_platform_data,
+	},
+	.resource	= tm8_unit0_resources,
+	.num_resources	= ARRAY_SIZE(tm8_unit0_resources),
+};
+
+static struct resource tpu12_resources[] = {
+	DEFINE_RES_MEM(0xffffe0, 16),
+	DEFINE_RES_MEM(0xfffff0, 12),
+};
+
+static struct resource tpu45_resources[] = {
+	DEFINE_RES_MEM(0xfffe90, 16),
+	DEFINE_RES_MEM(0xfffea0, 12),
+};
+
+static struct platform_device tpu12_device = {
+	.name	= "h8s-tpu",
+	.id		= 0,
+	.resource	= tpu12_resources,
+	.num_resources	= ARRAY_SIZE(tpu12_resources),
+};
+
+static struct platform_device tpu45_device = {
+	.name	= "h8s-tpu",
+	.id		= 1,
+	.resource	= tpu45_resources,
+	.num_resources	= ARRAY_SIZE(tpu45_resources),
+};
+
+static struct platform_device *devices[] __initdata = {
+	&tpu12_device,
+	&tpu45_device,
+	&sci0_device,
+	&sci1_device,
+	&sci2_device,
+};
+
+static struct platform_device *early_devices[] __initdata = {
+	&tm8_unit0_device,
+	&sci0_device,
+	&sci1_device,
+	&sci2_device,
+};
+
+static int __init devices_register(void)
+{
+	return platform_add_devices(devices,
+				    ARRAY_SIZE(devices));
+}
+arch_initcall(devices_register);
+
+void __init early_device_init(void)
+{
+	/* SCI / Timer enable */
+	ctrl_outw(0x07f0, 0xffff40);
+	early_platform_add_devices(early_devices,
+				   ARRAY_SIZE(early_devices));
+}
-- 
2.1.3

  parent reply	other threads:[~2015-01-21  4:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1421813622.git.ysato@users.sourceforge.jp>
2015-01-21  4:23 ` [PATCH 01/16] h8300: Assembly headers Yoshinori Sato
2015-01-21 11:02   ` Geert Uytterhoeven
2015-01-21 17:22     ` Yoshinori Sato
2015-01-21  4:23 ` [PATCH 02/16] h8300: UAPI headers Yoshinori Sato
2015-01-21  8:46   ` Arnd Bergmann
2015-01-21 17:16     ` Yoshinori Sato
2015-01-21  4:24 ` [PATCH 03/16] h8300: defconfigs Yoshinori Sato
2015-01-21  8:47   ` Arnd Bergmann
2015-01-21  4:24 ` [PATCH 04/16] h8300: Memory management Yoshinori Sato
2015-01-21 10:57   ` Geert Uytterhoeven
2015-01-21 17:20     ` Yoshinori Sato
2015-01-21  4:25 ` Yoshinori Sato [this message]
2015-01-21  4:27 ` [PATCH 06/16] drivers: Add h8300 Yoshinori Sato
2015-01-21 11:03   ` Geert Uytterhoeven
2015-01-21 17:23     ` Yoshinori Sato
2015-01-21  4:29 ` [PATCH 07/16] Add ELF machine Yoshinori Sato
2015-01-21  4:29 ` [PATCH 08/16] h8300: Build scripts Yoshinori Sato
2015-01-21  4:30 ` [PATCH 09/16] h8300: kernel startup Yoshinori Sato
2015-01-21  4:30 ` [PATCH 10/16] h8300: Exception and Interrupt handler Yoshinori Sato
2015-01-21  4:31 ` [PATCH 11/16] h8300: Libraries Yoshinori Sato
2015-01-21  4:31 ` [PATCH 12/16] h8300: clocksource Yoshinori Sato
2015-01-21  8:49   ` Arnd Bergmann
2015-01-21 17:06     ` Yoshinori Sato
2015-01-21  4:31 ` [PATCH 13/16] h8300: ptrace helper Yoshinori Sato
2015-01-21  8:51   ` Arnd Bergmann
2015-01-21 17:08     ` Yoshinori Sato
2015-01-21  4:32 ` [PATCH 14/16] h8300: signal handler Yoshinori Sato
2015-01-21  4:32 ` [PATCH 15/16] h8300: system call entry table Yoshinori Sato
2015-01-21  4:32 ` [PATCH 16/16] h8300: misc functions Yoshinori Sato
2015-01-21  9:01   ` Arnd Bergmann
2015-01-21 17:19     ` Yoshinori Sato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sif4vjyk.wl-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=linux-arch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).