mach-shmobile: Emma Mobile EV2 support V3
Subsystems (5)
Magnus Damm
maintainercover mach-shmobile: Emma Mobile EV2 support V3
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.
---
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(-)
Magnus Damm
maintainerPATCH 1/8 mach-shmobile: Emma Mobile EV2 SoC base support V3
From: Magnus Damm <[email protected]>
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.
---
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(+)
arch/arm/mach-shmobile/Kconfig +5 -0
@@ -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
arch/arm/mach-shmobile/Makefile +1 -0
@@ -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
arch/arm/mach-shmobile/clock-emev2.c new file +226 -0
226 lines not on this page · raw message
arch/arm/mach-shmobile/include/mach/emev2.h new file +9 -0
@@ -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__ */
arch/arm/mach-shmobile/setup-emev2.c new file +180 -0
180 lines not on this page · raw message
Re: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Quoted 24 lines · Magnus Damm
arch/arm/mach-shmobile/clock-emev2.c new file +24
-0+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;
arch/arm/mach-shmobile/clock-emev2.c line 157
Quoted 10 lines
arch/arm/mach-shmobile/clock-emev2.c new file +10
-0+ +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.
Magnus Damm
maintainerRe: [PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Quoted 29 lines · Paul Mundt
Quoted 28 lines · Magnus Damm
arch/arm/mach-shmobile/clock-emev2.c new file +28
-0+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;
Quoted 8 lines
arch/arm/mach-shmobile/clock-emev2.c line 52
Quoted 6 lines
+ ? ? ? ? ? ? ret |=
clk_register(clkp);
+ ? ? }arch/arm/mach-shmobile/clock-emev2.c new file +4
-0+ + ? ? return ret; +} +This all looks like a pointless abstraction. This is basically a verbatim copy of the
sh_clk_mstp32routines.
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.
Quoted 6 lines
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 thesh_clk_mstp32stuff 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
Magnus Damm
maintainerPATCH 2/8 ARM: Undelete KZM9D mach-type V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Undelete the KZM9D mach-type to allow build of board for EMEV2 SoC support.
---
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(+)
arch/arm/tools/mach-types +1 -0
@@ -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
Magnus Damm
maintainerPATCH 3/8 mach-shmobile: KZM9D board support V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
V3 of basic KZM9D board support. At this point a quite thin layer that makes use of the Emma Mobile EV2 SoC code.
---
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(+)
arch/arm/mach-shmobile/Kconfig +4 -0
@@ -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
arch/arm/mach-shmobile/Makefile +1 -0
@@ -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)
arch/arm/mach-shmobile/board-kzm9d.c new file +36 -0
@@ -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
Magnus Damm
maintainerPATCH 4/8 mach-shmobile: Emma Mobile EV2 SMP support V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
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.
---
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(+)
arch/arm/mach-shmobile/Makefile +1 -0
@@ -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 :=
arch/arm/mach-shmobile/board-kzm9d.c +1 -0
@@ -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,
arch/arm/mach-shmobile/clock-emev2.c +18 -0
@@ -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 loniowrite32 (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);
arch/arm/mach-shmobile/include/mach/emev2.h +7 -0
@@ -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__ */
arch/arm/mach-shmobile/platsmp.c +17 -0
@@ -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(unsignedif (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(uif (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 inif (is_r8a7779 ())return r8a7779_boot_secondary (cpu); +if (is_emev2 ()) +return emev2_boot_secondary (cpu); +return -ENOSYS ; }
arch/arm/mach-shmobile/setup-emev2.c +24 -0
@@ -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 ] = {
arch/arm/mach-shmobile/smp-emev2.c new file +97 -0
97 lines not on this page · raw message
Magnus Damm
maintainerPATCH 5/8 mach-shmobile: Emma Mobile EV2 GPIO support V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
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.
---
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(+)
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -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"
arch/arm/mach-shmobile/include/mach/emev2.h +3 -0
@@ -13,4 +13,7 @@ extern void emev2_secondary_init(unsigneextern 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__ */
arch/arm/mach-shmobile/setup-emev2.c +203 -0
221 lines not on this page · raw message
Magnus Damm
maintainerPATCH 6/8 mach-shmobile: KZM9D board Ethernet support V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Tie in the on-board Ethernet controller on KZM9D
and make use of the GPIO controller for external
IRQ pin support.
---
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(-)
arch/arm/mach-shmobile/board-kzm9d.c +43 -1
@@ -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
Magnus Damm
maintainerPATCH 7/8 mach-shmobile: Emma Mobile EV2 DT support V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
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.
---
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(-)
arch/arm/boot/dts/emev2.dtsi new file +63 -0
@@ -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>; + }; +};
arch/arm/mach-shmobile/clock-emev2.c +5 -0
@@ -191,10 +191,15 @@ static int __init emev2_sclkdiv_registerstatic 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 )
arch/arm/mach-shmobile/setup-emev2.c +46 -1
67 lines not on this page · raw message
Magnus Damm
maintainerPATCH 8/8 mach-shmobile: Use DT_MACHINE for KZM9D V3
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
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.
---
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(-)
arch/arm/boot/dts/emev2-kzm9d.dts new file +26 -0
@@ -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"; + }; +};
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -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"
arch/arm/mach-shmobile/board-kzm9d.c +7 -1
@@ -68,7 +68,12 @@ void __init kzm9d_add_standard_devices(vplatform_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
arch/arm/mach-shmobile/platsmp.c +2 -1
@@ -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 ) {
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
Quoted 3 lines · Magnus Damm
mach-shmobile: Emma Mobile EV2 support V3
[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Quoted 1 line
[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.
Quoted 1 line
[PATCH 03/08] mach-shmobile: KZM9D board support V3
Quoted 1 line
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
Quoted 1 line
[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
Quoted 1 line
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
Quoted 1 line
[PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
I applied this and the resulting kernel booted.
Quoted 1 line
[PATCH 08/08] mach-shmobile: Use
DT_MACHINEfor 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?
Simon Horman
Tested-byQuoted 78 lines · Simon Horman
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: Introduceserial8250_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_portop
clocksource:em_sti: Add DT support
clocksource:em_sti: Emma Mobile STI driver V2
clockevents: Makeclockevents_config()a global symbolI 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
Quoted 3 lines · Magnus Damm
mach-shmobile: Emma Mobile EV2 support V3
[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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 <[email protected]>Quoted 1 line
[PATCH 03/08] mach-shmobile: KZM9D board support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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.0Quoted 1 line
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
Tested-by Simon Horman <[email protected]>
Quoted 8 lines
Quoted 1 line
[PATCH 07/08] mach-shmobile: Emma Mobile EV2 DT support V3
I applied this and the resulting kernel booted.
Quoted 1 line
[PATCH 08/08] mach-shmobile: Use
DT_MACHINEfor KZM9D V3I 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.
Quoted 1 line
Lastly, could you consider suppling a patch which provides a defconfig?
Magnus Damm
maintainerHi Simon,
Quoted 5 lines · Simon Horman
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!
Quoted 15 lines
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: Introduceserial8250_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_portop
clocksource:em_sti: Add DT support
clocksource:em_sti: Emma Mobile STI driver V2
clockevents: Makeclockevents_config()a global symbol
Thanks, those are indeed needed for runtime UART and STI support, but there shouldn't be any build time dependencies.
Quoted 8 lines
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.
Quoted 11 lines · Magnus Damm
Quoted 3 lines
mach-shmobile: Emma Mobile EV2 support V3
[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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!
Quoted 6 lines
Reviewed-by Simon Horman <[email protected]>Quoted 1 line
[PATCH 03/08] mach-shmobile: KZM9D board support V3
Tested-by Simon Horman <[email protected]>
Quoted 8 lines
Quoted 1 line
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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.
Quoted 3 lines
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.
Quoted 7 lines
Quoted 1 line
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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!
Quoted 4 lines
Quoted 1 line
[PATCH 08/08] mach-shmobile: Use
DT_MACHINEfor KZM9D V3I 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.
Quoted 1 line
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
Hi Magnus,
Quoted 46 lines · Magnus Damm
Hi Simon,
Quoted 5 lines · Simon Horman
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!
Quoted 15 lines
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: Introduceserial8250_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_portop
clocksource:em_sti: Add DT support
clocksource:em_sti: Emma Mobile STI driver V2
clockevents: Makeclockevents_config()a global symbolThanks, those are indeed needed for runtime UART and STI support, but there shouldn't be any build time dependencies.
Quoted 8 lines
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.
Quoted 5 lines · Magnus Damm
Quoted 3 lines
mach-shmobile: Emma Mobile EV2 support V3
[PATCH 01/08] mach-shmobile: Emma Mobile EV2 SoC base support V3
Quoted 8 lines
Quoted 6 lines
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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!
:)
Quoted 10 lines
Quoted 10 lines
Reviewed-by Simon Horman <[email protected]>Quoted 1 line
[PATCH 03/08] mach-shmobile: KZM9D board support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[PATCH 04/08] mach-shmobile: Emma Mobile EV2 SMP support V3
Tested-by Simon Horman <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
[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
Quoted 5 lines
Quoted 3 lines
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
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
[PATCH 06/08] mach-shmobile: KZM9D board Ethernet support V3
Tested-by Simon Horman <[email protected]>Quoted 1 line
[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!
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
[PATCH 08/08] mach-shmobile: Use
DT_MACHINEfor KZM9D V3I 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=yand append the DTB to the zImage, then convert that to uImage.
Thanks for working me through that off-line.
Quoted 5 lines
Quoted 2 lines
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
Quoted 11 lines · 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: UseDT_MACHINEfor 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.