From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH] [v7] net: emac: emac gigabit ethernet controller driver Date: Wed, 17 Aug 2016 15:48:22 -0700 Message-ID: References: <1470255143-3979-1-git-send-email-timur@codeaurora.org> <20160804175541.GA2832@rob-hp-laptop> <57B220C0.3060608@codeaurora.org> <57B31780.5030106@codeaurora.org> <57B3878D.1000805@codeaurora.org> <57B4C6EE.3080903@codeaurora.org> <57B4E5F7.9040500@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <57B4E5F7.9040500-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Timur Tabi , Al Stone , Rob Herring Cc: netdev , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , linux-arm-msm , Sagar Dharia , Shanker Donthineni , Vikram Sethi , Christopher Covington , Gilad Avidov , Andrew Lunn , Bjorn Andersson , Mark Langsdorf , "jcm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org" , Andy Gross , David Miller , Lino Sanfilippo , "Rafael J. Wysocki" , "Abdulhamid, Harb" List-Id: linux-arm-msm@vger.kernel.org On 08/17/2016 03:32 PM, Timur Tabi wrote: > Timur Tabi wrote: >>> >>> Nothing prevents you from detailing in ACPI or DT sub-components of a >>> larger HW block, if there is such a desire, but just make it in a way >>> that it looks like what would be done for e.g: separate discrete parts, >>> only the parenting of nodes would change. >> >> So instead of just having a single property, instead create a child node >> just for the SGMII phy, with its own compatible string and various other >> properties (like interrupt and base register)? That's not a bad idea. > > I need help getting this to work. > > emac0: ethernet@38800000 { > compatible = "qcom,qdf2432-emac"; > reg-names = "base", "csr"; > reg = <0x0 0x38800000 0x0 0x10000 >, > <0x0 0x38816000 0x0 0x1000>, > <0x0 0x3881C000 0x0 0x4000>; > interrupts = <0 0x100 0 0 0x104 0>; > interrupt-names = "core0", "sgmii"; > > sgmii-handle = <&emac_sgmii>; > phy-handle = <&phy0>; > > #address-cells = <1>; > #size-cells = <0>; > phy0: ethernet-phy@4 { > reg = <4>; > }; > }; > > emac_sgmii: ethernet-phy@410400 { > compatible = "qcom,qdf2432-emac-phy"; > reg = <0x0 0x00410400 0x0 0x100>; > interrupts = <0 0x104 0>; > }; > Is this register range relative to the emac0 node here, or is this really a separate node, within the same adress space as your emac0 node? > When my driver probes, the platform_device object points to the emac0 > node, as always. > > How do I parse the emac_sgmii node? How do I get functions like > platform_get_resource() to work? How do I create a new platform_device > object that points to the emac_sgmii node? Answer largely depends on whether your device is really located outside of the emac, if it located outside, then a platform device matching the compatible string would get you what you want. If the emac_sgmii block is a sub-block within the EMAC, then a few things need fixing: - your emac_sgmii node should be a sub-node of the emac node, not a sibling - the emac0 node should have a "ranges" property that indicates how to translate the sub-nodes' "reg" property based on the base register address of the emac0 block - you would have to call of_platform_populate from the EMAC driver to ensure that the emac_sgmii child node and therefore platform device gets created -- Florian -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html