[PATCH 11/19] mci: sdhci: dove: fix pointer to u32 casts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dove SDHCI driver doesn't fully work on 64-bit, which
is ok as the SoC is ARMv7-only anways. We do want to be able to build
test the driver though, so replace straight casts of addr with
lower_32_bits(virt_to_phys(addr)), which has the same result, but makes
it clear that the upper 32 bit are truncated and silences the compiler
warnings.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/mci/dove-sdhci.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/mci/dove-sdhci.c b/drivers/mci/dove-sdhci.c
index 9e6da6a81be1..5954058e6b30 100644
--- a/drivers/mci/dove-sdhci.c
+++ b/drivers/mci/dove-sdhci.c
@@ -87,9 +87,11 @@ static int dove_sdhci_mci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 	if (data) {
 		num_bytes = data->blocks * data->blocksize;
 		if (data->flags & MMC_DATA_READ)
-			sdhci_write32(&host->sdhci, SDHCI_DMA_ADDRESS, (u32)data->dest);
+			sdhci_write32(&host->sdhci, SDHCI_DMA_ADDRESS,
+				      lower_32_bits(virt_to_phys(data->dest)));
 		else
-			sdhci_write32(&host->sdhci, SDHCI_DMA_ADDRESS, (u32)data->src);
+			sdhci_write32(&host->sdhci, SDHCI_DMA_ADDRESS,
+				      lower_32_bits(virt_to_phys(data->src)));
 		sdhci_write16(&host->sdhci, SDHCI_BLOCK_SIZE, SDHCI_DMA_BOUNDARY_512K |
 				SDHCI_TRANSFER_BLOCK_SIZE(data->blocksize));
 		sdhci_write16(&host->sdhci, SDHCI_BLOCK_COUNT, data->blocks);
@@ -97,10 +99,12 @@ static int dove_sdhci_mci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 
 
 		if (data->flags & MMC_DATA_WRITE)
-			dma_sync_single_for_device(host->mci.hw_dev, (unsigned long)data->src,
+			dma_sync_single_for_device(host->mci.hw_dev,
+						   lower_32_bits(virt_to_phys(data->src)),
 						    num_bytes, DMA_TO_DEVICE);
 		else
-			dma_sync_single_for_device(host->mci.hw_dev, (unsigned long)data->dest,
+			dma_sync_single_for_device(host->mci.hw_dev,
+						   lower_32_bits(virt_to_phys(data->dest)),
 						    num_bytes, DMA_FROM_DEVICE);
 	}
 
@@ -126,11 +130,13 @@ static int dove_sdhci_mci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
 
 	if (data) {
 		if (data->flags & MMC_DATA_WRITE)
-			dma_sync_single_for_cpu(host->mci.hw_dev, (unsigned long)data->src,
+			dma_sync_single_for_cpu(host->mci.hw_dev,
+						lower_32_bits(virt_to_phys(data->src)),
 						num_bytes, DMA_TO_DEVICE);
 		else
-			dma_sync_single_for_cpu(host->mci.hw_dev, (unsigned long)data->dest,
-					 num_bytes, DMA_FROM_DEVICE);
+			dma_sync_single_for_cpu(host->mci.hw_dev,
+						lower_32_bits(virt_to_phys(data->dest)),
+						num_bytes, DMA_FROM_DEVICE);
 
 		ret = dove_sdhci_wait_for_done(host, SDHCI_INT_XFER_COMPLETE);
 		if (ret) {
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux