From patchwork Mon Dec 21 22:25:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pushpal Sidhu X-Patchwork-Id: 559778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ABD221402DE for ; Tue, 22 Dec 2015 09:33:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gateworks-com.20150623.gappssmtp.com header.i=@gateworks-com.20150623.gappssmtp.com header.b=13mUQjXp; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 9B09628BD62; Mon, 21 Dec 2015 23:29:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5677D28BD27 for ; Mon, 21 Dec 2015 23:26:47 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gateworks. - helo: .mail-pa0-f47.google. - helo-domain: .google.) FROM/MX_MATCHES_NOT_HELO(DOMAIN)=1; rate: -5.5 Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 21 Dec 2015 23:26:23 +0100 (CET) Received: by mail-pa0-f47.google.com with SMTP id cy9so23884395pac.0 for ; Mon, 21 Dec 2015 14:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gw4fz+bzXr9g92dYdu8oqjWtm+J5hvcmYgvsplXcLgY=; b=13mUQjXpG+OT7gZjctwJsSV+DlrTz8pT8D1z5HQWgurCyFHKIKsaemTqR4Ow7vfVg+ 4xHE39P+J/sLz2B2xGJw4ii6SB8ggDgAacIxmBlZBSfBUE66phmDWq1a8DS/NVInMBrd GQIIE6TQRaRZqoG+WW4/SJR2oXP9barlYtByrkK/ASxhgVccq9s6HXrsWmXssrpYJv/0 U7tEe3zEUQZ35u6M494vzDzYIJjwbXw9VkenOAM9LHfDKiNhX7bhbpAGSOj1SBZePjGH onEH5gWHZ2maVs42wiGHQoyraUrBJu+ArJbUD8HGSIYH47v5X/fMJxkYvxuda4Clxya3 LfKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gw4fz+bzXr9g92dYdu8oqjWtm+J5hvcmYgvsplXcLgY=; b=XU/g9A77Xal1dgQV0g4w5XZJNS9RDncobWQkTLkP2e5OZ2/KI3yU2mPeW+Injmtuzq HA1vBSFmgIExeb78Eag3l4KNIE5wK+OP1K8A8VYIfFLvQ6dvkOYpStsJ3mw3nK/2bPj8 Sc8dR+iT+6geiKWC9Tl/hI02tZhSV59kWoV4e5n68oc3b2Tq691o39qk1FoV2QcmllvT STMK8m/TMsz/F0scmqQLZpkMiTrmcsqOBJ5VMlMfBpnbBf3NfNfzj21ZDJ1ckwyhBbVG 9iOaqSt5TvfWd5Bg1Du9i7MLmhb0teXxD/DErTRs605ceyw3wnh8Eg8i7Bm3L88eoWpU 0goA== X-Gm-Message-State: ALoCoQkyC6ZNFRW/++05quVcL37eRnPTdm/AM41v3Ypqtb9Btx12HohnP+o14YUJOyzDiDaL3dwt8EflzKqqg2GBRHeU78a0HQ== X-Received: by 10.66.139.131 with SMTP id qy3mr30960996pab.71.1450736800638; Mon, 21 Dec 2015 14:26:40 -0800 (PST) Received: from psidhu.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by smtp.gmail.com with ESMTPSA id s207sm25344564pfs.60.2015.12.21.14.26.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Dec 2015 14:26:39 -0800 (PST) From: Pushpal Sidhu To: Date: Mon, 21 Dec 2015 14:25:18 -0800 Message-Id: <1450736720-8908-9-git-send-email-psidhu@gateworks.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1450736720-8908-1-git-send-email-psidhu@gateworks.com> References: <1450736720-8908-1-git-send-email-psidhu@gateworks.com> Cc: Luka Perkov Subject: [OpenWrt-Devel] [PATCH 08/10] imx6: add i2c retries for Ventana /dev/i2c-0 X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" On Ventana boards the Gateworks System Controller is the only device on I2C1 (/dev/i2c-0) and it can NAK transfers if it is busy in an ADC loop. Because this is a multi-function device with several slave addresses it is best to add retries at the controller level instead of within each slave driver. This adds a patch that adds 3 retries for i2c transactions only for Ventana boards and only for I2C1 Signed-off-by: Tim Harvey Signed-off-by: Pushpal Sidhu --- ...x-add-retries-for-NAK-s-on-ventana-boards.patch | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 target/linux/imx6/patches-4.3/207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch diff --git a/target/linux/imx6/patches-4.3/207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch b/target/linux/imx6/patches-4.3/207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch new file mode 100644 index 0000000..bfb5707 --- /dev/null +++ b/target/linux/imx6/patches-4.3/207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch @@ -0,0 +1,24 @@ +Index: linux-4.3/drivers/i2c/busses/i2c-imx.c +=================================================================== +--- linux-4.3.orig/drivers/i2c/busses/i2c-imx.c 2015-11-01 16:05:25.000000000 -0800 ++++ linux-4.3/drivers/i2c/busses/i2c-imx.c 2015-12-18 10:39:44.971158318 -0800 +@@ -461,6 +461,8 @@ + { + if (imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR) & I2SR_RXAK) { + dev_dbg(&i2c_imx->adapter.dev, "<%s> No ACK\n", __func__); ++ if (i2c_imx->adapter.retries) ++ return -EAGAIN; + return -EIO; /* No ACK */ + } + +@@ -1010,6 +1012,10 @@ + i2c_imx->adapter.nr = pdev->id; + i2c_imx->adapter.dev.of_node = pdev->dev.of_node; + i2c_imx->base = base; ++ if (of_machine_is_compatible("gw,ventana") && phy_addr == 0x021a0000) { ++ dev_info(&pdev->dev, "Adding retries for Ventana GSC\n"); ++ i2c_imx->adapter.retries = 3; ++ } + + /* Get I2C clock */ + i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);