Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>,
	lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	tsbogend@alpha.franken.de, hkallweit1@gmail.com,
	linux@armlinux.org.uk, markus.stockhausen@gmx.de
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, linux-mips@vger.kernel.org
Subject: Re: [PATCH 4/4] net: mdio: Add RTL9300 MDIO driver
Date: Thu, 12 Dec 2024 09:18:04 +0100	[thread overview]
Message-ID: <a50f9f86-b0f4-484a-85ef-9dd1e5737d83@wanadoo.fr> (raw)
In-Reply-To: <20241211235342.1573926-5-chris.packham@alliedtelesis.co.nz>

Le 12/12/2024 à 00:53, Chris Packham a écrit :
> Add a driver for the MDIO controller on the RTL9300 family of Ethernet
> switches with integrated SoC. There are 4 physical SMI interfaces on the
> RTL9300 but access is done using the switch ports so a single MDIO bus
> is presented to the rest of the system.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

...

> +	err = regmap_write(priv->regmap, priv->reg_base + SMI_ACCESS_PHY_CTRL_1,
> +			   PHY_CTRL_RWOP | PHY_CTRL_TYPE | PHY_CTRL_CMD);
> +	if (err)
> +		return err;
> +
> +	err = regmap_read_poll_timeout(priv->regmap, priv->reg_base + SMI_ACCESS_PHY_CTRL_1,
> +				       val, !(val & PHY_CTRL_CMD), 10, 100);
> +	if (err)
> +		return err;
> +
> +	if (val & PHY_CTRL_FAIL) {
> +		err = -ENXIO;
> +		return err;

Nitpick: return -ENXIO; and remove the { }

> +	}
> +
> +	return err;

Nitpick: return 0;

> +}
> +
> +static int realtek_mdiobus_init(struct realtek_mdio_priv *priv)
> +{
> +	u32 port_addr[5] = { };
> +	u32 poll_sel[2] = { 0, 0 };

Nitpick: Why {} in on case and {0,0} in the other one?

> +	u32 glb_ctrl_mask = 0, glb_ctrl_val = 0;
> +	int i, err;
> +
> +	for (i = 0; i < MAX_PORTS; i++) {
> +		int pos;
> +
> +		if (priv->smi_bus[i] > 3)
> +			continue;
> +
> +		pos = (i % 6) * 5;
> +		port_addr[i / 6] |=  priv->smi_addr[i] << pos;
> +
> +		pos = (i % 16) * 2;
> +		poll_sel[i / 16] |= priv->smi_bus[i] << pos;
> +	}

...

CJ


  parent reply	other threads:[~2024-12-12  8:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 23:53 [PATCH 0/4] RTL9300 MDIO driver Chris Packham
2024-12-11 23:53 ` [PATCH 1/4] dt-bindings: net: Add Realtek MDIO controller Chris Packham
2024-12-12 17:13   ` Andrew Lunn
2024-12-13  0:56     ` Chris Packham
2024-12-13 11:58       ` Andrew Lunn
2024-12-15 19:52         ` Chris Packham
2024-12-15 21:38           ` Andrew Lunn
2024-12-11 23:53 ` [PATCH 2/4] dt-bindings: mfd: Add MDIO interface to rtl9301-switch Chris Packham
2024-12-11 23:53 ` [PATCH 3/4] mips: dts: realtek: Add MDIO controller Chris Packham
2024-12-11 23:53 ` [PATCH 4/4] net: mdio: Add RTL9300 MDIO driver Chris Packham
2024-12-12  7:41   ` Andrew Lunn
2024-12-12  8:18   ` Christophe JAILLET [this message]
2024-12-12  9:59   ` Russell King (Oracle)
2024-12-13  0:51     ` Chris Packham
2024-12-13 19:59   ` Simon Horman
2024-12-15 20:27     ` Chris Packham

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=a50f9f86-b0f4-484a-85ef-9dd1e5737d83@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=andrew+netdev@lunn.ch \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=markus.stockhausen@gmx.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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