u-boot-2015.04 No MMC card found

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

u-boot-2015.04 No MMC card found

Jump to solution
1,625 Views
fulinux
Contributor IV


hi,this is my modified base on the branch imx_v2015.04_4.1.15_1.0.0_ga patch:

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c

index 1f2bab1..faa938b 100644

--- a/arch/arm/lib/board.c

+++ b/arch/arm/lib/board.c

@@ -578,7 +578,7 @@ void board_init_r(gd_t *id, ulong dest_addr)

#endif

#ifdef CONFIG_GENERIC_MMC

-       puts("MMC:   ");

+       puts("fulinux MMC:   ");

        mmc_initialize(gd->bd);

#endif

@@ -592,6 +592,7 @@ void board_init_r(gd_t *id, ulong dest_addr)

        dataflash_print_info();

#endif

+    printf ("fulinux xxxx\n");

        /* initialize environment */

        if (should_load_env())

                env_relocate();

diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c

index ee2b67b..8be2b10 100644

--- a/board/freescale/mx6sabresd/mx6sabresd.c

+++ b/board/freescale/mx6sabresd/mx6sabresd.c

@@ -58,9 +58,14 @@ DECLARE_GLOBAL_DATA_PTR;

        PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm |                 \

        PAD_CTL_SRE_FAST  | PAD_CTL_HYS)

+#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |     \

+        PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \

+        PAD_CTL_DSE_40ohm |    PAD_CTL_SRE_FAST  | PAD_CTL_HYS)

+#if 0

#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |                   \

        PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |                 \

        PAD_CTL_SRE_FAST  | PAD_CTL_HYS)

+#endif

#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                  \

        PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)

@@ -129,6 +134,19 @@ static void setup_iomux_enet(void)

        gpio_set_value(IMX_GPIO_NR(1, 25), 1);

}

+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_SD1_DAT0__SD1_DATA0     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_SD1_DAT1__SD1_DATA1     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_SD1_DAT2__SD1_DATA2     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_SD1_DAT3__SD1_DATA3     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_NANDF_D0__SD1_DATA4     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_NANDF_D1__SD1_DATA5     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_NANDF_D2__SD1_DATA6     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+       MX6_PAD_NANDF_D3__SD1_DATA7     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

+};

+

static iomux_v3_cfg_t const usdhc2_pads[] = {

        MX6_PAD_SD2_CLK__SD2_CLK        | MUX_PAD_CTRL(USDHC_PAD_CTRL),

        MX6_PAD_SD2_CMD__SD2_CMD        | MUX_PAD_CTRL(USDHC_PAD_CTRL),

@@ -140,7 +158,6 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {

        MX6_PAD_NANDF_D5__SD2_DATA5     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

        MX6_PAD_NANDF_D6__SD2_DATA6     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

        MX6_PAD_NANDF_D7__SD2_DATA7     | MUX_PAD_CTRL(USDHC_PAD_CTRL),

-       MX6_PAD_NANDF_D2__GPIO2_IO02    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */

};

static iomux_v3_cfg_t const usdhc3_pads[] = {

@@ -154,7 +171,6 @@ static iomux_v3_cfg_t const usdhc3_pads[] = {

        MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),

        MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),

        MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),

-       MX6_PAD_NANDF_D0__GPIO2_IO00    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */

};

static iomux_v3_cfg_t const usdhc4_pads[] = {

@@ -311,7 +327,8 @@ static void setup_iomux_uart(void)

}

#ifdef CONFIG_FSL_ESDHC

-struct fsl_esdhc_cfg usdhc_cfg[3] = {

+struct fsl_esdhc_cfg usdhc_cfg[4] = {

+       {USDHC1_BASE_ADDR},

        {USDHC2_BASE_ADDR},

        {USDHC3_BASE_ADDR},

        {USDHC4_BASE_ADDR},

@@ -346,14 +363,16 @@ int mmc_map_to_kernel_blk(int dev_no)

        return dev_no + 1;

}

-#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 2)

-#define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)

+//#define USDHC2_CD_GPIO       IMX_GPIO_NR(1, 4)

+//#define USDHC3_CD_GPIO       IMX_GPIO_NR(7, 0)

int board_mmc_getcd(struct mmc *mmc)

{

        struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;

        int ret = 0;

+    return -1;

+#if 0

        switch (cfg->esdhc_base) {

        case USDHC2_BASE_ADDR:

                ret = !gpio_get_value(USDHC2_CD_GPIO);

@@ -367,6 +386,7 @@ int board_mmc_getcd(struct mmc *mmc)

        }

        return ret;

+#endif

}

int board_mmc_init(bd_t *bis)

@@ -386,20 +406,23 @@ int board_mmc_init(bd_t *bis)

                switch :smileyinfo: {

                case 0:

                        imx_iomux_v3_setup_multiple_pads(

-                               usdhc2_pads, ARRAY_SIZE(usdhc2_pads));

-                       gpio_direction_input(USDHC2_CD_GPIO);

-                       usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);

+                               usdhc1_pads, ARRAY_SIZE(usdhc1_pads));

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

                        break;

                case 1:

                        imx_iomux_v3_setup_multiple_pads(

-                               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));

-                       gpio_direction_input(USDHC3_CD_GPIO);

-                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);

+                               usdhc2_pads, ARRAY_SIZE(usdhc2_pads));

+                       usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);

                        break;

                case 2:

                        imx_iomux_v3_setup_multiple_pads(

+                               usdhc3_pads, ARRAY_SIZE(usdhc3_pads));

+                       usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);

+                       break;

+               case 3:

+                       imx_iomux_v3_setup_multiple_pads(

                                usdhc4_pads, ARRAY_SIZE(usdhc4_pads));

-                       usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);

+                       usdhc_cfg[3].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);

                        break;

                default:

                        printf("Warning: you configured more USDHC controllers"

diff --git a/common/board_r.c b/common/board_r.c

index b1ad605..59d0feb 100644

--- a/common/board_r.c

+++ b/common/board_r.c

@@ -400,7 +400,7 @@ static int initr_onenand(void)

#ifdef CONFIG_GENERIC_MMC

static int initr_mmc(void)

{

-       puts("MMC:   ");

+       puts("fulinux 1 MMC:   ");

        mmc_initialize(gd->bd);

        return 0;

}

@@ -439,6 +439,7 @@ static int should_load_env(void)

static int initr_env(void)

{

+    printf ("fulinux initr_env()\n");

        /* initialize environment */

        if (should_load_env())

                env_relocate();

diff --git a/common/env_common.c b/common/env_common.c

index af59c72..91c347a 100644

--- a/common/env_common.c

+++ b/common/env_common.c

@@ -251,6 +251,7 @@ int env_export(env_t *env_out)

void env_relocate(void)

{

+    printf ("fulinux env_relocate()\n");

#if defined(CONFIG_NEEDS_MANUAL_RELOC)

        env_reloc();

        env_htab.change_ok += gd->reloc_off;

diff --git a/common/env_mmc.c b/common/env_mmc.c

index fb006bd..33f9068 100644

--- a/common/env_mmc.c

+++ b/common/env_mmc.c

@@ -98,7 +98,7 @@ static inline int mmc_set_env_part(struct mmc *mmc) {return 0; };

static int init_mmc_for_env(struct mmc *mmc)

{

        if (!mmc) {

-               puts("No MMC card found\n");

+               puts("fulinux No MMC card found\n");

                return -1;

        }

@@ -303,11 +303,13 @@ void env_relocate_spec(void)

        u32 offset;

        int ret;

        int dev = mmc_get_env_devno();

+    printf ("fulinux dev=%d\n", dev);

#ifdef CONFIG_SPL_BUILD

        dev = 0;

#endif

+    printf ("fulinux env_relocate_spec\n");

        mmc = find_mmc_device(dev);

        if (init_mmc_for_env(mmc)) {

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c

index 830d9ae..f387be2 100644

--- a/drivers/mmc/mmc.c

+++ b/drivers/mmc/mmc.c

@@ -182,7 +182,7 @@ struct mmc *find_mmc_device(int dev_num)

        }

#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)

-       printf("MMC Device %d not found\n", dev_num);

+       printf("fuliux MMC Device %d not found\n", dev_num);

#endif

        return NULL;

diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h

index 153799e..ab8fd50 100644

--- a/include/configs/mx6sabresd.h

+++ b/include/configs/mx6sabresd.h

@@ -12,7 +12,7 @@

#include <asm/arch/imx-regs.h>

#include <asm/imx-common/gpio.h>

-#undef DEBUG

+#define DEBUG

#ifdef CONFIG_SPL

#define CONFIG_SPL_LIBCOMMON_SUPPORT

@@ -31,7 +31,7 @@

#define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024)

#elif defined(CONFIG_MX6Q)

#define CONFIG_DEFAULT_FDT_FILE        "imx6q-sabresd.dtb"

-#define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024)

+#define PHYS_SDRAM_SIZE                (2u * 1024 * 1024 * 1024)

#elif defined(CONFIG_MX6DL)

#define CONFIG_DEFAULT_FDT_FILE        "imx6dl-sabresd.dtb"

#define PHYS_SDRAM_SIZE                (1u * 1024 * 1024 * 1024)

@@ -42,8 +42,8 @@

#include "mx6sabre_common.h"

-#define CONFIG_SYS_FSL_USDHC_NUM       3

-#define CONFIG_SYS_MMC_ENV_DEV         1       /* SDHC3 */

+#define CONFIG_SYS_FSL_USDHC_NUM       4

+#define CONFIG_SYS_MMC_ENV_DEV         2       /* SDHC2 */

#define CONFIG_SYS_MMC_ENV_PART                0       /* user partition */

#ifdef CONFIG_SYS_USE_SPINOR

this is log when it runs on board:

U-Boot 2015.04-14468-g19b5506-dirty (Apr 20 2016 - 02:23:42)

initcall: 17805f44

U-Boot code: 17800000 -> 17864494  BSS: -> 178B20B4

initcall: 17801928

CPU:   Freescale i.MX6Q rev1.5 at 792 MHz

uclass_find_device_by_seq: 0 -1

uclass_find_device_by_seq: 0 0

   - -1 -1

   - not found

CPU:   Temperature 36 C

Reset cause: POR

initcall: 178063f4

Board: MX6-SabreSD

initcall: 17805f88

I2C:   ready

initcall: 17805f70

DRAM:  initcall: 17803168

initcall: 17806160

Monitor len: 000B20B4

Ram size: F0000000

Ram top: 00000000

initcall: 17805d00

initcall: 17805eec

TLB table from ffff0000 to ffff4000

initcall: 17805d18

initcall: 17805ea0

Reserving 712k for U-Boot at: fff3d000

initcall: 17805e70

Reserving 16392k for malloc() at: fef3b000

initcall: 17806040

Reserving 80 Bytes for Board Info at: fef3afb0

initcall: 17805d20

initcall: 17805e3c

Reserving 248 Bytes for Global Data at: fef3aeb8

initcall: 17805dd8

initcall: 17805d34

initcall: 178061d0

initcall: 1780613c

initcall: 17806098

RAM Configuration:

Bank #0: 10000000 3.8 GiB

DRAM:  3.8 GiB

initcall: 17805dbc

New Stack Pointer is: fef3ae90

initcall: 17805d3c

initcall: 17805d6c

Relocation Offset is: e873d000

Relocating to fff3d000, new gd at fef3aeb8, sp at fef3ae90

initcall: fff4321c

initcall: fff433a8

initcall: 17806398 (relocated to fff43398)

dram_bank_mmu_setup: bank: 0

mmu_set_region_dcache_behaviour: start=0x00000000, size=1048575, option=30

mmu_set_region_dcache_behaviour: start=0x00000009, size=262144, option=30

initcall: 17806224 (relocated to fff43224)

initcall: 1780624c (relocated to fff4324c)

initcall: 1780635c (relocated to fff4335c)

Pre-reloc malloc() used 0xd4 bytes (0 KB)

using memory 0xfef3b000-0xfff3d000 for malloc()

initcall: 17806214 (relocated to fff43214)

initcall: 17806348 (relocated to fff43348)

uclass_find_device_by_seq: 0 -1

uclass_find_device_by_seq: 0 0

   - -1 -1

   - not found

Bound device imx_thermal to root_driver

initcall: 178035d4 (relocated to fff405d4)

initcall: 17819388 (relocated to fff56388)

initcall: 17806338 (relocated to fff43338)

initcall: 178062c0 (relocated to fff432c0)

Now running in RAM - U-Boot at: fff3d000

initcall: 17803650 (relocated to fff40650)

initcall: 17806318 (relocated to fff43318)

fulinux 1 MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2, FSL_SDHC: 3

initcall: 178062dc (relocated to fff432dc)

fulinux initr_env()

fulinux env_relocate()

fulinux dev=-1

fulinux env_relocate_spec

fuliux MMC Device -1 not found

fulinux No MMC card found

Using default environment

I enable "#define DEBUG"

my question is "No MMC card found",What is the reason for this problem,Do you need any other information。

The problem has been bothering me for a week, i need help.

thanks.

Labels (2)
0 Kudos
1 Solution
880 Views
igorpadykov
NXP Employee
NXP Employee

Hi Chen

seems you are adding SD1 support in uboot, it is enabled in :

../mx6qsabreauto/mx6qsabreauto.c

please recheck these codes.

Aslo please check signals with oscilloscope.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
881 Views
igorpadykov
NXP Employee
NXP Employee

Hi Chen

seems you are adding SD1 support in uboot, it is enabled in :

../mx6qsabreauto/mx6qsabreauto.c

please recheck these codes.

Aslo please check signals with oscilloscope.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
880 Views
fulinux
Contributor IV

Hi, it's ok,sd0(emmc) seems like no card detect, so it's wrong when get cd status.

0 Kudos