From patchwork Wed Sep 25 23:47:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 2946041 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DA7D9F3C4 for ; Wed, 25 Sep 2013 23:47:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28E05202FF for ; Wed, 25 Sep 2013 23:47:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BB4920353 for ; Wed, 25 Sep 2013 23:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755258Ab3IYXrm (ORCPT ); Wed, 25 Sep 2013 19:47:42 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:26236 "EHLO mho-02-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754325Ab3IYXrk (ORCPT ); Wed, 25 Sep 2013 19:47:40 -0400 Received: from c-50-131-214-131.hsd1.ca.comcast.net ([50.131.214.131] helo=[127.0.0.1]) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1VOyny-0003qW-PK; Wed, 25 Sep 2013 23:47:38 +0000 X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 50.131.214.131 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+U1YQg5keh+Jd/nSoG8GfL Subject: [PATCH 1/2] mmc: omap_hsmmc: Fix context save and restore for DT To: cjb@laptop.org From: Tony Lindgren Cc: linux-omap@vger.kernel.org, linux-mmc@vger.kernel.org, Balaji T K , linux-arm-kernel@lists.infradead.org, Andreas Fenkart Date: Wed, 25 Sep 2013 16:47:37 -0700 Message-ID: <20130925234737.3745.64262.stgit@localhost> In-Reply-To: <20130925234544.3745.55170.stgit@localhost> References: <20130925234544.3745.55170.stgit@localhost> User-Agent: StGit/0.16-1-ga54b MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 want to get rid of the omap specific platform init code callbacks as they don't play nice with device tree. Let's convert the context loss check to be based on a register state detection instead. Cc: Andreas Fenkart Cc: Balaji T K Signed-off-by: Tony Lindgren --- drivers/mmc/host/omap_hsmmc.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 6ac63df..aa97497 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -171,19 +171,19 @@ struct omap_hsmmc_host { unsigned char bus_mode; unsigned char power_mode; int suspended; + u32 hctl; + u32 capa; int irq; int use_dma, dma_ch; struct dma_chan *tx_chan; struct dma_chan *rx_chan; int slot_id; int response_busy; - int context_loss; int protect_card; int reqs_blocked; int use_reg; int req_in_progress; struct omap_hsmmc_next next_data; - struct omap_mmc_platform_data *pdata; }; @@ -597,25 +597,16 @@ static void omap_hsmmc_set_bus_mode(struct omap_hsmmc_host *host) static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) { struct mmc_ios *ios = &host->mmc->ios; - struct omap_mmc_platform_data *pdata = host->pdata; - int context_loss = 0; u32 hctl, capa; unsigned long timeout; - if (pdata->get_context_loss_count) { - context_loss = pdata->get_context_loss_count(host->dev); - if (context_loss < 0) - return 1; - } - - dev_dbg(mmc_dev(host->mmc), "context was %slost\n", - context_loss == host->context_loss ? "not " : ""); - if (host->context_loss == context_loss) - return 1; - if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE) return 1; + if (host->hctl == OMAP_HSMMC_READ(host->base, HCTL) && + host->capa == OMAP_HSMMC_READ(host->base, CAPA)) + return 0; + if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) { if (host->power_mode != MMC_POWER_OFF && (1 << ios->vdd) <= MMC_VDD_23_24) @@ -655,8 +646,6 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host) omap_hsmmc_set_bus_mode(host); out: - host->context_loss = context_loss; - dev_dbg(mmc_dev(host->mmc), "context is restored\n"); return 0; } @@ -666,15 +655,8 @@ out: */ static void omap_hsmmc_context_save(struct omap_hsmmc_host *host) { - struct omap_mmc_platform_data *pdata = host->pdata; - int context_loss; - - if (pdata->get_context_loss_count) { - context_loss = pdata->get_context_loss_count(host->dev); - if (context_loss < 0) - return; - host->context_loss = context_loss; - } + host->hctl = OMAP_HSMMC_READ(host->base, HCTL); + host->capa = OMAP_HSMMC_READ(host->base, CAPA); } #else @@ -1635,13 +1617,6 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data) { struct mmc_host *mmc = s->private; struct omap_hsmmc_host *host = mmc_priv(mmc); - int context_loss = 0; - - if (host->pdata->get_context_loss_count) - context_loss = host->pdata->get_context_loss_count(host->dev); - - seq_printf(s, "mmc%d:\n ctx_loss:\t%d:%d\n\nregs:\n", - mmc->index, host->context_loss, context_loss); if (host->suspended) { seq_printf(s, "host suspended, can't read registers\n");