Re: [RFC PATCH] drivers: phy: add generic PHY framework

From: Felipe Balbi
Date: Fri Sep 14 2012 - 09:17:20 EST


On Fri, Sep 14, 2012 at 02:28:19PM +0200, Marc Kleine-Budde wrote:
> On 09/14/2012 01:58 PM, Kishon Vijay Abraham I wrote:
> > The PHY framework provides a set of API's for the PHY drivers to
> > create/remove a PHY and the PHY users to obtain a reference to the PHY
> > using or without using phandle. If the PHY users has to obtain a reference to
> > the PHY without using phandle, the platform specfic intialization code (say
> > from board file) should have already called phy_bind with the binding
> > information. The binding information consists of phy's device name, phy
> > user device name and an index. The index is used when the same phy user
> > binds to mulitple phys.
> >
> > PHY drivers should create the PHY by passing phy_descriptor that has
> > information about the PHY and ops like init, exit, suspend, resume,
> > poweron, shutdown.
>
> Some comments inside.
>
> While looking over the code, I was thinking why not abstract the phy
> with a "bus" in the linux kernel. The ethernet phys are on the mdio_bus,
> see /sys/bus/mdio_bus. This saves you hand crafting devices, drivers and
> bindings,

I don't think that's a good idea, actually. You can have USB PHYs which
are memory mapped, or connected through i2c, or connected through any
other bus. If the PHYs layer itself is a bus, it means we will need to
register a device on two different buses, which doesn't sound very
nice IMHO.

--
balbi

Attachment: signature.asc
Description: Digital signature