Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932559AbbFIHrt (ORCPT ); Tue, 9 Jun 2015 03:47:49 -0400 Received: from mail-by2on0093.outbound.protection.outlook.com ([207.46.100.93]:7264 "EHLO na01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932400AbbFIHrf (ORCPT ); Tue, 9 Jun 2015 03:47:35 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; apm.com; dkim=none (message not signed) header.d=none; From: Suneel Garapati To: , CC: Ulf Hansson , , , Adrian Hunter , Aisheng Dong , Haibo Chen , Tim Kryger , Shawn Guo , Yi Sun , "Rafael J. Wysocki" , , Suneel Garapati Subject: [PATCH 1/2] drivers: mmc: add quirk SDHCI_QUIRK_CLOCK_DIV_ZERO_BROKEN Date: Tue, 9 Jun 2015 13:01:50 +0530 Message-ID: <1433835111-32522-2-git-send-email-suneel.garapati@xilinx.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1433835111-32522-1-git-send-email-suneel.garapati@xilinx.com> References: <1433835111-32522-1-git-send-email-suneel.garapati@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21602.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD014;1:sVGy8z7+nuQpQgNEuhqZg3FhvshiquCil4q5OJrgqTZYKFleN3JMePMSc0CsBnUGmAzOTNP2A3FHpMc1Uyr69QmXIFjYa/0vz6labAOBSik7OHlwX3LzKEOAcqq2IgP8CrhdmtlZ+0b6DVKsGjCUesKKj5r9Tpn9L0P6GM9O/JvkqtIBzk+9yRKXu6XyT++X3W3uW8/CFHhtcu+D0mnmgwrpaNbHVUgZt8Lk3sT5GHEYW+F9t30kVlijwnQj4vWPvwlnD940ikxzxWMO59wTaeOvwS+wgh4ojisqrZ5BwA092TNAGDPjRKrGDF7+BSM0XMvQ+P+ucUyi8AnCyFhuKg== X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(438002)(189002)(199003)(106466001)(36756003)(77096005)(63266004)(50226001)(48376002)(229853001)(107886002)(50466002)(5001960100002)(19580395003)(19580405001)(62966003)(77156002)(92566002)(189998001)(76176999)(50986999)(86362001)(36386004)(33646002)(47776003)(87936001)(46102003)(2950100001)(5001770100001)(6806004)(7059030)(107986001)(4001430100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1BFFO11HUB053;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB053;2:AmYGKCj6vLuoz1tMGvuM7EJafIXlZHKtgvxiVoE7QfokDL3JXpu0Ii7KmDqYRJOw;2:QY+pa0IJ16mrX6xVaH/HXEUe01jbnZ1UumgTC685f8RreXSUpL3Uf4b5vs+TDXgsbrBmWfwbwUlJ79n5kOkvxSL36Ttpa5W0oZb8Eoq6UnAS5i9D/tbvNAgMlO4c1blihmEENCmYgT/9Z92Wy60vdYGq3Z/SE7moevTECibMC7A4h758CuvAxOJESKeNeXT7x9vgyKWTcUb67ufmhvuoXGyZAKxyBNlVa1V6H/LutGg=;6:XpzEjfPUJDMs/f+c+DPrA3+tFV0RSNC+D1+1QcGgasS230CN1gK40k5ZBFlygvNgW3//gEO+0NgUTgskxxCcgU2O3lvIuiMyyIMOPbpipRheFqIc+PdRMQTO4GdBNP/hpq32bLziSpFQsWeRPmwgTJ0ySwCqo9ZjFMpjePeX6YM63SuyhZOjsdANGDQIwCFQgUzI5qdofrpy8k7+5AEsU6Y4UEspvt6GbKiSPmzuyCM0zPJgHqZSRuuknjKbSjcjrFyjH5FlRsjQH2KkCLvGPSOGPWG379AFOZ1IPuEfubkjyfd0YhMvLLytvHyqBhWu/Gbi/5zOPbf3RpDmwd93/Zf7LNnYeiDaB8K6MlQM1u2uYQlSlXNbk/mEHnMip8oG2XBeVOfQxNkPVc1lHh8ILYooNW5Nrzzg8R8gbB56wd+ZFzQI8Knw7sUK2ckzQ/uqUxgNTUt/NKJpTAKaJWzbJmK1PkDgmUtAdLKzHbf1jt+6Ra/tvf1T0aLq1r3wLNpa X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB053; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BN1BFFO11HUB053;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB053; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB053;3:aZjvMPMTLT1aZP3uv52Q4wtiSvUNb+vBjktUjpsndpcVHrcL6ejqQvwsFFz55yGb3ZHuE+n9dnQL/24HLIVBO5fIqDR1TaTE+/P28EOKqGiUdyZUuAXM+ZvErllAZQfDdAxurNhxpQDuBd4tLOtfBQICaIHO+n+Vc+/PeJHj2xWYmAPP5NvcAB782/jd5joRtkRjkzyQHyBDfY4HP+NqEgq+MmwF1UAUgrjsPqK3+I35hL/ClqMwKTEgKYGJvc+iAOiSQpQbpghQFhOuEhoFOQYkUCiqdHEPs+HlX0Zf7vwX/kUm/3kSbGX5shp+S7IO X-Forefront-PRVS: 06022AA85F X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB053;9:n+0VtdvRTB0+VIQFdShJWtRmgvdWvH9eoZrNJ0AQpynxsJaL+ABgjOq/4cFpol1QCPy684U4///ykrOzmAQ4buqZ+IXZ7b6IZbK4aPaHA+wnB47iw7QmCnUujlgBWoM7yWgYa07SG9iqWdsrupwkVdXOgRG48iANyfmVndqA4HXxNVQNS2JvpGHxM/LTyFT8dEKT9QUE2sQnMPLk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exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB053 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11SHT009;9:ejZZTalDBkHG8nJaA/X5JffL2l2baltG76g0N5gDyyyeHcQn4x3KqYBgnTKGHrPQPB3LDxqrogMEK6UGdlNYQqQf9/xvVR12NA/98vQEtAaJ0fIlY269DWvFkvY63zbb0tf9TWf+sSjLZfRfBJap1g== X-OriginatorOrg: xilinx.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1528 Lines: 44 adds quirk for controllers whose clock divider zero is broken, sdhci_set_clock function will incorporate this modification. Signed-off-by: Suneel Garapati --- drivers/mmc/host/sdhci.c | 4 ++++ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 1b4861d..087327e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1210,6 +1210,10 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) } real_div = div; div >>= 1; + if ((host->quirks2 & SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN) + && !div && host->max_clk <= 25000000) { + div = 1; + } } } else { /* Version 2.00 divisors must be a power of 2. */ diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 5521d29..67046ca 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -409,6 +409,8 @@ struct sdhci_host { #define SDHCI_QUIRK2_SUPPORT_SINGLE (1<<13) /* Controller broken with using ACMD23 */ #define SDHCI_QUIRK2_ACMD23_BROKEN (1<<14) +/* Broken Clock divider zero in controller */ +#define SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN (1<<15) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */ -- 2.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/