All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft
@ 2016-04-26 15:55 Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs Wolfram Sang
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

Largely due to DT unification, some parts of the code became obsolete. Let's
remove that, the code is complex enough still:

* There are no boards anymore with named interrupt support. Drop support for
  that (patches 2-4)
* No need anymore for a public mmc/tmio.h header file. Merge it into the
  private one (patch 5)

Patches 1 and 6 are small cleanups found on the way :)

Based on latest renesas-drivers which is based on v4.6-rc1 with my sdr50
patches on top. Tested on a Renesas Lager board and build bot is happy, too
(after finding some issues initially).

Change since V1:

* Drop a small cleanup touching SH board files, so we stay in the MMC realm.
  I will do this as a seperate patch so this series won't get delayed.

Please test, comment, apply...

   Wolfram


Wolfram Sang (6):
  mmc: sh_mobile_sdhi: don't use array for DT configs
  mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration
  mmc: tmio: remove now unneeded seperate irq handlers
  mmc: tmio: simplify irq handler
  mmc: tmio: merge distributed include files
  mmc: sh_mobile_sdhi: simplify code for voltage switching

 drivers/mmc/host/sh_mobile_sdhi.c | 75 ++++++++-------------------------------
 drivers/mmc/host/tmio_mmc.h       | 59 +++++++++++++++++++++++++++---
 drivers/mmc/host/tmio_mmc_dma.c   |  1 -
 drivers/mmc/host/tmio_mmc_pio.c   | 55 ++++++----------------------
 include/linux/mmc/tmio.h          | 73 -------------------------------------
 5 files changed, 79 insertions(+), 184 deletions(-)
 delete mode 100644 include/linux/mmc/tmio.h

-- 
2.7.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 19:12   ` Geert Uytterhoeven
  2016-04-26 15:55 ` [PATCH V2 2/6] mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration Wolfram Sang
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

We won't access an index based array to get our DT config, but create
seperate structs instead. So, remove the array which only wastes memory.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index cf10f8cca9ee2d..9beee48d2e280d 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -51,10 +51,8 @@ struct sh_mobile_sdhi_of_data {
 	unsigned bus_shift;
 };
 
-static const struct sh_mobile_sdhi_of_data sh_mobile_sdhi_of_cfg[] = {
-	{
-		.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
-	},
+static const struct sh_mobile_sdhi_of_data of_default_cfg = {
+	.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
 };
 
 static const struct sh_mobile_sdhi_of_data of_rcar_gen1_compatible = {
@@ -81,9 +79,9 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen3_compatible = {
 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
 	{ .compatible = "renesas,sdhi-shmobile" },
 	{ .compatible = "renesas,sdhi-sh7372" },
-	{ .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], },
-	{ .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], },
+	{ .compatible = "renesas,sdhi-sh73a0", .data = &of_default_cfg, },
+	{ .compatible = "renesas,sdhi-r8a73a4", .data = &of_default_cfg, },
+	{ .compatible = "renesas,sdhi-r8a7740", .data = &of_default_cfg, },
 	{ .compatible = "renesas,sdhi-r8a7778", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7779", .data = &of_rcar_gen1_compatible, },
 	{ .compatible = "renesas,sdhi-r8a7790", .data = &of_rcar_gen2_compatible, },
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 2/6] mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers Wolfram Sang
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

There is no user left in the kernel, so this code can be removed.
(Legacy, non-DT sh_mobile boards have been removed a while ago.) The
diff looks more complicated than it is: The if-block for multiplexed isr
is now the main code path, the rest is removed.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c | 57 ++++++---------------------------------
 1 file changed, 8 insertions(+), 49 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 9beee48d2e280d..51d8dbd5b06a3e 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -28,7 +28,6 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/mmc/host.h>
-#include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/mfd/tmio.h>
 #include <linux/sh_dma.h>
 #include <linux/delay.h>
@@ -315,7 +314,6 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	struct tmio_mmc_host *host;
 	struct resource *res;
 	int irq, ret, i = 0;
-	bool multiplexed_isr = true;
 	struct tmio_mmc_dma *dma_priv;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -405,62 +403,23 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto efree;
 
-	/*
-	 * Allow one or more specific (named) ISRs or
-	 * one or more multiplexed (un-named) ISRs.
-	 */
-
-	irq = platform_get_irq_byname(pdev, SH_MOBILE_SDHI_IRQ_CARD_DETECT);
-	if (irq >= 0) {
-		multiplexed_isr = false;
-		ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_card_detect_irq, 0,
+	while (1) {
+		irq = platform_get_irq(pdev, i);
+		if (irq < 0)
+			break;
+		i++;
+		ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
 				  dev_name(&pdev->dev), host);
 		if (ret)
 			goto eirq;
 	}
 
-	irq = platform_get_irq_byname(pdev, SH_MOBILE_SDHI_IRQ_SDIO);
-	if (irq >= 0) {
-		multiplexed_isr = false;
-		ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_sdio_irq, 0,
-				  dev_name(&pdev->dev), host);
-		if (ret)
-			goto eirq;
-	}
-
-	irq = platform_get_irq_byname(pdev, SH_MOBILE_SDHI_IRQ_SDCARD);
-	if (irq >= 0) {
-		multiplexed_isr = false;
-		ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_sdcard_irq, 0,
-				  dev_name(&pdev->dev), host);
-		if (ret)
-			goto eirq;
-	} else if (!multiplexed_isr) {
-		dev_err(&pdev->dev,
-			"Principal SD-card IRQ is missing among named interrupts\n");
+	/* There must be at least one IRQ source */
+	if (!i) {
 		ret = irq;
 		goto eirq;
 	}
 
-	if (multiplexed_isr) {
-		while (1) {
-			irq = platform_get_irq(pdev, i);
-			if (irq < 0)
-				break;
-			i++;
-			ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
-					  dev_name(&pdev->dev), host);
-			if (ret)
-				goto eirq;
-		}
-
-		/* There must be at least one IRQ source */
-		if (!i) {
-			ret = irq;
-			goto eirq;
-		}
-	}
-
 	dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
 		 mmc_hostname(host->mmc), (unsigned long)
 		 (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 2/6] mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 18:03   ` Sergei Shtylyov
  2016-04-26 15:55 ` [PATCH V2 4/6] mmc: tmio: simplify irq handler Wolfram Sang
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

We removed installation of seperate handlers previously, so we can also
remove the seperate handlers.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc.h     |  3 ---
 drivers/mmc/host/tmio_mmc_pio.c | 31 ++-----------------------------
 2 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index b1819c74965b47..032188b766defd 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -115,9 +115,6 @@ void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
 void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 irqreturn_t tmio_mmc_irq(int irq, void *devid);
-irqreturn_t tmio_mmc_sdcard_irq(int irq, void *devid);
-irqreturn_t tmio_mmc_card_detect_irq(int irq, void *devid);
-irqreturn_t tmio_mmc_sdio_irq(int irq, void *devid);
 
 static inline char *tmio_mmc_kmap_atomic(struct scatterlist *sg,
 					 unsigned long *flags)
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 8e2fef7c5e481c..a7250a5fa670c5 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -664,18 +664,6 @@ static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
 	return false;
 }
 
-irqreturn_t tmio_mmc_card_detect_irq(int irq, void *devid)
-{
-	unsigned int ireg, status;
-	struct tmio_mmc_host *host = devid;
-
-	tmio_mmc_card_irq_status(host, &ireg, &status);
-	__tmio_mmc_card_detect_irq(host, ireg, status);
-
-	return IRQ_HANDLED;
-}
-EXPORT_SYMBOL(tmio_mmc_card_detect_irq);
-
 static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host,
 				 int ireg, int status)
 {
@@ -705,19 +693,7 @@ static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host,
 	return false;
 }
 
-irqreturn_t tmio_mmc_sdcard_irq(int irq, void *devid)
-{
-	unsigned int ireg, status;
-	struct tmio_mmc_host *host = devid;
-
-	tmio_mmc_card_irq_status(host, &ireg, &status);
-	__tmio_mmc_sdcard_irq(host, ireg, status);
-
-	return IRQ_HANDLED;
-}
-EXPORT_SYMBOL(tmio_mmc_sdcard_irq);
-
-irqreturn_t tmio_mmc_sdio_irq(int irq, void *devid)
+static void tmio_mmc_sdio_irq(int irq, void *devid)
 {
 	struct tmio_mmc_host *host = devid;
 	struct mmc_host *mmc = host->mmc;
@@ -726,7 +702,7 @@ irqreturn_t tmio_mmc_sdio_irq(int irq, void *devid)
 	unsigned int sdio_status;
 
 	if (!(pdata->flags & TMIO_MMC_SDIO_IRQ))
-		return IRQ_HANDLED;
+		return;
 
 	status = sd_ctrl_read16(host, CTL_SDIO_STATUS);
 	ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdcard_irq_mask;
@@ -739,10 +715,7 @@ irqreturn_t tmio_mmc_sdio_irq(int irq, void *devid)
 
 	if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ)
 		mmc_signal_sdio_irq(mmc);
-
-	return IRQ_HANDLED;
 }
-EXPORT_SYMBOL(tmio_mmc_sdio_irq);
 
 irqreturn_t tmio_mmc_irq(int irq, void *devid)
 {
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 4/6] mmc: tmio: simplify irq handler
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
                   ` (2 preceding siblings ...)
  2016-04-26 15:55 ` [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 5/6] mmc: tmio: merge distributed include files Wolfram Sang
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Having just one irq handler again, let's include the 'card_status'
function in the main handler which is way more readable. Drop a useless
debug output while here. It should be a dev_dbg in case we ever need it
again.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_pio.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index a7250a5fa670c5..879e0f5455ef44 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -632,19 +632,6 @@ out:
 	spin_unlock(&host->lock);
 }
 
-static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host,
-				       int *ireg, int *status)
-{
-	*status = sd_ctrl_read32(host, CTL_STATUS);
-	*ireg = *status & TMIO_MASK_IRQ & ~host->sdcard_irq_mask;
-
-	pr_debug_status(*status);
-	pr_debug_status(*ireg);
-
-	/* Clear the status except the interrupt status */
-	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);
-}
-
 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
 				      int ireg, int status)
 {
@@ -722,9 +709,15 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
 	struct tmio_mmc_host *host = devid;
 	unsigned int ireg, status;
 
-	pr_debug("MMC IRQ begin\n");
+	status = sd_ctrl_read32(host, CTL_STATUS);
+	ireg = status & TMIO_MASK_IRQ & ~host->sdcard_irq_mask;
+
+	pr_debug_status(status);
+	pr_debug_status(ireg);
+
+	/* Clear the status except the interrupt status */
+	sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ);
 
-	tmio_mmc_card_irq_status(host, &ireg, &status);
 	if (__tmio_mmc_card_detect_irq(host, ireg, status))
 		return IRQ_HANDLED;
 	if (__tmio_mmc_sdcard_irq(host, ireg, status))
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 5/6] mmc: tmio: merge distributed include files
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
                   ` (3 preceding siblings ...)
  2016-04-26 15:55 ` [PATCH V2 4/6] mmc: tmio: simplify irq handler Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 15:55 ` [PATCH V2 6/6] mmc: sh_mobile_sdhi: simplify code for voltage switching Wolfram Sang
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

There is no reason to have a public and private header file. Merge them
into a private one, so looking up symbols is less confusing.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc.h     | 56 ++++++++++++++++++++++++++++++-
 drivers/mmc/host/tmio_mmc_dma.c |  1 -
 drivers/mmc/host/tmio_mmc_pio.c |  1 -
 include/linux/mmc/tmio.h        | 73 -----------------------------------------
 4 files changed, 55 insertions(+), 76 deletions(-)
 delete mode 100644 include/linux/mmc/tmio.h

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 032188b766defd..439fdad2bad91d 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -1,6 +1,8 @@
 /*
  * linux/drivers/mmc/host/tmio_mmc.h
  *
+ * Copyright (C) 2016 Sang Engineering, Wolfram Sang
+ * Copyright (C) 2015-16 Renesas Electronics Corporation
  * Copyright (C) 2007 Ian Molton
  * Copyright (C) 2004 Ian Molton
  *
@@ -18,12 +20,64 @@
 
 #include <linux/dmaengine.h>
 #include <linux/highmem.h>
-#include <linux/mmc/tmio.h>
 #include <linux/mutex.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
 #include <linux/spinlock.h>
 
+#define CTL_SD_CMD 0x00
+#define CTL_ARG_REG 0x04
+#define CTL_STOP_INTERNAL_ACTION 0x08
+#define CTL_XFER_BLK_COUNT 0xa
+#define CTL_RESPONSE 0x0c
+#define CTL_STATUS 0x1c
+#define CTL_STATUS2 0x1e
+#define CTL_IRQ_MASK 0x20
+#define CTL_SD_CARD_CLK_CTL 0x24
+#define CTL_SD_XFER_LEN 0x26
+#define CTL_SD_MEM_CARD_OPT 0x28
+#define CTL_SD_ERROR_DETAIL_STATUS 0x2c
+#define CTL_SD_DATA_PORT 0x30
+#define CTL_TRANSACTION_CTL 0x34
+#define CTL_SDIO_STATUS 0x36
+#define CTL_SDIO_IRQ_MASK 0x38
+#define CTL_DMA_ENABLE 0xd8
+#define CTL_RESET_SD 0xe0
+#define CTL_VERSION 0xe2
+#define CTL_SDIO_REGS 0x100
+#define CTL_CLK_AND_WAIT_CTL 0x138
+#define CTL_RESET_SDIO 0x1e0
+
+/* Definitions for values the CTRL_STATUS register can take. */
+#define TMIO_STAT_CMDRESPEND    0x00000001
+#define TMIO_STAT_DATAEND       0x00000004
+#define TMIO_STAT_CARD_REMOVE   0x00000008
+#define TMIO_STAT_CARD_INSERT   0x00000010
+#define TMIO_STAT_SIGSTATE      0x00000020
+#define TMIO_STAT_WRPROTECT     0x00000080
+#define TMIO_STAT_CARD_REMOVE_A 0x00000100
+#define TMIO_STAT_CARD_INSERT_A 0x00000200
+#define TMIO_STAT_SIGSTATE_A    0x00000400
+#define TMIO_STAT_CMD_IDX_ERR   0x00010000
+#define TMIO_STAT_CRCFAIL       0x00020000
+#define TMIO_STAT_STOPBIT_ERR   0x00040000
+#define TMIO_STAT_DATATIMEOUT   0x00080000
+#define TMIO_STAT_RXOVERFLOW    0x00100000
+#define TMIO_STAT_TXUNDERRUN    0x00200000
+#define TMIO_STAT_CMDTIMEOUT    0x00400000
+#define TMIO_STAT_RXRDY         0x01000000
+#define TMIO_STAT_TXRQ          0x02000000
+#define TMIO_STAT_ILL_FUNC      0x20000000
+#define TMIO_STAT_CMD_BUSY      0x40000000
+#define TMIO_STAT_ILL_ACCESS    0x80000000
+
+#define TMIO_STATUS2_DAT0	BIT(7)
+
+#define	CLK_CTL_DIV_MASK	0xff
+#define	CLK_CTL_SCLKEN		BIT(8)
+
+#define TMIO_BBS		512		/* Boot block size */
+
 /* Definitions for values the CTRL_SDIO_STATUS register can take. */
 #define TMIO_SDIO_STAT_IOIRQ	0x0001
 #define TMIO_SDIO_STAT_EXPUB52	0x4000
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 67543587382312..d1573687515d2c 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -15,7 +15,6 @@
 #include <linux/dmaengine.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
-#include <linux/mmc/tmio.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
 
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 879e0f5455ef44..15e6f6d5a42337 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -39,7 +39,6 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/slot-gpio.h>
-#include <linux/mmc/tmio.h>
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
deleted file mode 100644
index b2f28e99503383..00000000000000
--- a/include/linux/mmc/tmio.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * include/linux/mmc/tmio.h
- *
- * Copyright (C) 2016 Sang Engineering, Wolfram Sang
- * Copyright (C) 2015-16 Renesas Electronics Corporation
- * Copyright (C) 2007 Ian Molton
- * Copyright (C) 2004 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Driver for the MMC / SD / SDIO cell found in:
- *
- * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
- */
-#ifndef LINUX_MMC_TMIO_H
-#define LINUX_MMC_TMIO_H
-
-#define CTL_SD_CMD 0x00
-#define CTL_ARG_REG 0x04
-#define CTL_STOP_INTERNAL_ACTION 0x08
-#define CTL_XFER_BLK_COUNT 0xa
-#define CTL_RESPONSE 0x0c
-#define CTL_STATUS 0x1c
-#define CTL_STATUS2 0x1e
-#define CTL_IRQ_MASK 0x20
-#define CTL_SD_CARD_CLK_CTL 0x24
-#define CTL_SD_XFER_LEN 0x26
-#define CTL_SD_MEM_CARD_OPT 0x28
-#define CTL_SD_ERROR_DETAIL_STATUS 0x2c
-#define CTL_SD_DATA_PORT 0x30
-#define CTL_TRANSACTION_CTL 0x34
-#define CTL_SDIO_STATUS 0x36
-#define CTL_SDIO_IRQ_MASK 0x38
-#define CTL_DMA_ENABLE 0xd8
-#define CTL_RESET_SD 0xe0
-#define CTL_VERSION 0xe2
-#define CTL_SDIO_REGS 0x100
-#define CTL_CLK_AND_WAIT_CTL 0x138
-#define CTL_RESET_SDIO 0x1e0
-
-/* Definitions for values the CTRL_STATUS register can take. */
-#define TMIO_STAT_CMDRESPEND    0x00000001
-#define TMIO_STAT_DATAEND       0x00000004
-#define TMIO_STAT_CARD_REMOVE   0x00000008
-#define TMIO_STAT_CARD_INSERT   0x00000010
-#define TMIO_STAT_SIGSTATE      0x00000020
-#define TMIO_STAT_WRPROTECT     0x00000080
-#define TMIO_STAT_CARD_REMOVE_A 0x00000100
-#define TMIO_STAT_CARD_INSERT_A 0x00000200
-#define TMIO_STAT_SIGSTATE_A    0x00000400
-#define TMIO_STAT_CMD_IDX_ERR   0x00010000
-#define TMIO_STAT_CRCFAIL       0x00020000
-#define TMIO_STAT_STOPBIT_ERR   0x00040000
-#define TMIO_STAT_DATATIMEOUT   0x00080000
-#define TMIO_STAT_RXOVERFLOW    0x00100000
-#define TMIO_STAT_TXUNDERRUN    0x00200000
-#define TMIO_STAT_CMDTIMEOUT    0x00400000
-#define TMIO_STAT_RXRDY         0x01000000
-#define TMIO_STAT_TXRQ          0x02000000
-#define TMIO_STAT_ILL_FUNC      0x20000000
-#define TMIO_STAT_CMD_BUSY      0x40000000
-#define TMIO_STAT_ILL_ACCESS    0x80000000
-
-#define TMIO_STATUS2_DAT0	BIT(7)
-
-#define	CLK_CTL_DIV_MASK	0xff
-#define	CLK_CTL_SCLKEN		BIT(8)
-
-#define TMIO_BBS		512		/* Boot block size */
-
-#endif /* LINUX_MMC_TMIO_H */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH V2 6/6] mmc: sh_mobile_sdhi: simplify code for voltage switching
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
                   ` (4 preceding siblings ...)
  2016-04-26 15:55 ` [PATCH V2 5/6] mmc: tmio: merge distributed include files Wolfram Sang
@ 2016-04-26 15:55 ` Wolfram Sang
  2016-04-26 16:00 ` [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Arnd Bergmann
  2016-04-26 16:25 ` Ulf Hansson
  7 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 15:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Wolfram Sang, linux-renesas-soc, Simon Horman, Ulf Hansson

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

A last minute fix applied by Ulf made room for some simplification.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/sh_mobile_sdhi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
index 51d8dbd5b06a3e..b85b87eb55009f 100644
--- a/drivers/mmc/host/sh_mobile_sdhi.c
+++ b/drivers/mmc/host/sh_mobile_sdhi.c
@@ -237,11 +237,7 @@ static int sh_mobile_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
 	if (ret)
 		return ret;
 
-	ret = pinctrl_select_state(priv->pinctrl, pin_state);
-	if (ret)
-		return ret;
-
-	return 0;
+	return pinctrl_select_state(priv->pinctrl, pin_state);
 }
 
 static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
                   ` (5 preceding siblings ...)
  2016-04-26 15:55 ` [PATCH V2 6/6] mmc: sh_mobile_sdhi: simplify code for voltage switching Wolfram Sang
@ 2016-04-26 16:00 ` Arnd Bergmann
  2016-04-26 16:25 ` Ulf Hansson
  7 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2016-04-26 16:00 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Simon Horman, Ulf Hansson

On Tuesday 26 April 2016 17:55:21 Wolfram Sang wrote:
> Largely due to DT unification, some parts of the code became obsolete. Let's
> remove that, the code is complex enough still:
> 
> * There are no boards anymore with named interrupt support. Drop support for
>   that (patches 2-4)
> * No need anymore for a public mmc/tmio.h header file. Merge it into the
>   private one (patch 5)
> 
> Patches 1 and 6 are small cleanups found on the way 
> 
> Based on latest renesas-drivers which is based on v4.6-rc1 with my sdr50
> patches on top. Tested on a Renesas Lager board and build bot is happy, too
> (after finding some issues initially).
> 
> Change since V1:
> 
> * Drop a small cleanup touching SH board files, so we stay in the MMC realm.
>   I will do this as a seperate patch so this series won't get delayed.
> 
> Please test, comment, apply...
> 

Looks really nice!

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft
  2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
                   ` (6 preceding siblings ...)
  2016-04-26 16:00 ` [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Arnd Bergmann
@ 2016-04-26 16:25 ` Ulf Hansson
  7 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-04-26 16:25 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Simon Horman

On 26 April 2016 at 17:55, Wolfram Sang <wsa@the-dreams.de> wrote:
> Largely due to DT unification, some parts of the code became obsolete. Let's
> remove that, the code is complex enough still:
>
> * There are no boards anymore with named interrupt support. Drop support for
>   that (patches 2-4)
> * No need anymore for a public mmc/tmio.h header file. Merge it into the
>   private one (patch 5)
>
> Patches 1 and 6 are small cleanups found on the way :)
>
> Based on latest renesas-drivers which is based on v4.6-rc1 with my sdr50
> patches on top. Tested on a Renesas Lager board and build bot is happy, too
> (after finding some issues initially).
>
> Change since V1:
>
> * Drop a small cleanup touching SH board files, so we stay in the MMC realm.
>   I will do this as a seperate patch so this series won't get delayed.
>
> Please test, comment, apply...
>
>    Wolfram
>
>
> Wolfram Sang (6):
>   mmc: sh_mobile_sdhi: don't use array for DT configs
>   mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration
>   mmc: tmio: remove now unneeded seperate irq handlers
>   mmc: tmio: simplify irq handler
>   mmc: tmio: merge distributed include files
>   mmc: sh_mobile_sdhi: simplify code for voltage switching
>
>  drivers/mmc/host/sh_mobile_sdhi.c | 75 ++++++++-------------------------------
>  drivers/mmc/host/tmio_mmc.h       | 59 +++++++++++++++++++++++++++---
>  drivers/mmc/host/tmio_mmc_dma.c   |  1 -
>  drivers/mmc/host/tmio_mmc_pio.c   | 55 ++++++----------------------
>  include/linux/mmc/tmio.h          | 73 -------------------------------------
>  5 files changed, 79 insertions(+), 184 deletions(-)
>  delete mode 100644 include/linux/mmc/tmio.h
>
> --
> 2.7.0
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers
  2016-04-26 15:55 ` [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers Wolfram Sang
@ 2016-04-26 18:03   ` Sergei Shtylyov
  2016-04-27  8:18     ` Ulf Hansson
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2016-04-26 18:03 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Ulf Hansson

Hello.

On 04/26/2016 06:55 PM, Wolfram Sang wrote:

> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> We removed installation of seperate handlers previously, so we can also

    Separate.

> remove the seperate handlers.

    Again. :-)

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs
  2016-04-26 15:55 ` [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs Wolfram Sang
@ 2016-04-26 19:12   ` Geert Uytterhoeven
  2016-04-26 20:26     ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Geert Uytterhoeven @ 2016-04-26 19:12 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux MMC List, linux-renesas-soc, Simon Horman, Ulf Hansson

Hi Wolfram,

On Tue, Apr 26, 2016 at 5:55 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> --- a/drivers/mmc/host/sh_mobile_sdhi.c
> +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> @@ -81,9 +79,9 @@ static const struct sh_mobile_sdhi_of_data of_rcar_gen3_compatible = {
>  static const struct of_device_id sh_mobile_sdhi_of_match[] = {
>         { .compatible = "renesas,sdhi-shmobile" },
>         { .compatible = "renesas,sdhi-sh7372" },

Care to receive bonus points for removing the compatible value for the
no longer supported sh7372 SoC?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs
  2016-04-26 19:12   ` Geert Uytterhoeven
@ 2016-04-26 20:26     ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-04-26 20:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux MMC List, linux-renesas-soc, Simon Horman, Ulf Hansson

[-- Attachment #1: Type: text/plain, Size: 122 bytes --]


> Care to receive bonus points for removing the compatible value for the
> no longer supported sh7372 SoC?

Oh, sure :D


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers
  2016-04-26 18:03   ` Sergei Shtylyov
@ 2016-04-27  8:18     ` Ulf Hansson
  0 siblings, 0 replies; 13+ messages in thread
From: Ulf Hansson @ 2016-04-27  8:18 UTC (permalink / raw)
  To: Sergei Shtylyov, Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Simon Horman

On 26 April 2016 at 20:03, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 04/26/2016 06:55 PM, Wolfram Sang wrote:
>
>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> We removed installation of seperate handlers previously, so we can also
>
>
>    Separate.
>
>> remove the seperate handlers.
>
>
>    Again. :-)
>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
>
> [...]
>
> MBR, Sergei
>

Acutally checkpatch complains about this as well. This time I decided
to amend the patches myself!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-04-27  8:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-26 15:55 [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Wolfram Sang
2016-04-26 15:55 ` [PATCH V2 1/6] mmc: sh_mobile_sdhi: don't use array for DT configs Wolfram Sang
2016-04-26 19:12   ` Geert Uytterhoeven
2016-04-26 20:26     ` Wolfram Sang
2016-04-26 15:55 ` [PATCH V2 2/6] mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration Wolfram Sang
2016-04-26 15:55 ` [PATCH V2 3/6] mmc: tmio: remove now unneeded seperate irq handlers Wolfram Sang
2016-04-26 18:03   ` Sergei Shtylyov
2016-04-27  8:18     ` Ulf Hansson
2016-04-26 15:55 ` [PATCH V2 4/6] mmc: tmio: simplify irq handler Wolfram Sang
2016-04-26 15:55 ` [PATCH V2 5/6] mmc: tmio: merge distributed include files Wolfram Sang
2016-04-26 15:55 ` [PATCH V2 6/6] mmc: sh_mobile_sdhi: simplify code for voltage switching Wolfram Sang
2016-04-26 16:00 ` [PATCH V2 0/6] mmc: tmio/sdhi: clean up cruft Arnd Bergmann
2016-04-26 16:25 ` Ulf Hansson

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.