boot linux kernel from usdhc2 at mx7d cpu

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

boot linux kernel from usdhc2 at mx7d cpu

1,675 Views
hideo_yamashiro
Contributor III

Hi.

We are porting linux to our board.

We need to boot linux kernel from usdhc2. Because the pins of usdhc1 are used for other purpose.

The u-boot boots form usdhc2. but u-boot can not find the sdcard connecting usdhc2 pins to load kernel image, device tree image.

We also modified device tree of u-boot like following.

We would like to how to change u-boot source code or/and other files.

-----------a part of device tree start ---------------------------------------------

&usdhc1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usdhc1>, <&pinctrl_usdhc1_gpio>;
        cd-gpios = <&gpio5 0 GPIO_ACTIVE_HIGH>;
        wp-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
        enable-sdio-wakeup;
        keep-power-in-suspend;
        status = "disabled";                                <-------------------------- change to disabled from okay.
};

  pinctrl_usdhc2_gpio: usdhc2_gpiogrp {
          fsl,pins = <    
             MX7D_PAD_SD2_CD_B__GPIO5_IO9            0x59 /* CD */
             MX7D_PAD_SD2_WP__GPIO5_IO10             0x59 /* WP */ 
          >;
    };

    pinctrl_usdhc2: usdhc2grp {
            fsl,pins = <
             MX7D_PAD_SD2_CMD__SD2_CMD                  0x53
             MX7D_PAD_SD2_CLK__SD2_CLK                  0x13
             MX7D_PAD_SD2_DATA0__SD2_DATA0              0x53
             MX7D_PAD_SD2_DATA1__SD2_DATA1              0x53
             MX7D_PAD_SD2_DATA2__SD2_DATA2              0x53
             MX7D_PAD_SD2_DATA3__SD2_DATA3              0x53
            >;
      };

&usdhc2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_usdhc2>, <&pinctrl_usdhc2_gpio>;
        cd-gpios = <&gpio5 9 GPIO_ACTIVE_HIGH>;
        wp-gpios = <&gpio5 10 GPIO_ACTIVE_LOW>;
        enable-sdio-wakeup;
        keep-power-in-suspend;
        status = "okay";
};

-----------a part of device tree end ---------------------------------------------

-----------console output start--------------------------------------------

U-Boot 2017.03 (Apr 01 2020 - 13:16:22 +0900)

DRAM:  1 GiB
MMC:   FSL_SDHC: 0
MMC Device 1 not found
*** Warning - No MMC card found, using default environment

Display: TFT43AB (480x272)
Video: 480x272x24
MMC Device 1 not found
no mmc device at slot 1
Net:   No ethernet found.
Normal Boot
Autoboot in 3 seconds

-----------console output end ---------------------------------------------

0 Kudos
2 Replies

1,589 Views
igorpadykov
NXP Employee
NXP Employee

Hi Hideo

usdhc2 example can be found in imx7d-12x12-lpddr3-arm2.dts :

imx7d-12x12-lpddr3-arm2.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Also please pay attention to "root" parameter in  Table 10. Common kernel boot parameters

attached Release Notes and sect.4.7.1 Running Linux OS from MMC/SD Linux Guide.

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

0 Kudos

1,589 Views
hideo_yamashiro
Contributor III

Dear igor.

Thank you for replying to my question.

I solved by myself.

1.disable iomuxc_lpsr , usdhc1 , usdhc3 in device tree;

2.enable usdhc2 in device tree like the following;

        reg_sd2_vmmc: regulator@7 {\
            compatible = "regulator-fixed";
            regulator-name = "VDD_SD2";
            regulator-min-microvolt = <3300000>;
            regulator-max-microvolt = <3300000>;
            gpio = <&gpio5 11 GPIO_ACTIVE_HIGH>;
            startup-delay-us = <200000>;
            off-on-delay = <20000>;
            enable-active-high;
        };
  &usdhc2 {
    pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_usdhc2>;
    cd-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
    wp-gpios = <&gpio5 10 GPIO_ACTIVE_HIGH>;
    wakeup-source;
    vmmc-supply = <&reg_sd2_vmmc>;
     enable-sdio-wakeup;
     keep-power-in-suspend;
    status = "okay";
  };

3.modify board_mmc_get_env_dev() in mx7sabresd.c

  int board_mmc_get_env_dev(int devno)
   {
    devno--;
     return devno;
 }

Best regards.

Hideo Yamashiro.

0 Kudos