This patch seggregates the PCI specific code in ufshcd.c to make it
ready for splitting into core ufs driver and PCI glue driver.
Reviewed-by: Namjae Jeon linkinj...@gmail.com
Signed-off-by: Vinayak Holikatti vinholika...@gmail.com
Signed-off-by: Santosh Yaraganavi santos...@gmail.com
---
drivers/scsi/ufs/ufshcd.c | 277 -
1 file changed, 150 insertions(+), 127 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 6a4fd00..c7b8f4b 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -129,7 +129,7 @@ struct uic_command {
* @utrdl_dma_addr: UTRDL DMA address
* @utmrdl_dma_addr: UTMRDL DMA address
* @host: Scsi_Host instance of the driver
- * @pdev: PCI device handle
+ * @dev: device handle
* @lrb: local reference block
* @outstanding_tasks: Bits representing outstanding task requests
* @outstanding_reqs: Bits representing outstanding transfer requests
@@ -159,7 +159,7 @@ struct ufs_hba {
dma_addr_t utmrdl_dma_addr;
struct Scsi_Host *host;
- struct pci_dev *pdev;
+ struct device *dev;
struct ufshcd_lrb *lrb;
@@ -335,21 +335,21 @@ static inline void ufshcd_free_hba_memory(struct ufs_hba
*hba)
if (hba-utmrdl_base_addr) {
utmrdl_size = sizeof(struct utp_task_req_desc) * hba-nutmrs;
- dma_free_coherent(hba-pdev-dev, utmrdl_size,
+ dma_free_coherent(hba-dev, utmrdl_size,
hba-utmrdl_base_addr, hba-utmrdl_dma_addr);
}
if (hba-utrdl_base_addr) {
utrdl_size =
(sizeof(struct utp_transfer_req_desc) * hba-nutrs);
- dma_free_coherent(hba-pdev-dev, utrdl_size,
+ dma_free_coherent(hba-dev, utrdl_size,
hba-utrdl_base_addr, hba-utrdl_dma_addr);
}
if (hba-ucdl_base_addr) {
ucdl_size =
(sizeof(struct utp_transfer_cmd_desc) * hba-nutrs);
- dma_free_coherent(hba-pdev-dev, ucdl_size,
+ dma_free_coherent(hba-dev, ucdl_size,
hba-ucdl_base_addr, hba-ucdl_dma_addr);
}
}
@@ -724,7 +724,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
/* Allocate memory for UTP command descriptors */
ucdl_size = (sizeof(struct utp_transfer_cmd_desc) * hba-nutrs);
- hba-ucdl_base_addr = dma_alloc_coherent(hba-pdev-dev,
+ hba-ucdl_base_addr = dma_alloc_coherent(hba-dev,
ucdl_size,
hba-ucdl_dma_addr,
GFP_KERNEL);
@@ -737,7 +737,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
*/
if (!hba-ucdl_base_addr ||
WARN_ON(hba-ucdl_dma_addr (PAGE_SIZE - 1))) {
- dev_err(hba-pdev-dev,
+ dev_err(hba-dev,
Command Descriptor Memory allocation failed\n);
goto out;
}
@@ -747,13 +747,13 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
* UFSHCI requires 1024 byte alignment of UTRD
*/
utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba-nutrs);
- hba-utrdl_base_addr = dma_alloc_coherent(hba-pdev-dev,
+ hba-utrdl_base_addr = dma_alloc_coherent(hba-dev,
utrdl_size,
hba-utrdl_dma_addr,
GFP_KERNEL);
if (!hba-utrdl_base_addr ||
WARN_ON(hba-utrdl_dma_addr (PAGE_SIZE - 1))) {
- dev_err(hba-pdev-dev,
+ dev_err(hba-dev,
Transfer Descriptor Memory allocation failed\n);
goto out;
}
@@ -763,13 +763,13 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
* UFSHCI requires 1024 byte alignment of UTMRD
*/
utmrdl_size = sizeof(struct utp_task_req_desc) * hba-nutmrs;
- hba-utmrdl_base_addr = dma_alloc_coherent(hba-pdev-dev,
+ hba-utmrdl_base_addr = dma_alloc_coherent(hba-dev,
utmrdl_size,
hba-utmrdl_dma_addr,
GFP_KERNEL);
if (!hba-utmrdl_base_addr ||
WARN_ON(hba-utmrdl_dma_addr (PAGE_SIZE - 1))) {
- dev_err(hba-pdev-dev,
+ dev_err(hba-dev,
Task Management Descriptor Memory allocation failed\n);
goto out;
}
@@ -777,7 +777,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
/* Allocate memory for local reference block */
hba-lrb = kcalloc(hba-nutrs, sizeof(struct ufshcd_lrb), GFP_KERNEL);
if (!hba-lrb) {
-