Pinmux and device-tree being patched

Hi,

I generated my devicetree file, and flashed them through USB with “sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1”. This all went well, until I actually tried to change the pinmux.

I used the excel to set it up entirely and moved the generated nodes into my devicetree file.
After half a day of looking, I finally discovered that this was not working, because -somewhere- during the flashing process OR the bootloader sequence, the device tree is patched behind my back. In particular, under pinmux@700008d4, the node pinctrl-names is deleted!. Hence, linux does not reapply pinmux.

I figured this out because I tried jetson-io, which actually just tells the bootloader to select another DTB file than the one that is flashed (using the FDT in extlinux.conf). If I do that, it also works…

But my question:

Can somebody please explain what the offical procedure is to change the device tree and the pinmux? Is there a good reason -why- it is patched to disable pinmuxing in linux in the first place? What jetson-io does is simply bypass this, and then this has no point anyway.

Thanks for your reply

BTW: Using: L4T 32.4.2 DP

hello arnout.diels,

you may refer to Nano’s application note for 40-Pin expansion header configuration.
thanks

Hi,

The procedure outlined indeed rebuilds cboot and uboot in contrast to jetson-io.
But it also only applies for the jetson nano devkit.

I’ve made my changes not in NV_Jetson_Nano_DeveloperKit_Users_Pinmux_Configuration, but in NV_Jetson_Nano_Module_Pinmux_Config_Template. The ./csv-to-board.py file refuses to parse its CSV… (ERROR: Header row not found) Is there a guide as well to modify the pinmux of a jetson nano pins (more than just the 40pins connector ones) for another carrierboard design?

EDIT: It does not even work for the other one either

Apparently, the python script tries to find

      # Header rows
    if not found_header:
        if 'Ball Name' not in row:
            if lnum > 25:
                print('ERROR: Header row not found', file=sys.stderr)
                sys.exit(1)
            continue

But it fails to do so for some reason

diff --git a/csv-to-board.py b/csv-to-board.py
index d82c9ac..4e0711d 100755
--- a/csv-to-board.py
+++ b/csv-to-board.py
@@ -232,6 +232,7 @@ with open(board_conf['filename'], newline='') as fh:
		# Header rows
		if not found_header:
			if 'Ball Name' not in row:
+                print('row %d was %s' % (lnum, row));
				if lnum > 25:
					print('ERROR: Header row not found', file=sys.stderr)
					sys.exit(1)



row 1 was [';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Color Code;;;;;;;;;SFIO']
row 2 was [';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Error;;;;;;;;;GPIO']
row 3 was ['Revision #;1', '01;1', '01;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Warning;;;;;;;;Boot Device;STRAP']
row 4 was [';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QSPI;UNUSED']
row 5 was [';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;']
row 6 was [';;;;Ball Locations;;;Pin Muxing;;;;;Allowed Pin Direction;;;;;Pin Groups;;;;;;General;;;POR;Boot Interface;;;Customer Configuration;;;;;;Error Check;;;;;;;;Filled in by Customers;;;;;;;;;;;Sample Usage']
row 7 was ['Jetson Nano Signal Name;"B01']
row 8 was ['SODIMM";40 Pin Header;Ball Name;DSC;MID;Unused;GPIO;SFIO0;SFIO1;SFIO2;SFIO3;GPIO;SFIO0;SFIO1;SFIO2;SFIO3;F0;F1;F2;F3;FS;Device Tree Pin Name;Power Rail;Wake;Strap;Pin State;Part of Boot Interface;Interface;Boot Config;Pin Group;SDMMC DAT/CMD;PUPD;Tristate;E_Input;GPIO Init Value;Customer Usage Checker;Initial State Checker;Pin Direction Checker;Wake Checker;Resistor Checker;3.3V Tolerance Enable Checker;Boot Pin Config Checker;Error Checker;Customer Usage;Pin Direction;Req. Initial State;Wake Pin;Lock;3.3V Tolerance Enable;Ext Pull Up Value (Ω);Ext Pull Down Value (Ω);Req. Deep Sleep State;IO Block Voltage;Customer Usage    Description or Net Names;']

Sigh, my version of excel uses ; as delimiter.

diff --git a/csv-to-board.py b/csv-to-board.py
index d82c9ac..ea5d3b6 100755
--- a/csv-to-board.py
+++ b/csv-to-board.py
@@ -224,7 +224,7 @@ found_header = False
pin_table = []
mipi_table = []
with open(board_conf['filename'], newline='') as fh:
-    csv = csv.reader(fh)
+    csv = csv.reader(fh, delimiter=';')
	lnum = 0
	for row in csv:
		lnum += 1

Note: I rebuilt and reflashed (LNX partition) u-boot with the procedure outlined. Cboot apparently just uses the DTB flashed already, so no modifs needed there it seems (other than to reflash the DTB)

Still, if fail to get my SPI to get pinmux correctly if I don’t specify the DTB option in extlinux as well. If the exact same DTB that was flashed using the ./flash.sh -k DTB command is explicitly reloaded by uboot from the rootfs as well, and then it works…

Indeed, checking /sys/kernel/debug/tegra_pinctrl_reg also shows this

Even though I will continue to override the DTB as this works now, out of curiousity, where was the pinmux supposed to be applied? In CBoot or uboot? (As they both need access to the pinmux somehow)

hello arnout.diels,

both cboot and uboot were applied pinmux settings,
the pinmux settings in device tree files are only applied by CBoot, and not reapplied by the Linux kernel.
the pinmux configuration programmed by the U-Boot bootloader is stored in one of the U-Boot header files

please also check Jetson Nano Boot Flow for details.
thanks