[SRU] [B/C/D/Unstable] [PATCH 0/2] Enable new Realtek card reader

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU] [B/C/D/Unstable] [PATCH 0/2] Enable new Realtek card reader

Kai-Heng Feng
BugLink: https://bugs.launchpad.net/bugs/1806335

[Impact]
USB Storage based Realtek card reader doesn't work, because the
usb-storage module tries to use it in UAS mode instead of using
"ums-realtek".

[Fix]
Add new IDs to ums-realtek driver.
In addition to that, we add a new module knob, "enable_mmc=", to
enable/disable MMC, as vendors may not pay MMC royalties. "enable_mmc"
defaults to 1.

[Test]
After applying the patch, the card reader works, and verified
"enable_mmc=" can enable/disable MMC support.

[Regression Potential]
Minimal. This SRU enables two specific card readers that don't work as
UAS, the new module knob only introduces new behavior when enable_mmc=0.

Kai-Heng Feng (2):
  USB: usb-storage: Add new IDs to ums-realtek
  UBUNTU: SAUCE: (noup) USB: usb-storage: Make MMC support optional on
    ums-realtek

 drivers/usb/storage/realtek_cr.c      | 36 +++++++++++++++++++++++++++
 drivers/usb/storage/unusual_realtek.h | 10 ++++++++
 2 files changed, 46 insertions(+)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] USB: usb-storage: Add new IDs to ums-realtek

Kai-Heng Feng
https://bugs.launchpad.net/bugs/1806335

There are two new Realtek card readers require ums-realtek to work
correctly.

Add the new IDs to support them.

Signed-off-by: Kai-Heng Feng <[hidden email]>
Acked-by: Alan Stern <[hidden email]>
Cc: stable <[hidden email]>
Signed-off-by: Greg Kroah-Hartman <[hidden email]>
(cherry picked from commit a84a1bcc992f0545a51d2e120b8ca2ef20e2ea97)
Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 drivers/usb/storage/unusual_realtek.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/storage/unusual_realtek.h b/drivers/usb/storage/unusual_realtek.h
index d17cd95b55bb..6b2140f966ef 100644
--- a/drivers/usb/storage/unusual_realtek.h
+++ b/drivers/usb/storage/unusual_realtek.h
@@ -27,4 +27,14 @@ UNUSUAL_DEV(0x0bda, 0x0159, 0x0000, 0x9999,
  "USB Card Reader",
  USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
 
+UNUSUAL_DEV(0x0bda, 0x0177, 0x0000, 0x9999,
+ "Realtek",
+ "USB Card Reader",
+ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
+
+UNUSUAL_DEV(0x0bda, 0x0184, 0x0000, 0x9999,
+ "Realtek",
+ "USB Card Reader",
+ USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
+
 #endif  /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] UBUNTU: SAUCE: (noup) USB: usb-storage: Make MMC support optional on ums-realtek

Kai-Heng Feng
In reply to this post by Kai-Heng Feng
BugLink: https://bugs.launchpad.net/bugs/1806335

Hardware vendors may not pay the MMC royalty, so MMC support needs to be
disabled on Ubuntu pre-installed hardwares.

The current approach is to use an out-of-tree module to disable MMC
support, but it's hard to maintain and it disables secure boot.

Use a new knob "enable_mmc" to enable/disable mmc support, so
pre-installed systems can easily turn MMC off.

Realtek doesn't want this feature in mainline kernel, but they are okay
to have this in Ubuntu's kernel. So let's have it here.

Signed-off-by: Kai-Heng Feng <[hidden email]>
---
 drivers/usb/storage/realtek_cr.c | 36 ++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 31b024441938..63fcf38c548e 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -40,6 +40,10 @@ static int auto_delink_en = 1;
 module_param(auto_delink_en, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(auto_delink_en, "enable auto delink");
 
+static int enable_mmc = 1;
+module_param(enable_mmc, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(enable_mmc, "enable mmc support");
+
 #ifdef CONFIG_REALTEK_AUTOPM
 static int ss_en = 1;
 module_param(ss_en, int, S_IRUGO | S_IWUSR);
@@ -474,6 +478,27 @@ static int rts51x_check_status(struct us_data *us, u8 lun)
  return 0;
 }
 
+static int rts51x_lun_is_mmc_xd(struct us_data *us, u8 lun)
+{
+ struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra);
+
+ if (rts51x_check_status(us, lun))
+ return -EIO;
+
+ usb_stor_dbg(us,"cur_lun = 0x%02X\n", chip->status[lun].cur_lun);
+ usb_stor_dbg(us,"card_type = 0x%02X\n", chip->status[lun].card_type);
+ usb_stor_dbg(us,"detailed_type1= 0x%02X\n", chip->status[lun].detailed_type.detailed_type1);
+ switch (chip->status[lun].card_type) {
+ case 0x4: /* XD */
+ return 1;
+ case 0x2: /* SD/MMC */
+ if (chip->status[lun].detailed_type.detailed_type1 & 0x08)
+ return 1;
+ default:
+ return 0;
+ }
+}
+
 static int enable_oscillator(struct us_data *us)
 {
  int retval;
@@ -852,6 +877,17 @@ static void rts51x_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
  chip->proto_handler_backup(srb, us);
  /* Check whether card is plugged in */
  if (srb->cmnd[0] == TEST_UNIT_READY) {
+ if (!enable_mmc && rts51x_lun_is_mmc_xd(us, srb->device->lun)) {
+ usb_stor_dbg(us,"%s: lun is mmc/xd\n", __func__);
+ srb->result = SAM_STAT_CHECK_CONDITION;
+ memcpy(srb->sense_buffer,
+ media_not_present,
+ US_SENSE_SIZE);
+ CLR_LUN_READY(chip, srb->device->lun);
+ card_first_show = 1;
+ return;
+ }
+
  if (srb->result == SAM_STAT_GOOD) {
  SET_LUN_READY(chip, srb->device->lun);
  if (card_first_show) {
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK/cmnt: [PATCH 2/2] UBUNTU: SAUCE: (noup) USB: usb-storage: Make MMC support optional on ums-realtek

AceLan Kao
We keep having this kind of request from customers that they don't
want to support MMC. We usually provide DKMS package to disable it,
but it's a good idea to have an option to enable/disable this feature.

Acked-By: AceLan Kao <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[OEM-B]: [SRU] [B/C/D/Unstable] [PATCH 0/2] Enable new Realtek card reader

AceLan Kao
In reply to this post by Kai-Heng Feng
Applied on Ubuntu-oem-4.15.0-1030.35

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU] [B/C/D/Unstable] [PATCH 0/2] Enable new Realtek card reader

Kleber Souza
In reply to this post by Kai-Heng Feng
On 12/3/18 7:27 AM, Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1806335
>
> [Impact]
> USB Storage based Realtek card reader doesn't work, because the
> usb-storage module tries to use it in UAS mode instead of using
> "ums-realtek".
>
> [Fix]
> Add new IDs to ums-realtek driver.
> In addition to that, we add a new module knob, "enable_mmc=", to
> enable/disable MMC, as vendors may not pay MMC royalties. "enable_mmc"
> defaults to 1.
>
> [Test]
> After applying the patch, the card reader works, and verified
> "enable_mmc=" can enable/disable MMC support.
>
> [Regression Potential]
> Minimal. This SRU enables two specific card readers that don't work as
> UAS, the new module knob only introduces new behavior when enable_mmc=0.
>
> Kai-Heng Feng (2):
>   USB: usb-storage: Add new IDs to ums-realtek
>   UBUNTU: SAUCE: (noup) USB: usb-storage: Make MMC support optional on
>     ums-realtek
>
>  drivers/usb/storage/realtek_cr.c      | 36 +++++++++++++++++++++++++++
>  drivers/usb/storage/unusual_realtek.h | 10 ++++++++
>  2 files changed, 46 insertions(+)
>
Looks reasonable.


Acked-by: Kleber Sacilotto de Souza <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED/cmnt: [SRU] [B/C/D/Unstable] [PATCH 0/2] Enable new Realtek card reader

Khaled Elmously
In reply to this post by Kai-Heng Feng
Patch #1 was already present in D and unstable



On 2018-12-03 14:27:18 , Kai-Heng Feng wrote:

> BugLink: https://bugs.launchpad.net/bugs/1806335
>
> [Impact]
> USB Storage based Realtek card reader doesn't work, because the
> usb-storage module tries to use it in UAS mode instead of using
> "ums-realtek".
>
> [Fix]
> Add new IDs to ums-realtek driver.
> In addition to that, we add a new module knob, "enable_mmc=", to
> enable/disable MMC, as vendors may not pay MMC royalties. "enable_mmc"
> defaults to 1.
>
> [Test]
> After applying the patch, the card reader works, and verified
> "enable_mmc=" can enable/disable MMC support.
>
> [Regression Potential]
> Minimal. This SRU enables two specific card readers that don't work as
> UAS, the new module knob only introduces new behavior when enable_mmc=0.
>
> Kai-Heng Feng (2):
>   USB: usb-storage: Add new IDs to ums-realtek
>   UBUNTU: SAUCE: (noup) USB: usb-storage: Make MMC support optional on
>     ums-realtek
>
>  drivers/usb/storage/realtek_cr.c      | 36 +++++++++++++++++++++++++++
>  drivers/usb/storage/unusual_realtek.h | 10 ++++++++
>  2 files changed, 46 insertions(+)
>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team