From patchwork Sat Oct 5 11:17:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 2991061 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 E242E9F169 for ; Sat, 5 Oct 2013 11:21:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B9F3201F4 for ; Sat, 5 Oct 2013 11:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59A0320219 for ; Sat, 5 Oct 2013 11:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751459Ab3JELT2 (ORCPT ); Sat, 5 Oct 2013 07:19:28 -0400 Received: from mail-ee0-f53.google.com ([74.125.83.53]:56182 "EHLO mail-ee0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751859Ab3JELT0 (ORCPT ); Sat, 5 Oct 2013 07:19:26 -0400 Received: by mail-ee0-f53.google.com with SMTP id b15so2281120eek.40 for ; Sat, 05 Oct 2013 04:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q9BhW5aYc72R1/q63Lc6FJrilWNa69/vQlZCVudxgpg=; b=xVgNTF5S4J1anLjnh3zUMSOA5tnMrKL7E142vpCr9mHp2JkpQvuaJ5yTpWgWFydWIV K5zUNpWpCFXr8gUywT5vQFB8AtKqj+9XscQjikivW0GuD6cYaMcOg7m8/CIuEudqx0M8 k0uxM+RLoRtHWjpscwGzlaVvwjP5SZwNyohj9BGMi/mTh2cue5YlvLH1G6tdcXLsefLp S4clfs4y0KqQQKbM39qrK1rSMYcOCMCglKI62SqOQNh8WWbVuqzpfUirjIipyDwfRoDL AZeFRtN4hekuuIfzPUbXbpADnlQDz7tnTokGnX703DIoE8cXSz97GwKZVqutRfgHZ8ZP bh1g== X-Received: by 10.14.199.3 with SMTP id w3mr30105616een.33.1380971964001; Sat, 05 Oct 2013 04:19:24 -0700 (PDT) Received: from localhost (ip-89-176-190-241.net.upcbroadband.cz. [89.176.190.241]) by mx.google.com with ESMTPSA id h45sm38681926eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Oct 2013 04:19:23 -0700 (PDT) From: Andreas Fenkart To: Chris Ball Cc: Tony Lindgren , Grant Likely , Felipe Balbi , Venkatraman S , Balaji T K , zonque@gmail.com, devicetree-discuss@lists.ozlabs.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org, Andreas Fenkart Subject: [PATCH v3 1/4] mmc: omap_hsmmc: Fix context save and restore for DT Date: Sat, 5 Oct 2013 13:17:07 +0200 Message-Id: <1380971830-21492-2-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380971830-21492-1-git-send-email-afenkart@gmail.com> References: <1380971830-21492-1-git-send-email-afenkart@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Tony Lindgren 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 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 260cdb4..94d6dc8 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -198,19 +198,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; }; @@ -624,25 +624,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) @@ -682,8 +673,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; } @@ -693,15 +682,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 @@ -1662,13 +1644,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");