Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4267712rwl; Tue, 28 Mar 2023 05:09:01 -0700 (PDT) X-Google-Smtp-Source: AK7set+BOoc9Mx5pBVt0v6p19hy6SEMBnjKNXCApKOy1IHDUyMvt4v7DrxX5SZEgZEl5CBRacIsy X-Received: by 2002:a05:6a20:7da6:b0:da:d4eb:9e07 with SMTP id v38-20020a056a207da600b000dad4eb9e07mr13747708pzj.30.1680005341057; Tue, 28 Mar 2023 05:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680005341; cv=none; d=google.com; s=arc-20160816; b=yW3MZGIJjIYKFXjJ1vFJTi8atHenppmU9SC6uh71n12cvNByKrwdyHDFvOYFTOt4z3 +HO6qRt+iHPKUGU+i+HhvojWGotwb8Ran/tBjKlSCVPhNMY9l+Ct6fPgWZL5dTCKgOJ1 4q43ZxoPuJ6HSGv+DSqWQutHp1a5Pcmg69lWh6XFz7kS9i3n7600ZOfb/5Ond4erJmnB l0wa602Pev3quS5xgPfJ47WXrn5GbI4Pqil2G+JCuA5Mz7p2VKps5ea/7Lxdx8R5QHvi L7mD94Ism7w6Z0gQ0V0mz9vZmwdM11w3mDLruOm/sl5iQVOz0RMvPo1lyu66cHqAXAQt Aw7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5bCsylRebXnqtEz5Nf62BHACtIqClF7v/m+II5yIOM0=; b=E3xDCj1LcOcryiqBbiCgxG4is4ExlnN9Dun1h7MdjZcV2HlJWM59V7dkqMlq06fYo5 YT+oeATmqPEaGUm38oqvnUfRkaBf6abXMaOF9qrSBpc9phqGLbGVuTo4NyFSzHcuZCLu WZvaM6QgmTeJOkKdsOebDhd9bGNXtJCVfUhupJv+zwtoxfVOaG3ShByfTs0U3fJAN4oz PSLWbXt5CfndgvFaNK7zzUR2sSgFSM/dWg4xzRPTlf+04HbAA1dCdl+2q+8QeuBol/uE rKwjly8tClgNQJXNSMfVTuAKsRXg1VwhJW9mPh+3HtNqXXtTq3s5hnePI8j8JW+8z5vH OQfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=F3Z1VnT0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nic.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l5-20020a63ba45000000b0050c08fcd35asi29551608pgu.71.2023.03.28.05.08.47; Tue, 28 Mar 2023 05:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nic.cz header.s=default header.b=F3Z1VnT0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nic.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231570AbjC1MGx (ORCPT + 99 others); Tue, 28 Mar 2023 08:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbjC1MGo (ORCPT ); Tue, 28 Mar 2023 08:06:44 -0400 Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FAAB8A43; Tue, 28 Mar 2023 05:06:17 -0700 (PDT) Received: from kandell (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPS id 5B5D91C1481; Tue, 28 Mar 2023 14:06:04 +0200 (CEST) Authentication-Results: mail.nic.cz; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1680005165; bh=yEJ4s07mOxgd45ojTtnpz2ZYwsSZtSkS7TxxQM1EWMg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Reply-To: Subject:To:Cc; b=F3Z1VnT0PbkprI187QqXHFnS9lanGTcPSUXj80fYUbixwlxz2Y3Qhb4dujmw8qDAc JzHINBlNRJ4qrQ1SfVeGFOebhucIC831HhK4pBHdS45GuzDdGDus/qiIcTmKR6tW4k 9fDad7cbX4a0GTuvqoN/Wff/YHGHBC1XT1L0LBx4= Date: Tue, 28 Mar 2023 14:06:04 +0200 From: Marek =?utf-8?B?QmVow7pu?= To: Gustav Ekelund Cc: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , kernel@axis.com, Gustav Ekelund , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: dsa: mv88e6xxx: Reset mv88e6393x watchdog register Message-ID: <20230328120604.zawfeskqs4yhlze6@kandell> References: <20230328115511.400145-1-gustav.ekelund@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230328115511.400145-1-gustav.ekelund@axis.com> X-Virus-Scanned: clamav-milter 0.103.7 at mail X-Virus-Status: Clean X-Rspamd-Action: no action X-Rspamd-Server: mail X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spamd-Result: default: False [-0.10 / 20.00]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; WHITELISTED_IP(0.00)[172.20.6.87]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+] X-Rspamd-Queue-Id: 5B5D91C1481 X-Spamd-Bar: / X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: WHITELISTED_IP 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 On Tue, Mar 28, 2023 at 01:55:11PM +0200, Gustav Ekelund wrote: > From: Gustav Ekelund > > The watchdog event bits are not cleared during SW reset in the mv88e6393x > switch. This causes one event to be handled over and over again. > > Explicitly clear the watchdog event register to 0 after the SW reset. > > Signed-off-by: Gustav Ekelund > --- > drivers/net/dsa/mv88e6xxx/chip.c | 2 +- > drivers/net/dsa/mv88e6xxx/global2.c | 17 +++++++++++++++++ > drivers/net/dsa/mv88e6xxx/global2.h | 1 + > 3 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > index 30383c4f8fd0..ee22d4785e9e 100644 > --- a/drivers/net/dsa/mv88e6xxx/chip.c > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > @@ -5596,7 +5596,7 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = { > * .port_set_upstream_port method. > */ > .set_egress_port = mv88e6393x_set_egress_port, > - .watchdog_ops = &mv88e6390_watchdog_ops, > + .watchdog_ops = &mv88e6393x_watchdog_ops, > .mgmt_rsvd2cpu = mv88e6393x_port_mgmt_rsvd2cpu, > .pot_clear = mv88e6xxx_g2_pot_clear, > .reset = mv88e6352_g1_reset, > diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c > index ed3b2f88e783..bef8297d4f78 100644 > --- a/drivers/net/dsa/mv88e6xxx/global2.c > +++ b/drivers/net/dsa/mv88e6xxx/global2.c > @@ -943,6 +943,23 @@ const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = { > .irq_free = mv88e6390_watchdog_free, > }; > > +static int mv88e6393x_watchdog_action(struct mv88e6xxx_chip *chip, int irq) > +{ > + mv88e6390_watchdog_action(chip, irq); > + > + mv88e6xxx_g2_write(chip, MV88E6390_G2_WDOG_CTL, > + MV88E6390_G2_WDOG_CTL_UPDATE | > + MV88E6390_G2_WDOG_CTL_PTR_EVENT); > + > + return IRQ_HANDLED; > +} Shouldn't this update be in .irq_setup() method? In the commit message you're saying that the problem is that bits aren't cleared with SW reset. So I would guess that the change should be in the setup of watchdog IRQ, not in IRQ action? (I am not disagreeing, I am just asking because I don't have access to documentation right now.) Marek > +const struct mv88e6xxx_irq_ops mv88e6393x_watchdog_ops = { > + .irq_action = mv88e6393x_watchdog_action, > + .irq_setup = mv88e6390_watchdog_setup, > + .irq_free = mv88e6390_watchdog_free, > +}; > + > static irqreturn_t mv88e6xxx_g2_watchdog_thread_fn(int irq, void *dev_id) > { > struct mv88e6xxx_chip *chip = dev_id; > diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h > index e973114d6890..7e091965582b 100644 > --- a/drivers/net/dsa/mv88e6xxx/global2.h > +++ b/drivers/net/dsa/mv88e6xxx/global2.h > @@ -369,6 +369,7 @@ int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target, > extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops; > extern const struct mv88e6xxx_irq_ops mv88e6250_watchdog_ops; > extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops; > +extern const struct mv88e6xxx_irq_ops mv88e6393x_watchdog_ops; > > extern const struct mv88e6xxx_avb_ops mv88e6165_avb_ops; > extern const struct mv88e6xxx_avb_ops mv88e6352_avb_ops; > -- > 2.30.2 >