Bug#757733: RTS2557 SD card reader does not work

2015-01-12 Thread Johannes Schauer
Hi,

On Sun, 11 Jan 2015 01:09:19 +0100 Johannes Schauer j.scha...@email.de wrote:
 Weirdly, my SD card reader used to work (but presented the SD card as
 /dev/mmcblk0pX). I do not know why it stopped working though as I didn't 
 reboot
 my laptop for several months. Running an older kernel version (3.14 for
 example) does not fix the problem. Maybe it is related to other parts of my
 (Debian testing) OS. I'll see if I can find a Debian unstable snapshot that
 restores the behaviour I observed last year and try to bisect to find the
 source of the regression.

I spent the past two days trying to reproduce the problem and I'm unable to get
reliable results. Let me explain what I did.

 - December 20 I took a snapshot of my system (but without rebooting) at this
   time my T440s SD card reader worked fine and showed up as /dev/mmcblk0*
 - January 10 (three weeks later) I did a big `apt-get upgrade/dist-upgrade` to
   update all the packages to their Jessie or Sid versions, respectively and
   rebooted. The card reader didn't show up anymore. Nothing on dmesg when I
   inserted my sdcard which would before show me the new registered partitions
 - I put a Debian Sid debootstrap from January 1 2014 on a USB stick and booted
   that. Same thing, no SD card.
 - I put a Debian Sid debootstrap from January 1 2013 on a USB stick and booted
   that. Same thing, no SD card.
 - In the hopes that at least the snapshot from December 20 would work and
   somehow allow me to find out which package upgrade broke my system, I put
   this back on my harddisk and booted it. The SD card reader worked and was
   available as /dev/mmcblk0*
 - I upgraded step by step important packages like linux-image-amd64,
   initramfs, udev, while rebooting after every step. The system kept working.
 - I added /usr /bin /sbin /var /etc /boot and /lib to a git on my / so that I
   would always be able to quickly roll back everything and did `apt-get
   upgrade/dist-upgrade` for the rest of my system and rebooted. Everything
   kept working
 - So at this point I executed the same upgrade path which before made a system
   that was working not working but in this case the SD card reader kept
   working. I had no explanation as I didn't do anything different.
 - I put the prior non-working snapshot of my system from January 10 back which
   had all the upgrades already done. And surprise: this time it worked! The
   exact same hard disk image which before leads to my MMC card reader not
   showing up worked fine this time.
 - I installed Debian Jessie (with the daily installer from [1]) on a USB stick
   and booted that. My card reader keeps working
 - I put put a Debian Sid debootstrap from January 1 2014 on a USB stick and
   booted that (this wasn't working before, see above). This time it worked and
   I was able to mount my SD card.

What do you make from this?

Apparently there are situations where, with the exact same root file system (My
January 20 full snapshot and the January 1 2014 Debian Sid debootstrap) it at
some point did not work but then worked again.

How can this happen?

What else can I try?

Right now everything works and I'm not able to make it not-working again.
Thoughts?

cheers, josch

[1] 
http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso


signature.asc
Description: signature


Bug#757733: RTS2557 SD card reader does not work

2015-01-10 Thread Johannes Schauer
Hi,

On Mon, 11 Aug 2014 06:45:24 + wei_w...@realsil.com.cn wrote:
 Would you please try this patch. If it does work, we will submit it to 
 upstream kernel.

I own a Lenovo Thinkpad T440s as well just as the original bug submitter
(Philipp) and that patch by Wei does not fix the problem for me (I applied it
to a 3.18 tree).

What does work is to follow Philipp's instructions to patch the out-of-tree
driver from realtek.com.tw. That module then gives me my SD card as /dev/sdbX.

Weirdly, my SD card reader used to work (but presented the SD card as
/dev/mmcblk0pX). I do not know why it stopped working though as I didn't reboot
my laptop for several months. Running an older kernel version (3.14 for
example) does not fix the problem. Maybe it is related to other parts of my
(Debian testing) OS. I'll see if I can find a Debian unstable snapshot that
restores the behaviour I observed last year and try to bisect to find the
source of the regression.

Thanks!

cheers, josch


signature.asc
Description: signature


Bug#757733: 答复: Bug#757733: RTS2557 SD card reader does not work

2014-09-21 Thread Fufu Fang
Hi Wei,
I am affected by this bug too.

I patched the kernel source, recompiled the modules in drivers/mfd, and
it gives the following message when I run dmesg:

[ 3940.436153] rtsx_pci :03:00.0: irq 50 for MSI/MSI-X
[ 3940.436185] rtsx_pci :03:00.0: rtsx_pci_acquire_irq: pcr-msi_en
= 1, pci-irq = 50
[ 3940.535119] rtsx_pci :03:00.0: rtsx_pci_init_hw error: optimize phy
[ 3940.535264] rtsx_pci: probe of :03:00.0 failed with error -110

Cheers,
Fufu

On Mon, 11 Aug 2014 06:45:24 + =?utf-8?B?546L54Kc?=
wei_w...@realsil.com.cn wrote:

  -邮件原件-
  发件人: Philipp Hagemeister [mailto:phi...@phihag.de]
  发送时间: 2014年8月11日 9:10
  收件人: Ben Hutchings; 王炜
  抄送: 757...@bugs.debian.org; LKML
  主题: Re: Bug#757733: RTS2557 SD card reader does not work
 
   A web search shows some similar reports (e.g.
   https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1329566,
  
  http://askubuntu.com/questions/473848/ubuntu-14-04-realtek-semiconducto
  r-co-ltd-rts5227-pci-express-card-reader-isn).
   But in that last one, it turns out that the out-of-tree driver does
   work.
 
  Indeed, that is a workaround - download from
  http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1PNid=
  15PFid=25Level=4Conn=3DownTypeID=3GetDown=false
  , apply the attached patch, remove all rtsx_* modules, and insert
the new
  rts2557 module into the kernel.


 Hi Philipp  Ben:

 Would you please try this patch. If it does work, we will submit it to
upstream kernel.

 BR,
 Wei


-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/541eefed.8060...@fangfufu.co.uk



Re: Bug#757733: 答复: Bug#757733: RTS2557 SD card reader does not work

2014-08-29 Thread Robert David
I just test that and it works fine.

I did little cleanup. Patch attached.

Regards,
Robert.
diff --git a/Makefile b/Makefile
index 6536bd4..d639053 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 # Makefile for the PCI-Express Card Reader drivers.
 #
 
-TARGET_MODULE := rts5229
+TARGET_MODULE := rts5227
 
 EXTRA_CFLAGS := -Idrivers/scsi 
 
@@ -38,9 +38,9 @@ debug:
 	cp -f ./define.debug ./define.h
 	make -C /lib/modules/$(shell uname -r)/build/ SUBDIRS=$(PWD) modules
 install:
-	cp $(TARGET_MODULE).ko /lib/modules/$(shell uname -r)/kernel/drivers/scsi -f
+	mkdir -p /lib/modules/$(shell uname -r)/kernel/drivers/scsi
+	cp $(TARGET_MODULE).ko /lib/modules/$(shell uname -r)/kernel/drivers/scsi/ -f
 clean:
-	rm -f *.o *.ko
+	rm -f *.o *.ko .*.ko* .*.o* Module.symvers define.h modules.order
 	rm -f $(TARGET_MODULE).mod.c
-
-
+	rm -rf .tmp_versions
diff --git a/rtsx.c b/rtsx.c
index 7fd7a92..dbe66ce 100644
--- a/rtsx.c
+++ b/rtsx.c
@@ -129,39 +129,6 @@ static int slave_configure(struct scsi_device *sdev)
 #define SPRINTF(args...) \
 	do { if (pos  buffer+length) pos += sprintf(pos, ## args); } while (0)
 
-static int proc_info (struct Scsi_Host *host, char *buffer,
-		char **start, off_t offset, int length, int inout)
-{
-	char *pos = buffer;
-
-	
-	if (inout)
-		return length;
-
-	
-	SPRINTF(   Host scsi%d: %s\n, host-host_no, CR_DRIVER_NAME);
-
-	
-	SPRINTF(   Vendor: Realtek Corp.\n);
-	SPRINTF(  Product: RTS5229\n);
-	SPRINTF(  Version: %s\n, DRIVER_VERSION);
-	SPRINTF(Build: %s, %s\n, __DATE__, __TIME__);
-
-	/*
-	 * Calculate start of next buffer, and return value.
-	 */
-	*start = buffer + offset;
-
-	if ((pos - buffer)  offset)
-		return (0);
-	else if ((pos - buffer - offset)  length)
-		return (pos - buffer - offset);
-	else
-		return (length);
-}
-
-
-
 static int queuecommand_lck(struct scsi_cmnd *srb,
 			void (*done)(struct scsi_cmnd *))
 {
@@ -263,7 +230,6 @@ static struct scsi_host_template rtsx_host_template = {
 	
 	.name =CR_DRIVER_NAME,
 	.proc_name =			CR_DRIVER_NAME,
-	.proc_info =			proc_info,
 	.info =host_info,
 
 	
@@ -911,7 +877,7 @@ static void rtsx_init_options(struct rtsx_chip *chip)
 	chip-support_mmc = 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;
@@ -1066,7 +1032,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);
 
@@ -1092,7 +1058,7 @@ static struct pci_driver driver = {
 	.name = CR_DRIVER_NAME,
 	.id_table = rts5229_ids,
 	.probe = rtsx_probe,
-	.remove = __devexit_p(rtsx_remove),
+	.remove = rtsx_remove,
 #ifdef CONFIG_PM
 	.suspend = rtsx_suspend,
 	.resume = rtsx_resume,
diff --git a/rtsx.h b/rtsx.h
index 3a1bb2f..98b26c4 100644
--- a/rtsx.h
+++ b/rtsx.h
@@ -52,7 +52,7 @@
 #include trace.h
 #include general.h
 
-#define CR_DRIVER_NAME		rts5229
+#define CR_DRIVER_NAME		rts5227
 
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 14)


Bug#757733: 答复: Bug#757733: RTS2557 SD card reader does not work

2014-08-11 Thread 王炜

 -邮件原件-
 发件人: Philipp Hagemeister [mailto:phi...@phihag.de]
 发送时间: 2014年8月11日 9:10
 收件人: Ben Hutchings; 王炜
 抄送: 757...@bugs.debian.org; LKML
 主题: Re: Bug#757733: RTS2557 SD card reader does not work
 
  A web search shows some similar reports (e.g.
  https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1329566,
 
 http://askubuntu.com/questions/473848/ubuntu-14-04-realtek-semiconducto
 r-co-ltd-rts5227-pci-express-card-reader-isn).
  But in that last one, it turns out that the out-of-tree driver does
  work.
 
 Indeed, that is a workaround - download from
 http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1PNid=
 15PFid=25Level=4Conn=3DownTypeID=3GetDown=false
 , apply the attached patch, remove all rtsx_* modules, and insert the new
 rts2557 module into the kernel.


Hi Philipp  Ben:

Would you please try this patch. If it does work, we will submit it to upstream 
kernel.

BR,
Wei


0001-mfd-rtsx-fix-rts5227-suspend-resume-setting.patch
Description: 0001-mfd-rtsx-fix-rts5227-suspend-resume-setting.patch


Bug#757733: RTS2557 SD card reader does not work

2014-08-10 Thread Philipp Hagemeister
Package: src:linux
Version: 3.16-1~exp1
Severity: normal

Dear Maintainer,

I have a Lenovo Thinkpad T440s with an included SD card reader for which
/dev/mmc* devices do not show up. It seems to be an RTS 2557:

$ lspci -v | grep RTS
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI
Express Card Reader (rev 01)

With linux-image-3.14-2-amd64 (unstable) as well as 3.16-trunk-
amd64(experimental), there are no /dev/mmc* devices (or in fact, any new
devices) after inserting an SD card (which works fine on another reader). dmesg
shows this error:

$ dmesg  | grep rtsx_pci
[0.881602] rtsx_pci :02:00.0: irq 57 for MSI/MSI-X
[0.881619] rtsx_pci :02:00.0: rtsx_pci_acquire_irq: pcr-msi_en = 1,
pci-irq = 57
[0.980400] rtsx_pci: probe of :02:00.0 failed with error -110

This error shows up at boot time. There are no new dmesg (or syslog) outputs
upon inserting the SD card.



-- Package-specific info:
** Version:
Linux version 3.16-trunk-amd64 (debian-kernel@lists.debian.org) (gcc version
4.8.3 (Debian 4.8.3-7) ) #1 SMP Debian 3.16-1~exp1 (2014-08-09)

** Command line:
BOOT_IMAGE=/boot/vmlinuz-3.16-trunk-amd64 root=UUID=9003c24a-
794a-4918-aa27-bb457b7dcfe4 ro quiet

** Not tainted

** Kernel log:
[3.194552] Bluetooth: SCO socket layer initialized
[3.194924] cdc_acm 2-4:1.1: ttyACM0: USB ACM device
[3.195517] cdc_acm 2-4:1.3: ttyACM1: USB ACM device
[3.195783] cdc_acm 2-4:1.9: ttyACM2: USB ACM device
[3.200339] usbcore: registered new interface driver cdc_acm
[3.200340] cdc_acm: USB Abstract Control Model driver for USB modems and
ISDN adapters
[3.204277] usbcore: registered new interface driver btusb
[3.215694] Bluetooth: hci0: read Intel version: 370710018002030d37
[3.215695] Bluetooth: hci0: Intel device is already patched. patch num: 37
[3.216540] cdc_ncm 2-4:1.6: MAC-Address: 02:15:e0:ec:01:00
[3.216845] cdc_ncm 2-4:1.6 wwan0: register 'cdc_ncm' at usb-:00:14.0-4,
Mobile Broadband Network Device, 02:15:e0:ec:01:00
[3.216882] usbcore: registered new interface driver cdc_ncm
[3.218328] usbcore: registered new interface driver cdc_mbim
[3.363073] Console: switching to colour frame buffer device 240x67
[3.368135] i915 :00:02.0: fb0: inteldrmfb frame buffer device
[3.368136] i915 :00:02.0: registered panic notifier
[3.371148] usb 1-1.5: new full-speed USB device number 3 using ehci-pci
[3.399439] ACPI: Video Device [VID] (multi-head: yes  rom: no  post: no)
[3.399545] input: Video Bus as
/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input9
[3.399664] [drm] Initialized i915 1.6.0 20080730 for :00:02.0 on minor
0
[3.399821] i801_smbus :00:1f.3: SMBus using PCI Interrupt
[3.401031] snd_hda_intel :00:1b.0: irq 62 for MSI/MSI-X
[3.408768] snd_hda_intel :00:03.0: irq 63 for MSI/MSI-X
[3.413626] sound hdaudioC1D0: autoconfig: line_outs=1
(0x16/0x0/0x0/0x0/0x0) type:line
[3.413630] sound hdaudioC1D0:speaker_outs=1 (0x14/0x0/0x0/0x0/0x0)
[3.413633] sound hdaudioC1D0:hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
[3.413634] sound hdaudioC1D0:mono: mono_out=0x0
[3.413636] sound hdaudioC1D0:inputs:
[3.413638] sound hdaudioC1D0:  Dock Mic=0x19
[3.413640] sound hdaudioC1D0:  Mic=0x1a
[3.413642] sound hdaudioC1D0:  Internal Mic=0x12
[3.436122] input: HDA Digital PCBeep as
/devices/pci:00/:00:1b.0/sound/card1/hdaudioC1D0/input10
[3.437232] input: HDA Intel PCH Dock Mic as
/devices/pci:00/:00:1b.0/sound/card1/input11
[3.437323] input: HDA Intel PCH Mic as
/devices/pci:00/:00:1b.0/sound/card1/input12
[3.437402] input: HDA Intel PCH Dock Headphone as
/devices/pci:00/:00:1b.0/sound/card1/input13
[3.437487] input: HDA Intel PCH Headphone as
/devices/pci:00/:00:1b.0/sound/card1/input14
[3.457467] input: HDA Intel HDMI HDMI/DP,pcm=3 as
/devices/pci:00/:00:03.0/sound/card0/input15
[3.457729] input: HDA Intel HDMI HDMI/DP,pcm=7 as
/devices/pci:00/:00:03.0/sound/card0/input16
[3.458451] input: HDA Intel HDMI HDMI/DP,pcm=8 as
/devices/pci:00/:00:03.0/sound/card0/input17
[3.476102] random: nonblocking pool is initialized
[3.476325] usb 1-1.5: No LPM exit latency info found, disabling LPM.
[3.485456] usb 1-1.5: New USB device found, idVendor=058f, idProduct=9540
[3.485461] usb 1-1.5: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[3.485463] usb 1-1.5: Product: EMV Smartcard Reader
[3.485465] usb 1-1.5: Manufacturer: Generic
[3.910813] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[5.508693] psmouse serio2: alps: Unknown ALPS touchpad: E7=10 00 64, EC=10
00 64
[6.783589] psmouse serio2: trackpoint: IBM TrackPoint firmware: 0x0e,
buttons: 3/3
[6.980179] input: TPPS/2 IBM TrackPoint as
/devices/platform/i8042/serio1/serio2/input/input7
[   69.427863] i915 

Bug#757733: RTS2557 SD card reader does not work

2014-08-10 Thread Ben Hutchings
On Mon, 2014-08-11 at 00:50 +0200, Philipp Hagemeister wrote:
 Package: src:linux
 Version: 3.16-1~exp1
 Severity: normal
 
 Dear Maintainer,
 
 I have a Lenovo Thinkpad T440s with an included SD card reader for which
 /dev/mmc* devices do not show up. It seems to be an RTS 2557:
 
 $ lspci -v | grep RTS
 02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI
 Express Card Reader (rev 01)
 
 With linux-image-3.14-2-amd64 (unstable) as well as 3.16-trunk-
 amd64(experimental), there are no /dev/mmc* devices (or in fact, any new
 devices) after inserting an SD card (which works fine on another reader). 
 dmesg
 shows this error:
 
 $ dmesg  | grep rtsx_pci
 [0.881602] rtsx_pci :02:00.0: irq 57 for MSI/MSI-X
 [0.881619] rtsx_pci :02:00.0: rtsx_pci_acquire_irq: pcr-msi_en = 1,
 pci-irq = 57
 [0.980400] rtsx_pci: probe of :02:00.0 failed with error -110
 
 This error shows up at boot time. There are no new dmesg (or syslog) outputs
 upon inserting the SD card.

A web search shows some similar reports (e.g.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1329566,
http://askubuntu.com/questions/473848/ubuntu-14-04-realtek-semiconductor-co-ltd-rts5227-pci-express-card-reader-isn).
But in that last one, it turns out that the out-of-tree driver does
work.

Is there anything Philipp can do (e.g. debugging options) to help get
this fixed?

Ben.

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.


signature.asc
Description: This is a digitally signed message part


Bug#757733: RTS2557 SD card reader does not work

2014-08-10 Thread Philipp Hagemeister
 A web search shows some similar reports (e.g.
 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1329566,

http://askubuntu.com/questions/473848/ubuntu-14-04-realtek-semiconductor-co-ltd-rts5227-pci-express-card-reader-isn).
 But in that last one, it turns out that the out-of-tree driver does
 work.

Indeed, that is a workaround - download from
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1PNid=15PFid=25Level=4Conn=3DownTypeID=3GetDown=false
, apply the attached patch, remove all rtsx_* modules, and insert the
new rts2557 module into the kernel.

commit 31eeecabfabe62c9667464f2144cbbd57c370b6f
Author: Philipp Hagemeister phi...@phihag.de
Date:   Mon Aug 11 03:03:56 2014 +0200

Rename rts2559 to rts2557 and remove outdated macros

diff --git a/Makefile b/Makefile
index 6536bd4..7815096 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
 # Makefile for the PCI-Express Card Reader drivers.
 #
 
-TARGET_MODULE := rts5229
+TARGET_MODULE := rts5227
 
 EXTRA_CFLAGS := -Idrivers/scsi 
 
diff --git a/rtsx.c b/rtsx.c
index 7fd7a92..8ba9e19 100644
--- a/rtsx.c
+++ b/rtsx.c
@@ -263,7 +263,6 @@ static struct scsi_host_template rtsx_host_template = {
 	
 	.name =CR_DRIVER_NAME,
 	.proc_name =			CR_DRIVER_NAME,
-	.proc_info =			proc_info,
 	.info =host_info,
 
 	
@@ -911,7 +910,7 @@ static void rtsx_init_options(struct rtsx_chip *chip)
 	chip-support_mmc = 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;
@@ -1066,7 +1065,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);
 
@@ -1092,7 +1091,7 @@ static struct pci_driver driver = {
 	.name = CR_DRIVER_NAME,
 	.id_table = rts5229_ids,
 	.probe = rtsx_probe,
-	.remove = __devexit_p(rtsx_remove),
+	.remove = rtsx_remove,
 #ifdef CONFIG_PM
 	.suspend = rtsx_suspend,
 	.resume = rtsx_resume,
diff --git a/rtsx.h b/rtsx.h
index 3a1bb2f..98b26c4 100644
--- a/rtsx.h
+++ b/rtsx.h
@@ -52,7 +52,7 @@
 #include trace.h
 #include general.h
 
-#define CR_DRIVER_NAME		rts5229
+#define CR_DRIVER_NAME		rts5227
 
 
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 14)


signature.asc
Description: OpenPGP digital signature