Skip to content

Commit af058d5

Browse files
committed
Merge tag 'reset-for-v6.19' of https://git.pengutronix.de/git/pza/linux into soc/drivers
Reset controller updates for v6.19 * Add support for LAN969x, eic770 and RZ/G3S reset controllers, for the RZ/G3S USB-PHY reset controller, and for the remaining TH1520 reset controllers. * Drop legacy reset control lookup code. * Include linux/bits.h from linux/reset.h to make it self-contained. * tag 'reset-for-v6.19' of https://git.pengutronix.de/git/pza/linux: Documentation: reset: Remove reset_controller_add_lookup() reset: fix BIT macro reference reset: rzg2l-usbphy-ctrl: Fix a NULL vs IS_ERR() bug in probe reset: th1520: Support reset controllers in more subsystems reset: th1520: Prepare for supporting multiple controllers dt-bindings: reset: thead,th1520-reset: Add controllers for more subsys dt-bindings: reset: thead,th1520-reset: Remove non-VO-subsystem resets reset: remove legacy reset lookup code clk: davinci: psc: drop unused reset lookup reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support reset: eswin: Add eic7700 reset driver dt-bindings: reset: eswin: Documentation for eic7700 SoC reset: sparx5: add LAN969x support dt-bindings: reset: microchip: Add LAN969x support Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 73147be + 1387cb7 commit af058d5

16 files changed

Lines changed: 1935 additions & 188 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/reset/eswin,eic7700-reset.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: ESWIN EIC7700 SoC reset controller
8+
9+
maintainers:
10+
- Yifeng Huang <huangyifeng@eswincomputing.com>
11+
- Xuyang Dong <dongxuyang@eswincomputing.com>
12+
13+
description:
14+
The system reset controller can be used to reset various peripheral
15+
controllers in ESWIN eic7700 SoC.
16+
17+
properties:
18+
compatible:
19+
const: eswin,eic7700-reset
20+
21+
reg:
22+
maxItems: 1
23+
24+
'#reset-cells':
25+
const: 1
26+
27+
required:
28+
- compatible
29+
- reg
30+
- '#reset-cells'
31+
32+
additionalProperties: false
33+
34+
examples:
35+
- |
36+
#include <dt-bindings/reset/eswin,eic7700-reset.h>
37+
38+
reset-controller@51828300 {
39+
compatible = "eswin,eic7700-reset";
40+
reg = <0x51828300 0x200>;
41+
#reset-cells = <1>;
42+
};

Documentation/devicetree/bindings/reset/microchip,rst.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ properties:
2020
pattern: "^reset-controller@[0-9a-f]+$"
2121

2222
compatible:
23-
enum:
24-
- microchip,sparx5-switch-reset
25-
- microchip,lan966x-switch-reset
23+
oneOf:
24+
- enum:
25+
- microchip,sparx5-switch-reset
26+
- microchip,lan966x-switch-reset
27+
- items:
28+
- enum:
29+
- microchip,lan9691-switch-reset
30+
- const: microchip,lan966x-switch-reset
2631

2732
reg:
2833
items:

Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ description:
1515

1616
properties:
1717
compatible:
18-
items:
19-
- enum:
20-
- renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
21-
- renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
22-
- renesas,r9a07g054-usbphy-ctrl # RZ/V2L
23-
- const: renesas,rzg2l-usbphy-ctrl
18+
oneOf:
19+
- items:
20+
- enum:
21+
- renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
22+
- renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
23+
- renesas,r9a07g054-usbphy-ctrl # RZ/V2L
24+
- const: renesas,rzg2l-usbphy-ctrl
25+
- const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
2426

2527
reg:
2628
maxItems: 1
@@ -48,6 +50,20 @@ properties:
4850
$ref: /schemas/regulator/regulator.yaml#
4951
unevaluatedProperties: false
5052

53+
renesas,sysc-pwrrdy:
54+
description:
55+
The system controller PWRRDY indicates to the USB PHY if the power supply
56+
is ready. PWRRDY needs to be set during power-on before applying any
57+
other settings. It also needs to be set before powering off the USB.
58+
$ref: /schemas/types.yaml#/definitions/phandle-array
59+
items:
60+
- items:
61+
- description:
62+
System controller phandle required by USB PHY CTRL driver to set
63+
PWRRDY
64+
- description: Register offset associated with PWRRDY
65+
- description: Register bitmask associated with PWRRDY
66+
5167
required:
5268
- compatible
5369
- reg
@@ -57,6 +73,19 @@ required:
5773
- '#reset-cells'
5874
- regulator-vbus
5975

76+
allOf:
77+
- if:
78+
properties:
79+
compatible:
80+
contains:
81+
const: renesas,r9a08g045-usbphy-ctrl
82+
then:
83+
required:
84+
- renesas,sysc-pwrrdy
85+
else:
86+
properties:
87+
renesas,sysc-pwrrdy: false
88+
6089
additionalProperties: false
6190

6291
examples:

Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ maintainers:
1616
properties:
1717
compatible:
1818
enum:
19-
- thead,th1520-reset
19+
- thead,th1520-reset # Reset controller for VO subsystem
20+
- thead,th1520-reset-ao
21+
- thead,th1520-reset-ap
22+
- thead,th1520-reset-dsp
23+
- thead,th1520-reset-misc
24+
- thead,th1520-reset-vi
25+
- thead,th1520-reset-vp
2026

2127
reg:
2228
maxItems: 1

Documentation/driver-api/reset.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,3 @@ devm_reset_controller_register().
218218
reset_controller_register
219219
reset_controller_unregister
220220
devm_reset_controller_register
221-
reset_controller_add_lookup

drivers/clk/davinci/psc-da850.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
#include <linux/clk-provider.h>
9-
#include <linux/reset-controller.h>
109
#include <linux/clk.h>
1110
#include <linux/clkdev.h>
1211
#include <linux/init.h>
@@ -66,14 +65,8 @@ LPSC_CLKDEV3(ecap_clkdev, "fck", "ecap.0",
6665
"fck", "ecap.1",
6766
"fck", "ecap.2");
6867

69-
static struct reset_control_lookup da850_psc0_reset_lookup_table[] = {
70-
RESET_LOOKUP("da850-psc0", 15, "davinci-rproc.0", NULL),
71-
};
72-
7368
static int da850_psc0_init(struct device *dev, void __iomem *base)
7469
{
75-
reset_controller_add_lookup(da850_psc0_reset_lookup_table,
76-
ARRAY_SIZE(da850_psc0_reset_lookup_table));
7770
return davinci_psc_register_clocks(dev, da850_psc0_info, 16, base);
7871
}
7972

drivers/reset/Kconfig

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ config RESET_BRCMSTB_RESCAL
7373
This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on
7474
BCM7216 or the BCM2712.
7575

76+
config RESET_EIC7700
77+
bool "Reset controller driver for ESWIN SoCs"
78+
depends on ARCH_ESWIN || COMPILE_TEST
79+
default ARCH_ESWIN
80+
help
81+
This enables the reset controller driver for ESWIN SoCs. This driver is
82+
specific to ESWIN SoCs and should only be enabled if using such hardware.
83+
The driver supports eic7700 series chips and provides functionality for
84+
asserting and deasserting resets on the chip.
85+
7686
config RESET_EYEQ
7787
bool "Mobileye EyeQ reset controller"
7888
depends on MACH_EYEQ5 || MACH_EYEQ6H || COMPILE_TEST
@@ -170,7 +180,7 @@ config RESET_LPC18XX
170180

171181
config RESET_MCHP_SPARX5
172182
tristate "Microchip Sparx5 reset driver"
173-
depends on ARCH_SPARX5 || SOC_LAN966 || MCHP_LAN966X_PCI || COMPILE_TEST
183+
depends on ARCH_SPARX5 || ARCH_LAN969X || SOC_LAN966 || MCHP_LAN966X_PCI || COMPILE_TEST
174184
default y if SPARX5_SWITCH
175185
select MFD_SYSCON
176186
help
@@ -237,6 +247,7 @@ config RESET_RASPBERRYPI
237247
config RESET_RZG2L_USBPHY_CTRL
238248
tristate "Renesas RZ/G2L USBPHY control driver"
239249
depends on ARCH_RZG2L || COMPILE_TEST
250+
select MFD_SYSCON
240251
help
241252
Support for USBPHY Control found on RZ/G2L family. It mainly
242253
controls reset and power down of the USB/PHY.

drivers/reset/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o
1313
obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o
1414
obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o
1515
obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o
16+
obj-$(CONFIG_RESET_EIC7700) += reset-eic7700.o
1617
obj-$(CONFIG_RESET_EYEQ) += reset-eyeq.o
1718
obj-$(CONFIG_RESET_GPIO) += reset-gpio.o
1819
obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o

drivers/reset/core.c

Lines changed: 3 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
static DEFINE_MUTEX(reset_list_mutex);
2626
static LIST_HEAD(reset_controller_list);
2727

28-
static DEFINE_MUTEX(reset_lookup_mutex);
29-
static LIST_HEAD(reset_lookup_list);
30-
3128
/* Protects reset_gpio_lookup_list */
3229
static DEFINE_MUTEX(reset_gpio_lookup_mutex);
3330
static LIST_HEAD(reset_gpio_lookup_list);
@@ -190,33 +187,6 @@ int devm_reset_controller_register(struct device *dev,
190187
}
191188
EXPORT_SYMBOL_GPL(devm_reset_controller_register);
192189

193-
/**
194-
* reset_controller_add_lookup - register a set of lookup entries
195-
* @lookup: array of reset lookup entries
196-
* @num_entries: number of entries in the lookup array
197-
*/
198-
void reset_controller_add_lookup(struct reset_control_lookup *lookup,
199-
unsigned int num_entries)
200-
{
201-
struct reset_control_lookup *entry;
202-
unsigned int i;
203-
204-
mutex_lock(&reset_lookup_mutex);
205-
for (i = 0; i < num_entries; i++) {
206-
entry = &lookup[i];
207-
208-
if (!entry->dev_id || !entry->provider) {
209-
pr_warn("%s(): reset lookup entry badly specified, skipping\n",
210-
__func__);
211-
continue;
212-
}
213-
214-
list_add_tail(&entry->list, &reset_lookup_list);
215-
}
216-
mutex_unlock(&reset_lookup_mutex);
217-
}
218-
EXPORT_SYMBOL_GPL(reset_controller_add_lookup);
219-
220190
static inline struct reset_control_array *
221191
rstc_to_array(struct reset_control *rstc) {
222192
return container_of(rstc, struct reset_control_array, base);
@@ -1081,83 +1051,20 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
10811051
}
10821052
EXPORT_SYMBOL_GPL(__of_reset_control_get);
10831053

1084-
static struct reset_controller_dev *
1085-
__reset_controller_by_name(const char *name)
1086-
{
1087-
struct reset_controller_dev *rcdev;
1088-
1089-
lockdep_assert_held(&reset_list_mutex);
1090-
1091-
list_for_each_entry(rcdev, &reset_controller_list, list) {
1092-
if (!rcdev->dev)
1093-
continue;
1094-
1095-
if (!strcmp(name, dev_name(rcdev->dev)))
1096-
return rcdev;
1097-
}
1098-
1099-
return NULL;
1100-
}
1101-
1102-
static struct reset_control *
1103-
__reset_control_get_from_lookup(struct device *dev, const char *con_id,
1104-
enum reset_control_flags flags)
1105-
{
1106-
bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
1107-
const struct reset_control_lookup *lookup;
1108-
struct reset_controller_dev *rcdev;
1109-
const char *dev_id = dev_name(dev);
1110-
struct reset_control *rstc = NULL;
1111-
1112-
mutex_lock(&reset_lookup_mutex);
1113-
1114-
list_for_each_entry(lookup, &reset_lookup_list, list) {
1115-
if (strcmp(lookup->dev_id, dev_id))
1116-
continue;
1117-
1118-
if ((!con_id && !lookup->con_id) ||
1119-
((con_id && lookup->con_id) &&
1120-
!strcmp(con_id, lookup->con_id))) {
1121-
mutex_lock(&reset_list_mutex);
1122-
rcdev = __reset_controller_by_name(lookup->provider);
1123-
if (!rcdev) {
1124-
mutex_unlock(&reset_list_mutex);
1125-
mutex_unlock(&reset_lookup_mutex);
1126-
/* Reset provider may not be ready yet. */
1127-
return ERR_PTR(-EPROBE_DEFER);
1128-
}
1129-
1130-
flags &= ~RESET_CONTROL_FLAGS_BIT_OPTIONAL;
1131-
1132-
rstc = __reset_control_get_internal(rcdev,
1133-
lookup->index,
1134-
flags);
1135-
mutex_unlock(&reset_list_mutex);
1136-
break;
1137-
}
1138-
}
1139-
1140-
mutex_unlock(&reset_lookup_mutex);
1141-
1142-
if (!rstc)
1143-
return optional ? NULL : ERR_PTR(-ENOENT);
1144-
1145-
return rstc;
1146-
}
1147-
11481054
struct reset_control *__reset_control_get(struct device *dev, const char *id,
11491055
int index, enum reset_control_flags flags)
11501056
{
11511057
bool shared = flags & RESET_CONTROL_FLAGS_BIT_SHARED;
11521058
bool acquired = flags & RESET_CONTROL_FLAGS_BIT_ACQUIRED;
1059+
bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
11531060

11541061
if (WARN_ON(shared && acquired))
11551062
return ERR_PTR(-EINVAL);
11561063

11571064
if (dev->of_node)
11581065
return __of_reset_control_get(dev->of_node, id, index, flags);
11591066

1160-
return __reset_control_get_from_lookup(dev, id, flags);
1067+
return optional ? NULL : ERR_PTR(-ENOENT);
11611068
}
11621069
EXPORT_SYMBOL_GPL(__reset_control_get);
11631070

@@ -1492,31 +1399,6 @@ devm_reset_control_array_get(struct device *dev, enum reset_control_flags flags)
14921399
}
14931400
EXPORT_SYMBOL_GPL(devm_reset_control_array_get);
14941401

1495-
static int reset_control_get_count_from_lookup(struct device *dev)
1496-
{
1497-
const struct reset_control_lookup *lookup;
1498-
const char *dev_id;
1499-
int count = 0;
1500-
1501-
if (!dev)
1502-
return -EINVAL;
1503-
1504-
dev_id = dev_name(dev);
1505-
mutex_lock(&reset_lookup_mutex);
1506-
1507-
list_for_each_entry(lookup, &reset_lookup_list, list) {
1508-
if (!strcmp(lookup->dev_id, dev_id))
1509-
count++;
1510-
}
1511-
1512-
mutex_unlock(&reset_lookup_mutex);
1513-
1514-
if (count == 0)
1515-
count = -ENOENT;
1516-
1517-
return count;
1518-
}
1519-
15201402
/**
15211403
* reset_control_get_count - Count number of resets available with a device
15221404
*
@@ -1530,6 +1412,6 @@ int reset_control_get_count(struct device *dev)
15301412
if (dev->of_node)
15311413
return of_reset_control_get_count(dev->of_node);
15321414

1533-
return reset_control_get_count_from_lookup(dev);
1415+
return -ENOENT;
15341416
}
15351417
EXPORT_SYMBOL_GPL(reset_control_get_count);

0 commit comments

Comments
 (0)