diff mbox

[02/08] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case

Message ID 20150621080927.10187.98007.sendpatchset@little-apple (mailing list archive)
State Changes Requested
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Magnus Damm June 21, 2015, 8:09 a.m. UTC
From: Magnus Damm <damm+renesas@opensource.se>

Always use 0x3f as channel mask for the SH_CMT_48BIT type of devices.
Once this patch is applied the "renesas,channels-mask" property will
be ignored by the driver for older devices matching SH_CMT_48BIT. In
the future when all CMT types store channel mask in the driver then
we will be able to deprecate and remove "renesas,channels-mask" from DTS.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/clocksource/sh_cmt.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in

Comments

Geert Uytterhoeven June 22, 2015, 9:43 a.m. UTC | #1
On Sun, Jun 21, 2015 at 10:09 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Always use 0x3f as channel mask for the SH_CMT_48BIT type of devices.
> Once this patch is applied the "renesas,channels-mask" property will
> be ignored by the driver for older devices matching SH_CMT_48BIT. In
> the future when all CMT types store channel mask in the driver then
> we will be able to deprecate and remove "renesas,channels-mask" from DTS.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
> ---
>
>  drivers/clocksource/sh_cmt.c |   14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> --- 0001/drivers/clocksource/sh_cmt.c
> +++ work/drivers/clocksource/sh_cmt.c   2015-06-20 15:25:54.302366518 +0900

> @@ -969,9 +972,14 @@ static int sh_cmt_setup(struct sh_cmt_de
>                 id = of_match_node(sh_cmt_of_table, pdev->dev.of_node);
>                 cmt->info = id->data;
>
> -               ret = sh_cmt_parse_dt(cmt);
> -               if (ret < 0)
> -                       return ret;
> +               /* prefer in-driver channel configuration over DT */
> +               if (cmt->info->channels_mask) {
> +                       cmt->hw_channels = cmt->info_channels_mask;

drivers/clocksource/sh_cmt.c: In function 'sh_cmt_setup':
drivers/clocksource/sh_cmt.c:996:26: error: 'struct sh_cmt_device' has
no member named 'info_channels_mask'
    cmt->hw_channels = cmt->info_channels_mask;
                          ^

"cmt->info->channels_mask"

> +               } else {
> +                       ret = sh_cmt_parse_dt(cmt);
> +                       if (ret < 0)
> +                               return ret;
> +               }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
Magnus Damm June 22, 2015, 9:45 a.m. UTC | #2
On Mon, Jun 22, 2015 at 6:43 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Sun, Jun 21, 2015 at 10:09 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
>> From: Magnus Damm <damm+renesas@opensource.se>
>>
>> Always use 0x3f as channel mask for the SH_CMT_48BIT type of devices.
>> Once this patch is applied the "renesas,channels-mask" property will
>> be ignored by the driver for older devices matching SH_CMT_48BIT. In
>> the future when all CMT types store channel mask in the driver then
>> we will be able to deprecate and remove "renesas,channels-mask" from DTS.
>>
>> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
>> ---
>>
>>  drivers/clocksource/sh_cmt.c |   14 +++++++++++---
>>  1 file changed, 11 insertions(+), 3 deletions(-)
>>
>> --- 0001/drivers/clocksource/sh_cmt.c
>> +++ work/drivers/clocksource/sh_cmt.c   2015-06-20 15:25:54.302366518 +0900
>
>> @@ -969,9 +972,14 @@ static int sh_cmt_setup(struct sh_cmt_de
>>                 id = of_match_node(sh_cmt_of_table, pdev->dev.of_node);
>>                 cmt->info = id->data;
>>
>> -               ret = sh_cmt_parse_dt(cmt);
>> -               if (ret < 0)
>> -                       return ret;
>> +               /* prefer in-driver channel configuration over DT */
>> +               if (cmt->info->channels_mask) {
>> +                       cmt->hw_channels = cmt->info_channels_mask;
>
> drivers/clocksource/sh_cmt.c: In function 'sh_cmt_setup':
> drivers/clocksource/sh_cmt.c:996:26: error: 'struct sh_cmt_device' has
> no member named 'info_channels_mask'
>     cmt->hw_channels = cmt->info_channels_mask;
>                           ^
>
> "cmt->info->channels_mask"

Ouch, will fix. Thanks!

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
diff mbox

Patch

--- 0001/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c	2015-06-20 15:25:54.302366518 +0900
@@ -74,6 +74,8 @@  enum sh_cmt_model {
 struct sh_cmt_info {
 	enum sh_cmt_model model;
 
+	unsigned long channels_mask;
+
 	unsigned long width; /* 16 or 32 bit version of hardware block */
 	unsigned long overflow_bit;
 	unsigned long clear_bits;
@@ -212,6 +214,7 @@  static const struct sh_cmt_info sh_cmt_i
 	},
 	[SH_CMT_48BIT] = {
 		.model = SH_CMT_48BIT,
+		.channels_mask = 0x3f,
 		.width = 32,
 		.overflow_bit = SH_CMT32_CMCSR_CMF,
 		.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
@@ -969,9 +972,14 @@  static int sh_cmt_setup(struct sh_cmt_de
 		id = of_match_node(sh_cmt_of_table, pdev->dev.of_node);
 		cmt->info = id->data;
 
-		ret = sh_cmt_parse_dt(cmt);
-		if (ret < 0)
-			return ret;
+		/* prefer in-driver channel configuration over DT */
+		if (cmt->info->channels_mask) {
+			cmt->hw_channels = cmt->info_channels_mask;
+		} else {
+			ret = sh_cmt_parse_dt(cmt);
+			if (ret < 0)
+				return ret;
+		}
 	} else if (pdev->dev.platform_data) {
 		struct sh_timer_config *cfg = pdev->dev.platform_data;
 		const struct platform_device_id *id = pdev->id_entry;