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 v2 04/11] clocksource: sh_cmt: Support separate R-Car Gen2 CMT0/1
Date: Thu, 17 Sep 2015 09:54:03 +0000 [thread overview]
Message-ID: <20150917095403.5369.97011.sendpatchset@little-apple> (raw)
In-Reply-To: <20150917095325.5369.73893.sendpatchset@little-apple>
From: Magnus Damm <damm+renesas@opensource.se>
Add support for the new R-Car Gen2 CMT0 and CMT1 bindings. Support
for the old DT binding is still kept around, however devices using
such binding will be treated as a low-feature CMT0 device. If users
want to make use of CMT1-specific features then they need to update
their DTBs. No special CMT1-specific features are however implemented
by his patch, only DT bindings are redone as groundwork for future
feature patches.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since V1:
- Added Acked-by and Tested-by from Geert
- Added Acked-by from Laurent
drivers/clocksource/sh_cmt.c | 38 +++++++++++++++++++++++++++-----------
1 file changed, 27 insertions(+), 11 deletions(-)
--- 0003/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c 2015-09-17 17:28:33.380513000 +0900
@@ -39,16 +39,16 @@ struct sh_cmt_device;
* SoC but also on the particular instance. The following table lists the main
* characteristics of those flavours.
*
- * 16B 32B 32B-F 48B 48B-2
+ * 16B 32B 32B-F 48B R-Car Gen2
* -----------------------------------------------------------------------------
* Channels 2 1/4 1 6 2/8
* Control Width 16 16 16 16 32
* Counter Width 16 32 32 32/48 32/48
* Shared Start/Stop Y Y Y Y N
*
- * The 48-bit gen2 version has a per-channel start/stop register located in the
- * channel registers block. All other versions have a shared start/stop register
- * located in the global space.
+ * The r8a73a4 / R-Car Gen2 version has a per-channel start/stop register
+ * located in the channel registers block. All other versions have a shared
+ * start/stop register located in the global space.
*
* Channels are indexed from 0 to N-1 in the documentation. The channel index
* infers the start/stop bit position in the control register and the channel
@@ -68,7 +68,8 @@ enum sh_cmt_model {
SH_CMT_32BIT,
SH_CMT_32BIT_FAST,
SH_CMT_48BIT,
- SH_CMT_48BIT_GEN2,
+ SH_CMT0_RCAR_GEN2,
+ SH_CMT1_RCAR_GEN2,
};
struct sh_cmt_info {
@@ -223,8 +224,20 @@ static const struct sh_cmt_info sh_cmt_i
.read_count = sh_cmt_read32,
.write_count = sh_cmt_write32,
},
- [SH_CMT_48BIT_GEN2] = {
- .model = SH_CMT_48BIT_GEN2,
+ [SH_CMT0_RCAR_GEN2] = {
+ .model = SH_CMT0_RCAR_GEN2,
+ .channels_mask = 0x60,
+ .width = 32,
+ .overflow_bit = SH_CMT32_CMCSR_CMF,
+ .clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
+ .read_control = sh_cmt_read32,
+ .write_control = sh_cmt_write32,
+ .read_count = sh_cmt_read32,
+ .write_count = sh_cmt_write32,
+ },
+ [SH_CMT1_RCAR_GEN2] = {
+ .model = SH_CMT1_RCAR_GEN2,
+ .channels_mask = 0xff,
.width = 32,
.overflow_bit = SH_CMT32_CMCSR_CMF,
.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
@@ -867,6 +880,7 @@ static int sh_cmt_setup_channel(struct s
ch->cmt = cmt;
ch->index = index;
ch->hwidx = hwidx;
+ ch->timer_bit = hwidx;
/*
* Compute the address of the channel control register block. For the
@@ -888,9 +902,11 @@ static int sh_cmt_setup_channel(struct s
*/
ch->ioctrl = cmt->mapbase + 0x40;
break;
- case SH_CMT_48BIT_GEN2:
+ case SH_CMT0_RCAR_GEN2:
+ case SH_CMT1_RCAR_GEN2:
ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
ch->ioctrl = ch->iostart + 0x10;
+ ch->timer_bit = 0;
break;
}
@@ -902,8 +918,6 @@ static int sh_cmt_setup_channel(struct s
ch->match_value = ch->max_match_value;
raw_spin_lock_init(&ch->lock);
- ch->timer_bit = cmt->info->model = SH_CMT_48BIT_GEN2 ? 0 : ch->hwidx;
-
ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
clockevent, clocksource);
if (ret) {
@@ -946,7 +960,9 @@ static const struct of_device_id sh_cmt_
{ .compatible = "renesas,cmt-32", .data = &sh_cmt_info[SH_CMT_32BIT] },
{ .compatible = "renesas,cmt-32-fast", .data = &sh_cmt_info[SH_CMT_32BIT_FAST] },
{ .compatible = "renesas,cmt-48", .data = &sh_cmt_info[SH_CMT_48BIT] },
- { .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT_48BIT_GEN2] },
+ { .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT0_RCAR_GEN2] },
+ { .compatible = "renesas,cmt0-rcar-gen2", .data = &sh_cmt_info[SH_CMT0_RCAR_GEN2] },
+ { .compatible = "renesas,cmt1-rcar-gen2", .data = &sh_cmt_info[SH_CMT1_RCAR_GEN2] },
{ }
};
MODULE_DEVICE_TABLE(of, sh_cmt_of_table);
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 v2 04/11] clocksource: sh_cmt: Support separate R-Car Gen2 CMT0/1
Date: Thu, 17 Sep 2015 18:54:03 +0900 [thread overview]
Message-ID: <20150917095403.5369.97011.sendpatchset@little-apple> (raw)
In-Reply-To: <20150917095325.5369.73893.sendpatchset@little-apple>
From: Magnus Damm <damm+renesas@opensource.se>
Add support for the new R-Car Gen2 CMT0 and CMT1 bindings. Support
for the old DT binding is still kept around, however devices using
such binding will be treated as a low-feature CMT0 device. If users
want to make use of CMT1-specific features then they need to update
their DTBs. No special CMT1-specific features are however implemented
by his patch, only DT bindings are redone as groundwork for future
feature patches.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since V1:
- Added Acked-by and Tested-by from Geert
- Added Acked-by from Laurent
drivers/clocksource/sh_cmt.c | 38 +++++++++++++++++++++++++++-----------
1 file changed, 27 insertions(+), 11 deletions(-)
--- 0003/drivers/clocksource/sh_cmt.c
+++ work/drivers/clocksource/sh_cmt.c 2015-09-17 17:28:33.380513000 +0900
@@ -39,16 +39,16 @@ struct sh_cmt_device;
* SoC but also on the particular instance. The following table lists the main
* characteristics of those flavours.
*
- * 16B 32B 32B-F 48B 48B-2
+ * 16B 32B 32B-F 48B R-Car Gen2
* -----------------------------------------------------------------------------
* Channels 2 1/4 1 6 2/8
* Control Width 16 16 16 16 32
* Counter Width 16 32 32 32/48 32/48
* Shared Start/Stop Y Y Y Y N
*
- * The 48-bit gen2 version has a per-channel start/stop register located in the
- * channel registers block. All other versions have a shared start/stop register
- * located in the global space.
+ * The r8a73a4 / R-Car Gen2 version has a per-channel start/stop register
+ * located in the channel registers block. All other versions have a shared
+ * start/stop register located in the global space.
*
* Channels are indexed from 0 to N-1 in the documentation. The channel index
* infers the start/stop bit position in the control register and the channel
@@ -68,7 +68,8 @@ enum sh_cmt_model {
SH_CMT_32BIT,
SH_CMT_32BIT_FAST,
SH_CMT_48BIT,
- SH_CMT_48BIT_GEN2,
+ SH_CMT0_RCAR_GEN2,
+ SH_CMT1_RCAR_GEN2,
};
struct sh_cmt_info {
@@ -223,8 +224,20 @@ static const struct sh_cmt_info sh_cmt_i
.read_count = sh_cmt_read32,
.write_count = sh_cmt_write32,
},
- [SH_CMT_48BIT_GEN2] = {
- .model = SH_CMT_48BIT_GEN2,
+ [SH_CMT0_RCAR_GEN2] = {
+ .model = SH_CMT0_RCAR_GEN2,
+ .channels_mask = 0x60,
+ .width = 32,
+ .overflow_bit = SH_CMT32_CMCSR_CMF,
+ .clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
+ .read_control = sh_cmt_read32,
+ .write_control = sh_cmt_write32,
+ .read_count = sh_cmt_read32,
+ .write_count = sh_cmt_write32,
+ },
+ [SH_CMT1_RCAR_GEN2] = {
+ .model = SH_CMT1_RCAR_GEN2,
+ .channels_mask = 0xff,
.width = 32,
.overflow_bit = SH_CMT32_CMCSR_CMF,
.clear_bits = ~(SH_CMT32_CMCSR_CMF | SH_CMT32_CMCSR_OVF),
@@ -867,6 +880,7 @@ static int sh_cmt_setup_channel(struct s
ch->cmt = cmt;
ch->index = index;
ch->hwidx = hwidx;
+ ch->timer_bit = hwidx;
/*
* Compute the address of the channel control register block. For the
@@ -888,9 +902,11 @@ static int sh_cmt_setup_channel(struct s
*/
ch->ioctrl = cmt->mapbase + 0x40;
break;
- case SH_CMT_48BIT_GEN2:
+ case SH_CMT0_RCAR_GEN2:
+ case SH_CMT1_RCAR_GEN2:
ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
ch->ioctrl = ch->iostart + 0x10;
+ ch->timer_bit = 0;
break;
}
@@ -902,8 +918,6 @@ static int sh_cmt_setup_channel(struct s
ch->match_value = ch->max_match_value;
raw_spin_lock_init(&ch->lock);
- ch->timer_bit = cmt->info->model == SH_CMT_48BIT_GEN2 ? 0 : ch->hwidx;
-
ret = sh_cmt_register(ch, dev_name(&cmt->pdev->dev),
clockevent, clocksource);
if (ret) {
@@ -946,7 +960,9 @@ static const struct of_device_id sh_cmt_
{ .compatible = "renesas,cmt-32", .data = &sh_cmt_info[SH_CMT_32BIT] },
{ .compatible = "renesas,cmt-32-fast", .data = &sh_cmt_info[SH_CMT_32BIT_FAST] },
{ .compatible = "renesas,cmt-48", .data = &sh_cmt_info[SH_CMT_48BIT] },
- { .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT_48BIT_GEN2] },
+ { .compatible = "renesas,cmt-48-gen2", .data = &sh_cmt_info[SH_CMT0_RCAR_GEN2] },
+ { .compatible = "renesas,cmt0-rcar-gen2", .data = &sh_cmt_info[SH_CMT0_RCAR_GEN2] },
+ { .compatible = "renesas,cmt1-rcar-gen2", .data = &sh_cmt_info[SH_CMT1_RCAR_GEN2] },
{ }
};
MODULE_DEVICE_TABLE(of, sh_cmt_of_table);
next prev parent reply other threads:[~2015-09-17 9:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 9:53 [PATCH v2 00/11] clocksource: sh_cmt: DT binding rework V2 Magnus Damm
2015-09-17 9:53 ` Magnus Damm
2015-09-17 9:53 ` [PATCH v2 01/11] devicetree: bindings: Remove sh7372 CMT binding Magnus Damm
2015-09-17 9:53 ` Magnus Damm
2015-09-17 9:53 ` [PATCH v2 02/11] clocksource: sh_cmt: Use 0x3f mask for SH_CMT_48BIT case Magnus Damm
2015-09-17 9:53 ` Magnus Damm
2015-09-17 9:53 ` [PATCH v2 03/11] devicetree: bindings: R-Car Gen2 CMT0 and CMT1 bindings Magnus Damm
2015-09-17 9:53 ` Magnus Damm
2015-09-17 9:54 ` Magnus Damm [this message]
2015-09-17 9:54 ` [PATCH v2 04/11] clocksource: sh_cmt: Support separate R-Car Gen2 CMT0/1 Magnus Damm
2015-09-17 9:54 ` [PATCH v2 05/11] devicetree: bindings: r8a73a4 and R-Car Gen2 CMT bindings Magnus Damm
2015-09-17 9:54 ` Magnus Damm
2015-09-17 9:54 ` [PATCH v2 06/11] ARM: shmobile: Update CMT compat string users in DTS Magnus Damm
2015-09-17 9:54 ` Magnus Damm
2015-09-17 9:54 ` [PATCH v2 07/11] devicetree: bindings: Deprecate property, update example Magnus Damm
2015-09-17 9:54 ` Magnus Damm
2015-09-17 9:54 ` [PATCH v2 08/11] ARM: shmobile: Remove CMT renesas,channels-mask from DTS Magnus Damm
2015-09-17 9:54 ` Magnus Damm
2015-09-17 9:54 ` [PATCH v2 09/11] devicetree: bindings: Remove unused 32-bit CMT bindings Magnus Damm
2015-09-17 9:54 ` Magnus Damm
2015-09-17 9:59 ` Geert Uytterhoeven
2015-09-17 9:59 ` Geert Uytterhoeven
2015-09-17 12:14 ` Sergei Shtylyov
2015-09-17 12:14 ` Sergei Shtylyov
2015-09-17 12:41 ` Magnus Damm
2015-09-17 12:41 ` Magnus Damm
2015-09-17 9:55 ` [PATCH v2 10/11] clocksource: sh_cmt: " Magnus Damm
2015-09-17 9:55 ` Magnus Damm
2015-09-17 9:59 ` Geert Uytterhoeven
2015-09-17 9:59 ` Geert Uytterhoeven
2015-09-17 9:55 ` [PATCH v2 11/11] devicetree: bindings: Remove deprecated properties Magnus Damm
2015-09-17 9:55 ` Magnus Damm
2015-09-17 10:04 ` Geert Uytterhoeven
2015-09-17 10:04 ` Geert Uytterhoeven
2015-09-17 10:33 ` Magnus Damm
2015-09-17 10:33 ` Magnus Damm
2015-09-21 14:25 ` [PATCH v2 00/11] clocksource: sh_cmt: DT binding rework V2 Rob Herring
2015-09-21 14:25 ` Rob Herring
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=20150917095403.5369.97011.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.