From patchwork Wed Aug 16 09:47:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 9903391 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 355DB60244 for ; Wed, 16 Aug 2017 09:51:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24443287A5 for ; Wed, 16 Aug 2017 09:51:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17AE628987; Wed, 16 Aug 2017 09:51:01 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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 5F623287A5 for ; Wed, 16 Aug 2017 09:51:00 +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=8y55SmlbEXfI8KhzNNjN6/V6uFvks3ubKPHbJz6OA8Q=; b=lOU61j86FuaF9U4YagF+1iWE9t 2KeivfBqiBpIoHm10dOvZo/KqRgo4FOPA0cPFaZ/39J4OmoMV50FqzBDhhaOwuVg/iCCJfCyx2hsa 0MB+2rl5XZT5gR08Q2iGnucS+jNBXBfHuVVDK9mqYrR7vju2Wq6PLUxF1DJsSPbe05vEcv87uYlX8 Na7EXUQXHLxVRhYT4fW5cwiaGEbvGngfYvjq7GE8FDmezIDghSZIeYdmpcw0ZxSSPWsoUgyG0o3Cd eiZsySmhY8JVjYrOPCTsM1F54O5VZgIvyzJJtAYFjlRn9b/1K5cMmh/8AZtq1v5TA1XgNgbncETuh ZhSa60dg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dhuyS-0005Bq-PH; Wed, 16 Aug 2017 09:50:52 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dhuvc-0001xU-5b for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2017 09:48:17 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.84_2) (envelope-from ) id 1dhuv7-00035j-1v; Wed, 16 Aug 2017 11:47:25 +0200 From: Philipp Zabel To: linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] reset: zx2967: use the reset-simple driver Date: Wed, 16 Aug 2017 11:47:00 +0200 Message-Id: <20170816094701.30678-5-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170816094701.30678-1-p.zabel@pengutronix.de> References: <20170816094701.30678-1-p.zabel@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170816_024757_468206_DD5C8FA9 X-CRM114-Status: GOOD ( 14.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: kernel@pengutronix.de, Alexandru Gagniuc , Steffen Trumtrar , Alexandre Torgue , Andre Przywara , Dinh Nguyen , Chen-Yu Tsai , Maxime Coquelin , Philipp Zabel , Maxime Ripard , Baoyou Xie , Eugeniy Paltsev , =?UTF-8?q?Andreas=20F=C3=A4rber?= , 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-Virus-Scanned: ClamAV using ClamSMTP The reset-simple driver can be used without changes. Signed-off-by: Philipp Zabel Reviewed-by: Alexandru Gagniuc --- MAINTAINERS | 1 - drivers/reset/Kconfig | 10 +---- drivers/reset/Makefile | 1 - drivers/reset/reset-simple.c | 2 + drivers/reset/reset-zx2967.c | 99 -------------------------------------------- 5 files changed, 4 insertions(+), 109 deletions(-) delete mode 100644 drivers/reset/reset-zx2967.c diff --git a/MAINTAINERS b/MAINTAINERS index 57853844969bf..30af04516d8a0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2061,7 +2061,6 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained F: arch/arm/mach-zx/ F: drivers/clk/zte/ -F: drivers/reset/reset-zx2967.c F: drivers/soc/zte/ F: Documentation/devicetree/bindings/arm/zte.txt F: Documentation/devicetree/bindings/clock/zx296702-clk.txt diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 29f4487c290fc..6dfea01023618 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -70,14 +70,14 @@ config RESET_PISTACHIO config RESET_SIMPLE bool "Simple Reset Controller Driver" if COMPILE_TEST - default ARCH_SOCFPGA || ARCH_STM32 || ARCH_SUNXI + default ARCH_SOCFPGA || ARCH_STM32 || ARCH_SUNXI || ARCH_ZX help This enables a simple reset controller driver for reset lines that that can be asserted and deasserted by toggling bits in a contiguous, exclusive register space. Currently this driver supports Altera SoCFPGAs, the RCC reset - controller in STM32 MCUs, and Allwinner SoCs. + controller in STM32 MCUs, Allwinner SoCs, and ZTE's zx2967 family. config RESET_SUNXI bool "Allwinner SoCs Reset Driver" if COMPILE_TEST && !ARCH_SUNXI @@ -114,12 +114,6 @@ config RESET_UNIPHIER Say Y if you want to control reset signals provided by System Control block, Media I/O block, Peripheral Block. -config RESET_ZX2967 - bool "ZTE ZX2967 Reset Driver" - depends on ARCH_ZX || COMPILE_TEST - help - This enables the reset controller driver for ZTE's zx2967 family. - config RESET_ZYNQ bool "ZYNQ Reset Driver" if COMPILE_TEST default ARCH_ZYNQ diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index e8c3a032f4780..3a70c254b5ea5 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile @@ -16,6 +16,5 @@ obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o -obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o diff --git a/drivers/reset/reset-simple.c b/drivers/reset/reset-simple.c index e54a29b8b532d..13e7d5559acc9 100644 --- a/drivers/reset/reset-simple.c +++ b/drivers/reset/reset-simple.c @@ -123,6 +123,8 @@ static const struct of_device_id reset_simple_dt_ids[] = { { .compatible = "st,stm32-rcc", }, { .compatible = "allwinner,sun6i-a31-clock-reset", .data = &reset_simple_active_low }, + { .compatible = "zte,zx296718-reset", + .data = &reset_simple_active_low }, { /* sentinel */ }, }; diff --git a/drivers/reset/reset-zx2967.c b/drivers/reset/reset-zx2967.c deleted file mode 100644 index 4f319f7753d4d..0000000000000 --- a/drivers/reset/reset-zx2967.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ZTE's zx2967 family reset controller driver - * - * Copyright (C) 2017 ZTE Ltd. - * - * Author: Baoyou Xie - * - * License terms: GNU General Public License (GPL) version 2 - */ - -#include -#include -#include - -struct zx2967_reset { - void __iomem *reg_base; - spinlock_t lock; - struct reset_controller_dev rcdev; -}; - -static int zx2967_reset_act(struct reset_controller_dev *rcdev, - unsigned long id, bool assert) -{ - struct zx2967_reset *reset = NULL; - int bank = id / 32; - int offset = id % 32; - u32 reg; - unsigned long flags; - - reset = container_of(rcdev, struct zx2967_reset, rcdev); - - spin_lock_irqsave(&reset->lock, flags); - - reg = readl_relaxed(reset->reg_base + (bank * 4)); - if (assert) - reg &= ~BIT(offset); - else - reg |= BIT(offset); - writel_relaxed(reg, reset->reg_base + (bank * 4)); - - spin_unlock_irqrestore(&reset->lock, flags); - - return 0; -} - -static int zx2967_reset_assert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - return zx2967_reset_act(rcdev, id, true); -} - -static int zx2967_reset_deassert(struct reset_controller_dev *rcdev, - unsigned long id) -{ - return zx2967_reset_act(rcdev, id, false); -} - -static const struct reset_control_ops zx2967_reset_ops = { - .assert = zx2967_reset_assert, - .deassert = zx2967_reset_deassert, -}; - -static int zx2967_reset_probe(struct platform_device *pdev) -{ - struct zx2967_reset *reset; - struct resource *res; - - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); - if (!reset) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - reset->reg_base = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(reset->reg_base)) - return PTR_ERR(reset->reg_base); - - spin_lock_init(&reset->lock); - - reset->rcdev.owner = THIS_MODULE; - reset->rcdev.nr_resets = resource_size(res) * 8; - reset->rcdev.ops = &zx2967_reset_ops; - reset->rcdev.of_node = pdev->dev.of_node; - - return devm_reset_controller_register(&pdev->dev, &reset->rcdev); -} - -static const struct of_device_id zx2967_reset_dt_ids[] = { - { .compatible = "zte,zx296718-reset", }, - {}, -}; - -static struct platform_driver zx2967_reset_driver = { - .probe = zx2967_reset_probe, - .driver = { - .name = "zx2967-reset", - .of_match_table = zx2967_reset_dt_ids, - }, -}; -builtin_platform_driver(zx2967_reset_driver);