From patchwork Wed May 25 11:01:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 815722 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4PB1blF028178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 25 May 2011 11:01:58 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPBol-0001jS-JG; Wed, 25 May 2011 10:59:59 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPBok-0000vo-2b; Wed, 25 May 2011 10:59:58 +0000 Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14] helo=TX2EHSOBE007.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QPBog-0000vW-82 for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2011 10:59:55 +0000 Received: from mail103-tx2-R.bigfish.com (10.9.14.247) by TX2EHSOBE007.bigfish.com (10.9.40.27) with Microsoft SMTP Server id 14.1.225.22; Wed, 25 May 2011 10:59:52 +0000 Received: from mail103-tx2 (localhost.localdomain [127.0.0.1]) by mail103-tx2-R.bigfish.com (Postfix) with ESMTP id AF3171240C05; Wed, 25 May 2011 10:59:52 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bh8275dhz2dh87h2a8h668h839h66h) X-Spam-TCS-SCL: 5:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-DOMAIN-IP-MATCH: fail Received: from mail103-tx2 (localhost.localdomain [127.0.0.1]) by mail103-tx2 (MessageSwitch) id 1306321172448511_30293; Wed, 25 May 2011 10:59:32 +0000 (UTC) Received: from TX2EHSMHS047.bigfish.com (unknown [10.9.14.252]) by mail103-tx2.bigfish.com (Postfix) with ESMTP id 25E3913200D1; Wed, 25 May 2011 10:57:49 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS047.bigfish.com (10.9.99.147) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 25 May 2011 10:57:46 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Wed, 25 May 2011 05:57:45 -0500 Received: from S2100-06.ap.freescale.net (S2100-06.ap.freescale.net [10.192.242.125]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p4PAvTws020863; Wed, 25 May 2011 05:57:41 -0500 (CDT) From: Shawn Guo To: Subject: [PATCH v3 2/4] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data Date: Wed, 25 May 2011 19:01:52 +0800 Message-ID: <1306321314-2493-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306321314-2493-1-git-send-email-shawn.guo@linaro.org> References: <1306321314-2493-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110525_065954_508977_7BDA632D X-CRM114-Status: GOOD ( 23.22 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [65.55.88.14 listed in list.dnswl.org] Cc: Shawn Guo , sameo@linux.intel.com, Arnd Bergmann , patches@linaro.org, devicetree-discuss@lists.ozlabs.org, Anton Vorontsov , Saeed Bishara , Wolfram Sang , Grant Likely , Xiaobo Xie , kernel@pengutronix.de, Mike Rapoport , Olof Johansson , Chris Ball , linuxppc-dev@lists.ozlabs.org, Albert Herranz , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 25 May 2011 11:01:58 +0000 (UTC) The patch migrates the use of sdhci_of_host and sdhci_of_data to sdhci_pltfm_host and sdhci_pltfm_data, so that the former pair can be eliminated. Signed-off-by: Shawn Guo Reviewed-by: Grant Likely Reviewed-by: Wolfram Sang Acked-by: Anton Vorontsov --- drivers/mmc/host/sdhci-of-core.c | 31 ++++++++++++++++--------------- drivers/mmc/host/sdhci-of-esdhc.c | 36 +++++++++++++++++++----------------- drivers/mmc/host/sdhci-of-hlwd.c | 20 +++++++++++--------- drivers/mmc/host/sdhci-of.h | 15 +++------------ drivers/mmc/host/sdhci-pltfm.h | 4 ++++ 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index f9b611f..bca7062 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c @@ -59,7 +59,7 @@ void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg) void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg) { - struct sdhci_of_host *of_host = sdhci_priv(host); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); int base = reg & ~0x3; int shift = (reg & 0x2) * 8; @@ -69,10 +69,11 @@ void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg) * Postpone this write, we must do it together with a * command write that is down below. */ - of_host->xfer_mode_shadow = val; + pltfm_host->xfer_mode_shadow = val; return; case SDHCI_COMMAND: - sdhci_be32bs_writel(host, val << 16 | of_host->xfer_mode_shadow, + sdhci_be32bs_writel(host, + val << 16 | pltfm_host->xfer_mode_shadow, SDHCI_TRANSFER_MODE); return; } @@ -127,7 +128,7 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np) static int __devinit sdhci_of_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; - struct sdhci_of_data *sdhci_of_data; + struct sdhci_pltfm_data *pdata; struct sdhci_host *host; struct sdhci_of_host *of_host; const __be32 *clk; @@ -136,16 +137,16 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) if (!ofdev->dev.of_match) return -EINVAL; - sdhci_of_data = ofdev->dev.of_match->data; + pdata = ofdev->dev.of_match->data; if (!of_device_is_available(np)) return -ENODEV; - host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host)); + host = sdhci_alloc_host(&ofdev->dev, sizeof(*pltfm_host)); if (IS_ERR(host)) return -ENOMEM; - of_host = sdhci_priv(host); + pltfm_host = sdhci_priv(host); dev_set_drvdata(&ofdev->dev, host); host->ioaddr = of_iomap(np, 0); @@ -161,9 +162,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) } host->hw_name = dev_name(&ofdev->dev); - if (sdhci_of_data) { - host->quirks = sdhci_of_data->quirks; - host->ops = &sdhci_of_data->ops; + if (pdata) { + host->quirks = pdata->quirks; + host->ops = &pdata->ops; } if (of_get_property(np, "sdhci,auto-cmd12", NULL)) @@ -178,7 +179,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) clk = of_get_property(np, "clock-frequency", &size); if (clk && size == sizeof(*clk) && *clk) - of_host->clock = be32_to_cpup(clk); + pltfm_host->clock = be32_to_cpup(clk); ret = sdhci_add_host(host); if (ret) @@ -208,12 +209,12 @@ static int __devexit sdhci_of_remove(struct platform_device *ofdev) static const struct of_device_id sdhci_of_match[] = { #ifdef CONFIG_MMC_SDHCI_OF_ESDHC - { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc, }, - { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc, }, - { .compatible = "fsl,esdhc", .data = &sdhci_esdhc, }, + { .compatible = "fsl,mpc8379-esdhc", .data = &sdhci_esdhc_pdata, }, + { .compatible = "fsl,mpc8536-esdhc", .data = &sdhci_esdhc_pdata, }, + { .compatible = "fsl,esdhc", .data = &sdhci_esdhc_pdata, }, #endif #ifdef CONFIG_MMC_SDHCI_OF_HLWD - { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd, }, + { .compatible = "nintendo,hollywood-sdhci", .data = &sdhci_hlwd_pdata, }, #endif { .compatible = "generic-sdhci", }, {}, diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index ba40d6d..492bcd7 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -60,32 +60,34 @@ static int esdhc_of_enable_dma(struct sdhci_host *host) static unsigned int esdhc_of_get_max_clock(struct sdhci_host *host) { - struct sdhci_of_host *of_host = sdhci_priv(host); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - return of_host->clock; + return pltfm_host->clock; } static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) { - struct sdhci_of_host *of_host = sdhci_priv(host); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - return of_host->clock / 256 / 16; + return pltfm_host->clock / 256 / 16; } -struct sdhci_of_data sdhci_esdhc = { +static struct sdhci_ops sdhci_esdhc_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = esdhc_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_be32bs_writel, + .write_w = esdhc_writew, + .write_b = esdhc_writeb, + .set_clock = esdhc_set_clock, + .enable_dma = esdhc_of_enable_dma, + .get_max_clock = esdhc_of_get_max_clock, + .get_min_clock = esdhc_of_get_min_clock, +}; + +struct sdhci_pltfm_data sdhci_esdhc_pdata = { /* card detection could be handled via GPIO */ .quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION | SDHCI_QUIRK_NO_CARD_NO_RESET, - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = esdhc_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_be32bs_writel, - .write_w = esdhc_writew, - .write_b = esdhc_writeb, - .set_clock = esdhc_set_clock, - .enable_dma = esdhc_of_enable_dma, - .get_max_clock = esdhc_of_get_max_clock, - .get_min_clock = esdhc_of_get_min_clock, - }, + .ops = &sdhci_esdhc_ops, }; diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c index 68ddb75..380e896 100644 --- a/drivers/mmc/host/sdhci-of-hlwd.c +++ b/drivers/mmc/host/sdhci-of-hlwd.c @@ -51,15 +51,17 @@ static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg) udelay(SDHCI_HLWD_WRITE_DELAY); } -struct sdhci_of_data sdhci_hlwd = { +static struct sdhci_ops sdhci_hlwd_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = sdhci_be32bs_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_hlwd_writel, + .write_w = sdhci_hlwd_writew, + .write_b = sdhci_hlwd_writeb, +}; + +struct sdhci_pltfm_data sdhci_hlwd_pdata = { .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | SDHCI_QUIRK_32BIT_DMA_SIZE, - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = sdhci_be32bs_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_hlwd_writel, - .write_w = sdhci_hlwd_writew, - .write_b = sdhci_hlwd_writeb, - }, + .ops = &sdhci_hlwd_ops, }; diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h index ad09ad9..5bdb5e7 100644 --- a/drivers/mmc/host/sdhci-of.h +++ b/drivers/mmc/host/sdhci-of.h @@ -18,16 +18,7 @@ #include #include "sdhci.h" - -struct sdhci_of_data { - unsigned int quirks; - struct sdhci_ops ops; -}; - -struct sdhci_of_host { - unsigned int clock; - u16 xfer_mode_shadow; -}; +#include "sdhci-pltfm.h" extern u32 sdhci_be32bs_readl(struct sdhci_host *host, int reg); extern u16 sdhci_be32bs_readw(struct sdhci_host *host, int reg); @@ -36,7 +27,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg); extern void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg); extern void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg); -extern struct sdhci_of_data sdhci_esdhc; -extern struct sdhci_of_data sdhci_hlwd; +extern struct sdhci_pltfm_data sdhci_esdhc_pdata; +extern struct sdhci_pltfm_data sdhci_hlwd_pdata; #endif /* __SDHCI_OF_H */ diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h index ff4b7eb..3cac450 100644 --- a/drivers/mmc/host/sdhci-pltfm.h +++ b/drivers/mmc/host/sdhci-pltfm.h @@ -19,6 +19,10 @@ struct sdhci_pltfm_host { struct clk *clk; void *priv; /* to handle quirks across io-accessor calls */ + + /* migrate from sdhci_of_host */ + unsigned int clock; + u16 xfer_mode_shadow; }; extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,