U-Boot: add a 'physical' arg to fdt_get_device_reg()
If false, try to use the virtual-reg property first.
This commit is contained in:
parent
73ef47f70a
commit
14cfccd011
@ -16,7 +16,7 @@ void dump_fdt(const void *fdt);
|
||||
status_t fdt_get_cell_count(const void* fdt, int node,
|
||||
int32 &addressCells, int32 &sizeCells);
|
||||
|
||||
phys_addr_t fdt_get_device_reg(const void* fdt, int node);
|
||||
phys_addr_t fdt_get_device_reg(const void* fdt, int node, bool physical=true);
|
||||
phys_addr_t fdt_get_device_reg_byname(const void* fdt, const char* name);
|
||||
phys_addr_t fdt_get_device_reg_byalias(const void* fdt, const char* alias);
|
||||
|
||||
|
@ -212,10 +212,11 @@ fdt_get_cell_count(const void* fdt, int node,
|
||||
|
||||
|
||||
phys_addr_t
|
||||
fdt_get_device_reg(const void* fdt, int node)
|
||||
fdt_get_device_reg(const void* fdt, int node, bool physical)
|
||||
{
|
||||
const void *prop;
|
||||
const void *prop = NULL;
|
||||
int len;
|
||||
uint64 baseDevice = 0x0;
|
||||
|
||||
int32 regAddressCells = 1;
|
||||
int32 regSizeCells = 1;
|
||||
@ -223,6 +224,15 @@ fdt_get_device_reg(const void* fdt, int node)
|
||||
|
||||
// TODO: check for virtual-reg, and don't -= fdt_get_range_offset?
|
||||
|
||||
// XXX: not sure #address-cells & #size-cells actually apply to virtual-reg
|
||||
if (!physical) {
|
||||
prop = fdt_getprop(fdt, node, "virtual-reg", &len);
|
||||
if (prop != NULL) {
|
||||
baseDevice = fdt32_to_cpu(*(uint32_t *)prop);
|
||||
return baseDevice;
|
||||
}
|
||||
}
|
||||
|
||||
prop = fdt_getprop(fdt, node, "reg", &len);
|
||||
|
||||
if (!prop) {
|
||||
@ -231,7 +241,6 @@ fdt_get_device_reg(const void* fdt, int node)
|
||||
}
|
||||
|
||||
const uint32 *p = (const uint32 *)prop;
|
||||
uint64 baseDevice = 0x0;
|
||||
|
||||
// soc base address cells
|
||||
if (regAddressCells == 2)
|
||||
|
Loading…
Reference in New Issue
Block a user