ARM RealView DeviceTree support v5
Subsystems (9)
cover ARM RealView DeviceTree support v5
I've updated the RealView DeviceTree patch.
Main changes:
- Push l2x0 setup into the device tree
- Abstractify syscon LEDs
- Abstractify syscon reboot
Florian Fainelli (1):
ARM: l2c: parse 'cache-size' and 'cache-sets' properties
Linus Walleij (7):
leds: add a driver for syscon-based LEDs
leds: add device tree bindings for register bit LEDs
power: reset: driver for the Versatile syscon reboot
soc: add driver for the ARM RealView
ARM: l2x0: move DT parsing for cache props
ARM: l2x0: support associativity from DT
ARM: realview: basic device tree implementation
Documentation/devicetree/bindings/arm/arm-boards | 65 ++++++ Documentation/devicetree/bindings/arm/gic.txt | 1 + Documentation/devicetree/bindings/arm/l2cc.txt | 3 + .../devicetree/bindings/leds/register-bit-led.txt | 99 +++++++++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 246 +++++++++++++++++++++ arch/arm/mach-realview/Kconfig | 13 ++ arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/realview-dt.c | 47 ++++ arch/arm/mm/cache-l2x0.c | 82 ++++++- drivers/irqchip/irq-gic.c | 2 + drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-syscon.c | 165 ++++++++++++++ drivers/power/reset/Kconfig | 9 + drivers/power/reset/Makefile | 1 + drivers/power/reset/arm-versatile-reboot.c | 111 ++++++++++ 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 ++++++++++++ 22 files changed, 1009 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/leds/register-bit-led.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 v2 1/8 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.
---
ChangeLog v1->v2:
- Augment driver to probe all nodes of a syscon to see if they are "register-bit-led"s, and then allocate them under the syscon if that is the case.
- Switch compatible string from "syscon-leds" to "register-bit-led"
--- drivers/leds/Kconfig | 10 +++ drivers/leds/Makefile | 1 + drivers/leds/leds-syscon.c | 165 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 drivers/leds/leds-syscon.c
drivers/leds/Kconfig +10 -0
@@ -478,6 +478,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 +165 -0
165 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH v2 2/8 leds: add device tree bindings for register bit LEDs
In reply to Linus WalleijThis adds the device tree bindings used by register bit LEDs.
---
ChangeLog v1->v2:
- Rename binding "register-bit-led"
- Define that such nodes appear only as children of syscon
- Group required and optional parameters
- Number nodes as foo@<offset>.<bit>
- Update example
--- .../devicetree/bindings/leds/register-bit-led.txt | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/register-bit-led.txt
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +99 -0
@@ -0,0 +1,99 @@ +Device Tree Bindings for Register Bit LEDs + +Register bit leds are used with syscon multifunctional devices +where single bits in a certain register can turn on/off a +single LED. The register bit LEDs appear as children to the +syscon device, with the proper compatible string. For the +syscon bindings see: +Documentation/devicetree/bindings/mfd/syscon.txt + +Each LED is represented as a sub-node of the syscon device. Each +node's name represents the name of the corresponding LED. + +LED sub-node properties: + +Required properties: +- compatible : must be "register-bit-led" +- 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 ... + +Optional properties: +- 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: + +syscon: syscon at 10000000 { + compatible = "arm,realview-pb1176-syscon", "syscon"; + reg = <0x10000000 0x1000>; + + led at 08.0 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x01>; + label = "versatile:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + led at 08.1 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x02>; + label = "versatile:1"; + linux,default-trigger = "mmc0"; + default-state = "off"; + }; + led at 08.2 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x04>; + label = "versatile:2"; + linux,default-trigger = "cpu0"; + default-state = "off"; + }; + led at 08.3 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x08>; + label = "versatile:3"; + default-state = "off"; + }; + led at 08.4 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x10>; + label = "versatile:4"; + default-state = "off"; + }; + led at 08.5 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x20>; + label = "versatile:5"; + default-state = "off"; + }; + led at 08.6 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x40>; + label = "versatile:6"; + default-state = "off"; + }; + led at 08.7 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x80>; + label = "versatile:7"; + default-state = "off"; + }; +};
Signature · 1 line
1.9.3
Arnd Bergmann
maintainerPATCH v2 2/8 leds: add device tree bindings for register bit LEDs
Documentation/devicetree/bindings/leds/register-bit-led.txt line 19
Quoted 8 lines · On Tuesday 02 September 2014 14:02:28 Linus Walleij wrote:
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +7
-0+LED sub-node properties: + +Required properties: +- compatible : must be "register-bit-led" +- 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 ...
How does the driver know whether to do byte or word sized accesses?
Arnd
PATCH v2 2/8 leds: add device tree bindings for register bit LEDs
Quoted 11 lines · Arnd Bergmann
Documentation/devicetree/bindings/leds/register-bit-led.txt line 19
Quoted 8 lines · On Tuesday 02 September 2014 14:02:28 Linus Walleij wrote:
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +7
-0+LED sub-node properties: + +Required properties: +- compatible : must be "register-bit-led" +- 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 ...How does the driver know whether to do byte or word sized accesses?
Like with all other bindings based on Documentation/devicetree/bindings/mfd/syscon.txt
it is implicit that the access size is 32 bit words. Just grep for syscon in the bindings and you will see none define the access width.
If this should be fixed, the parent syscon binding should be altered to cover access width for all children as this is a property of the entire register range.
So for example:
gpr: iomuxc-gpr at 020e0000 {
compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
reg = <0x020e0000 0x38>;
register-width = <32>;
register-valid = <32>;
register-stride = <4>;
};So as to indicate that this register range is made up of 32 bit words, all 32 bits are valid in each word, and the stride between words i 4 bytes (i.e. tightly packed).
As mentioned by Rob, the "syscon" driver should be renamed "register-range" and "syscon" deprecated as binding, as it is Linux terminology.
I guess this adds up to the conclusion that the "syscon" binding was badly reviewed and merged, and now we're suffering from it.
----
Not that anyone should care when reviewing device tree bindings, but as it happens, the Linux driver drivers/mfd/syscon.c
explicitly assumes all sycons are 32bit:
static struct regmap_config syscon_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};If one happens to work on Linux (we would never assume such a thing, but if one by infinitesimal chance would still happen to do that) we can leave a note in this posting that the syscon driver would need to be altered to marshall it's regmap differently on stumbling onto this new property.
Yours,
Linus Walleij
PATCH v2 2/8 leds: add device tree bindings for register bit LEDs
In reply to Linus WalleijHi Linus,
Documentation/devicetree/bindings/leds/register-bit-led.txt line 18
Quoted 6 lines · Linus Walleij
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +6
-0+LED sub-node properties: + +Required properties: +- compatible : must be "register-bit-led" +- offset : register offset to the register controlling this LED +- mask : bit mask for the bit controlling this LED in the register
Why don't you use a "reg" property with "#address-cells = <2>" and "#size-cells = <1>", so you can store offset and mask there?
Documentation/devicetree/bindings/leds/register-bit-led.txt line 47
Quoted 12 lines
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +12
-0+syscon: syscon at 10000000 { + compatible = "arm,realview-pb1176-syscon", "syscon"; + reg = <0x10000000 0x1000>; + + led at 08.0 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x01>; + label = "versatile:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + };
ePAPR v1.1 says:
"The unit-address must match the first address specified in the reg property
of the node. If the node has no reg property, the @ and unit-address must be omitted ..."
So you cannot have the "@8.0" without a "reg" property.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v2 2/8 leds: add device tree bindings for register bit LEDs
Quoted 10 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/leds/register-bit-led.txt line 18
Quoted 6 lines · Linus Walleij
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +6
-0+LED sub-node properties: + +Required properties: +- compatible : must be "register-bit-led" +- offset : register offset to the register controlling this LED +- mask : bit mask for the bit controlling this LED in the registerWhy don't you use a "reg" property with "#address-cells = <2>" and "#size-cells = <1>", so you can store offset and mask there?
Because "reg" means a register range not based off another range, i.e. not relative, and the OF cores does not allow overlapping reg ranges as would be the case here IIRC.
Quoted 15 lines
Documentation/devicetree/bindings/leds/register-bit-led.txt line 47
Quoted 12 lines
Documentation/devicetree/bindings/leds/register-bit-led.txt new file +12
-0+syscon: syscon at 10000000 { + compatible = "arm,realview-pb1176-syscon", "syscon"; + reg = <0x10000000 0x1000>; + + led at 08.0 { + compatible = "register-bit-led"; + offset = <0x08>; + mask = <0x01>; + label = "versatile:0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + };ePAPR v1.1 says:
Quoted 5 lines
"The unit-address must match the first address specified in the reg property
of the node. If the node has no reg property, the @ and unit-address must be omitted ..."So you cannot have the "@8.0" without a "reg" property.
This terminology was suggested by Rob Herring due to the fact that there were no previous examples.
Rob: care to comment?
Right now I have that distinct feeling of despair as the v8 patch set is still stuck in DT syntax discussions...
Yours,
Linus Walleij
PATCH v2 3/8 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.
---
ChangeLog v1->v2:
- Do not probe from a platform device, instead use a device_initcall() and look up the syscon device from its node. If that device is not yet registered, the call will be deferred. This is done so that the Linux driver model is not reflected into the device tree, as the reboot property of the syscon is not a separate device.
--- drivers/power/reset/Kconfig | 9 +++ drivers/power/reset/Makefile | 1 + drivers/power/reset/arm-versatile-reboot.c | 111 +++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 drivers/power/reset/arm-versatile-reboot.c
drivers/power/reset/Kconfig +9 -0
@@ -75,6 +75,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
@@ -7,6 +7,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 +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.9.3
Arnd Bergmann
maintainerPATCH v2 3/8 power: reset: driver for the Versatile syscon reboot
Quoted 12 lines · On Tuesday 02 September 2014 14:02:29 Linus Walleij wrote:
drivers/power/reset/arm-versatile-reboot.c new file +12
-0+enum versatile_reboot { +REALVIEW_REBOOT_EB , +REALVIEW_REBOOT_PB1176 , +REALVIEW_REBOOT_PB11MP , +REALVIEW_REBOOT_PBA8 , +REALVIEW_REBOOT_PBX , +}; +static const struct of_device_id versatile_reboot_of_match[] = { + { + .compatible ="arm,realview-eb-syscon" , + .data = (void *)REALVIEW_REBOOT_EB , + },
...
Quoted 6 lines
drivers/power/reset/arm-versatile-reboot.c new file +6
-0+}; + +static void versatile_reboot (enum reboot_mode mode,const char *cmd) +{ +/* Unlock the reset register */ + regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET,
drivers/power/reset/arm-versatile-reboot.c line 89
Quoted 10 lines
drivers/power/reset/arm-versatile-reboot.c new file +9
-0+ REALVIEW_SYS_LOCK_VAL); +/* Then hit reset on the different machines */ +switch (versatile_reboot_type) { +case REALVIEW_REBOOT_EB : +regmap_write (syscon_regmap, +REALVIEW_SYS_RESETCTL_OFFSET ,0x0008 ); +break ; + } +dsb ();
Looks ok to me. Just an idea for further simplification, we could easily encode the writes into the .data field:
{
.compatible = "arm,realview-eb-syscon",
.data = (void *)0x00080000,
},
...
{
.compatible = "arm,realview-pbx-syscon",
.data = (void *)0x00f000f4,
},static void versatile_reboot(enum reboot_mode mode, const char *cmd) {
/* Unlock the reset register */ regmap_write(syscon_regmap, REALVIEW_SYS_LOCK_OFFSET, REALVIEW_SYS_LOCK_VAL); regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, versatile_reboot_type >> 16); if (versatile_reboot_type & 0xffff) regmap_write(syscon_regmap, REALVIEW_SYS_RESETCTL_OFFSET, versatile_reboot_type >> 16); dsb(); }
It's definitely shorter, you can decide if you like it better or not, and add my 'Acked-by: Arnd Bergmann <[email protected]>' whichever you choose.
Arnd
PATCH 4/8 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
@@ -4,3 +4,4 @@ obj-$(CONFIG_ARCH_QCOM) += qcom/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ +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 5/8 ARM: l2x0: move DT parsing for cache props
In reply to Linus WalleijThe current diagnostic prints in the l2x0 driver will print warnings like this if the AUX register i modified by the mask and set words passed to the l2x0_init() function:
L2C: platform modifies aux control register: 0x02020fff -> 0x02730fff
L2C: DT/platform modifies aux control register: 0x02020fff -> 0x02730fff L2C-220 cache controller enabled, 8 ways, 128 kB
L2C-220: CACHE_ID 0x41000486, AUX_CTRL 0x06730fff
However this is not printed properly if the DT modifies the AUX register, even if the debug print says so. As the call to ->of_parse for the cache variant is placed after this print.
Move the ->of_parse call above the print so we get proper diagnostics.
--- arch/arm/mm/cache-l2x0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/mm/cache-l2x0.c +5 -5
@@ -1518,6 +1518,11 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) of_property_read_bool(np, "arm,io-coherent")) data = &of_l2c310_coherent_data; +/* L2 configuration can only be changed if the cache is disabled */ +if (!(readl_relaxed (l2x0_base +L2X0_CTRL ) &L2X0_CTRL_EN )) +if (data->of_parse) + data->of_parse (np, &aux_val, &aux_mask); + old_aux =readl_relaxed (l2x0_base +L2X0_AUX_CTRL );if (old_aux != ((old_aux & aux_mask) | aux_val)) { pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n",
@@ -1530,11 +1535,6 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)if (!of_property_read_bool (np,"cache-unified" ))pr_err ("L2C: device tree omits to specify unified cache\n" ); -/* L2 configuration can only be changed if the cache is disabled */ -if (!(readl_relaxed (l2x0_base +L2X0_CTRL ) &L2X0_CTRL_EN )) -if (data->of_parse) - data->of_parse (np, &aux_val, &aux_mask); -if (cache_id_part_number_from_dt) cache_id = cache_id_part_number_from_dt;else
Signature · 1 line
1.9.3
PATCH 5/8 ARM: l2x0: move DT parsing for cache props
Quoted 6 lines · Linus Walleij
The current diagnostic prints in the l2x0 driver will print warnings like this if the AUX register i modified by the mask and set words passed to the
l2x0_init()function:L2C: platform modifies aux control register:
0x02020fff->0x02730fff
L2C: DT/platform modifies aux control register:0x02020fff->0x02730fff
Notice that there are two here.
The first means that the platform passed values which resulted in an actual modification to the control register. This happens in l2x0_of_init() to identify values of aux_mask/aux_val which result in manipulation of the control register by hard-coded platform values.
The second means that the platform _or_ the DT resulted in an actual modification of the control register. This happens in __l2c_init(), after the DT has been parsed, or after the non-DT code paths to identify any remaining modifications.
I don't see any point to this patch.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
PATCH 5/8 ARM: l2x0: move DT parsing for cache props
Quoted 1 line · Russell King - ARM Linux
I don't see any point to this patch.
Neither do I after looking closer. Hm. I must have been confusing myself, I'm dropping this crap.
Yours,
Linus Walleij
PATCH 6/8 ARM: l2c: parse 'cache-size' and 'cache-sets' properties
In reply to Linus WalleijFrom: Florian Fainelli <[email protected]>
When both 'cache-size' and 'cache-sets' are specified for a L2 cache controller node, parse those properties and make sure we validate the way_size based on which type of L2 cache controller we are using.
Update the L2 cache controller Device Tree binding with the optional 'cache-size' and 'cache-sets' properties.
--- Documentation/devicetree/bindings/arm/l2cc.txt | 2 + arch/arm/mm/cache-l2x0.c | 61 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+)
Documentation/devicetree/bindings/arm/l2cc.txt +2 -0
@@ -44,6 +44,8 @@ Optional properties: I/O coherent mode. Valid only when the arm,pl310-cache compatible string is used. - interrupts : 1 combined interrupt. +- cache-size : specifies the size in bytes of the cache +- cache-sets : specifies the number of associativity sets of the cache - cache-id-part: cache id part number to be used if it is not present on hardware - wt-override: If present then L2 is forced to Write through mode
arch/arm/mm/cache-l2x0.c +61 -0
85 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH 7/8 ARM: l2x0: support associativity from DT
In reply to Linus WalleijThe ARM RealView platforms comes with boot loaders that fail to set up cache size, ways and associativity correctly. This complements Florian's patch to set up cache size and sets from the device tree with the possibility to set up associativity on the L2C-220 cache variant.
--- Documentation/devicetree/bindings/arm/l2cc.txt | 1 + arch/arm/mm/cache-l2x0.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
Documentation/devicetree/bindings/arm/l2cc.txt +1 -0
@@ -44,6 +44,7 @@ Optional properties: I/O coherent mode. Valid only when the arm,pl310-cache compatible string is used. - interrupts : 1 combined interrupt. +- cache-associativity : specifies the associativity of the cache - cache-size : specifies the size in bytes of the cache - cache-sets : specifies the number of associativity sets of the cache - cache-id-part: cache id part number to be used if it is not present
arch/arm/mm/cache-l2x0.c +11 -0
@@ -1007,6 +1007,7 @@ static void __init l2x0_of_parse(const struct device_node *np,u32 tag =0 ;u32 dirty =0 ;u32 val =0 , mask =0 ; +u32 assoc =0 ;of_property_read_u32 (np,"arm,tag-latency" , &tag);if (tag) {
@@ -1029,6 +1030,16 @@ static void __init l2x0_of_parse(const struct device_node *np, val |= (dirty -1 ) <<L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT ; } +of_property_read_u32 (np,"cache-associativity" , &assoc); +if (assoc) { +if (assoc >8 ) { +pr_warn ("L2C: associativity %d is too large\n" , assoc); + }else { + mask |=L2X0_AUX_CTRL_ASSOC_MASK ; + val |= (assoc <<L2X0_AUX_CTRL_ASSOC_SHIFT ); + } + } +l2x0_cache_size_of_parse (np, aux_val, aux_mask,SZ_256K ); *aux_val &= ~mask;
Signature · 1 line
1.9.3
PATCH 7/8 ARM: l2x0: support associativity from DT
Quoted 5 lines · Linus Walleij
The ARM RealView platforms comes with boot loaders that fail to set up cache size, ways and associativity correctly. This complements Florian's patch to set up cache size and sets from the device tree with the possibility to set up associativity on the L2C-220 cache variant.
Do we need this?
If we have the cache size, the number of sets, and the cache block size (cache line size) which are all ePAPR specified properties for a cache, then:
number of cache blocks = cache size / cache block size ways of associativity = number of cache blocks / number of sets way size = cache block size * number of sets
It's a tad annoying to have to convert between the two representations, but ePAPR decided on size, sets and block size rather than size and ways.
See arch/powerpc/kernel/cacheinfo.c line 260 for the powerpc associativity calculations from these values.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net.
PATCH v5 8/8 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 v4->v5:
- Move the l2x0_init() aux set-ups over to the device tree, using one patch from Florian Fainelli and one patch from myself to support the needed bits.
- Put "simple-bus" last in binding documentation, examples and device tree so we go from most to least specific.
- Use the compatible arm11mp-gic binding for the GIC, and add a more specific binding "arm,arm1176jzf-devchip-gic" for the variant specifically found on the ARM1176JZF development chip. Add IRQCHIP_DECLARE() for both variants.
- Drop the "reboot device" node as we rewrote the driver to hog onto the syscon node directly.
- Augment device tree for the new register-bit-leds used with the syscon.
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 | 65 ++++++ Documentation/devicetree/bindings/arm/gic.txt | 1 + arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/arm-realview-pb1176.dts | 246 +++++++++++++++++++++++ arch/arm/mach-realview/Kconfig | 13 ++ arch/arm/mach-realview/Makefile | 1 + arch/arm/mach-realview/realview-dt.c | 47 +++++ drivers/irqchip/irq-gic.c | 2 + 8 files changed, 376 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 +65 -0
@@ -92,3 +92,68 @@ Required nodes: - core-module: the root node to the Versatile platforms must have a core-module with regs and the compatible strings "arm,core-module-versatile", "syscon" + +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: + "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", "simple-bus" + +- 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 = "arm,realview-pb1176-soc", "simple-bus"; + ranges; + + syscon: syscon at 10000000 { + compatible = "arm,realview-syscon", "syscon"; + reg = <0x10000000 0x1000>; + }; + + }; +};
Documentation/devicetree/bindings/arm/gic.txt +1 -0
@@ -17,6 +17,7 @@ Main node required properties: "arm,cortex-a7-gic" "arm,arm11mp-gic" "brcm,brahma-b15-gic" + "arm,arm1176jzf-devchip-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
@@ -344,6 +344,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_ROCKCHIP) += \ rk3066a-bqcurie2.dtb \ rk3188-radxarock.dtb \
arch/arm/boot/dts/arm-realview-pb1176.dts new file +246 -0
246 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 +47 -0
47 lines not on this page · raw message
drivers/irqchip/irq-gic.c +2 -0
@@ -1022,6 +1022,8 @@ 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 (arm11mp_gic,"arm,arm11mp-gic" , gic_of_init); +IRQCHIP_DECLARE (arm1176jzf_dc_gic,"arm,arm1176jzf-devchip-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
Arnd Bergmann
maintainerPATCH v5 8/8 ARM: realview: basic device tree implementation
Quoted 23 lines · On Tuesday 02 September 2014 14:02:34 Linus Walleij wrote:
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 ) +l2x0_of_init (0 , ~0 ); +#endif + + ret =of_platform_populate (NULL , of_default_bus_match_table, +NULL ,NULL ); +if (ret) { +pr_crit ("could not populate device tree\n" ); +return ; + } +} + +static const char *realview_dt_platform_compat[]__initconst = { +"arm,realview-eb" , +"arm,realview-pb1176" , +"arm,realview-pb11mp" , +"arm,realview-pba8" , +"arm,realview-pbx" ,
arch/arm/mach-realview/realview-dt.c line 47
Quoted 10 lines
arch/arm/mach-realview/realview-dt.c new file +10
-0+NULL , +}; + +DT_MACHINE_START (REALVIEW_DT ,"ARM RealView Machine (Device Tree Support)" ) + .init_machine = realview_dt_init_machine, +#ifdef CONFIG_ZONE_DMA + .dma_zone_size = SZ_256M, +#endif + .dt_compat = realview_dt_platform_compat, +MACHINE_END
This looks almost perfect to me, but there is one simplification you can do now:
If you add the .l2c_aux_val/.l2c_aux_mask fields to the machine descriptor, you can remove the rest of the realview_dt_init_machine function, and have only the dma_zone_size setting left here.
On a related note, I think we need to add the same setting to the default machine descriptor in setup_machine_fdt() so it gets set up correctly there too.
Arnd