All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
@ 2010-08-30 10:50 Matt Fleming
  2010-08-30 13:17 ` Arnd Hannemann
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Matt Fleming @ 2010-08-30 10:50 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm, Arnd Hannemann,
	Samuel Ortiz, Ian Molton

From: Yusuke Goda <yusuke.goda.sx@renesas.com>

Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
mode if the hardware supports it.

Tested with the SDHI hardware block included in sh7724.

Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Matt Fleming <matt@console-pimps.org>
---

Andrew, I've added some code to Yusuke's original patch based on
feedback from Ian Molton saying that the original change didn't work on
his hardware. I'd really prefer some Tested-by's and Acked-by's before
you take this patch just so we can make sure that everybody is happy and
that everybody's hardware still works.

Magnus was worried that this patch would conflict with the SDHI/MMCIF
hotplug patches from Arnd (particularly "[PATCH 1/4] tmio_mmc: Allow the
mfd driver to specify get_cd handler") but I seem to be able to shuffle
the patches around without any conflicts.

 drivers/mfd/sh_mobile_sdhi.c |    6 ++++++
 drivers/mmc/host/tmio_mmc.c  |   17 ++++++++++++-----
 include/linux/mfd/tmio.h     |    5 +++++
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
index 7c23630..9d43316 100644
--- a/drivers/mfd/sh_mobile_sdhi.c
+++ b/drivers/mfd/sh_mobile_sdhi.c
@@ -125,6 +125,12 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
 		mmc_data->capabilities |= p->tmio_caps;
 	}
 
+	/*
+	 * All SDHI blocks support 2-byte and larger block sizes in 4-bit
+	 * bus width mode.
+	 */
+	mmc_data->flags |= TMIO_MMC_BLKSZ_2BYTES;
+
 	if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
 		priv->param_tx.slave_id = p->dma_slave_tx;
 		priv->param_rx.slave_id = p->dma_slave_rx;
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 1a47221..e7765a8 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -658,14 +658,21 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
 static int tmio_mmc_start_data(struct tmio_mmc_host *host,
 	struct mmc_data *data)
 {
+	struct mfd_cell *cell = host->pdev->dev.platform_data;
+	struct tmio_mmc_data *pdata = cell->driver_data;
+
 	pr_debug("setup data transfer: blocksize %08x  nr_blocks %d\n",
 		 data->blksz, data->blocks);
 
-	/* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */
-	if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
-		pr_err("%s: %d byte block unsupported in 4 bit mode\n",
-		       mmc_hostname(host->mmc), data->blksz);
-		return -EINVAL;
+	/* Some hardware cannot perform 2 byte requests in 4 bit mode */
+	if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
+		int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;
+
+		if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {
+			pr_err("%s: %d byte block unsupported in 4 bit mode\n",
+			       mmc_hostname(host->mmc), data->blksz);
+			return -EINVAL;
+		}
 	}
 
 	tmio_mmc_init_sg(host, data);
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 24c43bb..085f041 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -52,6 +52,11 @@
 
 /* tmio MMC platform flags */
 #define TMIO_MMC_WRPROTECT_DISABLE	(1 << 0)
+/*
+ * Some controllers can support a 2-byte block size when the bus width
+ * is configured in 4-bit mode.
+ */
+#define TMIO_MMC_BLKSZ_2BYTES		(1 << 1)
 
 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
-- 
1.7.1


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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
@ 2010-08-30 13:17 ` Arnd Hannemann
  2010-08-31 10:51 ` Magnus Damm
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Arnd Hannemann @ 2010-08-30 13:17 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm,
	Samuel Ortiz, Ian Molton

Hi,

Am 30.08.2010 12:50, schrieb Matt Fleming:
> From: Yusuke Goda <yusuke.goda.sx@renesas.com>
>
> Adjust the tmio_mmc block size check to accept 2-byte requests in
> 4-bit mode if the hardware supports it.
>
> Tested with the SDHI hardware block included in sh7724.
>
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Matt Fleming <matt@console-pimps.org>

Tested on AP4EVB (sh7372) with SDHC and MMC cards.

Tested-by: Arnd Hannemann <arnd@arndnet.de>

Regards,
Arnd



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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
  2010-08-30 13:17 ` Arnd Hannemann
@ 2010-08-31 10:51 ` Magnus Damm
  2010-09-05 20:08 ` Matt Fleming
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Magnus Damm @ 2010-08-31 10:51 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt,
	Arnd Hannemann, Samuel Ortiz, Ian Molton

Hi Matt,

On Mon, Aug 30, 2010 at 7:50 PM, Matt Fleming <matt@console-pimps.org> wrote:
> From: Yusuke Goda <yusuke.goda.sx@renesas.com>
>
> Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
> mode if the hardware supports it.
>
> Tested with the SDHI hardware block included in sh7724.
>
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Matt Fleming <matt@console-pimps.org>
> ---

So I've just tested this on AP4EVB with a b43 SDIO card.

Without this patch I get the following:
...
mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
mmc0: queuing unknown CIS tuple 0x80 (5 bytes)
mmc0: queuing unknown CIS tuple 0x80 (9 bytes)
mmc0: new SDIO card at address 0001
b43-sdio mmc0:0001:1: Chip ID 14e4:4318
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x0D, vendor 0x4243)
ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x09, vendor 0x4243)
ssb: Core 2 found: PCI (cc 0x804, rev 0x0C, vendor 0x4243)
ssb: Core 3 found: PCMCIA (cc 0x80D, rev 0x07, vendor 0x4243)
rtc-rs5c372 1-0032: hctosys: unable to read the hardware clock
b43-phy0: Broadcom 4318 WLAN found (core revision 9)
Freeing init memory: 2864K
mmc0: 2 byte block unsupported in 4 bit mode
b43-phy0 ERROR: FOUND UNSUPPORTED PHY (Analog 15, Type 15, Revision 255)
b43: probe of ssb0:0 failed with error -95
ssb: Sonics Silicon Backplane found on SDIO device mmc0:0001:1


With patch applied:
...
mmc0: queuing unknown CIS tuple 0x80 (3 bytes)
mmc0: queuing unknown CIS tuple 0x80 (5 bytes)
mmc0: queuing unknown CIS tuple 0x80 (9 bytes)
mmc0: new SDIO card at address 0001
b43-sdio mmc0:0001:1: Chip ID 14e4:4318
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x0D, vendor 0x4243)
ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x09, vendor 0x4243)
ssb: Core 2 found: PCI (cc 0x804, rev 0x0C, vendor 0x4243)
ssb: Core 3 found: PCMCIA (cc 0x80D, rev 0x07, vendor 0x4243)
rtc-rs5c372 1-0032: hctosys: unable to read the hardware clock
b43-phy0: Broadcom 4318 WLAN found (core revision 9)
Freeing init memory: 2864K
phy0: Selected rate control algorithm 'minstrel_ht'
ssb: Sonics Silicon Backplane found on SDIO device mmc0:0001:1


This patch is one step closer toward using the b43 driver on SDHI
hardware with polled SDIO.

Acked-by: Magnus Damm <damm@opensource.se>

Thanks!

/ magnus

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
  2010-08-30 13:17 ` Arnd Hannemann
  2010-08-31 10:51 ` Magnus Damm
@ 2010-09-05 20:08 ` Matt Fleming
  2010-09-10 16:58 ` Samuel Ortiz
  2010-09-23 19:11 ` Ian Molton
  4 siblings, 0 replies; 9+ messages in thread
From: Matt Fleming @ 2010-09-05 20:08 UTC (permalink / raw)
  To: Ian Molton
  Cc: linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm, Arnd Hannemann,
	Samuel Ortiz, Andrew Morton

On Mon, Aug 30, 2010 at 11:50:19AM +0100, Matt Fleming wrote:
> From: Yusuke Goda <yusuke.goda.sx@renesas.com>
> 
> Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
> mode if the hardware supports it.
> 
> Tested with the SDHI hardware block included in sh7724.

Ian, have you had a chance to test this yet?

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
                   ` (2 preceding siblings ...)
  2010-09-05 20:08 ` Matt Fleming
@ 2010-09-10 16:58 ` Samuel Ortiz
  2010-09-10 19:53   ` Matt Fleming
  2010-09-23 19:11 ` Ian Molton
  4 siblings, 1 reply; 9+ messages in thread
From: Samuel Ortiz @ 2010-09-10 16:58 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm,
	Arnd Hannemann, Ian Molton

Hi Matt,

On Mon, Aug 30, 2010 at 11:50:19AM +0100, Matt Fleming wrote:
> From: Yusuke Goda <yusuke.goda.sx@renesas.com>
> 
> Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
> mode if the hardware supports it.
> 
> Tested with the SDHI hardware block included in sh7724.
> 
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Matt Fleming <matt@console-pimps.org>
> ---
> 
> Andrew, I've added some code to Yusuke's original patch based on
> feedback from Ian Molton saying that the original change didn't work on
> his hardware. I'd really prefer some Tested-by's and Acked-by's before
> you take this patch just so we can make sure that everybody is happy and
> that everybody's hardware still works.
> 
> Magnus was worried that this patch would conflict with the SDHI/MMCIF
> hotplug patches from Arnd (particularly "[PATCH 1/4] tmio_mmc: Allow the
> mfd driver to specify get_cd handler") but I seem to be able to shuffle
> the patches around without any conflicts.
As I'm carrying Arnd patches through my MFD tree, I'm also taking this one.
I applied it while we're waiting for Ian to comment on it.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-09-10 16:58 ` Samuel Ortiz
@ 2010-09-10 19:53   ` Matt Fleming
  0 siblings, 0 replies; 9+ messages in thread
From: Matt Fleming @ 2010-09-10 19:53 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm,
	Arnd Hannemann, Ian Molton

On Fri, Sep 10, 2010 at 06:58:23PM +0200, Samuel Ortiz wrote:
>
> As I'm carrying Arnd patches through my MFD tree, I'm also taking this one.
> I applied it while we're waiting for Ian to comment on it.

Sounds good, thanks!

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
                   ` (3 preceding siblings ...)
  2010-09-10 16:58 ` Samuel Ortiz
@ 2010-09-23 19:11 ` Ian Molton
  2010-09-26 11:46   ` Matt Fleming
  4 siblings, 1 reply; 9+ messages in thread
From: Ian Molton @ 2010-09-23 19:11 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm,
	Arnd Hannemann, Samuel Ortiz

If its not already gone through...

Acked-by: Ian Molton <ian@mnementh.co.uk>

-- 
Ian Molton
Linux, Automotive, and other hacking:
http://www.mnementh.co.uk/



On 30 August 2010 11:50, Matt Fleming <matt@console-pimps.org> wrote:
> From: Yusuke Goda <yusuke.goda.sx@renesas.com>
>
> Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
> mode if the hardware supports it.
>
> Tested with the SDHI hardware block included in sh7724.
>
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Matt Fleming <matt@console-pimps.org>
> ---
>
> Andrew, I've added some code to Yusuke's original patch based on
> feedback from Ian Molton saying that the original change didn't work on
> his hardware. I'd really prefer some Tested-by's and Acked-by's before
> you take this patch just so we can make sure that everybody is happy and
> that everybody's hardware still works.
>
> Magnus was worried that this patch would conflict with the SDHI/MMCIF
> hotplug patches from Arnd (particularly "[PATCH 1/4] tmio_mmc: Allow the
> mfd driver to specify get_cd handler") but I seem to be able to shuffle
> the patches around without any conflicts.
>
>  drivers/mfd/sh_mobile_sdhi.c |    6 ++++++
>  drivers/mmc/host/tmio_mmc.c  |   17 ++++++++++++-----
>  include/linux/mfd/tmio.h     |    5 +++++
>  3 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c
> index 7c23630..9d43316 100644
> --- a/drivers/mfd/sh_mobile_sdhi.c
> +++ b/drivers/mfd/sh_mobile_sdhi.c
> @@ -125,6 +125,12 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev)
>                mmc_data->capabilities |= p->tmio_caps;
>        }
>
> +       /*
> +        * All SDHI blocks support 2-byte and larger block sizes in 4-bit
> +        * bus width mode.
> +        */
> +       mmc_data->flags |= TMIO_MMC_BLKSZ_2BYTES;
> +
>        if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
>                priv->param_tx.slave_id = p->dma_slave_tx;
>                priv->param_rx.slave_id = p->dma_slave_rx;
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index 1a47221..e7765a8 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -658,14 +658,21 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
>  static int tmio_mmc_start_data(struct tmio_mmc_host *host,
>        struct mmc_data *data)
>  {
> +       struct mfd_cell *cell = host->pdev->dev.platform_data;
> +       struct tmio_mmc_data *pdata = cell->driver_data;
> +
>        pr_debug("setup data transfer: blocksize %08x  nr_blocks %d\n",
>                 data->blksz, data->blocks);
>
> -       /* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */
> -       if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
> -               pr_err("%s: %d byte block unsupported in 4 bit mode\n",
> -                      mmc_hostname(host->mmc), data->blksz);
> -               return -EINVAL;
> +       /* Some hardware cannot perform 2 byte requests in 4 bit mode */
> +       if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
> +               int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;
> +
> +               if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {
> +                       pr_err("%s: %d byte block unsupported in 4 bit mode\n",
> +                              mmc_hostname(host->mmc), data->blksz);
> +                       return -EINVAL;
> +               }
>        }
>
>        tmio_mmc_init_sg(host, data);
> diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> index 24c43bb..085f041 100644
> --- a/include/linux/mfd/tmio.h
> +++ b/include/linux/mfd/tmio.h
> @@ -52,6 +52,11 @@
>
>  /* tmio MMC platform flags */
>  #define TMIO_MMC_WRPROTECT_DISABLE     (1 << 0)
> +/*
> + * Some controllers can support a 2-byte block size when the bus width
> + * is configured in 4-bit mode.
> + */
> +#define TMIO_MMC_BLKSZ_2BYTES          (1 << 1)
>
>  int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
>  int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
> --
> 1.7.1
>
>

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-09-23 19:11 ` Ian Molton
@ 2010-09-26 11:46   ` Matt Fleming
  2010-09-27  7:49     ` Samuel Ortiz
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Fleming @ 2010-09-26 11:46 UTC (permalink / raw)
  To: Ian Molton
  Cc: Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt, Magnus Damm,
	Arnd Hannemann, Samuel Ortiz

On Thu, Sep 23, 2010 at 08:11:26PM +0100, Ian Molton wrote:
> If its not already gone through...
> 
> Acked-by: Ian Molton <ian@mnementh.co.uk>

Cheers Ian.

I think Sam applied this patch but was waiting for your Acked-by.

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

* Re: [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode
  2010-09-26 11:46   ` Matt Fleming
@ 2010-09-27  7:49     ` Samuel Ortiz
  0 siblings, 0 replies; 9+ messages in thread
From: Samuel Ortiz @ 2010-09-27  7:49 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Ian Molton, Andrew Morton, linux-mmc, Yusuke Goda, Paul Mundt,
	Magnus Damm, Arnd Hannemann

On Sun, Sep 26, 2010 at 12:46:06PM +0100, Matt Fleming wrote:
> On Thu, Sep 23, 2010 at 08:11:26PM +0100, Ian Molton wrote:
> > If its not already gone through...
> > 
> > Acked-by: Ian Molton <ian@mnementh.co.uk>
> 
> Cheers Ian.
> 
> I think Sam applied this patch but was waiting for your Acked-by.
Correct. I'll add Ian's Acked-by, thanks Ian.

Cheers,
Samuel.


-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-09-27  7:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-30 10:50 [PATCH v2] tmio_mmc: Allow 2 byte requests in 4-bit mode Matt Fleming
2010-08-30 13:17 ` Arnd Hannemann
2010-08-31 10:51 ` Magnus Damm
2010-09-05 20:08 ` Matt Fleming
2010-09-10 16:58 ` Samuel Ortiz
2010-09-10 19:53   ` Matt Fleming
2010-09-23 19:11 ` Ian Molton
2010-09-26 11:46   ` Matt Fleming
2010-09-27  7:49     ` Samuel Ortiz

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.