diff options
author | Yang Xiwen <forbidden405@outlook.com> | 2024-01-19 20:49:17 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-01-24 11:12:12 -0500 |
commit | 7637e402549217edd9b383aaf4c252d890b61ebc (patch) | |
tree | d837e35e0e53351ed9a0a599c87a3459fbc7b0df | |
parent | 6a520fede44d85e82c7c8e382ecbbff5856aa1bf (diff) | |
download | u-boot-WIP/2024-01-24-assorted-fixes-and-updates.zip u-boot-WIP/2024-01-24-assorted-fixes-and-updates.tar.gz u-boot-WIP/2024-01-24-assorted-fixes-and-updates.tar.bz2 |
reset: reset-hisilicon: also handle #reset-cells = <2>WIP/2024-01-24-assorted-fixes-and-updates
It's also valid to have #reset-cells = <2> while the third arg defaults
to ASSERT_SET.
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
-rw-r--r-- | drivers/reset/reset-hisilicon.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c index 8152cec..85e02b2 100644 --- a/drivers/reset/reset-hisilicon.c +++ b/drivers/reset/reset-hisilicon.c @@ -49,7 +49,18 @@ static int hisi_reset_assert(struct reset_ctl *rst) static int hisi_reset_of_xlate(struct reset_ctl *rst, struct ofnode_phandle_args *args) { - if (args->args_count != 3) { + unsigned long polarity; + + switch (args->args_count) { + case 2: + polarity = ASSERT_SET; + break; + + case 3: + polarity = args->args[2]; + break; + + default: debug("Invalid args_count: %d\n", args->args_count); return -EINVAL; } @@ -57,7 +68,7 @@ static int hisi_reset_of_xlate(struct reset_ctl *rst, /* Use .data field as register offset and .id field as bit shift */ rst->data = args->args[0]; rst->id = args->args[1]; - rst->polarity = args->args[2]; + rst->polarity = polarity; return 0; } |