]> Git Repo - J-linux.git/commitdiff
Merge patch series "scsi: ufs: Bug fixes for ufs core and platform drivers"
authorMartin K. Petersen <[email protected]>
Thu, 21 Nov 2024 03:04:15 +0000 (22:04 -0500)
committerMartin K. Petersen <[email protected]>
Thu, 21 Nov 2024 03:04:15 +0000 (22:04 -0500)
Manivannan Sadhasivam <[email protected]> says:

Hi,

This series has several bug fixes that I encountered when the ufs-qcom driver
was removed and inserted back. But the fixes are applicable to other platform
glue drivers as well.

This series is tested on Qcom RB5 development board based on SM8250 SoC.

Signed-off-by: Manivannan Sadhasivam <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin K. Petersen <[email protected]>
1  2 
drivers/ufs/core/ufshcd.c
drivers/ufs/host/cdns-pltfrm.c
drivers/ufs/host/tc-dwc-g210-pltfrm.c
drivers/ufs/host/ufs-exynos.c
drivers/ufs/host/ufs-hisi.c
drivers/ufs/host/ufs-mediatek.c
drivers/ufs/host/ufs-qcom.c
drivers/ufs/host/ufs-renesas.c
drivers/ufs/host/ufs-sprd.c

index dd31aa7c6785658f882f6421d0ab88b0441d1544,216d1ed60d1afa1b6e18fa2625f8dbb507d0db43..acc3607bbd9c3f840f37ab3e401f50c0ae688ab5
@@@ -4319,42 -4319,6 +4319,42 @@@ out_unlock
        return ret;
  }
  
 +/**
 + * ufshcd_send_bsg_uic_cmd - Send UIC commands requested via BSG layer and retrieve the result
 + * @hba: per adapter instance
 + * @uic_cmd: UIC command
 + *
 + * Return: 0 only if success.
 + */
 +int ufshcd_send_bsg_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
 +{
 +      int ret;
 +
 +      if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
 +              return 0;
 +
 +      ufshcd_hold(hba);
 +
 +      if (uic_cmd->argument1 == UIC_ARG_MIB(PA_PWRMODE) &&
 +          uic_cmd->command == UIC_CMD_DME_SET) {
 +              ret = ufshcd_uic_pwr_ctrl(hba, uic_cmd);
 +              goto out;
 +      }
 +
 +      mutex_lock(&hba->uic_cmd_mutex);
 +      ufshcd_add_delay_before_dme_cmd(hba);
 +
 +      ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
 +      if (!ret)
 +              ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
 +
 +      mutex_unlock(&hba->uic_cmd_mutex);
 +
 +out:
 +      ufshcd_release(hba);
 +      return ret;
 +}
 +
  /**
   * ufshcd_uic_change_pwr_mode - Perform the UIC power mode chage
   *                            using DME_SET primitives.
@@@ -8659,14 -8623,6 +8659,14 @@@ static int ufshcd_add_lus(struct ufs_hb
                ufshcd_init_clk_scaling_sysfs(hba);
        }
  
 +      /*
 +       * The RTC update code accesses the hba->ufs_device_wlun->sdev_gendev
 +       * pointer and hence must only be started after the WLUN pointer has
 +       * been initialized by ufshcd_scsi_add_wlus().
 +       */
 +      schedule_delayed_work(&hba->ufs_rtc_update_work,
 +                            msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
 +
        ufs_bsg_probe(hba);
        scsi_scan_host(hba->host);
  
@@@ -8761,6 -8717,8 +8761,6 @@@ static int ufshcd_post_device_init(stru
        ufshcd_force_reset_auto_bkops(hba);
  
        ufshcd_set_timestamp_attr(hba);
 -      schedule_delayed_work(&hba->ufs_rtc_update_work,
 -                            msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
  
        if (!hba->max_pwr_info.is_valid)
                return 0;
@@@ -10231,6 -10189,7 +10231,7 @@@ void ufshcd_remove(struct ufs_hba *hba
        ufs_hwmon_remove(hba);
        ufs_bsg_remove(hba);
        ufs_sysfs_remove_nodes(hba->dev);
+       cancel_delayed_work_sync(&hba->ufs_rtc_update_work);
        blk_mq_destroy_queue(hba->tmf_queue);
        blk_put_queue(hba->tmf_queue);
        blk_mq_free_tag_set(&hba->tmf_tag_set);
index c80f770a6285437d9ceec2b0fe7571b8b6cf5c8c,b31aa84111511bf2d1e2fcb7cf0a90ac14dd076c..e793e3538c48f81d794e09666696ad144016996f
@@@ -307,9 -307,7 +307,7 @@@ static int cdns_ufs_pltfrm_probe(struc
   */
  static void cdns_ufs_pltfrm_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba =  platform_get_drvdata(pdev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
  
  static struct platform_driver cdns_ufs_pltfrm_driver = {
        .probe  = cdns_ufs_pltfrm_probe,
 -      .remove_new = cdns_ufs_pltfrm_remove,
 +      .remove = cdns_ufs_pltfrm_remove,
        .driver = {
                .name   = "cdns-ufshcd",
                .pm     = &cdns_ufs_dev_pm_ops,
index 9bfaa36cc898675df7a1f026282af4ffb034ace9,c6f8565ede21a1872899d84bff15ee1212897e5b..454ac88c357da2d5d91636c30597a29873dddbd3
@@@ -76,10 -76,7 +76,7 @@@ static int tc_dwc_g210_pltfm_probe(stru
   */
  static void tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba =  platform_get_drvdata(pdev);
-       pm_runtime_get_sync(&(pdev)->dev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
@@@ -89,7 -86,7 +86,7 @@@
  
  static struct platform_driver tc_dwc_g210_pltfm_driver = {
        .probe          = tc_dwc_g210_pltfm_probe,
 -      .remove_new     = tc_dwc_g210_pltfm_remove,
 +      .remove         = tc_dwc_g210_pltfm_remove,
        .driver         = {
                .name   = "tc-dwc-g210-pltfm",
                .pm     = &tc_dwc_g210_pltfm_pm_ops,
index 4a9173cf44041f67859bc39eb55205f7d95ad7e3,9d4db13e142d51dafd2aed1fef5acc85c2816d1f..aa54ab035bf03b4d8d31a55bc34bb4d522b93767
@@@ -1992,8 -1992,7 +1992,7 @@@ static void exynos_ufs_remove(struct pl
        struct ufs_hba *hba =  platform_get_drvdata(pdev);
        struct exynos_ufs *ufs = ufshcd_get_variant(hba);
  
-       pm_runtime_get_sync(&(pdev)->dev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  
        phy_power_off(ufs->phy);
        phy_exit(ufs->phy);
@@@ -2166,7 -2165,7 +2165,7 @@@ static const struct dev_pm_ops exynos_u
  
  static struct platform_driver exynos_ufs_pltform = {
        .probe  = exynos_ufs_probe,
 -      .remove_new = exynos_ufs_remove,
 +      .remove = exynos_ufs_remove,
        .driver = {
                .name   = "exynos-ufshc",
                .pm     = &exynos_ufs_pm_ops,
index 494f593702a34d8ebbfd5d1c2a1f2296b34de687,501609521b2609077f0688c130aa1bbef39ed784..6e6569de74d8302a6cef78b771e6afb63b244a07
@@@ -576,9 -576,7 +576,7 @@@ static int ufs_hisi_probe(struct platfo
  
  static void ufs_hisi_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba =  platform_get_drvdata(pdev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  static const struct dev_pm_ops ufs_hisi_pm_ops = {
  
  static struct platform_driver ufs_hisi_pltform = {
        .probe  = ufs_hisi_probe,
 -      .remove_new = ufs_hisi_remove,
 +      .remove = ufs_hisi_remove,
        .driver = {
                .name   = "ufshcd-hisi",
                .pm     = &ufs_hisi_pm_ops,
index 6fc848d0ada8bcf13aaf9f095ad9e4e43876c743,ffe4d03a0f3833ca5332c21e017a7725f6616688..135cd78109e24e47e3bfab78434650ae90de4376
@@@ -1879,10 -1879,7 +1879,7 @@@ out
   */
  static void ufs_mtk_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba =  platform_get_drvdata(pdev);
-       pm_runtime_get_sync(&(pdev)->dev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  #ifdef CONFIG_PM_SLEEP
@@@ -1962,7 -1959,7 +1959,7 @@@ static const struct dev_pm_ops ufs_mtk_
  
  static struct platform_driver ufs_mtk_pltform = {
        .probe      = ufs_mtk_probe,
 -      .remove_new = ufs_mtk_remove,
 +      .remove = ufs_mtk_remove,
        .driver = {
                .name   = "ufshcd-mtk",
                .pm     = &ufs_mtk_pm_ops,
index d2b8d97b480eb14e7fc22a16f9e6f7ca779cd6e1,73b4fec8221a049d58501fb6e51e084e51f0a176..68040b2ab5f82777cb3f6e99c12e7dba0ce9a857
@@@ -1861,10 -1861,11 +1861,11 @@@ static int ufs_qcom_probe(struct platfo
  static void ufs_qcom_remove(struct platform_device *pdev)
  {
        struct ufs_hba *hba =  platform_get_drvdata(pdev);
+       struct ufs_qcom_host *host = ufshcd_get_variant(hba);
  
-       pm_runtime_get_sync(&(pdev)->dev);
-       ufshcd_remove(hba);
-       platform_device_msi_free_irqs_all(hba->dev);
+       ufshcd_pltfrm_remove(pdev);
+       if (host->esi_enabled)
+               platform_device_msi_free_irqs_all(hba->dev);
  }
  
  static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {
@@@ -1897,7 -1898,7 +1898,7 @@@ static const struct dev_pm_ops ufs_qcom
  
  static struct platform_driver ufs_qcom_pltform = {
        .probe  = ufs_qcom_probe,
 -      .remove_new = ufs_qcom_remove,
 +      .remove = ufs_qcom_remove,
        .driver = {
                .name   = "ufshcd-qcom",
                .pm     = &ufs_qcom_pm_ops,
index f404019dc5d960fc55a706a8103f18b5aed4e6a8,21a64b34397d8c64736440f30812a35aedeb1027..03cd82db751b013d8f2f8e57eec9794386e1e25a
@@@ -397,14 -397,12 +397,12 @@@ static int ufs_renesas_probe(struct pla
  
  static void ufs_renesas_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba = platform_get_drvdata(pdev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  static struct platform_driver ufs_renesas_platform = {
        .probe  = ufs_renesas_probe,
 -      .remove_new = ufs_renesas_remove,
 +      .remove = ufs_renesas_remove,
        .driver = {
                .name   = "ufshcd-renesas",
                .of_match_table = of_match_ptr(ufs_renesas_of_match),
index b1ffb9b05fa75fe2e6f90ac318ea468e9273264a,d220978c2d8c8ac83c5c5be9e143ee141c9fc9fe..b1d532363f9d490b3415cc1b9d98604c8ddf44cd
@@@ -427,10 -427,7 +427,7 @@@ static int ufs_sprd_probe(struct platfo
  
  static void ufs_sprd_remove(struct platform_device *pdev)
  {
-       struct ufs_hba *hba =  platform_get_drvdata(pdev);
-       pm_runtime_get_sync(&(pdev)->dev);
-       ufshcd_remove(hba);
+       ufshcd_pltfrm_remove(pdev);
  }
  
  static const struct dev_pm_ops ufs_sprd_pm_ops = {
  
  static struct platform_driver ufs_sprd_pltform = {
        .probe = ufs_sprd_probe,
 -      .remove_new = ufs_sprd_remove,
 +      .remove = ufs_sprd_remove,
        .driver = {
                .name = "ufshcd-sprd",
                .pm = &ufs_sprd_pm_ops,
This page took 0.086598 seconds and 4 git commands to generate.