From: Konstantin Baydarov <hidden> Date: 2012-06-27 18:04:54
This patch introduces a MFD core device driver for OMAP system control module.
The control module allows software control of various static modes supported by the device.
It is composed of two control submodules: general control module and device (padconfiguration) control module.
Changes since previous version:
- omap-control-core: resources aren't hardcoded, they are specified in dts file.
- omap-control-core: Control module is a built-in driver - added control module select to ARCH_HAS_CONTROL_MODULE and ARCH_OMAP4.
Probably, no configuration option is required!
- omap-control-core: Added early init call that ioremaps control module IOMEM window, this allows access of SCM registers very early, for example from omap_type()
- omap-control-core: Removed device pointer from omap-control-core API arguments, becuase there can be only one instance control
module device.
- omap-control-core: removed omap_control_get, omap_control_readl, omap_control_writel
- omap-control-core: added omap_control_status_read that is used early in omap_type
Signed-off-by: Konstantin Baydarov <redacted>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <redacted>
Signed-off-by: Eduardo Valentin <redacted>
---
.../devicetree/bindings/mfd/omap_control.txt | 44 +++++++
arch/arm/mach-omap2/Kconfig | 1 +
arch/arm/plat-omap/Kconfig | 4 +
drivers/mfd/Kconfig | 9 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/omap-control-core.c | 131 ++++++++++++++++++++
include/linux/mfd/omap_control.h | 52 ++++++++
7 files changed, 242 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/omap_control.txt
create mode 100644 drivers/mfd/omap-control-core.c
create mode 100644 include/linux/mfd/omap_control.h
@@ -0,0 +1,44 @@+* Texas Instrument OMAP System Control Module (SCM) bindings++The control module allows software control of various static modes supported by+the device. The control module controls the settings of various device modules+through register configuration and internal signals. It also controls the pad+configuration, pin functional multiplexing, and the routing of internal signals+(such as PRCM signals or DMA requests) to output pins configured for hardware+observability.++Required properties:+- compatible : Should be:+ - "ti,omap3-control" for OMAP3 support+ - "ti,omap4-control" for OMAP4 support+ - "ti,omap5-control" for OMAP5 support++OMAP specific properties:+- ti,hwmods: Name of the hwmod associated to the control module:+ Should be "ctrl_module_core";++Sub-nodes:+- bandgap : contains the bandgap node++ The bindings details of individual bandgap device can be found in:+ Documentation/devicetree/bindings/thermal/omap_bandgap.txt++- usb : contains the usb phy pin control node++ The only required property for this child is:+ - compatible = "ti,omap4-control-usb";++Examples:++ctrl_module_core: ctrl_module_core at 4a002000 {+ compatible = "ti,omap4-control";+ ti,hwmods = "ctrl_module_core";+ bandgap {+ compatible = "ti,omap4460-bandgap";+ interrupts = <0 126 4>; /* talert */+ ti,tshut-gpio = <86>; /* tshut */+ };+ usb {+ compatible = "ti,omap4-usb-phy";+ };+};
@@ -5,6 +5,10 @@ menu "TI OMAP Common Features"configARCH_OMAP_OTGbool+configARCH_HAS_CONTROL_MODULE+bool+selectMFD_OMAP_CONTROL+choiceprompt"OMAP System Type"defaultARCH_OMAP2PLUS
@@ -0,0 +1,131 @@+/*+*OMAPsystemcontrolmoduledriverfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contacts:+*Basedonoriginalcodewrittenby:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*MFDcleanupandre-factoring:+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#include<linux/module.h>+#include<linux/export.h>+#include<linux/platform_device.h>+#include<linux/slab.h>+#include<linux/io.h>+#include<linux/err.h>+#include<linux/of_platform.h>+#include<linux/of_address.h>+#include<linux/mfd/core.h>+#include<linux/mfd/omap_control.h>++#include<linux/of.h>+#include<linux/of_address.h>++void__iomem*omap_control_base;++u32omap_control_status_read(u16offset)+{+return__raw_readl(omap_control_base+(offset));+}++staticconststructof_device_idof_omap_control_match[]={+{.compatible="ti,omap3-control",},+{.compatible="ti,omap4-control",},+{.compatible="ti,omap5-control",},+{},+};++staticint__devinitomap_control_probe(structplatform_device*pdev)+{+structdevice*dev=&pdev->dev;+structdevice_node*np=dev->of_node;++/*+*Buildchilddefvicesofctrl_module_core+*/+returnof_platform_populate(np,of_omap_control_match,NULL,dev);+}+++staticstructplatform_driveromap_control_driver={+.probe=omap_control_probe,+.driver={+.name="omap-control-core",+.owner=THIS_MODULE,+.of_match_table=of_omap_control_match,+},+};++int__initomap_control_of_init(structdevice_node*node,+structdevice_node*parent)+{+structresourceres;++if(WARN_ON(!node))+return-ENODEV;++if(of_address_to_resource(node,0,&res)){+WARN(1,"unable to get intc registers\n");+return-EINVAL;+}++return0;+}++void__initof_omap_control_init(conststructof_device_id*matches)+{+structdevice_node*np;+structproperty*pp=0;+unsignedlongphys_base=0;+size_tmapsize=0;++for_each_matching_node(np,matches){++pp=of_find_property(np,"reg",NULL);+if(pp){+phys_base=(unsignedlong)be32_to_cpup(pp->value);+mapsize=(size_t)be32_to_cpup((void*)((char*)pp->value+4));+omap_control_base=ioremap(phys_base,mapsize);+}+}+}++staticint__init+omap_control_early_initcall(void)+{+of_omap_control_init(of_omap_control_match);++return0;+}+early_initcall(omap_control_early_initcall);++staticint__initomap_control_init(void)+{+returnplatform_driver_register(&omap_control_driver);+}+postcore_initcall_sync(omap_control_init);++staticvoid__exitomap_control_exit(void)+{+platform_driver_unregister(&omap_control_driver);+}+module_exit(omap_control_exit);+early_platform_init("early_omap_control",&omap_control_driver);++MODULE_DESCRIPTION("OMAP system control module driver");+MODULE_LICENSE("GPL v2");+MODULE_ALIAS("platform:omap-control-core");+MODULE_AUTHOR("Texas Instruments Inc.");
Hello,
On Wed, Jun 27, 2012 at 10:04:54PM +0400, Konstantin Baydarov wrote:
quoted hunk
This patch introduces a MFD core device driver for OMAP system control module.
The control module allows software control of various static modes supported by the device.
It is composed of two control submodules: general control module and device (padconfiguration) control module.
Changes since previous version:
- omap-control-core: resources aren't hardcoded, they are specified in dts file.
- omap-control-core: Control module is a built-in driver - added control module select to ARCH_HAS_CONTROL_MODULE and ARCH_OMAP4.
Probably, no configuration option is required!
- omap-control-core: Added early init call that ioremaps control module IOMEM window, this allows access of SCM registers very early, for example from omap_type()
- omap-control-core: Removed device pointer from omap-control-core API arguments, becuase there can be only one instance control
module device.
- omap-control-core: removed omap_control_get, omap_control_readl, omap_control_writel
- omap-control-core: added omap_control_status_read that is used early in omap_type
Signed-off-by: Konstantin Baydarov <redacted>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <redacted>
Signed-off-by: Eduardo Valentin <redacted>
---
.../devicetree/bindings/mfd/omap_control.txt | 44 +++++++
arch/arm/mach-omap2/Kconfig | 1 +
arch/arm/plat-omap/Kconfig | 4 +
drivers/mfd/Kconfig | 9 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/omap-control-core.c | 131 ++++++++++++++++++++
include/linux/mfd/omap_control.h | 52 ++++++++
7 files changed, 242 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/omap_control.txt
create mode 100644 drivers/mfd/omap-control-core.c
create mode 100644 include/linux/mfd/omap_control.h
@@ -0,0 +1,44 @@+* Texas Instrument OMAP System Control Module (SCM) bindings++The control module allows software control of various static modes supported by+the device. The control module controls the settings of various device modules+through register configuration and internal signals. It also controls the pad+configuration, pin functional multiplexing, and the routing of internal signals+(such as PRCM signals or DMA requests) to output pins configured for hardware+observability.++Required properties:+- compatible : Should be:+ - "ti,omap3-control" for OMAP3 support+ - "ti,omap4-control" for OMAP4 support+ - "ti,omap5-control" for OMAP5 support++OMAP specific properties:+- ti,hwmods: Name of the hwmod associated to the control module:+ Should be "ctrl_module_core";++Sub-nodes:+- bandgap : contains the bandgap node++ The bindings details of individual bandgap device can be found in:+ Documentation/devicetree/bindings/thermal/omap_bandgap.txt++- usb : contains the usb phy pin control node++ The only required property for this child is:+ - compatible = "ti,omap4-control-usb";++Examples:++ctrl_module_core: ctrl_module_core at 4a002000 {+ compatible = "ti,omap4-control";+ ti,hwmods = "ctrl_module_core";+ bandgap {+ compatible = "ti,omap4460-bandgap";
You need to update the documentation if change the DT structure.
@@ -0,0 +1,131 @@+/*+*OMAPsystemcontrolmoduledriverfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contacts:+*Basedonoriginalcodewrittenby:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*MFDcleanupandre-factoring:+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#include<linux/module.h>+#include<linux/export.h>+#include<linux/platform_device.h>+#include<linux/slab.h>+#include<linux/io.h>+#include<linux/err.h>+#include<linux/of_platform.h>+#include<linux/of_address.h>+#include<linux/mfd/core.h>+#include<linux/mfd/omap_control.h>++#include<linux/of.h>+#include<linux/of_address.h>++void__iomem*omap_control_base;++u32omap_control_status_read(u16offset)+{+return__raw_readl(omap_control_base+(offset));+}++staticconststructof_device_idof_omap_control_match[]={+{.compatible="ti,omap3-control",},+{.compatible="ti,omap4-control",},+{.compatible="ti,omap5-control",},+{},+};++staticint__devinitomap_control_probe(structplatform_device*pdev)+{+structdevice*dev=&pdev->dev;+structdevice_node*np=dev->of_node;++/*+*Buildchilddefvicesofctrl_module_core+*/+returnof_platform_populate(np,of_omap_control_match,NULL,dev);+}+++staticstructplatform_driveromap_control_driver={+.probe=omap_control_probe,+.driver={+.name="omap-control-core",+.owner=THIS_MODULE,+.of_match_table=of_omap_control_match,+},+};++int__initomap_control_of_init(structdevice_node*node,+structdevice_node*parent)+{+structresourceres;++if(WARN_ON(!node))+return-ENODEV;++if(of_address_to_resource(node,0,&res)){+WARN(1,"unable to get intc registers\n");+return-EINVAL;+}++return0;+}
@@ -0,0 +1,52 @@+/*+*OMAPsystemcontrolmoduleheaderfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contact:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*Abraham,KishonVijay<kishon@ti.com>+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#ifndef __DRIVERS_OMAP_CONTROL_H+#define __DRIVERS_OMAP_CONTROL_H++#include<linux/err.h>++/**+*structsystemcontrolmodule-scmdevicestructure+*@dev:devicepointer+*@base:BaseofthetempI/O+*@reg_lock:protectomap_controlstructure+*@use_count:trackAPIusers+*/+structomap_control{+structdevice*dev;+void__iomem*base;+/* protect this data structure and register access */+spinlock_treg_lock;+intuse_count;
I suppose the reg_lock and the use_count are not needed in this design?
From: Konstantin Baydarov <hidden> Date: 2012-06-28 09:37:14
Hi.
On 06/28/2012 08:50 AM, Eduardo Valentin wrote:
Hello,
On Wed, Jun 27, 2012 at 10:04:54PM +0400, Konstantin Baydarov wrote:
quoted
This patch introduces a MFD core device driver for OMAP system control module.
The control module allows software control of various static modes supported by the device.
It is composed of two control submodules: general control module and device (padconfiguration) control module.
Changes since previous version:
- omap-control-core: resources aren't hardcoded, they are specified in dts file.
- omap-control-core: Control module is a built-in driver - added control module select to ARCH_HAS_CONTROL_MODULE and ARCH_OMAP4.
Probably, no configuration option is required!
- omap-control-core: Added early init call that ioremaps control module IOMEM window, this allows access of SCM registers very early, for example from omap_type()
- omap-control-core: Removed device pointer from omap-control-core API arguments, becuase there can be only one instance control
module device.
- omap-control-core: removed omap_control_get, omap_control_readl, omap_control_writel
- omap-control-core: added omap_control_status_read that is used early in omap_type
Signed-off-by: Konstantin Baydarov <redacted>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <redacted>
Signed-off-by: Eduardo Valentin <redacted>
---
.../devicetree/bindings/mfd/omap_control.txt | 44 +++++++
arch/arm/mach-omap2/Kconfig | 1 +
arch/arm/plat-omap/Kconfig | 4 +
drivers/mfd/Kconfig | 9 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/omap-control-core.c | 131 ++++++++++++++++++++
include/linux/mfd/omap_control.h | 52 ++++++++
7 files changed, 242 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/omap_control.txt
create mode 100644 drivers/mfd/omap-control-core.c
create mode 100644 include/linux/mfd/omap_control.h
@@ -0,0 +1,44 @@+* Texas Instrument OMAP System Control Module (SCM) bindings++The control module allows software control of various static modes supported by+the device. The control module controls the settings of various device modules+through register configuration and internal signals. It also controls the pad+configuration, pin functional multiplexing, and the routing of internal signals+(such as PRCM signals or DMA requests) to output pins configured for hardware+observability.++Required properties:+- compatible : Should be:+ - "ti,omap3-control" for OMAP3 support+ - "ti,omap4-control" for OMAP4 support+ - "ti,omap5-control" for OMAP5 support++OMAP specific properties:+- ti,hwmods: Name of the hwmod associated to the control module:+ Should be "ctrl_module_core";++Sub-nodes:+- bandgap : contains the bandgap node++ The bindings details of individual bandgap device can be found in:+ Documentation/devicetree/bindings/thermal/omap_bandgap.txt++- usb : contains the usb phy pin control node++ The only required property for this child is:+ - compatible = "ti,omap4-control-usb";++Examples:++ctrl_module_core: ctrl_module_core at 4a002000 {+ compatible = "ti,omap4-control";+ ti,hwmods = "ctrl_module_core";+ bandgap {+ compatible = "ti,omap4460-bandgap";
You need to update the documentation if change the DT structure.
@@ -0,0 +1,131 @@+/*+*OMAPsystemcontrolmoduledriverfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contacts:+*Basedonoriginalcodewrittenby:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*MFDcleanupandre-factoring:+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#include<linux/module.h>+#include<linux/export.h>+#include<linux/platform_device.h>+#include<linux/slab.h>+#include<linux/io.h>+#include<linux/err.h>+#include<linux/of_platform.h>+#include<linux/of_address.h>+#include<linux/mfd/core.h>+#include<linux/mfd/omap_control.h>++#include<linux/of.h>+#include<linux/of_address.h>++void__iomem*omap_control_base;++u32omap_control_status_read(u16offset)+{+return__raw_readl(omap_control_base+(offset));+}++staticconststructof_device_idof_omap_control_match[]={+{.compatible="ti,omap3-control",},+{.compatible="ti,omap4-control",},+{.compatible="ti,omap5-control",},+{},+};++staticint__devinitomap_control_probe(structplatform_device*pdev)+{+structdevice*dev=&pdev->dev;+structdevice_node*np=dev->of_node;++/*+*Buildchilddefvicesofctrl_module_core+*/+returnof_platform_populate(np,of_omap_control_match,NULL,dev);+}+++staticstructplatform_driveromap_control_driver={+.probe=omap_control_probe,+.driver={+.name="omap-control-core",+.owner=THIS_MODULE,+.of_match_table=of_omap_control_match,+},+};++int__initomap_control_of_init(structdevice_node*node,+structdevice_node*parent)+{+structresourceres;++if(WARN_ON(!node))+return-ENODEV;++if(of_address_to_resource(node,0,&res)){+WARN(1,"unable to get intc registers\n");+return-EINVAL;+}++return0;+}
This can be done following way:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
IIUC, this way was suggested by Tony.
@@ -0,0 +1,52 @@+/*+*OMAPsystemcontrolmoduleheaderfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contact:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*Abraham,KishonVijay<kishon@ti.com>+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#ifndef __DRIVERS_OMAP_CONTROL_H+#define __DRIVERS_OMAP_CONTROL_H++#include<linux/err.h>++/**+*structsystemcontrolmodule-scmdevicestructure+*@dev:devicepointer+*@base:BaseofthetempI/O+*@reg_lock:protectomap_controlstructure+*@use_count:trackAPIusers+*/+structomap_control{+structdevice*dev;+void__iomem*base;+/* protect this data structure and register access */+spinlock_treg_lock;+intuse_count;
I suppose the reg_lock and the use_count are not needed in this design?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello,
On Thu, Jun 28, 2012 at 12:37 PM, Konstantin Baydarov
[off-list ref] wrote:
?Hi.
On 06/28/2012 08:50 AM, Eduardo Valentin wrote:
quoted
Hello,
On Wed, Jun 27, 2012 at 10:04:54PM +0400, Konstantin Baydarov wrote:
quoted
This patch introduces a MFD core device driver for OMAP system control module.
The control module allows software control of various static modes supported by the device.
It is composed of two control submodules: general control module and device (padconfiguration) control module.
Changes since previous version:
- omap-control-core: resources aren't hardcoded, they are specified in dts file.
- omap-control-core: Control module is a built-in driver - added control module select to ARCH_HAS_CONTROL_MODULE and ARCH_OMAP4.
Probably, no configuration option is required!
- omap-control-core: Added early init call that ioremaps control module IOMEM window, this allows access of SCM registers very early, for example from omap_type()
- omap-control-core: Removed device pointer from omap-control-core API arguments, becuase there can be only one instance control
module device.
- omap-control-core: removed omap_control_get, omap_control_readl, omap_control_writel
- omap-control-core: added omap_control_status_read that is used early in omap_type
Signed-off-by: Konstantin Baydarov <redacted>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <redacted>
Signed-off-by: Eduardo Valentin <redacted>
---
?.../devicetree/bindings/mfd/omap_control.txt ? ? ? | ? 44 +++++++
?arch/arm/mach-omap2/Kconfig ? ? ? ? ? ? ? ? ? ? ? ?| ? ?1 +
?arch/arm/plat-omap/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? | ? ?4 +
?drivers/mfd/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?9 ++
?drivers/mfd/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
?drivers/mfd/omap-control-core.c ? ? ? ? ? ? ? ? ? ?| ?131 ++++++++++++++++++++
?include/linux/mfd/omap_control.h ? ? ? ? ? ? ? ? ? | ? 52 ++++++++
?7 files changed, 242 insertions(+), 0 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/mfd/omap_control.txt
?create mode 100644 drivers/mfd/omap-control-core.c
?create mode 100644 include/linux/mfd/omap_control.h
@@ -0,0 +1,44 @@+* Texas Instrument OMAP System Control Module (SCM) bindings++The control module allows software control of various static modes supported by+the device. The control module controls the settings of various device ?modules+through register configuration and internal signals. It also controls ?the ?pad+configuration, pin functional multiplexing, and the routing of internal signals+(such as PRCM ?signals or DMA requests) ?to output pins configured for hardware+observability.++Required properties:+- compatible : Should be:+ ?- "ti,omap3-control" for OMAP3 support+ ?- "ti,omap4-control" for OMAP4 support+ ?- "ti,omap5-control" for OMAP5 support++OMAP specific properties:+- ti,hwmods: Name of the hwmod associated to the control module:+ ?Should be "ctrl_module_core";++Sub-nodes:+- bandgap : contains the bandgap node++ ?The bindings details of individual bandgap device can be found in:+ ?Documentation/devicetree/bindings/thermal/omap_bandgap.txt++- usb : contains the usb phy pin control node++ ?The only required property for this child is:+ ? ?- compatible = "ti,omap4-control-usb";++Examples:++ctrl_module_core: ctrl_module_core at 4a002000 {+ ? ?compatible = "ti,omap4-control";+ ? ?ti,hwmods = "ctrl_module_core";+ ? ?bandgap {+ ? ? ? ? ? ?compatible = "ti,omap4460-bandgap";
You need to update the documentation if change the DT structure.
@@ -0,0 +1,131 @@+/*+*OMAPsystemcontrolmoduledriverfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contacts:+*Basedonoriginalcodewrittenby:+*??JKeerthy<j-keerthy@ti.com>+*??MoizSonasath<m-sonasath@ti.com>+*MFDcleanupandre-factoring:+*??EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.?SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#include<linux/module.h>+#include<linux/export.h>+#include<linux/platform_device.h>+#include<linux/slab.h>+#include<linux/io.h>+#include<linux/err.h>+#include<linux/of_platform.h>+#include<linux/of_address.h>+#include<linux/mfd/core.h>+#include<linux/mfd/omap_control.h>++#include<linux/of.h>+#include<linux/of_address.h>++void__iomem*omap_control_base;++u32omap_control_status_read(u16offset)+{+??return__raw_readl(omap_control_base+(offset));+}++staticconststructof_device_idof_omap_control_match[]={+??{.compatible="ti,omap3-control",},+??{.compatible="ti,omap4-control",},+??{.compatible="ti,omap5-control",},+??{},+};++staticint__devinitomap_control_probe(structplatform_device*pdev)+{+??structdevice*dev=&pdev->dev;+??structdevice_node*np=dev->of_node;++??/*+??*?Buildchilddefvicesofctrl_module_core+??*/+??returnof_platform_populate(np,of_omap_control_match,NULL,dev);+}+++staticstructplatform_driveromap_control_driver={+??.probe?????????=omap_control_probe,+??.driver={+??????.name?????="omap-control-core",+??????.owner?????=THIS_MODULE,+??????.of_match_table=of_omap_control_match,+??},+};++int__initomap_control_of_init(structdevice_node*node,+????????????structdevice_node*parent)+{+??structresourceres;++??if(WARN_ON(!node))+??????return-ENODEV;++??if(of_address_to_resource(node,0,&res)){+??????WARN(1,"unable to get intc registers\n");+??????return-EINVAL;+??}++??return0;+}
This can be done following way:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
IIUC, this way was suggested by Tony.
how better is this way compared to having the access functions in the
core? This way we just replicate the access functions in every
children.
I believe the suggestion was to have the ioremap and request done in
chunks. So that children dont step into each other ioarea. But then
again that can be a bit painful as the children registers are not
contiguous.
@@ -0,0 +1,52 @@+/*+*OMAPsystemcontrolmoduleheaderfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contact:+*?JKeerthy<j-keerthy@ti.com>+*?MoizSonasath<m-sonasath@ti.com>+*?Abraham,KishonVijay<kishon@ti.com>+*?EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.?SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#ifndef __DRIVERS_OMAP_CONTROL_H+#define __DRIVERS_OMAP_CONTROL_H++#include<linux/err.h>++/**+*structsystemcontrolmodule-scmdevicestructure+*@dev:devicepointer+*@base:BaseofthetempI/O+*@reg_lock:protectomap_controlstructure+*@use_count:trackAPIusers+*/+structomap_control{+??structdevice?????*dev;+??void__iomem??????*base;+??/* protect this data structure and register access */+??spinlock_t???????reg_lock;+??int??????????use_count;
I suppose the reg_lock and the use_count are not needed in this design?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
From: Konstantin Baydarov <hidden> Date: 2012-06-28 10:12:45
Hello.
On 06/28/2012 01:49 PM, Valentin, Eduardo wrote:
Hello,
On Thu, Jun 28, 2012 at 12:37 PM, Konstantin Baydarov
[off-list ref] wrote:
quoted
Hi.
On 06/28/2012 08:50 AM, Eduardo Valentin wrote:
quoted
Hello,
On Wed, Jun 27, 2012 at 10:04:54PM +0400, Konstantin Baydarov wrote:
quoted
This patch introduces a MFD core device driver for OMAP system control module.
The control module allows software control of various static modes supported by the device.
It is composed of two control submodules: general control module and device (padconfiguration) control module.
Changes since previous version:
- omap-control-core: resources aren't hardcoded, they are specified in dts file.
- omap-control-core: Control module is a built-in driver - added control module select to ARCH_HAS_CONTROL_MODULE and ARCH_OMAP4.
Probably, no configuration option is required!
- omap-control-core: Added early init call that ioremaps control module IOMEM window, this allows access of SCM registers very early, for example from omap_type()
- omap-control-core: Removed device pointer from omap-control-core API arguments, becuase there can be only one instance control
module device.
- omap-control-core: removed omap_control_get, omap_control_readl, omap_control_writel
- omap-control-core: added omap_control_status_read that is used early in omap_type
Signed-off-by: Konstantin Baydarov <redacted>
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <redacted>
Signed-off-by: Eduardo Valentin <redacted>
---
.../devicetree/bindings/mfd/omap_control.txt | 44 +++++++
arch/arm/mach-omap2/Kconfig | 1 +
arch/arm/plat-omap/Kconfig | 4 +
drivers/mfd/Kconfig | 9 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/omap-control-core.c | 131 ++++++++++++++++++++
include/linux/mfd/omap_control.h | 52 ++++++++
7 files changed, 242 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/omap_control.txt
create mode 100644 drivers/mfd/omap-control-core.c
create mode 100644 include/linux/mfd/omap_control.h
@@ -0,0 +1,44 @@+* Texas Instrument OMAP System Control Module (SCM) bindings++The control module allows software control of various static modes supported by+the device. The control module controls the settings of various device modules+through register configuration and internal signals. It also controls the pad+configuration, pin functional multiplexing, and the routing of internal signals+(such as PRCM signals or DMA requests) to output pins configured for hardware+observability.++Required properties:+- compatible : Should be:+ - "ti,omap3-control" for OMAP3 support+ - "ti,omap4-control" for OMAP4 support+ - "ti,omap5-control" for OMAP5 support++OMAP specific properties:+- ti,hwmods: Name of the hwmod associated to the control module:+ Should be "ctrl_module_core";++Sub-nodes:+- bandgap : contains the bandgap node++ The bindings details of individual bandgap device can be found in:+ Documentation/devicetree/bindings/thermal/omap_bandgap.txt++- usb : contains the usb phy pin control node++ The only required property for this child is:+ - compatible = "ti,omap4-control-usb";++Examples:++ctrl_module_core: ctrl_module_core at 4a002000 {+ compatible = "ti,omap4-control";+ ti,hwmods = "ctrl_module_core";+ bandgap {+ compatible = "ti,omap4460-bandgap";
You need to update the documentation if change the DT structure.
@@ -0,0 +1,131 @@+/*+*OMAPsystemcontrolmoduledriverfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contacts:+*Basedonoriginalcodewrittenby:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*MFDcleanupandre-factoring:+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#include<linux/module.h>+#include<linux/export.h>+#include<linux/platform_device.h>+#include<linux/slab.h>+#include<linux/io.h>+#include<linux/err.h>+#include<linux/of_platform.h>+#include<linux/of_address.h>+#include<linux/mfd/core.h>+#include<linux/mfd/omap_control.h>++#include<linux/of.h>+#include<linux/of_address.h>++void__iomem*omap_control_base;++u32omap_control_status_read(u16offset)+{+return__raw_readl(omap_control_base+(offset));+}++staticconststructof_device_idof_omap_control_match[]={+{.compatible="ti,omap3-control",},+{.compatible="ti,omap4-control",},+{.compatible="ti,omap5-control",},+{},+};++staticint__devinitomap_control_probe(structplatform_device*pdev)+{+structdevice*dev=&pdev->dev;+structdevice_node*np=dev->of_node;++/*+*Buildchilddefvicesofctrl_module_core+*/+returnof_platform_populate(np,of_omap_control_match,NULL,dev);+}+++staticstructplatform_driveromap_control_driver={+.probe=omap_control_probe,+.driver={+.name="omap-control-core",+.owner=THIS_MODULE,+.of_match_table=of_omap_control_match,+},+};++int__initomap_control_of_init(structdevice_node*node,+structdevice_node*parent)+{+structresourceres;++if(WARN_ON(!node))+return-ENODEV;++if(of_address_to_resource(node,0,&res)){+WARN(1,"unable to get intc registers\n");+return-EINVAL;+}++return0;+}
This can be done following way:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
IIUC, this way was suggested by Tony.
how better is this way compared to having the access functions in the
core? This way we just replicate the access functions in every
children.
I believe the suggestion was to have the ioremap and request done in
chunks. So that children dont step into each other ioarea. But then
again that can be a bit painful as the children registers are not
contiguous.
The interface(design) of omap-control-core.c has already been discussed many times :(
Eduardo, in his patch set, suggested following design:
- omap-control-core.c ioremaps SCM window and provide functions to read/write SCP register for bandgap and usb.
IIRC, this approach didn't satisfy and it was suggested to have private read/write in bandgap and usb.
So, my patch set introduces following design:
- omap-control-core.c don't provide read/write functions for bandgap and usb.
- bandgap and usb use their own private read/write functions
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped to the same virtual address. But the problem is that SMP memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach.
Another possible design is:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
- Bandgap and usb phy uses their own private read/write function.
IIUC, this way was suggested by Tony.
I guess It's better to settle the design(interface) of omap-control-core.c, bandgap and usb phy and then submit the next version of patch set.
@@ -0,0 +1,52 @@+/*+*OMAPsystemcontrolmoduleheaderfile+*+*Copyright(C)2011-2012TexasInstrumentsIncorporated-http://www.ti.com/+*Contact:+*JKeerthy<j-keerthy@ti.com>+*MoizSonasath<m-sonasath@ti.com>+*Abraham,KishonVijay<kishon@ti.com>+*EduardoValentin<eduardo.valentin@ti.com>+*+*Thisprogramisfreesoftware;youcanredistributeitand/or+*modifyitunderthetermsoftheGNUGeneralPublicLicense+*version2aspublishedbytheFreeSoftwareFoundation.+*+*Thisprogramisdistributedinthehopethatitwillbeuseful,but+*WITHOUTANYWARRANTY;withouteventheimpliedwarrantyof+*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU+*GeneralPublicLicenseformoredetails.+*+*/++#ifndef __DRIVERS_OMAP_CONTROL_H+#define __DRIVERS_OMAP_CONTROL_H++#include<linux/err.h>++/**+*structsystemcontrolmodule-scmdevicestructure+*@dev:devicepointer+*@base:BaseofthetempI/O+*@reg_lock:protectomap_controlstructure+*@use_count:trackAPIusers+*/+structomap_control{+structdevice*dev;+void__iomem*base;+/* protect this data structure and register access */+spinlock_treg_lock;+intuse_count;
I suppose the reg_lock and the use_count are not needed in this design?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Konstantin Baydarov <hidden> Date: 2012-06-28 10:26:28
On 06/28/2012 02:12 PM, Konstantin Baydarov wrote:
The interface(design) of omap-control-core.c has already been discussed many times :(
Eduardo, in his patch set, suggested following design:
- omap-control-core.c ioremaps SCM window and provide functions to read/write SCP register for bandgap and usb.
IIRC, this approach didn't satisfy and it was suggested to have private read/write in bandgap and usb.
So, my patch set introduces following design:
- omap-control-core.c don't provide read/write functions for bandgap and usb.
- bandgap and usb use their own private read/write functions
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped to the same virtual address. But the problem is that SMP memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach.
I mean:
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped. So each call of ioremap in omap-control-core.c, bandgap and usb drivers returns the same virtual address. But the problem is that SCM memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach(when each driver remaps the same IOMEM).
Another possible design is:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
- Bandgap and usb phy uses their own private read/write function.
IIUC, this way was suggested by Tony.
I guess It's better to settle the design(interface) of omap-control-core.c, bandgap and usb phy and then submit the next version of patch set.
Hello,
On Thu, Jun 28, 2012 at 1:26 PM, Konstantin Baydarov
[off-list ref] wrote:
On 06/28/2012 02:12 PM, Konstantin Baydarov wrote:
quoted
The interface(design) of omap-control-core.c has already been discussed many times :(
Eduardo, in his patch set, suggested following design:
- omap-control-core.c ioremaps SCM window and provide functions to read/write SCP register for bandgap and usb.
IIRC, this approach didn't satisfy and it was suggested to have private read/write in bandgap and usb.
So, my patch set introduces following design:
- omap-control-core.c don't provide read/write functions for bandgap and usb.
- bandgap and usb use their own private read/write functions
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped to the same virtual address. But the problem is that SMP memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach.
I mean:
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped. So each call of ioremap in omap-control-core.c, bandgap and usb drivers returns the same virtual address. But the problem is that SCM memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach(when each driver remaps the same IOMEM).
quoted
Another possible design is:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
- Bandgap and usb phy uses their own private read/write function.
IIUC, this way was suggested by Tony.
Well I understood slightly different :-)
I think the point is not really where to put the access functions, but
to have each driver handling a separate part of the the io window. As
I said before, so that they don't access each other io area.
If you have 1 io window, for the above mentioned constraint, you won't
protect anything. So, in that sense, it doesn't make much difference
if you have access functions in core, or in the children, as they are
all sharing the same io window. Of course, in case we put only 1 io
window, for me it is safer if that window is managed in only one
place, instead of several places.
The question is then, can we split the io area into smaller windows
for each children? Considering the children registers are not
contiguous :-(. In theory we can put several entries in the 'reg' DT
property, but that becomes a bit messy as it will change depending on
OMAP version. Anyways, if we split the scm io window into several io
smaller areas/chunks, then it makes sense to have access functions in
each children.
quoted
I guess It's better to settle the design(interface) of omap-control-core.c, bandgap and usb phy and then submit the next version of patch set.
Agreed. Here. We need to decide how to have this design and stick to it.
--
Eduardo Valentin
Hello again,
On Thu, Jun 28, 2012 at 1:51 PM, Valentin, Eduardo
[off-list ref] wrote:
Hello,
On Thu, Jun 28, 2012 at 1:26 PM, Konstantin Baydarov
[off-list ref] wrote:
quoted
On 06/28/2012 02:12 PM, Konstantin Baydarov wrote:
quoted
The interface(design) of omap-control-core.c has already been discussed many times :(
Eduardo, in his patch set, suggested following design:
- omap-control-core.c ioremaps SCM window and provide functions to read/write SCP register for bandgap and usb.
IIRC, this approach didn't satisfy and it was suggested to have private read/write in bandgap and usb.
So, my patch set introduces following design:
- omap-control-core.c don't provide read/write functions for bandgap and usb.
- bandgap and usb use their own private read/write functions
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped to the same virtual address. But the problem is that SMP memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach.
I mean:
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped. So each call of ioremap in omap-control-core.c, bandgap and usb drivers returns the same virtual address. But the problem is that SCM memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach(when each driver remaps the same IOMEM).
quoted
Another possible design is:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
- Bandgap and usb phy uses their own private read/write function.
IIUC, this way was suggested by Tony.
Well I understood slightly different :-)
I think the point is not really where to put the access functions, but
to have each driver handling a separate part of the the io window. As
I said before, so that they don't access each other io area.
If you have 1 io window, for the above mentioned constraint, you won't
protect anything. So, in that sense, it doesn't make much difference
if you have access functions in core, or in the children, as they are
all sharing the same io window. Of course, in case we put only 1 io
window, for me it is safer if that window is managed in only one
place, instead of several places.
The question is then, can we split the io area into smaller windows
for each children? Considering the children registers are not
contiguous :-(. In theory we can put several entries in the 'reg' DT
property, but that becomes a bit messy as it will change depending on
OMAP version. Anyways, if we split the scm io window into several io
smaller areas/chunks, then it makes sense to have access functions in
each children.
quoted
quoted
I guess It's better to settle the design(interface) of omap-control-core.c, bandgap and usb phy and then submit the next version of patch set.
Agreed. Here. We need to decide how to have this design and stick to it.
Once the design is agreed, the series can probably be split into
parts, so we can have the scm core and its children worked separately
Hello,
On Thu, Jun 28, 2012 at 1:55 PM, Valentin, Eduardo
[off-list ref] wrote:
Hello again,
On Thu, Jun 28, 2012 at 1:51 PM, Valentin, Eduardo
[off-list ref] wrote:
quoted
Hello,
On Thu, Jun 28, 2012 at 1:26 PM, Konstantin Baydarov
[off-list ref] wrote:
quoted
On 06/28/2012 02:12 PM, Konstantin Baydarov wrote:
quoted
The interface(design) of omap-control-core.c has already been discussed many times :(
Eduardo, in his patch set, suggested following design:
- omap-control-core.c ioremaps SCM window and provide functions to read/write SCP register for bandgap and usb.
IIRC, this approach didn't satisfy and it was suggested to have private read/write in bandgap and usb.
So, my patch set introduces following design:
- omap-control-core.c don't provide read/write functions for bandgap and usb.
- bandgap and usb use their own private read/write functions
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped to the same virtual address. But the problem is that SMP memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach.
I mean:
- Each omap-control-core.c, bandgap and usb drivers remap SCM window. It's OK because SCM window is statically mapped. So each call of ioremap in omap-control-core.c, bandgap and usb drivers returns the same virtual address. But the problem is that SCM memory window isn't protected. I'm not sure whether it's possible to protect SCM window using this approach(when each driver remaps the same IOMEM).
quoted
Another possible design is:
- omap-control-core.c ioremaps and reserves SCM IOMEM window
- omap-control-core.c exports omap_control_get_base(virtual base address is returned) to use in bandgap and usb_phy driver.
- Bandgap and usb phy uses their own private read/write function.
IIUC, this way was suggested by Tony.
Well I understood slightly different :-)
I think the point is not really where to put the access functions, but
to have each driver handling a separate part of the the io window. As
I said before, so that they don't access each other io area.
If you have 1 io window, for the above mentioned constraint, you won't
protect anything. So, in that sense, it doesn't make much difference
if you have access functions in core, or in the children, as they are
all sharing the same io window. Of course, in case we put only 1 io
window, for me it is safer if that window is managed in only one
place, instead of several places.
The question is then, can we split the io area into smaller windows
for each children? Considering the children registers are not
contiguous :-(. In theory we can put several entries in the 'reg' DT
property, but that becomes a bit messy as it will change depending on
OMAP version. Anyways, if we split the scm io window into several io
smaller areas/chunks, then it makes sense to have access functions in
each children.
quoted
quoted
I guess It's better to settle the design(interface) of omap-control-core.c, bandgap and usb phy and then submit the next version of patch set.
Agreed. Here. We need to decide how to have this design and stick to it.
Once the design is agreed, the series can probably be split into
parts, so we can have the scm core and its children worked separately
Just to be clear, what I was proposing is to have each driver taking
care of its own io window.
For instance, for BG, assuming we have a DT like this:
ctrl_module_core: ctrl_module_core at 4a002000 {
compatible = "ti,omap4-control";
ti,hwmods = "ctrl_module_core";
#address-cells = <1>;
#size-cells = <1>;
ranges;
bandgap: bandgap at 4a002000 {
reg = <0x4a00232C 0x4 0x4a002378 0x18>;
compatible = "ti,omap4460-bandgap";
interrupts = <0 126 4>; /* talert */
ti,tshut-gpio = <86>; /* tshut */
};
usb {
compatible = "ti,omap4-usb-phy";
};
};
then, while probing, it can request those by simply:
i = 0;
do {
void __iomem *chunk;
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res)
break;
chunk = devm_request_and_ioremap(&pdev->dev, res);
if (i == 0)
bg_ptr->base = chunk;
if (!chunk) {
dev_err(&pdev->dev,
"failed to request the IO (%d:%pR).\n",
i, res);
return ERR_PTR(-EADDRNOTAVAIL);
}
i++;
} while (res);
The driver needs to adapt its reg offsets, of course, it is doable and
with the current design it is just a matter of redefining the register
offsets.
But for the above to work, the core driver must not request the
complete IO area.
This should be an exported function instead. And it should
not need the offset as a parameter as the SCM core should know
where to find it's control_status register.
Regards,
Tony