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

Merge tag 'reset-for-4.15' of git://git.pengutronix.de/git/pza/linux into next/drivers

Pull "Reset controller changes for v4.15" from Philipp Zabel:

- add ARC AX10x support,
merged from a separate branch that is also included in the ARC tree
- add Stratix10 support via socfpga
- unify socfpga, stm32, sunxi, and zx2967 into simple-reset driver
- add Meson GX reset level control and remove an unneeded check
- add Uniphier PXs3 and ethernet reset controls
- add MT7622 reset control dt-bindings header

* tag 'reset-for-4.15' of git://git.pengutronix.de/git/pza/linux:
reset: zx2967: use the reset-simple driver
reset: stm32: use the reset-simple driver
reset: socfpga: use the reset-simple driver
reset: sunxi: use reset-simple driver
reset: add reset-simple to unify socfpga, stm32, sunxi, and zx2967
reset: meson: remove unneeded check in meson_reset_reset
reset: meson: add level reset support for GX SoC family
reset: uniphier: add PXs3 reset data
reset: mediatek: add reset controller dt-bindings required header for MT7622 SoC
reset: socfpga: build the reset-socfpga for Stratix10 SOC
reset: uniphier: add ethernet reset control support
reset: socfpga: fix for 64-bit compilation
ARC: reset: introduce AXS10x reset driver

+561 -485
+33
Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt
··· 1 + Binding for the AXS10x reset controller 2 + 3 + This binding describes the ARC AXS10x boards custom IP-block which allows 4 + to control reset signals of selected peripherals. For example DW GMAC, etc... 5 + This block is controlled via memory-mapped register (AKA CREG) which 6 + represents up-to 32 reset lines. 7 + 8 + As of today only the following lines are used: 9 + - DW GMAC - line 5 10 + 11 + This binding uses the common reset binding[1]. 12 + 13 + [1] Documentation/devicetree/bindings/reset/reset.txt 14 + 15 + Required properties: 16 + - compatible: should be "snps,axs10x-reset". 17 + - reg: should always contain pair address - length: for creg reset 18 + bits register. 19 + - #reset-cells: from common reset binding; Should always be set to 1. 20 + 21 + Example: 22 + reset: reset-controller@11220 { 23 + compatible = "snps,axs10x-reset"; 24 + #reset-cells = <1>; 25 + reg = <0x11220 0x4>; 26 + }; 27 + 28 + Specifying reset lines connected to IP modules: 29 + ethernet@.... { 30 + .... 31 + resets = <&reset 5>; 32 + .... 33 + };
+3
Documentation/devicetree/bindings/reset/uniphier-reset.txt
··· 13 13 "socionext,uniphier-pxs2-reset" - for PXs2/LD6b SoC 14 14 "socionext,uniphier-ld11-reset" - for LD11 SoC 15 15 "socionext,uniphier-ld20-reset" - for LD20 SoC 16 + "socionext,uniphier-pxs3-reset" - for PXs3 SoC 16 17 - #reset-cells: should be 1. 17 18 18 19 Example: ··· 45 44 "socionext,uniphier-ld11-mio-reset" - for LD11 SoC (MIO) 46 45 "socionext,uniphier-ld11-sd-reset" - for LD11 SoC (SD) 47 46 "socionext,uniphier-ld20-sd-reset" - for LD20 SoC 47 + "socionext,uniphier-pxs3-sd-reset" - for PXs3 SoC 48 48 - #reset-cells: should be 1. 49 49 50 50 Example: ··· 76 74 "socionext,uniphier-pxs2-peri-reset" - for PXs2/LD6b SoC 77 75 "socionext,uniphier-ld11-peri-reset" - for LD11 SoC 78 76 "socionext,uniphier-ld20-peri-reset" - for LD20 SoC 77 + "socionext,uniphier-pxs3-peri-reset" - for PXs3 SoC 79 78 - #reset-cells: should be 1. 80 79 81 80 Example:
+6 -1
MAINTAINERS
··· 2136 2136 F: drivers/i2c/busses/i2c-zx2967.c 2137 2137 F: drivers/mmc/host/dw_mmc-zx.* 2138 2138 F: drivers/pinctrl/zte/ 2139 - F: drivers/reset/reset-zx2967.c 2140 2139 F: drivers/soc/zte/ 2141 2140 F: drivers/thermal/zx2967_thermal.c 2142 2141 F: drivers/watchdog/zx2967_wdt.c ··· 12912 12913 F: arch/arc/plat-axs10x 12913 12914 F: arch/arc/boot/dts/ax* 12914 12915 F: Documentation/devicetree/bindings/arc/axs10* 12916 + 12917 + SYNOPSYS AXS10x RESET CONTROLLER DRIVER 12918 + M: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> 12919 + S: Supported 12920 + F: drivers/reset/reset-axs10x.c 12921 + F: Documentation/devicetree/bindings/reset/snps,axs10x-reset.txt 12915 12922 12916 12923 SYNOPSYS DESIGNWARE DMAC DRIVER 12917 12924 M: Viresh Kumar <vireshk@kernel.org>
+15 -15
drivers/reset/Kconfig
··· 28 28 This enables the ATH79 reset controller driver that supports the 29 29 AR71xx SoC reset controller. 30 30 31 + config RESET_AXS10X 32 + bool "AXS10x Reset Driver" if COMPILE_TEST 33 + default ARC_PLAT_AXS10X 34 + help 35 + This enables the reset controller driver for AXS10x. 36 + 31 37 config RESET_BERLIN 32 38 bool "Berlin Reset Driver" if COMPILE_TEST 33 39 default ARCH_BERLIN ··· 81 75 help 82 76 This enables the reset driver for ImgTec Pistachio SoCs. 83 77 84 - config RESET_SOCFPGA 85 - bool "SoCFPGA Reset Driver" if COMPILE_TEST 86 - default ARCH_SOCFPGA 78 + config RESET_SIMPLE 79 + bool "Simple Reset Controller Driver" if COMPILE_TEST 80 + default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX 87 81 help 88 - This enables the reset controller driver for Altera SoCFPGAs. 82 + This enables a simple reset controller driver for reset lines that 83 + that can be asserted and deasserted by toggling bits in a contiguous, 84 + exclusive register space. 89 85 90 - config RESET_STM32 91 - bool "STM32 Reset Driver" if COMPILE_TEST 92 - default ARCH_STM32 93 - help 94 - This enables the RCC reset controller driver for STM32 MCUs. 86 + Currently this driver supports Altera SoCFPGAs, the RCC reset 87 + controller in STM32 MCUs, Allwinner SoCs, and ZTE's zx2967 family. 95 88 96 89 config RESET_SUNXI 97 90 bool "Allwinner SoCs Reset Driver" if COMPILE_TEST && !ARCH_SUNXI 98 91 default ARCH_SUNXI 92 + select RESET_SIMPLE 99 93 help 100 94 This enables the reset driver for Allwinner SoCs. 101 95 ··· 126 120 Support for reset controllers on UniPhier SoCs. 127 121 Say Y if you want to control reset signals provided by System Control 128 122 block, Media I/O block, Peripheral Block. 129 - 130 - config RESET_ZX2967 131 - bool "ZTE ZX2967 Reset Driver" 132 - depends on ARCH_ZX || COMPILE_TEST 133 - help 134 - This enables the reset controller driver for ZTE's zx2967 family. 135 123 136 124 config RESET_ZYNQ 137 125 bool "ZYNQ Reset Driver" if COMPILE_TEST
+2 -3
drivers/reset/Makefile
··· 4 4 obj-$(CONFIG_ARCH_TEGRA) += tegra/ 5 5 obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o 6 6 obj-$(CONFIG_RESET_ATH79) += reset-ath79.o 7 + obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o 7 8 obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o 8 9 obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o 9 10 obj-$(CONFIG_RESET_IMX7) += reset-imx7.o ··· 13 12 obj-$(CONFIG_RESET_MESON) += reset-meson.o 14 13 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o 15 14 obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o 16 - obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o 17 - obj-$(CONFIG_RESET_STM32) += reset-stm32.o 15 + obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o 18 16 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o 19 17 obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o 20 18 obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o 21 19 obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o 22 - obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o 23 20 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o 24 21
+83
drivers/reset/reset-axs10x.c
··· 1 + /* 2 + * Copyright (C) 2017 Synopsys. 3 + * 4 + * Synopsys AXS10x reset driver. 5 + * 6 + * This file is licensed under the terms of the GNU General Public 7 + * License version 2. This program is licensed "as is" without any 8 + * warranty of any kind, whether express or implied. 9 + */ 10 + 11 + #include <linux/io.h> 12 + #include <linux/module.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/reset-controller.h> 15 + 16 + #define to_axs10x_rst(p) container_of((p), struct axs10x_rst, rcdev) 17 + 18 + #define AXS10X_MAX_RESETS 32 19 + 20 + struct axs10x_rst { 21 + void __iomem *regs_rst; 22 + spinlock_t lock; 23 + struct reset_controller_dev rcdev; 24 + }; 25 + 26 + static int axs10x_reset_reset(struct reset_controller_dev *rcdev, 27 + unsigned long id) 28 + { 29 + struct axs10x_rst *rst = to_axs10x_rst(rcdev); 30 + unsigned long flags; 31 + 32 + spin_lock_irqsave(&rst->lock, flags); 33 + writel(BIT(id), rst->regs_rst); 34 + spin_unlock_irqrestore(&rst->lock, flags); 35 + 36 + return 0; 37 + } 38 + 39 + static const struct reset_control_ops axs10x_reset_ops = { 40 + .reset = axs10x_reset_reset, 41 + }; 42 + 43 + static int axs10x_reset_probe(struct platform_device *pdev) 44 + { 45 + struct axs10x_rst *rst; 46 + struct resource *mem; 47 + 48 + rst = devm_kzalloc(&pdev->dev, sizeof(*rst), GFP_KERNEL); 49 + if (!rst) 50 + return -ENOMEM; 51 + 52 + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 53 + rst->regs_rst = devm_ioremap_resource(&pdev->dev, mem); 54 + if (IS_ERR(rst->regs_rst)) 55 + return PTR_ERR(rst->regs_rst); 56 + 57 + spin_lock_init(&rst->lock); 58 + 59 + rst->rcdev.owner = THIS_MODULE; 60 + rst->rcdev.ops = &axs10x_reset_ops; 61 + rst->rcdev.of_node = pdev->dev.of_node; 62 + rst->rcdev.nr_resets = AXS10X_MAX_RESETS; 63 + 64 + return devm_reset_controller_register(&pdev->dev, &rst->rcdev); 65 + } 66 + 67 + static const struct of_device_id axs10x_reset_dt_match[] = { 68 + { .compatible = "snps,axs10x-reset" }, 69 + { }, 70 + }; 71 + 72 + static struct platform_driver axs10x_reset_driver = { 73 + .probe = axs10x_reset_probe, 74 + .driver = { 75 + .name = "axs10x-reset", 76 + .of_match_table = axs10x_reset_dt_match, 77 + }, 78 + }; 79 + builtin_platform_driver(axs10x_reset_driver); 80 + 81 + MODULE_AUTHOR("Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>"); 82 + MODULE_DESCRIPTION("Synopsys AXS10x reset driver"); 83 + MODULE_LICENSE("GPL v2");
+58 -7
drivers/reset/reset-meson.c
··· 62 62 #include <linux/reset-controller.h> 63 63 #include <linux/slab.h> 64 64 #include <linux/types.h> 65 + #include <linux/of_device.h> 65 66 66 67 #define REG_COUNT 8 67 68 #define BITS_PER_REG 32 69 + #define LEVEL_OFFSET 0x7c 68 70 69 71 struct meson_reset { 70 72 void __iomem *reg_base; 71 73 struct reset_controller_dev rcdev; 74 + spinlock_t lock; 72 75 }; 73 76 74 77 static int meson_reset_reset(struct reset_controller_dev *rcdev, ··· 83 80 unsigned int offset = id % BITS_PER_REG; 84 81 void __iomem *reg_addr = data->reg_base + (bank << 2); 85 82 86 - if (bank >= REG_COUNT) 87 - return -EINVAL; 88 - 89 83 writel(BIT(offset), reg_addr); 90 84 91 85 return 0; 92 86 } 93 87 94 - static const struct reset_control_ops meson_reset_ops = { 88 + static int meson_reset_level(struct reset_controller_dev *rcdev, 89 + unsigned long id, bool assert) 90 + { 91 + struct meson_reset *data = 92 + container_of(rcdev, struct meson_reset, rcdev); 93 + unsigned int bank = id / BITS_PER_REG; 94 + unsigned int offset = id % BITS_PER_REG; 95 + void __iomem *reg_addr = data->reg_base + LEVEL_OFFSET + (bank << 2); 96 + unsigned long flags; 97 + u32 reg; 98 + 99 + spin_lock_irqsave(&data->lock, flags); 100 + 101 + reg = readl(reg_addr); 102 + if (assert) 103 + writel(reg & ~BIT(offset), reg_addr); 104 + else 105 + writel(reg | BIT(offset), reg_addr); 106 + 107 + spin_unlock_irqrestore(&data->lock, flags); 108 + 109 + return 0; 110 + } 111 + 112 + static int meson_reset_assert(struct reset_controller_dev *rcdev, 113 + unsigned long id) 114 + { 115 + return meson_reset_level(rcdev, id, true); 116 + } 117 + 118 + static int meson_reset_deassert(struct reset_controller_dev *rcdev, 119 + unsigned long id) 120 + { 121 + return meson_reset_level(rcdev, id, false); 122 + } 123 + 124 + static const struct reset_control_ops meson_reset_meson8_ops = { 95 125 .reset = meson_reset_reset, 96 126 }; 97 127 128 + static const struct reset_control_ops meson_reset_gx_ops = { 129 + .reset = meson_reset_reset, 130 + .assert = meson_reset_assert, 131 + .deassert = meson_reset_deassert, 132 + }; 133 + 98 134 static const struct of_device_id meson_reset_dt_ids[] = { 99 - { .compatible = "amlogic,meson8b-reset", }, 100 - { .compatible = "amlogic,meson-gxbb-reset", }, 135 + { .compatible = "amlogic,meson8b-reset", 136 + .data = &meson_reset_meson8_ops, }, 137 + { .compatible = "amlogic,meson-gxbb-reset", 138 + .data = &meson_reset_gx_ops, }, 101 139 { /* sentinel */ }, 102 140 }; 103 141 104 142 static int meson_reset_probe(struct platform_device *pdev) 105 143 { 144 + const struct reset_control_ops *ops; 106 145 struct meson_reset *data; 107 146 struct resource *res; 108 147 109 148 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 110 149 if (!data) 111 150 return -ENOMEM; 151 + 152 + ops = of_device_get_match_data(&pdev->dev); 153 + if (!ops) 154 + return -EINVAL; 112 155 113 156 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 114 157 data->reg_base = devm_ioremap_resource(&pdev->dev, res); ··· 163 114 164 115 platform_set_drvdata(pdev, data); 165 116 117 + spin_lock_init(&data->lock); 118 + 166 119 data->rcdev.owner = THIS_MODULE; 167 120 data->rcdev.nr_resets = REG_COUNT * BITS_PER_REG; 168 - data->rcdev.ops = &meson_reset_ops; 121 + data->rcdev.ops = ops; 169 122 data->rcdev.of_node = pdev->dev.of_node; 170 123 171 124 return devm_reset_controller_register(&pdev->dev, &data->rcdev);
+186
drivers/reset/reset-simple.c
··· 1 + /* 2 + * Simple Reset Controller Driver 3 + * 4 + * Copyright (C) 2017 Pengutronix, Philipp Zabel <kernel@pengutronix.de> 5 + * 6 + * Based on Allwinner SoCs Reset Controller driver 7 + * 8 + * Copyright 2013 Maxime Ripard 9 + * 10 + * Maxime Ripard <maxime.ripard@free-electrons.com> 11 + * 12 + * This program is free software; you can redistribute it and/or modify 13 + * it under the terms of the GNU General Public License as published by 14 + * the Free Software Foundation; either version 2 of the License, or 15 + * (at your option) any later version. 16 + */ 17 + 18 + #include <linux/device.h> 19 + #include <linux/err.h> 20 + #include <linux/io.h> 21 + #include <linux/of.h> 22 + #include <linux/of_device.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/reset-controller.h> 25 + #include <linux/spinlock.h> 26 + 27 + #include "reset-simple.h" 28 + 29 + static inline struct reset_simple_data * 30 + to_reset_simple_data(struct reset_controller_dev *rcdev) 31 + { 32 + return container_of(rcdev, struct reset_simple_data, rcdev); 33 + } 34 + 35 + static int reset_simple_update(struct reset_controller_dev *rcdev, 36 + unsigned long id, bool assert) 37 + { 38 + struct reset_simple_data *data = to_reset_simple_data(rcdev); 39 + int reg_width = sizeof(u32); 40 + int bank = id / (reg_width * BITS_PER_BYTE); 41 + int offset = id % (reg_width * BITS_PER_BYTE); 42 + unsigned long flags; 43 + u32 reg; 44 + 45 + spin_lock_irqsave(&data->lock, flags); 46 + 47 + reg = readl(data->membase + (bank * reg_width)); 48 + if (assert ^ data->active_low) 49 + reg |= BIT(offset); 50 + else 51 + reg &= ~BIT(offset); 52 + writel(reg, data->membase + (bank * reg_width)); 53 + 54 + spin_unlock_irqrestore(&data->lock, flags); 55 + 56 + return 0; 57 + } 58 + 59 + static int reset_simple_assert(struct reset_controller_dev *rcdev, 60 + unsigned long id) 61 + { 62 + return reset_simple_update(rcdev, id, true); 63 + } 64 + 65 + static int reset_simple_deassert(struct reset_controller_dev *rcdev, 66 + unsigned long id) 67 + { 68 + return reset_simple_update(rcdev, id, false); 69 + } 70 + 71 + static int reset_simple_status(struct reset_controller_dev *rcdev, 72 + unsigned long id) 73 + { 74 + struct reset_simple_data *data = to_reset_simple_data(rcdev); 75 + int reg_width = sizeof(u32); 76 + int bank = id / (reg_width * BITS_PER_BYTE); 77 + int offset = id % (reg_width * BITS_PER_BYTE); 78 + u32 reg; 79 + 80 + reg = readl(data->membase + (bank * reg_width)); 81 + 82 + return !(reg & BIT(offset)) ^ !data->status_active_low; 83 + } 84 + 85 + const struct reset_control_ops reset_simple_ops = { 86 + .assert = reset_simple_assert, 87 + .deassert = reset_simple_deassert, 88 + .status = reset_simple_status, 89 + }; 90 + 91 + /** 92 + * struct reset_simple_devdata - simple reset controller properties 93 + * @reg_offset: offset between base address and first reset register. 94 + * @nr_resets: number of resets. If not set, default to resource size in bits. 95 + * @active_low: if true, bits are cleared to assert the reset. Otherwise, bits 96 + * are set to assert the reset. 97 + * @status_active_low: if true, bits read back as cleared while the reset is 98 + * asserted. Otherwise, bits read back as set while the 99 + * reset is asserted. 100 + */ 101 + struct reset_simple_devdata { 102 + u32 reg_offset; 103 + u32 nr_resets; 104 + bool active_low; 105 + bool status_active_low; 106 + }; 107 + 108 + #define SOCFPGA_NR_BANKS 8 109 + 110 + static const struct reset_simple_devdata reset_simple_socfpga = { 111 + .reg_offset = 0x10, 112 + .nr_resets = SOCFPGA_NR_BANKS * 32, 113 + .status_active_low = true, 114 + }; 115 + 116 + static const struct reset_simple_devdata reset_simple_active_low = { 117 + .active_low = true, 118 + .status_active_low = true, 119 + }; 120 + 121 + static const struct of_device_id reset_simple_dt_ids[] = { 122 + { .compatible = "altr,rst-mgr", .data = &reset_simple_socfpga }, 123 + { .compatible = "st,stm32-rcc", }, 124 + { .compatible = "allwinner,sun6i-a31-clock-reset", 125 + .data = &reset_simple_active_low }, 126 + { .compatible = "zte,zx296718-reset", 127 + .data = &reset_simple_active_low }, 128 + { /* sentinel */ }, 129 + }; 130 + 131 + static int reset_simple_probe(struct platform_device *pdev) 132 + { 133 + struct device *dev = &pdev->dev; 134 + const struct reset_simple_devdata *devdata; 135 + struct reset_simple_data *data; 136 + void __iomem *membase; 137 + struct resource *res; 138 + u32 reg_offset = 0; 139 + 140 + devdata = of_device_get_match_data(dev); 141 + 142 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 143 + if (!data) 144 + return -ENOMEM; 145 + 146 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 147 + membase = devm_ioremap_resource(dev, res); 148 + if (IS_ERR(membase)) 149 + return PTR_ERR(membase); 150 + 151 + spin_lock_init(&data->lock); 152 + data->membase = membase; 153 + data->rcdev.owner = THIS_MODULE; 154 + data->rcdev.nr_resets = resource_size(res) * BITS_PER_BYTE; 155 + data->rcdev.ops = &reset_simple_ops; 156 + data->rcdev.of_node = dev->of_node; 157 + 158 + if (devdata) { 159 + reg_offset = devdata->reg_offset; 160 + if (devdata->nr_resets) 161 + data->rcdev.nr_resets = devdata->nr_resets; 162 + data->active_low = devdata->active_low; 163 + data->status_active_low = devdata->status_active_low; 164 + } 165 + 166 + if (of_device_is_compatible(dev->of_node, "altr,rst-mgr") && 167 + of_property_read_u32(dev->of_node, "altr,modrst-offset", 168 + &reg_offset)) { 169 + dev_warn(dev, 170 + "missing altr,modrst-offset property, assuming 0x%x!\n", 171 + reg_offset); 172 + } 173 + 174 + data->membase += reg_offset; 175 + 176 + return devm_reset_controller_register(dev, &data->rcdev); 177 + } 178 + 179 + static struct platform_driver reset_simple_driver = { 180 + .probe = reset_simple_probe, 181 + .driver = { 182 + .name = "simple-reset", 183 + .of_match_table = reset_simple_dt_ids, 184 + }, 185 + }; 186 + builtin_platform_driver(reset_simple_driver);
+45
drivers/reset/reset-simple.h
··· 1 + /* 2 + * Simple Reset Controller ops 3 + * 4 + * Based on Allwinner SoCs Reset Controller driver 5 + * 6 + * Copyright 2013 Maxime Ripard 7 + * 8 + * Maxime Ripard <maxime.ripard@free-electrons.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + */ 15 + 16 + #ifndef __RESET_SIMPLE_H__ 17 + #define __RESET_SIMPLE_H__ 18 + 19 + #include <linux/io.h> 20 + #include <linux/reset-controller.h> 21 + #include <linux/spinlock.h> 22 + 23 + /** 24 + * struct reset_simple_data - driver data for simple reset controllers 25 + * @lock: spinlock to protect registers during read-modify-write cycles 26 + * @membase: memory mapped I/O register range 27 + * @rcdev: reset controller device base structure 28 + * @active_low: if true, bits are cleared to assert the reset. Otherwise, bits 29 + * are set to assert the reset. Note that this says nothing about 30 + * the voltage level of the actual reset line. 31 + * @status_active_low: if true, bits read back as cleared while the reset is 32 + * asserted. Otherwise, bits read back as set while the 33 + * reset is asserted. 34 + */ 35 + struct reset_simple_data { 36 + spinlock_t lock; 37 + void __iomem *membase; 38 + struct reset_controller_dev rcdev; 39 + bool active_low; 40 + bool status_active_low; 41 + }; 42 + 43 + extern const struct reset_control_ops reset_simple_ops; 44 + 45 + #endif /* __RESET_SIMPLE_H__ */
-154
drivers/reset/reset-socfpga.c
··· 1 - /* 2 - * Socfpga Reset Controller Driver 3 - * 4 - * Copyright 2014 Steffen Trumtrar <s.trumtrar@pengutronix.de> 5 - * 6 - * based on 7 - * Allwinner SoCs Reset Controller driver 8 - * 9 - * Copyright 2013 Maxime Ripard 10 - * 11 - * Maxime Ripard <maxime.ripard@free-electrons.com> 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 - */ 18 - 19 - #include <linux/err.h> 20 - #include <linux/io.h> 21 - #include <linux/init.h> 22 - #include <linux/of.h> 23 - #include <linux/platform_device.h> 24 - #include <linux/reset-controller.h> 25 - #include <linux/spinlock.h> 26 - #include <linux/types.h> 27 - 28 - #define BANK_INCREMENT 4 29 - #define NR_BANKS 8 30 - 31 - struct socfpga_reset_data { 32 - spinlock_t lock; 33 - void __iomem *membase; 34 - struct reset_controller_dev rcdev; 35 - }; 36 - 37 - static int socfpga_reset_assert(struct reset_controller_dev *rcdev, 38 - unsigned long id) 39 - { 40 - struct socfpga_reset_data *data = container_of(rcdev, 41 - struct socfpga_reset_data, 42 - rcdev); 43 - int bank = id / BITS_PER_LONG; 44 - int offset = id % BITS_PER_LONG; 45 - unsigned long flags; 46 - u32 reg; 47 - 48 - spin_lock_irqsave(&data->lock, flags); 49 - 50 - reg = readl(data->membase + (bank * BANK_INCREMENT)); 51 - writel(reg | BIT(offset), data->membase + (bank * BANK_INCREMENT)); 52 - spin_unlock_irqrestore(&data->lock, flags); 53 - 54 - return 0; 55 - } 56 - 57 - static int socfpga_reset_deassert(struct reset_controller_dev *rcdev, 58 - unsigned long id) 59 - { 60 - struct socfpga_reset_data *data = container_of(rcdev, 61 - struct socfpga_reset_data, 62 - rcdev); 63 - 64 - int bank = id / BITS_PER_LONG; 65 - int offset = id % BITS_PER_LONG; 66 - unsigned long flags; 67 - u32 reg; 68 - 69 - spin_lock_irqsave(&data->lock, flags); 70 - 71 - reg = readl(data->membase + (bank * BANK_INCREMENT)); 72 - writel(reg & ~BIT(offset), data->membase + (bank * BANK_INCREMENT)); 73 - 74 - spin_unlock_irqrestore(&data->lock, flags); 75 - 76 - return 0; 77 - } 78 - 79 - static int socfpga_reset_status(struct reset_controller_dev *rcdev, 80 - unsigned long id) 81 - { 82 - struct socfpga_reset_data *data = container_of(rcdev, 83 - struct socfpga_reset_data, rcdev); 84 - int bank = id / BITS_PER_LONG; 85 - int offset = id % BITS_PER_LONG; 86 - u32 reg; 87 - 88 - reg = readl(data->membase + (bank * BANK_INCREMENT)); 89 - 90 - return !(reg & BIT(offset)); 91 - } 92 - 93 - static const struct reset_control_ops socfpga_reset_ops = { 94 - .assert = socfpga_reset_assert, 95 - .deassert = socfpga_reset_deassert, 96 - .status = socfpga_reset_status, 97 - }; 98 - 99 - static int socfpga_reset_probe(struct platform_device *pdev) 100 - { 101 - struct socfpga_reset_data *data; 102 - struct resource *res; 103 - struct device *dev = &pdev->dev; 104 - struct device_node *np = dev->of_node; 105 - u32 modrst_offset; 106 - 107 - /* 108 - * The binding was mainlined without the required property. 109 - * Do not continue, when we encounter an old DT. 110 - */ 111 - if (!of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) { 112 - dev_err(&pdev->dev, "%pOF missing #reset-cells property\n", 113 - pdev->dev.of_node); 114 - return -EINVAL; 115 - } 116 - 117 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 118 - if (!data) 119 - return -ENOMEM; 120 - 121 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 122 - data->membase = devm_ioremap_resource(&pdev->dev, res); 123 - if (IS_ERR(data->membase)) 124 - return PTR_ERR(data->membase); 125 - 126 - if (of_property_read_u32(np, "altr,modrst-offset", &modrst_offset)) { 127 - dev_warn(dev, "missing altr,modrst-offset property, assuming 0x10!\n"); 128 - modrst_offset = 0x10; 129 - } 130 - data->membase += modrst_offset; 131 - 132 - spin_lock_init(&data->lock); 133 - 134 - data->rcdev.owner = THIS_MODULE; 135 - data->rcdev.nr_resets = NR_BANKS * BITS_PER_LONG; 136 - data->rcdev.ops = &socfpga_reset_ops; 137 - data->rcdev.of_node = pdev->dev.of_node; 138 - 139 - return devm_reset_controller_register(dev, &data->rcdev); 140 - } 141 - 142 - static const struct of_device_id socfpga_reset_dt_ids[] = { 143 - { .compatible = "altr,rst-mgr", }, 144 - { /* sentinel */ }, 145 - }; 146 - 147 - static struct platform_driver socfpga_reset_driver = { 148 - .probe = socfpga_reset_probe, 149 - .driver = { 150 - .name = "socfpga-reset", 151 - .of_match_table = socfpga_reset_dt_ids, 152 - }, 153 - }; 154 - builtin_platform_driver(socfpga_reset_driver);
-108
drivers/reset/reset-stm32.c
··· 1 - /* 2 - * Copyright (C) Maxime Coquelin 2015 3 - * Author: Maxime Coquelin <mcoquelin.stm32@gmail.com> 4 - * License terms: GNU General Public License (GPL), version 2 5 - * 6 - * Heavily based on sunxi driver from Maxime Ripard. 7 - */ 8 - 9 - #include <linux/err.h> 10 - #include <linux/io.h> 11 - #include <linux/of.h> 12 - #include <linux/of_address.h> 13 - #include <linux/platform_device.h> 14 - #include <linux/reset-controller.h> 15 - #include <linux/slab.h> 16 - #include <linux/spinlock.h> 17 - #include <linux/types.h> 18 - 19 - struct stm32_reset_data { 20 - spinlock_t lock; 21 - void __iomem *membase; 22 - struct reset_controller_dev rcdev; 23 - }; 24 - 25 - static int stm32_reset_assert(struct reset_controller_dev *rcdev, 26 - unsigned long id) 27 - { 28 - struct stm32_reset_data *data = container_of(rcdev, 29 - struct stm32_reset_data, 30 - rcdev); 31 - int bank = id / BITS_PER_LONG; 32 - int offset = id % BITS_PER_LONG; 33 - unsigned long flags; 34 - u32 reg; 35 - 36 - spin_lock_irqsave(&data->lock, flags); 37 - 38 - reg = readl(data->membase + (bank * 4)); 39 - writel(reg | BIT(offset), data->membase + (bank * 4)); 40 - 41 - spin_unlock_irqrestore(&data->lock, flags); 42 - 43 - return 0; 44 - } 45 - 46 - static int stm32_reset_deassert(struct reset_controller_dev *rcdev, 47 - unsigned long id) 48 - { 49 - struct stm32_reset_data *data = container_of(rcdev, 50 - struct stm32_reset_data, 51 - rcdev); 52 - int bank = id / BITS_PER_LONG; 53 - int offset = id % BITS_PER_LONG; 54 - unsigned long flags; 55 - u32 reg; 56 - 57 - spin_lock_irqsave(&data->lock, flags); 58 - 59 - reg = readl(data->membase + (bank * 4)); 60 - writel(reg & ~BIT(offset), data->membase + (bank * 4)); 61 - 62 - spin_unlock_irqrestore(&data->lock, flags); 63 - 64 - return 0; 65 - } 66 - 67 - static const struct reset_control_ops stm32_reset_ops = { 68 - .assert = stm32_reset_assert, 69 - .deassert = stm32_reset_deassert, 70 - }; 71 - 72 - static const struct of_device_id stm32_reset_dt_ids[] = { 73 - { .compatible = "st,stm32-rcc", }, 74 - { /* sentinel */ }, 75 - }; 76 - 77 - static int stm32_reset_probe(struct platform_device *pdev) 78 - { 79 - struct stm32_reset_data *data; 80 - struct resource *res; 81 - 82 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 83 - if (!data) 84 - return -ENOMEM; 85 - 86 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 87 - data->membase = devm_ioremap_resource(&pdev->dev, res); 88 - if (IS_ERR(data->membase)) 89 - return PTR_ERR(data->membase); 90 - 91 - spin_lock_init(&data->lock); 92 - 93 - data->rcdev.owner = THIS_MODULE; 94 - data->rcdev.nr_resets = resource_size(res) * 8; 95 - data->rcdev.ops = &stm32_reset_ops; 96 - data->rcdev.of_node = pdev->dev.of_node; 97 - 98 - return devm_reset_controller_register(&pdev->dev, &data->rcdev); 99 - } 100 - 101 - static struct platform_driver stm32_reset_driver = { 102 - .probe = stm32_reset_probe, 103 - .driver = { 104 - .name = "stm32-rcc-reset", 105 - .of_match_table = stm32_reset_dt_ids, 106 - }, 107 - }; 108 - builtin_platform_driver(stm32_reset_driver);
+6 -98
drivers/reset/reset-sunxi.c
··· 22 22 #include <linux/spinlock.h> 23 23 #include <linux/types.h> 24 24 25 - struct sunxi_reset_data { 26 - spinlock_t lock; 27 - void __iomem *membase; 28 - struct reset_controller_dev rcdev; 29 - }; 30 - 31 - static int sunxi_reset_assert(struct reset_controller_dev *rcdev, 32 - unsigned long id) 33 - { 34 - struct sunxi_reset_data *data = container_of(rcdev, 35 - struct sunxi_reset_data, 36 - rcdev); 37 - int reg_width = sizeof(u32); 38 - int bank = id / (reg_width * BITS_PER_BYTE); 39 - int offset = id % (reg_width * BITS_PER_BYTE); 40 - unsigned long flags; 41 - u32 reg; 42 - 43 - spin_lock_irqsave(&data->lock, flags); 44 - 45 - reg = readl(data->membase + (bank * reg_width)); 46 - writel(reg & ~BIT(offset), data->membase + (bank * reg_width)); 47 - 48 - spin_unlock_irqrestore(&data->lock, flags); 49 - 50 - return 0; 51 - } 52 - 53 - static int sunxi_reset_deassert(struct reset_controller_dev *rcdev, 54 - unsigned long id) 55 - { 56 - struct sunxi_reset_data *data = container_of(rcdev, 57 - struct sunxi_reset_data, 58 - rcdev); 59 - int reg_width = sizeof(u32); 60 - int bank = id / (reg_width * BITS_PER_BYTE); 61 - int offset = id % (reg_width * BITS_PER_BYTE); 62 - unsigned long flags; 63 - u32 reg; 64 - 65 - spin_lock_irqsave(&data->lock, flags); 66 - 67 - reg = readl(data->membase + (bank * reg_width)); 68 - writel(reg | BIT(offset), data->membase + (bank * reg_width)); 69 - 70 - spin_unlock_irqrestore(&data->lock, flags); 71 - 72 - return 0; 73 - } 74 - 75 - static const struct reset_control_ops sunxi_reset_ops = { 76 - .assert = sunxi_reset_assert, 77 - .deassert = sunxi_reset_deassert, 78 - }; 25 + #include "reset-simple.h" 79 26 80 27 static int sunxi_reset_init(struct device_node *np) 81 28 { 82 - struct sunxi_reset_data *data; 29 + struct reset_simple_data *data; 83 30 struct resource res; 84 31 resource_size_t size; 85 32 int ret; ··· 55 108 56 109 data->rcdev.owner = THIS_MODULE; 57 110 data->rcdev.nr_resets = size * 8; 58 - data->rcdev.ops = &sunxi_reset_ops; 111 + data->rcdev.ops = &reset_simple_ops; 59 112 data->rcdev.of_node = np; 113 + data->active_low = true; 60 114 61 115 return reset_controller_register(&data->rcdev); 62 116 ··· 70 122 * These are the reset controller we need to initialize early on in 71 123 * our system, before we can even think of using a regular device 72 124 * driver for it. 125 + * The controllers that we can register through the regular device 126 + * model are handled by the simple reset driver directly. 73 127 */ 74 128 static const struct of_device_id sunxi_early_reset_dt_ids[] __initconst = { 75 129 { .compatible = "allwinner,sun6i-a31-ahb1-reset", }, ··· 85 135 for_each_matching_node(np, sunxi_early_reset_dt_ids) 86 136 sunxi_reset_init(np); 87 137 } 88 - 89 - /* 90 - * And these are the controllers we can register through the regular 91 - * device model. 92 - */ 93 - static const struct of_device_id sunxi_reset_dt_ids[] = { 94 - { .compatible = "allwinner,sun6i-a31-clock-reset", }, 95 - { /* sentinel */ }, 96 - }; 97 - 98 - static int sunxi_reset_probe(struct platform_device *pdev) 99 - { 100 - struct sunxi_reset_data *data; 101 - struct resource *res; 102 - 103 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 104 - if (!data) 105 - return -ENOMEM; 106 - 107 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 108 - data->membase = devm_ioremap_resource(&pdev->dev, res); 109 - if (IS_ERR(data->membase)) 110 - return PTR_ERR(data->membase); 111 - 112 - spin_lock_init(&data->lock); 113 - 114 - data->rcdev.owner = THIS_MODULE; 115 - data->rcdev.nr_resets = resource_size(res) * 8; 116 - data->rcdev.ops = &sunxi_reset_ops; 117 - data->rcdev.of_node = pdev->dev.of_node; 118 - 119 - return devm_reset_controller_register(&pdev->dev, &data->rcdev); 120 - } 121 - 122 - static struct platform_driver sunxi_reset_driver = { 123 - .probe = sunxi_reset_probe, 124 - .driver = { 125 - .name = "sunxi-reset", 126 - .of_match_table = sunxi_reset_dt_ids, 127 - }, 128 - }; 129 - builtin_platform_driver(sunxi_reset_driver);
+30
drivers/reset/reset-uniphier.c
··· 58 58 59 59 static const struct uniphier_reset_data uniphier_pro4_sys_reset_data[] = { 60 60 UNIPHIER_RESETX(2, 0x2000, 2), /* NAND */ 61 + UNIPHIER_RESETX(6, 0x2000, 12), /* Ether */ 61 62 UNIPHIER_RESETX(8, 0x2000, 10), /* STDMAC (HSC, MIO, RLE) */ 62 63 UNIPHIER_RESETX(12, 0x2000, 6), /* GIO (Ether, SATA, USB3) */ 63 64 UNIPHIER_RESETX(14, 0x2000, 17), /* USB30 */ ··· 77 76 78 77 static const struct uniphier_reset_data uniphier_pxs2_sys_reset_data[] = { 79 78 UNIPHIER_RESETX(2, 0x2000, 2), /* NAND */ 79 + UNIPHIER_RESETX(6, 0x2000, 12), /* Ether */ 80 80 UNIPHIER_RESETX(8, 0x2000, 10), /* STDMAC (HSC, RLE) */ 81 81 UNIPHIER_RESETX(14, 0x2000, 17), /* USB30 */ 82 82 UNIPHIER_RESETX(15, 0x2004, 17), /* USB31 */ ··· 94 92 static const struct uniphier_reset_data uniphier_ld11_sys_reset_data[] = { 95 93 UNIPHIER_RESETX(2, 0x200c, 0), /* NAND */ 96 94 UNIPHIER_RESETX(4, 0x200c, 2), /* eMMC */ 95 + UNIPHIER_RESETX(6, 0x200c, 6), /* Ether */ 97 96 UNIPHIER_RESETX(8, 0x200c, 8), /* STDMAC (HSC, MIO) */ 98 97 UNIPHIER_RESETX(40, 0x2008, 0), /* AIO */ 99 98 UNIPHIER_RESETX(41, 0x2008, 1), /* EVEA */ ··· 105 102 static const struct uniphier_reset_data uniphier_ld20_sys_reset_data[] = { 106 103 UNIPHIER_RESETX(2, 0x200c, 0), /* NAND */ 107 104 UNIPHIER_RESETX(4, 0x200c, 2), /* eMMC */ 105 + UNIPHIER_RESETX(6, 0x200c, 6), /* Ether */ 108 106 UNIPHIER_RESETX(8, 0x200c, 8), /* STDMAC (HSC) */ 109 107 UNIPHIER_RESETX(12, 0x200c, 5), /* GIO (PCIe, USB3) */ 110 108 UNIPHIER_RESETX(16, 0x200c, 12), /* USB30-PHY0 */ ··· 115 111 UNIPHIER_RESETX(40, 0x2008, 0), /* AIO */ 116 112 UNIPHIER_RESETX(41, 0x2008, 1), /* EVEA */ 117 113 UNIPHIER_RESETX(42, 0x2010, 2), /* EXIV */ 114 + UNIPHIER_RESET_END, 115 + }; 116 + 117 + static const struct uniphier_reset_data uniphier_pxs3_sys_reset_data[] = { 118 + UNIPHIER_RESETX(2, 0x200c, 0), /* NAND */ 119 + UNIPHIER_RESETX(4, 0x200c, 2), /* eMMC */ 120 + UNIPHIER_RESETX(8, 0x200c, 12), /* STDMAC */ 121 + UNIPHIER_RESETX(12, 0x200c, 4), /* USB30 link (GIO0) */ 122 + UNIPHIER_RESETX(13, 0x200c, 5), /* USB31 link (GIO1) */ 123 + UNIPHIER_RESETX(16, 0x200c, 16), /* USB30-PHY0 */ 124 + UNIPHIER_RESETX(17, 0x200c, 18), /* USB30-PHY1 */ 125 + UNIPHIER_RESETX(18, 0x200c, 20), /* USB30-PHY2 */ 126 + UNIPHIER_RESETX(20, 0x200c, 17), /* USB31-PHY0 */ 127 + UNIPHIER_RESETX(21, 0x200c, 19), /* USB31-PHY1 */ 118 128 UNIPHIER_RESET_END, 119 129 }; 120 130 ··· 377 359 .compatible = "socionext,uniphier-ld20-reset", 378 360 .data = uniphier_ld20_sys_reset_data, 379 361 }, 362 + { 363 + .compatible = "socionext,uniphier-pxs3-reset", 364 + .data = uniphier_pxs3_sys_reset_data, 365 + }, 380 366 /* Media I/O reset, SD reset */ 381 367 { 382 368 .compatible = "socionext,uniphier-ld4-mio-reset", ··· 414 392 .compatible = "socionext,uniphier-ld20-sd-reset", 415 393 .data = uniphier_pro5_sd_reset_data, 416 394 }, 395 + { 396 + .compatible = "socionext,uniphier-pxs3-sd-reset", 397 + .data = uniphier_pro5_sd_reset_data, 398 + }, 417 399 /* Peripheral reset */ 418 400 { 419 401 .compatible = "socionext,uniphier-ld4-peri-reset", ··· 445 419 }, 446 420 { 447 421 .compatible = "socionext,uniphier-ld20-peri-reset", 422 + .data = uniphier_pro4_peri_reset_data, 423 + }, 424 + { 425 + .compatible = "socionext,uniphier-pxs3-peri-reset", 448 426 .data = uniphier_pro4_peri_reset_data, 449 427 }, 450 428 /* Analog signal amplifiers reset */
-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);
+94
include/dt-bindings/reset/mt7622-reset.h
··· 1 + /* 2 + * Copyright (c) 2017 MediaTek Inc. 3 + * Author: Sean Wang <sean.wang@mediatek.com> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #ifndef _DT_BINDINGS_RESET_CONTROLLER_MT7622 16 + #define _DT_BINDINGS_RESET_CONTROLLER_MT7622 17 + 18 + /* INFRACFG resets */ 19 + #define MT7622_INFRA_EMI_REG_RST 0 20 + #define MT7622_INFRA_DRAMC0_A0_RST 1 21 + #define MT7622_INFRA_APCIRQ_EINT_RST 3 22 + #define MT7622_INFRA_APXGPT_RST 4 23 + #define MT7622_INFRA_SCPSYS_RST 5 24 + #define MT7622_INFRA_PMIC_WRAP_RST 7 25 + #define MT7622_INFRA_IRRX_RST 9 26 + #define MT7622_INFRA_EMI_RST 16 27 + #define MT7622_INFRA_WED0_RST 17 28 + #define MT7622_INFRA_DRAMC_RST 18 29 + #define MT7622_INFRA_CCI_INTF_RST 19 30 + #define MT7622_INFRA_TRNG_RST 21 31 + #define MT7622_INFRA_SYSIRQ_RST 22 32 + #define MT7622_INFRA_WED1_RST 25 33 + 34 + /* PERICFG Subsystem resets */ 35 + #define MT7622_PERI_UART0_SW_RST 0 36 + #define MT7622_PERI_UART1_SW_RST 1 37 + #define MT7622_PERI_UART2_SW_RST 2 38 + #define MT7622_PERI_UART3_SW_RST 3 39 + #define MT7622_PERI_UART4_SW_RST 4 40 + #define MT7622_PERI_BTIF_SW_RST 6 41 + #define MT7622_PERI_PWM_SW_RST 8 42 + #define MT7622_PERI_AUXADC_SW_RST 10 43 + #define MT7622_PERI_DMA_SW_RST 11 44 + #define MT7622_PERI_IRTX_SW_RST 13 45 + #define MT7622_PERI_NFI_SW_RST 14 46 + #define MT7622_PERI_THERM_SW_RST 16 47 + #define MT7622_PERI_MSDC0_SW_RST 19 48 + #define MT7622_PERI_MSDC1_SW_RST 20 49 + #define MT7622_PERI_I2C0_SW_RST 22 50 + #define MT7622_PERI_I2C1_SW_RST 23 51 + #define MT7622_PERI_I2C2_SW_RST 24 52 + #define MT7622_PERI_SPI0_SW_RST 33 53 + #define MT7622_PERI_SPI1_SW_RST 34 54 + #define MT7622_PERI_FLASHIF_SW_RST 36 55 + 56 + /* TOPRGU resets */ 57 + #define MT7622_TOPRGU_INFRA_RST 0 58 + #define MT7622_TOPRGU_ETHDMA_RST 1 59 + #define MT7622_TOPRGU_DDRPHY_RST 6 60 + #define MT7622_TOPRGU_INFRA_AO_RST 8 61 + #define MT7622_TOPRGU_CONN_RST 9 62 + #define MT7622_TOPRGU_APMIXED_RST 10 63 + #define MT7622_TOPRGU_CONN_MCU_RST 12 64 + 65 + /* PCIe/SATA Subsystem resets */ 66 + #define MT7622_SATA_PHY_REG_RST 12 67 + #define MT7622_SATA_PHY_SW_RST 13 68 + #define MT7622_SATA_AXI_BUS_RST 15 69 + #define MT7622_PCIE1_CORE_RST 19 70 + #define MT7622_PCIE1_MMIO_RST 20 71 + #define MT7622_PCIE1_HRST 21 72 + #define MT7622_PCIE1_USER_RST 22 73 + #define MT7622_PCIE1_PIPE_RST 23 74 + #define MT7622_PCIE0_CORE_RST 27 75 + #define MT7622_PCIE0_MMIO_RST 28 76 + #define MT7622_PCIE0_HRST 29 77 + #define MT7622_PCIE0_USER_RST 30 78 + #define MT7622_PCIE0_PIPE_RST 31 79 + 80 + /* SSUSB Subsystem resets */ 81 + #define MT7622_SSUSB_PHY_PWR_RST 3 82 + #define MT7622_SSUSB_MAC_PWR_RST 4 83 + 84 + /* ETHSYS Subsystem resets */ 85 + #define MT7622_ETHSYS_SYS_RST 0 86 + #define MT7622_ETHSYS_MCM_RST 2 87 + #define MT7622_ETHSYS_HSDMA_RST 5 88 + #define MT7622_ETHSYS_FE_RST 6 89 + #define MT7622_ETHSYS_GMAC_RST 23 90 + #define MT7622_ETHSYS_EPHY_RST 24 91 + #define MT7622_ETHSYS_CRYPTO_RST 29 92 + #define MT7622_ETHSYS_PPE_RST 31 93 + 94 + #endif /* _DT_BINDINGS_RESET_CONTROLLER_MT7622 */