1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/err.h>
22#include <linux/hwspinlock.h>
23
24#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h>
26
27static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
28 .base_id = 0,
29};
30
31int __init hwspinlocks_init(void)
32{
33 int retval = 0;
34 struct omap_hwmod *oh;
35 struct platform_device *pdev;
36 const char *oh_name = "spinlock";
37 const char *dev_name = "omap_hwspinlock";
38
39
40
41
42
43
44 oh = omap_hwmod_lookup(oh_name);
45 if (oh == NULL)
46 return -EINVAL;
47
48 pdev = omap_device_build(dev_name, 0, oh, &omap_hwspinlock_pdata,
49 sizeof(struct hwspinlock_pdata),
50 NULL, 0, false);
51 if (IS_ERR(pdev)) {
52 pr_err("Can't build omap_device for %s:%s\n", dev_name,
53 oh_name);
54 retval = PTR_ERR(pdev);
55 }
56
57 return retval;
58}
59
60postcore_initcall(hwspinlocks_init);
61