Closed humanoid2050 closed 3 years ago
To your last paragraph: U-Bott does not have a GPIO driver for Intel Tangier, that's why changing flags do nothing. But putting 'cd-inverted' into DTS should have an effect (as we exercised in #135 for cd_override_level
).
It seems I have nailed down what's going on in U-Boot. The firmware sets the mode for SD CD pin to native (mode 1), while in Linux kernel we first switch it to mode 0 (GPIO). That's why U-Boot doesn't ignore its state.
TL;DR: please test these two patches (@htot drop anything in your tree except these two along with https://github.com/andy-shev/u-boot/commit/20d551a84d7a, so you will have only three patches on top of upstream U-Boot) https://github.com/andy-shev/u-boot/commit/87f693a59df3b76952c8f5fadf13ce586dc2b1b2 followed by https://github.com/andy-shev/u-boot/commit/c5cfab637085991ebc44b052c2790fa19048ee7d.
Sure. I see it might be worth upgrading U-Boot to 2021.10 in our image.
No response from the reporter @humanoid2050 and works for me, hence closing.
For completeness I just tested these patches on Edison-Arduino. When SD card is not present:
=> ls mmc 1
Card did not respond to voltage select! : -110
Couldn't find partition mmc 1
When SD card is present:
=> ls mmc 1
.disk/
boot/
casper/
dists/
EFI/
install/
1073741824 casper-rw
pics/
pool/
preseed/
134 autorun.inf
18809 md5sum.txt
229 README.diskdefines
2501488 wubi.exe
32256 ldlinux.sys
syslinux/
11015538 mb_bios_z490m_f20d.zip
mb_bios_z490m_f20d/
7 file(s), 11 dir(s)
I didn't see any differences between booting with SD card inserted or not.
Other info:
=> fstype mmc 1
fat
=> fstypes
Supported filesystems: fat, ext4, btrfs
=> mmcinfo
Device: mmc@ff3fa000
Manufacturer ID: 2
OEM: 544d
Name: SD02G
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 1.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
Seems to work fine on Edison-Arduino. I hope to force push later this evening. @humanoid2050 would you have time to test on your platform?
I should be able to. I tried cobbling it together myself, but somehow I fixed uboot but broke kernel in a new way.
force pushed to htot/master and htot/gatesgarth
Allrighty. Pulled the latest gatesgarth. Built, compiled, flashed just fine. U-Boot and kernel both react properly to the SD card being inserted and removed!
Thanks for testing @humanoid2050
At least as far back as the Dunfell branch, U-Boot (as installed) does not properly detect an SD card when using a Sparkfun microSD Block. Product page Schematic A very long time ago (like when Intel was still supporting the Edison) U-Boot was able to see the uSD card.
When the card slot is empty
When the card slot is populated
Presumably, this is the U-Boot analog of #135, which focused on the kernel. Investigation into that issue indicated that the Sparkfun board and the Edison-Arduino board use different hardware for the uSD socket. The Sparkfun board has a "normally closed" switch on the Card Detect (CD) line. This means that when no card is present, the CD line is shorted to ground. Inserting the card breaks the contact. The Edison-Arduino board uses a "normally open" switch internally with an external pullup to 1.8V on the line.
I had assumed that the patch
meta-intel-edison/meta-intel-edison-bsp/recipes-bsp/u-boot/files/0004-x86-edison-Enable-SD-card-detect-on-the-SDHCI-2.patch
was responsible for configuring the GPIO line that U-Boot uses for CD, but altering and even removing the patch produced absolutely no observable changes to the behavior.