Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4265790pxt; Wed, 11 Aug 2021 01:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHxvb0FQ/ic1VQlsLyQCQ4pimJ/vkIMcHj0GAnPawmjH+lUdne6FW792Um3tcxW/vwhYT/ X-Received: by 2002:a17:906:d7b6:: with SMTP id pk22mr963290ejb.522.1628671516169; Wed, 11 Aug 2021 01:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628671516; cv=none; d=google.com; s=arc-20160816; b=EXmGDedMWb+gIaNK9eSi/8AvinI6iMw6qzbDaFeDs2g580YQ4zFPI/S9sWs1LwC8mt n12xz56x26OkbPQTOEXC0yvTptHDlYVgJmXpnOX01k9s7Jph8pp6vmgeqYjb758Jcz5f 0gN8iT4vAO0Zx8CLCsGyBSqlA4z34wxxgApbnjhJihMeePl09/cCycBB8T4XUHd5Yv6y rVhMl71jsHfG2pZmjylm+ntrCFB3edMEhMM1eMCnpBtU4If1MCg5D2UFXhH1aSWXxKl/ 0oHUzVt0WNzNB2ftgHI9gOaDjkM/CxEvdCbVIm829zlLTPIaUPud0gjUUijZP2ZZzXjH YtAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RRXhxpsGGBaiNGCyD3hg6td+QSBXWB5z0qL251IrDq4=; b=crzYgfdXc5nKQPh2152B1TLDw56wq8vQdGK9jnRoI8egxgcCJX/59/qFQtjEBSK0yy Lcr35IvOfFCGqrIYz5pz8iYfmREFqL5djjQIB1+inOLC0Jkbe7zXbAiuI6V8zgSxdgxH S8cdTzskHmZRcUCyzG8CGf3rHBuuQnxsXsF9uri86cPxqyrpfVm3UKNk1v0csKcfydpV ie8MbtrVK57QQrp29zJnLEYRIP+K4ZyXpPM1Ka3Wk9aaItSm9MNqYS+LXhkGr3h0mIO2 /BGfKntzpbpzk4KXq+cssASZp/T6nKVWQu494uSh2K+z0TM4jyk192qciddQyQD4gyMu nZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eUmIOHzw; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si24201869ejw.357.2021.08.11.01.44.50; Wed, 11 Aug 2021 01:45: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=@chromium.org header.s=google header.b=eUmIOHzw; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235902AbhHKIlm (ORCPT + 99 others); Wed, 11 Aug 2021 04:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236183AbhHKIll (ORCPT ); Wed, 11 Aug 2021 04:41:41 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF013C0613D5 for ; Wed, 11 Aug 2021 01:41:17 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id z2so4133168lft.1 for ; Wed, 11 Aug 2021 01:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RRXhxpsGGBaiNGCyD3hg6td+QSBXWB5z0qL251IrDq4=; b=eUmIOHzwisXtFKg49mSlkUJt8dGRHaqzBozWiWhzdPe8zHaOj6f30AKTlAcDd/lwb5 t4zLhSo+WFWFP1R0ImhHYjgR4CCSbFHRxMLECl2Qshn1OxF5jzpVhIUE/4+FYbFet3f+ gmve+QbPDuRAm+TQyHyiksrDXBapJDsvmXRBI= 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=RRXhxpsGGBaiNGCyD3hg6td+QSBXWB5z0qL251IrDq4=; b=tQqf2cqlOhSz4h2yXBYTj7TeNMeISDiGybw0lxs1tDf1UOnJPOioPXTBN3/gWHFeyA CQQ6ro4f5w+n6e95NnRCmhHMPorSOgLo6UAU4wdoXDqy/4byEJrNQyFRK6kbAVy2mSqR MMESNA3orjP5nsVY1SRNZ8OGKQ5woa4HTqn8krgnEIA+OkZDmYoyQPyye0KKljf+WM84 IGJsIKbE7UDIGWhmDG1xzL2G1Lb6pXQAh7KWdFW2ANw1LsdyhqWrNd5K08FT2qzQnOZ9 tnw6Gr0+4GKo7uIGfTEzgGg1i7aCeF5aTb9wvdk1FBIgvHOVi5g+TPknK2Wx7G/i2tKq YqbQ== X-Gm-Message-State: AOAM531o2d8+JqTQJ0/eB+W1NPedxO2isyxB0oigsObs1owEG/p6IxCe +sV02QgpMrGu/QLkCHtV/cHjSA1wmEZY3ATdMp7bsg== X-Received: by 2002:a19:c202:: with SMTP id l2mr24358532lfc.276.1628671276094; Wed, 11 Aug 2021 01:41:16 -0700 (PDT) MIME-Version: 1.0 References: <1626517079-9057-1-git-send-email-kewei.xu@mediatek.com> <1626517079-9057-4-git-send-email-kewei.xu@mediatek.com> In-Reply-To: <1626517079-9057-4-git-send-email-kewei.xu@mediatek.com> From: Chen-Yu Tsai Date: Wed, 11 Aug 2021 16:41:04 +0800 Message-ID: Subject: Re: [PATCH v4 3/8] i2c: mediatek: Reset the handshake signal between i2c and dma To: Kewei Xu Cc: wsa@the-dreams.de, Matthias Brugger , Rob Herring , linux-i2c@vger.kernel.org, Devicetree List , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , LKML , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , leilk.liu@mediatek.com, qii.wang@mediatek.com, yuhan.wei@mediatek.com, ot_daolong.zhu@mediatek.com, liguo.zhang@mediatek.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, Jul 17, 2021 at 6:29 PM Kewei Xu wrote: > > Due to changes in the hardware design of the handshaking signal > between i2c and dma, it is necessary to reset the handshaking > signal before each transfer to ensure that the multi-msgs can > be transferred correctly. This also affects MT8192. Has this been tested on that SoC as well? > Signed-off-by: Kewei Xu > --- > drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c > index 222ff765e55d..c0108387f34b 100644 > --- a/drivers/i2c/busses/i2c-mt65xx.c > +++ b/drivers/i2c/busses/i2c-mt65xx.c > @@ -47,6 +47,9 @@ > #define I2C_RD_TRANAC_VALUE 0x0001 > #define I2C_SCL_MIS_COMP_VALUE 0x0000 > #define I2C_CHN_CLR_FLAG 0x0000 > +#define I2C_CLR_DEBUGCTR 0x0000 > +#define I2C_RELIABILITY 0x0010 > +#define I2C_DMAACK_ENABLE 0x0008 > > #define I2C_DMA_CON_TX 0x0000 > #define I2C_DMA_CON_RX 0x0001 > @@ -850,6 +853,17 @@ static int mtk_i2c_do_transfer(struct mtk_i2c *i2c, struct i2c_msg *msgs, > > reinit_completion(&i2c->msg_complete); > > + if (i2c->dev_comp->apdma_sync) { > + mtk_i2c_writew(i2c, I2C_CLR_DEBUGCTR, OFFSET_DEBUGCTRL); > + writel(I2C_DMA_HANDSHAKE_RST | I2C_DMA_WARM_RST, > + i2c->pdmabase + OFFSET_RST); > + writel(I2C_DMA_CLR_FLAG, i2c->pdmabase + OFFSET_RST); I2C_DMA_WARM_RST is self-clearing. Is I2C_DMA_HANDSHAKE_RST not self-clearing? If both are self-clearing, don't you need to wait and check for them to cleared? If they aren't self-clearing, do you need to delay some time for them to complete? > + mtk_i2c_writew(i2c, I2C_HANDSHAKE_RST, OFFSET_SOFTRESET); > + mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_SOFTRESET); Same here. No time delay needed? > + mtk_i2c_writew(i2c, I2C_RELIABILITY | I2C_DMAACK_ENABLE, > + OFFSET_DEBUGCTRL); A comment explaining what the section above does would be nice. AFAICU this is force resetting the DMA handling. Regards ChenYu > + } > + > control_reg = mtk_i2c_readw(i2c, OFFSET_CONTROL) & > ~(I2C_CONTROL_DIR_CHANGE | I2C_CONTROL_RS); > if ((i2c->speed_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) || (left_num >= 1)) > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek