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.

Linux/am3357: MMC0 pinmux configuration

Part Number: AM3357


Tool/software: Linux

I have been looking at the device tree for both Uboot and Linux and I have been unable to find where the pinmux settings are for the SD card that is attached to mmc0. 

In am335x-evm.dts I found the following which tells me that the pinmux configs are under mmc1_pins:

&mmc1 {
	status = "okay";
	vmmc-supply = <&vmmc_reg>;
	bus-width = <4>;
	pinctrl-names = "default";
	pinctrl-0 = <&mmc1_pins>;
	cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
};

When I look up mmc1_pins in the pinmux section I see this:

mmc1_pins: pinmux_mmc1_pins {
	pinctrl-single,pins = <
		0x160 (PIN_INPUT | MUX_MODE7) /* spi0_cs1.gpio0_6 */
	>;
};

Should there not be entries for pins 0x0f0, 0x0f4, 0x0f8, 0x0fc, 0x100, 0x104 as well? I understand the meaning of the 0x160 line but I was expecting the definitions for Data0-2, CLK, CMD as well. I know the ROM boot loader will setup these pins when it looks for the SPL but isn't it prudent to keep these pins defined in the devicetree if you plan to use them?

For reference I was expecting to find something like this:

mmc1_pins: pinmux_mmc1_pins {
          pinctrl-single,pins = <
                    0x100 ( PIN_INPUT | MUX_MODE0 ) /* (G17) mmc0_clk.mmc0_clk */
                    0x104 ( PIN_INPUT | MUX_MODE0 ) /* (G18) mmc0_cmd.mmc0_cmd */
                    0xfc ( PIN_INPUT | MUX_MODE0 ) /* (G16) mmc0_dat0.mmc0_dat0 */
                    0xf8 ( PIN_INPUT | MUX_MODE0 ) /* (G15) mmc0_dat1.mmc0_dat1 */
                    0xf4 ( PIN_INPUT | MUX_MODE0 ) /* (F18) mmc0_dat2.mmc0_dat2 */
                    0xf0 ( PIN_INPUT | MUX_MODE0 ) /* (F17) mmc0_dat3.mmc0_dat3 */
                    0x160 ( PIN_INPUT | MUX_MODE7 ) /* (C15) spi0_cs1.mmc0_sdcd */
          >;
};

Thanks for any insight,

Tyler

 

EDIT


I went and decompiled the dtb that my beaglebone black is using (no uboot overlays enabled) and I found much the same for the mmc1:

pinmux_mmc1_pins {
	pinctrl-single,pins = <0x160 0x2f>;
	linux,phandle = <0x38>;
	phandle = <0x38>;
};

So I am convinced that there is no pinmux configs for the SD card bus and I believe this is because the rom bootloader is setting up the pinmux, but I am still left my original question of isn't it prudent to keep these pins defined in the devicetree if you plan to use them or is there a very good reason not to touch the pinmux registers for these pins once they are set by the rom bootloader?

Tyler

  • Hello Tyler,

    Pinmux configuration of mmc0 is done here <Processor SDK>/board-support/u-boot-<version>/board/ti/am335x/mux.c in U-Boot. Please, check this article too.

    Best regards,
    Kemal

  • Thank you Kemal for pointing me to that file.

    Do you know if the same thing happens during Linux boot and where the equivalent file is in the kernel source?

    Tyler
  • The equivalent file for pinmuxing in Linux is kernels's device tree, but it is not going to be done twice once it is done in U-Boot. This is explained why in that file, please read it.
  • I did read the article you linked but I do not think that it is applicable to my device, I think it applies to the AM57XX family and not the AM335X family.  I read though the TRM for AM335X and there was no mention about IO timings or isolation mode.

    That being, I did not know about the coded pinmux setup in mux.c, and that has cleared up the question of where those are being set. I still would like to know why they are not/can not be reconfigured again in the device tree?

    The board we are working on is using mmc1 to boot from an emmc device and I am looking to understand if I need to remove the pinmux reconfiguration from our device tree to mimic what I see for mmc0? Looking at the beaglebone distro, they too do not reconfigure mmc0 in the device tree but they do reconfigure mmc1 post uboot. I am trying to ensure we do not have a flaw in our device tree before we begin manufacturing.

    Thank you

    Tyler

  • mmc1 in device tree is really mmc0 physically. So do you want to boot from physical mmc1? That would be mmc2 in device tree.

    Steve K.
  • Hi Steve,

    I am speaking from TI's definition of mmc's so yes physical mmc1 is devicetree mmc2.

    What I was trying to convey is that physical mmc1 does have pinmux configurations in the device tree that would be applied during boot but mmc0 does not. Why should mmc0 not be touched after uboot performs the configuration, even though uboot sets up both mmc0 and mmc1?

    I feel like I am missing some part of the puzzle that could explain why mmc0 can not be touched after uboot. If its simply why do the same thing twice, I accept, but if the reason is the chip will halt and catch fire, I need to know that to ensure it does not happen.

    Thanks Again
    Tyler
  • Hi Tyler,
    Physical port mmc0 should have pinmux and a node in the device tree. A ticket has been opened to have it added in.

    Steve K.