# Removable SD Card support for MM6108

**URL:** <https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483>\
**Category:** Software\
**Created:** [April 14, 2025, 8:17pm UTC](https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483 "2025-04-14T20:17:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim.carney.cargt](https://sea1.discourse-cdn.com/flex001/user_avatar/community.morsemicro.com/tim.carney.cargt/32/92_2.png) [@tim.carney.cargt](https://community.morsemicro.com/u/tim.carney.cargt)\
**Post date:** [April 14, 2025, 8:17pm UTC](https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483/1 "2025-04-14T20:17:32Z")

</div>

I’m attempting to use an SDIO module with the MM6108 on a removable SD card. Is this supported with the morse\_sdio driver?

When I remove the device, I see the following output:

```auto
morse_sdio mmc2:0001:1: sdio removed func 1 vendor 0x325b device 0x306
WARNING: driver morse_sdio did not remove its interrupt handler!
morse_sdio mmc2:0001:2: sdio removed func 2 vendor 0x325b device 0x306
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_read failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_read failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_read failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_read failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_read failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
morse_sdio mmc2:0001:2: morse_sdio_set_func_address_base -123
morse_sdio mmc2:0001:2: morse_sdio_get_func failed
morse_sdio mmc2:0001:2: morse_sdio_reg32_write failed 18446744073709551611
mmc mmc2:0001: Runtime PM usage count underflow!
Failed to acquire reset gpio. Skipping reset.
mmc2: tried to HW reset card, got error -123
mmc2: card 0001 removed

```

---

<div class="post-metadata">

**Author:** ![ajudge](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ajudge](https://community.morsemicro.com/u/ajudge)\
**Post date:** [April 16, 2025, 8:17am UTC](https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483/2 "2025-04-16T08:17:17Z")

</div>

Strictly speaking, no the Morse Micro driver has not been developed to support hot removal. Primarily this is because the device driver “requires” gpios to be defined in device tree for proper function (power save and reset on removal of the driver).

That being said, the `power-gpios` are only used for power save, and while good to have, the `reset-gpio` is only really needed if you `rmmod morse`.  
These errors look like they might be caused by driver work queues being flushed during morse\_sdio\_remove.

It may not be super straightforward to add support for hot removal of SDIO, as there are some things to clean up. But I’m curious, does it hotplug correctly after this removal?

---

<div class="post-metadata">

**Author:** ![tim.carney.cargt](https://sea1.discourse-cdn.com/flex001/user_avatar/community.morsemicro.com/tim.carney.cargt/32/92_2.png) [@tim.carney.cargt](https://community.morsemicro.com/u/tim.carney.cargt)\
**Post date:** [April 16, 2025, 1:48pm UTC](https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483/3 "2025-04-16T13:48:37Z")

</div>

Yes, the driver appears to reload correctly after a hotplug. I have not done extensive testing, but I am able to remove and insert the device several times successfully initializing each time.

---

<div class="post-metadata">

**Author:** ![ajudge](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@ajudge](https://community.morsemicro.com/u/ajudge)\
**Post date:** [April 19, 2025, 1:51pm UTC](https://community.morsemicro.com/t/removable-sd-card-support-for-mm6108/483/4 "2025-04-19T13:51:01Z")

</div>

I’m not sure there’s a straightforward solution here. You could try to replace `flush_workqueue` with `cancel_work_sync` in `morse_sdio_remove`. I can’t stand by this as an official recommendation though, and given the nature of the bus and driver, I don’t think we can guarantee no in-flight messages will not error on on hot-removal. Network interfaces can be quite busy.
