Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2142668pxb; Mon, 12 Apr 2021 15:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy80BfUzj2Uo6s22EWp0WvsGqvxecMV3iyOLnVwaePqCHSLUHyehrl4IZjcu0OEtGAU5oQS X-Received: by 2002:a63:1556:: with SMTP id 22mr29991956pgv.142.1618268056889; Mon, 12 Apr 2021 15:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618268056; cv=none; d=google.com; s=arc-20160816; b=ixV9ZJbA/tQLoaKzGJeQLqvDL2vVONprwkW78rTRo9uuuE2vEBm51eMF02Ssz8IkR7 AqpnqHgNo2VCVH9rNlduY9VQg8ao+CAuTod26VP7pE0ncMQ9lAmo9BXxXU9EiLd586s6 aKV/ddnPGDk16NZmqiIF7Qcpv1kRzXXj+T4w1lHmHxOyxyJpmR6C7mIbu9PMQG1hh5T4 DubgxJHAlkngdNF1c+/PetlAnC3zviwBTQG7fU0CHiwAm7I1yQW1QAKzHb4VxXD423Hd OpusX81NGZxkqH+SC/PC6c/XZFuFmfH0Cx/cvE99ku0IOqcMuaC1qB/t1TX50UEepiiu PyFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=26AwY2jMGnIE0+RK3Qq3sZqkbFMUpDynrk8sTOMpS2I=; b=IgHcKaf0LGPHqAdGS5zxPeSQXLOAbZqEUMghIpWhG1ptnx4cjOWkorz1X8w5omqVBc rtXz0U5gMLzVwdaFh6/ath+BUkjwtu/PpdAnuK5HGGzs1lf8HcMy7nEffdqHGoO1/l/1 JZD63V727lLFI39nrVy8WjNAyLcsDmBc/As1oB8qOX8cAhQ/FW2EpztgoD2kpzMtgD4O UC7EtLTlS+M4x4OaKixCjZNRDAWSwbimVm09YDjmmz6SoNf+5mOLKp1viqbh85LIaxEx b7JXyj4xXG+55X3Wwp4Q8bCrr/wA2RVQT62JnnuX0EGzD3ZnPrgdiwwFivIp7dAcFh+k QAxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v9oeB8/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si14929112pgl.450.2021.04.12.15.54.04; Mon, 12 Apr 2021 15:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v9oeB8/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243405AbhDLJmG (ORCPT + 99 others); Mon, 12 Apr 2021 05:42:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:34722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239674AbhDLJJQ (ORCPT ); Mon, 12 Apr 2021 05:09:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE6A761385; Mon, 12 Apr 2021 09:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618218285; bh=NRtHKydRuvA7XqixRpGw4jbZ2dyk9afHXFvqaYT6jT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v9oeB8/jUabr+27mmijTuTuaH+iiioeMcbaHJ7yPxOAUIPQkO5Y+51vHdKDWN5W/L krzbcKxokvVx/aKBWsDa9CM5kuzfOBiNUxskPWz66r1N6fmk6shM/A4hXLjvMjoMl4 qsZ3trOtyAWxhz6nkNDtoPfJfCZivK5w9KR4M9V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E6=9D=A8=E6=96=87=E9=BE=99=20 ?= , =?UTF-8?q?=E5=91=A8=E7=90=B0=E6=9D=B0=20 ?= , Wolfram Sang , Sasha Levin Subject: [PATCH 5.11 141/210] I2C: JZ4780: Fix bug for Ingenic X1000. Date: Mon, 12 Apr 2021 10:40:46 +0200 Message-Id: <20210412084020.703650340@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084016.009884719@linuxfoundation.org> References: <20210412084016.009884719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: 周琰杰 (Zhou Yanjie) [ Upstream commit 942bfbecc0281c75db84f744b9b77b0f2396f484 ] Only send "X1000_I2C_DC_STOP" when last byte, or it will cause error when I2C write operation which should look like this: device_addr + w, reg_addr, data; But without this patch, it looks like this: device_addr + w, reg_addr, device_addr + w, data; Fixes: 21575a7a8d4c ("I2C: JZ4780: Add support for the X1000.") Reported-by: 杨文龙 (Yang Wenlong) Tested-by: 杨文龙 (Yang Wenlong) Signed-off-by: 周琰杰 (Zhou Yanjie) Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-jz4780.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index cb4a25ebb890..2a946c207928 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -526,8 +526,8 @@ static irqreturn_t jz4780_i2c_irq(int irqno, void *dev_id) i2c_sta = jz4780_i2c_readw(i2c, JZ4780_I2C_STA); data = *i2c->wbuf; data &= ~JZ4780_I2C_DC_READ; - if ((!i2c->stop_hold) && (i2c->cdata->version >= - ID_X1000)) + if ((i2c->wt_len == 1) && (!i2c->stop_hold) && + (i2c->cdata->version >= ID_X1000)) data |= X1000_I2C_DC_STOP; jz4780_i2c_writew(i2c, JZ4780_I2C_DC, data); i2c->wbuf++; -- 2.30.2