Skip to contentSkip to conversation

dm: arm: bcmstb: Enable driver model MMC support

PATCH New Thomas Fitzsimmons 3 participants 3 messages May 17, 2019 – May 29, 2019 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: arm: bcmstb: Enable driver model MMC support

For bcm7445 and bcm7260, this patch enables CONFIG_DM_MMC and updates the bcmstb SDHCI driver to use the new driver model. This allows removal of SDHCI configuration handling from bcmstb.c, and eliminates a board removal compile warning.

---
 board/broadcom/bcmstb/bcmstb.c | 65 +-----------------------------
 configs/bcm7260_defconfig      |  1 +
 configs/bcm7445_defconfig      |  1 +
 drivers/mmc/bcmstb_sdhci.c     | 73 +++++++++++++++++++++++++---------
 include/configs/bcm7260.h      |  1 -
 include/configs/bcm7445.h      |  1 -
 6 files changed, 58 insertions(+), 84 deletions(-)
board/broadcom/bcmstb/bcmstb.c +1 -64
index 56328463ae..7f8e0f951d 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2018  Cisco Systems, Inc.
+ * (C) Copyright 2019  Synamedia
  *
  * Author: Thomas Fitzsimmons <[email protected]>
  */
@@ -9,7 +10,6 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/bootm.h>
-#include <mach/sdhci.h>
 #include <mach/timer.h>
 #include <mmc.h>
 #include <fdtdec.h>
@@ -80,69 +80,6 @@ void enable_caches(void)
 	 */
 }
 
-static const phys_addr_t bcmstb_sdhci_address(u32 alias_index)
-{
-	int node = 0;
-	int ret = 0;
-	char sdhci[16] = { 0 };
-	const void *fdt = gd->fdt_blob;
-	const char *path = NULL;
-	struct fdt_resource resource = { 0 };
-
-	if (!fdt) {
-		printf("%s: Invalid gd->fdt_blob\n", __func__);
-		return 0;
-	}
-
-	node = fdt_path_offset(fdt, "/aliases");
-	if (node < 0) {
-		printf("%s: Failed to find /aliases node\n", __func__);
-		return 0;
-	}
-
-	sprintf(sdhci, "sdhci%d", alias_index);
-	path = fdt_getprop(fdt, node, sdhci, NULL);
-	if (!path) {
-		printf("%s: Failed to find alias for %s\n", __func__, sdhci);
-		return 0;
-	}
-
-	node = fdt_path_offset(fdt, path);
-	if (node < 0) {
-		printf("%s: Failed to resolve BCMSTB SDHCI alias\n", __func__);
-		return 0;
-	}
-
-	ret = fdt_get_named_resource(fdt, node, "reg", "reg-names",
-				     "host", &resource);
-	if (ret) {
-		printf("%s: Failed to read BCMSTB SDHCI host resource\n",
-		       __func__);
-		return 0;
-	}
-
-	return resource.start;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-	phys_addr_t sdhci_base_address = 0;
-
-	sdhci_base_address = bcmstb_sdhci_address(CONFIG_BCMSTB_SDHCI_INDEX);
-
-	if (!sdhci_base_address) {
-		sdhci_base_address = BCMSTB_SDHCI_BASE;
-		printf("%s: Assuming BCMSTB SDHCI address: 0x%p\n",
-		       __func__, (void *)sdhci_base_address);
-	}
-
-	debug("BCMSTB SDHCI base address: 0x%p\n", (void *)sdhci_base_address);
-
-	bcmstb_sdhci_init(sdhci_base_address);
-
-	return 0;
-}
-
 int timer_init(void)
 {
 	gd->arch.timer_rate_hz = readl(BCMSTB_TIMER_FREQUENCY);
configs/bcm7260_defconfig +1 -0
index 263694c58f..6e0266be45 100644
@@ -11,6 +11,7 @@ CONFIG_SYS_PROMPT="U-Boot>"
 CONFIG_EFI_PARTITION=y
 CONFIG_OF_PRIOR_STAGE=y
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_BCMSTB=y
 # CONFIG_EFI_LOADER is not set
configs/bcm7445_defconfig +1 -0
index 97098bf7e2..f22b06e9ce 100644
@@ -13,6 +13,7 @@ CONFIG_CMD_SF_TEST=y
 CONFIG_CMD_SPI=y
 CONFIG_OF_PRIOR_STAGE=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_BCMSTB=y
 CONFIG_DM_SPI_FLASH=y
drivers/mmc/bcmstb_sdhci.c +55 -18

98 lines not on this page · raw message

include/configs/bcm7260.h +0 -1
index a2d7f614ce..967bde54c8 100644
@@ -19,7 +19,6 @@
 
 #include "bcmstb.h"
 
-#define BCMSTB_SDHCI_BASE	0xf0200300
 #define BCMSTB_TIMER_LOW	0xf0412008
 #define BCMSTB_TIMER_HIGH	0xf041200c
 #define BCMSTB_TIMER_FREQUENCY	0xf0412020
include/configs/bcm7445.h +0 -1
index 6984edde18..3ff4677f0a 100644
@@ -19,7 +19,6 @@
 
 #include "bcmstb.h"
 
-#define BCMSTB_SDHCI_BASE	0xf03e0200
 #define BCMSTB_TIMER_LOW	0xf0412008
 #define BCMSTB_TIMER_HIGH	0xf041200c
 #define BCMSTB_TIMER_FREQUENCY	0xf0412020
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 dm: arm: bcmstb: Enable driver model MMC support

Quoted 6 lines · Thomas Fitzsimmons

For bcm7445 and bcm7260, this patch enables CONFIG_DM_MMC and updates the bcmstb SDHCI driver to use the new driver model. This allows removal of SDHCI configuration handling from bcmstb.c, and eliminates a board removal compile warning.

Quoted 8 lines
---
  board/broadcom/bcmstb/bcmstb.c | 65 +-----------------------------
  configs/bcm7260_defconfig      |  1 +
  configs/bcm7445_defconfig      |  1 +
  drivers/mmc/bcmstb_sdhci.c     | 73 +++++++++++++++++++++++++---------
  include/configs/bcm7260.h      |  1 -
  include/configs/bcm7445.h      |  1 -
  6 files changed, 58 insertions(+), 84 deletions(-)

Nice cleanup. ;)

Thanks,
Stefan

#2 lore raw

PATCH 1/1 dm: arm: bcmstb: Enable driver model MMC support

In reply to Thomas Fitzsimmons
Quoted 7 lines · Thomas Fitzsimmons

For bcm7445 and bcm7260, this patch enables CONFIG_DM_MMC and updates the bcmstb SDHCI driver to use the new driver model. This allows removal of SDHCI configuration handling from bcmstb.c, and eliminates a board removal compile warning.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190529/7ca3cc7c/attachment.sig>