Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2971157pxb; Tue, 12 Jan 2021 03:13:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1JdHjHsWT0Y6KTiUKkb8Gc/DiBocGoscs2dQnrebb4+pAatQ6J0r+Nf8616pvuQ0cDEGq X-Received: by 2002:a17:906:3499:: with SMTP id g25mr2870407ejb.18.1610450008978; Tue, 12 Jan 2021 03:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610450008; cv=none; d=google.com; s=arc-20160816; b=wh3fFYm4G4zIfzmWJVRVtU2yfVbWzOEav8AvzVza1doeRliGdBRZy0smbTy40wXggx ljzMU0z09Vxcbqe2Bff/8teTpHiaYfj5rjbRPYNm6fDDcRgsIQafDgVRedi3/+dkZpzC S3X+NxBcHgx0jjV09NFbHEhoAlKAaMwE/zPONCfZnGleTlvhJptLg4lhzF0fd9y0GdDB jjxg4hNqMW5zxWdePOjiNbVnreRUYxih5anUJIgkEASWQASPe/F8p5UdkCMqCChHZmir h6WPvZN4Bz8TbBhjfQcIkE/yUHIYrp69lAu0l5ilQpa6GVMssTFqlXyRsq+x/PT1NQ4z DMHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=Di1nGnKfNHnPo2PJcbfvnWaUpPkwPeDFp//2vWWPufA=; b=gDp8MXoH7v9hhjTtpu4Ikw4Y0fKGjkVHykv+67vHy1/+AAIUNFBt62kuzuK6DnpUqQ Tgo4+0lh+lFKycYwe6P9rVPOD9dNG3L92RdZ3RWXKfo4md+xIPwRYYXaOYG39YaSjae7 lKglnaO3XksB6x3mXIfZum33GK3drhLFqRKWbMT14iu/3d24akkgYIFGsG0ESQHxHYgn Onq9+UdO9sYIfNe+3TJPmXLyGtlGS2eMdTJd9T5+iQECyLF2jhErs18uEw6HK48GmGU6 eSMe8J1vsnxaPtUjjTtk6Dxz5vKtmHNoFhnoB6Fv7Nd2PoZYnkx3QlQIjrW9aX7rdMoB U/XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Ypirb7bY; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 96si1217772edq.111.2021.01.12.03.13.05; Tue, 12 Jan 2021 03:13:28 -0800 (PST) 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=@nvidia.com header.s=n1 header.b=Ypirb7bY; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729572AbhALEG7 (ORCPT + 99 others); Mon, 11 Jan 2021 23:06:59 -0500 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:12094 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729510AbhALEG7 (ORCPT ); Mon, 11 Jan 2021 23:06:59 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 11 Jan 2021 20:06:18 -0800 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 12 Jan 2021 04:06:18 +0000 Received: from skomatineni-linux.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Tue, 12 Jan 2021 04:06:17 +0000 From: Sowjanya Komatineni To: , , , , CC: , , Subject: [PATCH v2] i2c: tegra: Create i2c_writesl_vi() to use with VI I2C for filling TX FIFO Date: Mon, 11 Jan 2021 20:06:19 -0800 Message-ID: <1610424379-23653-2-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610424379-23653-1-git-send-email-skomatineni@nvidia.com> References: <1610424379-23653-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1610424378; bh=Di1nGnKfNHnPo2PJcbfvnWaUpPkwPeDFp//2vWWPufA=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-NVConfidentiality:MIME-Version:Content-Type; b=Ypirb7bYMBR+6DU6KIv9n0AKphmfPfLv0no+mMMye1peTBc9Bl/C8Q8e2s9GqW7e7 LXS2biZ+f5orFlw6r71D0c6HRGQ2V7iJ6gampp364Ux/wxWpPBudbqruVadm2BEuwO +fe5oXIs1IP88jpvY07dffL+mP2ZXs/B4rDXVDNPTY/4Zf/sNKPZU/oTXVRjF4swy8 a/sM1mw0W8sqx4zUpoERlwCVZ50w608b5zIDNsg/ai0l1EM6GfUpgz+5S+ch10diZm As7BeAQDTKO8P51k7GaR1eOFm0kcAFctljpqYh55e/nkQ26XK5oOyHYxf0TmYEul32 czYp0pyjOVVAQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VI I2C don't have DMA support and uses PIO mode all the time. Current driver uses writesl() to fill TX FIFO based on available empty slots and with this seeing strange silent hang during any I2C register access after filling TX FIFO with 8 words. Using writel() followed by i2c_readl() in a loop to write all words to TX FIFO instead of using writesl() helps for large transfers in PIO mode. So, this patch creates i2c_writesl_vi() API to use with VI I2C for filling TX FIFO. Signed-off-by: Sowjanya Komatineni --- drivers/i2c/busses/i2c-tegra.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 6f08c0c..e2b7503 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -339,6 +339,21 @@ static void i2c_writesl(struct tegra_i2c_dev *i2c_dev, void *data, writesl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg), data, len); } +static void i2c_writesl_vi(struct tegra_i2c_dev *i2c_dev, u32 *data, + unsigned int reg, unsigned int len) +{ + /* + * Using writesl() to fill VI I2C TX FIFO for transfers more than + * 6 words is causing a silent hang on any VI I2C register access + * after TX FIFO writes. + * So using writel() followed by i2c_readl(). + */ + while (len--) { + writel(*data++, i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); + i2c_readl(i2c_dev, I2C_INT_STATUS); + } +} + static void i2c_readsl(struct tegra_i2c_dev *i2c_dev, void *data, unsigned int reg, unsigned int len) { @@ -811,7 +826,10 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD; - i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); + if (i2c_dev->is_vi) + i2c_writesl_vi(i2c_dev, (u32 *)buf, I2C_TX_FIFO, words_to_transfer); + else + i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); buf += words_to_transfer * BYTES_PER_FIFO_WORD; } -- 2.7.4