-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'drivers/reset' into next/late
* drivers/reset: reset: ath79: Fix missing spin_lock_init reset: Add (devm_)reset_control_get stub functions reset: reset-zynq: Adding support for Xilinx Zynq reset controller. docs: dts: Added documentation for Xilinx Zynq Reset Controller bindings. MIPS: ath79: Add the reset controller to the AR9132 dtsi reset: Add a driver for the reset controller on the AR71XX/AR9XXX devicetree: Add bindings for the ATH79 reset controller reset: socfpga: Update reset-socfpga to read the altr,modrst-offset property doc: dt: add documentation for lpc1850-rgu reset driver reset: add driver for lpc18xx rgu reset: sti: constify of_device_id array ARM: STi: DT: Move reset controller constants into common location MAINTAINERS: add include/dt-bindings/reset path to reset controller entry
- Loading branch information
Showing
24 changed files
with
768 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Binding for Qualcomm Atheros AR7xxx/AR9XXX reset controller | ||
|
||
Please also refer to reset.txt in this directory for common reset | ||
controller binding usage. | ||
|
||
Required Properties: | ||
- compatible: has to be "qca,<soctype>-reset", "qca,ar7100-reset" | ||
as fallback | ||
- reg: Base address and size of the controllers memory area | ||
- #reset-cells : Specifies the number of cells needed to encode reset | ||
line, should be 1 | ||
|
||
Example: | ||
|
||
reset-controller@1806001c { | ||
compatible = "qca,ar9132-reset", "qca,ar7100-reset"; | ||
reg = <0x1806001c 0x4>; | ||
|
||
#reset-cells = <1>; | ||
}; |
84 changes: 84 additions & 0 deletions
84
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
NXP LPC1850 Reset Generation Unit (RGU) | ||
======================================== | ||
|
||
Please also refer to reset.txt in this directory for common reset | ||
controller binding usage. | ||
|
||
Required properties: | ||
- compatible: Should be "nxp,lpc1850-rgu" | ||
- reg: register base and length | ||
- clocks: phandle and clock specifier to RGU clocks | ||
- clock-names: should contain "delay" and "reg" | ||
- #reset-cells: should be 1 | ||
|
||
See table below for valid peripheral reset numbers. Numbers not | ||
in the table below are either reserved or not applicable for | ||
normal operation. | ||
|
||
Reset Peripheral | ||
9 System control unit (SCU) | ||
12 ARM Cortex-M0 subsystem core (LPC43xx only) | ||
13 CPU core | ||
16 LCD controller | ||
17 USB0 | ||
18 USB1 | ||
19 DMA | ||
20 SDIO | ||
21 External memory controller (EMC) | ||
22 Ethernet | ||
25 Flash bank A | ||
27 EEPROM | ||
28 GPIO | ||
29 Flash bank B | ||
32 Timer0 | ||
33 Timer1 | ||
34 Timer2 | ||
35 Timer3 | ||
36 Repetitive Interrupt timer (RIT) | ||
37 State Configurable Timer (SCT) | ||
38 Motor control PWM (MCPWM) | ||
39 QEI | ||
40 ADC0 | ||
41 ADC1 | ||
42 DAC | ||
44 USART0 | ||
45 UART1 | ||
46 USART2 | ||
47 USART3 | ||
48 I2C0 | ||
49 I2C1 | ||
50 SSP0 | ||
51 SSP1 | ||
52 I2S0 and I2S1 | ||
53 Serial Flash Interface (SPIFI) | ||
54 C_CAN1 | ||
55 C_CAN0 | ||
56 ARM Cortex-M0 application core (LPC4370 only) | ||
57 SGPIO (LPC43xx only) | ||
58 SPI (LPC43xx only) | ||
60 ADCHS (12-bit ADC) (LPC4370 only) | ||
|
||
Refer to NXP LPC18xx or LPC43xx user manual for more details about | ||
the reset signals and the connected block/peripheral. | ||
|
||
Reset provider example: | ||
rgu: reset-controller@40053000 { | ||
compatible = "nxp,lpc1850-rgu"; | ||
reg = <0x40053000 0x1000>; | ||
clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_BUS>; | ||
clock-names = "delay", "reg"; | ||
#reset-cells = <1>; | ||
}; | ||
|
||
Reset consumer example: | ||
mac: ethernet@40010000 { | ||
compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac"; | ||
reg = <0x40010000 0x2000>; | ||
interrupts = <5>; | ||
interrupt-names = "macirq"; | ||
clocks = <&ccu1 CLK_CPU_ETHERNET>; | ||
clock-names = "stmmaceth"; | ||
resets = <&rgu 22>; | ||
reset-names = "stmmaceth"; | ||
status = "disabled"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Xilinx Zynq Reset Manager | ||
|
||
The Zynq AP-SoC has several different resets. | ||
|
||
See Chapter 26 of the Zynq TRM (UG585) for more information about Zynq resets. | ||
|
||
Required properties: | ||
- compatible: "xlnx,zynq-reset" | ||
- reg: SLCR offset and size taken via syscon <0x200 0x48> | ||
- syscon: <&slcr> | ||
This should be a phandle to the Zynq's SLCR registers. | ||
- #reset-cells: Must be 1 | ||
|
||
The Zynq Reset Manager needs to be a childnode of the SLCR. | ||
|
||
Example: | ||
rstc: rstc@200 { | ||
compatible = "xlnx,zynq-reset"; | ||
reg = <0x200 0x48>; | ||
#reset-cells = <1>; | ||
syscon = <&slcr>; | ||
}; | ||
|
||
Reset outputs: | ||
0 : soft reset | ||
32 : ddr reset | ||
64 : topsw reset | ||
96 : dmac reset | ||
128: usb0 reset | ||
129: usb1 reset | ||
160: gem0 reset | ||
161: gem1 reset | ||
164: gem0 rx reset | ||
165: gem1 rx reset | ||
166: gem0 ref reset | ||
167: gem1 ref reset | ||
192: sdio0 reset | ||
193: sdio1 reset | ||
196: sdio0 ref reset | ||
197: sdio1 ref reset | ||
224: spi0 reset | ||
225: spi1 reset | ||
226: spi0 ref reset | ||
227: spi1 ref reset | ||
256: can0 reset | ||
257: can1 reset | ||
258: can0 ref reset | ||
259: can1 ref reset | ||
288: i2c0 reset | ||
289: i2c1 reset | ||
320: uart0 reset | ||
321: uart1 reset | ||
322: uart0 ref reset | ||
323: uart1 ref reset | ||
352: gpio reset | ||
384: lqspi reset | ||
385: qspi ref reset | ||
416: smc reset | ||
417: smc ref reset | ||
448: ocm reset | ||
512: fpga0 out reset | ||
513: fpga1 out reset | ||
514: fpga2 out reset | ||
515: fpga3 out reset | ||
544: a9 reset 0 | ||
545: a9 reset 1 | ||
552: peri reset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
obj-$(CONFIG_RESET_CONTROLLER) += core.o | ||
obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o | ||
obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o | ||
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o | ||
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o | ||
obj-$(CONFIG_ARCH_STI) += sti/ | ||
obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o | ||
obj-$(CONFIG_ATH79) += reset-ath79.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* Copyright (C) 2015 Alban Bedel <albeu@free.fr> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/reset-controller.h> | ||
|
||
struct ath79_reset { | ||
struct reset_controller_dev rcdev; | ||
void __iomem *base; | ||
spinlock_t lock; | ||
}; | ||
|
||
static int ath79_reset_update(struct reset_controller_dev *rcdev, | ||
unsigned long id, bool assert) | ||
{ | ||
struct ath79_reset *ath79_reset = | ||
container_of(rcdev, struct ath79_reset, rcdev); | ||
unsigned long flags; | ||
u32 val; | ||
|
||
spin_lock_irqsave(&ath79_reset->lock, flags); | ||
val = readl(ath79_reset->base); | ||
if (assert) | ||
val |= BIT(id); | ||
else | ||
val &= ~BIT(id); | ||
writel(val, ath79_reset->base); | ||
spin_unlock_irqrestore(&ath79_reset->lock, flags); | ||
|
||
return 0; | ||
} | ||
|
||
static int ath79_reset_assert(struct reset_controller_dev *rcdev, | ||
unsigned long id) | ||
{ | ||
return ath79_reset_update(rcdev, id, true); | ||
} | ||
|
||
static int ath79_reset_deassert(struct reset_controller_dev *rcdev, | ||
unsigned long id) | ||
{ | ||
return ath79_reset_update(rcdev, id, false); | ||
} | ||
|
||
static int ath79_reset_status(struct reset_controller_dev *rcdev, | ||
unsigned long id) | ||
{ | ||
struct ath79_reset *ath79_reset = | ||
container_of(rcdev, struct ath79_reset, rcdev); | ||
u32 val; | ||
|
||
val = readl(ath79_reset->base); | ||
|
||
return !!(val & BIT(id)); | ||
} | ||
|
||
static struct reset_control_ops ath79_reset_ops = { | ||
.assert = ath79_reset_assert, | ||
.deassert = ath79_reset_deassert, | ||
.status = ath79_reset_status, | ||
}; | ||
|
||
static int ath79_reset_probe(struct platform_device *pdev) | ||
{ | ||
struct ath79_reset *ath79_reset; | ||
struct resource *res; | ||
|
||
ath79_reset = devm_kzalloc(&pdev->dev, | ||
sizeof(*ath79_reset), GFP_KERNEL); | ||
if (!ath79_reset) | ||
return -ENOMEM; | ||
|
||
platform_set_drvdata(pdev, ath79_reset); | ||
|
||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
ath79_reset->base = devm_ioremap_resource(&pdev->dev, res); | ||
if (IS_ERR(ath79_reset->base)) | ||
return PTR_ERR(ath79_reset->base); | ||
|
||
spin_lock_init(&ath79_reset->lock); | ||
ath79_reset->rcdev.ops = &ath79_reset_ops; | ||
ath79_reset->rcdev.owner = THIS_MODULE; | ||
ath79_reset->rcdev.of_node = pdev->dev.of_node; | ||
ath79_reset->rcdev.of_reset_n_cells = 1; | ||
ath79_reset->rcdev.nr_resets = 32; | ||
|
||
return reset_controller_register(&ath79_reset->rcdev); | ||
} | ||
|
||
static int ath79_reset_remove(struct platform_device *pdev) | ||
{ | ||
struct ath79_reset *ath79_reset = platform_get_drvdata(pdev); | ||
|
||
reset_controller_unregister(&ath79_reset->rcdev); | ||
|
||
return 0; | ||
} | ||
|
||
static const struct of_device_id ath79_reset_dt_ids[] = { | ||
{ .compatible = "qca,ar7100-reset", }, | ||
{ }, | ||
}; | ||
MODULE_DEVICE_TABLE(of, ath79_reset_dt_ids); | ||
|
||
static struct platform_driver ath79_reset_driver = { | ||
.probe = ath79_reset_probe, | ||
.remove = ath79_reset_remove, | ||
.driver = { | ||
.name = "ath79-reset", | ||
.of_match_table = ath79_reset_dt_ids, | ||
}, | ||
}; | ||
module_platform_driver(ath79_reset_driver); | ||
|
||
MODULE_AUTHOR("Alban Bedel <albeu@free.fr>"); | ||
MODULE_DESCRIPTION("AR71xx Reset Controller Driver"); | ||
MODULE_LICENSE("GPL"); |
Oops, something went wrong.