This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

[FAQ] CCS/TDA4VM: TDA4: How do I determine the GPIO number within linux for a pin within the schematic?

Genius 15610 points

Replies: 1

Views: 28

Part Number: TDA4VM

Tool/software: Code Composer Studio

I have a bunch of pins that i want to configure as GPIO and use them in Linux.
How do i determine which Linux GPIO numbers corresponding to those pins in the schematic?

  • Data Sheet Link: 

    www.ti.com/.../tda4vm.pdf

    For the sake of demonstration let us take pins: GPMC0_AD10 GPMC0_AD11 GPMC0_AD12  &GPMC0_AD13.

    The GPIO numbers in Linux for a pin in schematic can be determined by following the below steps.

    1. Get the SoC GPIO Numbers by referring the above TDA4 Data Sheet. Search for GPMC0_AD10 in the data sheet.

    2. Page: 34
      We can observe that GPMC0_AD10 is multiplexed with GPIO0_71. So we have the SoC GPIO Number for GPMC0_AD10.

       Similarly we can check:

      GPMC0_AD11 It is muxed with GPIO0_72
      GPMC0_AD12 It is muxed with GPIO0_73
      GPMC0_AD13 It is muxed with GPIO0_80

    3. In Linux the GPIO bank numbers are not mapped. The SoC GPIO number is GPIO0_71 i.e 71st GPIO of Main GPIO Bank 0. In the SDK linux directory open the file arch/arm64/boot/dts/ti/k3-j721e-main.dtsi look for main_gpio0.
      The node name for main_gpio0 which is of our interest is gpio@600000. With this we have the MAIN_GPIO0 node string which is used for labeling the
      GPIO Banks while registering in Linux GPIO framework.


    4. Boot to Linux prompt & enter the command:
      /sys/class/gpio/gpiochip*/label

      Above command will give output like below:

      Note: The output may vary based on the GPIO nodes enabled in the device tree but this is to ascertain that we need to figure out which gpiochip corresponds to main_gpio0 with node name gpio@600000 --> 600000.gpio --> gpiochip336.


    5. Now we know that 336 maps to 0th GPIO of main_gpio0. 
      So gpio0_71 will map to 336 + 71 = 407 & hence i can form the table:
    Pin Name SoC GPIO name Linux GPIO number
    GPMC0_AD10  GPIO0_71 GPIO407
    GPMC0_AD11 GPIO0_72  GPIO408
    GPMC0_AD12  GPIO0_73 GPIO409
    GPMC0_AD13  GPIO0_80 GPIO416

     

     

     

     

     

     

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.