From patchwork Thu Oct 10 20:29:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175847 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2797419ill; Thu, 10 Oct 2019 13:31:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqwZtAPzcb42hPG4l/wgImEvKikRFQ8mC7+ZrkKdX0lBUDBlAZnuswwe3B+9m5jt2kDg3U X-Received: by 2002:a17:906:6a15:: with SMTP id o21mr9947865ejr.79.1570739462607; Thu, 10 Oct 2019 13:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739462; cv=none; d=google.com; s=arc-20160816; b=Zz/mmLTbqdwb0Hx/igcRgxgv/lG5gZL4EYXMVY8Jqy4Z9NKbNvYNOjPAxgb6hGvn6a kfR8l+20FmcuKTD7yR0nzztawlDkuLW3KvxovwUtTXIyUzg2d4oQr/T07AFAtBzCHeQQ LQYDEnqvdHkzbgav+gS4IdJaxT6Bz/VWuiP2dYoP4RNaAYT9B0BVqs7xWCr39vtGSUs1 liog7RzHeetFvbinj0timYGc6hhJzecNuugNtotNPt6zWJn4w2CBhXavuiVVZ8vbYVXx zOvy75fmap6ECI2c3CnqkvwM3oC0OwFGPxNvHh4xmN72TEjC18oG22x7gVD1QdFPvg2J vAHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=b8JRaSplep8F7kAXHZ9UnXhGbXlF5N/xbRStPBZSM/U=; b=k0wqZm1+QPrdx4ESoIf1M3OwxHbrrX/SXKUknMca/8t1312JekUctBI1X2j2V9/N2y xHx0Oyq4k8F3qW7WePGiZ6ZGjcVBxNNCt5fWQroKVCBSEFgk/gvl6qY00bEq8HM75iLo JL8EJVB/yOAfIrEbUhd6FRfVskYv4P5dWNTtEMK/0fOeGGSM/RFX37KTHifCnB49tR3N bMbkK5/5oWciW23zEnnJ4F++LEkdnOUKEop/sOteCd/OksrNA3TeXm+EKv0d3+3SXS9/ X8o7iU45lCX685t/kdpM9IvU75Ao4f6ol8qLZmz8qg6b6gTYTrw18dXFIagdyFGuweU2 +rsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.31.01; Thu, 10 Oct 2019 13:31:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727364AbfJJUa6 (ORCPT + 21 others); Thu, 10 Oct 2019 16:30:58 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:40223 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfJJUa5 (ORCPT ); Thu, 10 Oct 2019 16:30:57 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1M76jv-1iA7xr2etz-008WlZ; Thu, 10 Oct 2019 22:30:44 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Sylwester Nawrocki , Tomasz Figa , Chanwoo Choi Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 01/36] ARM: samsung: make S3C24XX_MISCCR access indirect Date: Thu, 10 Oct 2019 22:29:45 +0200 Message-Id: <20191010203043.1241612-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010202802.1132272-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ePLzvj7/CcvBZWd9/hVzvTOtmqd1jBEPawLsZLAlTOvjHU9Blp0 tvxX+UeVAWK0nrC7dGI+hFjF8ptcLrjrkZNrN1/uNRe+uaNHpuu2BxrAFpK9lILdg4Kj5GH JUyKX7A09rEBq4diiC18Z0WoqEb+HshWV0vBBd3lWJmlI9+0Kf3EIUQ1g4JogJyATj7uv+x eMo6Lt9LmrEqY9ZyRGCZA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:p+vtab0Sm4g=:GZ7JjxHd28lp/BUZHy55/p b9I5JvBFzQsD16r9zrfKLjJ5zalwgRAiq/aD/2IFvOdvFT72F5T/lS/DlazeTamoLZsSS/X04 mKee0zxPCOxG1iYddhlMCoHPUsmBSRePPJIvvWvLhieiH9YW0+BlgMGVG/6Wr+IceowcHuRxZ yQHylOXnOnpDglBkIRt6/qpzw39wUuLc1zI6hrFH420KpQzYVrB5lJsaE/ojDI9RnzIky8U9G 4fvej/0S799sglaZhKk1G0PSEKgYy8GJSBwrO1/urLdKdj/hxgOUaesBjta4gi7AFk3XNzxnK c6evzMifq7jGzWo48d+THy66ClEQuqbFZhxZEoQQLoYNka0K5pdwhgdMVevI4Zs4v5Pg04LlK X0MvJQ5fy8ogANXieli/NIJH15cHvdR4YuAT2hSdW+wCjNbJNQzO1CVSkPpxRQvxgXwQvNpaU TuOz6XyrB8bqiOdKiIWgi94Uc4Ts07dgo8znCybeGKJgKpJ75gfhCCrSR+xKs8DbJyopza9um Hv6aI1VN1XK1MJ06/ESbj+wrKSh9THAhq2P098AbLclaTHFYy4enQZQ9T5Te0tl+q+6/DueLe 8CY4X3pswccFQeZtOtRqOLZ/AekCpg0LiFMi6TBAZYP1yz2lkYTmigk1LOKDqPApclK+8PoQ3 87kIeHnio6OFfq5FCtr/hN4bwvr3ttcBvyd1tJdYKGk99bLPLRWK8cRwAmdbVCYlnNbslk9kw 8u4vrXdL8NT3UWlX90wxJSbcUoKF9+lTxFan3Cuv4EVvPVlUsnYW/ckcLtE/FrNPVbHEORV+7 3yoOX40qgdQvdqA4yek9OrFe07/3c1B0m5RpVzCb6JjARIHKrdj/tB7SbtKinMz6keJyuwGMl nMMhZ3QF99zmHauGWf8A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The clk driver uses both a function call into an exported platform file and a direct register access to a hardcoded virtual address for accessing the MISCCR register, both become are a problem for a multiplatform kernel because of the header file dependency. Make this an indirect function call through platform data instead. Signed-off-by: Arnd Bergmann --- arch/arm/mach-s3c24xx/common.c | 3 +++ drivers/clk/samsung/clk-s3c2410-dclk.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index 3dc029c2d2cb..ebf6bde67816 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c @@ -667,5 +667,8 @@ struct platform_device s3c2410_device_dclk = { .id = 0, .num_resources = ARRAY_SIZE(s3c2410_dclk_resource), .resource = s3c2410_dclk_resource, + .dev = { + .platform_data = s3c2410_modify_misccr, + }, }; #endif diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c index 1281672cb00e..fbcec0252c45 100644 --- a/drivers/clk/samsung/clk-s3c2410-dclk.c +++ b/drivers/clk/samsung/clk-s3c2410-dclk.c @@ -14,10 +14,6 @@ #include #include "clk.h" -/* legacy access to misccr, until dt conversion is finished */ -#include -#include - #define MUX_DCLK0 0 #define MUX_DCLK1 1 #define DIV_DCLK0 2 @@ -52,6 +48,7 @@ struct s3c24xx_clkout { struct clk_hw hw; u32 mask; u8 shift; + unsigned int (*modify_misccr)(unsigned int clr, unsigned int chg); }; #define to_s3c24xx_clkout(_hw) container_of(_hw, struct s3c24xx_clkout, hw) @@ -62,7 +59,7 @@ static u8 s3c24xx_clkout_get_parent(struct clk_hw *hw) int num_parents = clk_hw_get_num_parents(hw); u32 val; - val = readl_relaxed(S3C24XX_MISCCR) >> clkout->shift; + val = clkout->modify_misccr(0, 0) >> clkout->shift; val >>= clkout->shift; val &= clkout->mask; @@ -76,7 +73,7 @@ static int s3c24xx_clkout_set_parent(struct clk_hw *hw, u8 index) { struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw); - s3c2410_modify_misccr((clkout->mask << clkout->shift), + clkout->modify_misccr((clkout->mask << clkout->shift), (index << clkout->shift)); return 0; @@ -110,6 +107,7 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev, clkout->shift = shift; clkout->mask = mask; clkout->hw.init = &init; + clkout->modify_misccr = dev->platform_data; ret = clk_hw_register(dev, &clkout->hw); if (ret)