
On Sun, Mar 14, 2021 at 01:15:08PM +0800, Bin Meng wrote:
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
+static int platform_bus_map_region(ulong map_addr, phys_addr_t paddr,
phys_size_t size)
Function could have been void (minor detail).
+{
- /* 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));
- return 0;
+}
int misc_init_r(void) { struct udevice *dev; @@ -148,6 +163,22 @@ int misc_init_r(void) */ 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;
}
Reviewed-by: Vladimir Oltean vladimir.oltean@nxp.com