Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - sdmmc driver on rpi4 version: (13 Items)
   
sdmmc driver on rpi4 version  
Hi,
  I'm having a bit of a strange issue and although I _may_ have a workaround, I'd be interested in thoughts about what a
 better solution may be.  I have a few different versions of the RPi4 (1GB, 2GB) and while they all seem to work 
basically, I have a problem after booting from the ifs with the sdmmc driver finding the partition table on the 2GB 
system.  After logging in and exploring, I found that if I slay'd the dev-sdmmc-bcm2711 driver and then restarted, then 
the /dev/sd0 and it's partitions would be seen and I could proceed as normal.  So my workaround, which is ugly for sure,
 is to add this to my build file, which works?!  Any idea why I would need to run the driver, slay it, and re-run to 
have it find the partition on my SD?

#######################################################################
    ## SD memory card driver
    ## Note: "bmstr_base" option is required for busmaster memory
    ## address translation
    #######################################################################
    display_msg Starting SDMMC driver for SD card (SDIO0)...
    devb-sdmmc-bcm2711 mem name=below1G sdio addr=0xfe340000,irq=158,bs=bmstr_base=0xc0000000 disk name=sd
    waitfor /dev/sd0
    slay -9 devb-sdmmc-bcm2711
    devb-sdmmc-bcm2711 mem name=below1G sdio addr=0xfe340000,irq=158,bs=bmstr_base=0xc0000000 disk name=sd  
Re: sdmmc driver on rpi4 version  
Maybe something with pad or frequency settings is not correct, so that initialization fails first time.

Or something is being changed in the system - either explicitly or by accident - between the first launch and the spot 
where you apply the workaround.

Or an issue in the driver itself, maybe it is powering something up, that takes too long, but on second launch it is 
already powered up and the startup sequence succeeds.

Wild guesses, anyway.

Regards,
-Al
Re: sdmmc driver on rpi4 version  
Can you post the slog2info output in the failure case?

--Elad
Re: sdmmc driver on rpi4 version  
Somehow my previous response didn't ever go through...Instead of pasting, I've included output from the system that 
loads, slays, and reloads the driver.  If other diagnostics would be helpful, happy to provide those!

Thanks!
David
Attachment: Text slog2info.txt 44.37 KB
Re: sdmmc driver on rpi4 version  
The log shows no error from the sdmmc driver and the device is identified correctly.

Can you increase sdio and sdmmc verbosity of the driver and post a new log file?
# devb-sdmmc-bcm2711 mem name=below1G sdio addr=0xfe340000,irq=158,bs=bmstr_base=0xc0000000,verbose=4 sdmmc verbose=4 
disk name=sd

Re: sdmmc driver on rpi4 version  
Hi guys, new to the forum,

I am having the same issue with the RPi4 BSP.
The driver is started with:
devb-sdmmc-bcm2711 cam pnp,verbose mem name=below1G sdio addr=0xfe340000,irq=158,bs=bmstr_base=0xc0000000, verbose=4 
sdmmc verbose=4 disk name=sd

sd0 shows up in /dev but no partitions, fdisk confirms.
Interestingly, if I remove the busmaster base option, I can see the partitionts (sd0t11 and sd0t12 as expected, two 
FAT32 partitions) but upon mounting and accessing them, it still complains about corrupted file system.

I am attaching the slog. Any help would be greatly appreciated.
RPi4 8GB, SD card is a 64GB Samsung. First partition ~650MB (contains the IFS), second partition 1GB.
Attachment: Text slog_sd.txt 34.07 KB
Re: sdmmc driver on rpi4 version  
I am attaching the slog for the build without the "bs=bmstr_base=0xc0000000 "
I can immediately see a difference under the SD SW CAPS portion:

Not working, bmstr_base present:
slog   1800  SD SW CAPS:
slog   1800    bus mode 0x0, cmd sys 0x0
slog   1800    drv type 0x0, curr limit 0x0
slog   1800    dtr 0
slog   1800  CFG:  Timing LS, DTR 25000000, Bus Width 1 bit

Somewhat working, bmstr_base removed:
slog   1800  SD SW CAPS:
slog   1800    bus mode 0x3, cmd sys 0x1
slog   1800    drv type 0x1, curr limit 0x1
slog   1800    dtr 50000000
slog   1800  CFG:  Timing HS, DTR 50000000, Bus Width 4 bit


Attachment: Text slog_sd_no_bm_option.txt 21.7 KB
Re: sdmmc driver on rpi4 version  
There are two known issues with the SD card driver:

1. Newer revision boards (silently) changed the DMA range for the hardware. You probably have the C0 version. We have 
recently fixed that so that the driver now detects things automatically. For now just dropping that option from the 
command line should be fine (unless you are building an image that needs to support both hardware versions).
2. Not all SD cards work properly. I have no idea why, but then again I'm not a hardware/driver guy. I have had no 
issues with SanDisk cards, but many people have had issues with some other brands.

Finally, you may want to use a more robust file system than FAT.

I love Raspberry Pi - it's a technological marvel in terms of price/performance. But the foundation does a really lousy 
job at publishing information about the hardware.

--Elad
Re: sdmmc driver on rpi4 version  
> There are two known issues with the SD card driver:
> 
> 1. Newer revision boards (silently) changed the DMA range for the hardware. 
> You probably have the C0 version. We have recently fixed that so that the 
> driver now detects things automatically. For now just dropping that option 
> from the command line should be fine (unless you are building an image that 
> needs to support both hardware versions).
> 2. Not all SD cards work properly. I have no idea why, but then again I'm not 
> a hardware/driver guy. I have had no issues with SanDisk cards, but many 
> people have had issues with some other brands.
> 
> Finally, you may want to use a more robust file system than FAT.
> 
> I love Raspberry Pi - it's a technological marvel in terms of price/
> performance. But the foundation does a really lousy job at publishing 
> information about the hardware.
> 
> --Elad

Thanks Elad for the quick follow-up.
I am just dropping the option for now, I do not need to support other HW, so that works.

About file systems: I've tried to create two additional partitions, one FAT32 (type 14) and one qnx6fs (type 179). 
Here are my observations:
- both partitions created via the QNX host and persist in the partition table after a reboot
- both partitions formatted with their respective formatting tool (mkdosfs and mkqnx6fs)
- both partitions mount
- the qnx6 one can be accessed fine after mounting
- the fat32 says "Corrupted file system detected"

I am also checking the card with GParted on my Ubuntu PC, I can see all three partitions (the FAT32 with the IFS, and 
the two created by the QNX host). The second one shows up with "unknown" file system, as expected, and the third one is 
recognized as FAT32.
It seems like everything is working fine except actually reading the file system.
The preference towards FAT32 is motivated by a need: I would like to be able to copy files to this "data" partitions 
using a Windows machine...
Should I just buy more SD cards and hope for the best? I would really like to understand at least what's wrong. The HW 
should be ok as the partitions are created as expected, it is really only just accessing them after mounting...
Re: sdmmc driver on rpi4 version  
If you got this far then the SD card clearly works properly. The second problem I mentioned results in not being able to
 mount any partition.

There's a chkdosfs utility in the SDP. Perhaps it can shed some light on what's wrong with the FAT partition.

--Elad
Re: sdmmc driver on rpi4 version  
Do you specify the file system type when mounting?
QNX6FS is the default, other file systems must be specified at the mount command, e.g. "-t dos"
Re: sdmmc driver on rpi4 version  
> Do you specify the file system type when mounting?
> QNX6FS is the default, other file systems must be specified at the mount 
> command, e.g. "-t dos"

Ok, I think I was mislead by the documentation. The utility reference of mount says:
If you don't specify the filesystem, mount tries to determine which to use. If it can't figure out which to use, it uses
 qnx6.
Mounting with -t dos makes the partition accessible I can see the files.
Many thanks guys, fantastic support (both info and speed)!


Re: sdmmc driver on rpi4 version  
Silly question - are you sure your mount command is correct for a FAT partition? Can you share it?

--Elad