From: laurent.pinchart+renesas@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 04/19] clocksource: sh_tmu: Drop support for legacy platform data
Date: Mon, 16 Jun 2014 17:07:16 +0200 [thread overview]
Message-ID: <1402931251-22581-5-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <1402931251-22581-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>
Now that all platforms have switched to the new-style platform data,
drop support for the legacy version.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Simon Horman <horms+renesas@verge.net.au>
---
drivers/clocksource/sh_tmu.c | 82 ++++++++------------------------------------
1 file changed, 15 insertions(+), 67 deletions(-)
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index ec34095..4363eb7 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -32,7 +32,6 @@
#include <linux/spinlock.h>
enum sh_tmu_model {
- SH_TMU_LEGACY,
SH_TMU,
SH_TMU_SH3,
};
@@ -91,8 +90,6 @@ static inline unsigned long sh_tmu_read(struct sh_tmu_channel *ch, int reg_nr)
if (reg_nr == TSTR) {
switch (ch->tmu->model) {
- case SH_TMU_LEGACY:
- return ioread8(ch->tmu->mapbase);
case SH_TMU_SH3:
return ioread8(ch->tmu->mapbase + 2);
case SH_TMU:
@@ -115,8 +112,6 @@ static inline void sh_tmu_write(struct sh_tmu_channel *ch, int reg_nr,
if (reg_nr == TSTR) {
switch (ch->tmu->model) {
- case SH_TMU_LEGACY:
- return iowrite8(value, ch->tmu->mapbase);
case SH_TMU_SH3:
return iowrite8(value, ch->tmu->mapbase + 2);
case SH_TMU:
@@ -476,27 +471,12 @@ static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
return 0;
ch->tmu = tmu;
+ ch->index = index;
- if (tmu->model == SH_TMU_LEGACY) {
- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
-
- /*
- * The SH3 variant (SH770x, SH7705, SH7710 and SH7720) maps
- * channel registers blocks at base + 2 + 12 * index, while all
- * other variants map them at base + 4 + 12 * index. We can
- * compute the index by just dividing by 12, the 2 bytes or 4
- * bytes offset being hidden by the integer division.
- */
- ch->index = cfg->channel_offset / 12;
- ch->base = tmu->mapbase + cfg->channel_offset;
- } else {
- ch->index = index;
-
- if (tmu->model == SH_TMU_SH3)
- ch->base = tmu->mapbase + 4 + ch->index * 12;
- else
- ch->base = tmu->mapbase + 8 + ch->index * 12;
- }
+ if (tmu->model == SH_TMU_SH3)
+ ch->base = tmu->mapbase + 4 + ch->index * 12;
+ else
+ ch->base = tmu->mapbase + 8 + ch->index * 12;
ch->irq = platform_get_irq(tmu->pdev, index);
if (ch->irq < 0) {
@@ -526,28 +506,9 @@ static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
if (tmu->mapbase == NULL)
return -ENXIO;
- /*
- * In legacy platform device configuration (with one device per channel)
- * the resource points to the channel base address.
- */
- if (tmu->model == SH_TMU_LEGACY) {
- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
- tmu->mapbase -= cfg->channel_offset;
- }
-
return 0;
}
-static void sh_tmu_unmap_memory(struct sh_tmu_device *tmu)
-{
- if (tmu->model == SH_TMU_LEGACY) {
- struct sh_timer_config *cfg = tmu->pdev->dev.platform_data;
- tmu->mapbase += cfg->channel_offset;
- }
-
- iounmap(tmu->mapbase);
-}
-
static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
{
struct sh_timer_config *cfg = pdev->dev.platform_data;
@@ -564,8 +525,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
tmu->model = id->driver_data;
/* Get hold of clock. */
- tmu->clk = clk_get(&tmu->pdev->dev,
- tmu->model == SH_TMU_LEGACY ? "tmu_fck" : "fck");
+ tmu->clk = clk_get(&tmu->pdev->dev, "fck");
if (IS_ERR(tmu->clk)) {
dev_err(&tmu->pdev->dev, "cannot get clock\n");
return PTR_ERR(tmu->clk);
@@ -583,10 +543,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
}
/* Allocate and setup the channels. */
- if (tmu->model == SH_TMU_LEGACY)
- tmu->num_channels = 1;
- else
- tmu->num_channels = hweight8(cfg->channels_mask);
+ tmu->num_channels = hweight8(cfg->channels_mask);
tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels,
GFP_KERNEL);
@@ -595,23 +552,15 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
goto err_unmap;
}
- if (tmu->model == SH_TMU_LEGACY) {
- ret = sh_tmu_channel_setup(&tmu->channels[0], 0,
- cfg->clockevent_rating != 0,
- cfg->clocksource_rating != 0, tmu);
+ /*
+ * Use the first channel as a clock event device and the second channel
+ * as a clock source.
+ */
+ for (i = 0; i < tmu->num_channels; ++i) {
+ ret = sh_tmu_channel_setup(&tmu->channels[i], i,
+ i == 0, i == 1, tmu);
if (ret < 0)
goto err_unmap;
- } else {
- /*
- * Use the first channel as a clock event device and the second
- * channel as a clock source.
- */
- for (i = 0; i < tmu->num_channels; ++i) {
- ret = sh_tmu_channel_setup(&tmu->channels[i], i,
- i == 0, i == 1, tmu);
- if (ret < 0)
- goto err_unmap;
- }
}
platform_set_drvdata(pdev, tmu);
@@ -620,7 +569,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
err_unmap:
kfree(tmu->channels);
- sh_tmu_unmap_memory(tmu);
+ iounmap(tmu->mapbase);
err_clk_unprepare:
clk_unprepare(tmu->clk);
err_clk_put:
@@ -673,7 +622,6 @@ static int sh_tmu_remove(struct platform_device *pdev)
}
static const struct platform_device_id sh_tmu_id_table[] = {
- { "sh_tmu", SH_TMU_LEGACY },
{ "sh-tmu", SH_TMU },
{ "sh-tmu-sh3", SH_TMU_SH3 },
{ }
--
1.8.5.5
next prev parent reply other threads:[~2014-06-16 15:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 15:07 [PATCH v4 00/19] Renesas CMT, MTU2 and TMU timers DT support Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 01/19] clocksource: sh_tmu: Fix channel IRQ retrieval in legacy case Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 02/19] clocksource: sh_cmt: Drop support for legacy platform data Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 03/19] clocksource: sh_cmt: Replace global spinlock with a per-device spinlock Laurent Pinchart
2014-06-16 15:07 ` Laurent Pinchart [this message]
2014-06-16 15:07 ` [PATCH v4 05/19] clocksource: sh_tmu: " Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 06/19] clocksource: sh_mtu2: Drop support for legacy platform data Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 07/19] clocksource: sh_mtu2: Replace global spinlock with a per-device spinlock Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 08/19] clocksource: shmobile: Remove unused sh_timer_config members Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 09/19] clocksource: sh_cmt: Add DT support Laurent Pinchart
2014-07-04 13:15 ` Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 10/19] clocksource: sh_tmu: " Laurent Pinchart
2014-06-17 1:11 ` Simon Horman
2014-06-16 15:07 ` [PATCH v4 11/19] clocksource: sh_mtu2: " Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 12/19] ARM: shmobile: r8a7790: Add CMT devices to DT Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 13/19] ARM: shmobile: r8a7791: " Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 14/19] ARM: shmobile: r8a7779: Add TMU " Laurent Pinchart
2014-06-17 1:12 ` Simon Horman
2014-06-16 15:07 ` [PATCH v4 15/19] ARM: shmobile: r7s72100: Add MTU2 device " Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 16/19] ARM: shmobile: lager-reference: Enable CMT0 in device tree Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 17/19] ARM: shmobile: koelsch-reference: " Laurent Pinchart
2014-06-16 15:07 ` [PATCH v4 18/19] ARM: shmobile: marzen-reference: Enable TMU0 " Laurent Pinchart
2014-06-17 1:14 ` Simon Horman
2014-06-16 15:07 ` [PATCH v4 19/19] ARM: shmobile: genmai-reference: Enable MTU2 " Laurent Pinchart
2014-07-02 14:23 ` [GIT PULL FOR v3.17] Renesas CMT, MTU2 and TMU timers DT support Laurent Pinchart
2014-07-04 13:53 ` [GIT PULL v2 " Laurent Pinchart
2014-07-09 9:59 ` Laurent Pinchart
2014-07-13 9:55 ` Simon Horman
2014-07-13 13:00 ` Laurent Pinchart
2014-07-13 14:42 ` Daniel Lezcano
2014-07-13 20:39 ` Simon Horman
2014-07-14 21:54 ` Daniel Lezcano
2014-07-15 9:09 ` Simon Horman
2014-07-14 9:06 ` Laurent Pinchart
2014-07-14 10:20 ` Daniel Lezcano
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=1402931251-22581-5-git-send-email-laurent.pinchart+renesas@ideasonboard.com \
--to=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).