Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp264120pxb; Thu, 12 Nov 2020 03:18:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxalNjlPKbWmO1N1g//0UIWjod6+P73RBApPvnVUD7arUTxmKq3377QnbPSetPsafXzuWmx X-Received: by 2002:a17:906:2e8e:: with SMTP id o14mr30614195eji.324.1605179887324; Thu, 12 Nov 2020 03:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605179887; cv=none; d=google.com; s=arc-20160816; b=Ur2CSJgQ0AL+mQ0PdAc+NdYobVtnKcPmj7KIgx0SZgGJ6hcQymNZrusmMRdfakcQmx JZL1nT4E/uVkkAq+jPTZTj5sXSZw9jgURrDISyolUyjYMNw3Wh1lrI+IA0t/XpZ5pENz 6jmD+IR2vuj7dDoA0PQZIOKIlWAtaA+qksq9sY+Y/HZqAhbHswDF/LyxAvvnnovcUHwr Fcx3eAq4ZOU7c2Q8uLHF4Jr7nRhQE5pP8hWwzJacQ1O22H5oWd0u1kYSZTNTDlJ3dIFg EH5klqVBVlnnm9vkh8qMAGPbRZoF5MBjZw4jm/gOwuSxj6ZcX6axSluAHIjEHpXjG8/b Qa5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=2qkNvREGB6upemw2NWJh9LDH9SjawC+AaQHptIVURaU=; b=ygVjpwFrKb57wKD6a6JRZmTNuDBY9tzXhAgmo/dO0bwyGid1ZjR5PwGHJxWtOZFX2d 94Gj2v49yDantazPhypLAzu2Rahx1T93LMnBLn7YiBx3WvFajin2T5X+EheOXh8NUebQ nOEHNd+K+6sRtt/m6WgjzuGJWhDr0VonzPeRKPujqYoZR7WlvglvikJ2hM+EcjSwodMa ZSrfJRwYIL+QeaBM/IlpsDcPlDVddJOg6Jta4RPyS73ggBlL5AJJw2iBOZdwlRn7b0jB ndc0v267dsyo7J87QKUqDtNxDT41JCcSjllLnJyMj1AYpgmw4xhtcH1WiEnP3PjlMkgX 880w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Trlhxvlb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb12si3386006edb.272.2020.11.12.03.17.42; Thu, 12 Nov 2020 03:18:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Trlhxvlb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728022AbgKLLPp (ORCPT + 99 others); Thu, 12 Nov 2020 06:15:45 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:57150 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727035AbgKLLPp (ORCPT ); Thu, 12 Nov 2020 06:15:45 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0ACBFcaI009766; Thu, 12 Nov 2020 05:15:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605179738; bh=2qkNvREGB6upemw2NWJh9LDH9SjawC+AaQHptIVURaU=; h=From:To:CC:Subject:Date; b=TrlhxvlbWT8h7c0pu9qlVVOLBhWz2v7FMK/szdxGG0DMuOK7dvUv8JriCbkY2mAuh XwQIHgQOOS8Qu5Zk+klOXE7Cd3U1zkUh+wtum2P3S9EekipxkJLRH0OYAj0sxhb9MO UavJ+Jd7bdNrBBadPoFamgfGOaaMYUJr0ylAvn9E= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0ACBFc6a058380 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Nov 2020 05:15:38 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 12 Nov 2020 05:15:37 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 12 Nov 2020 05:15:37 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0ACBFaoE099039; Thu, 12 Nov 2020 05:15:37 -0600 From: Grygorii Strashko To: "David S. Miller" , , Jakub Kicinski , Tony Lindgren CC: Sekhar Nori , , , Vignesh Raghavendra , Grygorii Strashko Subject: [PATCH] net: ethernet: ti: cpsw: fix cpts irq after suspend Date: Thu, 12 Nov 2020 13:15:46 +0200 Message-ID: <20201112111546.20343-1-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Depending on the SoC/platform the CPSW can completely lose context after a suspend/resume cycle, including CPSW wrapper (WR) which will cause reset of WR_C0_MISC_EN register, so CPTS IRQ will became disabled. Fix it by moving CPTS IRQ enabling in cpsw_ndo_open() where CPTS is actually started. Fixes: 84ea9c0a95d7 ("net: ethernet: ti: cpsw: enable cpts irq") Reported-by: Tony Lindgren Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw.c | 10 ++++++---- drivers/net/ethernet/ti/cpsw_new.c | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9fd1f77190ad..fa2d1025cbb2 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -838,9 +838,12 @@ static int cpsw_ndo_open(struct net_device *ndev) if (ret < 0) goto err_cleanup; - if (cpts_register(cpsw->cpts)) - dev_err(priv->dev, "error registering cpts device\n"); - + if (cpsw->cpts) { + if (cpts_register(cpsw->cpts)) + dev_err(priv->dev, "error registering cpts device\n"); + else + writel(0x10, &cpsw->wr_regs->misc_en); + } } cpsw_restore(priv); @@ -1716,7 +1719,6 @@ static int cpsw_probe(struct platform_device *pdev) /* Enable misc CPTS evnt_pend IRQ */ cpts_set_irqpoll(cpsw->cpts, false); - writel(0x10, &cpsw->wr_regs->misc_en); skip_cpts: cpsw_notice(priv, probe, diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c index f779d2e1b5c5..2f5e0ad23ad7 100644 --- a/drivers/net/ethernet/ti/cpsw_new.c +++ b/drivers/net/ethernet/ti/cpsw_new.c @@ -873,8 +873,12 @@ static int cpsw_ndo_open(struct net_device *ndev) if (ret < 0) goto err_cleanup; - if (cpts_register(cpsw->cpts)) - dev_err(priv->dev, "error registering cpts device\n"); + if (cpsw->cpts) { + if (cpts_register(cpsw->cpts)) + dev_err(priv->dev, "error registering cpts device\n"); + else + writel(0x10, &cpsw->wr_regs->misc_en); + } napi_enable(&cpsw->napi_rx); napi_enable(&cpsw->napi_tx); @@ -2006,7 +2010,6 @@ static int cpsw_probe(struct platform_device *pdev) /* Enable misc CPTS evnt_pend IRQ */ cpts_set_irqpoll(cpsw->cpts, false); - writel(0x10, &cpsw->wr_regs->misc_en); skip_cpts: ret = cpsw_register_notifiers(cpsw); -- 2.17.1