Skip to content

Commit 85e618a

Browse files
gclementJason Cooper
authored andcommitted
ARM: mvebu: Add quirk for i2c for the OpenBlocks AX3-4 board
The first variants of Armada XP SoCs (A0 stepping) have issues related to the i2c controller which prevent to use the offload mechanism and lead to a kernel hang during boot. This commit add quirk in the mvebu platform code to check the SoC version and then update the compatible string for the i2c controller according to the revision of the SoC. Currently only some OpenBlocks AX3-4 boards are known to use an A0 revision so the check is done only for these boards. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: stable@vger.kernel.org # v3.12+: af8d1c6: ARM: mvebu: Add support to get the ID and the revision of a SoC Cc: stable@vger.kernel.org # v3.12+ Fixes: 930ab3d (i2c: mv64xxx: Add I2C Transaction Generator support) Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
1 parent af8d1c6 commit 85e618a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

arch/arm/mach-mvebu/armada-370-xp.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
#include <linux/clocksource.h>
2222
#include <linux/dma-mapping.h>
2323
#include <linux/mbus.h>
24+
#include <linux/slab.h>
2425
#include <asm/hardware/cache-l2x0.h>
2526
#include <asm/mach/arch.h>
2627
#include <asm/mach/map.h>
2728
#include <asm/mach/time.h>
2829
#include "armada-370-xp.h"
2930
#include "common.h"
3031
#include "coherency.h"
32+
#include "mvebu-soc-id.h"
3133

3234
static void __init armada_370_xp_map_io(void)
3335
{
@@ -45,8 +47,38 @@ static void __init armada_370_xp_timer_and_clk_init(void)
4547
#endif
4648
}
4749

50+
static void __init i2c_quirk(void)
51+
{
52+
struct device_node *np;
53+
u32 dev, rev;
54+
55+
/*
56+
* Only revisons more recent than A0 support the offload
57+
* mechanism. We can exit only if we are sure that we can
58+
* get the SoC revision and it is more recent than A0.
59+
*/
60+
if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV)
61+
return;
62+
63+
for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") {
64+
struct property *new_compat;
65+
66+
new_compat = kzalloc(sizeof(*new_compat), GFP_KERNEL);
67+
68+
new_compat->name = kstrdup("compatible", GFP_KERNEL);
69+
new_compat->length = sizeof("marvell,mv78230-a0-i2c");
70+
new_compat->value = kstrdup("marvell,mv78230-a0-i2c",
71+
GFP_KERNEL);
72+
73+
of_update_property(np, new_compat);
74+
}
75+
return;
76+
}
77+
4878
static void __init armada_370_xp_dt_init(void)
4979
{
80+
if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
81+
i2c_quirk();
5082
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
5183
}
5284

0 commit comments

Comments
 (0)