Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1288058lqb; Thu, 18 Apr 2024 05:59:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUesM6eK8O/hhLdZJ+rmVVyI/iEnz3L7Blo0ultuv/V+XutqVP/lhrLWZTAjqhbqdU1CLxWkbp54Vxm1JAQyrKiPd/NgU+tVI/XLRlzMw== X-Google-Smtp-Source: AGHT+IEDCOLC3DnjRHAPvGOe4QvBps8rN90dekfmPfyQL4X9B8zq3bY25t6NRHklNngxJqjKGg66 X-Received: by 2002:a9d:63d7:0:b0:6eb:7871:66f3 with SMTP id e23-20020a9d63d7000000b006eb787166f3mr2976673otl.29.1713445165841; Thu, 18 Apr 2024 05:59:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713445165; cv=pass; d=google.com; s=arc-20160816; b=EAwSG+gI0JJLcc0Ty36Y6QIjUeSJmjlyWtsP8v4sfBsPD7dzFcw3IQGQcsZRvywJgV 1Wf5k7g4m57wqx8F2ldFbcc2H4VP+ZKRDUmP5ZcpJukNoqs/KJVidk2XELeQ1a6KL8qM n62JU4K0A8tgIogDAuS+QnRVbtsLe75cVvaXvsIU6DgforFXrBvKRMumY8kzAdD9PGFn XAW52KyIHIkxZddE7MbjqNHPhA8CWAD7RBRAxxjt7gMhz1EFVWbHF87D19xD1noVJldq vtgiqrUWALGTi/+tDBCxu5LgNPGzkNrswOJJVXeZOUBTh/o7V1YZfkfgv2tvX0qPOSFg +Bug== 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=e73t2Wg5ODUkZkaxfyj7QGA3J2BB7JtpAK4H+mH4Dn8=; fh=Yek51KtWkuS8F9wIb61YhKBdNUJJ2f/R79g/JeL1hhg=; b=LO+l3m+9br50hYuqjdE9oz9z4q1qYFMeHuLw5pAINburn90Z6HbhXdVZy3XG3AjQu4 ML6v/B/ZMXQALnXwf5CTQj31Uqzor4pC37KCX1jgoL7rLMF2yEOa6UHkb4yZ9XDzQKUC XVWBMlbzuzBh8IfkFThKGPsXRb95TGPT3YhMJ4PVaxxZbdw3Ve5zWuoEVEs65swvODMV Qypetd0GFZjNZZ0cnDDFPSoiSwxuipSFi5/TAT4TufteKpAQ5FPYDpvCSpaglwa3z5fm 86HmycK+Fj/CYUxr8bMX9kfSVV+rboRs4oszpMWfZP21peSh0BUaSs4o+VB04gTyWpk9 Ykxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Xp8fOrky; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-150112-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150112-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 185-20020a6302c2000000b005dc927ee328si1328576pgc.662.2024.04.18.05.59.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150112-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=Xp8fOrky; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-150112-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150112-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7254A282667 for ; Thu, 18 Apr 2024 12:59:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85A53163A80; Thu, 18 Apr 2024 12:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Xp8fOrky" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 E3ED0161306; Thu, 18 Apr 2024 12:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445065; cv=none; b=WZqaWxY83VJNF8P41UQtg/Hhr2BkFxZ/tP2AIk/MYdAqKW+lxTCubg7X2G1WLbK8+cpSeyDSxUyVKdAHZBTSUUabf0WN06zFavqFpcsgl8PwdHBMPgInVrKk5qMrB74QFFIRoFlROgnvSbVINCtgGbxkghMiE5isEDcACEvIMlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713445065; c=relaxed/simple; bh=yQvbkSLcdIeNInVreHxrqpZEvnx+P5m7ZO6OmY1CBug=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jXbDMyq+eOMp3W4Y3UXdRiBhT99rLlBdIna9MKEkZlqAr+YAVL2+z2X+a+uSJTXfJwiN3atFRzTB3dT9m0vNAcunHHTdftL49FNYVr9CX4OcF0QZhuaIUzLqIYRLOBa+tgbfn/Ecs8JiyHCZEpLnYXD78A2MtAjneSaExFhf3pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=Xp8fOrky; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713445063; x=1744981063; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yQvbkSLcdIeNInVreHxrqpZEvnx+P5m7ZO6OmY1CBug=; b=Xp8fOrkyVPThsxbVBQPsAnFXRzshTT6o03kqNJWzUYN1BX6VTlXvRVqN 7gVtK/jw+TtEPuiG2kbDGUx7321En/7JvX2M2y0MibgeYtUfHwS/aIyMH IpcQEVtnn1G0RhFod64TISlKUQVN0NY7l/8es03GgqbmPBiEg6IETNDW2 HVafzf0tocyBGuZGZGhazS+5pmjyRhuYuDIE8tO0U7ERGEkRPUfOC+Ua2 +YuyZnNcg7kVojdqVqJnflEgViXePLE/YxbN1O7Py3jfkS0lNCDV5ZrZB 5R7geNZdZpA51XTNAZwQ8U+sANqH9J7Z8ypXnAzpgqMe3U/erv6vh9nu4 A==; X-CSE-ConnectionGUID: wIEpAzdhSGCIIYIJVV9X/Q== X-CSE-MsgGUID: xgwQeF8WQESD6EOchLi1OA== X-IronPort-AV: E=Sophos;i="6.07,212,1708412400"; d="scan'208";a="23619643" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Apr 2024 05:57:40 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 18 Apr 2024 05:57:29 -0700 Received: from CHE-LT-I17164LX.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 18 Apr 2024 05:57:21 -0700 From: Parthiban Veerasooran To: , , , , , , , , , , , , , , , , , , , CC: , , , , , , Parthiban Veerasooran Subject: [PATCH net-next v4 05/12] net: ethernet: oa_tc6: implement error interrupts unmasking Date: Thu, 18 Apr 2024 18:26:41 +0530 Message-ID: <20240418125648.372526-6-Parthiban.Veerasooran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240418125648.372526-1-Parthiban.Veerasooran@microchip.com> References: <20240418125648.372526-1-Parthiban.Veerasooran@microchip.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 This will unmask the following error interrupts from the MAC-PHY. tx protocol error rx buffer overflow error loss of framing error header error The MAC-PHY will signal an error by setting the EXST bit in the receive data footer which will then allow the host to read the STATUS0 register to find the source of the error. Signed-off-by: Parthiban Veerasooran --- drivers/net/ethernet/oa_tc6.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c index 4b0f63c02c35..850765574d30 100644 --- a/drivers/net/ethernet/oa_tc6.c +++ b/drivers/net/ethernet/oa_tc6.c @@ -18,6 +18,13 @@ #define OA_TC6_REG_STATUS0 0x0008 #define STATUS0_RESETC BIT(6) /* Reset Complete */ +/* Interrupt Mask Register #0 */ +#define OA_TC6_REG_INT_MASK0 0x000C +#define INT_MASK0_HEADER_ERR_MASK BIT(5) +#define INT_MASK0_LOSS_OF_FRAME_ERR_MASK BIT(4) +#define INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK BIT(3) +#define INT_MASK0_TX_PROTOCOL_ERR_MASK BIT(0) + /* Control command header */ #define OA_TC6_CTRL_HEADER_DATA_NOT_CTRL BIT(31) #define OA_TC6_CTRL_HEADER_WRITE_NOT_READ BIT(29) @@ -324,6 +331,23 @@ static int oa_tc6_sw_reset_macphy(struct oa_tc6 *tc6) return oa_tc6_write_register(tc6, OA_TC6_REG_STATUS0, regval); } +static int oa_tc6_unmask_macphy_error_interrupts(struct oa_tc6 *tc6) +{ + u32 regval; + int ret; + + ret = oa_tc6_read_register(tc6, OA_TC6_REG_INT_MASK0, ®val); + if (ret) + return ret; + + regval &= ~(INT_MASK0_TX_PROTOCOL_ERR_MASK | + INT_MASK0_RX_BUFFER_OVERFLOW_ERR_MASK | + INT_MASK0_LOSS_OF_FRAME_ERR_MASK | + INT_MASK0_HEADER_ERR_MASK); + + return oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval); +} + /** * oa_tc6_init - allocates and initializes oa_tc6 structure. * @spi: device with which data will be exchanged. @@ -364,6 +388,13 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi) return NULL; } + ret = oa_tc6_unmask_macphy_error_interrupts(tc6); + if (ret) { + dev_err(&tc6->spi->dev, + "MAC-PHY error interrupts unmask failed: %d\n", ret); + return NULL; + } + return tc6; } EXPORT_SYMBOL_GPL(oa_tc6_init); -- 2.34.1