Patchwork Re: [PATCH 2/4] rtc-s3c: make room for more variants in devicetree block

login
register
mail settings
Submitter Sylwester Nawrocki
Date Jan. 4, 2012, 10:43 a.m.
Message ID <4F042D61.2070309@samsung.com>
Download mbox | patch
Permalink /patch/134246/
State New
Headers show

Comments

Sylwester Nawrocki - Jan. 4, 2012, 10:43 a.m.
Hello,

On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> Use the data field of of_device_id to hold the type for
> s3c_cpu_type.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  drivers/rtc/rtc-s3c.c |   31 ++++++++++++++++++++++---------
>  1 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 175067a..2885b25 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev)
>  	return 0;
>  }
>  
> +static const struct of_device_id s3c_rtc_dt_match[];
> +
> +static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
> +{
> +#ifdef CONFIG_OF
> +	if (pdev->dev.of_node) {
> +		const struct of_device_id *match;
> +		match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> +		return match->data;
> +	}
> +#endif
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  {
>  	struct rtc_device *rtc;
> @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
>  		goto err_nortc;
>  	}
>  
> -#ifdef CONFIG_OF
> -	if (pdev->dev.of_node)
> -		s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node,
> -			"samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410;
> -	else
> -#endif
> -		s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
> +	s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
>  
>  	/* Check RTC Time */
>  
> @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev)
>  
>  #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
> -	{ .compatible = "samsung,s3c2410-rtc" },
> -	{ .compatible = "samsung,s3c6410-rtc" },
> +	{
> +		.compatible = "samsung,s3c2410-rtc"
> +		.data = TYPE_S3C2410,
> +	}, {
> +		.compatible = "samsung,s3c6410-rtc"
> +		.data = TYPE_S3C64XX,
> +	},
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);

This patch makes compilation with CONFIG_OF enabled fail with errors
and warnings:

drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer without a
cast
drivers/rtc/rtc-s3c.c: At top level:
drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something not a
structure or union
drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something not a
structure or union
make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1

And the following patch fixes this:

8<------------

        return platform_get_device_id(pdev)->driver_data;
@@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device *pdev)
 #ifdef CONFIG_OF
 static const struct of_device_id s3c_rtc_dt_match[] = {
        {
-               .compatible = "samsung,s3c2410-rtc"
-               .data = TYPE_S3C2410,
+               .compatible = "samsung,s3c2410-rtc",
+               .data = (void*)TYPE_S3C2410,
        }, {
-               .compatible = "samsung,s3c2443-rtc"
-               .data = TYPE_S3C2443,
+               .compatible = "samsung,s3c2443-rtc",
+               .data = (void*)TYPE_S3C2443,
        }, {
-               .compatible = "samsung,s3c2416-rtc"
-               .data = TYPE_S3C2416,
+               .compatible = "samsung,s3c2416-rtc",
+               .data = (void*)TYPE_S3C2416,
        }, {
-               .compatible = "samsung,s3c6410-rtc"
-               .data = TYPE_S3C64XX,
+               .compatible = "samsung,s3c6410-rtc",
+               .data = (void*)TYPE_S3C64XX,
        },
        {},
 };

8<-----------------

--

Regards,
Sylwester
Heiko Stübner - Jan. 4, 2012, 11:51 a.m.
Hi Sylwester,

Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> Hello,
> 
> On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > Use the data field of of_device_id to hold the type for
> > s3c_cpu_type.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > ---
> > 
> This patch makes compilation with CONFIG_OF enabled fail with errors
> and warnings:
> 
> drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> without a cast
> drivers/rtc/rtc-s3c.c: At top level:
> drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> not a structure or union
> drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> not a structure or union
> make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
thanks for spotting this.

@kgene: Should this go on top of the rtc series, or should I prepare a v4 with 
these fixes included?


> And the following patch fixes this:
> 
> 8<------------
> 
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 4498053..9a0d388 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct
> platform_device *pdev)
>         if (pdev->dev.of_node) {
>                 const struct of_device_id *match;
>                 match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
> -               return match->data;
> +               return (int)match->data;
>         }
>  #endif
>         return platform_get_device_id(pdev)->driver_data;
> @@ -670,17 +670,17 @@ static int s3c_rtc_resume(struct platform_device
> *pdev) #ifdef CONFIG_OF
>  static const struct of_device_id s3c_rtc_dt_match[] = {
>         {
> -               .compatible = "samsung,s3c2410-rtc"
> -               .data = TYPE_S3C2410,
> +               .compatible = "samsung,s3c2410-rtc",
> +               .data = (void*)TYPE_S3C2410,
>         }, {
> -               .compatible = "samsung,s3c2443-rtc"
> -               .data = TYPE_S3C2443,
> +               .compatible = "samsung,s3c2443-rtc",
> +               .data = (void*)TYPE_S3C2443,
>         }, {
> -               .compatible = "samsung,s3c2416-rtc"
> -               .data = TYPE_S3C2416,
> +               .compatible = "samsung,s3c2416-rtc",
> +               .data = (void*)TYPE_S3C2416,
>         }, {
> -               .compatible = "samsung,s3c6410-rtc"
> -               .data = TYPE_S3C64XX,
> +               .compatible = "samsung,s3c6410-rtc",
> +               .data = (void*)TYPE_S3C64XX,
>         },
>         {},
>  };
> 
> 8<-----------------

Heiko
Heiko Stübner - Jan. 4, 2012, 2:12 p.m.
Hi Kgene,

Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> Hi Sylwester,
> 
> Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > Hello,
> > 
> > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > Use the data field of of_device_id to hold the type for
> > > s3c_cpu_type.
> > > 
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > ---
> > 
> > This patch makes compilation with CONFIG_OF enabled fail with errors
> > and warnings:
> > 
> > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > without a cast
> > drivers/rtc/rtc-s3c.c: At top level:
> > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in something
> > not a structure or union
> > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in something
> > not a structure or union
> > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> 
> thanks for spotting this.
> 
> @kgene: Should this go on top of the rtc series, or should I prepare a v4
> with these fixes included?
never mind, I did both.

In reply to this mail you will find:
- a single patch on top of the 4 original patches, fixing the problems 
sylwester reported
- a v4 of the original series including the fixes to the problems, based on 
the code that you have in your rtc-branch

Please pick the apropriate variant to fix the problem :-)

Heiko
Heiko Stübner - Jan. 4, 2012, 2:14 p.m.
Similar to the ADC the RTC of S3C2443 and S3C2416/2450 has some slight
variances when compared to the existing types.

This series adds support for those SoCs.

As with the ADC patches, these changes where tested on S3C2416 hardware.
The S3C2443 quirks are a subset of those and are done according to the
datasheet, but not tested on real hardware (as I do not own a S3C2443 device).

changes since v3:
fixes missing "," in s3c_rtc_dt_match and wrong handling of the
of_device_id.data property, as reported-by Sylwester Nawrocki

changes since v2:
remove obsolete constants in register cleanup

changes since v1:
address comments from Thomas Abraham, reducing number of ifdefs and
duplicate code


Heiko Stuebner (4):
  ARM: SAMSUNG: cleanup of rtc register definitions
  rtc-s3c: make room for more variants in devicetree block
  rtc-s3c: add variants for S3C2443 and S3C2416
  ARM: S3C2443/S3C2416: add s3c_rtc_setname and rename rtc devices

 arch/arm/mach-s3c2416/s3c2416.c               |    2 +
 arch/arm/mach-s3c2443/s3c2443.c               |    2 +
 arch/arm/plat-samsung/include/plat/regs-rtc.h |   81 +++++++++++++------------
 arch/arm/plat-samsung/include/plat/rtc-core.h |   27 ++++++++
 drivers/rtc/rtc-s3c.c                         |   71 ++++++++++++++++++----
 5 files changed, 131 insertions(+), 52 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/rtc-core.h
Kukjin Kim - Jan. 5, 2012, 2:32 a.m.
Heiko Stübner wrote:

> 
> Hi Kgene,
> 
> Am Mittwoch, 4. Januar 2012, 12:51:41 schrieb Heiko Stübner:
> > Hi Sylwester,
> >
> > Am Mittwoch, 4. Januar 2012, 11:43:45 schrieb Sylwester Nawrocki:
> > > Hello,
> > >
> > > On 12/21/2011 10:16 AM, Heiko Stübner wrote:
> > > > Use the data field of of_device_id to hold the type for
> > > > s3c_cpu_type.
> > > >
> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > > Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org>
> > > > ---
> > >
> > > This patch makes compilation with CONFIG_OF enabled fail with errors
> > > and warnings:
> > >
> > > drivers/rtc/rtc-s3c.c: In function ‘s3c_rtc_get_driver_data’:
> > > drivers/rtc/rtc-s3c.c:454: warning: return makes integer from pointer
> > > without a cast
> > > drivers/rtc/rtc-s3c.c: At top level:
> > > drivers/rtc/rtc-s3c.c:674: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:677: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:680: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > drivers/rtc/rtc-s3c.c:683: error: request for member ‘data’ in
> something
> > > not a structure or union
> > > make[2]: *** [drivers/rtc/rtc-s3c.o] Error 1
> >
> > thanks for spotting this.
> >
> > @kgene: Should this go on top of the rtc series, or should I prepare a
> v4
> > with these fixes included?
> never mind, I did both.
> 
> In reply to this mail you will find:
> - a single patch on top of the 4 original patches, fixing the problems
> sylwester reported
> - a v4 of the original series including the fixes to the problems, based
> on
> the code that you have in your rtc-branch
> 
> Please pick the apropriate variant to fix the problem :-)
> 
OK, since it has been merged into arm-soc, I will send a single patch to
arm-soc.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

Patch

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4498053..9a0d388 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -451,7 +451,7 @@  static inline int s3c_rtc_get_driver_data(struct
platform_device *pdev)
        if (pdev->dev.of_node) {
                const struct of_device_id *match;
                match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
-               return match->data;
+               return (int)match->data;
        }
 #endif