mfd: add basic sun6i A31 PRCM support
Subsystems (6)
v2 cover mfd: add basic sun6i A31 PRCM support
Hello,
This patch series adds support for some functions provided by the PRCM (Power/Reset/Clock Management) unit:
- AR100, AHB0 and APB0 clocks
- APB0 reset controller
These functions are needed to get the P2WI driver working, but more subdevices might be added later.
Best Regards,
Boris
Changes since v1:
- fix prcm and prcm-clks DT documentation
- remove unneeded iounmap and kfree calls from sunxi_reset_remove function
- rework the AR100 clk implementation
Boris BREZILLON (7):
reset: sunxi: document sunxi's reset controllers bindings
reset: sunxi: allow MFD subdevices probe
mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
mfd: sun6i-prcm: document DT bindings
clk: sunxi: add PRCM (Power/Reset/Clock Management) clks support
clk: sunxi: document PRCM clock compatible strings
ARM: sunxi: dt: add PRCM clk and reset controller subdevices
Documentation/devicetree/bindings/clock/sunxi.txt | 4 + .../devicetree/bindings/mfd/sun6i-prcm.txt | 59 ++++ .../bindings/reset/allwinner,sunxi-clock-reset.txt | 21 ++ arch/arm/boot/dts/sun6i-a31.dtsi | 51 ++- drivers/clk/sunxi/Makefile | 2 + drivers/clk/sunxi/clk-sun6i-prcm.c | 343 +++++++++++++++++++++ drivers/mfd/Kconfig | 8 + drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++ drivers/reset/reset-sunxi.c | 21 +- 10 files changed, 657 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/sun6i-prcm.txt create mode 100644 Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt create mode 100644 drivers/clk/sunxi/clk-sun6i-prcm.c create mode 100644 drivers/mfd/sun6i-prcm.c
Signature · 1 line
1.8.3.2
PATCH v2 1/7 reset: sunxi: document sunxi's reset controllers bindings
Add DT bindings documentation for sunxi's reset controllers.
--- .../bindings/reset/allwinner,sunxi-clock-reset.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt
Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt new file +21 -0
@@ -0,0 +1,21 @@ +Allwinner sunxi Peripheral Reset Controller +=========================================== + +Please also refer to reset.txt in this directory for common reset +controller binding usage. + +Required properties: +- compatible: Should be one of the following: + "allwinner,sun6i-a31-ahb1-reset" + "allwinner,sun6i-a31-clock-reset" +- reg: should be register base and length as documented in the + datasheet +- #reset-cells: 1, see below + +example: + +ahb1_rst: reset at 01c202c0 { + #reset-cells = <1>; + compatible = "allwinner,sun6i-a31-ahb1-reset"; + reg = <0x01c202c0 0xc>; +};
Signature · 1 line
1.8.3.2
Re: [PATCH v2 1/7] reset: sunxi: document sunxi's reset controllers bindings
Quoted 3 lines · Boris BREZILLON
Add DT bindings documentation for sunxi's reset controllers.
Signed-off-by Boris BREZILLON <[email protected]>
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140507/29ee99a7/attachment-0001.sig>
PATCH v2 2/7 reset: sunxi: allow MFD subdevices probe
In reply to Boris BREZILLONThe current implementation uses sunxi_reset_init function for both early init and platform device probe.
The sunxi_reset_init function uses DT to retrieve device resources, which will be an issue if reset controllers are registered from an MFD device that define resources from mfd_cell definition.
Moreover, we can make of devm functions when we're in the probe context.
--- drivers/reset/reset-sunxi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/reset/reset-sunxi.c +18 -3
@@ -145,7 +145,24 @@ MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);static int sunxi_reset_probe (struct platform_device *pdev) { -return sunxi_reset_init (pdev->dev.of_node); +struct sunxi_reset_data *data; +struct resource *res; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + data->membase =devm_request_and_ioremap (&pdev->dev, res); +if (!data->membase) +return -ENOMEM ; + + data->rcdev.owner =THIS_MODULE ; + data->rcdev.nr_resets =resource_size (res) *32 ; + data->rcdev.ops = &sunxi_reset_ops; + data->rcdev.of_node = pdev->dev.of_node; + +return reset_controller_register (&data->rcdev); }static int sunxi_reset_remove (struct platform_device *pdev)
@@ -153,8 +170,6 @@ static int sunxi_reset_remove(struct platform_device *pdev)struct sunxi_reset_data *data =platform_get_drvdata (pdev);reset_controller_unregister (&data->rcdev); -iounmap (data->membase); -kfree (data);return 0 ; }
Signature · 1 line
1.8.3.2
Re: [PATCH v2 2/7] reset: sunxi: allow MFD subdevices probe
Quoted 24 lines · Boris BREZILLON
The current implementation uses
sunxi_reset_initfunction for both early init and platform device probe.The
sunxi_reset_initfunction uses DT to retrieve device resources, which will be an issue if reset controllers are registered from an MFD device that define resources frommfd_celldefinition.Moreover, we can make of devm functions when we're in the probe context.
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/reset/reset-sunxi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)drivers/reset/reset-sunxi.c +1
-1@@ -145,7 +145,24 @@ MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);static int sunxi_reset_probe (struct platform_device *pdev) { -return sunxi_reset_init (pdev->dev.of_node); +struct sunxi_reset_data *data;
drivers/reset/reset-sunxi.c MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids); · line 158
Quoted 10 lines
drivers/reset/reset-sunxi.c +10
-0+struct resource *res; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + data->membase =devm_request_and_ioremap (&pdev->dev, res); +if (!data->membase) +return -ENOMEM ;
You'd probably be better off using devm_ioremap_resource so that you get a meaningful error code.
Apart from this, you have my
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140507/d8717fa6/attachment.sig>
Re: [PATCH v2 2/7] reset: sunxi: allow MFD subdevices probe
Quoted 21 lines · Maxime Ripard
Quoted 20 lines · Boris BREZILLON
The current implementation uses
sunxi_reset_initfunction for both early init and platform device probe.The
sunxi_reset_initfunction uses DT to retrieve device resources, which will be an issue if reset controllers are registered from an MFD device that define resources frommfd_celldefinition.Moreover, we can make of devm functions when we're in the probe context.
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/reset/reset-sunxi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)drivers/reset/reset-sunxi.c +0
-0@@ -145,7 +145,24 @@ MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);
Quoted 16 lines
Quoted 4 lines
drivers/reset/reset-sunxi.c +1
-1static int sunxi_reset_probe (struct platform_device *pdev) { -return sunxi_reset_init (pdev->dev.of_node); +struct sunxi_reset_data *data;drivers/reset/reset-sunxi.c MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids); · line 158
Quoted 10 lines
drivers/reset/reset-sunxi.c +10
-0+struct resource *res; + + data =devm_kzalloc (&pdev->dev,sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + data->membase =devm_request_and_ioremap (&pdev->dev, res); +if (!data->membase) +return -ENOMEM ;You'd probably be better off using
devm_ioremap_resourceso that you get a meaningful error code.
Oh, I missed this one. I'll fix it for the next version.
Quoted 6 lines
Apart from this, you have my
Acked-by Maxime Ripard <[email protected]>Thanks!
Maxime
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 3/7 mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
In reply to Boris BREZILLONThe PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
--- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 drivers/mfd/sun6i-prcm.c
drivers/mfd/Kconfig +8 -0
@@ -731,6 +731,14 @@ config MFD_STA2X11 select MFD_CORE select REGMAP_MMIO +config MFD_SUN6I_PRCM + bool "Allwinner A31 PRCM controller" + depends on ARCH_SUNXI + select MFD_CORE + help + Support for the PRCM (Power/Reset/Clock Management) unit available + in A31 SoC. + config MFD_SYSCON bool "System Controller Register R/W Based on Regmap" select REGMAP_MMIO
drivers/mfd/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_MFD_STA2X11) += sta2x11-mfd.o obj-$(CONFIG_MFD_STMPE) += stmpe.o obj-$(CONFIG_STMPE_I2C) += stmpe-i2c.o obj-$(CONFIG_STMPE_SPI) += stmpe-spi.o +obj-$(CONFIG_MFD_SUN6I_PRCM) += sun6i-prcm.o obj-$(CONFIG_MFD_TC3589X) += tc3589x.o obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o tmio_core.o obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o tmio_core.o
drivers/mfd/sun6i-prcm.c new file +151 -0
151 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 9 lines · Boris BREZILLON
The PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
Signed-off-by Boris BREZILLON <[email protected]>
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140507/c738b902/attachment.sig>
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
In reply to Boris BREZILLONQuoted 15 lines
The PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 drivers/mfd/sun6i-prcm.c
[...]
Quoted 8 lines
drivers/mfd/sun6i-prcm.c new file +8
-0+#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/err.h> +#include <linux/spinlock.h> +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/mutex.h>
drivers/mfd/sun6i-prcm.c line 28
Quoted 10 lines
drivers/mfd/sun6i-prcm.c new file +10
-0+#include <linux/completion.h> +#include <linux/irq.h> +#include <linux/jiffies.h> +#include <linux/bitops.h> +#include <linux/fs.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> +#include <linux/uaccess.h> +#include <linux/mfd/core.h>
I'm pretty sure you don't need half of these. Please only add the ones you make use of.
[...]
drivers/mfd/sun6i-prcm.c line 134
Quoted 1 line
drivers/mfd/sun6i-prcm.c new file +1
-0+dev_info (&pdev->dev,"PRCM initialized\n" );
Please remove this from here.
[...]
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,
You need a .remove() call-back.
Quoted 6 lines
drivers/mfd/sun6i-prcm.c new file +6
-0+}; +module_platform_driver (sun6i_prcm_driver); + +MODULE_AUTHOR ("Boris BREZILLON <[email protected]>" ); +MODULE_DESCRIPTION ("Allwinner sun6i PRCM driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 29 lines · Lee Jones
Quoted 15 lines
The PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 drivers/mfd/sun6i-prcm.c[...]
Quoted 12 lines
drivers/mfd/sun6i-prcm.c new file +12
-0+#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/err.h> +#include <linux/spinlock.h> +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/mutex.h> +#include <linux/completion.h> +#include <linux/irq.h> +#include <linux/jiffies.h> +#include <linux/bitops.h>
Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 28
Quoted 6 lines
drivers/mfd/sun6i-prcm.c new file +6
-0+#include <linux/fs.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> +#include <linux/uaccess.h> +#include <linux/mfd/core.h> I'm pretty sure you don't need half of these. Please only add the ones you make use of.
Sure (this is what happens when you copy/paste from another driver :-))
Quoted 5 lines
[...]
drivers/mfd/sun6i-prcm.c line 134
Quoted 1 line
drivers/mfd/sun6i-prcm.c new file +1
-0+dev_info (&pdev->dev,"PRCM initialized\n" );Please remove this from here.
Okay.
Quoted 11 lines
[...]
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
This driver cannot be compiled as module (see the Kconfig definition) and the devices are not hotpluggable, as a result a probed device will never be removed.
Do you still want me to implement the remove function ?
Quoted 7 lines
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +6
-0+}; +module_platform_driver (sun6i_prcm_driver); + +MODULE_AUTHOR ("Boris BREZILLON <[email protected]>" ); +MODULE_DESCRIPTION ("Allwinner sun6i PRCM driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [linux-sunxi] Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Ühel kenal päeval, N, 08.05.2014 kell 22:04, kirjutas Boris BREZILLON:
Quoted 39 lines · Lee Jones
Quoted 29 lines
Quoted 15 lines
The PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 drivers/mfd/sun6i-prcm.c[...]
Quoted 12 lines
drivers/mfd/sun6i-prcm.c new file +12
-0+#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/err.h> +#include <linux/spinlock.h> +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/mutex.h> +#include <linux/completion.h> +#include <linux/irq.h> +#include <linux/jiffies.h> +#include <linux/bitops.h> Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 28
Quoted 6 lines
drivers/mfd/sun6i-prcm.c new file +6
-0+#include <linux/fs.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> +#include <linux/uaccess.h> +#include <linux/mfd/core.h> I'm pretty sure you don't need half of these. Please only add the ones you make use of.
Quoted 1 line
Sure (this is what happens when you copy/paste from another driver :-))
Also, alphabetic order would be nice.
Päikest,
Priit Laes :)
Re: [linux-sunxi] Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 15 lines
The PRCM (Power/Reset/Clock Management) block exposes several subdevices in different subsystems (clk, reset ...)
Add basic support for the PRCM unit with clk (AR100, AHB0, and APB0 clks) and reset controller subdevices.
Other subdevices might be added later (if needed).
Signed-off-by Boris BREZILLON <[email protected]>--- drivers/mfd/Kconfig | 8 +++ drivers/mfd/Makefile | 1 + drivers/mfd/sun6i-prcm.c | 151 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 drivers/mfd/sun6i-prcm.c[...]
Quoted 8 lines
drivers/mfd/sun6i-prcm.c new file +8
-0+#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/err.h> +#include <linux/spinlock.h> +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/mutex.h> drivers/mfd/sun6i-prcm.c line 28
Quoted 10 lines
drivers/mfd/sun6i-prcm.c new file +10
-0+#include <linux/completion.h> +#include <linux/irq.h> +#include <linux/jiffies.h> +#include <linux/bitops.h> +#include <linux/fs.h> +#include <linux/of.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> +#include <linux/uaccess.h> +#include <linux/mfd/core.h> I'm pretty sure you don't need half of these. Please only add the ones you make use of.
Quoted 3 lines
Quoted 1 line
Sure (this is what happens when you copy/paste from another driver :-))
Also, alphabetic order would be nice.
No, please don't do that, it's a waste of time.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
In reply to Boris BREZILLONQuoted 9 lines
Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
Quoted 5 lines
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.Do you still want me to implement the remove function ?
.remove() also be run on shut down. It's best practice to have one.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/mfd/sun6i-prcm.c new file +5
-0+module_platform_driver (sun6i_prcm_driver); + +MODULE_AUTHOR ("Boris BREZILLON <[email protected]>" ); +MODULE_DESCRIPTION ("Allwinner sun6i PRCM driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Hi,
Quoted 9 lines · Lee Jones
Quoted 9 lines
Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
Quoted 7 lines
Quoted 5 lines
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.Do you still want me to implement the remove function ?
.remove() also be run on shut down.
That is not true, if your device needs to do anything special at shutdown you need to add a shutdown callback. Devices are kept as is (not torn down) on shutdown.
Quoted 9 lines
It's best practice to have one.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
drivers/mfd/sun6i-prcm.c new file +5
-0+module_platform_driver (sun6i_prcm_driver); + +MODULE_AUTHOR ("Boris BREZILLON <[email protected]>" ); +MODULE_DESCRIPTION ("Allwinner sun6i PRCM driver" ); +MODULE_LICENSE ("GPL v2" );
Regards,
Hans
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Do you still want me to implement the remove function ?
.remove() also be run on shut down.
That is not true, if your device needs to do anything special at shutdown you need to add a shutdown callback. Devices are kept as is (not torn down) on shutdown.
Ah okay, I'll bow to your knowledge. So there's no reason for this driver to ever call mfd_remove_devices() then?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 3/7 mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Hi,
Quoted 15 lines · Lee Jones
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 8 lines
drivers/mfd/sun6i-prcm.c line 145
Quoted 7 lines
drivers/mfd/sun6i-prcm.c new file +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name ="sun6i-prcm" , + .owner =THIS_MODULE , + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.Do you still want me to implement the remove function ?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
.remove() also be run on shut down.
That is not true, if your device needs to do anything special at shutdown you need to add a shutdown callback. Devices are kept as is (not torn down) on shutdown.
Ah okay, I'll bow to your knowledge. So there's no reason for this driver to ever call
mfd_remove_devices()then?
No, this is an integral part of the SOC, which never gets removed in any way.
Regards,
Hans
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 15 lines · Hans de Goede
Hi,
Quoted 12 lines · Lee Jones
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name = "sun6i-prcm", + .owner = THIS_MODULE, + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Do you still want me to implement the remove function ?
.remove() also be run on shut down.
That is not true, if your device needs to do anything special at shutdown you need to add a shutdown callback. Devices are kept as is (not torn down) on shutdown.
Ah okay, I'll bow to your knowledge. So there's no reason for this driver to ever call
mfd_remove_devices()then?No, this is an integral part of the SOC, which never gets removed in any way.
Lee, I'm about to send a 3rd version of this series, is it okay for you if I leave the remove function unimplemented ?
Quoted 4 lines
Regards,
Hans
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [PATCH v2 3/7] mfd: add support for sun6i PRCM (Power/Reset/Clock Management) unit
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+static struct platform_driver sun6i_prcm_driver = { + .driver = { + .name = "sun6i-prcm", + .owner = THIS_MODULE, + .of_match_table = sun6i_prcm_dt_ids, + }, + .probe = sun6i_prcm_probe,You need a .remove() call-back.
Quoted 6 lines
Quoted 5 lines
This driver cannot be compiled as module (see the
Kconfigdefinition) and the devices are not hotpluggable, as a result a probed device will never be removed.Do you still want me to implement the remove function ?
.remove() also be run on shut down.
That is not true, if your device needs to do anything special at shutdown you need to add a shutdown callback. Devices are kept as is (not torn down) on shutdown.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Ah okay, I'll bow to your knowledge. So there's no reason for this driver to ever call
mfd_remove_devices()then?No, this is an integral part of the SOC, which never gets removed in any way.
Lee, I'm about to send a 3rd version of this series, is it okay for you if I leave the remove function unimplemented ?
It is.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 4/7 mfd: sun6i-prcm: document DT bindings
In reply to Boris BREZILLONDocument DT bindings of the PRCM (Power/Reset/Clock Management) unit.
--- .../devicetree/bindings/mfd/sun6i-prcm.txt | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/sun6i-prcm.txt
Documentation/devicetree/bindings/mfd/sun6i-prcm.txt new file +59 -0
@@ -0,0 +1,59 @@ +* Allwinner PRCM (Power/Reset/Clock Management) Multi-Functional Device + +PRCM is an MFD device exposing several Power Management related devices +(like clks and reset controllers). + +Required properties: + - compatible: "allwinner,sun6i-a31-prcm" + - reg: The PRCM registers range + +The prcm node may contain several subdevices definitions: + - see Documentation/devicetree/clk/sunxi.txt for clock devices + - see Documentation/devicetree/reset/allwinner,sunxi-clock-reset.txt for reset + controller devices + + +Example: + + prcm: prcm at 01f01400 { + compatible = "allwinner,sun6i-a31-prcm"; + reg = <0x01f01400 0x200>; + + /* Put subdevices here */ + ar100: ar100_clk { + compatible = "allwinner,sun6i-a31-ar100-clk"; + #clock-cells = <0>; + clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; + }; + + ahb0: ahb0_clk { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <1>; + clock-mult = <1>; + clocks = <&ar100_div>; + clock-output-names = "ahb0"; + }; + + apb0: apb0_clk { + compatible = "allwinner,sun6i-a31-apb0-clk"; + #clock-cells = <0>; + clocks = <&ahb0>; + clock-output-names = "apb0"; + }; + + apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi", + "apb0_uart", "apb0_1wire", + "apb0_i2c"; + }; + + apb0_rst: apb0_rst { + compatible = "allwinner,sun6i-a31-clock-reset"; + #reset-cells = <1>; + }; + };
Signature · 1 line
1.8.3.2
PATCH v2 5/7 clk: sunxi: add PRCM (Power/Reset/Clock Management) clks support
In reply to Boris BREZILLONThe PRCM (Power/Reset/Clock Management) unit provides several clock devices:
- AR100 clk: used to clock the Power Management co-processor
- AHB0 clk: used to clock the AHB0 bus
- APB0 clk and gates: used to clk peripherals connected to the APB0 bus
Add support for these clks in a separate driver so that they can be probed as platform devices instead of registered during early init. This is needed to be able to probe PRCM MFD subdevices.
--- drivers/clk/sunxi/Makefile | 2 + drivers/clk/sunxi/clk-sun6i-prcm.c | 343 +++++++++++++++++++++++++++++++++++++ 2 files changed, 345 insertions(+) create mode 100644 drivers/clk/sunxi/clk-sun6i-prcm.c
drivers/clk/sunxi/Makefile +2 -0
@@ -3,3 +3,5 @@ # obj-y += clk-sunxi.o clk-factors.o + +obj-$(CONFIG_MFD_SUN6I_PRCM) += clk-sun6i-prcm.o
drivers/clk/sunxi/clk-sun6i-prcm.c new file +343 -0
343 lines not on this page · raw message
Signature · 1 line
1.8.3.2
Re: [PATCH v2 5/7] clk: sunxi: add PRCM (Power/Reset/Clock Management) clks support
Quoted 11 lines · Boris BREZILLON
The PRCM (Power/Reset/Clock Management) unit provides several clock devices:
- AR100 clk: used to clock the Power Management co-processor
- AHB0 clk: used to clock the AHB0 bus
- APB0 clk and gates: used to clk peripherals connected to the APB0 busAdd support for these clks in a separate driver so that they can be probed as platform devices instead of registered during early init. This is needed to be able to probe PRCM MFD subdevices.
Signed-off-by Boris BREZILLON <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140507/db18718e/attachment.sig>
PATCH v2 6/7 clk: sunxi: document PRCM clock compatible strings
In reply to Boris BREZILLONDocument new compatible strings for clock provided by the PRCM (Power/Reset/Clock Management) unit.
--- Documentation/devicetree/bindings/clock/sunxi.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/clock/sunxi.txt +4 -0
@@ -20,12 +20,16 @@ Required properties: "allwinner,sun5i-a13-ahb-gates-clk" - for the AHB gates on A13 "allwinner,sun5i-a10s-ahb-gates-clk" - for the AHB gates on A10s "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20 + "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31 + "allwinner,sun6i-a31-ahb0-clk" - for the AHB0 multiplexer on A31 "allwinner,sun6i-a31-ahb1-mux-clk" - for the AHB1 multiplexer on A31 "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31 "allwinner,sun4i-a10-apb0-clk" - for the APB0 clock + "allwinner,sun6i-a31-apb0-clk" - for the APB0 clock on A31 "allwinner,sun4i-a10-apb0-gates-clk" - for the APB0 gates on A10 "allwinner,sun5i-a13-apb0-gates-clk" - for the APB0 gates on A13 "allwinner,sun5i-a10s-apb0-gates-clk" - for the APB0 gates on A10s + "allwinner,sun6i-a31-apb0-gates-clk" - for the APB0 gates on A31 "allwinner,sun7i-a20-apb0-gates-clk" - for the APB0 gates on A20 "allwinner,sun4i-a10-apb1-clk" - for the APB1 clock "allwinner,sun4i-a10-apb1-mux-clk" - for the APB1 clock muxing
Signature · 1 line
1.8.3.2
PATCH v2 7/7 ARM: sunxi: dt: add PRCM clk and reset controller subdevices
In reply to Boris BREZILLONAdd DT definitions for PRCM (Power/Reset/Clock Management) clock and reset controller subdevices.
--- arch/arm/boot/dts/sun6i-a31.dtsi | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun6i-a31.dtsi +38 -1
@@ -498,9 +498,46 @@ reg = <0x01f01c00 0x300>; }; - prcm at 01f01c00 { + prcm at 01f01400 { compatible = "allwinner,sun6i-a31-prcm"; reg = <0x01f01400 0x200>; + + ar100: ar100_clk { + compatible = "allwinner,sun6i-a31-ar100-clk"; + #clock-cells = <0>; + clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; + }; + + ahb0: ahb0_clk { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <1>; + clock-mult = <1>; + clocks = <&ar100>; + clock-output-names = "ahb0"; + }; + + apb0: apb0_clk { + compatible = "allwinner,sun6i-a31-apb0-clk"; + #clock-cells = <0>; + clocks = <&ahb0>; + clock-output-names = "apb0"; + }; + + apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi", + "apb0_uart", "apb0_1wire", + "apb0_i2c"; + }; + + apb0_rst: apb0_rst { + compatible = "allwinner,sun6i-a31-clock-reset"; + #reset-cells = <1>; + }; }; }; };
Signature · 1 line
1.8.3.2
Re: [PATCH v2 7/7] ARM: sunxi: dt: add PRCM clk and reset controller subdevices
Quoted 13 lines · Boris BREZILLON
Add DT definitions for PRCM (Power/Reset/Clock Management) clock and reset controller subdevices.
Signed-off-by Boris BREZILLON <[email protected]>--- arch/arm/boot/dts/sun6i-a31.dtsi | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)arch/arm/boot/dts/sun6i-a31.dtsi +0
-0
arch/arm/boot/dts/sun6i-a31.dtsi line 501
Quoted 5 lines
arch/arm/boot/dts/sun6i-a31.dtsi +1
-1@@ -498,9 +498,46 @@ reg = <0x01f01c00 0x300>; }; - prcm at 01f01c00 { + prcm at 01f01400 {
This has already been fixed by Hans.
Quoted 21 lines
arch/arm/boot/dts/sun6i-a31.dtsi +19
-0compatible = "allwinner,sun6i-a31-prcm"; reg = <0x01f01400 0x200>; + + ar100: ar100_clk { + compatible = "allwinner,sun6i-a31-ar100-clk"; + #clock-cells = <0>; + clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; + }; + + ahb0: ahb0_clk { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <1>; + clock-mult = <1>; + clocks = <&ar100>; + clock-output-names = "ahb0"; + }; + + apb0: apb0_clk { + compatible = "allwinner,sun6i-a31-apb0-clk"; + #clock-cells = <0>;
arch/arm/boot/dts/sun6i-a31.dtsi line 532
Quoted 10 lines
arch/arm/boot/dts/sun6i-a31.dtsi +10
-0+ clocks = <&ahb0>; + clock-output-names = "apb0"; + }; + + apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi",
timer01 ? is this a typo?
Quoted 14 lines
arch/arm/boot/dts/sun6i-a31.dtsi +8
-0+ "apb0_uart", "apb0_1wire", + "apb0_i2c"; + }; + + apb0_rst: apb0_rst { + compatible = "allwinner,sun6i-a31-clock-reset"; + #reset-cells = <1>; + }; }; }; };Signature · 1 line
1.8.3.2
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140507/453edd1d/attachment-0001.sig>
Re: [PATCH v2 7/7] ARM: sunxi: dt: add PRCM clk and reset controller subdevices
Quoted 47 lines · Maxime Ripard
Quoted 13 lines · Boris BREZILLON
Add DT definitions for PRCM (Power/Reset/Clock Management) clock and reset controller subdevices.
Signed-off-by Boris BREZILLON <[email protected]>--- arch/arm/boot/dts/sun6i-a31.dtsi | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-)arch/arm/boot/dts/sun6i-a31.dtsi +0
-0arch/arm/boot/dts/sun6i-a31.dtsi line 501
Quoted 5 lines
arch/arm/boot/dts/sun6i-a31.dtsi +1
-1@@ -498,9 +498,46 @@ reg = <0x01f01c00 0x300>; }; - prcm at 01f01c00 { + prcm at 01f01400 {This has already been fixed by Hans.
Quoted 25 lines
arch/arm/boot/dts/sun6i-a31.dtsi +23
-0compatible = "allwinner,sun6i-a31-prcm"; reg = <0x01f01400 0x200>; + + ar100: ar100_clk { + compatible = "allwinner,sun6i-a31-ar100-clk"; + #clock-cells = <0>; + clocks = <&osc32k>, <&osc24M>, <&pll6>, <&pll6>; + }; + + ahb0: ahb0_clk { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <1>; + clock-mult = <1>; + clocks = <&ar100>; + clock-output-names = "ahb0"; + }; + + apb0: apb0_clk { + compatible = "allwinner,sun6i-a31-apb0-clk"; + #clock-cells = <0>; + clocks = <&ahb0>; + clock-output-names = "apb0"; + }; +
Quoted 8 lines
arch/arm/boot/dts/sun6i-a31.dtsi line 532
Quoted 6 lines
arch/arm/boot/dts/sun6i-a31.dtsi +6
-0+ apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi",timer01 ? is this a typo?
A23 manual lists the clock gate as "r_timer0_1", so I put the name on the wiki. Allwinner sun6i code uses "r_tmr" or just "tmr". I see no problem naming this clock output as "apb0_timer" though.
Quoted 14 lines
Quoted 14 lines
arch/arm/boot/dts/sun6i-a31.dtsi +8
-1+ "apb0_uart", "apb0_1wire", + "apb0_i2c"; + }; + + apb0_rst: apb0_rst { + compatible = "allwinner,sun6i-a31-clock-reset"; + #reset-cells = <1>; + }; }; }; }; --1.8.3.2
Re: [PATCH v2 7/7] ARM: sunxi: dt: add PRCM clk and reset controller subdevices
Quoted 7 lines · Chen-Yu Tsai
Quoted 7 lines
Quoted 6 lines
arch/arm/boot/dts/sun6i-a31.dtsi +6
-0+ apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi",
Quoted 5 lines
Quoted 1 line
timer01 ? is this a typo?
A23 manual lists the clock gate as "
r_timer0_1", so I put the name on the wiki. Allwinner sun6i code uses "r_tmr" or just "tmr". I see no problem naming this clock output as "apb0_timer" though.
Yep, it seems better.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140508/5e299f63/attachment.sig>
Re: [PATCH v2 7/7] ARM: sunxi: dt: add PRCM clk and reset controller subdevices
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Chen-Yu Tsai
Quoted 6 lines
Quoted 6 lines
arch/arm/boot/dts/sun6i-a31.dtsi +6
-0+ apb0_gates: apb0_gates_clk { + compatible = "allwinner,sun6i-a31-apb0-gates-clk"; + #clock-cells = <1>; + clocks = <&apb0>; + clock-output-names = "apb0_pio", "apb0_ir", + "apb0_timer01", "apb0_p2wi",
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
timer01 ? is this a typo?
A23 manual lists the clock gate as "
r_timer0_1", so I put the name on the wiki. Allwinner sun6i code uses "r_tmr" or just "tmr". I see no problem naming this clock output as "apb0_timer" though.Yep, it seems better.
Fair enough, I'll change the name for the next version.
Quoted 3 lines
Maxime
Signature · 3 lines
Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com