SPI quastion again. About configure kernel. please help me

Hi.

This time, I want to ask about how to and which file should be change for enable SPI on AGX.

Thanks to @ShaneCCC, I understand how to download L4T source and build it.

So I think my next step is set

  1. PINMUX
  2. configure kernel for SPI
  3. set device tree.

first, let 3rd step off…I want to ask about 1st and 2nd step.

1. PINMUX
State:
Change PINMUX is easy because NVIDIA provide ‘Jetson_AGX_Series_DevKit_Pinmux_Configuration_Template.xlsm’.
So I just make several clicks. and I can make changed PINMUX file.

Question:
After make changed pinmux file, where should I place this files? which folder.

2. configure kernel
State:
I show that I need to change configuration file to use SPI.
So, I follow the direction from ‘https://elinux.org/Jetson/TX2_SPI’.
(I know it can not directly applied to AGX board, but just for start point.)
This document suggest to edit the tegra18_defconfig file:
I think the file is in the path below in my case.

/home/jhai/L4T_Source/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/configs

Question:
Which file should I need to change and how to change?
Because there are several files which include about SPI.
I’ll list below.


file name : defconfig
CONFIG_SPI=y
CONFIG_SPI_MESON_SPIFC=m
CONFIG_SPI_ORION=y
CONFIG_SPI_PL022=y
CONFIG_SPI_QUP=y
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_S3C64XX=y

file name : tegra_android_defconfig
CONFIG_SPI=y
CONFIG_SPI_TEGRA114=y
CONFIG_SPI_TEGRA124_SLAVE=y
CONFIG_QSPI_TEGRA210=y
CONFIG_SPI_IM501=m
CONFIG_SPI_SPIDEV=m

file name : trgra_defconfig
CONFIG_SPI=y
CONFIG_SPI_CADENCE=m
CONFIG_SPI_PXA2XX=m
CONFIG_SPI_SC18IS602=m
CONFIG_SPI_TEGRA114=y
CONFIG_SPI_TEGRA124_SLAVE=y
CONFIG_QSPI_TEGRA210=y
CONFIG_SPI_XCOMM=m
CONFIG_SPI_ZYNQMP_GQSPI=m
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_TLE62X0=m

file name: tegra_gnu_linux_defconfig
CONFIG_SPI=y
CONFIG_SPI_TEGRA114=m
CONFIG_SPI_TEGRA124_SLAVE=y
CONFIG_QSPI_TEGRA210=m
CONFIG_SPI_SPIDEV=m
CONFIG_SPI_AURIX_TEGRA=y


Please give me the insight about this.

Thanks!

  1. Have a check this topic. Spidev read failed on xavier devkit
    Should be JetPack_4.3_Linux_P2888/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg

  2. The r32 release branch don’t need to modify the configure file. The default configure are enable the SPI already.

1 Like

Thanks @ShaneCCC.
Can you tell me what is difference between ‘tegra19x-mb1-pinmux-p2888-0000-a00-p2822-0000-a00.cfg’, ‘tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg’ and ‘tegra19x-mb1-pinmux-p2888-0000-p2822-0000.cfg’?

And also why should I change B01 instead of A00?
(If there is documents, it is also fine!)

It’s board id and version. You should be able to find which one from the flash log.

1 Like

OK! I’ll check it!

@ShaneCCC.
Hi. I have several question again.
I’ve try to replace ‘tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg’ to ’ tegra19x-jetson_agx_devkit-pinmux.dtsi’ from ’ [Jetson_AGX_Series_DevKit_Pinmux_Configuration_Template.xlsm] file.
(I only replace contents of the file.)

But When I open the ’ tegra19x-jetson_agx_devkit-pinmux.dtsi’ file, it looks quite different than original files.
I’m worried about it but I replaced its contents.

And I try to flash with ‘sudo ./flash.sh jetson-xavier mmcblk0p1’ command under </home/jhai/nvidia/nvidia_sdk/JetPack_4.4_DP_Linux_DP_JETSON_AGX_XAVIER/Linux_for_Tegra> folder.

After try to flash, I’ve got error shown in below.

============================================================
Error: Return value 2
Command tegrabct_v2 --chip 0x19 0 --mb1bct mb1_cold_boot_bct.cfg --sdram /home/jhai/nvidia/nvidia_sdk/JetPack_4.4_DP_Linux_DP_JETSON_AGX_XAVIER/Linux_for_Tegra/bootloader/3689/tmpZArIKM1.cfg --misc tegra194-mb1-bct-misc-l4t.cfg --scr tegra194-mb1-bct-scr-cbb-mini.cfg --pinmux tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg --pmc tegra19x-mb1-padvoltage-p2888-0000-a00-p2822-0000-a00.cfg --pmic tegra194-mb1-bct-pmic-p2888-0001-a04-E-0-p2822-0000.cfg --brcommand tegra194-mb1-bct-reset-p2888-0000-p2822-0000.cfg --prod tegra19x-mb1-prod-p2888-0000-p2822-0000.cfg --gpioint tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg --uphy tegra194-mb1-uphy-lane-p2888-0000-p2822-0000.cfg --device tegra19x-mb1-bct-device-sdmmc.cfg

============================================================================

  1. How can I apply file from <Pinmux_Configuration_Template.xlsm> to <pinmux-p2888-0000-a04-p2822-0000-b01.cfg>? just copy it is not working.

  2. And <Pinmux_Configuration_Template.xlsm> makes 3 files named GPIO-default, padvoltage-default, devkit-pinmux.
    is it right that I don’t need GPIO-default & padvoltage-default?(because I don’t change it?)

If you just modify few pins you can just override the pin in the /bootloader/t186/BCT/xxx.cfg

I’ve just change

SPI1_CLK : output, Master, Header40 23pin
SPI1_MISO: input, Master, Header40 21pin
SPI1_MOSI: output, Master, Header40 19pin
SPI1_CS0_N: output, Master, Header40 24pin
SPI1_CS1_N: output, Master, Header40 26pin

Above 5 pins.

And Auto generated file contain like this.
pinmux@2430000 {
pinctrl-names = “default”, “drive”, “unused”;
pinctrl-0 = <&pinmux_default>;
pinctrl-1 = <&drive_default>;
pinctrl-2 = <&pinmux_unused_lowpower>;

	pinmux_default: common {
		/* SFIO Pin Configuration */
		dap1_sclk_ps0 {
			nvidia,pins = "dap1_sclk_ps0";
			nvidia,function = "i2s1";
			nvidia,pull = <TEGRA_PIN_PULL_NONE>;
			nvidia,tristate = <TEGRA_PIN_DISABLE>;
			nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			nvidia,lpdr = <TEGRA_PIN_DISABLE>;
		};

but original file is looks like this
pinmux.0x02446000 = 0x00000000; # cpu_pwr_req_1_pb1: rsvd0, tristate-disable, input-disable, lpdr-disable
pinmux.0x02437008 = 0x00000170; # pex_wake_n_pl2: rsvd0, tristate-enable, input-enable, io_high_voltage-enable, lpdr-enable
pinmux.0x02440048 = 0x00000002; # dp_aux_ch3_hpd_pm3: rsvd2, tristate-disable, input-disable, io_high_voltage-disable
pinmux.0x02440000 = 0x00000000; # soc_gpio50_pm5: rsvd0, tristate-disable, input-disable, lpdr-disable

Is it sure that Just override the file is fine?
Because It didn’t work.

OMG…

Auto generated file format is .dtsi…

and original file format is .cfg.

how can I use(or convert or apply) dtsi to cfg?

I’m really sorry that I don’t know about this well…

Have a check below to modify the tegra19x-mb1-pinmux-p2888-0000-a0*-p2822-0000-xxx.cfg

What?..

it means that files from [Jetson_AGX_Series_DevKit_Pinmux_Configuration_Template.xlsm] is useless??

I have to modify .cfg file my manual?

If I’m right, can you tell me what is [Jetson_AGX_Series_DevKit_Pinmux_Configuration_Template.xlsm] file for?

OK.

I found <pinmux-dts2cfg.py> from </home/jhai/nvidia/nvidia_sdk/JetPack_4.4_DP_Linux_DP_JETSON_AGX_XAVIER/Linux_for_Tegra/kernel/pinmux/t19x>.

I’ve try make cfg file! now And i’ll report after try.

Thanks.

You can reference to below link to gen the dts.

Thanks.

Now, I can make cfg file and I success to flash with new PINMUX file.
[with command :
python pinmux-dts2cfg.py --pinmux addr_info.txt gpio_addr_info.txt por_val.txt --mandatory_pinmux_file mandatory_pinmux.txt tegra19x-jetson_agx_devkit-pinmux.dtsi tegra19x-jetson_agx_devkit-gpio-default.dtsi 1.0 > data.cfg ]

It is time to try set device tree for SPI1.

I will try it and ask again.

Always Thanks for kind and fast answer.