Skip to content

Commit

Permalink
mmc: bcm2835-sdhost: Pass struct device to dma_alloc*()
Browse files Browse the repository at this point in the history
This makes it possible to get the bus address from Device Tree.
At the same time move the call to log_init() after getting the clock
to avoid allocating twice due to deferred probing.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
  • Loading branch information
notro committed Oct 25, 2016
1 parent 8a0e2e5 commit 210b709
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/mmc/host/bcm2835-sdhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ static void __iomem *timer_base;
#define LOG_ENTRIES (256*1)
#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES)

static void log_init(u32 bus_to_phys)
static void log_init(struct device *dev, u32 bus_to_phys)
{
spin_lock_init(&log_lock);
sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr,
sdhost_log_buf = dma_zalloc_coherent(dev, LOG_SIZE, &sdhost_log_addr,
GFP_KERNEL);
if (sdhost_log_buf) {
pr_info("sdhost: log_buf @ %p (%x)\n",
Expand Down Expand Up @@ -2037,7 +2037,6 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev)
return -ENODEV;
}
host->bus_addr = be32_to_cpup(addr);
log_init(iomem->start - host->bus_addr);
pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n",
(unsigned long)host->ioaddr,
(unsigned long)iomem->start,
Expand Down Expand Up @@ -2110,6 +2109,8 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev)
(unsigned long)host->max_clk,
(int)host->irq);

log_init(dev, iomem->start - host->bus_addr);

if (node)
mmc_of_parse(mmc);
else
Expand Down

0 comments on commit 210b709

Please sign in to comment.