LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Trying to get SD card working (https://www.linuxquestions.org/questions/linux-hardware-18/trying-to-get-sd-card-working-558156/)

paulsiu 05-31-2007 08:56 PM

Trying to get SD card working
 
I am trying to get my SD card working in Puppy Linux. The SD Card works under Ubuntu, so I figure that it must be because the default Puppy Kernel isn't compile with CONFIG_MMC=m.

I recompile the kernal with the right flag and install the modules. I then load the modules by

modprobe mmc_core
modprobe mmc_block
modprobe sdhci

I insert the SD card and do a dmesg, I get:

mmcblk0: mmc0:0002 SD 1971712KiB
mmcblk0: p1

When I do a find / -print | grep mmcblk0, I get

/sys/block/mmcblk0
/sys/block/mmcblk0/queue
/sys/block/mmcblk0/queue/iosched
/sys/block/mmcblk0/queue/iosched/slice_idle
/sys/block/mmcblk0/queue/iosched/slice_async_rq
/sys/block/mmcblk0/queue/iosched/slice_async
/sys/block/mmcblk0/queue/iosched/slice_sync
/sys/block/mmcblk0/queue/iosched/back_seek_penalty
/sys/block/mmcblk0/queue/iosched/back_seek_max
/sys/block/mmcblk0/queue/iosched/fifo_expire_async
/sys/block/mmcblk0/queue/iosched/fifo_expire_sync
/sys/block/mmcblk0/queue/iosched/queued
/sys/block/mmcblk0/queue/iosched/quantum
/sys/block/mmcblk0/queue/scheduler
/sys/block/mmcblk0/queue/max_sectors_kb
/sys/block/mmcblk0/queue/max_hw_sectors_kb
/sys/block/mmcblk0/queue/read_ahead_kb
/sys/block/mmcblk0/queue/nr_requests
/sys/block/mmcblk0/mmcblk0p1
/sys/block/mmcblk0/mmcblk0p1/holders
/sys/block/mmcblk0/mmcblk0p1/subsystem
/sys/block/mmcblk0/mmcblk0p1/stat
/sys/block/mmcblk0/mmcblk0p1/size
/sys/block/mmcblk0/mmcblk0p1/start
/sys/block/mmcblk0/mmcblk0p1/dev
/sys/block/mmcblk0/mmcblk0p1/uevent
/sys/block/mmcblk0/slaves
/sys/block/mmcblk0/holders
/sys/block/mmcblk0/subsystem
/sys/block/mmcblk0/device
/sys/block/mmcblk0/stat
/sys/block/mmcblk0/size
/sys/block/mmcblk0/removable
/sys/block/mmcblk0/range
/sys/block/mmcblk0/dev
/sys/block/mmcblk0/uevent
/sys/devices/pci0000:00/0000:00:10.0/0000:03:05.2/mmc0:0002/block:mmcblk0

The problem is that there are no mmcblk0 device in the /dev directory. I tried creating them manually using mknod

mknod /dev/mmcblk0 b 254 0
mknod /dev/mmcblk0p1 b 254 1

Unfortunately, mounting it did ot work:

mount /dev/mmcblk0p1 /mnt/flash
mount: Mounting /dev/mmcblk0p1 on /mnt/flash failed: No such device or address

What I am doing wrong here? I guess I can try compiling with the MMC debug flag, but I am not a device driver expert. What should I be looking for?

Paul

ciotog 06-01-2007 01:30 AM

What kind of SD interface do you have? You might need to enable another kernel driver like tifm_sd, mmc_wbsd or mmc_sdhci and load it too.

TheOracle 06-01-2007 03:28 AM

fdisk -l
 
Have you tried "fdisk -l"?
Perhaps puppy uses a different device???

Hope this helps

paulsiu 06-01-2007 09:08 AM

Well, it's an Averatec 2370 with a O2Micro controller, so it probably doesn't use TI or WinBond. I am just using the generic drivers. Judging from the various post, the TI drivers are broken any way so people generally use setpci to use the generic driver.

In my .config, I am compiling with the following flag:

CONFIG_MMC=m
CONFIG_MMC_DEBUG=y
CONFIG_MMC_BLOCK=m
CONFIG_MMC_SDHCI=m

I compile the kernel and modules using the above settings. Here's some of the debug output.

I load the 3 modules

modprobe mmc_core
modprobe mmc_block
modprobe sdhci

Here's what I get from dmesg (with the debug):

sdhci: Secure Digital Host Controller Interface driver, 0.12
sdhci: Copyright(c) Pierre Ossman
sdhci: SDHCI controller found at 0000:03:05.2 [1217:7120] (rev 1)
sdhci [sdhci_probe()]: found 1 slot(s)
ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
ACPI: PCI Interrupt 0000:03:05.2[A] -> Link [LNKB] -> GSI 10 (level, low) -> IRQ 10
sdhci [sdhci_probe_slot()]: slot 0 at 0xfe3fec00, irq 10
sdhci:slot0: Unknown controller version (16). You may experience problems.
sdhci [sdhci_probe_slot()]: Controller doesn't have DMA interface
sdhci: ============== REGISTER DUMP ==============
sdhci: Sys addr: 0x00000000 | Version: 0x00001010
sdhci: Blk size: 0x00000000 | Blk cnt: 0x00000000
sdhci: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci: Present: 0x01fa0000 | Host ctl: 0x00000000
sdhci: Power: 0x00000000 | Blk gap: 0x00000000
sdhci: Wake-up: 0x00000000 | Clock: 0x00000000
sdhci: Timeout: 0x00000000 | Int stat: 0x00000000
sdhci: Int enab: 0x00ff00fb | Sig enab: 0x00ff00fb
sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci: Caps: 0x038021a1 | Max curr: 0x00ffffff
sdhci: ===========================================
mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0
mmc0: SDHCI at 0xfe3fec00 irq 10 PIO
mmc0: clock 0Hz busmode 1 powermode 1 cs 0 Vdd 21 width 0
mmc0: clock 128906Hz busmode 1 powermode 2 cs 0 Vdd 21 width 0
mmc0: clock 128906Hz busmode 1 powermode 2 cs 1 Vdd 21 width 0
mmc0: starting CMD0 arg 00000000 flags 00000040
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (0)
mmc0: req done (CMD0): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: clock 128906Hz busmode 1 powermode 2 cs 0 Vdd 21 width 0
mmc0: starting CMD55 arg 00000000 flags 00000015
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: starting CMD55 arg 00000000 flags 00000015
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: starting CMD55 arg 00000000 flags 00000015
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: starting CMD55 arg 00000000 flags 00000015
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: starting CMD1 arg 00000000 flags 00000061
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (1)
mmc0: req done (CMD1): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0

When I insert the SD card, I get the following output

Sending cmd (29)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (29)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (29)
mmc0: req done (CMD41): 0/0/0: 00ff8000 00000000 00000000 00000000
mmc0: starting CMD55 arg 00000000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (37)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (37)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 0/0/0: 00000120 00000000 00000000 00000000
mmc0: starting CMD41 arg 00300000 flags 00000061
sdhci [sdhci_send_command()]: Sending cmd (29)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (29)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (29)
mmc0: req done (CMD41): 0/0/0: 80ff8000 00000000 00000000 00000000
mmc0: starting CMD2 arg 00000000 flags 00000067
sdhci [sdhci_send_command()]: Sending cmd (2)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (2)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (2)
mmc0: req done (CMD2): 0/0/0: 1a505153 44202020 0000c803 4d006500
mmc0: starting CMD3 arg 00000000 flags 00000065
sdhci [sdhci_send_command()]: Sending cmd (3)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (3)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (3)
mmc0: req done (CMD3): 0/0/0: 00020500 00000000 00000000 00000000
mmc0: starting CMD2 arg 00000000 flags 00000067
sdhci [sdhci_send_command()]: Sending cmd (2)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00018000
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (2)
mmc0: req done (CMD2): 1/0/0: 00000000 00000000 00000000 00000000
sdhci [sdhci_send_command()]: Sending cmd (2)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00018000
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (2)
mmc0: req done (CMD2): 1/0/0: 00000000 00000000 00000000 00000000
sdhci [sdhci_send_command()]: Sending cmd (2)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00018000
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (2)
mmc0: req done (CMD2): 1/0/0: 00000000 00000000 00000000 00000000
sdhci [sdhci_send_command()]: Sending cmd (2)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00018000
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (2)
mmc0: req done (CMD2): 1/0/0: 00000000 00000000 00000000 00000000
mmc0: clock 128906Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0
mmc0: starting CMD9 arg 00020000 flags 00000007
sdhci [sdhci_send_command()]: Sending cmd (9)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (9)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (9)
mmc0: req done (CMD9): 0/0/0: 002f0132 5f5a83c2 b6dbdfff 9e800000
mmc0: starting CMD7 arg 00020000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (7)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (7)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (7)
mmc0: req done (CMD7): 0/0/0: 00000700 00000000 00000000 00000000
mmc0: clock 128906Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0
mmc0: starting CMD55 arg 00020000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (37)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (37)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 0/0/0: 00000920 00000000 00000000 00000000
mmc0: starting CMD51 arg 00000000 flags 00000035
sdhci [sdhci_send_command()]: Sending cmd (33)
sdhci [sdhci_prepare_data()]: blksz 0008 blks 0001 flags 00000200
sdhci [sdhci_prepare_data()]: tsac 100 ms nsac 0 clk
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (33)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000020
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_transfer_pio()]: PIO transfer complete.
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000002
sdhci [sdhci_finish_data()]: Ending data transfer (8 bytes)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (33)
mmc0: req done (CMD51): 0/0/0: 00000920 00000000 00000000 00000000
mmc0: starting CMD7 arg 00000000 flags 00000000
sdhci [sdhci_send_command()]: Sending cmd (7)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (7)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (7)
mmc0: req done (CMD7): 0/0/0: 00000000 00000000 00000000 00000000
mmc0: selected 25.000MHz transfer rate
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0
mmc0: starting CMD7 arg 00020000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (7)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (7)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (7)
mmc0: req done (CMD7): 0/0/0: 00000700 00000000 00000000 00000000
mmc0: starting CMD55 arg 00020000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (37)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (37)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (37)
mmc0: req done (CMD55): 0/0/0: 00000920 00000000 00000000 00000000
mmc0: starting CMD6 arg 00000002 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (6)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (6)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (6)
mmc0: req done (CMD6): 0/0/0: 00000920 00000000 00000000 00000000
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 2
mmc0: starting CMD16 arg 00000200 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (10)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (10)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (10)
mmc0: req done (CMD16): 0/0/0: 00000900 00000000 00000000 00000000
mmcblk0: mmc0:0002 SD 1971712KiB
mmcblk0:<7>mmc0: starting CMD18 arg 00000000 flags 00000035
sdhci [sdhci_send_command()]: Sending cmd (12)
sdhci [sdhci_prepare_data()]: blksz 0200 blks 0008 flags 00000a00
sdhci [sdhci_prepare_data()]: tsac 100 ms nsac 0 clk
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (12)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000020
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_read_block_pio()]: PIO reading
sdhci [sdhci_transfer_pio()]: PIO transfer complete.
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000022
sdhci [sdhci_finish_data()]: Ending data transfer (4096 bytes)
sdhci [sdhci_send_command()]: Sending cmd (c)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000003
sdhci [sdhci_finish_command()]: Ending cmd (c)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (12)
mmc0: req done (CMD18): 0/0/0: 00000900 00000000 00000000 00000000
mmc0: starting CMD13 arg 00020000 flags 00000015
sdhci [sdhci_send_command()]: Sending cmd (d)
sdhci [sdhci_irq()]: *** sdhci:slot0 got interrupt: 0x00000001
sdhci [sdhci_finish_command()]: Ending cmd (d)
sdhci [sdhci_tasklet_finish()]: Ending request, cmd (d)
mmc0: req done (CMD13): 0/0/0: 00000900 00000000 00000000 00000000
p1

When I attempt to mount the sd I don't get anything in dmesg. When I tied to use fdisk -l, I do not get the SD card.

Does anyone have any idea what's going on? Is there another forum with experts on MMC? Thanks.

Paul

ciotog 06-01-2007 06:19 PM

Are you using udev or devfs? If so, then the device nodes ought to be created automatically. You might need to add entries manually, so for example create a file in /etc/udev/rules.d called mmc-rules or something like so:
Code:

ACTION=="add" KERNEL=="mmcblk[0-9]p[0-9]", GROUP="floppy"
ACTION=="remove" KERNEL=="mmcblk[0-9]p[0-9]", GROUP="floppy"

Also try the following mount command:
Code:

mount -t auto -q sync /dev/mmcblk0p1 /mnt/flash

paulsiu 06-01-2007 09:22 PM

Hi Ciotog

I think it's udev since the kernel is 2.6.18. I did add the entries in udev but it did not cause the devices to show up in dev. The mount command you suggested return with the same error

paulsiu 06-04-2007 06:34 AM

It appears that while there is a udev directly in Puppy. Puppy does not use udev.

I figure out the problem though, I was off the device number by 1 digit. From what I can tell, the card was being mounted. So I double check /proc/partitions again after I inserted the SD card and notice that the device number is actually 253, so it's:

1. Insert the SD card.
2. run the commmand cat /proc/partitions. You should see the device mmcblk0 and mmcblk0p1 and a list of the device number.
3. Use the numebers listed to create the device. In my case:

mknod mmcblk0 b 253 0
mknod mmcblk0p1 b 253 1

4. Mount the device by:

mount /dev/mmcblk0p1 /mnt/flash

Remember to mount the mmcblk0p1 (partition) and not mmcblk0

Paul


All times are GMT -5. The time now is 05:46 PM.