• Tony Lindgren's avatar
    ARM: OMAP2+: Fix overwriting hwmod data with data from device tree · 5e863c56
    Tony Lindgren authored
    We have some device tree properties where the ti,hwmod have multiple
    values:
    
    am33xx.dtsi:	ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
    am4372.dtsi:	ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
    dra7.dtsi:	ti,hwmods = "l3_main_1", "l3_main_2";
    omap3.dtsi:	ti,hwmods = "mcbsp2", "mcbsp2_sidetone";
    omap3.dtsi:	ti,hwmods = "mcbsp3", "mcbsp3_sidetone";
    omap4.dtsi:	ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
    omap5.dtsi:	ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
    
    That's not correct way of doing things in this case because these are
    separate devices with their own address space, interrupts, SYSCONFIG
    registers and can set their PM states independently.
    
    So they should all be fixed up to be separate devices in the .dts files.
    
    We also have the related data removed for at least omap4 in commit
    3b9b1015 (ARM: OMAP4: hwmod data: Clean up the data file), so
    that data is wrongly initialized as null data.
    
    So we need to fix two bugs:
    
    1. We are only checking the first entry of the ti,hwmods property
    
       This means that we're only initializing the first hwmods entry
       instead of the ones listed in the ti,hwmods property.
    
    2. We are only checking the child nodes, not the nodes themselves
    
       This means that anything listed at OCP level is currently just
       ignored and unitialized and at least the omap4 case, with the
       legacy data missing from the hwmod.
    
    Fix both of the issues by using an index to the ti,hwmods property
    and changing the hwmod lookup function to also check the current node
    for ti,hwmods property instead of just the children.
    
    While at it, let's also add some warnings for the bad data so it's
    easier to fix.
    
    Cc: "Benoît Cousson" <bcousson@baylibre.com>
    Acked-by: default avatarPaul Walmsley <paul@pwsan.com>
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    5e863c56
omap_hwmod.c 120 KB