Skip to contentSkip to conversation

Add driver for ARM AMBA PL031 RTC

PATCH In review Deepak Saxena 3 participants 7 messages May 16, 2006 – Jun 10, 2006

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

PATCH 1/1 Add driver for ARM AMBA PL031 RTC

This patch adds a driver for the ARM PL031 RTC found on some ARM SOCs. The driver is fairly trivial as the RTC only provides a read/write and alarm capability.

---

Alessandro: What userland tool do I use to test alarm capability?

 drivers/rtc/Kconfig     |   10 ++
 drivers/rtc/Makefile    |    1 
 drivers/rtc/rtc-pl031.c |  245 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 256 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-pl031.c

4b821f9e1daffb15e4d102bab44660c3debe46e9

drivers/rtc/Kconfig +10 -0
index 65d090d..875ff5e 100644
@@ -157,6 +157,16 @@ config RTC_DRV_VR41XX
 	  To compile this driver as a module, choose M here: the
 	  module will be called rtc-vr41xx.
 
+config RTC_DRV_PL031
+	tristate "ARM AMBA PL031 RTC"
+	depends on RTC_CLASS && ARM_AMBA
+	help
+	  If you say Y here you will get access to ARM AMBA
+	  PrimeCell PL031 RTC found on certain ARM SOCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called rtc-pl031.
+
 config RTC_DRV_TEST
 	tristate "Test driver/device"
 	depends on RTC_CLASS
drivers/rtc/Makefile +1 -0
index a9ca0f1..1b3f32e 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_RTC_DRV_M48T86)	+= rtc-m48t
 obj-$(CONFIG_RTC_DRV_EP93XX)	+= rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_SA1100)	+= rtc-sa1100.o
 obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
+obj-$(CONFIG_RTC_DRV_PL031)	+= rtc-pl031.o
drivers/rtc/rtc-pl031.c new file +245 -0

245 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · On Tue, 16 May 2006 14:48:13 -0700 Deepak Saxena <[email protected]> wrote:

This patch adds a driver for the ARM PL031 RTC found on some ARM SOCs. The driver is fairly trivial as the RTC only provides a read/write and alarm capability.

Alessandro: What userland tool do I use to test alarm capability?

There's the source code of a test program in Documentation/rtc.txt . I'm not so sure the alarm capability is used nowadays.

you can avoid including this one if it is a no-op:

Quoted 12 lines
drivers/rtc/rtc-pl031.c new file +9 -0
+static int pl031_read_callback(struct device *dev, int data)
+{
+	return data;
+}
 
 
 
+static int pl031_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
+{
+	struct pl031_local *ldata = dev_get_drvdata(dev);
+
+	switch (cmd) {

drivers/rtc/rtc-pl031.c line 90

Quoted 10 lines
drivers/rtc/rtc-pl031.c new file +10 -0
+	case RTC_AIE_OFF:
+		__raw_writel(1, ldata->base + RTC_MIS);
+		return 0;
+	case RTC_AIE_ON:
+		__raw_writel(0, ldata->base + RTC_MIS);
+		return 0;
+	}
+
+	return -EINVAL;
+}

pleasew return -ENOIOCTLCMD instead of -EINVAL . I know, I will have
to fix the other drivers to do the same.

no op:

Quoted 5 lines
drivers/rtc/rtc-pl031.c new file +5 -0
+static int pl031_proc(struct device *dev, struct seq_file *seq)
+{
+	return 0;
+}
+
Signature · 6 lines
 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it
#2 lore raw

Updated patch follows:

drivers/rtc/Kconfig +10 -0
index 65d090d..875ff5e 100644
@@ -157,6 +157,16 @@ config RTC_DRV_VR41XX
 	  To compile this driver as a module, choose M here: the
 	  module will be called rtc-vr41xx.
 
+config RTC_DRV_PL031
+	tristate "ARM AMBA PL031 RTC"
+	depends on RTC_CLASS && ARM_AMBA
+	help
+	  If you say Y here you will get access to ARM AMBA
+	  PrimeCell PL031 UART found on certain ARM SOCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called rtc-pl031.
+
 config RTC_DRV_TEST
 	tristate "Test driver/device"
 	depends on RTC_CLASS
drivers/rtc/Makefile +1 -0
index a9ca0f1..1b3f32e 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_RTC_DRV_M48T86)	+= rtc-m48t
 obj-$(CONFIG_RTC_DRV_EP93XX)	+= rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_SA1100)	+= rtc-sa1100.o
 obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
+obj-$(CONFIG_RTC_DRV_PL031)	+= rtc-pl031.o
drivers/rtc/rtc-pl031.c new file +233 -0

233 lines not on this page · raw message

Signature · 5 lines
Deepak Saxena - [email protected] - http://www.plexity.net

I am not a consumer. My existence on this planet is not defined by my
relationship to a producer of goods.  I was not put on this planet to
consume goods from a company for their profit. - Michael W.
#5 lore raw
In reply to Alessandro Zummo

On May 17 2006, at 01:02, Alessandro Zummo was caught saying:

Quoted 10 lines

drivers/rtc/rtc-pl031.c line 90

Quoted 7 lines
drivers/rtc/rtc-pl031.c new file +7 -0
+	case RTC_AIE_ON:
+		__raw_writel(0, ldata->base + RTC_MIS);
+		return 0;
+	}
+
+	return -EINVAL;
+}

pleasew return -ENOIOCTLCMD instead of -EINVAL . I know, I will have
to fix the other drivers to do the same.

So I just tried building my kernel and this symbol is not defined... Do you have a separate patch that defines it or is it just in -mm?

~Deepak

Signature · 5 lines
Deepak Saxena - [email protected] - http://www.plexity.net

I am not a consumer. My existence on this planet is not defined by my
relationship to a producer of goods.  I was not put on this planet to
consume goods from a company for their profit. - Michael W.
#6 lore raw
Quoted 12 lines · On Thu, 18 May 2006 14:14:13 -0700 Deepak Saxena <[email protected]> wrote:

On May 17 2006, at 01:02, Alessandro Zummo was caught saying:

Quoted 10 lines

drivers/rtc/rtc-pl031.c line 90

Quoted 7 lines
drivers/rtc/rtc-pl031.c new file +7 -0
+	case RTC_AIE_ON:
+		__raw_writel(0, ldata->base + RTC_MIS);
+		return 0;
+	}
+
+	return -EINVAL;
+}

pleasew return -ENOIOCTLCMD instead of -EINVAL . I know, I will have
to fix the other drivers to do the same.

Quoted 2 lines

So I just tried building my kernel and this symbol is not defined... Do you have a separate patch that defines it or is it just in -mm?

it's in linux/errno.h

Signature · 6 lines
 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it
#4 lore raw
In reply to Deepak Saxena

Review

Quoted 1 line · On Tue, 16 May 2006 17:01:42 -0700 Deepak Saxena <[email protected]> wrote:
(quoted diff) +1 -0
+	return -ENOIOCNTLCMD;

Tell me you forgot to run `quilt refresh' too?

drivers/rtc/rtc-pl031.c renamed from drivers/rtc/rtc-pl031.c~add-driver-for-arm-amba-pl031-rtc-fix +1 -1
@@ -81,7 +81,7 @@ static int pl031_ioctl(struct device *de
 		return 0;
 	}
 
-	return -ENOIOCNTLCMD;
+	return -ENOIOCTLCMD;
 }
 
 static int pl031_read_time(struct device *dev, struct rtc_time *tm)

_