From patchwork Mon Dec 11 08:01:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jaiswal X-Patchwork-Id: 176520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6892845vqy; Mon, 11 Dec 2023 00:03:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkwFVjuRkFdVUxVum9EXh8IJ5Ki3UV5DYRuWMROfa00H/qNZ4N3p40g6MyHlS+dTjShRQm X-Received: by 2002:a05:6e02:1ba9:b0:35c:e98f:c591 with SMTP id n9-20020a056e021ba900b0035ce98fc591mr2920940ili.3.1702281787467; Mon, 11 Dec 2023 00:03:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702281787; cv=none; d=google.com; s=arc-20160816; b=XCY9n9JlEgAzq9bhdJSiuV6ZPDXdtIcA0ZpBeifVet9tCaVwds2UEag6zBHidbvFux nk1bRfHySUwwq5d2u/LJlSjNlJfayUPhhL+CCGxLU9KZ9r0+BGYaGOC8DQP97KWakI8Q 2z8PkEWwTmqduNq5K4cnmGzTWFHDOSLSa7wLT12uJtVI3DGGuKoiGbCrMuxmtvT7Ksek 32xNBTuVgeqA0yWOl+fx/XLo7SBCrd9nxjpg0Gz85ujtCktp1faPtcsmG0g0VT+KbWlk AqMXpa6wFIv00IaVdd5EFYJln5imFC8rQu6ZndjYwfYOtY9ROjPXG03syGMg8V4ngBC2 AgmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+FEzrFKs6ZPhCQRBlfYnh24zV5xaPlV/IKpddkGjXTw=; fh=AO1athPla3jqhCn4k6adBHi7gs3A5EcpzQmM6u71SYU=; b=hI5Yf4GeXe5U1fO0mXFcuPpn7KxgFIX92UZYZxo0D9vpkRs9M3262UoiD7DF13Gx9c F7aNIN3gKPQfsyJSVjmJUNJuuKhHdGrMfHdt6obz7hdgn0af45fDmFM4w/K8rBnctYSv izabBLFmIydXqtlVMQeSoBaJgtJ3oglqWomiumGsco8t35LqOWFVutumNLssdrn08Ssv TkaHQMdIb0omYRyeda2z5Mk89OpEeU6ereVLFc6GqrZ4SIsApiXtVVlnkfhPWSf0GVNo oNguPbONeXiSHC3bv+RjFvrSPjUDiin/sMniKT8gZyRQq65QBuncmEUXTr9/54ebmyuY cFgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jaoQqXLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n2-20020a632702000000b005be1ee5dd00si5679439pgn.764.2023.12.11.00.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 00:03:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jaoQqXLk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 471A8807066E; Mon, 11 Dec 2023 00:03:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233910AbjLKICy (ORCPT + 99 others); Mon, 11 Dec 2023 03:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233899AbjLKICv (ORCPT ); Mon, 11 Dec 2023 03:02:51 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA385101; Mon, 11 Dec 2023 00:02:54 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BB7aoV9013723; Mon, 11 Dec 2023 08:02:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=+FEzrFKs6ZPhCQRBlfYnh24zV5xaPlV/IKpddkGjXTw=; b=ja oQqXLkSUd5O5JXVKrGhXAYK5sZ/4VSVYd3xR7Iknkbqi8y3vIR3OPp/FxBNu+XC5 aXMgVwVDIDU1UWeCU1Lh2Pkk97hCi8l/p94KLqE3knOPklp6nP+fApnGoRYsfR4X kLx4kiXqTuyqsvqDciG/tQdCnbi1hyUxyReQ/eG8dtroTxDpmLTg770IVUXzaTnN 0+/8umhD3ToL0IcAuiEKSajMadLigc9F5vuH2eNqbzmiiCmUPpWxR5TZTvjsk+65 IXak+PtHVomGeN1ytfsPqi27ma93Wzjd19bw/9gHkeSpk8gTwYJSqZ+VyL2InmCW hxM2QwA4dQoXlWYOy9uA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uwjyjrynx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 08:02:41 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BB82eYp003204 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Dec 2023 08:02:40 GMT Received: from hu-jsuraj-hyd.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 11 Dec 2023 00:02:30 -0800 From: Suraj Jaiswal To: , Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Alexandre Torgue , "Jose Abreu" , Maxime Coquelin , , , , , , Prasad Sodagudi , Andrew Halaney , Rob Herring CC: Subject: [PATCH net-next v5 3/3] net: stmmac: Add driver support for DWMAC5 safety IRQ support Date: Mon, 11 Dec 2023 13:31:53 +0530 Message-ID: <20231211080153.3005122-4-quic_jsuraj@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231211080153.3005122-1-quic_jsuraj@quicinc.com> References: <20231211080153.3005122-1-quic_jsuraj@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: x5JuBftQhK7WbrtJsDHr2lL8fsUiMgXn X-Proofpoint-ORIG-GUID: x5JuBftQhK7WbrtJsDHr2lL8fsUiMgXn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312110066 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 00:03:06 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784971827738545934 X-GMAIL-MSGID: 1784971827738545934 Add IRQ support to listen HW safety IRQ like ECC(error correction code), DPP(data path parity), FSM(finite state machine) fault and print the fault information in the kernel log. Signed-off-by: Suraj Jaiswal --- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.c | 9 +++++++++ 4 files changed, 30 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 721c1f8e892f..cb9645fe16d8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -347,6 +347,7 @@ enum request_irq_err { REQ_IRQ_ERR_SFTY_UE, REQ_IRQ_ERR_SFTY_CE, REQ_IRQ_ERR_LPI, + REQ_IRQ_ERR_SAFETY, REQ_IRQ_ERR_WOL, REQ_IRQ_ERR_MAC, REQ_IRQ_ERR_NO, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 9f89acf31050..aa2eda6fb927 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -33,6 +33,7 @@ struct stmmac_resources { int irq; int sfty_ce_irq; int sfty_ue_irq; + int safety_common_irq; int rx_irq[MTL_MAX_RX_QUEUES]; int tx_irq[MTL_MAX_TX_QUEUES]; }; @@ -299,6 +300,7 @@ struct stmmac_priv { unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; int sfty_ce_irq; int sfty_ue_irq; + int safety_common_irq; int rx_irq[MTL_MAX_RX_QUEUES]; int tx_irq[MTL_MAX_TX_QUEUES]; /*irq name */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 47de466e432c..e4a0d9ec8b3f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3592,6 +3592,10 @@ static void stmmac_free_irq(struct net_device *dev, if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) free_irq(priv->wol_irq, dev); fallthrough; + case REQ_IRQ_ERR_SAFETY: + if (priv->safety_common_irq > 0 && priv->safety_common_irq != dev->irq) + free_irq(priv->safety_common_irq, dev); + fallthrough; case REQ_IRQ_ERR_WOL: free_irq(dev->irq, dev); fallthrough; @@ -3798,6 +3802,18 @@ static int stmmac_request_irq_single(struct net_device *dev) } } + if (priv->safety_common_irq > 0 && priv->safety_common_irq != dev->irq) { + ret = request_irq(priv->safety_common_irq, stmmac_safety_interrupt, + 0, "safety", dev); + if (unlikely(ret < 0)) { + netdev_err(priv->dev, + "%s: alloc safety failed %d (error: %d)\n", + __func__, priv->safety_common_irq, ret); + irq_err = REQ_IRQ_ERR_SAFETY; + goto irq_error; + } + } + return 0; irq_error: @@ -7464,6 +7480,8 @@ int stmmac_dvr_probe(struct device *device, priv->lpi_irq = res->lpi_irq; priv->sfty_ce_irq = res->sfty_ce_irq; priv->sfty_ue_irq = res->sfty_ue_irq; + priv->safety_common_irq = res->safety_common_irq; + for (i = 0; i < MTL_MAX_RX_QUEUES; i++) priv->rx_irq[i] = res->rx_irq[i]; for (i = 0; i < MTL_MAX_TX_QUEUES; i++) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 1ffde555da47..41a4a253d75b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -726,6 +726,15 @@ int stmmac_get_platform_resources(struct platform_device *pdev, dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); } + stmmac_res->safety_common_irq = + platform_get_irq_byname_optional(pdev, "safety"); + + if (stmmac_res->safety_common_irq < 0) { + if (stmmac_res->safety_common_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_info(&pdev->dev, "IRQ safety IRQ not found\n"); + } + stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); return PTR_ERR_OR_ZERO(stmmac_res->addr);