# [solved] SD card reader not working on custom kernel

## DeIM

I tried many times to get it working on several kernel versions but it never worked.

Then I saw in dmesg log of live media (e.g. gentoo-based SystemRescueCD or new Arch based one also) it detects it and it worked

```
[   13.467373] sdhci: Secure Digital Host Controller Interface driver

[   13.467375] sdhci: Copyright(c) Pierre Ossman

[   13.507868] mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
```

vs my dmesg:

```
[    1.288631] sdhci: Secure Digital Host Controller Interface driver

[    1.288633] sdhci: Copyright(c) Pierre Ossman
```

```
# grep -i 8086 /lib/modules/5.9.1-gentoo/modules.* | grep -i 0f14

/lib/modules/5.9.1-gentoo/modules.alias:alias pci:v00008086d00000F14sv*sd*bc*sc*i* sdhci_pci

/lib/modules/5.9.1-gentoo/modules.alias:alias acpi*:80860F14:* sdhci_acpi
```

Don't know where I make mistake.Last edited by DeIM on Mon Nov 22, 2021 5:43 pm; edited 1 time in total

----------

## charles17

You might want to search the internet for "8086 0F14" and one of the hits might be cateee.net

Are you having those CONFIG options both enabled?

----------

## DeIM

yes:

```
# grep SDHC .config

CONFIG_MMC_SDHCI=y

CONFIG_MMC_SDHCI_IO_ACCESSORS=y

CONFIG_MMC_SDHCI_PCI=y

CONFIG_MMC_SDHCI_ACPI=y

# CONFIG_MMC_SDHCI_PLTFM is not set
```

```
# grep PCI .config

...

CONFIG_PCI=y

...
```

----------

## grumblebear

First, try to build those as modules insted of having them compiled in. If they do not get loaded automatically, you can at least try to modprobe them and see what happens.

----------

## DeIM

Tried to compile as modules. No change. Those are loaded automatically:

```
sdhci_acpi             24576  0

sdhci                  61440  1 sdhci_acpi
```

tried to load sdhci_pci and unload sdhci_acpi also.

Maybe ADMA which uses another media?

----------

## theotherjoe

anything in dmesg output that gives a hint 

about what is going wrong?

----------

## DeIM

I see nothing wrong:

https://pastebin.com/1FDQcqW0

Working dmesg (from SysResc):

https://pastebin.com/Qx8WqsNX

----------

## Jaglover

 *charles17 wrote:*   

> You might want to search the internet for "8086 0F14" and one of the hits might be cateee.net
> 
> Are you having those CONFIG options both enabled?

 

You can eliminate this uncertainty.   :Cool: 

https://duckduckgo.com/?q=site%3Acateee.net+0F14&ia=web

----------

## DeIM

I see something wrong about ADMA - I have very little info about it - too little info in menuconfig search also.

Found this about it:

https://e2e.ti.com/support/legacy_forums/omap/f/885/t/385576?Difference-between-ADMA-and-SDMA

Is it possible that ADMA is somehow missing in my kernel config?

If so, where is it located since I can't see it anywhere.   :Confused: 

Many thanks!   :Wink: 

----------

## charles17

 *DeIM wrote:*   

> Is it possible that ADMA is somehow missing in my kernel config?
> 
> If so, where is it located since I can't see it anywhere.   

 

Have you tried

```
cd /usr/src/<your kernel>

su -c "make menuconfig"

Then read the very first line on top saying »Press [...], </> for Search.«

```

----------

## DeIM

Yes, I used searching before. But the most relevant I found was:

```
  │ Symbol: INTEL_IOP_ADMA [=n]

  │ Type  : tristate

  │ Defined at drivers/dma/Kconfig:313

  │   Prompt: Intel IOP32x ADMA support

  │   Depends on: DMADEVICES [=y] && (ARCH_IOP32X || COMPILE_TEST [=n])

  │   Location:

  │     -> Device Drivers

  │ (2)   -> DMA Engine support (DMADEVICES [=y])

  │ Selects: DMA_ENGINE [=y] && ASYNC_TX_ENABLE_CHANNEL_SWITCH [=n]
```

I think I'll give sys-kernel/gentoo-kernel-bin a try to see if it differ.

----------

## DeIM

I've just created installation on Flash disk with kernel and initrd generated by genkernel.

After boot of same version of kernel I can see sdcard and I can insert and mount SD cards.

Still don't know how to achieve the same with manually configured kernel. I've tried to enable many modules.

Is there a chance it must be included and loaded by initrd?

----------

## pietinger

 *DeIM wrote:*   

> Still don't know how to achieve the same with manually configured kernel. I've tried to enable many modules.

 

If your initrd is able to bring up a working SD card reader you must have all needed modules in your kernel, so you must be able to achieve the same with a manually configured kernel.

I recommend to work with the help function in your "make menuconfig".You will get there the most interesting informations:

1.) The NAME of the module

2.) which module depends on other modules,

3.) which modules selects other modules and

4.) which module was enabled/selected by another module.

An example is the first entry in "Device Drivers -> [*] MMC/SD/SDIO card support". It depends on

```
CONFIG_MMC_BLOCK:                                                                                                                                                                                                                                                                            

[helptext]                                                                                                                                                                                                                                                                        

Symbol: MMC_BLOCK [=y]                                                                                                                                                                                                                                                                         

 Type  : tristate                                                                                                                                                                                                                                                                               

 Defined at drivers/mmc/core/Kconfig:37

 Prompt: MMC block device driver

 Depends on: MMC [=y] && BLOCK [=y]
```

This one doesnt have a

```
Selects:

Selected by [n]:
```

First you should do: Decide if you want to have them static in your kernel or as module. The do ALL as module OR static (no mismatch; only options which are not able to get in as module you can mismatch).

Second: get a list of your modules with "lsmod".

Delete all modules from your list, you know they doesnt have any clue to your SD cardreader.

So you will have maybe 4 or 7 modules left (maybe some modules which are not related to your SD; but this you will find out).

Search them with / in your make menuconfig. Then go into the HELP and read. If you dont find a module with / you know this module depends on another one and will be only visible if you enabled the other one. After a while of searching you have found them all ... even these which are at first sight invisible. You can also use "z" (toggle-function) to see invisible modules.

Good Luck,

Peter

----------

## pietinger

P.S.: Do the "lsmod" AFTER you inserted a SD card and after you WORKED with the SD card ...

----------

## NeddySeagoon

pietinger,

Its also possible to do 

```
modprobe -r module
```

and see what makes the card reader non operational.

rmmod is a bit more brutal. It will remove modules that are in use too.

Its a very bad thing to remove the kernel module for your video card, or hard drives, so don't do that.

lsmod lists modules in module load order with the first loaded module at the bottom of the list.

If modprobe -r fails because the module is in use, its either used by the kernel or something further up the list.

----------

## pietinger

Neddy,

thank you very much again, especially this is very helpful:

 *NeddySeagoon wrote:*   

> lsmod lists modules in module load order with the first loaded module at the bottom of the list.

 

... bottom ... bottom ... NOT top ... aaaarggghhh   :Wink: 

Many greetings,

Peter

----------

## DeIM

Thanks very much for guidelines. I must be stupid cause I was unable to make it work modifying the configuration.

I discovered the last difference - dw_dmac which provides ADMA for mmc, I suppose, didn't loaded at all. It was in config. Tried modules and built-in also. Nothing worked. I spend no little time with it...

Then I decided to make VV approach - I put working config and tried to put away things laptop don't use. Now I have everything working.

Many thanks to You all - I'm closing it finally  :Very Happy: 

----------

