lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEaQdXwrmVekXp4G@lunn.ch>
Date:   Mon, 8 Mar 2021 22:00:37 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Álvaro Fernández Rojas <noltari@...il.com>
Cc:     jonas.gorski@...il.com, "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] net: mdio: Add BCM6368 MDIO mux bus controller

> +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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ