mach-shmobile: Emma Mobile EV2 support V2
Subsystems (5)
Magnus Damm
maintainercover mach-shmobile: Emma Mobile EV2 support V2
mach-shmobile: Emma Mobile EV2 support V2
[PATCH 01/06] mach-shmobile: Emma Mobile EV2 SoC base support V2 [PATCH 02/06] mach-shmobile: KZM9D board support V2 [PATCH 03/06] mach-shmobile: Emma Mobile EV2 SMP support V2 [PATCH 04/06] mach-shmobile: Emma Mobile EV2 GPIO support V2 [PATCH 05/06] mach-shmobile: KZM9D board Ethernet support V2 [PATCH 06/06] mach-shmobile: Emma Mobile EV2 DT support V2
This series are the second 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. SMP is also missing from DT. 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 20120511 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
Also, the KZM9D mach-type entry seems gone in linux-next, so I suppose we need to deal with that as well somehow.
---
Applies to linux-next 20120511
arch/arm/boot/dts/emev2-kzm9d.dts | 66 +++ arch/arm/mach-shmobile/Kconfig | 10 arch/arm/mach-shmobile/Makefile | 3 arch/arm/mach-shmobile/board-kzm9d.c | 81 ++++ arch/arm/mach-shmobile/clock-emev2.c | 249 ++++++++++++++ arch/arm/mach-shmobile/include/mach/emev2.h | 19 + arch/arm/mach-shmobile/platsmp.c | 17 + arch/arm/mach-shmobile/setup-emev2.c | 454 ++++++++++++++++++++++++++- arch/arm/mach-shmobile/smp-emev2.c | 97 +++++ 9 files changed, 994 insertions(+), 2 deletions(-)
Magnus Damm
maintainerPATCH 1/6 mach-shmobile: Emma Mobile EV2 SoC base support V2
From: Magnus Damm <[email protected]>
This is V2 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 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
Magnus Damm
maintainerPATCH 2/6 mach-shmobile: KZM9D board support V2
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
V2 of basic KZM9D board support. At this point a quite thin layer that makes use of the Emma Mobile EV2 SoC code.
---
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 3/6 mach-shmobile: Emma Mobile EV2 SMP support V2
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
This is V2 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 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 4/6 mach-shmobile: Emma Mobile EV2 GPIO support V2
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 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 5/6 mach-shmobile: KZM9D board Ethernet support V2
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 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 6/6 mach-shmobile: Emma Mobile EV2 DT support V2
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
This is EMEV2 DT support V2. 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 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-kzm9d.dts | 66 ++++++++++++++++++++++++++++++++++ arch/arm/mach-shmobile/clock-emev2.c | 5 ++ arch/arm/mach-shmobile/setup-emev2.c | 47 +++++++++++++++++++++++- 3 files changed, 117 insertions(+), 1 deletion(-)
arch/arm/boot/dts/emev2-kzm9d.dts new file +66 -0
@@ -0,0 +1,66 @@ +/dts-v1/; + +/ { + model = "EMEV2 KZM9D Board"; + compatible = "renesas,emev2"; + #address-cells = <1>; + #size-cells = <1>; + + 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>; + }; + + chosen { + bootargs = "console=ttyS1,115200n81"; + }; + + memory { + device_type = "memory"; + reg = <0x40000000 0x8000000>; /* 128 MB */ + }; + + 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