From patchwork Mon Oct 14 08:23:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3034651 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 40184BF924 for ; Mon, 14 Oct 2013 08:23:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CED720278 for ; Mon, 14 Oct 2013 08:23:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5DB0202BE for ; Mon, 14 Oct 2013 08:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753018Ab3JNIXV (ORCPT ); Mon, 14 Oct 2013 04:23:21 -0400 Received: from mail-db9lp0252.outbound.messaging.microsoft.com ([213.199.154.252]:5403 "EHLO db9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451Ab3JNIXU (ORCPT ); Mon, 14 Oct 2013 04:23:20 -0400 Received: from mail95-db9-R.bigfish.com (10.174.16.235) by DB9EHSOBE002.bigfish.com (10.174.14.65) with Microsoft SMTP Server id 14.1.225.22; Mon, 14 Oct 2013 08:23:19 +0000 Received: from mail95-db9 (localhost [127.0.0.1]) by mail95-db9-R.bigfish.com (Postfix) with ESMTP id 7722A300099; Mon, 14 Oct 2013 08:23:19 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h1de097h8275dhz2dh87h2a8h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1e23h1fe8h1ff5h1151h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail95-db9 (localhost.localdomain [127.0.0.1]) by mail95-db9 (MessageSwitch) id 1381738997291807_15394; Mon, 14 Oct 2013 08:23:17 +0000 (UTC) Received: from DB9EHSMHS011.bigfish.com (unknown [10.174.16.238]) by mail95-db9.bigfish.com (Postfix) with ESMTP id 386E46006D; Mon, 14 Oct 2013 08:23:17 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS011.bigfish.com (10.174.14.21) with Microsoft SMTP Server (TLS) id 14.16.227.3; Mon, 14 Oct 2013 08:23:16 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.158.2; Mon, 14 Oct 2013 08:23:15 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.29]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r9E8MxRK007437; Mon, 14 Oct 2013 01:23:13 -0700 From: Shawn Guo To: CC: Dong Aisheng , Chris Ball , , Shawn Guo Subject: [PATCH 5/5] mmc: sdhci-esdhc-imx: eliminate enum imx_esdhc_type Date: Mon, 14 Oct 2013 16:23:44 +0800 Message-ID: <1381739024-24924-6-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381739024-24924-1-git-send-email-shawn.guo@linaro.org> References: <1381739024-24924-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We now have 'flags' in struct pltfm_imx_data to identify the features and quirks for ESDHC variants running on different i.MX SoCs. The enum imx_esdhc_type can be eliminated by interpreting the ESDHC variants with the ESDHC_FLAG_* flags. Signed-off-by: Shawn Guo --- drivers/mmc/host/sdhci-esdhc-imx.c | 52 +++++------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index f1e1385..f2cd5b0 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -100,18 +100,15 @@ */ #define ESDHC_FLAG_USDHC BIT(3) -enum imx_esdhc_type { - IMX25_ESDHC, - IMX35_ESDHC, - IMX51_ESDHC, - IMX53_ESDHC, - IMX6Q_USDHC, -}; +#define IMX25_ESDHC (ESDHC_FLAG_NO_DMAS_BITS | ESDHC_FLAG_ENGCM07207) +#define IMX35_ESDHC (ESDHC_FLAG_ENGCM07207) +#define IMX51_ESDHC (0) +#define IMX53_ESDHC (ESDHC_FLAG_MULTIBLK_NO_INT) +#define IMX6Q_USDHC (ESDHC_FLAG_USDHC) struct pltfm_imx_data { int flags; u32 scratchpad; - enum imx_esdhc_type devtype; struct pinctrl *pinctrl; struct pinctrl_state *pins_default; struct pinctrl_state *pins_100mhz; @@ -154,31 +151,6 @@ static const struct of_device_id imx_esdhc_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids); -static inline int is_imx25_esdhc(struct pltfm_imx_data *data) -{ - return data->devtype == IMX25_ESDHC; -} - -static inline int is_imx35_esdhc(struct pltfm_imx_data *data) -{ - return data->devtype == IMX35_ESDHC; -} - -static inline int is_imx51_esdhc(struct pltfm_imx_data *data) -{ - return data->devtype == IMX51_ESDHC; -} - -static inline int is_imx53_esdhc(struct pltfm_imx_data *data) -{ - return data->devtype == IMX53_ESDHC; -} - -static inline int is_imx6q_usdhc(struct pltfm_imx_data *data) -{ - return data->devtype == IMX6Q_USDHC; -} - static inline int esdhc_is_usdhc(struct pltfm_imx_data *data) { return !!(data->flags & ESDHC_FLAG_USDHC); @@ -866,19 +838,10 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) goto free_sdhci; } - imx_data->devtype = of_id ? (enum imx_esdhc_type) of_id->data : + imx_data->flags = of_id ? (int) of_id->data : pdev->id_entry->driver_data; pltfm_host->priv = imx_data; - if (is_imx25_esdhc(imx_data)) - imx_data->flags |= ESDHC_FLAG_NO_DMAS_BITS; - - if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) - imx_data->flags |= ESDHC_FLAG_ENGCM07207; - - if (is_imx6q_usdhc(imx_data)) - imx_data->flags |= ESDHC_FLAG_USDHC; - imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); if (IS_ERR(imx_data->clk_ipg)) { err = PTR_ERR(imx_data->clk_ipg); @@ -924,9 +887,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK | SDHCI_QUIRK_BROKEN_ADMA; - if (is_imx53_esdhc(imx_data)) - imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; - /* * The imx6q ROM code will change the default watermark level setting * to something insane. Change it back here.