* [PATCH 4/6] rtc: pm8xxx: add support for devicetree
[not found] ` <1394047776-13827-1-git-send-email-joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2014-03-05 19:29 ` Josh Cartwright
2014-03-05 20:59 ` Stephen Boyd
2014-03-06 9:18 ` Lee Jones
0 siblings, 2 replies; 10+ messages in thread
From: Josh Cartwright @ 2014-03-05 19:29 UTC (permalink / raw)
To: Alessandro Zummo, David Brown, Daniel Walker, Bryan Huntsman,
Grant Likely, Rob Herring
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Stephen Boyd, Samuel Ortiz,
Lee Jones, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
rtc-linux-/JYPxA39Uh5TLH3MbocFFw,
devicetree-u79uwXL29TY76Z2rM5mHXA
Add support for describing the PM8921/PM8058 RTC in device tree.
Additionally:
- drop support for describing the RTC using platform data,
as there are no current in tree users who do so.
- make allow_set_time a device-specific flag, instead of mucking
with the rtc_ops
Signed-off-by: Josh Cartwright <joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
drivers/rtc/rtc-pm8xxx.c | 54 +++++++++++++++++++++++-------------------
include/linux/mfd/pm8xxx/rtc.h | 25 -------------------
2 files changed, 30 insertions(+), 49 deletions(-)
delete mode 100644 include/linux/mfd/pm8xxx/rtc.h
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index ed3fe83..cb5576f 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -9,7 +9,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-
+#include <linux/of.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/rtc.h>
@@ -19,9 +19,6 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
-#include <linux/mfd/pm8xxx/rtc.h>
-
-
/* RTC Register offsets from RTC CTRL REG */
#define PM8XXX_ALARM_CTRL_OFFSET 0x01
#define PM8XXX_RTC_WRITE_OFFSET 0x02
@@ -39,6 +36,7 @@
* struct pm8xxx_rtc - rtc driver internal structure
* @rtc: rtc device for this driver.
* @regmap: regmap used to access RTC registers
+ * @allow_set_time: indicates whether writing to the RTC is allowed
* @rtc_alarm_irq: rtc alarm irq number.
* @rtc_base: address of rtc control register.
* @rtc_read_base: base address of read registers.
@@ -51,6 +49,7 @@
struct pm8xxx_rtc {
struct rtc_device *rtc;
struct regmap *regmap;
+ bool allow_set_time;
int rtc_alarm_irq;
int rtc_base;
int rtc_read_base;
@@ -75,6 +74,9 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, ctrl_reg;
struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
+ if (!rtc_dd->allow_set_time)
+ return -EACCES;
+
rtc_tm_to_time(tm, &secs);
for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) {
@@ -291,8 +293,9 @@ rtc_rw_fail:
return rc;
}
-static struct rtc_class_ops pm8xxx_rtc_ops = {
+static const struct rtc_class_ops pm8xxx_rtc_ops = {
.read_time = pm8xxx_rtc_read_time,
+ .set_time = pm8xxx_rtc_set_time,
.set_alarm = pm8xxx_rtc_set_alarm,
.read_alarm = pm8xxx_rtc_read_alarm,
.alarm_irq_enable = pm8xxx_rtc_alarm_irq_enable,
@@ -346,18 +349,26 @@ rtc_alarm_handled:
return IRQ_HANDLED;
}
+/*
+ * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out
+ */
+static const struct of_device_id pm8xxx_id_table[] = {
+ { .compatible = "qcom,pm8921-rtc", .data = (void *) 0x11D },
+ { .compatible = "qcom,pm8058-rtc", .data = (void *) 0x1E8 },
+ { },
+};
+MODULE_DEVICE_TABLE(of, pm8xxx_id_table);
+
static int pm8xxx_rtc_probe(struct platform_device *pdev)
{
int rc;
unsigned int ctrl_reg;
- bool rtc_write_enable = false;
struct pm8xxx_rtc *rtc_dd;
- struct resource *rtc_resource;
- const struct pm8xxx_rtc_platform_data *pdata =
- dev_get_platdata(&pdev->dev);
+ const struct of_device_id *match;
- if (pdata != NULL)
- rtc_write_enable = pdata->rtc_write_enable;
+ match = of_match_node(pm8xxx_id_table, pdev->dev.of_node);
+ if (!match)
+ return -ENXIO;
rtc_dd = devm_kzalloc(&pdev->dev, sizeof(*rtc_dd), GFP_KERNEL);
if (rtc_dd == NULL)
@@ -372,20 +383,16 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
return -ENXIO;
}
- rtc_dd->rtc_alarm_irq = platform_get_irq(pdev, 0);
+ rtc_dd->rtc_alarm_irq = platform_get_irq_byname(pdev, "alarm");
if (rtc_dd->rtc_alarm_irq < 0) {
dev_err(&pdev->dev, "Alarm IRQ resource absent!\n");
return -ENXIO;
}
- rtc_resource = platform_get_resource_byname(pdev, IORESOURCE_IO,
- "pmic_rtc_base");
- if (!(rtc_resource && rtc_resource->start)) {
- dev_err(&pdev->dev, "RTC IO resource absent!\n");
- return -ENXIO;
- }
+ rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node,
+ "linux,allow-set-time");
- rtc_dd->rtc_base = rtc_resource->start;
+ rtc_dd->rtc_base = (long) match->data;
/* Setup RTC register addresses */
rtc_dd->rtc_write_base = rtc_dd->rtc_base + PM8XXX_RTC_WRITE_OFFSET;
@@ -412,8 +419,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
}
rtc_dd->ctrl_reg = ctrl_reg;
- if (rtc_write_enable)
- pm8xxx_rtc_ops.set_time = pm8xxx_rtc_set_time;
platform_set_drvdata(pdev, rtc_dd);
@@ -472,9 +477,10 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops,
static struct platform_driver pm8xxx_rtc_driver = {
.probe = pm8xxx_rtc_probe,
.driver = {
- .name = PM8XXX_RTC_DEV_NAME,
- .owner = THIS_MODULE,
- .pm = &pm8xxx_rtc_pm_ops,
+ .name = "rtc-pm8xxx",
+ .owner = THIS_MODULE,
+ .pm = &pm8xxx_rtc_pm_ops,
+ .of_match_table = pm8xxx_id_table,
},
};
diff --git a/include/linux/mfd/pm8xxx/rtc.h b/include/linux/mfd/pm8xxx/rtc.h
deleted file mode 100644
index 14f1983..0000000
--- a/include/linux/mfd/pm8xxx/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef __RTC_PM8XXX_H__
-#define __RTC_PM8XXX_H__
-
-#define PM8XXX_RTC_DEV_NAME "rtc-pm8xxx"
-/**
- * struct pm8xxx_rtc_pdata - RTC driver platform data
- * @rtc_write_enable: variable stating RTC write capability
- */
-struct pm8xxx_rtc_platform_data {
- bool rtc_write_enable;
-};
-
-#endif /* __RTC_PM8XXX_H__ */
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
[not found] <1394047776-13827-1-git-send-email-joshc@codeaurora.org>
[not found] ` <1394047776-13827-1-git-send-email-joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2014-03-05 19:29 ` Josh Cartwright
2014-03-05 20:58 ` Stephen Boyd
1 sibling, 1 reply; 10+ messages in thread
From: Josh Cartwright @ 2014-03-05 19:29 UTC (permalink / raw)
To: Alessandro Zummo, linux-kernel
Cc: linux-arm-msm, Stephen Boyd, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley, devicetree,
linux-doc
This RTC is found on the Qualcomm 8921 and 8058 PMICs.
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
.../devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
new file mode 100644
index 0000000..699bd30
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
@@ -0,0 +1,29 @@
+* Real-Time Clock for Qualcomm 8058/8921 PMICs
+
+Required properties:
+- compatible: should be one of the following.
+ * "qcom,pm8058-rtc"
+ * "qcom,pm8921-rtc"
+- reg: base address of the register region
+- reg-names: corresponding reg names for the regions listed in the 'reg'
+ property, must contain:
+ "rtc_base" - base of the RTC register region
+- interrupts: interrupt list for the RTC, must contain a single interrupt
+ specifier for the alarm interrupt
+- interrupt-names: corresponding interrupt names for the interrupts listed in
+ the 'interrupts' property, must contain:
+ "alarm" - summary interrupt for PMIC peripherals
+
+Option properties:
+- linux,allow-set-time: indicates that the setting of RTC time is allowed by
+ the host CPU
+
+Example:
+
+ rtc {
+ compatible = "qcom,pm8921-rtc";
+ reg = <0x11D>;
+ reg-names = "rtc_base";
+ interrupts = <0x27 0>;
+ interrupt-names = "alarm";
+ };
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-05 19:29 ` [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
@ 2014-03-05 20:58 ` Stephen Boyd
2014-03-06 0:00 ` Josh Cartwright
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2014-03-05 20:58 UTC (permalink / raw)
To: Josh Cartwright
Cc: Alessandro Zummo, linux-kernel, linux-arm-msm, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
devicetree, linux-doc
On 03/05/14 11:29, Josh Cartwright wrote:
> diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> new file mode 100644
> index 0000000..699bd30
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> @@ -0,0 +1,29 @@
> +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> +
> +Required properties:
> +- compatible: should be one of the following.
> + * "qcom,pm8058-rtc"
> + * "qcom,pm8921-rtc"
> +- reg: base address of the register region
> +- reg-names: corresponding reg names for the regions listed in the 'reg'
> + property, must contain:
> + "rtc_base" - base of the RTC register region
optional reg-names?
> +- interrupts: interrupt list for the RTC, must contain a single interrupt
> + specifier for the alarm interrupt
> +- interrupt-names: corresponding interrupt names for the interrupts listed in
> + the 'interrupts' property, must contain:
> + "alarm" - summary interrupt for PMIC peripherals
optional interrupt-names?
> +
> +Option properties:
> +- linux,allow-set-time: indicates that the setting of RTC time is allowed by
> + the host CPU
Is this a "linux" property? It seems like something that other OSes
would want to know about and doesn't require any explicit knowledge
about operating system things (like keymaps for example).
> +
> +Example:
> +
> + rtc {
rtc@11d
> + compatible = "qcom,pm8921-rtc";
> + reg = <0x11D>;
> + reg-names = "rtc_base";
> + interrupts = <0x27 0>;
> + interrupt-names = "alarm";
> + };
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/6] rtc: pm8xxx: add support for devicetree
2014-03-05 19:29 ` [PATCH 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
@ 2014-03-05 20:59 ` Stephen Boyd
2014-03-06 9:18 ` Lee Jones
1 sibling, 0 replies; 10+ messages in thread
From: Stephen Boyd @ 2014-03-05 20:59 UTC (permalink / raw)
To: Josh Cartwright
Cc: Alessandro Zummo, David Brown, Daniel Walker, Bryan Huntsman,
Grant Likely, Rob Herring, linux-arm-msm, Samuel Ortiz, Lee Jones,
linux-kernel, rtc-linux, devicetree
On 03/05/14 11:29, Josh Cartwright wrote:
> Add support for describing the PM8921/PM8058 RTC in device tree.
>
> Additionally:
> - drop support for describing the RTC using platform data,
> as there are no current in tree users who do so.
> - make allow_set_time a device-specific flag, instead of mucking
> with the rtc_ops
>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-05 20:58 ` Stephen Boyd
@ 2014-03-06 0:00 ` Josh Cartwright
2014-03-06 1:31 ` Stephen Boyd
2014-03-10 15:35 ` Rob Herring
0 siblings, 2 replies; 10+ messages in thread
From: Josh Cartwright @ 2014-03-06 0:00 UTC (permalink / raw)
To: Stephen Boyd
Cc: Alessandro Zummo, linux-kernel, linux-arm-msm, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
devicetree, linux-doc
On Wed, Mar 05, 2014 at 12:58:55PM -0800, Stephen Boyd wrote:
> On 03/05/14 11:29, Josh Cartwright wrote:
> > diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > new file mode 100644
> > index 0000000..699bd30
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> > @@ -0,0 +1,29 @@
> > +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> > +
> > +Required properties:
> > +- compatible: should be one of the following.
> > + * "qcom,pm8058-rtc"
> > + * "qcom,pm8921-rtc"
> > +- reg: base address of the register region
> > +- reg-names: corresponding reg names for the regions listed in the 'reg'
> > + property, must contain:
> > + "rtc_base" - base of the RTC register region
>
> optional reg-names?
>
> > +- interrupts: interrupt list for the RTC, must contain a single interrupt
> > + specifier for the alarm interrupt
> > +- interrupt-names: corresponding interrupt names for the interrupts listed in
> > + the 'interrupts' property, must contain:
> > + "alarm" - summary interrupt for PMIC peripherals
>
> optional interrupt-names?
It isn't clear to me why these should be made optional, I hope Rob
provides some clarification in the sdhci-msm thread.
> > +
> > +Option properties:
Woops, this should be "Optional" :).
> > +- linux,allow-set-time: indicates that the setting of RTC time is allowed by
> > + the host CPU
>
> Is this a "linux" property? It seems like something that other OSes
> would want to know about and doesn't require any explicit knowledge
> about operating system things (like keymaps for example).
Yeah, I wasn't quite sure how to name this property. It's
Linux-specific in the sense that the underlying operation method is
"set_time", but I agree this should be named something else...
How do you feel about simply "allow-set-time"?
>
> > +
> > +Example:
> > +
> > + rtc {
>
> rtc@11d
Yep, thanks.
> > + compatible = "qcom,pm8921-rtc";
> > + reg = <0x11D>;
> > + reg-names = "rtc_base";
> > + interrupts = <0x27 0>;
> > + interrupt-names = "alarm";
> > + };
> >
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-06 0:00 ` Josh Cartwright
@ 2014-03-06 1:31 ` Stephen Boyd
2014-03-07 19:01 ` Josh Cartwright
2014-03-10 15:35 ` Rob Herring
1 sibling, 1 reply; 10+ messages in thread
From: Stephen Boyd @ 2014-03-06 1:31 UTC (permalink / raw)
To: Josh Cartwright
Cc: Alessandro Zummo, linux-kernel, linux-arm-msm, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
devicetree, linux-doc
On 03/05/14 16:00, Josh Cartwright wrote:
> On Wed, Mar 05, 2014 at 12:58:55PM -0800, Stephen Boyd wrote:
>> On 03/05/14 11:29, Josh Cartwright wrote:
>>> diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
>>> new file mode 100644
>>> index 0000000..699bd30
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
>>> @@ -0,0 +1,29 @@
>>> +* Real-Time Clock for Qualcomm 8058/8921 PMICs
>>> +
>>> +Required properties:
>>> +- compatible: should be one of the following.
>>> + * "qcom,pm8058-rtc"
>>> + * "qcom,pm8921-rtc"
>>> +- reg: base address of the register region
>>> +- reg-names: corresponding reg names for the regions listed in the 'reg'
>>> + property, must contain:
>>> + "rtc_base" - base of the RTC register region
>> optional reg-names?
>>
>>> +- interrupts: interrupt list for the RTC, must contain a single interrupt
>>> + specifier for the alarm interrupt
>>> +- interrupt-names: corresponding interrupt names for the interrupts listed in
>>> + the 'interrupts' property, must contain:
>>> + "alarm" - summary interrupt for PMIC peripherals
>> optional interrupt-names?
> It isn't clear to me why these should be made optional, I hope Rob
> provides some clarification in the sdhci-msm thread.
Looks like the driver isn't using either of these properties, so I'm not
sure why they're needed. Maybe they should just be removed.
>
>
>>> +- linux,allow-set-time: indicates that the setting of RTC time is allowed by
>>> + the host CPU
>> Is this a "linux" property? It seems like something that other OSes
>> would want to know about and doesn't require any explicit knowledge
>> about operating system things (like keymaps for example).
> Yeah, I wasn't quite sure how to name this property. It's
> Linux-specific in the sense that the underlying operation method is
> "set_time", but I agree this should be named something else...
>
> How do you feel about simply "allow-set-time"?
Sounds ok to me.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/6] rtc: pm8xxx: add support for devicetree
2014-03-05 19:29 ` [PATCH 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
2014-03-05 20:59 ` Stephen Boyd
@ 2014-03-06 9:18 ` Lee Jones
1 sibling, 0 replies; 10+ messages in thread
From: Lee Jones @ 2014-03-06 9:18 UTC (permalink / raw)
To: Josh Cartwright
Cc: Alessandro Zummo, David Brown, Daniel Walker, Bryan Huntsman,
Grant Likely, Rob Herring, linux-arm-msm, Stephen Boyd,
Samuel Ortiz, linux-kernel, rtc-linux, devicetree
> Add support for describing the PM8921/PM8058 RTC in device tree.
>
> Additionally:
> - drop support for describing the RTC using platform data,
> as there are no current in tree users who do so.
> - make allow_set_time a device-specific flag, instead of mucking
> with the rtc_ops
>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
> drivers/rtc/rtc-pm8xxx.c | 54 +++++++++++++++++++++++-------------------
> include/linux/mfd/pm8xxx/rtc.h | 25 -------------------
For the MFD changes@:
Acked-by: Lee Jones <lee.jones@linaro.org>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-06 1:31 ` Stephen Boyd
@ 2014-03-07 19:01 ` Josh Cartwright
0 siblings, 0 replies; 10+ messages in thread
From: Josh Cartwright @ 2014-03-07 19:01 UTC (permalink / raw)
To: Stephen Boyd
Cc: Alessandro Zummo, linux-kernel, linux-arm-msm, Rob Herring,
Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, Rob Landley,
devicetree, linux-doc
On Wed, Mar 05, 2014 at 05:31:27PM -0800, Stephen Boyd wrote:
> On 03/05/14 16:00, Josh Cartwright wrote:
> > On Wed, Mar 05, 2014 at 12:58:55PM -0800, Stephen Boyd wrote:
> >> On 03/05/14 11:29, Josh Cartwright wrote:
> >>> diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> >>> new file mode 100644
> >>> index 0000000..699bd30
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
> >>> @@ -0,0 +1,29 @@
> >>> +* Real-Time Clock for Qualcomm 8058/8921 PMICs
> >>> +
> >>> +Required properties:
> >>> +- compatible: should be one of the following.
> >>> + * "qcom,pm8058-rtc"
> >>> + * "qcom,pm8921-rtc"
> >>> +- reg: base address of the register region
> >>> +- reg-names: corresponding reg names for the regions listed in the 'reg'
> >>> + property, must contain:
> >>> + "rtc_base" - base of the RTC register region
> >> optional reg-names?
> >>
> >>> +- interrupts: interrupt list for the RTC, must contain a single interrupt
> >>> + specifier for the alarm interrupt
> >>> +- interrupt-names: corresponding interrupt names for the interrupts listed in
> >>> + the 'interrupts' property, must contain:
> >>> + "alarm" - summary interrupt for PMIC peripherals
> >> optional interrupt-names?
> > It isn't clear to me why these should be made optional, I hope Rob
> > provides some clarification in the sdhci-msm thread.
>
> Looks like the driver isn't using either of these properties, so I'm not
> sure why they're needed. Maybe they should just be removed.
The driver does make use of platform_get_irq_byname(pdev, "alarm"), and
I expect to make use of platform_get_resource_byname(pdev, IORESOURCE_REG, "rtc_base")
in the near future.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-06 0:00 ` Josh Cartwright
2014-03-06 1:31 ` Stephen Boyd
@ 2014-03-10 15:35 ` Rob Herring
2014-03-10 17:05 ` Josh Cartwright
1 sibling, 1 reply; 10+ messages in thread
From: Rob Herring @ 2014-03-10 15:35 UTC (permalink / raw)
To: Josh Cartwright
Cc: Stephen Boyd, Alessandro Zummo, linux-kernel@vger.kernel.org,
linux-arm-msm, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Rob Landley, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
On Wed, Mar 5, 2014 at 6:00 PM, Josh Cartwright <joshc@codeaurora.org> wrote:
> On Wed, Mar 05, 2014 at 12:58:55PM -0800, Stephen Boyd wrote:
>> On 03/05/14 11:29, Josh Cartwright wrote:
>> > diff --git a/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
>> > new file mode 100644
>> > index 0000000..699bd30
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/rtc/qcom,pm8xxx-rtc.txt
>> > @@ -0,0 +1,29 @@
>> > +* Real-Time Clock for Qualcomm 8058/8921 PMICs
>> > +
>> > +Required properties:
>> > +- compatible: should be one of the following.
>> > + * "qcom,pm8058-rtc"
>> > + * "qcom,pm8921-rtc"
>> > +- reg: base address of the register region
>> > +- reg-names: corresponding reg names for the regions listed in the 'reg'
>> > + property, must contain:
>> > + "rtc_base" - base of the RTC register region
>>
>> optional reg-names?
>>
>> > +- interrupts: interrupt list for the RTC, must contain a single interrupt
>> > + specifier for the alarm interrupt
>> > +- interrupt-names: corresponding interrupt names for the interrupts listed in
>> > + the 'interrupts' property, must contain:
>> > + "alarm" - summary interrupt for PMIC peripherals
>>
>> optional interrupt-names?
>
> It isn't clear to me why these should be made optional, I hope Rob
> provides some clarification in the sdhci-msm thread.
Because reg and interrupt names are relatively new and reluctantly
added by DT maintainers. Personally, I think it was a mistake and it
is simply Linux specific information leaking into the DT, but it did
make transition to DT easier. The requirement is still the ordering of
reg and interrupts fields must be defined and you cannot rely on the
names to define the order. It is quite pointless here since you only
have 1 field.
Rob
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC
2014-03-10 15:35 ` Rob Herring
@ 2014-03-10 17:05 ` Josh Cartwright
0 siblings, 0 replies; 10+ messages in thread
From: Josh Cartwright @ 2014-03-10 17:05 UTC (permalink / raw)
To: Rob Herring
Cc: Stephen Boyd, Alessandro Zummo, linux-kernel@vger.kernel.org,
linux-arm-msm, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Rob Landley, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Hey Rob-
Thanks for the reply.
On Mon, Mar 10, 2014 at 10:35:25AM -0500, Rob Herring wrote:
> On Wed, Mar 5, 2014 at 6:00 PM, Josh Cartwright <joshc@codeaurora.org> wrote:
> > On Wed, Mar 05, 2014 at 12:58:55PM -0800, Stephen Boyd wrote:
> >> On 03/05/14 11:29, Josh Cartwright wrote:
> >> > +- interrupts: interrupt list for the RTC, must contain a single interrupt
> >> > + specifier for the alarm interrupt
> >> > +- interrupt-names: corresponding interrupt names for the interrupts listed in
> >> > + the 'interrupts' property, must contain:
> >> > + "alarm" - summary interrupt for PMIC peripherals
> >>
> >> optional interrupt-names?
> >
> > It isn't clear to me why these should be made optional, I hope Rob
> > provides some clarification in the sdhci-msm thread.
>
> Because reg and interrupt names are relatively new and reluctantly
> added by DT maintainers. Personally, I think it was a mistake and it
> is simply Linux specific information leaking into the DT, but it did
> make transition to DT easier.
I don't necessarily buy the Linux-specific argument in general. If a
devices' datasheet clearly gives names to register regions and
interrupts, what about reflecting these names in the bindings is
Linux-specific?
Now, there are probably abuses of this, where the reg-names and
interrupt-names are abused to ensure driver compatibility with devices
described in board files, and only in that case will I agree is
Linux-specific and should be strongly discouraged.
> The requirement is still the ordering of reg and interrupts fields
> must be defined and you cannot rely on the names to define the order.
Should this requirement also exist for other <foo>-names properties?
> It is quite pointless here since you only have 1 field.
Indeed in the interrupt case it is worthless, as there is only one alarm
interrupt. However for registers I do plan to extend this binding in
the future to document a newer RTC which does split registers across
multiple named address regions.
Thanks again,
Josh
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-03-10 17:05 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1394047776-13827-1-git-send-email-joshc@codeaurora.org>
[not found] ` <1394047776-13827-1-git-send-email-joshc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-03-05 19:29 ` [PATCH 4/6] rtc: pm8xxx: add support for devicetree Josh Cartwright
2014-03-05 20:59 ` Stephen Boyd
2014-03-06 9:18 ` Lee Jones
2014-03-05 19:29 ` [PATCH 6/6] documentation: bindings: document PMIC8921/8058 RTC Josh Cartwright
2014-03-05 20:58 ` Stephen Boyd
2014-03-06 0:00 ` Josh Cartwright
2014-03-06 1:31 ` Stephen Boyd
2014-03-07 19:01 ` Josh Cartwright
2014-03-10 15:35 ` Rob Herring
2014-03-10 17:05 ` Josh Cartwright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).