From patchwork Thu Jul 20 15:50:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9855219 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 2FDF9602BA for ; Thu, 20 Jul 2017 15:52:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 200AB286B2 for ; Thu, 20 Jul 2017 15:52:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14A71286D6; Thu, 20 Jul 2017 15:52:20 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AEBA286B2 for ; Thu, 20 Jul 2017 15:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965728AbdGTPwT (ORCPT ); Thu, 20 Jul 2017 11:52:19 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:59603 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965727AbdGTPwS (ORCPT ); Thu, 20 Jul 2017 11:52:18 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MT92U-1d9Rcv0Rzq-00S62C; Thu, 20 Jul 2017 17:51:35 +0200 From: Arnd Bergmann To: Sekhar Nori , Kevin Hilman , Hartley Sweeten , Alexander Sverdlin , Eric Miao , Haojian Zhuang , Wan ZongShun Cc: linux-clk@vger.kernel.org, Stephen Boyd , Michael Turquette , Arnd Bergmann , Russell King , Alexandre Bailon , Masahiro Yamada , Dmitry Eremin-Solenikov , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/12] ARM: normalize clk API for older platforms Date: Thu, 20 Jul 2017 17:50:46 +0200 Message-Id: <20170720155132.3250812-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170720154616.3250481-1-arnd@arndb.de> References: <20170720154616.3250481-1-arnd@arndb.de> X-Provags-ID: V03:K0:20TnyH58LouFp+nlEuA4xN4jqxdDz24Bxq7fvXKYISKQSSbsCt4 OEAzD57UZnbJqm3jcRIUEqVONVfCmpQhprPrEx2y8ZRU7vGZ3yMOe616jflDzgj4v9chXTx 9wxg7paJM9z0rH5uNIYYBjqZv/IV9RfLW478S47AgRAw2uUE35TX4uNivkEOIT9QsbUJiii stRxSOkidw9XqXA3QvuOg== X-UI-Out-Filterresults: notjunk:1; V01:K0:7oqAnAQfl8E=:h4dHUck3FS27ZDkaak0fxn 8rC2UgEZd2+selJFynykFNwEfVtui9bX5De6h+90UGx/OVa+sssxKq2yOWKzYRWgRn3IPRKjS W8BUm8o3wTpzgq/ykz1rRAuxHtJ5u6VsbCijfOA/hY9EwLXdW7wYQPQlFz8VH3rVwqjSofIwq 9N9OL+2q+m4gyVWbjrQwsa8mIPjE6c9Bw1pn1xogJ0tp4piX5739fGJgqjf9RXEWxvhEcdEkt ygzdACV3vmW1zAysggzLropbRJNjck3ApQP8lo9Tgtwdsr7RQnCxpl/45+Mzi2rvAhDO2o58w ijt9cS6n0TFRHXBwVcIjP6RPbLeO/aLDeNCP/zSlI5S4FouZheIB/faTtz8QXo/uSIfOWSN9f AXhpHh/u6aKFLDLkuRcs6LCBBEeWdawdkFxsKipVsOUpATP7GOqyGmn5OzULt0pkDOm6YH2bk PqxZjvkY5X3GwCIKsKx2zY/uMvjMWA8GeH3/230ITelK/HrgcQl/6V722ls3l0ECyKhVU4Uf+ bs4U5WoC35NsSOXqD/8KgsPPaXOdgW58wpQakXsub53A1O2oYgVYJGRQNymu6X6KeeUmYKr2g K/GIVnZufFaM7F7XHkBdAP20tJs0PCD2JIK3HLx9Ls8WPz+nBi9L2AfYvhEPXQwGuFcLR1HOS RhWdXN8lkiQ9QMLsYinj+PjDcMODDdZETCrTqoTEUOy7UOonSBHnXRhRJTm1GNQRXR/qJO6rS MGoDqQKb3Gxv+coD/W3yw02Sk06FBY27GtvzJQ== Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Six ARM platforms still provide their own variant of the clk API rather than using the generic COMMON_CLK API. This generally works, but it causes some link errors with drivers using the clk_set_rate, clk_get_parent, clk_set_parent or clk_round_rate functions when a platform lacks those interfaces. OMAP1 implements the whole set already, but davinci, ep93xx, mmp, sa1100 and w90x900 all lack at least one of the functions. This adds empty stub implementations for each of them, and I don't even try to do something useful here but instead just print a WARN() message to make it obvious what is going on if they ever end up being called. The drivers that call these won't be used on these platforms (otherwise we'd get a link error today), so the added code is harmless bloat and will warn about accidental use. Signed-off-by: Arnd Bergmann Acked-by: Sekhar Nori --- arch/arm/mach-davinci/clock.c | 6 ++++++ arch/arm/mach-ep93xx/clock.c | 21 +++++++++++++++++++++ arch/arm/mach-mmp/clock.c | 22 ++++++++++++++++++++++ arch/arm/mach-sa1100/clock.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-w90x900/clock.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 107 insertions(+) diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index f5dce9b4e617..89586779526c 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c @@ -218,6 +218,12 @@ int clk_set_parent(struct clk *clk, struct clk *parent) } EXPORT_SYMBOL(clk_set_parent); +struct clk *clk_get_parent(struct clk *clk) +{ + return clk->parent; +} +EXPORT_SYMBOL(clk_get_parent); + int clk_register(struct clk *clk) { if (clk == NULL || IS_ERR(clk)) diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index 39ef3b613912..c1c91fc6e178 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c @@ -323,6 +323,27 @@ unsigned long clk_get_rate(struct clk *clk) } EXPORT_SYMBOL(clk_get_rate); +long clk_round_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_round_rate); + +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + +struct clk *clk_get_parent(struct clk *clk) +{ + WARN_ON(clk); + return NULL; +} +EXPORT_SYMBOL(clk_get_parent); + static int set_keytchclk_rate(struct clk *clk, unsigned long rate) { u32 val; diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c index 28fe64c6e2f5..78513f74ae8d 100644 --- a/arch/arm/mach-mmp/clock.c +++ b/arch/arm/mach-mmp/clock.c @@ -106,3 +106,25 @@ int clk_set_rate(struct clk *clk, unsigned long rate) return ret; } EXPORT_SYMBOL(clk_set_rate); + +/* Dummy clk routine to build generic kernel parts that may be using them */ +long clk_round_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_round_rate); + +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + +struct clk *clk_get_parent(struct clk *clk) +{ + WARN_ON(clk); + return NULL; +} +EXPORT_SYMBOL(clk_get_parent); diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index 0db46895c82a..a602d876c231 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c @@ -35,6 +35,35 @@ struct clk clk_##_name = { \ static DEFINE_SPINLOCK(clocks_lock); +/* Dummy clk routine to build generic kernel parts that may be using them */ +long clk_round_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_round_rate); + +int clk_set_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_rate); + +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + +struct clk *clk_get_parent(struct clk *clk) +{ + WARN_ON(clk); + return NULL; +} +EXPORT_SYMBOL(clk_get_parent); + static void clk_gpio27_enable(struct clk *clk) { /* diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c index ac6fd1a2cb59..3f93fac98d97 100644 --- a/arch/arm/mach-w90x900/clock.c +++ b/arch/arm/mach-w90x900/clock.c @@ -93,3 +93,32 @@ void nuc900_subclk_enable(struct clk *clk, int enable) __raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK); } + +/* dummy functions, should not be called */ +long clk_round_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_round_rate); + +int clk_set_rate(struct clk *clk, unsigned long rate) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_rate); + +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + WARN_ON(clk); + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + +struct clk *clk_get_parent(struct clk *clk) +{ + WARN_ON(clk); + return NULL; +} +EXPORT_SYMBOL(clk_get_parent);