From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B970C433DF for ; Thu, 6 Aug 2020 18:42:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50047221E2 for ; Thu, 6 Aug 2020 18:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596739331; bh=NRxqjOGqoPFTWLmHKMktE6m1euhpzWseKiiSJ0AcWmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MHklLqSgMV5Zo9AW7z8JYiXrRWP1OK6hRcAIxvvJq74XU79b5rPah+oGs4/1OUGG5 iIeor1c7RqrTXBMKoMMkZFUHGeoE2DOyl3LBjyNL5Wq3++joVDINjWV/ht0c59+wAD BTFaUb9rGisemGsgG2PLz4hs5GDULFvq45Yf7T9U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730145AbgHFSmH (ORCPT ); Thu, 6 Aug 2020 14:42:07 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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) -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1B04C433DF for ; Thu, 6 Aug 2020 18:23:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BD9122DFB for ; Thu, 6 Aug 2020 18:23:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="obHSiqF7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="j35u3MXT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BD9122DFB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6QzmrUXXavzEZnU3JayMdYhV7wRDFX6ssqRRTj9ts3I=; b=obHSiqF7xzTZshki6cOPvpjgZc Uc6QtPtCIfvWq7VZl+xXqAanuKnYMFc3cj1NUp28ZvlE8u86uiC5cdvYrrOpcwBuezXgEJLpga8y7 YLEyJyx+SG0Adl2+xCMufttSIa2O+cfAK9ZIGnSbxyjEN0gT97QGyP6HefwcRsvbkrsvQpiLm63VS 00gGZ9B2lIZhHT9yv3yAeozAgI5pK9af5xTZ9KA8w9oMxk144Fa1yps6aCK1uVsn7H2fBqQrJScHi gAaflBN3ZxMMDd6tAZY137i/aA4p5WD867789mFQelbOVkTG9rtxoWuUwmX4uwZ/ON8bSv4TN0w9C tI+mU+Hg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3kWk-0007uG-TA; Thu, 06 Aug 2020 18:22:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3kWg-0007sN-Ij for linux-arm-kernel@lists.infradead.org; Thu, 06 Aug 2020 18:22:03 +0000 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200806_142202_798205_8FA1CA24 X-CRM114-Status: GOOD ( 20.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, Arnd Bergmann , Stephen Boyd , Michael Turquette , Tomasz Figa , Krzysztof Kozlowski , Russell King , Chanwoo Choi , Kukjin Kim , Sylwester Nawrocki , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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(-) 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) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel