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=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 1076AC433B4 for ; Fri, 7 May 2021 02:57:05 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CFF4600CC for ; Fri, 7 May 2021 02:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CFF4600CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VhlqriUKCrbnVF1FwWyChu5o8YLaNYk51/vqg11CIsI=; b=I/r96kx8YmGtYgH4qcYTIX7Hk 9wLH2cRrf8OumOyWCU5oXkyfHVvcKzbkZMrFoEMygWa1oZrPsP7oogKOfbcBJ6kNVGsNqo8U2qlvT A6JmJG0MaSjin44DIlFzN3XsAMTfMkhJQCBkG98YSMGYof9xfwUM4wLdM3K9lpXDUb8XBhcl3bK9x 0109mm8HepIGRPeQHrTxypwAocn+wlc6hCAIYTCHe8eqL/b85d/cx/EkFey9k3avF6ocAlqHxJLrO KQ6I+SsPsHWEcPvXScRYNL7nUKqUp/o3Ux6r0UU6N7GkP8jIfD+BCIg4LdERzXF1QfrVDr6BfWfFX hav+Ue6KQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leqeH-005v3J-M4; Fri, 07 May 2021 02:55:29 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leqeF-005v2w-Uw for linux-arm-kernel@desiato.infradead.org; Fri, 07 May 2021 02:55:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=8cTSVQulBeITLa2/m1dmitAiZk9XtTtJnEzh3hUGeoU=; b=GV5lZWPzlN0HxKQQRDFfMdXeFK dfGXhEjOSfcweEJXxjhQOneXwGIiaoT9+yAqNKc0PA/ruK6gOzJKk9P77jvPB2OCkpoAXWNodANki x0BTMC3VAxVsVFZF/5hr25DABS8PmeJdsyN5F1aVKSPhTDtQrMAykT0rOpZRLYZ4ujzrWHIp3MRVl f/lkVwXo4d2Obr9GQ2Kj+JtzjR1bfTv4TnrRTi2o1LfgA5tNsgUKdQ8yQsNjw3OrdQq2r/R1zMDzR hNJ/ygQEIiwt0kLPs1eZlCU+akZHgU+270RLZ3hDmZAflnrsWX//4exagp0elFIX7NeCxsqi0MYwb bRX72RtQ==; Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leqeD-006XRL-AF for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 02:55:26 +0000 Received: by mail-il1-x136.google.com with SMTP id i22so6508038ila.11 for ; Thu, 06 May 2021 19:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8cTSVQulBeITLa2/m1dmitAiZk9XtTtJnEzh3hUGeoU=; b=cT2ueQbZYQ5FJAitvJOWcefEXBE/+kkX/R4/Kq67RZRWnT/5Uww8mZr34d6Tp9V7oR IZtosX+BEeg7jtZg8NZUeSj13AoRPf9hZZjreEJ2q3niNvpcjOQ9HYP8xvf87w6dynH+ 1tgraxqqCO8fZSn8m2y7m1mHoWWTurzSyvUJuWftsFrnIckGyWw4wAY1/DppiCOGnT2s P4s1EJgQIoYUCpxIZSB5QuU0rpv7xCfl/+916ySp9TcPw3Uy61U7fUA6Cw3pAy34FYOV DN2PgcGtJTQrQmi3V0IL7MVr9QuZJ1ZyhetBAScR2IC8FeSPc9m3j1RR2FS7ZOKm6yTQ HMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8cTSVQulBeITLa2/m1dmitAiZk9XtTtJnEzh3hUGeoU=; b=dahQqlRyDjg6DoOdLuObcRPlMx27+jJYJd8Wz2l188Q5Ymxb2cIIu/aqzFLi2QpGsh 2/UImOJwt1C7iYfUS/tchzjbEOQrULgJOAgwg2lYCyGKEZF8cloiUNpMwz9DRL6Ew1/j hYDXZYc3VnYwkxus85/rZS+7SOdwa1fgENXDjkgMzxZQ3V4GlQREVM+Q3PsmcLWp0jN/ TdKNAf+MrlKGS7TqplmAINy9uIdr+iKlCw/Pdg/9kVOWhH/qEauRpU/GIqPD0siibPon Nuc2x7zmFsgdy/uxMzxq1jWmDLxANRMjdOX4MVHJlcQgZDH/eOz8ayvMUg7xQppkySU6 4OIw== X-Gm-Message-State: AOAM530bduYyHQ8BzDczaS3zDdtNiESl9vzajcnuFjGtN5ttDerBYDQf YiVtYqwsEZfMwvPtu+fm1iFFOMc66gEyBYqYUrE= X-Google-Smtp-Source: ABdhPJw2RBOr2b1dAal8DBdHKDFJPjaMT1E1faSTNgTk5hI83mVNs5XiUZDhlNQbktQ/l4JJRdV37hjRqUN1IaKqYAU= X-Received: by 2002:a05:6e02:e0d:: with SMTP id a13mr7322226ilk.270.1620356123603; Thu, 06 May 2021 19:55:23 -0700 (PDT) MIME-Version: 1.0 References: <1591709203-12106-1-git-send-email-dillon.minfei@gmail.com> <1591709203-12106-5-git-send-email-dillon.minfei@gmail.com> <20210315130050.GD1182@ninjato> In-Reply-To: <20210315130050.GD1182@ninjato> From: dillon min Date: Fri, 7 May 2021 10:54:47 +0800 Message-ID: Subject: Re: [PATCH v4 4/4] i2c: stm32f4: Fix stmpe811 get xyz data timeout issue To: Wolfram Sang , pierre-yves.mordret@foss.st.com, alain.volmat@foss.st.com Cc: pierre-yves.mordret@st.com, Rob Herring , Maxime Coquelin , Alexandre Torgue , p.zabel@pengutronix.de, Philippe Schenker , Alexandre TORGUE , Linux Kernel Mailing List , Linux ARM , linux-stm32@st-md-mailman.stormreply.com, linux-i2c@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210506_195525_395905_4CA9B5AE X-CRM114-Status: GOOD ( 30.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Pierre-Yves, Alain Could you help to take a look? i really appreciate it. Thanks, Best Regards Dillon On Mon, Mar 15, 2021 at 9:00 PM Wolfram Sang wrote: > > On Mon, Mar 15, 2021 at 08:43:54PM +0800, dillon min wrote: > > Hi All, > > > > Just a gentle ping. > > Pierre-Yves? > > > > > Regards. > > > > On Tue, Jun 9, 2020 at 9:27 PM wrote: > > > > > > 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. > > > > > > to not take side effect, introduce IIC_LAST_BYTE_POS to support xip > > > kernel or has mmu platform. > > > > > > Signed-off-by: dillon min > > > --- > > > > > > V4: indroduce 'IIC_LAST_BYTE_POS' to compatible with xipkernel boot > > > > > > drivers/i2c/busses/i2c-stm32f4.c | 12 +++++++++--- > > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c > > > index d6a69dfcac3f..97cf42ae7fa0 100644 > > > --- a/drivers/i2c/busses/i2c-stm32f4.c > > > +++ b/drivers/i2c/busses/i2c-stm32f4.c > > > @@ -93,6 +93,12 @@ > > > #define STM32F4_I2C_MAX_FREQ 46U > > > #define HZ_TO_MHZ 1000000 > > > > > > +#if !defined(CONFIG_MMU) && !defined(CONFIG_XIP_KERNEL) > > > +#define IIC_LAST_BYTE_POS 1 > > > +#else > > > +#define IIC_LAST_BYTE_POS 2 > > > +#endif > > > + > > > /** > > > * struct stm32f4_i2c_msg - client specific data > > > * @addr: 8-bit slave addr, including r/w bit > > > @@ -439,7 +445,7 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) > > > int i; > > > > > > switch (msg->count) { > > > - case 2: > > > + case IIC_LAST_BYTE_POS: > > > /* > > > * 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 +460,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 = IIC_LAST_BYTE_POS; i > 0; i--) > > > stm32f4_i2c_read_msg(i2c_dev); > > > > > > reg = i2c_dev->base + STM32F4_I2C_CR2; > > > @@ -463,7 +469,7 @@ static void stm32f4_i2c_handle_rx_done(struct stm32f4_i2c_dev *i2c_dev) > > > > > > complete(&i2c_dev->complete); > > > break; > > > - case 3: > > > + case (IIC_LAST_BYTE_POS+1): > > > /* > > > * 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 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel