]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
reset: reset-hisilicon: also handle #reset-cells = <2>
authorYang Xiwen <forbidden405@outlook.com>
Fri, 19 Jan 2024 12:49:17 +0000 (20:49 +0800)
committerTom Rini <trini@konsulko.com>
Wed, 24 Jan 2024 21:17:14 +0000 (16:17 -0500)
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>
drivers/reset/reset-hisilicon.c

index 8152cec22714f4a03ff9f3cb8cb523d66902abad..85e02b296b02b0a9018542e62fa404813b2590db 100644 (file)
@@ -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;
 }