OpenWrt Forum Archive

Topic: Optimized version of mmc.c

The content of this topic has been archived between 5 Jun 2014 and 7 Mar 2018. Unfortunately there are posts – most likely complete pages – missing.

Hi there,

I am getting the exact same error off the exact same build and router.  I have a WRT54GL v1.1 and installed kamikaze 8.09 kernel 2.4.35.4.  I ran the following:

-cd /lib/modules/2.4.35.4/
-wget http://programmingstuff.free.fr/files/openwrt/whiterussian/mmc/1_3_4/gpio2/mmc.o
-opkg update
-opkg install kmod-fs-ext2

I then did an ls to see what I was looking at and these are what are installed:

root@OpenWrt:/lib/modules/2.4.35.4# ls
diag.o               ipt_REJECT.o         ppp_generic.o
ext2.o               ipt_TCPMSS.o         pppoe.o
ip_conntrack.o       ipt_limit.o          pppox.o
ip_conntrack_ftp.o   ipt_mac.o            slhc.o
ip_conntrack_irc.o   ipt_multiport.o      switch-adm.o
ip_conntrack_tftp.o  ipt_state.o          switch-core.o
ip_nat_ftp.o         iptable_filter.o     switch-robo.o
ip_nat_irc.o         iptable_mangle.o     wl.o
ip_tables.o          iptable_nat.o        wlcompat.o
ipt_LOG.o            mmc.o
ipt_MASQUERADE.o     ppp_async.o

I then ran:
-mkdir /mmc
-echo "0x9c" > /proc/diag/gpiomask
-insmod mmc

I checked and then there wasn't an mmc in /dev, so I ran dmesg and got the following:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43656 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43323 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

Any ideas what can be causing this?

Thanks in advance!

Spencer

To me is CPU cycles problem, but this driver must be converted to 2.6 kernel.
Now i solved this buying a router with usb ports.

slthomason wrote:

Hi there,

I am getting the exact same error off the exact same build and router.  I have a WRT54GL v1.1 and installed kamikaze 8.09 kernel 2.4.35.4.  I ran the following:

-cd /lib/modules/2.4.35.4/
-wget http://programmingstuff.free.fr/files/openwrt/whiterussian/mmc/1_3_4/gpio2/mmc.o
-opkg update
-opkg install kmod-fs-ext2

I then did an ls to see what I was looking at and these are what are installed:

root@OpenWrt:/lib/modules/2.4.35.4# ls
diag.o               ipt_REJECT.o         ppp_generic.o
ext2.o               ipt_TCPMSS.o         pppoe.o
ip_conntrack.o       ipt_limit.o          pppox.o
ip_conntrack_ftp.o   ipt_mac.o            slhc.o
ip_conntrack_irc.o   ipt_multiport.o      switch-adm.o
ip_conntrack_tftp.o  ipt_state.o          switch-core.o
ip_nat_ftp.o         iptable_filter.o     switch-robo.o
ip_nat_irc.o         iptable_mangle.o     wl.o
ip_tables.o          iptable_nat.o        wlcompat.o
ipt_LOG.o            mmc.o
ipt_MASQUERADE.o     ppp_async.o

I then ran:
-mkdir /mmc
-echo "0x9c" > /proc/diag/gpiomask
-insmod mmc

I checked and then there wasn't an mmc in /dev, so I ran dmesg and got the following:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43656 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43323 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

Any ideas what can be causing this?

Thanks in advance!

Spencer

opensys wrote:

To me is CPU cycles problem, but this driver must be converted to 2.6 kernel.

Any idea where to go with a "CPU cycles problem?"  Also, why would it need to be convered to 2.6 kernel.  I am using the 2.4 kernel .....

opensys wrote:

Now i solved this buying a router with usb ports.

For what I am trying to achieve, I need to use the WRT54GL, and there are lots of people who have gotten SD cards mounted with a WRT54GL .... so I should be able to pull it off.

Any hints in what direction to try would be greatly appreciated.

Spencer

The messages seams that he can not make the correct sync with the card, the cpu speed maybe its the problem.

I have 3 wrt54gl and one wrt54g all with mmc card hacks, white Russian works good, kamikaze 8.09 not.
Change from the 2.4 to 2.6 is the future, but yes 2.6 kernel need more space then 2.4.
This driver works very good, and have good rw speed.
the openwrt is working on a mmc driver, only fonera work fine, all other not work, or work very bad.
ex: broadcom 2.6, detect ok, mount ok, but when RW in the card he freeze the router, he get a kernel panic by low memory.

slthomason wrote:
opensys wrote:

To me is CPU cycles problem, but this driver must be converted to 2.6 kernel.

Any idea where to go with a "CPU cycles problem?"  Also, why would it need to be convered to 2.6 kernel.  I am using the 2.4 kernel .....

opensys wrote:

Now i solved this buying a router with usb ports.

For what I am trying to achieve, I need to use the WRT54GL, and there are lots of people who have gotten SD cards mounted with a WRT54GL .... so I should be able to pull it off.

Any hints in what direction to try would be greatly appreciated.

Spencer

opensys wrote:

I have 3 wrt54gl and one wrt54g all with mmc card hacks, white Russian works good, kamikaze 8.09 not.
Change from the 2.4 to 2.6 is the future, but yes 2.6 kernel need more space then 2.4.
This driver works very good, and have good rw speed.
the openwrt is working on a mmc driver, only fonera work fine, all other not work, or work very bad.
ex: broadcom 2.6, detect ok, mount ok, but when RW in the card he freeze the router, he get a kernel panic by low memory.

So your recommendation is to go back to White Russian to get this to work?  Are you seeing this with all cards?  Or just some?  I am currently trying this with a Kingston 2GB MicroSD.  I soldered to the SD adapter .... could something in that be the problem?  I am going to try and go get a different card today to try ...

Spencer

Okay - so I ran out to Walmart and got a new MicroSD card.  This is a Sandisk 2GB.  Plugged it in, recycled the router (to clear out the other stuff since I don't have the driver being loaded at startup), and loaded the "optimized version of mmc.o (beginning of this post, used version 1.3.4, GPIO2) into temp, and ran "insmod mmc.o".  This is the "dmesg | grep mmc" after:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43646 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 460 tries (14190890 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
[INFO] mmc_card_config: size = 1931264, hardsectsize = 1024, sectors = 1931264
[WARN] mmc_init: hd_sizes=1931264, hd[0].nr_sects=3862528
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
mmca: p1

I checked /dev and it can see the card.

So I went back into the WebUI and enabled the WebUI, set MMC device to enable, set GPIO pins select to Manual --> DI: 2  D0: 4  CLK: 3  CS:  7 and setting JFFS2 Support to enabled, Clean JFFS2 to disabled.  I rebooted the router, and it rebooted a few times, with the both LEDs / flashing.  It settled in after a little bit (5-10 minutes) with the Orange LED set, and then showing the Total / Free Size as 2,816.00 KB / 0 --> which we all know means it isn't working (especially since it is only a 2 GB card).  After rebooting the, dmesg | grep mmc showed:

root@DD-WRT:~# dmesg |grep mmc
mmc: starting module with: SD_DI=0x4, SD_DO=0x10, SD_CLK=0x8, SD_CS=0x80
mmc: this board has no MMC mod installed!
mmc: error in mmc_init (-1)

Which seems really odd to me what pins it is showing.  Is it just me ... Or are these not what I set in the UI (UI still shows the DI: 2  D0: 4  CLK: 3  CS:  7)?

So I set the MMC Device to disabled, but left the JFFS2 to enabled and rebooted the router.  After it came back up I did the following:

-SCP'd into the box and copied the optimized mmc.o up to /tmp.  I can not get wget to work on DD-WRT (have no idea why).
-telneted into the box and did "rm mmc.o" from the /lib/modules/2.4.36 directory.  It prompted, and I said y.  However, after I did an ls it still shows in the directory.  Not sure why it wouldn't remove.
-I then changed the directory to /tmp and checked that the uploaded mmc.o was there - it was.  So from /tmp I ran mmc.o.
-I then ran dmesg again, and got this:
[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43646 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43271 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

After wanting to throw the computer, the router, and every other inanimate object out the window .... I:
-rebooted the router (from the command line),
-checked the dmesg to ensure there wasn't anything there. 
-I then went back into the WebUI and turned the JFFS2 to disabled, still leaving the MMC disabled in the WebUI, saved and rebooted.
-I uploaded the optimized mmc.o to /tmp.
-I telneted into the box, checked that the mmc.o was there, then ran "insmod mmc.o"
-ran dmesg, and same output as above (the errorring one).

Really ready to throw the thing, I went back to the unit, checked my solders, then figured I would cycle it by unplugging and replugging in the power.  So I did that.
-I then uploaded the mmc.o to /tmp.
-telneted into it and from /tmp ran "insmod mmc.o".
-dmesg | grep mmc shows:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43649 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 531 tries (16381213 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
[INFO] mmc_card_config: size = 1931264, hardsectsize = 1024, sectors = 1931264
[WARN] mmc_init: hd_sizes=1931264, hd[0].nr_sects=3862528
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
mmca: p1

So .... I know this has been REALLY long .... but I have a couple of questions:
-First, any idea for this behavior?  First why the optimized mmc.o from this works, but the one that the GUI is trying to load from the kernel is bombing?
-Next, why the mmc.o file from the /lib/modules/2.4.36/ can't be removed?
-Why wget doesn't work in DD-WRT?
-How I should go about getting this to mount so I don't have to do this every time I have to reboot ....

Thanks!

Spencer

I tried a test with a multimeter on the pin (4 and 2) i noticed that the gpio 4 and 2 are like shortcutted... cause both turn on/off the white led on my wrt54gl v1.1 is it normal? it's trivial that the sd mod doesn't work for me smile
Any help?

I found maybe a solution... here:
http://nil-techno.blogspot.com/2008/07/ … 5673494175
i'll try it asap..

(Last edited by eidos on 15 Jun 2009, 23:14)

So.... I have the same issue.

I'm convinced the card connections are right - this card has been used successfully prior to upgrading to 8.09 kamikaze.

My first driver load attempt appeared successful:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43643 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 195 tries (6015626 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
27 50 48 53 44 35 31 32 11 e5 40 02 07 00 69 81 [INFO] Manufacturer ID   : 27
[INFO] OEM/Application ID: PH
[INFO] Product name      : SD512
[INFO] Product revision  : 1.1
[INFO] Product SN        : e5400207
[INFO] Product Date      : 2006-9
[INFO] mmc_card_config: size = 497152, hardsectsize = 512, sectors = 994304
[WARN] mmc_init: hd_sizes=497152, hd[0].nr_sects=994304
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
Partition check:
mmca: p1

the mmc appeared in /dev/ - for whatever reason, after loading the filesystem drivers and attempting to mount, all attempts to use the mmc fail.

Even subsequent attempts to load the driver now fail with that error:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43643 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43324 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

Thanks to everyone who helped us get this far smile

(Last edited by deathazre on 5 Jul 2009, 16:31)

Wow super fast transfer rates... Now I can copy files faster than ever. Thanks for the info...

Ryan D
banner design

Get a router with USB if you need extra storage...

the new package broadcom-sdhc is meant to replace the outdated broadcom-mmc driver for brcm-2.4 in trunk. Please try it. It's an enhanced version of the broadcom-mmc version 1.3.5 module.
See https://forum.openwrt.org/viewtopic.php?pid=100795#p100795

.. bud

Hi all,

yet another success story with WRT54GL v1.1 and Kamikaze 8.09.2, r18961 (2.4.35.4 linux kernel) and the 1.3.4 driver, using GPIO 2 = DI, 4 = DO, 3 = CLK and 7 = CS:

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43646 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 2 tries (61580 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
28 42 45 42 34 39 38 33 10 00 00 f0 e2 00 5c 03 [INFO] Manufacturer ID   : 28
[INFO] OEM/Application ID: BE
[INFO] Product name      : B4983
[INFO] Product revision  : 1.0
[INFO] Product SN        : 0000f0e2
[INFO] Product Date      : 2005-12
[INFO] mmc_card_config: size = 249856, hardsectsize = 512, sectors = 499712
[WARN] mmc_init: hd_sizes=249856, hd[0].nr_sects=499712
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
Partition check:
mmca: p1

I also found the following links quite helpful:
1. http://beta.ivc.no/wiki/index.php/Adding_SD_card_to_WRT54GL - great description with various pinouts, also pointing to these enhanced drivers
2. http://www.hendlsofen.de/WRT54GL/eng/WRT54GL_main.html - very nice step-by-step type instructions, especially for mounting the SD-card as root

I have a 256 MB microSD card with ext2 partition. I soldered the wires to the microSD card adaptor, instead of directly to the microSD card, so I used the SD card pinout. This made soldering a lot easier for me, as it is much larger - yet, I still got it wrong on the first attempt. If you are seeing this error:

[FATAL] mmc_card_init: invalid response from card: 00 found, waiting for 01

it may very well be that you are having a similar problem like I had - my GPIO 4 was apparently shorted to ground. So in my case it was a soldering / wiring problem.

Hope this may help someone.

Many thanks to Cyril for his great work !

Kind Regards

I have a 8 GB card and WRT54GL V1.1 with OpenWrt kernel 2.4

when I boot the card is installed nearly ok, second part mean mounting not

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[ERROR] mmc_card_init: card not successfully inited after 30000 tries.
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 7207 tries (118 seconds -351182 usec).
[WARN] mmc_init: impossible to get card indentification info for reason code: 02
[ERROR] mmc_init: got an error when trying to get card configuration registers: 02
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

When I rmmod mmc and istmod mmc do then

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43657 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43309 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

has some any idea what I can do?
I need the space for my own HTML and co.

Will this version recognize the GPIO layout in the Buffalo WHR-HP-G54??? I've been trying and trying to get anything, a nice generic SP3 would be nice. I'm bad at compiling and scripting though cell phone tracker

(Last edited by McKein on 11 Apr 2012, 07:05)

The discussion might have continued from here.