From patchwork Wed Jul 6 16:47:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 950132 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p66GfqAw027795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 6 Jul 2011 16:42:13 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QeVAV-0003To-Jy; Wed, 06 Jul 2011 16:41:43 +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 1QeVAV-0003IJ-6P; Wed, 06 Jul 2011 16:41:43 +0000 Received: from db3ehsobe005.messaging.microsoft.com ([213.199.154.143] helo=DB3EHSOBE005.bigfish.com) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QeVAQ-0003Hh-Pi for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2011 16:41:40 +0000 Received: from mail54-db3-R.bigfish.com (10.3.81.245) by DB3EHSOBE005.bigfish.com (10.3.84.25) with Microsoft SMTP Server id 14.1.225.22; Wed, 6 Jul 2011 16:41:32 +0000 Received: from mail54-db3 (localhost.localdomain [127.0.0.1]) by mail54-db3-R.bigfish.com (Postfix) with ESMTP id DDA17B829C; Wed, 6 Jul 2011 16:41:32 +0000 (UTC) X-SpamScore: -5 X-BigFish: VS-5(z78cMzzz1202hzz8275bh8275dhz2dh87h2a8h668h839h62h) X-Spam-TCS-SCL: 1: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 mail54-db3 (localhost.localdomain [127.0.0.1]) by mail54-db3 (MessageSwitch) id 1309970492535890_10435; Wed, 6 Jul 2011 16:41:32 +0000 (UTC) Received: from DB3EHSMHS013.bigfish.com (unknown [10.3.81.246]) by mail54-db3.bigfish.com (Postfix) with ESMTP id 7DCF2630056; Wed, 6 Jul 2011 16:41:32 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS013.bigfish.com (10.3.87.113) with Microsoft SMTP Server (TLS) id 14.1.225.22; Wed, 6 Jul 2011 16:41:29 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.289.8; Wed, 6 Jul 2011 11:41:27 -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 p66GfLGu027675; Wed, 6 Jul 2011 11:41:24 -0500 (CDT) From: Shawn Guo To: Subject: [PATCH v3 1/4] mmc: sdhci-esdhc-imx: do not reference platform data after probe Date: Thu, 7 Jul 2011 00:47:47 +0800 Message-ID: <1309970870-13336-2-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1309970870-13336-1-git-send-email-shawn.guo@linaro.org> References: <1309970870-13336-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-20110706_124139_111047_57D7F798 X-CRM114-Status: GOOD ( 16.70 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [213.199.154.143 listed in list.dnswl.org] Cc: Chris Ball , patches@linaro.org, devicetree-discuss@lists.ozlabs.org, Wolfram Sang , Troy Kisky , Grant Likely , Shawn Guo , 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, 06 Jul 2011 16:42:13 +0000 (UTC) The patch copies platform data into pltfm_imx_data and reference the data there than platform data after probe. This work is inspired by Grant Likely and Troy Kisky. Signed-off-by: Shawn Guo Cc: Troy Kisky Cc: Grant Likely Cc: Wolfram Sang Cc: Chris Ball Acked-by: Grant Likely --- drivers/mmc/host/sdhci-esdhc-imx.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 3cc6f61..0b0e62e 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -45,6 +45,7 @@ struct pltfm_imx_data { int flags; u32 scratchpad; + struct esdhc_platform_data boarddata; }; static unsigned int esdhc_pltfm_get_max_blk_size(struct sdhci_host *host) @@ -69,8 +70,9 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i static u32 esdhc_readl_le(struct sdhci_host *host, int reg) { - struct esdhc_platform_data *boarddata = - host->mmc->parent->platform_data; + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = pltfm_host->priv; + struct esdhc_platform_data *boarddata = &imx_data->boarddata; /* fake CARD_PRESENT flag */ u32 val = readl(host->ioaddr + reg); @@ -92,8 +94,7 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct pltfm_imx_data *imx_data = pltfm_host->priv; - struct esdhc_platform_data *boarddata = - host->mmc->parent->platform_data; + struct esdhc_platform_data *boarddata = &imx_data->boarddata; if (unlikely((reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE) && (boarddata->cd_type == ESDHC_CD_GPIO))) @@ -210,8 +211,9 @@ static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host) { - struct esdhc_platform_data *boarddata = - host->mmc->parent->platform_data; + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = pltfm_host->priv; + struct esdhc_platform_data *boarddata = &imx_data->boarddata; switch (boarddata->wp_type) { case ESDHC_WP_GPIO: @@ -291,12 +293,14 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; - boarddata = host->mmc->parent->platform_data; - if (!boarddata) { + if (!host->mmc->parent->platform_data) { dev_err(mmc_dev(host->mmc), "no board data!\n"); err = -EINVAL; goto no_board_data; } + imx_data->boarddata = *((struct esdhc_platform_data *) + host->mmc->parent->platform_data); + boarddata = &imx_data->boarddata; /* write_protect */ if (boarddata->wp_type == ESDHC_WP_GPIO) { @@ -373,8 +377,8 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev) { struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct esdhc_platform_data *boarddata = host->mmc->parent->platform_data; struct pltfm_imx_data *imx_data = pltfm_host->priv; + struct esdhc_platform_data *boarddata = &imx_data->boarddata; int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); sdhci_remove_host(host, dead);