Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935395Ab3FTKQQ (ORCPT ); Thu, 20 Jun 2013 06:16:16 -0400 Received: from us02smtp1.synopsys.com ([198.182.60.75]:41334 "EHLO vaxjo.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965163Ab3FTKQM convert rfc822-to-8bit (ORCPT ); Thu, 20 Jun 2013 06:16:12 -0400 From: Alexey Brodkin To: Florian Fainelli CC: Andy Shevchenko , netdev , Francois Romieu , Joe Perches , Vineet Gupta , Mischa Jonker , Arnd Bergmann , Grant Likely , Rob Herring , "Paul Gortmaker" , "David S. Miller" , "linux-kernel@vger.kernel.org" , Devicetree Discuss Subject: Re: [PATCH v5] ethernet/arc/arc_emac - Add new driver Thread-Topic: [PATCH v5] ethernet/arc/arc_emac - Add new driver Thread-Index: AQHObMTB0pUCWSTLfkKwzmR6uOQoOA== Date: Thu, 20 Jun 2013 10:16:04 +0000 Message-ID: <4881796E12491D4BB15146FE0209CE643F5F30BF@DE02WEMBXB.internal.synopsys.com> References: <1371629537-8076-1-git-send-email-abrodkin@synopsys.com> <4881796E12491D4BB15146FE0209CE643F5F2F56@DE02WEMBXB.internal.synopsys.com> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2313 Lines: 73 On 06/20/2013 01:57 PM, Florian Fainelli wrote: > 2013/6/20 Alexey Brodkin : > [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@deadbeef) 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@c0fc2000 { 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? That's why address of registers IMHO fits better to a bus id. -Alexey -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/