litex-hub / linux-on-litex-vexriscv

Linux on LiteX-VexRiscv
BSD 2-Clause "Simplified" License
573 stars 174 forks source link

Inserting SDCard does not create /dev/mmcblk* on titanium_ti60_f225_dev_kit build #273

Closed sammhho closed 2 years ago

sammhho commented 2 years ago

First of all, thx again for all the open source efforts, great work!

Now, I've successfully built and booted into Linux targeting the titanium_ti60_f225_dev_kit board.

Gateware was all defaults setting, just ran ./make.py --board=titanium_ti60_f225_dev_kit --build --flash (I did have to migrate the def flash function under TitaniumTi60F225DevKit class inside make.py from the litex_boards module so it launchs openFPGALoader though)

Software was from the pre-built linux_2022_03_23.zip as pointed to on the README.md.

Then, according to the HOWTO.md, when I plug in a SDCard now some node should pop under /dev/mmcblk*, but it didn't (nor any /dev/sd*). Doing cat /proc/partitions shows nothing.

Then I've no idea how to debug from this point. I see under build/titanium_ti60_f225_dev_kit/software there's library code for liblitesdcard, but I presumed those are for bare-metal use? Then there doesn't seem to be extra driver code for the litesdcard, drivers are just generic code from buildroot code base within the Linux kernel? (coz lsmod also shows nothing so if there's any driver it has to be built within kernel instead of via kernel modules on PC?) After Googling some says I can manually do mknod to create the node? (but I bet it won't work...?)

Results of cat /proc/devices:

Character devices: 1 mem 2 pty 3 ttyp 4 /dev/vc/0 4 tty 5 /dev/tty 5 /dev/console 5 /dev/ptmx 7 vcs 10 misc 13 input 29 fb 89 i2c 90 mtd 128 ptm 136 pts 153 spi 226 drm 229 hvc 250 rpmb 251 ttyLXU 252 ptp 253 pps 254 gpiochip

Block devices: 179 mmc 259 blkext

At the end of dmesg (not sure it's relevant):

[ 4.085575] litex-mmc f0004000.mmc: Requested clk_freq=12500000: set to 9375000 via div=32 [ 5.126995] Command (cmd 8) failed, status 2 [ 6.130946] Command (cmd 55) failed, status 2 [ 7.135029] Command (cmd 55) failed, status 2 [ 8.139112] Command (cmd 55) failed, status 2 [ 9.143190] Command (cmd 55) failed, status 2 [ 10.147286] Command (cmd 1) failed, status 2 [ 10.151269] litex-mmc f0004000.mmc: Requested clk_freq=0: set to 1171875 via div=256 [ 10.162725] Freeing unused kernel image (initmem) memory: 204K [ 10.168622] Kernel memory protection not selected by kernel config. [ 10.175403] Run /init as init process [ 10.178856] with arguments: [ 10.179140] /init [ 10.179406] with environment: [ 10.179693] HOME=/ [ 10.179960] TERM=linux [ 13.122981] random: dd: uninitialized urandom read (512 bytes read)

sammhho commented 2 years ago

Ok I found the SD card actually works when it's already plugged in during boot of Linux. And seems the SD card socket on the board doesn't support detecting insertion/removal. Also, I can now boot from the SD card instead of previously from litex_term. So nothing wrong with the build, closing this issue.