Skip to content

Commit bd90f11

Browse files
committed
Merge tag 'reset-for-4.3' of git://git.pengutronix.de/git/pza/linux into next/drivers
Reset controller changes for v4.3 - moved the DT reset binding includes from include/dt-bindings/reset-controller to include/dt-bindings/reset - new driver for LPC18xx Reset Generation Unit (RGU) - of_device_id array in the STi driver changed to const. - extend SoCFPGA reset driver to support Arria10 - new ath79 reset controller driver for AR71XX/AR9XXX - new driver for Xilinx Zynq reset controller * tag 'reset-for-4.3' of git://git.pengutronix.de/git/pza/linux: 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 Signed-off-by: Olof Johansson <[email protected]>
2 parents a005bc6 + 5d44595 commit bd90f11

23 files changed

+753
-20
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Binding for Qualcomm Atheros AR7xxx/AR9XXX reset controller
2+
3+
Please also refer to reset.txt in this directory for common reset
4+
controller binding usage.
5+
6+
Required Properties:
7+
- compatible: has to be "qca,<soctype>-reset", "qca,ar7100-reset"
8+
as fallback
9+
- reg: Base address and size of the controllers memory area
10+
- #reset-cells : Specifies the number of cells needed to encode reset
11+
line, should be 1
12+
13+
Example:
14+
15+
reset-controller@1806001c {
16+
compatible = "qca,ar9132-reset", "qca,ar7100-reset";
17+
reg = <0x1806001c 0x4>;
18+
19+
#reset-cells = <1>;
20+
};
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
NXP LPC1850 Reset Generation Unit (RGU)
2+
========================================
3+
4+
Please also refer to reset.txt in this directory for common reset
5+
controller binding usage.
6+
7+
Required properties:
8+
- compatible: Should be "nxp,lpc1850-rgu"
9+
- reg: register base and length
10+
- clocks: phandle and clock specifier to RGU clocks
11+
- clock-names: should contain "delay" and "reg"
12+
- #reset-cells: should be 1
13+
14+
See table below for valid peripheral reset numbers. Numbers not
15+
in the table below are either reserved or not applicable for
16+
normal operation.
17+
18+
Reset Peripheral
19+
9 System control unit (SCU)
20+
12 ARM Cortex-M0 subsystem core (LPC43xx only)
21+
13 CPU core
22+
16 LCD controller
23+
17 USB0
24+
18 USB1
25+
19 DMA
26+
20 SDIO
27+
21 External memory controller (EMC)
28+
22 Ethernet
29+
25 Flash bank A
30+
27 EEPROM
31+
28 GPIO
32+
29 Flash bank B
33+
32 Timer0
34+
33 Timer1
35+
34 Timer2
36+
35 Timer3
37+
36 Repetitive Interrupt timer (RIT)
38+
37 State Configurable Timer (SCT)
39+
38 Motor control PWM (MCPWM)
40+
39 QEI
41+
40 ADC0
42+
41 ADC1
43+
42 DAC
44+
44 USART0
45+
45 UART1
46+
46 USART2
47+
47 USART3
48+
48 I2C0
49+
49 I2C1
50+
50 SSP0
51+
51 SSP1
52+
52 I2S0 and I2S1
53+
53 Serial Flash Interface (SPIFI)
54+
54 C_CAN1
55+
55 C_CAN0
56+
56 ARM Cortex-M0 application core (LPC4370 only)
57+
57 SGPIO (LPC43xx only)
58+
58 SPI (LPC43xx only)
59+
60 ADCHS (12-bit ADC) (LPC4370 only)
60+
61+
Refer to NXP LPC18xx or LPC43xx user manual for more details about
62+
the reset signals and the connected block/peripheral.
63+
64+
Reset provider example:
65+
rgu: reset-controller@40053000 {
66+
compatible = "nxp,lpc1850-rgu";
67+
reg = <0x40053000 0x1000>;
68+
clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_BUS>;
69+
clock-names = "delay", "reg";
70+
#reset-cells = <1>;
71+
};
72+
73+
Reset consumer example:
74+
mac: ethernet@40010000 {
75+
compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
76+
reg = <0x40010000 0x2000>;
77+
interrupts = <5>;
78+
interrupt-names = "macirq";
79+
clocks = <&ccu1 CLK_CPU_ETHERNET>;
80+
clock-names = "stmmaceth";
81+
resets = <&rgu 22>;
82+
reset-names = "stmmaceth";
83+
status = "disabled";
84+
};

Documentation/devicetree/bindings/reset/st,sti-picophyreset.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ Example:
3939
};
4040

4141
Macro definitions for the supported reset channels can be found in:
42-
include/dt-bindings/reset-controller/stih407-resets.h
42+
include/dt-bindings/reset/stih407-resets.h

Documentation/devicetree/bindings/reset/st,sti-powerdown.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ example:
4343

4444
Macro definitions for the supported reset channels can be found in:
4545

46-
include/dt-bindings/reset-controller/stih415-resets.h
47-
include/dt-bindings/reset-controller/stih416-resets.h
46+
include/dt-bindings/reset/stih415-resets.h
47+
include/dt-bindings/reset/stih416-resets.h

Documentation/devicetree/bindings/reset/st,sti-softreset.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ example:
4242

4343
Macro definitions for the supported reset channels can be found in:
4444

45-
include/dt-bindings/reset-controller/stih415-resets.h
46-
include/dt-bindings/reset-controller/stih416-resets.h
45+
include/dt-bindings/reset/stih415-resets.h
46+
include/dt-bindings/reset/stih416-resets.h
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Xilinx Zynq Reset Manager
2+
3+
The Zynq AP-SoC has several different resets.
4+
5+
See Chapter 26 of the Zynq TRM (UG585) for more information about Zynq resets.
6+
7+
Required properties:
8+
- compatible: "xlnx,zynq-reset"
9+
- reg: SLCR offset and size taken via syscon <0x200 0x48>
10+
- syscon: <&slcr>
11+
This should be a phandle to the Zynq's SLCR registers.
12+
- #reset-cells: Must be 1
13+
14+
The Zynq Reset Manager needs to be a childnode of the SLCR.
15+
16+
Example:
17+
rstc: rstc@200 {
18+
compatible = "xlnx,zynq-reset";
19+
reg = <0x200 0x48>;
20+
#reset-cells = <1>;
21+
syscon = <&slcr>;
22+
};
23+
24+
Reset outputs:
25+
0 : soft reset
26+
32 : ddr reset
27+
64 : topsw reset
28+
96 : dmac reset
29+
128: usb0 reset
30+
129: usb1 reset
31+
160: gem0 reset
32+
161: gem1 reset
33+
164: gem0 rx reset
34+
165: gem1 rx reset
35+
166: gem0 ref reset
36+
167: gem1 ref reset
37+
192: sdio0 reset
38+
193: sdio1 reset
39+
196: sdio0 ref reset
40+
197: sdio1 ref reset
41+
224: spi0 reset
42+
225: spi1 reset
43+
226: spi0 ref reset
44+
227: spi1 ref reset
45+
256: can0 reset
46+
257: can1 reset
47+
258: can0 ref reset
48+
259: can1 ref reset
49+
288: i2c0 reset
50+
289: i2c1 reset
51+
320: uart0 reset
52+
321: uart1 reset
53+
322: uart0 ref reset
54+
323: uart1 ref reset
55+
352: gpio reset
56+
384: lqspi reset
57+
385: qspi ref reset
58+
416: smc reset
59+
417: smc ref reset
60+
448: ocm reset
61+
512: fpga0 out reset
62+
513: fpga1 out reset
63+
514: fpga2 out reset
64+
515: fpga3 out reset
65+
544: a9 reset 0
66+
545: a9 reset 1
67+
552: peri reset
68+

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8553,6 +8553,7 @@ M: Philipp Zabel <[email protected]>
85538553
S: Maintained
85548554
F: drivers/reset/
85558555
F: Documentation/devicetree/bindings/reset/
8556+
F: include/dt-bindings/reset/
85568557
F: include/linux/reset.h
85578558
F: include/linux/reset-controller.h
85588559

arch/arm/boot/dts/stih407-family.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "stih407-pinctrl.dtsi"
1010
#include <dt-bindings/mfd/st-lpc.h>
1111
#include <dt-bindings/phy/phy.h>
12-
#include <dt-bindings/reset-controller/stih407-resets.h>
12+
#include <dt-bindings/reset/stih407-resets.h>
1313
#include <dt-bindings/interrupt-controller/irq-st.h>
1414
/ {
1515
#address-cells = <1>;

arch/arm/boot/dts/stih415.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "stih415-clock.dtsi"
1111
#include "stih415-pinctrl.dtsi"
1212
#include <dt-bindings/interrupt-controller/arm-gic.h>
13-
#include <dt-bindings/reset-controller/stih415-resets.h>
13+
#include <dt-bindings/reset/stih415-resets.h>
1414
/ {
1515

1616
L2: cache-controller {

arch/arm/boot/dts/stih416.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <dt-bindings/phy/phy.h>
1414
#include <dt-bindings/interrupt-controller/arm-gic.h>
15-
#include <dt-bindings/reset-controller/stih416-resets.h>
15+
#include <dt-bindings/reset/stih416-resets.h>
1616
#include <dt-bindings/interrupt-controller/irq-st.h>
1717
/ {
1818
L2: cache-controller {

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ config ATH25
118118

119119
config ATH79
120120
bool "Atheros AR71XX/AR724X/AR913X based boards"
121+
select ARCH_HAS_RESET_CONTROLLER
121122
select ARCH_REQUIRE_GPIOLIB
122123
select BOOT_RAW
123124
select CEVT_R4K

arch/mips/boot/dts/qca/ar9132.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@
115115
interrupt-controller;
116116
#interrupt-cells = <1>;
117117
};
118+
119+
rst: reset-controller@1806001c {
120+
compatible = "qca,ar9132-reset",
121+
"qca,ar7100-reset";
122+
reg = <0x1806001c 0x4>;
123+
124+
#reset-cells = <1>;
125+
};
118126
};
119127

120128
spi@1f000000 {

drivers/reset/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
obj-$(CONFIG_RESET_CONTROLLER) += core.o
2+
obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
23
obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
34
obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
45
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
56
obj-$(CONFIG_ARCH_STI) += sti/
7+
obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
8+
obj-$(CONFIG_ATH79) += reset-ath79.o

drivers/reset/reset-ath79.c

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* Copyright (C) 2015 Alban Bedel <[email protected]>
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
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+
#include <linux/module.h>
16+
#include <linux/platform_device.h>
17+
#include <linux/reset-controller.h>
18+
19+
struct ath79_reset {
20+
struct reset_controller_dev rcdev;
21+
void __iomem *base;
22+
spinlock_t lock;
23+
};
24+
25+
static int ath79_reset_update(struct reset_controller_dev *rcdev,
26+
unsigned long id, bool assert)
27+
{
28+
struct ath79_reset *ath79_reset =
29+
container_of(rcdev, struct ath79_reset, rcdev);
30+
unsigned long flags;
31+
u32 val;
32+
33+
spin_lock_irqsave(&ath79_reset->lock, flags);
34+
val = readl(ath79_reset->base);
35+
if (assert)
36+
val |= BIT(id);
37+
else
38+
val &= ~BIT(id);
39+
writel(val, ath79_reset->base);
40+
spin_unlock_irqrestore(&ath79_reset->lock, flags);
41+
42+
return 0;
43+
}
44+
45+
static int ath79_reset_assert(struct reset_controller_dev *rcdev,
46+
unsigned long id)
47+
{
48+
return ath79_reset_update(rcdev, id, true);
49+
}
50+
51+
static int ath79_reset_deassert(struct reset_controller_dev *rcdev,
52+
unsigned long id)
53+
{
54+
return ath79_reset_update(rcdev, id, false);
55+
}
56+
57+
static int ath79_reset_status(struct reset_controller_dev *rcdev,
58+
unsigned long id)
59+
{
60+
struct ath79_reset *ath79_reset =
61+
container_of(rcdev, struct ath79_reset, rcdev);
62+
u32 val;
63+
64+
val = readl(ath79_reset->base);
65+
66+
return !!(val & BIT(id));
67+
}
68+
69+
static struct reset_control_ops ath79_reset_ops = {
70+
.assert = ath79_reset_assert,
71+
.deassert = ath79_reset_deassert,
72+
.status = ath79_reset_status,
73+
};
74+
75+
static int ath79_reset_probe(struct platform_device *pdev)
76+
{
77+
struct ath79_reset *ath79_reset;
78+
struct resource *res;
79+
80+
ath79_reset = devm_kzalloc(&pdev->dev,
81+
sizeof(*ath79_reset), GFP_KERNEL);
82+
if (!ath79_reset)
83+
return -ENOMEM;
84+
85+
platform_set_drvdata(pdev, ath79_reset);
86+
87+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
88+
ath79_reset->base = devm_ioremap_resource(&pdev->dev, res);
89+
if (IS_ERR(ath79_reset->base))
90+
return PTR_ERR(ath79_reset->base);
91+
92+
ath79_reset->rcdev.ops = &ath79_reset_ops;
93+
ath79_reset->rcdev.owner = THIS_MODULE;
94+
ath79_reset->rcdev.of_node = pdev->dev.of_node;
95+
ath79_reset->rcdev.of_reset_n_cells = 1;
96+
ath79_reset->rcdev.nr_resets = 32;
97+
98+
return reset_controller_register(&ath79_reset->rcdev);
99+
}
100+
101+
static int ath79_reset_remove(struct platform_device *pdev)
102+
{
103+
struct ath79_reset *ath79_reset = platform_get_drvdata(pdev);
104+
105+
reset_controller_unregister(&ath79_reset->rcdev);
106+
107+
return 0;
108+
}
109+
110+
static const struct of_device_id ath79_reset_dt_ids[] = {
111+
{ .compatible = "qca,ar7100-reset", },
112+
{ },
113+
};
114+
MODULE_DEVICE_TABLE(of, ath79_reset_dt_ids);
115+
116+
static struct platform_driver ath79_reset_driver = {
117+
.probe = ath79_reset_probe,
118+
.remove = ath79_reset_remove,
119+
.driver = {
120+
.name = "ath79-reset",
121+
.of_match_table = ath79_reset_dt_ids,
122+
},
123+
};
124+
module_platform_driver(ath79_reset_driver);
125+
126+
MODULE_AUTHOR("Alban Bedel <[email protected]>");
127+
MODULE_DESCRIPTION("AR71xx Reset Controller Driver");
128+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)