From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E8D5C5DF60 for ; Fri, 8 Nov 2019 19:08:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A47A2196F for ; Fri, 8 Nov 2019 19:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573240137; bh=2kX+laI/ehn4iXN0vCEbIsI7s9sawNuYiTvkxjFIIns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CLropzucJz8XWWO2OXjS0G7u947qnTZAiwh7EzseNiuNUuKwVO3iQr6lCXncQeHG6 qybx147RoATGZe2ViFLh34OV2qDyqS14/7cLJrjmT+fvmtT3FKokJNquvld6Ahfg+j xYpCZSla6rUb1FbVwYRGb/kbvFb985KVPwufPQYs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390966AbfKHTI4 (ORCPT ); Fri, 8 Nov 2019 14:08:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:40098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733278AbfKHTIz (ORCPT ); Fri, 8 Nov 2019 14:08:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3DBA1206A3; Fri, 8 Nov 2019 19:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573240130; bh=2kX+laI/ehn4iXN0vCEbIsI7s9sawNuYiTvkxjFIIns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d5kcZku5tBs1wDF8lvP0RG78n7oGR5iA16SHiqVbPvI79R5kqeSnisGp4dSVwOljy i3kb4S05IWCkDnpMMMuL5oDF7UN3tzAPWtLnM3CdGFz+guAgQxNCFiex48Ak02icYs toOz9D0YgTJaptJsLjLGwEYUWBdh0TAgS3IQXghs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrice Gasnier , Pierre-Yves MORDRET , Wolfram Sang , Sasha Levin Subject: [PATCH 5.3 072/140] i2c: stm32f7: fix first byte to send in slave mode Date: Fri, 8 Nov 2019 19:50:00 +0100 Message-Id: <20191108174909.685970242@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174900.189064908@linuxfoundation.org> References: <20191108174900.189064908@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Fabrice Gasnier [ Upstream commit 02e64276c6dbcc4c5f39844f33d18180832a58f3 ] The slave-interface documentation [1] states "the bus driver should transmit the first byte" upon I2C_SLAVE_READ_REQUESTED slave event: - 'val': backend returns first byte to be sent The driver currently ignores the 1st byte to send on this event. [1] https://www.kernel.org/doc/Documentation/i2c/slave-interface Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support") Signed-off-by: Fabrice Gasnier Reviewed-by: Pierre-Yves MORDRET Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-stm32f7.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c index 266d1c269b835..0af9219e45f79 100644 --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -1192,6 +1192,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev) STM32F7_I2C_CR1_TXIE; stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask); + /* Write 1st data byte */ + writel_relaxed(value, base + STM32F7_I2C_TXDR); } else { /* Notify i2c slave that new write transfer is starting */ i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); -- 2.20.1