Re: PCI Cardreader

From: Benjamin Close <Benjamin.Close_at_clearchain.com>
Date: Fri, 09 Nov 2007 12:05:40 +1030
Rene Ladan wrote:
> 2007/11/8, Rene Ladan <r.c.ladan_at_gmail.com>:
>   
>> Alexandre "Sunny" Kovalenko schreef:
>>     
>>> On Wed, 2007-11-07 at 22:13 +0100, Rene Ladan wrote:
>>>       
>>>> Bachilo Dmitry schreef:
>>>>         
>>>>> Hello all.
>>>>> I always used USB cardreaders and had no problem with it, but now in my
>>>>> notebook I have a cardreader, that appears to be onboard PCI device. And so
>>>>> FreeBSD sees it as this:
>>>>> pci6: <memory, flash> at device 4.1 (no driver attached)
>>>>> pci6: <base peripheral> at device 4.2 (no driver attached)
>>>>> pci6: <memory, flash> at device 4.3 (no driver attached)
>>>>> pci6: <memory, flash> at device 4.4 (no driver attached)
>>>>>
>>>>>
>>>>> That's even more odd because three are recognized as flash and one is not.
>>>>> pciconf -lv shows this:
>>>>>
>>>>> none13_at_pci6:4:1:        class=0x050100 card=0x009f1025 chip=0x05301524
>>>>> rev=0x01 hdr=0x00
>>>>>     vendor     = 'ENE Technology Inc'
>>>>>     device     = 'PCI Memory Stick Card Reader Controller'
>>>>>     class      = memory
>>>>>     subclass   = flash
>>>>>
>>>>> Well, in 7.0-CURRENT it showed all four devices and now in BETA-2 only this
>>>>> one.
>>>>>
>>>>>           
>>>> On my 8.0-CURRENT box (20071105) it shows all four devices:
>>>>
>>>> cbb0_at_pci0:4:1:0:     class=0x060700 card=0x14371043 chip=0x04761180 rev=0xb3 hdr=0x02
>>>>     vendor     = 'Ricoh Company, Ltd.'
>>>>     device     = 'unknown Ricoh R/RL/5C476(II)'
>>>>     class      = bridge
>>>>     subclass   = PCI-CardBus
>>>> fwohci0_at_pci0:4:1:1:  class=0x0c0010 card=0x14371043 chip=0x05521180 rev=0x08 hdr=0x00
>>>>     vendor     = 'Ricoh Company, Ltd.'
>>>>     device     = 'RL5c552 IEEE-1394 Controller'
>>>>     class      = serial bus
>>>>     subclass   = FireWire
>>>> none0_at_pci0:4:1:2:    class=0x080500 card=0x14371043 chip=0x08221180 rev=0x17 hdr=0x00
>>>>     vendor     = 'Ricoh Company, Ltd.'
>>>>     device     = 'R5C832, R5C843 SDA Standard Compliant SD Host Controller'
>>>>     class      = base peripheral
>>>> none1_at_pci0:4:1:3:    class=0x088000 card=0x14371043 chip=0x05921180 rev=0x08 hdr=0x00
>>>>     vendor     = 'Ricoh Company, Ltd.'
>>>>     device     = '13871043 Ricoh Memory Stick Host Controller'
>>>>     class      = base peripheral
>>>>
>>>>         
>>>>> Is there any way I can make them work?
>>>>>
>>>>>           
>>>> You can add these lines to your kernel configuration:
>>>>
>>>> device          mmc
>>>> device          mmcsd
>>>>
>>>> But don't expect any magic.  mmc(4) and mmcsd(4) tell that nothing currently works,
>>>> which seems to be true on my Asus A6JE (using a Kingston micro-SD card with adapter).
>>>>
>>>> imp_at_ is the last person who touched the driver which lives in /usr/src/sys/dev/mmc/
>>>>
>>>>         
>>> Thing below is on my list to try out when I get enough breathing room
>>> (or when I would have a dire need to read SD cards on my ThinkPad
>>> X60 ;). Did you, by any chance, try it? Any experiences to share?
>>>
>>> http://www.freebsd.org/cgi/getmsg.cgi?fetch=17399+21119
>>> +/usr/local/www/db/text/2007/freebsd-mobile/20070916.freebsd-mobile
>>>
>>>       
>> Not yet, I didn't see the message until now since I'm not (yet) on the mobile list.
>> A quick try showed that it does not compile on my box.  I'll investigate why.
>> The author did not leave an email address in the files.
>>
>>     
> The short story is bus_setup_intr() gained some parameters, I'll
> figure out which.  According to a blog at bsdimp.blogspot.com, Ricoh
> based readers should work with this driver :)
The attached patch gets it compiling but I think there might be some 
locking issues still as I got an immediate panic at module load. Not 
sure who put up the tar.gz but I know Max has done some work porting it 
from OpenBSD in p4:

http://perforce.freebsd.org/changeList.cgi?CMD=changes&FSPC=//depot/user/mlaier/sdmmc/sys/...


diff -ur sdmmc-20070627/dev/sdmmc/sdshc.c 
sdmmc-20070627-devel/dev/sdmmc/sdshc.c
--- sdmmc-20070627/dev/sdmmc/sdshc.c    2007-06-25 19:55:52.000000000 +0930
+++ sdmmc-20070627-devel/dev/sdmmc/sdshc.c      2007-11-09 
11:45:00.779789122 +1030
_at__at_ -42,6 +42,8 _at__at_
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/malloc.h>
+#include <sys/bus.h>
+#include <machine/bus.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
_at__at_ -342,7 +344,7 _at__at_
      * Hook our interrupt after all initialization is complete.
      */
     LOG(0x10, (dev, "Setup Intr\n"));
-    error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET|INTR_MPSAFE ,
+    error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET|INTR_MPSAFE , NULL,
                           sdshc_intr, sc, &sc->ih);
     if (error != 0) {
        MSG((dev, "could not set up interrupt\n"));
diff -ur sdmmc-20070627/dev/sdmmc/sdshcbus.c 
sdmmc-20070627-devel/dev/sdmmc/sdshcbus.c
--- sdmmc-20070627/dev/sdmmc/sdshcbus.c 2007-06-20 03:12:28.000000000 +0930
+++ sdmmc-20070627-devel/dev/sdmmc/sdshcbus.c   2007-11-09 
11:49:18.706315189 +1030
_at__at_ -41,6 +41,8 _at__at_
 #include <sys/conf.h>
 #include <sys/malloc.h>
 #include <sys/ctype.h>
+#include <sys/bus.h>
+#include <machine/bus.h>
 
 #include "sdbus_if.h"
Received on Fri Nov 09 2007 - 00:36:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:21 UTC