From patchwork Mon Apr 15 10:10:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7451C1669 for ; Mon, 15 Apr 2019 10:11:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 579B22889B for ; Mon, 15 Apr 2019 10:11:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55CB028904; Mon, 15 Apr 2019 10:11:12 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDC6E2889B for ; Mon, 15 Apr 2019 10:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=cr8z1EVXGfAf+LKEVeuzO+IDr9YYucr6Bfw5kIBZGgQ=; b=NsQuORFfQRkugMsSqp8Ff2vQUW kqLiO8KZjZ0/IL7hmHI4oZCwK3TnPmFi2aIq5Z5VDve6PP3YKyqWEK/DC8orPu1RH/IC7iocu80Gi XNCuOGX83r6HNUKI+RLqDQCjkxIby3eJNsIh6U6A7x5ep9tjr9eTttL1H9qY2HLRwxhTEjA9TYyIp iqUoZQRnVpIexaOz1YoJaPzTQ2h/trbzY0LnXCVtTj8NeqmRZxtVgKsJRivjCGcj1rfOFSvrQMCF2 NbAKWbjyUxgVjwbHoxd7SglDnNr7lMfwYP28UuE45oaJah0LkFUKL3ftpmPcD4Xd07UqNdlSzrQj2 NI8ucu7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZx-0003zH-2x; Mon, 15 Apr 2019 10:11:09 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZh-0003hf-Nd; Mon, 15 Apr 2019 10:10:55 +0000 Received: by mail-wm1-x342.google.com with SMTP id z24so19740023wmi.5; Mon, 15 Apr 2019 03:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cSD6PBow7v0W8TwFUmI5O2Pxk6CBw7ocNAAJAAXdWg8=; b=Znubu+SBnrloeNAT8sZMfuxqeFCVL60+47/i85ZzPS2cuhM8KEu6rEJmwddEvfM/hN 8OMOgxgRo3C+7g+dQ9yMUA7FD3kUFXHByFUZmOD1FfqUpnaQYevYG6u+3orpJtLY7MDi fXKlHkpbpnv57up630V0jzQwAEm+nNyB+6hKhhhYfGlZ28qMJitYKjLQDvBIMXjs13VA sSuRsFrhSiVlJlmJIxdqNl9kOo0nwazv/ZkUTF3o/jkzKn9qJZItZMEGF41KR9bfzSYD SfSYhh6daMKDFH3gI22x6lXl8KGapgnYmxc0N9yrtXYfkZczK37KlYK0gSEqilvOYkwL 5tsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cSD6PBow7v0W8TwFUmI5O2Pxk6CBw7ocNAAJAAXdWg8=; b=s6BKTPrGZ74GuBWlNDzm2z5ZwD56LDAX1Pvb0N6CgNBIDT+Cfda6XmlvSp44zCbNj4 7PvAE/OuDT7OP9S+IpbL2TjW/ez+JXKJ4QpI0G428wolTpzGOTEBXhZMloZT16JEMkGj aPC3Kjii8nSP7c2mPTkG3I6yCKZttaUF7g7DvLPBINxcd8khpVli0MnejnLDTLClz7pN Iw5DTna/RIy8ZeJoO5+ceRVDB2TTJUMWNBahLHyiRTzN+n3qbHvSwgSueirGex7Eqbin /vybO6Gas13wLvBhANiFdez1NKEA7EeAIlrNGPZ3MyhzQ00fkY72n8sZoNtuxheqaGjq qDkQ== X-Gm-Message-State: APjAAAVleYeJXYYSDP7XROcP8SGOiY6QbplJtjUIZcUWOuSj58roDm2z luwIH5y5xhwTVEDYiHo+T+M= X-Google-Smtp-Source: APXvYqzNxdl1PhIO1oOobESMBfrW0DrNzXt6hIBogeVrQpk/WjkC/3DOHfN+kDsMgbMux6PsbVAqxA== X-Received: by 2002:a7b:cd95:: with SMTP id y21mr21860173wmj.29.1555323052152; Mon, 15 Apr 2019 03:10:52 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.10.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:10:51 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 1/8] clk: divider: add explicit big endian support Date: Mon, 15 Apr 2019 12:10:39 +0200 Message-Id: <20190415101046.5872-2-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031053_767686_88298398 X-CRM114-Status: GOOD ( 15.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a clock specific flag to switch register accesses to big endian, to allow runtime configuration of big endian divider clocks. Signed-off-by: Jonas Gorski --- V1 -> V2: * switch from global to local flag drivers/clk/clk-divider.c | 26 ++++++++++++++++++++++---- include/linux/clk-provider.h | 4 ++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index e5a17265cfaf..ff791a7a5e9e 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -25,6 +25,24 @@ * parent - fixed parent. No clk_set_parent support */ +static inline u32 clk_div_readl(struct clk_divider *divider) +{ + if (divider->flags & CLK_DIVIDER_BIG_ENDIAN) + return ioread32be(divider->reg); + else + return clk_readl(divider->reg); +} + +static inline void clk_div_writel(struct clk_divider *divider, u32 val) +{ + if (divider->flags & CLK_DIVIDER_BIG_ENDIAN) + iowrite32be(val, divider->reg); + else + clk_writel(val, divider->reg); +} + +#define div_mask(width) ((1 << (width)) - 1) + static unsigned int _get_table_maxdiv(const struct clk_div_table *table, u8 width) { @@ -135,7 +153,7 @@ static unsigned long clk_divider_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); unsigned int val; - val = clk_readl(divider->reg) >> divider->shift; + val = clk_div_readl(divider) >> divider->shift; val &= clk_div_mask(divider->width); return divider_recalc_rate(hw, parent_rate, val, divider->table, @@ -370,7 +388,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, if (divider->flags & CLK_DIVIDER_READ_ONLY) { u32 val; - val = clk_readl(divider->reg) >> divider->shift; + val = clk_div_readl(divider->reg) >> divider->shift; val &= clk_div_mask(divider->width); return divider_ro_round_rate(hw, rate, prate, divider->table, @@ -420,11 +438,11 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { val = clk_div_mask(divider->width) << (divider->shift + 16); } else { - val = clk_readl(divider->reg); + val = clk_div_readl(divider->reg); val &= ~(clk_div_mask(divider->width) << divider->shift); } val |= (u32)value << divider->shift; - clk_writel(val, divider->reg); + clk_div_writel(divider, val); if (divider->lock) spin_unlock_irqrestore(divider->lock, flags); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index db21437c77e2..7117b8cc0c0c 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -416,6 +416,9 @@ struct clk_div_table { * CLK_DIVIDER_MAX_AT_ZERO - For dividers which are like CLK_DIVIDER_ONE_BASED * except when the value read from the register is zero, the divisor is * 2^width of the field. + * CLK_DIVIDER_BIG_ENDIAN - By default little endian register accesses are used + * for the divider register. Setting this flag makes the register accesses + * big endian. */ struct clk_divider { struct clk_hw hw; @@ -437,6 +440,7 @@ struct clk_divider { #define CLK_DIVIDER_ROUND_CLOSEST BIT(4) #define CLK_DIVIDER_READ_ONLY BIT(5) #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) +#define CLK_DIVIDER_BIG_ENDIAN BIT(7) extern const struct clk_ops clk_divider_ops; extern const struct clk_ops clk_divider_ro_ops; From patchwork Mon Apr 15 10:10:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F51B1669 for ; Mon, 15 Apr 2019 10:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21AAA288BA for ; Mon, 15 Apr 2019 10:11:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F2DE284F5; Mon, 15 Apr 2019 10:11:49 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C2B712884E for ; Mon, 15 Apr 2019 10:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=XsV7SmgRNwztxzG09rTVlKlCrx7wm0LJ8HxcHemCCfU=; b=i/lbKWMPDGV1fHe6W/tUY6KoAY zYF8a0hEMciNwHb6E/Mq3aHdV1VgQx2REIphjz445WhuESgSXoGorDYjSiRTTImPPdIKap5YEV48y HLv5DHpRQOPjZOzX4LbcbxTQaqcnTj/AkmzNeyUX8cMy4gLQ+9iQKE1JTn3hlwJ0s8syIDNVcjvA2 TxS+uZNm4VBWzBosIHH15KlLwtQQTXoYHhgNT1X1e1GkRfX3U/V6ohniiFxhmxdI0kuCJlMt3zaW+ 3vYXGWY+lTmSuStGX4vQCNWWtsShS2y9o5tnV9LcQoyII3oTC+lh25PF94v7Aj6buN0vQ0jUnIXHt pSbn/sMg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyaZ-0004f8-TV; Mon, 15 Apr 2019 10:11:47 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZj-0003i1-Bi; Mon, 15 Apr 2019 10:10:57 +0000 Received: by mail-wr1-x441.google.com with SMTP id h4so21149903wre.7; Mon, 15 Apr 2019 03:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o+W2Q634iC3zR2xiEnI5jQwiq7sivbZ81nwPB9eB+tU=; b=gztGjS1hRk4mVTO/iq0Zf3l+AJuYNqz3qjgBMCKMLcEtjTKD1dvxU280eEopc1zqjp 3mVduNg2l6/zUug56BWIGoXgTufkNUR1/GVyyxNeN/v0wFu5hSzGt9z0pBZrFdjHT2JJ FEJBOb31onNhjnwqgxnUDN+Ht3ExstBL4lIlKhhOsIzbsvbedk2DPwC7LDCjnx0hnf3J 6fGKL1Vy9WALTgeQXrtDvb3HvSuH453GwBjxEeLvHiwKJ1KWfowHFSpApbN/60681UAx S7F5tovZ3qcr/9qOTlt2gVrRqjl1AErzJq1UEmFkoH2+C4RrlnByh7gdGymRaUO1IKuX 6YLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o+W2Q634iC3zR2xiEnI5jQwiq7sivbZ81nwPB9eB+tU=; b=fjntMKksp14zVbCItyfek0deBzOp8zkrOCxYJS2ONDXQ7BPpi60fdH2AS3rvwtBysc I3MHmEHUIglpQFovJJk7QvL+kJ4gYOPwE6tjZF3+nE3iSz2CBRU1AF+IKuXBGuwoUfvN 9KHBLB+udMpm8nZzwAyqEfGEFPOYk+w44UaHGPKJkB/hTkhCA0LpwgQRxsKoGtmJoxSv hG1YJNk/ImHhyGARXKSpALw8tSzy8mmW1EQFDg/wOQVlXApHAIw0fUTKAOdZnJ0vrw3c HfM1AvqM+8SMnCGswoqfzRUz/tv94WKhI71A+2wBqsNxVeN+JjJo8Tqmrn2QF7i4Irpz Obkg== X-Gm-Message-State: APjAAAUI4VCyFJi6oT3WLkB/XBgdPTh0jmtO8y9ACxkicStceg6micXq Srd0DTddGYr8f6boIrzUrWcZCgbpqL0= X-Google-Smtp-Source: APXvYqwjGrmwlbP67cAxOBoWrpPk6FwlPj8xUIyK9GJsk2OjFotgQsFgHX7W7vJb9Un2uuMuRW2EUg== X-Received: by 2002:a05:6000:1286:: with SMTP id f6mr13099948wrx.93.1555323053789; Mon, 15 Apr 2019 03:10:53 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.10.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:10:53 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 2/8] clk: fractional-divider: add explicit big endian support Date: Mon, 15 Apr 2019 12:10:40 +0200 Message-Id: <20190415101046.5872-3-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031055_494672_9A90F5A2 X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a clock specific flag to switch register accesses to big endian, to allow runtime configuration of big endian fractional divider clocks. Signed-off-by: Jonas Gorski --- V1 -> V2: * newly added patch drivers/clk/clk-fractional-divider.c | 22 +++++++++++++++++++--- include/linux/clk-provider.h | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index fdfe2e423d15..b9988d3b3828 100644 --- a/drivers/clk/clk-fractional-divider.c +++ b/drivers/clk/clk-fractional-divider.c @@ -13,6 +13,22 @@ #include #include +static inline u32 clk_fd_readl(struct clk_fractional_divider *fd) +{ + if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) + return ioread32be(fd->reg); + else + return clk_readl(fd->reg); +} + +static inline void clk_fd_writel(struct clk_fractional_divider *fd, u32 val) +{ + if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) + iowrite32be(val, fd->reg); + else + clk_writel(val, fd->reg); +} + static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -27,7 +43,7 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, else __acquire(fd->lock); - val = clk_readl(fd->reg); + val = clk_fd_readl(fd); if (fd->lock) spin_unlock_irqrestore(fd->lock, flags); @@ -115,10 +131,10 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate, else __acquire(fd->lock); - val = clk_readl(fd->reg); + val = clk_fd_readl(fd); val &= ~(fd->mmask | fd->nmask); val |= (m << fd->mshift) | (n << fd->nshift); - clk_writel(val, fd->reg); + clk_fd_writel(fd, val); if (fd->lock) spin_unlock_irqrestore(fd->lock, flags); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7117b8cc0c0c..8c07d810acf5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -607,6 +607,9 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw); * is the value read from the register. If CLK_FRAC_DIVIDER_ZERO_BASED * is set then the numerator and denominator are both the value read * plus one. + * CLK_FRAC_DIVIDER_BIG_ENDIAN - By default little endian register accesses are + * used for the divider register. Setting this flag makes the register + * accesses big endian. */ struct clk_fractional_divider { struct clk_hw hw; @@ -627,6 +630,7 @@ struct clk_fractional_divider { #define to_clk_fd(_hw) container_of(_hw, struct clk_fractional_divider, hw) #define CLK_FRAC_DIVIDER_ZERO_BASED BIT(0) +#define CLK_FRAC_DIVIDER_BIG_ENDIAN BIT(1) extern const struct clk_ops clk_fractional_divider_ops; struct clk *clk_register_fractional_divider(struct device *dev, From patchwork Mon Apr 15 10:10:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEADE1669 for ; Mon, 15 Apr 2019 10:11:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DEC1288AE for ; Mon, 15 Apr 2019 10:11:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B6A228678; Mon, 15 Apr 2019 10:11:28 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BBED2889B for ; Mon, 15 Apr 2019 10:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=AlvdW+uurl6gwrJ7CMgnIkiqp8V5frDFbo15YjEdHfk=; b=cx2054hD4Pnz+ynHwNx2M0IuJ3 tbLLl08218ZC3aRrNTClS7ndSYO1gUjEx1+3l2SNIij39hIMxl52Ng40F9q9+OrV/MwqDZaGl1iFg L4syhEu34Dw1eUJxV9bIwFfagZ6bKNMb0yVwcVWUFZgQYgTIxMhkeIbTLAA2FTvmtPisyGq9MaEfu WxW4sQpCS9aDjEAR/HZK8DRRK/n+cJuhYKMAJ/xRvRboqoy9mAd5SwdBHx953H61NMgR+R3WwwJAt fIxkzkPBLoAzU2GjCio7vz2iYizSGPQ9hb+g70kl918dL0oY7QUQtVFvvKKqvn4gbosG1hl3QPIZT U6SEyd+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyaE-0004ID-74; Mon, 15 Apr 2019 10:11:26 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZl-0003jh-I7; Mon, 15 Apr 2019 10:11:01 +0000 Received: by mail-wm1-x342.google.com with SMTP id 4so19880841wmf.1; Mon, 15 Apr 2019 03:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0DzTJysZxO15MPQ7kqYMW+n479fJgtxXcOuK6TSaMOY=; b=rvd99lJGUbu0PxIfKZBydyMyHcMRBVRstZMvv7xY86ibl0HhEWK6WLbj4kToX2g5c+ kpvz8UEBYyKpYwK/LmVh6c7orT1KPp5CmN+qZahxMfllHlE86MOyWEN8ekUc1XGt3Rgt KugqFdGcBiGk24zQ+g4PNL1pGUi14PiLUbHjI/87Ht0TpCldR9JAYf3xKTVRfdJRfPE+ JgVdX89pzQovf2vyHTytIrczXYVYx1PrgGSnn85RtYZkSIF/BfMt52XT28AM5ucwadWW svWpsLin2Fq3UfQIMeA8dLmFF69fFfEetIc3SFWXFJWlSeqsKo/IKEZtXW6ZXdH/0BzI f/GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0DzTJysZxO15MPQ7kqYMW+n479fJgtxXcOuK6TSaMOY=; b=dC90SmfHypluS5vJm7R/8z963VsCXWtQq7yKXGwIaPTeWL9G4ukD/+VucN1xXUPGhw RLwHcbgiWb2iPRCIwpNQVJBdp7rvihq2laUWOoBcyoTnymlY96MeIZ5eNFvKJgjitPB3 tp7FtqSqhLt77jWccl24vsUFDgOVifWitxQZB31d38JqmkQgngcanu7bbLYPCTVg8YAF bHAvJ+1dpBvyfWrzR4mCGkLtzjaPyV5w7Y/E4p/fmA3Fb56hv7PNFc4pdrh00lbyxiJq fWpCUF4pAYyjWnPNkhx/nPCgQORxcSbFHZrjqD+BA5ayb9ncZSEpCKZ8sjH587EvIbEF Xyig== X-Gm-Message-State: APjAAAW3Kk4NADwwTdRUG422PbAXTWBbMKYpnxNfLFoHJRQlo/b8/Aas uDgRdYssGbFlKdI7PH3P4q0= X-Google-Smtp-Source: APXvYqxsvH0Rc7MHGSQ5oXiwFD2EUfMonfSwzm6bqTZnIhCPTVMeStUOT1R7Tz14Ms6g+WEJB2kWAw== X-Received: by 2002:a05:600c:24f:: with SMTP id 15mr22249991wmj.48.1555323056233; Mon, 15 Apr 2019 03:10:56 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.10.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:10:55 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 3/8] clk: gate: add explicit big endian support Date: Mon, 15 Apr 2019 12:10:41 +0200 Message-Id: <20190415101046.5872-4-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031057_934764_63198021 X-CRM114-Status: GOOD ( 15.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a clock specific flag to switch register accesses to big endian, to allow runtime configuration of big endian gated clocks. Signed-off-by: Jonas Gorski --- V1 -> V2: * switch from global to local flag drivers/clk/clk-gate.c | 22 +++++++++++++++++++--- include/linux/clk-provider.h | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index f05823cd9b21..521e112ef5b5 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -23,6 +23,22 @@ * parent - fixed parent. No clk_set_parent support */ +static inline u32 clk_gate_readl(struct clk_gate *gate) +{ + if (gate->flags & CLK_GATE_BIG_ENDIAN) + return ioread32be(gate->reg); + else + return clk_readl(gate->reg); +} + +static inline void clk_gate_writel(struct clk_gate *gate, u32 val) +{ + if (gate->flags & CLK_GATE_BIG_ENDIAN) + iowrite32be(val, gate->reg); + else + clk_writel(val, gate->reg); +} + /* * It works on following logic: * @@ -55,7 +71,7 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable) if (set) reg |= BIT(gate->bit_idx); } else { - reg = clk_readl(gate->reg); + reg = clk_gate_readl(gate); if (set) reg |= BIT(gate->bit_idx); @@ -63,7 +79,7 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable) reg &= ~BIT(gate->bit_idx); } - clk_writel(reg, gate->reg); + clk_gate_writel(gate, reg); if (gate->lock) spin_unlock_irqrestore(gate->lock, flags); @@ -88,7 +104,7 @@ int clk_gate_is_enabled(struct clk_hw *hw) u32 reg; struct clk_gate *gate = to_clk_gate(hw); - reg = clk_readl(gate->reg); + reg = clk_gate_readl(gate); /* if a set bit disables this clk, flip it before masking */ if (gate->flags & CLK_GATE_SET_TO_DISABLE) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8c07d810acf5..8576c2dbc639 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -348,6 +348,9 @@ void of_fixed_clk_setup(struct device_node *np); * of this register, and mask of gate bits are in higher 16-bit of this * register. While setting the gate bits, higher 16-bit should also be * updated to indicate changing gate bits. + * CLK_GATE_BIG_ENDIAN - by default little endian register accesses are used for + * the gate register. Setting this flag makes the register accesses big + * endian. */ struct clk_gate { struct clk_hw hw; @@ -361,6 +364,7 @@ struct clk_gate { #define CLK_GATE_SET_TO_DISABLE BIT(0) #define CLK_GATE_HIWORD_MASK BIT(1) +#define CLK_GATE_BIG_ENDIAN BIT(2) extern const struct clk_ops clk_gate_ops; struct clk *clk_register_gate(struct device *dev, const char *name, From patchwork Mon Apr 15 10:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A3E0922 for ; Mon, 15 Apr 2019 10:11:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E26AF28587 for ; Mon, 15 Apr 2019 10:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFB1428892; Mon, 15 Apr 2019 10:11:58 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 854F2288BA for ; Mon, 15 Apr 2019 10:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=aK9+snJPPBdvOK7ICYYoA0NBOT4VZvvcpU8a9XzvyqY=; b=oBb4KrUJSVqfDF7XwNIODm7DW5 v1cIk+hS+/3e/dvXszG46w0SMUL9/EJGwxGi2Xb/lZrsJG1cSNEaYml0SEhDnhPzhovaYgRMrJXVJ 0L1ILocZo/DoAcAG8RpqXfyuCC6/KLFvdMQtgZ61MSyxb7Twm6nn0DPOvmAG353BZdeZimBoNgmIO hKspPaFMNEbOsEeERaMtSRgNbc2scOGhmsi+MsdOdnOkyn+UQ/7SSGNRUofwXxUVsmpR9eutW5fJQ q5OoVr9wt80weT5duc+ccQ8f8XbfRkV1FLH1hGO6stik085LHc6XTntXML1tyObyBxtwc+ZChrhpB FkqnHGZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyah-0004rG-7y; Mon, 15 Apr 2019 10:11:55 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZn-0003mM-Gy; Mon, 15 Apr 2019 10:11:03 +0000 Received: by mail-wm1-x344.google.com with SMTP id h18so19631215wml.1; Mon, 15 Apr 2019 03:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OdocwXwJ3rh4kwfXC02eb0oWwurnzLR9MAj+DB02QVg=; b=unVegUezf3xp5NAJ3uaaFz2qj1jvI7tB9oNDrgZUIg3ywpAxWLOr1z8t3mHOXUqUB3 ni6AtLJTn3FK/ozoiLTJSQ0MTx9xY3NgwZb4LpZ+HssMdoKX/IUzPcyg++RFKz02069V JV6IVqMrSGl87D3L0dW4Bx832kjL7/RJGvEqNDxO+Zsi41aFBdzqEe8kTw2ZNaBhv0X3 RCD9UMLh/II2owi+ncMQFtPW9465GQVwF7DNgNK+3gKo+ygzx57N/+7SpXCvR3wvT/m6 nCGNPIEp39TdRYKfA3nPvCRuIds7NI7VBDu3Ae/yXYsgJQnrBAPCMqqJos+eHoYKA9Ui EpkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OdocwXwJ3rh4kwfXC02eb0oWwurnzLR9MAj+DB02QVg=; b=dtywcUPa5HMwBix8kalyMylhuHLHsiufWvETOJRShDjaZ94qKTezxPi9yUbqGL98Qs Cdd9l0C049Ar3y0CWHFRp2sZ5Rfh7uN7q+0NemexsvXhiaflMB3H3MrfrNoAS4svOK+f vzf9vEjSc36QTXuy9TxNvqA8xKuu1J/K7gb2D3cG3k5dyEGljsrkuoq6TIVH2LirJHqZ Jo5ne7tMTxjkCEMNfCKsOEGER8kct+r76pNJFrk1TRshweUCaKi2ci4mtkIWfkHsCYes jZANo7sgKU0wetFOsJGYsJLdrnrgSOfRSjAj6JB2lsm86e2uhK8CobKMYhIE5uPCTs+K qjnw== X-Gm-Message-State: APjAAAUIFzeXahnei+3nr8Zn47fRKEPmc45Suq2aBo6y02L+zi05Oarz mAKixpBPxjadVfH/G3PGyQM= X-Google-Smtp-Source: APXvYqxQ8qfQOyCV+Mgmqtj6HKEKkrAY4bniNY5tMWURoN0nFwuxCZuqpTFJI+y9FSrpJlXQV9gxpw== X-Received: by 2002:a7b:cf2b:: with SMTP id m11mr19829090wmg.56.1555323058192; Mon, 15 Apr 2019 03:10:58 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.10.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:10:57 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 4/8] clk: multiplier: add explicit big endian support Date: Mon, 15 Apr 2019 12:10:42 +0200 Message-Id: <20190415101046.5872-5-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031100_129239_FDE88CE6 X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a clock specific flag to switch register accesses to big endian, to allow runtime configuration of big endian multiplier clocks. Signed-off-by: Jonas Gorski --- V1 -> V2: * newly added patch drivers/clk/clk-multiplier.c | 22 +++++++++++++++++++--- include/linux/clk-provider.h | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-multiplier.c b/drivers/clk/clk-multiplier.c index 3c86f859c199..fb032f7dd407 100644 --- a/drivers/clk/clk-multiplier.c +++ b/drivers/clk/clk-multiplier.c @@ -11,6 +11,22 @@ #include #include +static inline u32 clk_mult_readl(struct clk_multiplier *mult) +{ + if (mult->flags & CLK_MULTIPLIER_BIG_ENDIAN) + return ioread32be(mult->reg); + else + return clk_readl(mult->reg); +} + +static inline void clk_mult_writel(struct clk_multiplier *mult, u32 val) +{ + if (mult->flags & CLK_MULTIPLIER_BIG_ENDIAN) + iowrite32be(val, mult->reg); + else + clk_writel(val, mult->reg); +} + static unsigned long __get_mult(struct clk_multiplier *mult, unsigned long rate, unsigned long parent_rate) @@ -27,7 +43,7 @@ static unsigned long clk_multiplier_recalc_rate(struct clk_hw *hw, struct clk_multiplier *mult = to_clk_multiplier(hw); unsigned long val; - val = clk_readl(mult->reg) >> mult->shift; + val = clk_mult_readl(mult) >> mult->shift; val &= GENMASK(mult->width - 1, 0); if (!val && mult->flags & CLK_MULTIPLIER_ZERO_BYPASS) @@ -118,10 +134,10 @@ static int clk_multiplier_set_rate(struct clk_hw *hw, unsigned long rate, else __acquire(mult->lock); - val = clk_readl(mult->reg); + val = clk_mult_readl(mult); val &= ~GENMASK(mult->width + mult->shift - 1, mult->shift); val |= factor << mult->shift; - clk_writel(val, mult->reg); + clk_mult_writel(mult, val); if (mult->lock) spin_unlock_irqrestore(mult->lock, flags); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8576c2dbc639..9df78e3fb62b 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -667,6 +667,9 @@ void clk_hw_unregister_fractional_divider(struct clk_hw *hw); * leaving the parent rate unmodified. * CLK_MULTIPLIER_ROUND_CLOSEST - Makes the best calculated divider to be * rounded to the closest integer instead of the down one. + * CLK_MULTIPLIER_BIG_ENDIAN - By default little endian register accesses are + * used for the multiplier register. Setting this flag makes the register + * accesses big endian. */ struct clk_multiplier { struct clk_hw hw; @@ -681,6 +684,7 @@ struct clk_multiplier { #define CLK_MULTIPLIER_ZERO_BYPASS BIT(0) #define CLK_MULTIPLIER_ROUND_CLOSEST BIT(1) +#define CLK_MULTIPLIER_BIG_ENDIAN BIT(2) extern const struct clk_ops clk_multiplier_ops; From patchwork Mon Apr 15 10:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5D86922 for ; Mon, 15 Apr 2019 10:12:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C311288CF for ; Mon, 15 Apr 2019 10:12:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FD622892B; Mon, 15 Apr 2019 10:12:14 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F11B288AE for ; Mon, 15 Apr 2019 10:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=dy8/t36FDbAlo0b127qNwEZDyUK7mqoGIjnRWGkGktU=; b=pEHfB6zL42qZN9sqStMCJydk8u uoyOCGo3B1QXXPz6HSkRPJByIYcGbV75XnzH/R+PQlXmqd3vG1BXMac3ARCnZ6s3Qom8Lrh3M5MPo T6i61QXJYKTTXPK3JTekOGlOIWgVTX27+gmSmGV0tT9wrpus2EiISm6WZIVKLFDvJnwPDxntwmX1E xigw8m0vPDIOQfN9zRbLSZl1e7JU+1cu5fAMJS6z/RnP2TKmeo1plPmSUjwyCr3P+AS3pMOA717+6 DsSRVMUY+QDQr4nWNnhVbtURiCrI7raP3+c+g53Syekspys7/NE2ZX8ItZeO3zTGM1p+zpe3NEbXS 8Awcij8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyas-000552-98; Mon, 15 Apr 2019 10:12:06 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZq-0003pZ-64; Mon, 15 Apr 2019 10:11:05 +0000 Received: by mail-wm1-x341.google.com with SMTP id n25so19615447wmk.4; Mon, 15 Apr 2019 03:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GrboAZF3BnjJNJvt9JLXUkPnL7d9/yHPsH0HVH2JN4Y=; b=XlQeaea1fDY3FHmAXvyH27UaBMFNPOXHyoCRGBshG0SHeWTFfslSQE8WAxpWcXgJs2 PdsSiorJe2WTrLDAC69mefgxeAhBOyglj5gR6wLQzENFv9gmWxQQeATXdlSIUYtgwHcS x00R0q6jtOop5hQ2AAFufqZLDQf9MOgYgC7CHL2+8C/zNPBeJVH84mL87+CwDct0AQWT PJzp5Vcv4IT0nIg+XvNP5hSzSjkQb/D/yViyBn/rLi5uC5tNUZ1CHIsHc94+LQeiNrBF 5v7MBqUvQE1AJkvV1E2NWjGn6HxKgMvAJkPSR2G7ydyUeBEooyvfoMDwuYT1jFeUqw2h 4kqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GrboAZF3BnjJNJvt9JLXUkPnL7d9/yHPsH0HVH2JN4Y=; b=PyOHDOQOgdPpXNCOLbDdFBg19nZYWRPQ25g/tzmaEqhiUJK0xQk5aIDVJTPG3jfkIJ +61oMiqaYJZzhHs4VI7i/fBQfLHH+0Clo6C3zAHC0MPII4X6Rm2WDzqv5UE+g6PkeUOv mdjuDTB3rSkjGkWODnRIw3XTt6w2LQc3Ir/80GfByZDvKYH41D/bRcyF6hCntJaJqMGw dCiIfEwflskz88+55PLcMnu+hNfeTfS7xC8AgNsJbbILu+pjv1MJSA9otVQvAv+OnxVy 83tRLXcDt9ed3Rtloi0bx89XsnOMthbFWwtOPzXJGF1iKx/mJH9Jjc2QZa9VR0CnAJhh RxTg== X-Gm-Message-State: APjAAAVoI7Chu1FUCOzj3auApTpmSH1rqxLEHyewWbxBMa1yudrOj3NT VGbBjYkmaoDkfhjO9O7rXKc= X-Google-Smtp-Source: APXvYqx4YIrnaKjtFxaqoF6x/Hk55DKfuyQGcZX+zQoPcFihiNiCA3oA8O89/p25+iSx3jZReIhnvA== X-Received: by 2002:a1c:4187:: with SMTP id o129mr21175746wma.57.1555323060365; Mon, 15 Apr 2019 03:11:00 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:10:59 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 5/8] clk: mux: add explicit big endian support Date: Mon, 15 Apr 2019 12:10:43 +0200 Message-Id: <20190415101046.5872-6-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031102_647574_3F04C86D X-CRM114-Status: GOOD ( 14.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a clock specific flag to switch register accesses to big endian, to allow runtime configuration of big endian mux clocks. Signed-off-by: Jonas Gorski --- V1 -> V2: * switch from global to local flag drivers/clk/clk-mux.c | 22 +++++++++++++++++++--- include/linux/clk-provider.h | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 2ad2df2e8909..47f6f4f55f08 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -23,6 +23,22 @@ * parent - parent is adjustable through clk_set_parent */ +static inline u32 clk_mux_readl(struct clk_mux *mux) +{ + if (mux->flags & CLK_MUX_BIG_ENDIAN) + return ioread32be(mux->reg); + else + return clk_readl(mux->reg); +} + +static inline void clk_mux_writel(struct clk_mux *mux, u32 val) +{ + if (mux->flags & CLK_MUX_BIG_ENDIAN) + iowrite32be(val, mux->reg); + else + clk_writel(val, mux->reg); +} + int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, unsigned int val) { @@ -73,7 +89,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw) struct clk_mux *mux = to_clk_mux(hw); u32 val; - val = clk_readl(mux->reg) >> mux->shift; + val = clk_mux_readl(mux) >> mux->shift; val &= mux->mask; return clk_mux_val_to_index(hw, mux->table, mux->flags, val); @@ -94,12 +110,12 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) if (mux->flags & CLK_MUX_HIWORD_MASK) { reg = mux->mask << (mux->shift + 16); } else { - reg = clk_readl(mux->reg); + reg = clk_mux_readl(mux); reg &= ~(mux->mask << mux->shift); } val = val << mux->shift; reg |= val; - clk_writel(reg, mux->reg); + clk_mux_writel(mux, reg); if (mux->lock) spin_unlock_irqrestore(mux->lock, flags); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 9df78e3fb62b..f82cda41e1a8 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -510,6 +510,9 @@ void clk_hw_unregister_divider(struct clk_hw *hw); * .get_parent clk_op. * CLK_MUX_ROUND_CLOSEST - Use the parent rate that is closest to the desired * frequency. + * CLK_MUX_BIG_ENDIAN - By default little endian register accesses are used for + * the mux register. Setting this flag makes the register accesses big + * endian. */ struct clk_mux { struct clk_hw hw; @@ -528,6 +531,7 @@ struct clk_mux { #define CLK_MUX_HIWORD_MASK BIT(2) #define CLK_MUX_READ_ONLY BIT(3) /* mux can't be changed */ #define CLK_MUX_ROUND_CLOSEST BIT(4) +#define CLK_MUX_BIG_ENDIAN BIT(5) extern const struct clk_ops clk_mux_ops; extern const struct clk_ops clk_mux_ro_ops; From patchwork Mon Apr 15 10:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 112781669 for ; Mon, 15 Apr 2019 10:12:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7C62284F5 for ; Mon, 15 Apr 2019 10:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E57FD2859E; Mon, 15 Apr 2019 10:12:27 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8EA2C288AE for ; Mon, 15 Apr 2019 10:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=2b+Aa2ZwiJWV/B89vBX4Qpv1Ba347V13Ve9X6sejs6A=; b=q38ZirAhdxQzZ0HdRuCYq1AHVg HYvcCv/Fsbgkx9KAenC6s2lj3VtHTIteAfkrjH9j2Yxkz1+3o/0T4C5Awj74hqmI9Ux1pj2qSZAfe f9k+tuN7tgaKEgGOnYU5Q2zQHMp+YcxvfzWs5DVob7OuTaXKVobiuADZHDGHAHkhB4YU5e6h/phVI FmvtcvIKJvGrj067hceZq53OqfdfNjZib8IK9Dw8qzMYH8pKFhx9aSpKww1nmeVfUPzz0p6b2Rzos wDwHDL0w1U6gqdFHex8TQtwH0Upa2/gUmeGLKgUxdBsoX4JEs73+he69ZqlRx4CY8DrHrpZ8YoCKI OH6TCKEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyb5-0005LI-JW; Mon, 15 Apr 2019 10:12:19 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZs-0003sX-0O; Mon, 15 Apr 2019 10:11:07 +0000 Received: by mail-wr1-x442.google.com with SMTP id q1so21177836wrp.0; Mon, 15 Apr 2019 03:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1utUG9oo11jNXQpQkS4fRJ6SG9XxN3l3dVfTXDmhkww=; b=Qi8BP0AzvIj0CLEGzLnz/Oj66x7Dup5/AB4St3neDWs+l/i0yiEZGoj2S4lnmAo91j 6/Qv4T6XF36DDGNKBw+wk0oFjNaEZQipRQAFa25p/OHpCu/QtsYR1hcziqSoKRGMFM9K LCDXH/dTI5b0GTYpzcbOvk4ZRiG/pKpdi7ZvbIEGE5ISd8pPn04AmqjSYmOwOHhQ/pyo iSrtKlnKUuDzZUg6NFMOpDFbl737JjXPmWD/NW671VrdazNDzygD6zM8hh+3A1v2/wy8 MYN6yFc7198iiPRhhsd3HyhW8VLm+sFt6x6mgoeq7p7W2zSzm99BSUO+VEsNocKqwZ/m 08Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1utUG9oo11jNXQpQkS4fRJ6SG9XxN3l3dVfTXDmhkww=; b=H4KOLAGpFhJjLuRJZlSG2c9SIhrVqw0wnPisMpgnv1ANB6aRQPFPIRpglKG2UHkKuC mhWxr+E7DuZkcy9U0CbQCPczPhUrIBlgFg6Y0e9kiTMfeqpGYbyKdA1BxNAJT0Qh2g3L yIoOfiNTsCX2E/GW4/MvFZWUAsE47sC7lr54W6G2H0jdI53ZugIrvH1HYk5dlVOeASUh gUDi8Acnk29pXTcPSvn8QHQOJfhIHV1u1H7mLRwfSfKA9yiMfRGIyZAt/QdQ/jMA8+Bw ia+vis92VDDm8dHuEYRaThmPegU8hgokKT4BYmXIfQUlsFr5wgd7Tqts7mL3c+E3LUxx NndQ== X-Gm-Message-State: APjAAAX5CnJV0JeBAqPDx9xR/TIdx/sMQhXOz9ONYOm3a1rQQCbtjGwH LE46HrifwUoHcBPPWbiPhzM= X-Google-Smtp-Source: APXvYqzDXCPaXtO/0J6yWiR1mbQTpGNquiOsxi0UOZGLzVVoYvpAf+tZqDLVoX6afIm4E1NjyaPrJQ== X-Received: by 2002:a5d:6646:: with SMTP id f6mr25387wrw.68.1555323062247; Mon, 15 Apr 2019 03:11:02 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.11.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:11:01 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 6/8] powerpc/512x: mark clocks as big endian Date: Mon, 15 Apr 2019 12:10:44 +0200 Message-Id: <20190415101046.5872-7-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031104_273648_FBC94736 X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP These clocks' registers are accessed as big endian, so mark them as such. Signed-off-by: Jonas Gorski --- V1 -> V2: * switch from global to local flags arch/powerpc/platforms/512x/clock-commonclk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/512x/clock-commonclk.c b/arch/powerpc/platforms/512x/clock-commonclk.c index b3097fe6441b..0072330350fa 100644 --- a/arch/powerpc/platforms/512x/clock-commonclk.c +++ b/arch/powerpc/platforms/512x/clock-commonclk.c @@ -240,7 +240,8 @@ static inline struct clk *mpc512x_clk_divider( u32 __iomem *reg, u8 pos, u8 len, int divflags) { return clk_register_divider(NULL, name, parent_name, clkflags, - reg, pos, len, divflags, &clklock); + reg, pos, len, + divflags | CLK_DIVIDER_BIG_ENDIAN, &clklock); } static inline struct clk *mpc512x_clk_divtable( @@ -250,7 +251,7 @@ static inline struct clk *mpc512x_clk_divtable( { u8 divflags; - divflags = 0; + divflags = CLK_DIVIDER_BIG_ENDIAN; return clk_register_divider_table(NULL, name, parent_name, 0, reg, pos, len, divflags, divtab, &clklock); @@ -261,10 +262,12 @@ static inline struct clk *mpc512x_clk_gated( u32 __iomem *reg, u8 pos) { int clkflags; + u8 gateflags; clkflags = CLK_SET_RATE_PARENT; + gateflags = CLK_GATE_BIG_ENDIAN; return clk_register_gate(NULL, name, parent_name, clkflags, - reg, pos, 0, &clklock); + reg, pos, gateflags, &clklock); } static inline struct clk *mpc512x_clk_muxed(const char *name, @@ -275,7 +278,7 @@ static inline struct clk *mpc512x_clk_muxed(const char *name, u8 muxflags; clkflags = CLK_SET_RATE_PARENT; - muxflags = 0; + muxflags = CLK_MUX_BIG_ENDIAN; return clk_register_mux(NULL, name, parent_names, parent_count, clkflags, reg, pos, len, muxflags, &clklock); From patchwork Mon Apr 15 10:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E02F1669 for ; Mon, 15 Apr 2019 10:12:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41878284F5 for ; Mon, 15 Apr 2019 10:12:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F9BC28896; Mon, 15 Apr 2019 10:12:36 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, TVD_SUBJ_WIPE_DEBT autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD07828893 for ; Mon, 15 Apr 2019 10:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=5A17K68M0ImE2C+2av2gWv8CxqTfplSB0GoR/2J3Qz4=; b=aX42arvOLaSxjBd/GuX2Csnx0O J0sNIeWFgnYzISZbnK5k05TeZcaTgrvEXJ9Pz7TKGtWbXtOaN6vfeM/y8PbPquEJ5rqoXekTtTeEv isf/Q44W9Mi70Q7wfAiIqfhMaMu6owhMjRY0AQIU0BhK54n3VioJt5fP6XV1vbA3BmzuL98GFj/3w o1Tf5jF/vAN6YWFeIKyEdAbBBVrNpCVsj9uCBIIB6aNLfyIuGat2jhRf2f5yp6JCAlrmpRYLtmq72 Tt7PAV4gaxDROgumkoYNWHLAmzlf+kFxgx6/9k/GIUOMcJy4PTGhUGubJwa3NYr6nGhuV8Q255geE +3LK8w/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFybG-0005c6-LG; Mon, 15 Apr 2019 10:12:30 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZt-0003vl-FS; Mon, 15 Apr 2019 10:11:07 +0000 Received: by mail-wm1-x342.google.com with SMTP id h18so19631675wml.1; Mon, 15 Apr 2019 03:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sj0AUTH1hVgf3wNwVxaR3FGot08SzGps4WY/S0Hmy/E=; b=V+yvan/Zm0HTn2scxhSs9EmCYDAt39Twv0oMrtdz/oOUUBDuKQbPtb7FemAjsHjS2P X996fb5pDqSUxCSQBxW9CrzN40m9/dOEcY9U/QK7kXH4B6Kx9XzVTgzRZpxf47T65hhu U0rM11acTkeBNEgr+u6oyjLo0+JZvaeVQ5RZLgbFQqBOiwT1CnIHU8ZB3CeLy6JrKLsC 2pFMc6xo8d0tuRJYiGdMdbTsqpxZ30/XnGaf6c/P8UdejTFa+z0Brhum8FiKNp1760J5 6KvCdxnSdyK5A/d5XeNa1WS5uRNZfFjkWJAsLpy7qcc4BXt4rxAzOVM2R6+fR4LjeARj wTGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Sj0AUTH1hVgf3wNwVxaR3FGot08SzGps4WY/S0Hmy/E=; b=NXGUl48KqAni6steeIzAaJ6ghr5XNl+VIzbGPT6+gn7pOMMM6TFQEGsS2wY3hIclFR QNk/3K8sno+em+dEU2gWBqEsZAcmkRy1bsIF+d5ZrfvtHSMq3a4XA2rzbgxXGiWf470Q f0g61k2Bl+vI8EpdC3i1IxtsoPHALL8z7SK8FIrKpIKSW51gY4z3A1Da0zH0eUhvMeDH ffOXBEute2cW2kSftnk/bCscYiI6YFTPRWpD3caSH9SZxYMLGAVQ2tqMsO+YCb9TSSjj uNAK9Ru3SbR+EE3a9nw2au4J7nDUcSk9WiMJyF1NyD0c/CG7mx/0phDmuJrhx36CnF8A BWAg== X-Gm-Message-State: APjAAAU/3zOXYbW83NG0/k8pJvyQwZJAU1pFMuhl++SnSpKit1gmNKm9 /I/ca8Q5Awz6vAivNGCeFXJcmZeWWQc= X-Google-Smtp-Source: APXvYqw2zXF9I3SOjK4eDyXT/3JKr8GdVdxfKwB3FDSG/F11qD5sT964dRm277f+oBYa2U14U3zytw== X-Received: by 2002:a1c:a9cb:: with SMTP id s194mr22219969wme.62.1555323064237; Mon, 15 Apr 2019 03:11:04 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.11.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:11:03 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 7/8] clk: core: remove powerpc special handling Date: Mon, 15 Apr 2019 12:10:45 +0200 Message-Id: <20190415101046.5872-8-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031105_613965_EC2F5B5B X-CRM114-Status: GOOD ( 11.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the powerpc clocks are properly marked as big endian, we can remove the special handling for PowerPC. Signed-off-by: Jonas Gorski --- V1 -> V2: * no actual changes include/linux/clk-provider.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index f82cda41e1a8..479e616ce7f5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -1001,20 +1001,6 @@ static inline int of_clk_detect_critical(struct device_node *np, int index, * for improved portability across platforms */ -#if IS_ENABLED(CONFIG_PPC) - -static inline u32 clk_readl(u32 __iomem *reg) -{ - return ioread32be(reg); -} - -static inline void clk_writel(u32 val, u32 __iomem *reg) -{ - iowrite32be(val, reg); -} - -#else /* platform dependent I/O accessors */ - static inline u32 clk_readl(u32 __iomem *reg) { return readl(reg); @@ -1025,8 +1011,6 @@ static inline void clk_writel(u32 val, u32 __iomem *reg) writel(val, reg); } -#endif /* platform dependent I/O accessors */ - void clk_gate_restore_context(struct clk_hw *hw); #endif /* CONFIG_COMMON_CLK */ From patchwork Mon Apr 15 10:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10900481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4121F1669 for ; Mon, 15 Apr 2019 10:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204F2288BA for ; Mon, 15 Apr 2019 10:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C8CE28922; Mon, 15 Apr 2019 10:12:56 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1246288BA for ; Mon, 15 Apr 2019 10:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=QVFZk5nTjaLoooJqO/5RSjq/CAoiIYgMGx5cHp+4fqw=; b=KC49nDfGiAiBHa7vGD6FRv6sXW fZeN5F5xlJohNo9C+V7lqg0Z2UR25g0JNa9jh/LCi5ExkUMRL76EhUERaVsSQwJRqT7CdolGfLEfG rCXpukmIRsqCkM8/AwxlszLjo19J6EN1pbITw3IFMcJhVXhedrOXsEeRbvwl0a4sthmx6tFQHWx78 YQVGQFiQQT73o79wa+LoE2j3/1Q/fDWSzq3wrX3BDBDPo3igHnb7aTF/Vb7JXWnB4y8s0F36GtLig aXZcgKe+tVZ1D9Xpag4wLpistpSM7yy36rXmeLk1RW7wQkNkn8mlYnmM+cjop8jKhKgZ8M3kzDhK+ N7APA2Pg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFybd-0005ym-0T; Mon, 15 Apr 2019 10:12:53 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFyZv-0003y7-Vu; Mon, 15 Apr 2019 10:11:16 +0000 Received: by mail-wr1-x441.google.com with SMTP id y13so21179458wrd.3; Mon, 15 Apr 2019 03:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NL96trJbiwYCBdqnquCsPKm1HUfK4513ScI5kVI9UD8=; b=PIlJe2iOhXwvyxtXNx0Or4odI/mFDMxzmnrNfovensv1XvcqjKcZh/wuhKn28gFGOS ftumgTRmAW4nh+j7IDu318XOGA4kIFbFWoy0hCJ+XUgn6sb3vHGwSwcIRXDWfHscx0QX cfOYh5EPfF6sCO3XugPwXuw2nvBE+ieAkTKrNzLdLkp48bGiI3bpTFC1zlY5UCwZSMVh R8RlHWMhlFmKV0b7sKbgHIhu8ZOJAO1szJM6hcgF3jBqlctfS1o9LM+v3WESprq634aA +O+fihtjJt9azIvQh3p+DgrEoKJJ1EnUi42rJC19uAcHZnIDG8fj1SpEe3BlxwjETlkv XiIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NL96trJbiwYCBdqnquCsPKm1HUfK4513ScI5kVI9UD8=; b=IrtmPN5hqJ3Zal2NtM+nv/0oUL7Wfv8/3bmgVm07dK35I8VlnnmR+XVMMFtMDHUXYY Vea7fnRfk0AeTp3mQVhsG78wgsmqYmDq5CzhNqMGau/T1056580iflagTozQUCwZU48R VjTmhk6YS2G8YbiD/Evp3hMkUwRLnEz+ii86RUftAizi9b3SV/lzGgTBIqJmqYfUOOc6 EYmY5/NyQNElE8H8Eqzk4/g7mwDwaD0n/wrV91O8tc9g8Lxnd7CE9mpTejuqrHs4JDv1 KWQa3N8GpTikzKHuV/gYSerys1NpmL53sxiiW8AiE6p647vvvOeSo6I9DzVoZWDOGc9M TzRg== X-Gm-Message-State: APjAAAVpypJbt/xY9Cwn1nIgrffDwm68qSSGvxo+mvOvnpLXqHxSCX5L oPQ85Nnw/+Anm/a43LBUaxM= X-Google-Smtp-Source: APXvYqwlhiXEcQf7qfIC0HInLTEYTS6FRF6Wi4NVfwfUY1rWDTwJ8PH1PbpnikjHSQLQkx9p/iqcAg== X-Received: by 2002:adf:f48d:: with SMTP id l13mr41212394wro.2.1555323066409; Mon, 15 Apr 2019 03:11:06 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id d6sm11592214wrp.9.2019.04.15.03.11.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 03:11:05 -0700 (PDT) From: Jonas Gorski To: linux-clk@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH RFT V2 8/8] clk: core: replace clk_{readl, writel} with {readl, writel} Date: Mon, 15 Apr 2019 12:10:46 +0200 Message-Id: <20190415101046.5872-9-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20190415101046.5872-1-jonas.gorski@gmail.com> References: <20190415101046.5872-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_031108_339657_11AC6A47 X-CRM114-Status: GOOD ( 18.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter De Schrijver , Fabio Estevam , Heiko Stuebner , Stephen Boyd , Benjamin Herrenschmidt , Michael Turquette , Michal Simek , Jonathan Hunter , Prashant Gaikwad , Paul Mackerras , NXP Linux Team , Pengutronix Kernel Team , Michael Ellerman , Thierry Reding , Anatolij Gustschin , Shawn Guo , Sascha Hauer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that clk_{readl,writel} is just an alias for {readl,writel}, we can switch all users of clk_* to use the accessors directly and remove the helpers. Signed-off-by: Jonas Gorski --- V1 -> V2: * newly added patch drivers/clk/clk-divider.c | 4 ++-- drivers/clk/clk-fractional-divider.c | 4 ++-- drivers/clk/clk-gate.c | 4 ++-- drivers/clk/clk-multiplier.c | 4 ++-- drivers/clk/clk-mux.c | 4 ++-- drivers/clk/clk-xgene.c | 6 +++--- drivers/clk/hisilicon/clk-hisi-phase.c | 4 ++-- drivers/clk/imx/clk-divider-gate.c | 20 ++++++++++---------- drivers/clk/imx/clk-sccg-pll.c | 12 ++++++------ drivers/clk/nxp/clk-lpc18xx-ccu.c | 6 +++--- drivers/clk/nxp/clk-lpc18xx-cgu.c | 24 ++++++++++++------------ drivers/clk/rockchip/clk-ddr.c | 2 +- drivers/clk/rockchip/clk-half-divider.c | 6 +++--- drivers/clk/tegra/clk-tegra124.c | 4 ++-- drivers/clk/tegra/clk-tegra210.c | 6 +++--- drivers/clk/zynq/clkc.c | 6 +++--- drivers/clk/zynq/pll.c | 18 +++++++++--------- include/linux/clk-provider.h | 15 --------------- 18 files changed, 67 insertions(+), 82 deletions(-) diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index ff791a7a5e9e..bb49dbf05a64 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -30,7 +30,7 @@ static inline u32 clk_div_readl(struct clk_divider *divider) if (divider->flags & CLK_DIVIDER_BIG_ENDIAN) return ioread32be(divider->reg); else - return clk_readl(divider->reg); + return readl(divider->reg); } static inline void clk_div_writel(struct clk_divider *divider, u32 val) @@ -38,7 +38,7 @@ static inline void clk_div_writel(struct clk_divider *divider, u32 val) if (divider->flags & CLK_DIVIDER_BIG_ENDIAN) iowrite32be(val, divider->reg); else - clk_writel(val, divider->reg); + writel(val, divider->reg); } #define div_mask(width) ((1 << (width)) - 1) diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index b9988d3b3828..99133554466f 100644 --- a/drivers/clk/clk-fractional-divider.c +++ b/drivers/clk/clk-fractional-divider.c @@ -18,7 +18,7 @@ static inline u32 clk_fd_readl(struct clk_fractional_divider *fd) if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) return ioread32be(fd->reg); else - return clk_readl(fd->reg); + return readl(fd->reg); } static inline void clk_fd_writel(struct clk_fractional_divider *fd, u32 val) @@ -26,7 +26,7 @@ static inline void clk_fd_writel(struct clk_fractional_divider *fd, u32 val) if (fd->flags & CLK_FRAC_DIVIDER_BIG_ENDIAN) iowrite32be(val, fd->reg); else - clk_writel(val, fd->reg); + writel(val, fd->reg); } static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 521e112ef5b5..bd201eaa99df 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -28,7 +28,7 @@ static inline u32 clk_gate_readl(struct clk_gate *gate) if (gate->flags & CLK_GATE_BIG_ENDIAN) return ioread32be(gate->reg); else - return clk_readl(gate->reg); + return readl(gate->reg); } static inline void clk_gate_writel(struct clk_gate *gate, u32 val) @@ -36,7 +36,7 @@ static inline void clk_gate_writel(struct clk_gate *gate, u32 val) if (gate->flags & CLK_GATE_BIG_ENDIAN) iowrite32be(val, gate->reg); else - clk_writel(val, gate->reg); + writel(val, gate->reg); } /* diff --git a/drivers/clk/clk-multiplier.c b/drivers/clk/clk-multiplier.c index fb032f7dd407..a433442a1fa6 100644 --- a/drivers/clk/clk-multiplier.c +++ b/drivers/clk/clk-multiplier.c @@ -16,7 +16,7 @@ static inline u32 clk_mult_readl(struct clk_multiplier *mult) if (mult->flags & CLK_MULTIPLIER_BIG_ENDIAN) return ioread32be(mult->reg); else - return clk_readl(mult->reg); + return readl(mult->reg); } static inline void clk_mult_writel(struct clk_multiplier *mult, u32 val) @@ -24,7 +24,7 @@ static inline void clk_mult_writel(struct clk_multiplier *mult, u32 val) if (mult->flags & CLK_MULTIPLIER_BIG_ENDIAN) iowrite32be(val, mult->reg); else - clk_writel(val, mult->reg); + writel(val, mult->reg); } static unsigned long __get_mult(struct clk_multiplier *mult, diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 47f6f4f55f08..9ae3a4c17ed5 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -28,7 +28,7 @@ static inline u32 clk_mux_readl(struct clk_mux *mux) if (mux->flags & CLK_MUX_BIG_ENDIAN) return ioread32be(mux->reg); else - return clk_readl(mux->reg); + return readl(mux->reg); } static inline void clk_mux_writel(struct clk_mux *mux, u32 val) @@ -36,7 +36,7 @@ static inline void clk_mux_writel(struct clk_mux *mux, u32 val) if (mux->flags & CLK_MUX_BIG_ENDIAN) iowrite32be(val, mux->reg); else - clk_writel(val, mux->reg); + writel(val, mux->reg); } int clk_mux_val_to_index(struct clk_hw *hw, u32 *table, unsigned int flags, diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c index 531b030d4d4e..d975465fe2a8 100644 --- a/drivers/clk/clk-xgene.c +++ b/drivers/clk/clk-xgene.c @@ -262,7 +262,7 @@ static unsigned long xgene_clk_pmd_recalc_rate(struct clk_hw *hw, else __acquire(fd->lock); - val = clk_readl(fd->reg); + val = readl(fd->reg); if (fd->lock) spin_unlock_irqrestore(fd->lock, flags); @@ -333,10 +333,10 @@ static int xgene_clk_pmd_set_rate(struct clk_hw *hw, unsigned long rate, else __acquire(fd->lock); - val = clk_readl(fd->reg); + val = readl(fd->reg); val &= ~fd->mask; val |= (scale << fd->shift); - clk_writel(val, fd->reg); + writel(val, fd->reg); if (fd->lock) spin_unlock_irqrestore(fd->lock, flags); diff --git a/drivers/clk/hisilicon/clk-hisi-phase.c b/drivers/clk/hisilicon/clk-hisi-phase.c index 5fdc267bb2da..ba6afad66a2b 100644 --- a/drivers/clk/hisilicon/clk-hisi-phase.c +++ b/drivers/clk/hisilicon/clk-hisi-phase.c @@ -75,10 +75,10 @@ static int hisi_clk_set_phase(struct clk_hw *hw, int degrees) spin_lock_irqsave(phase->lock, flags); - val = clk_readl(phase->reg); + val = readl(phase->reg); val &= ~phase->mask; val |= regval << phase->shift; - clk_writel(val, phase->reg); + writel(val, phase->reg); spin_unlock_irqrestore(phase->lock, flags); diff --git a/drivers/clk/imx/clk-divider-gate.c b/drivers/clk/imx/clk-divider-gate.c index df1f8429fe16..2a8352a316c7 100644 --- a/drivers/clk/imx/clk-divider-gate.c +++ b/drivers/clk/imx/clk-divider-gate.c @@ -29,7 +29,7 @@ static unsigned long clk_divider_gate_recalc_rate_ro(struct clk_hw *hw, struct clk_divider *div = to_clk_divider(hw); unsigned int val; - val = clk_readl(div->reg) >> div->shift; + val = readl(div->reg) >> div->shift; val &= clk_div_mask(div->width); if (!val) return 0; @@ -51,7 +51,7 @@ static unsigned long clk_divider_gate_recalc_rate(struct clk_hw *hw, if (!clk_hw_is_enabled(hw)) { val = div_gate->cached_val; } else { - val = clk_readl(div->reg) >> div->shift; + val = readl(div->reg) >> div->shift; val &= clk_div_mask(div->width); } @@ -87,10 +87,10 @@ static int clk_divider_gate_set_rate(struct clk_hw *hw, unsigned long rate, spin_lock_irqsave(div->lock, flags); if (clk_hw_is_enabled(hw)) { - val = clk_readl(div->reg); + val = readl(div->reg); val &= ~(clk_div_mask(div->width) << div->shift); val |= (u32)value << div->shift; - clk_writel(val, div->reg); + writel(val, div->reg); } else { div_gate->cached_val = value; } @@ -114,9 +114,9 @@ static int clk_divider_enable(struct clk_hw *hw) spin_lock_irqsave(div->lock, flags); /* restore div val */ - val = clk_readl(div->reg); + val = readl(div->reg); val |= div_gate->cached_val << div->shift; - clk_writel(val, div->reg); + writel(val, div->reg); spin_unlock_irqrestore(div->lock, flags); @@ -133,10 +133,10 @@ static void clk_divider_disable(struct clk_hw *hw) spin_lock_irqsave(div->lock, flags); /* store the current div val */ - val = clk_readl(div->reg) >> div->shift; + val = readl(div->reg) >> div->shift; val &= clk_div_mask(div->width); div_gate->cached_val = val; - clk_writel(0, div->reg); + writel(0, div->reg); spin_unlock_irqrestore(div->lock, flags); } @@ -146,7 +146,7 @@ static int clk_divider_is_enabled(struct clk_hw *hw) struct clk_divider *div = to_clk_divider(hw); u32 val; - val = clk_readl(div->reg) >> div->shift; + val = readl(div->reg) >> div->shift; val &= clk_div_mask(div->width); return val ? 1 : 0; @@ -206,7 +206,7 @@ struct clk_hw *imx_clk_divider_gate(const char *name, const char *parent_name, div_gate->divider.hw.init = &init; div_gate->divider.flags = CLK_DIVIDER_ONE_BASED | clk_divider_flags; /* cache gate status */ - val = clk_readl(reg) >> shift; + val = readl(reg) >> shift; val &= clk_div_mask(width); div_gate->cached_val = val; diff --git a/drivers/clk/imx/clk-sccg-pll.c b/drivers/clk/imx/clk-sccg-pll.c index 9dfd03a95557..991bbe63f156 100644 --- a/drivers/clk/imx/clk-sccg-pll.c +++ b/drivers/clk/imx/clk-sccg-pll.c @@ -348,7 +348,7 @@ static unsigned long clk_sccg_pll_recalc_rate(struct clk_hw *hw, temp64 = parent_rate; - val = clk_readl(pll->base + PLL_CFG0); + val = readl(pll->base + PLL_CFG0); if (val & SSCG_PLL_BYPASS2_MASK) { temp64 = parent_rate; } else if (val & SSCG_PLL_BYPASS1_MASK) { @@ -371,10 +371,10 @@ static int clk_sccg_pll_set_rate(struct clk_hw *hw, unsigned long rate, u32 val; /* set bypass here too since the parent might be the same */ - val = clk_readl(pll->base + PLL_CFG0); + val = readl(pll->base + PLL_CFG0); val &= ~SSCG_PLL_BYPASS_MASK; val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, setup->bypass); - clk_writel(val, pll->base + PLL_CFG0); + writel(val, pll->base + PLL_CFG0); val = readl_relaxed(pll->base + PLL_CFG2); val &= ~(PLL_DIVF1_MASK | PLL_DIVF2_MASK); @@ -395,7 +395,7 @@ static u8 clk_sccg_pll_get_parent(struct clk_hw *hw) u32 val; u8 ret = pll->parent; - val = clk_readl(pll->base + PLL_CFG0); + val = readl(pll->base + PLL_CFG0); if (val & SSCG_PLL_BYPASS2_MASK) ret = pll->bypass2; else if (val & SSCG_PLL_BYPASS1_MASK) @@ -408,10 +408,10 @@ static int clk_sccg_pll_set_parent(struct clk_hw *hw, u8 index) struct clk_sccg_pll *pll = to_clk_sccg_pll(hw); u32 val; - val = clk_readl(pll->base + PLL_CFG0); + val = readl(pll->base + PLL_CFG0); val &= ~SSCG_PLL_BYPASS_MASK; val |= FIELD_PREP(SSCG_PLL_BYPASS_MASK, pll->setup.bypass); - clk_writel(val, pll->base + PLL_CFG0); + writel(val, pll->base + PLL_CFG0); return clk_sccg_pll_wait_lock(pll); } diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c index 27781b49eb82..5969f620607a 100644 --- a/drivers/clk/nxp/clk-lpc18xx-ccu.c +++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c @@ -142,7 +142,7 @@ static int lpc18xx_ccu_gate_endisable(struct clk_hw *hw, bool enable) * Divider field is write only, so divider stat field must * be read so divider field can be set accordingly. */ - val = clk_readl(gate->reg); + val = readl(gate->reg); if (val & LPC18XX_CCU_DIVSTAT) val |= LPC18XX_CCU_DIV; @@ -155,12 +155,12 @@ static int lpc18xx_ccu_gate_endisable(struct clk_hw *hw, bool enable) * and the next write should clear the RUN bit. */ val |= LPC18XX_CCU_AUTO; - clk_writel(val, gate->reg); + writel(val, gate->reg); val &= ~LPC18XX_CCU_RUN; } - clk_writel(val, gate->reg); + writel(val, gate->reg); return 0; } diff --git a/drivers/clk/nxp/clk-lpc18xx-cgu.c b/drivers/clk/nxp/clk-lpc18xx-cgu.c index 2531174b399e..f5bc8bd192b7 100644 --- a/drivers/clk/nxp/clk-lpc18xx-cgu.c +++ b/drivers/clk/nxp/clk-lpc18xx-cgu.c @@ -352,9 +352,9 @@ static unsigned long lpc18xx_pll0_recalc_rate(struct clk_hw *hw, struct lpc18xx_pll *pll = to_lpc_pll(hw); u32 ctrl, mdiv, msel, npdiv; - ctrl = clk_readl(pll->reg + LPC18XX_CGU_PLL0USB_CTRL); - mdiv = clk_readl(pll->reg + LPC18XX_CGU_PLL0USB_MDIV); - npdiv = clk_readl(pll->reg + LPC18XX_CGU_PLL0USB_NP_DIV); + ctrl = readl(pll->reg + LPC18XX_CGU_PLL0USB_CTRL); + mdiv = readl(pll->reg + LPC18XX_CGU_PLL0USB_MDIV); + npdiv = readl(pll->reg + LPC18XX_CGU_PLL0USB_NP_DIV); if (ctrl & LPC18XX_PLL0_CTRL_BYPASS) return parent_rate; @@ -415,25 +415,25 @@ static int lpc18xx_pll0_set_rate(struct clk_hw *hw, unsigned long rate, m |= lpc18xx_pll0_msel2seli(m) << LPC18XX_PLL0_MDIV_SELI_SHIFT; /* Power down PLL, disable clk output and dividers */ - ctrl = clk_readl(pll->reg + LPC18XX_CGU_PLL0USB_CTRL); + ctrl = readl(pll->reg + LPC18XX_CGU_PLL0USB_CTRL); ctrl |= LPC18XX_PLL0_CTRL_PD; ctrl &= ~(LPC18XX_PLL0_CTRL_BYPASS | LPC18XX_PLL0_CTRL_DIRECTI | LPC18XX_PLL0_CTRL_DIRECTO | LPC18XX_PLL0_CTRL_CLKEN); - clk_writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); + writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); /* Configure new PLL settings */ - clk_writel(m, pll->reg + LPC18XX_CGU_PLL0USB_MDIV); - clk_writel(LPC18XX_PLL0_NP_DIVS_1, pll->reg + LPC18XX_CGU_PLL0USB_NP_DIV); + writel(m, pll->reg + LPC18XX_CGU_PLL0USB_MDIV); + writel(LPC18XX_PLL0_NP_DIVS_1, pll->reg + LPC18XX_CGU_PLL0USB_NP_DIV); /* Power up PLL and wait for lock */ ctrl &= ~LPC18XX_PLL0_CTRL_PD; - clk_writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); + writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); do { udelay(10); - stat = clk_readl(pll->reg + LPC18XX_CGU_PLL0USB_STAT); + stat = readl(pll->reg + LPC18XX_CGU_PLL0USB_STAT); if (stat & LPC18XX_PLL0_STAT_LOCK) { ctrl |= LPC18XX_PLL0_CTRL_CLKEN; - clk_writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); + writel(ctrl, pll->reg + LPC18XX_CGU_PLL0USB_CTRL); return 0; } @@ -458,8 +458,8 @@ static unsigned long lpc18xx_pll1_recalc_rate(struct clk_hw *hw, bool direct, fbsel; u32 stat, ctrl; - stat = clk_readl(pll->reg + LPC18XX_CGU_PLL1_STAT); - ctrl = clk_readl(pll->reg + LPC18XX_CGU_PLL1_CTRL); + stat = readl(pll->reg + LPC18XX_CGU_PLL1_STAT); + ctrl = readl(pll->reg + LPC18XX_CGU_PLL1_CTRL); direct = (ctrl & LPC18XX_PLL1_CTRL_DIRECT) ? true : false; fbsel = (ctrl & LPC18XX_PLL1_CTRL_FBSEL) ? true : false; diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c index ebce5260068b..09ede6920593 100644 --- a/drivers/clk/rockchip/clk-ddr.c +++ b/drivers/clk/rockchip/clk-ddr.c @@ -82,7 +82,7 @@ static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw) struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw); u32 val; - val = clk_readl(ddrclk->reg_base + + val = readl(ddrclk->reg_base + ddrclk->mux_offset) >> ddrclk->mux_shift; val &= GENMASK(ddrclk->mux_width - 1, 0); diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c index b8da6e799423..784b81e1ea7c 100644 --- a/drivers/clk/rockchip/clk-half-divider.c +++ b/drivers/clk/rockchip/clk-half-divider.c @@ -24,7 +24,7 @@ static unsigned long clk_half_divider_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); unsigned int val; - val = clk_readl(divider->reg) >> divider->shift; + val = readl(divider->reg) >> divider->shift; val &= div_mask(divider->width); val = val * 2 + 3; @@ -124,11 +124,11 @@ static int clk_half_divider_set_rate(struct clk_hw *hw, unsigned long rate, if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { val = div_mask(divider->width) << (divider->shift + 16); } else { - val = clk_readl(divider->reg); + val = readl(divider->reg); val &= ~(div_mask(divider->width) << divider->shift); } val |= value << divider->shift; - clk_writel(val, divider->reg); + writel(val, divider->reg); if (divider->lock) spin_unlock_irqrestore(divider->lock, flags); diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c index df0018f7bf7e..abc0c4bea740 100644 --- a/drivers/clk/tegra/clk-tegra124.c +++ b/drivers/clk/tegra/clk-tegra124.c @@ -1466,9 +1466,9 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np) tegra_pmc_clk_init(pmc_base, tegra124_clks); /* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */ - plld_base = clk_readl(clk_base + PLLD_BASE); + plld_base = readl(clk_base + PLLD_BASE); plld_base &= ~BIT(25); - clk_writel(plld_base, clk_base + PLLD_BASE); + writel(plld_base, clk_base + PLLD_BASE); } /** diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c index 7545af763d7a..ed3c7df75d1e 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3557,7 +3557,7 @@ static void __init tegra210_clock_init(struct device_node *np) if (!clks) return; - value = clk_readl(clk_base + SPARE_REG0) >> CLK_M_DIVISOR_SHIFT; + value = readl(clk_base + SPARE_REG0) >> CLK_M_DIVISOR_SHIFT; clk_m_div = (value & CLK_M_DIVISOR_MASK) + 1; if (tegra_osc_clk_init(clk_base, tegra210_clks, tegra210_input_freq, @@ -3574,9 +3574,9 @@ static void __init tegra210_clock_init(struct device_node *np) tegra_pmc_clk_init(pmc_base, tegra210_clks); /* For Tegra210, PLLD is the only source for DSIA & DSIB */ - value = clk_readl(clk_base + PLLD_BASE); + value = readl(clk_base + PLLD_BASE); value &= ~BIT(25); - clk_writel(value, clk_base + PLLD_BASE); + writel(value, clk_base + PLLD_BASE); tegra_clk_apply_init_table = tegra210_clock_apply_init_table; diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index d7b53ac8ad11..4b9d5c14c400 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -158,7 +158,7 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, clks[fclk] = clk_register_gate(NULL, clk_name, div1_name, CLK_SET_RATE_PARENT, fclk_gate_reg, 0, CLK_GATE_SET_TO_DISABLE, fclk_gate_lock); - enable_reg = clk_readl(fclk_gate_reg) & 1; + enable_reg = readl(fclk_gate_reg) & 1; if (enable && !enable_reg) { if (clk_prepare_enable(clks[fclk])) pr_warn("%s: FCLK%u enable failed\n", __func__, @@ -287,7 +287,7 @@ static void __init zynq_clk_setup(struct device_node *np) SLCR_IOPLL_CTRL, 4, 1, 0, &iopll_lock); /* CPU clocks */ - tmp = clk_readl(SLCR_621_TRUE) & 1; + tmp = readl(SLCR_621_TRUE) & 1; clk = clk_register_mux(NULL, "cpu_mux", cpu_parents, 4, CLK_SET_RATE_NO_REPARENT, SLCR_ARM_CLK_CTRL, 4, 2, 0, &armclk_lock); @@ -510,7 +510,7 @@ static void __init zynq_clk_setup(struct device_node *np) &dbgclk_lock); /* leave debug clocks in the state the bootloader set them up to */ - tmp = clk_readl(SLCR_DBG_CLK_CTRL); + tmp = readl(SLCR_DBG_CLK_CTRL); if (tmp & DBG_CLK_CTRL_CLKACT_TRC) if (clk_prepare_enable(clks[dbg_trc])) pr_warn("%s: trace clk enable failed\n", __func__); diff --git a/drivers/clk/zynq/pll.c b/drivers/clk/zynq/pll.c index 00d72fb5c036..800b70ee19b3 100644 --- a/drivers/clk/zynq/pll.c +++ b/drivers/clk/zynq/pll.c @@ -90,7 +90,7 @@ static unsigned long zynq_pll_recalc_rate(struct clk_hw *hw, * makes probably sense to redundantly save fbdiv in the struct * zynq_pll to save the IO access. */ - fbdiv = (clk_readl(clk->pll_ctrl) & PLLCTRL_FBDIV_MASK) >> + fbdiv = (readl(clk->pll_ctrl) & PLLCTRL_FBDIV_MASK) >> PLLCTRL_FBDIV_SHIFT; return parent_rate * fbdiv; @@ -112,7 +112,7 @@ static int zynq_pll_is_enabled(struct clk_hw *hw) spin_lock_irqsave(clk->lock, flags); - reg = clk_readl(clk->pll_ctrl); + reg = readl(clk->pll_ctrl); spin_unlock_irqrestore(clk->lock, flags); @@ -138,10 +138,10 @@ static int zynq_pll_enable(struct clk_hw *hw) /* Power up PLL and wait for lock */ spin_lock_irqsave(clk->lock, flags); - reg = clk_readl(clk->pll_ctrl); + reg = readl(clk->pll_ctrl); reg &= ~(PLLCTRL_RESET_MASK | PLLCTRL_PWRDWN_MASK); - clk_writel(reg, clk->pll_ctrl); - while (!(clk_readl(clk->pll_status) & (1 << clk->lockbit))) + writel(reg, clk->pll_ctrl); + while (!(readl(clk->pll_status) & (1 << clk->lockbit))) ; spin_unlock_irqrestore(clk->lock, flags); @@ -168,9 +168,9 @@ static void zynq_pll_disable(struct clk_hw *hw) /* shut down PLL */ spin_lock_irqsave(clk->lock, flags); - reg = clk_readl(clk->pll_ctrl); + reg = readl(clk->pll_ctrl); reg |= PLLCTRL_RESET_MASK | PLLCTRL_PWRDWN_MASK; - clk_writel(reg, clk->pll_ctrl); + writel(reg, clk->pll_ctrl); spin_unlock_irqrestore(clk->lock, flags); } @@ -223,9 +223,9 @@ struct clk *clk_register_zynq_pll(const char *name, const char *parent, spin_lock_irqsave(pll->lock, flags); - reg = clk_readl(pll->pll_ctrl); + reg = readl(pll->pll_ctrl); reg &= ~PLLCTRL_BPQUAL_MASK; - clk_writel(reg, pll->pll_ctrl); + writel(reg, pll->pll_ctrl); spin_unlock_irqrestore(pll->lock, flags); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 479e616ce7f5..46d5fc3057b5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -996,21 +996,6 @@ static inline int of_clk_detect_critical(struct device_node *np, int index, } #endif /* CONFIG_OF */ -/* - * wrap access to peripherals in accessor routines - * for improved portability across platforms - */ - -static inline u32 clk_readl(u32 __iomem *reg) -{ - return readl(reg); -} - -static inline void clk_writel(u32 val, u32 __iomem *reg) -{ - writel(val, reg); -} - void clk_gate_restore_context(struct clk_hw *hw); #endif /* CONFIG_COMMON_CLK */