From patchwork Fri Sep 24 03:43:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 203462 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 o8O3dXpT014272 for ; Fri, 24 Sep 2010 03:39:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754888Ab0IXDje (ORCPT ); Thu, 23 Sep 2010 23:39:34 -0400 Received: from db3ehsobe004.messaging.microsoft.com ([213.199.154.142]:4274 "EHLO DB3EHSOBE004.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753741Ab0IXDje (ORCPT ); Thu, 23 Sep 2010 23:39:34 -0400 Received: from mail39-db3-R.bigfish.com (10.3.81.244) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 8.1.436.0; Fri, 24 Sep 2010 03:39:32 +0000 Received: from mail39-db3 (localhost.localdomain [127.0.0.1]) by mail39-db3-R.bigfish.com (Postfix) with ESMTP id B2E43E83C6 for ; Fri, 24 Sep 2010 03:39:31 +0000 (UTC) X-SpamScore: -8 X-BigFish: VS-8(zzbb2cKea8Nzz1202hzz8275bh1497iz2dh2a8h87h2a8h87h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail39-db3 (localhost.localdomain [127.0.0.1]) by mail39-db3 (MessageSwitch) id 128529957172137_24952; Fri, 24 Sep 2010 03:39:31 +0000 (UTC) Received: from DB3EHSMHS006.bigfish.com (unknown [10.3.81.249]) by mail39-db3.bigfish.com (Postfix) with ESMTP id 094FB1C70053 for ; Fri, 24 Sep 2010 03:39:31 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by DB3EHSMHS006.bigfish.com (10.3.87.106) with Microsoft SMTP Server (TLS) id 14.0.482.44; Fri, 24 Sep 2010 03:39:30 +0000 Received: from de01smr01.freescale.net (de01smr01.freescale.net [10.208.0.31]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o8O3dSeW012702 for ; Thu, 23 Sep 2010 20:39:28 -0700 (MST) Received: from shlinux1.ap.freescale.net ([10.192.225.216]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o8O3ruxu001158 for ; Thu, 23 Sep 2010 22:53:57 -0500 (CDT) Received: by shlinux1.ap.freescale.net (Postfix, from userid 1003) id DA6264D6002; Fri, 24 Sep 2010 11:43:09 +0800 (CST) From: Richard Zhu To: w.sang@pengutronix.de, u.kleine-koenig@pengutronix.de, linux-mmc@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org, Richard Zhu Subject: [PATCH 1/4] sdhci-1: sdhci driver modifications when support FSL eSDHC Date: Fri, 24 Sep 2010 11:43:05 +0800 Message-ID: <1285299788-32209-2-git-send-email-r65037@freescale.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1285299788-32209-1-git-send-email-r65037@freescale.com> References: <1285299788-32209-1-git-send-email-r65037@freescale.com> MIME-Version: 1.0 X-Reverse-DNS: az33egw02.freescale.net 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, 24 Sep 2010 03:39:35 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index e045e3c..202a6bf 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -54,12 +54,24 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) { struct sdhci_pltfm_data *pdata = pdev->dev.platform_data; const struct platform_device_id *platid = platform_get_device_id(pdev); + struct sdhci_pltfm_data *dpdata = (void *)platid->driver_data; struct sdhci_host *host; + struct sdhci_pltfm_host *pltfm_host; struct resource *iomem; int ret; if (!pdata && platid && platid->driver_data) pdata = (void *)platid->driver_data; + else { + if (!pdata->ops) + pdata->ops = dpdata->ops; + if (pdata->quirks == 0) + pdata->quirks = dpdata->quirks; + if (!pdata->init) + pdata->init = dpdata->init; + if (!pdata->exit) + pdata->exit= dpdata->exit; + } iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!iomem) { @@ -72,15 +84,20 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) "experience problems.\n"); if (pdev->dev.parent) - host = sdhci_alloc_host(pdev->dev.parent, 0); + host = sdhci_alloc_host(pdev->dev.parent, + sizeof(struct sdhci_pltfm_host)); else - host = sdhci_alloc_host(&pdev->dev, 0); + host = sdhci_alloc_host(&pdev->dev, + sizeof(struct sdhci_pltfm_host)); if (IS_ERR(host)) { ret = PTR_ERR(host); goto err; } + pltfm_host = sdhci_priv(host); + pltfm_host->wp_gpio = pdata->wp_gpio; + host->hw_name = "platform"; if (pdata && pdata->ops) host->ops = pdata->ops; @@ -161,6 +178,9 @@ static const struct platform_device_id sdhci_pltfm_ids[] = { #ifdef CONFIG_MMC_SDHCI_CNS3XXX { "sdhci-cns3xxx", (kernel_ulong_t)&sdhci_cns3xxx_pdata }, #endif +#ifdef CONFIG_MMC_SDHCI_IMX + { "imx-sdhci", (kernel_ulong_t)&sdhci_imx_pdata }, +#endif { }, }; MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids); diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h index 900f329..2df8cac 100644 --- a/drivers/mmc/host/sdhci-pltfm.h +++ b/drivers/mmc/host/sdhci-pltfm.h @@ -13,6 +13,13 @@ #include +struct sdhci_pltfm_host { + struct clk *clk; + u32 scratchpad; /* to handle quirks across io-accessor calls */ + u32 wp_gpio; /* GPIO pin number that used as the Write Protect */ +}; + extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata; +extern struct sdhci_pltfm_data sdhci_imx_pdata; #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */ diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 7855121..10e5931 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1208,6 +1208,9 @@ static int sdhci_get_ro(struct mmc_host *mmc) host = mmc_priv(mmc); + if (host->ops->get_ro) + return host->ops->get_ro(host); + spin_lock_irqsave(&host->lock, flags); if (host->flags & SDHCI_DEVICE_DEAD) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 036cfae..e765cc6 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -321,6 +321,7 @@ struct sdhci_ops { unsigned int (*get_max_clock)(struct sdhci_host *host); unsigned int (*get_min_clock)(struct sdhci_host *host); unsigned int (*get_timeout_clock)(struct sdhci_host *host); + unsigned int (*get_ro)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h index 0239bd7..da83e76 100644 --- a/include/linux/sdhci-pltfm.h +++ b/include/linux/sdhci-pltfm.h @@ -30,6 +30,8 @@ struct sdhci_pltfm_data { unsigned int quirks; int (*init)(struct sdhci_host *host); void (*exit)(struct sdhci_host *host); + unsigned int wp_gpio; /* GPIO pin num that used as the Write Protect */ + unsigned int caps; /* Board specified max bus width */ }; #endif /* _SDHCI_PLTFM_H */