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.

Questions about .dtsi file of am335x

Other Parts Discussed in Thread: AM3358

Hello All,

I'm trying to modify the Device Tree file at /arch/arm/boot/dts/xxx.dtsi. In the file there are part of code as below:

user_leds: pinmux_user_leds {

pinctrl-single, pins = <

0x38 ( PIN_OUTPUT | MUX_MODE7 )  /* (V13)  gpmc_ad14.gpio[14] */

......

0x108 ( PIN_OUTPUT | MUX_MODE7 )  /* (H16)  gmii1_col.gpio3[0] */

>;

};

My questions are:  what's the meaning of the number 0x38 and 0x108? How do they come?

Does 0x108 stand for GPIO3[0] or GPIO2[0]? Where can I find the document about them?

Thank you very much for your help in advance.

Best,

Lin

  • Finspoo said:

    pinctrl-single, pins = <

    0x38 ( PIN_OUTPUT | MUX_MODE7 )  /* (V13)  gpmc_ad14.gpio[14] */

    Let's take this one as a quick example...  For reference, please look at the TRM Table 9-10. CONTROL_MODULE REGISTERS.  Notice that offset 800h is register conf_gpmc_ad0.  That's the very first of all the pinmux-related registers, so that's what we're using as "zero" for the pinctrl offsets.  So above, 0x38 corresponds to offset 0x838 in the TRM.  You'll see from the table I mentioned that offset corresponds to conf_gpmc_ad14.

    There's a little bit more to it...  You'll also need the data manual.  Specifically, please look at Table 4-1. Pin Attributes.  So each pin of the device has multiple associated mux modes.  So for example if you find ball V13 (under the ZCZ column).  The "Pin Name" is "GPMC_AD14".  The pin name always corresponds to whatever function is used for mux mode 0.  And furthermore, this pin name is what's used for the name of the corresponding pinmux register.  So you can see from the data manual that mux mode 7 is gpio1_14.

    Finspoo said:
    0x108 ( PIN_OUTPUT | MUX_MODE7 )  /* (H16)  gmii1_col.gpio3[0] */

    So the quick decoding of this one... Offset 108h corresponds to offset 908h in the TRM which is conf_mii1_col.  And mux mode 7 is gpio3_0 as listed in the data manual.

  • PS. Make sure you're not editing am33xx.dtsi. That's intended to be maintained by the silicon vendor. Your board.dts file should include am33xx.dtsi and then you can over-ride anything you want to update, e.g. enabling peripherals, etc.
  • Hi Brad,

    Thank you very much for your detail and helpful info. Now it's much clear.

    Appreciated.

    Finspoo

  • Hi Brad,

    Thanks for your reminder.

    Here I have another question: after modified the .dtsi file, what kind of tools I need to compile the file and whole system?

    Expecting for your answer.

    Regards,

    Finspoo
  • Again, you should not be modifying the am33xx.dtsi file. You should be modifying a board level dts file, e.g. am335x-evm.dts is the one that corresponds to the TI EVM. If for example you modify am335x-evm.dts in the Processor SDK, then you can go to the root directory (two levels up from the linux directory) and run "make linux-dtbs" to rebuild the dtb output.
  • If you have not already visited this page, it should help:

    processors.wiki.ti.com/.../Processor_SDK_Linux_Getting_Started_Guide

    What I described above is an advanced usage of the top-level makefile mentioned in step 7. The dtb files are rebuilt as part of the full kernel rebuild "make linux" as well.
  • Sure, I will definitely not modify the am33xx.dtsi file (we have some other .dtsi files). All those .dtsi and .dts files are located at /arch/arm/boot/dts/ directory. Then at which directory I can run the "make linux-dtbs"?
  • I did read that Guide, but still hard to understand it.
  • You run "make linux-dtbs" from the SDK install directory. The very top directory of the entire SDK.
  • Hi Brad,

    Here I have specific questions for you.

    In our developing board there is a led pin connecting to pin T13 (GPMC_CSn3) of AM3358. By searching TRM Table 9-10 and DM Table 4-1, I found that T13 (GPMC_CSn3)'s offset is 888 and muxed to GPIO2-0. To make it working, in the ourOwn.dtsi file I have following part of code:

    / {
    ......

    /* the first part code */
    leds {
    pinctrl-names = "default";
    pinctrl-0 = <&user_leds>;
    compatible = "gpio-leds";

    led@0 {
    label = "ourBoard:green:usr0";
    gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
    linux, default-trigger = "heartbeat";
    default-state = "off";
    };
    ......
    }
    ......

    /* the second part code */
    user_leds: pinmux_user_leds {
    pinctrl-single, pins = <
    0x88 ( PIN_OUTPUT | MUX_MODE7 ) /* (T13) gpmc_csn3.gpio2[0] */

    ......
    >;
    };
    ......
    };

    My questions are: Is above setting enough to control the led by changing the /sys/class/leds/ourBoard:green:usr0/brightness?
    Can I only have the first part code without the second part of code to make it work? Or are both parts are necessary and needed to be matched each other (offset address and gpio#)?

    Hope I express it clearly.

    Thanks again for your help.

    Regards,
    Finspoo