From patchwork Fri Feb 12 09:31:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 8289281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 997F9BEEE5 for ; Fri, 12 Feb 2016 09:33:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7512203B7 for ; Fri, 12 Feb 2016 09:33:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE997203B5 for ; Fri, 12 Feb 2016 09:33:33 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUA5B-0001c9-Ma; Fri, 12 Feb 2016 09:32:09 +0000 Received: from mirror2.csie.ntu.edu.tw ([140.112.30.76] helo=wens.csie.org) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aUA4i-0001O4-Cn for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2016 09:31:42 +0000 Received: by wens.csie.org (Postfix, from userid 1000) id 6753A5F82C; Fri, 12 Feb 2016 17:31:16 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Michael Turquette , Stephen Boyd Subject: [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock Date: Fri, 12 Feb 2016 17:31:14 +0800 Message-Id: <1455269475-8180-2-git-send-email-wens@csie.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1455269475-8180-1-git-send-email-wens@csie.org> References: <1455269475-8180-1-git-send-email-wens@csie.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160212_013140_819386_72E9C023 X-CRM114-Status: GOOD ( 12.23 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, Chen-Yu Tsai , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A80's APBS clock is not the same as the APB0 clock on A23. The A80's is a zero-based divider, while the A23's is a power-of-two divider. Replace the CLK_OF_DECLARE version of sun8i-a23-apb0. This also extends the common setup function to take div clk flags. Signed-off-by: Chen-Yu Tsai Acked-by: Rob Herring --- Documentation/devicetree/bindings/clock/sunxi.txt | 1 + drivers/clk/sunxi/clk-sun8i-apb0.c | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt index 966dcaffcb9c..5206e48694d6 100644 --- a/Documentation/devicetree/bindings/clock/sunxi.txt +++ b/Documentation/devicetree/bindings/clock/sunxi.txt @@ -60,6 +60,7 @@ Required properties: "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 "allwinner,sun8i-a83t-bus-gates-clk" - for the bus gates on A83T "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3 + "allwinner,sun9i-a80-apbs-clk" - for the APBS clock on A80 "allwinner,sun9i-a80-apbs-gates-clk" - for the APBS gates on A80 "allwinner,sun4i-a10-dram-gates-clk" - for the DRAM gates on A10 "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c b/drivers/clk/sunxi/clk-sun8i-apb0.c index 7ba61103a6f5..cfe9c19a831b 100644 --- a/drivers/clk/sunxi/clk-sun8i-apb0.c +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c @@ -21,7 +21,7 @@ #include static struct clk *sun8i_a23_apb0_register(struct device_node *node, - void __iomem *reg) + void __iomem *reg, u8 div_flags) { const char *clk_name = node->name; const char *clk_parent; @@ -36,7 +36,7 @@ static struct clk *sun8i_a23_apb0_register(struct device_node *node, /* The A23 APB0 clock is a standard 2 bit wide divider clock */ clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg, - 0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); + 0, 2, div_flags, NULL); if (IS_ERR(clk)) return clk; @@ -52,7 +52,7 @@ err_unregister: return ERR_PTR(ret); } -static void sun8i_a23_apb0_setup(struct device_node *node) +static void sun9i_a80_apbs_setup(struct device_node *node) { void __iomem *reg; struct resource res; @@ -60,18 +60,11 @@ static void sun8i_a23_apb0_setup(struct device_node *node) reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) { - /* - * This happens with clk nodes instantiated through mfd, - * as those do not have their resources assigned in the - * device tree. Do not print an error in this case. - */ - if (PTR_ERR(reg) != -EINVAL) - pr_err("Could not get registers for a23-apb0-clk\n"); - + pr_err("Could not get registers for a80-apbs-clk\n"); return; } - clk = sun8i_a23_apb0_register(node, reg); + clk = sun8i_a23_apb0_register(node, reg, 0); if (IS_ERR(clk)) goto err_unmap; @@ -82,8 +75,8 @@ err_unmap: of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); } -CLK_OF_DECLARE(sun8i_a23_apb0, "allwinner,sun8i-a23-apb0-clk", - sun8i_a23_apb0_setup); +CLK_OF_DECLARE(sun9i_a80_apbs, "allwinner,sun9i-a80-apbs-clk", + sun9i_a80_apbs_setup); static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev) { @@ -97,7 +90,7 @@ static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev) if (IS_ERR(reg)) return PTR_ERR(reg); - clk = sun8i_a23_apb0_register(np, reg); + clk = sun8i_a23_apb0_register(np, reg, CLK_DIVIDER_POWER_OF_TWO); if (IS_ERR(clk)) return PTR_ERR(clk);