Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2095821pxb; Mon, 12 Apr 2021 14:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLo8yaZosQKTwPkgzKj02v06UIR4yOKVJJVPX0gMDDuPA1w2k28Yhjw1hFp8Ax/vdGxIL+ X-Received: by 2002:a05:6402:1853:: with SMTP id v19mr30872520edy.179.1618262513529; Mon, 12 Apr 2021 14:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618262513; cv=none; d=google.com; s=arc-20160816; b=qqrqelH5dIiXD+N5m1aV3Q5pJjcIVSoXJkxOqhSZT1vbM3WFZ/FgQPvw4WZz63nJ2N m883St84hJYebR4UWfLbR6yHPue17XZ6q1qynH/0GrN9x0WkUqNXpa1szBRuvLipBiQk Qf5Cr/SUj+jQ/+9hoeLhMc1jV+uPwWRk7Kn9vsxCNGGS0j9dK60pAmGhEotyWad8xAzd wFosyGmoH1eDQteCuzO1XLjH8qtMc7GcHXHCbX92LKi/H3YBalk6uzNA+rxfqH1C2oxv q/hUWI9i8OG9jkgkV0fUlpxPpQKBOP+iNRTB6SS1mNlkIJacWfn/iB8Pd/FCKk9QBKHm ISCA== 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=xSZHVIBvi/t53AGzyve00WSQaEqRAWP5uRjqCMtauS4YxRUntucYDBh6lEhMW6pBtb qlpo5n886NNZcUl7BEOnELreuRpnC/p4CUS1K3snEMye8acgRLhf7YpXIyBzVxuyYNaM JGHZSzc3aXgxEuWZwou5qjbQnVdiTqOMyPUvHmFqURMvSczpHFxH37lAjTVRd5Qt0b7c Dn3xDflEBw4hH7Tk6t8zoWUZlBShQTmr6EvbNPFXOZ/d5NufAjWNRxmyihbtpKc7ae8J yubM9OFjAzI4KGAGpipv9TtMZKt6nrVk5tEoa2jXNqg5U1T7IFQ9Qs+dlp+iB90SrZG1 Salw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E9qlL9Zs; 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 g20si8730553ejz.520.2021.04.12.14.21.30; Mon, 12 Apr 2021 14:21:53 -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=E9qlL9Zs; 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 S240918AbhDLJLK (ORCPT + 99 others); Mon, 12 Apr 2021 05:11:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:49260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238105AbhDLI4F (ORCPT ); Mon, 12 Apr 2021 04:56:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C71261249; Mon, 12 Apr 2021 08:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217747; bh=NRtHKydRuvA7XqixRpGw4jbZ2dyk9afHXFvqaYT6jT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9qlL9Zs7leVWrQPkizeIEfB0rZHd4HXnLLgjsPN2TV5+OiYPMoTh0StJjhjEKp9Y EBdwe7a7OE+LmZdpepSnxcpKTV6CfPNhQaymqdzfLOnzL/Sw5Frhpk0fCfPDeKrM0a 1y/HU7GS1t3PL9tqfz7oNQYxuA/i7f6hnyRvrjA4= 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.10 129/188] I2C: JZ4780: Fix bug for Ingenic X1000. Date: Mon, 12 Apr 2021 10:40:43 +0200 Message-Id: <20210412084017.936466952@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@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