mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
ppc: qemu: Create a virtual memory mapping of the platform bus
QEMU ppce500 target can dynamically instantiate an eTSEC device on a platform bus if "-device eTSEC" is given to QEMU. It is presented as a "simple-bus" in the device tree, with an additional compatible string "qemu,platform". Let's create a virtual memory mapping for it in misc_init_r(), in preparation to adding eTSEC support. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
This commit is contained in:
parent
ea8971cdde
commit
b3398993ba
|
@ -9,4 +9,10 @@ config SYS_VENDOR
|
||||||
config SYS_CONFIG_NAME
|
config SYS_CONFIG_NAME
|
||||||
default "qemu-ppce500"
|
default "qemu-ppce500"
|
||||||
|
|
||||||
|
config PLATFORM_BUS_MAP_ADDR
|
||||||
|
hex
|
||||||
|
default 0xf0000000
|
||||||
|
help
|
||||||
|
The QEMU platform bus base mapped address in the virtual memory space.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <dm/simple_bus.h>
|
||||||
|
#include <dm/uclass-internal.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#include <asm/mmu.h>
|
#include <asm/mmu.h>
|
||||||
|
@ -109,6 +111,17 @@ static int pci_map_region(phys_addr_t paddr, phys_size_t size, ulong *pmap_addr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void platform_bus_map_region(ulong map_addr, phys_addr_t paddr,
|
||||||
|
phys_size_t size)
|
||||||
|
{
|
||||||
|
/* Align map_addr */
|
||||||
|
map_addr += size - 1;
|
||||||
|
map_addr &= ~(size - 1);
|
||||||
|
|
||||||
|
/* Map virtual memory for range */
|
||||||
|
assert(!tlb_map_range(map_addr, paddr, size, TLB_MAP_IO));
|
||||||
|
}
|
||||||
|
|
||||||
int misc_init_r(void)
|
int misc_init_r(void)
|
||||||
{
|
{
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
|
@ -148,6 +161,22 @@ int misc_init_r(void)
|
||||||
*/
|
*/
|
||||||
disable_tlb(find_tlb_idx((void *)CONFIG_SYS_TMPVIRT, 1));
|
disable_tlb(find_tlb_idx((void *)CONFIG_SYS_TMPVIRT, 1));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Detect the presence of the platform bus node, and
|
||||||
|
* create a virtual memory mapping for it.
|
||||||
|
*/
|
||||||
|
for (ret = uclass_find_first_device(UCLASS_SIMPLE_BUS, &dev);
|
||||||
|
dev;
|
||||||
|
ret = uclass_find_next_device(&dev)) {
|
||||||
|
if (device_is_compatible(dev, "qemu,platform")) {
|
||||||
|
struct simple_bus_plat *plat = dev_get_uclass_plat(dev);
|
||||||
|
|
||||||
|
platform_bus_map_region(CONFIG_PLATFORM_BUS_MAP_ADDR,
|
||||||
|
plat->target, plat->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ CONFIG_OF_BOARD=y
|
||||||
CONFIG_ENV_OVERWRITE=y
|
CONFIG_ENV_OVERWRITE=y
|
||||||
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||||
CONFIG_DM=y
|
CONFIG_DM=y
|
||||||
|
CONFIG_SIMPLE_BUS_CORRECT_RANGE=y
|
||||||
CONFIG_BLK=y
|
CONFIG_BLK=y
|
||||||
CONFIG_HAVE_BLOCK_DEVICE=y
|
CONFIG_HAVE_BLOCK_DEVICE=y
|
||||||
CONFIG_MPC8XXX_GPIO=y
|
CONFIG_MPC8XXX_GPIO=y
|
||||||
|
|
Loading…
Reference in New Issue
Block a user