Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755200AbdCTUmg (ORCPT ); Mon, 20 Mar 2017 16:42:36 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:9630 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755195AbdCTUmc (ORCPT ); Mon, 20 Mar 2017 16:42:32 -0400 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 20 Mar 2017 13:42:30 -0700 Subject: Re: [PATCH 1/2] mmc: sdhci: Add support for setting parent clock To: Adrian Hunter , Ulf Hansson , Thierry Reding , "Ritesh Harjani" References: <1489660364-17698-1-git-send-email-jonathanh@nvidia.com> <693f9e04-b2b0-4d11-1359-0364961687e9@intel.com> CC: , , From: Jon Hunter Message-ID: <5556520b-d972-f40c-db84-43583b6dad9b@nvidia.com> Date: Mon, 20 Mar 2017 20:31:20 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <693f9e04-b2b0-4d11-1359-0364961687e9@intel.com> X-Originating-IP: [10.26.11.169] X-ClientProxiedBy: DRUKMAIL102.nvidia.com (10.25.59.20) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1281 Lines: 30 On 20/03/17 19:22, Adrian Hunter wrote: > On 03/16/2017 12:32 PM, Jon Hunter wrote: >> It is common for SD/MMC host controllers to set the parent clock that >> drives the SD/MMC interface in order to support various operating >> speeds. Typically, this is performed by calling common clock framework >> APIs such as clk_set_rate(). The problem is that these APIs may sleep >> and must not be called from within atomic sections and therefore, these >> functions cannot be called within the existing 'set_clock' SDHCI >> operator because they are called from within the context of a spinlock. >> Add a new 'set_parent_clock' operator for the SDHCI driver that is >> called early during the SDHCI 'set_ios' before the spinlock is aquire to >> give the platform driver the opportunity to set the parent clock rate. > > I just posted a patch to remove the spin lock from set_ios(). Does that help? Yes it does, thanks! Technically, the only other place this could occur is in sdhci_request_done() because this also calls ->set_clock() with the spinlock held. However, this is only called if SDHCI_QUIRK_CLOCK_BEFORE_RESET is set, which is only currently true for a device in sdhci-pci-core.c and this one just uses the normal sdhci_set_clock() routine. Cheers Jon -- nvpublic