[08/43] rtc: ep93xx: add DT support for Cirrus EP93xx

Message ID 20230424123522.18302-9-nikita.shubin@maquefel.me
State New
Headers
Series ep93xx device tree conversion |

Commit Message

Nikita Shubin April 24, 2023, 12:34 p.m. UTC
  - Find register range from the device tree.

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
---

Notes:
    Arnd Bergmann:
    - wildcards ep93xx to something meaningful, i.e. ep9301
    - drop wrappers

 drivers/rtc/rtc-ep93xx.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Rob Herring April 24, 2023, 3:56 p.m. UTC | #1
On Mon, Apr 24, 2023 at 03:34:24PM +0300, Nikita Shubin wrote:
> - Find register range from the device tree.
> 
> Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
> ---
> 
> Notes:
>     Arnd Bergmann:
>     - wildcards ep93xx to something meaningful, i.e. ep9301
>     - drop wrappers
> 
>  drivers/rtc/rtc-ep93xx.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
> index acae7f16808f..8bda20a4940a 100644
> --- a/drivers/rtc/rtc-ep93xx.c
> +++ b/drivers/rtc/rtc-ep93xx.c
> @@ -8,6 +8,7 @@
>  
>  #include <linux/module.h>
>  #include <linux/rtc.h>
> +#include <linux/of.h>

linux/mod_devicetable.h is the actual header you depend on.

>  #include <linux/platform_device.h>
>  #include <linux/io.h>
>  #include <linux/gfp.h>
> @@ -148,9 +149,16 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
>  	return devm_rtc_register_device(ep93xx_rtc->rtc);
>  }
>  
> +static const struct of_device_id ep93xx_rtc_of_ids[] = {
> +	{ .compatible = "cirrus,ep9301-rtc" },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, ep93xx_rtc_of_ids);
> +
>  static struct platform_driver ep93xx_rtc_driver = {
>  	.driver		= {
>  		.name	= "ep93xx-rtc",
> +		.of_match_table = ep93xx_rtc_of_ids,
>  	},
>  	.probe		= ep93xx_rtc_probe,
>  };
> -- 
> 2.39.2
>
  

Patch

diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index acae7f16808f..8bda20a4940a 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -8,6 +8,7 @@ 
 
 #include <linux/module.h>
 #include <linux/rtc.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/gfp.h>
@@ -148,9 +149,16 @@  static int ep93xx_rtc_probe(struct platform_device *pdev)
 	return devm_rtc_register_device(ep93xx_rtc->rtc);
 }
 
+static const struct of_device_id ep93xx_rtc_of_ids[] = {
+	{ .compatible = "cirrus,ep9301-rtc" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, ep93xx_rtc_of_ids);
+
 static struct platform_driver ep93xx_rtc_driver = {
 	.driver		= {
 		.name	= "ep93xx-rtc",
+		.of_match_table = ep93xx_rtc_of_ids,
 	},
 	.probe		= ep93xx_rtc_probe,
 };