# Changing GPIO pin for SD card detection

**URL:** <https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311>\
**Category:** mangOH Red\
**Created:** [April 9, 2018, 12:02am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311 "2018-04-09T00:02:13Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 12:02am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/1 "2018-04-09T00:02:13Z")

</div>

Hello all,

We’ve recently received some new hardware based on the MangOH Red design. Unfortunately it seems our SD card detection GPIO pin is slightly different from the MangOH Red. This seems to be causing this: `[10.398626] mmc0: No card detect facilities available`

I spoke briefly with @dfrey about this and he suggested modifying `kernel/arch/arm/mach-msm/board-9625.c` but I haven’t seen anything SD card related in there. Also note I’ve been able to successfully rebuild and flash Yocto to my WP85.

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [April 9, 2018, 12:57am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/2 "2018-04-09T00:57:18Z")

</div>

SD card pin needs to be same as mangoh unless you want to dig into the SDIO driver(not recommended)

---

<div class="post-metadata">

**Author:** ![coastalbrandon](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/coastalbrandon/32/264_2.png) [@coastalbrandon](https://mangoh.discourse.group/u/coastalbrandon)\
**Post date:** [April 9, 2018, 1:18am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/3 "2018-04-09T01:18:01Z")

</div>

Ah geeze, we are going to have to look at the SDIO driver, we made a mistake attaching it to a different gpio - it was due to the orientation of the WP chip and SD card reader that we made it this way.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 2:40am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/4 "2018-04-09T02:40:28Z")

</div>

Thanks for the reply @asyal. How did you guys define this when designing the MangOH? Did you guys modify the SDIO driver to define the GPIO pin or just chose a standard GPIO pin?

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [April 9, 2018, 3:14am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/5 "2018-04-09T03:14:42Z")

</div>

SDIO driver defines that GPIO functionality. We didnt modify it.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 5:32am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/6 "2018-04-09T05:32:02Z")

</div>

So the driver has a spec for the GPIO pin and you guys just followed it?

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [April 9, 2018, 5:33am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/7 "2018-04-09T05:33:21Z")

</div>

yes.  
If you look carefully Green and Red, use the same GPIO pin.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 5:35am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/8 "2018-04-09T05:35:01Z")

</div>

Thanks @asyal. I spoke with @coastalbrandon and it sounds like we’re stuck with this pin for now. I’m going to try and trace backwards from that log message I received.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 5:50am UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/9 "2018-04-09T05:50:32Z")

</div>

I’ve been looking around at old forum posts and lots of them seem to involve `No card detect facilities available` so I’m thinking this might be a false alarm of sorts.

---

<div class="post-metadata">

**Author:** ![dfrey](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/dfrey/32/303_2.png) [@dfrey](https://mangoh.discourse.group/u/dfrey)\
**Post date:** [April 9, 2018, 4:54pm UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/10 "2018-04-09T16:54:59Z")

</div>

For the WPx5xx, the definition of the GPIO for SD card detection is in `kernel/arch/arm/mach-msm/board-9615-storage.c`

Look at `GPIO_SDC1_HW_DET` and how it is referenced. Keep in mind that 80 is the internal modem GPIO number, not the WP GPIO number. Look in `gpiolib.c` for the translation table.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 4:58pm UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/11 "2018-04-09T16:58:50Z")

</div>

Perfect, thank you! I’ll give this a try later this afternoon.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 11:07pm UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/12 "2018-04-09T23:07:38Z")

</div>

Hey all,

I made the change but there is still no `mmc` device in `/dev`. I’m still seeing `mmc0: No card detect facilities available` but like I said, I think this may be a somewhat expected error. I’m hoping to test a few different models of SD cards tomorrow.

---

<div class="post-metadata">

**Author:** ![asyal](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/asyal/32/78_2.png) [@asyal](https://mangoh.discourse.group/u/asyal)\
**Post date:** [April 9, 2018, 11:13pm UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/13 "2018-04-09T23:13:06Z")

</div>

> [@nick](#):
>
> mmc0: No card detect facilities available but like I said, I think this may be a somewhat expected error. I’m hoping to test a few different models of SD cards tomorrow.

> [@nick](#):
>
> o mmc device in /dev. I’m still seeing mmc0: No card detect facilities available but like I said, I think this may be a somewhat expected error. I’m hoping to test a few different models of SD cards tomorrow.

Where is GPIO42 connected to?

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/nick/32/1380_2.png) [@nick](https://mangoh.discourse.group/u/nick)\
**Post date:** [April 9, 2018, 11:21pm UTC](https://mangoh.discourse.group/t/changing-gpio-pin-for-sd-card-detection/1311/14 "2018-04-09T23:21:31Z")

</div>

It’s connected to a different digital input.
