OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

4 Pages V  < 1 2 3 4 >  
Reply to this topicStart new topic
> Mmc Soldered. Driver Almost Working
albertr
post Sep 17 2005, 02:31 PM
Post #16





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



The same problem with 128MB SD card made by Sandisk.
CODE
mmc: GPIO init
mmc: initialising MMC
GPIO_SD_CS dir: 1 alt: 0
GPIO_SD_DI dir: 1 alt: 0
GPIO_SD_DO dir: 0 alt: 0
GPIO_SD_CS dir: 1 alt: 0
mmc: card init 1/2
mmc: card init 2/2
mmc: card init 3/3
Size = 123008, hardsectsize = 512, sectors = 246016
Partition check:
mmca:end_request: I/O error, dev 79:00 (mmc), sector 0
end_request: I/O error, dev 79:00 (mmc), sector 2
end_request: I/O error, dev 79:00 (mmc), sector 4
end_request: I/O error, dev 79:00 (mmc), sector 6
end_request: I/O error, dev 79:00 (mmc), sector 0
end_request: I/O error, dev 79:00 (mmc), sector 2
end_request: I/O error, dev 79:00 (mmc), sector 4
end_request: I/O error, dev 79:00 (mmc), sector 6
unable to read partition table


This one has a primary partition type "b" - W95 FAT32.

Guylhem, what card do you use? Can you post its partition table info?
-albertr
Go to the top of the page
 
+Quote Post
niv
post Oct 4 2005, 10:10 AM
Post #17





Group: Members
Posts: 237
Joined: 3-June 05
Member No.: 7,261





If some1 may want to use a mmc/SD socket here is a cheap choice (got it at 19$ from amazon :-( two weeks ago

linky
Go to the top of the page
 
+Quote Post
albertr
post Oct 5 2005, 08:23 AM
Post #18





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



The price for a SD/MMC socket varies from $1 to $3 depending on make.

I would like to see someone else got the driver working, thou. I didn't have much time to debug it, but it doesn't seem to work in my setup, and I'm not sure what I'm doing wrong either...
-albertr
Go to the top of the page
 
+Quote Post
guylhem
post Oct 6 2005, 03:20 AM
Post #19





Group: Members
Posts: 577
Joined: 17-March 04
Member No.: 2,365



albertr, you must reread the partition of the card with forcepart. It's a simple ioctl. Tell me if it's not on the site, I'll upload it.

This is due to a bug in the current driver - it tries to read the partition table too early. Yet after that it works fine. To try out, try fdisk : pretend to make changes (say delete and recreate the same partition) then exit. It will send this ioctl.

This bug will be fixed in the next version which will also bring power management (for now you must umount before suspend or you'll have fs corruption)
Go to the top of the page
 
+Quote Post
albertr
post Oct 6 2005, 08:53 AM
Post #20





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



Guylhem, thanks for explanation. Do you mean BLKRRPART ioctl()? When/How should I issue it? I.e. load the driver, make ioctl() call, then re-load the driver? I'm not sure since when driver is unloaded, device is gone, so no ioctl's can be made.
I'll give it a shot tonight when get back home.
-albertr
Go to the top of the page
 
+Quote Post
albertr
post Oct 6 2005, 07:29 PM
Post #21





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



Still no go...
Here's the simple code that I'm trying to execute as per your suggestion (it's borrowed from fdisk code):
CODE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <setjmp.h>
#include <errno.h>
#include <getopt.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>

#define BLKRRPART    _IO(0x12,95)    /* re-read partition table */
#define BLKGETSIZE   _IO(0x12,96)    /* return device size */
#define BLKFLSBUF    _IO(0x12,97)    /* flush buffer cache */
#define BLKSSZGET    _IO(0x12,104)   /* get block device sector size */
#define BLKGETSIZE64 _IOR(0x12,114,size_t)      /* size in bytes */

int
main(int argc, char **argv) {
       int fd = 0, error = 0;
       int i;
       char name[] ="/dev/mmc/disc0";
//      char name[] ="/dev/mmcda";

       if ((fd = open(name, O_RDWR)) < 0) {
               if ((fd = open(name, O_RDONLY)) < 0) {
                       printf("Failed to open %s, error[%d]: %s\n",
                               name, error, strerror(error));
                       exit(1);
               }
       }


       printf("Calling ioctl() to re-read partition table.\n");
       sync();
       sleep(2);
       if ((i = ioctl(fd, BLKRRPART)) != 0) {
               error = errno;
       } else {
               /* give it another chance */
               sync();
               sleep(2);
               if ((i = ioctl(fd, BLKRRPART)) != 0)
                       error = errno;
       }

       if (i) {
               printf("Re-reading the partition table failed with error %d: %s.\n",
                       error, strerror(error));
       }


       if (fsync(fd) || close(fd)) {
               printf("Error closing %s\n", name);
               exit(1);
       }

       exit(0);
}


Here's the output I'm getting:

CODE
# ./fc
Calling ioctl() to re-read partition table.
Re-reading the partition table failed with error 25: Inappropriate ioctl for device.
Error closing /dev/mmc/disc0


What I'm doing wrong?

-albertr
Go to the top of the page
 
+Quote Post
guylhem
post Oct 7 2005, 12:02 PM
Post #22





Group: Members
Posts: 577
Joined: 17-March 04
Member No.: 2,365



Hello

It's not exactly what I use. My code is pasted below. Please send that ~ 1 to 2 seconds after the insmod. I use /dev/mmc because I don't like "dynamic" /dev filesystems.

CODE
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/fs.h> /* BLKRRPART */
#include <linux/errno.h>

int main(void) {
       char *device = "/dev/mmc";
       int fd, err;

       fd = open(device, O_RDONLY | O_NONBLOCK);
       if (fd < 0) {
               fprintf(stderr, "cannot open %s\n", device);
               exit(1);
       }

       err=ioctl(fd, BLKRRPART);

       if (err) {
              if (EBUSY == err) {
               fprintf(stderr, "%s : device busy\n", device);
//                      perror("EBUSY");
                       exit(-1);
               }
              if (EIO == err) {
//                      perror("EBUSY");
                       fprintf(stderr, "%s : no partition defined\n", device);
                       exit(-1);
               }
               perror("BLKRRPART");
               exit(-1);
       }

       return 0;
}

Attached File(s)
Attached File  forcepart.gz ( 3.02K ) Number of downloads: 67
 
Go to the top of the page
 
+Quote Post
albertr
post Oct 8 2005, 06:25 AM
Post #23





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



Hah! I'm a dumbass! I was using the wrong device name, it's /dev/mmc/disc0/disc, and I was trying to open /dev/mmc/disc0 which was a devfs directory wink.gif

I'm happy to report that driver works. I didn't do much of the testing yet, but at least I can mount a partition and read/write files.
It definitely looks promising... Great work, Guylhem!
-albertr
Go to the top of the page
 
+Quote Post
albertr
post Oct 9 2005, 11:07 AM
Post #24





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



I put some pictures here:

http://www.iral.com/~albertr/linux/simpad/mmc/

-albertr
Go to the top of the page
 
+Quote Post
Tom61
post Oct 9 2005, 03:57 PM
Post #25





Group: Members
Posts: 253
Joined: 22-December 04
Member No.: 6,002



QUOTE(albertr @ Oct 9 2005, 07:07 PM)
I put some pictures here:

http://www.iral.com/~albertr/linux/simpad/mmc/

-albertr
*


Looks good. Hard to tell the slot wasn't put there at the factory!
Go to the top of the page
 
+Quote Post
albertr
post Oct 9 2005, 04:44 PM
Post #26





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



That's what dremel is capable of wink.gif
-albertr
Go to the top of the page
 
+Quote Post
guylhem
post Oct 12 2005, 05:15 AM
Post #27





Group: Members
Posts: 577
Joined: 17-March 04
Member No.: 2,365



QUOTE(albertr @ Oct 8 2005, 06:25 AM)
Hah! I'm a dumbass! I was using the wrong device name, it's /dev/mmc/disc0/disc, and I was trying to open /dev/mmc/disc0 which was a devfs directory wink.gif

I'm happy to report that driver works. I didn't do much of the testing yet, but at least I can mount a partition and read/write files.
It definitely looks promising... Great work, Guylhem!
-albertr
*


Thanks for the compliment albert :-) I saw you where using 3.3 from the JTAG. If you use my schema, you can use cs3 to control the power - thus cutting power to the bluetooth and the MMC while on sleep mode.

BTW, I'd be very interested in making a beautiful hole like you did. Where are you located? May I bring you/send you my simpad? I suck at cutting hole in plastic, and I fear I'll do an awful job compared to what you did.

I'd also be very happy to discuss with you the project I'm currently working on- a GSM addon to the simpad. I've some prototypes around, and I'm wondering what's the best option (hooking the GSM module to the external serial port, or using another bluetooth chip, to connect to it via bluetooth serial profile, and have a SCO connection to the cellphone while keeping the 1st bluetooth chip bandwith totally available for other applications, such as network connection. In the latter case, I'd be like having a bluetooth cellphone inside the simpad, only using its power and smartcard slot to access the SIM)

Guylhem
Go to the top of the page
 
+Quote Post
albertr
post Oct 12 2005, 05:54 AM
Post #28





Group: Members
Posts: 535
Joined: 7-March 04
Member No.: 2,195



I'm not good in cutting thru plastic too, but dremel was very handy. I'm curious how much current idle SD/MMC card is consuming? Might try to measure it sometime later to be certain. I'm planning to modify serial driver to send the break signal when port is closed, this way CSR bluetooth module would enter deep sleep mode to save the power.

Not really sure about serial GSM module, I don't have any experience with these. Besides, I always carry a cell phone with me anyway, but using Simpad only once in a while as a GPS navigation device.
I'm located in Eastern PA, USA.
-albertr
Go to the top of the page
 
+Quote Post
guylhem
post Oct 13 2005, 12:31 AM
Post #29





Group: Members
Posts: 577
Joined: 17-March 04
Member No.: 2,365



Well that's a bit far from Europe. I'll try to play with a dremel to see what I can do with some training :-)

Guylhem
Go to the top of the page
 
+Quote Post
sash
post Oct 25 2005, 08:32 AM
Post #30





Group: Members
Posts: 12
Joined: 29-September 05
Member No.: 8,218



@Guylhem: How did you compile the kernel module?
I used the kernel 2.4.25 from your homepage, but I got many errors.

Maybe you can post the command line or a Makefile?

thx
Sascha
Go to the top of the page
 
+Quote Post

4 Pages V  < 1 2 3 4 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 29th August 2014 - 04:22 PM