# card reader doesn't work: rts_bpp

## Xywa

Hi,

For the lat year I was using this solution from Gentoo forum for my card reader - driver rts_bpp

https://forums.gentoo.org/viewtopic-t-922794-start-0-postdays-0-postorder-asc-highlight-.html

```
wget https://bugs.launchpad.net/bugs/971876/+attachment/2991730/+files/rts_bpp.tar.bz2 

 tar jxf rts_bpp.tar.bz2 

 cd rts_bpp 

 make 

 su -c 'make install ; modprobe rts_bpp ; depmod -a'
```

People says from kernel 3.8 this card reader works out of the box with driver rtsx_pci  (from the kernel).

Unfortunately for me doesn't work (I was trying as a module and as a build in into kernel)...

Everything looks OK on the paper.

```
# lsmod 

Module                  Size  Used by

iwldvm                125862  0 

nvidia               9119147  0 

r8168                 235989  0 

rtsx_pci               17588  0 

mfd_core                2905  1 rtsx_pci

iwlwifi                67931  1 iwldvm

```

```
lspci -v

06:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01)

        Subsystem: Realtek Semiconductor Co., Ltd. Device 5289

        Flags: bus master, fast devsel, latency 0, IRQ 55

        Memory at f7800000 (32-bit, non-prefetchable) [size=64K]

        Capabilities: [40] Power Management version 3

        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+

        Capabilities: [70] Express Endpoint, MSI 00

        Capabilities: [b0] MSI-X: Enable- Count=1 Masked-

        Capabilities: [d0] Vital Product Data

        Capabilities: [100] Advanced Error Reporting

        Capabilities: [140] Virtual Channel

        Capabilities: [160] Device Serial Number 00-00-00-00-00-00-00-00

        Kernel driver in use: rtsx_pci

        Kernel modules: rtsx_pci

```

What to do?   :Sad: 

When I am trying to compile it in the old way, I have such error:

```
# make

cp -f ./define.release ./define.h

make -C /lib/modules/3.8.8-gentoo/build/ SUBDIRS=/mnt/twardy/system/rts_bpp modules

make[1]: Entering directory `/usr/src/linux-3.8.8-gentoo'

  CC [M]  /mnt/twardy/system/rts_bpp/rtsx.o

/mnt/twardy/system/rts_bpp/rtsx.c:893:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rtsx_probe’

/mnt/twardy/system/rts_bpp/rtsx.c:1048:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rtsx_remove’

/mnt/twardy/system/rts_bpp/rtsx.c:1073:11: error: ‘rtsx_probe’ undeclared here (not in a function)

/mnt/twardy/system/rts_bpp/rtsx.c:1074:2: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]

/mnt/twardy/system/rts_bpp/rtsx.c:1074:24: error: ‘rtsx_remove’ undeclared here (not in a function)

/mnt/twardy/system/rts_bpp/rtsx.c:255:34: warning: ‘rtsx_host_template’ defined but not used [-Wunused-variable]

/mnt/twardy/system/rts_bpp/rtsx.c:450:12: warning: ‘rtsx_control_thread’ defined but not used [-Wunused-function]

/mnt/twardy/system/rts_bpp/rtsx.c:559:12: warning: ‘rtsx_polling_thread’ defined but not used [-Wunused-function]

/mnt/twardy/system/rts_bpp/rtsx.c:715:13: warning: ‘quiesce_and_remove_host’ defined but not used [-Wunused-function]

/mnt/twardy/system/rts_bpp/rtsx.c:751:13: warning: ‘release_everything’ defined but not used [-Wunused-function]

/mnt/twardy/system/rts_bpp/rtsx.c:761:12: warning: ‘rtsx_scan_thread’ defined but not used [-Wunused-function]

/mnt/twardy/system/rts_bpp/rtsx.c:786:13: warning: ‘rtsx_init_options’ defined but not used [-Wunused-function]

cc1: some warnings being treated as errors

make[2]: *** [/mnt/twardy/system/rts_bpp/rtsx.o] Error 1

make[1]: *** [_module_/mnt/twardy/system/rts_bpp] Error 2

make[1]: Leaving directory `/usr/src/linux-3.8.8-gentoo'

make: *** [default] Error 2

```

----------

## roarinelk

remove all __devinit and __devexit references in the source.

----------

## eccerr0r

What does the in-kernel driver do and (obviously) not do?

I'm tempted to try it... is it worth the try?

(Machine: HP Envy4 Ultrabook with built-in SD card reader that rts_bpp worked on...)

----------

## Xywa

 *roarinelk wrote:*   

> remove all __devinit and __devexit references in the source.

 

I am thinking why this compilations runs OK for kernel<3.8?

----------

## eccerr0r

I just built Linux 3.8.8 (straight from kernel.org) for my HP Envy4 with

```
01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01)

        Subsystem: Hewlett-Packard Company Device 1894

        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+

        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 0, Cache Line Size: 64 bytes

        Interrupt: pin B routed to IRQ 45

        Region 0: Memory at c0600000 (32-bit, non-prefetchable) [size=64K]

        Capabilities: <access denied>

        Kernel driver in use: rtsx_pci

```

I just tried a regular 1GB SD card and it worked!  Yay! No more rts_bpp, that module was awful...  Bloat Galore! (plus it was a polling driver...)

----------

## Xywa

 *eccerr0r wrote:*   

> I just built Linux 3.8.8 (straight from kernel.org) for my HP Envy4 with
> 
> ```
> 01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01)
> 
> ...

 

Have a look at mine (the same, but doesn't work):

```
lspci -v 

 06:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5289 (rev 01) 

         Subsystem: Realtek Semiconductor Co., Ltd. Device 5289 

         Flags: bus master, fast devsel, latency 0, IRQ 55 

         Memory at f7800000 (32-bit, non-prefetchable) [size=64K] 

         Capabilities: [40] Power Management version 3 

         Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+ 

         Capabilities: [70] Express Endpoint, MSI 00 

         Capabilities: [b0] MSI-X: Enable- Count=1 Masked- 

         Capabilities: [d0] Vital Product Data 

         Capabilities: [100] Advanced Error Reporting 

         Capabilities: [140] Virtual Channel 

         Capabilities: [160] Device Serial Number 00-00-00-00-00-00-00-00 

         Kernel driver in use: rtsx_pci 

         Kernel modules: rtsx_pci
```

----------

## DirtyHairy

 *Xywa wrote:*   

> I am thinking why this compilations runs OK for kernel<3.8?

 

Simple thing: kernel sources change, external driver doesn't  :Wink: 

----------

## eccerr0r

This may provide some clues:

```
mikuru:/usr/portage/sys-kernel/gentoo-sources $ lsmod|grep rtsx_pci

rtsx_pci_ms             4970  0 

rtsx_pci_sdmmc          9309  0 

mmc_core               82256  2 mmc_block,rtsx_pci_sdmmc

memstick                6398  1 rtsx_pci_ms

rtsx_pci               17780  2 rtsx_pci_ms,rtsx_pci_sdmmc

mfd_core                2969  2 lpc_ich,rtsx_pci

```

Not sure why yours isn't pulling in these modules (I'd imagine it should do something similar to mine...)?

----------

## Xywa

Kernel 3.8.10 - still the same.

To use card reader I had to downgrade to 3.7.10, when it will be fixed in future kernel, I will let you know.

----------

## roarinelk

Apply this patch, then it builds for 3.9:

```
--- rtsx.c~     2011-12-05 04:41:04.000000000 +0100

+++ rtsx.c      2013-04-29 13:24:41.794429549 +0200

@@ -890,7 +890,7 @@ static void rtsx_init_options(struct rts

        chip->handshake_en = 1;

 }

 

-static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

+static int rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

 {

        struct Scsi_Host *host;

        struct rtsx_dev *dev;

@@ -1045,7 +1045,7 @@ errout:

 }

 

 

-static void __devexit rtsx_remove(struct pci_dev *pci)

+static void rtsx_remove(struct pci_dev *pci)

 {

        struct rtsx_dev *dev = (struct rtsx_dev *)pci_get_drvdata(pci);

 

@@ -1071,7 +1071,7 @@ static struct pci_driver driver = {

        .name = CR_DRIVER_NAME,

        .id_table = rts_bpp_ids,

        .probe = rtsx_probe,

-       .remove = __devexit_p(rtsx_remove),

+       .remove = rtsx_remove,

 #ifdef CONFIG_PM

        .suspend = rtsx_suspend,

        .resume = rtsx_resume,

```

----------

## Uli Sing

Working for me, thanks for the patch!

----------

## Xywa

 *roarinelk wrote:*   

> Apply this patch, then it builds for 3.9:
> 
> ```
> --- rtsx.c~     2011-12-05 04:41:04.000000000 +0100
> 
> ...

 

Could you explain step by step how to install this patch?

I don't think kernel developers are interested to fix it...

----------

## roarinelk

 *Xywa wrote:*   

>  *roarinelk wrote:*   Apply this patch, then it builds for 3.9:
> 
> ```
> --- rtsx.c~     2011-12-05 04:41:04.000000000 +0100
> 
> ...

 

That's because this driver is in mainline linux now.  You shouldn't need this patch to the out-of-tree driver any more.

----------

## Xywa

 *Quote:*   

> That's because this driver is in mainline linux now.  You shouldn't need this patch to the out-of-tree driver any more.

 

But the driver is broken, doesn't work I think to ver.B of the hardware (works for ver.A, C and others), so this is a problem for many users:

https://bugzilla.kernel.org/show_bug.cgi?id=57061

----------

