linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] rtc: at91sam9: drop platform_data support
@ 2019-03-20 12:40 Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 2/6] rtc: at91sam9: convert to devm_rtc_allocate_device Alexandre Belloni
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

ARCH_AT91 is DT only for a while, drop platform data support.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/Kconfig        |  2 +-
 drivers/rtc/rtc-at91sam9.c | 44 +++++++-------------------------------
 2 files changed, 9 insertions(+), 37 deletions(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 7555fd344ff0..fa5638269b33 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1432,7 +1432,7 @@ config RTC_DRV_AT91RM9200
 config RTC_DRV_AT91SAM9
 	tristate "AT91SAM9 RTT as RTC"
 	depends on ARCH_AT91 || COMPILE_TEST
-	depends on HAS_IOMEM
+	depends on OF && HAS_IOMEM
 	select MFD_SYSCON
 	help
 	  Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 1d31c0ae6334..7ec114b59513 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -340,13 +340,6 @@ static const struct rtc_class_ops at91_rtc_ops = {
 	.alarm_irq_enable = at91_rtc_alarm_irq_enable,
 };
 
-static const struct regmap_config gpbr_regmap_config = {
-	.name = "gpbr",
-	.reg_bits = 32,
-	.val_bits = 32,
-	.reg_stride = 4,
-};
-
 /*
  * Initialize and install RTC driver
  */
@@ -357,6 +350,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
 	int		ret, irq;
 	u32		mr;
 	unsigned int	sclk_rate;
+	struct of_phandle_args args;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
@@ -382,34 +376,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(rtc->rtt))
 		return PTR_ERR(rtc->rtt);
 
-	if (!pdev->dev.of_node) {
-		/*
-		 * TODO: Remove this code chunk when removing non DT board
-		 * support. Remember to remove the gpbr_regmap_config
-		 * variable too.
-		 */
-		void __iomem *gpbr;
-
-		r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		gpbr = devm_ioremap_resource(&pdev->dev, r);
-		if (IS_ERR(gpbr))
-			return PTR_ERR(gpbr);
-
-		rtc->gpbr = regmap_init_mmio(NULL, gpbr,
-					     &gpbr_regmap_config);
-	} else {
-		struct of_phandle_args args;
-
-		ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
-						"atmel,rtt-rtc-time-reg", 1, 0,
-						&args);
-		if (ret)
-			return ret;
-
-		rtc->gpbr = syscon_node_to_regmap(args.np);
-		rtc->gpbr_offset = args.args[0];
-	}
+	ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
+					"atmel,rtt-rtc-time-reg", 1, 0,
+					&args);
+	if (ret)
+		return ret;
 
+	rtc->gpbr = syscon_node_to_regmap(args.np);
+	rtc->gpbr_offset = args.args[0];
 	if (IS_ERR(rtc->gpbr)) {
 		dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
 		return -ENOMEM;
@@ -561,13 +535,11 @@ static int at91_rtc_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
 
-#ifdef CONFIG_OF
 static const struct of_device_id at91_rtc_dt_ids[] = {
 	{ .compatible = "atmel,at91sam9260-rtt" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
-#endif
 
 static struct platform_driver at91_rtc_driver = {
 	.probe		= at91_rtc_probe,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] rtc: at91sam9: convert to devm_rtc_allocate_device
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
@ 2019-03-20 12:40 ` Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 3/6] rtc: at91sam9: set range Alexandre Belloni
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-at91sam9.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 7ec114b59513..cbbf8121dca0 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -418,13 +418,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
 	mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
 	rtt_writel(rtc, MR, mr);
 
-	rtc->rtcdev = devm_rtc_device_register(&pdev->dev, pdev->name,
-					&at91_rtc_ops, THIS_MODULE);
+	rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(rtc->rtcdev)) {
 		ret = PTR_ERR(rtc->rtcdev);
 		goto err_clk;
 	}
 
+	rtc->rtcdev->ops = &at91_rtc_ops;
+
 	/* register irq handler after we know what name we'll use */
 	ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
 			       IRQF_SHARED | IRQF_COND_SUSPEND,
@@ -444,7 +445,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
 		dev_warn(&pdev->dev, "%s: SET TIME!\n",
 				dev_name(&rtc->rtcdev->dev));
 
-	return 0;
+	return rtc_register_device(rtc->rtcdev);
 
 err_clk:
 	clk_disable_unprepare(rtc->sclk);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] rtc: at91sam9: set range
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 2/6] rtc: at91sam9: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-03-20 12:40 ` Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 4/6] rtc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

The AT91 RTT is a 32bit second counter that is saved in a 32bit global
purpose register.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-at91sam9.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index cbbf8121dca0..5ab13fe56164 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -425,6 +425,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
 	}
 
 	rtc->rtcdev->ops = &at91_rtc_ops;
+	rtc->rtcdev->range_max = U32_MAX;
 
 	/* register irq handler after we know what name we'll use */
 	ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] rtc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 2/6] rtc: at91sam9: convert to devm_rtc_allocate_device Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 3/6] rtc: at91sam9: set range Alexandre Belloni
@ 2019-03-20 12:40 ` Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 5/6] rtc: at91sam9: convert to SPDX identifier Alexandre Belloni
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

Call the 64bit versions of rtc_tm time conversion as the range is enforced
by the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-at91sam9.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 5ab13fe56164..62695596b00c 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -122,7 +122,7 @@ static int at91_rtc_readtime(struct device *dev, struct rtc_time *tm)
 	if (secs != secs2)
 		secs = rtt_readl(rtc, VR);
 
-	rtc_time_to_tm(offset + secs, tm);
+	rtc_time64_to_tm(offset + secs, tm);
 
 	dev_dbg(dev, "%s: %ptR\n", __func__, tm);
 
@@ -135,15 +135,12 @@ static int at91_rtc_readtime(struct device *dev, struct rtc_time *tm)
 static int at91_rtc_settime(struct device *dev, struct rtc_time *tm)
 {
 	struct sam9_rtc *rtc = dev_get_drvdata(dev);
-	int err;
 	u32 offset, alarm, mr;
 	unsigned long secs;
 
 	dev_dbg(dev, "%s: %ptR\n", __func__, tm);
 
-	err = rtc_tm_to_time(tm, &secs);
-	if (err != 0)
-		return err;
+	secs = rtc_tm_to_time64(tm);
 
 	mr = rtt_readl(rtc, MR);
 
@@ -193,7 +190,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
 
 	memset(alrm, 0, sizeof(*alrm));
 	if (alarm != ALARM_DISABLED && offset != 0) {
-		rtc_time_to_tm(offset + alarm, tm);
+		rtc_time64_to_tm(offset + alarm, tm);
 
 		dev_dbg(dev, "%s: %ptR\n", __func__, tm);
 
@@ -211,11 +208,8 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
 	unsigned long secs;
 	u32 offset;
 	u32 mr;
-	int err;
 
-	err = rtc_tm_to_time(tm, &secs);
-	if (err != 0)
-		return err;
+	secs = rtc_tm_to_time64(tm);
 
 	offset = gpbr_readl(rtc);
 	if (offset == 0) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] rtc: at91sam9: convert to SPDX identifier
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
                   ` (2 preceding siblings ...)
  2019-03-20 12:40 ` [PATCH 4/6] rtc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
@ 2019-03-20 12:40 ` Alexandre Belloni
  2019-03-20 12:40 ` [PATCH 6/6] rtc: at91sam9: correct trivial checkpatch warnings Alexandre Belloni
  2019-03-21 10:11 ` [PATCH 1/6] rtc: at91sam9: drop platform_data support Nicolas.Ferre
  5 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-at91sam9.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 62695596b00c..d8a23b89ba73 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -1,14 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * "RTT as Real Time Clock" driver for AT91SAM9 SoC family
  *
  * (C) 2007 Michel Benoit
  *
  * Based on rtc-at91rm9200.c by Rick Bronson
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
  */
 
 #include <linux/clk.h>
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] rtc: at91sam9: correct trivial checkpatch warnings
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
                   ` (3 preceding siblings ...)
  2019-03-20 12:40 ` [PATCH 5/6] rtc: at91sam9: convert to SPDX identifier Alexandre Belloni
@ 2019-03-20 12:40 ` Alexandre Belloni
  2019-03-21 10:11 ` [PATCH 1/6] rtc: at91sam9: drop platform_data support Nicolas.Ferre
  5 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:40 UTC (permalink / raw)
  To: linux-rtc
  Cc: Nicolas Ferre, linux-arm-kernel, linux-kernel, Alexandre Belloni

Correct trivial checkpatch warnings, mostly whitespace issues and
unbalanced braces.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-at91sam9.c | 40 +++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index d8a23b89ba73..4daf3789b978 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -43,21 +43,21 @@
  * registers available, likewise usable for more than "RTC" support.
  */
 
-#define AT91_RTT_MR		0x00			/* Real-time Mode Register */
-#define AT91_RTT_RTPRES		(0xffff << 0)		/* Real-time Timer Prescaler Value */
-#define AT91_RTT_ALMIEN		(1 << 16)		/* Alarm Interrupt Enable */
-#define AT91_RTT_RTTINCIEN	(1 << 17)		/* Real Time Timer Increment Interrupt Enable */
-#define AT91_RTT_RTTRST		(1 << 18)		/* Real Time Timer Restart */
+#define AT91_RTT_MR		0x00		/* Real-time Mode Register */
+#define AT91_RTT_RTPRES		(0xffff << 0)	/* Timer Prescaler Value */
+#define AT91_RTT_ALMIEN		BIT(16)		/* Alarm Interrupt Enable */
+#define AT91_RTT_RTTINCIEN	BIT(17)		/* Increment Interrupt Enable */
+#define AT91_RTT_RTTRST		BIT(18)		/* Timer Restart */
 
-#define AT91_RTT_AR		0x04			/* Real-time Alarm Register */
-#define AT91_RTT_ALMV		(0xffffffff)		/* Alarm Value */
+#define AT91_RTT_AR		0x04		/* Real-time Alarm Register */
+#define AT91_RTT_ALMV		(0xffffffff)	/* Alarm Value */
 
-#define AT91_RTT_VR		0x08			/* Real-time Value Register */
-#define AT91_RTT_CRTV		(0xffffffff)		/* Current Real-time Value */
+#define AT91_RTT_VR		0x08		/* Real-time Value Register */
+#define AT91_RTT_CRTV		(0xffffffff)	/* Current Real-time Value */
 
-#define AT91_RTT_SR		0x0c			/* Real-time Status Register */
-#define AT91_RTT_ALMS		(1 << 0)		/* Real-time Alarm Status */
-#define AT91_RTT_RTTINC		(1 << 1)		/* Real-time Timer Increment */
+#define AT91_RTT_SR		0x0c		/* Real-time Status Register */
+#define AT91_RTT_ALMS		BIT(0)		/* Alarm Status */
+#define AT91_RTT_RTTINC		BIT(1)		/* Timer Increment */
 
 /*
  * We store ALARM_DISABLED in ALMV to record that no alarm is set.
@@ -65,14 +65,13 @@
  */
 #define ALARM_DISABLED	((u32)~0)
 
-
 struct sam9_rtc {
 	void __iomem		*rtt;
 	struct rtc_device	*rtcdev;
 	u32			imr;
 	struct regmap		*gpbr;
 	unsigned int		gpbr_offset;
-	int 			irq;
+	int			irq;
 	struct clk		*sclk;
 	bool			suspended;
 	unsigned long		events;
@@ -253,7 +252,7 @@ static int at91_rtc_proc(struct device *dev, struct seq_file *seq)
 	u32 mr = rtt_readl(rtc, MR);
 
 	seq_printf(seq, "update_IRQ\t: %s\n",
-			(mr & AT91_RTT_RTTINCIEN) ? "yes" : "no");
+		   (mr & AT91_RTT_RTTINCIEN) ? "yes" : "no");
 	return 0;
 }
 
@@ -289,7 +288,7 @@ static void at91_rtc_flush_events(struct sam9_rtc *rtc)
 	rtc->events = 0;
 
 	pr_debug("%s: num=%ld, events=0x%02lx\n", __func__,
-		rtc->events >> 8, rtc->events & 0x000000FF);
+		 rtc->events >> 8, rtc->events & 0x000000FF);
 }
 
 /*
@@ -367,8 +366,8 @@ static int at91_rtc_probe(struct platform_device *pdev)
 		return PTR_ERR(rtc->rtt);
 
 	ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
-					"atmel,rtt-rtc-time-reg", 1, 0,
-					&args);
+					       "atmel,rtt-rtc-time-reg", 1, 0,
+					       &args);
 	if (ret)
 		return ret;
 
@@ -434,7 +433,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
 
 	if (gpbr_readl(rtc) == 0)
 		dev_warn(&pdev->dev, "%s: SET TIME!\n",
-				dev_name(&rtc->rtcdev->dev));
+			 dev_name(&rtc->rtcdev->dev));
 
 	return rtc_register_device(rtc->rtcdev);
 
@@ -494,8 +493,9 @@ static int at91_rtc_suspend(struct device *dev)
 			/* don't let RTTINC cause wakeups */
 			if (mr & AT91_RTT_RTTINCIEN)
 				rtt_writel(rtc, MR, mr & ~AT91_RTT_RTTINCIEN);
-		} else
+		} else {
 			rtt_writel(rtc, MR, mr & ~rtc->imr);
+		}
 	}
 
 	return 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/6] rtc: at91sam9: drop platform_data support
  2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
                   ` (4 preceding siblings ...)
  2019-03-20 12:40 ` [PATCH 6/6] rtc: at91sam9: correct trivial checkpatch warnings Alexandre Belloni
@ 2019-03-21 10:11 ` Nicolas.Ferre
  5 siblings, 0 replies; 7+ messages in thread
From: Nicolas.Ferre @ 2019-03-21 10:11 UTC (permalink / raw)
  To: alexandre.belloni, linux-rtc; +Cc: linux-arm-kernel, linux-kernel

On 20/03/2019 at 13:40, Alexandre Belloni wrote:

> ARCH_AT91 is DT only for a while, drop platform data support.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

For the whole series:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>


> ---
>   drivers/rtc/Kconfig        |  2 +-
>   drivers/rtc/rtc-at91sam9.c | 44 +++++++-------------------------------
>   2 files changed, 9 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 7555fd344ff0..fa5638269b33 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1432,7 +1432,7 @@ config RTC_DRV_AT91RM9200
>   config RTC_DRV_AT91SAM9
>   	tristate "AT91SAM9 RTT as RTC"
>   	depends on ARCH_AT91 || COMPILE_TEST
> -	depends on HAS_IOMEM
> +	depends on OF && HAS_IOMEM
>   	select MFD_SYSCON
>   	help
>   	  Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
> diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
> index 1d31c0ae6334..7ec114b59513 100644
> --- a/drivers/rtc/rtc-at91sam9.c
> +++ b/drivers/rtc/rtc-at91sam9.c
> @@ -340,13 +340,6 @@ static const struct rtc_class_ops at91_rtc_ops = {
>   	.alarm_irq_enable = at91_rtc_alarm_irq_enable,
>   };
>   
> -static const struct regmap_config gpbr_regmap_config = {
> -	.name = "gpbr",
> -	.reg_bits = 32,
> -	.val_bits = 32,
> -	.reg_stride = 4,
> -};
> -
>   /*
>    * Initialize and install RTC driver
>    */
> @@ -357,6 +350,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
>   	int		ret, irq;
>   	u32		mr;
>   	unsigned int	sclk_rate;
> +	struct of_phandle_args args;
>   
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq < 0) {
> @@ -382,34 +376,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
>   	if (IS_ERR(rtc->rtt))
>   		return PTR_ERR(rtc->rtt);
>   
> -	if (!pdev->dev.of_node) {
> -		/*
> -		 * TODO: Remove this code chunk when removing non DT board
> -		 * support. Remember to remove the gpbr_regmap_config
> -		 * variable too.
> -		 */
> -		void __iomem *gpbr;
> -
> -		r = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -		gpbr = devm_ioremap_resource(&pdev->dev, r);
> -		if (IS_ERR(gpbr))
> -			return PTR_ERR(gpbr);
> -
> -		rtc->gpbr = regmap_init_mmio(NULL, gpbr,
> -					     &gpbr_regmap_config);
> -	} else {
> -		struct of_phandle_args args;
> -
> -		ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
> -						"atmel,rtt-rtc-time-reg", 1, 0,
> -						&args);
> -		if (ret)
> -			return ret;
> -
> -		rtc->gpbr = syscon_node_to_regmap(args.np);
> -		rtc->gpbr_offset = args.args[0];
> -	}
> +	ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node,
> +					"atmel,rtt-rtc-time-reg", 1, 0,
> +					&args);
> +	if (ret)
> +		return ret;
>   
> +	rtc->gpbr = syscon_node_to_regmap(args.np);
> +	rtc->gpbr_offset = args.args[0];
>   	if (IS_ERR(rtc->gpbr)) {
>   		dev_err(&pdev->dev, "failed to retrieve gpbr regmap, aborting.\n");
>   		return -ENOMEM;
> @@ -561,13 +535,11 @@ static int at91_rtc_resume(struct device *dev)
>   
>   static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
>   
> -#ifdef CONFIG_OF
>   static const struct of_device_id at91_rtc_dt_ids[] = {
>   	{ .compatible = "atmel,at91sam9260-rtt" },
>   	{ /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
> -#endif
>   
>   static struct platform_driver at91_rtc_driver = {
>   	.probe		= at91_rtc_probe,
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-21 10:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 12:40 [PATCH 1/6] rtc: at91sam9: drop platform_data support Alexandre Belloni
2019-03-20 12:40 ` [PATCH 2/6] rtc: at91sam9: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-20 12:40 ` [PATCH 3/6] rtc: at91sam9: set range Alexandre Belloni
2019-03-20 12:40 ` [PATCH 4/6] rtc: at91sam9: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-03-20 12:40 ` [PATCH 5/6] rtc: at91sam9: convert to SPDX identifier Alexandre Belloni
2019-03-20 12:40 ` [PATCH 6/6] rtc: at91sam9: correct trivial checkpatch warnings Alexandre Belloni
2019-03-21 10:11 ` [PATCH 1/6] rtc: at91sam9: drop platform_data support Nicolas.Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).