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]
Date:	Thu, 20 Jun 2013 11:36:36 +0100
From:	Florian Fainelli <florian@...nwrt.org>
To:	Alexey Brodkin <Alexey.Brodkin@...opsys.com>
Cc:	Andy Shevchenko <andy.shevchenko@...il.com>,
	netdev <netdev@...r.kernel.org>,
	Francois Romieu <romieu@...zoreil.com>,
	Joe Perches <joe@...ches.com>,
	Vineet Gupta <Vineet.Gupta1@...opsys.com>,
	Mischa Jonker <Mischa.Jonker@...opsys.com>,
	Arnd Bergmann <arnd@...db.de>,
	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <rob.herring@...xeda.com>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	"David S. Miller" <davem@...emloft.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Devicetree Discuss <devicetree-discuss@...ts.ozlabs.org>
Subject: Re: [PATCH v5] ethernet/arc/arc_emac - Add new driver

2013/6/20 Alexey Brodkin <Alexey.Brodkin@...opsys.com>:
> On 06/20/2013 01:57 PM, Florian Fainelli wrote:
>> 2013/6/20 Alexey Brodkin <Alexey.Brodkin@...opsys.com>:
>> [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)
>
> Good explanation. I didn't realize it yet.
> And it seems like I talked about bus "name", not "id".
>
>> 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@...dbeef) which would be exactly equivalent to what you are doing
>> with priv->regs;
>
> The thing is I don't have separate "mdio" device description in DT.
> Regs value is read from "ethernet" device description.
>
> Here's my DT entry for entire emac:
> =============
>                 ethernet@...c2000 {
>                         compatible = "snps,arc-emac";
>                         reg = <0xc0fc2000 0x3c>;
>                         interrupts = <6>;
>                         mac-address = [ 00 11 22 33 44 55 ];
>                         clock-frequency = <80000000>;
>                         max-speed = <100>;
>                         phy = <&phy0>;
>
>                         #address-cells = <1>;
>                         #size-cells = <0>;
>                         phy0: ethernet-phy@0 {
>                                 reg = <1>;
>                         };
>                 };
> =============
>
> So with your proposal bus id will be just "ethernet" which is not that
> unique, right?

No, it would be c0fc2000, which is, so we are just fine. Drivers that
support DT instantiation or platform_device/driver should in general
use <pdev->name>-<pdev->id> which works fine in both cases.
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ