ARM RealView DeviceTree support v4
Subsystems (10)
cover ARM RealView DeviceTree support v4
As it says, now that v3.16 has settled and my infrastructure is in place, I've updated the RealView DeviceTree patch. Starting to look good: we can now push almost everything down into different driver subsystems, have a look.
Linus Walleij (6):
leds: add a driver for syscon-based LEDs
leds: add device tree bindings for syscon LEDs
power: reset: driver for the Versatile syscon reboot
power: reset: DT bindings for the Versatile reset driver
soc: add driver for the ARM RealView
ARM: realview: basic device tree implementation
Documentation/devicetree/bindings/arm/arm-boards | 66 ++++++ Documentation/devicetree/bindings/arm/gic.txt | 1 + .../devicetree/bindings/leds/leds-syscon.txt | 83 +++++++ .../bindings/reset/arm-versatile-reboot.txt | 18 ++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 240 +++++++++++++++++++++ arch/arm/mach-realview/Kconfig | 13 ++ arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/realview-dt.c | 72 +++++++ drivers/irqchip/irq-gic.c | 1 + drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-syscon.c | 152 +++++++++++++ drivers/power/reset/Kconfig | 9 + drivers/power/reset/Makefile | 1 + drivers/power/reset/arm-versatile-reboot.c | 121 +++++++++++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/versatile/Kconfig | 10 + drivers/soc/versatile/Makefile | 1 + drivers/soc/versatile/soc-realview.c | 144 +++++++++++++ 21 files changed, 947 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-syscon.txt create mode 100644 Documentation/devicetree/bindings/reset/arm-versatile-reboot.txt create mode 100644 arch/arm/boot/dts/arm-realview-pb1176.dts create mode 100644 arch/arm/mach-realview/realview-dt.c create mode 100644 drivers/leds/leds-syscon.c create mode 100644 drivers/power/reset/arm-versatile-reboot.c create mode 100644 drivers/soc/versatile/Kconfig create mode 100644 drivers/soc/versatile/Makefile create mode 100644 drivers/soc/versatile/soc-realview.c
Signature · 1 line
1.9.3
PATCH 1/6 leds: add a driver for syscon-based LEDs
This makes it possible to create a set of LEDs from a syscon MFD instance, which is lean mean and clean on the ARM reference designs and can replace the Versatile LEDs driver in the long run, as well as other custom syscon LEDs drivers.
--- drivers/leds/Kconfig | 10 +++ drivers/leds/Makefile | 1 + drivers/leds/leds-syscon.c | 152 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+) create mode 100644 drivers/leds/leds-syscon.c
drivers/leds/Kconfig +10 -0
@@ -479,6 +479,16 @@ config LEDS_BLINKM This option enables support for the BlinkM RGB LED connected through I2C. Say Y to enable support for the BlinkM LED. +config LEDS_SYSCON + bool "LED support for LEDs on system controllers" + depends on LEDS_CLASS + depends on MFD_SYSCON + depends on OF + help + This option enabled support for the LEDs on syscon type + devices. This will only work with device tree enabled + devices. + config LEDS_VERSATILE tristate "LED support for the ARM Versatile and RealView" depends on ARCH_REALVIEW || ARCH_VERSATILE
drivers/leds/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o +obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o obj-$(CONFIG_LEDS_VERSATILE) += leds-versatile.o # LED SPI Drivers
drivers/leds/leds-syscon.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 1/6 leds: add a driver for syscon-based LEDs
Quoted 8 lines · Linus Walleij
This makes it possible to create a set of LEDs from a syscon MFD instance, which is lean mean and clean on the ARM reference designs and can replace the Versatile LEDs driver in the long run, as well as other custom syscon LEDs drivers.
Cc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>Signed-off-by Linus Walleij <[email protected]>
Bryan can you have a look at this driver? It can be merged stand-alone through the LEDs tree for v3.18 once you're happy with it.
Yours,
Linus Walleij
PATCH 2/6 leds: add device tree bindings for syscon LEDs
In reply to Linus WalleijThis adds the device tree bindings used by syscon-based LEDs.
--- .../devicetree/bindings/leds/leds-syscon.txt | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-syscon.txt
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +83 -0
@@ -0,0 +1,83 @@ +Device Tree Bindings for Syscon LEDs + +Required properties: +- compatible : must be "syscon-leds". +- regmap : a phandle to a syscon node containing a regmap + +Each LED is represented as a sub-node of the syscon-leds device. Each +node's name represents the name of the corresponding LED. + +LED sub-node properties: +- offset : register offset to the register controlling this LED +- mask : bit mask for the bit controlling this LED in the register + typically 0x01, 0x02, 0x04 ... +- label : (optional) + see Documentation/devicetree/bindings/leds/common.txt +- linux,default-trigger : (optional) + see Documentation/devicetree/bindings/leds/common.txt +- default-state: (optional) The initial state of the LED. Valid + values are "on", "off", and "keep". If the LED is already on or off + and the default-state property is set the to same value, then no + glitch should be produced where the LED momentarily turns off (or + on). The "keep" setting will keep the LED at whatever its current + state is, without producing a glitch. The default is off if this + property is not present. + +Example: + +leds: leds at 08 { + compatible = "syscon-leds"; + regmap = <&syscon>; + + led at bit0 { + offset = <0x08>; + mask = <0x01>; + label = "versatile:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + led at bit1 { + offset = <0x08>; + mask = <0x02>; + label = "versatile:1"; + linux,default-trigger = "mmc0"; + default-state = "off"; + }; + led at bit2 { + offset = <0x08>; + mask = <0x04>; + label = "versatile:2"; + linux,default-trigger = "cpu0"; + default-state = "off"; + }; + led at bit3 { + offset = <0x08>; + mask = <0x08>; + label = "versatile:3"; + default-state = "off"; + }; + led at bit4 { + offset = <0x08>; + mask = <0x10>; + label = "versatile:4"; + default-state = "off"; + }; + led at bit5 { + offset = <0x08>; + mask = <0x20>; + label = "versatile:5"; + default-state = "off"; + }; + led at bit6 { + offset = <0x08>; + mask = <0x40>; + label = "versatile:6"; + default-state = "off"; + }; + led at bit7 { + offset = <0x08>; + mask = <0x80>; + label = "versatile:7"; + default-state = "off"; + }; +};
Signature · 1 line
1.9.3
Rob Herring
maintainerPATCH 2/6 leds: add device tree bindings for syscon LEDs
Quoted 17 lines · Linus Walleij
This adds the device tree bindings used by syscon-based LEDs.
Cc devicetree at vger.kernel.orgCc Bryan Wu <[email protected]>Cc Richard Purdie <[email protected]>Signed-off-by Linus Walleij <[email protected]>--- .../devicetree/bindings/leds/leds-syscon.txt | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-syscon.txtDocumentation/devicetree/bindings/leds/leds-syscon.txt new file +0
-0
Documentation/devicetree/bindings/leds/leds-syscon.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +4
-0@@ -0,0 +1,83 @@ +Device Tree Bindings for Syscon LEDs + +Required properties: +- compatible : must be "syscon-leds".
Not really happy with the name... More below.
Documentation/devicetree/bindings/leds/leds-syscon.txt line 13
Quoted 9 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +9
-0+- regmap : a phandle to a syscon node containing a regmap + +Each LED is represented as a sub-node of the syscon-leds device. Each +node's name represents the name of the corresponding LED. + +LED sub-node properties: +- offset : register offset to the register controlling this LED +- mask : bit mask for the bit controlling this LED in the register + typically 0x01, 0x02, 0x04 ...
This would be a single bit, right? What about inverted bits (i.e. 0 is on or 1 is on)?
Documentation/devicetree/bindings/leds/leds-syscon.txt line 14
Quoted 1 line
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +1
-0+- label : (optional)
Please group all required and optional properties under those headings.
Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +8
-0+ see Documentation/devicetree/bindings/leds/common.txt +- linux,default-trigger : (optional) + see Documentation/devicetree/bindings/leds/common.txt +- default-state: (optional) The initial state of the LED. Valid + values are "on", "off", and "keep". If the LED is already on or off + and the default-state property is set the to same value, then no + glitch should be produced where the LED momentarily turns off (or + on). The "keep" setting will keep the LED at whatever its current
Documentation/devicetree/bindings/leds/leds-syscon.txt line 32
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +10
-0+ state is, without producing a glitch. The default is off if this + property is not present. + +Example: + +leds: leds at 08 { + compatible = "syscon-leds"; + regmap = <&syscon>; + + led at bit0 {
Perhaps we can define a way to express unit address as offset+bit like <offset>_<bit> or <offset>.<bit>.
I think we should get rid of the leds node and put this within the syscon device node and each node here should have a compatible property. I think the compatible should be something like "register-bit-led" (perhaps someone has a better name) as syscon is somewhat linux specific term and you could use this binding for any LEDs that have a single register bit control.
Rob
Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +6
-0+ offset = <0x08>; + mask = <0x01>; + label = "versatile:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + };
PATCH 2/6 leds: add device tree bindings for syscon LEDs
Quoted 2 lines · Rob Herring
Quoted 1 line · Linus Walleij
This adds the device tree bindings used by syscon-based LEDs.
(...)
Quoted 6 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +4
-0+Device Tree Bindings for Syscon LEDs + +Required properties: +- compatible : must be "syscon-leds".Not really happy with the name... More below.
[copy paste]
Quoted 4 lines
I think the compatible should be something like "register-bit-led" (perhaps someone has a better name) as syscon is somewhat linux specific term and you could use this binding for any LEDs that have a single register bit control.
Hm... this driver:drivers/gpio/gpio-syscon.c
Has some bindings specific to a certain controller here:Documentation/devicetree/bindings/gpio/cirrus,clps711x-mctrl-gpio.txt
Maybe I should think of something generic for that one along the same lines then, so we get some consensus on this.
Documentation/devicetree/bindings/mfd/syscon.txt Specifies the string "syscon" for such regmap ranges, maybe it should rather use the compatible string "misc-register-range" or something.
Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt line 13
Quoted 4 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +4
-0+LED sub-node properties: +- offset : register offset to the register controlling this LED +- mask : bit mask for the bit controlling this LED in the register + typically 0x01, 0x02, 0x04 ...This would be a single bit, right? What about inverted bits (i.e. 0 is on or 1 is on)?
I can of course add inversion bindings, but cannot add it to the driver as I can't test it. Just an "active-low;" string would do I guess.
Quoted 3 lines
Quoted 1 line
+- label : (optional)
Please group all required and optional properties under those headings.
OK.
Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt line 32
Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-syscon.txt new file +7
-0+Example: + +leds: leds at 08 { + compatible = "syscon-leds"; + regmap = <&syscon>; + + led at bit0 {Perhaps we can define a way to express unit address as offset+bit like <offset>_<bit> or <offset>.<bit>.
I'll come up with something. We don't really have a place to document such schemas do we?
Quoted 3 lines
I think we should get rid of the leds node and put this within the syscon device node and each node here should have a compatible property.
OK. But then I guess you also expect to get rid of the phandle <&syscon> from the node, so that it implicitly uses the syscon it's embedded in? Or is it OK to keep? Or should it be optional, so the (syscon) driver will look upward when locating the syscon for a node?
Like I need to add a new function syscon_regmap_lookup_by_hierarchy() to syscon.c... It already has like three ways to look up syscons, now we add another one.
I know that is a Linux implementation detail but it reflects the fact that similar code will be needed in all operating systems using syscon-type things, if it's a case-by-case question whether a phandle or hierarchy traversal is to be used for getting hold of the interface.
Your,
Linus Walleij
PATCH 3/6 power: reset: driver for the Versatile syscon reboot
In reply to Linus WalleijThis driver enabled us to drive the reboot of the Versatile family of ARM reference boards. Even though only the RealView boards are supported initially, these boards all have the same procedure for reboot:
- Write a magic value into an unlocking register
- Write another magic value into a reset control register
The driver will be reusable for Versatile and possibly also the Integrator family of reference boards.
--- drivers/power/reset/Kconfig | 9 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/arm-versatile-reboot.c | 121 +++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 drivers/power/reset/arm-versatile-reboot.c
drivers/power/reset/Kconfig +9 -0
@@ -58,6 +58,15 @@ config POWER_RESET_SUN6I help Reboot support for the Allwinner A31 SoCs. +config POWER_RESET_VERSATILE + bool "ARM Versatile family reboot driver" + depends on ARM + depends on MFD_SYSCON + depends on OF + help + Power off and restart support for ARM Versatile family of + reference boards. + config POWER_RESET_VEXPRESS bool "ARM Versatile Express power-off and reset driver" depends on ARM || ARM64
drivers/power/reset/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o obj-$(CONFIG_POWER_RESET_SUN6I) += sun6i-reboot.o +obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o obj-$(CONFIG_POWER_RESET_KEYSTONE) += keystone-reset.o
drivers/power/reset/arm-versatile-reboot.c new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 4/6 power: reset: DT bindings for the Versatile reset driver
In reply to Linus WalleijThis adds the device tree bindings for the Versatile reset driver.
--- .../devicetree/bindings/reset/arm-versatile-reboot.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/arm-versatile-reboot.txt
Documentation/devicetree/bindings/reset/arm-versatile-reboot.txt new file +18 -0
@@ -0,0 +1,18 @@ +ARM Versatile Family Reboot bindings + +Required nodes: + +- compatible: must be one of these to identify the system: + "arm,realview-eb-reboot" + "arm,realview-pb1176-reboot" + "arm,realview-pb11mp-reboot" + "arm,realview-pba8-reboot" + "arm,realview-pbx-reboot" +- regmap : a phandle to a syscon node containing a regmap + +Example: + +reboot: reboot at 0x40 { + compatible = "arm,realview-pb1176-reboot"; + regmap = <&syscon>; +};
Signature · 1 line
1.9.3
PATCH 5/6 soc: add driver for the ARM RealView
In reply to Linus WalleijThis adds a SoC driver to be used by the ARM RealView reference boards. We create the "versatile" directory to hold the different ARM reference designs as per the pattern of the clk directory layout. The driver utilze the syscon to get to the register needed. After this we can use sysfs to get at some SoC properties on RealView DT variants like this:
Quoted 2 lines
cd /sysbus/soc/devices/soc0
ls
board family machine power subsystem build fpga manufacturer soc_id uevent
Quoted 1 line
cat family
Versatile
Quoted 1 line
cat fpga
Multi-layer AXI
Quoted 1 line
cat board
HBI-0147
Quoted 1 line
cat build
03
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/versatile/Kconfig | 10 +++ drivers/soc/versatile/Makefile | 1 + drivers/soc/versatile/soc-realview.c | 144 +++++++++++++++++++++++++++++++++++ 5 files changed, 157 insertions(+) create mode 100644 drivers/soc/versatile/Kconfig create mode 100644 drivers/soc/versatile/Makefile create mode 100644 drivers/soc/versatile/soc-realview.c
drivers/soc/Kconfig +1 -0
@@ -1,5 +1,6 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/qcom/Kconfig" +source "drivers/soc/versatile/Kconfig" endmenu
drivers/soc/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-$(CONFIG_ARCH_QCOM) += qcom/ +obj-$(CONFIG_PLAT_VERSATILE) += versatile/
drivers/soc/versatile/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# +# ARM Versatile SoC drivers +# +config SOC_REALVIEW + bool "SoC bus device for the ARM RealView platforms" + depends on ARCH_REALVIEW + select SOC_BUS + help + Include support for the SoC bus on the ARM RealView platforms + providing some sysfs information about the ASIC variant.
drivers/soc/versatile/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_SOC_REALVIEW) += soc-realview.o
drivers/soc/versatile/soc-realview.c new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH v4 6/6 ARM: realview: basic device tree implementation
In reply to Linus WalleijThis implements basic device tree boot support for the RealView platforms, with a basic device tree for ARM PB1176 as an example.
The implementation is done with a new DT-specific board file using only pre-existing bindings for the basic IRQ, timer and serial port drivers. A new compatible type is added to the GIC for the ARM1176.
This implementation uses the MFD syscon handle from day one to access the system controller registers, and register the devices using the SoC bus.
---
ChangeLog v3->v4:
- Switch the LEDs to usa a new syscon-LEDs driver so we can use the syscon as a hub for all these registers
- Split out the SoC driver to its own file in drivers/soc ChangeLog v2->v3:
- Rename uart at 0x12345678 to serial at 0x12345678 in DTS file
- Drop static remapping for the LEDs, using my new invention syscon-leds instead
- Drop the hunk selecting ARM_DMA_MEM_BUFFERABLE for the DT version of the RealView platform. We think this is a local optimization we can live without.
- Split off the reset driver to a separate syscon-based reset driver in drivers/power/reset, add separate device tree bindings for this driver.
- To make sure the reset driver is always available for this system a few extra select statements are needed in Kconfig
- Split off the SoC bus driver to an easily identifiable chunk inside the mach-realview/realview-dt.c file. This *can* be spun off as a separate driver under drivers/soc for example but we need some separate discussion on this subject.
- Augment the SoC driver to display some system info so it's clear why this driver is there.
- Drop surplus string "with device tree" from machine description in the DTS file.
- Move the new GIC compatible string in alphabetic order. ChangeLog v1->v2:
- Adjust timer clock names to be the same as the example in the device tree binding.
- Remove all memory fixup code - this should be handled by the device tree specification of memory areas or by special MM hacks for the RealView PBX.
- Fix the documentation around syscon to specify that it can be in any node, need not be the root node.
- Switch device tree license to the BSD license, taken from arch/powerpc/boot/dts/p1024rdb_32b.dts
- Add a hunk for the new compatible string to Documentation/devicetree/bindings/arm/gic.txt
- Move the clocks out of the SoC node, certainly the xtal is not sitting on the SoC...
- Sort the selects in Kconfig alphabetically
- Use IS_ENABLED() for the l2x0 code snippet
- Instead of checking the board variant in the reset routine to figure out how to tweak the reset controller, have a compatible string for each syscon variant, map it to an enum that provides a unique type ID and that way figure out how to handle it in a maybe more elegant way.
- Open issue: what do to with the l2x0 stuff?
--- Documentation/devicetree/bindings/arm/arm-boards | 66 +++++++ Documentation/devicetree/bindings/arm/gic.txt | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 240 +++++++++++++++++++++++ arch/arm/mach-realview/Kconfig | 13 ++ arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/realview-dt.c | 72 +++++++ drivers/irqchip/irq-gic.c | 1 + 8 files changed, 395 insertions(+) create mode 100644 arch/arm/boot/dts/arm-realview-pb1176.dts create mode 100644 arch/arm/mach-realview/realview-dt.c
Documentation/devicetree/bindings/arm/arm-boards +66 -0
@@ -86,3 +86,69 @@ Interrupt controllers: compatible = "arm,versatile-sic"; interrupt-controller; #interrupt-cells = <1>; + + +ARM RealView Boards +------------------- +The RealView boards cover tailored evaluation boards that are used to explore +the ARM11 and Cortex A-8 and Cortex A-9 processors. + +Required properties (in root node): + /* RealView Emulation Baseboard */ + compatible = "arm,realview-eb"; + /* RealView Platform Baseboard for ARM1176JZF-S */ + compatible = "arm,realview-pb1176"; + /* RealView Platform Baseboard for ARM11 MPCore */ + compatible = "arm,realview-pb11mp"; + /* RealView Platform Baseboard for Cortex A-8 */ + compatible = "arm,realview-pba8"; + /* RealView Platform Baseboard Explore for Cortex A-9 */ + compatible = "arm,realview-pbx"; + +Required nodes: + +- soc: some node of the RealView platforms must be the SoC + node that contain the SoC-specific devices, withe the compatible + string set to one of these tuples: + "simple-bus", "arm,realview-eb-soc" + "simple-bus", "arm,realview-pb1176-soc" + "simple-bus", "arm,realview-pb11mp-soc" + "simple-bus", "arm,realview-pba8-soc" + "simple-bus", "arm,realview-pbx-soc" + +- syscon: some subnode of the RealView SoC node must be a + system controller node pointing to the control registers, + with the compatible string set to one of these tuples: + "arm,realview-eb-syscon", "syscon" + "arm,realview-pb1176-syscon", "syscon" + "arm,realview-pb11mp-syscon", "syscon" + "arm,realview-pba8-syscon", "syscon" + "arm,realview-pbx-syscon", "syscon" + + Required properties for the system controller: + - regs: the location and size of the system controller registers, + one range of 0x1000 bytes. + +Example: + +/dts-v1/; +#include <dt-bindings/interrupt-controller/irq.h> +#include "skeleton.dtsi" + +/ { + model = "ARM RealView PB1176 with device tree"; + compatible = "arm,realview-pb1176"; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus", "arm,realview-pb1176-soc"; + ranges; + + syscon: syscon at 10000000 { + compatible = "arm,realview-syscon", "syscon"; + reg = <0x10000000 0x1000>; + }; + + }; +};
Documentation/devicetree/bindings/arm/gic.txt +1 -0
@@ -16,6 +16,7 @@ Main node required properties: "arm,cortex-a9-gic" "arm,cortex-a7-gic" "arm,arm11mp-gic" + "arm,arm1176jzf-gic" - interrupt-controller : Identifies the node as an interrupt controller - #interrupt-cells : Specifies the number of cells needed to encode an interrupt source. The type shall be a <u32> and the value shall be 3.
arch/arm/boot/dts/Makefile +1 -0
@@ -318,6 +318,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8084-mtp.dtb \ qcom-msm8660-surf.dtb \ qcom-msm8960-cdp.dtb +dtb-$(CONFIG_ARCH_REALVIEW) += arm-realview-pb1176.dtb dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb dtb-$(CONFIG_ARCH_S3C64XX) += s3c6410-mini6410.dtb \ s3c6410-smdk6410.dtb
arch/arm/boot/dts/arm-realview-pb1176.dts new file +240 -0
240 lines not on this page · raw message
arch/arm/mach-realview/Kconfig +13 -0
@@ -1,6 +1,19 @@ menu "RealView platform type" depends on ARCH_REALVIEW +config REALVIEW_DT + bool "Support RealView(R) Device Tree based boot" + select ARM_GIC + select MFD_SYSCON + select POWER_RESET + select POWER_RESET_VERSATILE + select POWER_SUPPLY + select SOC_REALVIEW + select USE_OF + help + Include support for booting the ARM(R) RealView(R) evaluation + boards using a device tree machine description. + config MACH_REALVIEW_EB bool "Support RealView(R) Emulation Baseboard" select ARM_GIC
arch/arm/mach-realview/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-y := core.o +obj-$(CONFIG_REALVIEW_DT) += realview-dt.o obj-$(CONFIG_MACH_REALVIEW_EB) += realview_eb.o obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
arch/arm/mach-realview/realview-dt.c new file +72 -0
72 lines not on this page · raw message
drivers/irqchip/irq-gic.c +1 -0
@@ -1075,6 +1075,7 @@ gic_of_init(struct device_node *node, struct device_node *parent)return 0 ; }IRQCHIP_DECLARE (gic_400,"arm,gic-400" , gic_of_init); +IRQCHIP_DECLARE (arm1176jzf_gic,"arm,arm1176jzf-gic" , gic_of_init);IRQCHIP_DECLARE (cortex_a15_gic,"arm,cortex-a15-gic" , gic_of_init);IRQCHIP_DECLARE (cortex_a9_gic,"arm,cortex-a9-gic" , gic_of_init);IRQCHIP_DECLARE (cortex_a7_gic,"arm,cortex-a7-gic" , gic_of_init);
Signature · 1 line
1.9.3
PATCH v4 6/6 ARM: realview: basic device tree implementation
Hi Linus,
Quoted 104 lines · Linus Walleij
This implements basic device tree boot support for the RealView platforms, with a basic device tree for ARM PB1176 as an example.
The implementation is done with a new DT-specific board file using only pre-existing bindings for the basic IRQ, timer and serial port drivers. A new compatible type is added to the GIC for the ARM1176.
This implementation uses the MFD syscon handle from day one to access the system controller registers, and register the devices using the SoC bus.
Cc Arnd Bergmann <[email protected]>Cc Rob Herring <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
ChangeLogv3->v4:
- Switch the LEDs to usa a new syscon-LEDs driver so we can use the syscon as a hub for all these registers
- Split out the SoC driver to its own file indrivers/socChangeLogv2->v3:
- Rename uart at0x12345678to serial at0x12345678in DTS file
- Drop static remapping for the LEDs, using my new invention syscon-leds instead
- Drop the hunk selectingARM_DMA_MEM_BUFFERABLEfor the DT version of the RealView platform. We think this is a local optimization we can live without.
- Split off the reset driver to a separate syscon-based reset driver indrivers/power/reset, add separate device tree bindings for this driver.
- To make sure the reset driver is always available for this system a few extra select statements are needed inKconfig
- Split off the SoC bus driver to an easily identifiable chunk inside themach-realview/realview-dt.cfile. This *can* be spun off as a separate driver underdrivers/socfor example but we need some separate discussion on this subject.
- Augment the SoC driver to display some system info so it's clear why this driver is there.
- Drop surplus string "with device tree" from machine description in the DTS file.
- Move the new GIC compatible string in alphabetic order. ChangeLogv1->v2:
- Adjust timer clock names to be the same as the example in the device tree binding.
- Remove all memory fixup code - this should be handled by the device tree specification of memory areas or by special MM hacks for the RealView PBX.
- Fix the documentation around syscon to specify that it can be in any node, need not be the root node.
- Switch device tree license to the BSD license, taken fromarch/powerpc/boot/dts/p1024rdb_32b.dts
- Add a hunk for the new compatible string toDocumentation/devicetree/bindings/arm/gic.txt
- Move the clocks out of the SoC node, certainly the xtal is not sitting on the SoC...
- Sort the selects inKconfigalphabetically
- UseIS_ENABLED()for the l2x0 code snippet
- Instead of checking the board variant in the reset routine to figure out how to tweak the reset controller, have a compatible string for each syscon variant, map it to an enum that provides a unique type ID and that way figure out how to handle it in a maybe more elegant way.
- Open issue: what do to with the l2x0 stuff?--- Documentation/devicetree/bindings/arm/arm-boards | 66 +++++++ Documentation/devicetree/bindings/arm/gic.txt | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 240 +++++++++++++++++++++++ arch/arm/mach-realview/Kconfig | 13 ++ arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/realview-dt.c | 72 +++++++ drivers/irqchip/irq-gic.c | 1 + 8 files changed, 395 insertions(+) create mode 100644 arch/arm/boot/dts/arm-realview-pb1176.dts create mode 100644 arch/arm/mach-realview/realview-dt.cDocumentation/devicetree/bindings/arm/arm-boards +19
-0@@ -86,3 +86,69 @@ Interrupt controllers: compatible = "arm,versatile-sic"; interrupt-controller; #interrupt-cells = <1>; + + +ARM RealView Boards +------------------- +The RealView boards cover tailored evaluation boards that are used to explore +the ARM11 and Cortex A-8 and Cortex A-9 processors. + +Required properties (in root node): + /* RealView Emulation Baseboard */ + compatible = "arm,realview-eb"; + /* RealView Platform Baseboard for ARM1176JZF-S */ + compatible = "arm,realview-pb1176"; + /* RealView Platform Baseboard for ARM11 MPCore */ + compatible = "arm,realview-pb11mp"; + /* RealView Platform Baseboard for Cortex A-8 */ + compatible = "arm,realview-pba8"; + /* RealView Platform Baseboard Explore for Cortex A-9 */ + compatible = "arm,realview-pbx"; +
Documentation/devicetree/bindings/arm/arm-boards Interrupt controllers: · line 117
Quoted 10 lines
Documentation/devicetree/bindings/arm/arm-boards +10
-0+Required nodes: + +- soc: some node of the RealView platforms must be the SoC + node that contain the SoC-specific devices, withe the compatible + string set to one of these tuples: + "simple-bus", "arm,realview-eb-soc" + "simple-bus", "arm,realview-pb1176-soc" + "simple-bus", "arm,realview-pb11mp-soc" + "simple-bus", "arm,realview-pba8-soc" + "simple-bus", "arm,realview-pbx-soc"
If you have simple-bus in a compatible list, it should come last. The list is meant to go from most specific to least specific.
That'll need to be swapped in the example and dts too.
[...]
Quoted 6 lines
Documentation/devicetree/bindings/arm/arm-boards +6
-0+ soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus", "arm,realview-pb1176-soc"; + regmap = <&syscon>; + ranges;
Documentation/devicetree/bindings/arm/arm-boards Interrupt controllers: · line 133
Quoted 10 lines
Documentation/devicetree/bindings/arm/arm-boards +10
-0+ + syscon: syscon at 10000000 { + compatible = "arm,realview-pb1176-syscon", "syscon"; + reg = <0x10000000 0x1000>; + }; + + reboot: reboot at 0x40 { + compatible = "arm,realview-pb1176-reboot"; + regmap = <&syscon>; + };
What's the @0x40 for?
Why don't we just have a property on the arm,realview-pb1176-syscon node to say it can do reset (or just assume that it can)?
This looks like a leak of Linux internals, this isn't really a device.
[...]
Documentation/devicetree/bindings/arm/arm-boards Interrupt controllers: · line 136
Quoted 3 lines
Documentation/devicetree/bindings/arm/arm-boards +3
-0+ /* Primary DevChip GIC synthesized with the CPU */ + intc_dc1176: interrupt-controller at 10120000 { + compatible = "arm,arm1176jzf-gic";
As far as I am aware, the JZF flags haven nothing to do with the GIC implementation. I think they can be dropped from this string (following the example of "arm,arm1176-pmu").
Documentation/devicetree/bindings/arm/arm-boards Interrupt controllers: · line 146
Quoted 10 lines
Documentation/devicetree/bindings/arm/arm-boards +10
-0+ #interrupt-cells = <3>; + #address-cells = <1>; + interrupt-controller; + reg = <0x10121000 0x1000>, + <0x10120000 0x100>; + }; + + /* This GIC on the board is cascaded off the DevChip GIC */ + intc_pb1176: interrupt-controller at 10040000 { + compatible = "arm,arm1176jzf-gic";
And this isn't part of the CPU, so that string doesn't look right. I'd at least like to see an additional string earlier in the list
Quoted 8 lines
Documentation/devicetree/bindings/arm/arm-boards +8
-0+ #interrupt-cells = <3>; + #address-cells = <1>; + interrupt-controller; + reg = <0x10041000 0x1000>, + <0x10040000 0x100>; + interrupt-parent = <&intc_dc1176>; + interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>; + };
[...]
Quoted 22 lines
Documentation/devicetree/bindings/arm/arm-boards +22
-0+static void __init realview_dt_init_machine(void) +{ + int ret; + +#if IS_ENABLED(CONFIG_CACHE_L2X0) + if (of_machine_is_compatible("arm,realview-eb")) + /* + * 1MB (128KB/way), 8-way associativity, + * evmon/parity/share enabled + * Bits: .... ...0 0111 1001 0000 .... .... .... + */ + l2x0_of_init(0x00790000, 0xfe000fff); + else if (of_machine_is_compatible("arm,realview-pb1176")) + /* + * 128Kb (16Kb/way) 8-way associativity. + * evmon/parity/share enabled. + */ + l2x0_of_init(0x00730000, 0xfe000fff); + else if (of_machine_is_compatible("arm,realview-pb11mp")) + /* + * 1MB (128KB/way), 8-way associativity, + * evmon/parity/share enabled
Documentation/devicetree/bindings/arm/arm-boards
Quoted 10 lines
Documentation/devicetree/bindings/arm/arm-boards +10
-0+ * Bits: .... ...0 0111 1001 0000 .... .... .... + */ + l2x0_of_init(0x00730000, 0xfe000fff); + else if (of_machine_is_compatible("arm,realview-pbx")) + /* + * 16KB way size, 8-way associativity, parity disabled + * Bits: .. 0 0 0 0 1 00 1 0 1 001 0 000 0 .... .... .... + */ + l2x0_of_init(0x02520000, 0xc0000fff); +#endif
Are these just copied form what we already have for non-DT?
Do we know that these are all necessary?
Quoted 1 line
+DT_MACHINE_START(REALVIEW_DT, "ARM RealView Machine (Device Tree Support)")
As a general point, we seem to have so many different ways of formatting this, and we should standardise.
Thanks,
Mark.
PATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 38 lines · Mark Rutland
Hi Linus,
Quoted 22 lines · Linus Walleij
arch/arm/mach-realview/realview-dt.c new file +22
-0+static void __init realview_dt_init_machine (void ) +{ +int ret; + +#if IS_ENABLED (CONFIG_CACHE_L2X0 ) +if (of_machine_is_compatible ("arm,realview-eb" )) +/* +* 1MB (128KB/way), 8-way associativity, +* evmon/parity/share enabled +* Bits: .... ...0 0111 1001 0000 .... .... .... +*/ +l2x0_of_init (0x00790000 ,0xfe000fff ); +else if (of_machine_is_compatible ("arm,realview-pb1176" )) +/* +* 128Kb (16Kb/way) 8-way associativity. +* evmon/parity/share enabled. +*/ +l2x0_of_init (0x00730000 ,0xfe000fff ); +else if (of_machine_is_compatible ("arm,realview-pb11mp" )) +/* +* 1MB (128KB/way), 8-way associativity, +* evmon/parity/share enabled arch/arm/mach-realview/realview-dt.c line 47
Quoted 10 lines
arch/arm/mach-realview/realview-dt.c new file +10
-0+* Bits: .... ...0 0111 1001 0000 .... .... .... +*/ +l2x0_of_init (0x00730000 ,0xfe000fff ); + else if (of_machine_is_compatible("arm,realview-pbx")) +/* +* 16KB way size, 8-way associativity, parity disabled +* Bits: .. 0 0 0 0 1 00 1 0 1 001 0 000 0 .... .... .... +*/ +l2x0_of_init (0x02520000 ,0xc0000fff ); +#endif Are these just copied form what we already have for non-DT?
Quoted 1 line
Do we know that these are all necessary?
It is necessary to provide the cache sizes on Realview because the older L2C210/L2C220 do not have a method of encoding that information in the register - and given that ARM doesn't seem to like shipping Linux compatible boot loaders on their eval hardware, we can't really say that it should be dealt with there.
I toyed with the idea of adding the standard cache size specifications to the L2C code, it sounds like there's a reason to do that now.
Let's not mess around with adding stuff like the above to work around the L2 code not parsing the appropriate specs from DT, let's do the right thing and add bindings to allow DT to provide the cache geometry.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Arnd Bergmann
maintainerPATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 7 lines · On Friday 25 July 2014 16:50:10 Russell King - ARM Linux wrote:
I toyed with the idea of adding the standard cache size specifications to the L2C code, it sounds like there's a reason to do that now.
Let's not mess around with adding stuff like the above to work around the L2 code not parsing the appropriate specs from DT, let's do the right thing and add bindings to allow DT to provide the cache geometry.
Yes, please!
That would actually reduce the realview to just the dma_zone_size definition, and I think someone also posted a patch to get that from DT recently. Having realview booting with an empty board file would be ideal.
Arnd
PATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Friday 25 July 2014 16:50:10 Russell King - ARM Linux wrote:
I toyed with the idea of adding the standard cache size specifications to the L2C code, it sounds like there's a reason to do that now.
Let's not mess around with adding stuff like the above to work around the L2 code not parsing the appropriate specs from DT, let's do the right thing and add bindings to allow DT to provide the cache geometry.
Quoted 6 lines
Yes, please!
That would actually reduce the realview to just the
dma_zone_sizedefinition, and I think someone also posted a patch to get that from DT recently. Having realview booting with an empty board file would be ideal.
I did have a patch in my L2C cleanup series to provide these properties, but it got discarded - even though we have existing platforms which provide these values.
The reason for that was because requiring new properties causes a DT breakage - previous versions of the DT suddenly stop working because the values necessary to setup the L2C have been removed from the kernel, and the older DT files do not contain the neccessary values either.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
Arnd Bergmann
maintainerPATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 21 lines · On Monday 01 September 2014 13:03:13 Russell King - ARM Linux wrote:
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Friday 25 July 2014 16:50:10 Russell King - ARM Linux wrote:
I toyed with the idea of adding the standard cache size specifications to the L2C code, it sounds like there's a reason to do that now.
Let's not mess around with adding stuff like the above to work around the L2 code not parsing the appropriate specs from DT, let's do the right thing and add bindings to allow DT to provide the cache geometry.
Quoted 6 lines
Yes, please!
That would actually reduce the realview to just the
dma_zone_sizedefinition, and I think someone also posted a patch to get that from DT recently. Having realview booting with an empty board file would be ideal.I did have a patch in my L2C cleanup series to provide these properties, but it got discarded - even though we have existing platforms which provide these values.
Quoted 5 lines
The reason for that was because requiring new properties causes a DT breakage - previous versions of the DT suddenly stop working because the values necessary to setup the L2C have been removed from the kernel, and the older DT files do not contain the neccessary values either.
But in case of realview or any other platform that does not have mainline DT support, nothing would break. There is no need to remove the settings from the kernel, I would just prefer not to add any other ones.
Arnd
PATCH v4 6/6 ARM: realview: basic device tree implementation
In reply to Mark RutlandSome ARM1176JZF confusion in as separate thread...
Quoted 9 lines · Mark Rutland
arch/arm/boot/dts/arm-realview-pb1176.dts line 150
Quoted 3 lines · Linus Walleij
arch/arm/boot/dts/arm-realview-pb1176.dts new file +3
-0+ /* Primary DevChip GIC synthesized with the CPU */ + intc_dc1176: interrupt-controller at 10120000 { + compatible = "arm,arm1176jzf-gic";As far as I am aware, the JZF flags haven nothing to do with the GIC implementation. I think they can be dropped from this string (following the example of "arm,arm1176-pmu").
FWIW I changed the string to "arm,arm1176-gic"
But this isn't about the CPU actually. It is the ARM1176JZF development chip. See:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0375a/DDI0375A_arm1176jzf_dev_chip_r0p0_trm.pdf
I know it is confusingly named as a name of a SoC that has this CPU inside it but what can I do ... some guys named ARM came up with this.
Should use the string "arm,arm1176jzf-devchip-gic"?
Quoted 6 lines
arch/arm/boot/dts/arm-realview-pb1176.dts line 160
Quoted 3 lines
arch/arm/boot/dts/arm-realview-pb1176.dts new file +3
-0+ /* This GIC on the board is cascaded off the DevChip GIC */ + intc_pb1176: interrupt-controller at 10040000 { + compatible = "arm,arm1176jzf-gic";And this isn't part of the CPU, so that string doesn't look right. I'd at least like to see an additional string earlier in the list
This seems to be a follow-on to the above confusion.
Yours,
Linus Walleij
PATCH v4 6/6 ARM: realview: basic device tree implementation
Hi Linus,
Quoted 9 lines · Linus Walleij
Some ARM1176JZF confusion in as separate thread...
Quoted 6 lines · Mark Rutland
Quoted 3 lines · Linus Walleij
arch/arm/boot/dts/arm-realview-pb1176.dts new file +3
-0+ /* Primary DevChip GIC synthesized with the CPU */ + intc_dc1176: interrupt-controller at 10120000 { + compatible = "arm,arm1176jzf-gic";
Quoted 5 lines
Quoted 3 lines
As far as I am aware, the JZF flags haven nothing to do with the GIC implementation. I think they can be dropped from this string (following the example of "arm,arm1176-pmu").
FWIW I changed the string to "arm,arm1176-gic"
Ok.
Quoted 7 lines
But this isn't about the CPU actually. It is the ARM1176JZF development chip. See:
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0375a/DDI0375A_arm1176jzf_dev_chip_r0p0_trm.pdfI know it is confusingly named as a name of a SoC that has this CPU inside it but what can I do ... some guys named ARM came up with this.
Ah, I see. Sorry for the confusion there.
Quoted 1 line
Should use the string "arm,arm1176jzf-devchip-gic"?
That sounds fine to me.
The document you've linked to says the GIC is derived from the MPCore GIC, so I'd place "arm,arm11mp-gic" as a fallback entry in the compatible list. Until we need to distinguish the two the driver shouldn't need to be updated.
Quoted 9 lines
Quoted 7 lines
arch/arm/boot/dts/arm-realview-pb1176.dts line 160
Quoted 4 lines
arch/arm/boot/dts/arm-realview-pb1176.dts new file +3
-0+ /* This GIC on the board is cascaded off the DevChip GIC */ + intc_pb1176: interrupt-controller at 10040000 { + compatible = "arm,arm1176jzf-gic";And this isn't part of the CPU, so that string doesn't look right. I'd at least like to see an additional string earlier in the list
This seems to be a follow-on to the above confusion.
Yup.
Thanks,
Mark.
PATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 10 lines · Mark Rutland
Quoted 1 line · Linus Walleij
Should use the string "arm,arm1176jzf-devchip-gic"?
That sounds fine to me.
The document you've linked to says the GIC is derived from the MPCore GIC, so I'd place "arm,arm11mp-gic" as a fallback entry in the compatible list. Until we need to distinguish the two the driver shouldn't need to be updated.
Well the driver doesn't have a IRQCHIP_DECLARE() for arm11mp-gic either so I'll have to add that instead.
Yours,
Linus Walleij
PATCH v4 6/6 ARM: realview: basic device tree implementation
Quoted 7 lines · Linus Walleij
Quoted 6 lines · Mark Rutland
Quoted 1 line · Linus Walleij
Should use the string "arm,arm1176jzf-devchip-gic"?
That sounds fine to me.
Quoted 7 lines
Quoted 4 lines
The document you've linked to says the GIC is derived from the MPCore GIC, so I'd place "arm,arm11mp-gic" as a fallback entry in the compatible list. Until we need to distinguish the two the driver shouldn't need to be updated.
Well the driver doesn't have a
IRQCHIP_DECLARE()for arm11mp-gic either so I'll have to add that instead.
Sorry, I's assumed that because it was documented the driver already supported it. I should know better ;)
let's add an IRQCHIP_DECLARE for both "arm,arm1176jzf-devchip-gic" and "arm,arm11mp-gic" (given it was already documented), so as to make things less painful.
Thanks,
Mark.