ARM: clps711x: Initial DT support
Subsystems (4)
cover ARM: clps711x: Initial DT support
This small series of patches adds initial DT support for Cirrus Logic ARMv4T processors.
Alexander Shiyan (3):
ARM: clps711x: Reduce static map size
ARM: clps711x: Add basic DT support
ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
arch/arm/Kconfig | 2 + arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/clps711x-cdb89712.dts | 56 +++++++ arch/arm/boot/dts/clps711x.dtsi | 201 +++++++++++++++++++++++++ arch/arm/include/debug/clps711x.S | 4 +- arch/arm/mach-clps711x/Kconfig | 7 + arch/arm/mach-clps711x/common.c | 20 ++- arch/arm/mach-clps711x/devices.c | 6 + arch/arm/mach-clps711x/devices.h | 1 + arch/arm/mach-clps711x/include/mach/hardware.h | 2 +- 10 files changed, 295 insertions(+), 6 deletions(-) create mode 100644 arch/arm/boot/dts/clps711x-cdb89712.dts create mode 100644 arch/arm/boot/dts/clps711x.dtsi
Signature · 1 line
2.4.9
PATCH 1/3 ARM: clps711x: Reduce static map size
Last CLPS711X CPU register is PLLR has 0xa5a8 address, so we can reduce the map to 48k and align the end of the static at VMALLOC_START.
--- arch/arm/include/debug/clps711x.S | 4 ++-- arch/arm/mach-clps711x/common.c | 6 +++--- arch/arm/mach-clps711x/include/mach/hardware.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/include/debug/clps711x.S +2 -2
@@ -9,10 +9,10 @@ #ifndef CONFIG_DEBUG_CLPS711X_UART2 #define CLPS711X_UART_PADDR (0x80000000 + 0x0000) -#define CLPS711X_UART_VADDR (0xfeff0000 + 0x0000) +#define CLPS711X_UART_VADDR (0xfeff4000 + 0x0000) #else #define CLPS711X_UART_PADDR (0x80000000 + 0x1000) -#define CLPS711X_UART_VADDR (0xfeff0000 + 0x1000) +#define CLPS711X_UART_VADDR (0xfeff4000 + 0x1000) #endif #define SYSFLG (0x0140)
arch/arm/mach-clps711x/common.c +3 -3
@@ -37,9 +37,9 @@ static struct map_desc clps711x_io_desc[] __initdata = { { .virtual = (unsigned long)CLPS711X_VIRT_BASE, .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE), - .length = SZ_64K, - .type = MT_DEVICE - } + .length = 48 * SZ_1K, + .type = MT_DEVICE, + }, };void __init clps711x_map_io (void )
arch/arm/mach-clps711x/include/mach/hardware.h +1 -1
@@ -24,7 +24,7 @@#include <mach/clps711x.h> -#define CLPS711X_VIRT_BASE IOMEM(0xfeff0000) +#define CLPS711X_VIRT_BASE IOMEM(0xfeff4000)#ifndef __ASSEMBLY__#define clps_readb (off) readb(CLPS711X_VIRT_BASE + (off))
Signature · 1 line
2.4.9
PATCH 2/3 ARM: clps711x: Add basic DT support
In reply to Alexander ShiyanThis patch adds basic support to run Cirrus Logic ARMv4T CPUs with device-tree support.
--- arch/arm/Kconfig | 2 ++ arch/arm/mach-clps711x/Kconfig | 7 +++++++ arch/arm/mach-clps711x/common.c | 14 ++++++++++++++ arch/arm/mach-clps711x/devices.c | 6 ++++++ arch/arm/mach-clps711x/devices.h | 1 + 5 files changed, 30 insertions(+)
arch/arm/Kconfig +2 -0
@@ -357,10 +357,12 @@ config ARCH_CLPS711X select ARCH_REQUIRE_GPIOLIB select AUTO_ZRELADDR select CLKSRC_MMIO + select CLKSRC_OF if OF select COMMON_CLK select CPU_ARM720T select GENERIC_CLOCKEVENTS select MFD_SYSCON + select OF_IRQ if OF select SOC_BUS help Support for Cirrus Logic 711x/721x/731x based boards.
arch/arm/mach-clps711x/Kconfig +7 -0
@@ -2,6 +2,13 @@ if ARCH_CLPS711X menu "CLPS711X/EP721X/EP731X Implementations" +config MACH_CLPS711X_DT + bool "Device-tree support" + select USE_OF + help + Select this if you want to experiment device-tree with + ARMv4T Cirrus Logic chips. + config ARCH_AUTCPU12 bool "AUTCPU12" help
arch/arm/mach-clps711x/common.c +14 -0
@@ -23,12 +23,14 @@#include <linux/init.h> #include <linux/sizes.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/system_misc.h> #include <mach/hardware.h> #include "common.h" +#include "devices.h" /* * This maps the generic CLPS711x registers
@@ -63,3 +65,15 @@ void clps711x_restart(enum reboot_mode mode, const char *cmd) {soft_restart (0 ); } + +static const char *clps711x_dt_compat[]__initconst = { +"cirrus,clps711x" , +NULL +}; + +DT_MACHINE_START (CLPS711X_DT ,"Cirrus Logic CLPS711X (Device Tree Support)" ) + .dt_compat = clps711x_dt_compat, + .map_io = clps711x_map_io, + .init_late = clps711x_devices_init_dt, + .restart = clps711x_restart, +MACHINE_END
arch/arm/mach-clps711x/devices.c +6 -0
@@ -147,3 +147,9 @@ void __init clps711x_devices_init(void)clps711x_add_uart ();clps711x_soc_init (); } + +void __init clps711x_devices_init_dt (void ) +{ +clps711x_add_cpuidle (); +clps711x_soc_init (); +};
arch/arm/mach-clps711x/devices.h +1 -0
@@ -10,3 +10,4 @@*/ void clps711x_devices_init (void ); +void clps711x_devices_init_dt (void );
Signature · 1 line
2.4.9
PATCH 3/3 ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
In reply to Alexander ShiyanThis adds the Cirrus Logic CLPS711X DT template and support for CDB89712 Development board.
http://www.cirrus.com/en/pubs/manual/cdb89712-2.pdf
--- arch/arm/boot/dts/Makefile | 2 + arch/arm/boot/dts/clps711x-cdb89712.dts | 56 +++++++++ arch/arm/boot/dts/clps711x.dtsi | 201 ++++++++++++++++++++++++++++++++ 3 files changed, 259 insertions(+) create mode 100644 arch/arm/boot/dts/clps711x-cdb89712.dts create mode 100644 arch/arm/boot/dts/clps711x.dtsi
arch/arm/boot/dts/Makefile +2 -0
@@ -104,6 +104,8 @@ dtb-$(CONFIG_ARCH_BERLIN) += \ berlin2q-marvell-dmp.dtb dtb-$(CONFIG_ARCH_BRCMSTB) += \ bcm7445-bcm97445svmb.dtb +dtb-$(CONFIG_ARCH_CLPS711X) += \ + clps711x-cdb89712.dtb dtb-$(CONFIG_ARCH_DAVINCI) += \ da850-enbw-cmc.dtb \ da850-evm.dtb
arch/arm/boot/dts/clps711x-cdb89712.dts new file +56 -0
56 lines not on this page · raw message
arch/arm/boot/dts/clps711x.dtsi new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.4.9
Arnd Bergmann
maintainerPATCH 3/3 ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
arch/arm/boot/dts/clps711x-cdb89712.dts line 38
Quoted 9 lines · On Friday 13 May 2016 14:26:28 Alexander Shiyan wrote:
+&bus {
arch/arm/boot/dts/clps711x-cdb89712.dts new file +8
-0+ flash: root at 00000000 { + compatible = "cfi-flash"; + reg = <0 0x00000000 0x01000000>; + bank-width = <2>; + linux,mtd-name = "physmap-flash.0"; + #address-cells = <1>; + #size-cells = <1>; + };
I've never seen the linux,mtd-name property before, but I think it's meant to refer to the name of the flash chip, not the name of the linux device.
arch/arm/boot/dts/clps711x.dtsi line 28
Quoted 12 lines
arch/arm/boot/dts/clps711x.dtsi new file +12
-0+ aliases { + gpio0 = &porta; + gpio1 = &portb; + gpio2 = &portc; + gpio3 = &portd; + gpio4 = &porte; + serial0 = &uart1; + serial1 = &uart2; + spi0 = &spi; + timer0 = &timer1; + timer1 = &timer2; + };
Please move this into the .dts file: not all boards necessarily have all of the above.
arch/arm/boot/dts/clps711x.dtsi line 45
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + interrupt-parent = <&intc>; + ranges;
All child devices seem to be in the 0x80000000-0x90000000 range, maybe set the ranges property accordingly?
arch/arm/boot/dts/clps711x.dtsi line 52
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ clks: clks at 80000000 { + #clock-cells = <1>; + compatible = "cirrus,clps711x-clk"; + reg = <0x80000000 0xc000>; + startup-frequency = <73728000>; + };
Please fix the compatible strings for all devices to not have 'x' for wildcards. Normally you'd use the name of hte first chip to have this particular IP block.
arch/arm/boot/dts/clps711x.dtsi line 59
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ intc: intc at 80000000 { + compatible = "cirrus,clps711x-intc"; + reg = <0x80000000 0x4000>; + interrupt-controller; + #interrupt-cells = <1>; + };
Better make the register ranges non-overlapping. This appears to start at the same place as the 'clks' node.
Quoted 18 lines
arch/arm/boot/dts/clps711x.dtsi new file +18
-0+ porta: gpio at 80000000 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000000 0x1 0x80000040 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portb: gpio at 80000001 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000001 0x1 0x80000041 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portc: gpio at 80000002 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000002 0x1 0x80000042 0x1>; + gpio-controller;
arch/arm/boot/dts/clps711x.dtsi line 88
Quoted 10 lines
arch/arm/boot/dts/clps711x.dtsi new file +10
-0+ #gpio-cells = <2>; + status = "disabled"; + }; + + portd: gpio at 80000003 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000003 0x1 0x80000043 0x1>; + gpio-controller; + #gpio-cells = <2>; + };
These are all just single bytes. My guess is that there is actually one IP block that contains all the gpios, not four identical blocks.
arch/arm/boot/dts/clps711x.dtsi line 107
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ bus: bus at 80000180 { + #address-cells = <2>; + #size-cells = <1>; + compatible = "cirrus,clps711x-bus", "simple-bus"; + clocks = <&clks CLPS711X_CLK_BUS>; + reg = <0x80000180 0x80>;
If it has registers, it's not a 'simple-bus'. Is this an external bus controller perhaps?
Arnd
Re: [PATCH 3/3] ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
Hello.
Quoted 3 lines
???????, 13 ??? 2016, 15:00 +03:00 ?? Arnd Bergmann <[email protected]>:
On Friday 13 May 2016 14:26:28 Alexander Shiyan wrote:
...
Quoted 9 lines
arch/arm/boot/dts/clps711x.dtsi line 45
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + interrupt-parent = <&intc>; + ranges;All child devices seem to be in the 0x80000000-0x90000000 range, maybe set the ranges property accordingly?
I do not quite understand that you want to change here.
Quoted 7 lines
Quoted 7 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ clks: clks at 80000000 { + #clock-cells = <1>; + compatible = "cirrus,clps711x-clk"; + reg = <0x80000000 0xc000>; + startup-frequency = <73728000>; + };
...
Quoted 9 lines
arch/arm/boot/dts/clps711x.dtsi line 59
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ intc: intc at 80000000 { + compatible = "cirrus,clps711x-intc"; + reg = <0x80000000 0x4000>; + interrupt-controller; + #interrupt-cells = <1>; + };Better make the register ranges non-overlapping. This appears to start at the same place as the 'clks' node.
CLK driver uses:
#define CLPS711X_SYSCON1 (0x0100)
#define CLPS711X_SYSCON2 (0x1100)
...
#define CLPS711X_PLLR (0xa5a8)
IRQCHIP driver uses:
#define CLPS711X_INTSR1 (0x0240)
...
#define CLPS711X_INTSR2 (0x1240)
...
#define CLPS711X_INTMR3 (0x2280)
So there is no way to do any else.
Quoted 24 lines
Quoted 24 lines
arch/arm/boot/dts/clps711x.dtsi new file +24
-0+ porta: gpio at 80000000 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000000 0x1 0x80000040 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portb: gpio at 80000001 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000001 0x1 0x80000041 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portc: gpio at 80000002 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000002 0x1 0x80000042 0x1>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + portd: gpio at 80000003 { + compatible = "cirrus,clps711x-gpio";
Quoted 8 lines
arch/arm/boot/dts/clps711x.dtsi line 88
Quoted 4 lines
arch/arm/boot/dts/clps711x.dtsi new file +4
-0+ reg = <0x80000003 0x1 0x80000043 0x1>; + gpio-controller; + #gpio-cells = <2>; + };These are all just single bytes. My guess is that there is actually one IP block that contains all the gpios, not four identical blocks.
These is a 8-bit registers with different properties, which parses in the GPIO driver depending of alias (GPIO count, inverted logic etc.).
Thanks.
---
Arnd Bergmann
maintainerPATCH 3/3 ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
Quoted 16 lines · On Friday 13 May 2016 15:30:23 Alexander Shiyan wrote:
Hello.
Quoted 3 lines
???????, 13 ??? 2016, 15:00 +03:00 ?? Arnd Bergmann <[email protected]>:
On Friday 13 May 2016 14:26:28 Alexander Shiyan wrote:
...
Quoted 9 lines
arch/arm/boot/dts/clps711x.dtsi line 45
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + interrupt-parent = <&intc>; + ranges;All child devices seem to be in the 0x80000000-0x90000000 range, maybe set the ranges property accordingly?
Quoted 1 line
I do not quite understand that you want to change here.
I meant using the ranges property to describe the bus addresses without the 0x80000000 offset, like
ranges = <0 0x8000000 0xc000>;
and then adapting the registers under the node to be based on the bus address.
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ clks: clks at 80000000 { + #clock-cells = <1>; + compatible = "cirrus,clps711x-clk"; + reg = <0x80000000 0xc000>; + startup-frequency = <73728000>; + };...
Quoted 9 lines
arch/arm/boot/dts/clps711x.dtsi line 59
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ intc: intc at 80000000 { + compatible = "cirrus,clps711x-intc"; + reg = <0x80000000 0x4000>; + interrupt-controller; + #interrupt-cells = <1>; + };Better make the register ranges non-overlapping. This appears to start at the same place as the 'clks' node.
CLK driver uses:
#defineCLPS711X_SYSCON1(0x0100)
#defineCLPS711X_SYSCON2(0x1100)
...
#defineCLPS711X_PLLR(0xa5a8)
Quoted 8 lines
IRQCHIP driver uses:
#defineCLPS711X_INTSR1(0x0240)
...
#defineCLPS711X_INTSR2(0x1240)
...
#defineCLPS711X_INTMR3(0x2280)So there is no way to do any else.
It sounds like what you have is a large system controller that has registers everywhere. Could you use syscon to access the individual registers instead?
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
arch/arm/boot/dts/clps711x.dtsi new file +24
-0+ porta: gpio at 80000000 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000000 0x1 0x80000040 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portb: gpio at 80000001 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000001 0x1 0x80000041 0x1>; + gpio-controller; + #gpio-cells = <2>; + }; + + portc: gpio at 80000002 { + compatible = "cirrus,clps711x-gpio"; + reg = <0x80000002 0x1 0x80000042 0x1>; + gpio-controller; + #gpio-cells = <2>; + status = "disabled"; + }; + + portd: gpio at 80000003 { + compatible = "cirrus,clps711x-gpio";Quoted 8 lines
arch/arm/boot/dts/clps711x.dtsi line 88
Quoted 4 lines
arch/arm/boot/dts/clps711x.dtsi new file +4
-0+ reg = <0x80000003 0x1 0x80000043 0x1>; + gpio-controller; + #gpio-cells = <2>; + };These are all just single bytes. My guess is that there is actually one IP block that contains all the gpios, not four identical blocks.
Quoted 2 lines
These is a 8-bit registers with different properties, which parses in the GPIO driver depending of alias (GPIO count, inverted logic etc.).
The alias should not influence the interpretation of the registers. If each byte in there behaves differently, it would be better to have separate "compatible" strings instead. I still don't see why you can't just have one device node for all the registers and then create multiple gpio_chip instances from that though.
Arnd
PATCH 3/3 ARM: dts: clps711x: Add basic Cirrus Logic CDB89712 Development board
Quoted 7 lines · On Fri, 13 May 2016 15:41:11 +0200 Arnd Bergmann <[email protected]> wrote:
Quoted 6 lines · On Friday 13 May 2016 15:30:23 Alexander Shiyan wrote:
Hello.
Quoted 3 lines
???????, 13 ??? 2016, 15:00 +03:00 ?? Arnd Bergmann <[email protected]>:
On Friday 13 May 2016 14:26:28 Alexander Shiyan wrote:
...
...
Quoted 30 lines
Quoted 30 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ clks: clks at 80000000 { + #clock-cells = <1>; + compatible = "cirrus,clps711x-clk"; + reg = <0x80000000 0xc000>; + startup-frequency = <73728000>; + };...
Quoted 9 lines
arch/arm/boot/dts/clps711x.dtsi line 59
Quoted 6 lines
arch/arm/boot/dts/clps711x.dtsi new file +6
-0+ intc: intc at 80000000 { + compatible = "cirrus,clps711x-intc"; + reg = <0x80000000 0x4000>; + interrupt-controller; + #interrupt-cells = <1>; + };Better make the register ranges non-overlapping. This appears to start at the same place as the 'clks' node.
CLK driver uses:
#defineCLPS711X_SYSCON1(0x0100)
#defineCLPS711X_SYSCON2(0x1100)
...
#defineCLPS711X_PLLR(0xa5a8)IRQCHIP driver uses:
#defineCLPS711X_INTSR1(0x0240)
...
#defineCLPS711X_INTSR2(0x1240)
...
#defineCLPS711X_INTMR3(0x2280)
Quoted 5 lines
Quoted 1 line
So there is no way to do any else.
It sounds like what you have is a large system controller that has registers everywhere. Could you use syscon to access the individual registers instead?
There are several problems:
- The syscon driver must be initialized before any other devices, including the interrupt controller and clk/clocksource subsystems.
- A slight performance impact will be observed in the interrupt handler.
- SYSCON (regmap) is designed to use with equal the width of registers, while we need to use different widths (8/16/32) for some subsystems.
Signature · 1 line
Alexander Shiyan <[email protected]>