aboutsummaryrefslogtreecommitdiff
path: root/simple-reset-consumer.c
blob: 21c0da006293ecdd032b8813cec5de017c5e0da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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");