Modify

Opened 11 years ago

Closed 5 years ago

Last modified 4 years ago

#2185 closed enhancement (fixed)

SD/MMC Driver for 2.6 kernel

Reported by: anonymous Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: mmc sd hack 2.6 Cc:

Description

Hi guys,
after googling around, watching forums, reading people opinion, maded a lot of tests i'd like to ask you if is there anyone trying to port MMC/SD hack to Kamikaze 2.6 kernel.
I've seen some ports for LaFonera, something from dd-wrt but nothing generic for broadcom 2.6.
I've even tried to port something from dd-wrt (already has one module) and from specific fonera adapted module but with no luck. Fonera module compiled fine but got some troubles with current svn kernel when loading up with insmod, dd-wrt module cannot be compiled at all (by me)
Is there anyone interested in adding mmc-driver package to 2.6 kernel image ?
I'd like to compile it by my own in order to use some custom SD GPIOs hacks but it's not currently possible
I'd like to help and test your suggestions if needed but i've no clue where to start


Thank you in advance for your reply
Ben

Attachments (0)

Change History (13)

comment:1 in reply to: ↑ description Changed 10 years ago by Chris.Krusch@…

I've been doing some work on the optimized mmc driver in kamikaze 2.4 - adding high capacity card support, allow gpio pins to be set by kernel parameters, increasing performance by implementing clustered io. Still have a bit of work left, but when finished and published will try and get it operational on the 2.6 kernel as well...

I'll post again when I get there...

Replying to anonymous:

Hi guys,
after googling around, watching forums, reading people opinion, maded a lot of tests i'd like to ask you if is there anyone trying to port MMC/SD hack to Kamikaze 2.6 kernel.
I've seen some ports for LaFonera, something from dd-wrt but nothing generic for broadcom 2.6.
I've even tried to port something from dd-wrt (already has one module) and from specific fonera adapted module but with no luck. Fonera module compiled fine but got some troubles with current svn kernel when loading up with insmod, dd-wrt module cannot be compiled at all (by me)
Is there anyone interested in adding mmc-driver package to 2.6 kernel image ?
I'd like to compile it by my own in order to use some custom SD GPIOs hacks but it's not currently possible
I'd like to help and test your suggestions if needed but i've no clue where to start


Thank you in advance for your reply
Ben

comment:2 in reply to: ↑ description Changed 10 years ago by anonymous

Replying to anonymous:

Hi guys,
after googling around, watching forums, reading people opinion, maded a lot of tests i'd like to ask you if is there anyone trying to port MMC/SD hack to Kamikaze 2.6 kernel.
I've seen some ports for LaFonera, something from dd-wrt but nothing generic for broadcom 2.6.
I've even tried to port something from dd-wrt (already has one module) and from specific fonera adapted module but with no luck. Fonera module compiled fine but got some troubles with current svn kernel when loading up with insmod, dd-wrt module cannot be compiled at all (by me)
Is there anyone interested in adding mmc-driver package to 2.6 kernel image ?
I'd like to compile it by my own in order to use some custom SD GPIOs hacks but it's not currently possible
I'd like to help and test your suggestions if needed but i've no clue where to start


Thank you in advance for your reply
Ben

comment:3 Changed 10 years ago by Chris Krusch

I'm very close to starting work on a version for the 2.6 kernel...

I've completed the next generation 2.4 driver and will begin work on porting it to the 2.6 kernel soon (in a few weeks).

It supports SDHC cards (works great with my sandisk 4gb SDHC card), and let's you set the GPIO's via kernel module parameters. It also implements clustering of requests as well, so even though GPIO's are set dynamically, it's slightly faster than the version 1 optimized driver where they are compiled in. Details of all the changes can be found in the doc at the top of the mmc.c file and in the README.

I need to complete some doc before I post info about the driver on the opwenwrt wiki, but at this point, anyone is welcome to play with it...

Go to http://4mul8.ca/openwrt to get the source and/or package to install... It was built for the latest version of kamikaze...

To install/use the package:

1) Install support for FAT filesystem
2) Download the ipkg from above url into /tmp and install.
3) Edit /etc/mmc.conf and set your gpio mappings - change other settings if necessary (e.g. partition number and mount point).
4) Plug in your card and try the following:
/etc/init.d/mmc start <-- Will tell you if card was successfully detected and mounted
/etc/init.d/mmc status <-- Will list card details if one was detected
/etc/init.d/mmc test <-- Will run a read/write test
/etc/init.d/mmc stop <-- Unmounts card and shuts down driver so you can remove it.

If no card is detected, set dbg=1 to turn on card initialization debugging, then try again (do a logread to see the debugging output).

Use at your own risk...

Have fun...

comment:4 Changed 9 years ago by vorkachev

Hello, Cris. Will we see any updates on your driver? I can't use it with sd >4Gb. I'd like may be to rewrite it, but firstly I want you to consult me a bit if it is possibe

comment:5 Changed 9 years ago by Chris.Krusch@…

I haven't touched it since posting - you're the first one to query or contact me about it...

Send me details about where it's failing and we'll see if it can be resolved. If it's failing at card initialization, turn on card initialization debugging (dbg=1) and send the output in the logs.

I only had one 4GB PNY SDHC card, and a few non-SDHC cards to test with, so issues with other manufacturers and bigger SDHC cards were bound to surface.

I can be reached at Chris.Krusch@… if you want to discuss the driver or try to debug the problem with your 8Gb card..

The time I had hoped to find to port to 2.6 never surfaced, but:

FYI - there are now modules in the kamikaze development trunk for the 2.6 kernel to do mmc via gpio pins - see the kmod-mmc-spi and kmod-spi-gpio modules and doc. These may roll out in the upcoming kamikaze 8.08 release

comment:6 Changed 9 years ago by vorkachev

Hello again, since I have no reminder when you post here message, I didn't see that post for a long time, may be you can contact me directly by icq? my number is 445411329. 16gb card inicialize with no problem but it inicialize as 3.9Gb gard, I can't write any futher, If I try to write to fourht gigabyte of memory it start to give i/o errors in dmesg. I know about 2.6 official drivers and even that bcm47 is already unofficially BUT it would be simmilar, I'm shure, it's all limitation of spi, it use sector adressing, but for sdhc it should use block adressing, so it's limited to 4Gb, when SDHC itselfs is limited to 1Tb.. I'm even unshure, may be to 32Tb

comment:7 Changed 9 years ago by anonymous

Dear Chris and co-authors,

Thanks for the very nice driver you wrote & modified!

I am using your driver for kamikaze 7.09 broadcom 2.4 Kernel (linksys wrt54gs)

I investigated a bit the reason why the driver would not work with cards > 4GB.
I discovered that the size calculation in the init.c (size in bytes) uses a 32bit unsigned long.
So I changed it to unsigned long long, re-compiled it and tried out. And it seems to work with my
16GB Lexear SDHC card. Can it be so simple? (I do not have the SD spec at hand and also did not study carefully your driver...)
I only modified the init_card_sd and not the init_card_mm since I do not have an mm card. Looking
at the code I assume an equivalent change could be done in the mmc section.
Also, so far I did not test thorougly: I only downloaded the latest Suse distr (4.4GB) and
checked the md5sum (successfully).

Here the diff (I added some debug messages):

122a123
>
236c237
<     int i,ic;
---
>     int i;
326,330d326
<     LOG_DEBUG(DBG_INIT, "init SD: Card Specific Data read\n");
<     for ( ic = 0; ic < sizeof(csd); ic++ ) {
<       LOG_DEBUG(DBG_INIT, "       : %02d (%02d) => 0x%02x (%03d)\n", ic, ic*8, csd[ic], csd[ic]);
<     }
<
359c355
<     unsigned long long Size;
---
>     unsigned int Size;
371,373c367
<         Size = (((csd[7] & 0x3F) << 16) | (csd[8] << 8) | csd[9]);
<         Size = Size * 1024 * 512;
<       LOG_DEBUG(DBG_INIT, "init SD: calculated length %Ld (0x%Lx)\n", Size, Size);
---
>       Size = (((csd[7] & 0x3F) << 16) | (csd[8] << 8) | csd[9]) * 1024 * 512;
391d384
<     LOG_DEBUG(DBG_INIT, "init SD: calculated blocks %d\n", c->blocks);


Thanks again and good luck for everyone who wants to try this "patch".

Christoph

PS.: Apologies since this has strictly speaking nothing to do with the subject of the thread,
but I did not know where to put it...

comment:8 Changed 9 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Everything that is required to use a SD card with broadcom 2.6 is now there with kmod-spi-gio and friends.

comment:9 Changed 8 years ago by bud.dhay@…

Chris are you reading? .. Found a small bug in the init script from
http://4mul8.ca
and ask myself why the module to date is not in buildroot trunk?

regards bud

comment:10 Changed 8 years ago by Newice

Please can someone give step by step instruction , i am not expert in Linux .
I appreciate it, thanks in advace
BOB

comment:11 Changed 7 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:12 Changed 5 years ago by jogo

  • Resolution set to fixed
  • Status changed from reopened to closed
  • Version set to Trunk

comment:13 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.