Skip to contentSkip to conversation

ARM SOCFPGA: add resetmgr command so reset can be deasserted in bootcmd (for example on peripheral dma interfaces after fpga has been programmed).

PATCH New Frank Mori Hess 2 participants 2 messages Dec 14, 2017 – Dec 15, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM SOCFPGA: add resetmgr command so reset can be deasserted in bootcmd (for example on peripheral dma interfaces after fpga has been programmed).

---
 arch/arm/mach-socfpga/reset_manager_gen5.c | 31 ++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/mach-socfpga/reset_manager_gen5.c +31 -0
index aa88adb414..6ad5d2a362 100644
@@ -114,3 +114,34 @@ void socfpga_bridges_reset(int enable)
 	return;
 }
 #endif
+
+int resetmgr_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	unsigned long bank;
+	unsigned long offset;
+	unsigned long assert;
+
+	if (argc != 4)
+		return CMD_RET_USAGE;
+
+	bank = simple_strtoul(argv[1], NULL, 0);
+	offset = simple_strtoul(argv[2], NULL, 0);
+	assert = simple_strtoul(argv[3], NULL, 0);
+	socfpga_per_reset(RSTMGR_DEFINE(bank, offset), assert);
+	return 0;
+}
+
+U_BOOT_CMD(
+	resetmgr, 4, 1, resetmgr_cmd,
+	"SoCFPGA HPS reset manager control",
+	"resetmgr bank offset assert\n"
+	"    bank - Bank of reset to assert/deassert.\n"
+	"        0 ... mpumodrst\n"
+	"        1 ... permodrst\n"
+	"        2 ... per2modrst\n"
+	"        3 ... brgmodrst\n"
+	"        4 ... miscmodrst\n"
+	"    offset - Offset of reset to assert/deassert.\n"
+	"    assert - 1 to assert reset, 0 to deassert.\n"
+	""
+);
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAJz5OpcM_nHQqecnP1xPkHZS=40rpPPwbGfvj8rq4rCsH24PYg@mail.gmail.com

#3 lore raw

PATCH 1/1 ARM SOCFPGA: add resetmgr command so reset can be deasserted in bootcmd (for example on peripheral dma interfaces after fpga has been programmed).

On 12/15/2017 06:07 PM, Frank Mori Hess wrote:

Please always CC the list. Do NOT top-post.

Quoted 4 lines

Would you consider it more worthwhile if it included the reset_config.h generated by Quartus (currently ignored by mainline u-boot) and figured out which reset lines needed to be deasserted on its own?

What is your goal here ?

Quoted 2 lines

Or, what if that function was integrated into the "bridge" command?

No, that's for controlling the bridges.

Quoted 1 line

Are you against defining commands?

I am against polluting U-Boot with ad-hoc commands without any concept.

Quoted 3 lines

If so, why does the
"bridge" command exist anyways, wasn't there a bridge_enable_handoff in the u-boot env before that did the same thing?

Because that one didn't work. Notice that the bridge command runs some assembly locked to cacheline.

Quoted 7 lines

The current
situation is poor, if you have anything in your fpga that uses dma then reset_config.h is ignored and the dma simply doesn't work. It is up to the end user to figure out why. The altera version of u-boot has a reset_deassert_peripherals_handoff which handles this stuff, I'm not sure what the rationale was for dropping it although it did seem to get called way too early as far as the dma reset deassert goes.

Going back to my initial question -- what is your usecase and your aim here ? Usually you use FPGA manager in Linux to load the FPGA.

Quoted 9 lines · Marek Vasut
Quoted 8 lines · Frank Mori Hess

Commit message is missing, SoB line is missing etc
https://www.denx.de/wiki/U-Boot/Patches#General_Patch_Submission_Rules

But you can really just do mw to the correct address or create a U-Boot script , so this command is not really needed, is it ?

Signature · 2 lines
Best regards,
Marek Vasut