From patchwork Sat May 6 21:19:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 90805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1264447vqo; Sat, 6 May 2023 14:56:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MBki5cZFye8r0ERViNxC4mh41ab982DhkQFa2gkgCNoabMpcLape1iMyMfr9YY5sa064w X-Received: by 2002:a17:90a:ac0f:b0:246:75c8:f071 with SMTP id o15-20020a17090aac0f00b0024675c8f071mr5929548pjq.3.1683410185637; Sat, 06 May 2023 14:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683410185; cv=none; d=google.com; s=arc-20160816; b=0ZYZzIWdfIaU3Nbtpa4ctF9OmE4nSNpsYHPs+XI5vUz5nKI3Pl7edXX+JtqpGVyYZY OiiMj5HUQ04aCBWT1rH+wDd/CYo6IBE/cbSzcH61C7zrCVfRif18snL9xD3f7o/6Buui hhzE1T4vp3zt4++XpTFtM7f22To6gJetw1qOlAGkWWyIpc8nPs6TKwpsP18/YCzZzwdV kz6siC330LwnAzckhc9ux+mhrfcRXvr6IyKCYhNunZjdpWumnTNkE8bUIj5EmLrho0wq LXjMqppUph0sk3RbeG1FwpsuJWdX8fHWglFoTUvZcQ8k7Hxu4eHDjP/hisNtYiiOtf/3 MpYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :subject:from:references:in-reply-to:message-id:date:dkim-signature; bh=q7YMahovG8I9PzVEgZoPBBlx37+qNWRoZK9y6RXPobU=; b=Q8zjsyhbiKPrLXuvUulRyB2Z2XzwUCrutQUs6rQDXZP1tMw9IKLYY3F9z1Vfwey6Cg mXBhF220m0A4W7mRiiI/lH5m7weUChbb9NUNqPtldkhbOK9bAIXwp6O4zGddMrlr3GAD RxglGqOnKXI0epNksaxXvogH6BQisopi/jgQrhHJqZbW10g0wVLzNi0qQzgkZPoj8/uW Du5SZD88M45Yb9OmLymxTIGbbJFVWbe+KKAxTumLv4EI6GJ8LPlXoOePjegydrs+70HH CmjqCttdkLSxujy8BbW3KajsatexF+2m1Mw8MDkSPfmV1RLWUc4bFVIV98mkBuu3ESwP ZM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=FIAAptJI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a63330f000000b005030eb175d1si4738925pgz.107.2023.05.06.14.56.13; Sat, 06 May 2023 14:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=FIAAptJI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbjEFVTJ (ORCPT + 99 others); Sat, 6 May 2023 17:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjEFVTH (ORCPT ); Sat, 6 May 2023 17:19:07 -0400 Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2489E83C2; Sat, 6 May 2023 14:19:05 -0700 (PDT) Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4QDL5f0pJvzBf; Sat, 6 May 2023 23:19:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1683407942; bh=VHLUk5TRxUrV9tpNVEXH1omBZ4+ZuQYZ46H+ns5d9jM=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=FIAAptJIJJTcG94JlQS89qaAADnJoy77xnDlV/8AmLz7ZNoK4Pm1RC9IoRXX/VbJe f02Z8Cpb+GvGbfDgnjh9B9qOuKAg6lX8tdbmn2sP1d34s1AEG2kIEHBpmjtkh0AsCe YOPbKjcgPkiskDrRng9iOrCqx+2/yhjhsX9Ww4/sZ/gLr8PbUlordcUo4ury0W5S9z 4vaXsaXfXSP4NeUo6ahFSqWJN8HETpyd5xSyrtpYNklUdO8wcA6scRQs+XxOsZJEtY WddlEpG9Y3jipMcwEXh/U8U5WW1uFB0p3Gh27GletC30eVK6djIXoeuJYaWzY55R1u T/a2d2szF3E0w== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at mail Date: Sat, 06 May 2023 23:19:01 +0200 Message-Id: <857cca81cdda30c1a2b5fb87e81cc50ec6c51e63.1683407699.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v4 1/2] i2c: tegra: allow DVC support to be compiled out MIME-Version: 1.0 To: Dmitry Osipenko , Jonathan Hunter , Laxman Dewangan , Thierry Reding Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765183518557683428?= X-GMAIL-MSGID: =?utf-8?q?1765183518557683428?= Save a bit of code for newer Tegra platforms by compiling out DVC's I2C mode support that's used only for Tegra2. $ size i2c-tegra.o text data bss dec hex filename - 11381 292 8 11681 2da1 i2c-tegra.o + 10193 292 8 10493 28fd i2c-tegra.o Signed-off-by: Michał Mirosław Reviewed-by: Dmitry Osipenko Reviewed-by: Wolfram Sang --- v4: no changes v3: add parentheses for IS_DVC() macro value v2: remove KConfig symbol as per Dmitry Osipenko's suggestion. (Assuming that for Tegra20 the DVC part will be used anyway.) --- drivers/i2c/busses/i2c-tegra.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 157066f06a32..51ef2e80e8ce 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -298,6 +298,8 @@ struct tegra_i2c_dev { bool is_vi; }; +#define IS_DVC(dev) (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && (dev)->is_dvc) + static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned int reg) { @@ -315,7 +317,7 @@ static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg) */ static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, unsigned int reg) { - if (i2c_dev->is_dvc) + if (IS_DVC(i2c_dev)) reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40; else if (i2c_dev->is_vi) reg = 0xc00 + (reg << 2); @@ -639,7 +641,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) WARN_ON_ONCE(err); - if (i2c_dev->is_dvc) + if (IS_DVC(i2c_dev)) tegra_dvc_init(i2c_dev); val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN | @@ -703,7 +705,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) return err; } - if (!i2c_dev->is_dvc && !i2c_dev->is_vi) { + if (!IS_DVC(i2c_dev) && !i2c_dev->is_vi) { u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL; @@ -933,7 +935,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) } i2c_writel(i2c_dev, status, I2C_INT_STATUS); - if (i2c_dev->is_dvc) + if (IS_DVC(i2c_dev)) dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS); /* @@ -972,7 +974,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id) i2c_writel(i2c_dev, status, I2C_INT_STATUS); - if (i2c_dev->is_dvc) + if (IS_DVC(i2c_dev)) dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS); if (i2c_dev->dma_mode) { @@ -1660,7 +1662,9 @@ static const struct of_device_id tegra_i2c_of_match[] = { { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, }, { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, +#if IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, +#endif {}, }; MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); @@ -1675,7 +1679,8 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev) multi_mode = device_property_read_bool(i2c_dev->dev, "multi-master"); i2c_dev->multimaster_mode = multi_mode; - if (of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc")) + if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && + of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc")) i2c_dev->is_dvc = true; if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi")) From patchwork Sat May 6 21:19:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 90803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1264076vqo; Sat, 6 May 2023 14:55:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MPxmmTikzqpRui4jKrttVoVlFA43+mrGBt2la37Ottps6B6OO2j7DvdQK3S653+DUbNd2 X-Received: by 2002:a05:6a20:4412:b0:f3:2d33:de79 with SMTP id ce18-20020a056a20441200b000f32d33de79mr7290798pzb.43.1683410116571; Sat, 06 May 2023 14:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683410116; cv=none; d=google.com; s=arc-20160816; b=Nir+/YQ17GT9fyI5hfA5j17HVQhhhNw0f6S91x9VpNw5JFWufcUwbz3b+qXzkFFOhw +h8ycTgp3Fv53fIK4edpj7XF812FL0LN7XBDizuDJ+NKzLDyjIpi6BypUCSCDvlcSsTl 9eJxtEGu+yQqC04TG6oM97kxxocs7RZbrv0Gh1xKhG8RJBJAhP6AK6nsaDaN2MiEtufq 7w5MNCgVhQG1Q3XH87x9nd0LHlABzwJMFgZ33UAkvIy3R9VeneOTI65N4tDZUTzRXsaI YWKsOVc7sbxrDhhVnNIk3I83BgEsHScVA7UFnIMMHGPVUQl0biUn8BIcN0WfvTc0/FM8 olew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :subject:from:references:in-reply-to:message-id:date:dkim-signature; bh=St0zbOsbXoknZex46yxArzzORxC54odJMZ/umRJwbzg=; b=n0frhCmHZFQ42CgstqsNAHwMVun5jqpKOyRrjqPBhXCXFVA1+yi+RAEsfQGvAHL7dP oRKMLahMNw9mQNhl1AeYFIpmRCW2DWkF89+pCpyHWEw23LxFELvxKCxxUgg2VtsoejRl ZhJrp22jJgSFHAEVMK818xwa+dXQ6bS/Zyq6iR+DwAWbbSXgQyu6CMFrrjwVxMVoAbwm 5bpPuWq7B4srlwih1uHd8KmQh/OlRBNsZrXCNsBdCpszI4dpKtxYpyniwbo3oG7vw7EW 8yKmhs4NTytQHQhNLxRZkQm0KSW0cJAsd7LvOrAxWZ86cVD/q0OHDq+uDE5rGrCBpWk5 E24g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=cvxrKEui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b26-20020a63931a000000b0052d7238ad58si1429061pge.388.2023.05.06.14.55.01; Sat, 06 May 2023 14:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=cvxrKEui; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbjEFVTK (ORCPT + 99 others); Sat, 6 May 2023 17:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjEFVTI (ORCPT ); Sat, 6 May 2023 17:19:08 -0400 Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963E28A60; Sat, 6 May 2023 14:19:05 -0700 (PDT) Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4QDL5f3CkYzBr; Sat, 6 May 2023 23:19:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1683407942; bh=awLAvYVYY1Hw6JPyY91yctNAjsWIDgy3YBAXa3CweBw=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=cvxrKEuiyxlHVNIwzgoglYAaCUnnYNJGRj9pddIT2xa9qsXzQS8WVnHMpoA71dC+K ARZ/r7nLjfg/GM6dATnKFV4gLrascLu9LMa9350p9sMEJU434j41mmaOOi5OI0w64S oNZxjTT00OoaGUqEmaBe0qgiYoEB68AD8POqaS3FDCJFWgtHDGCv2OSuvKmyeyTb7X /zlPmiWuY/4o+IzZ8XVIkxhs5D1vfrWPlrTkc6/hnwpVMPUvjh0cj6BCrHlpi2xBlm 8Q0USUxAWdQ0+9k/ezgslIAy3TY6Ps+HAk3zKBJoN4/v3fezuHZFg+CFHh3U0mTwrP TG3nZvtIlHFNQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at mail Date: Sat, 06 May 2023 23:19:02 +0200 Message-Id: <0248c0737ace5db7be4e04f97985f3e7874ff1ab.1683407699.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v4 2/2] i2c: tegra: allow VI support to be compiled out MIME-Version: 1.0 To: Dmitry Osipenko , Jonathan Hunter , Laxman Dewangan , Thierry Reding Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765183446040070131?= X-GMAIL-MSGID: =?utf-8?q?1765183446040070131?= Save a bit of code for older Tegra platforms by compiling out VI's I2C mode support that's used only for Tegra210. $ size i2c-tegra.o text data bss dec hex filename 11381 292 8 11681 2da1 i2c-tegra.o (full) 10193 292 8 10493 28fd i2c-tegra.o (no-dvc) 9145 292 8 9445 24e5 i2c-tegra.o (no-vi,no-dvc) Signed-off-by: Michał Mirosław Reviewed-by: Dmitry Osipenko Reviewed-by: Wolfram Sang --- v4: include a missed is_vi check in i2c_writel() readback v3: add parentheses for IS_VI() macro value v2: remove KConfig symbol as per Dmitry Osipenko's suggestion. (Assuming that for Tegra210 the VI part will be used anyway.) --- drivers/i2c/busses/i2c-tegra.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 51ef2e80e8ce..d26f94364fbc 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -299,6 +299,7 @@ struct tegra_i2c_dev { }; #define IS_DVC(dev) (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && (dev)->is_dvc) +#define IS_VI(dev) (IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) && (dev)->is_vi) static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned int reg) @@ -319,7 +320,7 @@ static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, unsigned int reg) { if (IS_DVC(i2c_dev)) reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40; - else if (i2c_dev->is_vi) + else if (IS_VI(i2c_dev)) reg = 0xc00 + (reg << 2); return reg; @@ -332,7 +333,7 @@ static void i2c_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned int reg) /* read back register to make sure that register writes completed */ if (reg != I2C_TX_FIFO) readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); - else if (i2c_dev->is_vi) + else if (IS_VI(i2c_dev)) readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, I2C_INT_STATUS)); } @@ -448,7 +449,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) u32 *dma_buf; int err; - if (i2c_dev->is_vi) + if (IS_VI(i2c_dev)) return 0; if (!i2c_dev->hw->has_apb_dma) { @@ -653,7 +654,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) i2c_writel(i2c_dev, val, I2C_CNFG); i2c_writel(i2c_dev, 0, I2C_INT_MASK); - if (i2c_dev->is_vi) + if (IS_VI(i2c_dev)) tegra_i2c_vi_init(i2c_dev); switch (t->bus_freq_hz) { @@ -705,7 +706,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) return err; } - if (!IS_DVC(i2c_dev) && !i2c_dev->is_vi) { + if (!IS_DVC(i2c_dev) && !IS_VI(i2c_dev)) { u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL; @@ -848,7 +849,7 @@ 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; - if (i2c_dev->is_vi) + if (IS_VI(i2c_dev)) i2c_writesl_vi(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); else i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); @@ -1656,7 +1657,9 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = { static const struct of_device_id tegra_i2c_of_match[] = { { .compatible = "nvidia,tegra194-i2c", .data = &tegra194_i2c_hw, }, { .compatible = "nvidia,tegra186-i2c", .data = &tegra186_i2c_hw, }, +#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) { .compatible = "nvidia,tegra210-i2c-vi", .data = &tegra210_i2c_hw, }, +#endif { .compatible = "nvidia,tegra210-i2c", .data = &tegra210_i2c_hw, }, { .compatible = "nvidia,tegra124-i2c", .data = &tegra124_i2c_hw, }, { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, }, @@ -1683,7 +1686,8 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev) of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc")) i2c_dev->is_dvc = true; - if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi")) + if (IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC) && + of_device_is_compatible(np, "nvidia,tegra210-i2c-vi")) i2c_dev->is_vi = true; } @@ -1712,7 +1716,7 @@ static int tegra_i2c_init_clocks(struct tegra_i2c_dev *i2c_dev) if (i2c_dev->hw == &tegra20_i2c_hw || i2c_dev->hw == &tegra30_i2c_hw) i2c_dev->clocks[i2c_dev->nclocks++].id = "fast-clk"; - if (i2c_dev->is_vi) + if (IS_VI(i2c_dev)) i2c_dev->clocks[i2c_dev->nclocks++].id = "slow"; err = devm_clk_bulk_get(i2c_dev->dev, i2c_dev->nclocks, @@ -1830,7 +1834,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) * VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't * be used for atomic transfers. */ - if (!i2c_dev->is_vi) + if (!IS_VI(i2c_dev)) pm_runtime_irq_safe(i2c_dev->dev); pm_runtime_enable(i2c_dev->dev); @@ -1904,7 +1908,7 @@ static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev) * power ON/OFF during runtime PM resume/suspend, meaning that * controller needs to be re-initialized after power ON. */ - if (i2c_dev->is_vi) { + if (IS_VI(i2c_dev)) { err = tegra_i2c_init(i2c_dev); if (err) goto disable_clocks;