From patchwork Mon Nov 2 03:54:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 11872943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A7F9C00A89 for ; Mon, 2 Nov 2020 03:56:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C746A2145D for ; Mon, 2 Nov 2020 03:56:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="STSlE1xD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="C0OwBURN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C746A2145D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:MIME-Version: Cc:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F8aGCIUEx19LOqXM9E1CSM5FqG8iY/LD7udUVjlHf6w=; b=STSlE1xDr3Plgjn90L44RM3Lr FP7G5Ep/VnB3FoBp/T1dpV+hipbi9W84OedXd5NRZtkxv3POhaQ+xxilCYlnh6WP8W+nJQwcQQXZU xSpCN1dPpZBMSry+RMSQYY7+SERPEbJ3B3dzfIBeMlGoKNz1bPBld2LjDiQIwcs611yu6VbJjrlX1 TLCVDgaJSkG+QQSuRNjewYwtdAw/J6QF++iyZvqhV3FMDST37FW+UbJ50/86MXS/nU2SYXHXUCcGK zeQaTRAyxAR05p8EZTUIgZfDsdmB7AAUqwQaGJPeHbTcKkUCw1176NOmAUr7SHcL9MIpOiq8o7r7+ EX5QlN09Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQwR-0000sn-QP; Mon, 02 Nov 2020 03:55:36 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQwE-0000n9-BH for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 03:55:23 +0000 Received: by mail-pf1-x442.google.com with SMTP id 133so9910629pfx.11 for ; Sun, 01 Nov 2020 19:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wscl5T23Q5IKV3AI5Ht/eaVldSVlsEPR9sZTO/udtmk=; b=C0OwBURNZAimY+pLnu6wgL7vxeRrrrAIhp9IMjDfQQpB7GgeuaFDmaD+MjTpSPv9TE J7ViYzLJI4Uumz9rRpoxBsuQsS/XyTDG1zWs16BabrfjS0/Y9utznzJ9parXS+Og+7jU hOGhZ+PjfWCYFGpupySrNc19N3uD9CV0fg5SI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wscl5T23Q5IKV3AI5Ht/eaVldSVlsEPR9sZTO/udtmk=; b=UGSB4iLS+LNkVXCe+Yr7yJnKTjyiev+ZJKMaq/CnFAPqF2bgwyyMZ7mJ0rqbK31Uea 3TqYD14L5ZGwoM+bNLCBTyDRdwctGxTJUwzUIq4wqjPI/naWfjuovMWbwoi6ipbe5oHh EEVA1tOrMO1MUajLzbnw1kEFD3+Dmn+QG4XE5mX7rIBfulBhYtH37PPPlYaFbZ8Jj/I/ ik16bqVUgrvUJaPMBCdotQllFwcOWtCrams9zSi/+VrPilFS0AugCd5Keycy47Ty3Vfg 1QeP/aM1DTxOKypgmrPj5xXQyu2jgk7tBQq0bX1kpKnigj6dfqdWHiREnKLuDVREbq9Q L2Kg== X-Gm-Message-State: AOAM531Sj2oUonp3QS5aDIz8IwebUOAf0yGtoP2Kx8sNxYfYaDDrIQar UFUIrwIdxIcQKzz+DUuen0aLJQ== X-Google-Smtp-Source: ABdhPJyjhHDYm+I40geGi/eSntY8YCxTXWDj0z8+PdUxieeYJEIi6M04zchVLuzttnIUXwGqK7RZaQ== X-Received: by 2002:a62:e308:0:b029:152:8cc3:ebdc with SMTP id g8-20020a62e3080000b02901528cc3ebdcmr20143680pfh.42.1604289320107; Sun, 01 Nov 2020 19:55:20 -0800 (PST) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y5sm5655711pfc.165.2020.11.01.19.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 19:55:19 -0800 (PST) From: Rayagonda Kokatanur To: Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Wolfram Sang , Florian Fainelli , Brendan Higgins , Andy Shevchenko , Lori Hikichi , Dhananjay Phadke , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/6] i2c: iproc: handle rx fifo full interrupt Date: Mon, 2 Nov 2020 09:24:33 +0530 Message-Id: <20201102035433.6774-7-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102035433.6774-1-rayagonda.kokatanur@broadcom.com> References: <20201102035433.6774-1-rayagonda.kokatanur@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_225522_591298_761DB91D X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rayagonda Kokatanur MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add code to handle IS_S_RX_FIFO_FULL_SHIFT interrupt to support master write request with >= 64 bytes. Iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes full. This can happen if master issues write request of more than 64 bytes. Signed-off-by: Rayagonda Kokatanur --- drivers/i2c/busses/i2c-bcm-iproc.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 22e04055b447..cceaf69279a9 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -313,6 +313,8 @@ static void bcm_iproc_i2c_slave_init( /* Enable interrupt register to indicate a valid byte in receive fifo */ val = BIT(IE_S_RX_EVENT_SHIFT); + /* Enable interrupt register to indicate Slave Rx FIFO Full */ + val |= BIT(IE_S_RX_FIFO_FULL_SHIFT); /* Enable interrupt register to indicate a Master read transaction */ val |= BIT(IE_S_RD_EVENT_SHIFT); /* Enable interrupt register for the Slave BUSY command */ @@ -434,9 +436,15 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, * events * Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT * events or only IS_S_RD_EVENT_SHIFT + * + * iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt + * (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes + * full. This can happen if Master issues write requests of more than + * 64 bytes. */ if (status & BIT(IS_S_RX_EVENT_SHIFT) || - status & BIT(IS_S_RD_EVENT_SHIFT)) { + status & BIT(IS_S_RD_EVENT_SHIFT) || + status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) { /* disable slave interrupts */ val = iproc_i2c_rd_reg(iproc_i2c, IE_OFFSET); val &= ~iproc_i2c->slave_int_mask; @@ -452,9 +460,14 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, /* schedule tasklet to read data later */ tasklet_schedule(&iproc_i2c->slave_rx_tasklet); - /* clear only IS_S_RX_EVENT_SHIFT interrupt */ - iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, - BIT(IS_S_RX_EVENT_SHIFT)); + /* + * clear only IS_S_RX_EVENT_SHIFT and + * IS_S_RX_FIFO_FULL_SHIFT interrupt. + */ + val = BIT(IS_S_RX_EVENT_SHIFT); + if (status & BIT(IS_S_RX_FIFO_FULL_SHIFT)) + val |= BIT(IS_S_RX_FIFO_FULL_SHIFT); + iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, val); } if (status & BIT(IS_S_TX_UNDERRUN_SHIFT)) {