Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1259983lqz; Sun, 31 Mar 2024 23:33:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkbspVA/+btruv0C7jbNLvXwjkX7kypvGKu3aLtDmyKrVo+EY0PCbVT3eY5JvnOFz32t9vcvmzjYUrHblqd44uGY60BjhWx16r4KhkAQ== X-Google-Smtp-Source: AGHT+IGcTlzEe+tAr+lGaQ1S2BDbzUyDimeRTiv2zv/BuaMPpfPSxkxHyPHIyj7eheFOggSXODfs X-Received: by 2002:a05:6512:36d8:b0:515:d0e6:a141 with SMTP id e24-20020a05651236d800b00515d0e6a141mr4235508lfs.40.1711953210832; Sun, 31 Mar 2024 23:33:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711953210; cv=pass; d=google.com; s=arc-20160816; b=tPPycGCHukOaaNis5U3PZp/Y0IUKznxlWVaPhcbJZk+Eb5Q+GjgzQHJpTwOPUPRgQJ ndU+CxQ44Pe96zKjf44yAmqV3lbWOyMmT6Sv+wQzx+e1F87ByDLS6waZ8ACkkBtsjH35 GpwqMgoVVsaVHwiriSZolQ6sLII/3IQ3WrCdJ0vZUFXIugSBBrXM9HjkxUjhJ70sQP17 PV60H0Rpo/wKz4lzPJtvvYwAo72Ql2ZfuQCye0fELlzPM/LXfYRyNeRbXYps3DzrKhRN ZzGymnAYEuuxFOTkUn+yBGf/CUckovPi3LR+YkNiJmxV0R3hXxQxksK6+a5Aop0bjLOZ pwrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vz+6XzCOGzRq9l4PyntdCFIG9dw51GuUuqB3jIvIixU=; fh=Z9OgthGJeFmQ4kBJNFAFXVxfFUmiPwdI1l/d4NOJJEU=; b=FiU0KGu8Yvp0mcCVXFsu0OCtxmlRqt1JlPz6T6TlZmeJr5/Fm2KFIOszzG5I30T4yd Jstq9PAL1+/w9MzPsJo93agfG1HHV0SShCuOA9L8biD39w0dSx1ynVvfRNsJd8NpxfaW kJ3dUgBb68D3/7AqEvYl/W+RaWSbB6gEGlahlMpPJwx+27uQF86L/08PrxmtyDpu2qbH xiVySfsCu2QkjBRr5erEoJZXXhfpqtNckR8jojSnKV9e1pm9uHU1NiqsxBzsQ1xEG1qR MfJLed1kZfg1Oy7pepO1M8zd/cTe4tqMH+Cmd1I7IucKnUsxNIoGC8LasGfrJsFk2buu 1I1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UeLqLCOX; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-126470-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126470-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e20-20020a056402191400b0056c2e67f5b7si4412713edz.254.2024.03.31.23.33.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 23:33:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126470-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UeLqLCOX; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-126470-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126470-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8D5861F21346 for ; Mon, 1 Apr 2024 06:33:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71D869475; Mon, 1 Apr 2024 06:33:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="UeLqLCOX" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EC9F8F6E; Mon, 1 Apr 2024 06:33:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711953195; cv=none; b=KgvHFOlRJuOyVmcWuIcDiaZcaiQ4TTyC4eywu7IAzkd2vH9K8nAraWtqnRscbje8+bR06ZxeYf0snDRLCvr54QiprZBqPZRvKzQ121M85Cdx4MjEtg38e6pl+fP5d9Jt9iZAdB2aPTyQYd3krdk1srmaHbcVhjcX+62YVC97dIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711953195; c=relaxed/simple; bh=ws3vCzaAI4D/icQcMUS3KleFn//uZ3Xji7aA62VwFRQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eydrDk4huwJUzZ29rxkkClQrxUDJUCq1ItotdBH3hp9pTq1vhNvRdf55n4hewnxtoUuvMyKWhHbvu4oLiHC5oRkSP0T/85VCQ07eKAYtD2Xpxd6yUSWnLvChE6KKmtQ1oBm7tKwlQ3YSECIFv0x/bqf7rXs38E2FZn4jgVZJqZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=UeLqLCOX; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42VMlR5N010926; Sun, 31 Mar 2024 23:33:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=vz+6XzCOGzRq9l4PyntdCFIG9dw51GuUuqB3jIvIixU=; b=UeL qLCOXB1O4ulTuuMNymcfdQmN0ka/MgSPvUgCKa0nnXK98PHPHMqXUQPx2GgVzcQG 5lw7lei1EyvvyD2vy4BUZ3QR497NkBPuUCHRaphQ2JjhkxludWgQ+kiFwF/kH5gd zldd6IHN54VAFFbM7Fgag2jwdFPKXbsiSFfd2BRwwj5dRDXPyFuGC9NqZefl1KTu G/IiRGHbAA8z7Ric94FHGLFKQGEN/H0eOUSzBFGOFxSNqIc/qUcdjWEygKCPEP4P +mAVJNYpI2aw3fEgruexssCk2Zm5cRI7m6XlTKxm+EO4J/Kodge9PoH0w4JLDk3G sphSxUnLrLsXVhgURkw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3x7a7bsqxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 31 Mar 2024 23:33:10 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 31 Mar 2024 23:32:59 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sun, 31 Mar 2024 23:32:59 -0700 Received: from Dell2s-9.sclab.marvell.com (unknown [10.110.150.250]) by maili.marvell.com (Postfix) with ESMTP id 59CBF3F705D; Sun, 31 Mar 2024 23:32:59 -0700 (PDT) From: Piyush Malgujar To: , , CC: , , , Piyush Malgujar Subject: [PATCH v5 3/4] i2c: octeon: Handle watchdog timeout Date: Sun, 31 Mar 2024 23:32:17 -0700 Message-ID: <20240401063229.2112782-4-pmalgujar@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240401063229.2112782-1-pmalgujar@marvell.com> References: <20240401063229.2112782-1-pmalgujar@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: l3kJJf8TDqS5AhDXMSzNPRFXfjoBz4u3 X-Proofpoint-ORIG-GUID: l3kJJf8TDqS5AhDXMSzNPRFXfjoBz4u3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-01_03,2024-03-28_01,2023-05-22_02 From: Suneel Garapati Add watchdog timeout handling to cater to the unhandled warnings seen during validation on boards with different I2C slaves. This status code reflects the state that controller couldn't receive any response from slave while being in non-idle state and HW recommends to reset before any further bus access. Signed-off-by: Suneel Garapati Signed-off-by: Piyush Malgujar Acked-by: Andi Shyti --- drivers/i2c/busses/i2c-octeon-core.c | 8 ++++++++ drivers/i2c/busses/i2c-octeon-core.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c index 76a5ec100d3039b840ba28ae7a817da447923d4f..5b7b942141e725c7f9071c217c728efce067cee6 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c @@ -182,6 +182,7 @@ static int octeon_i2c_hlc_wait(struct octeon_i2c *i2c) static int octeon_i2c_check_status(struct octeon_i2c *i2c, int final_read) { u8 stat; + u64 mode; /* * This is ugly... in HLC mode the status is not in the status register @@ -244,6 +245,13 @@ static int octeon_i2c_check_status(struct octeon_i2c *i2c, int final_read) case STAT_RXADDR_NAK: case STAT_AD2W_NAK: return -ENXIO; + + case STAT_WDOG_TOUT: + mode = __raw_readq(i2c->twsi_base + OCTEON_REG_MODE(i2c)); + /* Set BUS_MON_RST to reset bus monitor */ + mode |= BUS_MON_RST_MASK; + octeon_i2c_writeq_flush(mode, i2c->twsi_base + OCTEON_REG_MODE(i2c)); + return -EIO; default: dev_err(i2c->dev, "unhandled state: %d\n", stat); return -EIO; diff --git a/drivers/i2c/busses/i2c-octeon-core.h b/drivers/i2c/busses/i2c-octeon-core.h index 883337d3ecb0d4a91117d2eb3fbe6e8edaf9e484..2cf490bd129735aa162372ec26aa0b80331c7639 100644 --- a/drivers/i2c/busses/i2c-octeon-core.h +++ b/drivers/i2c/busses/i2c-octeon-core.h @@ -72,6 +72,7 @@ #define STAT_SLAVE_ACK 0xC8 #define STAT_AD2W_ACK 0xD0 #define STAT_AD2W_NAK 0xD8 +#define STAT_WDOG_TOUT 0xF0 #define STAT_IDLE 0xF8 /* TWSI_INT values */ @@ -106,6 +107,9 @@ struct octeon_i2c_reg_offset { #define TWSX_MODE_HS_MODE BIT(0) #define TWSX_MODE_HS_MASK (TWSX_MODE_REFCLK_SRC | TWSX_MODE_HS_MODE) +/* Set BUS_MON_RST to reset bus monitor */ +#define BUS_MON_RST_MASK BIT(3) + struct octeon_i2c { wait_queue_head_t queue; struct i2c_adapter adap; -- 2.43.0