aboutsummaryrefslogtreecommitdiff
path: root/simple-reset-consumer.c
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2021-05-16 19:38:05 +1200
committerDavid Phillips <david@yeah.nah.nz>2021-05-16 19:38:05 +1200
commit50af9be8086dda5febc62f2e9f254720180a748b (patch)
tree20b469357acfa8da4572cf761c22c8201e508442 /simple-reset-consumer.c
parent9de30f1f92924be479dd3ed07a4638e46a83098b (diff)
downloadcds9k-50af9be8086dda5febc62f2e9f254720180a748b.tar.xz
Add reset driver and consumer for debugging it
Diffstat (limited to 'simple-reset-consumer.c')
-rw-r--r--simple-reset-consumer.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/simple-reset-consumer.c b/simple-reset-consumer.c
new file mode 100644
index 0000000..21c0da0
--- /dev/null
+++ b/simple-reset-consumer.c
@@ -0,0 +1,36 @@
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+
+static int simple_reset_consumer_probe(struct platform_device *pdev)
+{
+ struct reset_control *reset = devm_reset_control_get(&pdev->dev, NULL);
+ if (IS_ERR(reset))
+ return PTR_ERR(reset);
+
+ dev_info(&pdev->dev, "firing reset\n");
+ reset_control_reset(reset);
+
+ return 0;
+}
+
+static struct of_device_id simple_reset_consumer_of_match[] = {
+ { .compatible = "david,simple-reset-consumer" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, simple_reset_consumer_of_match);
+
+static struct platform_driver simple_reset_consumer = {
+ .driver = {
+ .name = "simple-reset-consumer",
+ .of_match_table = simple_reset_consumer_of_match,
+ },
+ .probe = simple_reset_consumer_probe
+};
+module_platform_driver(simple_reset_consumer);
+
+MODULE_AUTHOR("David Phillips <david@yeah.nah.nz>");
+MODULE_DESCRIPTION("Simple reset consumer for testing/demoing reset controllers");
+MODULE_LICENSE("GPL v2");