iMX6UL - device tree settings for SD1 VSELECT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX6UL - device tree settings for SD1 VSELECT

3,131 Views
nickbedbury
Contributor III

I would like to enable the VSELECT feature for SD1 on a custom iMX6UL platform.  I have the interface working at 3.3V with the "no-1.8-v;" option in the device tree.  However, if I remove that (enabling voltage negotiation), the card does not enumerate.

The following errors are printed to the Linux console when the SD card is inserted:

mmc0: host does not support reading read-only switch, assuming write-enable     
sdhci: Tuning procedure failed, falling back to fixed sampling clock            
mmc0: tuning execution failed: -5                                               
mmc0: error -5 whilst initialising SD card 

I'm not sure if I have the device tree correct.  I'm trying to let a GPIO regulator drive a pin to the PMIC for VSELECT.  The relevant portion of our device tree looks like this:

&usdhc1 {
    pinctrl-names = "default", "state_100mhz", "state_200mhz";
    pinctrl-0 = <&pinctrl_usdhc1>;
    pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
    pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
    broken-cd;
    no-1-8-v;
    keep-power-in-suspend;
    enable-sdio-wakeup;
    vmmc-supply = <&reg_sd1_vmmc>;
    status = "okay";
};

    regulators {
        compatible = "simple-bus";
        #address-cells = <1>;
        #size-cells = <0>;

        reg_sd1_vmmc: sd1_regulator {
                        compatible = "regulator-gpio";
                        pinctrl-names = "default";
                        pinctrl-0 = <&pinctrl_sd1>;
                        regulator-name = "gpio_sd1";
                        regulator-type ="voltage";
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio4 28 GPIO_ACTIVE_HIGH>; // What does ACTIVE_HIGH vs ACTIVE_LOW mean here?
                        states = <1800000 0x0 3300000 0x1>;
                };

    };

    pinctrl_sd1: sd1grp {
        fsl,pins = <
            MX6UL_PAD_CSI_DATA07__GPIO4_IO28 0x8B0
/*            MX6UL_PAD_CSI_DATA07__USDHC1_VSELECT 0x8B0*/  // Which should this be?  This or the above?
        >;
    };

Any recommendations on my device tree?  Per my last comment above, I wasn't sure if the peripheral's VSELECT or a GPIO should be mapped to the pin.

Labels (2)
0 Kudos
3 Replies

2,342 Views
nickbedbury
Contributor III

I'm back to having a working SD card.  This was what I ended up with in the device tree:

&usdhc1 {
    pinctrl-names = "default", "state_100mhz", "state_200mhz";
    pinctrl-0 = <&pinctrl_usdhc1>;
    pinctrl-1 = <&pinctrl_usdhc1_100mhz>;
    pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
    cd-gpios = <&gpio4 26 GPIO_ACTIVE_HIGH>;
    vmmc-supply = <&reg_sd1_vmmc>;
    status = "okay";
};

 

    regulators {
        compatible = "simple-bus";
        #address-cells = <1>;
        #size-cells = <0>;

 

        reg_sd1_vmmc: sd1_regulator {
                        compatible = "regulator-gpio";
                        pinctrl-names = "default";
                        pinctrl-0 = <&pinctrl_sd1>;
                        regulator-name = "gpio_sd1";
                        regulator-type ="voltage";
                        regulator-min-microvolt = <1800000>;
                        regulator-max-microvolt = <3300000>;
                        gpio = <&gpio4 28 0>; // I don't think the USDHC peripheral/driver pays attention to this default state.
                        states = <3300000 0x0 1800000 0x1>; // Changed from original.  I don't think this matters really either.
                };

    };

 

    pinctrl_sd1: sd1grp {
        fsl,pins = <
            MX6UL_PAD_CSI_DATA07__USDHC1_VSELECT 0xB0  // Let USDHC peripheral control pin.  Note drive strength and other settings (custom for our setup)
        >;
    };

When I use a SanDisk SDHC UHS-I A1 card, the iMX6UL tries to check for 1.8V support, but ends up running at 3.3V from what I can tell.

0 Kudos

2,342 Views
igorpadykov
NXP Employee
NXP Employee

you can use i.MX6UL EVK schematic as reference for designing custom board,

where it is working fine.

Best regards
igor

0 Kudos

2,342 Views
igorpadykov
NXP Employee
NXP Employee

Hi Nick

for VSELECT usage one can look on linux/arch/arm/boot/dts/imx6ul-14x14-evk.dts

imx6ul-14x14-evk.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

            fsl,pins = <
                MX6UL_PAD_UART1_RTS_B__GPIO1_IO19    0x17059 /* SD1 CD */
                MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT    0x17059 /* SD1 VSELECT */

It is used for U707 regulator on i.MX6UL EVK schematic SCH-28617

Schematics (1)
MCIMX6UL-EVK_DESIGNFILES
Design files, including hardware schematics, Gerbers, and OrCAD files. (REV 0)
http://www.nxp.com/products/sensors/gyroscopes/i.mx6ultralite-evaluation-kit:MCIMX6UL-EVK?fpsp=1&tab...

Gpio regulator device tree is described in linux/Documentation/devicetree/bindings/regulator/gpio-regulator.txt

USDHC1_VSELECT is controlled in driver by uSDHCx_VEND_SPEC register described in sect.56.8.26

i.MX6UL Reference Manual.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos