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: Radoslaw Pietrzyk X-Patchwork-Id: 824366 X-Patchwork-Delegate: wolfram@the-dreams.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tDrmf2vs"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yBsnh4FRKz9sNr for ; Wed, 11 Oct 2017 22:53:44 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757234AbdJKLxX (ORCPT ); Wed, 11 Oct 2017 07:53:23 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:50261 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdJKLxV (ORCPT ); Wed, 11 Oct 2017 07:53:21 -0400 Received: by mail-lf0-f68.google.com with SMTP id a132so1768655lfa.7; Wed, 11 Oct 2017 04:53:20 -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=YJTVM1uhg5qndSgHYmrxv0heahNY/XdcerRQf6CIZI7ZovwUSZl0YQifxoJxu0djfj ztS0KR7rG+wwpL4Z2d99rYoC/KCsI8iTwqVYcjOL7gzlDzXRni9U/DciTfmUR8NLiVyD v8gVzNwROJ6XS4rhOgnQKCpz6akdOj/wBOVvyfJj4DY8jXRf+HSCcosBu0oD3+C6/fG/ cgCWXVFRMzraP1LzX36LwChZwrZazcH/47bmWuGU3se8cuHntTXUgeL0QJLK6Vn5JmoX jNdIpZ6xm1eD/+6FcEhiO9ljRyiDwXEVsWFXeWYV/s73xeQpyKbnp6nY5+cS+8fUYzZ3 JJhw== X-Gm-Message-State: AMCzsaVx5DpacHH/2hz9qNBSfdPbvxnBb/SFGTiMEXCSAnCldkqIUHkt +gzdzywLesGWUj8EAhweSaQ= 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) Cc: Radoslaw Pietrzyk 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 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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); }