Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1239027ybj; Thu, 7 May 2020 18:49:17 -0700 (PDT) X-Google-Smtp-Source: APiQypKbG7U+WfjN3VL1/zNEztCJT4E8mNvqbiQq3AVQmw/5QfoTxKhPvpmntFOCq26j0/RSzGsi X-Received: by 2002:aa7:cd01:: with SMTP id b1mr223599edw.163.1588902556969; Thu, 07 May 2020 18:49:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588902556; cv=none; d=google.com; s=arc-20160816; b=jAbToljQRS3KPeWJ47uscJ+G/Q041f81N92d0nefBjHxz186NZrPFJ6K3z6lct3v1t cKQ9Gbpd0Usp40EqmJP1WiGVnREJqf0EB04hhaRC4MHLyARLA+u1Iv9kJfZifKJ5Db+8 Wu8akwTGcwDEu9eWGU/bgfBFRkzXxMQfNqpwvzRWBBlMBQfIRdHu2JyP+aio+cnfjvn5 6+WU/VYhCJh4hxZ9ocUex6pCOg0wZ83fN0QLVW+q8syM+wJjCDgFfEHVSTxX7dRc8wMq M1YXYYyMOF38Bjj33E9y6P9qqU+4hX4l9Z5ghhP14rhLA/+KU9HY6nehhnjq1V2N/xVl VFDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=YPET1s2LAGhUOXmbuGCWG2lOM9gQW5zcHOoGqo8jUto=; b=LEVUEm0qS62DTV80js43CzWbIbJK6SuheYmDaxTFW2+yG551PCShXQ9VCgZNmDs3F+ H8cMXX5FANpr7huGh7glT0mCQQPHq2TPdRKgDPFJjpXaBLMuJw+1gedTyO9RZsK7ldNW elc5OgNwi71h7U+SxsCdLfieg9KStni8T2YeY/y6AFUY6nxrB/Oq8z/UzoV0dAt6/5o4 VLugoRhnGbNvZQ2KCweguujZ4tpCvhE5u2ISxffTeIFo+PH56BMmebz4dhcMuc+NMZmf GgSffg73L/YYdhJkLVcziXQj1QMek+1HfHwR6VDnWe37V/vLv96/v9BRsuGkSWyKxBfp Logg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gSsPcfh/"; 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 ks15si116039ejb.223.2020.05.07.18.48.54; Thu, 07 May 2020 18:49:16 -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="gSsPcfh/"; 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 S1727109AbgEHBqp (ORCPT + 99 others); Thu, 7 May 2020 21:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727099AbgEHBqo (ORCPT ); Thu, 7 May 2020 21:46:44 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22512C05BD43 for ; Thu, 7 May 2020 18:46:44 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id r14so104127pfg.2 for ; Thu, 07 May 2020 18:46:44 -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:in-reply-to:references; bh=YPET1s2LAGhUOXmbuGCWG2lOM9gQW5zcHOoGqo8jUto=; b=gSsPcfh/FmLMFO8F/e1XknD3JIM2pA62uVJim6lR2mvj0H1qriC2lddSShZQTFLpbY ALw0zklxxW1C0syHhLZO2+HYLZng52g4CfsVoJ3VW6AHVJm7uDAOKY1flF+qs3Wf4Bm3 eYVMWT+7t8DVeBipQXFDhXGzYD0K5D05DbdOKzIciLjmKU3zbXSojG+zQhsapme9TtBo MQjQyMNYSaK+W7ffUF/dJgIoVxP+jeLbxOdzrVzRrioPKheevGY/2FpVBSHWY141IHyo 9qMhhKzSM+Hbij//nWhXsryAL1LwtW1EC7hJXAkv0WFfynXz+yrvWmBVhTwDL56YQXWD E8cg== 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:in-reply-to :references; bh=YPET1s2LAGhUOXmbuGCWG2lOM9gQW5zcHOoGqo8jUto=; b=UQ0Z67sBgoFb/dzkZ7mpy/PRqxXEoM5PT3ybDqTWBsBy/JryD7SZgncwbQv7eMJ5YT Lj6wDk1dr5wbCoM9s+I2y8slwK7kUIssIo5MrP839E4wy6jQCbG9vfDJQgOEqWgBg50Q z8kb+QtyMYQBfNI7foaK+2NLTiYOoEDdFSiLvVtwqI/dfXlmon2A6y9lTr4dg74ahE7H U5cCRS7hAsocLaUXsWRfAMv0hDftXcLfg6LeW/xpkENvGiOlwfzDIK4jwxgafEj7ynRp 9caXZf6FjPZmKBfZVc0XZzbQClWrXSgrEpo15QHsQf2cf5jZeLBaGszQzkqnrf3uBCDl i9gg== X-Gm-Message-State: AGi0PubXlSu2FwXlnccLa5WW76NbYOT6g/oIZzSM8h2BRYRHswhPhyty Mp7lelS+CMrIBvQ6Xeh9HeoCQYUT23g= X-Received: by 2002:a63:6cf:: with SMTP id 198mr128652pgg.59.1588902403750; Thu, 07 May 2020 18:46:43 -0700 (PDT) Received: from fmin-OptiPlex-7060.nreal.work ([103.206.190.146]) by smtp.gmail.com with ESMTPSA id f74sm9270816pje.3.2020.05.07.18.46.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 18:46:43 -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 v3 4/4] i2c: stm32f4: Fix stmpe811 get xyz data timeout issue Date: Fri, 8 May 2020 09:46:28 +0800 Message-Id: <1588902388-4596-5-git-send-email-dillon.minfei@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588902388-4596-1-git-send-email-dillon.minfei@gmail.com> References: <1588902388-4596-1-git-send-email-dillon.minfei@gmail.com> 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 position' 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