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

Configure Feed

Select the types of activity you want to include in your feed.

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

Merge "Reset controller changes for v4.8, part 3" from Philipp Zabel:

- change request API to be more explicit about the difference between
exclusive and shared resets (the former guarantee the reset line is
asserted immediately when reset_control_assert is called, the latter
are refcounted and do not guarantee this).
- add Hisilicon hi6220 media subsystem reset controller support
- add TI SYSCON based reset controller support

* tag 'reset-for-4.8-3' of git://git.pengutronix.de/git/pza/linux:
reset: add TI SYSCON based reset driver
Documentation: dt: reset: Add TI syscon reset binding
reset: hisilicon: Add hi6220 media subsystem reset support
reset: hisilicon: Change to syscon register access
arm64: dts: hi6220: Add media subsystem reset dts
reset: hisilicon: Add media reset controller binding
reset: TRIVIAL: Add line break at same place for similar APIs
reset: Supply *_shared variant calls when using *_optional APIs
reset: Supply *_shared variant calls when using of_* API
reset: Ensure drivers are explicit when requesting reset lines
reset: Reorder inline reset_control_get*() wrappers

+647 -85
+3 -1
Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
··· 8 8 hi6220 SoC. 9 9 10 10 Required properties: 11 - - compatible: may be "hisilicon,hi6220-sysctrl" 11 + - compatible: should be one of the following: 12 + - "hisilicon,hi6220-sysctrl", "syscon" : For peripheral reset controller. 13 + - "hisilicon,hi6220-mediactrl", "syscon" : For media reset controller. 12 14 - reg: should be register base and length as documented in the 13 15 datasheet 14 16 - #reset-cells: 1, see below
+91
Documentation/devicetree/bindings/reset/ti-syscon-reset.txt
··· 1 + TI SysCon Reset Controller 2 + ======================= 3 + 4 + Almost all SoCs have hardware modules that require reset control in addition 5 + to clock and power control for their functionality. The reset control is 6 + typically provided by means of memory-mapped I/O registers. These registers are 7 + sometimes a part of a larger register space region implementing various 8 + functionalities. This register range is best represented as a syscon node to 9 + allow multiple entities to access their relevant registers in the common 10 + register space. 11 + 12 + A SysCon Reset Controller node defines a device that uses a syscon node 13 + and provides reset management functionality for various hardware modules 14 + present on the SoC. 15 + 16 + SysCon Reset Controller Node 17 + ============================ 18 + Each of the reset provider/controller nodes should be a child of a syscon 19 + node and have the following properties. 20 + 21 + Required properties: 22 + -------------------- 23 + - compatible : Should be, 24 + "ti,k2e-pscrst" 25 + "ti,k2l-pscrst" 26 + "ti,k2hk-pscrst" 27 + "ti,syscon-reset" 28 + - #reset-cells : Should be 1. Please see the reset consumer node below 29 + for usage details 30 + - ti,reset-bits : Contains the reset control register information 31 + Should contain 7 cells for each reset exposed to 32 + consumers, defined as: 33 + Cell #1 : offset of the reset assert control 34 + register from the syscon register base 35 + Cell #2 : bit position of the reset in the reset 36 + assert control register 37 + Cell #3 : offset of the reset deassert control 38 + register from the syscon register base 39 + Cell #4 : bit position of the reset in the reset 40 + deassert control register 41 + Cell #5 : offset of the reset status register 42 + from the syscon register base 43 + Cell #6 : bit position of the reset in the 44 + reset status register 45 + Cell #7 : Flags used to control reset behavior, 46 + availible flags defined in the DT include 47 + file <dt-bindings/reset/ti-syscon.h> 48 + 49 + SysCon Reset Consumer Nodes 50 + =========================== 51 + Each of the reset consumer nodes should have the following properties, 52 + in addition to their own properties. 53 + 54 + Required properties: 55 + -------------------- 56 + - resets : A phandle to the reset controller node and an index number 57 + to a reset specifier as defined above. 58 + 59 + Please also refer to Documentation/devicetree/bindings/reset/reset.txt for 60 + common reset controller usage by consumers. 61 + 62 + Example: 63 + -------- 64 + The following example demonstrates a syscon node, the reset controller node 65 + using the syscon node, and a consumer (a DSP device) on the TI Keystone 2 66 + Edison SoC. 67 + 68 + / { 69 + soc { 70 + psc: power-sleep-controller@02350000 { 71 + compatible = "syscon", "simple-mfd"; 72 + reg = <0x02350000 0x1000>; 73 + 74 + pscrst: psc-reset { 75 + compatible = "ti,k2e-pscrst", "ti,syscon-reset"; 76 + #reset-cells = <1>; 77 + 78 + ti,reset-bits = < 79 + 0xa3c 8 0xa3c 8 0x83c 8 (ASSERT_SET|DEASSERT_CLEAR|STATUS_SET) /* 0: pcrst-dsp0 */ 80 + 0xa40 5 0xa44 3 0 0 (ASSERT_SET|DEASSERT_CLEAR|STATUS_NONE) /* 1: pcrst-example */ 81 + >; 82 + }; 83 + }; 84 + 85 + dsp0: dsp0 { 86 + ... 87 + resets = <&pscrst 0>; 88 + ... 89 + }; 90 + }; 91 + };
+2
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
··· 5 5 */ 6 6 7 7 #include <dt-bindings/interrupt-controller/arm-gic.h> 8 + #include <dt-bindings/reset/hisi,hi6220-resets.h> 8 9 #include <dt-bindings/clock/hi6220-clock.h> 9 10 #include <dt-bindings/pinctrl/hisi.h> 10 11 #include <dt-bindings/thermal/thermal.h> ··· 253 252 compatible = "hisilicon,hi6220-mediactrl", "syscon"; 254 253 reg = <0x0 0xf4410000 0x0 0x1000>; 255 254 #clock-cells = <1>; 255 + #reset-cells = <1>; 256 256 }; 257 257 258 258 pm_ctrl: pm_ctrl@f7032000 {
+10
drivers/reset/Kconfig
··· 17 17 config RESET_OXNAS 18 18 bool 19 19 20 + config TI_SYSCON_RESET 21 + tristate "TI SYSCON Reset Driver" 22 + depends on HAS_IOMEM 23 + select MFD_SYSCON 24 + help 25 + This enables the reset driver support for TI devices with 26 + memory-mapped reset registers as part of a syscon device node. If 27 + you wish to use the reset framework for such memory-mapped devices, 28 + say Y here. Otherwise, say N. 29 + 20 30 source "drivers/reset/sti/Kconfig" 21 31 source "drivers/reset/hisilicon/Kconfig" 22 32
+1
drivers/reset/Makefile
··· 10 10 obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o 11 11 obj-$(CONFIG_ATH79) += reset-ath79.o 12 12 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o 13 + obj-$(CONFIG_TI_SYSCON_RESET) += reset-ti-syscon.o
+89 -39
drivers/reset/hisilicon/hi6220_reset.c
··· 1 1 /* 2 2 * Hisilicon Hi6220 reset controller driver 3 3 * 4 - * Copyright (c) 2015 Hisilicon Limited. 4 + * Copyright (c) 2016 Linaro Limited. 5 + * Copyright (c) 2015-2016 Hisilicon Limited. 5 6 * 6 7 * Author: Feng Chen <puck.chen@hisilicon.com> 7 8 * ··· 16 15 #include <linux/module.h> 17 16 #include <linux/bitops.h> 18 17 #include <linux/of.h> 18 + #include <linux/of_device.h> 19 + #include <linux/regmap.h> 20 + #include <linux/mfd/syscon.h> 19 21 #include <linux/reset-controller.h> 20 22 #include <linux/reset.h> 21 23 #include <linux/platform_device.h> 22 24 23 - #define ASSERT_OFFSET 0x300 24 - #define DEASSERT_OFFSET 0x304 25 - #define MAX_INDEX 0x509 25 + #define PERIPH_ASSERT_OFFSET 0x300 26 + #define PERIPH_DEASSERT_OFFSET 0x304 27 + #define PERIPH_MAX_INDEX 0x509 28 + 29 + #define SC_MEDIA_RSTEN 0x052C 30 + #define SC_MEDIA_RSTDIS 0x0530 31 + #define MEDIA_MAX_INDEX 8 26 32 27 33 #define to_reset_data(x) container_of(x, struct hi6220_reset_data, rc_dev) 28 34 29 - struct hi6220_reset_data { 30 - void __iomem *assert_base; 31 - void __iomem *deassert_base; 32 - struct reset_controller_dev rc_dev; 35 + enum hi6220_reset_ctrl_type { 36 + PERIPHERAL, 37 + MEDIA, 33 38 }; 34 39 35 - static int hi6220_reset_assert(struct reset_controller_dev *rc_dev, 40 + struct hi6220_reset_data { 41 + struct reset_controller_dev rc_dev; 42 + struct regmap *regmap; 43 + }; 44 + 45 + static int hi6220_peripheral_assert(struct reset_controller_dev *rc_dev, 46 + unsigned long idx) 47 + { 48 + struct hi6220_reset_data *data = to_reset_data(rc_dev); 49 + struct regmap *regmap = data->regmap; 50 + u32 bank = idx >> 8; 51 + u32 offset = idx & 0xff; 52 + u32 reg = PERIPH_ASSERT_OFFSET + bank * 0x10; 53 + 54 + return regmap_write(regmap, reg, BIT(offset)); 55 + } 56 + 57 + static int hi6220_peripheral_deassert(struct reset_controller_dev *rc_dev, 58 + unsigned long idx) 59 + { 60 + struct hi6220_reset_data *data = to_reset_data(rc_dev); 61 + struct regmap *regmap = data->regmap; 62 + u32 bank = idx >> 8; 63 + u32 offset = idx & 0xff; 64 + u32 reg = PERIPH_DEASSERT_OFFSET + bank * 0x10; 65 + 66 + return regmap_write(regmap, reg, BIT(offset)); 67 + } 68 + 69 + static const struct reset_control_ops hi6220_peripheral_reset_ops = { 70 + .assert = hi6220_peripheral_assert, 71 + .deassert = hi6220_peripheral_deassert, 72 + }; 73 + 74 + static int hi6220_media_assert(struct reset_controller_dev *rc_dev, 36 75 unsigned long idx) 37 76 { 38 77 struct hi6220_reset_data *data = to_reset_data(rc_dev); 78 + struct regmap *regmap = data->regmap; 39 79 40 - int bank = idx >> 8; 41 - int offset = idx & 0xff; 42 - 43 - writel(BIT(offset), data->assert_base + (bank * 0x10)); 44 - 45 - return 0; 80 + return regmap_write(regmap, SC_MEDIA_RSTEN, BIT(idx)); 46 81 } 47 82 48 - static int hi6220_reset_deassert(struct reset_controller_dev *rc_dev, 83 + static int hi6220_media_deassert(struct reset_controller_dev *rc_dev, 49 84 unsigned long idx) 50 85 { 51 86 struct hi6220_reset_data *data = to_reset_data(rc_dev); 87 + struct regmap *regmap = data->regmap; 52 88 53 - int bank = idx >> 8; 54 - int offset = idx & 0xff; 55 - 56 - writel(BIT(offset), data->deassert_base + (bank * 0x10)); 57 - 58 - return 0; 89 + return regmap_write(regmap, SC_MEDIA_RSTDIS, BIT(idx)); 59 90 } 60 91 61 - static const struct reset_control_ops hi6220_reset_ops = { 62 - .assert = hi6220_reset_assert, 63 - .deassert = hi6220_reset_deassert, 92 + static const struct reset_control_ops hi6220_media_reset_ops = { 93 + .assert = hi6220_media_assert, 94 + .deassert = hi6220_media_deassert, 64 95 }; 65 96 66 97 static int hi6220_reset_probe(struct platform_device *pdev) 67 98 { 99 + struct device_node *np = pdev->dev.of_node; 100 + struct device *dev = &pdev->dev; 101 + enum hi6220_reset_ctrl_type type; 68 102 struct hi6220_reset_data *data; 69 - struct resource *res; 70 - void __iomem *src_base; 103 + struct regmap *regmap; 71 104 72 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 105 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 73 106 if (!data) 74 107 return -ENOMEM; 75 108 76 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 77 - src_base = devm_ioremap_resource(&pdev->dev, res); 78 - if (IS_ERR(src_base)) 79 - return PTR_ERR(src_base); 109 + type = (enum hi6220_reset_ctrl_type)of_device_get_match_data(dev); 80 110 81 - data->assert_base = src_base + ASSERT_OFFSET; 82 - data->deassert_base = src_base + DEASSERT_OFFSET; 83 - data->rc_dev.nr_resets = MAX_INDEX; 84 - data->rc_dev.ops = &hi6220_reset_ops; 85 - data->rc_dev.of_node = pdev->dev.of_node; 111 + regmap = syscon_node_to_regmap(np); 112 + if (IS_ERR(regmap)) { 113 + dev_err(dev, "failed to get reset controller regmap\n"); 114 + return PTR_ERR(regmap); 115 + } 116 + 117 + data->regmap = regmap; 118 + data->rc_dev.of_node = np; 119 + if (type == MEDIA) { 120 + data->rc_dev.ops = &hi6220_media_reset_ops; 121 + data->rc_dev.nr_resets = MEDIA_MAX_INDEX; 122 + } else { 123 + data->rc_dev.ops = &hi6220_peripheral_reset_ops; 124 + data->rc_dev.nr_resets = PERIPH_MAX_INDEX; 125 + } 86 126 87 127 return reset_controller_register(&data->rc_dev); 88 128 } 89 129 90 130 static const struct of_device_id hi6220_reset_match[] = { 91 - { .compatible = "hisilicon,hi6220-sysctrl" }, 92 - { }, 131 + { 132 + .compatible = "hisilicon,hi6220-sysctrl", 133 + .data = (void *)PERIPHERAL, 134 + }, 135 + { 136 + .compatible = "hisilicon,hi6220-mediactrl", 137 + .data = (void *)MEDIA, 138 + }, 139 + { /* sentinel */ }, 93 140 }; 141 + MODULE_DEVICE_TABLE(of, hi6220_reset_match); 94 142 95 143 static struct platform_driver hi6220_reset_driver = { 96 144 .probe = hi6220_reset_probe,
+237
drivers/reset/reset-ti-syscon.c
··· 1 + /* 2 + * TI SYSCON regmap reset driver 3 + * 4 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Andrew F. Davis <afd@ti.com> 6 + * Suman Anna <afd@ti.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + * 12 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 13 + * kind, whether express or implied; without even the implied warranty 14 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/mfd/syscon.h> 19 + #include <linux/module.h> 20 + #include <linux/of.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/regmap.h> 23 + #include <linux/reset-controller.h> 24 + 25 + #include <dt-bindings/reset/ti-syscon.h> 26 + 27 + /** 28 + * struct ti_syscon_reset_control - reset control structure 29 + * @assert_offset: reset assert control register offset from syscon base 30 + * @assert_bit: reset assert bit in the reset assert control register 31 + * @deassert_offset: reset deassert control register offset from syscon base 32 + * @deassert_bit: reset deassert bit in the reset deassert control register 33 + * @status_offset: reset status register offset from syscon base 34 + * @status_bit: reset status bit in the reset status register 35 + * @flags: reset flag indicating how the (de)assert and status are handled 36 + */ 37 + struct ti_syscon_reset_control { 38 + unsigned int assert_offset; 39 + unsigned int assert_bit; 40 + unsigned int deassert_offset; 41 + unsigned int deassert_bit; 42 + unsigned int status_offset; 43 + unsigned int status_bit; 44 + u32 flags; 45 + }; 46 + 47 + /** 48 + * struct ti_syscon_reset_data - reset controller information structure 49 + * @rcdev: reset controller entity 50 + * @regmap: regmap handle containing the memory-mapped reset registers 51 + * @controls: array of reset controls 52 + * @nr_controls: number of controls in control array 53 + */ 54 + struct ti_syscon_reset_data { 55 + struct reset_controller_dev rcdev; 56 + struct regmap *regmap; 57 + struct ti_syscon_reset_control *controls; 58 + unsigned int nr_controls; 59 + }; 60 + 61 + #define to_ti_syscon_reset_data(rcdev) \ 62 + container_of(rcdev, struct ti_syscon_reset_data, rcdev) 63 + 64 + /** 65 + * ti_syscon_reset_assert() - assert device reset 66 + * @rcdev: reset controller entity 67 + * @id: ID of the reset to be asserted 68 + * 69 + * This function implements the reset driver op to assert a device's reset. 70 + * This asserts the reset in a manner prescribed by the reset flags. 71 + * 72 + * Return: 0 for successful request, else a corresponding error value 73 + */ 74 + static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, 75 + unsigned long id) 76 + { 77 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 78 + struct ti_syscon_reset_control *control; 79 + unsigned int mask, value; 80 + 81 + if (id >= data->nr_controls) 82 + return -EINVAL; 83 + 84 + control = &data->controls[id]; 85 + 86 + if (control->flags & ASSERT_NONE) 87 + return -ENOTSUPP; /* assert not supported for this reset */ 88 + 89 + mask = BIT(control->assert_bit); 90 + value = (control->flags & ASSERT_SET) ? mask : 0x0; 91 + 92 + return regmap_update_bits(data->regmap, control->assert_offset, mask, value); 93 + } 94 + 95 + /** 96 + * ti_syscon_reset_deassert() - deassert device reset 97 + * @rcdev: reset controller entity 98 + * @id: ID of reset to be deasserted 99 + * 100 + * This function implements the reset driver op to deassert a device's reset. 101 + * This deasserts the reset in a manner prescribed by the reset flags. 102 + * 103 + * Return: 0 for successful request, else a corresponding error value 104 + */ 105 + static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, 106 + unsigned long id) 107 + { 108 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 109 + struct ti_syscon_reset_control *control; 110 + unsigned int mask, value; 111 + 112 + if (id >= data->nr_controls) 113 + return -EINVAL; 114 + 115 + control = &data->controls[id]; 116 + 117 + if (control->flags & DEASSERT_NONE) 118 + return -ENOTSUPP; /* deassert not supported for this reset */ 119 + 120 + mask = BIT(control->deassert_bit); 121 + value = (control->flags & DEASSERT_SET) ? mask : 0x0; 122 + 123 + return regmap_update_bits(data->regmap, control->deassert_offset, mask, value); 124 + } 125 + 126 + /** 127 + * ti_syscon_reset_status() - check device reset status 128 + * @rcdev: reset controller entity 129 + * @id: ID of the reset for which the status is being requested 130 + * 131 + * This function implements the reset driver op to return the status of a 132 + * device's reset. 133 + * 134 + * Return: 0 if reset is deasserted, true if reset is asserted, else a 135 + * corresponding error value 136 + */ 137 + static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, 138 + unsigned long id) 139 + { 140 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 141 + struct ti_syscon_reset_control *control; 142 + unsigned int reset_state; 143 + int ret; 144 + 145 + if (id >= data->nr_controls) 146 + return -EINVAL; 147 + 148 + control = &data->controls[id]; 149 + 150 + if (control->flags & STATUS_NONE) 151 + return -ENOTSUPP; /* status not supported for this reset */ 152 + 153 + ret = regmap_read(data->regmap, control->status_offset, &reset_state); 154 + if (ret) 155 + return ret; 156 + 157 + return (reset_state & BIT(control->status_bit)) && 158 + (control->flags & STATUS_SET); 159 + } 160 + 161 + static struct reset_control_ops ti_syscon_reset_ops = { 162 + .assert = ti_syscon_reset_assert, 163 + .deassert = ti_syscon_reset_deassert, 164 + .status = ti_syscon_reset_status, 165 + }; 166 + 167 + static int ti_syscon_reset_probe(struct platform_device *pdev) 168 + { 169 + struct device *dev = &pdev->dev; 170 + struct device_node *np = dev->of_node; 171 + struct ti_syscon_reset_data *data; 172 + struct regmap *regmap; 173 + const __be32 *list; 174 + struct ti_syscon_reset_control *controls; 175 + int size, nr_controls, i; 176 + 177 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 178 + if (!data) 179 + return -ENOMEM; 180 + 181 + regmap = syscon_node_to_regmap(np->parent); 182 + if (IS_ERR(regmap)) 183 + return PTR_ERR(regmap); 184 + 185 + list = of_get_property(np, "ti,reset-bits", &size); 186 + if (!list || (size / sizeof(*list)) % 7 != 0) { 187 + dev_err(dev, "invalid DT reset description\n"); 188 + return -EINVAL; 189 + } 190 + 191 + nr_controls = (size / sizeof(*list)) / 7; 192 + controls = devm_kzalloc(dev, nr_controls * sizeof(*controls), GFP_KERNEL); 193 + if (!controls) 194 + return -ENOMEM; 195 + 196 + for (i = 0; i < nr_controls; i++) { 197 + controls[i].assert_offset = be32_to_cpup(list++); 198 + controls[i].assert_bit = be32_to_cpup(list++); 199 + controls[i].deassert_offset = be32_to_cpup(list++); 200 + controls[i].deassert_bit = be32_to_cpup(list++); 201 + controls[i].status_offset = be32_to_cpup(list++); 202 + controls[i].status_bit = be32_to_cpup(list++); 203 + controls[i].flags = be32_to_cpup(list++); 204 + } 205 + 206 + data->rcdev.ops = &ti_syscon_reset_ops; 207 + data->rcdev.owner = THIS_MODULE; 208 + data->rcdev.of_node = np; 209 + data->rcdev.nr_resets = nr_controls; 210 + data->regmap = regmap; 211 + data->controls = controls; 212 + data->nr_controls = nr_controls; 213 + 214 + platform_set_drvdata(pdev, data); 215 + 216 + return devm_reset_controller_register(dev, &data->rcdev); 217 + } 218 + 219 + static const struct of_device_id ti_syscon_reset_of_match[] = { 220 + { .compatible = "ti,syscon-reset", }, 221 + { /* sentinel */ }, 222 + }; 223 + MODULE_DEVICE_TABLE(of, ti_syscon_reset_of_match); 224 + 225 + static struct platform_driver ti_syscon_reset_driver = { 226 + .probe = ti_syscon_reset_probe, 227 + .driver = { 228 + .name = "ti-syscon-reset", 229 + .of_match_table = ti_syscon_reset_of_match, 230 + }, 231 + }; 232 + module_platform_driver(ti_syscon_reset_driver); 233 + 234 + MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>"); 235 + MODULE_AUTHOR("Suman Anna <s-anna@ti.com>"); 236 + MODULE_DESCRIPTION("TI SYSCON Regmap Reset Driver"); 237 + MODULE_LICENSE("GPL v2");
+8
include/dt-bindings/reset/hisi,hi6220-resets.h
··· 64 64 #define PERIPH_RSDIST9_CARM_SOCDBG 0x507 65 65 #define PERIPH_RSDIST9_CARM_ETM 0x508 66 66 67 + #define MEDIA_G3D 0 68 + #define MEDIA_CODEC_VPU 2 69 + #define MEDIA_CODEC_JPEG 3 70 + #define MEDIA_ISP 4 71 + #define MEDIA_ADE 5 72 + #define MEDIA_MMU 6 73 + #define MEDIA_XG2RAM1 7 74 + 67 75 #endif /*_DT_BINDINGS_RESET_CONTROLLER_HI6220*/
+38
include/dt-bindings/reset/ti-syscon.h
··· 1 + /* 2 + * TI Syscon Reset definitions 3 + * 4 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #ifndef __DT_BINDINGS_RESET_TI_SYSCON_H__ 18 + #define __DT_BINDINGS_RESET_TI_SYSCON_H__ 19 + 20 + /* 21 + * The reset does not support the feature and corresponding 22 + * values are not valid 23 + */ 24 + #define ASSERT_NONE (1 << 0) 25 + #define DEASSERT_NONE (1 << 1) 26 + #define STATUS_NONE (1 << 2) 27 + 28 + /* When set this function is activated by setting(vs clearing) this bit */ 29 + #define ASSERT_SET (1 << 3) 30 + #define DEASSERT_SET (1 << 4) 31 + #define STATUS_SET (1 << 5) 32 + 33 + /* The following are the inverse of the above and are added for consistency */ 34 + #define ASSERT_CLEAR (0 << 3) 35 + #define DEASSERT_CLEAR (0 << 4) 36 + #define STATUS_CLEAR (0 << 5) 37 + 38 + #endif
+168 -45
include/linux/reset.h
··· 84 84 #endif /* CONFIG_RESET_CONTROLLER */ 85 85 86 86 /** 87 - * reset_control_get - Lookup and obtain an exclusive reference to a 88 - * reset controller. 87 + * reset_control_get_exclusive - Lookup and obtain an exclusive reference 88 + * to a reset controller. 89 89 * @dev: device to be reset by the controller 90 90 * @id: reset line name 91 91 * ··· 98 98 * 99 99 * Use of id names is optional. 100 100 */ 101 - static inline struct reset_control *__must_check reset_control_get( 102 - struct device *dev, const char *id) 101 + static inline struct reset_control * 102 + __must_check reset_control_get_exclusive(struct device *dev, const char *id) 103 103 { 104 104 #ifndef CONFIG_RESET_CONTROLLER 105 105 WARN_ON(1); 106 106 #endif 107 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 108 - } 109 - 110 - static inline struct reset_control *reset_control_get_optional( 111 - struct device *dev, const char *id) 112 - { 113 107 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 114 108 } 115 109 ··· 135 141 return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); 136 142 } 137 143 144 + static inline struct reset_control *reset_control_get_optional_exclusive( 145 + struct device *dev, const char *id) 146 + { 147 + return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); 148 + } 149 + 150 + static inline struct reset_control *reset_control_get_optional_shared( 151 + struct device *dev, const char *id) 152 + { 153 + return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); 154 + } 155 + 138 156 /** 139 - * of_reset_control_get - Lookup and obtain an exclusive reference to a 140 - * reset controller. 157 + * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference 158 + * to a reset controller. 141 159 * @node: device to be reset by the controller 142 160 * @id: reset line name 143 161 * ··· 157 151 * 158 152 * Use of id names is optional. 159 153 */ 160 - static inline struct reset_control *of_reset_control_get( 154 + static inline struct reset_control *of_reset_control_get_exclusive( 161 155 struct device_node *node, const char *id) 162 156 { 163 157 return __of_reset_control_get(node, id, 0, 0); 164 158 } 165 159 166 160 /** 167 - * of_reset_control_get_by_index - Lookup and obtain an exclusive reference to 168 - * a reset controller by index. 161 + * of_reset_control_get_shared - Lookup and obtain an shared reference 162 + * to a reset controller. 163 + * @node: device to be reset by the controller 164 + * @id: reset line name 165 + * 166 + * When a reset-control is shared, the behavior of reset_control_assert / 167 + * deassert is changed, the reset-core will keep track of a deassert_count 168 + * and only (re-)assert the reset after reset_control_assert has been called 169 + * as many times as reset_control_deassert was called. Also see the remark 170 + * about shared reset-controls in the reset_control_assert docs. 171 + * 172 + * Calling reset_control_assert without first calling reset_control_deassert 173 + * is not allowed on a shared reset control. Calling reset_control_reset is 174 + * also not allowed on a shared reset control. 175 + * Returns a struct reset_control or IS_ERR() condition containing errno. 176 + * 177 + * Use of id names is optional. 178 + */ 179 + static inline struct reset_control *of_reset_control_get_shared( 180 + struct device_node *node, const char *id) 181 + { 182 + return __of_reset_control_get(node, id, 0, 1); 183 + } 184 + 185 + /** 186 + * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive 187 + * reference to a reset controller 188 + * by index. 169 189 * @node: device to be reset by the controller 170 190 * @index: index of the reset controller 171 191 * ··· 199 167 * in whatever order. Returns a struct reset_control or IS_ERR() condition 200 168 * containing errno. 201 169 */ 202 - static inline struct reset_control *of_reset_control_get_by_index( 170 + static inline struct reset_control *of_reset_control_get_exclusive_by_index( 203 171 struct device_node *node, int index) 204 172 { 205 173 return __of_reset_control_get(node, NULL, index, 0); 206 174 } 207 175 208 176 /** 209 - * devm_reset_control_get - resource managed reset_control_get() 177 + * of_reset_control_get_shared_by_index - Lookup and obtain an shared 178 + * reference to a reset controller 179 + * by index. 180 + * @node: device to be reset by the controller 181 + * @index: index of the reset controller 182 + * 183 + * When a reset-control is shared, the behavior of reset_control_assert / 184 + * deassert is changed, the reset-core will keep track of a deassert_count 185 + * and only (re-)assert the reset after reset_control_assert has been called 186 + * as many times as reset_control_deassert was called. Also see the remark 187 + * about shared reset-controls in the reset_control_assert docs. 188 + * 189 + * Calling reset_control_assert without first calling reset_control_deassert 190 + * is not allowed on a shared reset control. Calling reset_control_reset is 191 + * also not allowed on a shared reset control. 192 + * Returns a struct reset_control or IS_ERR() condition containing errno. 193 + * 194 + * This is to be used to perform a list of resets for a device or power domain 195 + * in whatever order. Returns a struct reset_control or IS_ERR() condition 196 + * containing errno. 197 + */ 198 + static inline struct reset_control *of_reset_control_get_shared_by_index( 199 + struct device_node *node, int index) 200 + { 201 + return __of_reset_control_get(node, NULL, index, 1); 202 + } 203 + 204 + /** 205 + * devm_reset_control_get_exclusive - resource managed 206 + * reset_control_get_exclusive() 210 207 * @dev: device to be reset by the controller 211 208 * @id: reset line name 212 209 * 213 - * Managed reset_control_get(). For reset controllers returned from this 214 - * function, reset_control_put() is called automatically on driver detach. 215 - * See reset_control_get() for more information. 210 + * Managed reset_control_get_exclusive(). For reset controllers returned 211 + * from this function, reset_control_put() is called automatically on driver 212 + * detach. 213 + * 214 + * See reset_control_get_exclusive() for more information. 216 215 */ 217 - static inline struct reset_control *__must_check devm_reset_control_get( 218 - struct device *dev, const char *id) 216 + static inline struct reset_control * 217 + __must_check devm_reset_control_get_exclusive(struct device *dev, 218 + const char *id) 219 219 { 220 220 #ifndef CONFIG_RESET_CONTROLLER 221 221 WARN_ON(1); 222 222 #endif 223 223 return __devm_reset_control_get(dev, id, 0, 0); 224 - } 225 - 226 - static inline struct reset_control *devm_reset_control_get_optional( 227 - struct device *dev, const char *id) 228 - { 229 - return __devm_reset_control_get(dev, id, 0, 0); 230 - } 231 - 232 - /** 233 - * devm_reset_control_get_by_index - resource managed reset_control_get 234 - * @dev: device to be reset by the controller 235 - * @index: index of the reset controller 236 - * 237 - * Managed reset_control_get(). For reset controllers returned from this 238 - * function, reset_control_put() is called automatically on driver detach. 239 - * See reset_control_get() for more information. 240 - */ 241 - static inline struct reset_control *devm_reset_control_get_by_index( 242 - struct device *dev, int index) 243 - { 244 - return __devm_reset_control_get(dev, NULL, index, 0); 245 224 } 246 225 247 226 /** ··· 270 227 return __devm_reset_control_get(dev, id, 0, 1); 271 228 } 272 229 230 + static inline struct reset_control *devm_reset_control_get_optional_exclusive( 231 + struct device *dev, const char *id) 232 + { 233 + return __devm_reset_control_get(dev, id, 0, 0); 234 + } 235 + 236 + static inline struct reset_control *devm_reset_control_get_optional_shared( 237 + struct device *dev, const char *id) 238 + { 239 + return __devm_reset_control_get(dev, id, 0, 1); 240 + } 241 + 242 + /** 243 + * devm_reset_control_get_exclusive_by_index - resource managed 244 + * reset_control_get_exclusive() 245 + * @dev: device to be reset by the controller 246 + * @index: index of the reset controller 247 + * 248 + * Managed reset_control_get_exclusive(). For reset controllers returned from 249 + * this function, reset_control_put() is called automatically on driver 250 + * detach. 251 + * 252 + * See reset_control_get_exclusive() for more information. 253 + */ 254 + static inline struct reset_control * 255 + devm_reset_control_get_exclusive_by_index(struct device *dev, int index) 256 + { 257 + return __devm_reset_control_get(dev, NULL, index, 0); 258 + } 259 + 273 260 /** 274 261 * devm_reset_control_get_shared_by_index - resource managed 275 262 * reset_control_get_shared ··· 310 237 * this function, reset_control_put() is called automatically on driver detach. 311 238 * See reset_control_get_shared() for more information. 312 239 */ 313 - static inline struct reset_control *devm_reset_control_get_shared_by_index( 314 - struct device *dev, int index) 240 + static inline struct reset_control * 241 + devm_reset_control_get_shared_by_index(struct device *dev, int index) 315 242 { 316 243 return __devm_reset_control_get(dev, NULL, index, 1); 317 244 } 318 245 246 + /* 247 + * TEMPORARY calls to use during transition: 248 + * 249 + * of_reset_control_get() => of_reset_control_get_exclusive() 250 + * 251 + * These inline function calls will be removed once all consumers 252 + * have been moved over to the new explicit API. 253 + */ 254 + static inline struct reset_control *reset_control_get( 255 + struct device *dev, const char *id) 256 + { 257 + return reset_control_get_exclusive(dev, id); 258 + } 259 + 260 + static inline struct reset_control *reset_control_get_optional( 261 + struct device *dev, const char *id) 262 + { 263 + return reset_control_get_optional_exclusive(dev, id); 264 + } 265 + 266 + static inline struct reset_control *of_reset_control_get( 267 + struct device_node *node, const char *id) 268 + { 269 + return of_reset_control_get_exclusive(node, id); 270 + } 271 + 272 + static inline struct reset_control *of_reset_control_get_by_index( 273 + struct device_node *node, int index) 274 + { 275 + return of_reset_control_get_exclusive_by_index(node, index); 276 + } 277 + 278 + static inline struct reset_control *devm_reset_control_get( 279 + struct device *dev, const char *id) 280 + { 281 + return devm_reset_control_get_exclusive(dev, id); 282 + } 283 + 284 + static inline struct reset_control *devm_reset_control_get_optional( 285 + struct device *dev, const char *id) 286 + { 287 + return devm_reset_control_get_optional_exclusive(dev, id); 288 + 289 + } 290 + 291 + static inline struct reset_control *devm_reset_control_get_by_index( 292 + struct device *dev, int index) 293 + { 294 + return devm_reset_control_get_exclusive_by_index(dev, index); 295 + } 319 296 #endif