All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com,
	geert+renesas@glider.be, linux-sh@vger.kernel.org,
	daniel.lezcano@linaro.org, horms+renesas@verge.net.au,
	Magnus Damm <magnus.damm@gmail.com>,
	tglx@linutronix.de
Subject: [PATCH 02/08] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case
Date: Sun, 21 Jun 2015 08:09:27 +0000	[thread overview]
Message-ID: <20150621080927.10187.98007.sendpatchset@little-apple> (raw)
In-Reply-To: <20150621080903.10187.20998.sendpatchset@little-apple>

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
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in

WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com,
	geert+renesas@glider.be, linux-sh@vger.kernel.org,
	daniel.lezcano@linaro.org, horms+renesas@verge.net.au,
	Magnus Damm <magnus.damm@gmail.com>,
	tglx@linutronix.de
Subject: [PATCH 02/08] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case
Date: Sun, 21 Jun 2015 17:09:27 +0900	[thread overview]
Message-ID: <20150621080927.10187.98007.sendpatchset@little-apple> (raw)
In-Reply-To: <20150621080903.10187.20998.sendpatchset@little-apple>

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
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org,
	laurent.pinchart+renesas@ideasonboard.com,
	geert+renesas@glider.be, linux-sh@vger.kernel.org,
	daniel.lezcano@linaro.org, horms+renesas@verge.net.au,
	Magnus Damm <magnus.damm@gmail.com>,
	tglx@linutronix.de
Subject: [PATCH 02/08] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case
Date: Sun, 21 Jun 2015 17:09:27 +0900	[thread overview]
Message-ID: <20150621080927.10187.98007.sendpatchset@little-apple> (raw)
In-Reply-To: <20150621080903.10187.20998.sendpatchset@little-apple>

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
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in

  parent reply	other threads:[~2015-06-21  8:09 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21  8:09 [PATCH 00/08] clocksource: sh_cmt: DT binding rework Magnus Damm
2015-06-21  8:09 ` Magnus Damm
2015-06-21  8:09 ` Magnus Damm
2015-06-21  8:09 ` [PATCH 01/08] devicetree: bindings: Remove sh7372 CMT binding Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-22  9:38   ` Geert Uytterhoeven
2015-06-22  9:38     ` Geert Uytterhoeven
2015-06-22  9:38     ` Geert Uytterhoeven
2015-06-22  9:41     ` Magnus Damm
2015-06-22  9:41       ` Magnus Damm
2015-06-22  9:41       ` Magnus Damm
2015-06-21  8:09 ` Magnus Damm [this message]
2015-06-21  8:09   ` [PATCH 02/08] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-22  9:43   ` Geert Uytterhoeven
2015-06-22  9:43     ` Geert Uytterhoeven
2015-06-22  9:43     ` Geert Uytterhoeven
2015-06-22  9:45     ` Magnus Damm
2015-06-22  9:45       ` Magnus Damm
2015-06-22  9:45       ` Magnus Damm
2015-06-21  8:09 ` [PATCH 03/08] devicetree: bindings: R-Car Gen2 CMT0 and CMT1 bindings Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-21  8:09 ` [PATCH 04/08] clocksource: sh_cmt: Support separate R-Car Gen2 CMT0/1 Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-21  8:09   ` Magnus Damm
2015-06-21  8:10 ` [PATCH 05/08] devicetree: bindings: r8a73a4 and R-Car Gen2 CMT bindings Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10 ` [PATCH 06/08] ARM: shmobile: Update CMT compat string users in DTS Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10 ` [PATCH 07/08] devicetree: bindings: Deprecate property, update example Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10 ` [PATCH 08/08] ARM: shmobile: Remove CMT renesas,channels-mask from DTS Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-21  8:10   ` Magnus Damm
2015-06-22 22:40   ` Laurent Pinchart
2015-06-22 22:40     ` Laurent Pinchart
2015-06-22 22:40     ` Laurent Pinchart
2015-06-23  2:46     ` Magnus Damm
2015-06-23  2:46       ` Magnus Damm
2015-06-23  2:46       ` Magnus Damm
2015-06-25 21:56       ` Laurent Pinchart
2015-06-25 21:56         ` Laurent Pinchart
2015-06-22  9:49 ` [PATCH 00/08] clocksource: sh_cmt: DT binding rework Geert Uytterhoeven
2015-06-22  9:49   ` Geert Uytterhoeven
2015-06-22  9:49   ` Geert Uytterhoeven
2015-06-22 22:45 ` Laurent Pinchart
2015-06-22 22:45   ` Laurent Pinchart
2015-06-22 22:45   ` Laurent Pinchart

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=20150621080927.10187.98007.sendpatchset@little-apple \
    --to=magnus.damm@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=horms+renesas@verge.net.au \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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.