MDIO and MDC as GPIO in Jetson orion AGX dev Kit

Hi I configured MDIO and MDC lines as GPIO below are the changes

ATH: /home/user/Linux_for_Tegra/bootloader
Files:

tegra234-mb1-bct-gpio-p3701-0000-a04.dtsi
tegra234-mb1-bct-gpio-p3701-0000.dtsi

gpio@2200000

gpio-output-low 


				TEGRA234_MAIN_GPIO(N, 3)
			TEGRA234_MAIN_GPIO(M, 5)      
			TEGRA234_MAIN_GPIO(M, 6)  
			TEGRA234_MAIN_GPIO(H, 1)

PATH : /home/user/Linux_for_Tegra/bootloader/generic/BCT

Files : tegra234-mb1-bct-pinmux-p3701-0000.dtsi
tegra234-mb1-bct-pinmux-p3701-0000-a04.dtsi

		soc_gpio36_pm5 {
                            nvidia,pins = "soc_gpio36_pm5";
                            nvidia,function = "gp";
                            nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                            nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
                            nvidia,lpdr = <TEGRA_PIN_ENABLE>;
                    };

                    soc_gpio53_pm6 {
                            nvidia,pins = "soc_gpio53_pm6";
                            nvidia,function = "gp";
                            nvidia,pull = <TEGRA_PIN_PULL_NONE>;
                            nvidia,tristate = <TEGRA_PIN_DISABLE>;
                            nvidia,enable-input = <TEGRA_PIN_DISABLE>;
                            nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
                            nvidia,lpdr = <TEGRA_PIN_ENABLE>;
                    };

MDIO MDC:

PATH: /home/user/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay
File : tegra234-p3737-camera-modules.dtsi

bus@0 {
/* set camera gpio direction to output */
gpio@2200000 {

                                    mdio_gpio {
                                    //        gpio-hog;
                                            gpios = <TEGRA234_MAIN_GPIO(M, 5) 0>;
                                            output-low;
                                            line-name = "mdio_gpio";
                                    };

                                    mdc_gpio {
                                    //        gpio-hog;
                                            gpios = <TEGRA234_MAIN_GPIO(M, 6) 0>;
                                            output-low;
                                            line-name = "mdc_gpio";
                                    };


                            };

<===================================================================================================================>

Im using sudo gpioset gpiochio0 81=1 to make it high and 81 = 0 make it low but when i check the voltage it is always measure ~0.5V.

Is there any way to toggel gpio?

*** Please note that this reply is generated by LLM automatically ***

Based on the provided context, it appears that you are trying to configure the MDIO and MDC lines as GPIOs on the Jetson AGX Orin module. You have made changes to the device tree files and pinmux files to achieve this.

However, when you try to toggle the GPIO using the gpioset command, you are not seeing the expected voltage changes on the pin. Specifically, you are always measuring 0.5V on the pin, regardless of whether you set the GPIO high or low.

There are a few possible reasons for this issue:

  1. GPIO direction: Make sure that the GPIO direction is set correctly. In your device tree file, you have set the GPIO direction to output using the gpio2200000 node. However, you may need to verify that this change is being applied correctly.
  2. GPIO value: Double-check that the GPIO value is being set correctly using the gpioset command. You can use the gpioget command to read the current value of the GPIO pin and verify that it is being set correctly.
  3. Pinmux configuration: Verify that the pinmux configuration is correct. You have made changes to the tegra234mb1bctpinmuxp37010000dtsi and tegra234mb1bctpinmuxp37010000a04dtsi files, but you may need to verify that these changes are being applied correctly.
  4. GPIO driver: Make sure that the GPIO driver is loaded and functioning correctly. You can check the kernel logs to see if there are any errors related to the GPIO driver.
  5. Hardware issue: It’s possible that there is a hardware issue with the Jetson AGX Orin module or the carrier board. You may need to verify that the pin is not shorted to ground or that there is not a problem with the pin’s voltage regulator.

To troubleshoot this issue, you can try the following:

  1. Use the gpioget command to read the current value of the GPIO pin and verify that it is being set correctly.
  2. Use a logic analyzer or oscilloscope to verify that the GPIO pin is being toggled correctly.
  3. Check the kernel logs for any errors related to the GPIO driver.
  4. Verify that the pinmux configuration is correct and that the GPIO direction is set correctly.
  5. If you are still having issues, try using a different GPIO pin to see if the problem is specific to the MDIO and MDC lines.

In terms of comparing the GPIO configuration on the Jetson AGX Orin module to other modules, the GPIO configuration is generally similar across different Jetson modules. However, there may be some differences in the device tree files and pinmux files that need to be taken into account.

For example, on the Jetson TX2 module, the GPIO configuration is similar to the Jetson AGX Orin module, but there are some differences in the device tree files and pinmux files. On the Jetson TX2 module, the GPIO driver is loaded using the tegra-gpio driver, and the GPIO pins are configured using the tegra-gpio device tree node.

In contrast, on the Jetson AGX Orin module, the GPIO driver is loaded using the gpio-tegra driver, and the GPIO pins are configured using the gpio2200000 device tree node. Therefore, when comparing the GPIO configuration on different Jetson modules, it’s essential to take into account the specific device tree files and pinmux files used on each module.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

Hi divith.h,

What’s the Jetpack version in use?

Could you configure them through pinmux spreadsheet instead?

Could you try running the following command instead to control?

# gpioset --mode=wait `gpiofind "PM.05"`=1
# gpioset --mode=wait `gpiofind "PM.05"`=0

Hey Kevin,

Thansk for your replay. Please find the comments below

  1. We have Jetpack version 6

  2. yes we used pinmux spreadsheet for gpio configuration. attched image for your reference

    image (1)

    image (2)

  3. when i tried running

Could you run sudo su before run the commands I shared?

$ sudo su
# gpioset --mode=wait `gpiofind "PM.05"`=1
# gpioset --mode=wait `gpiofind "PM.05"`=0

Yes we did that also. Same we tried able to set but for reading the status we cant use gpioget so we tried with devmem but cant see the changes.

The process of converting MDIO and MDC lines are correct??

Is there any possibility that, can i get the actual devme address ??

currently PM05 and PM06 lies under gpiochip0 line 81 and 82. and base address is @2200000

  1. Global GPIO number for PM.05 is 429

  2. Bank = 429 / 32 = 13

  3. Bit offset = 429 % 32 = 13

  4. GPIO Output Register = 0x2200000 + (13 * 0x1000) + 0x04 = 0x2211004

used above calc to read the status, but not succeed.

Please also apply the patch from the following thread to check if it could help.
40hdr - SPI1 gpio padctl register bit[10] effect by gpiod tools in JP6 - #20 by KevinFFF

You can refer to the following thread to get their address and control them with DRA.
Calculating/Getting register adresses of gpio pins - #10 by KevinFFF

Hi I tried applying the above patches .. still im not able to set pin high or low.

I just need below address are correct to validate PM.05 and PM06

Function PM5 Address PM6 Address
Direction (OE) 0x022124c0 0x022124d0*
Input Value 0x022124c8 0x022124d8
Output Value 0x022124d0 0x022124e0

As i tried with above address .. It is working.. Can you confirm the same..

It is the address for PP.06..

PM.05: GPIO_M_ENABLE_CONFIG_05_0 => 0x022120a0
PM.06: GPIO_M_ENABLE_CONFIG_06_0 => 0x022120c0

What do you mean about “working” here?

I mean.. with these address I’m able to toggle. Please confirm are these device address are correct ??

I’ve replied to the previous response with correct device address for both PM.05 and PM.06 .

When you toggle 0x022124d0, when do you get from the pin state of PM.05 or PM.06?
Do you get a scope or LA to confirm if the pin state has been reflected?

I dont have that provision currently to probe it as I’m using devkit. We have a custom board to probe it. I need to verify that. But my question is are those address are correct for PM.05 and PM.06?

The correct address for PM.05 and PM.06 have been mentioned here.

is it possible to share Output enable register value and How to make it high and Low

PM.05 :
GPIO_M_OUTPUT_CONTROL_05_0 => 0x022120ac
GPIO_M_ENABLE_CONFIG_05_0 => 0x022120a0
GPIO_M_OUTPUT_VALUE_05_0 => 0x022120b0

PM.06 :
GPIO_M_OUTPUT_CONTROL_06_0 => 0x022120cc
GPIO_M_ENABLE_CONFIG_06_0 => 0x022120c0
GPIO_M_OUTPUT_VALUE_06_0 => 0x022120d0

Please refer to the following steps to control it. (e.g. PM.05)

// configure OUTPUT_CONTROL as DRIVEN
$ sudo busybox devmem 0x022120ac w 0x0

// configure ENABLE_CONFIG as ENABLE/OUT
$ sudo busybox devmem 0x022120a0 w 0x3

// control PM.05 to High/Low
$ sudo busybox devmem 0x022120b0 w 0x1
$ sudo busybox devmem 0x022120b0 w 0x0

Thank You Kevin,

Today I will validate on the custom board and give you update.

Is this still an issue to support? Any result can be shared?

Hi Kevin.

Verified but it is not toggling .. I mean if we set 1 it should give high voltage but it always give 0.5V

Do you mean it will only output 0.5V when you control it HIGH?
If so, how about its output if you control it LOW? Will it become 0V?
Is the same behavior for both PM.05 and PM.06?

Please also share the result of the following command for further check.

//PADCTL_EDP_SOC_GPIO36_0
$ sudo busybox devmem 0x02440000

//PADCTL_EDP_SOC_GPIO53_0
$ sudo busybox devmem 0x02440008

In addition, I would suggest you removing mdio_gpio and mdc_gpio nodes from device tree before using the register to control GPIO.