cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
512 Views
Registered: ‎07-06-2016

MMC: 0 busy timeout - create the patch against petalinux 2018.3

Hello,

I'm having similar issue as in this post: https://forums.xilinx.com/t5/Embedded-Linux/sdhci-send-command-MMC-1-busy-timeout-increasing-to-400-ms/m-p/1010277#M35986

I'm booting petalinux from sd1 card but at the start it checks for mmc 0 and wastes quite a lot of time (~15s):

MMC:   sdhci_send_command: MMC: 0 busy timeout increasing to: 200 ms.
sdhci_send_command: MMC: 0 busy timeout increasing to: 400 ms.
sdhci_send_command: MMC: 0 busy timeout increasing to: 800 ms.
sdhci_send_command: MMC: 0 busy timeout increasing to: 1600 ms.
sdhci_send_command: MMC: 0 busy timeout increasing to: 3200 ms.
sdhci_send_command: MMC: 0 busy timeout.
sdhci_send_command: MMC: 0 busy timeout.
mmc_init: -70, time 7439
mmc@ff160000 - probe failed: -70
sdhci_send_command: MMC: 0 busy timeout.
sdhci_send_command: MMC: 0 busy timeout.
mmc_init: -70, time 7413

I'd like to skip this and it looks that applying the patch could fix this issue. 

How can I create the provided patch (link above) against petalinux 2018.3?

Thanks in advance.

0 Kudos
7 Replies
Highlighted
489 Views
Registered: ‎02-24-2020

First create a patch, there are a couple of ways to do this, but probably the easiest is using git:

1. Clone Xilinx U-boot repo:

git clone https://github.com/Xilinx/u-boot-xlnx.git

2. Make a patch from the commit sha in question

cd u-boot-xlnx
git format-patch -1 2f9a216c72d3d8621e2501d2bee2b0406d8dabc0

This should have generated a patch file "0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch" for you in the u-boot directory.

3. Next we're going to check that it applies cleanly before trying to use it in PetaLinux. So we'll checkout your version of U-Boot for PetaLinux and then try to apply the patch:

git checkout xilinx-v2018.3
git am 0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch

It does apply cleanly FYI, this doesn't guarantee it works or compiles, you'll need to test this.

 

Second part is to add this to PetaLinux so it's applied during the normal build:

1. Put the patch file in this directory (create if it doesn't exist):

project-spec/meta-user/recipes-bsp/u-boot/files/

2. Edit the u-boot append file (or create if it doesn't exist) to include your patch:

# project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
# If there's already SRC_URI here then you need to add this to the list of other items SRC_URI += "file://0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch"

That's it. Please give a kudos and mark as solution if this solves your issue.

 

 

Ken Sloat - Embedded Software Engineer
https://www.designlinxhs.com
Highlighted
Voyager
Voyager
445 Views
Registered: ‎07-06-2016

Hi @ksloatdesignlinx ,

Thanks for your answer, really useful steps to create the patch.

Sorry I'm quite new with creating patches and I'm trying to understand the whole picture, could you please explain exactly what to do in step 3 to test the patch?:

...................

3. Next we're going to check that it applies cleanly before trying to use it in PetaLinux. So we'll checkout your version of U-Boot for PetaLinux and then try to apply the patch:

What do I need to do here....open the file? go to the directory...?:

project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend

 

In which folder should I do it? same where I created the patch (u-boot-xlnx)?:

git checkout xilinx-v2018.3
git am 0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch

It does apply cleanly FYI, this doesn't guarantee it works or compiles, you'll need to test this.

Running the above commands I've got:

 

..../u-boot-xlnx$ git checkout xilinx-v2018.3
HEAD is now at d8fc4b3... fs: Fix issue with finding files in FAT32 partition

.../u-boot-xlnx$ git am 0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch
Applying: mmc: sdhci: Read sdhci card detect properties from DT

...........................

 

Anyway I've also tried to apply the patch to the project and build following steps 1 and 2 but I've got next error:

| /home/user/projectest/build/tmp/work/plnx_zynqmp-xilinx-linux/u-boot-xlnx/v2018.01-xilinx-v2018.3+gitAUTOINC+d8fc4b3b70-r0/git/include/configs/platform-top.h:85:75: warning: backslash and newline separated by space
| "default_bootcmd=run uenvboot; run cp_kernel2ram && bootm ${netstart}\0" \
|
| aarch64-xilinx-linux-ld.bfd -r -o common/built-in.o common/init/built-in.o common/main.o common/exports.o common/hash.o common/cli_hush.o common/autoboot.o common/board_f.o common/board_r.o common/board_info.o common/bootm.o common/bootm_os.o common/fdt_support.o common/miiphyutil.o common/usb.o common/usb_hub.o common/usb_storage.o common/splash.o common/menu.o common/cli_readline.o common/cli_simple.o common/console.o common/dlmalloc.o common/malloc_simple.o common/image.o common/image-android.o common/image-fdt.o common/image-fit.o common/memsize.o common/stdio.o common/image-sparse.o common/fb_mmc.o common/cli.o common/dfu.o common/command.o common/s_record.o common/xyzModem.o

| make[1]: Leaving directory '/home/user/projectest/build/tmp/work/plnx_zynqmp-xilinx-linux/u-boot-xlnx/v2018.01-xilinx-v2018.3+gitAUTOINC+d8fc4b3b70-r0/build' | make: *** [Makefile:150: sub-make] Error 2 | make: Leaving directory '/home/user/projectest/build/tmp/work/plnx_zynqmp-xilinx-linux/u-boot-xlnx/v2018.01-xilinx-v2018.3+gitAUTOINC+d8fc4b3b70-r0/git' | ERROR: oe_runmake failed

My u-boot append file looks like this:

 

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://platform-top.h \
            file://user_2019-02-15-12-33-00.cfg \
            file://user_2020-07-20-08-18-00.cfg \
	    file://0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch "

 

Also tried:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://platform-top.h \
            file://user_2019-02-15-12-33-00.cfg \
            file://user_2020-07-20-08-18-00.cfg \
            "
SRC_URI_append += " file://0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch"

But unfortunately with same results....

Any ideas? 

Thanks

 

0 Kudos
Highlighted
422 Views
Registered: ‎02-24-2020

Hi @joseer 

Sorry that first line for the append file was a copy paste error when I was formatting my reply. I edited and removed. What you did with the step to check the patch is good, you are simply just applying the patch to that branch to make sure the patch is valid. If you did git log following that you would see the message and change for the patch you applied.

As far as the build error, can you post the full log? Whenever there is an error message Bitbake/Petalinux should actually give you the location of the full log file it generates.

Ken Sloat - Embedded Software Engineer
https://www.designlinxhs.com
0 Kudos
Highlighted
Voyager
Voyager
411 Views
Registered: ‎07-06-2016

Hi @ksloatdesignlinx ,

Thanks for your reply and help,

Yes, it looks like the patch is compatible so I don't understand why I'm having the error....

Please find attached the full log.

0 Kudos
Highlighted
396 Views
Registered: ‎02-24-2020

Hi @joseer 

So the log message is a bit cryptic, but based on what it's saying it points to the fact that something is probably messed up with a #define. If a #define of certain type doesn't exist, you will often see messages related to other associated #defines like we are.

Looking at the code itself, and grepping the source, I see for sure one #define that is used in the patch that does not exist in the U-Boot version released with PetaLinux 2018.3 - MMC_CAP_CD_ACTIVE_HIGH.

This means your patch is relying on at least one additional change or functionality present in the newer U-Boot that are not present here. So you will need to figure out how to adjust the change to really achieve what you need it to do. If you remember I mentioned that just because the patch applies cleanly doesn't mean it will actually work for what you want it to do. You will obviously need to understand what that patch was really doing in the newer version of U-Boot to figure out how to modify it to apply in 2018.3.

So you could:

1. Generate and apply the patch to the 2018.3 branch like before

 

git clone https://github.com/Xilinx/u-boot-xlnx.git
cd u-boot-xlnx
git format-patch -1 2f9a216c72d3d8621e2501d2bee2b0406d8dabc0
git checkout xilinx-v2018.3
git am 0001-mmc-sdhci-Read-sdhci-card-detect-properties-from-DT.patch

2. Next back out the commit the patch applied leaving the changes around so you can edit them

git reset HEAD~1

3. Then you can edit the source in the tree to make whatever additional changes are needed to make this compatible with 2018.3.

4. Then make a commit

git add -A
git commit -m "Make a change to sdhci_init."

5. Then generate a new patch from the latest commit which will include your change:

git format-patch -1

You can then add that patch file to the bbappend like before.

 

Ken Sloat - Embedded Software Engineer
https://www.designlinxhs.com
Highlighted
Voyager
Voyager
387 Views
Registered: ‎07-06-2016

Hi @ksloatdesignlinx,

Thanks again for that, it looks like it's a bit more complex than I thought....

I'll follow your recommendations and I'll dig in the code and try to get rid of the "MMC busy timeout" issue using the patch, I'll get back with the result...

Just one question and to clarify, when you saying edit the source in the tree I assume in my case I'll have to edit for instance the "sdhci.c" file inside the "u-boot-xlnx"  but why I have to run first the command git reset HEAD~1 ?  It looks to me that I can edit the source anyway...

 

0 Kudos
Highlighted
383 Views
Registered: ‎02-24-2020

Hi @joseer 

Doing

git reset HEAD~1

rolls back the previous git commit but keeps the actual working changes around. So you apply the patch to the 2018.3 branch first and then roll back the commit but leave the actual changes to the source code in the u-boot directory you cloned.

After this if you do

git status

You should see that "modified: drivers/mmc/sdhci.c" has been modified and "git diff" should show you the changes from the patch you applied. Then you make your additional changes and add all and commit and generate a new patch.

By doing this, you get the original changes from the upstream patch + your edits in 1 commit and therefore 1 patch. There are other ways to do this as well, but this is the simplest for what you are trying to achieve. 

Ken Sloat - Embedded Software Engineer
https://www.designlinxhs.com
0 Kudos