Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2984415rdb; Tue, 6 Feb 2024 04:00:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHz0uAuhOMsCW682om1KqAMhfO446lQpDGxlOZ04dM9BUj7QPt1bfy2SH9DMaOLolK8y57Z X-Received: by 2002:a17:906:3bca:b0:a35:e9f1:9690 with SMTP id v10-20020a1709063bca00b00a35e9f19690mr1555063ejf.22.1707220831408; Tue, 06 Feb 2024 04:00:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707220831; cv=pass; d=google.com; s=arc-20160816; b=TXNW7xqlR2T03H4RZYPZ4PTBKd4mybDJpU1p/5ls3KV3aU4bCm/LQDSCr+UdQ/A6DN lFkMTzy5ciy6UXh3bg9GU5li50aLrsHEMRJADNj3lZiA52hyUeVOiKGysOBQMqrYrapN BtERq7RZQDKQBvtTgLaZGzHx/SOIlc8OTrrD9/GFqdVSKZ8PvZH7nr7m7YiVpO83dTJE YJgJmIMX6LeRbsU5uX+HbxRkkaF2pqEx5pxKEtWLmhtaCY5dhka50/R3+3WnzO5llirL RatOZcNbk0KR2xSXQNXUY6rywfJ63gjohuo+awfhs5yEmeY+lpaBBo9xknyddvDZK7C7 Zr1g== 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=ej+YcMoyPkSvf5dqTkEkDG2azTmL1gzXIrSHqaw8k2s=; fh=x30GYCj0Y2Dy4cX/lt2X8K5XMkkvJxluUPhiQRoER+Q=; b=Dc3KN4/SsLvkPEErYmmUFB//YGFVR6Dg/RAH/ayw3pRbsOvKiyV/pyaMGSjzF31Rqg MKwutfTzX53RVwwwqY2HQ1N7fyRXf1WNT1+JoaqrC8OLapkOxWFXrkVuRovz+zOLkVIP xZGHxetv43x8nUjlXLMjaWnMVnb0nKzEwKQuDKd3rcpWpi64e+CbzhTaQwB4fwGUDq0P IYhggn1rUo1YwAUj0SSYJJ44CEiHZ8ffR6scZ89xq/CTaCShmviv3YEYvdZsQH7NPRuz P66J3vK7PXciKhnwO91yUoA+4eCXObc0cJm5MdcorCTbFKvL891yYl4IqwabIw6P7NuQ yarA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=PwY89Ou4; 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-54823-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54823-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com X-Forwarded-Encrypted: i=1; AJvYcCU8kJSBf6WYuQOn2PFIPqkRPOSKcLr1uAnnnE1TVttRGQpmJ9+HbQIcMOBq1psPta4jb+hrgUPtBD0YeLYCGjY2uMIyrwFAnJqdvgrOCg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v10-20020a170906564a00b00a35361024c1si963695ejr.506.2024.02.06.04.00.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54823-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=PwY89Ou4; 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-54823-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54823-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 2B73E1F25461 for ; Tue, 6 Feb 2024 12:00:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4236E131E5F; Tue, 6 Feb 2024 11:45:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="PwY89Ou4" 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 E5276131E33; Tue, 6 Feb 2024 11:45:08 +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=1707219911; cv=none; b=QvlrRl1f7rhvz5aeWmNvJimgvxadTdvNNU6d+EImBi34nXVEw+kbPBL+Tskd/rpbWQqhPmfRjZ6r63tRGwWdUc2hRjvCRwgBj4/1v+z8Tc8rUNRJ4uxQZvm2H65F5mMVrdWiaHwlF+qDYxU2CCyHcBDDcWt6ncPacQA93AQWets= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707219911; c=relaxed/simple; bh=5MaI+SAJmeMZipScJnfmg2EXRGX8tvxaCG/kfIfa3yc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GwPQSbWrS6oHM5Ra85qt3U1zm/FjF6sYt/vYtD6DwH/WdBFaLbwQcNipfzRkt9ca1TONhX4Dg2H6H3JNJ9SQlVBZMi4MXVqafogRRTWXiaOWinD3JuNP6blwur1oZWZM5zvcCCpaTBil5nAH7U1ivTa6UdcLuNbTxwidn+kOipI= 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=PwY89Ou4; 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 416BBNGf024712; Tue, 6 Feb 2024 03:45:06 -0800 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=ej+YcMoyPkSvf5dqTkEkDG2azTmL1gzXIrSHqaw8k2s=; b=PwY 89Ou4CP7KP/EL1UXGuITR96P9+zcw2ndN+d2w92oV28Fs3DHzrGC2sskqEKuY74h t6J8kfoMI8j4OfwUEaOO390T5h8KOhBZOVDNJIJiDK4f25rTNORSNEhEd4qZZ4WU Z768UmjV8R2VZYqzMk8LwO3vztbPpIoODoD72hw2XLyCjabVcGLnUcAKgyE3eta+ oUddK0V6FD9BgD7EDwtIJXy67PxRKK8L8y6LMJgLxrc+3jQWP9UzgJ9ko1N62WPq 3dJyJOqiklqwijWfXA7Fa3viPOSaZetb/ewSB9JnRmA9FKBUTShFxuL3vpN5FF4B vIMqJOMnoTWpc+XFxhA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3w38y4j006-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 06 Feb 2024 03:45:06 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 6 Feb 2024 03:45:05 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 6 Feb 2024 03:45:05 -0800 Received: from localhost.localdomain (unknown [10.110.150.250]) by maili.marvell.com (Postfix) with ESMTP id A503A3F7041; Tue, 6 Feb 2024 03:45:04 -0800 (PST) From: Piyush Malgujar To: , , CC: , , , Piyush Malgujar Subject: [PATCH v3 3/4] i2c: octeon: Handle watchdog timeout Date: Tue, 6 Feb 2024 03:43:48 -0800 Message-ID: <20240206114349.32197-4-pmalgujar@marvell.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240206114349.32197-1-pmalgujar@marvell.com> References: <20240206114349.32197-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-ORIG-GUID: afM_f96TIEIfEP7b4ojVOv2hQGf_qfaS X-Proofpoint-GUID: afM_f96TIEIfEP7b4ojVOv2hQGf_qfaS 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-02-06_04,2024-01-31_01,2023-05-22_02 From: Suneel Garapati Status code 0xF0 refers to expiry of TWSI controller access watchdog and needs bus monitor reset using MODE register. 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 6636719ca8f005056230620e2cee19de7154e024..0c89d8d640424356f1ea4f7da11d528631ae7efd 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c @@ -178,6 +178,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 @@ -240,6 +241,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 + MODE(i2c)); + /* Set BUS_MON_RST to reset bus monitor */ + mode |= BUS_MON_RST_MASK; + octeon_i2c_writeq_flush(mode, i2c->twsi_base + 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 e89f041550ace5f7cbcdd94146d0193abe51d466..e53fe60a41b7feb7ccc081cc671cec7be00c5a97 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 { /* Set REFCLK_SRC and HS_MODE in TWSX_MODE register */ #define TWSX_MODE_HS_MASK (BIT(4) | BIT(0)) +/* 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.42.0