u-boot/0025-mmc-Introduce-mmc_phys_to_bus-mmc_b.patch
Guillaume GARDET 111c122751 Accepting request 872955 from hardware👢staging
- Add qemu-riscv64spl
Patch queue updated from git://github.com/openSUSE/u-boot.git tumbleweed-2021.01
* Patches added:
  0031-efi_loader-Avoid-emitting-efi_var_b.patch
- Drop pcm051rev3 for Phytec Wega board 
- Fix binary extension for sunxi based boards
- Add Pinephone
- Fix documentation location 
Update to v2021.01.
Patch queue updated from git://github.com/openSUSE/u-boot.git tumbleweed-2021.01
* Patches dropped:
  0028-usb-xhci-xhci_bulk_tx-Don-t-BUG-whe.patch
  0029-Revert-Fix-data-abort-caused-by-mis.patch
  0030-usb-xhci-pci-Add-DM_FLAG_OS_PREPARE.patch
  0031-pci-brcmstb-Cleanup-controller-stat.patch
* Patches added:
  0028-usb-xhci-pci-Add-DM_FLAG_OS_PREPARE.patch
  0029-pci-brcmstb-Cleanup-controller-stat.patch
  0030-fs-btrfs-Select-SHA256-in-Kconfig.patch

OBS-URL: https://build.opensuse.org/request/show/872955
OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=127
2021-02-17 07:37:34 +00:00

83 lines
2.6 KiB
Diff

From 8c9cce2f60aa7ded50f42c7de363f7d6af91c66a Mon Sep 17 00:00:00 2001
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Date: Tue, 12 Jan 2021 13:55:29 +0100
Subject: [PATCH] mmc: Introduce mmc_phys_to_bus()/mmc_bus_to_phys()
This will allow us to use DM variants of phys_to_bus()/bus_to_phys()
when relevant.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
---
drivers/mmc/sdhci.c | 12 +++++++-----
include/mmc.h | 6 ++++++
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 0628934312..62e4f53b8b 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -14,12 +14,12 @@
#include <log.h>
#include <malloc.h>
#include <mmc.h>
+#include <phys2bus.h>
#include <sdhci.h>
#include <asm/cache.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
-#include <phys2bus.h>
static void sdhci_reset(struct sdhci_host *host, u8 mask)
{
@@ -73,6 +73,7 @@ static void sdhci_transfer_pio(struct sdhci_host *host, struct mmc_data *data)
static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
int *is_aligned, int trans_bytes)
{
+ dma_addr_t dma_addr;
unsigned char ctrl;
void *buf;
@@ -103,8 +104,8 @@ static void sdhci_prepare_dma(struct sdhci_host *host, struct mmc_data *data,
mmc_get_dma_dir(data));
if (host->flags & USE_SDMA) {
- sdhci_writel(host, phys_to_bus((ulong)host->start_addr),
- SDHCI_DMA_ADDRESS);
+ dma_addr = dev_phys_to_bus(mmc_to_dev(host->mmc), host->start_addr);
+ sdhci_writel(host, dma_addr, SDHCI_DMA_ADDRESS);
}
#if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
else if (host->flags & (USE_ADMA | USE_ADMA64)) {
@@ -162,8 +163,9 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
start_addr &=
~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1);
start_addr += SDHCI_DEFAULT_BOUNDARY_SIZE;
- sdhci_writel(host, phys_to_bus((ulong)start_addr),
- SDHCI_DMA_ADDRESS);
+ start_addr = dev_phys_to_bus(mmc_to_dev(host->mmc),
+ start_addr);
+ sdhci_writel(host, start_addr, SDHCI_DMA_ADDRESS);
}
}
if (timeout-- > 0)
diff --git a/include/mmc.h b/include/mmc.h
index 1d377e0281..c12c7a0b5c 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -736,6 +736,12 @@ struct mmc {
u8 hs400_tuning;
};
+#if CONFIG_IS_ENABLED(DM_MMC)
+#define mmc_to_dev(_mmc) _mmc->dev
+#else
+#define mmc_to_dev(_mmc) NULL
+#endif
+
struct mmc_hwpart_conf {
struct {
uint enh_start; /* in 512-byte sectors */