devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Magnus Damm <damm+renesas@opensource.se>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH v3 2/7] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case
Date: Mon, 18 Sep 2017 15:46:42 +0200	[thread overview]
Message-ID: <1505742407-31576-3-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1505742407-31576-1-git-send-email-geert+renesas@glider.be>

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>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
  - Take over from Magnus,
  - Change channels_mask from "unsigned long" to "unsigned int, as it's
    assigned to sh_cmt_device.hw_channels, which is "unsigned int",

v2:
  - Fixed compile error,
  - Added Acked-by and Tested-by from Geert,
  - Added Acked-by from Laurent.
---
 drivers/clocksource/sh_cmt.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index e09e8bf0bb9bf536..c104c80424c88f08 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -74,6 +74,8 @@ enum sh_cmt_model {
 struct sh_cmt_info {
 	enum sh_cmt_model model;
 
+	unsigned int 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_info[] = {
 	},
 	[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),
@@ -966,9 +969,14 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 		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;
-- 
2.7.4

  parent reply	other threads:[~2017-09-18 13:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 13:46 [PATCH v3 0/7] clocksource: sh_cmt: Update driver for DT binding rework Geert Uytterhoeven
2017-09-18 13:46 ` [PATCH v3 1/7] dt-bindings: timer: renesas,cmt: Fix SoC-specific compatible values Geert Uytterhoeven
     [not found]   ` <1505742407-31576-2-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2017-09-21 23:10     ` Rob Herring
2017-09-18 13:46 ` Geert Uytterhoeven [this message]
     [not found] ` <1505742407-31576-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
2017-09-18 13:46   ` [PATCH v3 3/7] clocksource: sh_cmt: Support separate R-Car Gen2 CMT0/1 Geert Uytterhoeven
2017-09-18 13:46   ` [PATCH v3 4/7] clocksource: sh_cmt: Remove support for "renesas,cmt-32*" Geert Uytterhoeven
2017-09-18 13:46 ` [PATCH v3 5/7] clocksource: sh_cmt: Mark "renesas,cmt-48-gen2" deprecated Geert Uytterhoeven
2017-09-18 13:46 ` [PATCH v3 6/7] clocksource: sh_cmt: Remove unused "renesas,channels-mask" handling Geert Uytterhoeven
2017-09-18 13:46 ` [PATCH v3 7/7] clocksource: sh_cmt: Use of_device_get_match_data() helper Geert Uytterhoeven
2017-09-25 23:21 ` [PATCH v3 0/7] clocksource: sh_cmt: Update driver for DT binding rework Daniel Lezcano
2017-09-26  8:26 ` Laurent Pinchart
2017-09-26 18:38   ` Daniel Lezcano
     [not found]     ` <1464ad27-3627-df14-91f9-29a626ceb29d-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-09-27  7:14       ` Geert Uytterhoeven

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=1505742407-31576-3-git-send-email-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=damm+renesas@opensource.se \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@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 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).