Skip to contentSkip to conversation

ARM: sunxi: RTC support for A31/A23

PATCH RESEND In review Chen-Yu Tsai 2 participants 5 messages Aug 26, 2014 – Sep 19, 2014

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

v5 cover ARM: sunxi: RTC support for A31/A23

Hi everyone,

Resending the sun6i RTC series, rebased onto 3.17-rc1. The DT/defconfig patches have been queued for 3.18, and therefore dropped from this series. Hope we can get the driver parts in as well.

The A31 has a new RTC block that is separate from the timer block. It has separate interrupts for each of the alarms, and a different format for the counter alarm. The driver has been tested on the A31 Hummingbird, and the A23 tablet I'm using to work on sun8i support.

Patch 1 adds the driver for the RTC.

Patch 2 is a minor cleanup. This makes rtc-sunxi depend on sun4i or sun7i, the 2 platforms the driver is actually used on.

Changes since v4:
- Added interrupt for alarm 1 to DT bindings for completeness

Changes since v3:
- reformatted all multi-line function calls to have indentation match open parenthesis

Changes since v2:
- fixed indentation in DT binding docs
- have function argument indentation match open parenthesis
- drop driver owner field

Changes since v1:
- Enable rtc-sun6i in multi_v7_defconfig
- Cleanup the time/date GET/SET macros
- Use GENMASK for control register mask
- Change Kconfig option to show 'A31'
- Remove leftover comment from rtc-sun4i
- Remove extra newline

Cheers
ChenYu

Chen-Yu Tsai (2):
rtc: sun6i: Add sun6i RTC driver
rtc: sunxi: Depend on platforms sun4i/sun7i that actually have the rtc

 .../devicetree/bindings/rtc/sun6i-rtc.txt          |  17 +
 drivers/rtc/Kconfig                                |   9 +-
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-sun6i.c                            | 447 +++++++++++++++++++++
 4 files changed, 473 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/sun6i-rtc.txt
 create mode 100644 drivers/rtc/rtc-sun6i.c
Signature · 1 line
2.1.0
#1 lore raw

PATCH RESEND v5 1/2 rtc: sun6i: Add sun6i RTC driver

This patch introduces the driver for the RTC in the Allwinner A31 and A23 SoCs.

Unlike the RTC found in A10/A20 SoCs, which was part of the timer, the RTC in A31/A23 are a separate hardware block, which also contain a few controls for the RTC block hardware (a regulator and RTC block GPIO pin latches), while also having separate interrupts for the alarms.

The hardware is different enough to make a different driver for it.

---
 .../devicetree/bindings/rtc/sun6i-rtc.txt          |  17 +
 drivers/rtc/Kconfig                                |   7 +
 drivers/rtc/Makefile                               |   1 +
 drivers/rtc/rtc-sun6i.c                            | 447 +++++++++++++++++++++
 4 files changed, 472 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rtc/sun6i-rtc.txt
 create mode 100644 drivers/rtc/rtc-sun6i.c
Documentation/devicetree/bindings/rtc/sun6i-rtc.txt new file +17 -0
new file mode 100644
index 0000000..f007e42
@@ -0,0 +1,17 @@
+* sun6i Real Time Clock
+
+RTC controller for the Allwinner A31
+
+Required properties:
+- compatible	: Should be "allwinner,sun6i-a31-rtc"
+- reg		: physical base address of the controller and length of
+		  memory mapped region.
+- interrupts	: IRQ lines for the RTC alarm 0 and alarm 1, in that order.
+
+Example:
+
+rtc: rtc at 01f00000 {
+	compatible = "allwinner,sun6i-a31-rtc";
+	reg = <0x01f00000 0x54>;
+	interrupts = <0 40 4>, <0 41 4>;
+};
drivers/rtc/Kconfig +7 -0
index a168e96..f2300b4 100644
@@ -1175,6 +1175,13 @@ config RTC_DRV_SUN4V
 	  If you say Y here you will get support for the Hypervisor
 	  based RTC on SUN4V systems.
 
+config RTC_DRV_SUN6I
+	tristate "Allwinner A31 RTC"
+	depends on MACH_SUN6I || MACH_SUN8I
+	help
+	  If you say Y here you will get support for the RTC found on
+	  Allwinner A31.
+
 config RTC_DRV_SUNXI
 	tristate "Allwinner sun4i/sun7i RTC"
 	depends on ARCH_SUNXI
drivers/rtc/Makefile +1 -0
index 56f061c..9055b7d 100644
@@ -128,6 +128,7 @@ obj-$(CONFIG_RTC_DRV_STARFIRE)	+= rtc-starfire.o
 obj-$(CONFIG_RTC_DRV_STK17TA8)	+= rtc-stk17ta8.o
 obj-$(CONFIG_RTC_DRV_STMP)	+= rtc-stmp3xxx.o
 obj-$(CONFIG_RTC_DRV_SUN4V)	+= rtc-sun4v.o
+obj-$(CONFIG_RTC_DRV_SUN6I)	+= rtc-sun6i.o
 obj-$(CONFIG_RTC_DRV_SUNXI)	+= rtc-sunxi.o
 obj-$(CONFIG_RTC_DRV_TEGRA)	+= rtc-tegra.o
 obj-$(CONFIG_RTC_DRV_TEST)	+= rtc-test.o
drivers/rtc/rtc-sun6i.c new file +447 -0

447 lines not on this page · raw message

Signature · 1 line
2.1.0
#2 lore raw

PATCH RESEND v5 2/2 rtc: sunxi: Depend on platforms sun4i/sun7i that actually have the rtc

In reply to Chen-Yu Tsai

Now that we have Kconfig options for individual sunxi platforms, let the rtc-sunxi driver depend on the platforms that actually have this hardware, sun4i and sun7i.

---
 drivers/rtc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/Kconfig +1 -1
index f2300b4..6b34bc9 100644
@@ -1184,7 +1184,7 @@ config RTC_DRV_SUN6I
 
 config RTC_DRV_SUNXI
 	tristate "Allwinner sun4i/sun7i RTC"
-	depends on ARCH_SUNXI
+	depends on MACH_SUN4I || MACH_SUN7I
 	help
 	  If you say Y here you will get support for the RTC found on
 	  Allwinner A10/A20.
Signature · 1 line
2.1.0
#3 lore raw
In reply to Chen-Yu Tsai

Hi Alessandro,

Quoted 13 lines · Chen-Yu Tsai

Hi everyone,

Resending the sun6i RTC series, rebased onto 3.17-rc1. The DT/defconfig patches have been queued for 3.18, and therefore dropped from this series. Hope we can get the driver parts in as well.

The A31 has a new RTC block that is separate from the timer block. It has separate interrupts for each of the alarms, and a different format for the counter alarm. The driver has been tested on the A31 Hummingbird, and the A23 tablet I'm using to work on sun8i support.

Quoted 4 lines

Patch 1 adds the driver for the RTC.

Patch 2 is a minor cleanup. This makes rtc-sunxi depend on sun4i or sun7i, the 2 platforms the driver is actually used on.

I'm quite happy with these patches. Are you?

IIRC, you prefer that we merge these kind of patches by our tree, are you still ok with that? I'd feel more comfortable having an Acked-by from you on this.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140829/0d12e54e/attachment.sig>
#4 lore raw
In reply to Chen-Yu Tsai
Quoted 13 lines · Chen-Yu Tsai

Hi everyone,

Resending the sun6i RTC series, rebased onto 3.17-rc1. The DT/defconfig patches have been queued for 3.18, and therefore dropped from this series. Hope we can get the driver parts in as well.

The A31 has a new RTC block that is separate from the timer block. It has separate interrupts for each of the alarms, and a different format for the counter alarm. The driver has been tested on the A31 Hummingbird, and the A23 tablet I'm using to work on sun8i support.

Quoted 4 lines

Patch 1 adds the driver for the RTC.

Patch 2 is a minor cleanup. This makes rtc-sunxi depend on sun4i or sun7i, the 2 platforms the driver is actually used on.

Ok, I ended up merging the two patches.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140919/f4de4f7d/attachment-0001.sig>