From patchwork Wed Nov 7 11:07:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhilash Kesavan X-Patchwork-Id: 1710011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id E6A9CDFB7A for ; Wed, 7 Nov 2012 11:06:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TW3QG-0001Qo-1m; Wed, 07 Nov 2012 11:03:52 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TW3QB-0001P8-68 for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 11:03:48 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD40044C6PSY630@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 20:03:35 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 96.70.01231.6004A905; Wed, 07 Nov 2012 20:03:34 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-d7-509a40066d06 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 56.70.01231.5004A905; Wed, 07 Nov 2012 20:03:34 +0900 (KST) Received: from localhost.localdomain ([107.108.73.92]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MD4007RB6LNNL20@mmp2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2012 20:03:33 +0900 (KST) From: Abhilash Kesavan To: linux-arm-kernel@lists.infradead.org, kgene.kim@samsung.com, cjb@laptop.org, linux-mmc@vger.kernel.org, will.newton@imgtec.com Subject: [PATCH] mmc: dw_mmc: Add sdio power bindings Date: Wed, 07 Nov 2012 16:37:40 +0530 Message-id: <1352286460-13925-2-git-send-email-a.kesavan@samsung.com> X-Mailer: git-send-email 1.6.6.1 In-reply-to: <1352286460-13925-1-git-send-email-a.kesavan@samsung.com> References: <1352286460-13925-1-git-send-email-a.kesavan@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsWyRsSkTpfNYVaAwYU2fotNj6+xOjB6bF5S H8AYxWWTkpqTWZZapG+XwJXxYMoNpoIJ4hU/395hamD8INTFyMEhIWAicf+ecBcjJ5ApJnHh 3nq2LkYuDiGBpYwSF9uamGBq2h6KgJhCAtMZJe5KQZSsZ5JYc/gYO0gvm4CexIJ/X5lBEiIC LYwSGyZtZwRJCAuYStx6/4ANxGYRUJXY8+8jE4jNK+Aq8apxJRPEYgWJ0x/Wgg3iFHCTeLiq gw1imavErEUyEK0CEt8mH2KBOEdWYtMBsFUSAkfYJDbuvcwIMUZS4uCKGywTGIUWMDKsYhRN LUguKE5KzzXUK07MLS7NS9dLzs/dxAgMstP/nkntYFzZYHGIUYCDUYmHd0L6zAAh1sSy4src Q4wSHMxKIrzLjWYFCPGmJFZWpRblxxeV5qQWH2L0AbpkIrOUaHI+MALySuINjU3MTY1NLY2M zExNcQgrifM2e6QECAmkJ5akZqemFqQWwYxj4uCUamDclrHVhM1he8qmuFVfm4q5FMujjpde nLByVm3OGm39rr9Kpguu/7m6+Ogm65tz4zLnHa0LnHrRc5W59tN3c6++cqlxVBW0LW+Ze+fr VV5FnSlrVQ9lWcRklR/7M/PfsYpvzQ9+y5R/TI42WOtht/Xn/C1ZC27UTp3+db+btAPLxi1v irgmfRZXV2Ipzkg01GIuKk4EAG4bccNfAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRmVeSWpSXmKPExsVy+t9jQV02h1kBBmueM1lsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwhrGjAdTbjAVTBCv+Pn2DlMD 4wehLkYODgkBE4m2hyJdjJxAppjEhXvr2UDCQgLTGSXuSnUxcgGZ65kk1hw+xg5SwyagJ7Hg 31dmkISIQAujxIZJ2xlBEsICphK33j9gA7FZBFQl9vz7yARi8wq4SrxqXMkEsUBB4vSHtWCD OAXcJB6u6oBa5ioxa5HMBEaeBYwMqxhFUwuSC4qT0nMN9YoTc4tL89L1kvNzNzGCg/iZ1A7G lQ0WhxgFOBiVeHgnpM8MEGJNLCuuzD3EKMHBrCTCu9xoVoAQb0piZVVqUX58UWlOavEhRh+g oyYyS4km5wMjLK8k3tDYxNzU2NTSxMLEzBKHsJI4b7NHSoCQQHpiSWp2ampBahHMOCYOTqkG RltH3Vk+CXr3JggVMm+8v7jwxnXuk57/PrrMe9yxIV39TJWeinBklEfGycmSN9PrS7btTTuZ tGIFe6D5tdhVDA2/ZjaxivSHf3SIvJrs6Nr8JK/kWGitvMFfm7L3r6JaKo9FWlqfVGa49oF1 WevGyQ28MXzFB7+6zbaZoXZwvYHartet3zctUWIpzkg01GIuKk4EABhUzTOPAgAA X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121107_060347_700337_ADEE9316 X-CRM114-Status: GOOD ( 13.41 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.33 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add dt-based retrieval of host sdio pm capabilities. Based on the dt based discovery do a bus init in the resume function. Signed-off-by: Olof Johansson Signed-off-by: Abhilash Kesavan --- drivers/mmc/host/dw_mmc.c | 20 +++++++++++++++++--- include/linux/mmc/dw_mmc.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index c0667c8..5979203 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -617,13 +617,13 @@ static void mci_send_cmd(struct dw_mci_slot *slot, u32 cmd, u32 arg) cmd, arg, cmd_status); } -static void dw_mci_setup_bus(struct dw_mci_slot *slot) +static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) { struct dw_mci *host = slot->host; u32 div; u32 clk_en_a; - if (slot->clock != host->current_speed) { + if (slot->clock != host->current_speed || force_clkinit) { div = host->bus_hz / slot->clock; if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) /* @@ -684,7 +684,7 @@ static void __dw_mci_start_request(struct dw_mci *host, host->pdata->select_slot(slot->id); /* Slot specific timing and width adjustment */ - dw_mci_setup_bus(slot); + dw_mci_setup_bus(slot, false); host->cur_slot = slot; host->mrq = mrq; @@ -1850,6 +1850,9 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host->pdata->caps) mmc->caps = host->pdata->caps; + if (host->pdata->pm_caps) + mmc->pm_caps = host->pdata->pm_caps; + if (host->dev->of_node) { ctrl_id = of_alias_get_id(host->dev->of_node, "mshc"); if (ctrl_id < 0) @@ -2072,6 +2075,12 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) return ERR_PTR(ret); } + if (of_find_property(np, "keep-power-in-suspend", NULL)) + pdata->pm_caps |= MMC_PM_KEEP_POWER; + + if (of_find_property(np, "enable-sdio-wakeup", NULL)) + pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ; + return pdata; } @@ -2411,6 +2420,11 @@ int dw_mci_resume(struct dw_mci *host) 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); + dw_mci_setup_bus(slot, true); + } + ret = mmc_resume_host(host->slot[i]->mmc); if (ret < 0) return ret; diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index 9653166..b27471d 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -231,6 +231,7 @@ struct dw_mci_board { unsigned int caps; /* Capabilities */ unsigned int caps2; /* More capabilities */ + unsigned int pm_caps; /* PM capabilities */ /* * Override fifo depth. If 0, autodetect it from the FIFOTH register, * but note that this may not be reliable after a bootloader has used