netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <marek.behun@nic.cz>
To: Gustav Ekelund <gustav.ekelund@axis.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	kernel@axis.com, Gustav Ekelund <gustaek@axis.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: dsa: mv88e6xxx: Reset mv88e6393x watchdog register
Date: Tue, 28 Mar 2023 14:06:04 +0200	[thread overview]
Message-ID: <20230328120604.zawfeskqs4yhlze6@kandell> (raw)
In-Reply-To: <20230328115511.400145-1-gustav.ekelund@axis.com>

On Tue, Mar 28, 2023 at 01:55:11PM +0200, Gustav Ekelund wrote:
> From: Gustav Ekelund <gustaek@axis.com>
> 
> 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 <gustaek@axis.com>
> ---
>  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
> 

  reply	other threads:[~2023-03-28 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 11:55 [PATCH net] net: dsa: mv88e6xxx: Reset mv88e6393x watchdog register Gustav Ekelund
2023-03-28 12:06 ` Marek Behún [this message]
2023-03-28 12:30   ` Andrew Lunn
2023-03-28 12:47     ` Marek Behún
2023-03-28 13:34       ` Gustav Ekelund
2023-03-28 13:45         ` Andrew Lunn
2023-03-28 14:47           ` Marek Behún
2023-03-30 13:29             ` Gustav Ekelund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230328120604.zawfeskqs4yhlze6@kandell \
    --to=marek.behun@nic.cz \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gustaek@axis.com \
    --cc=gustav.ekelund@axis.com \
    --cc=kernel@axis.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).