From patchwork Mon Jun 5 04:41:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 9765477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 695EA60353 for ; Mon, 5 Jun 2017 04:41:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BB2B27FA9 for ; Mon, 5 Jun 2017 04:41:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F45827F10; Mon, 5 Jun 2017 04:41:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84CB127F10 for ; Mon, 5 Jun 2017 04:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751310AbdFEElk (ORCPT ); Mon, 5 Jun 2017 00:41:40 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:63528 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbdFEElj (ORCPT ); Mon, 5 Jun 2017 00:41:39 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20170605044137epoutp0254d3af5ec1da654f3e191c0163589022~FIA6Jbsjn2236422364epoutp02n; Mon, 5 Jun 2017 04:41:37 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.69]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170605044137epcas1p431a62018bbf3ec1705577c39bde35b56~FIA52j8tN1505815058epcas1p4T; Mon, 5 Jun 2017 04:41:37 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 78.53.11213.101E4395; Mon, 5 Jun 2017 13:41:37 +0900 (KST) Received: from epsmgms2p1.samsung.com (unknown [182.195.42.79]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e~FIA5of2cQ2526725267epcas1p4Q; Mon, 5 Jun 2017 04:41:37 +0000 (GMT) X-AuditID: b6c32a36-f79446d000002bcd-2d-5934e10117b6 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 30.F1.02179.101E4395; Mon, 5 Jun 2017 13:41:37 +0900 (KST) Received: from localhost.localdomain ([10.113.62.216]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OR200A0S51CWR90@mmp1.samsung.com>; Mon, 05 Jun 2017 13:41:37 +0900 (KST) From: Jaehoon Chung To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, shawn.lin@rock-chips.com, Jaehoon Chung Subject: [PATCH 2/6] mmc: dw_mmc: remove the loop about finding slots Date: Mon, 05 Jun 2017 13:41:31 +0900 Message-id: <20170605044135.18304-3-jh80.chung@samsung.com> X-Mailer: git-send-email 2.10.2 In-reply-to: <20170605044135.18304-1-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDKsWRmVeSWpSXmKPExsWy7bCmvi7jQ5NIg13fVS1u/GpjtTjyv5/R 4s6T9awWx9eGO7B43Lm2h83j76z9LB59W1YxenzeJBfAEpVqk5GamJJapJCal5yfkpmXbqvk HRzvHG9qZmCoa2hpYa6kkJeYm2qr5OIToOuWmQO0UUmhLD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IWwxiQv31rN1MXJxCAlsY5TY+mYtK4Tzg1Hiw5znTCBVbAI6Etu/ HQezRQRkJX7+ucAGYjMLxEksOvqTHcQWFnCVmH5nLzOIzSKgKvHu1zywel4Ba4mLK38wQmyT l1h4/ghYnFPARmL13UdgthBQzZX2JqYJjLwLGBlWMXKlFhTnpucWGxUYbmIEhuO2w1r+Oxh/ nI0+xCjAwajEwyuRaRIpxJpYVlyZe4hRgoNZSYS3+DpQiDclsbIqtSg/vqg0J7X4EKMp0CkT maVEk/OBsZJXEm9oYmlkYmBmZmhkYGymJM47IfBLhJBAemJJanZqakFqEUwfEwenVAMjc8q7 026zpn5u4BD65vnhotiZo2uStWf+2WF30PpxZ42FyE5N0Van+QyXXe87aHMYPu1ZHX0n9Jn2 Hb2pJk8Oltv7dDGtPsmn15dq3vkxn9Eho6PHI/TSw6UdB46sbpV2cDtma+fxyEzgiAaX3ve5 C57G7TgQqPindKLpIrfv0o39bV8us3sqsRRnJBpqMRcVJwIAxdnewl0CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e X-Msg-Generator: CA X-Sender-IP: 182.195.42.79 X-Local-Sender: =?UTF-8?B?7KCV7J6s7ZuIG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?SmFlaG9vbiBDaHVuZxtUaXplbiBQbGF0Zm9ybSBMYWIuG1Nh?= =?UTF-8?B?bXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e X-RootMTR: 20170605044137epcas1p47fa50e6e9a2b68eccc1f726a33e14c0e References: <20170605044135.18304-1-jh80.chung@samsung.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dwmmc controller has used the only one slot. It doesn't need to check the other slots. Remove the loop about finding slots. Signed-off-by: Jaehoon Chung --- drivers/mmc/host/dw_mmc.c | 115 +++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 79 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index a66edd0..1b415da 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2563,26 +2563,21 @@ static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status) static void dw_mci_handle_cd(struct dw_mci *host) { - int i; - - for (i = 0; i < host->num_slots; i++) { - struct dw_mci_slot *slot = host->slot[i]; - - if (!slot) - continue; + int i = 0; + struct dw_mci_slot *slot = host->slot[i]; - if (slot->mmc->ops->card_event) - slot->mmc->ops->card_event(slot->mmc); - mmc_detect_change(slot->mmc, - msecs_to_jiffies(host->pdata->detect_delay_ms)); - } + if (slot->mmc->ops->card_event) + slot->mmc->ops->card_event(slot->mmc); + mmc_detect_change(slot->mmc, + msecs_to_jiffies(host->pdata->detect_delay_ms)); } static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) { struct dw_mci *host = dev_id; u32 pending; - int i; + int i = 0; + struct dw_mci_slot *slot = host->slot[i]; pending = mci_readl(host, MINTSTS); /* read-only mask reg */ @@ -2659,19 +2654,11 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) dw_mci_handle_cd(host); } - /* Handle SDIO Interrupts */ - for (i = 0; i < host->num_slots; i++) { - struct dw_mci_slot *slot = host->slot[i]; - - if (!slot) - continue; - - if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { - mci_writel(host, RINTSTS, - SDMMC_INT_SDIO(slot->sdio_id)); - __dw_mci_enable_sdio_irq(slot, 0); - sdio_signal_irq(slot->mmc); - } + if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { + mci_writel(host, RINTSTS, + SDMMC_INT_SDIO(slot->sdio_id)); + __dw_mci_enable_sdio_irq(slot, 0); + sdio_signal_irq(slot->mmc); } } @@ -3011,29 +2998,24 @@ static void dw_mci_enable_cd(struct dw_mci *host) { unsigned long irqflags; u32 temp; - int i; + int i = 0; struct dw_mci_slot *slot; /* * No need for CD if all slots have a non-error GPIO * as well as broken card detection is found. */ - for (i = 0; i < host->num_slots; i++) { - slot = host->slot[i]; - if (slot->mmc->caps & MMC_CAP_NEEDS_POLL) - return; - - if (mmc_gpio_get_cd(slot->mmc) < 0) - break; - } - if (i == host->num_slots) + slot = host->slot[i]; + if (slot->mmc->caps & MMC_CAP_NEEDS_POLL) return; - spin_lock_irqsave(&host->irq_lock, irqflags); - temp = mci_readl(host, INTMASK); - temp |= SDMMC_INT_CD; - mci_writel(host, INTMASK, temp); - spin_unlock_irqrestore(&host->irq_lock, irqflags); + if (mmc_gpio_get_cd(slot->mmc) < 0) { + spin_lock_irqsave(&host->irq_lock, irqflags); + temp = mci_readl(host, INTMASK); + temp |= SDMMC_INT_CD; + mci_writel(host, INTMASK, temp); + spin_unlock_irqrestore(&host->irq_lock, irqflags); + } } int dw_mci_probe(struct dw_mci *host) @@ -3041,7 +3023,6 @@ int dw_mci_probe(struct dw_mci *host) const struct dw_mci_drv_data *drv_data = host->drv_data; int width, i, ret = 0; u32 fifo_size; - int init_slots = 0; if (!host->pdata) { host->pdata = dw_mci_parse_dt(host); @@ -3205,13 +3186,6 @@ int dw_mci_probe(struct dw_mci *host) goto err_dmaunmap; /* - * Even though dwmmc IP is provided the multiple slots, - * there is no use case in mms subsystem. - * dwmmc host controller needs to initialize the one slot per an IP. - */ - host->num_slots = 1; - - /* * Enable interrupts for command done, data over, data empty, * receive ready and error such as transmit, receive timeout, crc error */ @@ -3226,20 +3200,9 @@ int dw_mci_probe(struct dw_mci *host) host->irq, width, fifo_size); /* We need at least one slot to succeed */ - for (i = 0; i < host->num_slots; i++) { - ret = dw_mci_init_slot(host, i); - if (ret) - dev_dbg(host->dev, "slot %d init failed\n", i); - else - init_slots++; - } - - if (init_slots) { - dev_info(host->dev, "%d slots initialized\n", init_slots); - } else { - dev_dbg(host->dev, - "attempted to initialize %d slots, but failed on all\n", - host->num_slots); + ret = dw_mci_init_slot(host, 0); + if (ret) { + dev_dbg(host->dev, "slot %d init failed\n", i); goto err_dmaunmap; } @@ -3267,13 +3230,11 @@ EXPORT_SYMBOL(dw_mci_probe); void dw_mci_remove(struct dw_mci *host) { - int i; + int i = 0; - for (i = 0; i < host->num_slots; i++) { - dev_dbg(host->dev, "remove slot %d\n", i); - if (host->slot[i]) - dw_mci_cleanup_slot(host->slot[i], i); - } + dev_dbg(host->dev, "remove slot %d\n", i); + if (host->slot[i]) + dw_mci_cleanup_slot(host->slot[i], i); mci_writel(host, RINTSTS, 0xFFFFFFFF); mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */ @@ -3316,8 +3277,9 @@ EXPORT_SYMBOL(dw_mci_runtime_suspend); int dw_mci_runtime_resume(struct device *dev) { - int i, ret = 0; + int i = 0, ret = 0; struct dw_mci *host = dev_get_drvdata(dev); + struct dw_mci_slot *slot = host->slot[i]; if (host->cur_slot && (mmc_can_gpio_cd(host->cur_slot->mmc) || @@ -3356,17 +3318,12 @@ int dw_mci_runtime_resume(struct device *dev) DW_MCI_ERROR_FLAGS); mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); - for (i = 0; i < host->num_slots; i++) { - struct dw_mci_slot *slot = host->slot[i]; - if (!slot) - continue; - if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) - dw_mci_set_ios(slot->mmc, &slot->mmc->ios); + if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) + dw_mci_set_ios(slot->mmc, &slot->mmc->ios); - /* Force setup bus to guarantee available clock output */ - dw_mci_setup_bus(slot, true); - } + /* Force setup bus to guarantee available clock output */ + dw_mci_setup_bus(slot, true); /* Now that slots are all setup, we can enable card detect */ dw_mci_enable_cd(host);