IMX6Q Android Custom Board not booting from SD1 pins

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

IMX6Q Android Custom Board not booting from SD1 pins

1,674 Views
kyle2
Contributor I

We have been developing code with an IMX6Quad-SabreSD evaluation board using the IMX_O8.0.0_1.0.0_ANDROID_SOURCE where the boot devices are SD2, SD3 and eMMC. We have produced a custom board which only has one boot device where the SD card pins are now routed from the SD1 pins of the IMX6Q processor, where we are trying to boot from unsuccessfully. 

We did not see any support for SD1 in uboot, so we have attempted to add it. We modified our code (see below) and now the output from the custom board is as follows when we try to boot it:

U-Boot 2017.03-dirty (Sep 04 2018 - 09:43:28 +0100)

CPU: Freescale i.MX6Q rev1.5 at 792MHz
CPU: Industrial temperature grade (-40C to 105C) at 20C
Reset cause: POR
Model: Freescale i.MX6 Quad SABRE Smart Device Board
Board: MX6-SabreSD
DRAM: 1 GiB
PMIC: PFUZE100! DEV_ID=0x10 REV_ID=0x21
MMC: FSL_SDHC: 0, FSL_SDHC: 1FSL_SDHC: 2
MMC Device -1 not found
*** Warning - No MMC card found, using default environment

No panel detected: default to Hannstar-XGA
Display: Hannstar-XGA (1024x768)
In: serial
Out: serial
Err: serial
flash target is MMC:255
MMC Device 255 not found
MMC Device 255 not found
** Block device MMC 255 not supported
Net:
Error: ethernet@02188000 address not set.
No ethernet found.
MMC Device -1 not found
Block device mmc -1 not supported
bcb_rw_block, get_block_size return 0
read_bootctl, bcb_rw_block read failed
read command failed
Fastboot: Normal
Hit any key to stop autoboot: 0
boota mmc-1
mmc_init: -110, time 1443
** Block device MMC 0 not supported
USB EHCI 1.00

When we stop autoboot - we issue the following commands:

Hit any key to stop autoboot: 0
=> mmc dev 0
mmc_init: -110, time 1451
=> mmc dev 1
MMC Device 1 not found
no mmc device at slot 1
=> mmc dev 2
MMC Device 2 not found
no mmc device at slot 2
=> mmc dev 3
MMC Device 3 not found
no mmc device at slot 3
=> mmc dev 0
mmc_init: -110, time 1448
=> mmc part
mmc_init: -110, time 1448
=> mmc list
FSL_SDHC: 0
=>

We know that the mmc_init has a timeout error with code -110 but we can't figure out why. We know it detects the card by listing it under MMC: FSL_SDHC: 0, but we just can't get past uboot.

We are using a 4-bit uSD card slot for this. The pins are connected as follows:

uSD_CMD      <->   SD1_CMD

uSD_SCK       <->   SD1_CLK

uSD_DATA0   <->   SD1_DAT0

uSD_DATA1   <->   SD1_DAT1

uSD_DATA2   <->   SD1_DAT2

uSD_DATA3   <->   SD1_DAT3

~uSD_CD       <->   GPIO1_1

The source code where we based this build from is the IMX_O8.0.0_1.0.0_ANDROID_SOURCE. We have been editing the following files - where we have added/changed the following lines (highlighted in RED):

android_build/vendor/nxp-opensource/uboot-imx/board/freescale/mx6sabresd/mx6sabresd.c

static iomux_v3_cfg_t const usdhc1_pads[] = {
    MX6_PAD_SD1_CLK__SD1_CLK    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_SD1_CMD__SD1_CMD    | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
    MX6_PAD_GPIO_1__GPIO1_IO01  | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
};
#ifdef CONFIG_FSL_ESDHC
struct fsl_esdhc_cfg usdhc_cfg[4] = {
    {USDHC1_BASE_ADDR},
    {USDHC2_BASE_ADDR},
    {USDHC3_BASE_ADDR},
    {USDHC4_BASE_ADDR},
};

#define USDHC1_CD_GPIO  IMX_GPIO_NR(1, 1)
#define USDHC2_CD_GPIO  IMX_GPIO_NR(2, 2)
#define USDHC3_CD_GPIO  IMX_GPIO_NR(2, 0)

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

int mmc_map_to_kernel_blk(int devno)
{
    return devno + 1;
}

int board_mmc_getcd(struct mmc *mmc)
{
    struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
    int ret = 0;

    
    switch (cfg->esdhc_base) {
    case USDHC1_BASE_ADDR:
        ret = !gpio_get_value(USDHC1_CD_GPIO);
        break;
    case USDHC2_BASE_ADDR:
        ret = !gpio_get_value(USDHC2_CD_GPIO);
        break;
    case USDHC3_BASE_ADDR:
        ret = !gpio_get_value(USDHC3_CD_GPIO);
        break;
    case USDHC4_BASE_ADDR:
        ret = 1; /* eMMC/uSDHC4 is always present */
        break;
    }

    return ret;
}

int board_mmc_init(bd_t *bis)
{
    int ret;
    imx_iomux_v3_setup_multiple_pads(
        usdhc1_pads, ARRAY_SIZE(usdhc1_pads));
    gpio_request(USDHC1_CD_GPIO, "USDHC1 CD");
    gpio_direction_input(USDHC1_CD_GPIO);
    usdhc_cfg[0].esdhc_base = USDHC1_BASE_ADDR;

    usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);

    ret = fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
    if (ret)
        return ret;

    return 0;           
}
#endif

android_build/vendor/nxp-opensource/uboot-imx/include/configs/mx6sabresd.h

#define CONFIG_MMCROOT          "/dev/mmcblk0p2" /* SDHC1 */

#define CONFIG_SYS_FSL_USDHC_NUM    1
#define CONFIG_SYS_MMC_ENV_DEV      0   /* SDHC1 */
#ifndef CONFIG_SYS_MMC_ENV_PART
#define CONFIG_SYS_MMC_ENV_PART 0 /* user partition */
#endif

android_build/vendor/nxp-opensource/uboot-imx/include/configs/mx6sabre_common.h

/* MMC Configs */
#define CONFIG_SYS_FSL_ESDHC_ADDR 0

android_build/vendor/nxp-opensource/uboot-imx/arch/arm/dts/imx6qdl-sabresd.dtsi

pinctrl_usdhc1: usdhc1grp {
fsl,pins = <
MX6QDL_PAD_SD1_CMD__SD1_CMD 0x17059
MX6QDL_PAD_SD1_CLK__SD1_CLK 0x10059
MX6QDL_PAD_SD1_DAT0__SD1_DATA0 0x17059
MX6QDL_PAD_SD1_DAT1__SD1_DATA1 0x17059
MX6QDL_PAD_SD1_DAT2__SD1_DATA2 0x17059
MX6QDL_PAD_SD1_DAT3__SD1_DATA3 0x17059
>;
};

&usdhc1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_usdhc1>;
bus-width = <4>;
cd-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
no-1-8-v;
keep-power-in-suspend;
enable-sdio-wakeup;
status = "okay";
};

We think we have changed the appropriate files but we are still stuck in the same position as we have been for the past week.

Any help from would be greatly appreciated.

0 Kudos
2 Replies

1,120 Views
igorpadykov
NXP Employee
NXP Employee

Hi Kyle

one can check if sion bit is set for sd pads, described in

sect.36.4.208 Pad Mux Register (IOMUXC_SW_MUX_CTL_PAD_SD1_CLK)

i.MX6DQ Reference Manual

http://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf

and look on sd signals with oscilloscope. Another test may be performed with

baremetal sdk found on SMP Enable in IMX6 

For image programming recommended to use mfg tool

i.MX 6/7D Series Manufacturing Toolkit for Android O8.0.0_1.0.0 Release

https://www.nxp.com/webapp/Download?colCode=IMX_O8.0.0_1.0.0_TOOL&appType=license&location=null&Pare... 

Use mfgtool2-android-mx6q-sabresd-sd.vbs, change appropriately "mmc" parameter. Just for test

one can try mfgtool2-yocto-mx-sabresd-sdcard-sd1.vbs,  used for linux programming.


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

0 Kudos

1,039 Views
bastien
Contributor I

Hello!

Does this topic is resolved ?

I need to know if booting linux from SD card 1 (SD1) is possible.

Is it required to connect the write protect pin on the imx6 (sush as sd3 in sabre sd) ?

Thank you

 

 

 

0 Kudos