linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: jonas.gorski@gmail.com, "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] net: mdio: Add BCM6368 MDIO mux bus controller
Date: Mon, 8 Mar 2021 22:00:37 +0100	[thread overview]
Message-ID: <YEaQdXwrmVekXp4G@lunn.ch> (raw)
In-Reply-To: <20210308184102.3921-3-noltari@gmail.com>

> +static int bcm6368_mdiomux_probe(struct platform_device *pdev)
> +{
> +	struct bcm6368_mdiomux_desc *md;
> +	struct mii_bus *bus;
> +	struct resource *res;
> +	int rc;
> +
> +	md = devm_kzalloc(&pdev->dev, sizeof(*md), GFP_KERNEL);
> +	if (!md)
> +		return -ENOMEM;
> +	md->dev = &pdev->dev;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -EINVAL;
> +
> +	/* Just ioremap, as this MDIO block is usually integrated into an
> +	 * Ethernet MAC controller register range
> +	 */
> +	md->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> +	if (!md->base) {
> +		dev_err(&pdev->dev, "failed to ioremap register\n");
> +		return -ENOMEM;
> +	}
> +
> +	md->mii_bus = devm_mdiobus_alloc(&pdev->dev);
> +	if (!md->mii_bus) {
> +		dev_err(&pdev->dev, "mdiomux bus alloc failed\n");
> +		return ENOMEM;
> +	}
> +
> +	bus = md->mii_bus;
> +	bus->priv = md;
> +	bus->name = "BCM6368 MDIO mux bus";
> +	snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id);
> +	bus->parent = &pdev->dev;
> +	bus->read = bcm6368_mdiomux_read;
> +	bus->write = bcm6368_mdiomux_write;
> +	bus->phy_mask = 0x3f;
> +	bus->dev.of_node = pdev->dev.of_node;
> +
> +	rc = mdiobus_register(bus);
> +	if (rc) {
> +		dev_err(&pdev->dev, "mdiomux registration failed\n");
> +		return rc;
> +	}

So this is different to all the other mux drivers. Normally there is
an MDIO driver. And there is a mux driver. Two separate drivers. The
mux driver uses a phandle to reference the MDIO driver. Here we have
both in one driver.

Does this MDIO bus device exist as a standalone device? Without the
mux? If silicon does exist like that, having two separate drivers
would be better.

     Andrew

  parent reply	other threads:[~2021-03-08 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 18:41 [PATCH 0/2] net: mdio: Add BCM6368 MDIO mux bus controller Álvaro Fernández Rojas
2021-03-08 18:41 ` [PATCH 1/2] dt-bindings: net: Add bcm6368-mdio-mux bindings Álvaro Fernández Rojas
2021-03-08 20:54   ` Andrew Lunn
2021-03-15 13:51     ` Álvaro Fernández Rojas
2021-03-08 18:41 ` [PATCH 2/2] net: mdio: Add BCM6368 MDIO mux bus controller Álvaro Fernández Rojas
2021-03-08 19:57   ` Jakub Kicinski
2021-03-15 13:53     ` Álvaro Fernández Rojas
2021-03-08 21:00   ` Andrew Lunn [this message]
2021-03-15 14:02     ` Álvaro Fernández Rojas
2021-03-17 17:49       ` Andrew Lunn
2021-03-17 21:42         ` Florian Fainelli

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=YEaQdXwrmVekXp4G@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=robh+dt@kernel.org \
    /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).