From patchwork Mon Nov 2 03:54:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 11872933 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 4FCA4C00A89 for ; Mon, 2 Nov 2020 03:55:42 +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 D5D0221556 for ; Mon, 2 Nov 2020 03:55:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iqM8NX5P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="FvUaiHjD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5D0221556 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=RcGyZnL0ogmSzO+8OT3hsEkYaedQiCEgDtGNJY+3isA=; b=iqM8NX5PpQmh8yERACthE+2qS u9Iz+MdEh3RuM/yYkO9KTReXqzQSb9eV152YZ6Y3rZtTdnVKd6SMxWbpwSB2vt/OT068NOdlgNGRC H+AQ1y12m8eLXx6IELBpkKdWiPT0yByVAsRGtqMU2BwQeBPATrZ8peHbPQ1SdD7DEIDLOOnZkrZsQ uJA3EVsjIFfCZk+NQDnDx2OhgJi3V3OGrQ2NxX0Y0ePYXTWQ2vIJU45lQng7cm9MtmWqezb5t9QNT yHf7O5uAruKteecfdx0A5XPikoyOwASStqfJn+K+5cpiWvbCxFiuz+rtKekWcPx9LKq7p3/tx0jXp EyEF3tUvA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQvw-0000ha-B8; Mon, 02 Nov 2020 03:55:04 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZQvo-0000fh-LG for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2020 03:54:58 +0000 Received: by mail-pg1-x542.google.com with SMTP id o3so9617843pgr.11 for ; Sun, 01 Nov 2020 19:54:56 -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=Sg8bv4vpW2ixnVnViLDk8exfH6g0ylfal6p5QmUyTig=; b=FvUaiHjD9GrFgHXSyDr17hbsgmyUhQXeWtLqhcapwLgA6fp65IE5gPonX+Il48e7Pv 8fzC+ZRzq2cjetu27gU/d5Qa/471m4U41hQ14qig1xajtgKRkbxPCt8pUX5uWkYP350P xZDxZZLhUvq0UGuyO4UAA3fXuCq7yySRlPIjE= 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=Sg8bv4vpW2ixnVnViLDk8exfH6g0ylfal6p5QmUyTig=; b=UZfEIrhVTM5xZ5OXkfDME/rU8GUkGLWdo+2RRVMePQ19CJVJsY0449YENfExH16/95 CMz13UBEAqGp3lPjK30vmTg4ac2QpnIcdhr54rUDnd9i0wD2bkdXEJ6Ll0/naYOpEZie 67g3JQecsGZpvoGiA4odHtehCSOH4IEK/TnXHEeAMmzjiYfBMvd2BLWDPR7T4nbWU9hm oNBYIjIcNUqsVElYD5+dyrVdt7iGcda1H/hcKOud5kr505BbsD1VzE9kN2U1GuUhI2S4 nQqLliBpdoMI+BtVb4xORWHhcjMqACZvWZevszX9eZVhfA1Mf6aj4S1zIBchBJ8g6taS iQXg== X-Gm-Message-State: AOAM532W569oIahmYaaGRX4sBEv1AaLZrr4e/pXPGgdaYbJW+N1zWESf C6BOZbkNidm6OvOI7V59CPh0/w== X-Google-Smtp-Source: ABdhPJwYB7XMYT2ERy6b1KACo/JPeZdWqgosJ2FZaeQF6Typ3caft/wf6DmPo2Vxrsb250lnvdR0nA== X-Received: by 2002:aa7:91cf:0:b029:18a:9972:1aa9 with SMTP id z15-20020aa791cf0000b029018a99721aa9mr10873546pfa.46.1604289294415; Sun, 01 Nov 2020 19:54:54 -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.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 19:54:53 -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 1/6] i2c: iproc: handle Master aborted error Date: Mon, 2 Nov 2020 09:24:28 +0530 Message-Id: <20201102035433.6774-2-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_225456_878027_E6354CAF X-CRM114-Status: GOOD ( 12.15 ) 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 Handle Master aborted error by flushing tx and rx fifo and reinitializing the hw. Signed-off-by: Rayagonda Kokatanur Acked-by: Ray Jui --- drivers/i2c/busses/i2c-bcm-iproc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index d8295b1c379d..834a98caeada 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -93,6 +93,7 @@ #define S_CMD_STATUS_MASK 0x07 #define S_CMD_STATUS_SUCCESS 0x0 #define S_CMD_STATUS_TIMEOUT 0x5 +#define S_CMD_STATUS_MASTER_ABORT 0x7 #define IE_OFFSET 0x38 #define IE_M_RX_FIFO_FULL_SHIFT 31 @@ -311,9 +312,10 @@ static void bcm_iproc_i2c_check_slave_status( return; val = (val >> S_CMD_STATUS_SHIFT) & S_CMD_STATUS_MASK; - if (val == S_CMD_STATUS_TIMEOUT) { - dev_err(iproc_i2c->device, "slave random stretch time timeout\n"); - + if (val == S_CMD_STATUS_TIMEOUT || val == S_CMD_STATUS_MASTER_ABORT) { + dev_err(iproc_i2c->device, (val == S_CMD_STATUS_TIMEOUT) ? + "slave random stretch time timeout\n" : + "Master aborted read transaction\n"); /* re-initialize i2c for recovery */ bcm_iproc_i2c_enable_disable(iproc_i2c, false); bcm_iproc_i2c_slave_init(iproc_i2c, true);