From patchwork Tue Dec 4 14:01:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 1837691 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 CEB2A40E3E for ; Tue, 4 Dec 2012 14:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754109Ab2LDOBq (ORCPT ); Tue, 4 Dec 2012 09:01:46 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:13813 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060Ab2LDOBk (ORCPT ); Tue, 4 Dec 2012 09:01:40 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEI00AQQEXVRBM0@mailout3.samsung.com>; Tue, 04 Dec 2012 23:01:39 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-d9-50be0243241c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id BA.1F.12699.3420EB05; Tue, 04 Dec 2012 23:01:39 +0900 (KST) Received: from localhost.localdomain ([106.116.147.30]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEI00EMKEY4BV70@mmp2.samsung.com>; Tue, 04 Dec 2012 23:01:39 +0900 (KST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Cc: Marek Szyprowski , Kyungmin Park , Mark Brown , Liam Girdwood , Chris Ball , Kevin Liu Subject: [PATCH 3/3] mmc: sdhci: check voltage range only on regulators aware of voltage value Date: Tue, 04 Dec 2012 15:01:03 +0100 Message-id: <1354629663-29091-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1354629663-29091-1-git-send-email-m.szyprowski@samsung.com> References: <1354629663-29091-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQV1npn0BBovOiVhc3jWHzeLI/35G ByaPz5vkAhijuGxSUnMyy1KL9O0SuDL+7v7FWtDCWTHtHm8D40H2LkZODgkBE4nll86xQdhi EhfurQeyuTiEBKYzSsydvZAdwmlnknj7+gNYB5uAoUTX2y6gKg4OEQFrib0LfUFqmAXeMkos v7WdBSQuLJAgcXlnKojJIqAq8feSFUgnr4CHxJf2/awgYQkBBYk5k2xATE4BT4m3PxlBKoSA Ku4tX8c4gZF3ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYxgnz+T3sG4qsHiEKMAB6MS D++CF3sChFgTy4orcw8xSnAwK4nwKnzYGyDEm5JYWZValB9fVJqTWnyIUZqDRUmct9kjJUBI ID2xJDU7NbUgtQgmy8TBKdXAOOGkTmBokwm701HfGRb+V+fL5r3x1K9w2bPXaP/ilko1J51o xs3WKipz9yufvbEk3u3gQ+f9H6veVwgUNoYJvbFolHh3Mf/apR9fqt++n/6lbfOXfdeY27+Z uJ6qMf0e/LNl4o3FStrOWxc7SIXpSh6ZXRQkyLxDw6RpUypTAxvD7ImB7tO+K7EUZyQaajEX FScCALgYwYT1AQAA Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Some regulators don't report any voltage values, so checking supported voltage range results in disabling all SDHCI_CAN_VDD_* flags and registration failure. This patch finally provides a correct fix for the registration of SDHCI driver with all possible voltage regulators: dummy, fixed and regulated without using regulator_count_voltages() hacks. Signed-off-by: Marek Szyprowski --- drivers/mmc/host/sdhci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a9ad2cd..d244dc0 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2930,7 +2930,11 @@ int sdhci_add_host(struct sdhci_host *host) } #ifdef CONFIG_REGULATOR - if (host->vmmc && regulator_count_voltages(host->vmmc) > 1) { + /* + * Voltage range check makes sense only if regulator reports + * any voltage value. + */ + if (host->vmmc && regulator_get_voltage(host->vmmc) > 0) { ret = regulator_is_supported_voltage(host->vmmc, 2700000, 3600000); if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))