From patchwork Thu Nov 23 11:38:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jaiswal X-Patchwork-Id: 168891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp379929vqx; Thu, 23 Nov 2023 03:39:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeqbjYIx3FGsyTXCuO7NN81ytab/KUW5FpND1FfellCxb0SyPFlvrf9oAESz8oFO/l2Y3S X-Received: by 2002:a05:6a20:3d21:b0:18b:8fd9:5ad4 with SMTP id y33-20020a056a203d2100b0018b8fd95ad4mr1730051pzi.10.1700739582069; Thu, 23 Nov 2023 03:39:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700739582; cv=none; d=google.com; s=arc-20160816; b=aU6Pp50Bw4QbTaS/pIuXmTfBa2lUGm+xQ4uMsyzpHap4ru2ZERydxIwZQqj2QjvSUo 8g1Q4INAR/ElRJGl3ph6bwIUvB3Vpdn/I1bpiOLXNkds8hlVQEsKFHUCzbe/au7X49Fz s47KgMhkp0swLhgOmeCf7/0nGdYXPTzCDX3Ki3EFK+9EpyTNCDxQVJ+2AvEeHCdlcKrp 8Yb1ERqvjuXUT2Y2edQe98J1MHEE0e2ruZ1TifXky9wqAYAemf6ugXf/2BUisDVa25Af xksftQj6U8sitin6MoJepYUgECQBrHdh43XW3kRX2vF4lZd0h7wegWo07Q5o/F5tbShY 3X5w== 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=6juClkUBmcBTBsnEjdDc22tc/uO5kD0o1qqxtbwZTZM=; fh=gw1nGGRvPTMpMB1+2yIHl2JD2hbsUI2mdSe/41PDYQ8=; b=rrU8793VSh/MR7yqWkMkm62e/PiOOe6JuumKm1Z30H9gahxLDWifSDy/JRva3XFX1H rmCQxeH0a0xs8Kc6t25U30yi+vbB6fCb6eYZRuAtnaiHtNLJq9dVseNMPAnOz7gUcgjl BJnTsQ1FfxH5YcgdhQgjktyBsPJ5futoxkUlRovZAB0nFXR3olxT6eaF28iUuOyugE78 ucBzB4o3ilkrwYaxNC+GefHV2UQ+yqyosGEH5A6fsek8Vn78tRL6hZWuySpMyIJsUeDB okAGR6E9FxKu0w/7in92nr/HxHMG2riMwoAeXbLZc3wdyqnmLYpSG7ptK8MgVp+Jl0Ed F9zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S4oW4wKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id p6-20020a634206000000b0056513361b4fsi1082405pga.741.2023.11.23.03.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 03:39:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=S4oW4wKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 70C1883271FB; Thu, 23 Nov 2023 03:39:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345107AbjKWLjY (ORCPT + 99 others); Thu, 23 Nov 2023 06:39:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345097AbjKWLjM (ORCPT ); Thu, 23 Nov 2023 06:39:12 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 264DD10C0; Thu, 23 Nov 2023 03:39:18 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8fLHM007773; Thu, 23 Nov 2023 11:39:06 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=6juClkUBmcBTBsnEjdDc22tc/uO5kD0o1qqxtbwZTZM=; b=S4oW4wKRm2I3ppiPge+nPl+LYaNLjOrkEwx64EfTssDd5PypbUkDpZT1WtRhI1heA7zs NjXf+98H2zhe2q8yLI+f8BmhU29bOZTWppPXJy+85Ri/Tv/RbSdb9ex6EXq5CDI5lpAa qA8y3ZbngPWjhkD78+7ALREWCss0JZslNc0ciQP8xUygAGUhAKugZVDzzFfFgWMAf9uQ QZcJ2NYWNHI8L9AABa8YyzgqZ3NTS2A11BbNRk2F7nBYO3MZLUrNvvoAfRw4feP6ZXUm 6M0CcI+OTppAERi4g0OWl/zeHek+zCnYW1H4Ehg1qZN+lW6Cz6zJeGR9yHLZSZARGLkg vw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uj3ec0b67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 11:39:06 +0000 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 3ANBd59P005976 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 11:39:05 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; Thu, 23 Nov 2023 03:38:55 -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 CC: Subject: [PATCH net-next v3 3/3] net: stmmac: Add driver support for DWMAC5 fault IRQ Support Date: Thu, 23 Nov 2023 17:08:15 +0530 Message-ID: <62eaaace3713751cb1ecac3163e857737107ca0e.1700737841.git.quic_jsuraj@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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-ORIG-GUID: inTtRkS7Bsh4eRNmB_EsvVggQ51OqJNb X-Proofpoint-GUID: inTtRkS7Bsh4eRNmB_EsvVggQ51OqJNb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-23_09,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230083 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 03:39:39 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783354708328955469 X-GMAIL-MSGID: 1783354708328955469 Add IRQ support to listen HW fault like ECC,DPP,FSM 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 | 20 +++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 6b935922054d..c4821c7ab674 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 cd7a9768de5f..8893d4b7fa38 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_intr; int rx_irq[MTL_MAX_RX_QUEUES]; int tx_irq[MTL_MAX_TX_QUEUES]; }; @@ -331,6 +332,7 @@ struct stmmac_priv { /* XDP BPF Program */ unsigned long *af_xdp_zc_qps; struct bpf_prog *xdp_prog; + int safety_common_intr; }; enum stmmac_state { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8964fc8a955f..2ae4f34444de 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3530,6 +3530,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_intr > 0 && priv->safety_common_intr != dev->irq) + free_irq(priv->safety_common_intr, dev); + fallthrough; case REQ_IRQ_ERR_WOL: free_irq(dev->irq, dev); fallthrough; @@ -3736,6 +3740,18 @@ static int stmmac_request_irq_single(struct net_device *dev) } } + if (priv->safety_common_intr > 0 && priv->safety_common_intr != dev->irq) { + ret = request_irq(priv->safety_common_intr, 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_intr, ret); + irq_err = REQ_IRQ_ERR_SAFETY; + goto irq_error; + } + } + return 0; irq_error: @@ -7398,6 +7414,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_intr = res->safety_common_intr; + 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..bae1704d5f4b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -690,9 +690,25 @@ devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) #endif /* CONFIG_OF */ EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt); +int stmmac_get_fault_intr_config(struct platform_device *pdev, struct stmmac_resources *res) +{ + int ret = 0; + + res->safety_common_intr = platform_get_irq_byname(pdev, "safety"); + + if (res->safety_common_intr < 0) { + if (res->safety_common_intr != -EPROBE_DEFER) + dev_err(&pdev->dev, "safety IRQ configuration information not found\n"); + ret = 1; + } + + return ret; +} + int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res) { + int ret = 0; memset(stmmac_res, 0, sizeof(*stmmac_res)); /* Get IRQ information early to have an ability to ask for deferred @@ -702,6 +718,10 @@ int stmmac_get_platform_resources(struct platform_device *pdev, if (stmmac_res->irq < 0) return stmmac_res->irq; + ret = stmmac_get_fault_intr_config(pdev, stmmac_res); + if (ret) + dev_err(&pdev->dev, "Fault interrupt not present\n"); + /* On some platforms e.g. SPEAr the wake up irq differs from the mac irq * The external wake up irq can be passed through the platform code * named as "eth_wake_irq"