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 Cyril!

Cyril wrote:

For the news:
Here is the source of a 1.3.5 version that searches at runtime for GPIO addresses specific to each router.
Would you please test it and report me if it crashes like the 1.3.4 ?
If not, please output the dmesg and I will finalize the version for tomorrow.
source of 1.3.5 work
Cyril

Great! I hurried to test it and it loaded with no compaints!

After the last tests i have the wiring a bit messed, I am going right now to rework it, but the food thing is that it loaded, and this is the output:

[INFO] mmc_init: GPIO input addr: b8007060
[INFO] mmc_init: GPIO output addr: b8007064
[INFO] mmc_init: GPIO output enable addr: b8007068
[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 218 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 18778 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 218 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 18646 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


AGAIN: My wiring is wrong at this time, just wanted to check if it was loading. I rework wiring and test again smile

Thanks!!

Thanks for your quick reply.

So, we have found GPIO registers.

You can rewire your SD card but It shouldn't work as this version lacks specificities you spotted out :
1<<24 and reverting output. Maybe you can try to hack it?

Anyway I will do it ASAP.

See ya.

[EDIT]
Question:

Yours: [INFO] mmc_card_init: the period of a 380KHz frequency lasts 218 CPU cycles
Mine : [INFO] mmc_card_init: the period of a 380KHz frequency lasts 628 CPU cycles

What is the clock speed of your CPU ? It smells like a problem in my calculations ...

(Last edited by Cyril on 27 Mar 2007, 07:58)

Cyril wrote:

You can rewire your SD card but It shouldn't work as this version lacks specificities you spotted out :
1<<24 and reverting output. Maybe you can try to hack it?

Yours: [INFO] mmc_card_init: the period of a 380KHz frequency lasts 218 CPU cycles
Mine : [INFO] mmc_card_init: the period of a 380KHz frequency lasts 628 CPU cycles

What is the clock speed of your CPU ? It smells like a problem in my calculations ...

I dont think i will be able to do the modification, at least not without lots of time and tests since I am not even sure to understand the differences. I can check with gpio utility which is the default polarity for each gpio. But I dont yet understand how this works. I know very little C, and for sure not structs nor bit maskings (dont even tell me about pointers tongue ). Anyway, if there is anything It is on my hand to try just tell me and I will do my best. I really would love to finally have SD card working on my old router smile

I dont think there is anything wrong in your calculations as v1.0 has a 125MHZ CPU:

system type             : Broadcom BCM947XX
processor               : 0
cpu model               : BCM4710 V0.0
BogoMIPS                : 82.94
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : no
hardware watchpoint     : no
VCED exceptions         : not available
VCEI exceptions         : not available

It is the original model with the wireless card in a minipci socket.

Mmm, now that I reread.... I assume your router is a 200mhz one, I dont know why such big difference in cpu cycles...

Is there anything more i can test?

Thanks!

er, is there anything new on the great new driver these days?

The only thing that would fancy me would be a kernel 2.6 driver :weeps:

Good work on this BTW...hope we can port it soon and get optimized speeds!

does kernel 2.6 fit to run on a broadcom router with 16MB ram?

(Last edited by jnjn on 1 Apr 2007, 11:43)

jnjn,

Yes it does but the broadcom platform isn't too interesting for kamikaze with kernel 2.6. Mainly the wireless drivers are for 2.4 .

However, there are many atheros and new platforms supported in kamikaze with madwifi. Cheers!

Hi Cyril, thanks for you work on this crucial driver for us people looking for affordable ways of having a little server :)

I tried 1.3.4 it didnt load the card

1.3.3 got me further.

im trying to get the things up manually so after boot i do a:
echo "0x9c" > /proc/diag/gpiomask
(the dmz led of my wrt54gl starts blinking)

then insmod mmc (1.3):
[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
[ERROR] mmc_card_init: card not successfully inited after 30000 tries.
[ERROR] mmc_init: got an error calling mmc_card_init: 02
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

i have tried with >30000 tries and the command just stays in the loading loop forever.

it is a 2gig SD card labeled Trascend. im using rc9 white russian.

i have manage to load the card with this driver: http://www.halbundhalb.net/mmc/mmc.co

it recognizes the card and mounts it as vfat, i manage to copy filez to it but after 2 o3 minutes things just dissapear from the dir in /mnt/sd/ or it just blocks the whole systema allowing only pings to it.

oke, please let me know if i can provide more info and do advice on how to be sure that cabling is fine or similar basic things that might be stopping the mod from working well.

tx!
/a

(Last edited by alej00d on 7 Apr 2007, 02:38)

Please, can somebody port this driver to the 2.6 kernel?

Are you realy sure you are writing on such high speed? I think you have a buffer with your ram memory!
Just do the test with a big file and see what happens then...

lospiratos wrote:

Are you realy sure you are writing on such high speed? I think you have a buffer with your ram memory!
Just do the test with a big file and see what happens then...

Man, I am a programmer. I am doing programming every day - this my job.
Please don't give me advices like this.
My test was done with a 32MB file with "syncing" the filesystem.

Bye.

I'm sorry, do you have plans to port the driver to the 2.6 kernel?

jnjn wrote:

does kernel 2.6 fit to run on a broadcom router with 16MB ram?

yes, linux 2.6 can easily work on 16mb ram

hi @ all

i am in trouble with my mmc-card inside the router. today, i soldered an mmc-card into my wrt54gl. i soldered the cables from the wrt-mainboard directly to my 8MB mmc card. (8MB is enough for me, i need it only for something to try).

i am using your optimized mmc.o. first, all is going on to work properly, but now it doesn't recognise the partitions on the card. first i had the /dev/mmc/disc0/part1 device, then i tried to format the card with mkfs.ext2, but the router freezed while formatting (why this?)...
i made a reboot of the wrt(power chord in and out), and now it does not recognize any partitions on the card, i have the following error:

 
[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
[INFO] mmc_card_init: card inited successfully in 4 tries (0 seconds 70598 usec).
[INFO] mmc_init: MMC/SD Card ID:
06 00 00 33 32 4d 20 20 20 01 19 c0 cf 03 96 d9
Manufacturer : 32M   , cardUID = 3cfc019
[INFO] mmc_card_config: size = 31360, hardsectsize = 512, sectors = 62720
[WARN] mmc_init: hd_sizes=31360, hd[0].nr_sects=62720
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
Partition check:
 mmca:[ERROR] mmc_request: read error: 03

i have to repartitioning the mmc-card maybe, but i can not put it into my card-reader, because the wires are soldered directly from the wrt on the card....

is there any possibility to solve that problem ? when there is no possibility i need to unsolder the wires from the mmc-card, to repartition it with the help of my PC

(and sorry for my not so good english wink - and a big "thanks" to the "OpenWrt"-Team and the "DD-WRT"-Team) , i am an autrian)

tranks
fabian f.

maybe you can do it with the router?
and, i guess you may try the old driver to see if it makes any change first.

with the old driver i have the same issue...

i have also checked the wires, nothing wrong.

i also think that this is a software problem. hardware is recognized, but only "/dev/mmc/disc0/disc"-device-node is there. "/dev/mmc/disc0/part1" is missing there...

greets
fabian f.

(Last edited by fabifri on 17 Apr 2007, 17:26)

i have a piece of broken card, which the parameters can be read, but cannot read/write data.
however, you can try to partition the card with the router. maybe you can try that linux fdisk utility?

this was my first idea, after i realised that the card was broken. but i need an fdisk packet for whiterussian...

i habve xwrt, backports and official packets, but there is no fdisk.

i will try to unsolder the card, and partition it with my ubuntu linux. i hope this works.

greets fabi

After doing the mmc mod (gpio2), isn't possible to turn on/off the cisco button? (or maybe modify the mmc code to use only orange led and leave the white led for general uses). I've also noticed that i have only power and wlan in /proc/diag/led   didn't remember.

Any info?

(Last edited by michelinok76 on 25 Apr 2007, 18:45)

Salut Cyril,

just tried version 1.3.4 with an EMTEC (basf) 2Gb & and Panasonic 16Mb, and I get the following message on my wrt54G v2 GPIO5.


[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 43511 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 43160 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


using the original old GPIO5 works with the 16 mb card (not 2gb...) from http://www.frontiernet.net/~beakmyn/openwrt/mmc/GPIO5/Old

Any ideas?

=>Edit: Now I even don't get the 16 Mb card workign with this driver... wondering how I did it!? sad

=>Edit: The issue was with the floppy SD connector, which doesn't work well when I push the card till the end => connection issue.


Merci!
migube


[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 43509 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 2207 tries (67457319 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
27 50 48 53 44 30 32 47 20 b0 00 47 da 00 73 ad [INFO] Manufacturer ID   : 27
[INFO] OEM/Application ID: PH
[INFO] Product name      : SD02G
[INFO] Product revision  : 2.0
[INFO] Product SN        : b00047da
[INFO] Product Date      : 2007-3
[INFO] mmc_card_config: size = 1992704, hardsectsize = 1024, sectors = 1992704
[WARN] mmc_init: hd_sizes=1992704, hd[0].nr_sects=3985408
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
Partition check:
mmca: p1

=>edit:
I have the same issue with soft reboot as noticed by others. All lights are on & power&dmz blink. I have to swtich off power to reaccess it.

Any idea on how to solve this?

thx!

(Last edited by migube on 1 May 2007, 21:01)

Hi!!

I have done the "hack" in order to havean SDCard on my WRT54GL v1.1 (to install Proxy, and content filtering system on it)
So I solder as explain here:
http://www.the-mesh.org/tiki-index.php?page=LinksysSDCard

I download the mmc.o module a place it in /lib/modules/2.4.30/
Reboot my LinkSys, and got some error in dmesg

[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 44145 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 43763 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

Tried GPIO2 and GPIO5 modules, nothing change (Which one will I use ?)
I have a 512Mo Integral SDcard

Thanks in advance

Gauthier from France

Hi !

migube wrote:

=>Edit: The issue was with the floppy SD connector, which doesn't work well when I push the card till the end => connection issue.

The same problem i have had. I solved it by cutting a 1mm thick line and stick it in the floppy connector. Now I am not abel to insert the card too deep.

migube wrote:

=>edit:
I have the same issue with soft reboot as noticed by others. All lights are on & power&dmz blink. I have to swtich off power to reaccess it.

Any idea on how to solve this?

As I stated before, it has something to do how the safe mode is enabled in white russian (don't know if the problem exists in kamikaze).

When you insert the mmc.o you have to to set the gpiomask so that router is not looping it's self due to button hotplug request by diag.o directed to hotplug helper.

When you reboot after using mmc.o the gpiomask is reset. Hotplug events are  issued, because the mmc card seems to be still active. /etc/preinit so thinks the reset button or something else was pressed an goes in to failsafe.

If you do a soft reboot and unplug the card, shortly after issuing the reboot this will not happen.

So if anyhow the driver will make the card quiet (disable it) before reboot, this problem is solved.

cya

Hi,

Yep it was the problem!
I solder directly on the SDCard and it finally works wink

Now I will try to install some package on it wink

thanks abraXxl,

Cyril stp,
any way of disabling the card in the driver when the system reboots, or rmmod mmc ?

thx

hie

Can we hope to have a driver in future for 8 or 16Go SDcard ?

Sorry, posts 76 to 75 are missing from our archive.