From patchwork Fri Oct 8 19:32:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Rakity X-Patchwork-Id: 242241 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o98JVvDo023622 for ; Fri, 8 Oct 2010 19:33:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212Ab0JHTdR (ORCPT ); Fri, 8 Oct 2010 15:33:17 -0400 Received: from na3sys009aog108.obsmtp.com ([74.125.149.199]:58753 "HELO na3sys009aog108.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754162Ab0JHTdQ convert rfc822-to-8bit (ORCPT ); Fri, 8 Oct 2010 15:33:16 -0400 Received: from source ([65.219.4.129]) (using TLSv1) by na3sys009aob108.postini.com ([74.125.148.12]) with SMTP ID DSNKTK9x/JU72d+lL/czdB83Kk1TvLJL1alU@postini.com; Fri, 08 Oct 2010 12:33:16 PDT Received: from SC-vEXCH3.marvell.com ([10.93.76.133]) by SC-OWA01.marvell.com ([10.93.76.21]) with mapi; Fri, 8 Oct 2010 12:32:16 -0700 From: Philip Rakity To: "linux-mmc@vger.kernel.org" Date: Fri, 8 Oct 2010 12:32:15 -0700 Subject: [PATCH] sdhci: add support for non v3 controllers to support 8 bit data Thread-Topic: [PATCH] sdhci: add support for non v3 controllers to support 8 bit data Thread-Index: ActnH4PCB7lhDDPjSAGD7ZCocuOWug== Message-ID: <8DF87361-9A12-4678-8661-06C55CFB574C@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 08 Oct 2010 19:33:18 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 90cfdfb..21b4ff9 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1188,29 +1188,30 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (host->ops->platform_send_init_74_clocks) host->ops->platform_send_init_74_clocks(host, ios->power_mode); - ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); - if (ios->bus_width == MMC_BUS_WIDTH_8) { - ctrl &= ~SDHCI_CTRL_4BITBUS; - if (host->version >= SDHCI_SPEC_300) - ctrl |= SDHCI_CTRL_8BITBUS; - } else { - if (host->version >= SDHCI_SPEC_300) - ctrl &= ~SDHCI_CTRL_8BITBUS; - if (ios->bus_width == MMC_BUS_WIDTH_4) - ctrl |= SDHCI_CTRL_4BITBUS; - else + /* + * use platform_8_bit_width if not v3 controller + * or if special hw/board specific processing is needed + */ + if (host->ops->platform_8_bit_width) + host->ops->platform_8_bit_width(host, ios->bus_width); + else { + ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); + if (ios->bus_width == MMC_BUS_WIDTH_8) { ctrl &= ~SDHCI_CTRL_4BITBUS; + if (host->version >= SDHCI_SPEC_300) + ctrl |= SDHCI_CTRL_8BITBUS; + } else { + if (host->version >= SDHCI_SPEC_300) + ctrl &= ~SDHCI_CTRL_8BITBUS; + if (ios->bus_width == MMC_BUS_WIDTH_4) + ctrl |= SDHCI_CTRL_4BITBUS; + else + ctrl &= ~SDHCI_CTRL_4BITBUS; + } + sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); } - if (ios->bus_width == MMC_BUS_WIDTH_8) - ctrl |= SDHCI_CTRL_8BITBUS; - else - ctrl &= ~SDHCI_CTRL_8BITBUS; - - if (ios->bus_width == MMC_BUS_WIDTH_4) - ctrl |= SDHCI_CTRL_4BITBUS; - else - ctrl &= ~SDHCI_CTRL_4BITBUS; + ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); if ((ios->timing == MMC_TIMING_SD_HS || ios->timing == MMC_TIMING_MMC_HS) @@ -1857,6 +1858,7 @@ int sdhci_add_host(struct sdhci_host *host) mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; else mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; + mmc->f_max = host->max_clk; mmc->caps |= MMC_CAP_SDIO_IRQ; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c87e3c4..ae30f7d 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -215,6 +215,8 @@ struct sdhci_ops { unsigned int (*get_timeout_clock)(struct sdhci_host *host); void (*platform_send_init_74_clocks)(struct sdhci_host *host, u8 power_mode); + void (*platform_8_bit_width)(struct sdhci_host *host, + int width); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS