Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp573035pxu; Wed, 7 Oct 2020 10:08:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9f86WRD6iIRL/8bL1h1A6w/Ob98RaUA2P9jOpKZVHh1p2YXfsrQMqOfOXVJC8hMNEGBuf X-Received: by 2002:a17:906:f92:: with SMTP id q18mr4163239ejj.237.1602090502317; Wed, 07 Oct 2020 10:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602090502; cv=none; d=google.com; s=arc-20160816; b=yEK31Fk3MfUGHJUnSWNzpOOwpNPu7DzCvr0bD9vkm6665Nisx6g3HH/nbiV+8ljix0 zdaVuq0TZJaUmHyUuKXd2a4CRLfJmYVwil5K6+C4cGx71CkXGRR8jPD6ZiTGccLDrsaj mLpapQ2GvZF2kIic4qO34WqY7a4RypK0dOAl668om6pi4OZJ3k4FWDfo6x8JL/Hxfm58 tjzH+Zv/Gi9aykOX5OedYKYdFaRKR5vCRRnF+EWx1eojNea/iINpP7MfCScHuMbUxRbC soDxvks/0JOqeZq10W0QFvz89yWovLOs8EsGklvgT/ws7HlPjqSXU2zfU0KbpSxYheNt ahxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:sender:dkim-signature; bh=k0aeJ1aYDeTbfQgHa1bFP6cUwbAIO3u/WkE2x9DvX8Y=; b=K5TWF6c6msmEJ7bBU6DzJQuMDcp2Om38DoycN3z/UWNm3+Vi79G7YSSUC0altkALNh feB5rOLkACwdCrxM+tzqQVrx3X3wEDmwYg4cNIysmoFXlvQzjysGIB9Tyy45+9c0D+Xs sg8fNqZlFAFG00WiH2nFT6ZCbC9QF+BfzBfe/63Z6gA+w8ua9zgPmdANCwLxOlMVOjvy pbvicGTvG5ixrT2vZcpYNMg6nQ8lqv07lcm7FSxBGculiuz7h84Dx0eOutkqSOpI1KTk KQmQC2NKAwPiK6kcX1a3wbCXvp5tHXJPYmImKlCcRpr6HGtOvoGrnZpe5PahjUoHrLY2 oR8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lL6tR969; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si1843833ejr.152.2020.10.07.10.07.58; Wed, 07 Oct 2020 10:08:22 -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=@gmail.com header.s=20161025 header.b=lL6tR969; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbgJGLkc (ORCPT + 99 others); Wed, 7 Oct 2020 07:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726096AbgJGLkb (ORCPT ); Wed, 7 Oct 2020 07:40:31 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5B9FC061755; Wed, 7 Oct 2020 04:40:29 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id t21so1799365eds.6; Wed, 07 Oct 2020 04:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=k0aeJ1aYDeTbfQgHa1bFP6cUwbAIO3u/WkE2x9DvX8Y=; b=lL6tR969hOKqmM8s5zNN//ayAtdv7Ochna4uq6PZS54QF5l4MU+t4smAXv2EhtFOqi 0nBsyOoRstNSS4yzZ0OpGMCmjhoDIJprstf5+YlImipSM6XjE3oqFGtuX/iLdMrQ/heO zAm7Vec+A9T6Dl9ep+/AgFwyns8sTn5gRSSp62jRC/It1TbFyx+Mm+gkpEK0kMY3k1hX acrMmRVLwp7XiIzJ8ADtFKlnpsGI1Lkqv8/5bm5xPO6d5h7uosjpQcP/5RLaC7pMcQMC uzBZofb6QC1JUw3n/1DJJ90EGnn2ZXzGMfR6Yxzk9H9S0EPphVCovR8pf9hEisWrqtIV PxbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=k0aeJ1aYDeTbfQgHa1bFP6cUwbAIO3u/WkE2x9DvX8Y=; b=fjB8B/clBY5Qt7Fw6Rd9AGKdSP/tpIgDMX6HUYD6ClIEifjeiuqwhDL8ybgiGBVQgO PspXnkjVaxUXJZScNfRd6O2eVBEEonPrWKj/TXQ8GSjqnr780ILpcTm4u695z3ZElO8I dQDX8cO9jya/GMxLLc0VY4khyUCd76ivBSJDjP5OTVhEvCK/EHd+d/61yS4csbZ0WKXf TDMCo3i4JL5US+WBI98EnIY1dLzGI7PTeuKu46fni+u6V4BPYMganje8Bt6YZw5NHl+s ZwFuMA70VXCLomFSgcv+xy7TtgeqSKM9cdjcgKkN+2c93fHuLi7Cw39ZV/BDQP54vzhw Cigg== X-Gm-Message-State: AOAM530vV8jOvREi+vo9nXLvg9/DMH767RnOlXRGnyhYDTjf6v3P9wLZ 4KATQVsDO/EM172BcqBvzzA= X-Received: by 2002:aa7:dbc5:: with SMTP id v5mr3195373edt.54.1602070828096; Wed, 07 Oct 2020 04:40:28 -0700 (PDT) Received: from dell.be.48ers.dk (d51A5BC31.access.telenet.be. [81.165.188.49]) by smtp.gmail.com with ESMTPSA id r21sm1319295eda.3.2020.10.07.04.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 04:40:26 -0700 (PDT) Sender: Peter Korsgaard Received: from peko by dell.be.48ers.dk with local (Exim 4.92) (envelope-from ) id 1kQ7o2-0002tm-0t; Wed, 07 Oct 2020 13:40:26 +0200 From: Peter Korsgaard To: Sagar Shrikant Kadam Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-i2c@vger.kernel.org, andrew@lunn.ch, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Subject: Re: [PATCH 1/1] i2c: ocores: fix polling mode workaround on FU540-C000 SoC References: <1602006796-273724-1-git-send-email-sagar.kadam@sifive.com> <1602006796-273724-2-git-send-email-sagar.kadam@sifive.com> Date: Wed, 07 Oct 2020 13:40:26 +0200 In-Reply-To: <1602006796-273724-2-git-send-email-sagar.kadam@sifive.com> (Sagar Shrikant Kadam's message of "Tue, 6 Oct 2020 10:53:16 -0700") Message-ID: <87imbm4639.fsf@dell.be.48ers.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>>>> "Sagar" == Sagar Shrikant Kadam writes: > The FU540-C000 has a broken IRQ and support was added earlier > so that it will operate in polling mode, but seems to work only > in case interrupts property is missing from the i2c0 dt-node. > This should not be the case and the driver should handle polling > mode with the interrupt property present in i2c0 node of the > device tree. > So check if it's the FU540-C000 soc and enable polling mode master > xfers, as the IRQ for this chip is broken. > Fixes commit c45d4ba86731 ("i2c: ocores: add polling mode workaround > for Sifive FU540-C000 SoC") > Signed-off-by: Sagar Shrikant Kadam > --- > drivers/i2c/busses/i2c-ocores.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c > index f5fc75b..4405244 100644 > --- a/drivers/i2c/busses/i2c-ocores.c > +++ b/drivers/i2c/busses/i2c-ocores.c > @@ -686,17 +686,21 @@ static int ocores_i2c_probe(struct platform_device *pdev) > init_waitqueue_head(&i2c->wait); > + /* > + * Set OCORES_FLAG_BROKEN_IRQ to enable workaround for > + * FU540-C000 SoC in polling mode. > + * Since the SoC does have interrupt it's dt has the interrupt > + * defined but it should be bypassed in driver as this SoC has > + * a broken IRQ, hence update the master_xfer to use polling > + * transfers. > + */ > + match = of_match_node(ocores_i2c_match, pdev->dev.of_node); > + if (match && (long)match->data == TYPE_SIFIVE_REV0) > + i2c->flags |= OCORES_FLAG_BROKEN_IRQ; > + > irq = platform_get_irq(pdev, 0); > - if (irq == -ENXIO) { > + if (i2c->flags == OCORES_FLAG_BROKEN_IRQ || irq == -ENXIO) { NIT: flags is a bitmask, so i2c->flags & OCORES_FLAG_BROKEN_IRQ would be better, even if there currently doesn't exist any other flags. TYPE_SIFIVE_REV0 is also set for two compatibles: { .compatible = "sifive,fu540-c000-i2c", .data = (void *)TYPE_SIFIVE_REV0, }, { .compatible = "sifive,i2c0", .data = (void *)TYPE_SIFIVE_REV0, }, Are both affected by this issue? if not, we will need to extend the code to handle them differently. Other than that, it looks OK to me. -- Bye, Peter Korsgaard