Re: [PATCH v5] ethernet/arc/arc_emac - Add new driver

From: Florian Fainelli
Date: Thu Jun 20 2013 - 05:57:33 EST


2013/6/20 Alexey Brodkin <Alexey.Brodkin@xxxxxxxxxxxx>:
[snip]

>
> In general MDIO register gets polled by "libphy" once in a couple of
> seconds, so delay of 25 milliseconds IMHO is fine.
>
>>> +int arc_mdio_probe(struct device_node *dev_node, struct arc_emac_priv *priv)
>>> +{
>>
>>> + snprintf(bus->id, MII_BUS_ID_SIZE, "%.8x", (unsigned int)priv->regs);
>>
>> Is bus->id exposed to user-space somehow?
>
> Well as a boot-up message from "libphy":
> ====
> libphy: Synopsys MII Bus: probed
> ====

Well not only as a boot-up message, this serves as unique identifer in
the entire system for your MDIO bus. It is crucial that you have an
unique MDIO bus identifier for at least the two following reasons:

- the corresponding kobject/sysfs node that is going to be created
also needs to be unique in the system
- you may have multiple MDIO bus in the system (e.g: the one for your
specific driver and the fixed MDIO bus)

Since you are using Device Tree already, you may just turn this into:

snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);

assuming that your node is already properly labelleled (e.g:
mdio@deadbeef) which would be exactly equivalent to what you are doing
with priv->regs;
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/