Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4950

Device Tree • Additional SD card overlay for CM4 and bookworm

$
0
0
Hi,

I followed the instructions in this forum thread - viewtopic.php?t=302634 to add a sd card to the CM4 using the GPIO pins 22-27 with a custom DTS overlay.

The dts file looks like

Code:

/* * Device tree overlay for enabling SD0 using the sdhost interface on GPIO 22-27 by Kristian Sloth Lauszus. *//dts-v1/;/plugin/;/{    compatible = "brcm,bcm2711";    fragment@0 {        target = <&sdhost>;        frag0: __overlay__ {            pinctrl-names = "default";            pinctrl-0 = <&sdhost_pins>;            bus-width = <4>;            brcm,overclock-50 = <0>;            brcm,pio-limit = <1>;            status = "okay";        };    };    fragment@1 {        target = <&gpio>;        __overlay__ {            sdhost_pins: sdhost_pins {                brcm,pins = <22 23 24 25 26 27>;                brcm,function = <4 4 4 4 4 4>; /* ALT0: SD0 */                brcm,pull = <0 2 2 2 2 2>; /* pull up all except clk */            };        };    };    __overrides__ {        overclock_50 = <&frag0>,"brcm,overclock-50:0";        force_pio = <&frag0>,"brcm,force-pio?";        pio_limit = <&frag0>,"brcm,pio-limit:0";        debug = <&frag0>,"brcm,debug?";    };};
I compile the custom DTS overlay from Lauszus after writing the sd0-overlay.dts file by running

Code:

sudo dtc -@ -I dts -O dtb -o /boot/overlays/sd0.dtbo sd0-overlay.dts
This sets the GPIO pin 22-27 to SD0 alt and set the pull-ups. I have appended the following line to the bottom of /boot/config.txt or /firmware/boot/config.txt

Code:

dtoverlay=sd0
I am using a CM4 module with eMMC and WiFi.

On bullseye (OS lite, 64 bit, flashed 14th May 2024) the overlay works, I can mount and write files to the SD card.

On bookworm (OS lite, 64 bit, flashed Feb 2025) I take the same steps, the SD card can be seen by the cm4 but the partitions cannot. I get these dmesg errors whenever I try to mount and it doesn't matter how I format the card (on other computers) the result is the same

Code:

pi@REFLEX0004:~ $ dmesg | grep mmc[    1.869740] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0[    1.869755] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated[    1.948033] mmc2: sdhost-bcm2835 loaded - DMA enabled (>1)[    2.291730] mmc1: new high speed SDIO card at address 0001[    2.318069] mmc0: SDHCI controller on fe340000.mmc [fe340000.mmc] using ADMA[    2.428781] mmc2: host does not support reading read-only switch, assuming write-enable[    2.443958] mmc2: Host Software Queue enabled[    2.452015] mmc2: new high speed SDHC card at address aaaa[    2.510486] mmc0: new DDR MMC card at address 0001[    2.513981] mmcblk2: mmc2:aaaa SC16G 14.8 GiB[    2.523707] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB[    2.534829]  mmcblk2: p1[    2.536821]  mmcblk0: p1 p2[    2.539380] mmcblk2: mmc2:aaaa SC16G 14.8 GiB (quirks 0x00004000)[    2.545289] mmcblk0: mmc0:0001 8GTF4R 7.28 GiB[    3.526138] mmcblk0boot0: mmc0:0001 8GTF4R 4.00 MiB[    3.533154] mmcblk0boot1: mmc0:0001 8GTF4R 4.00 MiB[    3.539314] mmcblk0rpmb: mmc0:0001 8GTF4R 512 KiB, chardev (243:0)[    7.864347] systemd[1]: Unnecessary job was removed for dev-mmcblk0p1.device - /dev/mmcblk0p1.[   49.583980] /dev/mmcblk2p1/: Can't lookup blockdev[   56.040936] F2FS-fs (mmcblk2p1): Magic Mismatch, valid(0xf2f52010) - read(0xa9890)[   56.040962] F2FS-fs (mmcblk2p1): Can't find valid F2FS filesystem in 1th superblock[   56.041548] F2FS-fs (mmcblk2p1): Magic Mismatch, valid(0xf2f52010) - read(0x80000)[   56.041560] F2FS-fs (mmcblk2p1): Can't find valid F2FS filesystem in 2th superblock
It sounds like other users are getting a similar overlay to work - viewtopic.php?t=381108

Statistics: Posted by tennisparty — Fri Feb 21, 2025 8:53 pm — Replies 0 — Views 1



Viewing all articles
Browse latest Browse all 4950

Trending Articles