From patchwork Wed Oct 1 17:40:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru M Stan X-Patchwork-Id: 5013781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B71A6BEEA6 for ; Wed, 1 Oct 2014 17:43:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C171720221 for ; Wed, 1 Oct 2014 17:43:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E88482012F for ; Wed, 1 Oct 2014 17:43:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XZNu8-0005ed-7N; Wed, 01 Oct 2014 17:41:32 +0000 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XZNu6-0005b6-B6 for linux-arm-kernel@lists.infradead.org; Wed, 01 Oct 2014 17:41:30 +0000 Received: by mail-pd0-f174.google.com with SMTP id y13so582373pdi.5 for ; Wed, 01 Oct 2014 10:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=Wb0wne+DaJpeByUUiAXnz2nbu/x+oCUkXcdmpv6q/Hk=; b=Sxs704n70RyqQddnMCWwPPkqC+6qu/yMBuBu2Zd3xgz+hfhbd+hSR0tFtMPaJ3G/c3 4/GsFM7S7IgqlvFi3u3WRlwwMG2gyTYXw/3s1pfvMFlTyUEiPKLGwmtUzi9BS6aoWJaV ubliHm6+N+FhZ+G7L9OxUwMUhPhXJT62Nh0gs= 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; bh=Wb0wne+DaJpeByUUiAXnz2nbu/x+oCUkXcdmpv6q/Hk=; b=ih6uHNjHjwcdvCO/7cvLGakEfhnTrsJRU+CvRpfzsH7O7SOM8HuHLSqJrD6XQh5h4r GEHNTmlHWnE4HWg5uEkIC8gjZbGTxiK4ivSIujGKour8/5QvStMgT7YUFJfdcl0r7pQ+ 6ReQ0EgnYIMghPQKztLRDLQ+5pHKuUyAmVlBQ4OPvHOjq3CsTgVrF6Mau11eBRJHhdh1 Et5aA3M3G+n0Jfznwcc6HeJ5N5cL6gZQK/Gv4eFaU1IS8afIsd3X1ZAz+e7Hj09c0Z6Z j7COz4sU0qvVWWTycTirPm/joPY8YIhSWm/Y6eg1DVNjCtf5w3PoDAc3OzIBhOxFGkmF mA8w== X-Gm-Message-State: ALoCoQn+i4I3LmK5cHsv987UTqP3Xe7z8304szyKKNXoMc0N8c8yiJxTUTQ+Mv+VZDNZGngeIJUx X-Received: by 10.68.68.131 with SMTP id w3mr43250584pbt.93.1412185268568; Wed, 01 Oct 2014 10:41:08 -0700 (PDT) Received: from amstan.mtv.corp.google.com (amstan.mtv.corp.google.com [172.22.162.17]) by mx.google.com with ESMTPSA id f2sm1563268pdd.25.2014.10.01.10.41.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Oct 2014 10:41:08 -0700 (PDT) From: Alexandru M Stan To: Max Schwarz , Wolfram Sang Subject: [PATCH] i2c: rk3x: fix 0 length write transfers Date: Wed, 1 Oct 2014 10:40:41 -0700 Message-Id: <1412185241-24950-1-git-send-email-amstan@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141001_104130_407561_ED3A5AC3 X-CRM114-Status: GOOD ( 12.99 ) X-Spam-Score: -0.8 (/) Cc: addy ke , Alexandru M Stan , Sonny Rao , Jeffy Chen , Doug Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org, ZhengShunQian , linux-arm-kernel@lists.infradead.org, heiko@sntech.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP i2cdetect -q was broken (everything was a false positive, and no transfers were actually being sent over i2c). The way it works is by sending a 0 length write request and checking for NACK. This patch fixes the 0 length writes and actually sends them. Reported-by: Doug Anderson Signed-off-by: Alexandru M Stan Reviewed-by: Doug Anderson Tested-by: Doug Anderson Reviewed-By: Max Schwarz Tested-By: Max Schwarz --- drivers/i2c/busses/i2c-rk3x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index b41d979..f486d0e 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) for (i = 0; i < 8; ++i) { val = 0; for (j = 0; j < 4; ++j) { - if (i2c->processed == i2c->msg->len) + if ((i2c->processed == i2c->msg->len) && (cnt != 0)) break; if (i2c->processed == 0 && cnt == 0)