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: 87532 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp410517qgi; Fri, 9 Dec 2016 09:01:44 -0800 (PST) X-Received: by 10.84.176.100 with SMTP id u91mr157222122plb.7.1481302904680; Fri, 09 Dec 2016 09:01:44 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id x16si34670408pff.226.2016.12.09.09.01.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 09:01:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c01:0:0:0:22e listed in] [list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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+patch=linaro.org@lists.infradead.org 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(-) -- 2.7.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 *);