From patchwork Fri Dec 9 16:59:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 9468753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D64D1607D8 for ; Fri, 9 Dec 2016 17:02:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C549D28647 for ; Fri, 9 Dec 2016 17:02:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B92A228662; Fri, 9 Dec 2016 17:02:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C9D728647 for ; Fri, 9 Dec 2016 17:02:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFOWm-0006r4-Mx; Fri, 09 Dec 2016 17:00:08 +0000 Received: from mail-wj0-x22e.google.com ([2a00:1450:400c:c01::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cFOWi-0006PV-Ga for linux-arm-kernel@lists.infradead.org; Fri, 09 Dec 2016 17:00:06 +0000 Received: by mail-wj0-x22e.google.com with SMTP id v7so19537131wjy.2 for ; Fri, 09 Dec 2016 08:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=wNML/jkfMR0BkdJNP9K1CDfCe/RBCtOab9oAh09I4Jk=; b=M11YQgL/dmOgr9uvzwqrfQXGtYny82nvZWxh7kH+ZmJU+OxRUzYNzHJ0KL889LbnzT fUpRg/rpjf8M9HzYmXKfDAUvDH/ggTlJAZ9Uul7i+rhMj94oF8HuxOfCA5eyiofQilV2 xYRnYj+x7WJBVsDS+P066z0P3PcAQqzCijBnJrgP7UyzxFX4riH69ldnRv5YaSNh1tIB HnAzIc8Hc3V2AguGZr/fy9KPfzFGGx2UxEM9vkpyqgAlCXNMZDF8UlHVJfUeArHW7lAb RCLsIxc/lHZWb/G0dJciUwsf6TU8su3yHXqMc8mEFWUh3gQZWH5zFgbM7u3zk31t7izE MwPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wNML/jkfMR0BkdJNP9K1CDfCe/RBCtOab9oAh09I4Jk=; b=O+tQiYWu7d3yBNaTpSfYggvYVI3LWBozcejQcDe6ROv6YV2DiWHx53K0GUmtLzAGQD OAdi/k3wry+gZxDIOl/uM7JoDIiq0aGOHbP1o1BU8714HngABGnrc8xl/IKqdUFD5ZRa iyASooMImdg4C/nPasaxdenVvw4tO17lu/sFq9PCsRFKedQ5Rp+rcCK5SsZS+w3AtjzN UcoJDnh2YL9NRczxaALE+w3rii1BCzwQpovvEqYeZ9XLvWnxztA7J9PHcSsmQf2BLxQl n8otTEZPkQaEemZ6gpvnMREVq9U0+Kk+E7yx5f4MjTV6tAghp54/rN5GRAcx8udILFEU /lJA== X-Gm-Message-State: AKaTC01R8x62jENDt0z+xwLKqjBSBM+wGsp9Gnk5twkWOyKnA9jREaW2QXymLgrjEE2KhVeo X-Received: by 10.194.164.226 with SMTP id yt2mr80154738wjb.201.1481302781401; Fri, 09 Dec 2016 08:59:41 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id kp5sm43250827wjb.8.2016.12.09.08.59.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 08:59:40 -0800 (PST) From: Alexandre Bailon To: nsekhar@ti.com Subject: [PATCH v7 1/2] provide lock-less versions of clk_{enable|disable} Date: Fri, 9 Dec 2016 17:59:32 +0100 Message-Id: <1481302773-14181-1-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161209_090004_805284_D2EF7636 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, ahaslam@baylibre.com, khilman@baylibre.com, Alexandre Bailon , ptitiano@baylibre.com, linux-arm-kernel@lists.infradead.org, david@lechnology.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Rename __clk_{enable|disble} in davinci_clk_{enable|disable}. davinci_clk_{enable|disable} is a lock-less version of clk_{enable|disable}. This is useful to recursively enable clock without doing recursive call to clk_enable(), which would cause a recursive locking issue. The lock-less version could be used by example by the usb20 phy clock, that need to enable the usb20 clock before to start. Signed-off-by: Alexandre Bailon Suggested-by: David Lechner --- arch/arm/mach-davinci/clock.c | 12 ++++++------ arch/arm/mach-davinci/clock.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index df42c93..f5dce9b 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c @@ -31,10 +31,10 @@ static LIST_HEAD(clocks); static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clockfw_lock); -static void __clk_enable(struct clk *clk) +void davinci_clk_enable(struct clk *clk) { if (clk->parent) - __clk_enable(clk->parent); + davinci_clk_enable(clk->parent); if (clk->usecount++ == 0) { if (clk->flags & CLK_PSC) davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, @@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk) } } -static void __clk_disable(struct clk *clk) +void davinci_clk_disable(struct clk *clk) { if (WARN_ON(clk->usecount == 0)) return; @@ -56,7 +56,7 @@ static void __clk_disable(struct clk *clk) clk->clk_disable(clk); } if (clk->parent) - __clk_disable(clk->parent); + davinci_clk_disable(clk->parent); } int davinci_clk_reset(struct clk *clk, bool reset) @@ -103,7 +103,7 @@ int clk_enable(struct clk *clk) return -EINVAL; spin_lock_irqsave(&clockfw_lock, flags); - __clk_enable(clk); + davinci_clk_enable(clk); spin_unlock_irqrestore(&clockfw_lock, flags); return 0; @@ -118,7 +118,7 @@ void clk_disable(struct clk *clk) return; spin_lock_irqsave(&clockfw_lock, flags); - __clk_disable(clk); + davinci_clk_disable(clk); spin_unlock_irqrestore(&clockfw_lock, flags); } EXPORT_SYMBOL(clk_disable); diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h index e2a5437..fa2b837 100644 --- a/arch/arm/mach-davinci/clock.h +++ b/arch/arm/mach-davinci/clock.h @@ -132,6 +132,8 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate); int davinci_set_refclk_rate(unsigned long rate); int davinci_simple_set_rate(struct clk *clk, unsigned long rate); int davinci_clk_reset(struct clk *clk, bool reset); +void davinci_clk_enable(struct clk *clk); +void davinci_clk_disable(struct clk *clk); extern struct platform_device davinci_wdt_device; extern void davinci_watchdog_reset(struct platform_device *);