Versatile Express infrastructure
Subsystems (11)
cover Versatile Express infrastructure
Hi All,
This series is a complete set of patches implementing platform control infrastructure, clocking etc. It is sent as a one off for completeness, but eventually ambakmi, hwmon and regulators patches will go through their subsystems.
The clocking patches depend on Linus Walleij's "clk: convert ARM RealView to common clk" and should go through Mike Turquette's tree. I am a little bit worried about merging this, as it depends on the "config_bus" infrastructure which should go through arm-soc. Any ideas and suggestions more then welcome.
Most of the random bits and pieces (reset controllers and alike) are located in drivers/misc/vexpress now, and I'm more than happy to move them if anyone has better idea.
Regards
Pawel
Pawel Moll (11):
input: ambakmi: Add missing clk_[un]prepare() calls
misc: Versatile Express config bus infrastructure
misc: Versatile Express reset driver
misc: Versatile Express display muxer driver
clk: Versatile Express clock generators ("osc") driver
clk: Common clocks implementation for Versatile Express
regulators: Versatile Express regulator driver
hwmon: Versatile Express hwmon driver
misc: Versatile Express system registers driver
ARM: vexpress: Add config bus components and clocks to DTs
ARM: vexpress: Start using new Versatile Express infrastructure
Documentation/devicetree/bindings/arm/vexpress.txt | 173 +++++- arch/arm/Kconfig | 4 +- arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 136 ++++- arch/arm/boot/dts/vexpress-v2m.dtsi | 136 ++++- arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts | 103 ++++ arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 169 ++++++ arch/arm/boot/dts/vexpress-v2p-ca5s.dts | 71 +++ arch/arm/boot/dts/vexpress-v2p-ca9.dts | 121 ++++ arch/arm/include/asm/hardware/sp810.h | 6 +- arch/arm/mach-vexpress/ct-ca9x4.c | 37 +- arch/arm/mach-vexpress/include/mach/motherboard.h | 81 --- arch/arm/mach-vexpress/platsmp.c | 3 +- arch/arm/mach-vexpress/v2m.c | 321 +++-------- drivers/clk/Kconfig | 8 +- drivers/clk/versatile/Makefile | 2 + drivers/clk/versatile/clk-vexpress-osc.c | 154 +++++ drivers/clk/versatile/clk-vexpress.c | 174 ++++++ drivers/hwmon/Kconfig | 8 + drivers/hwmon/Makefile | 1 + drivers/hwmon/vexpress.c | 275 +++++++++ drivers/input/serio/ambakmi.c | 9 +- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/vexpress/Kconfig | 5 + drivers/misc/vexpress/Makefile | 4 + drivers/misc/vexpress/config_bus.c | 596 ++++++++++++++++++++ drivers/misc/vexpress/display.c | 197 +++++++ drivers/misc/vexpress/reset.c | 110 ++++ drivers/misc/vexpress/sysreg.c | 423 ++++++++++++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/vexpress.c | 144 +++++ include/linux/vexpress.h | 150 +++++ 33 files changed, 3257 insertions(+), 374 deletions(-) create mode 100644 drivers/clk/versatile/clk-vexpress-osc.c create mode 100644 drivers/clk/versatile/clk-vexpress.c create mode 100644 drivers/hwmon/vexpress.c create mode 100644 drivers/misc/vexpress/Kconfig create mode 100644 drivers/misc/vexpress/Makefile create mode 100644 drivers/misc/vexpress/config_bus.c create mode 100644 drivers/misc/vexpress/display.c create mode 100644 drivers/misc/vexpress/reset.c create mode 100644 drivers/misc/vexpress/sysreg.c create mode 100644 drivers/regulator/vexpress.c create mode 100644 include/linux/vexpress.h
Signature · 1 line
1.7.9.5
PATCH 1/11 input: ambakmi: Add missing clk_[un]prepare() calls
Clocks must be prepared before enabling and unprepared after disabling. Without that clk_enable() fails with warning.
--- drivers/input/serio/ambakmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/input/serio/ambakmi.c +8 -1
@@ -72,10 +72,14 @@ static int amba_kmi_open(struct serio *io)unsigned int divisor;int ret; - ret =clk_enable (kmi->clk); + ret =clk_prepare (kmi->clk);if (ret) goto out; + ret =clk_enable (kmi->clk); +if (ret) + goto clk_unprepare; + divisor =clk_get_rate (kmi->clk) /8000000 -1 ;writeb (divisor,KMICLKDIV );writeb (KMICR_EN ,KMICR );
@@ -93,6 +97,8 @@ static int amba_kmi_open(struct serio *io) clk_disable:clk_disable (kmi->clk); + clk_unprepare: +clk_unprepare (kmi->clk); out:return ret; }
@@ -105,6 +111,7 @@ static void amba_kmi_close(struct serio *io)free_irq (kmi->irq, kmi);clk_disable (kmi->clk); +clk_unprepare (kmi->clk); } static int __devinit amba_kmi_probe(struct amba_device *dev,
Signature · 1 line
1.7.9.5
PATCH 1/11 input: ambakmi: Add missing clk_[un]prepare() calls
Pawel,
Le Mon, 3 Sep 2012 17:25:21 +0100,
Pawel Moll <[email protected]> a ?crit :
Quoted 16 lines
Clocks must be prepared before enabling and unprepared after disabling. Without that
clk_enable()fails with warning.Signed-off-by Pawel Moll <[email protected]>--- drivers/input/serio/ambakmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/input/serio/ambakmi.c +0
-0@@ -72,10 +72,14 @@ static int amba_kmi_open(struct serio *io)unsigned int divisor;int ret;
drivers/input/serio/ambakmi.c static int amba_kmi_open(struct serio *io) · line 82
Quoted 10 lines
drivers/input/serio/ambakmi.c +5
-1- ret =clk_enable (kmi->clk); + ret =clk_prepare (kmi->clk);if (ret) goto out; + ret =clk_enable (kmi->clk); +if (ret) + goto clk_unprepare; +
What about using clk_prepare_enable() here?
drivers/input/serio/ambakmi.c static void amba_kmi_close(struct serio *io) · line 114
Quoted 3 lines
drivers/input/serio/ambakmi.c +1
-0free_irq (kmi->irq, kmi);clk_disable (kmi->clk); +clk_unprepare (kmi->clk);
And clk_disable_unprepare() here?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/11 input: ambakmi: Add missing clk_[un]prepare() calls
Quoted 18 lines · Thomas Petazzoni
Quoted 5 lines
drivers/input/serio/ambakmi.c +0
-0@@ -72,10 +72,14 @@ static int amba_kmi_open(struct serio *io)unsigned int divisor;int ret;drivers/input/serio/ambakmi.c static int amba_kmi_open(struct serio *io) · line 82
Quoted 10 lines
drivers/input/serio/ambakmi.c +5
-1- ret =clk_enable (kmi->clk); + ret =clk_prepare (kmi->clk);if (ret) goto out; + ret =clk_enable (kmi->clk); +if (ret) + goto clk_unprepare; +What about using
clk_prepare_enable()here?
Quoted 5 lines
drivers/input/serio/ambakmi.c static void amba_kmi_close(struct serio *io) · line 114
Quoted 3 lines
drivers/input/serio/ambakmi.c +1
-0free_irq (kmi->irq, kmi);clk_disable (kmi->clk); +clk_unprepare (kmi->clk);And
clk_disable_unprepare()here?
Sure thing, thanks for pointing that out!
Pawel
PATCH 2/11 misc: Versatile Express config bus infrastructure
In reply to Pawel MollVersatile Express platform has an elaborated configuration system, consisting of microcontrollers residing on the mother- and daughterboards known as Motherboard/Daughterboard Configuration Controller (MCC and DCC). The controllers are responsible for the platform initialization (reset generation, flash programming, FPGA bitfiles loading etc.) but also control clock generators, voltage regulators, gather environmental data like temperature, power consumption etc. Even the video output switch (FPGA) is controlled that way.
Those devices are _not_ visible in the main address space and the usual communication channel uses some kind of a bridge in the peripheral block sending commands (requests) to the controllers and receiving responses. It can take up to 500 microseconds for a transaction to be completed, therefore it is important to provide a non-blocking interface to it.
This patch adds an abstraction of this infrastructure in a form of "config bus".
The devices (and their functions) are addressed by: site number (motherboard is 0, daughterboard sites 1 and 2), position in the boards stack (eg. logic tiles are often stacked on top of each other), controller number (boards can have more then one controller) and the device number (eg. oscillators 1 to 5, temperature sensors 1 to 3 etc.).
Function number (eg. oscillator is 1, temperature sensor is 4) is common across all system and is used to bind devices with respective drivers. Static devices can use defined constants, devices instantiated from a DT should use appropriate compatible values that will be translated into numbers during device creation.
--- Documentation/devicetree/bindings/arm/vexpress.txt | 154 ++++- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/vexpress/Kconfig | 5 + drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/config_bus.c | 596 ++++++++++++++++++++ include/linux/vexpress.h | 120 ++++ 7 files changed, 877 insertions(+), 1 deletion(-) create mode 100644 drivers/misc/vexpress/Kconfig create mode 100644 drivers/misc/vexpress/Makefile create mode 100644 drivers/misc/vexpress/config_bus.c create mode 100644 include/linux/vexpress.h
Documentation/devicetree/bindings/arm/vexpress.txt +153 -1
@@ -11,6 +11,10 @@ the motherboard file using a /include/ directive. As the motherboard can be initialized in one of two different configurations ("memory maps"), care must be taken to include the correct one. + +Root node +--------- + Required properties in the root node: - compatible value: compatible = "arm,vexpress,<model>", "arm,vexpress";
@@ -45,6 +49,10 @@ Optional properties in the root node: - Coretile Express A9x4 (V2P-CA9) HBI-0225: arm,hbi = <0x225>; + +CPU nodes +--------- + Top-level standard "cpus" node is required. It must contain a node with device_type = "cpu" property for every available core, eg.:
@@ -59,6 +67,10 @@ with device_type = "cpu" property for every available core, eg.: }; }; + +Motherboard node +---------------- + The motherboard description file provides a single "motherboard" node using 2 address cells corresponding to the Static Memory Bus used between the motherboard and the tile. The first cell defines the Chip
@@ -96,7 +108,132 @@ The tile description must define "ranges", "interrupt-map-mask" and "interrupt-map" properties to translate the motherboard's address and interrupt space into one used by the tile's processor. -Abbreviated example: + +Configuration bus +----------------- + +Versatile Express platform has an elaborated configuration system, +consisting of microcontrollers residing on the mother- and +daughterboards known as Motherboard/Daughterboard Configuration +Controller (MCC and DCC). The controllers are responsible for +the platform initialization (reset generation, flash programming, +FPGA bitfiles loading etc.) but also control clock generators, +voltage regulators, gather environmental data like temperature, +power consumption etc. Even the video output switch (FPGA) is +controlled that way. + +Those devices are _not_ visible in the main address space and +are addressed by: site number (motherboard is 0, daughterboard +sites 1 and 2), position in the boards stack (eg. logic tiles +are often stacked on top of each other), controller number +(boards can have more then one controller) and the device number +(eg. oscillators 1 to 5, temperature sensors 1 to 3 etc.). + +They should be by a separate node of the device tree, called +"dcc" or "mcc", with the following required properties: +- site number: + arm,vexpress,site = <number>; + where 0 means motherboard, 1 or 2 are daugtherboard sites, + 0xff means "master" site (site containing main CPU tile) +- address and size cells for the children + #address-cells = <1>; + #size-cells = <0>; + +Optional properties: +- position and/or controller number: + arm,vexpress,position = <number>; + arm,vexpress,dcc = <number>; + if not defined, the numbers default to zero. + +The controller's node children define functions of all +devices available through the controller. The compatible +value defines the function, the reg value defines the +device number. + +- clock generators: + osc@<device> { + compatible = "arm,vexpress-config,osc"; + reg = <device>; + freq-range = <freq_min freq_max>; + #clock-cells = <0>; + clock-output-names = "<name>"; + }; + +- voltage regulators: + volt@<device> { + compatible = "arm,vexpress-config,volt"; + reg = <device>; + regulator-name = "<name>"; + regulator-always-on; + }; + +- current meters: + amp@<device> { + compatible = "arm,vexpress-config,amp"; + reg = <device>; + label = "<name>"; + }; + +- temperature sensors: + temp@<device> { + compatible = "arm,vexpress-config,temp"; + reg = <device>; + label = "<name>"; + }; + +- reset generator: + reset@<device> { + compatible = "arm,vexpress-config,reset"; + reg = <device>; + }; + +- SCC registers access: + scc@<device> { + compatible = "arm,vexpress-config,scc"; + reg = <device>; + }; + +- DVI muxing (switching) FPGAs: + muxfpga@<device> { + compatible = "arm,vexpress-config,muxfpga"; + reg = <device>; + }; + +- power supply control: + shutdown@<device> { + compatible = "arm,vexpress-config,shutdown"; + reg = <0>; + }; + reboot@<device> { + compatible = "arm,vexpress-config,reboot"; + reg = <device>; + }; + +- DVI formatter mode control: + dvimode@<device> { + compatible = "arm,vexpress-config,dvimode"; + reg = <device>; + }; + +- instant power monitors: + power@<device> { + compatible = "arm,vexpress-config,power"; + reg = <device>; + label = "<name>"; + }; + +- continuous energy consumption monitors: + energy@<device> { + compatible = "arm,vexpress-config,energy"; + reg = <device>; + label = "<name>"; + }; + Note: Amount of the consumed energy is available as a 64-bit + value, in two consecutive registers. + + +Example of a VE tile description (simplified) +--------------------------------------------- /dts-v1/;
@@ -141,6 +278,21 @@ Abbreviated example: /* Active high IRQ 0 is connected to GIC's SPI0 */ interrupt-map = <0 0 0 &gic 0 0 4>; }; + + dcc at 0 { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <0>; + arm,vexpress,site = <0xff>; /* Master site */ + + osc at 0 { + compatible = "arm,vexpress-config,osc"; + reg = <0>; + freq-range = <50000000 100000000>; + #clock-cells = <1>; + clock-output-names = "oscclk0"; + }; + }; }; /include/ "vexpress-v2m-rs1.dtsi"
drivers/misc/Kconfig +1 -0
@@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" +source "drivers/misc/vexpress/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -50,3 +50,4 @@ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ obj-$(CONFIG_INTEL_MEI) += mei/ +obj-y += vexpress/
drivers/misc/vexpress/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config VEXPRESS_CONFIG_BUS + bool + help + Infrastructure for the ARM Ltd. Versatile Expres platform + configuration bus.
drivers/misc/vexpress/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += config_bus.o
drivers/misc/vexpress/config_bus.c new file +596 -0
596 lines not on this page · raw message
include/linux/vexpress.h new file +120 -0
120 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerPATCH 2/11 misc: Versatile Express config bus infrastructure
Quoted 5 lines · Pawel Moll
Documentation/devicetree/bindings/arm/vexpress.txt +5
-0+ dcc at 0 { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <0>; + arm,vexpress,site = <0xff>; /* Master site */
Documentation/devicetree/bindings/arm/vexpress.txt Abbreviated example: · line 296
Quoted 10 lines
Documentation/devicetree/bindings/arm/vexpress.txt +9
-0+ + osc at 0 { + compatible = "arm,vexpress-config,osc"; + reg = <0>; + freq-range = <50000000 100000000>; + #clock-cells = <1>; + clock-output-names = "oscclk0"; + }; + }; };
The #interrupt-cells property seems misplaced here.
Quoted 13 lines
drivers/misc/Kconfig +1
-0@@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" +source "drivers/misc/vexpress/Kconfig" endmenudrivers/misc/Makefile +0
-0
drivers/misc/Makefile obj-y += carma/ · line 53
Quoted 4 lines
drivers/misc/Makefile +1
-0@@ -50,3 +50,4 @@ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ obj-$(CONFIG_INTEL_MEI) += mei/ +obj-y += vexpress/
This does not look like something that should go to drivers/misc (well, basically nothing ever does). How about drivers/mfd or drivers/bus instead?
drivers/misc/Makefile
Quoted 5 lines
drivers/misc/Makefile +5
-0+#define ADDR_FMT "%u.%x:%x:%x:%x" + +#define ADDR_ARGS(_ptr) \ + _ptr->func, _ptr->addr.site, _ptr->addr.position, \ + _ptr->addr.dcc, _ptr->addr.device
Can't you use dev_printk() to print the device name in the normal format?
drivers/misc/Makefile
Quoted 8 lines
drivers/misc/Makefile +8
-0+#define ADDR_TO_U64(addr) \ + (((u64)(addr).site << 32) | ((addr).position << 24) | \ + ((addr).dcc << 16) | (addr).device) + +static bool vexpress_config_early = true; +static DEFINE_MUTEX(vexpress_config_early_mutex); +static LIST_HEAD(vexpress_config_early_drivers); +static LIST_HEAD(vexpress_config_early_devices);
What is the reason for needing early devices that you have to keep in a list like this? If it's only for setup purposes, it's probably easier to have a platform hook that probes the hardware you want to initialize at boot time and only start using the device method at device init time.
Quoted 11 lines
drivers/misc/Makefile +11
-0+static int vexpress_config_match(struct device *dev, struct device_driver *drv) +{ + struct vexpress_config_device *vecdev = to_vexpress_config_device(dev); + struct vexpress_config_driver *vecdrv = to_vexpress_config_driver(drv); + + if (vecdrv->funcs) { + const unsigned *func = vecdrv->funcs; + + while (*func) { + if (*func == vecdev->func) + return 1;
drivers/misc/Makefile
Quoted 10 lines
drivers/misc/Makefile +10
-0+ func++; + } + } + + return 0; +} + +static struct device vexpress_config_bus = { + .init_name = "vexpress-config", +};
No static devices in new code please. Just put it into the device tree.
drivers/misc/Makefile
Quoted 4 lines
drivers/misc/Makefile +4
-0+struct bus_type vexpress_config_bus_type = { + .name = "vexpress-config", + .match = vexpress_config_match, +};
What is the reason for having a separate bus_type here? Is this a discoverable bus? If it is, why do you need a device tree binding for the child devices?
Quoted 11 lines
drivers/misc/Makefile +11
-0+#define VEXPRESS_COMPATIBLE_TO_FUNC(_compatible, _func) \ + { \ + .compatible = "arm,vexpress-config," _compatible, \ + .data = (void *)VEXPRESS_CONFIG_FUNC_##_func \ + } + +static struct of_device_id vexpress_config_devices_matches[] = { + VEXPRESS_COMPATIBLE_TO_FUNC("osc", OSC), + VEXPRESS_COMPATIBLE_TO_FUNC("volt", VOLT), + VEXPRESS_COMPATIBLE_TO_FUNC("amp", AMP), + VEXPRESS_COMPATIBLE_TO_FUNC("temp", TEMP),
drivers/misc/Makefile
Quoted 10 lines
drivers/misc/Makefile +10
-0+ VEXPRESS_COMPATIBLE_TO_FUNC("reset", RESET), + VEXPRESS_COMPATIBLE_TO_FUNC("scc", SCC), + VEXPRESS_COMPATIBLE_TO_FUNC("muxfpga", MUXFPGA), + VEXPRESS_COMPATIBLE_TO_FUNC("shutdown", SHUTDOWN), + VEXPRESS_COMPATIBLE_TO_FUNC("reboot", REBOOT), + VEXPRESS_COMPATIBLE_TO_FUNC("dvimode", DVIMODE), + VEXPRESS_COMPATIBLE_TO_FUNC("power", POWER), + VEXPRESS_COMPATIBLE_TO_FUNC("energy", ENERGY), + {}, +};
What is the purpose of this lookup? Can't you make the child devices get probed by the compatible value?
Quoted 50 lines
drivers/misc/Makefile +50
-0+static void vexpress_config_of_device_add(struct device_node *node) +{ + int err; + struct vexpress_config_device *vecdev; + const struct of_device_id *match; + u32 value; + + if (!of_device_is_available(node)) + return; + + vecdev = kzalloc(sizeof(*vecdev), GFP_KERNEL); + if (WARN_ON(!vecdev)) + return; + + vecdev->dev.of_node = of_node_get(node); + + vecdev->name = node->name; + + match = of_match_node(vexpress_config_devices_matches, node); + vecdev->func = (unsigned)match->data; + + err = of_property_read_u32(node->parent, "arm,vexpress,site", &value); + if (!err) + vecdev->addr.site = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,position", + &value); + if (!err) + vecdev->addr.position = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,dcc", &value); + if (!err) + vecdev->addr.dcc = value; + + err = of_property_read_u32(node, "reg", &value); + if (!err) { + vecdev->addr.device = value; + } else { + pr_err("Invalid reg property in '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return; + } + + err = vexpress_config_device_register(vecdev); + if (err) { + pr_err("Failed to add OF device '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return;
drivers/misc/Makefile
Quoted 10 lines
drivers/misc/Makefile +10
-0+ } +} + +void vexpress_config_of_populate(void) +{ + struct device_node *node; + + for_each_matching_node(node, vexpress_config_devices_matches) + vexpress_config_of_device_add(node); +}
This is unusual. Why do you only add the matching devices rather than all of them? Doing it your way also means O(n^2) rather than O(n) traversal through the list of children.
Quoted 23 lines
drivers/misc/Makefile +23
-0+int vexpress_config_device_register(struct vexpress_config_device *vecdev) +{ + pr_debug("Registering %sdevice '%s." ADDR_FMT "'\n", + vexpress_config_early ? "early " : "", + vecdev->name, ADDR_ARGS(vecdev)); + + if (vecdev->addr.site == VEXPRESS_SITE_MASTER) + vecdev->addr.site = vexpress_config_get_master_site(); + + if (!vecdev->bridge) { + spin_lock(&vexpress_config_bridges_lock); + vexpress_config_bridge_find(&vecdev->dev, NULL); + spin_unlock(&vexpress_config_bridges_lock); + } + + if (vexpress_config_early) { + list_add(&vecdev->early, &vexpress_config_early_devices); + vexpress_config_early_bind(); + + return 0; + } + + device_initialize(&vecdev->dev);
drivers/misc/Makefile
Quoted 10 lines
drivers/misc/Makefile +10
-0+ vecdev->dev.bus = &vexpress_config_bus_type; + if (!vecdev->dev.parent) + vecdev->dev.parent = &vexpress_config_bus; + + dev_set_name(&vecdev->dev, "%s." ADDR_FMT, + vecdev->name, ADDR_ARGS(vecdev)); + + return device_add(&vecdev->dev); +} +EXPORT_SYMBOL(vexpress_config_device_register);
Why is this exported to non-GPL drivers? It looks like the only caller should be in this file.
Arnd
PATCH 2/11 misc: Versatile Express config bus infrastructure
Hi Arnd,
Thanks for your time!
Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Pawel Moll
Documentation/devicetree/bindings/arm/vexpress.txt +9
-0+ dcc at 0 { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <0>; + arm,vexpress,site = <0xff>; /* Master site */ + + osc at 0 { + compatible = "arm,vexpress-config,osc"; + reg = <0>;
Quoted 8 lines
Documentation/devicetree/bindings/arm/vexpress.txt Abbreviated example: · line 296
Quoted 6 lines
Documentation/devicetree/bindings/arm/vexpress.txt +5
-0+ freq-range = <50000000 100000000>; + #clock-cells = <1>; + clock-output-names = "oscclk0"; + }; + }; };The #interrupt-cells property seems misplaced here.
Right. I'm not sure what I meant here, probably a cut-and-paste error.
Quoted 12 lines
Quoted 12 lines
drivers/misc/Kconfig +1
-0@@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" +source "drivers/misc/vexpress/Kconfig" endmenudrivers/misc/Makefile +0
-0
Quoted 8 lines
drivers/misc/Makefile obj-y += carma/ · line 53
Quoted 5 lines
drivers/misc/Makefile +1
-0@@ -50,3 +50,4 @@ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ obj-$(CONFIG_INTEL_MEI) += mei/ +obj-y += vexpress/This does not look like something that should go to
drivers/misc(well, basically nothing ever does). How aboutdrivers/mfdordrivers/businstead?
I don't see drivers/bus in 3.6-rc4? If there will be such thing, I guess I can move config_bus.c to drivers/bus/vexpress-config.c, display.c to drivers/video/vexpress-display.c (see my other answer), sysreg.c to drivers/mfd/vexpress-sysreg.c (it is a multifunction device indeed, not argument about that), but reset.c seems to me should stay as drivers/misc/vexpress-reset.c - it's hardly a mfd...
Quoted 7 lines
drivers/misc/Makefile
Quoted 5 lines
drivers/misc/Makefile +5
-0+#define ADDR_FMT "%u.%x:%x:%x:%x" + +#define ADDR_ARGS(_ptr) \ + _ptr->func, _ptr->addr.site, _ptr->addr.position, \ + _ptr->addr.dcc, _ptr->addr.deviceCan't you use
dev_printk()to print the device name in the normal format?
Well, in some places it's used before dev_set_name(), but I guess I can get rid of those printk-s (they are debug messages anyway).
Quoted 5 lines
Quoted 5 lines
drivers/misc/Makefile +5
-0+#define ADDR_TO_U64(addr) \ + (((u64)(addr).site << 32) | ((addr).position << 24) | \ + ((addr).dcc << 16) | (addr).device) + +static bool vexpress_config_early = true;
Quoted 8 lines
drivers/misc/Makefile
Quoted 3 lines
drivers/misc/Makefile +3
-0+static DEFINE_MUTEX(vexpress_config_early_mutex); +static LIST_HEAD(vexpress_config_early_drivers); +static LIST_HEAD(vexpress_config_early_devices);What is the reason for needing early devices that you have to keep in a list like this? If it's only for setup purposes, it's probably easier to have a platform hook that probes the hardware you want to initialize at boot time and only start using the device method at device init time.
Funnily enough the first version didn't have anything "early related"... Till I actually defined the real clock dependency in the tree :-(
So it's all about clocks, that must be available really early. The particular problem I faced was the amba_probe() trying to enable apb_pclk of each device and failing...
Now, during the clock registration the device model is not initialized yet, so I can't do normal devices registration. I've stolen some ideas from the early platform bus code...
Quoted 15 lines
Quoted 15 lines
drivers/misc/Makefile +15
-0+static int vexpress_config_match(struct device *dev, struct device_driver *drv) +{ + struct vexpress_config_device *vecdev = to_vexpress_config_device(dev); + struct vexpress_config_driver *vecdrv = to_vexpress_config_driver(drv); + + if (vecdrv->funcs) { + const unsigned *func = vecdrv->funcs; + + while (*func) { + if (*func == vecdev->func) + return 1; + func++; + } + } +
Quoted 8 lines
drivers/misc/Makefile
Quoted 6 lines
drivers/misc/Makefile +6
-0+ return 0; +} + +static struct device vexpress_config_bus = { + .init_name = "vexpress-config", +};No static devices in new code please. Just put it into the device tree.
Hm. This is just a dummy device serving as a default parent, similarly to:
struct device platform_bus = {
.init_name = "platform",
};EXPORT_SYMBOL_GPL(platform_bus);
Without that I can see two options:
1. Create some kind of a device (platform?) for the dcc/mcc node and use it as a parent.
2. Scan the device tree "downwards" searching for a node that has a device already associated with it (but this may not work at the early stage).
Quoted 8 lines
drivers/misc/Makefile
Quoted 4 lines
drivers/misc/Makefile +4
-0+struct bus_type vexpress_config_bus_type = { + .name = "vexpress-config", + .match = vexpress_config_match, +};What is the reason for having a separate
bus_typehere? Is this a discoverable bus? If it is, why do you need a device tree binding for the child devices?
It is not a discoverable bus, but the devices are very different from the "normal" platform devices and have specific read/write interface, so it seemed to me that a separate bus would make sense. And I didn't want to reinvent the wheel with my own "device/driver model".
Quoted 16 lines
Quoted 16 lines
drivers/misc/Makefile +16
-0+#define VEXPRESS_COMPATIBLE_TO_FUNC(_compatible, _func) \ + { \ + .compatible = "arm,vexpress-config," _compatible, \ + .data = (void *)VEXPRESS_CONFIG_FUNC_##_func \ + } + +static struct of_device_id vexpress_config_devices_matches[] = { + VEXPRESS_COMPATIBLE_TO_FUNC("osc", OSC), + VEXPRESS_COMPATIBLE_TO_FUNC("volt", VOLT), + VEXPRESS_COMPATIBLE_TO_FUNC("amp", AMP), + VEXPRESS_COMPATIBLE_TO_FUNC("temp", TEMP), + VEXPRESS_COMPATIBLE_TO_FUNC("reset", RESET), + VEXPRESS_COMPATIBLE_TO_FUNC("scc", SCC), + VEXPRESS_COMPATIBLE_TO_FUNC("muxfpga", MUXFPGA), + VEXPRESS_COMPATIBLE_TO_FUNC("shutdown", SHUTDOWN), + VEXPRESS_COMPATIBLE_TO_FUNC("reboot", REBOOT),
Quoted 8 lines
drivers/misc/Makefile
Quoted 5 lines
drivers/misc/Makefile +5
-0+ VEXPRESS_COMPATIBLE_TO_FUNC("dvimode", DVIMODE), + VEXPRESS_COMPATIBLE_TO_FUNC("power", POWER), + VEXPRESS_COMPATIBLE_TO_FUNC("energy", ENERGY), + {}, +};What is the purpose of this lookup? Can't you make the child devices get probed by the compatible value?
Ok, there are two reasons for this table existence:
1. vexpress_config_of_populate() below - I need a comprehensive list of compatible values to be able to search the tree and create respective devices.
2. Non-DT static devices - I need something to be able to match a driver with a device, and the "functions list" seemed appropriate.
Quoted 56 lines
Quoted 56 lines
drivers/misc/Makefile +56
-0+static void vexpress_config_of_device_add(struct device_node *node) +{ + int err; + struct vexpress_config_device *vecdev; + const struct of_device_id *match; + u32 value; + + if (!of_device_is_available(node)) + return; + + vecdev = kzalloc(sizeof(*vecdev), GFP_KERNEL); + if (WARN_ON(!vecdev)) + return; + + vecdev->dev.of_node = of_node_get(node); + + vecdev->name = node->name; + + match = of_match_node(vexpress_config_devices_matches, node); + vecdev->func = (unsigned)match->data; + + err = of_property_read_u32(node->parent, "arm,vexpress,site", &value); + if (!err) + vecdev->addr.site = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,position", + &value); + if (!err) + vecdev->addr.position = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,dcc", &value); + if (!err) + vecdev->addr.dcc = value; + + err = of_property_read_u32(node, "reg", &value); + if (!err) { + vecdev->addr.device = value; + } else { + pr_err("Invalid reg property in '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return; + } + + err = vexpress_config_device_register(vecdev); + if (err) { + pr_err("Failed to add OF device '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return; + } +} + +void vexpress_config_of_populate(void) +{ + struct device_node *node;
Quoted 8 lines
drivers/misc/Makefile
Quoted 4 lines
drivers/misc/Makefile +4
-0+ + for_each_matching_node(node, vexpress_config_devices_matches) + vexpress_config_of_device_add(node); +}This is unusual. Why do you only add the matching devices rather than all of them? Doing it your way also means O(n^2) rather than O(n) traversal through the list of children.
Em, I'm not sure what do you mean... The idea is shamelessly stolen from of_irq_init() and of_clk_init()...
Quoted 28 lines
Quoted 28 lines
drivers/misc/Makefile +28
-0+int vexpress_config_device_register(struct vexpress_config_device *vecdev) +{ + pr_debug("Registering %sdevice '%s." ADDR_FMT "'\n", + vexpress_config_early ? "early " : "", + vecdev->name, ADDR_ARGS(vecdev)); + + if (vecdev->addr.site == VEXPRESS_SITE_MASTER) + vecdev->addr.site = vexpress_config_get_master_site(); + + if (!vecdev->bridge) { + spin_lock(&vexpress_config_bridges_lock); + vexpress_config_bridge_find(&vecdev->dev, NULL); + spin_unlock(&vexpress_config_bridges_lock); + } + + if (vexpress_config_early) { + list_add(&vecdev->early, &vexpress_config_early_devices); + vexpress_config_early_bind(); + + return 0; + } + + device_initialize(&vecdev->dev); + vecdev->dev.bus = &vexpress_config_bus_type; + if (!vecdev->dev.parent) + vecdev->dev.parent = &vexpress_config_bus; + + dev_set_name(&vecdev->dev, "%s." ADDR_FMT,
Quoted 8 lines
drivers/misc/Makefile
Quoted 5 lines
drivers/misc/Makefile +5
-0+ vecdev->name, ADDR_ARGS(vecdev)); + + return device_add(&vecdev->dev); +} +EXPORT_SYMBOL(vexpress_config_device_register);Why is this exported to non-GPL drivers? It looks like the only caller should be in this file.
Hm. There's no hidden agenda behind the non-GPL export, if that's what you are afraid of ;-) Now, why it is exported at all? Because platform_device_register is, I suppose (you can tell that I was looking at the platform bus code ;-). The non-DT platform code is using it, so it can't be static, but I wouldn't really expect any module to use it. So I can make it EXPORT_SYMBOL_GPL or drop it, no problem.
Cheers!
Pawel
Arnd Bergmann
maintainerPATCH 2/11 misc: Versatile Express config bus infrastructure
Quoted 24 lines · Pawel Moll
Quoted 14 lines · Arnd Bergmann
Quoted 12 lines · Pawel Moll
drivers/misc/Kconfig +1
-0@@ -517,4 +517,5 @@ source "drivers/misc/lis3lv02d/Kconfig" source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" +source "drivers/misc/vexpress/Kconfig" endmenudrivers/misc/Makefile +0
-0Quoted 8 lines
drivers/misc/Makefile obj-y += carma/ · line 53
Quoted 5 lines
drivers/misc/Makefile +1
-0@@ -50,3 +50,4 @@ obj-y += carma/ obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o obj-$(CONFIG_ALTERA_STAPL) +=altera-stapl/ obj-$(CONFIG_INTEL_MEI) += mei/ +obj-y += vexpress/This does not look like something that should go to
drivers/misc(well, basically nothing ever does). How aboutdrivers/mfdordrivers/businstead?
Quoted 6 lines
I don't see
drivers/busin 3.6-rc4? If there will be such thing, I guess I can moveconfig_bus.ctodrivers/bus/vexpress-config.c,display.ctodrivers/video/vexpress-display.c(see my other answer),sysreg.ctodrivers/mfd/vexpress-sysreg.c(it is a multifunction device indeed, not argument about that), butreset.cseems to me should stay asdrivers/misc/vexpress-reset.c- it's hardly a mfd...
We're adding drivers/bus in v3.7, I already have another bus driver in the arm-soc tree.
The reset code can probably just go to arch/arm/mach-vexpress though, we do the same for the reset code on all other platforms.
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
drivers/misc/Makefile +5
-0+#define ADDR_TO_U64(addr) \ + (((u64)(addr).site << 32) | ((addr).position << 24) | \ + ((addr).dcc << 16) | (addr).device) + +static bool vexpress_config_early = true;Quoted 8 lines
drivers/misc/Makefile
Quoted 3 lines
drivers/misc/Makefile +3
-0+static DEFINE_MUTEX(vexpress_config_early_mutex); +static LIST_HEAD(vexpress_config_early_drivers); +static LIST_HEAD(vexpress_config_early_devices);What is the reason for needing early devices that you have to keep in a list like this? If it's only for setup purposes, it's probably easier to have a platform hook that probes the hardware you want to initialize at boot time and only start using the device method at device init time.
Funnily enough the first version didn't have anything "early related"... Till I actually defined the real clock dependency in the tree :-(
Quoted 7 lines
So it's all about clocks, that must be available really early. The particular problem I faced was the
amba_probe()trying to enableapb_pclkof each device and failing...Now, during the clock registration the device model is not initialized yet, so I can't do normal devices registration. I've stolen some ideas from the early platform bus code...
Maybe you can change amba_probe() to provide a -EPROBE_DEFER return code to the caller when the clock is not yet there, it should then just come back later.
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
drivers/misc/Makefile +15
-0+static int vexpress_config_match(struct device *dev, struct device_driver *drv) +{ + struct vexpress_config_device *vecdev = to_vexpress_config_device(dev); + struct vexpress_config_driver *vecdrv = to_vexpress_config_driver(drv); + + if (vecdrv->funcs) { + const unsigned *func = vecdrv->funcs; + + while (*func) { + if (*func == vecdev->func) + return 1; + func++; + } + } +Quoted 8 lines
drivers/misc/Makefile
Quoted 6 lines
drivers/misc/Makefile +6
-0+ return 0; +} + +static struct device vexpress_config_bus = { + .init_name = "vexpress-config", +};No static devices in new code please. Just put it into the device tree.
Quoted 7 lines
Hm. This is just a dummy device serving as a default parent, similarly to:
struct device
platform_bus= {
.init_name = "platform",
};EXPORT_SYMBOL_GPL(platform_bus);
The platform bus is very special, you should try not to use it as an example for other buses ;-)
Quoted 7 lines
Without that I can see two options:
1. Create some kind of a device (platform?) for the dcc/mcc node and use it as a parent.
2. Scan the device tree "downwards" searching for a node that has a device already associated with it (but this may not work at the early stage).
I think 1. would be logical. The device should actually be created by the device tree probe anyway.
Quoted 9 lines
Quoted 8 lines
drivers/misc/Makefile
Quoted 4 lines
drivers/misc/Makefile +4
-0+struct bus_type vexpress_config_bus_type = { + .name = "vexpress-config", + .match = vexpress_config_match, +};What is the reason for having a separate
bus_typehere? Is this a discoverable bus? If it is, why do you need a device tree binding for the child devices?
Quoted 4 lines
It is not a discoverable bus, but the devices are very different from the "normal" platform devices and have specific read/write interface, so it seemed to me that a separate bus would make sense. And I didn't want to reinvent the wheel with my own "device/driver model".
Not introducing a different way to do devices is good, but I don't think that using something else than platform devices buys you much. If it's not discoverable, this driver does not look all that different from an MFD (which is based on platform devices).
A new bus type is typically used only for cases where you have multiple different bus drivers and multiple different device drivers, and want a bus layer to proxy between them. In your case, it seems you have only a single device driver providing devices, and it just gets them by looking at the device tree, so there is no real need for a bus_type.
Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
drivers/misc/Makefile +16
-0+#define VEXPRESS_COMPATIBLE_TO_FUNC(_compatible, _func) \ + { \ + .compatible = "arm,vexpress-config," _compatible, \ + .data = (void *)VEXPRESS_CONFIG_FUNC_##_func \ + } + +static struct of_device_id vexpress_config_devices_matches[] = { + VEXPRESS_COMPATIBLE_TO_FUNC("osc", OSC), + VEXPRESS_COMPATIBLE_TO_FUNC("volt", VOLT), + VEXPRESS_COMPATIBLE_TO_FUNC("amp", AMP), + VEXPRESS_COMPATIBLE_TO_FUNC("temp", TEMP), + VEXPRESS_COMPATIBLE_TO_FUNC("reset", RESET), + VEXPRESS_COMPATIBLE_TO_FUNC("scc", SCC), + VEXPRESS_COMPATIBLE_TO_FUNC("muxfpga", MUXFPGA), + VEXPRESS_COMPATIBLE_TO_FUNC("shutdown", SHUTDOWN), + VEXPRESS_COMPATIBLE_TO_FUNC("reboot", REBOOT),Quoted 8 lines
drivers/misc/Makefile
Quoted 5 lines
drivers/misc/Makefile +5
-0+ VEXPRESS_COMPATIBLE_TO_FUNC("dvimode", DVIMODE), + VEXPRESS_COMPATIBLE_TO_FUNC("power", POWER), + VEXPRESS_COMPATIBLE_TO_FUNC("energy", ENERGY), + {}, +};What is the purpose of this lookup? Can't you make the child devices get probed by the compatible value?
Quoted 5 lines
Ok, there are two reasons for this table existence:
1.
vexpress_config_of_populate()below - I need a comprehensive list of compatible values to be able to search the tree and create respective devices.
I don't see why you need this list. Just call of_platform_populate or a copy of that. It does not require the compatible values of the devices, just the one for the parent.
Quoted 2 lines
2. Non-DT static devices - I need something to be able to match a driver with a device, and the "functions list" seemed appropriate.
How important is this case really, given that the driver has never been supported and that the non-DT case is going away soon?
Quoted 65 lines
Quoted 56 lines
Quoted 56 lines
drivers/misc/Makefile +56
-0+static void vexpress_config_of_device_add(struct device_node *node) +{ + int err; + struct vexpress_config_device *vecdev; + const struct of_device_id *match; + u32 value; + + if (!of_device_is_available(node)) + return; + + vecdev = kzalloc(sizeof(*vecdev), GFP_KERNEL); + if (WARN_ON(!vecdev)) + return; + + vecdev->dev.of_node = of_node_get(node); + + vecdev->name = node->name; + + match = of_match_node(vexpress_config_devices_matches, node); + vecdev->func = (unsigned)match->data; + + err = of_property_read_u32(node->parent, "arm,vexpress,site", &value); + if (!err) + vecdev->addr.site = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,position", + &value); + if (!err) + vecdev->addr.position = value; + + err = of_property_read_u32(node->parent, "arm,vexpress,dcc", &value); + if (!err) + vecdev->addr.dcc = value; + + err = of_property_read_u32(node, "reg", &value); + if (!err) { + vecdev->addr.device = value; + } else { + pr_err("Invalid reg property in '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return; + } + + err = vexpress_config_device_register(vecdev); + if (err) { + pr_err("Failed to add OF device '%s'! (%d)\n", + node->full_name, err); + kfree(vecdev); + return; + } +} + +void vexpress_config_of_populate(void) +{ + struct device_node *node;Quoted 8 lines
drivers/misc/Makefile
Quoted 4 lines
drivers/misc/Makefile +4
-0+ + for_each_matching_node(node, vexpress_config_devices_matches) + vexpress_config_of_device_add(node); +}This is unusual. Why do you only add the matching devices rather than all of them? Doing it your way also means O(n^2) rather than O(n) traversal through the list of children.
Quoted 2 lines
Em, I'm not sure what do you mean... The idea is shamelessly stolen from
of_irq_init()andof_clk_init()...
But those are not buses, they are infrastructure that is used across buses. The regular way to do this is to register a driver for your parent node and then just iterate over the children, in the way that we do for e.g. i2c or spi buses.
Quoted 11 lines
Quoted 4 lines
Quoted 1 line
+EXPORT_SYMBOL(vexpress_config_device_register);
Why is this exported to non-GPL drivers? It looks like the only caller should be in this file.
Hm. There's no hidden agenda behind the non-GPL export, if that's what you are afraid of ;-) Now, why it is exported at all? Because
platform_device_registeris, I suppose (you can tell that I was looking at the platform bus code ;-). The non-DT platform code is using it, so it can't be static, but I wouldn't really expect any module to use it. So I can make itEXPORT_SYMBOL_GPLor drop it, no problem.
Ok. I'd say just drop it then.
Arnd
PATCH 2/11 misc: Versatile Express config bus infrastructure
Quoted 5 lines · Arnd Bergmann
We're adding
drivers/busin v3.7, I already have another bus driver in the arm-soc tree.The reset code can probably just go to
arch/arm/mach-vexpressthough, we do the same for the reset code on all other platforms.
Hm, ok, let's make it so. Of course the question is what will the arm64 use, but I'll ignore it for the moment.
Quoted 11 lines
Quoted 7 lines
So it's all about clocks, that must be available really early. The particular problem I faced was the
amba_probe()trying to enableapb_pclkof each device and failing...Now, during the clock registration the device model is not initialized yet, so I can't do normal devices registration. I've stolen some ideas from the early platform bus code...
Maybe you can change
amba_probe()to provide a -EPROBE_DEFER return code to the caller when the clock is not yet there, it should then just come back later.
Hm. I'm honestly a little bit afraid to propose that, but I'll see how would this work.
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
drivers/misc/vexpress/config_bus.c line 67
Quoted 4 lines
drivers/misc/vexpress/config_bus.c new file +4
-0+struct bus_type vexpress_config_bus_type = { + .name ="vexpress-config" , + .match = vexpress_config_match, +};What is the reason for having a separate
bus_typehere? Is this a discoverable bus? If it is, why do you need a device tree binding for the child devices?Quoted 4 lines
It is not a discoverable bus, but the devices are very different from the "normal" platform devices and have specific read/write interface, so it seemed to me that a separate bus would make sense. And I didn't want to reinvent the wheel with my own "device/driver model".
Quoted 4 lines
Not introducing a different way to do devices is good, but I don't think that using something else than platform devices buys you much. If it's not discoverable, this driver does not look all that different from an MFD (which is based on platform devices).
Generally you seem to suggest using the MFD "micro-framework" instead... (quite frankly I wasn't aware of its existence till now_. Ok, I'll try to use it instead of a custom bus. I have some doubts (eg. not quite sure what to do with the resources and "reg" properties), but I'll give it a go.
Quoted 3 lines
A new bus type is typically used only for cases where you have multiple different bus drivers and multiple different device drivers, and want a bus layer to proxy between them.
I'm not sure what do you mean by "bus driver", but to my mind the buses are just a way of binding devices and their drivers of a particular variety. And the VE config bus is of a very specific variety indeed :-)
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
What is the purpose of this lookup? Can't you make the child devices get probed by the compatible value?
Ok, there are two reasons for this table existence:
Quoted 7 lines
Quoted 3 lines
1.
vexpress_config_of_populate()below - I need a comprehensive list of compatible values to be able to search the tree and create respective devices.I don't see why you need this list. Just call
of_platform_populateor a copy of that. It does not require the compatible values of the devices, just the one for the parent.
... but of course it only creates platform devices. So as long as
Quoted 5 lines
Quoted 2 lines
2. Non-DT static devices - I need something to be able to match a driver with a device, and the "functions list" seemed appropriate.
How important is this case really, given that the driver has never been supported and that the non-DT case is going away soon?
The non-DT code used to use v2m_cfg_write() calls to do restart/power_off and to control video output. So I felt obliged to provide the same functionality.
Quoted 7 lines
Quoted 2 lines
Em, I'm not sure what do you mean... The idea is shamelessly stolen from
of_irq_init()andof_clk_init()...But those are not buses, they are infrastructure that is used across buses. The regular way to do this is to register a driver for your parent node and then just iterate over the children, in the way that we do for e.g. i2c or spi buses.
Ok, I see what you mean, although this is a slightly different case than SPI - there's no single master and straight hierarchy of the devices... To use the I2C analogy - it would be hard to describe a multi-master I2C segment (where one slave can be accessed by more than one master) with the current framework and bindings. And this is roughly the VE case - a device can be accessed through more than one bridge, and the way the transactions are routed can be quite convoluted (CPU->motherboard->IOFPGA->bridge->IOFPGA->motherboard micro->daugtherboard micro->device).
Anyway, I'll see what can be simplified here.
Cheers!
Pawe?
PATCH 3/11 misc: Versatile Express reset driver
In reply to Pawel MollThis is a simple vexpress config driver providing platform restart and power off functions.
By writing to the "active" attribute of the reboot or reset device, user can decide what if the platform is supposed to execute full power cycle (reboot, default) or simply assert system level reset signal.
--- drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/reset.c | 110 ++++++++++++++++++++++++++++++++++++++++ include/linux/vexpress.h | 4 ++ 3 files changed, 115 insertions(+) create mode 100644 drivers/misc/vexpress/reset.c
drivers/misc/vexpress/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += config_bus.o +obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += reset.o
drivers/misc/vexpress/reset.c new file +110 -0
110 lines not on this page · raw message
include/linux/vexpress.h +4 -0
@@ -117,4 +117,8 @@ int vexpress_config_read(struct vexpress_config_device *vecdev, int offset,int vexpress_config_write (struct vexpress_config_device *vecdev,int offset,u32 data); +/* Reset control */ +void vexpress_power_off (void ); +void vexpress_restart (char str,const char *cmd); +#endif
Signature · 1 line
1.7.9.5
PATCH 4/11 misc: Versatile Express display muxer driver
In reply to Pawel MollVersatile Express video output can be connected to one the three sources - motherboard's CLCD controller or a video signal generated by one of the daughterboards.
This driver configures the muxer FPGA so the output displays content of one of the framebuffers in the system (0 by default, can be changed by user writing to "fb" attribute of the muxfpga device). The decision is based on an educated guess in case of DT-less system or on the "arm,vexpress,site" property of the display controller's DT node.
It will also set up the display formatter mode and keep it up to date with mode changes requested by the user (eg. with fbset tool).
--- Documentation/devicetree/bindings/arm/vexpress.txt | 19 ++ drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/display.c | 197 ++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 drivers/misc/vexpress/display.c
Documentation/devicetree/bindings/arm/vexpress.txt +19 -0
@@ -232,6 +232,16 @@ device number. value, in two consecutive registers. +Display controller nodes +------------------------ + +All nodes describing display controllers connected to the VE's +multimedia bus (that is CLCD and HDLCD) should contain the +"arm,vexpress,site" property (see the previous section for +possible values) describing the controller's location in the +system. + + Example of a VE tile description (simplified) ---------------------------------------------
@@ -279,6 +289,15 @@ Example of a VE tile description (simplified) interrupt-map = <0 0 0 &gic 0 0 4>; }; + hdlcd at 2b000000 { + compatible = "arm,hdlcd"; + reg = <0 0x2b000000 0 0x1000>; + interrupts = <0 85 4>; + arm,vexpress,site = <0xff>; + clocks = <&oscclk3>; + clock-names = "pxlclk"; + }; + dcc at 0 { #address-cells = <1>; #size-cells = <0>;
drivers/misc/vexpress/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += config_bus.o +obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += display.o obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += reset.o
drivers/misc/vexpress/display.c new file +197 -0
197 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerPATCH 4/11 misc: Versatile Express display muxer driver
Quoted 8 lines · Pawel Moll
Signed-off-by Pawel Moll <[email protected]>--- Documentation/devicetree/bindings/arm/vexpress.txt | 19 ++ drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/display.c | 197 ++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 drivers/misc/vexpress/display.c
Shouldn't this go into the drivers/video directory?
Arnd
PATCH 4/11 misc: Versatile Express display muxer driver
Quoted 11 lines · Arnd Bergmann
Quoted 8 lines · Pawel Moll
Signed-off-by Pawel Moll <[email protected]>--- Documentation/devicetree/bindings/arm/vexpress.txt | 19 ++ drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/display.c | 197 ++++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 drivers/misc/vexpress/display.cShouldn't this go into the
drivers/videodirectory?
I sort of assumed that drivers/video contain frame buffer drivers only, but now I see there are some "control modules" there as well. Fine with me.
Cheers!
Pawel
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
In reply to Pawel MollThis driver provides a common clock framework hardware driver for Versatile Express clock generators (a.k.a "osc") controlled via the config bus.
--- arch/arm/include/asm/hardware/sp810.h | 2 + drivers/clk/versatile/Makefile | 1 + drivers/clk/versatile/clk-vexpress-osc.c | 154 ++++++++++++++++++++++++++++++ include/linux/vexpress.h | 9 ++ 4 files changed, 166 insertions(+) create mode 100644 drivers/clk/versatile/clk-vexpress-osc.c
arch/arm/include/asm/hardware/sp810.h +2 -0
@@ -56,6 +56,8 @@#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17)#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17) +#define SCCTRL_TIMERENnSEL_SHIFT (n) (15 + ((n) * 2)) +static inline void sysctl_soft_reset (void __iomem *base) {/* switch to slow mode */
drivers/clk/versatile/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_ICST) += clk-icst.o obj-$(CONFIG_ARCH_INTEGRATOR) += clk-integrator.o obj-$(CONFIG_ARCH_REALVIEW) += clk-realview.o +obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += clk-vexpress-osc.o
drivers/clk/versatile/clk-vexpress-osc.c new file +154 -0
154 lines not on this page · raw message
include/linux/vexpress.h +9 -0
@@ -121,4 +121,13 @@ int vexpress_config_write(struct vexpress_config_device *vecdev, int offset,void vexpress_power_off (void );void vexpress_restart (char str,const char *cmd); +/* Clock generators */ +struct vexpress_osc_info { +const char *clock_name; +unsigned long rate_min; +unsigned long rate_max; +const char *const *dev_ids; +}; +int vexpress_osc_driver_register (void ); +#endif
Signature · 1 line
1.7.9.5
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
Quoting Pawel Moll (2012-09-03 09:25:25)
Quoted 8 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +8
-0+static int vexpress_osc_probe (struct vexpress_config_device *vecdev) +{ +int err; +struct device_node *node = vecdev->dev.of_node; +struct vexpress_osc_info *info = vecdev->dev.platform_data; +struct clk_init_data init; +struct vexpress_osc *osc; +struct clk *clk;
drivers/clk/versatile/clk-vexpress-osc.c line 87
Quoted 10 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +10
-0+const char *const *dev_ids =NULL ; +u32 range[2 ]; + +if (vecdev->status &VEXPRESS_CONFIG_DEVICE_PROBED_EARLY ) +return 0 ; + + osc =kzalloc (sizeof (*osc),GFP_KERNEL ); +if (!osc) { + err = -ENOMEM ; + goto error;
Minor nitpick: the error label tries to free osc, which in this case shouldn't be freed because it is NULL.
<snip>
drivers/clk/versatile/clk-vexpress-osc.c line 137
Quoted 3 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +3
-0+error: +kfree (osc); +return err;
Would be better to have something like:
error_clk: kfree(osc); error_osc: return err;
Otherwise patch looks good to me. There are some changes to headers in this patch, and it is part of a larger series. How did you want the common clk patches to get merged?
Regards,
Mike
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
Hi Mike,
Quoted 23 lines · Mike Turquette
Quoting Pawel Moll (2012-09-03 09:25:25)
Quoted 8 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +8
-0+static int vexpress_osc_probe (struct vexpress_config_device *vecdev) +{ +int err; +struct device_node *node = vecdev->dev.of_node; +struct vexpress_osc_info *info = vecdev->dev.platform_data; +struct clk_init_data init; +struct vexpress_osc *osc; +struct clk *clk;drivers/clk/versatile/clk-vexpress-osc.c line 87
Quoted 10 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +10
-0+const char *const *dev_ids =NULL ; +u32 range[2 ]; + +if (vecdev->status &VEXPRESS_CONFIG_DEVICE_PROBED_EARLY ) +return 0 ; + + osc =kzalloc (sizeof (*osc),GFP_KERNEL ); +if (!osc) { + err = -ENOMEM ; + goto error;Minor nitpick: the error label tries to free osc, which in this case shouldn't be freed because it is NULL.
Quoted 4 lines
<snip>
Quoted 3 lines
drivers/clk/versatile/clk-vexpress-osc.c new file +3
-0+error: +kfree (osc); +return err;
$ grep kfree scripts/checkpatch.pl
# check for needless kfree() checks
if ($line =~ /\bkfree\(\Q$expr\E\);/) {
"kfree(NULL) is safe this check is probably not required\n" . $hereprev);$ grep -B2 kfree Documentation/CodingStyle ... out: kfree(buffer);
;-)
Quoted 3 lines
Otherwise patch looks good to me. There are some changes to headers in this patch, and it is part of a larger series. How did you want the common clk patches to get merged?
I'm re-working the series right now, but generally I planned to push drivers/clk changes via your tree, unless you want me to get it in through arm-soc.
Cheers!
Pawel
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
Quoted 1 line · Pawel Moll
On Mon, 2012-09-10 at 20:14 +0100, Mike Turquette wrote:
(...)
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ osc =
kzalloc(sizeof(*osc), GFP_KERNEL);
(...)
Quoted 4 lines
Quoted 4 lines
Minor nitpick: the error label tries to free osc, which in this case shouldn't be freed because it is NULL.
Quoted 1 line
+ kfree(osc);
(...)
Quoted 1 line
$ grep kfree scripts/checkpatch.pl
(...)
Quoted 1 line
$ grep -B2 kfree Documentation/CodingStyle
Can't you just use devm_kzalloc(&vecdev->dev, ...) and be done with it?
Yours,
Linus Walleij
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
Quoted 3 lines · Linus Walleij
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ osc =
kzalloc(sizeof(*osc), GFP_KERNEL);Can't you just use
devm_kzalloc(&vecdev->dev, ...)and be done with it?
Eh. It was devm_kzalloc() initially, then the driver became an "early" one and I could use devm_*(). I actually made it devm_kzalloc() again, hope it will survive like this to v2.
Pawe?
PATCH 5/11 clk: Versatile Express clock generators ("osc") driver
In reply to Pawel MollQuoting Pawel Moll (2012-09-11 09:10:48)
Quoted 4 lines
I'm re-working the series right now, but generally I planned to push
drivers/clkchanges via your tree, unless you want me to get it in through arm-soc.
I'm happy to take the clk patches. Just make it clear which patches you want to go through me (I think it's obvious which two, but clarity is always nice ;-)
Regards,
Mike
Quoted 11 lines
Cheers!
Pawel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 6/11 clk: Common clocks implementation for Versatile Express
In reply to Pawel MollThis patch adds a DT and non-DT based implementation of the common clock infrastructure for Versatile Express platform. It registers (statically or using DT) all required fixed clocks, initialises motherboard's SP810 cell (that provides clocks for SP804 timers) and explicitely registers VE "osc" driver, to make the clock generators availalable early.
--- drivers/clk/Kconfig | 8 +- drivers/clk/versatile/Makefile | 1 + drivers/clk/versatile/clk-vexpress.c | 174 ++++++++++++++++++++++++++++++++++ include/linux/vexpress.h | 4 + 4 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/versatile/clk-vexpress.c
drivers/clk/Kconfig +5 -3
@@ -42,9 +42,11 @@ config COMMON_CLK_WM831X config COMMON_CLK_VERSATILE tristate "Clock driver for ARM Reference designs" - depends on ARCH_INTEGRATOR || ARCH_REALVIEW + depends on ARCH_INTEGRATOR || ARCH_REALVIEW || ARCH_VEXPRESS ---help--- - Supports clocking on ARM Reference designs Integrator/AP, - Integrator/CP, RealView PB1176, EB, PB11MP and PBX. + Supports clocking on ARM Reference designs: + - Integrator/AP and Integrator/CP + - RealView PB1176, EB, PB11MP and PBX + - Versatile Express endmenu
drivers/clk/versatile/Makefile +1 -0
@@ -2,4 +2,5 @@ obj-$(CONFIG_ICST) += clk-icst.o obj-$(CONFIG_ARCH_INTEGRATOR) += clk-integrator.o obj-$(CONFIG_ARCH_REALVIEW) += clk-realview.o +obj-$(CONFIG_ARCH_VEXPRESS) += clk-vexpress.o obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += clk-vexpress-osc.o
drivers/clk/versatile/clk-vexpress.c new file +174 -0
174 lines not on this page · raw message
include/linux/vexpress.h +4 -0
@@ -130,4 +130,8 @@ struct vexpress_osc_info { };int vexpress_osc_driver_register (void ); +/* Clocks */ +void vexpress_clk_init (void __iomem *sp810_base); +void vexpress_clk_of_init (void ); +#endif
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerPATCH 6/11 clk: Common clocks implementation for Versatile Express
drivers/clk/versatile/clk-vexpress.c line 87
Quoted 9 lines · Pawel Moll
drivers/clk/versatile/clk-vexpress.c new file +9
-0+void __init vexpress_clk_init (void __iomem *sp810_base) +{ +struct clk *clk; +int i; + + clk =clk_register_fixed_rate (NULL ,"dummy_apb_pclk" ,NULL , +CLK_IS_ROOT ,0 ); +WARN_ON (clk_register_clkdev (clk,"apb_pclk" ,NULL )); +
Isn't it time to just remove the non-DT parts of vexpress? That would also simplify this driver.
Arnd
PATCH 6/11 clk: Common clocks implementation for Versatile Express
Quoted 13 lines · Arnd Bergmann
drivers/clk/versatile/clk-vexpress.c line 87
Quoted 9 lines · Pawel Moll
drivers/clk/versatile/clk-vexpress.c new file +9
-0+void __init vexpress_clk_init (void __iomem *sp810_base) +{ +struct clk *clk; +int i; + + clk =clk_register_fixed_rate (NULL ,"dummy_apb_pclk" ,NULL , +CLK_IS_ROOT ,0 ); +WARN_ON (clk_register_clkdev (clk,"apb_pclk" ,NULL )); +Isn't it time to just remove the non-DT parts of vexpress? That would also simplify this driver.
It would simplify not only this driver, but the whole infrastructure indeed. But we are still "CLCD driver away" from the full features replacement. Ryan Harkin is working on this, but it doesn't look like he was going to make it in time for 3.7. A second after this happens I'll post a "big kill" patch removing all non-DT stuff - I'm really looking forward to it :-)
Pawel
PATCH 6/11 clk: Common clocks implementation for Versatile Express
Quoted 2 lines · Pawel Moll
But we are still "CLCD driver away" from the full features replacement. Ryan Harkin is working on this,
Will be useful for Integrator, Versatile, RealView, and some non-ARM SoCs too I think, so very interesting!
Yours,
Linus Walleij
PATCH 6/11 clk: Common clocks implementation for Versatile Express
Quoted 7 lines · Linus Walleij
Quoted 2 lines · Pawel Moll
But we are still "CLCD driver away" from the full features replacement. Ryan Harkin is working on this,
Will be useful for Integrator, Versatile, RealView, and some non-ARM SoCs too I think, so very interesting!
Well, we already have a patch set in our tree [1] that will support CLCD in Device Tree, however, I have yet to get this reviewed, despite Pawel reminding me about it, er, occasionally.
I guess that now we've seen it working on several tiles and FastModel, I should get on with it...
I expect significant changes, particularly with the DT bindings, before this will be acceptable upstream.
Cheers,
Ryan.
PATCH 6/11 clk: Common clocks implementation for Versatile Express
In reply to Pawel MollQuoting Pawel Moll (2012-09-03 09:25:26)
Quoted 11 lines
This patch adds a DT and non-DT based implementation of the common clock infrastructure for Versatile Express platform. It registers (statically or using DT) all required fixed clocks, initialises motherboard's SP810 cell (that provides clocks for SP804 timers) and explicitely registers VE "osc" driver, to make the clock generators availalable early.
Signed-off-by Pawel Moll <[email protected]>Cc Mike Turquette <[email protected]>Cc Linus Walleij <[email protected]>
Barring the DT-related comments by Arnd and others, the common clk-specific changes in this patch look good to me. Which tree will this patch go through? (same question I asked on patch 5)
Regards,
Mike
PATCH 7/11 regulators: Versatile Express regulator driver
In reply to Pawel MollImplementation of the regulator framework driver for the Versatile Express voltage control. Devices without voltage constraints (ie. "regulator-[min|max]-microvolt" properties in the DT node) are treated as fixed (or rather read-only) regulators.
--- drivers/regulator/Kconfig | 7 ++ drivers/regulator/Makefile | 1 + drivers/regulator/vexpress.c | 144 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+) create mode 100644 drivers/regulator/vexpress.c
drivers/regulator/Kconfig +7 -0
@@ -404,6 +404,13 @@ config REGULATOR_TWL4030 This driver supports the voltage regulators provided by this family of companion chips. +config REGULATOR_VEXPRESS + tristate "Versatile Express regulators" + depends on VEXPRESS_CONFIG_BUS + help + This driver provides support for voltage regulators available + on the ARM Ltd's Versatile Express platform. + config REGULATOR_WM831X tristate "Wolfson Microelectronics WM831x PMIC regulators" depends on MFD_WM831X
drivers/regulator/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o +obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
drivers/regulator/vexpress.c new file +144 -0
144 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 8/11 hwmon: Versatile Express hwmon driver
In reply to Pawel Mollhwmon framework driver for Versatile Express sensors, providing information about board level voltage (only when regulator driver is not configured), currents, temperature and power/energy usage. Labels for the values can be defined as DT properties.
--- drivers/hwmon/Kconfig | 8 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/vexpress.c | 275 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 284 insertions(+) create mode 100644 drivers/hwmon/vexpress.c
drivers/hwmon/Kconfig +8 -0
@@ -1187,6 +1187,14 @@ config SENSORS_TWL4030_MADC This driver can also be built as a module. If so it will be called twl4030-madc-hwmon. +config SENSORS_VEXPRESS + tristate "Versatile Express" + depends on VEXPRESS_CONFIG_BUS + help + This driver provides support for hardware sensors available on + the ARM Ltd's Versatile Express platform. It can provide wide + range of information like temperature, power, energy. + config SENSORS_VIA_CPUTEMP tristate "VIA CPU temperature sensor" depends on X86
drivers/hwmon/Makefile +1 -0
@@ -120,6 +120,7 @@ obj-$(CONFIG_SENSORS_TMP102) += tmp102.o obj-$(CONFIG_SENSORS_TMP401) += tmp401.o obj-$(CONFIG_SENSORS_TMP421) += tmp421.o obj-$(CONFIG_SENSORS_TWL4030_MADC)+= twl4030-madc-hwmon.o +obj-$(CONFIG_SENSORS_VEXPRESS) += vexpress.o obj-$(CONFIG_SENSORS_VIA_CPUTEMP)+= via-cputemp.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
drivers/hwmon/vexpress.c new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 9/11 misc: Versatile Express system registers driver
In reply to Pawel MollThis is a platform driver for Versatile Express' "system register" block. It's a random collection of registers providing the following functionality:
- low level platform functions like board ID access; in order to use those, the driver must be initialized early, either statically or based on the DT
- config bus bridge via "system control" interface; as the response from the controller does not generate interrupt (yet), the status register is periodically polled using a timer
- pseudo GPIO lines providing MMC card status and Flash WP# signal control
- LED interface for a set of 8 LEDs on the motherboard, with "heartbeat" and "mmc0" as default triggers for 2 of them
--- drivers/misc/vexpress/Makefile | 1 + drivers/misc/vexpress/sysreg.c | 423 ++++++++++++++++++++++++++++++++++++++++ include/linux/vexpress.h | 13 ++ 3 files changed, 437 insertions(+) create mode 100644 drivers/misc/vexpress/sysreg.c
drivers/misc/vexpress/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += config_bus.o obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += display.o obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += reset.o +obj-$(CONFIG_VEXPRESS_CONFIG_BUS) += sysreg.o
drivers/misc/vexpress/sysreg.c new file +423 -0
423 lines not on this page · raw message
include/linux/vexpress.h +13 -0
@@ -134,4 +134,17 @@ int vexpress_osc_driver_register(void);void vexpress_clk_init (void __iomem *sp810_base);void vexpress_clk_of_init (void ); +/* System facilities */ +void vexpress_sysreg_early_init (void __iomem *base); +void vexpress_sysreg_of_early_init (void ); +u32 vexpress_get_procid (int site); +u32 vexpress_get_hbi (int site); +void *vexpress_get_24mhz_clock_base (void ); +void __init vexpress_flags_set (u32 data); + +/* System pseudo-GPIOs */ +#define VEXPRESS_GPIO_MMC_CARDIN 0 +#define VEXPRESS_GPIO_MMC_WPROT 1 +#define VEXPRESS_GPIO_FLASH_WPn 2 +#endif
Signature · 1 line
1.7.9.5
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
In reply to Pawel MollAdd description of all functions provided by Versatile Express motherboard and daughterboards configuration controllers and clock dependencies between devices.
--- arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 136 ++++++++++++++++++++- arch/arm/boot/dts/vexpress-v2m.dtsi | 136 ++++++++++++++++++++- arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts | 103 ++++++++++++++++ arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 169 +++++++++++++++++++++++++++ arch/arm/boot/dts/vexpress-v2p-ca5s.dts | 71 +++++++++++ arch/arm/boot/dts/vexpress-v2p-ca9.dts | 121 +++++++++++++++++++ 6 files changed, 732 insertions(+), 4 deletions(-)
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +134 -2
@@ -72,14 +72,20 @@ #size-cells = <1>; ranges = <0 3 0 0x200000>; - sysreg at 010000 { + v2m_sysreg: sysreg at 010000 { compatible = "arm,vexpress-sysreg"; reg = <0x010000 0x1000>; + gpio-controller; + #gpio-cells = <2>; }; - sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk"; + #clock-cells = <1>; + clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3"; }; /* PCI-E I2C bus */
@@ -100,66 +106,92 @@ compatible = "arm,pl041", "arm,primecell"; reg = <0x040000 0x1000>; interrupts = <11>; + clocks = <&v2m_osc_clk0>; + clock-names = "apb_pclk"; }; mmci at 050000 { compatible = "arm,pl180", "arm,primecell"; reg = <0x050000 0x1000>; interrupts = <9 10>; + cd-gpios = <&v2m_sysreg 0 0>; + wp-gpios = <&v2m_sysreg 1 0>; + max-frequency = <12000000>; + vmmc-supply = <&v2m_fixed_3v3>; + clocks = <&v2m_clk_24mhz>, <&v2m_osc_clk0>; + clock-names = "mclk", "apb_pclk"; }; kmi at 060000 { compatible = "arm,pl050", "arm,primecell"; reg = <0x060000 0x1000>; interrupts = <12>; + clocks = <&v2m_clk_24mhz>, <&v2m_osc_clk0>; + clock-names = "KMIREFCLK", "apb_pclk"; }; kmi at 070000 { compatible = "arm,pl050", "arm,primecell"; reg = <0x070000 0x1000>; interrupts = <13>; + clocks = <&v2m_clk_24mhz>, <&v2m_osc_clk0>; + clock-names = "KMIREFCLK", "apb_pclk"; }; v2m_serial0: uart at 090000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x090000 0x1000>; interrupts = <5>; + clocks = <&v2m_osc_clk2>, <&v2m_osc_clk0>; + clock-names = "uartclk", "apb_pclk"; }; v2m_serial1: uart at 0a0000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x0a0000 0x1000>; interrupts = <6>; + clocks = <&v2m_osc_clk2>, <&v2m_osc_clk0>; + clock-names = "uartclk", "apb_pclk"; }; v2m_serial2: uart at 0b0000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x0b0000 0x1000>; interrupts = <7>; + clocks = <&v2m_osc_clk2>, <&v2m_osc_clk0>; + clock-names = "uartclk", "apb_pclk"; }; v2m_serial3: uart at 0c0000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x0c0000 0x1000>; interrupts = <8>; + clocks = <&v2m_osc_clk2>, <&v2m_osc_clk0>; + clock-names = "uartclk", "apb_pclk"; }; wdt at 0f0000 { compatible = "arm,sp805", "arm,primecell"; reg = <0x0f0000 0x1000>; interrupts = <0>; + clocks = <&v2m_refclk32khz>, <&v2m_osc_clk0>; + clock-names = "wdogclk", "apb_pclk"; }; v2m_timer01: timer at 110000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x110000 0x1000>; interrupts = <2>; + clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&v2m_osc_clk0>; + clock-names = "timclken1", "timclken2", "apb_pclk"; }; v2m_timer23: timer at 120000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x120000 0x1000>; interrupts = <3>; + clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&v2m_osc_clk0>; + clock-names = "timclken1", "timclken2", "apb_pclk"; }; /* DVI I2C bus */
@@ -185,6 +217,8 @@ compatible = "arm,pl031", "arm,primecell"; reg = <0x170000 0x1000>; interrupts = <4>; + clocks = <&v2m_osc_clk0>; + clock-names = "apb_pclk"; }; compact-flash at 1a0000 {
@@ -198,6 +232,9 @@ compatible = "arm,pl111", "arm,primecell"; reg = <0x1f0000 0x1000>; interrupts = <14>; + arm,vexpress,site = <0>; + clocks = <&v2m_osc_clk1>, <&v2m_osc_clk0>; + clock-names = "clcdclk", "apb_pclk"; }; };
@@ -208,5 +245,100 @@ regulator-max-microvolt = <3300000>; regulator-always-on; }; + + v2m_clk_24mhz: clk_24mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "v2m:clk_24mhz"; + }; + + v2m_refclk1mhz: refclk1mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1000000>; + clock-output-names = "v2m:refclk1mhz"; + }; + + v2m_refclk32khz: refclk32khz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "v2m:refclk32khz"; + }; + + mcc { + #address-cells = <1>; + #size-cells = <0>; + #interrupt-cells = <0>; + arm,vexpress,site = <0>; /* Motherboard */ + + v2m_osc_clk0: osc at 0 { + /* MCC static memory clock */ + compatible = "arm,vexpress-config,osc"; + reg = <0>; + freq-range = <25000000 60000000>; + #clock-cells = <0>; + clock-output-names = "v2m:osc_clk0"; + }; + + v2m_osc_clk1: osc at 1 { + /* CLCD clock */ + compatible = "arm,vexpress-config,osc"; + reg = <1>; + freq-range = <23750000 63500000>; + #clock-cells = <0>; + clock-output-names = "v2m:osc_clk1"; + }; + + v2m_osc_clk2: osc at 2 { + /* IO FPGA peripheral clock */ + compatible = "arm,vexpress-config,osc"; + reg = <2>; + freq-range = <24000000 24000000>; + #clock-cells = <0>; + clock-output-names = "v2m:osc_clk2"; + }; + + volt at 0 { + /* Logic level voltage */ + compatible = "arm,vexpress-config,volt"; + reg = <0>; + regulator-name = "VIO"; + regulator-always-on; + }; + + temp at 0 { + /* MCC internal operating temperature */ + compatible = "arm,vexpress-config,temp"; + reg = <0>; + label = "MCC"; + }; + + reset at 0 { + compatible = "arm,vexpress-config,reset"; + reg = <0>; + }; + + muxfpga at 0 { + compatible = "arm,vexpress-config,muxfpga"; + reg = <0>; + }; + + shutdown at 0 { + compatible = "arm,vexpress-config,shutdown"; + reg = <0>; + }; + + reboot at 0 { + compatible = "arm,vexpress-config,reboot"; + reg = <0>; + }; + + dvimode at 0 { + compatible = "arm,vexpress-config,dvimode"; + reg = <0>; + }; + }; }; };
arch/arm/boot/dts/vexpress-v2m.dtsi +134 -2
231 lines not on this page · raw message
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts +103 -0
121 lines not on this page · raw message
arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +169 -0
187 lines not on this page · raw message
arch/arm/boot/dts/vexpress-v2p-ca5s.dts +71 -0
83 lines not on this page · raw message
arch/arm/boot/dts/vexpress-v2p-ca9.dts +121 -0
156 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 26 lines · Pawel Moll
Add description of all functions provided by Versatile Express motherboard and daughterboards configuration controllers and clock dependencies between devices.
Signed-off-by Pawel Moll <[email protected]>--- arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 136 ++++++++++++++++++++- arch/arm/boot/dts/vexpress-v2m.dtsi | 136 ++++++++++++++++++++- arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts | 103 ++++++++++++++++ arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts | 169 +++++++++++++++++++++++++++ arch/arm/boot/dts/vexpress-v2p-ca5s.dts | 71 +++++++++++ arch/arm/boot/dts/vexpress-v2p-ca9.dts | 121 +++++++++++++++++++ 6 files changed, 732 insertions(+), 4 deletions(-)arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +1
-1@@ -72,14 +72,20 @@ #size-cells = <1>; ranges = <0 3 0 0x200000>; - sysreg at 010000 { + v2m_sysreg: sysreg at 010000 { compatible = "arm,vexpress-sysreg"; reg = <0x010000 0x1000>;
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi line 86
Quoted 10 lines
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +5
-1+ gpio-controller; + #gpio-cells = <2>; }; - sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk";
See Documentation/devicetree/bindings/arm/primecell.txt
apb_pclk should be first in the list.
Rob
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 10 lines · Rob Herring
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi line 86
Quoted 6 lines
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +3
-1- sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk";See
Documentation/devicetree/bindings/arm/primecell.txt
apb_pclkshould be first in the list.
Hm. Why, if you don't mind me asking? The amba_get_enable_pclk() explicitly asks for "apb_pclk" id:
struct clk *pclk = clk_get(&pcdev->dev, "apb_pclk");
Now, let's have a look at MMCI:
mmci at 050000 {
compatible = "arm,pl180", "arm,primecell";
reg = <0x050000 0x1000>;
interrupts = <9 10>;
+ cd-gpios = <&v2m_sysreg 0 0>;
+ wp-gpios = <&v2m_sysreg 1 0>;
+ max-frequency = <12000000>;
+ vmmc-supply = <&v2m_fixed_3v3>;
+ clocks = <&v2m_clk_24mhz>, <&v2m_osc_clk0>;
+ clock-names = "mclk", "apb_pclk";
};and mmci_probe() does:
host->clk = clk_get(&dev->dev, NULL);
if (IS_ERR(host->clk)) {
ret = PTR_ERR(host->clk);
host->clk = NULL;
goto host_free;
} Now, if I put "apb_pclk" first, before "mclk", the driver will get the wrong clock.
Pawe?
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 10 lines · Pawel Moll
Quoted 9 lines · Rob Herring
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi line 86
Quoted 6 lines
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +3
-1- sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk";See
Documentation/devicetree/bindings/arm/primecell.txt
Quoted 4 lines
Quoted 1 line
apb_pclkshould be first in the list.Hm. Why, if you don't mind me asking? The
amba_get_enable_pclk()explicitly asks for "apb_pclk" id:
So apb_pclk is always in the same position in the list and I had to define something. Clock names are supposed to be optional, so we have to be able to identify which clock is the bus clock without the name.
Quoted 25 lines
struct clk *pclk =
clk_get(&pcdev->dev, "apb_pclk");Now, let's have a look at MMCI:
mmci at 050000 { compatible = "arm,pl180", "arm,primecell"; reg = <0x050000 0x1000>; interrupts = <9 10>;arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +6
-0+ cd-gpios = <&v2m_sysreg 0 0>; + wp-gpios = <&v2m_sysreg 1 0>; + max-frequency = <12000000>; + vmmc-supply = <&v2m_fixed_3v3>; + clocks = <&v2m_clk_24mhz>, <&v2m_osc_clk0>; + clock-names = "mclk", "apb_pclk"; };and
mmci_probe()does:host->clk = clk_get(&dev->dev, NULL); if (IS_ERR(host->clk)) { ret = PTR_ERR(host->clk); host->clk = NULL; goto host_free; }
Quoted 2 lines
Now, if I put "
apb_pclk" first, before "mclk", the driver will get the wrong clock.
You're getting lucky with how clk_get is implemented. The driver should be more specific with which clock it wants if there is more than 1. Perhaps we need a clk_get_by_index() function?
Rob
Quoted 4 lines
Pawe?
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 19 lines · Rob Herring
Quoted 10 lines · Pawel Moll
Quoted 9 lines · Rob Herring
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi line 86
Quoted 6 lines
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +3
-1- sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk";See
Documentation/devicetree/bindings/arm/primecell.txtQuoted 4 lines
Quoted 1 line
apb_pclkshould be first in the list.Hm. Why, if you don't mind me asking? The
amba_get_enable_pclk()explicitly asks for "apb_pclk" id:So
apb_pclkis always in the same position in the list and I had to define something. Clock names are supposed to be optional, so we have to be able to identify which clock is the bus clock without the name.
[snip]
Quoted 3 lines
You're getting lucky with how
clk_getis implemented. The driver should be more specific with which clock it wants if there is more than 1. Perhaps we need aclk_get_by_index()function?
But the clocking framework doesn't know what "index", while it knows exactly what is "id" (string). How about making the clock names obligatory in the tree when there a node has more than one clock input? This sounds much simpler to me and seems to be in line with the clocking API. And the apb_pclk wouldn't have to be first/last/whatever.
Pawe?
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 25 lines · Pawel Moll
Quoted 19 lines · Rob Herring
Quoted 10 lines · Pawel Moll
Quoted 9 lines · Rob Herring
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi line 86
Quoted 6 lines
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi +3
-1- sysctl at 020000 { + v2m_sysctl: sysctl at 020000 { compatible = "arm,sp810", "arm,primecell"; reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_osc_clk0>; + clock-names = "refclk", "timclk", "apb_pclk";See
Documentation/devicetree/bindings/arm/primecell.txtQuoted 4 lines
Quoted 1 line
apb_pclkshould be first in the list.Hm. Why, if you don't mind me asking? The
amba_get_enable_pclk()explicitly asks for "apb_pclk" id:So
apb_pclkis always in the same position in the list and I had to define something. Clock names are supposed to be optional, so we have to be able to identify which clock is the bus clock without the name.[snip]
Quoted 3 lines
You're getting lucky with how
clk_getis implemented. The driver should be more specific with which clock it wants if there is more than 1. Perhaps we need aclk_get_by_index()function?
Quoted 5 lines
But the clocking framework doesn't know what "index", while it knows exactly what is "id" (string). How about making the clock names obligatory in the tree when there a node has more than one clock input? This sounds much simpler to me and seems to be in line with the clocking API. And the
apb_pclkwouldn't have to be first/last/whatever.
I did say they are *supposed* to be optional, but the amba bus code essentially makes them required. Ideally, Linux doesn't dictate what goes in the dtb or not, but I don't have a problem if specific users of the clock binding require the names.
Rob
PATCH 10/11 ARM: vexpress: Add config bus components and clocks to DTs
Quoted 4 lines · Rob Herring
I did say they are *supposed* to be optional, but the amba bus code essentially makes them required. Ideally, Linux doesn't dictate what goes in the dtb or not, but I don't have a problem if specific users of the clock binding require the names.
Ok, so how about such change in wording?
Documentation/devicetree/bindings/arm/primecell.txt +7 -6
@@ -13,17 +13,18 @@ Required properties: Optional properties: - arm,primecell-periphid : Value to override the h/w value with -- clocks : From common clock binding. First clock is phandle to clock for apb - pclk. Additional clocks are optional and specific to those peripherals. -- clock-names : From common clock binding. Shall be "apb_pclk" for first clock. +- clocks : From common clock binding. One of the clocks should be a phandle to + clock for APB PCLK. Additional clocks are optional and specific to + those peripherals. +- clock-names : From common clock binding. Required here if clocks are + defined. Shall be "apb_pclk" for the APB PCLK. Example: serial at fff36000 { compatible = "arm,pl011", "arm,primecell"; arm,primecell-periphid = <0x00341011>; - clocks = <&pclk>; - clock-names = "apb_pclk"; - + clocks = <&refclk>, <&pclk>; + clock-names = "uartclk", "apb_pclk"; };
Also, maybe we could add a possibility of defining the APB clock for whole APB "cluster" (as usually the same clock is shared across all peripherals connected to a single AHB/APB bridge) using clock-ranges parents? What I think about is something of this sort:
iofpga {
clock-ranges;
clocks = <&pclk>;
clock-names = "apb_pclk";
serial {
compatible = "arm,pl011", "arm,primecell";
clocks = <&refclk>;
clock-names = "uartclk";
};
};Cheers!
Pawel
PATCH 11/11 ARM: vexpress: Start using new Versatile Express infrastructure
In reply to Pawel MollThis patch starts using all the configuration infrastructure.
- generic GPIO library is forced now
- sysreg GPIOs are used to as MMC CD and WP information sources; thanks to this MMCI auxiliary data is not longer necessary
- DVI muxer and mode control is removed from non-DT V2P-CA9 code as this is now handled by the vexpress-display driver
- oscillator control is removed as is being handled by the common clock driver now
- the sysreg and sysctl control is now delegated to the appropriate drivers and all related code was removed
- NOR Flash set_vpp function has been removed as the control bit used does _not_ control its VPP line, but the #WP signal instead (which is de facto unusable in case of Linux MTD drivers); this also allowed the remove its DT auxiliary data
The non-DT code defines only minimal required number of the config devices. Device Trees are updated to make use of all new features.
--- arch/arm/Kconfig | 4 +- arch/arm/include/asm/hardware/sp810.h | 6 - arch/arm/mach-vexpress/ct-ca9x4.c | 37 +-- arch/arm/mach-vexpress/include/mach/motherboard.h | 81 ------ arch/arm/mach-vexpress/platsmp.c | 3 +- arch/arm/mach-vexpress/v2m.c | 321 +++++---------------- 6 files changed, 86 insertions(+), 366 deletions(-)
arch/arm/Kconfig +3 -1
@@ -322,11 +322,12 @@ config ARCH_VERSATILE config ARCH_VEXPRESS bool "ARM Ltd. Versatile Express family" - select ARCH_WANT_OPTIONAL_GPIOLIB + select ARCH_REQUIRE_GPIOLIB select ARM_AMBA select ARM_TIMER_SP804 select CLKDEV_LOOKUP select COMMON_CLK + select COMMON_CLK_VERSATILE select GENERIC_CLOCKEVENTS select HAVE_CLK select HAVE_PATA_PLATFORM
@@ -335,6 +336,7 @@ config ARCH_VEXPRESS select PLAT_VERSATILE select PLAT_VERSATILE_CLCD select REGULATOR_FIXED_VOLTAGE if REGULATOR + select VEXPRESS_CONFIG_BUS help This enables support for the ARM Ltd Versatile Express boards.
arch/arm/include/asm/hardware/sp810.h +0 -6
@@ -50,12 +50,6 @@#define SCPCELLID2 0xFF8#define SCPCELLID3 0xFFC -#define SCCTRL_TIMEREN0SEL_REFCLK (0 << 15) -#define SCCTRL_TIMEREN0SEL_TIMCLK (1 << 15) - -#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17) -#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17) -#define SCCTRL_TIMERENnSEL_SHIFT (n) (15 + ((n) * 2))static inline void sysctl_soft_reset (void __iomem *base)
arch/arm/mach-vexpress/ct-ca9x4.c +16 -21
@@ -9,6 +9,7 @@#include <linux/amba/bus.h> #include <linux/amba/clcd.h> #include <linux/clkdev.h> +#include <linux/vexpress.h> #include <asm/hardware/arm_timer.h> #include <asm/hardware/cache-l2x0.h>
@@ -64,19 +65,6 @@ static void __init ct_ca9x4_init_irq(void)ca9x4_twd_init (); } -static void ct_ca9x4_clcd_enable (struct clcd_fb *fb) -{ -u32 site =v2m_get_master_site (); - -/* -* Old firmware was using the "site" component of the command -* to control the DVI muxer (while it should be always 0 ie. MB). -* Newer firmware uses the data register. Keep both for compatibility. -*/ -v2m_cfg_write (SYS_CFG_MUXFPGA |SYS_CFG_SITE (site), site); -v2m_cfg_write (SYS_CFG_DVIMODE |SYS_CFG_SITE (SYS_CFG_SITE_MB ),2 ); -} -static int ct_ca9x4_clcd_setup (struct clcd_fb *fb) {unsigned long framesize =1024 *768 *2 ;
@@ -93,7 +81,6 @@ static struct clcd_board ct_ca9x4_clcd_data = { .caps = CLCD_CAP_5551 | CLCD_CAP_565, .check = clcdfb_check, .decode = clcdfb_decode, - .enable = ct_ca9x4_clcd_enable, .setup = ct_ca9x4_clcd_setup, .mmap = versatile_clcd_mmap_dma, .remove = versatile_clcd_remove_dma,
@@ -111,12 +98,23 @@ static struct amba_device *ct_ca9x4_amba_devs[] __initdata = { &gpio_device, }; +static const char *const ct_ca9x4_osc1_periphs[] = { +"ct:clcd" , +NULL +}; -static struct v2m_osc ct_osc1 = { - .osc =1 , +static struct vexpress_osc_info ct_ca9x4_osc1_info = { + .clock_name ="clcdclk" , .rate_min =10000000 , .rate_max =80000000 , - .rate_default =23750000 , + .dev_ids = ct_ca9x4_osc1_periphs, +}; + +static struct vexpress_config_device ct_ca9x4_osc1_device = { + .name ="ct:osc1" , + .func =VEXPRESS_CONFIG_FUNC_OSC , + .addr = {VEXPRESS_SITE_MASTER ,0 ,0 ,1 }, + .dev.platform_data = &ct_ca9x4_osc1_info, };static struct resource pmu_resources[] = {
@@ -152,7 +150,6 @@ static struct platform_device pmu_device = {static void __init ct_ca9x4_init (void ) {int i; -struct clk *clk;#ifdef CONFIG_CACHE_L2X0 void __iomem *l2x0_base =ioremap (CT_CA9X4_L2CC ,SZ_4K );
@@ -164,9 +161,7 @@ static void __init ct_ca9x4_init(void)l2x0_init (l2x0_base,0x00400000 ,0xfe0fffff );#endif - ct_osc1.site =v2m_get_master_site (); - clk =v2m_osc_register ("ct:osc1" , &ct_osc1); -clk_register_clkdev (clk,NULL ,"ct:clcd" ); +vexpress_config_device_register (&ct_ca9x4_osc1_device);for (i =0 ; i <ARRAY_SIZE (ct_ca9x4_amba_devs); i++)amba_device_register (ct_ca9x4_amba_devs[i], &iomem_resource);
arch/arm/mach-vexpress/include/mach/motherboard.h +0 -81
103 lines not on this page · raw message
arch/arm/mach-vexpress/platsmp.c +2 -1
@@ -13,6 +13,7 @@#include <linux/smp.h> #include <linux/io.h> #include <linux/of_fdt.h> +#include <linux/vexpress.h> #include <asm/smp_scu.h> #include <asm/hardware/gic.h>
@@ -193,5 +194,5 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)* until it receives a soft interrupt, and then the * secondary CPU branches to this address. */ -v2m_flags_set (virt_to_phys (versatile_secondary_startup)); +vexpress_flags_set (virt_to_phys (versatile_secondary_startup)); }
arch/arm/mach-vexpress/v2m.c +65 -256
458 lines not on this page · raw message
Signature · 1 line
1.7.9.5