From: Chris Brandt <chris.brandt@renesas.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Simon Horman <horms+renesas@verge.net.au>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: rtc-linux@googlegroups.com, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Chris Brandt <chris.brandt@renesas.com>
Subject: [rtc-linux] [PATCH 1/5] rtc: rtc-sh: add support for rza series
Date: Thu, 16 Mar 2017 13:51:08 -0400 [thread overview]
Message-ID: <20170316175112.27913-2-chris.brandt@renesas.com> (raw)
In-Reply-To: <20170316175112.27913-1-chris.brandt@renesas.com>
This same RTC is used in RZ/A series MPUs, therefore with some slight
changes, this driver can be reused. Additionally, since ARM architectures
require Device Tree configurations, device tree support has been added.
Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
drivers/rtc/Kconfig | 4 ++--
drivers/rtc/rtc-sh.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index ee1b0e9..77d1495 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1303,10 +1303,10 @@ config RTC_DRV_SA1100
config RTC_DRV_SH
tristate "SuperH On-Chip RTC"
- depends on SUPERH && HAVE_CLK
+ depends on (SUPERH || ARCH_RENESAS) && HAVE_CLK
help
Say Y here to enable support for the on-chip RTC found in
- most SuperH processors.
+ most SuperH processors. This RTC is also found in RZ/A SoCs.
To compile this driver as a module, choose M here: the
module will be called rtc-sh.
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index c626e43..2ef4ac7 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -27,7 +27,15 @@
#include <linux/log2.h>
#include <linux/clk.h>
#include <linux/slab.h>
+#ifdef CONFIG_SUPERH
#include <asm/rtc.h>
+#else
+/* Default values for RZ/A RTC */
+#define rtc_reg_size sizeof(u16)
+#define RTC_BIT_INVERTED 0 /* no chip bugs */
+#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
+#define RTC_DEF_CAPABILITIES RTC_CAP_4_DIGIT_YEAR
+#endif
#define DRV_NAME "sh-rtc"
@@ -570,6 +578,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
rtc->alarm_irq = platform_get_irq(pdev, 2);
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (res == NULL)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(res == NULL)) {
dev_err(&pdev->dev, "No IO resource\n");
return -ENOENT;
@@ -608,6 +618,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
clk_enable(rtc->clk);
rtc->capabilities = RTC_DEF_CAPABILITIES;
+
+#ifdef CONFIG_SUPERH
if (dev_get_platdata(&pdev->dev)) {
struct sh_rtc_platform_info *pinfo =
dev_get_platdata(&pdev->dev);
@@ -618,6 +630,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
*/
rtc->capabilities |= pinfo->capabilities;
}
+#endif
if (rtc->carry_irq <= 0) {
/* register shared periodic/carry/alarm irq */
@@ -738,10 +751,17 @@ static int sh_rtc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(sh_rtc_pm_ops, sh_rtc_suspend, sh_rtc_resume);
+static const struct of_device_id sh_rtc_of_match[] = {
+ { .compatible = "renesas,sh-rtc", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sh_rtc_of_match);
+
static struct platform_driver sh_rtc_platform_driver = {
.driver = {
.name = DRV_NAME,
.pm = &sh_rtc_pm_ops,
+ .of_match_table = sh_rtc_of_match,
},
.remove = __exit_p(sh_rtc_remove),
};
--
2.10.1
--
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@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WARNING: multiple messages have this Message-ID (diff)
From: Chris Brandt <chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
To: Alessandro Zummo
<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
Alexandre Belloni
<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Simon Horman
<horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
Geert Uytterhoeven
<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Chris Brandt
<chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 1/5] rtc: rtc-sh: add support for rza series
Date: Thu, 16 Mar 2017 13:51:08 -0400 [thread overview]
Message-ID: <20170316175112.27913-2-chris.brandt@renesas.com> (raw)
In-Reply-To: <20170316175112.27913-1-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
This same RTC is used in RZ/A series MPUs, therefore with some slight
changes, this driver can be reused. Additionally, since ARM architectures
require Device Tree configurations, device tree support has been added.
Signed-off-by: Chris Brandt <chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
drivers/rtc/Kconfig | 4 ++--
drivers/rtc/rtc-sh.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index ee1b0e9..77d1495 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1303,10 +1303,10 @@ config RTC_DRV_SA1100
config RTC_DRV_SH
tristate "SuperH On-Chip RTC"
- depends on SUPERH && HAVE_CLK
+ depends on (SUPERH || ARCH_RENESAS) && HAVE_CLK
help
Say Y here to enable support for the on-chip RTC found in
- most SuperH processors.
+ most SuperH processors. This RTC is also found in RZ/A SoCs.
To compile this driver as a module, choose M here: the
module will be called rtc-sh.
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index c626e43..2ef4ac7 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -27,7 +27,15 @@
#include <linux/log2.h>
#include <linux/clk.h>
#include <linux/slab.h>
+#ifdef CONFIG_SUPERH
#include <asm/rtc.h>
+#else
+/* Default values for RZ/A RTC */
+#define rtc_reg_size sizeof(u16)
+#define RTC_BIT_INVERTED 0 /* no chip bugs */
+#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
+#define RTC_DEF_CAPABILITIES RTC_CAP_4_DIGIT_YEAR
+#endif
#define DRV_NAME "sh-rtc"
@@ -570,6 +578,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
rtc->alarm_irq = platform_get_irq(pdev, 2);
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (res == NULL)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(res == NULL)) {
dev_err(&pdev->dev, "No IO resource\n");
return -ENOENT;
@@ -608,6 +618,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
clk_enable(rtc->clk);
rtc->capabilities = RTC_DEF_CAPABILITIES;
+
+#ifdef CONFIG_SUPERH
if (dev_get_platdata(&pdev->dev)) {
struct sh_rtc_platform_info *pinfo =
dev_get_platdata(&pdev->dev);
@@ -618,6 +630,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
*/
rtc->capabilities |= pinfo->capabilities;
}
+#endif
if (rtc->carry_irq <= 0) {
/* register shared periodic/carry/alarm irq */
@@ -738,10 +751,17 @@ static int sh_rtc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(sh_rtc_pm_ops, sh_rtc_suspend, sh_rtc_resume);
+static const struct of_device_id sh_rtc_of_match[] = {
+ { .compatible = "renesas,sh-rtc", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sh_rtc_of_match);
+
static struct platform_driver sh_rtc_platform_driver = {
.driver = {
.name = DRV_NAME,
.pm = &sh_rtc_pm_ops,
+ .of_match_table = sh_rtc_of_match,
},
.remove = __exit_p(sh_rtc_remove),
};
--
2.10.1
--
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.
WARNING: multiple messages have this Message-ID (diff)
From: Chris Brandt <chris.brandt@renesas.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Simon Horman <horms+renesas@verge.net.au>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: rtc-linux@googlegroups.com, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
Chris Brandt <chris.brandt@renesas.com>
Subject: [PATCH 1/5] rtc: rtc-sh: add support for rza series
Date: Thu, 16 Mar 2017 13:51:08 -0400 [thread overview]
Message-ID: <20170316175112.27913-2-chris.brandt@renesas.com> (raw)
In-Reply-To: <20170316175112.27913-1-chris.brandt@renesas.com>
This same RTC is used in RZ/A series MPUs, therefore with some slight
changes, this driver can be reused. Additionally, since ARM architectures
require Device Tree configurations, device tree support has been added.
Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
drivers/rtc/Kconfig | 4 ++--
drivers/rtc/rtc-sh.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index ee1b0e9..77d1495 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1303,10 +1303,10 @@ config RTC_DRV_SA1100
config RTC_DRV_SH
tristate "SuperH On-Chip RTC"
- depends on SUPERH && HAVE_CLK
+ depends on (SUPERH || ARCH_RENESAS) && HAVE_CLK
help
Say Y here to enable support for the on-chip RTC found in
- most SuperH processors.
+ most SuperH processors. This RTC is also found in RZ/A SoCs.
To compile this driver as a module, choose M here: the
module will be called rtc-sh.
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index c626e43..2ef4ac7 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -27,7 +27,15 @@
#include <linux/log2.h>
#include <linux/clk.h>
#include <linux/slab.h>
+#ifdef CONFIG_SUPERH
#include <asm/rtc.h>
+#else
+/* Default values for RZ/A RTC */
+#define rtc_reg_size sizeof(u16)
+#define RTC_BIT_INVERTED 0 /* no chip bugs */
+#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
+#define RTC_DEF_CAPABILITIES RTC_CAP_4_DIGIT_YEAR
+#endif
#define DRV_NAME "sh-rtc"
@@ -570,6 +578,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
rtc->alarm_irq = platform_get_irq(pdev, 2);
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (res == NULL)
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(res == NULL)) {
dev_err(&pdev->dev, "No IO resource\n");
return -ENOENT;
@@ -608,6 +618,8 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
clk_enable(rtc->clk);
rtc->capabilities = RTC_DEF_CAPABILITIES;
+
+#ifdef CONFIG_SUPERH
if (dev_get_platdata(&pdev->dev)) {
struct sh_rtc_platform_info *pinfo =
dev_get_platdata(&pdev->dev);
@@ -618,6 +630,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
*/
rtc->capabilities |= pinfo->capabilities;
}
+#endif
if (rtc->carry_irq <= 0) {
/* register shared periodic/carry/alarm irq */
@@ -738,10 +751,17 @@ static int sh_rtc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(sh_rtc_pm_ops, sh_rtc_suspend, sh_rtc_resume);
+static const struct of_device_id sh_rtc_of_match[] = {
+ { .compatible = "renesas,sh-rtc", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sh_rtc_of_match);
+
static struct platform_driver sh_rtc_platform_driver = {
.driver = {
.name = DRV_NAME,
.pm = &sh_rtc_pm_ops,
+ .of_match_table = sh_rtc_of_match,
},
.remove = __exit_p(sh_rtc_remove),
};
--
2.10.1
next prev parent reply other threads:[~2017-03-16 17:51 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 17:51 [rtc-linux] [PATCH 0/5] rtc: Reuse rtc-sh driver to support RZ/A1 Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` Chris Brandt [this message]
2017-03-16 17:51 ` [PATCH 1/5] rtc: rtc-sh: add support for rza series Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-17 8:22 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 8:22 ` Geert Uytterhoeven
2017-03-17 8:22 ` Geert Uytterhoeven
2017-03-17 13:17 ` [rtc-linux] " Chris Brandt
2017-03-17 13:17 ` Chris Brandt
2017-03-17 13:17 ` Chris Brandt
2017-03-17 15:11 ` [rtc-linux] " Alexandre Belloni
2017-03-17 15:11 ` Alexandre Belloni
2017-03-16 17:51 ` [rtc-linux] [PATCH 2/5] rtc: Add rtc-sh Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-17 8:17 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 8:17 ` Geert Uytterhoeven
2017-03-17 8:17 ` Geert Uytterhoeven
2017-03-17 13:16 ` [rtc-linux] " Chris Brandt
2017-03-17 13:16 ` Chris Brandt
2017-03-17 13:16 ` Chris Brandt
2017-03-17 13:21 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 13:21 ` Geert Uytterhoeven
2017-03-17 13:21 ` Geert Uytterhoeven
2017-03-17 13:41 ` [rtc-linux] " Chris Brandt
2017-03-17 13:41 ` Chris Brandt
2017-03-17 13:41 ` Chris Brandt
2017-03-17 13:55 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 13:55 ` Geert Uytterhoeven
2017-03-17 13:55 ` Geert Uytterhoeven
2017-03-17 15:05 ` [rtc-linux] " Alexandre Belloni
2017-03-17 15:05 ` Alexandre Belloni
2017-03-17 15:05 ` Alexandre Belloni
2017-03-20 15:05 ` [rtc-linux] " Chris Brandt
2017-03-20 15:05 ` Chris Brandt
2017-03-20 15:05 ` Chris Brandt
2017-03-20 16:03 ` [rtc-linux] " Geert Uytterhoeven
2017-03-20 16:03 ` Geert Uytterhoeven
2017-03-20 16:03 ` Geert Uytterhoeven
2017-03-20 16:26 ` [rtc-linux] " Chris Brandt
2017-03-20 16:26 ` Chris Brandt
2017-03-20 16:26 ` Chris Brandt
2017-03-20 22:45 ` [rtc-linux] " Alexandre Belloni
2017-03-20 22:45 ` Alexandre Belloni
2017-03-20 22:45 ` Alexandre Belloni
2017-03-16 17:51 ` [rtc-linux] [PATCH 3/5] ARM: dts: r7s72100: add rtc clock to device tree Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-17 8:27 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 8:27 ` Geert Uytterhoeven
2017-03-17 8:27 ` Geert Uytterhoeven
2017-03-17 13:20 ` [rtc-linux] " Chris Brandt
2017-03-17 13:20 ` Chris Brandt
2017-03-17 13:20 ` Chris Brandt
2017-03-17 13:33 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 13:33 ` Geert Uytterhoeven
2017-03-17 13:33 ` Geert Uytterhoeven
2017-03-17 13:48 ` [rtc-linux] " Chris Brandt
2017-03-17 13:48 ` Chris Brandt
2017-03-17 13:48 ` Chris Brandt
2017-03-17 13:57 ` [rtc-linux] " Geert Uytterhoeven
2017-03-17 13:57 ` Geert Uytterhoeven
2017-03-17 13:57 ` Geert Uytterhoeven
2017-03-17 15:16 ` [rtc-linux] " Alexandre Belloni
2017-03-17 15:16 ` Alexandre Belloni
2017-03-17 15:16 ` Alexandre Belloni
2017-03-16 17:51 ` [rtc-linux] [PATCH 4/5] ARM: dts: r7s72100: add rtc " Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` [rtc-linux] [PATCH 5/5] ARM: dts: rskrza1: add rtc DT support Chris Brandt
2017-03-16 17:51 ` Chris Brandt
2017-03-16 17:51 ` Chris Brandt
[not found] ` <20170316175112.27913-1-chris.brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-03-28 13:38 ` [PATCH 0/5] rtc: Reuse rtc-sh driver to support RZ/A1 bobethtarsi3-Re5JQEeQqe8AvxtiuMwx3w
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170316175112.27913-2-chris.brandt@renesas.com \
--to=chris.brandt@renesas.com \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=horms+renesas@verge.net.au \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.