From patchwork Wed Oct 11 11:53:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: radek X-Patchwork-Id: 9999447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4EFA9602BF for ; Wed, 11 Oct 2017 11:53:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 404CD283CF for ; Wed, 11 Oct 2017 11:53:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34FC4289F0; Wed, 11 Oct 2017 11:53:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE218283CF for ; Wed, 11 Oct 2017 11:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Iesnve6KysOTs2Fv4Lj/XY3bIU0KXoHV7AybaRQVGSk=; b=cZH eNt7LiC3Bg0YNBJFDf0PMl2MsdGL21W24bUfr+JZsdPD2Xo/K/FL7tzBm2X2BpseoW9Fw5YClyBSo 93fM7YIFubpTbplu6w5F/bLPniP+OnNnl/cWSDkk9gxGOyeuzZ+8uvE5W9b7JYbPbaU9qNTfXeL+P 5SFIMUnMpUgJNr/3kORiaVIgqUw1tNh55V6hCIiEjxGY4mAT7GZNJ29RgW6twVAEaHlotsXbyP23o kjno/ZyAM9Hhq4qQ3hfblVaRhWZhykroos8pgzNujpmrRJQtJXlAe6X4vT70jDAlsV1553/JLkT0l rcg0zfNeT/YsLpAyqij8dsmju71HLbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e2Fa5-0000YQ-U9; Wed, 11 Oct 2017 11:53:45 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e2Fa2-0000SE-0O for linux-arm-kernel@lists.infradead.org; Wed, 11 Oct 2017 11:53:43 +0000 Received: by mail-lf0-x243.google.com with SMTP id a69so1773289lfe.5 for ; Wed, 11 Oct 2017 04:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=w9txoNhWVOyJITrsPAaYpb67DZDTKvhwv75fVwDdI3U=; b=tDrmf2vs/GUJWxY4lIznYKgpM9P3/TMBqg/Et32JTgxA7zMXstB4Krt3y3RAM06Lum vkVe2PYv2GZVh8270hgpWjKT2R9Ksv6DPVzJSBf5BzraysLyGXGHZaXvYfaWtPz16gly 65mOvLsi00rOa61739vDGhPa7FHd8cjN1eY1iv8Is9NhaekR9D7mEpdZ63nVVJ6y3EF3 5TwfrM/3vsT2n0mY5z6KBePfxfhaFJ9C8VugHZYArkG5OMMe1OzdVXuYv6fgL9A0+hdm nLD86RD5byqSvPN9pXJSJ5uRoCgQVb+FiS0BgWzJAJTtG9mNNfG1zzEtlItvfdJ7Kl4K Qw2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=w9txoNhWVOyJITrsPAaYpb67DZDTKvhwv75fVwDdI3U=; b=AFq2ksiVc1noi/Sf6gwwSN2IpLSkAAg0m+iK3uidqFV/ueseieLavkCTDwx5TI2SL1 04WSaYPDrG7oh+m04lAc4XGYIjrO4jCFl7DIONOMKuqQddfOLHSLNMP0T1YXXY4RfZMK S+bKJkIlvRGAbthaDIq+dRfN7Xpv1e/Jkx17GtetSTsO+P9F0PnlXiEHDNv2Zu7xZLjU s+WG7DgjJOcxwE9Za62VYxrwwMBnttcB9mVm223019noTRPWPW9nZHerkobyKlkv0PyT uAoba6+iL1fXIF9rogu8/USXMLbC8IW9BrQB58AtvRz9rcUhB/JDSfHggzy7dUG81SDM PR1w== X-Gm-Message-State: AMCzsaX7xGxuUMGrEHc4aCgEqLbKB8TdQkj7ORjoTNat03uVUUJMCJ/G 2FswBoCLzM21wcTEusQuJi4= X-Google-Smtp-Source: AOwi7QBsq9GR/NvDeh4N3IxZiHyAfXME3wlRHl/RzpjWlX2AGUamF266g6WUuMH4yvLRrirIh2yAPg== X-Received: by 10.25.168.78 with SMTP id r75mr4736291lfe.65.1507722799566; Wed, 11 Oct 2017 04:53:19 -0700 (PDT) Received: from PLLZPC317.harman.com ([212.91.28.199]) by smtp.gmail.com with ESMTPSA id h140sm2238130lfh.42.2017.10.11.04.53.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Oct 2017 04:53:18 -0700 (PDT) From: Radoslaw Pietrzyk To: Wolfram Sang , Maxime Coquelin , Alexandre Torgue , linux-i2c@vger.kernel.org (open list:I2C SUBSYSTEM), linux-arm-kernel@lists.infradead.org (moderated list:ARM/STM32 ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] i2c: stm32: Fixes multibyte transfer for STM32F4 I2C controller Date: Wed, 11 Oct 2017 13:53:08 +0200 Message-Id: <1507722788-31224-1-git-send-email-radoslaw.pietrzyk@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171011_045342_242433_396B71E9 X-CRM114-Status: GOOD ( 10.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Radoslaw Pietrzyk MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Do not read data on RXNE but on BTF only due to HW synchronisation problems and NACKing read data too early. It was found during testing of stmpe811 touchscreen driver. Signed-off-by: Radoslaw Pietrzyk --- drivers/i2c/busses/i2c-stm32f4.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c index 4ec1084..86bcf4c 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c @@ -409,16 +409,9 @@ static void stm32f4_i2c_handle_read(struct stm32f4_i2c_dev *i2c_dev) * So, here we just disable buffer interrupt in order to avoid another * system preemption due to RX not empty event. */ - case 2: - case 3: + default: stm32f4_i2c_clr_bits(reg, STM32F4_I2C_CR2_ITBUFEN); break; - /* - * For N byte reception with N > 3 we directly read data register - * until N-2 data. - */ - default: - stm32f4_i2c_read_msg(i2c_dev); } } @@ -470,8 +463,6 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) */ reg = i2c_dev->base + STM32F4_I2C_CR1; stm32f4_i2c_clr_bits(reg, STM32F4_I2C_CR1_ACK); - stm32f4_i2c_read_msg(i2c_dev); - break; default: stm32f4_i2c_read_msg(i2c_dev); }