Skip to contentSkip to conversation

reset: reset-hisilicon: also handle #reset-cells = <2>

PATCH In review Yang Xiwen 2 participants 2 messages Jan 19, 2024 – Jan 25, 2024 Reset controller framework

lore
Share & tools
lore

Yang Xiwen

author
#0 lore raw

PATCH 1/1 reset: reset-hisilicon: also handle #reset-cells = <2>

It's also valid to have #reset-cells = <2> while the third arg defaults to ASSERT_SET.

---
 drivers/reset/reset-hisilicon.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/reset/reset-hisilicon.c +13 -2
index 8152cec227..85e02b296b 100644
@@ -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;
 }

---
base-commit: f7cca7ccc5117eaafcc2bde91ad1bed6fee7cfc3
change-id: 20240119-rst-0bc8097b847a

Best regards,

Signature · 1 line
Yang Xiwen <[email protected]>
#1 lore raw
Quoted 6 lines · On Fri, Jan 19, 2024 at 08:49:17PM +0800, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen <[email protected]>

It's also valid to have #reset-cells = <2> while the third arg defaults to ASSERT_SET.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom