mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 03/25] clocksource: sh_tmu: Drop support for legacy platform data
Date: Wed, 23 Jul 2014 12:53:45 +0200	[thread overview]
Message-ID: <1406112847-26275-3-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1406112847-26275-1-git-send-email-daniel.lezcano@linaro.org>

From: Laurent Pinchart <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 6bd17a8..3eee5c8 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:
@@ -671,7 +620,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.7.9.5


  parent reply	other threads:[~2014-07-23 10:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 10:51 [PULL] clockevents changes for 3.17 Daniel Lezcano
2014-07-23 10:53 ` [PATCH 01/25] clocksource: sh_cmt: Drop support for legacy platform data Daniel Lezcano
2014-07-23 10:53   ` [PATCH 02/25] clocksource: sh_cmt: Replace global spinlock with a per-device spinlock Daniel Lezcano
2014-07-23 10:53   ` Daniel Lezcano [this message]
2014-07-23 10:53   ` [PATCH 04/25] clocksource: sh_tmu: " Daniel Lezcano
2014-07-23 10:53   ` [PATCH 05/25] clocksource: sh_mtu2: Drop support for legacy platform data Daniel Lezcano
2014-07-23 10:53   ` [PATCH 06/25] clocksource: sh_mtu2: Replace global spinlock with a per-device spinlock Daniel Lezcano
2014-07-23 10:53   ` [PATCH 07/25] clocksource: shmobile: Remove unused sh_timer_config members Daniel Lezcano
2014-07-23 10:53   ` [PATCH 08/25] clocksource: sh_cmt: Add DT support Daniel Lezcano
2014-07-23 10:53   ` [PATCH 09/25] clocksource: sh_tmu: " Daniel Lezcano
2014-07-23 10:53   ` [PATCH 10/25] clocksource: sh_mtu2: " Daniel Lezcano
2014-07-23 10:53   ` [PATCH 11/25] clocksource: sh_mtu2: Tidy up Kconfig typo for MTU2 Daniel Lezcano
2014-07-23 10:53   ` [PATCH 12/25] of: Provide a function to request and map memory Daniel Lezcano
2014-07-23 10:53   ` [PATCH 13/25] clocksource: Add support for the Mediatek SoCs Daniel Lezcano
2014-07-23 10:53   ` [PATCH 14/25] dt-bindings: Add mtk-timer bindings Daniel Lezcano
2014-07-23 10:53   ` [PATCH 15/25] vendor-prefixes: Add prefix for Mediatek Inc Daniel Lezcano
2014-07-23 10:53   ` [PATCH 16/25] clocksource: Kconfig: Let EM_TIMER_STI depend on HAS_IOMEM Daniel Lezcano
2014-07-23 10:53   ` [PATCH 17/25] clocksource: sirf: Fix incorrect clock enable counter for timer Daniel Lezcano
2014-07-23 10:54   ` [PATCH 18/25] clocksource: clps711x: Add CLPS711X clocksource driver Daniel Lezcano
2014-07-23 10:54   ` [PATCH 19/25] clocksource: clps711x: Add DT bindings documentation Daniel Lezcano
2014-07-23 10:54   ` [PATCH 20/25] clocksource: pxa: Move PXA timer to clocksource framework Daniel Lezcano
2014-07-23 10:54   ` [PATCH 21/25] clocksource: pxa: Add device-tree support for PXA timer Daniel Lezcano
2014-07-23 10:54   ` [PATCH 22/25] ARM: pxa: Add CLKSRC_OF dependency Daniel Lezcano
2014-07-23 10:54   ` [PATCH 23/25] ARM: pxa: Add non device-tree timer link to clocksource Daniel Lezcano
2014-07-23 10:54   ` [PATCH 24/25] clocksource: exynos_mct: Use readl_relaxed/writel_relaxed Daniel Lezcano
2014-07-23 10:54   ` [PATCH 25/25] clocksource: exynos_mct: Only use 32-bits where possible 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=1406112847-26275-3-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®