1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Reset driver for the StarFive JH7110 SoC
5 * Copyright (C) 2022 StarFive Technology Co., Ltd.
8 #include <linux/auxiliary_bus.h>
10 #include <soc/starfive/reset-starfive-jh71x0.h>
12 #include "reset-starfive-jh71x0.h"
14 #include <dt-bindings/reset/starfive,jh7110-crg.h>
16 struct jh7110_reset_info {
17 unsigned int nr_resets;
18 unsigned int assert_offset;
19 unsigned int status_offset;
22 static const struct jh7110_reset_info jh7110_sys_info = {
23 .nr_resets = JH7110_SYSRST_END,
24 .assert_offset = 0x2F8,
25 .status_offset = 0x308,
28 static const struct jh7110_reset_info jh7110_aon_info = {
29 .nr_resets = JH7110_AONRST_END,
30 .assert_offset = 0x38,
31 .status_offset = 0x3C,
34 static int jh7110_reset_probe(struct auxiliary_device *adev,
35 const struct auxiliary_device_id *id)
37 struct jh7110_reset_info *info = (struct jh7110_reset_info *)(id->driver_data);
38 struct jh71x0_reset_adev *rdev = to_jh71x0_reset_adev(adev);
39 void __iomem *base = rdev->base;
44 return reset_starfive_jh71x0_register(&adev->dev, adev->dev.parent->of_node,
45 base + info->assert_offset,
46 base + info->status_offset,
52 static const struct auxiliary_device_id jh7110_reset_ids[] = {
54 .name = "clk_starfive_jh7110_sys.rst-sys",
55 .driver_data = (kernel_ulong_t)&jh7110_sys_info,
58 .name = "clk_starfive_jh7110_sys.rst-aon",
59 .driver_data = (kernel_ulong_t)&jh7110_aon_info,
63 MODULE_DEVICE_TABLE(auxiliary, jh7110_reset_ids);
65 static struct auxiliary_driver jh7110_reset_driver = {
66 .probe = jh7110_reset_probe,
67 .id_table = jh7110_reset_ids,
69 module_auxiliary_driver(jh7110_reset_driver);
71 MODULE_AUTHOR("Hal Feng <hal.feng@starfivetech.com>");
72 MODULE_DESCRIPTION("StarFive JH7110 reset driver");
73 MODULE_LICENSE("GPL");