This source file includes following definitions.
- kona_reset_handler
- kona_reset_probe
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <linux/io.h>
15 #include <linux/of_address.h>
16 #include <linux/of_platform.h>
17 #include <linux/reboot.h>
18
19 #define RSTMGR_REG_WR_ACCESS_OFFSET 0
20 #define RSTMGR_REG_CHIP_SOFT_RST_OFFSET 4
21
22 #define RSTMGR_WR_PASSWORD 0xa5a5
23 #define RSTMGR_WR_PASSWORD_SHIFT 8
24 #define RSTMGR_WR_ACCESS_ENABLE 1
25
26 static void __iomem *kona_reset_base;
27
28 static int kona_reset_handler(struct notifier_block *this,
29 unsigned long mode, void *cmd)
30 {
31
32
33
34
35
36 writel((RSTMGR_WR_PASSWORD << RSTMGR_WR_PASSWORD_SHIFT) |
37 RSTMGR_WR_ACCESS_ENABLE,
38 kona_reset_base + RSTMGR_REG_WR_ACCESS_OFFSET);
39 writel(0, kona_reset_base + RSTMGR_REG_CHIP_SOFT_RST_OFFSET);
40
41 return NOTIFY_DONE;
42 }
43
44 static struct notifier_block kona_reset_nb = {
45 .notifier_call = kona_reset_handler,
46 .priority = 128,
47 };
48
49 static int kona_reset_probe(struct platform_device *pdev)
50 {
51 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
52
53 kona_reset_base = devm_ioremap_resource(&pdev->dev, res);
54 if (IS_ERR(kona_reset_base))
55 return PTR_ERR(kona_reset_base);
56
57 return register_restart_handler(&kona_reset_nb);
58 }
59
60 static const struct of_device_id of_match[] = {
61 { .compatible = "brcm,bcm21664-resetmgr" },
62 {},
63 };
64
65 static struct platform_driver bcm_kona_reset_driver = {
66 .probe = kona_reset_probe,
67 .driver = {
68 .name = "brcm-kona-reset",
69 .of_match_table = of_match,
70 },
71 };
72
73 builtin_platform_driver(bcm_kona_reset_driver);