Re: Experimental driver for Ricoh Bay1Controller SD Card readers

Previous thread: Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree by Daniel Walker on Saturday, January 6, 2007 - 3:35 pm. (8 messages)

Next thread: Question on ALSA intel8x0 by J.A. on Saturday, January 6, 2007 - 5:29 pm. (2 messages)
From: Sascha Sommer
Date: Saturday, January 6, 2007 - 4:32 pm

Hi,

Attached is a very experimental driver for a Ricoh SD Card reader that can be 
found in some notebooks like the Samsung P35.

Whenever a sd card is inserted into one of these notebooks, a virtual pcmcia 
card will show up:

Socket 0:
  product info: "RICOH", "Bay1Controller", "", ""
  manfid: 0x0000, 0x0000

In order to write this driver I hacked qemu to have access to the cardbus 
bridge containing this card. I then logged the register accesses of the 
windows xp driver and tryed to analyse them.

As the meanings of most of the register are still unknown to me, I consider 
this driver very experimental. It is possible that this driver might destroy 
your data or your hardware. Use at your own risk! 

Other problems:
- I only implemented reading support
- I only tested with a 128 MB SD card, no idea what would be needed to support
  other card types
- irqs are not supported
- dma is not supported
- it is very slow
- the registers can be found on the cardbus bridge and not on the virtual 
  pcmcia card. The cardbus bridge is already claimed by yenta_socket. 
  Therefore the driver currently uses pci_find_device to find the cardbus
  bridge containing the sd card reader registers.
- it will probably crash when you remove the sd card without unmounting first
- the ios stuff is not really understood
- there are a bunch of extra MMC_APP_CMDs inside the driver
- only tested with kernel 2.6.18

apart from all these problems reading an image from my sd card seems to have 
worked ;) 

If you are still brave enough to try it out make at least a backup of the data 
on your sd card.

Feedback is highly appreciated.

Regards

Sascha

From: Jiri Slaby
Date: Sunday, January 7, 2007 - 2:56 am

- pci_find_device is no go today. Use pci_get_device (+ pci_dev_get, _put).
- ioremap->pci_iomap
- iobase should be __iomem.
- codingstyle (char* buffer, for(loop, if(data){, ...)

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E
-

From: Sascha Sommer
Date: Sunday, February 11, 2007 - 1:22 pm

Hi,


Thanks for your feedback and testing.
I fixed the above problems and ran the code through Lindent.
Apart from that I did the following changes:
- implemented suspend/resume support (not tested very much)
- named the registers
- fixed a bug that caused a major slowdown when modprobed without debug=1
- added writting support (disabled by default, modprobe with write=1)
Before you enable writting please make sure that you did a proper backup of 
the data on the card. Do not use this driver to save important data.

I still consider this driver experimental, but without documentation this is 
probably not going to change anytime soon.
The question is now what I should do with the driver?
Is it worth to be included in the kernel? If yes where and against what 
kernelversion should I send the patch?


Thanks

Sascha

From: Pierre Ossman
Date: Monday, February 12, 2007 - 10:47 pm

That's up to you. The most important thing for any part of the kernel is
that it must have a maintainer. So if you are ready to keep the driver
up to date and handle the support requests that show, then you should
really submit it.

Patches should always be sent against the current version of the kernel
(i.e. git HEAD). Usually the latest packaged release will also do.

(Note that I haven't had time to review your latest version of the driver)

Rgds

-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org

-

From: Samuel Thibault
Date: Tuesday, February 13, 2007 - 2:48 am

You can mark your Kconfig entry with EXPERIMENTAL for letting people
know about the status :)

Samuel
-

From: Sascha Sommer
Date: Tuesday, February 13, 2007 - 4:42 am

Hi,


Yes, I'm going to maintain it. There are still some bugs that need to be fixed 
first, though. I also got a mail from someone else how also did some 
reverseengineering work for this reader. I'm waiting for his feedback before 
I will submit a patch that can be included.

Thanks.

Sascha

-

From: Samuel Thibault
Date: Tuesday, January 9, 2007 - 1:57 pm

Hi,

Sascha Sommer, le Sun 07 Jan 2007 00:32:26 +0100, a 
From: Pierre Ossman
Date: Wednesday, January 10, 2007 - 1:10 pm

Impressive. Keep up the good work. :)

Rgds
-- 
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  PulseAudio, core developer          http://pulseaudio.org
  rdesktop, core developer          http://www.rdesktop.org
-

Previous thread: Re: + spin_lock_irq-enable-interrupts-while-spinning-i386-implementation.patch added to -mm tree by Daniel Walker on Saturday, January 6, 2007 - 3:35 pm. (8 messages)

Next thread: Question on ALSA intel8x0 by J.A. on Saturday, January 6, 2007 - 5:29 pm. (2 messages)