summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-08-19 00:04:27 +0200
committerArnd Bergmann <arnd@arndb.de>2017-08-19 00:04:27 +0200
commite517030e2689c3f04a5516c1b4c007c8a64c597b (patch)
treec65ad73020d3db15f71ac53e1dad8c79ea43000a /include
parent03f89359929eee410cc9a73be094d717b33bb65c (diff)
parentac0c735ac3dd6697055299cac01617527aa6a695 (diff)
Merge tag 'reset-for-4.14' of git://git.pengutronix.de/git/pza/linux into next/drivers
Pull "Reset controller changes for v4.14" from Philipp Zabel: - constify zx2967 reset_ops - add a convenience API to manage an array of resets - let deassert report success and let assert report success for shared resets if the reset controller driver does not implement (de)assert. - add HSDKv1 reset driver - remove Gemini reset controller, the driver is made obsolete by a combined clock/reset driver in drivers/clk - fix the total number of reset lines in the sunxi driver - various uniphier updates and fixes: - remove sLD3 SoC support - simplify system reset register and bit definitions - add audio systems, video input subsystem, and analog amplifiers reset controls * tag 'reset-for-4.14' of git://git.pengutronix.de/git/pza/linux: reset: uniphier: add analog amplifiers reset control reset: uniphier: add video input subsystem reset control reset: uniphier: add audio systems reset control reset: sunxi: fix number of reset lines reset: uniphier: do not use per-SoC macro for system reset block reset: uniphier: remove sLD3 SoC support Revert "reset: Add a Gemini reset controller" ARC: reset: introduce HSDKv1 reset driver reset: make (de)assert report success for self-deasserting reset drivers reset: Add APIs to manage array of resets reset: zx2967: constify zx2967_reset_ops.
Diffstat (limited to 'include')
-rw-r--r--include/dt-bindings/reset/snps,hsdk-v1-reset.h17
-rw-r--r--include/linux/reset.h68
2 files changed, 85 insertions, 0 deletions
diff --git a/include/dt-bindings/reset/snps,hsdk-v1-reset.h b/include/dt-bindings/reset/snps,hsdk-v1-reset.h
new file mode 100644
index 000000000000..d898c89b7123
--- /dev/null
+++ b/include/dt-bindings/reset/snps,hsdk-v1-reset.h
@@ -0,0 +1,17 @@
+/**
+ * This header provides index for the HSDK v1 reset controller.
+ */
+#ifndef _DT_BINDINGS_RESET_CONTROLLER_HSDK_V1
+#define _DT_BINDINGS_RESET_CONTROLLER_HSDK_V1
+
+#define HSDK_V1_APB_RESET 0
+#define HSDK_V1_AXI_RESET 1
+#define HSDK_V1_ETH_RESET 2
+#define HSDK_V1_USB_RESET 3
+#define HSDK_V1_SDIO_RESET 4
+#define HSDK_V1_HDMI_RESET 5
+#define HSDK_V1_GFX_RESET 6
+#define HSDK_V1_DMAC_RESET 7
+#define HSDK_V1_EBI_RESET 8
+
+#endif /*_DT_BINDINGS_RESET_CONTROLLER_HSDK_V1*/
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 13d8681210d5..56463f37f3e6 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -25,6 +25,11 @@ struct reset_control *__devm_reset_control_get(struct device *dev,
int __must_check device_reset(struct device *dev);
+struct reset_control *devm_reset_control_array_get(struct device *dev,
+ bool shared, bool optional);
+struct reset_control *of_reset_control_array_get(struct device_node *np,
+ bool shared, bool optional);
+
static inline int device_reset_optional(struct device *dev)
{
return device_reset(dev);
@@ -89,6 +94,18 @@ static inline struct reset_control *__devm_reset_control_get(
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}
+static inline struct reset_control *
+devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
+{
+ return optional ? NULL : ERR_PTR(-ENOTSUPP);
+}
+
+static inline struct reset_control *
+of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
+{
+ return optional ? NULL : ERR_PTR(-ENOTSUPP);
+}
+
#endif /* CONFIG_RESET_CONTROLLER */
/**
@@ -374,4 +391,55 @@ static inline struct reset_control *devm_reset_control_get_by_index(
{
return devm_reset_control_get_exclusive_by_index(dev, index);
}
+
+/*
+ * APIs to manage a list of reset controllers
+ */
+static inline struct reset_control *
+devm_reset_control_array_get_exclusive(struct device *dev)
+{
+ return devm_reset_control_array_get(dev, false, false);
+}
+
+static inline struct reset_control *
+devm_reset_control_array_get_shared(struct device *dev)
+{
+ return devm_reset_control_array_get(dev, true, false);
+}
+
+static inline struct reset_control *
+devm_reset_control_array_get_optional_exclusive(struct device *dev)
+{
+ return devm_reset_control_array_get(dev, false, true);
+}
+
+static inline struct reset_control *
+devm_reset_control_array_get_optional_shared(struct device *dev)
+{
+ return devm_reset_control_array_get(dev, true, true);
+}
+
+static inline struct reset_control *
+of_reset_control_array_get_exclusive(struct device_node *node)
+{
+ return of_reset_control_array_get(node, false, false);
+}
+
+static inline struct reset_control *
+of_reset_control_array_get_shared(struct device_node *node)
+{
+ return of_reset_control_array_get(node, true, false);
+}
+
+static inline struct reset_control *
+of_reset_control_array_get_optional_exclusive(struct device_node *node)
+{
+ return of_reset_control_array_get(node, false, true);
+}
+
+static inline struct reset_control *
+of_reset_control_array_get_optional_shared(struct device_node *node)
+{
+ return of_reset_control_array_get(node, true, true);
+}
#endif