From patchwork Thu Aug 6 18:20:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 247531 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1747268ilo; Thu, 6 Aug 2020 11:41:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8II3V4DotVrqcCmbaBGcQJiNrHfcWCqG85T9dUSxFKETcXs4pfMcLmn7dPLC25r73QrmP X-Received: by 2002:a17:906:f8d9:: with SMTP id lh25mr5927950ejb.458.1596739318952; Thu, 06 Aug 2020 11:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596739318; cv=none; d=google.com; s=arc-20160816; b=bEhvIagpJaRA3596/BA3merX9a6Vd3wFWWq/vgs0IlApMLKUybbL5r7RDDM1FgvlBP zPm8/ZJ+YOMEV3DMFDiwKkfN4uo20EJkfg4MZY6YVAuVC3Tt99oWxH/qsOhEExnCD/3K NsbNHTqapYUwUerW0UcF1MSND+I1U5x94VIG8yrGA6b3dI1JjmNZ22wo421OUCtgKhRR 6KdRK2UOsyUaR8R9tKRiUXLkRcBCalXJ2YZXQ+KuNLhHDCMBu7KpWWJcmf5JCGWKwy4d OT4XSXZHd5OxbJ0gALW+R3NK09pg34085SeErlliHyaulECfvplrkXKrxH+G2xGCO4hI qHMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=5fmsOr+E0f7f7JxNMikB2FV6OPHFQ+GubGbLn2hnIOU=; b=B3CqND5iW2pFct8B9GOM7um52zrXKV3OHCMPGf12ySVHbdSonsRrGjrFWvHbJPiyAy KaJgqbjXHqMCUN9Uo6EeaBMqCKXrIJU8sDrKk8Dnd1pJnhw8dUKKFz5/OrKG0oloY/JL Ky9eMcjrMZfulwJIs+nCbhHzS71C372Vnu0xKkenUlNvGCehAy1lMrtEP33Y/Vpp5g8o 6obOOGH9BNJBuSnTKMM7yDywpJfmyHbL72EbGsNVQSCjroqoPRzP9PHRP7o9etpZyJ0L qmGUW2IRgzGRFaH8DniJLcThAPKN0qGj4Uqaj4WoNmHUV3stf1FZHLcWzbX34oHj2JHn MB6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j35u3MXT; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si3582997edr.130.2020.08.06.11.41.58; Thu, 06 Aug 2020 11:41:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j35u3MXT; spf=pass (google.com: domain of linux-samsung-soc-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729806AbgHFSl5 (ORCPT + 4 others); Thu, 6 Aug 2020 14:41:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:50308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728303AbgHFSXb (ORCPT ); Thu, 6 Aug 2020 14:23:31 -0400 Received: from localhost.localdomain (unknown [194.230.155.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7AE7622D00; Thu, 6 Aug 2020 18:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596738122; bh=NRxqjOGqoPFTWLmHKMktE6m1euhpzWseKiiSJ0AcWmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j35u3MXT45QA/tPevvXazqEanrPD2LI2UfrNwXKhljiD/b9HapLDz+kRmx9VdG9or jdvh70v5fZf8gKQ3wdxNfY0TAzO+yjGzdD3Hxp1pnTSz1l76MtdSzNJRaIfZOw6nWN D486RGZpDRuSJIfYdpl4/beyb7K4z41bT2N6tDR4= From: Krzysztof Kozlowski To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Krzysztof Kozlowski , Russell King , Sylwester Nawrocki , Tomasz Figa , Chanwoo Choi , Michael Turquette , Stephen Boyd , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v2 05/41] ARM: s3c24xx: make S3C24XX_MISCCR access indirect Date: Thu, 6 Aug 2020 20:20:22 +0200 Message-Id: <20200806182059.2431-5-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806181932.2253-1-krzk@kernel.org> References: <20200806181932.2253-1-krzk@kernel.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Arnd Bergmann 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 Signed-off-by: Krzysztof Kozlowski --- arch/arm/mach-s3c24xx/common.c | 3 +++ drivers/clk/samsung/clk-s3c2410-dclk.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) -- 2.17.1 Reviewed-by: Stephen Boyd diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index 0d55e88ee0a8..222238e8acbb 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c @@ -668,5 +668,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 7dad9098e897..3e0f23e8ec21 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)