Skip to contentSkip to conversation

add Alphascale asm9260 RTC driver

PATCH Superseded Oleksij Rempel 3 participants 15 messages Jan 29, 2016 – Feb 20, 2016 9 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover add Alphascale asm9260 RTC driver

This patch set provide support for RTC controller found on Alphascale ASM9260 SoC.

Oleksij Rempel (2):
rtc: add rtc-asm9260 driver
doc: dt: add documentation for alphascale,asm9260-rtc

 .../bindings/rtc/alphascale,asm9260-rtc.txt        |  25 ++
 drivers/rtc/Kconfig                                |  10 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-asm9260.c                          | 391 +++++++++++++++++++++
 4 files changed, 427 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
 create mode 100644 drivers/rtc/rtc-asm9260.c
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1454056802-23386-1-git-send-email-linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org

#2 lore raw

PATCH 1/2 rtc: add rtc-asm9260 driver

Add support for RTC controller found on Alphascale asm9260 SoC.

---
 drivers/rtc/Kconfig       |  10 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-asm9260.c | 391 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 402 insertions(+)
 create mode 100644 drivers/rtc/rtc-asm9260.c
drivers/rtc/Kconfig +10 -0
index 376322f..733b6aa 100644
@@ -1144,6 +1144,16 @@ config RTC_DRV_ZYNQMP
 
 comment "on-CPU RTC drivers"
 
+config RTC_DRV_ASM9260
+	tristate "Alphascale asm9260 RTC"
+	depends on MACH_ASM9260
+	help
+	  If you say yes here you get support for the RTC on the
+	  Alphascale asm9260 SoC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-asm9260.
+
 config RTC_DRV_DAVINCI
 	tristate "TI DaVinci RTC"
 	depends on ARCH_DAVINCI_DM365
drivers/rtc/Makefile +1 -0
index 62d61b2..f4d841b 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_RTC_DRV_ABB5ZES3)	+= rtc-ab-b5ze-s3.o
 obj-$(CONFIG_RTC_DRV_ABX80X)	+= rtc-abx80x.o
 obj-$(CONFIG_RTC_DRV_ARMADA38X)	+= rtc-armada38x.o
 obj-$(CONFIG_RTC_DRV_AS3722)	+= rtc-as3722.o
+obj-$(CONFIG_RTC_DRV_ASM9260)	+= rtc-asm9260.o
 obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
 obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
 obj-$(CONFIG_RTC_DRV_AT91SAM9)	+= rtc-at91sam9.o
drivers/rtc/rtc-asm9260.c new file +391 -0

391 lines not on this page · raw message

Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1454056802-23386-2-git-send-email-linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org

#4 lore raw

Re: [PATCH 1/2] rtc: add rtc-asm9260 driver

Quoted 15 lines · Oleksij Rempel
drivers/rtc/rtc-asm9260.c new file +15 -0
+static irqreturn_t asm9260_rtc_irq(int irq, void *dev_id)
+{
+	struct asm9260_rtc_priv *priv = dev_id;
+	u32 isr;
+	unsigned long events = 0;
+
+	isr = ioread32(priv->iobase + HW_CIIR);
+	if (!isr)
+		return IRQ_NONE;
+
+	iowrite32(0, priv->iobase + HW_CIIR);
+
+	events |= RTC_AF | RTC_IRQF;
+
+	rtc_update_irq(priv->rtc, 1, events);

drivers/rtc/rtc-asm9260.c line 158

Quoted 10 lines
drivers/rtc/rtc-asm9260.c new file +10 -0
+
+	return IRQ_HANDLED;
+}
+
+static int asm9260_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
+	u32 ctime0, ctime1, ctime2;
+	unsigned long irq_flags;
+

It would be nice to actually use BM_RTC_OSCF and return -EINVAL if it is set.

Quoted 40 lines
drivers/rtc/rtc-asm9260.c new file +40 -0
+	spin_lock_irqsave(&priv->lock, irq_flags);
+	ctime0 = ioread32(priv->iobase + HW_CTIME0);
+	ctime1 = ioread32(priv->iobase + HW_CTIME1);
+	ctime2 = ioread32(priv->iobase + HW_CTIME2);
+
+	if (ctime1 != ioread32(priv->iobase + HW_CTIME1)) {
+		/*
+		 * woops, counter flipped right now. Now we are safe
+		 * to reread.
+		 */
+		ctime0 = ioread32(priv->iobase + HW_CTIME0);
+		ctime1 = ioread32(priv->iobase + HW_CTIME1);
+		ctime2 = ioread32(priv->iobase + HW_CTIME2);
+	}
+	spin_unlock_irqrestore(&priv->lock, irq_flags);
+
+	tm->tm_sec  = (ctime0 >> BM_CTIME0_SEC_S)  & BM_CTIME0_SEC_M;
+	tm->tm_min  = (ctime0 >> BM_CTIME0_MIN_S)  & BM_CTIME0_MIN_M;
+	tm->tm_hour = (ctime0 >> BM_CTIME0_HOUR_S) & BM_CTIME0_HOUR_M;
+	tm->tm_wday = (ctime0 >> BM_CTIME0_DOW_S)  & BM_CTIME0_DOW_M;
+
+	tm->tm_mday = (ctime1 >> BM_CTIME1_DOM_S)  & BM_CTIME1_DOM_M;
+	tm->tm_mon  = (ctime1 >> BM_CTIME1_MON_S)  & BM_CTIME1_MON_M;
+	tm->tm_year = (ctime1 >> BM_CTIME1_YEAR_S) & BM_CTIME1_YEAR_M;
+
+	tm->tm_yday = (ctime2 >> BM_CTIME2_DOY_S)  & BM_CTIME2_DOY_M;
+
+	return 0;
+}
+
+static int asm9260_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
+	unsigned long irq_flags;
+
+	spin_lock_irqsave(&priv->lock, irq_flags);
+	/*
+	 * make sure SEC counter will not flip other counter on write time,
+	 * real value will be written at the enf of sequence.
+	 */

drivers/rtc/rtc-asm9260.c line 208

Quoted 10 lines
drivers/rtc/rtc-asm9260.c new file +10 -0
+	iowrite32(0, priv->iobase + HW_SEC);
+
+	iowrite32(tm->tm_year, priv->iobase + HW_YEAR);
+	iowrite32(tm->tm_mon,  priv->iobase + HW_MONTH);
+	iowrite32(tm->tm_mday, priv->iobase + HW_DOM);
+	iowrite32(tm->tm_wday, priv->iobase + HW_DOW);
+	iowrite32(tm->tm_yday, priv->iobase + HW_DOY);
+	iowrite32(tm->tm_hour, priv->iobase + HW_HOUR);
+	iowrite32(tm->tm_min,  priv->iobase + HW_MIN);
+	iowrite32(tm->tm_sec,  priv->iobase + HW_SEC);

That would be a good time to reset BM_RTC_OSCF. Maybe it can also be useful to enable the interrupt but there isn't much more to do than print an error message.

Quoted 5 lines
drivers/rtc/rtc-asm9260.c new file +5 -0
+	spin_unlock_irqrestore(&priv->lock, irq_flags);
+
+	return 0;
+}
+
Signature · 7 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 1/2] rtc: add rtc-asm9260 driver

Am 01.02.2016 um 17:05 schrieb Alexandre Belloni:

Quoted 21 lines · Oleksij Rempel
Quoted 20 lines
drivers/rtc/rtc-asm9260.c new file +20 -0
+static irqreturn_t asm9260_rtc_irq(int irq, void *dev_id)
+{
+	struct asm9260_rtc_priv *priv = dev_id;
+	u32 isr;
+	unsigned long events = 0;
+
+	isr = ioread32(priv->iobase + HW_CIIR);
+	if (!isr)
+		return IRQ_NONE;
+
+	iowrite32(0, priv->iobase + HW_CIIR);
+
+	events |= RTC_AF | RTC_IRQF;
+
+	rtc_update_irq(priv->rtc, 1, events);
+
+	return IRQ_HANDLED;
+}
+
+static int asm9260_rtc_read_time(struct device *dev, struct rtc_time *tm)
Quoted 8 lines

drivers/rtc/rtc-asm9260.c line 158

Quoted 5 lines
drivers/rtc/rtc-asm9260.c new file +5 -0
+{
+	struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
+	u32 ctime0, ctime1, ctime2;
+	unsigned long irq_flags;
+

It would be nice to actually use BM_RTC_OSCF and return -EINVAL if it is set.

Hm... this register was described in reference driver, but not in the documentation. Now i did some testing but i can't confirm that it is working. BM_RTC_OSCF is never set, even after completely reseted clock removed battery or shortened XTAL.
So, i will remove this register from the driver.

Quoted 55 lines
Quoted 40 lines
drivers/rtc/rtc-asm9260.c new file +40 -0
+	spin_lock_irqsave(&priv->lock, irq_flags);
+	ctime0 = ioread32(priv->iobase + HW_CTIME0);
+	ctime1 = ioread32(priv->iobase + HW_CTIME1);
+	ctime2 = ioread32(priv->iobase + HW_CTIME2);
+
+	if (ctime1 != ioread32(priv->iobase + HW_CTIME1)) {
+		/*
+		 * woops, counter flipped right now. Now we are safe
+		 * to reread.
+		 */
+		ctime0 = ioread32(priv->iobase + HW_CTIME0);
+		ctime1 = ioread32(priv->iobase + HW_CTIME1);
+		ctime2 = ioread32(priv->iobase + HW_CTIME2);
+	}
+	spin_unlock_irqrestore(&priv->lock, irq_flags);
+
+	tm->tm_sec  = (ctime0 >> BM_CTIME0_SEC_S)  & BM_CTIME0_SEC_M;
+	tm->tm_min  = (ctime0 >> BM_CTIME0_MIN_S)  & BM_CTIME0_MIN_M;
+	tm->tm_hour = (ctime0 >> BM_CTIME0_HOUR_S) & BM_CTIME0_HOUR_M;
+	tm->tm_wday = (ctime0 >> BM_CTIME0_DOW_S)  & BM_CTIME0_DOW_M;
+
+	tm->tm_mday = (ctime1 >> BM_CTIME1_DOM_S)  & BM_CTIME1_DOM_M;
+	tm->tm_mon  = (ctime1 >> BM_CTIME1_MON_S)  & BM_CTIME1_MON_M;
+	tm->tm_year = (ctime1 >> BM_CTIME1_YEAR_S) & BM_CTIME1_YEAR_M;
+
+	tm->tm_yday = (ctime2 >> BM_CTIME2_DOY_S)  & BM_CTIME2_DOY_M;
+
+	return 0;
+}
+
+static int asm9260_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
+	unsigned long irq_flags;
+
+	spin_lock_irqsave(&priv->lock, irq_flags);
+	/*
+	 * make sure SEC counter will not flip other counter on write time,
+	 * real value will be written at the enf of sequence.
+	 */

drivers/rtc/rtc-asm9260.c line 208

Quoted 10 lines
drivers/rtc/rtc-asm9260.c new file +10 -0
+	iowrite32(0, priv->iobase + HW_SEC);
+
+	iowrite32(tm->tm_year, priv->iobase + HW_YEAR);
+	iowrite32(tm->tm_mon,  priv->iobase + HW_MONTH);
+	iowrite32(tm->tm_mday, priv->iobase + HW_DOM);
+	iowrite32(tm->tm_wday, priv->iobase + HW_DOW);
+	iowrite32(tm->tm_yday, priv->iobase + HW_DOY);
+	iowrite32(tm->tm_hour, priv->iobase + HW_HOUR);
+	iowrite32(tm->tm_min,  priv->iobase + HW_MIN);
+	iowrite32(tm->tm_sec,  priv->iobase + HW_SEC);

That would be a good time to reset BM_RTC_OSCF. Maybe it can also be useful to enable the interrupt but there isn't much more to do than print an error message.

Quoted 6 lines

drivers/rtc/rtc-asm9260.c line 188

Quoted 5 lines
drivers/rtc/rtc-asm9260.c new file +5 -0
+	spin_unlock_irqrestore(&priv->lock, irq_flags);
+
+	return 0;
+}
+

Thank you for review :)

Signature · 2 lines
Regards,
Oleksij
#7 lore raw

PATCH 2/2 doc: dt: add documentation for alphascale,asm9260-rtc

In reply to a message not in the archive

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +25 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).
+
+Example:
+rtc0: rtc@800a0000 {
+	compatible = "alphascale,asm9260-rtc";
+	reg = <0x800a0000 0x100>;
+	clocks = <&acc CLKID_AHB_RTC>;
+	clock-names = "ahb";
+	interrupts = <2>;
+	calibration = <0x129c>;
+};
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1454056802-23386-3-git-send-email-linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org

#9 lore raw

Re: [PATCH 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

Quoted 19 lines · Oleksij Rempel

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +5 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length

Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +10 -0
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).

This should be prefixed with 'alphascale,'

How is this value determined?

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

Quoted 33 lines · Rob Herring
Quoted 19 lines · Oleksij Rempel

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +5 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length

Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +10 -0
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).

This should be prefixed with 'alphascale,'

Quoted 2 lines

How is this value determined?

I think this should stay in userspace, see that series:
https://groups.google.com/forum/#!topic/rtc-linux/HGQqiHnMiuw

It quite often depends on environmental things like temperature so it may be updated at runtime.

Signature · 7 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

Am 01.02.2016 um 16:55 schrieb Alexandre Belloni:

Quoted 34 lines · Rob Herring
Quoted 33 lines · Oleksij Rempel
Quoted 19 lines

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +5 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length

Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +10 -0
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).

This should be prefixed with 'alphascale,'

Quoted 8 lines
Quoted 2 lines

How is this value determined?

I think this should stay in userspace, see that series:
https://groups.google.com/forum/#!topic/rtc-linux/HGQqiHnMiuw

It quite often depends on environmental things like temperature so it may be updated at runtime.

I partially agree. IMO default configuration should work properly by 20C. My devkit provide terrible results without default offset.

Signature · 2 lines
Regards,
Oleksij

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

Quoted 38 lines · Oleksij Rempel

Am 01.02.2016 um 16:55 schrieb Alexandre Belloni:

Quoted 37 lines · Rob Herring
Quoted 35 lines · Oleksij Rempel
Quoted 19 lines

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +5 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length

Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +10 -0
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).

This should be prefixed with 'alphascale,'

How is this value determined?

Quoted 9 lines
Quoted 5 lines

I think this should stay in userspace, see that series:
https://groups.google.com/forum/#!topic/rtc-linux/HGQqiHnMiuw

It quite often depends on environmental things like temperature so it may be updated at runtime.

I partially agree. IMO default configuration should work properly by 20C. My devkit provide terrible results without default offset.

I'm not against having a sane default. What I would do is set a default hardcoded value from the driver at the time the RTC is reset (that is: it has never been set yet) then let the user adjust that calibration through sysfs.

Signature · 7 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

v2 cover add Alphascale asm9260 RTC driver

This patch set provide support for RTC controller found on Alphascale ASM9260 SoC.

v2:
- change license to GPLv2 and later
- remove HW_RTC_AUX and HW_RTC_AUXEN. Thay was taken from reference driver. Documentation do not provide any info about it. According to my tests this regs are not available on asm9260.
- remove calibration from DT. It will be beter to set it over sysfs.

Oleksij Rempel (2):
rtc: add rtc-asm9260 driver
doc: dt: add documentation for alphascale,asm9260-rtc

 .../bindings/rtc/alphascale,asm9260-rtc.txt        |  19 ++
 drivers/rtc/Kconfig                                |  10 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-asm9260.c                          | 355 +++++++++++++++++++++
 4 files changed, 385 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
 create mode 100644 drivers/rtc/rtc-asm9260.c
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1454442971-25225-1-git-send-email-linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org

#18 lore raw

PATCH v2 1/2 rtc: add rtc-asm9260 driver

Add support for RTC controller found on Alphascale asm9260 SoC.

---
 drivers/rtc/Kconfig       |  10 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/rtc-asm9260.c | 355 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 366 insertions(+)
 create mode 100644 drivers/rtc/rtc-asm9260.c
drivers/rtc/Kconfig +10 -0
index 376322f..733b6aa 100644
@@ -1144,6 +1144,16 @@ config RTC_DRV_ZYNQMP
 
 comment "on-CPU RTC drivers"
 
+config RTC_DRV_ASM9260
+	tristate "Alphascale asm9260 RTC"
+	depends on MACH_ASM9260
+	help
+	  If you say yes here you get support for the RTC on the
+	  Alphascale asm9260 SoC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-asm9260.
+
 config RTC_DRV_DAVINCI
 	tristate "TI DaVinci RTC"
 	depends on ARCH_DAVINCI_DM365
drivers/rtc/Makefile +1 -0
index 62d61b2..f4d841b 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_RTC_DRV_ABB5ZES3)	+= rtc-ab-b5ze-s3.o
 obj-$(CONFIG_RTC_DRV_ABX80X)	+= rtc-abx80x.o
 obj-$(CONFIG_RTC_DRV_ARMADA38X)	+= rtc-armada38x.o
 obj-$(CONFIG_RTC_DRV_AS3722)	+= rtc-as3722.o
+obj-$(CONFIG_RTC_DRV_ASM9260)	+= rtc-asm9260.o
 obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
 obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
 obj-$(CONFIG_RTC_DRV_AT91SAM9)	+= rtc-at91sam9.o
drivers/rtc/rtc-asm9260.c new file +355 -0

355 lines not on this page · raw message

Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#19 lore raw

PATCH v2 2/2 doc: dt: add documentation for alphascale,asm9260-rtc

In reply to a message not in the archive

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +19 -0
new file mode 100644
index 0000000..76ebca5
@@ -0,0 +1,19 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
+  * "ahb" for the SoC RTC clock
+
+Example:
+rtc0: rtc@800a0000 {
+	compatible = "alphascale,asm9260-rtc";
+	reg = <0x800a0000 0x100>;
+	clocks = <&acc CLKID_AHB_RTC>;
+	clock-names = "ahb";
+	interrupts = <2>;
+};
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1454442971-25225-3-git-send-email-linux-YEK0n+YFykbzxQdaRaTXBw@public.gmane.org

Acked-by
#21 lore raw

Re: [PATCH v2 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

Quoted 7 lines · Oleksij Rempel

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw
In reply to a message not in the archive
Quoted 14 lines · Oleksij Rempel

This patch set provide support for RTC controller found on Alphascale ASM9260 SoC.

v2:
- change license to GPLv2 and later
- remove HW_RTC_AUX and HW_RTC_AUXEN. Thay was taken from reference driver. Documentation do not provide any info about it. According to my tests this regs are not available on asm9260.
- remove calibration from DT. It will be beter to set it over sysfs.

Oleksij Rempel (2):
rtc: add rtc-asm9260 driver
doc: dt: add documentation for alphascale,asm9260-rtc

Quoted 8 lines
 .../bindings/rtc/alphascale,asm9260-rtc.txt        |  19 ++
 drivers/rtc/Kconfig                                |  10 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-asm9260.c                          | 355 +++++++++++++++++++++
 4 files changed, 385 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
 create mode 100644 drivers/rtc/rtc-asm9260.c

Applied, thanks!

Signature · 7 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#23 lore raw

Re: [PATCH 2/2] doc: dt: add documentation for alphascale,asm9260-rtc

In reply to Rob Herring

Am 01.02.2016 um 16:27 schrieb Rob Herring:

Quoted 24 lines · Oleksij Rempel
Quoted 23 lines

Document Alphascale asm9260 RTC bindings

---
 .../bindings/rtc/alphascale,asm9260-rtc.txt        | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +9 -0
new file mode 100644
index 0000000..2c0ff3c
@@ -0,0 +1,25 @@
+* Alphascale asm9260 SoC Real Time Clock
+
+Required properties:
+- compatible: Should be "alphascale,asm9260-rtc"
+- reg: Physical base address of the controller and length
+       of memory mapped region.
+- interrupts: IRQ line for the RTC.
+- clocks: Reference to the clock entry.
+- clock-names: should contain:
Quoted 8 lines

Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt line 15

Quoted 6 lines
Documentation/devicetree/bindings/rtc/alphascale,asm9260-rtc.txt new file +6 -0
+  * "ahb" for the SoC RTC clock
+
+Optional:
+- calibration: calibration value for 1 sec period.
+		Max value for forward calibration is 0x1ffff (131071),
+		Min value for backward calibration is 0xfffe0001 (-131071).

This should be prefixed with 'alphascale,'

ok,

Quoted 1 line

How is this value determined?

To each second the counter value will be increased to decreased by calibration value - if google translated it correctly from chinese :)

It is RAW value which will be written to register. Since DT compiler do not support signed values i converted it to HEX.

Signature · 2 lines
Regards,
Oleksij