OpenWrt Forum Archive

Topic: Problems with SD-card/MMC-driver on Fonera.

The content of this topic has been archived on 11 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I just added a SD-card to my fonera and patched openwrt with the patches in https://dev.openwrt.org/ticket/1861

And I've been somewhat successful, the card is detected and I could read data from it, so the hardware appears to work.
BUT when I try to run fdisk to repartition the card I only get errors (see below).

Does anyone recognize what might be wrong?

And a more general question: where can I find information about what "error -51" and "error -22" stands for?

mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
spi-gpio-mmc: MMC-Card "fonera" attached to GPIO pins 1,3,4,7
mmc_spi spi32766.0: can't change chip-select polarity
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 SD01G 992000KiB
root@OpenWrt:/tmp# fdisk /dev/mmcblk0 
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 0
Buffer I/O error on device mmcblk0, logical block 0
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 8
Buffer I/O error on device mmcblk0, logical block 1
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 16
Buffer I/O error on device mmcblk0, logical block 2
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 24
Buffer I/O error on device mmcblk0, logical block 3
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 0
Buffer I/O error on device mmcblk0, logical block 0
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 1983992
Buffer I/O error on device mmcblk0, logical block 247999
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 1983992
Buffer I/O error on device mmcblk0, logical block 247999
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 0
Buffer I/O error on device mmcblk0, logical block 0
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 8
Buffer I/O error on device mmcblk0, logical block 1
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 16
Buffer I/O error on device mmcblk0, logical block 2
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 24
mmcblk0: error -22 sending read/write command
end_request: I/O error, dev mmcblk0, sector 0

Unable to read /dev/mmcblk0
root@OpenWrt:/tmp#

I put the SD-card in my other linux computer and partitioned the card the way I wanted, then I put it back in the Fonera and was able to format, mount and use the card without any problem at all, so the hardware is correct. But as soon as I try to use fdisk on it, things go wrong and I can't use the card at all anymore until I reboot the Fonera.

My conclution is that it's the mmc_over_gpio driver that does not work 100% with my Sandisk 1GB card. sad
And it is the following error message that is the important one, all errors after this one is just symptoms of the original error:

mmcblk0: error -51 sending stop command
end_request: I/O error, dev mmcblk0, sector 1983992
Buffer I/O error on device mmcblk0, logical block 247999

The discussion might have continued from here.