forked from torvalds/linux
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reset: starfive: Add StarFive JH7110 reset driver
Add auxiliary driver to support StarFive JH7110 system and always-on resets. Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
- Loading branch information
1 parent
e307056
commit 01106ff
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
/* | ||
* Reset driver for the StarFive JH7110 SoC | ||
* | ||
* Copyright (C) 2022 StarFive Technology Co., Ltd. | ||
*/ | ||
|
||
#include <linux/auxiliary_bus.h> | ||
|
||
#include "reset-starfive-jh71x0.h" | ||
|
||
#include <dt-bindings/reset/starfive,jh7110-crg.h> | ||
|
||
static int jh7110_reset_probe(struct auxiliary_device *adev, | ||
const struct auxiliary_device_id *id) | ||
{ | ||
struct reset_info *info = (struct reset_info *)(id->driver_data); | ||
void __iomem *base = dev_get_drvdata(adev->dev.parent); | ||
|
||
if (!info || !base) | ||
return -ENODEV; | ||
|
||
return reset_starfive_jh71x0_register(&adev->dev, adev->dev.parent->of_node, | ||
base + info->assert_offset, | ||
base + info->status_offset, | ||
NULL, | ||
info->nr_resets, | ||
NULL); | ||
} | ||
|
||
static const struct reset_info jh7110_sys_info = { | ||
.nr_resets = JH7110_SYSRST_END, | ||
.assert_offset = 0x2F8, | ||
.status_offset = 0x308, | ||
}; | ||
|
||
static const struct reset_info jh7110_aon_info = { | ||
.nr_resets = JH7110_AONRST_END, | ||
.assert_offset = 0x38, | ||
.status_offset = 0x3C, | ||
}; | ||
|
||
static const struct auxiliary_device_id jh7110_reset_ids[] = { | ||
{ | ||
.name = "clk_starfive_jh71x0.reset-sys", | ||
.driver_data = (kernel_ulong_t)&jh7110_sys_info, | ||
}, | ||
{ | ||
.name = "clk_starfive_jh71x0.reset-aon", | ||
.driver_data = (kernel_ulong_t)&jh7110_aon_info, | ||
}, | ||
{ /* sentinel */ } | ||
}; | ||
MODULE_DEVICE_TABLE(auxiliary, jh7110_reset_ids); | ||
|
||
static struct auxiliary_driver jh7110_reset_driver = { | ||
.probe = jh7110_reset_probe, | ||
.id_table = jh7110_reset_ids, | ||
}; | ||
module_auxiliary_driver(jh7110_reset_driver); | ||
|
||
MODULE_AUTHOR("Hal Feng <hal.feng@starfivetech.com>"); | ||
MODULE_DESCRIPTION("StarFive JH7110 reset driver"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters