9
0
Fork 0

ARM: mvebu: Add machine compatible to mbus ranges

Multi-SoC support for MVEBU will add mbus ranges for all compiled
SoCs. To protect the mbus node of the SoC barebox is executed on
from others ranges, pass machine's compatible to mvebu_mbus_add_range
and check before applying the fixup.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sebastian Hesselbarth 2014-09-17 22:22:40 +02:00 committed by Sascha Hauer
parent f94a71cb51
commit 561dfebb4b
5 changed files with 15 additions and 6 deletions

View File

@ -70,7 +70,8 @@ static int armada_370_xp_init_soc(void)
armada_370_xp_memory_find(&phys_base, &phys_size);
mvebu_set_memory(phys_base, phys_size);
mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
MVEBU_REMAP_INT_REG_BASE);
return 0;
}

View File

@ -90,8 +90,10 @@ static int dove_init_soc(void)
dove_memory_find(&phys_base, &phys_size);
mvebu_set_memory(phys_base, phys_size);
mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
mvebu_mbus_add_range(0xf0, 0x02, DOVE_REMAP_MC_REGS);
mvebu_mbus_add_range("marvell,dove", 0xf0, 0x01,
MVEBU_REMAP_INT_REG_BASE);
mvebu_mbus_add_range("marvell,dove", 0xf0, 0x02,
DOVE_REMAP_MC_REGS);
return 0;
}

View File

@ -63,7 +63,8 @@ static int kirkwood_init_soc(void)
kirkwood_memory_find(&phys_base, &phys_size);
mvebu_set_memory(phys_base, phys_size);
mvebu_mbus_add_range(0xf0, 0x01, MVEBU_REMAP_INT_REG_BASE);
mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
MVEBU_REMAP_INT_REG_BASE);
return 0;
}

View File

@ -744,6 +744,7 @@ static int mvebu_mbus_init(void)
postcore_initcall(mvebu_mbus_init);
struct mbus_range {
const char *compatible;
u32 mbusid;
u32 remap;
struct list_head list;
@ -752,10 +753,11 @@ struct mbus_range {
#define MBUS_ID(t,a) (((t) << 24) | ((attr) << 16))
static LIST_HEAD(mbus_ranges);
void mvebu_mbus_add_range(u8 target, u8 attr, u32 remap)
void mvebu_mbus_add_range(const char *compatible, u8 target, u8 attr, u32 remap)
{
struct mbus_range *r = xzalloc(sizeof(*r));
r->compatible = strdup(compatible);
r->mbusid = MBUS_ID(target, attr);
r->remap = remap;
list_add_tail(&r->list, &mbus_ranges);
@ -811,6 +813,8 @@ static int mvebu_mbus_of_fixup(struct device_node *root, void *context)
continue;
list_for_each_entry(r, &mbus_ranges, list) {
if (!of_machine_is_compatible(r->compatible))
continue;
if (r->mbusid == mbusid)
ranges[n + na + pa - 1] = r->remap;
}

View File

@ -58,6 +58,7 @@ int mvebu_mbus_add_window_by_id(unsigned int target, unsigned int attribute,
phys_addr_t base, size_t size);
int mvebu_mbus_del_window(phys_addr_t base, size_t size);
void mvebu_mbus_add_range(u8 target, u8 attr, u32 remap);
void mvebu_mbus_add_range(const char *compatible,
u8 target, u8 attr, u32 remap);
#endif /* __LINUX_MBUS_H */