From: Tony Lindgren <tony@atomide.com>
To: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Madhusudhan Chikkature <madhu.cr@ti.com>,
linux-omap@vger.kernel.org
Subject: Re: [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data
Date: Thu, 11 Sep 2008 12:53:37 -0700 [thread overview]
Message-ID: <20080911195335.GN21163@atomide.com> (raw)
In-Reply-To: <20080911112315.GA10002@angel.research.nokia.com>
* Jarkko Lavinen <jarkko.lavinen@nokia.com> [080911 04:23]:
> On Thu, Sep 11, 2008 at 09:48:28AM +0100, ext Russell King - ARM Linux wrote:
> > So, given my update for this, shouldn't this be something sent almost
> > immediately to me so stuff for mainline isn't falling behind.
>
> Hi Russell and all
>
> Here is a hopefully self-explaining patch, which enables 8-bit
> support similar to the 4-bit support in Omap HSMMC when then mmc
> confifuration from platform data tells it is available.
>
> I have tested it on a testboard with 2.6.26 beased kernel and
> write speed increased some 30..40%.
>
> Cheers,
> Jarkko
>
> ---
>
> From f739457703988da18a5509bd297c4f6ebed83291 Mon Sep 17 00:00:00 2001
> From: Jarkko Lavinen <jarkko.lavinen@nokia.com>
> Date: Thu, 11 Sep 2008 14:15:31 +0300
> Subject: [PATCH] HSMMC: Enable 8-bit transfer when available.
>
> Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
> ---
> arch/arm/plat-omap/devices.c | 8 ++++++--
> arch/arm/plat-omap/include/mach/board.h | 4 +++-
> drivers/mmc/core/mmc.c | 17 +++++++++++++----
> drivers/mmc/host/omap_hsmmc.c | 10 ++++++++++
> include/linux/mmc/host.h | 12 +++++++-----
> 5 files changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
> index 3bd1da2..aa1299f 100644
> --- a/arch/arm/plat-omap/devices.c
> +++ b/arch/arm/plat-omap/devices.c
> @@ -289,13 +289,17 @@ static void __init omap_init_mmc(void)
> mmc = &mmc_conf->mmc[0];
>
> if (cpu_is_omap2430() || cpu_is_omap34xx()) {
> - if (mmc->enabled)
> + if (mmc->enabled) {
> + mmc1_data.conf = *mmc;
> (void) platform_device_register(&mmc_omap_device1);
> + }
>
> #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
> mmc = &mmc_conf->mmc[1];
> - if (mmc->enabled)
> + if (mmc->enabled) {
> + mmc2_data.conf = *mmc;
> (void) platform_device_register(&mmc_omap_device2);
> + }
> #endif
>
> return;
I'm about to get rid of the old mmc_conf and use only
omap_mmc_platform_data. So this will need to be modified a bit
as soon as I'm done.
Regards,
Tony
> diff --git a/arch/arm/plat-omap/include/mach/board.h b/arch/arm/plat-omap/include/mach/board.h
> index a1a66ac..cd287dd 100644
> --- a/arch/arm/plat-omap/include/mach/board.h
> +++ b/arch/arm/plat-omap/include/mach/board.h
> @@ -46,8 +46,10 @@ struct omap_mmc_conf {
> unsigned nomux:1;
> /* switch pin can be for card detect (default) or card cover */
> unsigned cover:1;
> - /* 4 wire signaling is optional, and is only used for SD/SDIO */
> + /* 4 and 8 wire signaling are optional */
> unsigned wire4:1;
> + unsigned wire8:1;
> +
> /* use the internal clock */
> unsigned internal_clock:1;
> s16 power_pin;
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index fdd7c76..8c55df3 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -434,13 +434,23 @@ 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, driver_width;
> +
> + if (host->caps & MMC_CAP_8_BIT_DATA) {
> + ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
> + driver_width = MMC_BUS_WIDTH_8;
> + } else {
> + ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
> + driver_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, driver_width);
> }
>
> if (!oldcard)
> @@ -624,4 +634,3 @@ err:
>
> return err;
> }
> -
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index af34871..92ad67e 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -72,6 +72,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
> @@ -631,6 +632,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:
> @@ -641,12 +643,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;
> @@ -814,6 +822,8 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
>
> if (pdata->conf.wire4)
> mmc->caps |= MMC_CAP_4_BIT_DATA;
> + if (pdata->conf.wire8)
> + mmc->caps |= MMC_CAP_8_BIT_DATA;
>
> /* Only MMC1 supports 3.0V */
> if (host->id == OMAP_MMC1_DEVID) {
> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 9c288c9..ddd8b97 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -41,6 +41,7 @@ struct mmc_ios {
>
> #define MMC_BUS_WIDTH_1 0
> #define MMC_BUS_WIDTH_4 2
> +#define MMC_BUS_WIDTH_8 3
>
> unsigned char timing; /* timing specification used */
>
> @@ -111,11 +112,12 @@ struct mmc_host {
> unsigned long caps; /* Host capabilities */
>
> #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
> -#define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
> -#define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
> -#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 << 1) /* Can the host do 8 bit transfers */
> +#define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */
> +#define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */
> +#define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */
> +#define MMC_CAP_SPI (1 << 5) /* Talks only SPI protocols */
> +#define MMC_CAP_NEEDS_POLL (1 << 6) /* Needs polling for card-detection */
>
> /* host specific block data */
> unsigned int max_seg_size; /* see blk_queue_max_segment_size */
> --
> 1.5.6.5
>
next prev parent reply other threads:[~2008-09-11 19:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 6:13 [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data Madhusudhan Chikkature
2008-09-10 23:56 ` Tony Lindgren
2008-09-11 8:48 ` Russell King - ARM Linux
2008-09-11 9:13 ` Russell King - ARM Linux
2008-09-11 17:33 ` Tony Lindgren
2008-09-11 18:13 ` Russell King - ARM Linux
2008-09-11 21:18 ` Steve Sakoman
2008-09-12 8:04 ` Felipe Balbi
2008-09-12 0:48 ` [PATCH] ARM: OMAP: Clean-up MMC device init (Was: [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data) Tony Lindgren
2008-09-13 9:59 ` Russell King - ARM Linux
2008-09-13 17:11 ` Tony Lindgren
2008-09-16 23:13 ` Tony Lindgren
2008-09-17 1:52 ` Tony Lindgren
2008-09-17 7:57 ` Russell King - ARM Linux
2008-09-24 9:02 ` Tony Lindgren
2008-09-11 11:23 ` [PATCH]Enable 4-bit in HSMMC1 and HSMMC2 platform data Jarkko Lavinen
2008-09-11 11:35 ` Felipe Balbi
2008-09-20 10:02 ` Pierre Ossman
2008-09-11 19:53 ` Tony Lindgren [this message]
2008-09-12 12:32 ` Madhusudhan Chikkature
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=20080911195335.GN21163@atomide.com \
--to=tony@atomide.com \
--cc=jarkko.lavinen@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=madhu.cr@ti.com \
/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 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.