Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3027104ybt; Mon, 29 Jun 2020 13:16:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgZcmK8WN1qP6JRjr2oCmusnjxm3FF+XUjxbaqCuKT9iNVJCIt34T0VW7gVt9LHev6G3lj X-Received: by 2002:a05:6402:17ee:: with SMTP id t14mr16388667edy.359.1593461783793; Mon, 29 Jun 2020 13:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593461783; cv=none; d=google.com; s=arc-20160816; b=pGR9SBr73KkHb/eL2YVaPx75Av44RJ3mRSbHQmMUwFytUTZkE1Q8Pt9g+06tLW9tY0 bja6k7zHwDOyIaVag4Uc6Ogc/LD+UASNsSknjpI7V+weKsdjLyUa/XEF5QNhB3zVp94w Iwzoognnx+lgbkyKlHsCpEDYAzSZUU7R2mQCLEWWqr7IZw0eW3mQin/V6ZcJmzz8FjLQ JkKbvE43q6NREZqyH2CDbunSw4Dekdok8RpWMvtVwdiyQ6E47kJNYu5Edx4+sXB9clmf fNcCL4EqXmMCc2Jl0IVDSF0fBhsKYGeq09OpcPsGYkpYNIvjZAY6dqZ8qWQyMrT0AfZ4 Vu6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LbjkLfNAaIUmfOYm0h6L7B2KNHQ0Jg9yMgTRcWzmUOE=; b=dOBS/Y8rNYR57icFHd1y3h9RYW+CjkPgQAzpiHABqv+byaMG7+PkFqwZFP4YixlEWj 6D1sFBohRwCgOmwyjKE0VgzqnO5SVVFYI+eBGYb9zNMSxiPJIypaPMPFHzxVM6VH0GoM 2Na2ANnZwVysTVYoO3nAyBeagiL74K5NfoRY9gEWSx+UDrCDtQ8KMQQV0hiGpEvxHPd5 1E2ZwR986R2uF4R+xFpF7ApuwDzhvUFsrqVUUr6FmtSmO43To9mM4UQ7q6Yw3K187ytR Cq30H/w43jJWrqw4tQQxC7pfN/cnbIxXt5H9Var3fcNf7mN5Nrgk+nFX1ijXPUx1gYkU 1V9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=170KneM4; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj23si375361ejb.746.2020.06.29.13.16.00; Mon, 29 Jun 2020 13:16:23 -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=@kernel.org header.s=default header.b=170KneM4; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729867AbgF2UOf (ORCPT + 99 others); Mon, 29 Jun 2020 16:14:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:40580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732838AbgF2TaS (ORCPT ); Mon, 29 Jun 2020 15:30:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2B8A251F6; Mon, 29 Jun 2020 15:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593444914; bh=nDK7Vd65zXaNkIiAip2aUpYP8MkPkFhbPYTrKFizs54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=170KneM49If7uJJJowQ8Pnp/uBt6biS0b1DmEgL9peLY3TLibVK9IOrBy5x4SUwLT yN9L8frQ8qpmh2kIMZVjgx3xcrLAFAp7rzEg89lj5rczTpthd7sMbq9CQZvqaoOPDh V0A4MSZLq5bFCOKqqDCEa7rJxzD3jzBpcO0zvdUI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sowjanya Komatineni , Thierry Reding , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 010/131] i2c: tegra: Fix Maximum transfer size Date: Mon, 29 Jun 2020 11:33:01 -0400 Message-Id: <20200629153502.2494656-11-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629153502.2494656-1-sashal@kernel.org> References: <20200629153502.2494656-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.131-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.131-rc1 X-KernelTest-Deadline: 2020-07-01T15:34+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sowjanya Komatineni [ Upstream commit b67d4530cdade7ebfafa2c6b46f2a0dad3e41bcb ] Tegra194 supports maximum 64K Bytes transfer per packet. Tegra186 and prior supports maximum 4K Bytes transfer per packet. This patch fixes this payload difference between Tegra194 and prior Tegra chipsets using separate i2c_adapter_quirks. Signed-off-by: Sowjanya Komatineni Acked-by: Thierry Reding Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-tegra.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 917f416787b10..af06198851f1b 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -164,6 +164,8 @@ enum msg_end_type { * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that * provides additional features and allows for longer messages to * be transferred in one go. + * @quirks: i2c adapter quirks for limiting write/read transfer size and not + * allowing 0 length transfers. */ struct tegra_i2c_hw_feature { bool has_continue_xfer_support; @@ -176,6 +178,7 @@ struct tegra_i2c_hw_feature { bool has_multi_master_mode; bool has_slcg_override_reg; bool has_mst_fifo; + const struct i2c_adapter_quirks *quirks; }; /** @@ -847,6 +850,10 @@ static const struct i2c_adapter_quirks tegra_i2c_quirks = { .max_write_len = 4096 - 12, }; +static const struct i2c_adapter_quirks tegra194_i2c_quirks = { + .flags = I2C_AQ_NO_ZERO_LEN, +}; + static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { .has_continue_xfer_support = false, .has_per_pkt_xfer_complete_irq = false, @@ -858,6 +865,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { .has_multi_master_mode = false, .has_slcg_override_reg = false, .has_mst_fifo = false, + .quirks = &tegra_i2c_quirks, }; static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { @@ -871,6 +879,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { .has_multi_master_mode = false, .has_slcg_override_reg = false, .has_mst_fifo = false, + .quirks = &tegra_i2c_quirks, }; static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { @@ -884,6 +893,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = { .has_multi_master_mode = false, .has_slcg_override_reg = false, .has_mst_fifo = false, + .quirks = &tegra_i2c_quirks, }; static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { @@ -897,6 +907,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = { .has_multi_master_mode = false, .has_slcg_override_reg = true, .has_mst_fifo = false, + .quirks = &tegra_i2c_quirks, }; static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { @@ -910,6 +921,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { .has_multi_master_mode = true, .has_slcg_override_reg = true, .has_mst_fifo = false, + .quirks = &tegra_i2c_quirks, }; static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { @@ -923,6 +935,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { .has_multi_master_mode = true, .has_slcg_override_reg = true, .has_mst_fifo = true, + .quirks = &tegra194_i2c_quirks, }; /* Match table for of_platform binding */ @@ -974,7 +987,6 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_dev->base = base; i2c_dev->div_clk = div_clk; i2c_dev->adapter.algo = &tegra_i2c_algo; - i2c_dev->adapter.quirks = &tegra_i2c_quirks; i2c_dev->irq = irq; i2c_dev->cont_id = pdev->id; i2c_dev->dev = &pdev->dev; @@ -990,6 +1002,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_dev->hw = of_device_get_match_data(&pdev->dev); i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, "nvidia,tegra20-i2c-dvc"); + i2c_dev->adapter.quirks = i2c_dev->hw->quirks; init_completion(&i2c_dev->msg_complete); spin_lock_init(&i2c_dev->xfer_lock); -- 2.25.1