OpenWrt Forum Archive

Topic: new release of package kmod-mmc-over-gpio

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

Hi,
The last release of package kmod-mmc-over-gpio depends on package kmod-spi-gpio-old. Why two releases ?
When I install the last package kmod-mmc-over-gpio and after setting /etc/config/mmc_over_gpio with good values for GPIO PIN (I have one WRT54GL v1.1 hacked with
MMC/SD Card Proto from MikroElectronika), I need to reboot my router.

Then after reboot I have always the following message :

gpio-mmc: Failed to request mmc_spi module
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
gpio-mmc: MMC-Card "default" attached to GPIO pins di=2, do=4, clk=3, cs=7
mmc_spi spi32766.0: can't change chip-select polarity

And no device is created on /dev. Even I unplug SD Card, after reboot, I have the same message.
here is the follwing lsmod listing :
Module                  Size  Used by    Not tainted
gpiommc                 4192  2
spi_gpio_old            3072  1 gpiommc
spi_gpio                3520  0
spi_bitbang             3328  2 spi_gpio_old,spi_gpio
mmc_spi                 7616  0
mmc_block               7024  0
mmc_core               36128  2 mmc_spi,mmc_block
nf_nat_tftp              416  0
nf_conntrack_tftp       2416  1 nf_nat_tftp
nf_nat_irc               896  0
nf_conntrack_irc        2784  1 nf_nat_irc
nf_nat_ftp              1440  0
nf_conntrack_ftp        5088  1 nf_nat_ftp
ipt_MASQUERADE          1120  2
iptable_nat             2896  1
nf_nat                 12192  5 nf_nat_tftp,nf_nat_irc,nf_nat_ftp,ipt_MASQUERADE,iptable_nat
xt_state                 832  6
nf_conntrack_ipv4       8128  9 iptable_nat,nf_nat
nf_defrag_ipv4           640  1 nf_conntrack_ipv4
nf_conntrack           43280  11 nf_nat_tftp,nf_conntrack_tftp,nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_conntrack_ftp,ipt_MASQUERADE,iptable_nat,nf_nat,xt_state,nf_conntrack_ipv4
ipt_REJECT              1952  2
xt_TCPMSS               2080  2
ipt_LOG                 4928  0
xt_multiport            1888  0
xt_mac                   544  0
xt_limit                1120  1
iptable_mangle          1120  0
iptable_filter           928  1
ip_tables               8240  3 iptable_nat,iptable_mangle,iptable_filter
xt_tcpudp               1920  4
x_tables                9328  11 ipt_MASQUERADE,iptable_nat,xt_state,ipt_REJECT,xt_TCPMSS,ipt_LOG,xt_multiport,xt_mac,xt_limit,ip_tables,xt_tcpudp
vfat                    8928  0
fat                    44176  1 vfat
ext3                  101008  0
jbd                    46624  1 ext3
ext2                   46224  0
b43legacy             105952  0
b43                   127488  0
nls_base                4480  2 vfat,fat
mac80211              201904  2 b43legacy,b43
cfg80211               56256  3 b43legacy,b43,mac80211
crc7                     704  1 mmc_spi
crc_itu_t                960  1 mmc_spi
arc4                     800  2
aes_generic            28496  0
deflate                 1504  0
hmac                    2720  0
ecb                     1376  2
cbc                     2144  0
crypto_hash             2624  1 hmac
cryptomgr              71056  0
crypto_blkcipher        7696  3 ecb,cbc,cryptomgr
aead                    3776  1 cryptomgr
crypto_algapi           9600  9 arc4,aes_generic,deflate,hmac,ecb,cbc,cryptomgr,crypto_blkcipher,aead
switch_robo             4192  0
switch_core             5184  1 switch_robo
diag                    7632  0

---------------------
I can see that module mmc-spi isn't used by any module. Is it normal at this point ?

Can you help me please ?

Hi,
I am using the last release of kamikaze and kernel 2.6. I needed to compile all the trunk.
I am installing all my packages modules in a particular order.
1) kmod-crc7, kmod-crc-itu-t
2) kmod-mmc
3) kmod-spi-bitbang
4) kmod-spi-gpio-old
5) kmod-mmc-over-gpio

Module                  Size  Used by    Not tainted
gpiommc               4192  2
spi_gpio_old         3072  1 gpiommc
spidev                   4816  0
spi_bitbang          3328  1 spi_gpio_old
mmc_spi               7616  0
mmc_block            7024  0
mmc_core             36128  2 mmc_spi,mmc_bloc

Then You have to configure /etc/config/mmc_over_gpio file like that :

config 'mmc_over_gpio'
        option 'name' 'default'
        option 'enabled' '1'
        option 'DI_pin' '4'
        option 'DO_pin' '2'
        option 'CLK_pin' '3'
        option 'CS_pin' '7'
        option 'mode' '3'

Warning : value for DI and DO depend on release of router. I have one WRT54GL v1.1 and also I have an inversion between pin 2 and 4.
You can set mode to 0. It's the SPI mode. It depends on release of Card Reader and SD Card (SD, MMC, low capacity storage and high capacity).

And just link for starting loading module at boot system :
# ln -s /etc/init.d/mmc_over_gpio /etc/rc.d/S90mmc_over_gpio

And reboot your system.

You can see that pins GPIO for di is 4 and for do is 2. It's not a mistake, just one inversion inside my SD Card Reader (MMC/SD ProtoCard).

Here is the following message at the end of boot system.

gpio-mmc: Failed to request mmc_spi module.
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
gpio-mmc: MMC-Card "default" attached to GPIO pins di=4, do=2, clk=3, cs=7
mmc_spi spi32766.0: can't change chip-select polarity
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 SD02G 1.83 GiB
mmcblk0: p1 p2 < p5 p6 >

I can't mount the partitions yet.
But I think that I am not fare from success.

Phil

I wish you good luck!
I am trying to do the same with 16MB sd, started yesterday.

It worked partially here. I'm using trunk r14911 and WRT54GL 1.1.
After /etc/init.d/mmc_over_gpio start
/mnt/mmcblk0p1 was mounted automaticly.

root@OpenWrt:~# mount
...
configfs on /config type configfs (rw)
/dev/mmcblk0p1 on /mnt/mmcblk0p1 type ext2 (rw,errors=continue)

But when I run after umount it:
e2fsck -p /dev/mmcblk0p1

CPU goes near 100% usage.
echo "0x9c" > /proc/diag/gpiomask
didn't work.

Using a SD/MMC card in kernel 2.4 was so easy. Too bad that for the kernel 2.6 things got complicated and no docs.

I changed card to 64MB MMC Mobile.
now it works on various kamikaze versions.
imho problem might be in spi driver or spi mode possibility in specific card.

in 8.09 2.6.25-17 I can get /dev/mmcblk0p1 in 3 steps:
vi /etc/init.d/mmc_over_gpio and change DI value from 5 to2
echo 0x9c > /proc/diag/gpiomask
/etc/init.d/mmc_over_gpio start

problems:
I can format and mount only ext3, ext2 dont work.
impossible to use card and wireless simultaneously - wireless driver takes control over GPIOs.

No SD card on kernel 2.6 (broadcom?)
Bugged port forward on 2.4 (https://dev.openwrt.org/ticket/2558)

Houston we have a problem.

(Last edited by Jakabin on 21 Mar 2009, 13:39)

Tested with:
KAMIKAZE trunk(r15041)
root@OpenWrt:~# uname -r
2.6.28.9

and still same problem

root@OpenWrt:~# e2fsck -p /dev/mmcblk0p1
/dev/mmcblk0p1 was not cleanly unmounted, check forced.

in another ssh session:
root@OpenWrt:~# top
Mem: 12992K used, 716K free, 0K shrd, 4708K buff, 1656K cached
CPU:   0% usr  97% sys   0% nice   0% idle   0% io   0% irq   2% softirq
Load average: 3.03 2.07 0.95
  PID  PPID USER     STAT   VSZ %MEM %CPU COMMAND
1011     2 root     SW<      0   0%  97% [spi-gpio.0]
1016     2 root     RW<      0   0%   1% [mmcqd]
...

at least this this time package kmod-mmc-over-gpio_2.6.28.9-brcm47xx-1_mipsel.ipk was create.

I was try it on SVN snapshot r15361
Situation still without change it is not work.

SD card is detected including partition, but is not possible to use it

jdobry wrote:

I was try it on SVN snapshot r15361
Situation still without change it is not work.

SD card is detected including partition, but is not possible to use it

LOL. I'm not surprised at all. On IRC, IIRC someone said that the author of the mmc-over-gpio driver isn't interesting in bug fixing anymore...

Good luck or buy a router with USB...

I have some news!

Good new: it works!! (on my hw Buffalo WHR-G54S)

Bad news:
- you must make own compilation. One of problems is conflict on signal from button. You must disable kmod-diag module
- e2fsprog not works on this platform. I don't know why, but you can try it on file (dd if=/dev/zero of=/tmp/test bs=1M count=1 && mkfs.ext3 /tmp/test) <- this test newer end, it looks like bug
- current driver SW is slow, realy slow around 100KB/s or less, usualy 50KB/s

PS: I have another HW with USB (asus WL-500gx)

(Last edited by jdobry on 24 Apr 2009, 22:21)

I also confirm, in Buffalo whr-g54s work with 8GB SDHC smile

But if wirless is enable, then isn't work hmm
I try disable kmod-diag, but it posible disable gpio in b43 driver? http://bcm-specs.sipsolutions.net/GPIO

(Last edited by wieszti on 24 Apr 2009, 22:40)

i have b43 enabled and its works.
What you thing about slow speed? I was try to use reiserfs and mount take something over 20 minutes (512MB SD)

I think the best will be ext2 (simple filesystem, without jurnalig etc. = fast filesystem) and mount with noatime option, this also smallest wear sdcard

   
Which gpio pins you use to sd-mod?

(Last edited by wieszti on 25 Apr 2009, 00:18)

wieszti wrote:

Which gpio pins you use to sd-mod?

option 'DI_pin' '6'
option 'DO_pin' '5'
option 'CLK_pin' '3'
option 'CS_pin' '1'

so if i wanna make an image should i get rid of kmod-diag? or is it b43's fault?

I'd guess it's more b43s fault.

jdobry wrote:
wieszti wrote:

Which gpio pins you use to sd-mod?

option 'DI_pin' '6'
option 'DO_pin' '5'
option 'CLK_pin' '3'
option 'CS_pin' '1'

I have the same GPIO pins, but not work for me with wireless sad https://dev.openwrt.org/ticket/5153

The discussion might have continued from here.