From patchwork Thu Apr 18 11:12:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 10907039 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 C71F217E0 for ; Thu, 18 Apr 2019 11:12:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB2C028C21 for ; Thu, 18 Apr 2019 11:12:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E5F728C29; Thu, 18 Apr 2019 11:12:32 +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 4305C28C21 for ; Thu, 18 Apr 2019 11:12:32 +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: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:In-Reply-To: References:List-Owner; bh=tBisAF1+5Q70X5bshwmv73ZzNrfayLkeBo/ae1IYcmo=; b=dGb Go57raS/meXM1UjXdky+ZUtjjslXy2/YprYGJwzWFap7N/Z6RtQoDkxnWgG5fPDIec9I8l/KnK9re hIa+5lajWESRU4+B6ZlEpSDQvmYr8RkMuFiQKgM81LpOeeRd5FMQS7myAaX0c2+HPcO1SJXPX8BfU qC4q5bzowqU0czsch6sq1RgAvsw6JuXeuL1EyO/m/6Cm68G2C/4N64m4aaw9cnnRK6O1g+YYLScoK JUo3SOuE38y0urEKOGta4drJ+a5/Lj+wTD10oreiNoUoPbHb7SZvXiGYgtOZUnjg1AXNk/0nfw+mF HEW+H7TXEPQsk88VQ4mzUnCuKjnx/Cw==; 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 1hH4xv-0006n2-3W; Thu, 18 Apr 2019 11:12:27 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hH4xj-0006Zk-LE; Thu, 18 Apr 2019 11:12:17 +0000 Received: by mail-wm1-x343.google.com with SMTP id a184so2304370wma.2; Thu, 18 Apr 2019 04:12:15 -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; bh=yn6Id06pDDX/+u4mQsjGgX3TBS/5u8W5OOwPhGIgFdM=; b=YzC/KeKLwg1AvhqgZhhkiOqcltq302IQ+VApzqyw0eOEPk5APvnJA/j5KieEP8o3KI eTPk0c6OAs0aOZdW0oSkdHf+G0AVGVm5OPTnT3mGtX5vL84GFTej6GchpcBh3T5Bw3KT aOEFnjdtvDSUJAaMhBVZ/62JDXWpnAP2fUUC4fc/51fjjZhs0HMxs8+KH4YVl6cGm/N+ Tr6BNr8nRWYa7ub9I8X/fIUnFCDftPtPIAl0SlBiaJR2r6ExpX+Y/t36rKviqlQWNaNc TesH5sNsjEMKj3vljaWiLDCWFju2ZEhO57X20hYZ9RnEj/jtgukPJ2YpjaPXZRsdm7Qg Q98Q== 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; bh=yn6Id06pDDX/+u4mQsjGgX3TBS/5u8W5OOwPhGIgFdM=; b=AzsyrEnya6QCzNvm1TKE7nyR51AebF4nUZDIxy0E9XtW6coXKUBWWlxZUrLmiLR2rA y80R0CZtRDzYUHrGhChPqx5bb8cM/8EEWdcHAco2C2RFaUR+Tx3+7o9v5paI0tFNP7d9 4YDLnksy2oSBp8mCNbxUl9rjDAwfFvP69PI9PyehYZLijORkLNxKkkL8HAjqpVuXc1fa scanRYilJEHzEqlDG521N4PstbZmXGQjFj2UrLLPeGnSv/l38uWQLoXX66+q6weaG0Yk FGINon3/1sGYZ57R4PquIH2sJ0eGk2p7BswtTeeoEZj37LLZqpn8eYZmGPK3Xy/sTgw0 6Wmw== X-Gm-Message-State: APjAAAUUvXges0sxrFFRvFbvPdxEbkVmh1jcROgJMte9B3wyabOpOujR mXHEY1wPdOxff70bRFdYDiE= X-Google-Smtp-Source: APXvYqw8WChf9BG5BreV5SUSIsaLZMXms31bwzlET9t+fOAgDmvooHPOEV5Pq0+Fu4l/eNjOVzO6Fg== X-Received: by 2002:a1c:c101:: with SMTP id r1mr2526596wmf.123.1555585933878; Thu, 18 Apr 2019 04:12:13 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::64]) by smtp.gmail.com with ESMTPSA id z63sm2005594wme.30.2019.04.18.04.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 04:12:13 -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 V3 0/8] clk: make register endianness a run-time property Date: Thu, 18 Apr 2019 13:12:03 +0200 Message-Id: <20190418111211.10474-1-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190418_041215_742509_9E0D23E1 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the endianness for register accesses of basic clocks if fixed based on the architecture (BE for PowerPC, LE for everyone else). This is inconvenient for architectures that support both. To avoid adding more rules to the #ifdef, this patchset adds new flags to the basic clocks to tag the registers as BE then converts the only big endian machine PowerPC to use it. While not used by PowerPC, also add big endian support to clk-fractional- divider and clk-multiplier, to cover all basic clocks. Technically clk-multiplier isn't one as it doesn't provide any registration functions and none of its users set the basic clock flag, but nevertheless it and its flags are defined clk-provider.h. So I think it's close enough to a basic clock to still count. That way we can drop the special casing for PowerPC, and allow other big endian platforms/drivers to make use of the basic clocks. In addition, we can now drop clk_readl and clk_writel, and replace them with normal readl and writel accessors everywhere. Still RFT because I don't have a PowerPC device to test, and especially not a 512x one. I did compile test it though! I looked really hard, and this is the only place I could find where a PowerPC platform (indirectly) used the clk accessors. None of the regular drivers in clk/ were selected in any of the powerpc defconfigs, and this was the only platform code that registered basic clocks. Changelog: V2 -> V3: * fix passed arguments to clk_div_readl found by kbuild * drop unneeded else in generic read accessors * fix a >80 chars line issue in the powerpc patch V1 -> V2: * switch from global flag to per-clock flag * also added fractional divider and multiplier clocks, to make all basic or quasi basic clocks support big endian * reordered the basic clock patches in alphabetical order * drop clk_{readl,writel} instead of adding BE variants and use common accessors directly * dropped the RFC, as I got comments (yay). More always welcome of course :-) Jonas Gorski (8): clk: divider: add explicit big endian support clk: fractional-divider: add explicit big endian support clk: gate: add explicit big endian support clk: multiplier: add explicit big endian support clk: mux: add explicit big endian support powerpc/512x: mark clocks as big endian clk: core: remove powerpc special handling clk: core: replace clk_{readl,writel} with {readl,writel} arch/powerpc/platforms/512x/clock-commonclk.c | 9 +++-- drivers/clk/clk-divider.c | 26 +++++++++++--- drivers/clk/clk-fractional-divider.c | 22 ++++++++++-- drivers/clk/clk-gate.c | 22 ++++++++++-- drivers/clk/clk-multiplier.c | 22 ++++++++++-- drivers/clk/clk-mux.c | 22 ++++++++++-- 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 | 51 +++++++++++---------------- 19 files changed, 181 insertions(+), 107 deletions(-)