The patch fixes the problem when there is another IP on higher addresses
which require allocation.
For example:
uart16550: 0x44a00000 - 0x44a10000 (reg offset: 0x1000)
IP: 0x44a10000 - 0x44aX0000
Current code is shifting base address with reg-offset value
(0x44a01000) but the size is the same that's why requested memory
region for ioremap is from 0x44a01000 with 0x10000 size which overlap
the next IP where requesting memory region is failing because the part
of region is already mapped.
The patch decreases mapped size with reg-offset not to overlap selected
memory address ranges.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
port->mapsize = resource_size(&resource);
/* Check for shifted address mapping */
- if (of_property_read_u32(np, "reg-offset", &prop) == 0)
+ if (of_property_read_u32(np, "reg-offset", &prop) == 0) {
port->mapbase += prop;
+ port->mapsize -= prop;
+ }
/* Check for registers offset within the devices address range */
if (of_property_read_u32(np, "reg-shift", &prop) == 0)