This series brings up UFS on the Sony Xperia "Yoshino" (MSM8998) and
"Tama" (SDM845) families.

The work falls into four layers:

1. A small refactor that extends ufs_dev_desc with the product revision
   string and the UFS spec version (patch 1). No behaviour change.

2. A device-quirk infrastructure (patches 2-4) that lets us match
   per-device link / power-mode workarounds against manufacturer id,
   model and fw revision:

     - patch 2: generic ufs_fixups[] table and ufshcd_fixup_dev_quirks(),
       called from ufs_start() before power-mode negotiation
     - patch 3: UFS_DEVICE_QUIRK_EXTEND_SYNC_LENGTH for SK Hynix devices
       that need PA_TxHsG{1,2,3}SyncLength programmed to 0x48
     - patch 4: CONFIG_UFS_RESTRICT_TX_LANES build-time knob for boards
       with only a single reliable TX lane. Defaults to N so nothing
       else is affected.

3. The NO_PURGE quirk for devices that brick if issued PURGE / UNMAP
   (patches 5-7):

     - patch 5: refuse erase/UNMAP in the SCSI uclass when NO_PURGE
       is set on the underlying UFS device
     - patch 6: print device identification (vendor / model / rev /
       spec version) at probe so quirk matching is observable on the
       console
     - patch 7: a platform gate that auto-enables NO_PURGE on Sony
       Yoshino/Tama compatibles because per-UFS-chip rows can't see
       blank string descriptors on some affected boards.

4. Akatsuki DTS enablement (patch 8): re-enable the UFS controller node.

Background on NO_PURGE: on the affected Sony platforms the SCSI ERASE /
UNMAP / WRITE_BUFFER PURGE operation overwrites the bootloader region
and permanently bricks the device.

Based on the linux patches by Angelo:
https://github.com/kholk/kernel/commit/2e7a9ee1c91a016baa0b826a7752ec45663a0561

Tested on Sony XZ3 (akatsuki, SDM845) where U-Boot enumerates UFS LUN0
and exposes the GPT.

```
UFS Device Information (ufshc@1d84000)
  Manufacturer:    Samsung (0x01ce)
  Model:           (unset)
  Revision:        (unset)
  Spec Version:    0x0210
  Gear  - RX: 3, TX: 3
  Lane  - RX: 2, TX: 2
  Power - RX: 1, TX: 1, HS rate: 2
  Device Quirks:   0x00000001
  NO_PURGE Quirk:  Yes

...

=> scsi erase 0 1

scsi erase: device 0 block # 0, count 1 ... scsi_erase: erase not supported on 
this device
0 blocks erased: ERROR
=> 
```

Signed-off-by: Petr Hodina <[email protected]>
---
Petr Hodina (8):
      ufs: read product revision and spec version into ufs_dev_desc
      ufs: add device-quirk infrastructure
      ufs: program extended HS sync length for SK Hynix devices
      ufs: add CONFIG_UFS_RESTRICT_TX_LANES
      scsi: ufs: refuse erase/UNMAP on NO_PURGE devices
      ufs: print device information at probe
      ufs: gate NO_PURGE on Sony Yoshino/Tama platform compatible
      arm: dts: qcom: akatsuki: re-enable the UFS controller node

 MAINTAINERS                                        |   1 +
 .../sdm845-sony-xperia-tama-akatsuki-u-boot.dtsi   |   9 +
 drivers/scsi/scsi.c                                |   5 +
 drivers/ufs/Kconfig                                |  14 ++
 drivers/ufs/ufs-uclass.c                           | 197 +++++++++++++++++++++
 drivers/ufs/ufs.h                                  |   7 +
 drivers/ufs/ufs_quirks.h                           |  94 ++++++++++
 drivers/ufs/unipro.h                               |   3 +
 include/scsi.h                                     |   5 +
 9 files changed, 335 insertions(+)
---
base-commit: ece349ade2973e220f524ce59e59711cc919263f
change-id: 20260611-b4-ufs-sony-794325f6f4af

Best regards,
--  
Petr Hodina <[email protected]>


Reply via email to