From patchwork Sat Jan 6 04:23:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 10147631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C141E6020B for ; Sat, 6 Jan 2018 04:26:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6309C28468 for ; Sat, 6 Jan 2018 04:26:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5647C28606; Sat, 6 Jan 2018 04:26:44 +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_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 09FFB28468 for ; Sat, 6 Jan 2018 04:26:43 +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=LdsHEu0Mm4/EeGFO6qWbOSI0J6cimnYN3lkrQQxo9bc=; b=cS2 EQCwJbizrr4MGehiQKAqHx+dVqmGYUCbQ4ORDMVF8hEVNCQ7UeBRNdhQsTGvUmhHFfs6fQaUyes71 coOCZY87wBEuKYKpeKK6RrJTx0s1iwh0EawxVG8PEeINAYk2mJUfZkVpBBGrI36V2Odql4ZOv/jwV 477v8C1wyMMqEQttdBcQfLHcfOQ2v+O0j3M2I1BC3pR6qz1Gn0uQaJ0juVE8r1SHm/epMPbM40ucV jSeFeI+nabrZiOX3D/1NTYk6yk4EYOf0BoYEfYNBtDkFQ8rYPRHPnfXDadsrzqKXuymoVTnxOqrkI KyWNsr+FaVLLIkvJ6P0UkrZz3kJJheA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eXg4A-0000Pq-BW; Sat, 06 Jan 2018 04:26:42 +0000 Received: from weasel.birch.relay.mailchannels.net ([23.83.209.247]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eXg47-0000Od-1U for linux-arm-kernel@lists.infradead.org; Sat, 06 Jan 2018 04:26:40 +0000 X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 63E825C057D; Sat, 6 Jan 2018 04:26:26 +0000 (UTC) Received: from hermes.aosc.io (unknown [100.96.29.6]) (Authenticated sender: lmn-TZDUIOWCRQMW) by relay.mailchannels.net (Postfix) with ESMTPA id 799A75C01A8; Sat, 6 Jan 2018 04:26:25 +0000 (UTC) X-Sender-Id: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io Received: from hermes.aosc.io (hermes.aosc.io [172.18.52.53]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.11.3); Sat, 06 Jan 2018 04:26:26 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: lmn-tzduiowcrqmw|x-authsender|icenowy@aosc.io X-MailChannels-Auth-Id: lmn-TZDUIOWCRQMW X-Occur-Cold: 35906829582223a4_1515212786102_952473183 X-MC-Loop-Signature: 1515212786101:3086433039 X-MC-Ingress-Time: 1515212786100 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id C4855550A4; Sat, 6 Jan 2018 04:25:48 +0000 (UTC) From: Icenowy Zheng To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Linus Walleij Subject: [PATCH 1/7] pinctrl: sunxi: add support for pin controllers without bus gate Date: Sat, 6 Jan 2018 12:23:20 +0800 Message-Id: <20180106042326.46519-1-icenowy@aosc.io> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180105_202639_243811_7D2C128A X-CRM114-Status: GOOD ( 11.80 ) 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-sunxi@googlegroups.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng 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 The Allwinner H6 pin controllers (both the main one and the CPUs one) have no bus gate clocks. Add support for this kind of pin controllers. Signed-off-by: Icenowy Zheng --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 30 ++++++++++++++++++++---------- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 4b6cb25bc796..68cd505679d9 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -1182,7 +1182,12 @@ static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl, unsigned int hosc_div, losc_div; struct clk *hosc, *losc; u8 div, src; - int i, ret; + int i, ret, clk_count; + + if (pctl->desc->without_bus_gate) + clk_count = 2; + else + clk_count = 3; /* Deal with old DTs that didn't have the oscillators */ if (of_count_phandle_with_args(node, "clocks", "#clock-cells") != 3) @@ -1360,15 +1365,19 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, goto gpiochip_error; } - clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - goto gpiochip_error; - } + if (!desc->without_bus_gate) { + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + goto gpiochip_error; + } - ret = clk_prepare_enable(clk); - if (ret) - goto gpiochip_error; + ret = clk_prepare_enable(clk); + if (ret) + goto gpiochip_error; + } else { + clk = NULL; + } pctl->irq = devm_kcalloc(&pdev->dev, pctl->desc->irq_banks, @@ -1425,7 +1434,8 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev, return 0; clk_error: - clk_disable_unprepare(clk); + if (clk) + clk_disable_unprepare(clk); gpiochip_error: gpiochip_remove(pctl->chip); return ret; diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index 11b128f54ed2..ccb6230f0bb5 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h @@ -113,6 +113,7 @@ struct sunxi_pinctrl_desc { unsigned irq_bank_base; bool irq_read_needs_mux; bool disable_strict_mode; + bool without_bus_gate; }; struct sunxi_pinctrl_function {