From ff2217b2d7f964250dbb9feae94caec8adf3d124 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 11 May 2023 16:23:13 +0100 Subject: [PATCH] bcm2835-sdhost: Use DT to configure logging Retrieve the system timer base address directly from DT. Signed-off-by: Phil Elwell --- drivers/mmc/host/bcm2835-sdhost.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/mmc/host/bcm2835-sdhost.c +++ b/drivers/mmc/host/bcm2835-sdhost.c @@ -242,15 +242,19 @@ static void __iomem *timer_base; #define LOG_ENTRIES (256*1) #define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) -static void log_init(struct device *dev, u32 bus_to_phys) +static void log_init(struct device *dev) { + struct device_node *np; + spin_lock_init(&log_lock); sdhost_log_buf = dma_alloc_coherent(dev, LOG_SIZE, &sdhost_log_addr, GFP_KERNEL); if (sdhost_log_buf) { + np = of_find_compatible_node(NULL, NULL, + "brcm,bcm2835-system-timer"); pr_info("sdhost: log_buf @ %p (%llx)\n", sdhost_log_buf, (u64)sdhost_log_addr); - timer_base = ioremap(bus_to_phys + 0x7e003000, SZ_4K); + timer_base = of_iomap(np, 0); if (!timer_base) pr_err("sdhost: failed to remap timer\n"); } @@ -2123,7 +2127,7 @@ static int bcm2835_sdhost_probe(struct p (unsigned long)host->max_clk, (int)host->irq); - log_init(dev, iomem->start - host->bus_addr); + log_init(dev); if (node) mmc_of_parse(mmc);