ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
Subsystems (4)
PATCH 1/1 ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
--- arch/arm/Kconfig | 15 +- arch/arm/Kconfig.debug | 16 ++ arch/arm/Makefile | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/armv7-m.dtsi | 18 ++ arch/arm/boot/dts/efm32gg-dk3750.dts | 63 ++++++ arch/arm/boot/dts/efm32gg.dtsi | 141 +++++++++++++ arch/arm/configs/efm32_defconfig | 104 ++++++++++ arch/arm/mach-efm32/Makefile | 1 + arch/arm/mach-efm32/Makefile.boot | 2 + arch/arm/mach-efm32/cmu.h | 15 ++ arch/arm/mach-efm32/common.h | 1 + arch/arm/mach-efm32/dtmachine.c | 31 +++ arch/arm/mach-efm32/include/mach/debug-macro.S | 48 +++++ arch/arm/mach-efm32/include/mach/entry-macro.S | 5 + arch/arm/mach-efm32/include/mach/io.h | 6 + arch/arm/mach-efm32/include/mach/irqs.h | 6 + arch/arm/mach-efm32/include/mach/timex.h | 7 + arch/arm/mach-efm32/time.c | 261 +++++++++++++++++++++++++ 19 files changed, 741 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/armv7-m.dtsi create mode 100644 arch/arm/boot/dts/efm32gg-dk3750.dts create mode 100644 arch/arm/boot/dts/efm32gg.dtsi create mode 100644 arch/arm/configs/efm32_defconfig create mode 100644 arch/arm/mach-efm32/Makefile create mode 100644 arch/arm/mach-efm32/Makefile.boot create mode 100644 arch/arm/mach-efm32/cmu.h create mode 100644 arch/arm/mach-efm32/common.h create mode 100644 arch/arm/mach-efm32/dtmachine.c create mode 100644 arch/arm/mach-efm32/include/mach/debug-macro.S create mode 100644 arch/arm/mach-efm32/include/mach/entry-macro.S create mode 100644 arch/arm/mach-efm32/include/mach/io.h create mode 100644 arch/arm/mach-efm32/include/mach/irqs.h create mode 100644 arch/arm/mach-efm32/include/mach/timex.h create mode 100644 arch/arm/mach-efm32/time.c
arch/arm/Kconfig +14 -1
@@ -404,6 +404,19 @@ config ARCH_EBSA110 Ethernet interface, two PCMCIA sockets, two serial ports and a parallel port. +config ARCH_EFM32 + bool "Energy Micro Cortex M3 Platform" + depends on !MMU + select ARM_NVIC + select CLKSRC_MMIO + select COMMON_CLK + select CPU_V7M + select GENERIC_CLOCKEVENTS + select HAVE_CLK + select NO_DMA + select NO_IOPORT + select USE_OF + config ARCH_EP93XX bool "EP93xx-based" select ARCH_HAS_HOLES_MEMORYMODEL
@@ -1762,7 +1775,7 @@ config FORCE_MAX_ZONEORDER int "Maximum zone order" if ARCH_SHMOBILE range 11 64 if ARCH_SHMOBILE default "12" if SOC_AM33XX - default "9" if SA1111 + default "9" if SA1111 || ARCH_EFM32 default "11" help The kernel memory allocator divides physically contiguous memory
arch/arm/Kconfig.debug +16 -0
@@ -167,6 +167,22 @@ choice Say Y here if you want the debug print routines to direct their output to the serial port in the DC21285 (Footbridge). + config DEBUG_EFM32_UART1 + bool "Kernel low-level debugging messages via UART1 (ttyefm4)" + depends on ARCH_EFM32 + help + Say Y here if you want the debug print routines to direct + their output to the second UART port on efm32 based + machines. + + config DEBUG_EFM32_USART1 + bool "Kernel low-level debugging messages via USART1 (ttyefm1)" + depends on ARCH_EFM32 + help + Say Y here if you want the debug print routines to direct + their output to the second USART port on efm32 based + machines. + config DEBUG_FOOTBRIDGE_COM1 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1" depends on FOOTBRIDGE
arch/arm/Makefile +1 -0
@@ -152,6 +152,7 @@ machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx machine-$(CONFIG_ARCH_DAVINCI) += davinci machine-$(CONFIG_ARCH_DOVE) += dove machine-$(CONFIG_ARCH_EBSA110) += ebsa110 +machine-$(CONFIG_ARCH_EFM32) += efm32 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += gemini
arch/arm/boot/dts/Makefile +1 -0
@@ -48,6 +48,7 @@ dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ dove-cubox.dtb \ dove-dove-db.dtb +dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ exynos4210-smdkv310.dtb \ exynos4210-trats.dtb \
arch/arm/boot/dts/armv7-m.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +#include "skeleton.dtsi" + +/ { + nvic: nv-interrupt-controller at 0xe0000000 { + compatible = "arm,armv7m-nvic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0xe000e100 0xc00>; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + interrupt-parent = <&nvic>; + ranges; + }; +};
arch/arm/boot/dts/efm32gg-dk3750.dts new file +63 -0
63 lines not on this page · raw message
arch/arm/boot/dts/efm32gg.dtsi new file +141 -0
141 lines not on this page · raw message
arch/arm/configs/efm32_defconfig new file +104 -0
104 lines not on this page · raw message
arch/arm/mach-efm32/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += dtmachine.o time.o
arch/arm/mach-efm32/Makefile.boot new file +2 -0
@@ -0,0 +1,2 @@ +# This file is still needed because we cannot select ARCH_MULTIPLATFORM (as it +# depends on MMU) and then this file is sourced in arch/arm/boot/Makefile
arch/arm/mach-efm32/cmu.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Register definition for efm32's CMU component +*/ + +#define CMU_OSCENCMD 0x20 +#define CMU_OSCENCMD_HFXOEN 0x00000004 + +#define CMU_CMD 0x24 +#define CMU_CMD_HFCLKSEL_HFXO 0x00000002 + +#define CMU_STATUS 0x2c +#define CMU_STATUS_HFRCOSEL 0x00000400 +#define CMU_STATUS_HFXOSEL 0x00000800 + +#define CMU_HFPERCLKEN0 0x44
arch/arm/mach-efm32/common.h new file +1 -0
@@ -0,0 +1 @@ +void efm32_timer_init (void );
arch/arm/mach-efm32/dtmachine.c new file +31 -0
@@ -0,0 +1,31 @@ +#include <linux/kernel.h> +#include <linux/pinctrl/machine.h> +#include <linux/irqdomain.h> +#include <linux/of_platform.h> +#include <linux/of_irq.h> +#include <linux/irqchip.h> + +#include <asm/v7m.h> + +#include <asm/mach/arch.h> +#include <asm/mach/time.h> + +#include "common.h" + +static void __init efm32_init (void ) +{ +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *const efm32gg_compat[]__initconst = { +"efm32,dk3750" , +NULL +}; + +DT_MACHINE_START (EFM32DT ,"EFM32 (Device Tree Support)" ) + .init_irq = irqchip_init, + .init_time = efm32_timer_init, + .init_machine = efm32_init, + .dt_compat = efm32gg_compat, + .restart = armv7m_restart, +MACHINE_END
arch/arm/mach-efm32/include/mach/debug-macro.S new file +48 -0
48 lines not on this page · raw message
arch/arm/mach-efm32/include/mach/entry-macro.S new file +5 -0
@@ -0,0 +1,5 @@ + .macro get_irqnr_preamble, base, tmp + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm
arch/arm/mach-efm32/include/mach/io.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __MACH_IO_H__ +#define __MACH_IO_H__ + +#define __mem_pci (a) (a) + +#endif /* __MACH_IO_H__ */
arch/arm/mach-efm32/include/mach/irqs.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __MACH_IRQS_H__ +#define __MACH_IRQS_H__ + +#define NR_IRQS 82 + +#endif /* __MACH_IRQS_H__ */
arch/arm/mach-efm32/include/mach/timex.h new file +7 -0
@@ -0,0 +1,7 @@ +#ifndef __MACH_TIMEX_H__ +#define __MACH_TIMEX_H__ + +/* just a bogus value */ +#define CLOCK_TICK_RATE 12345678 + +#endif /* __MACH_TIMEX_H__ */
arch/arm/mach-efm32/time.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.8.4.rc0
PATCH 1/1 ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
Hello,
I forgot to mention that this patch depends on the following patches:
- ARM: ARMv7-M: implement restart routine common to all v7-M machines
sent with Message-Id: 1376494305-24270-1-git-send-email-u.kleine-koenig at pengutronix.de; and
- clk: new driver for efm32 SoC
sent with Message-Id: 1376510693-12491-1-git-send-email-u.kleine-koenig at pengutronix.de
So in the unlikely case you are already happy with this patch, it needs some coordination to go in.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
Hi,
Sorry for the delay in responding to this. See below.
Quoted 6 lines · Uwe Kleine-K?nig
Hello,
I forgot to mention that this patch depends on the following patches:
- ARM: ARMv7-M: implement restart routine common to all v7-M machines
sent with Message-Id: 1376494305-24270-1-git-send-email-u.kleine-koenig at pengutronix.de; and
Seems like you addressed Russell's comments here, so hopefully he's ok with us picking it up directly as a prereq.
Quoted 2 lines
- clk: new driver for efm32 SoC
sent with Message-Id: 1376510693-12491-1-git-send-email-u.kleine-koenig at pengutronix.de
This can be applied directly by Mike, since the code doesn't depend on each other (just won't be fully functional until both lands).
Quoted 2 lines
So in the unlikely case you are already happy with this patch, it needs some coordination to go in.
I'll have a few comments, should hopefully be quick to respin.
-Olof
PATCH 1/1 ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
I already told Olof via irc, but for the protocol:
Quoted 10 lines · Olof Johansson
Quoted 6 lines · Uwe Kleine-K?nig
Hello,
I forgot to mention that this patch depends on the following patches:
- ARM: ARMv7-M: implement restart routine common to all v7-M machines
sent with Message-Id: 1376494305-24270-1-git-send-email-u.kleine-koenig at pengutronix.de; andSeems like you addressed Russell's comments here, so hopefully he's ok with us picking it up directly as a prereq.
It was Jonathan Austin who commented, but anyhow as I don't think to get all three patches ready in time for 3.12-rc1 I posted that one to Russell's patch tracker.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 1/1 ARM: new platform for Energy Micro's EFM32 Cortex-M3 SoCs
In reply to Uwe Kleine-KönigHi,
Quoted 88 lines · Uwe Kleine-K?nig
Signed-off-by Uwe Kleine-K?nig <[email protected]>--- arch/arm/Kconfig | 15 +- arch/arm/Kconfig.debug | 16 ++ arch/arm/Makefile | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/armv7-m.dtsi | 18 ++ arch/arm/boot/dts/efm32gg-dk3750.dts | 63 ++++++ arch/arm/boot/dts/efm32gg.dtsi | 141 +++++++++++++ arch/arm/configs/efm32_defconfig | 104 ++++++++++ arch/arm/mach-efm32/Makefile | 1 + arch/arm/mach-efm32/Makefile.boot | 2 + arch/arm/mach-efm32/cmu.h | 15 ++ arch/arm/mach-efm32/common.h | 1 + arch/arm/mach-efm32/dtmachine.c | 31 +++ arch/arm/mach-efm32/include/mach/debug-macro.S | 48 +++++ arch/arm/mach-efm32/include/mach/entry-macro.S | 5 + arch/arm/mach-efm32/include/mach/io.h | 6 + arch/arm/mach-efm32/include/mach/irqs.h | 6 + arch/arm/mach-efm32/include/mach/timex.h | 7 + arch/arm/mach-efm32/time.c | 261 +++++++++++++++++++++++++ 19 files changed, 741 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/armv7-m.dtsi create mode 100644 arch/arm/boot/dts/efm32gg-dk3750.dts create mode 100644 arch/arm/boot/dts/efm32gg.dtsi create mode 100644 arch/arm/configs/efm32_defconfig create mode 100644 arch/arm/mach-efm32/Makefile create mode 100644 arch/arm/mach-efm32/Makefile.boot create mode 100644 arch/arm/mach-efm32/cmu.h create mode 100644 arch/arm/mach-efm32/common.h create mode 100644 arch/arm/mach-efm32/dtmachine.c create mode 100644 arch/arm/mach-efm32/include/mach/debug-macro.S create mode 100644 arch/arm/mach-efm32/include/mach/entry-macro.S create mode 100644 arch/arm/mach-efm32/include/mach/io.h create mode 100644 arch/arm/mach-efm32/include/mach/irqs.h create mode 100644 arch/arm/mach-efm32/include/mach/timex.h create mode 100644 arch/arm/mach-efm32/time.carch/arm/Kconfig +14
-1@@ -404,6 +404,19 @@ config ARCH_EBSA110 Ethernet interface, two PCMCIA sockets, two serial ports and a parallel port. +config ARCH_EFM32 + bool "Energy Micro Cortex M3 Platform" + depends on !MMU + select ARM_NVIC + select CLKSRC_MMIO + select COMMON_CLK + select CPU_V7M + select GENERIC_CLOCKEVENTS + select HAVE_CLK + select NO_DMA + select NO_IOPORT + select USE_OF + config ARCH_EP93XX bool "EP93xx-based" select ARCH_HAS_HOLES_MEMORYMODEL@@ -1762,7 +1775,7 @@ config FORCE_MAX_ZONEORDER int "Maximum zone order" if ARCH_SHMOBILE range 11 64 if ARCH_SHMOBILE default "12" if SOC_AM33XX - default "9" if SA1111 + default "9" if SA1111 || ARCH_EFM32 default "11" help The kernel memory allocator divides physically contiguous memoryarch/arm/Kconfig.debug +9
-0@@ -167,6 +167,22 @@ choice Say Y here if you want the debug print routines to direct their output to the serial port in the DC21285 (Footbridge). + config DEBUG_EFM32_UART1 + bool "Kernel low-level debugging messages via UART1 (ttyefm4)" + depends on ARCH_EFM32 + help + Say Y here if you want the debug print routines to direct + their output to the second UART port on efm32 based + machines. + + config DEBUG_EFM32_USART1
arch/arm/Kconfig.debug choice · line 188
Quoted 10 lines
arch/arm/Kconfig.debug +7
-0+ bool "Kernel low-level debugging messages via USART1 (ttyefm1)" + depends on ARCH_EFM32 + help + Say Y here if you want the debug print routines to direct + their output to the second USART port on efm32 based + machines. + config DEBUG_FOOTBRIDGE_COM1 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1" depends on FOOTBRIDGE
Make sure this doesn't conflict with the rework that Russell has done for Kconfig.debug in his for-3.12 branch. It might be better to either merge a separate patch for it through him, or just hold off one release with it.
Quoted 30 lines
arch/arm/Makefile +1
-0@@ -152,6 +152,7 @@ machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx machine-$(CONFIG_ARCH_DAVINCI) += davinci machine-$(CONFIG_ARCH_DOVE) += dove machine-$(CONFIG_ARCH_EBSA110) += ebsa110 +machine-$(CONFIG_ARCH_EFM32) += efm32 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += geminiarch/arm/boot/dts/Makefile +1
-0@@ -48,6 +48,7 @@ dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ dove-cubox.dtb \ dove-dove-db.dtb +dtb-$(CONFIG_ARCH_EFM32) += efm32gg-dk3750.dtb dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ exynos4210-smdkv310.dtb \ exynos4210-trats.dtb \arch/arm/boot/dts/armv7-m.dtsi new file +0
-0
arch/arm/boot/dts/armv7-m.dtsi line 4
Quoted 4 lines
arch/arm/boot/dts/armv7-m.dtsi new file +4
-0@@ -0,0 +1,18 @@ +#include "skeleton.dtsi" + +/ { + nvic: nv-interrupt-controller at 0xe0000000 {
No 0x in unit specifiers here and elsewhere.
arch/arm/boot/dts/armv7-m.dtsi line 8
Quoted 4 lines
arch/arm/boot/dts/armv7-m.dtsi new file +4
-0+ compatible = "arm,armv7m-nvic"; + interrupt-controller; + #interrupt-cells = <1>; + reg = <0xe000e100 0xc00>;
If reg is 0xe000e100, then so should the unit specifier. Or it shouldn't be there at all (i.e. it's not needed unless there are multiple nodes with the same name).
Quoted 113 lines
arch/arm/boot/dts/efm32gg-dk3750.dts new file +63
-0@@ -0,0 +1,63 @@ +/dts-v1/; +#include "efm32gg.dtsi" + +/ { + model = "Energy Micro Giant Gecko Development Kit"; + compatible = "efm32,dk3750"; + + chosen { + bootargs = "console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0"; + }; + + memory { + reg = <0x88000000 0x400000>; + }; + + soc { + adc at 0x40002000 { + status = "ok"; + }; + + spi0: spi at 0x4000c000 { /* USART0 */ + cs-gpios = <&gpio 68 1>; // E4 + location = <1>; + status = "ok"; + + microsd at 0 { + compatible = "mmc-spi-slot"; + spi-max-frequency = <100000>; + voltage-ranges = <3200 3400>; + broken-cd; + reg = <0>; + }; + }; + + spi1: spi at 0x4000c400 { /* USART1 */ + cs-gpios = <&gpio 51 1>; // D3 + location = <1>; + status = "ok"; + + ks8851 at 0 { + compatible = "ks8851"; + spi-max-frequency = <6000000>; + reg = <0>; + interrupt-parent = <&boardfpga>; + interrupts = <4>; + }; + }; + + uart4: uart at 0x4000e400 { /* UART1 */ + location = <2>; + status = "ok"; + }; + + boardfpga: boardfpga at 0x80000000 { + compatible = "efm32board"; + reg = <0x80000000 0x400>; + irq-gpios = <&gpio 64 1>; + interrupt-controller; + #interrupt-cells = <1>; + status = "ok"; + }; + }; +};arch/arm/mach-efm32/include/mach/debug-macro.S new file +38
-0@@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#define UARTn_CMD 0x000c +#define UARTn_CMD_TXEN 0x0004 + +#define UARTn_STATUS 0x0010 +#define UARTn_STATUS_TXC 0x0020 +#define UARTn_STATUS_TXBL 0x0040 + +#define UARTn_TXDATA 0x0034 + + .macro addruart, rx, tmp +#if defined(CONFIG_DEBUG_EFM32_USART1) + ldr \rx, =(0x4000c400) /* USART1 */ +#elif defined(CONFIG_DEBUG_EFM32_UART1) + ldr \rx, =(0x4000e400) /* UART1 */ +#else +#error "No debug port configured" +#endif + /* + * enable TX. The driver might disable that to save energy. We + * don't care about disabling at the end as during debug power + * consumption isn't that important. + */ + ldr \tmp, =(UARTn_CMD_TXEN) + str \tmp, [\rx, #UARTn_CMD] + .endm + + + .macro senduart,rd,rx + strb \rd, [\rx, #UARTn_TXDATA] + .endm + + .macro waituart,rd,rx
arch/arm/mach-efm32/include/mach/debug-macro.S line 48
Quoted 10 lines
arch/arm/mach-efm32/include/mach/debug-macro.S new file +10
-0+1001: ldr \rd, [\rx, #UARTn_STATUS] + tst \rd, #UARTn_STATUS_TXBL + beq 1001b + .endm + + .macro busyuart,rd,rx +1001: ldr \rd, [\rx, UARTn_STATUS] + tst \rd, #UARTn_STATUS_TXC + bne 1001b + .endm
Same with this w.r.t. coordinating with Russell's cleanups.
arch/arm/mach-efm32/time.c
Quoted 5 lines
arch/arm/mach-efm32/time.c new file +0
-0
Shouldn't this be a drivers/clocksource driver instead?
-Olof