Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reset: zx2967: use the reset-simple driver

The reset-simple driver can be used without changes.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Alexandru Gagniuc <alex.g@adaptrum.com>

+4 -109
-1
MAINTAINERS
··· 2124 2124 F: drivers/i2c/busses/i2c-zx2967.c 2125 2125 F: drivers/mmc/host/dw_mmc-zx.* 2126 2126 F: drivers/pinctrl/zte/ 2127 - F: drivers/reset/reset-zx2967.c 2128 2127 F: drivers/soc/zte/ 2129 2128 F: drivers/thermal/zx2967_thermal.c 2130 2129 F: drivers/watchdog/zx2967_wdt.c
+2 -8
drivers/reset/Kconfig
··· 77 77 78 78 config RESET_SIMPLE 79 79 bool "Simple Reset Controller Driver" if COMPILE_TEST 80 - default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI 80 + default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX 81 81 help 82 82 This enables a simple reset controller driver for reset lines that 83 83 that can be asserted and deasserted by toggling bits in a contiguous, 84 84 exclusive register space. 85 85 86 86 Currently this driver supports Altera SoCFPGAs, the RCC reset 87 - controller in STM32 MCUs, and Allwinner SoCs. 87 + controller in STM32 MCUs, Allwinner SoCs, and ZTE's zx2967 family. 88 88 89 89 config RESET_SUNXI 90 90 bool "Allwinner SoCs Reset Driver" if COMPILE_TEST && !ARCH_SUNXI ··· 120 120 Support for reset controllers on UniPhier SoCs. 121 121 Say Y if you want to control reset signals provided by System Control 122 122 block, Media I/O block, Peripheral Block. 123 - 124 - config RESET_ZX2967 125 - bool "ZTE ZX2967 Reset Driver" 126 - depends on ARCH_ZX || COMPILE_TEST 127 - help 128 - This enables the reset controller driver for ZTE's zx2967 family. 129 123 130 124 config RESET_ZYNQ 131 125 bool "ZYNQ Reset Driver" if COMPILE_TEST
-1
drivers/reset/Makefile
··· 17 17 obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o 18 18 obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o 19 19 obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o 20 - obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o 21 20 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o 22 21
+2
drivers/reset/reset-simple.c
··· 123 123 { .compatible = "st,stm32-rcc", }, 124 124 { .compatible = "allwinner,sun6i-a31-clock-reset", 125 125 .data = &reset_simple_active_low }, 126 + { .compatible = "zte,zx296718-reset", 127 + .data = &reset_simple_active_low }, 126 128 { /* sentinel */ }, 127 129 }; 128 130
-99
drivers/reset/reset-zx2967.c
··· 1 - /* 2 - * ZTE's zx2967 family reset controller driver 3 - * 4 - * Copyright (C) 2017 ZTE Ltd. 5 - * 6 - * Author: Baoyou Xie <baoyou.xie@linaro.org> 7 - * 8 - * License terms: GNU General Public License (GPL) version 2 9 - */ 10 - 11 - #include <linux/of_address.h> 12 - #include <linux/platform_device.h> 13 - #include <linux/reset-controller.h> 14 - 15 - struct zx2967_reset { 16 - void __iomem *reg_base; 17 - spinlock_t lock; 18 - struct reset_controller_dev rcdev; 19 - }; 20 - 21 - static int zx2967_reset_act(struct reset_controller_dev *rcdev, 22 - unsigned long id, bool assert) 23 - { 24 - struct zx2967_reset *reset = NULL; 25 - int bank = id / 32; 26 - int offset = id % 32; 27 - u32 reg; 28 - unsigned long flags; 29 - 30 - reset = container_of(rcdev, struct zx2967_reset, rcdev); 31 - 32 - spin_lock_irqsave(&reset->lock, flags); 33 - 34 - reg = readl_relaxed(reset->reg_base + (bank * 4)); 35 - if (assert) 36 - reg &= ~BIT(offset); 37 - else 38 - reg |= BIT(offset); 39 - writel_relaxed(reg, reset->reg_base + (bank * 4)); 40 - 41 - spin_unlock_irqrestore(&reset->lock, flags); 42 - 43 - return 0; 44 - } 45 - 46 - static int zx2967_reset_assert(struct reset_controller_dev *rcdev, 47 - unsigned long id) 48 - { 49 - return zx2967_reset_act(rcdev, id, true); 50 - } 51 - 52 - static int zx2967_reset_deassert(struct reset_controller_dev *rcdev, 53 - unsigned long id) 54 - { 55 - return zx2967_reset_act(rcdev, id, false); 56 - } 57 - 58 - static const struct reset_control_ops zx2967_reset_ops = { 59 - .assert = zx2967_reset_assert, 60 - .deassert = zx2967_reset_deassert, 61 - }; 62 - 63 - static int zx2967_reset_probe(struct platform_device *pdev) 64 - { 65 - struct zx2967_reset *reset; 66 - struct resource *res; 67 - 68 - reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); 69 - if (!reset) 70 - return -ENOMEM; 71 - 72 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 73 - reset->reg_base = devm_ioremap_resource(&pdev->dev, res); 74 - if (IS_ERR(reset->reg_base)) 75 - return PTR_ERR(reset->reg_base); 76 - 77 - spin_lock_init(&reset->lock); 78 - 79 - reset->rcdev.owner = THIS_MODULE; 80 - reset->rcdev.nr_resets = resource_size(res) * 8; 81 - reset->rcdev.ops = &zx2967_reset_ops; 82 - reset->rcdev.of_node = pdev->dev.of_node; 83 - 84 - return devm_reset_controller_register(&pdev->dev, &reset->rcdev); 85 - } 86 - 87 - static const struct of_device_id zx2967_reset_dt_ids[] = { 88 - { .compatible = "zte,zx296718-reset", }, 89 - {}, 90 - }; 91 - 92 - static struct platform_driver zx2967_reset_driver = { 93 - .probe = zx2967_reset_probe, 94 - .driver = { 95 - .name = "zx2967-reset", 96 - .of_match_table = zx2967_reset_dt_ids, 97 - }, 98 - }; 99 - builtin_platform_driver(zx2967_reset_driver);