Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 857c20ee authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ufs: fix DMA mask setting"

parents 5a7b0e6c c8e1ea58
Loading
Loading
Loading
Loading
+0 −26
Original line number Diff line number Diff line
@@ -135,26 +135,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
	pci_set_drvdata(pdev, NULL);
}

/**
 * ufshcd_set_dma_mask - Set dma mask based on the controller
 *			 addressing capability
 * @pdev: PCI device structure
 *
 * Returns 0 for success, non-zero for failure
 */
static int ufshcd_set_dma_mask(struct pci_dev *pdev)
{
	int err;

	if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))
		&& !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))
		return 0;
	err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
	if (!err)
		err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
	return err;
}

/**
 * ufshcd_pci_probe - probe routine of the driver
 * @pdev: pointer to PCI device handle
@@ -185,12 +165,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)

	mmio_base = pcim_iomap_table(pdev)[0];

	err = ufshcd_set_dma_mask(pdev);
	if (err) {
		dev_err(&pdev->dev, "set dma mask failed\n");
		return err;
	}

	err = ufshcd_alloc_host(&pdev->dev, &hba);
	if (err) {
		dev_err(&pdev->dev, "Allocation failed\n");
+30 −0
Original line number Diff line number Diff line
@@ -3685,6 +3685,30 @@ out_error:
}
EXPORT_SYMBOL(ufshcd_alloc_host);

/**
 * ufshcd_set_dma_mask - Set dma mask based on the controller
 *			 addressing capability
 * @hba: per adapter instance
 *
 * Returns 0 for success, non-zero for failure
 */
static int ufshcd_set_dma_mask(struct ufs_hba *hba)
{
	int err;

	if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) {
		if (!dma_set_mask(hba->dev, DMA_BIT_MASK(64))) {
			dma_set_coherent_mask(hba->dev, DMA_BIT_MASK(64));
			return 0;
		}
	}
	err = dma_set_mask(hba->dev, DMA_BIT_MASK(32));
	if (!err)
		dma_set_coherent_mask(hba->dev, DMA_BIT_MASK(32));

	return err;
}

/**
 * ufshcd_init - Driver initialization routine
 * @hba: per-adapter instance
@@ -3724,6 +3748,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
	/* Get Interrupt bit mask per version */
	hba->intr_mask = ufshcd_get_intr_mask(hba);

	err = ufshcd_set_dma_mask(hba);
	if (err) {
		dev_err(hba->dev, "set dma mask failed\n");
		goto out_disable;
	}

	/* Allocate memory for host memory space */
	err = ufshcd_memory_alloc(hba);
	if (err) {