Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecf47e9b authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville
Browse files

bcma: only map wrapper if its address is available



The Chipcommon B core does not have a wrap address and it would fail here.

Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 89be7ceb
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -134,12 +134,16 @@ static void bcma_host_soc_block_write(struct bcma_device *core,


static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset)
static u32 bcma_host_soc_aread32(struct bcma_device *core, u16 offset)
{
{
	if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
		return ~0;
	return readl(core->io_wrap + offset);
	return readl(core->io_wrap + offset);
}
}


static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset,
static void bcma_host_soc_awrite32(struct bcma_device *core, u16 offset,
				  u32 value)
				  u32 value)
{
{
	if (WARN_ONCE(!core->io_wrap, "Accessed core has no wrapper/agent\n"))
		return;
	writel(value, core->io_wrap + offset);
	writel(value, core->io_wrap + offset);
}
}


+7 −4
Original line number Original line Diff line number Diff line
@@ -421,12 +421,15 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
		core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE);
		core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE);
		if (!core->io_addr)
		if (!core->io_addr)
			return -ENOMEM;
			return -ENOMEM;
		core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE);
		if (core->wrap) {
			core->io_wrap = ioremap_nocache(core->wrap,
							BCMA_CORE_SIZE);
			if (!core->io_wrap) {
			if (!core->io_wrap) {
				iounmap(core->io_addr);
				iounmap(core->io_addr);
				return -ENOMEM;
				return -ENOMEM;
			}
			}
		}
		}
	}
	return 0;
	return 0;
}
}