MMC: Add 8-bit bus width support
Subsystems (2)
Hi Pierre
Here is a patch which adds 8-bit bus width suport to the mmc driver common part.
I've tested it with a test board with 8-bit eMMC device on Omap 3420 HSMMC controller. It speeds up DMA transfer from host to the card and most of the time is spent in busy polling for the card to become ready.
Regards
Jarkko Lavinen
Quoted 1 line
From
d038f6ebe177f3f4ae2ae1f8a9dfc648e5625909Mon Sep 17 00:00:00 2001
From: Jarkko Lavinen <[email protected]>
Date: Mon, 17 Nov 2008 14:30:17 +0200
Subject: [PATCH] MMC: Add 8-bit bus width support
--- drivers/mmc/core/mmc.c | 18 ++++++++++++++---- include/linux/mmc/host.h | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc.c +14 -4
@@ -434,13 +434,24 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,* Activate wide bus (if supported). */ if ((card->csd.mmca_vsn >=CSD_SPEC_VER_4 ) && - (host->caps &MMC_CAP_4_BIT_DATA )) { + (host->caps & (MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA ))) { +unsigned ext_csd_bit, bus_width; + +if (host->caps &MMC_CAP_8_BIT_DATA ) { + ext_csd_bit =EXT_CSD_BUS_WIDTH_8 ; + bus_width =MMC_BUS_WIDTH_8 ; + }else { + ext_csd_bit =EXT_CSD_BUS_WIDTH_4 ; + bus_width =MMC_BUS_WIDTH_4 ; + } + err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_BUS_WIDTH ,EXT_CSD_BUS_WIDTH_4 ); +EXT_CSD_BUS_WIDTH , ext_csd_bit); +if (err) goto free_card; -mmc_set_bus_width (card->host,MMC_BUS_WIDTH_4 ); +mmc_set_bus_width (card->host, bus_width); }if (!oldcard)
@@ -624,4 +635,3 @@ err:return err; } -
include/linux/mmc/host.h +2 -0
@@ -41,6 +41,7 @@ struct mmc_ios {#define MMC_BUS_WIDTH_1 0#define MMC_BUS_WIDTH_4 2 +#define MMC_BUS_WIDTH_8 3unsigned char timing;/* timing specification used */
@@ -116,6 +117,7 @@ struct mmc_host {#define MMC_CAP_SDIO_IRQ (1 << 3)/* Can signal pending SDIO IRQs */ #define MMC_CAP_SPI (1 << 4)/* Talks only SPI protocols */ #define MMC_CAP_NEEDS_POLL (1 << 5)/* Needs polling for card-detection */ +#define MMC_CAP_8_BIT_DATA (1 << 6)/* Can the host do 8 bit transfers */ /* host specific block data */ unsigned int max_seg_size;/* see blk_queue_max_segment_size */
Signature · 1 line
1.5.6.5
Quoted 9 lines · Jarkko Lavinen
Hi Pierre
Here is a patch which adds 8-bit bus width suport to the mmc driver common part.
I've tested it with a test board with 8-bit eMMC device on Omap 3420 HSMMC controller. It speeds up DMA transfer from host to the card and most of the time is spent in busy polling for the card to become ready.
I'll try and give this a test on the S3C6410, which has the option of having channel 1 being 8bit. Any idea of cards that support 8bit?
Quoted 79 lines
Regards
Jarkko LavinenQuoted 1 line
From
d038f6ebe177f3f4ae2ae1f8a9dfc648e5625909Mon Sep 17 00:00:00 2001From: Jarkko Lavinen <[email protected]>
Date: Mon, 17 Nov 2008 14:30:17 +0200
Subject: [PATCH] MMC: Add 8-bit bus width supportSigned-off-by Jarkko Lavinen <[email protected]>--- drivers/mmc/core/mmc.c | 18 ++++++++++++++---- include/linux/mmc/host.h | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-)drivers/mmc/core/mmc.c +14
-4@@ -434,13 +434,24 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,* Activate wide bus (if supported). */ if ((card->csd.mmca_vsn >=CSD_SPEC_VER_4 ) && - (host->caps &MMC_CAP_4_BIT_DATA )) { + (host->caps & (MMC_CAP_4_BIT_DATA |MMC_CAP_8_BIT_DATA ))) { +unsigned ext_csd_bit, bus_width; + +if (host->caps &MMC_CAP_8_BIT_DATA ) { + ext_csd_bit =EXT_CSD_BUS_WIDTH_8 ; + bus_width =MMC_BUS_WIDTH_8 ; + }else { + ext_csd_bit =EXT_CSD_BUS_WIDTH_4 ; + bus_width =MMC_BUS_WIDTH_4 ; + } + err =mmc_switch (card,EXT_CSD_CMD_SET_NORMAL , -EXT_CSD_BUS_WIDTH ,EXT_CSD_BUS_WIDTH_4 ); +EXT_CSD_BUS_WIDTH , ext_csd_bit); +if (err) goto free_card; -mmc_set_bus_width (card->host,MMC_BUS_WIDTH_4 ); +mmc_set_bus_width (card->host, bus_width); }if (!oldcard)@@ -624,4 +635,3 @@ err:return err; } -include/linux/mmc/host.h +2
-0@@ -41,6 +41,7 @@ struct mmc_ios {#define MMC_BUS_WIDTH_1 0#define MMC_BUS_WIDTH_4 2 +#define MMC_BUS_WIDTH_8 3unsigned char timing;/* timing specification used */ @@ -116,6 +117,7 @@ struct mmc_host {#define MMC_CAP_SDIO_IRQ (1 << 3)/* Can signal pending SDIO IRQs */ #define MMC_CAP_SPI (1 << 4)/* Talks only SPI protocols */ #define MMC_CAP_NEEDS_POLL (1 << 5)/* Needs polling for card-detection */ +#define MMC_CAP_8_BIT_DATA (1 << 6)/* Can the host do 8 bit transfers */ /* host specific block data */ unsigned int max_seg_size;/* see blk_queue_max_segment_size */ Signature · 7 lines
1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/) 'a smiley only costs 4 bytes'
Quoted 2 lines · ext Ben Dooks
I'll try and give this a test on the S3C6410, which has the option of having channel 1 being 8bit. Any idea of cards that support 8bit?
Hi Ben
Below is sample for HSMMC driver which tells the mmc driver the host has 8-bit capability and enables it when told to.
The test board has an eMMC chip with 8 data lines connected to HSMMC controller. I am not aware of mmc cards having 8 pins yet.
Jarkko
Quoted 1 line
From
8318b7e7fd9a163b1fccf397a1b040d1a4e18d97Mon Sep 17 00:00:00 2001
From: Jarkko Lavinen <[email protected]>
Date: Mon, 17 Nov 2008 21:05:31 +0200
Subject: [PATCH] OMAP: HSMMC: Add 8-bit bus width mode support
--- drivers/mmc/host/omap_hsmmc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/mmc/host/omap_hsmmc.c +10 -0
@@ -75,6 +75,7 @@#define MSBS (1 << 5)#define BCE (1 << 1)#define FOUR_BIT (1 << 1) +#define DW8 (1 << 5)#define CC 0x1#define TC 0x02#define OD 0x1
@@ -753,6 +754,7 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)u16 dsor =0 ;unsigned long regval;unsigned long timeout; +u32 con;switch (ios->power_mode) {case MMC_POWER_OFF :
@@ -763,12 +765,18 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)break ; } + con =OMAP_HSMMC_READ (host->base,CON );switch (mmc->ios.bus_width) { +case MMC_BUS_WIDTH_8 : +OMAP_HSMMC_WRITE (host->base,CON , con |DW8 ); +break ;case MMC_BUS_WIDTH_4 : +OMAP_HSMMC_WRITE (host->base,CON , con & ~DW8 );OMAP_HSMMC_WRITE (host->base,HCTL ,OMAP_HSMMC_READ (host->base,HCTL ) |FOUR_BIT );break ;case MMC_BUS_WIDTH_1 : +OMAP_HSMMC_WRITE (host->base,CON , con & ~DW8 );OMAP_HSMMC_WRITE (host->base,HCTL ,OMAP_HSMMC_READ (host->base,HCTL ) & ~FOUR_BIT );break ;
@@ -965,6 +973,8 @@ static int __init omap_mmc_probe(struct platform_device *pdev)if (pdata->slots[host->slot_id].wires >=4 ) mmc->caps |=MMC_CAP_4_BIT_DATA ; +if (pdata->slots[host->slot_id].wires >=8 ) + mmc->caps |=MMC_CAP_8_BIT_DATA ;/* Only MMC1 supports 3.0V */ if (host->id ==OMAP_MMC1_DEVID ) {
Signature · 1 line
1.5.6.5
Quoted 10 lines · On Mon, 17 Nov 2008 14:35:21 +0200 Jarkko Lavinen <[email protected]>…
Hi Pierre
Here is a patch which adds 8-bit bus width suport to the mmc driver common part.
I've tested it with a test board with 8-bit eMMC device on Omap 3420 HSMMC controller. It speeds up DMA transfer from host to the card and most of the time is spent in busy polling for the card to become ready.
Patch looks ok. I'll see if I can do some testing here. Not sure my MMC cards are fast enough to notice any difference though...
Rgds
Signature · 6 lines
-- Pierre Ossman WARNING: This correspondence is being monitored by the Swedish government. Make sure your server uses encryption for SMTP traffic and consider using PGP for end-to-end encryption.