From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:22
This patch set is a v2 of a patchset I sent in March.
The previous patch 5/5 was garbage and has been dropped.
It was garbage, for two reasons:
- It enforced the jz4740-rtc as the system power controller in the
SoC devicetree file, which introduced policy (maybe the jz4740-based
boards want to use something else as the system power controller)
- It added the 'system-power-controller' entry not to the jz4740-rtc driver
node, but to the 'rtc' clock node... I don't know how that slipped in, but
I apologise for that. I need to raise my QA standards.
For the rest:
1/7: No change
2/7:
- Remove 'interrupt-parent' of the list of required properties
- Add the -msec suffix for the DT entries that represent time
3/7: No change
4/7:
- Get a handle to the 'rtc' clock in the probe function, to handle errors early
- Call clk_prepare_enable() on the 'rtc' clock before calling clk_get_rate()
- Use the -msec suffix for the OF properties that deal with time
- Use of_property_read_32() instead of device_property_read_u32()
5/7, 6/7, 7/7: New patches
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:13
Since we already have a devicetree node for the jz4740-rtc driver, we
don't have to probe it from platform code.
Besides, using the jz4740-rtc driver as the power controller for the
qi_lb60 platform allows us to remove the jz4740 platform power-off code,
since this is the only jz4740-based board upstream.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/boot/dts/ingenic/qi_lb60.dts | 4 ++++
arch/mips/jz4740/board-qi_lb60.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
v2: New patch in this series
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:15
This commit adds documentation for the device-tree bindings of the
jz4740-rtc driver, which supports the RTC unit present in the JZ4740 and
JZ4780 SoCs from Ingenic.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
.../devicetree/bindings/rtc/ingenic,jz4740-rtc.txt | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
v2:
- Remove 'interrupt-parent' of the list of required properties
- Add the -msec suffix for the DT entries that represent time
@@ -0,0 +1,37 @@+JZ4740 and similar SoCs real-time clock driver++Required properties:++- compatible: One of:+ - "ingenic,jz4740-rtc" - for use with the JZ4740 SoC+ - "ingenic,jz4780-rtc" - for use with the JZ4780 SoC+- reg: Address range of rtc register set+- interrupts: IRQ number for the alarm interrupt+- clocks: phandle to the "rtc" clock+- clock-names: must be "rtc"++Optional properties:+- system-power-controller: To use this component as the+ system power controller+- reset-pin-assert-time-msec: Reset pin low-level assertion+ time after wakeup (default 60ms; range 0-125ms if RTC clock+ at 32 kHz)+- min-wakeup-pin-assert-time-msec: Minimum wakeup pin assertion+ time (default 100ms; range 0-2s if RTC clock at 32 kHz)++Example:++rtc@10003000 {+ compatible = "ingenic,jz4740-rtc";+ reg = <0x10003000 0x3F>;++ interrupt-parent = <&intc>;+ interrupts = <32>;++ clocks = <&rtc_clock>;+ clock-names = "rtc";++ system-power-controller;+ reset-pin-assert-time-msec = <60>;+ min-wakeup-pin-assert-time-msec = <100>;+};
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Rob Herring <robh@kernel.org> Date: 2016-10-31 06:39:37
On Mon, Oct 31, 2016 at 12:02:42AM +0100, Paul Cercueil wrote:
This commit adds documentation for the device-tree bindings of the
jz4740-rtc driver, which supports the RTC unit present in the JZ4740 and
JZ4780 SoCs from Ingenic.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
.../devicetree/bindings/rtc/ingenic,jz4740-rtc.txt | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
v2:
- Remove 'interrupt-parent' of the list of required properties
- Add the -msec suffix for the DT entries that represent time
Sorry, I told you the wrong suffix. It should be '-ms' as documented in
.../bindings/property-units.txt. I never can remember which is why I
wrote the doc to begin with. With that fix,
Acked-by: Rob Herring <redacted>
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Sergei Shtylyov <hidden> Date: 2016-10-31 09:48:43
Hello.
On 10/31/2016 2:02 AM, Paul Cercueil wrote:
quoted hunk
This commit adds documentation for the device-tree bindings of the
jz4740-rtc driver, which supports the RTC unit present in the JZ4740 and
JZ4780 SoCs from Ingenic.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
.../devicetree/bindings/rtc/ingenic,jz4740-rtc.txt | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
v2:
- Remove 'interrupt-parent' of the list of required properties
- Add the -msec suffix for the DT entries that represent time
Are you sure it's not 0x40? It's a size, not a limit...
[...]
MBR, Sergei
--
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
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:18
See
Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
for a description of the bindings.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/rtc-jz4740.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
v2: No change
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:24
This commit removes two things:
- The platform_device that corresponds to the RTC driver, since we now
probe this driver from devicetree;
- The platform power-off code, since all the jz4740-based platforms are
now using the jz4740-rtc driver as the system power controller.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/include/asm/mach-jz4740/platform.h | 1 -
arch/mips/jz4740/platform.c | 21 ----------
arch/mips/jz4740/reset.c | 63 ----------------------------
3 files changed, 85 deletions(-)
v2: New patch in this series
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:09:26
The RTC unit present in the JZ4780 works mostly the same as the one in
the JZ4740. The major difference is that register writes need to be
explicitly enabled, by writing a magic code (0xA55A) to a "write
enable" register before each access.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/Kconfig | 6 +++---
drivers/rtc/rtc-jz4740.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 5 deletions(-)
v2: No change
@@ -29,6 +29,10 @@#define JZ_REG_RTC_HIBERNATE 0x20#define JZ_REG_RTC_SCRATCHPAD 0x34+/* The following are present on the jz4780 */+#define JZ_REG_RTC_WENR 0x3C+#define JZ_RTC_WENR_WEN BIT(31)+#define JZ_RTC_CTRL_WRDY BIT(7)#define JZ_RTC_CTRL_1HZ BIT(6)#define JZ_RTC_CTRL_1HZ_IRQ BIT(5)
@@ -37,8 +41,17 @@#define JZ_RTC_CTRL_AE BIT(2)#define JZ_RTC_CTRL_ENABLE BIT(0)+/* Magic value to enable writes on jz4780 */+#define JZ_RTC_WENR_MAGIC 0xA55A++enumjz4740_rtc_type{+ID_JZ4740,+ID_JZ4780,+};+structjz4740_rtc{void__iomem*base;+enumjz4740_rtc_typetype;structrtc_device*rtc;
@@ -64,11 +77,33 @@ static int jz4740_rtc_wait_write_ready(struct jz4740_rtc *rtc)returntimeout?0:-EIO;}+staticinlineintjz4780_rtc_enable_write(structjz4740_rtc*rtc)+{+uint32_tctrl;+intret,timeout=1000;++ret=jz4740_rtc_wait_write_ready(rtc);+if(ret!=0)+returnret;++writel(JZ_RTC_WENR_MAGIC,rtc->base+JZ_REG_RTC_WENR);++do{+ctrl=readl(rtc->base+JZ_REG_RTC_WENR);+}while(!(ctrl&JZ_RTC_WENR_WEN)&&--timeout);++returntimeout?0:-EIO;+}+staticinlineintjz4740_rtc_reg_write(structjz4740_rtc*rtc,size_treg,uint32_tval){-intret;-ret=jz4740_rtc_wait_write_ready(rtc);+intret=0;++if(rtc->type>=ID_JZ4780)+ret=jz4780_rtc_enable_write(rtc);+if(ret==0)+ret=jz4740_rtc_wait_write_ready(rtc);if(ret==0)writel(val,rtc->base+reg);
@@ -216,11 +251,14 @@ static int jz4740_rtc_probe(struct platform_device *pdev)structjz4740_rtc*rtc;uint32_tscratchpad;structresource*mem;+conststructplatform_device_id*id=platform_get_device_id(pdev);rtc=devm_kzalloc(&pdev->dev,sizeof(*rtc),GFP_KERNEL);if(!rtc)return-ENOMEM;+rtc->type=id->driver_data;+rtc->irq=platform_get_irq(pdev,0);if(rtc->irq<0){dev_err(&pdev->dev,"Failed to get platform irq\n");
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:10:43
Now that the jz4740-rtc driver supports devicetree, we can add a
devicetree node for it.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/boot/dts/ingenic/jz4740.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
v2: Previous patch 5/5 was garbage. This is a new patch.
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Sergei Shtylyov <hidden> Date: 2016-10-31 09:50:43
Hello.
On 10/31/2016 2:02 AM, Paul Cercueil wrote:
quoted hunk
Now that the jz4740-rtc driver supports devicetree, we can add a
devicetree node for it.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/boot/dts/ingenic/jz4740.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
v2: Previous patch 5/5 was garbage. This is a new patch.
Just "rtc@10003000" to comply with the DT spec.
[...]
MBR, Sergei
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-30 23:11:02
The 'system-power-controller' singleton entry can be used in the
devicetree node of the jz4740-rtc driver to specify that the driver is
granted the right to power off the system through the registers of the
RTC unit.
See the documentation for more details:
Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/rtc-jz4740.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
v2:
- Get a handle to the 'rtc' clock in the probe function, to handle errors early
- Call clk_prepare_enable() on the 'rtc' clock before calling clk_get_rate()
- Use the -msec suffix for the OF properties that deal with time
- Use of_property_read_32() instead of device_property_read_u32()
@@ -28,6 +30,8 @@#define JZ_REG_RTC_SEC_ALARM 0x08#define JZ_REG_RTC_REGULATOR 0x0C#define JZ_REG_RTC_HIBERNATE 0x20+#define JZ_REG_RTC_WAKEUP_FILTER 0x24+#define JZ_REG_RTC_RESET_COUNTER 0x28#define JZ_REG_RTC_SCRATCHPAD 0x34/* The following are present on the jz4780 */
@@ -45,6 +49,9 @@/* Magic value to enable writes on jz4780 */#define JZ_RTC_WENR_MAGIC 0xA55A+#define JZ_RTC_WAKEUP_FILTER_MASK 0x0000FFE0+#define JZ_RTC_RESET_COUNTER_MASK 0x00000FE0+enumjz4740_rtc_type{ID_JZ4740,ID_JZ4780,
@@ -262,6 +315,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev)conststructplatform_device_id*id=platform_get_device_id(pdev);conststructof_device_id*of_id=of_match_device(jz4740_rtc_of_match,&pdev->dev);+structdevice_node*np=pdev->dev.of_node;rtc=devm_kzalloc(&pdev->dev,sizeof(*rtc),GFP_KERNEL);if(!rtc)
@@ -283,6 +337,12 @@ static int jz4740_rtc_probe(struct platform_device *pdev)if(IS_ERR(rtc->base))returnPTR_ERR(rtc->base);+rtc->clk=devm_clk_get(&pdev->dev,"rtc");+if(IS_ERR(rtc->clk)){+dev_err(&pdev->dev,"Failed to get RTC clock\n");+returnPTR_ERR(rtc->clk);+}+spin_lock_init(&rtc->lock);platform_set_drvdata(pdev,rtc);
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:40:27
The RTC unit present in the JZ4780 works mostly the same as the one in
the JZ4740. The major difference is that register writes need to be
explicitly enabled, by writing a magic code (0xA55A) to a "write
enable" register before each access.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/Kconfig | 6 +++---
drivers/rtc/rtc-jz4740.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 5 deletions(-)
v2: No change
v3: No change
@@ -29,6 +29,10 @@#define JZ_REG_RTC_HIBERNATE 0x20#define JZ_REG_RTC_SCRATCHPAD 0x34+/* The following are present on the jz4780 */+#define JZ_REG_RTC_WENR 0x3C+#define JZ_RTC_WENR_WEN BIT(31)+#define JZ_RTC_CTRL_WRDY BIT(7)#define JZ_RTC_CTRL_1HZ BIT(6)#define JZ_RTC_CTRL_1HZ_IRQ BIT(5)
@@ -37,8 +41,17 @@#define JZ_RTC_CTRL_AE BIT(2)#define JZ_RTC_CTRL_ENABLE BIT(0)+/* Magic value to enable writes on jz4780 */+#define JZ_RTC_WENR_MAGIC 0xA55A++enumjz4740_rtc_type{+ID_JZ4740,+ID_JZ4780,+};+structjz4740_rtc{void__iomem*base;+enumjz4740_rtc_typetype;structrtc_device*rtc;
@@ -64,11 +77,33 @@ static int jz4740_rtc_wait_write_ready(struct jz4740_rtc *rtc)returntimeout?0:-EIO;}+staticinlineintjz4780_rtc_enable_write(structjz4740_rtc*rtc)+{+uint32_tctrl;+intret,timeout=1000;++ret=jz4740_rtc_wait_write_ready(rtc);+if(ret!=0)+returnret;++writel(JZ_RTC_WENR_MAGIC,rtc->base+JZ_REG_RTC_WENR);++do{+ctrl=readl(rtc->base+JZ_REG_RTC_WENR);+}while(!(ctrl&JZ_RTC_WENR_WEN)&&--timeout);++returntimeout?0:-EIO;+}+staticinlineintjz4740_rtc_reg_write(structjz4740_rtc*rtc,size_treg,uint32_tval){-intret;-ret=jz4740_rtc_wait_write_ready(rtc);+intret=0;++if(rtc->type>=ID_JZ4780)+ret=jz4780_rtc_enable_write(rtc);+if(ret==0)+ret=jz4740_rtc_wait_write_ready(rtc);if(ret==0)writel(val,rtc->base+reg);
@@ -216,11 +251,14 @@ static int jz4740_rtc_probe(struct platform_device *pdev)structjz4740_rtc*rtc;uint32_tscratchpad;structresource*mem;+conststructplatform_device_id*id=platform_get_device_id(pdev);rtc=devm_kzalloc(&pdev->dev,sizeof(*rtc),GFP_KERNEL);if(!rtc)return-ENOMEM;+rtc->type=id->driver_data;+rtc->irq=platform_get_irq(pdev,0);if(rtc->irq<0){dev_err(&pdev->dev,"Failed to get platform irq\n");
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:40:22
See
Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
for a description of the bindings.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/rtc-jz4740.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
v2: No change
v3: No change
--
2.9.3
--
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
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:40:24
The 'system-power-controller' singleton entry can be used in the
devicetree node of the jz4740-rtc driver to specify that the driver is
granted the right to power off the system through the registers of the
RTC unit.
See the documentation for more details:
Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/rtc-jz4740.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
v2:
- Get a handle to the 'rtc' clock in the probe function, to handle errors early
- Call clk_prepare_enable() on the 'rtc' clock before calling clk_get_rate()
- Use the -msec suffix for the OF properties that deal with time
- Use of_property_read_32() instead of device_property_read_u32()
v3: Replace the -msec suffix by -ms
@@ -28,6 +30,8 @@#define JZ_REG_RTC_SEC_ALARM 0x08#define JZ_REG_RTC_REGULATOR 0x0C#define JZ_REG_RTC_HIBERNATE 0x20+#define JZ_REG_RTC_WAKEUP_FILTER 0x24+#define JZ_REG_RTC_RESET_COUNTER 0x28#define JZ_REG_RTC_SCRATCHPAD 0x34/* The following are present on the jz4780 */
@@ -45,6 +49,9 @@/* Magic value to enable writes on jz4780 */#define JZ_RTC_WENR_MAGIC 0xA55A+#define JZ_RTC_WAKEUP_FILTER_MASK 0x0000FFE0+#define JZ_RTC_RESET_COUNTER_MASK 0x00000FE0+enumjz4740_rtc_type{ID_JZ4740,ID_JZ4780,
@@ -262,6 +315,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev)conststructplatform_device_id*id=platform_get_device_id(pdev);conststructof_device_id*of_id=of_match_device(jz4740_rtc_of_match,&pdev->dev);+structdevice_node*np=pdev->dev.of_node;rtc=devm_kzalloc(&pdev->dev,sizeof(*rtc),GFP_KERNEL);if(!rtc)
@@ -283,6 +337,12 @@ static int jz4740_rtc_probe(struct platform_device *pdev)if(IS_ERR(rtc->base))returnPTR_ERR(rtc->base);+rtc->clk=devm_clk_get(&pdev->dev,"rtc");+if(IS_ERR(rtc->clk)){+dev_err(&pdev->dev,"Failed to get RTC clock\n");+returnPTR_ERR(rtc->clk);+}+spin_lock_init(&rtc->lock);platform_set_drvdata(pdev,rtc);
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:40:40
This commit removes two things:
- The platform_device that corresponds to the RTC driver, since we now
probe this driver from devicetree;
- The platform power-off code, since all the jz4740-based platforms are
now using the jz4740-rtc driver as the system power controller.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/include/asm/mach-jz4740/platform.h | 1 -
arch/mips/jz4740/platform.c | 21 ----------
arch/mips/jz4740/reset.c | 63 ----------------------------
3 files changed, 85 deletions(-)
v2: New patch in this series
v3: No change
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:42:21
Since we already have a devicetree node for the jz4740-rtc driver, we
don't have to probe it from platform code.
Besides, using the jz4740-rtc driver as the power controller for the
qi_lb60 platform allows us to remove the jz4740 platform power-off code,
since this is the only jz4740-based board upstream.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/boot/dts/ingenic/qi_lb60.dts | 4 ++++
arch/mips/jz4740/board-qi_lb60.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
v2: New patch in this series
v3: No change
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:42:41
This commit adds documentation for the device-tree bindings of the
jz4740-rtc driver, which supports the RTC unit present in the JZ4740 and
JZ4780 SoCs from Ingenic.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
.../devicetree/bindings/rtc/ingenic,jz4740-rtc.txt | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
v2:
- Remove 'interrupt-parent' of the list of required properties
- Add the -msec suffix for the DT entries that represent time
v3:
- Replace the -msec suffix by -ms
- Change the register area size from 0x3F to 0x40
@@ -0,0 +1,37 @@+JZ4740 and similar SoCs real-time clock driver++Required properties:++- compatible: One of:+ - "ingenic,jz4740-rtc" - for use with the JZ4740 SoC+ - "ingenic,jz4780-rtc" - for use with the JZ4780 SoC+- reg: Address range of rtc register set+- interrupts: IRQ number for the alarm interrupt+- clocks: phandle to the "rtc" clock+- clock-names: must be "rtc"++Optional properties:+- system-power-controller: To use this component as the+ system power controller+- reset-pin-assert-time-ms: Reset pin low-level assertion+ time after wakeup (default 60ms; range 0-125ms if RTC clock+ at 32 kHz)+- min-wakeup-pin-assert-time-ms: Minimum wakeup pin assertion+ time (default 100ms; range 0-2s if RTC clock at 32 kHz)++Example:++rtc@10003000 {+ compatible = "ingenic,jz4740-rtc";+ reg = <0x10003000 0x40>;++ interrupt-parent = <&intc>;+ interrupts = <32>;++ clocks = <&rtc_clock>;+ clock-names = "rtc";++ system-power-controller;+ reset-pin-assert-time-ms = <60>;+ min-wakeup-pin-assert-time-ms = <100>;+};
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
From: Rob Herring <robh+dt@kernel.org> Date: 2016-10-31 21:17:22
On Mon, Oct 31, 2016 at 3:39 PM, Paul Cercueil [off-list ref] wrote:
This commit adds documentation for the device-tree bindings of the
jz4740-rtc driver, which supports the RTC unit present in the JZ4740 and
JZ4780 SoCs from Ingenic.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Maarten ter Huurne <redacted>
---
.../devicetree/bindings/rtc/ingenic,jz4740-rtc.txt | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt
From: Paul Cercueil <paul@crapouillou.net> Date: 2016-10-31 20:42:42
Now that the jz4740-rtc driver supports devicetree, we can add a
devicetree node for it.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
arch/mips/boot/dts/ingenic/jz4740.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
v2: Previous patch 5/5 was garbage. This is a new patch.
v3: Changed 'jz4740-rtc@10003000' to 'rtc@10003000'
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
On 31/10/2016 at 21:39:45 +0100, Paul Cercueil wrote :
The RTC unit present in the JZ4780 works mostly the same as the one in
the JZ4740. The major difference is that register writes need to be
explicitly enabled, by writing a magic code (0xA55A) to a "write
enable" register before each access.
Signed-off-by: Paul Cercueil <redacted>
Acked-by: Maarten ter Huurne <redacted>
---
drivers/rtc/Kconfig | 6 +++---
drivers/rtc/rtc-jz4740.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 51 insertions(+), 5 deletions(-)
v2: No change
v3: No change
All applied, thanks
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.