Skip to content

Commit 467e6cc

Browse files
Merge patch series "UFS host controller driver patches"
Bart Van Assche <[email protected]> says: Please consider these four UFS host controller driver patches for the next merge window. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents f762326 + 0818a69 commit 467e6cc

File tree

13 files changed

+25
-77
lines changed

13 files changed

+25
-77
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2899,7 +2899,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
28992899
ufshcd_hold(hba);
29002900

29012901
lrbp = &hba->lrb[tag];
2902-
WARN_ON(lrbp->cmd);
29032902
lrbp->cmd = cmd;
29042903
lrbp->task_tag = tag;
29052904
lrbp->lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun);
@@ -2915,7 +2914,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
29152914

29162915
err = ufshcd_map_sg(hba, lrbp);
29172916
if (err) {
2918-
lrbp->cmd = NULL;
29192917
ufshcd_release(hba);
29202918
goto out;
29212919
}
@@ -3178,7 +3176,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
31783176
down_read(&hba->clk_scaling_lock);
31793177

31803178
lrbp = &hba->lrb[tag];
3181-
WARN_ON(lrbp->cmd);
3179+
lrbp->cmd = NULL;
31823180
err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag);
31833181
if (unlikely(err))
31843182
goto out;
@@ -5418,7 +5416,6 @@ void ufshcd_release_scsi_cmd(struct ufs_hba *hba,
54185416
struct scsi_cmnd *cmd = lrbp->cmd;
54195417

54205418
scsi_dma_unmap(cmd);
5421-
lrbp->cmd = NULL; /* Mark the command as completed. */
54225419
ufshcd_release(hba);
54235420
ufshcd_clk_scaling_update_busy(hba);
54245421
}
@@ -7106,7 +7103,6 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
71067103
down_read(&hba->clk_scaling_lock);
71077104

71087105
lrbp = &hba->lrb[tag];
7109-
WARN_ON(lrbp->cmd);
71107106
lrbp->cmd = NULL;
71117107
lrbp->task_tag = tag;
71127108
lrbp->lun = 0;
@@ -7278,7 +7274,6 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *r
72787274
down_read(&hba->clk_scaling_lock);
72797275

72807276
lrbp = &hba->lrb[tag];
7281-
WARN_ON(lrbp->cmd);
72827277
lrbp->cmd = NULL;
72837278
lrbp->task_tag = tag;
72847279
lrbp->lun = UFS_UPIU_RPMB_WLUN;
@@ -9296,7 +9291,8 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev,
92969291
};
92979292

92989293
return scsi_execute_cmd(sdev, cdb, REQ_OP_DRV_IN, /*buffer=*/NULL,
9299-
/*bufflen=*/0, /*timeout=*/HZ, /*retries=*/0, &args);
9294+
/*bufflen=*/0, /*timeout=*/10 * HZ, /*retries=*/0,
9295+
&args);
93009296
}
93019297

93029298
/**
@@ -9879,28 +9875,6 @@ static int ufshcd_wl_resume(struct device *dev)
98799875
}
98809876
#endif
98819877

9882-
static void ufshcd_wl_shutdown(struct device *dev)
9883-
{
9884-
struct scsi_device *sdev = to_scsi_device(dev);
9885-
struct ufs_hba *hba;
9886-
9887-
hba = shost_priv(sdev->host);
9888-
9889-
down(&hba->host_sem);
9890-
hba->shutting_down = true;
9891-
up(&hba->host_sem);
9892-
9893-
/* Turn on everything while shutting down */
9894-
ufshcd_rpm_get_sync(hba);
9895-
scsi_device_quiesce(sdev);
9896-
shost_for_each_device(sdev, hba->host) {
9897-
if (sdev == hba->ufs_device_wlun)
9898-
continue;
9899-
scsi_device_quiesce(sdev);
9900-
}
9901-
__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
9902-
}
9903-
99049878
/**
99059879
* ufshcd_suspend - helper function for suspend operations
99069880
* @hba: per adapter instance
@@ -10085,25 +10059,34 @@ int ufshcd_runtime_resume(struct device *dev)
1008510059
EXPORT_SYMBOL(ufshcd_runtime_resume);
1008610060
#endif /* CONFIG_PM */
1008710061

10088-
/**
10089-
* ufshcd_shutdown - shutdown routine
10090-
* @hba: per adapter instance
10091-
*
10092-
* This function would turn off both UFS device and UFS hba
10093-
* regulators. It would also disable clocks.
10094-
*
10095-
* Returns 0 always to allow force shutdown even in case of errors.
10096-
*/
10097-
int ufshcd_shutdown(struct ufs_hba *hba)
10062+
static void ufshcd_wl_shutdown(struct device *dev)
1009810063
{
10064+
struct scsi_device *sdev = to_scsi_device(dev);
10065+
struct ufs_hba *hba = shost_priv(sdev->host);
10066+
10067+
down(&hba->host_sem);
10068+
hba->shutting_down = true;
10069+
up(&hba->host_sem);
10070+
10071+
/* Turn on everything while shutting down */
10072+
ufshcd_rpm_get_sync(hba);
10073+
scsi_device_quiesce(sdev);
10074+
shost_for_each_device(sdev, hba->host) {
10075+
if (sdev == hba->ufs_device_wlun)
10076+
continue;
10077+
scsi_device_quiesce(sdev);
10078+
}
10079+
__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
10080+
10081+
/*
10082+
* Next, turn off the UFS controller and the UFS regulators. Disable
10083+
* clocks.
10084+
*/
1009910085
if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
1010010086
ufshcd_suspend(hba);
1010110087

1010210088
hba->is_powered = false;
10103-
/* allow force shutdown even in case of errors */
10104-
return 0;
1010510089
}
10106-
EXPORT_SYMBOL(ufshcd_shutdown);
1010710090

1010810091
/**
1010910092
* ufshcd_remove - de-allocate SCSI host and host memory space

drivers/ufs/host/cdns-pltfrm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {
328328
static struct platform_driver cdns_ufs_pltfrm_driver = {
329329
.probe = cdns_ufs_pltfrm_probe,
330330
.remove = cdns_ufs_pltfrm_remove,
331-
.shutdown = ufshcd_pltfrm_shutdown,
332331
.driver = {
333332
.name = "cdns-ufshcd",
334333
.pm = &cdns_ufs_dev_pm_ops,

drivers/ufs/host/tc-dwc-g210-pci.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ static struct ufs_hba_variant_ops tc_dwc_g210_pci_hba_vops = {
3232
.link_startup_notify = ufshcd_dwc_link_startup_notify,
3333
};
3434

35-
/**
36-
* tc_dwc_g210_pci_shutdown - main function to put the controller in reset state
37-
* @pdev: pointer to PCI device handle
38-
*/
39-
static void tc_dwc_g210_pci_shutdown(struct pci_dev *pdev)
40-
{
41-
ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
42-
}
43-
4435
/**
4536
* tc_dwc_g210_pci_remove - de-allocate PCI/SCSI host and host memory space
4637
* data structure memory
@@ -137,7 +128,6 @@ static struct pci_driver tc_dwc_g210_pci_driver = {
137128
.id_table = tc_dwc_g210_pci_tbl,
138129
.probe = tc_dwc_g210_pci_probe,
139130
.remove = tc_dwc_g210_pci_remove,
140-
.shutdown = tc_dwc_g210_pci_shutdown,
141131
.driver = {
142132
.pm = &tc_dwc_g210_pci_pm_ops
143133
},

drivers/ufs/host/tc-dwc-g210-pltfrm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
9292
static struct platform_driver tc_dwc_g210_pltfm_driver = {
9393
.probe = tc_dwc_g210_pltfm_probe,
9494
.remove = tc_dwc_g210_pltfm_remove,
95-
.shutdown = ufshcd_pltfrm_shutdown,
9695
.driver = {
9796
.name = "tc-dwc-g210-pltfm",
9897
.pm = &tc_dwc_g210_pltfm_pm_ops,

drivers/ufs/host/ufs-exynos.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,6 @@ static const struct dev_pm_ops exynos_ufs_pm_ops = {
17571757
static struct platform_driver exynos_ufs_pltform = {
17581758
.probe = exynos_ufs_probe,
17591759
.remove = exynos_ufs_remove,
1760-
.shutdown = ufshcd_pltfrm_shutdown,
17611760
.driver = {
17621761
.name = "exynos-ufshc",
17631762
.pm = &exynos_ufs_pm_ops,

drivers/ufs/host/ufs-hisi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ static const struct dev_pm_ops ufs_hisi_pm_ops = {
593593
static struct platform_driver ufs_hisi_pltform = {
594594
.probe = ufs_hisi_probe,
595595
.remove = ufs_hisi_remove,
596-
.shutdown = ufshcd_pltfrm_shutdown,
597596
.driver = {
598597
.name = "ufshcd-hisi",
599598
.pm = &ufs_hisi_pm_ops,

drivers/ufs/host/ufs-mediatek.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,6 @@ static const struct dev_pm_ops ufs_mtk_pm_ops = {
16471647
static struct platform_driver ufs_mtk_pltform = {
16481648
.probe = ufs_mtk_probe,
16491649
.remove = ufs_mtk_remove,
1650-
.shutdown = ufshcd_pltfrm_shutdown,
16511650
.driver = {
16521651
.name = "ufshcd-mtk",
16531652
.pm = &ufs_mtk_pm_ops,

drivers/ufs/host/ufs-qcom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,6 @@ static const struct dev_pm_ops ufs_qcom_pm_ops = {
17231723
static struct platform_driver ufs_qcom_pltform = {
17241724
.probe = ufs_qcom_probe,
17251725
.remove = ufs_qcom_remove,
1726-
.shutdown = ufshcd_pltfrm_shutdown,
17271726
.driver = {
17281727
.name = "ufshcd-qcom",
17291728
.pm = &ufs_qcom_pm_ops,

drivers/ufs/host/ufs-sprd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ static const struct dev_pm_ops ufs_sprd_pm_ops = {
444444
static struct platform_driver ufs_sprd_pltform = {
445445
.probe = ufs_sprd_probe,
446446
.remove = ufs_sprd_remove,
447-
.shutdown = ufshcd_pltfrm_shutdown,
448447
.driver = {
449448
.name = "ufshcd-sprd",
450449
.pm = &ufs_sprd_pm_ops,

drivers/ufs/host/ufshcd-pci.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,6 @@ static int ufshcd_pci_restore(struct device *dev)
504504
}
505505
#endif
506506

507-
/**
508-
* ufshcd_pci_shutdown - main function to put the controller in reset state
509-
* @pdev: pointer to PCI device handle
510-
*/
511-
static void ufshcd_pci_shutdown(struct pci_dev *pdev)
512-
{
513-
ufshcd_shutdown((struct ufs_hba *)pci_get_drvdata(pdev));
514-
}
515-
516507
/**
517508
* ufshcd_pci_remove - de-allocate PCI/SCSI host and host memory space
518509
* data structure memory
@@ -618,7 +609,6 @@ static struct pci_driver ufshcd_pci_driver = {
618609
.id_table = ufshcd_pci_tbl,
619610
.probe = ufshcd_pci_probe,
620611
.remove = ufshcd_pci_remove,
621-
.shutdown = ufshcd_pci_shutdown,
622612
.driver = {
623613
.pm = &ufshcd_pci_pm_ops
624614
},

0 commit comments

Comments
 (0)