Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp640729ybj; Thu, 7 May 2020 04:19:02 -0700 (PDT) X-Google-Smtp-Source: APiQypL5ktnb/yl1WkwTz+EQpN8yomKnK8MO/7dUM4KEqTfOEtVR7gzVrjNPkaeAqgXG/s1WfKty X-Received: by 2002:a50:eb8b:: with SMTP id y11mr11336443edr.229.1588850342074; Thu, 07 May 2020 04:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588850342; cv=none; d=google.com; s=arc-20160816; b=tf3iFIgCZMWXcrQ6zod6+uyn1MC3KbrwKOE+vOTDFzIrb19dMc1sc7kLKYHnVNlMf8 LCKI5hxqH/Z5Zl1p+npFIVoCmpOOff3ZwqaTMPewOxKLcwuWXUyYuYDVV591Ln7YkfDb EgYCv/EX/Au4vT8US68Dm+RLD3ErAtStZHYFrXa0lofNIEvO1f8MFTp/Hn0R0VzLrqr6 ZCw1vTP2M2vJsWZcPyCMI2932AAhgtbvRbCvnz73cJhYbJ9+SMhtBCWBWQyfVnqhQMA+ Zd+xCukCkcPwNCxvsFt5X1kykpxS4u066dDzET0nmZh4U3qOlhnh68qqq7F8pGgIcMoB H1Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=q5Ur7h/8oNS0E2jiQqG3CicZ1bVNQn1Ydx7PFOHfa0s=; b=CbJk2O9pXx+VsFDPRF/ebGbaNvQsFG0jxRwaL9RY/FpeSc1Wlr1O6gNy4m9xVtbmE0 BxaiW5HU9ImNljXWlM0PIsP4PvELq4c08s3IPGITGzr2k50PcgQ72sLDHRdiSdeY86kO jCK1QDNm6jRoTxSX7kXbGPK+APR6VX9phtKMGvGm2m+LlInxVpBVdapc+DQiCyIrFzKS iGeDO5DuFERokpVmrILqi78ruBYF2f4OA0m1va6GCfA04wzWtiC7R8MxqjIIbAbGIIvL UjxH6oBPf9C5z2T4Wj1flHUZhUnErEMJcbaqgTv0o1r4lB08tGNZE2k0/dF+RaiYnu6I CdOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vR5ulAiF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si3162439edi.509.2020.05.07.04.18.36; Thu, 07 May 2020 04:19:02 -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=@gmail.com header.s=20161025 header.b=vR5ulAiF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgEGLPz (ORCPT + 99 others); Thu, 7 May 2020 07:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbgEGLPy (ORCPT ); Thu, 7 May 2020 07:15:54 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6CCCC05BD43 for ; Thu, 7 May 2020 04:15:54 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id w65so2844514pfc.12 for ; Thu, 07 May 2020 04:15:54 -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=q5Ur7h/8oNS0E2jiQqG3CicZ1bVNQn1Ydx7PFOHfa0s=; b=vR5ulAiFzgiMVcgSPCb6i5yphLLVEtvHKU/b5abZlIFH43323JlPd5KMMStpRnXzBh WaI6/rirsojCkduRRV/ISOPLZmdiIuEpB57Y1eFvwFAo8LqTyxDXcix6QMLHG7BFeobo jgZi1O968NO0xyNItwoWpBW2XGhT4JWh3z8hpxUjrVpoDc3RGTxwtkEfTzM5pn8eGh4h UQdlyay/n0BgUc6MZhoACDDKw6l24cg92w0h6UUWWg0eE2Prim1/PQhMkJcNBe6RLvi2 XmVGQw0ZN0XpQToieiNZ50lWcepk2YyOIh4UtDooZjjoniNj8hGu+QqrRLEqcvwUpPvn uIQg== 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=q5Ur7h/8oNS0E2jiQqG3CicZ1bVNQn1Ydx7PFOHfa0s=; b=oHH5Byp1sRJhbVfysSyZ9y+eUZGiu12r5ufNdhRgi3ekSb547F8vs3mVUjA8L0IkLX Wb6tp2PPhoagIdWSiS6v/pHlmG1VWXNUSd/UE0OZS1noOlf9SL0IOWeNb+q5vp0x0oy2 gUGV1sEHANaISiy53+fBvL01q2fcBRM92J/oJeqfQ9NsAl/bz5IDRtskke4GeR35VDBH LVlsIPJw40L/tXimBWggXCKEi5yccgKRJZV95y64/doIJiwvD/0FS0ZI/4+lp7o2gxcm BjLeCJS/LniSf6rVnBe1NnkQJBSSVpoIuYYFVppKNCAzrSUm5/OgvlCQVQLA+Vxad+oR ENZQ== X-Gm-Message-State: AGi0PuZDbPCEdOXlWPpnhFRYaGDBgSuPht6U5K68/GY9PKjhVA8kR6Bx alO3DPKzDCxLlvYEDcApd5I= X-Received: by 2002:a63:f70e:: with SMTP id x14mr10338566pgh.394.1588850154438; Thu, 07 May 2020 04:15:54 -0700 (PDT) Received: from fmin-OptiPlex-7060.nreal.work ([103.206.190.146]) by smtp.gmail.com with ESMTPSA id d184sm4492752pfc.130.2020.05.07.04.15.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 04:15:53 -0700 (PDT) From: dillon.minfei@gmail.com To: mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, philippe.schenker@toradex.com Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dillon min Subject: [PATCH V2 4/4] i2c: stm32f4: Fix stmpe811 get xyz data timeout issue Date: Thu, 7 May 2020 19:15:49 +0800 Message-Id: <1588850149-24393-1-git-send-email-dillon.minfei@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: dillon min As stm32f429's internal flash is 2Mbytes and compiled kernel image bigger than 2Mbytes, so we have to load kernel image to sdram on stm32f429-disco board which has 8Mbytes sdram space. based on above context, as you knows kernel running on external sdram is more slower than internal flash. besides, we need read 4 bytes to get touch screen xyz(x, y, pressure) coordinate data in stmpe811 interrupt. so, in stm32f4_i2c_handle_rx_done, as i2c read slower than running in xip mode, have to adjust 'STOP/START bit set time' from last two bytes to last one bytes. else, will get i2c timeout in reading touch screen coordinate. Signed-off-by: dillon min --- drivers/i2c/busses/i2c-stm32f4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c index d6a69df..83004f2 100644 --- a/drivers/i2c/busses/i2c-stm32f4.c +++ b/drivers/i2c/busses/i2c-stm32f4.c @@ -439,7 +439,7 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) int i; switch (msg->count) { - case 2: + case 1: /* * In order to correctly send the Stop or Repeated Start * condition on the I2C bus, the STOP/START bit has to be set @@ -454,7 +454,7 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) else stm32f4_i2c_set_bits(reg, STM32F4_I2C_CR1_START); - for (i = 2; i > 0; i--) + for (i = 1; i > 0; i--) stm32f4_i2c_read_msg(i2c_dev); reg = i2c_dev->base + STM32F4_I2C_CR2; @@ -463,7 +463,7 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) complete(&i2c_dev->complete); break; - case 3: + case 2: /* * In order to correctly generate the NACK pulse after the last * received data byte, we have to enable NACK before reading N-2 -- 2.7.4