All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-16  6:44 ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

mach-shmobile: Emma Mobile EV2 support V3

[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
[PATCH 02/08] ARM: Undelete KZM9D mach-type V3
[PATCH 03/08] mach-shmobile: KZM9D board support V3
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
[PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
[PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
[PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

This series are the third iteration of Emma Mobile EV2 support
for mach-shmobile. Yet another dual core Cortex-A9 SoC.

At this point serial, timer and gpio are supported as platform
devices. Serial and timer also come with DT bindings.

Basic SMP support is in place, but CPU hotplug and TWD needs
more work.

Clocks are enabled in the case of the KZM9D board support
via platform devices. In the DT case there are no clocks
enabled. So anyone playing around with DT will have to accept
the fact that it is very limited at tis point. All features with
upstream support can however be enabled via regular platform devices.

Many thanks to Arnd for his endless reviews and helpful
suggestions and a lot of patience!

To build this you also need whatever included in linux-next
as of 20120514 plus the following patches:

[PATCH 01/03] clockevents: Make clockevents_config() a global symbol
[PATCH 02/03] clocksource: em_sti: Emma Mobile STI driver V2
[PATCH 03/03] clocksource: em_sti: Add DT support
[PATCH] gpio: Emma Mobile GPIO driver V2

The only update since V2 of this series is DT related bits
in [7/8] and [8/8] plus the mach-type change in [2/8].

In case the GPIO driver does not get merged it should be possible
to omit [5/8] and [6/8] and still have a working but limited system.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Applies to linux-next 20120514

 arch/arm/boot/dts/emev2-kzm9d.dts           |   26 +
 arch/arm/boot/dts/emev2.dtsi                |   63 +++
 arch/arm/mach-shmobile/Kconfig              |   11 
 arch/arm/mach-shmobile/Makefile             |    3 
 arch/arm/mach-shmobile/board-kzm9d.c        |   89 +++++
 arch/arm/mach-shmobile/clock-emev2.c        |  249 ++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |   19 +
 arch/arm/mach-shmobile/platsmp.c            |   20 +
 arch/arm/mach-shmobile/setup-emev2.c        |  454 ++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++
 arch/arm/tools/mach-types                   |    1 
 11 files changed, 1028 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-16  6:44 ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: horms, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof,
	Magnus Damm

mach-shmobile: Emma Mobile EV2 support V3

[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
[PATCH 02/08] ARM: Undelete KZM9D mach-type V3
[PATCH 03/08] mach-shmobile: KZM9D board support V3
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
[PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
[PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
[PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

This series are the third iteration of Emma Mobile EV2 support
for mach-shmobile. Yet another dual core Cortex-A9 SoC.

At this point serial, timer and gpio are supported as platform
devices. Serial and timer also come with DT bindings.

Basic SMP support is in place, but CPU hotplug and TWD needs
more work.

Clocks are enabled in the case of the KZM9D board support
via platform devices. In the DT case there are no clocks
enabled. So anyone playing around with DT will have to accept
the fact that it is very limited at tis point. All features with
upstream support can however be enabled via regular platform devices.

Many thanks to Arnd for his endless reviews and helpful
suggestions and a lot of patience!

To build this you also need whatever included in linux-next
as of 20120514 plus the following patches:

[PATCH 01/03] clockevents: Make clockevents_config() a global symbol
[PATCH 02/03] clocksource: em_sti: Emma Mobile STI driver V2
[PATCH 03/03] clocksource: em_sti: Add DT support
[PATCH] gpio: Emma Mobile GPIO driver V2

The only update since V2 of this series is DT related bits
in [7/8] and [8/8] plus the mach-type change in [2/8].

In case the GPIO driver does not get merged it should be possible
to omit [5/8] and [6/8] and still have a working but limited system.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Applies to linux-next 20120514

 arch/arm/boot/dts/emev2-kzm9d.dts           |   26 +
 arch/arm/boot/dts/emev2.dtsi                |   63 +++
 arch/arm/mach-shmobile/Kconfig              |   11 
 arch/arm/mach-shmobile/Makefile             |    3 
 arch/arm/mach-shmobile/board-kzm9d.c        |   89 +++++
 arch/arm/mach-shmobile/clock-emev2.c        |  249 ++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |   19 +
 arch/arm/mach-shmobile/platsmp.c            |   20 +
 arch/arm/mach-shmobile/setup-emev2.c        |  454 ++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++
 arch/arm/tools/mach-types                   |    1 
 11 files changed, 1028 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-16  6:44 ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

mach-shmobile: Emma Mobile EV2 support V3

[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
[PATCH 02/08] ARM: Undelete KZM9D mach-type V3
[PATCH 03/08] mach-shmobile: KZM9D board support V3
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
[PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
[PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
[PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

This series are the third iteration of Emma Mobile EV2 support
for mach-shmobile. Yet another dual core Cortex-A9 SoC.

At this point serial, timer and gpio are supported as platform
devices. Serial and timer also come with DT bindings.

Basic SMP support is in place, but CPU hotplug and TWD needs
more work.

Clocks are enabled in the case of the KZM9D board support
via platform devices. In the DT case there are no clocks
enabled. So anyone playing around with DT will have to accept
the fact that it is very limited at tis point. All features with
upstream support can however be enabled via regular platform devices.

Many thanks to Arnd for his endless reviews and helpful
suggestions and a lot of patience!

To build this you also need whatever included in linux-next
as of 20120514 plus the following patches:

[PATCH 01/03] clockevents: Make clockevents_config() a global symbol
[PATCH 02/03] clocksource: em_sti: Emma Mobile STI driver V2
[PATCH 03/03] clocksource: em_sti: Add DT support
[PATCH] gpio: Emma Mobile GPIO driver V2

The only update since V2 of this series is DT related bits
in [7/8] and [8/8] plus the mach-type change in [2/8].

In case the GPIO driver does not get merged it should be possible
to omit [5/8] and [6/8] and still have a working but limited system.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Applies to linux-next 20120514

 arch/arm/boot/dts/emev2-kzm9d.dts           |   26 +
 arch/arm/boot/dts/emev2.dtsi                |   63 +++
 arch/arm/mach-shmobile/Kconfig              |   11 
 arch/arm/mach-shmobile/Makefile             |    3 
 arch/arm/mach-shmobile/board-kzm9d.c        |   89 +++++
 arch/arm/mach-shmobile/clock-emev2.c        |  249 ++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |   19 +
 arch/arm/mach-shmobile/platsmp.c            |   20 +
 arch/arm/mach-shmobile/setup-emev2.c        |  454 ++++++++++++++++++++++++++-
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++
 arch/arm/tools/mach-types                   |    1 
 11 files changed, 1028 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:44   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is V3 of the Emma Mobile EV2 SoC support.
Included here is support for serial and timer
devices which is just about enough to boot a kernel.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - use IOMEM(), ioremap() and iowrite32() for clock code
 - use built-in ioremap in shared sh clock code
 - break out function prototypes to a separate header
 - move gic code into setup-emev2.c
 - get rid of static io table

 Thanks to Arnd for his kind help!

 arch/arm/mach-shmobile/Kconfig              |    5 
 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |  226 +++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    9 +
 arch/arm/mach-shmobile/setup-emev2.c        |  180 +++++++++++++++++++++
 5 files changed, 421 insertions(+)

--- 0003/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:10.000000000 +0900
@@ -41,6 +41,11 @@ config ARCH_R8A7779
 	select ARM_GIC
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 
+config ARCH_EMEV2
+	bool "Emma Mobile EV2"
+	select CPU_V7
+	select ARM_GIC
+
 comment "SH-Mobile Board Type"
 
 config MACH_G3EVM
--- 0001/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:20.000000000 +0900
@@ -12,6 +12,7 @@ obj-$(CONFIG_ARCH_SH7372)	+= setup-sh737
 obj-$(CONFIG_ARCH_SH73A0)	+= setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
 obj-$(CONFIG_ARCH_R8A7740)	+= setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
+obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o clock-emev2.o
 
 # SMP objects
 smp-y				:= platsmp.o headsmp.o
--- /dev/null
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,226 @@
+/*
+ * Emma Mobile EV2 clock framework support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/sh_clk.h>
+#include <linux/clkdev.h>
+#include <mach/common.h>
+
+#define EMEV2_SMU_BASE 0xe0110000
+
+/* EMEV2 SMU registers */
+#define USIAU0_RSTCTRL 0x094
+#define USIBU1_RSTCTRL 0x0ac
+#define USIBU2_RSTCTRL 0x0b0
+#define USIBU3_RSTCTRL 0x0b4
+#define STI_RSTCTRL 0x124
+#define USIAU0GCLKCTRL 0x4a0
+#define USIBU1GCLKCTRL 0x4b8
+#define USIBU2GCLKCTRL 0x4bc
+#define USIBU3GCLKCTRL 0x04c0
+#define STIGCLKCTRL 0x528
+#define USIAU0SCLKDIV 0x61c
+#define USIB2SCLKDIV 0x65c
+#define USIB3SCLKDIV 0x660
+#define STI_CLKSEL 0x688
+
+/* not pretty, but hey */
+static void __iomem *smu_base;
+
+static void emev2_smu_write(unsigned long value, int offs)
+{
+	BUG_ON(!smu_base || (offs >= PAGE_SIZE));
+	iowrite32(value, smu_base + offs);
+}
+
+static struct clk_mapping smu_mapping = {
+	.phys	= EMEV2_SMU_BASE,
+	.len	= PAGE_SIZE,
+};
+
+/* Fixed 32 KHz root clock from C32K pin */
+static struct clk c32k_clk = {
+	.rate           = 32768,
+	.mapping	= &smu_mapping,
+};
+
+/* PLL3 multiplies C32K with 7000 */
+static unsigned long pll3_recalc(struct clk *clk)
+{
+	return clk->parent->rate * 7000;
+}
+
+static struct sh_clk_ops pll3_clk_ops = {
+	.recalc		= pll3_recalc,
+};
+
+static struct clk pll3_clk = {
+	.ops		= &pll3_clk_ops,
+	.parent		= &c32k_clk,
+};
+
+static struct clk *main_clks[] = {
+	&c32k_clk,
+	&pll3_clk,
+};
+
+enum { SCLKDIV_USIAU0, SCLKDIV_USIBU2, SCLKDIV_USIBU1, SCLKDIV_USIBU3,
+	SCLKDIV_NR };
+
+#define SCLKDIV(_reg, _shift)			\
+{								\
+	.parent		= &pll3_clk,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= _shift,				\
+}
+
+static struct clk sclkdiv_clks[SCLKDIV_NR] = {
+	[SCLKDIV_USIAU0] = SCLKDIV(USIAU0SCLKDIV, 0),
+	[SCLKDIV_USIBU2] = SCLKDIV(USIB2SCLKDIV, 16),
+	[SCLKDIV_USIBU1] = SCLKDIV(USIB2SCLKDIV, 0),
+	[SCLKDIV_USIBU3] = SCLKDIV(USIB3SCLKDIV, 0),
+};
+
+enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
+	GCLK_STI_SCLK,
+	GCLK_NR };
+
+#define GCLK_SCLK(_parent, _reg) \
+{								\
+	.parent		= _parent,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= 1, /* SCLK_GCC */			\
+}
+
+static struct clk gclk_clks[GCLK_NR] = {
+	[GCLK_USIAU0_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIAU0],
+				       USIAU0GCLKCTRL),
+	[GCLK_USIBU1_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU1],
+				       USIBU1GCLKCTRL),
+	[GCLK_USIBU2_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU2],
+				       USIBU2GCLKCTRL),
+	[GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
+				       USIBU3GCLKCTRL),
+	[GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
+};
+
+static int emev2_gclk_enable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
+		  clk->mapped_reg);
+	return 0;
+}
+
+static void emev2_gclk_disable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
+		  clk->mapped_reg);
+}
+
+static struct sh_clk_ops emev2_gclk_clk_ops = {
+	.enable		= emev2_gclk_enable,
+	.disable	= emev2_gclk_disable,
+	.recalc		= followparent_recalc,
+};
+
+static int __init emev2_gclk_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_gclk_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static unsigned long emev2_sclkdiv_recalc(struct clk *clk)
+{
+	unsigned int sclk_div;
+
+	sclk_div = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0xff;
+
+	return clk->parent->rate / (sclk_div + 1);
+}
+
+static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
+	.recalc		= emev2_sclkdiv_recalc,
+};
+
+static int __init emev2_sclkdiv_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_sclkdiv_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static struct clk_lookup lookups[] = {
+	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+};
+
+void __init emev2_clock_init(void)
+{
+	int k, ret = 0;
+
+	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
+	BUG_ON(!smu_base);
+
+	/* setup STI timer to run on 37.768 kHz and deassert reset */
+	emev2_smu_write(0, STI_CLKSEL);
+	emev2_smu_write(1, STI_RSTCTRL);
+
+	/* deassert reset for UART0->UART3 */
+	emev2_smu_write(2, USIAU0_RSTCTRL);
+	emev2_smu_write(2, USIBU1_RSTCTRL);
+	emev2_smu_write(2, USIBU2_RSTCTRL);
+	emev2_smu_write(2, USIBU3_RSTCTRL);
+
+	for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
+		ret = clk_register(main_clks[k]);
+
+	if (!ret)
+		ret = emev2_sclkdiv_register(sclkdiv_clks, SCLKDIV_NR);
+
+	if (!ret)
+		ret = emev2_gclk_register(gclk_clks, GCLK_NR);
+
+	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+	if (!ret)
+		shmobile_clk_init();
+	else
+		panic("failed to setup emev2 clocks\n");
+}
--- /dev/null
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,9 @@
+#ifndef __ASM_EMEV2_H__
+#define __ASM_EMEV2_H__
+
+extern void emev2_init_irq(void);
+extern void emev2_add_early_devices(void);
+extern void emev2_add_standard_devices(void);
+extern void emev2_clock_init(void);
+
+#endif /* __ASM_EMEV2_H__ */
--- /dev/null
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,180 @@
+/*
+ * Emma Mobile EV2 processor support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <mach/irqs.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/time.h>
+#include <asm/hardware/gic.h>
+
+/* UART */
+static struct resource uart0_resources[] = {
+	[0]	= {
+		.start	= 0xe1020000,
+		.end	= 0xe1020037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 40,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart0_device = {
+	.name		= "serial8250-em",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(uart0_resources),
+	.resource	= uart0_resources,
+};
+
+static struct resource uart1_resources[] = {
+	[0]	= {
+		.start	= 0xe1030000,
+		.end	= 0xe1030037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 41,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart1_device = {
+	.name		= "serial8250-em",
+	.id		= 1,
+	.num_resources	= ARRAY_SIZE(uart1_resources),
+	.resource	= uart1_resources,
+};
+
+static struct resource uart2_resources[] = {
+	[0]	= {
+		.start	= 0xe1040000,
+		.end	= 0xe1040037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 42,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart2_device = {
+	.name		= "serial8250-em",
+	.id		= 2,
+	.num_resources	= ARRAY_SIZE(uart2_resources),
+	.resource	= uart2_resources,
+};
+
+static struct resource uart3_resources[] = {
+	[0]	= {
+		.start	= 0xe1050000,
+		.end	= 0xe1050037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 43,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart3_device = {
+	.name		= "serial8250-em",
+	.id		= 3,
+	.num_resources	= ARRAY_SIZE(uart3_resources),
+	.resource	= uart3_resources,
+};
+
+/* STI */
+static struct resource sti_resources[] = {
+	[0] = {
+		.name	= "STI",
+		.start	= 0xe0180000,
+		.end	= 0xe0180053,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 157,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sti_device = {
+	.name		= "em_sti",
+	.id		= 0,
+	.resource	= sti_resources,
+	.num_resources	= ARRAY_SIZE(sti_resources),
+};
+
+static struct platform_device *emev2_early_devices[] __initdata = {
+	&uart0_device,
+	&uart1_device,
+	&uart2_device,
+	&uart3_device,
+};
+
+static struct platform_device *emev2_late_devices[] __initdata = {
+	&sti_device,
+};
+
+void __init emev2_add_standard_devices(void)
+{
+	emev2_clock_init();
+
+	platform_add_devices(emev2_early_devices,
+			     ARRAY_SIZE(emev2_early_devices));
+
+	platform_add_devices(emev2_late_devices,
+			     ARRAY_SIZE(emev2_late_devices));
+}
+
+void __init emev2_add_early_devices(void)
+{
+	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+
+	early_platform_add_devices(emev2_early_devices,
+				   ARRAY_SIZE(emev2_early_devices));
+
+	/* setup early console here as well */
+	shmobile_setup_console();
+}
+
+void __init emev2_init_irq(void)
+{
+	void __iomem *gic_dist_base;
+	void __iomem *gic_cpu_base;
+
+	/* Static mappings, never released */
+	gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
+	gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
+	BUG_ON(!gic_dist_base || !gic_cpu_base);
+
+	/* Use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  6:44   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux, arnd, linux-sh, lethal, linux-kernel, rjw, horms, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

This is V3 of the Emma Mobile EV2 SoC support.
Included here is support for serial and timer
devices which is just about enough to boot a kernel.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - use IOMEM(), ioremap() and iowrite32() for clock code
 - use built-in ioremap in shared sh clock code
 - break out function prototypes to a separate header
 - move gic code into setup-emev2.c
 - get rid of static io table

 Thanks to Arnd for his kind help!

 arch/arm/mach-shmobile/Kconfig              |    5 
 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |  226 +++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    9 +
 arch/arm/mach-shmobile/setup-emev2.c        |  180 +++++++++++++++++++++
 5 files changed, 421 insertions(+)

--- 0003/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:10.000000000 +0900
@@ -41,6 +41,11 @@ config ARCH_R8A7779
 	select ARM_GIC
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 
+config ARCH_EMEV2
+	bool "Emma Mobile EV2"
+	select CPU_V7
+	select ARM_GIC
+
 comment "SH-Mobile Board Type"
 
 config MACH_G3EVM
--- 0001/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:20.000000000 +0900
@@ -12,6 +12,7 @@ obj-$(CONFIG_ARCH_SH7372)	+= setup-sh737
 obj-$(CONFIG_ARCH_SH73A0)	+= setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
 obj-$(CONFIG_ARCH_R8A7740)	+= setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
+obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o clock-emev2.o
 
 # SMP objects
 smp-y				:= platsmp.o headsmp.o
--- /dev/null
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,226 @@
+/*
+ * Emma Mobile EV2 clock framework support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/sh_clk.h>
+#include <linux/clkdev.h>
+#include <mach/common.h>
+
+#define EMEV2_SMU_BASE 0xe0110000
+
+/* EMEV2 SMU registers */
+#define USIAU0_RSTCTRL 0x094
+#define USIBU1_RSTCTRL 0x0ac
+#define USIBU2_RSTCTRL 0x0b0
+#define USIBU3_RSTCTRL 0x0b4
+#define STI_RSTCTRL 0x124
+#define USIAU0GCLKCTRL 0x4a0
+#define USIBU1GCLKCTRL 0x4b8
+#define USIBU2GCLKCTRL 0x4bc
+#define USIBU3GCLKCTRL 0x04c0
+#define STIGCLKCTRL 0x528
+#define USIAU0SCLKDIV 0x61c
+#define USIB2SCLKDIV 0x65c
+#define USIB3SCLKDIV 0x660
+#define STI_CLKSEL 0x688
+
+/* not pretty, but hey */
+static void __iomem *smu_base;
+
+static void emev2_smu_write(unsigned long value, int offs)
+{
+	BUG_ON(!smu_base || (offs >= PAGE_SIZE));
+	iowrite32(value, smu_base + offs);
+}
+
+static struct clk_mapping smu_mapping = {
+	.phys	= EMEV2_SMU_BASE,
+	.len	= PAGE_SIZE,
+};
+
+/* Fixed 32 KHz root clock from C32K pin */
+static struct clk c32k_clk = {
+	.rate           = 32768,
+	.mapping	= &smu_mapping,
+};
+
+/* PLL3 multiplies C32K with 7000 */
+static unsigned long pll3_recalc(struct clk *clk)
+{
+	return clk->parent->rate * 7000;
+}
+
+static struct sh_clk_ops pll3_clk_ops = {
+	.recalc		= pll3_recalc,
+};
+
+static struct clk pll3_clk = {
+	.ops		= &pll3_clk_ops,
+	.parent		= &c32k_clk,
+};
+
+static struct clk *main_clks[] = {
+	&c32k_clk,
+	&pll3_clk,
+};
+
+enum { SCLKDIV_USIAU0, SCLKDIV_USIBU2, SCLKDIV_USIBU1, SCLKDIV_USIBU3,
+	SCLKDIV_NR };
+
+#define SCLKDIV(_reg, _shift)			\
+{								\
+	.parent		= &pll3_clk,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= _shift,				\
+}
+
+static struct clk sclkdiv_clks[SCLKDIV_NR] = {
+	[SCLKDIV_USIAU0] = SCLKDIV(USIAU0SCLKDIV, 0),
+	[SCLKDIV_USIBU2] = SCLKDIV(USIB2SCLKDIV, 16),
+	[SCLKDIV_USIBU1] = SCLKDIV(USIB2SCLKDIV, 0),
+	[SCLKDIV_USIBU3] = SCLKDIV(USIB3SCLKDIV, 0),
+};
+
+enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
+	GCLK_STI_SCLK,
+	GCLK_NR };
+
+#define GCLK_SCLK(_parent, _reg) \
+{								\
+	.parent		= _parent,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= 1, /* SCLK_GCC */			\
+}
+
+static struct clk gclk_clks[GCLK_NR] = {
+	[GCLK_USIAU0_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIAU0],
+				       USIAU0GCLKCTRL),
+	[GCLK_USIBU1_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU1],
+				       USIBU1GCLKCTRL),
+	[GCLK_USIBU2_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU2],
+				       USIBU2GCLKCTRL),
+	[GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
+				       USIBU3GCLKCTRL),
+	[GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
+};
+
+static int emev2_gclk_enable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
+		  clk->mapped_reg);
+	return 0;
+}
+
+static void emev2_gclk_disable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
+		  clk->mapped_reg);
+}
+
+static struct sh_clk_ops emev2_gclk_clk_ops = {
+	.enable		= emev2_gclk_enable,
+	.disable	= emev2_gclk_disable,
+	.recalc		= followparent_recalc,
+};
+
+static int __init emev2_gclk_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_gclk_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static unsigned long emev2_sclkdiv_recalc(struct clk *clk)
+{
+	unsigned int sclk_div;
+
+	sclk_div = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0xff;
+
+	return clk->parent->rate / (sclk_div + 1);
+}
+
+static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
+	.recalc		= emev2_sclkdiv_recalc,
+};
+
+static int __init emev2_sclkdiv_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_sclkdiv_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static struct clk_lookup lookups[] = {
+	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+};
+
+void __init emev2_clock_init(void)
+{
+	int k, ret = 0;
+
+	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
+	BUG_ON(!smu_base);
+
+	/* setup STI timer to run on 37.768 kHz and deassert reset */
+	emev2_smu_write(0, STI_CLKSEL);
+	emev2_smu_write(1, STI_RSTCTRL);
+
+	/* deassert reset for UART0->UART3 */
+	emev2_smu_write(2, USIAU0_RSTCTRL);
+	emev2_smu_write(2, USIBU1_RSTCTRL);
+	emev2_smu_write(2, USIBU2_RSTCTRL);
+	emev2_smu_write(2, USIBU3_RSTCTRL);
+
+	for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
+		ret = clk_register(main_clks[k]);
+
+	if (!ret)
+		ret = emev2_sclkdiv_register(sclkdiv_clks, SCLKDIV_NR);
+
+	if (!ret)
+		ret = emev2_gclk_register(gclk_clks, GCLK_NR);
+
+	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+	if (!ret)
+		shmobile_clk_init();
+	else
+		panic("failed to setup emev2 clocks\n");
+}
--- /dev/null
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,9 @@
+#ifndef __ASM_EMEV2_H__
+#define __ASM_EMEV2_H__
+
+extern void emev2_init_irq(void);
+extern void emev2_add_early_devices(void);
+extern void emev2_add_standard_devices(void);
+extern void emev2_clock_init(void);
+
+#endif /* __ASM_EMEV2_H__ */
--- /dev/null
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,180 @@
+/*
+ * Emma Mobile EV2 processor support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <mach/irqs.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/time.h>
+#include <asm/hardware/gic.h>
+
+/* UART */
+static struct resource uart0_resources[] = {
+	[0]	= {
+		.start	= 0xe1020000,
+		.end	= 0xe1020037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 40,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart0_device = {
+	.name		= "serial8250-em",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(uart0_resources),
+	.resource	= uart0_resources,
+};
+
+static struct resource uart1_resources[] = {
+	[0]	= {
+		.start	= 0xe1030000,
+		.end	= 0xe1030037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 41,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart1_device = {
+	.name		= "serial8250-em",
+	.id		= 1,
+	.num_resources	= ARRAY_SIZE(uart1_resources),
+	.resource	= uart1_resources,
+};
+
+static struct resource uart2_resources[] = {
+	[0]	= {
+		.start	= 0xe1040000,
+		.end	= 0xe1040037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 42,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart2_device = {
+	.name		= "serial8250-em",
+	.id		= 2,
+	.num_resources	= ARRAY_SIZE(uart2_resources),
+	.resource	= uart2_resources,
+};
+
+static struct resource uart3_resources[] = {
+	[0]	= {
+		.start	= 0xe1050000,
+		.end	= 0xe1050037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 43,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart3_device = {
+	.name		= "serial8250-em",
+	.id		= 3,
+	.num_resources	= ARRAY_SIZE(uart3_resources),
+	.resource	= uart3_resources,
+};
+
+/* STI */
+static struct resource sti_resources[] = {
+	[0] = {
+		.name	= "STI",
+		.start	= 0xe0180000,
+		.end	= 0xe0180053,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 157,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sti_device = {
+	.name		= "em_sti",
+	.id		= 0,
+	.resource	= sti_resources,
+	.num_resources	= ARRAY_SIZE(sti_resources),
+};
+
+static struct platform_device *emev2_early_devices[] __initdata = {
+	&uart0_device,
+	&uart1_device,
+	&uart2_device,
+	&uart3_device,
+};
+
+static struct platform_device *emev2_late_devices[] __initdata = {
+	&sti_device,
+};
+
+void __init emev2_add_standard_devices(void)
+{
+	emev2_clock_init();
+
+	platform_add_devices(emev2_early_devices,
+			     ARRAY_SIZE(emev2_early_devices));
+
+	platform_add_devices(emev2_late_devices,
+			     ARRAY_SIZE(emev2_late_devices));
+}
+
+void __init emev2_add_early_devices(void)
+{
+	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+
+	early_platform_add_devices(emev2_early_devices,
+				   ARRAY_SIZE(emev2_early_devices));
+
+	/* setup early console here as well */
+	shmobile_setup_console();
+}
+
+void __init emev2_init_irq(void)
+{
+	void __iomem *gic_dist_base;
+	void __iomem *gic_cpu_base;
+
+	/* Static mappings, never released */
+	gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
+	gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
+	BUG_ON(!gic_dist_base || !gic_cpu_base);
+
+	/* Use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  6:44   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is V3 of the Emma Mobile EV2 SoC support.
Included here is support for serial and timer
devices which is just about enough to boot a kernel.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - use IOMEM(), ioremap() and iowrite32() for clock code
 - use built-in ioremap in shared sh clock code
 - break out function prototypes to a separate header
 - move gic code into setup-emev2.c
 - get rid of static io table

 Thanks to Arnd for his kind help!

 arch/arm/mach-shmobile/Kconfig              |    5 
 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |  226 +++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    9 +
 arch/arm/mach-shmobile/setup-emev2.c        |  180 +++++++++++++++++++++
 5 files changed, 421 insertions(+)

--- 0003/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:10.000000000 +0900
@@ -41,6 +41,11 @@ config ARCH_R8A7779
 	select ARM_GIC
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 
+config ARCH_EMEV2
+	bool "Emma Mobile EV2"
+	select CPU_V7
+	select ARM_GIC
+
 comment "SH-Mobile Board Type"
 
 config MACH_G3EVM
--- 0001/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:20.000000000 +0900
@@ -12,6 +12,7 @@ obj-$(CONFIG_ARCH_SH7372)	+= setup-sh737
 obj-$(CONFIG_ARCH_SH73A0)	+= setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
 obj-$(CONFIG_ARCH_R8A7740)	+= setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
+obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o clock-emev2.o
 
 # SMP objects
 smp-y				:= platsmp.o headsmp.o
--- /dev/null
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,226 @@
+/*
+ * Emma Mobile EV2 clock framework support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/sh_clk.h>
+#include <linux/clkdev.h>
+#include <mach/common.h>
+
+#define EMEV2_SMU_BASE 0xe0110000
+
+/* EMEV2 SMU registers */
+#define USIAU0_RSTCTRL 0x094
+#define USIBU1_RSTCTRL 0x0ac
+#define USIBU2_RSTCTRL 0x0b0
+#define USIBU3_RSTCTRL 0x0b4
+#define STI_RSTCTRL 0x124
+#define USIAU0GCLKCTRL 0x4a0
+#define USIBU1GCLKCTRL 0x4b8
+#define USIBU2GCLKCTRL 0x4bc
+#define USIBU3GCLKCTRL 0x04c0
+#define STIGCLKCTRL 0x528
+#define USIAU0SCLKDIV 0x61c
+#define USIB2SCLKDIV 0x65c
+#define USIB3SCLKDIV 0x660
+#define STI_CLKSEL 0x688
+
+/* not pretty, but hey */
+static void __iomem *smu_base;
+
+static void emev2_smu_write(unsigned long value, int offs)
+{
+	BUG_ON(!smu_base || (offs >= PAGE_SIZE));
+	iowrite32(value, smu_base + offs);
+}
+
+static struct clk_mapping smu_mapping = {
+	.phys	= EMEV2_SMU_BASE,
+	.len	= PAGE_SIZE,
+};
+
+/* Fixed 32 KHz root clock from C32K pin */
+static struct clk c32k_clk = {
+	.rate           = 32768,
+	.mapping	= &smu_mapping,
+};
+
+/* PLL3 multiplies C32K with 7000 */
+static unsigned long pll3_recalc(struct clk *clk)
+{
+	return clk->parent->rate * 7000;
+}
+
+static struct sh_clk_ops pll3_clk_ops = {
+	.recalc		= pll3_recalc,
+};
+
+static struct clk pll3_clk = {
+	.ops		= &pll3_clk_ops,
+	.parent		= &c32k_clk,
+};
+
+static struct clk *main_clks[] = {
+	&c32k_clk,
+	&pll3_clk,
+};
+
+enum { SCLKDIV_USIAU0, SCLKDIV_USIBU2, SCLKDIV_USIBU1, SCLKDIV_USIBU3,
+	SCLKDIV_NR };
+
+#define SCLKDIV(_reg, _shift)			\
+{								\
+	.parent		= &pll3_clk,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= _shift,				\
+}
+
+static struct clk sclkdiv_clks[SCLKDIV_NR] = {
+	[SCLKDIV_USIAU0] = SCLKDIV(USIAU0SCLKDIV, 0),
+	[SCLKDIV_USIBU2] = SCLKDIV(USIB2SCLKDIV, 16),
+	[SCLKDIV_USIBU1] = SCLKDIV(USIB2SCLKDIV, 0),
+	[SCLKDIV_USIBU3] = SCLKDIV(USIB3SCLKDIV, 0),
+};
+
+enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
+	GCLK_STI_SCLK,
+	GCLK_NR };
+
+#define GCLK_SCLK(_parent, _reg) \
+{								\
+	.parent		= _parent,				\
+	.enable_reg	= IOMEM(EMEV2_SMU_BASE + (_reg)),	\
+	.enable_bit	= 1, /* SCLK_GCC */			\
+}
+
+static struct clk gclk_clks[GCLK_NR] = {
+	[GCLK_USIAU0_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIAU0],
+				       USIAU0GCLKCTRL),
+	[GCLK_USIBU1_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU1],
+				       USIBU1GCLKCTRL),
+	[GCLK_USIBU2_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU2],
+				       USIBU2GCLKCTRL),
+	[GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
+				       USIBU3GCLKCTRL),
+	[GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
+};
+
+static int emev2_gclk_enable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
+		  clk->mapped_reg);
+	return 0;
+}
+
+static void emev2_gclk_disable(struct clk *clk)
+{
+	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
+		  clk->mapped_reg);
+}
+
+static struct sh_clk_ops emev2_gclk_clk_ops = {
+	.enable		= emev2_gclk_enable,
+	.disable	= emev2_gclk_disable,
+	.recalc		= followparent_recalc,
+};
+
+static int __init emev2_gclk_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_gclk_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static unsigned long emev2_sclkdiv_recalc(struct clk *clk)
+{
+	unsigned int sclk_div;
+
+	sclk_div = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0xff;
+
+	return clk->parent->rate / (sclk_div + 1);
+}
+
+static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
+	.recalc		= emev2_sclkdiv_recalc,
+};
+
+static int __init emev2_sclkdiv_register(struct clk *clks, int nr)
+{
+	struct clk *clkp;
+	int ret = 0;
+	int k;
+
+	for (k = 0; !ret && (k < nr); k++) {
+		clkp = clks + k;
+		clkp->ops = &emev2_sclkdiv_clk_ops;
+		ret |= clk_register(clkp);
+	}
+
+	return ret;
+}
+
+static struct clk_lookup lookups[] = {
+	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+};
+
+void __init emev2_clock_init(void)
+{
+	int k, ret = 0;
+
+	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
+	BUG_ON(!smu_base);
+
+	/* setup STI timer to run on 37.768 kHz and deassert reset */
+	emev2_smu_write(0, STI_CLKSEL);
+	emev2_smu_write(1, STI_RSTCTRL);
+
+	/* deassert reset for UART0->UART3 */
+	emev2_smu_write(2, USIAU0_RSTCTRL);
+	emev2_smu_write(2, USIBU1_RSTCTRL);
+	emev2_smu_write(2, USIBU2_RSTCTRL);
+	emev2_smu_write(2, USIBU3_RSTCTRL);
+
+	for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
+		ret = clk_register(main_clks[k]);
+
+	if (!ret)
+		ret = emev2_sclkdiv_register(sclkdiv_clks, SCLKDIV_NR);
+
+	if (!ret)
+		ret = emev2_gclk_register(gclk_clks, GCLK_NR);
+
+	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
+	if (!ret)
+		shmobile_clk_init();
+	else
+		panic("failed to setup emev2 clocks\n");
+}
--- /dev/null
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,9 @@
+#ifndef __ASM_EMEV2_H__
+#define __ASM_EMEV2_H__
+
+extern void emev2_init_irq(void);
+extern void emev2_add_early_devices(void);
+extern void emev2_add_standard_devices(void);
+extern void emev2_clock_init(void);
+
+#endif /* __ASM_EMEV2_H__ */
--- /dev/null
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 02:44:44.000000000 +0900
@@ -0,0 +1,180 @@
+/*
+ * Emma Mobile EV2 processor support
+ *
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <mach/hardware.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <mach/irqs.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/time.h>
+#include <asm/hardware/gic.h>
+
+/* UART */
+static struct resource uart0_resources[] = {
+	[0]	= {
+		.start	= 0xe1020000,
+		.end	= 0xe1020037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 40,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart0_device = {
+	.name		= "serial8250-em",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(uart0_resources),
+	.resource	= uart0_resources,
+};
+
+static struct resource uart1_resources[] = {
+	[0]	= {
+		.start	= 0xe1030000,
+		.end	= 0xe1030037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 41,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart1_device = {
+	.name		= "serial8250-em",
+	.id		= 1,
+	.num_resources	= ARRAY_SIZE(uart1_resources),
+	.resource	= uart1_resources,
+};
+
+static struct resource uart2_resources[] = {
+	[0]	= {
+		.start	= 0xe1040000,
+		.end	= 0xe1040037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 42,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart2_device = {
+	.name		= "serial8250-em",
+	.id		= 2,
+	.num_resources	= ARRAY_SIZE(uart2_resources),
+	.resource	= uart2_resources,
+};
+
+static struct resource uart3_resources[] = {
+	[0]	= {
+		.start	= 0xe1050000,
+		.end	= 0xe1050037,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1]	= {
+		.start	= 43,
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device uart3_device = {
+	.name		= "serial8250-em",
+	.id		= 3,
+	.num_resources	= ARRAY_SIZE(uart3_resources),
+	.resource	= uart3_resources,
+};
+
+/* STI */
+static struct resource sti_resources[] = {
+	[0] = {
+		.name	= "STI",
+		.start	= 0xe0180000,
+		.end	= 0xe0180053,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= 157,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device sti_device = {
+	.name		= "em_sti",
+	.id		= 0,
+	.resource	= sti_resources,
+	.num_resources	= ARRAY_SIZE(sti_resources),
+};
+
+static struct platform_device *emev2_early_devices[] __initdata = {
+	&uart0_device,
+	&uart1_device,
+	&uart2_device,
+	&uart3_device,
+};
+
+static struct platform_device *emev2_late_devices[] __initdata = {
+	&sti_device,
+};
+
+void __init emev2_add_standard_devices(void)
+{
+	emev2_clock_init();
+
+	platform_add_devices(emev2_early_devices,
+			     ARRAY_SIZE(emev2_early_devices));
+
+	platform_add_devices(emev2_late_devices,
+			     ARRAY_SIZE(emev2_late_devices));
+}
+
+void __init emev2_add_early_devices(void)
+{
+	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+
+	early_platform_add_devices(emev2_early_devices,
+				   ARRAY_SIZE(emev2_early_devices));
+
+	/* setup early console here as well */
+	shmobile_setup_console();
+}
+
+void __init emev2_init_irq(void)
+{
+	void __iomem *gic_dist_base;
+	void __iomem *gic_cpu_base;
+
+	/* Static mappings, never released */
+	gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
+	gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
+	BUG_ON(!gic_dist_base || !gic_cpu_base);
+
+	/* Use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Undelete the KZM9D mach-type to allow build of board
for EMEV2 SoC support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V1:
 - posted before in different series, here just bumped version to match V3

 arch/arm/tools/mach-types |    1 +
 1 file changed, 1 insertion(+)

--- 0001/arch/arm/tools/mach-types
+++ work/arch/arm/tools/mach-types	2012-05-14 19:38:03.000000000 +0900
@@ -530,6 +530,7 @@ nokia_rm680		MACH_NOKIA_RM680	NOKIA_RM68
 msm8960_sim		MACH_MSM8960_SIM	MSM8960_SIM		3230
 msm8960_rumi3		MACH_MSM8960_RUMI3	MSM8960_RUMI3		3231
 gsia18s			MACH_GSIA18S		GSIA18S			3234
+kzm9d			MACH_KZM9D		KZM9D			3246
 mx53_loco		MACH_MX53_LOCO		MX53_LOCO		3273
 tx53			MACH_TX53		TX53			3279
 encore			MACH_ENCORE		ENCORE			3284

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: horms, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

Undelete the KZM9D mach-type to allow build of board
for EMEV2 SoC support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V1:
 - posted before in different series, here just bumped version to match V3

 arch/arm/tools/mach-types |    1 +
 1 file changed, 1 insertion(+)

--- 0001/arch/arm/tools/mach-types
+++ work/arch/arm/tools/mach-types	2012-05-14 19:38:03.000000000 +0900
@@ -530,6 +530,7 @@ nokia_rm680		MACH_NOKIA_RM680	NOKIA_RM68
 msm8960_sim		MACH_MSM8960_SIM	MSM8960_SIM		3230
 msm8960_rumi3		MACH_MSM8960_RUMI3	MSM8960_RUMI3		3231
 gsia18s			MACH_GSIA18S		GSIA18S			3234
+kzm9d			MACH_KZM9D		KZM9D			3246
 mx53_loco		MACH_MX53_LOCO		MX53_LOCO		3273
 tx53			MACH_TX53		TX53			3279
 encore			MACH_ENCORE		ENCORE			3284

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Undelete the KZM9D mach-type to allow build of board
for EMEV2 SoC support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V1:
 - posted before in different series, here just bumped version to match V3

 arch/arm/tools/mach-types |    1 +
 1 file changed, 1 insertion(+)

--- 0001/arch/arm/tools/mach-types
+++ work/arch/arm/tools/mach-types	2012-05-14 19:38:03.000000000 +0900
@@ -530,6 +530,7 @@ nokia_rm680		MACH_NOKIA_RM680	NOKIA_RM68
 msm8960_sim		MACH_MSM8960_SIM	MSM8960_SIM		3230
 msm8960_rumi3		MACH_MSM8960_RUMI3	MSM8960_RUMI3		3231
 gsia18s			MACH_GSIA18S		GSIA18S			3234
+kzm9d			MACH_KZM9D		KZM9D			3246
 mx53_loco		MACH_MX53_LOCO		MX53_LOCO		3273
 tx53			MACH_TX53		TX53			3279
 encore			MACH_ENCORE		ENCORE			3284

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 03/08] mach-shmobile: KZM9D board support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

V3 of basic KZM9D board support. At this point a quite
thin layer that makes use of the Emma Mobile EV2 SoC code.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - removed now unnecessary ->map_io() callback
 - reworked includes to use new broken out header file
 - reworked to fit on top of linux-next

 arch/arm/mach-shmobile/Kconfig       |    4 +++
 arch/arm/mach-shmobile/Makefile      |    1 
 arch/arm/mach-shmobile/board-kzm9d.c |   36 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

--- 0007/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:51.000000000 +0900
@@ -115,6 +115,10 @@ config MACH_KZM9G
 	depends on ARCH_SH73A0
 	select ARCH_REQUIRE_GPIOLIB
 
+config MACH_KZM9D
+	bool "KZM9D board"
+	depends on ARCH_EMEV2
+
 comment "SH-Mobile System Configuration"
 
 config CPU_HAS_INTEVT
--- 0007/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:51.000000000 +0900
@@ -52,6 +52,7 @@ obj-$(CONFIG_MACH_BONITO)	+= board-bonit
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_KZM9G)	+= board-kzm9g.o
+obj-$(CONFIG_MACH_KZM9D)	+= board-kzm9d.o
 
 # Framework support
 obj-$(CONFIG_SMP)		+= $(smp-y)
--- /dev/null
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 02:45:52.000000000 +0900
@@ -0,0 +1,36 @@
+/*
+ * kzm9d board support
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/hardware/gic.h>
+
+MACHINE_START(KZM9D, "kzm9d")
+	.init_early	= emev2_add_early_devices,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices,
+	.timer		= &shmobile_timer,
+MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 03/08] mach-shmobile: KZM9D board support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux, arnd, linux-sh, lethal, linux-kernel, rjw, horms, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

V3 of basic KZM9D board support. At this point a quite
thin layer that makes use of the Emma Mobile EV2 SoC code.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - removed now unnecessary ->map_io() callback
 - reworked includes to use new broken out header file
 - reworked to fit on top of linux-next

 arch/arm/mach-shmobile/Kconfig       |    4 +++
 arch/arm/mach-shmobile/Makefile      |    1 
 arch/arm/mach-shmobile/board-kzm9d.c |   36 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

--- 0007/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:51.000000000 +0900
@@ -115,6 +115,10 @@ config MACH_KZM9G
 	depends on ARCH_SH73A0
 	select ARCH_REQUIRE_GPIOLIB
 
+config MACH_KZM9D
+	bool "KZM9D board"
+	depends on ARCH_EMEV2
+
 comment "SH-Mobile System Configuration"
 
 config CPU_HAS_INTEVT
--- 0007/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:51.000000000 +0900
@@ -52,6 +52,7 @@ obj-$(CONFIG_MACH_BONITO)	+= board-bonit
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_KZM9G)	+= board-kzm9g.o
+obj-$(CONFIG_MACH_KZM9D)	+= board-kzm9d.o
 
 # Framework support
 obj-$(CONFIG_SMP)		+= $(smp-y)
--- /dev/null
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 02:45:52.000000000 +0900
@@ -0,0 +1,36 @@
+/*
+ * kzm9d board support
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/hardware/gic.h>
+
+MACHINE_START(KZM9D, "kzm9d")
+	.init_early	= emev2_add_early_devices,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices,
+	.timer		= &shmobile_timer,
+MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 03/08] mach-shmobile: KZM9D board support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

V3 of basic KZM9D board support. At this point a quite
thin layer that makes use of the Emma Mobile EV2 SoC code.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - removed now unnecessary ->map_io() callback
 - reworked includes to use new broken out header file
 - reworked to fit on top of linux-next

 arch/arm/mach-shmobile/Kconfig       |    4 +++
 arch/arm/mach-shmobile/Makefile      |    1 
 arch/arm/mach-shmobile/board-kzm9d.c |   36 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

--- 0007/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 02:45:51.000000000 +0900
@@ -115,6 +115,10 @@ config MACH_KZM9G
 	depends on ARCH_SH73A0
 	select ARCH_REQUIRE_GPIOLIB
 
+config MACH_KZM9D
+	bool "KZM9D board"
+	depends on ARCH_EMEV2
+
 comment "SH-Mobile System Configuration"
 
 config CPU_HAS_INTEVT
--- 0007/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:45:51.000000000 +0900
@@ -52,6 +52,7 @@ obj-$(CONFIG_MACH_BONITO)	+= board-bonit
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_KZM9G)	+= board-kzm9g.o
+obj-$(CONFIG_MACH_KZM9D)	+= board-kzm9d.o
 
 # Framework support
 obj-$(CONFIG_SMP)		+= $(smp-y)
--- /dev/null
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 02:45:52.000000000 +0900
@@ -0,0 +1,36 @@
+/*
+ * kzm9d board support
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/hardware/gic.h>
+
+MACHINE_START(KZM9D, "kzm9d")
+	.init_early	= emev2_add_early_devices,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices,
+	.timer		= &shmobile_timer,
+MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is V3 of Emma Mobile EV2 SMP support.

At this point only the most basic form of SMP operation
is supported. TWD and CPU Hotplug support is excluded.

Tied to both the Emma Mobile EV2 and the KZM9D board
due to the need to switch on board in platsmp.c and
the newly introduced need for static mappings.

The static mappings are needed to allow hardware
acces early during boot when SMP is initialized.
This early requirement forces us to also map in
the SMU registers.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - access SMU via separate function
 - rework SCU coherency setting function
 - make use of broken out emev2 header

 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/board-kzm9d.c        |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |   18 +++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    7 +
 arch/arm/mach-shmobile/platsmp.c            |   17 ++++
 arch/arm/mach-shmobile/setup-emev2.c        |   24 ++++++
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++++++++++++++++++++++++
 7 files changed, 165 insertions(+)

--- 0008/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:48:35.000000000 +0900
@@ -19,6 +19,7 @@ smp-y				:= platsmp.o headsmp.o
 smp-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
 smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.o
 smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o
+smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o
 
 # Pinmux setup
 pfc-y				:--- 0008/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:23:09.000000000 +0900
@@ -27,6 +27,7 @@
 #include <asm/hardware/gic.h>
 
 MACHINE_START(KZM9D, "kzm9d")
+	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
--- 0007/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 03:34:20.000000000 +0900
@@ -40,6 +40,7 @@
 #define USIB2SCLKDIV 0x65c
 #define USIB3SCLKDIV 0x660
 #define STI_CLKSEL 0x688
+#define SMU_GENERAL_REG0 0x7c0
 
 /* not pretty, but hey */
 static void __iomem *smu_base;
@@ -50,6 +51,11 @@ static void emev2_smu_write(unsigned lon
 	iowrite32(value, smu_base + offs);
 }
 
+void emev2_set_boot_vector(unsigned long value)
+{
+	emev2_smu_write(value, SMU_GENERAL_REG0);
+}
+
 static struct clk_mapping smu_mapping = {
 	.phys	= EMEV2_SMU_BASE,
 	.len	= PAGE_SIZE,
@@ -194,6 +200,18 @@ static struct clk_lookup lookups[] = {
 void __init emev2_clock_init(void)
 {
 	int k, ret = 0;
+	static int is_setup;
+
+	/* yuck, this is ugly as hell, but the non-smp case of clocks
+	 * code is now designed to rely on ioremap() instead of static
+	 * entity maps. in the case of smp we need access to the SMU
+	 * register earlier than ioremap() is actually working without
+	 * any static maps. to enable SMP in ugly but with dynamic
+	 * mappings we have to call emev2_clock_init() from different
+	 * places depending on UP and SMP...
+	 */
+	if (is_setup++)
+		return;
 
 	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
 	BUG_ON(!smu_base);
--- 0007/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:59:15.000000000 +0900
@@ -1,9 +1,16 @@
 #ifndef __ASM_EMEV2_H__
 #define __ASM_EMEV2_H__
 
+extern void emev2_map_io(void);
 extern void emev2_init_irq(void);
 extern void emev2_add_early_devices(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
+extern void emev2_set_boot_vector(unsigned long value);
+extern unsigned int emev2_get_core_count(void);
+extern int emev2_platform_cpu_kill(unsigned int cpu);
+extern void emev2_secondary_init(unsigned int cpu);
+extern int emev2_boot_secondary(unsigned int cpu);
+extern void emev2_smp_prepare_cpus(void);
 
 #endif /* __ASM_EMEV2_H__ */
--- 0001/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-12 03:20:28.000000000 +0900
@@ -19,9 +19,11 @@
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
+#include <mach/emev2.h>
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
+#define is_emev2() machine_is_kzm9d()
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {
@@ -31,6 +33,9 @@ static unsigned int __init shmobile_smp_
 	if (is_r8a7779())
 		return r8a7779_get_core_count();
 
+	if (is_emev2())
+		return emev2_get_core_count();
+
 	return 1;
 }
 
@@ -41,6 +46,9 @@ static void __init shmobile_smp_prepare_
 
 	if (is_r8a7779())
 		r8a7779_smp_prepare_cpus();
+
+	if (is_emev2())
+		emev2_smp_prepare_cpus();
 }
 
 int shmobile_platform_cpu_kill(unsigned int cpu)
@@ -48,6 +56,9 @@ int shmobile_platform_cpu_kill(unsigned
 	if (is_r8a7779())
 		return r8a7779_platform_cpu_kill(cpu);
 
+	if (is_emev2())
+		return emev2_platform_cpu_kill(cpu);
+
 	return 1;
 }
 
@@ -60,6 +71,9 @@ void __cpuinit platform_secondary_init(u
 
 	if (is_r8a7779())
 		r8a7779_secondary_init(cpu);
+
+	if (is_emev2())
+		emev2_secondary_init(cpu);
 }
 
 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -70,6 +84,9 @@ int __cpuinit boot_secondary(unsigned in
 	if (is_r8a7779())
 		return r8a7779_boot_secondary(cpu);
 
+	if (is_emev2())
+		return emev2_boot_secondary(cpu);
+
 	return -ENOSYS;
 }
 
--- 0007/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:37:24.000000000 +0900
@@ -34,6 +34,30 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/gic.h>
 
+static struct map_desc emev2_io_desc[] __initdata = {
+#ifdef CONFIG_SMP
+	/* 128K entity map for 0xe0100000 (SMU) */
+	{
+		.virtual	= 0xe0100000,
+		.pfn		= __phys_to_pfn(0xe0100000),
+		.length		= SZ_128K,
+		.type		= MT_DEVICE
+	},
+	/* 2M mapping for SCU + L2 controller */
+	{
+		.virtual	= 0xf0000000,
+		.pfn		= __phys_to_pfn(0x1e000000),
+		.length		= SZ_2M,
+		.type		= MT_DEVICE
+	},
+#endif
+};
+
+void __init emev2_map_io(void)
+{
+	iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
+}
+
 /* UART */
 static struct resource uart0_resources[] = {
 	[0]	= {
--- /dev/null
+++ work/arch/arm/mach-shmobile/smp-emev2.c	2012-05-12 03:38:32.000000000 +0900
@@ -0,0 +1,97 @@
+/*
+ * SMP support for Emma Mobile EV2
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+#include <asm/hardware/gic.h>
+#include <asm/cacheflush.h>
+
+#define EMEV2_SCU_BASE 0x1e000000
+
+static DEFINE_SPINLOCK(scu_lock);
+static void __iomem *scu_base;
+
+static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
+{
+	unsigned long tmp;
+
+	/* we assume this code is running on a different cpu
+	 * than the one that is changing coherency setting */
+	spin_lock(&scu_lock);
+	tmp = readl(scu_base + 8);
+	tmp &= ~clr;
+	tmp |= set;
+	writel(tmp, scu_base + 8);
+	spin_unlock(&scu_lock);
+
+}
+
+unsigned int __init emev2_get_core_count(void)
+{
+	if (!scu_base) {
+		scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
+		emev2_clock_init(); /* need ioremapped SMU */
+	}
+
+	WARN_ON_ONCE(!scu_base);
+
+	return scu_base ? scu_get_core_count(scu_base) : 1;
+}
+
+int emev2_platform_cpu_kill(unsigned int cpu)
+{
+	return 0; /* not supported yet */
+}
+
+void __cpuinit emev2_secondary_init(unsigned int cpu)
+{
+	gic_secondary_init(0);
+}
+
+int __cpuinit emev2_boot_secondary(unsigned int cpu)
+{
+	cpu = cpu_logical_map(cpu);
+
+	/* enable cache coherency */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+
+	/* Tell ROM loader about our vector (in headsmp.S) */
+	emev2_set_boot_vector(__pa(shmobile_secondary_vector));
+
+	gic_raise_softirq(cpumask_of(cpu), 1);
+	return 0;
+}
+
+void __init emev2_smp_prepare_cpus(void)
+{
+	int cpu = cpu_logical_map(0);
+
+	scu_enable(scu_base);
+
+	/* enable cache coherency on CPU0 */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: horms, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

This is V3 of Emma Mobile EV2 SMP support.

At this point only the most basic form of SMP operation
is supported. TWD and CPU Hotplug support is excluded.

Tied to both the Emma Mobile EV2 and the KZM9D board
due to the need to switch on board in platsmp.c and
the newly introduced need for static mappings.

The static mappings are needed to allow hardware
acces early during boot when SMP is initialized.
This early requirement forces us to also map in
the SMU registers.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - access SMU via separate function
 - rework SCU coherency setting function
 - make use of broken out emev2 header

 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/board-kzm9d.c        |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |   18 +++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    7 +
 arch/arm/mach-shmobile/platsmp.c            |   17 ++++
 arch/arm/mach-shmobile/setup-emev2.c        |   24 ++++++
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++++++++++++++++++++++++
 7 files changed, 165 insertions(+)

--- 0008/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:48:35.000000000 +0900
@@ -19,6 +19,7 @@ smp-y				:= platsmp.o headsmp.o
 smp-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
 smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.o
 smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o
+smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o
 
 # Pinmux setup
 pfc-y				:=
--- 0008/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:23:09.000000000 +0900
@@ -27,6 +27,7 @@
 #include <asm/hardware/gic.h>
 
 MACHINE_START(KZM9D, "kzm9d")
+	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
--- 0007/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 03:34:20.000000000 +0900
@@ -40,6 +40,7 @@
 #define USIB2SCLKDIV 0x65c
 #define USIB3SCLKDIV 0x660
 #define STI_CLKSEL 0x688
+#define SMU_GENERAL_REG0 0x7c0
 
 /* not pretty, but hey */
 static void __iomem *smu_base;
@@ -50,6 +51,11 @@ static void emev2_smu_write(unsigned lon
 	iowrite32(value, smu_base + offs);
 }
 
+void emev2_set_boot_vector(unsigned long value)
+{
+	emev2_smu_write(value, SMU_GENERAL_REG0);
+}
+
 static struct clk_mapping smu_mapping = {
 	.phys	= EMEV2_SMU_BASE,
 	.len	= PAGE_SIZE,
@@ -194,6 +200,18 @@ static struct clk_lookup lookups[] = {
 void __init emev2_clock_init(void)
 {
 	int k, ret = 0;
+	static int is_setup;
+
+	/* yuck, this is ugly as hell, but the non-smp case of clocks
+	 * code is now designed to rely on ioremap() instead of static
+	 * entity maps. in the case of smp we need access to the SMU
+	 * register earlier than ioremap() is actually working without
+	 * any static maps. to enable SMP in ugly but with dynamic
+	 * mappings we have to call emev2_clock_init() from different
+	 * places depending on UP and SMP...
+	 */
+	if (is_setup++)
+		return;
 
 	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
 	BUG_ON(!smu_base);
--- 0007/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:59:15.000000000 +0900
@@ -1,9 +1,16 @@
 #ifndef __ASM_EMEV2_H__
 #define __ASM_EMEV2_H__
 
+extern void emev2_map_io(void);
 extern void emev2_init_irq(void);
 extern void emev2_add_early_devices(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
+extern void emev2_set_boot_vector(unsigned long value);
+extern unsigned int emev2_get_core_count(void);
+extern int emev2_platform_cpu_kill(unsigned int cpu);
+extern void emev2_secondary_init(unsigned int cpu);
+extern int emev2_boot_secondary(unsigned int cpu);
+extern void emev2_smp_prepare_cpus(void);
 
 #endif /* __ASM_EMEV2_H__ */
--- 0001/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-12 03:20:28.000000000 +0900
@@ -19,9 +19,11 @@
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
+#include <mach/emev2.h>
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
+#define is_emev2() machine_is_kzm9d()
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {
@@ -31,6 +33,9 @@ static unsigned int __init shmobile_smp_
 	if (is_r8a7779())
 		return r8a7779_get_core_count();
 
+	if (is_emev2())
+		return emev2_get_core_count();
+
 	return 1;
 }
 
@@ -41,6 +46,9 @@ static void __init shmobile_smp_prepare_
 
 	if (is_r8a7779())
 		r8a7779_smp_prepare_cpus();
+
+	if (is_emev2())
+		emev2_smp_prepare_cpus();
 }
 
 int shmobile_platform_cpu_kill(unsigned int cpu)
@@ -48,6 +56,9 @@ int shmobile_platform_cpu_kill(unsigned
 	if (is_r8a7779())
 		return r8a7779_platform_cpu_kill(cpu);
 
+	if (is_emev2())
+		return emev2_platform_cpu_kill(cpu);
+
 	return 1;
 }
 
@@ -60,6 +71,9 @@ void __cpuinit platform_secondary_init(u
 
 	if (is_r8a7779())
 		r8a7779_secondary_init(cpu);
+
+	if (is_emev2())
+		emev2_secondary_init(cpu);
 }
 
 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -70,6 +84,9 @@ int __cpuinit boot_secondary(unsigned in
 	if (is_r8a7779())
 		return r8a7779_boot_secondary(cpu);
 
+	if (is_emev2())
+		return emev2_boot_secondary(cpu);
+
 	return -ENOSYS;
 }
 
--- 0007/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:37:24.000000000 +0900
@@ -34,6 +34,30 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/gic.h>
 
+static struct map_desc emev2_io_desc[] __initdata = {
+#ifdef CONFIG_SMP
+	/* 128K entity map for 0xe0100000 (SMU) */
+	{
+		.virtual	= 0xe0100000,
+		.pfn		= __phys_to_pfn(0xe0100000),
+		.length		= SZ_128K,
+		.type		= MT_DEVICE
+	},
+	/* 2M mapping for SCU + L2 controller */
+	{
+		.virtual	= 0xf0000000,
+		.pfn		= __phys_to_pfn(0x1e000000),
+		.length		= SZ_2M,
+		.type		= MT_DEVICE
+	},
+#endif
+};
+
+void __init emev2_map_io(void)
+{
+	iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
+}
+
 /* UART */
 static struct resource uart0_resources[] = {
 	[0]	= {
--- /dev/null
+++ work/arch/arm/mach-shmobile/smp-emev2.c	2012-05-12 03:38:32.000000000 +0900
@@ -0,0 +1,97 @@
+/*
+ * SMP support for Emma Mobile EV2
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+#include <asm/hardware/gic.h>
+#include <asm/cacheflush.h>
+
+#define EMEV2_SCU_BASE 0x1e000000
+
+static DEFINE_SPINLOCK(scu_lock);
+static void __iomem *scu_base;
+
+static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
+{
+	unsigned long tmp;
+
+	/* we assume this code is running on a different cpu
+	 * than the one that is changing coherency setting */
+	spin_lock(&scu_lock);
+	tmp = readl(scu_base + 8);
+	tmp &= ~clr;
+	tmp |= set;
+	writel(tmp, scu_base + 8);
+	spin_unlock(&scu_lock);
+
+}
+
+unsigned int __init emev2_get_core_count(void)
+{
+	if (!scu_base) {
+		scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
+		emev2_clock_init(); /* need ioremapped SMU */
+	}
+
+	WARN_ON_ONCE(!scu_base);
+
+	return scu_base ? scu_get_core_count(scu_base) : 1;
+}
+
+int emev2_platform_cpu_kill(unsigned int cpu)
+{
+	return 0; /* not supported yet */
+}
+
+void __cpuinit emev2_secondary_init(unsigned int cpu)
+{
+	gic_secondary_init(0);
+}
+
+int __cpuinit emev2_boot_secondary(unsigned int cpu)
+{
+	cpu = cpu_logical_map(cpu);
+
+	/* enable cache coherency */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+
+	/* Tell ROM loader about our vector (in headsmp.S) */
+	emev2_set_boot_vector(__pa(shmobile_secondary_vector));
+
+	gic_raise_softirq(cpumask_of(cpu), 1);
+	return 0;
+}
+
+void __init emev2_smp_prepare_cpus(void)
+{
+	int cpu = cpu_logical_map(0);
+
+	scu_enable(scu_base);
+
+	/* enable cache coherency on CPU0 */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is V3 of Emma Mobile EV2 SMP support.

At this point only the most basic form of SMP operation
is supported. TWD and CPU Hotplug support is excluded.

Tied to both the Emma Mobile EV2 and the KZM9D board
due to the need to switch on board in platsmp.c and
the newly introduced need for static mappings.

The static mappings are needed to allow hardware
acces early during boot when SMP is initialized.
This early requirement forces us to also map in
the SMU registers.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - access SMU via separate function
 - rework SCU coherency setting function
 - make use of broken out emev2 header

 arch/arm/mach-shmobile/Makefile             |    1 
 arch/arm/mach-shmobile/board-kzm9d.c        |    1 
 arch/arm/mach-shmobile/clock-emev2.c        |   18 +++++
 arch/arm/mach-shmobile/include/mach/emev2.h |    7 +
 arch/arm/mach-shmobile/platsmp.c            |   17 ++++
 arch/arm/mach-shmobile/setup-emev2.c        |   24 ++++++
 arch/arm/mach-shmobile/smp-emev2.c          |   97 +++++++++++++++++++++++++++
 7 files changed, 165 insertions(+)

--- 0008/arch/arm/mach-shmobile/Makefile
+++ work/arch/arm/mach-shmobile/Makefile	2012-05-12 02:48:35.000000000 +0900
@@ -19,6 +19,7 @@ smp-y				:= platsmp.o headsmp.o
 smp-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
 smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.o
 smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o
+smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o
 
 # Pinmux setup
 pfc-y				:=
--- 0008/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:23:09.000000000 +0900
@@ -27,6 +27,7 @@
 #include <asm/hardware/gic.h>
 
 MACHINE_START(KZM9D, "kzm9d")
+	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
--- 0007/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-12 03:34:20.000000000 +0900
@@ -40,6 +40,7 @@
 #define USIB2SCLKDIV 0x65c
 #define USIB3SCLKDIV 0x660
 #define STI_CLKSEL 0x688
+#define SMU_GENERAL_REG0 0x7c0
 
 /* not pretty, but hey */
 static void __iomem *smu_base;
@@ -50,6 +51,11 @@ static void emev2_smu_write(unsigned lon
 	iowrite32(value, smu_base + offs);
 }
 
+void emev2_set_boot_vector(unsigned long value)
+{
+	emev2_smu_write(value, SMU_GENERAL_REG0);
+}
+
 static struct clk_mapping smu_mapping = {
 	.phys	= EMEV2_SMU_BASE,
 	.len	= PAGE_SIZE,
@@ -194,6 +200,18 @@ static struct clk_lookup lookups[] = {
 void __init emev2_clock_init(void)
 {
 	int k, ret = 0;
+	static int is_setup;
+
+	/* yuck, this is ugly as hell, but the non-smp case of clocks
+	 * code is now designed to rely on ioremap() instead of static
+	 * entity maps. in the case of smp we need access to the SMU
+	 * register earlier than ioremap() is actually working without
+	 * any static maps. to enable SMP in ugly but with dynamic
+	 * mappings we have to call emev2_clock_init() from different
+	 * places depending on UP and SMP...
+	 */
+	if (is_setup++)
+		return;
 
 	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
 	BUG_ON(!smu_base);
--- 0007/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 02:59:15.000000000 +0900
@@ -1,9 +1,16 @@
 #ifndef __ASM_EMEV2_H__
 #define __ASM_EMEV2_H__
 
+extern void emev2_map_io(void);
 extern void emev2_init_irq(void);
 extern void emev2_add_early_devices(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
+extern void emev2_set_boot_vector(unsigned long value);
+extern unsigned int emev2_get_core_count(void);
+extern int emev2_platform_cpu_kill(unsigned int cpu);
+extern void emev2_secondary_init(unsigned int cpu);
+extern int emev2_boot_secondary(unsigned int cpu);
+extern void emev2_smp_prepare_cpus(void);
 
 #endif /* __ASM_EMEV2_H__ */
--- 0001/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-12 03:20:28.000000000 +0900
@@ -19,9 +19,11 @@
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
+#include <mach/emev2.h>
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
+#define is_emev2() machine_is_kzm9d()
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {
@@ -31,6 +33,9 @@ static unsigned int __init shmobile_smp_
 	if (is_r8a7779())
 		return r8a7779_get_core_count();
 
+	if (is_emev2())
+		return emev2_get_core_count();
+
 	return 1;
 }
 
@@ -41,6 +46,9 @@ static void __init shmobile_smp_prepare_
 
 	if (is_r8a7779())
 		r8a7779_smp_prepare_cpus();
+
+	if (is_emev2())
+		emev2_smp_prepare_cpus();
 }
 
 int shmobile_platform_cpu_kill(unsigned int cpu)
@@ -48,6 +56,9 @@ int shmobile_platform_cpu_kill(unsigned
 	if (is_r8a7779())
 		return r8a7779_platform_cpu_kill(cpu);
 
+	if (is_emev2())
+		return emev2_platform_cpu_kill(cpu);
+
 	return 1;
 }
 
@@ -60,6 +71,9 @@ void __cpuinit platform_secondary_init(u
 
 	if (is_r8a7779())
 		r8a7779_secondary_init(cpu);
+
+	if (is_emev2())
+		emev2_secondary_init(cpu);
 }
 
 int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -70,6 +84,9 @@ int __cpuinit boot_secondary(unsigned in
 	if (is_r8a7779())
 		return r8a7779_boot_secondary(cpu);
 
+	if (is_emev2())
+		return emev2_boot_secondary(cpu);
+
 	return -ENOSYS;
 }
 
--- 0007/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:37:24.000000000 +0900
@@ -34,6 +34,30 @@
 #include <asm/mach/time.h>
 #include <asm/hardware/gic.h>
 
+static struct map_desc emev2_io_desc[] __initdata = {
+#ifdef CONFIG_SMP
+	/* 128K entity map for 0xe0100000 (SMU) */
+	{
+		.virtual	= 0xe0100000,
+		.pfn		= __phys_to_pfn(0xe0100000),
+		.length		= SZ_128K,
+		.type		= MT_DEVICE
+	},
+	/* 2M mapping for SCU + L2 controller */
+	{
+		.virtual	= 0xf0000000,
+		.pfn		= __phys_to_pfn(0x1e000000),
+		.length		= SZ_2M,
+		.type		= MT_DEVICE
+	},
+#endif
+};
+
+void __init emev2_map_io(void)
+{
+	iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
+}
+
 /* UART */
 static struct resource uart0_resources[] = {
 	[0]	= {
--- /dev/null
+++ work/arch/arm/mach-shmobile/smp-emev2.c	2012-05-12 03:38:32.000000000 +0900
@@ -0,0 +1,97 @@
+/*
+ * SMP support for Emma Mobile EV2
+ *
+ * Copyright (C) 2012  Renesas Solutions Corp.
+ * Copyright (C) 2012  Magnus Damm
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/spinlock.h>
+#include <linux/io.h>
+#include <linux/delay.h>
+#include <mach/common.h>
+#include <mach/emev2.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+#include <asm/hardware/gic.h>
+#include <asm/cacheflush.h>
+
+#define EMEV2_SCU_BASE 0x1e000000
+
+static DEFINE_SPINLOCK(scu_lock);
+static void __iomem *scu_base;
+
+static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
+{
+	unsigned long tmp;
+
+	/* we assume this code is running on a different cpu
+	 * than the one that is changing coherency setting */
+	spin_lock(&scu_lock);
+	tmp = readl(scu_base + 8);
+	tmp &= ~clr;
+	tmp |= set;
+	writel(tmp, scu_base + 8);
+	spin_unlock(&scu_lock);
+
+}
+
+unsigned int __init emev2_get_core_count(void)
+{
+	if (!scu_base) {
+		scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
+		emev2_clock_init(); /* need ioremapped SMU */
+	}
+
+	WARN_ON_ONCE(!scu_base);
+
+	return scu_base ? scu_get_core_count(scu_base) : 1;
+}
+
+int emev2_platform_cpu_kill(unsigned int cpu)
+{
+	return 0; /* not supported yet */
+}
+
+void __cpuinit emev2_secondary_init(unsigned int cpu)
+{
+	gic_secondary_init(0);
+}
+
+int __cpuinit emev2_boot_secondary(unsigned int cpu)
+{
+	cpu = cpu_logical_map(cpu);
+
+	/* enable cache coherency */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+
+	/* Tell ROM loader about our vector (in headsmp.S) */
+	emev2_set_boot_vector(__pa(shmobile_secondary_vector));
+
+	gic_raise_softirq(cpumask_of(cpu), 1);
+	return 0;
+}
+
+void __init emev2_smp_prepare_cpus(void)
+{
+	int cpu = cpu_logical_map(0);
+
+	scu_enable(scu_base);
+
+	/* enable cache coherency on CPU0 */
+	modify_scu_cpu_psr(0, 3 << (cpu * 8));
+}

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Tie in the Emma Mobile GPIO driver "em-gio" to
support the GPIOs on Emma Mobile EV2.

A static IRQ range is used to allow boards to
hook up their platform devices to the GPIOs.

DT support is still on the TODO for the GPIO driver,
so only platform device support is included here.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - none, this is the first public release

 arch/arm/mach-shmobile/Kconfig              |    1 
 arch/arm/mach-shmobile/include/mach/emev2.h |    3 
 arch/arm/mach-shmobile/setup-emev2.c        |  203 +++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)

--- 0008/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 03:41:45.000000000 +0900
@@ -45,6 +45,7 @@ config ARCH_EMEV2
 	bool "Emma Mobile EV2"
 	select CPU_V7
 	select ARM_GIC
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 
 comment "SH-Mobile Board Type"
 
--- 0009/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 03:44:29.000000000 +0900
@@ -13,4 +13,7 @@ extern void emev2_secondary_init(unsigne
 extern int emev2_boot_secondary(unsigned int cpu);
 extern void emev2_smp_prepare_cpus(void);
 
+#define EMEV2_GPIO_BASE 200
+#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
+
 #endif /* __ASM_EMEV2_H__ */
--- 0009/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:45:30.000000000 +0900
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/gpio-em.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
@@ -156,6 +157,203 @@ static struct platform_device sti_device
 	.num_resources	= ARRAY_SIZE(sti_resources),
 };
 
+
+/* GIO */
+static struct gpio_em_config gio0_config = {
+	.gpio_base = 0,
+	.irq_base = EMEV2_GPIO_IRQ(0),
+	.number_of_pins = 32,
+};
+
+static struct resource gio0_resources[] = {
+	[0] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050000,
+		.end	= 0xe005002b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050040,
+		.end	= 0xe005005f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 99,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 100,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio0_device = {
+	.name		= "em_gio",
+	.id		= 0,
+	.resource	= gio0_resources,
+	.num_resources	= ARRAY_SIZE(gio0_resources),
+	.dev		= {
+		.platform_data	= &gio0_config,
+	},
+};
+
+static struct gpio_em_config gio1_config = {
+	.gpio_base = 32,
+	.irq_base = EMEV2_GPIO_IRQ(32),
+	.number_of_pins = 32,
+};
+
+static struct resource gio1_resources[] = {
+	[0] = {
+		.name	= "GIO_032",
+		.start	= 0xe0050080,
+		.end	= 0xe00500ab,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_032",
+		.start	= 0xe00500c0,
+		.end	= 0xe00500df,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 101,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 102,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio1_device = {
+	.name		= "em_gio",
+	.id		= 1,
+	.resource	= gio1_resources,
+	.num_resources	= ARRAY_SIZE(gio1_resources),
+	.dev		= {
+		.platform_data	= &gio1_config,
+	},
+};
+
+static struct gpio_em_config gio2_config = {
+	.gpio_base = 64,
+	.irq_base = EMEV2_GPIO_IRQ(64),
+	.number_of_pins = 32,
+};
+
+static struct resource gio2_resources[] = {
+	[0] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 103,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 104,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio2_device = {
+	.name		= "em_gio",
+	.id		= 2,
+	.resource	= gio2_resources,
+	.num_resources	= ARRAY_SIZE(gio2_resources),
+	.dev		= {
+		.platform_data	= &gio2_config,
+	},
+};
+
+static struct gpio_em_config gio3_config = {
+	.gpio_base = 96,
+	.irq_base = EMEV2_GPIO_IRQ(96),
+	.number_of_pins = 32,
+};
+
+static struct resource gio3_resources[] = {
+	[0] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 105,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 106,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio3_device = {
+	.name		= "em_gio",
+	.id		= 3,
+	.resource	= gio3_resources,
+	.num_resources	= ARRAY_SIZE(gio3_resources),
+	.dev		= {
+		.platform_data	= &gio3_config,
+	},
+};
+
+static struct gpio_em_config gio4_config = {
+	.gpio_base = 128,
+	.irq_base = EMEV2_GPIO_IRQ(128),
+	.number_of_pins = 31,
+};
+
+static struct resource gio4_resources[] = {
+	[0] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050200,
+		.end	= 0xe005022b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050240,
+		.end	= 0xe005025f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 107,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 108,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio4_device = {
+	.name		= "em_gio",
+	.id		= 4,
+	.resource	= gio4_resources,
+	.num_resources	= ARRAY_SIZE(gio4_resources),
+	.dev		= {
+		.platform_data	= &gio4_config,
+	},
+};
+
 static struct platform_device *emev2_early_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
@@ -165,6 +363,11 @@ static struct platform_device *emev2_ear
 
 static struct platform_device *emev2_late_devices[] __initdata = {
 	&sti_device,
+	&gio0_device,
+	&gio1_device,
+	&gio2_device,
+	&gio3_device,
+	&gio4_device,
 };
 
 void __init emev2_add_standard_devices(void)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux, arnd, linux-sh, lethal, linux-kernel, rjw, horms, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

Tie in the Emma Mobile GPIO driver "em-gio" to
support the GPIOs on Emma Mobile EV2.

A static IRQ range is used to allow boards to
hook up their platform devices to the GPIOs.

DT support is still on the TODO for the GPIO driver,
so only platform device support is included here.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - none, this is the first public release

 arch/arm/mach-shmobile/Kconfig              |    1 
 arch/arm/mach-shmobile/include/mach/emev2.h |    3 
 arch/arm/mach-shmobile/setup-emev2.c        |  203 +++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)

--- 0008/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 03:41:45.000000000 +0900
@@ -45,6 +45,7 @@ config ARCH_EMEV2
 	bool "Emma Mobile EV2"
 	select CPU_V7
 	select ARM_GIC
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 
 comment "SH-Mobile Board Type"
 
--- 0009/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 03:44:29.000000000 +0900
@@ -13,4 +13,7 @@ extern void emev2_secondary_init(unsigne
 extern int emev2_boot_secondary(unsigned int cpu);
 extern void emev2_smp_prepare_cpus(void);
 
+#define EMEV2_GPIO_BASE 200
+#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
+
 #endif /* __ASM_EMEV2_H__ */
--- 0009/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:45:30.000000000 +0900
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/gpio-em.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
@@ -156,6 +157,203 @@ static struct platform_device sti_device
 	.num_resources	= ARRAY_SIZE(sti_resources),
 };
 
+
+/* GIO */
+static struct gpio_em_config gio0_config = {
+	.gpio_base = 0,
+	.irq_base = EMEV2_GPIO_IRQ(0),
+	.number_of_pins = 32,
+};
+
+static struct resource gio0_resources[] = {
+	[0] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050000,
+		.end	= 0xe005002b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050040,
+		.end	= 0xe005005f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 99,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 100,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio0_device = {
+	.name		= "em_gio",
+	.id		= 0,
+	.resource	= gio0_resources,
+	.num_resources	= ARRAY_SIZE(gio0_resources),
+	.dev		= {
+		.platform_data	= &gio0_config,
+	},
+};
+
+static struct gpio_em_config gio1_config = {
+	.gpio_base = 32,
+	.irq_base = EMEV2_GPIO_IRQ(32),
+	.number_of_pins = 32,
+};
+
+static struct resource gio1_resources[] = {
+	[0] = {
+		.name	= "GIO_032",
+		.start	= 0xe0050080,
+		.end	= 0xe00500ab,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_032",
+		.start	= 0xe00500c0,
+		.end	= 0xe00500df,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 101,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 102,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio1_device = {
+	.name		= "em_gio",
+	.id		= 1,
+	.resource	= gio1_resources,
+	.num_resources	= ARRAY_SIZE(gio1_resources),
+	.dev		= {
+		.platform_data	= &gio1_config,
+	},
+};
+
+static struct gpio_em_config gio2_config = {
+	.gpio_base = 64,
+	.irq_base = EMEV2_GPIO_IRQ(64),
+	.number_of_pins = 32,
+};
+
+static struct resource gio2_resources[] = {
+	[0] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 103,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 104,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio2_device = {
+	.name		= "em_gio",
+	.id		= 2,
+	.resource	= gio2_resources,
+	.num_resources	= ARRAY_SIZE(gio2_resources),
+	.dev		= {
+		.platform_data	= &gio2_config,
+	},
+};
+
+static struct gpio_em_config gio3_config = {
+	.gpio_base = 96,
+	.irq_base = EMEV2_GPIO_IRQ(96),
+	.number_of_pins = 32,
+};
+
+static struct resource gio3_resources[] = {
+	[0] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 105,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 106,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio3_device = {
+	.name		= "em_gio",
+	.id		= 3,
+	.resource	= gio3_resources,
+	.num_resources	= ARRAY_SIZE(gio3_resources),
+	.dev		= {
+		.platform_data	= &gio3_config,
+	},
+};
+
+static struct gpio_em_config gio4_config = {
+	.gpio_base = 128,
+	.irq_base = EMEV2_GPIO_IRQ(128),
+	.number_of_pins = 31,
+};
+
+static struct resource gio4_resources[] = {
+	[0] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050200,
+		.end	= 0xe005022b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050240,
+		.end	= 0xe005025f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 107,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 108,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio4_device = {
+	.name		= "em_gio",
+	.id		= 4,
+	.resource	= gio4_resources,
+	.num_resources	= ARRAY_SIZE(gio4_resources),
+	.dev		= {
+		.platform_data	= &gio4_config,
+	},
+};
+
 static struct platform_device *emev2_early_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
@@ -165,6 +363,11 @@ static struct platform_device *emev2_ear
 
 static struct platform_device *emev2_late_devices[] __initdata = {
 	&sti_device,
+	&gio0_device,
+	&gio1_device,
+	&gio2_device,
+	&gio3_device,
+	&gio4_device,
 };
 
 void __init emev2_add_standard_devices(void)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Tie in the Emma Mobile GPIO driver "em-gio" to
support the GPIOs on Emma Mobile EV2.

A static IRQ range is used to allow boards to
hook up their platform devices to the GPIOs.

DT support is still on the TODO for the GPIO driver,
so only platform device support is included here.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes since V1:
 - none, this is the first public release

 arch/arm/mach-shmobile/Kconfig              |    1 
 arch/arm/mach-shmobile/include/mach/emev2.h |    3 
 arch/arm/mach-shmobile/setup-emev2.c        |  203 +++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)

--- 0008/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-12 03:41:45.000000000 +0900
@@ -45,6 +45,7 @@ config ARCH_EMEV2
 	bool "Emma Mobile EV2"
 	select CPU_V7
 	select ARM_GIC
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 
 comment "SH-Mobile Board Type"
 
--- 0009/arch/arm/mach-shmobile/include/mach/emev2.h
+++ work/arch/arm/mach-shmobile/include/mach/emev2.h	2012-05-12 03:44:29.000000000 +0900
@@ -13,4 +13,7 @@ extern void emev2_secondary_init(unsigne
 extern int emev2_boot_secondary(unsigned int cpu);
 extern void emev2_smp_prepare_cpus(void);
 
+#define EMEV2_GPIO_BASE 200
+#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
+
 #endif /* __ASM_EMEV2_H__ */
--- 0009/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-12 03:45:30.000000000 +0900
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/gpio-em.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
@@ -156,6 +157,203 @@ static struct platform_device sti_device
 	.num_resources	= ARRAY_SIZE(sti_resources),
 };
 
+
+/* GIO */
+static struct gpio_em_config gio0_config = {
+	.gpio_base = 0,
+	.irq_base = EMEV2_GPIO_IRQ(0),
+	.number_of_pins = 32,
+};
+
+static struct resource gio0_resources[] = {
+	[0] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050000,
+		.end	= 0xe005002b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_000",
+		.start	= 0xe0050040,
+		.end	= 0xe005005f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 99,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 100,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio0_device = {
+	.name		= "em_gio",
+	.id		= 0,
+	.resource	= gio0_resources,
+	.num_resources	= ARRAY_SIZE(gio0_resources),
+	.dev		= {
+		.platform_data	= &gio0_config,
+	},
+};
+
+static struct gpio_em_config gio1_config = {
+	.gpio_base = 32,
+	.irq_base = EMEV2_GPIO_IRQ(32),
+	.number_of_pins = 32,
+};
+
+static struct resource gio1_resources[] = {
+	[0] = {
+		.name	= "GIO_032",
+		.start	= 0xe0050080,
+		.end	= 0xe00500ab,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_032",
+		.start	= 0xe00500c0,
+		.end	= 0xe00500df,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 101,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 102,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio1_device = {
+	.name		= "em_gio",
+	.id		= 1,
+	.resource	= gio1_resources,
+	.num_resources	= ARRAY_SIZE(gio1_resources),
+	.dev		= {
+		.platform_data	= &gio1_config,
+	},
+};
+
+static struct gpio_em_config gio2_config = {
+	.gpio_base = 64,
+	.irq_base = EMEV2_GPIO_IRQ(64),
+	.number_of_pins = 32,
+};
+
+static struct resource gio2_resources[] = {
+	[0] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_064",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 103,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 104,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio2_device = {
+	.name		= "em_gio",
+	.id		= 2,
+	.resource	= gio2_resources,
+	.num_resources	= ARRAY_SIZE(gio2_resources),
+	.dev		= {
+		.platform_data	= &gio2_config,
+	},
+};
+
+static struct gpio_em_config gio3_config = {
+	.gpio_base = 96,
+	.irq_base = EMEV2_GPIO_IRQ(96),
+	.number_of_pins = 32,
+};
+
+static struct resource gio3_resources[] = {
+	[0] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050100,
+		.end	= 0xe005012b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_096",
+		.start	= 0xe0050140,
+		.end	= 0xe005015f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 105,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 106,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio3_device = {
+	.name		= "em_gio",
+	.id		= 3,
+	.resource	= gio3_resources,
+	.num_resources	= ARRAY_SIZE(gio3_resources),
+	.dev		= {
+		.platform_data	= &gio3_config,
+	},
+};
+
+static struct gpio_em_config gio4_config = {
+	.gpio_base = 128,
+	.irq_base = EMEV2_GPIO_IRQ(128),
+	.number_of_pins = 31,
+};
+
+static struct resource gio4_resources[] = {
+	[0] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050200,
+		.end	= 0xe005022b,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "GIO_128",
+		.start	= 0xe0050240,
+		.end	= 0xe005025f,
+		.flags	= IORESOURCE_MEM,
+	},
+	[2] = {
+		.start	= 107,
+		.flags	= IORESOURCE_IRQ,
+	},
+	[3] = {
+		.start	= 108,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device gio4_device = {
+	.name		= "em_gio",
+	.id		= 4,
+	.resource	= gio4_resources,
+	.num_resources	= ARRAY_SIZE(gio4_resources),
+	.dev		= {
+		.platform_data	= &gio4_config,
+	},
+};
+
 static struct platform_device *emev2_early_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
@@ -165,6 +363,11 @@ static struct platform_device *emev2_ear
 
 static struct platform_device *emev2_late_devices[] __initdata = {
 	&sti_device,
+	&gio0_device,
+	&gio1_device,
+	&gio2_device,
+	&gio3_device,
+	&gio4_device,
 };
 
 void __init emev2_add_standard_devices(void)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Tie in the on-board Ethernet controller on KZM9D
and make use of the GPIO controller for external
IRQ pin support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes from V1:
 - none - this is the first public release

 arch/arm/mach-shmobile/board-kzm9d.c |   44 +++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

--- 0009/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:49:52.000000000 +0900
@@ -20,18 +20,60 @@
 
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 
+/* Ether */
+static struct resource smsc911x_resources[] = {
+	[0] = {
+		.start	= 0x20000000,
+		.end	= 0x2000ffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= EMEV2_GPIO_IRQ(1),
+		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+	},
+};
+
+static struct smsc911x_platform_config smsc911x_platdata = {
+	.flags		= SMSC911X_USE_32BIT,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
+};
+
+static struct platform_device smsc91x_device = {
+	.name	= "smsc911x",
+	.id	= 0,
+	.dev	= {
+		  .platform_data = &smsc911x_platdata,
+		},
+	.num_resources	= ARRAY_SIZE(smsc911x_resources),
+	.resource	= smsc911x_resources,
+};
+
+static struct platform_device *kzm9d_devices[] __initdata = {
+	&smsc91x_device,
+};
+
+void __init kzm9d_add_standard_devices(void)
+{
+	emev2_add_standard_devices();
+
+	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
+}
+
 MACHINE_START(KZM9D, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
 	.handle_irq	= gic_handle_irq,
-	.init_machine	= emev2_add_standard_devices,
+	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
 MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: horms, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

Tie in the on-board Ethernet controller on KZM9D
and make use of the GPIO controller for external
IRQ pin support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes from V1:
 - none - this is the first public release

 arch/arm/mach-shmobile/board-kzm9d.c |   44 +++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

--- 0009/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:49:52.000000000 +0900
@@ -20,18 +20,60 @@
 
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 
+/* Ether */
+static struct resource smsc911x_resources[] = {
+	[0] = {
+		.start	= 0x20000000,
+		.end	= 0x2000ffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= EMEV2_GPIO_IRQ(1),
+		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+	},
+};
+
+static struct smsc911x_platform_config smsc911x_platdata = {
+	.flags		= SMSC911X_USE_32BIT,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
+};
+
+static struct platform_device smsc91x_device = {
+	.name	= "smsc911x",
+	.id	= 0,
+	.dev	= {
+		  .platform_data = &smsc911x_platdata,
+		},
+	.num_resources	= ARRAY_SIZE(smsc911x_resources),
+	.resource	= smsc911x_resources,
+};
+
+static struct platform_device *kzm9d_devices[] __initdata = {
+	&smsc91x_device,
+};
+
+void __init kzm9d_add_standard_devices(void)
+{
+	emev2_add_standard_devices();
+
+	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
+}
+
 MACHINE_START(KZM9D, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
 	.handle_irq	= gic_handle_irq,
-	.init_machine	= emev2_add_standard_devices,
+	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
 MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Tie in the on-board Ethernet controller on KZM9D
and make use of the GPIO controller for external
IRQ pin support.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - none, just bumped up version to match the V3 series

 Changes from V1:
 - none - this is the first public release

 arch/arm/mach-shmobile/board-kzm9d.c |   44 +++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

--- 0009/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-12 03:49:52.000000000 +0900
@@ -20,18 +20,60 @@
 
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/smsc911x.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/hardware/gic.h>
 
+/* Ether */
+static struct resource smsc911x_resources[] = {
+	[0] = {
+		.start	= 0x20000000,
+		.end	= 0x2000ffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= EMEV2_GPIO_IRQ(1),
+		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
+	},
+};
+
+static struct smsc911x_platform_config smsc911x_platdata = {
+	.flags		= SMSC911X_USE_32BIT,
+	.irq_type	= SMSC911X_IRQ_TYPE_PUSH_PULL,
+	.irq_polarity	= SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
+};
+
+static struct platform_device smsc91x_device = {
+	.name	= "smsc911x",
+	.id	= 0,
+	.dev	= {
+		  .platform_data = &smsc911x_platdata,
+		},
+	.num_resources	= ARRAY_SIZE(smsc911x_resources),
+	.resource	= smsc911x_resources,
+};
+
+static struct platform_device *kzm9d_devices[] __initdata = {
+	&smsc91x_device,
+};
+
+void __init kzm9d_add_standard_devices(void)
+{
+	emev2_add_standard_devices();
+
+	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
+}
+
 MACHINE_START(KZM9D, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
 	.handle_irq	= gic_handle_irq,
-	.init_machine	= emev2_add_standard_devices,
+	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
 MACHINE_END

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:45   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is EMEV2 DT support V3. The support is limited to
whatever devices that are complied in the kernel. At this
point we have UARTs handled by "em-uart" and a timer
handled by "em-sti". Clocks and SMP are not supported.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - converted board-specific emev2-kzm9d.dts into emev2.dtsi

 Changes since V1:
 - cleaned up the command line in the dts file
 - removed call to clock setup code - this should be done through DT
 - removed map io callback
 - removed Makefile hacks, people will have to add them by themselves

 arch/arm/boot/dts/emev2.dtsi         |   63 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-emev2.c |    5 ++
 arch/arm/mach-shmobile/setup-emev2.c |   47 ++++++++++++++++++++++++-
 3 files changed, 114 insertions(+), 1 deletion(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2.dtsi	2012-05-16 15:01:20.000000000 +0900
@@ -0,0 +1,63 @@
+/*
+ * Device Tree Source for the EMEV2 SoC
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,emev2";
+	interrupt-parent = <&gic>;
+
+	cpus {
+		cpu@0 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu@1 {
+			compatible = "arm,cortex-a9";
+		};
+	};
+
+	gic: interrupt-controller@e0020000 {
+		compatible = "arm,cortex-a9-gic";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		reg = <0xe0028000 0x1000>,
+		      <0xe0020000 0x0100>;
+	};
+
+	sti@e0180000 {
+		compatible = "renesas,em-sti";
+		reg = <0xe0180000 0x54>;
+		interrupts = <0 125 0>;
+	};
+
+	uart@e1020000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1020000 0x38>;
+		interrupts = <0 8 0>;
+	};
+
+	uart@e1030000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1030000 0x38>;
+		interrupts = <0 9 0>;
+	};
+
+	uart@e1040000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1040000 0x38>;
+		interrupts = <0 10 0>;
+	};
+
+	uart@e1050000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1050000 0x38>;
+		interrupts = <0 11 0>;
+	};
+};
--- 0009/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -191,10 +191,15 @@ static int __init emev2_sclkdiv_register
 
 static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("e1020000.uart", &gclk_clks[GCLK_USIAU0_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("e1030000.uart", &gclk_clks[GCLK_USIBU1_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("e1040000.uart", &gclk_clks[GCLK_USIBU2_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
 	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+	CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
 };
 
 void __init emev2_clock_init(void)
--- 0010/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -22,9 +22,11 @@
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/gpio-em.h>
+#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
+#include <linux/of_irq.h>
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
@@ -381,9 +383,14 @@ void __init emev2_add_standard_devices(v
 			     ARRAY_SIZE(emev2_late_devices));
 }
 
-void __init emev2_add_early_devices(void)
+void __init emev2_init_delay(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+}
+
+void __init emev2_add_early_devices(void)
+{
+	emev2_init_delay();
 
 	early_platform_add_devices(emev2_early_devices,
 				   ARRAY_SIZE(emev2_early_devices));
@@ -405,3 +412,41 @@ void __init emev2_init_irq(void)
 	/* Use GIC to handle interrupts */
 	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 }
+
+#ifdef CONFIG_USE_OF
+static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
+	{ }
+};
+
+void __init emev2_add_standard_devices_dt(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     emev2_auxdata_lookup, NULL);
+}
+
+static const struct of_device_id emev2_dt_irq_match[] = {
+	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+	{},
+};
+
+static const char *emev2_boards_compat_dt[] __initdata = {
+	"renesas,emev2",
+	NULL,
+};
+
+void __init emev2_init_irq_dt(void)
+{
+	of_irq_init(emev2_dt_irq_match);
+}
+
+DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
+	.init_early	= emev2_init_delay,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq_dt,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices_dt,
+	.timer		= &shmobile_timer,
+	.dt_compat	= emev2_boards_compat_dt,
+MACHINE_END
+
+#endif /* CONFIG_USE_OF */

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux, arnd, linux-sh, lethal, linux-kernel, rjw, horms, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

This is EMEV2 DT support V3. The support is limited to
whatever devices that are complied in the kernel. At this
point we have UARTs handled by "em-uart" and a timer
handled by "em-sti". Clocks and SMP are not supported.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - converted board-specific emev2-kzm9d.dts into emev2.dtsi

 Changes since V1:
 - cleaned up the command line in the dts file
 - removed call to clock setup code - this should be done through DT
 - removed map io callback
 - removed Makefile hacks, people will have to add them by themselves

 arch/arm/boot/dts/emev2.dtsi         |   63 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-emev2.c |    5 ++
 arch/arm/mach-shmobile/setup-emev2.c |   47 ++++++++++++++++++++++++-
 3 files changed, 114 insertions(+), 1 deletion(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2.dtsi	2012-05-16 15:01:20.000000000 +0900
@@ -0,0 +1,63 @@
+/*
+ * Device Tree Source for the EMEV2 SoC
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,emev2";
+	interrupt-parent = <&gic>;
+
+	cpus {
+		cpu@0 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu@1 {
+			compatible = "arm,cortex-a9";
+		};
+	};
+
+	gic: interrupt-controller@e0020000 {
+		compatible = "arm,cortex-a9-gic";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		reg = <0xe0028000 0x1000>,
+		      <0xe0020000 0x0100>;
+	};
+
+	sti@e0180000 {
+		compatible = "renesas,em-sti";
+		reg = <0xe0180000 0x54>;
+		interrupts = <0 125 0>;
+	};
+
+	uart@e1020000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1020000 0x38>;
+		interrupts = <0 8 0>;
+	};
+
+	uart@e1030000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1030000 0x38>;
+		interrupts = <0 9 0>;
+	};
+
+	uart@e1040000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1040000 0x38>;
+		interrupts = <0 10 0>;
+	};
+
+	uart@e1050000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1050000 0x38>;
+		interrupts = <0 11 0>;
+	};
+};
--- 0009/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -191,10 +191,15 @@ static int __init emev2_sclkdiv_register
 
 static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("e1020000.uart", &gclk_clks[GCLK_USIAU0_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("e1030000.uart", &gclk_clks[GCLK_USIBU1_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("e1040000.uart", &gclk_clks[GCLK_USIBU2_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
 	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+	CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
 };
 
 void __init emev2_clock_init(void)
--- 0010/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -22,9 +22,11 @@
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/gpio-em.h>
+#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
+#include <linux/of_irq.h>
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
@@ -381,9 +383,14 @@ void __init emev2_add_standard_devices(v
 			     ARRAY_SIZE(emev2_late_devices));
 }
 
-void __init emev2_add_early_devices(void)
+void __init emev2_init_delay(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+}
+
+void __init emev2_add_early_devices(void)
+{
+	emev2_init_delay();
 
 	early_platform_add_devices(emev2_early_devices,
 				   ARRAY_SIZE(emev2_early_devices));
@@ -405,3 +412,41 @@ void __init emev2_init_irq(void)
 	/* Use GIC to handle interrupts */
 	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 }
+
+#ifdef CONFIG_USE_OF
+static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
+	{ }
+};
+
+void __init emev2_add_standard_devices_dt(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     emev2_auxdata_lookup, NULL);
+}
+
+static const struct of_device_id emev2_dt_irq_match[] = {
+	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+	{},
+};
+
+static const char *emev2_boards_compat_dt[] __initdata = {
+	"renesas,emev2",
+	NULL,
+};
+
+void __init emev2_init_irq_dt(void)
+{
+	of_irq_init(emev2_dt_irq_match);
+}
+
+DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
+	.init_early	= emev2_init_delay,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq_dt,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices_dt,
+	.timer		= &shmobile_timer,
+	.dt_compat	= emev2_boards_compat_dt,
+MACHINE_END
+
+#endif /* CONFIG_USE_OF */

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
@ 2012-05-16  6:45   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

This is EMEV2 DT support V3. The support is limited to
whatever devices that are complied in the kernel. At this
point we have UARTs handled by "em-uart" and a timer
handled by "em-sti". Clocks and SMP are not supported.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes since V2:
 - converted board-specific emev2-kzm9d.dts into emev2.dtsi

 Changes since V1:
 - cleaned up the command line in the dts file
 - removed call to clock setup code - this should be done through DT
 - removed map io callback
 - removed Makefile hacks, people will have to add them by themselves

 arch/arm/boot/dts/emev2.dtsi         |   63 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-emev2.c |    5 ++
 arch/arm/mach-shmobile/setup-emev2.c |   47 ++++++++++++++++++++++++-
 3 files changed, 114 insertions(+), 1 deletion(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2.dtsi	2012-05-16 15:01:20.000000000 +0900
@@ -0,0 +1,63 @@
+/*
+ * Device Tree Source for the EMEV2 SoC
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,emev2";
+	interrupt-parent = <&gic>;
+
+	cpus {
+		cpu at 0 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu at 1 {
+			compatible = "arm,cortex-a9";
+		};
+	};
+
+	gic: interrupt-controller at e0020000 {
+		compatible = "arm,cortex-a9-gic";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		reg = <0xe0028000 0x1000>,
+		      <0xe0020000 0x0100>;
+	};
+
+	sti at e0180000 {
+		compatible = "renesas,em-sti";
+		reg = <0xe0180000 0x54>;
+		interrupts = <0 125 0>;
+	};
+
+	uart at e1020000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1020000 0x38>;
+		interrupts = <0 8 0>;
+	};
+
+	uart at e1030000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1030000 0x38>;
+		interrupts = <0 9 0>;
+	};
+
+	uart at e1040000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1040000 0x38>;
+		interrupts = <0 10 0>;
+	};
+
+	uart at e1050000 {
+		compatible = "renesas,em-uart";
+		reg = <0xe1050000 0x38>;
+		interrupts = <0 11 0>;
+	};
+};
--- 0009/arch/arm/mach-shmobile/clock-emev2.c
+++ work/arch/arm/mach-shmobile/clock-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -191,10 +191,15 @@ static int __init emev2_sclkdiv_register
 
 static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
+	CLKDEV_DEV_ID("e1020000.uart", &gclk_clks[GCLK_USIAU0_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
+	CLKDEV_DEV_ID("e1030000.uart", &gclk_clks[GCLK_USIBU1_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
+	CLKDEV_DEV_ID("e1040000.uart", &gclk_clks[GCLK_USIBU2_SCLK]),
 	CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
+	CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
 	CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
+	CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
 };
 
 void __init emev2_clock_init(void)
--- 0010/arch/arm/mach-shmobile/setup-emev2.c
+++ work/arch/arm/mach-shmobile/setup-emev2.c	2012-05-16 14:56:42.000000000 +0900
@@ -22,9 +22,11 @@
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/gpio-em.h>
+#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
+#include <linux/of_irq.h>
 #include <mach/hardware.h>
 #include <mach/common.h>
 #include <mach/emev2.h>
@@ -381,9 +383,14 @@ void __init emev2_add_standard_devices(v
 			     ARRAY_SIZE(emev2_late_devices));
 }
 
-void __init emev2_add_early_devices(void)
+void __init emev2_init_delay(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+}
+
+void __init emev2_add_early_devices(void)
+{
+	emev2_init_delay();
 
 	early_platform_add_devices(emev2_early_devices,
 				   ARRAY_SIZE(emev2_early_devices));
@@ -405,3 +412,41 @@ void __init emev2_init_irq(void)
 	/* Use GIC to handle interrupts */
 	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 }
+
+#ifdef CONFIG_USE_OF
+static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
+	{ }
+};
+
+void __init emev2_add_standard_devices_dt(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     emev2_auxdata_lookup, NULL);
+}
+
+static const struct of_device_id emev2_dt_irq_match[] = {
+	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+	{},
+};
+
+static const char *emev2_boards_compat_dt[] __initdata = {
+	"renesas,emev2",
+	NULL,
+};
+
+void __init emev2_init_irq_dt(void)
+{
+	of_irq_init(emev2_dt_irq_match);
+}
+
+DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
+	.init_early	= emev2_init_delay,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= emev2_init_irq_dt,
+	.handle_irq	= gic_handle_irq,
+	.init_machine	= emev2_add_standard_devices_dt,
+	.timer		= &shmobile_timer,
+	.dt_compat	= emev2_boards_compat_dt,
+MACHINE_END
+
+#endif /* CONFIG_USE_OF */

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-16  6:46   ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:46 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Use DT_MACHINE_START() on the emev2 based KZM9D board.

Also include a tiny DTS file to describe the board and
update the Kconfig dependencies to select CONFIG_USE_OF.

Update the SMP glue code to use OF for matching.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes from V1:
 - none - this is the first public release

 arch/arm/boot/dts/emev2-kzm9d.dts    |   26 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-kzm9d.c |    8 +++++++-
 arch/arm/mach-shmobile/platsmp.c     |    3 ++-
 4 files changed, 36 insertions(+), 2 deletions(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2-kzm9d.dts	2012-05-16 15:22:30.000000000 +0900
@@ -0,0 +1,26 @@
+/*
+ * Device Tree Source for the KZM9D board
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+/dts-v1/;
+
+/include/ "emev2.dtsi"
+
+/ {
+	model = "EMEV2 KZM9D Board";
+	compatible = "renesas,kzm9d", "renesas,emev2";
+
+	memory {
+		device_type = "memory";
+		reg = <0x40000000 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS1,115200n81";
+	};
+};
--- 0010/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-16 15:03:53.000000000 +0900
@@ -119,6 +119,7 @@ config MACH_KZM9G
 config MACH_KZM9D
 	bool "KZM9D board"
 	depends on ARCH_EMEV2
+	select USE_OF
 
 comment "SH-Mobile System Configuration"
 
--- 0011/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-16 15:17:35.000000000 +0900
@@ -68,7 +68,12 @@ void __init kzm9d_add_standard_devices(v
 	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
 }
 
-MACHINE_START(KZM9D, "kzm9d")
+static const char *kzm9d_boards_compat_dt[] __initdata = {
+	"renesas,kzm9d",
+	NULL,
+};
+
+DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
@@ -76,4 +81,5 @@ MACHINE_START(KZM9D, "kzm9d")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
+	.dt_compat	= kzm9d_boards_compat_dt,
 MACHINE_END
--- 0009/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-16 15:17:41.000000000 +0900
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/of.h>
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
@@ -23,7 +24,7 @@
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
-#define is_emev2() machine_is_kzm9d()
+#define is_emev2() of_machine_is_compatible("renesas,emev2")
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
@ 2012-05-16  6:46   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:46 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: horms, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof,
	Magnus Damm

From: Magnus Damm <damm@opensource.se>

Use DT_MACHINE_START() on the emev2 based KZM9D board.

Also include a tiny DTS file to describe the board and
update the Kconfig dependencies to select CONFIG_USE_OF.

Update the SMP glue code to use OF for matching.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes from V1:
 - none - this is the first public release

 arch/arm/boot/dts/emev2-kzm9d.dts    |   26 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-kzm9d.c |    8 +++++++-
 arch/arm/mach-shmobile/platsmp.c     |    3 ++-
 4 files changed, 36 insertions(+), 2 deletions(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2-kzm9d.dts	2012-05-16 15:22:30.000000000 +0900
@@ -0,0 +1,26 @@
+/*
+ * Device Tree Source for the KZM9D board
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+/dts-v1/;
+
+/include/ "emev2.dtsi"
+
+/ {
+	model = "EMEV2 KZM9D Board";
+	compatible = "renesas,kzm9d", "renesas,emev2";
+
+	memory {
+		device_type = "memory";
+		reg = <0x40000000 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS1,115200n81";
+	};
+};
--- 0010/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-16 15:03:53.000000000 +0900
@@ -119,6 +119,7 @@ config MACH_KZM9G
 config MACH_KZM9D
 	bool "KZM9D board"
 	depends on ARCH_EMEV2
+	select USE_OF
 
 comment "SH-Mobile System Configuration"
 
--- 0011/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-16 15:17:35.000000000 +0900
@@ -68,7 +68,12 @@ void __init kzm9d_add_standard_devices(v
 	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
 }
 
-MACHINE_START(KZM9D, "kzm9d")
+static const char *kzm9d_boards_compat_dt[] __initdata = {
+	"renesas,kzm9d",
+	NULL,
+};
+
+DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
@@ -76,4 +81,5 @@ MACHINE_START(KZM9D, "kzm9d")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
+	.dt_compat	= kzm9d_boards_compat_dt,
 MACHINE_END
--- 0009/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-16 15:17:41.000000000 +0900
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/of.h>
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
@@ -23,7 +24,7 @@
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
-#define is_emev2() machine_is_kzm9d()
+#define is_emev2() of_machine_is_compatible("renesas,emev2")
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
@ 2012-05-16  6:46   ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  6:46 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Use DT_MACHINE_START() on the emev2 based KZM9D board.

Also include a tiny DTS file to describe the board and
update the Kconfig dependencies to select CONFIG_USE_OF.

Update the SMP glue code to use OF for matching.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Changes from V1:
 - none - this is the first public release

 arch/arm/boot/dts/emev2-kzm9d.dts    |   26 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig       |    1 +
 arch/arm/mach-shmobile/board-kzm9d.c |    8 +++++++-
 arch/arm/mach-shmobile/platsmp.c     |    3 ++-
 4 files changed, 36 insertions(+), 2 deletions(-)

--- /dev/null
+++ work/arch/arm/boot/dts/emev2-kzm9d.dts	2012-05-16 15:22:30.000000000 +0900
@@ -0,0 +1,26 @@
+/*
+ * Device Tree Source for the KZM9D board
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+/dts-v1/;
+
+/include/ "emev2.dtsi"
+
+/ {
+	model = "EMEV2 KZM9D Board";
+	compatible = "renesas,kzm9d", "renesas,emev2";
+
+	memory {
+		device_type = "memory";
+		reg = <0x40000000 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS1,115200n81";
+	};
+};
--- 0010/arch/arm/mach-shmobile/Kconfig
+++ work/arch/arm/mach-shmobile/Kconfig	2012-05-16 15:03:53.000000000 +0900
@@ -119,6 +119,7 @@ config MACH_KZM9G
 config MACH_KZM9D
 	bool "KZM9D board"
 	depends on ARCH_EMEV2
+	select USE_OF
 
 comment "SH-Mobile System Configuration"
 
--- 0011/arch/arm/mach-shmobile/board-kzm9d.c
+++ work/arch/arm/mach-shmobile/board-kzm9d.c	2012-05-16 15:17:35.000000000 +0900
@@ -68,7 +68,12 @@ void __init kzm9d_add_standard_devices(v
 	platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
 }
 
-MACHINE_START(KZM9D, "kzm9d")
+static const char *kzm9d_boards_compat_dt[] __initdata = {
+	"renesas,kzm9d",
+	NULL,
+};
+
+DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
@@ -76,4 +81,5 @@ MACHINE_START(KZM9D, "kzm9d")
 	.handle_irq	= gic_handle_irq,
 	.init_machine	= kzm9d_add_standard_devices,
 	.timer		= &shmobile_timer,
+	.dt_compat	= kzm9d_boards_compat_dt,
 MACHINE_END
--- 0009/arch/arm/mach-shmobile/platsmp.c
+++ work/arch/arm/mach-shmobile/platsmp.c	2012-05-16 15:17:41.000000000 +0900
@@ -16,6 +16,7 @@
 #include <linux/device.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/of.h>
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
@@ -23,7 +24,7 @@
 
 #define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || machine_is_kzm9g())
 #define is_r8a7779() machine_is_marzen()
-#define is_emev2() machine_is_kzm9d()
+#define is_emev2() of_machine_is_compatible("renesas,emev2")
 
 static unsigned int __init shmobile_smp_get_core_count(void)
 {

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
  2012-05-16  6:44   ` Magnus Damm
  (?)
@ 2012-05-16  6:56     ` Paul Mundt
  -1 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-05-16  6:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
> +static int emev2_gclk_enable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +	return 0;
> +}
> +
> +static void emev2_gclk_disable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +}
> +
> +static struct sh_clk_ops emev2_gclk_clk_ops = {
> +	.enable		= emev2_gclk_enable,
> +	.disable	= emev2_gclk_disable,
> +	.recalc		= followparent_recalc,
> +};
> +
> +static int __init emev2_gclk_register(struct clk *clks, int nr)
> +{
> +	struct clk *clkp;
> +	int ret = 0;
> +	int k;
> +
> +	for (k = 0; !ret && (k < nr); k++) {
> +		clkp = clks + k;
> +		clkp->ops = &emev2_gclk_clk_ops;
> +		ret |= clk_register(clkp);
> +	}
> +
> +	return ret;
> +}
> +
This all looks like a pointless abstraction. This is basically a verbatim
copy of the sh_clk_mstp32 routines.

I suppose this is a case where you want to use the mstp32 routines but
don't specifically have div4/div6 clocks to manage so you aren't setting
SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
it's provided regardless of the CPG setting and rename it to drop the
mstp32 connotations. It's really only the div4/div6 stuff that has any
CPG-specific behaviour at this point anyways.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  6:56     ` Paul Mundt
  0 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-05-16  6:56 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, horms, olof

On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
> +static int emev2_gclk_enable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +	return 0;
> +}
> +
> +static void emev2_gclk_disable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +}
> +
> +static struct sh_clk_ops emev2_gclk_clk_ops = {
> +	.enable		= emev2_gclk_enable,
> +	.disable	= emev2_gclk_disable,
> +	.recalc		= followparent_recalc,
> +};
> +
> +static int __init emev2_gclk_register(struct clk *clks, int nr)
> +{
> +	struct clk *clkp;
> +	int ret = 0;
> +	int k;
> +
> +	for (k = 0; !ret && (k < nr); k++) {
> +		clkp = clks + k;
> +		clkp->ops = &emev2_gclk_clk_ops;
> +		ret |= clk_register(clkp);
> +	}
> +
> +	return ret;
> +}
> +
This all looks like a pointless abstraction. This is basically a verbatim
copy of the sh_clk_mstp32 routines.

I suppose this is a case where you want to use the mstp32 routines but
don't specifically have div4/div6 clocks to manage so you aren't setting
SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
it's provided regardless of the CPG setting and rename it to drop the
mstp32 connotations. It's really only the div4/div6 stuff that has any
CPG-specific behaviour at this point anyways.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  6:56     ` Paul Mundt
  0 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-05-16  6:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
> +static int emev2_gclk_enable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +	return 0;
> +}
> +
> +static void emev2_gclk_disable(struct clk *clk)
> +{
> +	iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
> +		  clk->mapped_reg);
> +}
> +
> +static struct sh_clk_ops emev2_gclk_clk_ops = {
> +	.enable		= emev2_gclk_enable,
> +	.disable	= emev2_gclk_disable,
> +	.recalc		= followparent_recalc,
> +};
> +
> +static int __init emev2_gclk_register(struct clk *clks, int nr)
> +{
> +	struct clk *clkp;
> +	int ret = 0;
> +	int k;
> +
> +	for (k = 0; !ret && (k < nr); k++) {
> +		clkp = clks + k;
> +		clkp->ops = &emev2_gclk_clk_ops;
> +		ret |= clk_register(clkp);
> +	}
> +
> +	return ret;
> +}
> +
This all looks like a pointless abstraction. This is basically a verbatim
copy of the sh_clk_mstp32 routines.

I suppose this is a case where you want to use the mstp32 routines but
don't specifically have div4/div6 clocks to manage so you aren't setting
SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
it's provided regardless of the CPG setting and rename it to drop the
mstp32 connotations. It's really only the div4/div6 stuff that has any
CPG-specific behaviour at this point anyways.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
  2012-05-16  6:56     ` Paul Mundt
  (?)
@ 2012-05-16  9:49       ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 3:56 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
>> +static int emev2_gclk_enable(struct clk *clk)
>> +{
>> +     iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
>> +               clk->mapped_reg);
>> +     return 0;
>> +}
>> +
>> +static void emev2_gclk_disable(struct clk *clk)
>> +{
>> +     iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
>> +               clk->mapped_reg);
>> +}
>> +
>> +static struct sh_clk_ops emev2_gclk_clk_ops = {
>> +     .enable         = emev2_gclk_enable,
>> +     .disable        = emev2_gclk_disable,
>> +     .recalc         = followparent_recalc,
>> +};
>> +
>> +static int __init emev2_gclk_register(struct clk *clks, int nr)
>> +{
>> +     struct clk *clkp;
>> +     int ret = 0;
>> +     int k;
>> +
>> +     for (k = 0; !ret && (k < nr); k++) {
>> +             clkp = clks + k;
>> +             clkp->ops = &emev2_gclk_clk_ops;
>> +             ret |= clk_register(clkp);
>> +     }
>> +
>> +     return ret;
>> +}
>> +
> This all looks like a pointless abstraction. This is basically a verbatim
> copy of the sh_clk_mstp32 routines.

At a first glance maybe, but the operation is inverted compared to MSTP32.

So, at disable time gclk clears the bit. MSTP32 sets the bit.

> I suppose this is a case where you want to use the mstp32 routines but
> don't specifically have div4/div6 clocks to manage so you aren't setting
> SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
> it's provided regardless of the CPG setting and rename it to drop the
> mstp32 connotations. It's really only the div4/div6 stuff that has any
> CPG-specific behaviour at this point anyways.

Perhaps we could base this code on MSTP32 and CPG, but I believe it is
better just to move to common clocks directly. So in this case for
gclk we can instead use code in drivers/clk/clk-gate.c.

Cheers,

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  9:49       ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  9:49 UTC (permalink / raw)
  To: Paul Mundt
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, horms, olof

On Wed, May 16, 2012 at 3:56 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
>> +static int emev2_gclk_enable(struct clk *clk)
>> +{
>> +     iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
>> +               clk->mapped_reg);
>> +     return 0;
>> +}
>> +
>> +static void emev2_gclk_disable(struct clk *clk)
>> +{
>> +     iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
>> +               clk->mapped_reg);
>> +}
>> +
>> +static struct sh_clk_ops emev2_gclk_clk_ops = {
>> +     .enable         = emev2_gclk_enable,
>> +     .disable        = emev2_gclk_disable,
>> +     .recalc         = followparent_recalc,
>> +};
>> +
>> +static int __init emev2_gclk_register(struct clk *clks, int nr)
>> +{
>> +     struct clk *clkp;
>> +     int ret = 0;
>> +     int k;
>> +
>> +     for (k = 0; !ret && (k < nr); k++) {
>> +             clkp = clks + k;
>> +             clkp->ops = &emev2_gclk_clk_ops;
>> +             ret |= clk_register(clkp);
>> +     }
>> +
>> +     return ret;
>> +}
>> +
> This all looks like a pointless abstraction. This is basically a verbatim
> copy of the sh_clk_mstp32 routines.

At a first glance maybe, but the operation is inverted compared to MSTP32.

So, at disable time gclk clears the bit. MSTP32 sets the bit.

> I suppose this is a case where you want to use the mstp32 routines but
> don't specifically have div4/div6 clocks to manage so you aren't setting
> SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
> it's provided regardless of the CPG setting and rename it to drop the
> mstp32 connotations. It's really only the div4/div6 stuff that has any
> CPG-specific behaviour at this point anyways.

Perhaps we could base this code on MSTP32 and CPG, but I believe it is
better just to move to common clocks directly. So in this case for
gclk we can instead use code in drivers/clk/clk-gate.c.

Cheers,

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
@ 2012-05-16  9:49       ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-16  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 3:56 PM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Wed, May 16, 2012 at 03:44:58PM +0900, Magnus Damm wrote:
>> +static int emev2_gclk_enable(struct clk *clk)
>> +{
>> + ? ? iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
>> + ? ? ? ? ? ? ? clk->mapped_reg);
>> + ? ? return 0;
>> +}
>> +
>> +static void emev2_gclk_disable(struct clk *clk)
>> +{
>> + ? ? iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
>> + ? ? ? ? ? ? ? clk->mapped_reg);
>> +}
>> +
>> +static struct sh_clk_ops emev2_gclk_clk_ops = {
>> + ? ? .enable ? ? ? ? = emev2_gclk_enable,
>> + ? ? .disable ? ? ? ?= emev2_gclk_disable,
>> + ? ? .recalc ? ? ? ? = followparent_recalc,
>> +};
>> +
>> +static int __init emev2_gclk_register(struct clk *clks, int nr)
>> +{
>> + ? ? struct clk *clkp;
>> + ? ? int ret = 0;
>> + ? ? int k;
>> +
>> + ? ? for (k = 0; !ret && (k < nr); k++) {
>> + ? ? ? ? ? ? clkp = clks + k;
>> + ? ? ? ? ? ? clkp->ops = &emev2_gclk_clk_ops;
>> + ? ? ? ? ? ? ret |= clk_register(clkp);
>> + ? ? }
>> +
>> + ? ? return ret;
>> +}
>> +
> This all looks like a pointless abstraction. This is basically a verbatim
> copy of the sh_clk_mstp32 routines.

At a first glance maybe, but the operation is inverted compared to MSTP32.

So, at disable time gclk clears the bit. MSTP32 sets the bit.

> I suppose this is a case where you want to use the mstp32 routines but
> don't specifically have div4/div6 clocks to manage so you aren't setting
> SH_CLK_CPG. Perhaps we should just move the sh_clk_mstp32 stuff out so
> it's provided regardless of the CPG setting and rename it to drop the
> mstp32 connotations. It's really only the div4/div6 stuff that has any
> CPG-specific behaviour at this point anyways.

Perhaps we could base this code on MSTP32 and CPG, but I believe it is
better just to move to common clocks directly. So in this case for
gclk we can instead use code in drivers/clk/clk-gate.c.

Cheers,

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-05-18  1:44   ` Simon Horman
  -1 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Magnus,

I have tested these patches on top of the soc-new branch of
rafael's renesas tree, revision 5658c94, which is based on
v3.4-rc6.

I also have the cherry picked following patches before applying your patches.

serial8250-em: clk_get() IS_ERR() error handling fix
serial8250-em: Emma Mobile UART driver V2
serial8250: Introduce serial8250_register_8250_port()
serial8250: Clean up default map and dl code
serial8250: Use dl_read()/dl_write() on RM9K
serial8250: Use dl_read()/dl_write() on Alchemy
serial8250: Add dl_read()/dl_write() callbacks
8250.c: less than 2400 baud fix.
serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
tegra, serial8250: add ->handle_break() uart_port op
clocksource: em_sti: Add DT support
clocksource: em_sti: Emma Mobile STI driver V2
clockevents: Make clockevents_config() a global symbol

I have added the follwing patch of yours

gpio: Emma Mobile GPIO driver V2

And one of my own, which just fixes a build problem
in rafael's tree.

ARM: mach-types: Manually add KZM-A9-GT

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3

I did not need this patch with the base I am using,
so I did not test it.

Reviewed-by: Simon Horman <horms@verge.net.au>

> [PATCH 03/08] mach-shmobile: KZM9D board support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3

I am only seeing interripts for em_gio.0, is there a
way to exercise em_gio.1 .. 4 ?

Duplicate names for interrupts, that is
each of em_gio.0..4 have two entries in /proc/interripts.
Is this intentional?

 99:         32          0       GIC  em_gio.0
 100:          0          0       GIC  em_gio.0
 101:          0          0       GIC  em_gio.1
 102:          0          0       GIC  em_gio.1
 103:          0          0       GIC  em_gio.2
 104:          0          0       GIC  em_gio.2
 105:          0          0       GIC  em_gio.3
 106:          0          0       GIC  em_gio.3
 107:          0          0       GIC  em_gio.4
 108:          0          0       GIC  em_gio.4
 157:      35952          0       GIC  em_sti.0

> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3

I applied this and the resulting kernel booted.

> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

I applied this and the resulting kernel did not boot.
I saw nothing after the uboot prompt..


Lastly, could you consider suppling a patch which provides a defconfig?

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  1:44   ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  1:44 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof

Hi Magnus,

I have tested these patches on top of the soc-new branch of
rafael's renesas tree, revision 5658c94, which is based on
v3.4-rc6.

I also have the cherry picked following patches before applying your patches.

serial8250-em: clk_get() IS_ERR() error handling fix
serial8250-em: Emma Mobile UART driver V2
serial8250: Introduce serial8250_register_8250_port()
serial8250: Clean up default map and dl code
serial8250: Use dl_read()/dl_write() on RM9K
serial8250: Use dl_read()/dl_write() on Alchemy
serial8250: Add dl_read()/dl_write() callbacks
8250.c: less than 2400 baud fix.
serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
tegra, serial8250: add ->handle_break() uart_port op
clocksource: em_sti: Add DT support
clocksource: em_sti: Emma Mobile STI driver V2
clockevents: Make clockevents_config() a global symbol

I have added the follwing patch of yours

gpio: Emma Mobile GPIO driver V2

And one of my own, which just fixes a build problem
in rafael's tree.

ARM: mach-types: Manually add KZM-A9-GT

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3

I did not need this patch with the base I am using,
so I did not test it.

Reviewed-by: Simon Horman <horms@verge.net.au>

> [PATCH 03/08] mach-shmobile: KZM9D board support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3

I am only seeing interripts for em_gio.0, is there a
way to exercise em_gio.1 .. 4 ?

Duplicate names for interrupts, that is
each of em_gio.0..4 have two entries in /proc/interripts.
Is this intentional?

 99:         32          0       GIC  em_gio.0
 100:          0          0       GIC  em_gio.0
 101:          0          0       GIC  em_gio.1
 102:          0          0       GIC  em_gio.1
 103:          0          0       GIC  em_gio.2
 104:          0          0       GIC  em_gio.2
 105:          0          0       GIC  em_gio.3
 106:          0          0       GIC  em_gio.3
 107:          0          0       GIC  em_gio.4
 108:          0          0       GIC  em_gio.4
 157:      35952          0       GIC  em_sti.0

> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3

I applied this and the resulting kernel booted.

> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

I applied this and the resulting kernel did not boot.
I saw nothing after the uboot prompt..


Lastly, could you consider suppling a patch which provides a defconfig?

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  1:44   ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  1:44 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Magnus,

I have tested these patches on top of the soc-new branch of
rafael's renesas tree, revision 5658c94, which is based on
v3.4-rc6.

I also have the cherry picked following patches before applying your patches.

serial8250-em: clk_get() IS_ERR() error handling fix
serial8250-em: Emma Mobile UART driver V2
serial8250: Introduce serial8250_register_8250_port()
serial8250: Clean up default map and dl code
serial8250: Use dl_read()/dl_write() on RM9K
serial8250: Use dl_read()/dl_write() on Alchemy
serial8250: Add dl_read()/dl_write() callbacks
8250.c: less than 2400 baud fix.
serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
tegra, serial8250: add ->handle_break() uart_port op
clocksource: em_sti: Add DT support
clocksource: em_sti: Emma Mobile STI driver V2
clockevents: Make clockevents_config() a global symbol

I have added the follwing patch of yours

gpio: Emma Mobile GPIO driver V2

And one of my own, which just fixes a build problem
in rafael's tree.

ARM: mach-types: Manually add KZM-A9-GT

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3

I did not need this patch with the base I am using,
so I did not test it.

Reviewed-by: Simon Horman <horms@verge.net.au>

> [PATCH 03/08] mach-shmobile: KZM9D board support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3

I am only seeing interripts for em_gio.0, is there a
way to exercise em_gio.1 .. 4 ?

Duplicate names for interrupts, that is
each of em_gio.0..4 have two entries in /proc/interripts.
Is this intentional?

 99:         32          0       GIC  em_gio.0
 100:          0          0       GIC  em_gio.0
 101:          0          0       GIC  em_gio.1
 102:          0          0       GIC  em_gio.1
 103:          0          0       GIC  em_gio.2
 104:          0          0       GIC  em_gio.2
 105:          0          0       GIC  em_gio.3
 106:          0          0       GIC  em_gio.3
 107:          0          0       GIC  em_gio.4
 108:          0          0       GIC  em_gio.4
 157:      35952          0       GIC  em_sti.0

> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3

Tested-by: Simon Horman <horms@verge.net.au>

> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3

I applied this and the resulting kernel booted.

> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3

I applied this and the resulting kernel did not boot.
I saw nothing after the uboot prompt..


Lastly, could you consider suppling a patch which provides a defconfig?

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
  2012-05-18  1:44   ` Simon Horman
  (?)
@ 2012-05-18  3:30     ` Simon Horman
  -1 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 18, 2012 at 10:44:26AM +0900, Simon Horman wrote:
> Hi Magnus,
> 
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.
> 
> I also have the cherry picked following patches before applying your patches.
> 
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol
> 
> I have added the follwing patch of yours
> 
> gpio: Emma Mobile GPIO driver V2
> 
> And one of my own, which just fixes a build problem
> in rafael's tree.
> 
> ARM: mach-types: Manually add KZM-A9-GT
> 
> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> > mach-shmobile: Emma Mobile EV2 support V3
> > 
> > [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> 
> I did not need this patch with the base I am using,
> so I did not test it.
> 
> Reviewed-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 03/08] mach-shmobile: KZM9D board support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> 
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?
> 
> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?
> 
>  99:         32          0       GIC  em_gio.0
>  100:          0          0       GIC  em_gio.0
>  101:          0          0       GIC  em_gio.1
>  102:          0          0       GIC  em_gio.1
>  103:          0          0       GIC  em_gio.2
>  104:          0          0       GIC  em_gio.2
>  105:          0          0       GIC  em_gio.3
>  106:          0          0       GIC  em_gio.3
>  107:          0          0       GIC  em_gio.4
>  108:          0          0       GIC  em_gio.4
>  157:      35952          0       GIC  em_sti.0
> 
> > [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> 
> I applied this and the resulting kernel booted.
> 
> > [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Thanks for walking me through how to manually adding the dtb to the zImage.

Tested-by: Simon Horman <horms@verge.net.au>

> Lastly, could you consider suppling a patch which provides a defconfig?


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  3:30     ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  3:30 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof

On Fri, May 18, 2012 at 10:44:26AM +0900, Simon Horman wrote:
> Hi Magnus,
> 
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.
> 
> I also have the cherry picked following patches before applying your patches.
> 
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol
> 
> I have added the follwing patch of yours
> 
> gpio: Emma Mobile GPIO driver V2
> 
> And one of my own, which just fixes a build problem
> in rafael's tree.
> 
> ARM: mach-types: Manually add KZM-A9-GT
> 
> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> > mach-shmobile: Emma Mobile EV2 support V3
> > 
> > [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> 
> I did not need this patch with the base I am using,
> so I did not test it.
> 
> Reviewed-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 03/08] mach-shmobile: KZM9D board support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> 
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?
> 
> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?
> 
>  99:         32          0       GIC  em_gio.0
>  100:          0          0       GIC  em_gio.0
>  101:          0          0       GIC  em_gio.1
>  102:          0          0       GIC  em_gio.1
>  103:          0          0       GIC  em_gio.2
>  104:          0          0       GIC  em_gio.2
>  105:          0          0       GIC  em_gio.3
>  106:          0          0       GIC  em_gio.3
>  107:          0          0       GIC  em_gio.4
>  108:          0          0       GIC  em_gio.4
>  157:      35952          0       GIC  em_sti.0
> 
> > [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> 
> I applied this and the resulting kernel booted.
> 
> > [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Thanks for walking me through how to manually adding the dtb to the zImage.

Tested-by: Simon Horman <horms@verge.net.au>

> Lastly, could you consider suppling a patch which provides a defconfig?


^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  3:30     ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  3:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 18, 2012 at 10:44:26AM +0900, Simon Horman wrote:
> Hi Magnus,
> 
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.
> 
> I also have the cherry picked following patches before applying your patches.
> 
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol
> 
> I have added the follwing patch of yours
> 
> gpio: Emma Mobile GPIO driver V2
> 
> And one of my own, which just fixes a build problem
> in rafael's tree.
> 
> ARM: mach-types: Manually add KZM-A9-GT
> 
> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> > mach-shmobile: Emma Mobile EV2 support V3
> > 
> > [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> 
> I did not need this patch with the base I am using,
> so I did not test it.
> 
> Reviewed-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 03/08] mach-shmobile: KZM9D board support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> 
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?
> 
> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?
> 
>  99:         32          0       GIC  em_gio.0
>  100:          0          0       GIC  em_gio.0
>  101:          0          0       GIC  em_gio.1
>  102:          0          0       GIC  em_gio.1
>  103:          0          0       GIC  em_gio.2
>  104:          0          0       GIC  em_gio.2
>  105:          0          0       GIC  em_gio.3
>  106:          0          0       GIC  em_gio.3
>  107:          0          0       GIC  em_gio.4
>  108:          0          0       GIC  em_gio.4
>  157:      35952          0       GIC  em_sti.0
> 
> > [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> 
> Tested-by: Simon Horman <horms@verge.net.au>
> 
> > [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> 
> I applied this and the resulting kernel booted.
> 
> > [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Thanks for walking me through how to manually adding the dtb to the zImage.

Tested-by: Simon Horman <horms@verge.net.au>

> Lastly, could you consider suppling a patch which provides a defconfig?

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
  2012-05-18  1:44   ` Simon Horman
  (?)
@ 2012-05-18  3:40     ` Magnus Damm
  -1 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-18  3:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> Hi Magnus,
>
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.

Excellent!

> I also have the cherry picked following patches before applying your patches.
>
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol

Thanks, those are indeed needed for runtime UART and STI support, but
there shouldn't be any build time dependencies.

> I have added the follwing patch of yours
>
> gpio: Emma Mobile GPIO driver V2
>
> And one of my own, which just fixes a build problem
> in rafael's tree.
>
> ARM: mach-types: Manually add KZM-A9-GT

Right, that's a bit of a mess.

> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
>> mach-shmobile: Emma Mobile EV2 support V3
>>
>> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
>
> I did not need this patch with the base I am using,
> so I did not test it.

Ok!

> Reviewed-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 03/08] mach-shmobile: KZM9D board support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
>
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?

When we start using other GPIO pins with interrupts then that will
happen. Right now there is no code.

> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?

Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

>> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
>
> I applied this and the resulting kernel booted.

That's good! Thanks for testing!

>> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
>
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
to the zImage, then convert that to uImage.

> Lastly, could you consider suppling a patch which provides a defconfig?

I've been asked to provide a defconfig that we can share between
multiple platforms. So it's on my TODO.

Thank you!

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  3:40     ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-18  3:40 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof

Hi Simon,

On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> Hi Magnus,
>
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.

Excellent!

> I also have the cherry picked following patches before applying your patches.
>
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol

Thanks, those are indeed needed for runtime UART and STI support, but
there shouldn't be any build time dependencies.

> I have added the follwing patch of yours
>
> gpio: Emma Mobile GPIO driver V2
>
> And one of my own, which just fixes a build problem
> in rafael's tree.
>
> ARM: mach-types: Manually add KZM-A9-GT

Right, that's a bit of a mess.

> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
>> mach-shmobile: Emma Mobile EV2 support V3
>>
>> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
>
> I did not need this patch with the base I am using,
> so I did not test it.

Ok!

> Reviewed-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 03/08] mach-shmobile: KZM9D board support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
>
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?

When we start using other GPIO pins with interrupts then that will
happen. Right now there is no code.

> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?

Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

>> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
>
> I applied this and the resulting kernel booted.

That's good! Thanks for testing!

>> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
>
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
to the zImage, then convert that to uImage.

> Lastly, could you consider suppling a patch which provides a defconfig?

I've been asked to provide a defconfig that we can share between
multiple platforms. So it's on my TODO.

Thank you!

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  3:40     ` Magnus Damm
  0 siblings, 0 replies; 48+ messages in thread
From: Magnus Damm @ 2012-05-18  3:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> Hi Magnus,
>
> I have tested these patches on top of the soc-new branch of
> rafael's renesas tree, revision 5658c94, which is based on
> v3.4-rc6.

Excellent!

> I also have the cherry picked following patches before applying your patches.
>
> serial8250-em: clk_get() IS_ERR() error handling fix
> serial8250-em: Emma Mobile UART driver V2
> serial8250: Introduce serial8250_register_8250_port()
> serial8250: Clean up default map and dl code
> serial8250: Use dl_read()/dl_write() on RM9K
> serial8250: Use dl_read()/dl_write() on Alchemy
> serial8250: Add dl_read()/dl_write() callbacks
> 8250.c: less than 2400 baud fix.
> serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> tegra, serial8250: add ->handle_break() uart_port op
> clocksource: em_sti: Add DT support
> clocksource: em_sti: Emma Mobile STI driver V2
> clockevents: Make clockevents_config() a global symbol

Thanks, those are indeed needed for runtime UART and STI support, but
there shouldn't be any build time dependencies.

> I have added the follwing patch of yours
>
> gpio: Emma Mobile GPIO driver V2
>
> And one of my own, which just fixes a build problem
> in rafael's tree.
>
> ARM: mach-types: Manually add KZM-A9-GT

Right, that's a bit of a mess.

> On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
>> mach-shmobile: Emma Mobile EV2 support V3
>>
>> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
>
> I did not need this patch with the base I am using,
> so I did not test it.

Ok!

> Reviewed-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 03/08] mach-shmobile: KZM9D board support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
>
> I am only seeing interripts for em_gio.0, is there a
> way to exercise em_gio.1 .. 4 ?

When we start using other GPIO pins with interrupts then that will
happen. Right now there is no code.

> Duplicate names for interrupts, that is
> each of em_gio.0..4 have two entries in /proc/interripts.
> Is this intentional?

Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

>> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
>
> Tested-by: Simon Horman <horms@verge.net.au>
>
>> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
>
> I applied this and the resulting kernel booted.

That's good! Thanks for testing!

>> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
>
> I applied this and the resulting kernel did not boot.
> I saw nothing after the uboot prompt..

Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
to the zImage, then convert that to uImage.

> Lastly, could you consider suppling a patch which provides a defconfig?

I've been asked to provide a defconfig that we can share between
multiple platforms. So it's on my TODO.

Thank you!

/ magnus

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
  2012-05-18  3:40     ` Magnus Damm
  (?)
@ 2012-05-18  4:46       ` Simon Horman
  -1 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  4:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Magnus,

On Fri, May 18, 2012 at 12:40:21PM +0900, Magnus Damm wrote:
> Hi Simon,
> 
> On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> > Hi Magnus,
> >
> > I have tested these patches on top of the soc-new branch of
> > rafael's renesas tree, revision 5658c94, which is based on
> > v3.4-rc6.
> 
> Excellent!
> 
> > I also have the cherry picked following patches before applying your patches.
> >
> > serial8250-em: clk_get() IS_ERR() error handling fix
> > serial8250-em: Emma Mobile UART driver V2
> > serial8250: Introduce serial8250_register_8250_port()
> > serial8250: Clean up default map and dl code
> > serial8250: Use dl_read()/dl_write() on RM9K
> > serial8250: Use dl_read()/dl_write() on Alchemy
> > serial8250: Add dl_read()/dl_write() callbacks
> > 8250.c: less than 2400 baud fix.
> > serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> > tegra, serial8250: add ->handle_break() uart_port op
> > clocksource: em_sti: Add DT support
> > clocksource: em_sti: Emma Mobile STI driver V2
> > clockevents: Make clockevents_config() a global symbol
> 
> Thanks, those are indeed needed for runtime UART and STI support, but
> there shouldn't be any build time dependencies.
> 
> > I have added the follwing patch of yours
> >
> > gpio: Emma Mobile GPIO driver V2
> >
> > And one of my own, which just fixes a build problem
> > in rafael's tree.
> >
> > ARM: mach-types: Manually add KZM-A9-GT
> 
> Right, that's a bit of a mess.
> 
> > On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> >> mach-shmobile: Emma Mobile EV2 support V3
> >>
> >> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> >
> > I did not need this patch with the base I am using,
> > so I did not test it.
> 
> Ok!

:)

> > Reviewed-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> >
> > I am only seeing interripts for em_gio.0, is there a
> > way to exercise em_gio.1 .. 4 ?
> 
> When we start using other GPIO pins with interrupts then that will
> happen. Right now there is no code.

Ok, in that case

Tested-by: Simon Horman <horms@verge.net.au>

> > Duplicate names for interrupts, that is
> > each of em_gio.0..4 have two entries in /proc/interripts.
> > Is this intentional?
> 
> Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

In that case

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> >
> > I applied this and the resulting kernel booted.
> 
> That's good! Thanks for testing!

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> >
> > I applied this and the resulting kernel did not boot.
> > I saw nothing after the uboot prompt..
> 
> Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
> to the zImage, then convert that to uImage.

Thanks for working me through that off-line.

Tested-by: Simon Horman <horms@verge.net.au>

> 
> > Lastly, could you consider suppling a patch which provides a defconfig?
> 
> I've been asked to provide a defconfig that we can share between
> multiple platforms. So it's on my TODO.

Excellent

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  4:46       ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  4:46 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-arm-kernel, linux, arnd, linux-sh, linux-kernel, rjw, lethal, olof

Hi Magnus,

On Fri, May 18, 2012 at 12:40:21PM +0900, Magnus Damm wrote:
> Hi Simon,
> 
> On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> > Hi Magnus,
> >
> > I have tested these patches on top of the soc-new branch of
> > rafael's renesas tree, revision 5658c94, which is based on
> > v3.4-rc6.
> 
> Excellent!
> 
> > I also have the cherry picked following patches before applying your patches.
> >
> > serial8250-em: clk_get() IS_ERR() error handling fix
> > serial8250-em: Emma Mobile UART driver V2
> > serial8250: Introduce serial8250_register_8250_port()
> > serial8250: Clean up default map and dl code
> > serial8250: Use dl_read()/dl_write() on RM9K
> > serial8250: Use dl_read()/dl_write() on Alchemy
> > serial8250: Add dl_read()/dl_write() callbacks
> > 8250.c: less than 2400 baud fix.
> > serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> > tegra, serial8250: add ->handle_break() uart_port op
> > clocksource: em_sti: Add DT support
> > clocksource: em_sti: Emma Mobile STI driver V2
> > clockevents: Make clockevents_config() a global symbol
> 
> Thanks, those are indeed needed for runtime UART and STI support, but
> there shouldn't be any build time dependencies.
> 
> > I have added the follwing patch of yours
> >
> > gpio: Emma Mobile GPIO driver V2
> >
> > And one of my own, which just fixes a build problem
> > in rafael's tree.
> >
> > ARM: mach-types: Manually add KZM-A9-GT
> 
> Right, that's a bit of a mess.
> 
> > On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> >> mach-shmobile: Emma Mobile EV2 support V3
> >>
> >> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> >
> > I did not need this patch with the base I am using,
> > so I did not test it.
> 
> Ok!

:)

> > Reviewed-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> >
> > I am only seeing interripts for em_gio.0, is there a
> > way to exercise em_gio.1 .. 4 ?
> 
> When we start using other GPIO pins with interrupts then that will
> happen. Right now there is no code.

Ok, in that case

Tested-by: Simon Horman <horms@verge.net.au>

> > Duplicate names for interrupts, that is
> > each of em_gio.0..4 have two entries in /proc/interripts.
> > Is this intentional?
> 
> Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

In that case

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> >
> > I applied this and the resulting kernel booted.
> 
> That's good! Thanks for testing!

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> >
> > I applied this and the resulting kernel did not boot.
> > I saw nothing after the uboot prompt..
> 
> Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
> to the zImage, then convert that to uImage.

Thanks for working me through that off-line.

Tested-by: Simon Horman <horms@verge.net.au>

> 
> > Lastly, could you consider suppling a patch which provides a defconfig?
> 
> I've been asked to provide a defconfig that we can share between
> multiple platforms. So it's on my TODO.

Excellent

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-05-18  4:46       ` Simon Horman
  0 siblings, 0 replies; 48+ messages in thread
From: Simon Horman @ 2012-05-18  4:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Magnus,

On Fri, May 18, 2012 at 12:40:21PM +0900, Magnus Damm wrote:
> Hi Simon,
> 
> On Fri, May 18, 2012 at 10:44 AM, Simon Horman <horms@verge.net.au> wrote:
> > Hi Magnus,
> >
> > I have tested these patches on top of the soc-new branch of
> > rafael's renesas tree, revision 5658c94, which is based on
> > v3.4-rc6.
> 
> Excellent!
> 
> > I also have the cherry picked following patches before applying your patches.
> >
> > serial8250-em: clk_get() IS_ERR() error handling fix
> > serial8250-em: Emma Mobile UART driver V2
> > serial8250: Introduce serial8250_register_8250_port()
> > serial8250: Clean up default map and dl code
> > serial8250: Use dl_read()/dl_write() on RM9K
> > serial8250: Use dl_read()/dl_write() on Alchemy
> > serial8250: Add dl_read()/dl_write() callbacks
> > 8250.c: less than 2400 baud fix.
> > serial/8250_pci: Clear FIFOs for Intel ME Serial Over Lan device on BI
> > tegra, serial8250: add ->handle_break() uart_port op
> > clocksource: em_sti: Add DT support
> > clocksource: em_sti: Emma Mobile STI driver V2
> > clockevents: Make clockevents_config() a global symbol
> 
> Thanks, those are indeed needed for runtime UART and STI support, but
> there shouldn't be any build time dependencies.
> 
> > I have added the follwing patch of yours
> >
> > gpio: Emma Mobile GPIO driver V2
> >
> > And one of my own, which just fixes a build problem
> > in rafael's tree.
> >
> > ARM: mach-types: Manually add KZM-A9-GT
> 
> Right, that's a bit of a mess.
> 
> > On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> >> mach-shmobile: Emma Mobile EV2 support V3
> >>
> >> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> >
> > I did not need this patch with the base I am using,
> > so I did not test it.
> 
> Ok!

:)

> > Reviewed-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> >
> > I am only seeing interripts for em_gio.0, is there a
> > way to exercise em_gio.1 .. 4 ?
> 
> When we start using other GPIO pins with interrupts then that will
> happen. Right now there is no code.

Ok, in that case

Tested-by: Simon Horman <horms@verge.net.au>

> > Duplicate names for interrupts, that is
> > each of em_gio.0..4 have two entries in /proc/interripts.
> > Is this intentional?
> 
> Yes, it is intentional. There are two interrupt sources per 32 GPIO pins.

In that case

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> >
> > Tested-by: Simon Horman <horms@verge.net.au>
> >
> >> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> >
> > I applied this and the resulting kernel booted.
> 
> That's good! Thanks for testing!

Tested-by: Simon Horman <horms@verge.net.au>

> >> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> >
> > I applied this and the resulting kernel did not boot.
> > I saw nothing after the uboot prompt..
> 
> Yeah, you need to select CONFIG_ARM_APPENDED_DTB=y and append the DTB
> to the zImage, then convert that to uImage.

Thanks for working me through that off-line.

Tested-by: Simon Horman <horms@verge.net.au>

> 
> > Lastly, could you consider suppling a patch which provides a defconfig?
> 
> I've been asked to provide a defconfig that we can share between
> multiple platforms. So it's on my TODO.

Excellent

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
  2012-05-16  6:44 ` Magnus Damm
  (?)
@ 2012-06-11  3:55   ` Paul Mundt
  -1 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-06-11  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
Now that this series has hit mainline I notice that no defconfig is
available for the board, so there's no way to have any coverage in it in
-next. When we're at a point where multiple boards are enabled in one
config then they can be consolidated, but it's not acceptable to have a
platform upstream that people have no way of building.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-06-11  3:55   ` Paul Mundt
  0 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-06-11  3:55 UTC (permalink / raw)
  To: Magnus Damm
  Cc: linux-arm-kernel, horms, linux, arnd, linux-sh, linux-kernel, rjw, olof

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
Now that this series has hit mainline I notice that no defconfig is
available for the board, so there's no way to have any coverage in it in
-next. When we're at a point where multiple boards are enabled in one
config then they can be consolidated, but it's not acceptable to have a
platform upstream that people have no way of building.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3
@ 2012-06-11  3:55   ` Paul Mundt
  0 siblings, 0 replies; 48+ messages in thread
From: Paul Mundt @ 2012-06-11  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 16, 2012 at 03:44:49PM +0900, Magnus Damm wrote:
> mach-shmobile: Emma Mobile EV2 support V3
> 
> [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
> [PATCH 02/08] ARM: Undelete KZM9D mach-type V3
> [PATCH 03/08] mach-shmobile: KZM9D board support V3
> [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
> [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO support V3
> [PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
> [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
> [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3
> 
Now that this series has hit mainline I notice that no defconfig is
available for the board, so there's no way to have any coverage in it in
-next. When we're at a point where multiple boards are enabled in one
config then they can be consolidated, but it's not acceptable to have a
platform upstream that people have no way of building.

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2012-06-11  3:56 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-16  6:44 [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3 Magnus Damm
2012-05-16  6:44 ` Magnus Damm
2012-05-16  6:44 ` Magnus Damm
2012-05-16  6:44 ` [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base " Magnus Damm
2012-05-16  6:44   ` Magnus Damm
2012-05-16  6:44   ` Magnus Damm
2012-05-16  6:56   ` Paul Mundt
2012-05-16  6:56     ` Paul Mundt
2012-05-16  6:56     ` Paul Mundt
2012-05-16  9:49     ` Magnus Damm
2012-05-16  9:49       ` Magnus Damm
2012-05-16  9:49       ` Magnus Damm
2012-05-16  6:45 ` [PATCH 02/08] ARM: Undelete KZM9D mach-type V3 Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45 ` [PATCH 03/08] mach-shmobile: KZM9D board support V3 Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45 ` [PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP " Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45 ` [PATCH 05/08] mach-shmobile: Emma Mobile EV2 GPIO " Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45 ` [PATCH 06/08] mach-shmobile: KZM9D board Ethernet " Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45 ` [PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT " Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:45   ` Magnus Damm
2012-05-16  6:46 ` [PATCH 08/08] mach-shmobile: Use DT_MACHINE for KZM9D V3 Magnus Damm
2012-05-16  6:46   ` Magnus Damm
2012-05-16  6:46   ` Magnus Damm
2012-05-18  1:44 ` [PATCH 00/08] mach-shmobile: Emma Mobile EV2 support V3 Simon Horman
2012-05-18  1:44   ` Simon Horman
2012-05-18  1:44   ` Simon Horman
2012-05-18  3:30   ` Simon Horman
2012-05-18  3:30     ` Simon Horman
2012-05-18  3:30     ` Simon Horman
2012-05-18  3:40   ` Magnus Damm
2012-05-18  3:40     ` Magnus Damm
2012-05-18  3:40     ` Magnus Damm
2012-05-18  4:46     ` Simon Horman
2012-05-18  4:46       ` Simon Horman
2012-05-18  4:46       ` Simon Horman
2012-06-11  3:55 ` Paul Mundt
2012-06-11  3:55   ` Paul Mundt
2012-06-11  3:55   ` Paul Mundt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.