From patchwork Wed Aug 22 15:10:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1361981 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 945F03FD40 for ; Wed, 22 Aug 2012 15:10:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932633Ab2HVPJ6 (ORCPT ); Wed, 22 Aug 2012 11:09:58 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:55521 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932467Ab2HVPJ4 (ORCPT ); Wed, 22 Aug 2012 11:09:56 -0400 Received: by pbbrr13 with SMTP id rr13so1615895pbb.19 for ; Wed, 22 Aug 2012 08:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=thPxuXZnuN/yJEcz4UP5UqDZKl7CKBObwyLDX77hAv8=; b=ajLUMYfIZKlqT6nhDxdgmiA1x9JrFQY/jY24i6Y815zySrcpGq9iRvqRSNz6njHcs6 K+bCuKfZTEDHsMBguiUypVgXdVInkxLb+nKNoyVONpZLMgB1NNSPNY9JBfMATr89MUh9 InVpGZ7RvQHBn5vSjqN/Lvpvy1v1w0uOVR+wVe2pnLMgac/ca4fhQBuAHrbIWqk7ptMY qQyRvpi4vsaHaSVyBskzsRgMLduipgOZt3o9bRCDKRidm2L+obcw4tlGRxejfmvcuVKX HNr62sH6TR3RMwE+RM0eC5U5QTdiiXXeCCcL5CTgF4/HpNpDRraCyg7j6eAqjZvYgOFW I61A== Received: by 10.66.88.198 with SMTP id bi6mr46766720pab.23.1345648195046; Wed, 22 Aug 2012 08:09:55 -0700 (PDT) Received: from localhost.localdomain ([114.216.232.42]) by mx.google.com with ESMTPS id tq4sm3903322pbc.11.2012.08.22.08.09.47 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Aug 2012 08:09:54 -0700 (PDT) From: Shawn Guo To: linux-mmc@vger.kernel.org Cc: Chris Ball , Shawn Guo , Subject: [PATCH] mmc: sdhci-esdhc: break out early if clock is 0 Date: Wed, 22 Aug 2012 23:10:01 +0800 Message-Id: <1345648201-10746-1-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.5.4 X-Gm-Message-State: ALoCoQld8wtcF3YrvGbiH4gCofbT6S4KZNDfNT/MDYD5NRUE0VjnhNsB1NGY6/dnHCoifVrWXMv3 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Since commit 30832ab (mmc: sdhci: Always pass clock request value zero to set_clock host op) gets in, esdhc_set_clock starts hitting "if (clock == 0)" where ESDHC_SYSTEM_CONTROL has been operated. This causes SDHCI card-detection function being broken. Fix the regression by moving "if (clock == 0)" above ESDHC_SYSTEM_CONTROL operation. Cc: Signed-off-by: Shawn Guo --- drivers/mmc/host/sdhci-esdhc.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index b97b2f5..d25f9ab 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -48,14 +48,14 @@ static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock) int div = 1; u32 temp; + if (clock == 0) + goto out; + temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); temp &= ~(ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN | ESDHC_CLOCK_MASK); sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); - if (clock == 0) - goto out; - while (host->max_clk / pre_div / 16 > clock && pre_div < 256) pre_div *= 2;