[v5,00/23] ufs: qcom: Add HS-G4 support

Message ID 20221222141001.54849-1-manivannan.sadhasivam@linaro.org
Headers
Series ufs: qcom: Add HS-G4 support |

Message

Manivannan Sadhasivam Dec. 22, 2022, 2:09 p.m. UTC
  Hello,

This series adds HS-G4 support to the Qcom UFS driver and PHY driver.
The newer Qcom platforms support configuring the UFS controller and PHY
in dual gears (i.e., controller/PHY can be configured to run in two gear
speeds). This is accomplished by adding two different PHY init sequences
to the PHY driver and the UFS driver requesting the one that's required
based on the platform configuration.

Initially the ufs-qcom driver will use the default gear G2 for enumerating
the UFS device. Afer enumeration, the max gear supported by both the
controller and device would be found out and that will be used thereafter.
But for using the max gear after enumeration, the ufs-qcom driver requires
the UFS device to be reinitialized. For this purpose, a separate quirk has
been introduced in the UFS core along with a callback and those will be used
by the ufs-qcom driver.

This series has been tested on following platforms:

* Qcom RB5 development platform powered by SM8250 SoC
* SM8450 based dev board
* Qdrive3/sa8540p-ride board based on SC8280XP (derivative)

Merging Strategy:
-----------------

The PHY patches are expected to go through PHY tree and UFS, MAINTAINERS
patches are expected to go through SCSI tree.

NOTE: Since this series targets multiple SoCs (base like SM8350) and
(derivative like SC8280XP), testing on all of these platforms is really
appreciated. Although, if the series works for base SoC, then for derivatives
also it should work.

Thanks,
Mani

Changes in v5:

* Collected Review and tested-by tags
* Reworded patch 18/23 (Bart) and also the comment for reinit_notify

Changes in v4:

* Dropped HS G3 specific setting from SM8350 default init sequence
* Added G4 support to SM8350 and SC8280XP
* Covered all qcom files under drivers/ufs/host in MAINTAINERS file
* Added missing Suggested-by tags for Can Guo
* Rebased on top of linux-next 20221201

Changes in v3:

* Dropped the "device-max-gear" DT property and switched to reinitialization (Krzysztof)
* Added HS-G4 support to all compatible SoCs (SM8150, SM8250 and SM8450). This will also
  benefit the derivative SoCs of these platforms like SC8180x, SC8280x etc...
* Splitted the qmp_phy_init_tbl changes into separate patches (Vinod)
* Collected reviews from Andrew H

Changes in v2:

* Collected reviews from Dmitry
* Renamed "max-gear" property to "max-device-gear"
* Used min() for deciding which gear to use instead of open comparision
* Added comment about the old register name

Manivannan Sadhasivam (23):
  phy: qcom-qmp-ufs: Remove _tbl suffix from qmp_phy_init_tbl
    definitions
  phy: qcom-qmp-ufs: Rename MSM8996 PHY definitions
  phy: qcom-qmp-ufs: Move register settings to qmp_phy_cfg_tbls struct
  phy: qcom-qmp-ufs: Add support for configuring PHY in HS Series B mode
  phy: qcom-qmp-ufs: Add support for configuring PHY in HS G4 mode
  phy: qcom-qmp-ufs: Move HS Rate B register setting to tbls_hs_b
  phy: qcom-qmp-ufs: Add HS G4 mode support to SM8150 SoC
  phy: qcom-qmp-ufs: Add HS G4 mode support to SM8250 SoC
  phy: qcom-qmp-ufs: Avoid setting HS G3 specific registers
  phy: qcom-qmp-ufs: Add HS G4 mode support to SM8350 SoC
  phy: qcom-qmp-ufs: Add HS G4 mode support to SM8450 SoC
  phy: qcom-qmp-ufs: Add HS G4 mode support to SC8280XP SoC
  scsi: ufs: ufs-qcom: Remove un-necessary goto statements
  scsi: ufs: ufs-qcom: Remove un-necessary WARN_ON()
  scsi: ufs: ufs-qcom: Use bitfields where appropriate
  scsi: ufs: ufs-qcom: Use dev_err_probe() for printing probe error
  scsi: ufs: ufs-qcom: Fix the Qcom register name for offset 0xD0
  scsi: ufs: core: Add reinit_notify() callback
  scsi: ufs: core: Add support for reinitializing the UFS device
  scsi: ufs: ufs-qcom: Factor out the logic finding the HS Gear
  scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device
  scsi: ufs: ufs-qcom: Add support for finding max gear on new platforms
  MAINTAINERS: Add myself as the maintainer for Qcom UFS drivers

 MAINTAINERS                                   |   8 +
 .../phy/qualcomm/phy-qcom-qmp-pcs-ufs-v5.h    |   1 +
 drivers/phy/qualcomm/phy-qcom-qmp-ufs.c       | 454 +++++++++++++-----
 drivers/ufs/core/ufshcd-priv.h                |   6 +
 drivers/ufs/core/ufshcd.c                     |  63 ++-
 drivers/ufs/host/ufs-qcom.c                   | 170 +++----
 drivers/ufs/host/ufs-qcom.h                   |  70 +--
 include/ufs/ufshcd.h                          |   8 +
 8 files changed, 532 insertions(+), 248 deletions(-)
  

Comments

Martin K. Petersen Dec. 30, 2022, 11:29 p.m. UTC | #1
Manivannan,

>   scsi: ufs: core: Add reinit_notify() callback
>   scsi: ufs: core: Add support for reinitializing the UFS device

I would like to see some reviews of the proposed core changes.
  
Manivannan Sadhasivam Jan. 2, 2023, 8:47 a.m. UTC | #2
Hi Martin,

On Fri, Dec 30, 2022 at 06:29:24PM -0500, Martin K. Petersen wrote:
> 
> Manivannan,
> 
> >   scsi: ufs: core: Add reinit_notify() callback
> >   scsi: ufs: core: Add support for reinitializing the UFS device
> 
> I would like to see some reviews of the proposed core changes.
> 

Both patches are reviewed by Bart now.

Thanks,
Mani

> -- 
> Martin K. Petersen	Oracle Linux Engineering
  
Martin K. Petersen Jan. 5, 2023, 2:37 a.m. UTC | #3
Manivannan,

>> >   scsi: ufs: core: Add reinit_notify() callback
>> >   scsi: ufs: core: Add support for reinitializing the UFS device
>> 
>> I would like to see some reviews of the proposed core changes.
>> 
>
> Both patches are reviewed by Bart now.

Series applied to 6.3/scsi-staging, thanks!
  
Manivannan Sadhasivam Jan. 5, 2023, 10 a.m. UTC | #4
On Wed, Jan 04, 2023 at 09:37:56PM -0500, Martin K. Petersen wrote:
> 
> Manivannan,
> 
> >> >   scsi: ufs: core: Add reinit_notify() callback
> >> >   scsi: ufs: core: Add support for reinitializing the UFS device
> >> 
> >> I would like to see some reviews of the proposed core changes.
> >> 
> >
> > Both patches are reviewed by Bart now.
> 
> Series applied to 6.3/scsi-staging, thanks!
> 

Thanks Martin! I presume that you have applied only the ufs patches as
mentioned in the cover letter. PHY patches are expected to go through PHY tree.

I cannot see the patches in 6.3/scsi-staging branch yet, so couldn't confirm.

Thanks,
Mani

> -- 
> Martin K. Petersen	Oracle Linux Engineering
  
Martin K. Petersen Jan. 6, 2023, 3:02 a.m. UTC | #5
Manivannan,

> Thanks Martin! I presume that you have applied only the ufs patches as
> mentioned in the cover letter. PHY patches are expected to go through
> PHY tree.

Correct, I only took the SCSI patches.

> I cannot see the patches in 6.3/scsi-staging branch yet, so couldn't
> confirm.

I did not push my tree to kernel.org as I discovered that one of the
merges had pulled in a bunch of unrelated commits into staging. Will
resolve this tomorrow.
  
Manivannan Sadhasivam Jan. 6, 2023, 8:46 a.m. UTC | #6
On Thu, Jan 05, 2023 at 10:02:56PM -0500, Martin K. Petersen wrote:
> 
> Manivannan,
> 
> > Thanks Martin! I presume that you have applied only the ufs patches as
> > mentioned in the cover letter. PHY patches are expected to go through
> > PHY tree.
> 
> Correct, I only took the SCSI patches.
> 
> > I cannot see the patches in 6.3/scsi-staging branch yet, so couldn't
> > confirm.
> 
> I did not push my tree to kernel.org as I discovered that one of the
> merges had pulled in a bunch of unrelated commits into staging. Will
> resolve this tomorrow.
> 

Okay. Thanks for confirming!

-Mani

> -- 
> Martin K. Petersen	Oracle Linux Engineering
  
Vinod Koul Jan. 12, 2023, 6:11 p.m. UTC | #7
On 22-12-22, 19:39, Manivannan Sadhasivam wrote:
> Hello,
> 
> This series adds HS-G4 support to the Qcom UFS driver and PHY driver.
> The newer Qcom platforms support configuring the UFS controller and PHY
> in dual gears (i.e., controller/PHY can be configured to run in two gear
> speeds). This is accomplished by adding two different PHY init sequences
> to the PHY driver and the UFS driver requesting the one that's required
> based on the platform configuration.
> 
> Initially the ufs-qcom driver will use the default gear G2 for enumerating
> the UFS device. Afer enumeration, the max gear supported by both the
> controller and device would be found out and that will be used thereafter.
> But for using the max gear after enumeration, the ufs-qcom driver requires
> the UFS device to be reinitialized. For this purpose, a separate quirk has
> been introduced in the UFS core along with a callback and those will be used
> by the ufs-qcom driver.

The series lgtm. This fails for me to apply though due to other patches
I have picked up.

Can you please rebase the phy patches and send those
  
Martin K. Petersen Jan. 14, 2023, 3:06 a.m. UTC | #8
On Thu, 22 Dec 2022 19:39:38 +0530, Manivannan Sadhasivam wrote:

> This series adds HS-G4 support to the Qcom UFS driver and PHY driver.
> The newer Qcom platforms support configuring the UFS controller and PHY
> in dual gears (i.e., controller/PHY can be configured to run in two gear
> speeds). This is accomplished by adding two different PHY init sequences
> to the PHY driver and the UFS driver requesting the one that's required
> based on the platform configuration.
> 
> [...]

Applied to 6.3/scsi-queue, thanks!

[13/23] scsi: ufs: ufs-qcom: Remove un-necessary goto statements
        https://git.kernel.org/mkp/scsi/c/031312dbc695
[14/23] scsi: ufs: ufs-qcom: Remove un-necessary WARN_ON()
        https://git.kernel.org/mkp/scsi/c/a98c2183e81d
[15/23] scsi: ufs: ufs-qcom: Use bitfields where appropriate
        https://git.kernel.org/mkp/scsi/c/18fe2ab79bcf
[16/23] scsi: ufs: ufs-qcom: Use dev_err_probe() for printing probe error
        https://git.kernel.org/mkp/scsi/c/132b027205ef
[17/23] scsi: ufs: ufs-qcom: Fix the Qcom register name for offset 0xD0
        https://git.kernel.org/mkp/scsi/c/7959587f3284
[18/23] scsi: ufs: core: Add reinit_notify() callback
        https://git.kernel.org/mkp/scsi/c/c2c38c573a2e
[19/23] scsi: ufs: core: Add support for reinitializing the UFS device
        https://git.kernel.org/mkp/scsi/c/96a7141da332
[20/23] scsi: ufs: ufs-qcom: Factor out the logic finding the HS Gear
        https://git.kernel.org/mkp/scsi/c/c270986527f9
[21/23] scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device
        https://git.kernel.org/mkp/scsi/c/baf5ddac90dc
[22/23] scsi: ufs: ufs-qcom: Add support for finding max gear on new platforms
        https://git.kernel.org/mkp/scsi/c/2c407fe97015
[23/23] MAINTAINERS: Add myself as the maintainer for Qcom UFS drivers
        https://git.kernel.org/mkp/scsi/c/39beef59128f
  
Manivannan Sadhasivam Jan. 14, 2023, 7:11 a.m. UTC | #9
On Thu, Jan 12, 2023 at 11:41:13PM +0530, Vinod Koul wrote:
> On 22-12-22, 19:39, Manivannan Sadhasivam wrote:
> > Hello,
> > 
> > This series adds HS-G4 support to the Qcom UFS driver and PHY driver.
> > The newer Qcom platforms support configuring the UFS controller and PHY
> > in dual gears (i.e., controller/PHY can be configured to run in two gear
> > speeds). This is accomplished by adding two different PHY init sequences
> > to the PHY driver and the UFS driver requesting the one that's required
> > based on the platform configuration.
> > 
> > Initially the ufs-qcom driver will use the default gear G2 for enumerating
> > the UFS device. Afer enumeration, the max gear supported by both the
> > controller and device would be found out and that will be used thereafter.
> > But for using the max gear after enumeration, the ufs-qcom driver requires
> > the UFS device to be reinitialized. For this purpose, a separate quirk has
> > been introduced in the UFS core along with a callback and those will be used
> > by the ufs-qcom driver.
> 
> The series lgtm. This fails for me to apply though due to other patches
> I have picked up.
> 
> Can you please rebase the phy patches and send those 
> 

Done!

Thanks,
Mani

> -- 
> ~Vinod