diff options
author | Jon Medhurst <tixy@linaro.org> | 2012-08-01 18:27:52 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2012-08-07 09:15:44 +0100 |
commit | 249df4afea46019c7bdba4681590a79c68aa6e4e (patch) | |
tree | 34d3f3823d49bcdf8779856054544e2a7ce36e46 | |
parent | 868c352568eb4bac9b556d1572a7fee6a891ce28 (diff) |
ARM: vexpress: Fix parsing of framebuffer in HDLCD device-tree nodetracking-tracking-armlt-hdlcd-ll-20120820.0tracking-tracking-armlt-hdlcd-ll-20120817.2tracking-tracking-armlt-hdlcd-ll-20120817.1tracking-tracking-armlt-hdlcd-ll-20120817.0tracking-tracking-armlt-hdlcd-ll-20120815.0
Parsing of the frame buffer property by v2m_dt_hdlcd_init() needs
to respect the length of address and size values in the device-tree.
Without this, the move to 64-bit address in device-tree (for LPAE
support) will go wrong.
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | arch/arm/mach-vexpress/v2m.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index b1c2ab34fd66..ab45e089b31e 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -565,24 +565,32 @@ static struct v2m_osc v2m_dt_hdlcd_osc = { static void __init v2m_dt_hdlcd_init(void) { struct device_node *node; - u32 framebuffer[2]; + int len, na, ns; + const __be32 *prop; + phys_addr_t fb_base, fb_size; u32 osc; node = of_find_compatible_node(NULL, NULL, "arm,hdlcd"); if (!node) return; - if (WARN_ON(of_property_read_u32_array(node, "framebuffer", - framebuffer, ARRAY_SIZE(framebuffer)))) + na = of_n_addr_cells(node); + ns = of_n_size_cells(node); + + prop = of_get_property(node, "framebuffer", &len); + if (WARN_ON(!prop || len < (na + ns) * sizeof(*prop))) return; + fb_base = of_read_number(prop, na); + fb_size = of_read_number(prop + na, ns); + if (WARN_ON(of_property_read_u32(node, "arm,vexpress-osc", &osc))) return; v2m_dt_hdlcd_osc.site = v2m_get_master_site(); v2m_dt_hdlcd_osc.osc = osc; - if (WARN_ON(memblock_remove(framebuffer[0], framebuffer[1]))) + if (WARN_ON(memblock_remove(fb_base, fb_size))) return; v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE(SYS_CFG_SITE_MB), |