[PATCH 0/3] scsi:ufs: Fix failure to read the string descriptor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fix failure to read the string descriptor.

In kernel v4.9.100,we encountered the following error info:

[3.141326] ufshcd-hi3660 ff3b0000.ufs: ufshcd_read_desc_param: Failed reading descriptor. desc_id 0 param_offset 0 buff_len 31 ret 0
[3.141331] ufshcd-hi3660 ff3b0000.ufs: ufs_get_device_info: Failed reading Device Desc. err = -22
[3.141336] ufshcd-hi3660 ff3b0000.ufs: ufs_advertise_fixup_device: Failed getting device info. err = -22
[3.145923] ufs final power mode: gear = 3, lane = 2, pwr = 1, rate = 2
[3.145927] ufshcd-hi3660 ff3b0000.ufs: set TX_EQUALIZER 3.5db
[3.157229] ufshcd-hi3660 ff3b0000.ufs: check TX_EQUALIZER DB value lane0 = 0x1
[3.157716] ufshcd-hi3660 ff3b0000.ufs: check TX_EQUALIZER DB value lane1 = 0x1
[3.190446] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.227484] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.263496] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.299509] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.335528] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.371501] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.407493] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.443501] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11
[3.479491] ufshcd-hi3660 ff3b0000.ufs: ufshcd_query_flag: Sending flag query for idn 3 failed, err = -11

If failed to read device desc, card_data->wmanufacturerid and card_data->model will not get the correct value,
meaning that hba->dev_quirks will no longer work. And some ufs device's quirks handling will even cause ufs can't work.
In fact, our hikey960 board using Hynix ufs device failed to initialize on v4.9 because a quirk of the hynix device was not handled.

We test with hikey960 & hikey970 boards in aosp-master hikey-linaro-4.9 (v4.9.100), this patch can solve the above problem perfectly.

[3.223550] ufs final power mode: gear = 3, lane = 2, pwr = 1, rate = 2
[3.223565] ufshcd-hi3660 ff3b0000.ufs: set TX_EQUALIZER 3.5db
[3.223609] ufs flash device must set VS_DebugSaveConfigTime 0x10
[3.226218] ufshcd-hi3660 ff3b0000.ufs: check TX_EQUALIZER DB value lane0 = 0x1
[3.226247] ufshcd-hi3660 ff3b0000.ufs: check TX_EQUALIZER DB value lane1 = 0x1
[3.226400] ufshcd-hi3660 ff3b0000.ufs: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0
[3.232847] scsi 0:0:0:49488: Well-known LUN    SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.321453] scsi 0:0:0:49456: Well-known LUN    SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.383820] scsi 0:0:0:49476: Well-known LUN    SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.447615] scsi 0:0:0:0: Direct-Access     SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.503504] sd 0:0:0:0: [sda] 1024 4096-byte logical blocks: (4.19 MB/4.00 MiB)
[3.503863] sd 0:0:0:0: [sda] Write Protect is off
[3.503867] sd 0:0:0:0: [sda] Mode Sense: 00 32 00 10
[3.503963] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[3.504017] scsi 0:0:0:1: Direct-Access     SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.505615] sd 0:0:0:0: [sda] Attached SCSI disk
[3.547425] sd 0:0:0:1: [sdb] 1024 4096-byte logical blocks: (4.19 MB/4.00 MiB)
[3.547768] scsi 0:0:0:2: Direct-Access     SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.548003] sd 0:0:0:1: [sdb] Write Protect is off
[3.548005] sd 0:0:0:1: [sdb] Mode Sense: 00 32 00 10
[3.548428] sd 0:0:0:1: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
[3.553383] sd 0:0:0:1: [sdb] Attached SCSI disk
[3.591547] sd 0:0:0:2: [sdc] 2048 4096-byte logical blocks: (8.39 MB/8.00 MiB)
[3.592056] scsi 0:0:0:3: Direct-Access     SKhynix  H28U62301AMR     H109 PQ: 0 ANSI: 6
[3.593336] sd 0:0:0:2: [sdc] Write Protect is off
[3.593340] sd 0:0:0:2: [sdc] Mode Sense: 00 32 00 10
[3.593638] sd 0:0:0:2: [sdc] Write cache: enabled, read cache: enabled, supports DPO and FUA
[3.596473] Alternate GPT is invalid, using primary GPT.
[3.596480]  sdc: sdc1
[3.597069] random: fast init done
[3.597168] sd 0:0:0:2: [sdc] Attached SCSI disk
[3.644460] sd 0:0:0:3: [sdd] 7805952 4096-byte logical blocks: (32.0 GB/29.8 GiB)
[3.644867] sd 0:0:0:3: [sdd] Write Protect is off
[3.644869] sd 0:0:0:3: [sdd] Mode Sense: 00 32 00 10
[3.644992] sd 0:0:0:3: [sdd] Write cache: enabled, read cache: enabled, supports DPO and FUA
[3.646506] Alternate GPT is invalid, using primary GPT.
[3.646518]  sdd: sdd1 sdd2 sdd3 sdd4 sdd5 sdd6 sdd7 sdd8 sdd9 sdd10 sdd11 sdd12 sdd13
[3.647956] sd 0:0:0:3: [sdd] Attached SCSI disk

We hope merge this patch to 4.9-stable to avoid other similar problems.

Potomski, MichalX (1):
  scsi: ufs: Factor out ufshcd_read_desc_param

Tomas Winkler (1):
  scsi: ufs: refactor device descriptor reading

subhashj@xxxxxxxxxxxxxx (1):
  scsi: ufs: fix failure to read the string descriptor

 drivers/scsi/ufs/ufs.h        |  34 +++---
 drivers/scsi/ufs/ufs_quirks.h |  28 +----
 drivers/scsi/ufs/ufshcd.c     | 272 +++++++++++++++++++++++++++++++-----------
 drivers/scsi/ufs/ufshcd.h     |  16 +++
 4 files changed, 246 insertions(+), 104 deletions(-)

-- 
2.15.0




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux