From patchwork Tue Jan 7 16:35:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 307705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 877902C0091 for ; Wed, 8 Jan 2014 03:35:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752362AbaAGQfh (ORCPT ); Tue, 7 Jan 2014 11:35:37 -0500 Received: from top.free-electrons.com ([176.31.233.9]:60535 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752485AbaAGQfb (ORCPT ); Tue, 7 Jan 2014 11:35:31 -0500 Received: by mail.free-electrons.com (Postfix, from userid 106) id ED6E37FA; Tue, 7 Jan 2014 17:35:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.2 Received: from localhost (tra42-5-83-152-246-54.fbx.proxad.net [83.152.246.54]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8F9247FA; Tue, 7 Jan 2014 17:35:17 +0100 (CET) From: Gregory CLEMENT To: Wolfram Sang , linux-i2c@vger.kernel.org, Jason Cooper , Andrew Lunn , Gregory CLEMENT Cc: Thomas Petazzoni , Ezequiel Garcia , Sebastian Hesselbarth , linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org Subject: [PATCH v4 2/3] ARM: mvebu: Add quirk for i2c Date: Tue, 7 Jan 2014 17:35:03 +0100 Message-Id: <1389112504-9931-3-git-send-email-gregory.clement@free-electrons.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1389112504-9931-1-git-send-email-gregory.clement@free-electrons.com> References: <1389112504-9931-1-git-send-email-gregory.clement@free-electrons.com> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 add the "offload-broken" property for the i2c controller according to the revision of the SoC. Signed-off-by: Gregory CLEMENT --- arch/arm/mach-mvebu/armada-370-xp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index e2acff98e750..c93ac68779e0 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -45,8 +46,31 @@ static void __init armada_370_xp_timer_and_clk_init(void) #endif } +static struct property i2c_offload_broken = { + .name = "offload-broken", +}; + +static void __init i2c_quirk(void) +{ + struct device_node *np; + u32 dev, rev; + + /* + * Only revisons more recent than A0 support the offload + * mechanism. We can exit only if we are sure that we can + * get the SoC revision and it is more recent than A0. + */ + if (mvebu_get_soc_id(&rev, &dev) == 0 && dev > MV78XX0_A0_REV) + return; + + for_each_compatible_node(np, NULL, "marvell,mv78230-i2c") + of_add_property(np, &i2c_offload_broken); + return; +} + static void __init armada_370_xp_dt_init(void) { + i2c_quirk(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); }