From patchwork Tue Jul 3 06:06:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aaron lu X-Patchwork-Id: 1149231 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 478AFDFF72 for ; Tue, 3 Jul 2012 06:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932487Ab2GCGHI (ORCPT ); Tue, 3 Jul 2012 02:07:08 -0400 Received: from va3ehsobe005.messaging.microsoft.com ([216.32.180.31]:35492 "EHLO va3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754174Ab2GCGHH (ORCPT ); Tue, 3 Jul 2012 02:07:07 -0400 Received: from mail82-va3-R.bigfish.com (10.7.14.248) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.23; Tue, 3 Jul 2012 06:05:07 +0000 Received: from mail82-va3 (localhost [127.0.0.1]) by mail82-va3-R.bigfish.com (Postfix) with ESMTP id A385B42026F; Tue, 3 Jul 2012 06:05:07 +0000 (UTC) X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null); IPV:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI X-SpamScore: -3 X-BigFish: VPS-3(zz98dI1432I4015Izz1202hzz8275ch8275bh8275dhz2dh668h839h944hd25hf0ah) Received: from mail82-va3 (localhost.localdomain [127.0.0.1]) by mail82-va3 (MessageSwitch) id 1341295506207770_26968; Tue, 3 Jul 2012 06:05:06 +0000 (UTC) Received: from VA3EHSMHS029.bigfish.com (unknown [10.7.14.248]) by mail82-va3.bigfish.com (Postfix) with ESMTP id 2EAD74E007E; Tue, 3 Jul 2012 06:05:06 +0000 (UTC) Received: from ausb3twp01.amd.com (163.181.249.108) by VA3EHSMHS029.bigfish.com (10.7.99.39) with Microsoft SMTP Server id 14.1.225.23; Tue, 3 Jul 2012 06:05:04 +0000 X-WSS-ID: 0M6KMBN-01-AFA-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp01.amd.com (Axway MailGate 3.8.1) with ESMTP id 2BA7D10280F2; Tue, 3 Jul 2012 01:06:58 -0500 (CDT) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 3 Jul 2012 01:07:07 -0500 Received: from sausexmb1.amd.com (163.181.3.156) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server id 8.3.213.0; Tue, 3 Jul 2012 01:06:59 -0500 Received: from storexbh1.amd.com ([10.1.1.17]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 3 Jul 2012 01:06:59 -0500 Received: from sshaexmb1.amd.com ([10.237.2.11]) by storexbh1.amd.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 3 Jul 2012 02:06:57 -0400 Received: from aarontestpc.amd.com ([10.237.73.86]) by sshaexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 3 Jul 2012 14:06:55 +0800 Date: Tue, 3 Jul 2012 14:06:55 +0800 From: Aaron Lu To: Chris Ball CC: , , , Philip Rakity Subject: Re: [PATCH 2/2] mmc: only support voltage (vdd) that regulator agree's with Message-ID: <20120703060655.GA10350@aarontestpc.amd.com> References: <1339183573-21688-1-git-send-email-prakity@marvell.com> <87pq8haeq0.fsf@octavius.laptop.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87pq8haeq0.fsf@octavius.laptop.org> X-OriginalArrivalTime: 03 Jul 2012 06:06:55.0640 (UTC) FILETIME=[0C559180:01CD58E2] X-OriginatorOrg: amd.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Hi Chris, On Fri, Jun 29, 2012 at 07:19:19PM -0400, Chris Ball wrote: > Hi, > > On Fri, Jun 08 2012, philipspatches@gmail.com wrote: > > From: Philip Rakity > > > > If we are using a regulator the SD Host Controller and the > > regulator should agree about the voltages supported. Use > > the common subset that is supported. > > > > Signed-off-by: Philip Rakity > > This breaks the build when CONFIG_REGULATOR=n -- I've applied what looks > like the correct fix to me: > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index eae7c3c..caba999 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2832,51 +2832,53 @@ int sdhci_add_host(struct sdhci_host *host) > +#ifdef CONFIG_REGULATOR > /* > * According to SD Host Controller spec v3.00, if the Host System > * can afford more than 150mA, Host Driver should set XPC to 1. Also > * the value is meaningful only if Voltage Support in the Capabilities > * register is set. The actual current value is 4 times the register > * value. > */ The above comments does not belong to regulator code, it should be placed on top of the max_current_caps variable like this: Thanks, Aaron > if (host->vmmc) { > ret = regulator_is_supported_voltage(host->vmmc, 3300000, > 3300000); > if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330))) > caps[0] &= ~SDHCI_CAN_VDD_330; > ret = regulator_is_supported_voltage(host->vmmc, 3000000, > 3000000); > if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300))) > caps[0] &= ~SDHCI_CAN_VDD_300; > ret = regulator_is_supported_voltage(host->vmmc, 1800000, > 1800000); > if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180))) > caps[0] &= ~SDHCI_CAN_VDD_180; > } > +#endif /* CONFIG_REGULATOR */ > > -- > Chris Ball > One Laptop Per Child > --- 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/sdhci.c b/drivers/mmc/host/sdhci.c index caba999..f76736b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2845,13 +2845,6 @@ int sdhci_add_host(struct sdhci_host *host) } #ifdef CONFIG_REGULATOR - /* - * According to SD Host Controller spec v3.00, if the Host System - * can afford more than 150mA, Host Driver should set XPC to 1. Also - * the value is meaningful only if Voltage Support in the Capabilities - * register is set. The actual current value is 4 times the register - * value. - */ if (host->vmmc) { ret = regulator_is_supported_voltage(host->vmmc, 3300000, 3300000); @@ -2868,6 +2861,13 @@ int sdhci_add_host(struct sdhci_host *host) } #endif /* CONFIG_REGULATOR */ + /* + * According to SD Host Controller spec v3.00, if the Host System + * can afford more than 150mA, Host Driver should set XPC to 1. Also + * the value is meaningful only if Voltage Support in the Capabilities + * register is set. The actual current value is 4 times the register + * value. + */ max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT); if (!max_current_caps && host->vmmc) { u32 curr = regulator_get_current_limit(host->vmmc);