08 Oct, 2014

1 commit

  • Adjust fixed_phy_register() to return struct phy_device *, so that
    it becomes easy to use fixed PHYs without device tree support:

    phydev = fixed_phy_register(PHY_POLL, &fixed_phy_status, NULL);
    fixed_phy_set_link_update(phydev, fixed_phy_link_update);
    phy_connect_direct(netdev, phydev, handler_fn, phy_interface);

    This change is a prerequisite for modifying bcmgenet driver to work
    without a device tree on Broadcom's MIPS-based 7xxx platforms.

    Signed-off-by: Petri Gynther
    Signed-off-by: David S. Miller

    Petri Gynther
     

20 Sep, 2014

1 commit

  • Commit f9a8f83b04e0 ("net: phy: remove flags argument from phy_{attach,
    connect, connect_direct}") removed the flags argument to the PHY library
    calls to: phy_{attach,connect,connect_direct}.

    Most Device Tree aware drivers call of_phy_connect() with the flag
    argument set to 0, but some of them might want to set a different value
    there in order for the PHY driver to key a specific behavior based on
    the phy_device::phy_flags value.

    Allow such drivers to set custom phy_flags as part of the
    of_phy_connect() call since of_phy_connect() does start the PHY state
    machine, it will call into the PHY driver config_init() callback which
    is usually where a specific phy_flags value is important.

    Fixes: f9a8f83b04e0 ("net: phy: remove flags argument from phy_{attach, connect, connect_direct}")
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

02 Jul, 2014

1 commit

  • Commit 86f6cf4127 (net: of_mdio: add of_mdiobus_link_phydev()) introduced a
    circular dependency between libphy and of_mdio.

    depmod: ERROR: /kernel/drivers/net/phy/libphy.ko in
    dependency cycle!
    depmod: ERROR: /kernel/drivers/of/of_mdio.ko in dependency cycle!

    The problem is that of_mdio.c references &mdio_bus_type and libphy now
    references of_mdiobus_link_phydev.

    Fix this by not exporting of_mdiobus_link_phydev() from of_mdio.ko.
    Make it a static function in mdio_bus.c instead.

    Signed-off-by: Daniel Mack
    Reported-by: Jeff Mahoney
    Fixes: 86f6cf4127 (net: of_mdio: add of_mdiobus_link_phydev())
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Daniel Mack
     

23 Jun, 2014

1 commit


03 Jun, 2014

2 commits


30 May, 2014

3 commits


26 May, 2014

1 commit

  • Commit de906af1 (net: phy: make of_set_phy_supported work with genphy driver)
    removed the last user of variable 'max_speed' in function
    of_mdiobus_register_phy(), leading to compile warning "unused variable
    ‘max_speed’ [-Wunused-variable]". Thus remove it.

    Signed-off-by: Christian Engelmayer
    Acked-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Christian Engelmayer
     

23 May, 2014

2 commits

  • of_set_phy_supported allows overwiting hardware capabilities of
    a phy with values from the devicetree. of_set_phy_supported is
    called right after phy_device_register in the assumption that
    phy_probe is called from phy_device_register and the features
    of the phy are already initialized. For the genphy driver this
    is not true, here phy_probe is called later during phy_connect
    time. phy_probe will then overwrite all settings done from
    of_set_phy_supported
    Fix this by moving of_set_phy_supported to the core phy code
    and calling it from phy_probe.

    Signed-off-by: Sascha Hauer
    Signed-off-by: David S. Miller

    Sascha Hauer
     
  • All in-tree drivers have been converted to use the new pair of
    functions: of_is_fixed_phy_link() plus of_phy_register_fixed_link(), we
    can now safely remove of_phy_connect_fixed_link.

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

17 May, 2014

1 commit

  • Some Ethernet MACs have a "fixed link", and are not connected to a
    normal MDIO-managed PHY device. For those situations, a Device Tree
    binding allows to describe a "fixed link" using a special PHY node.

    This patch adds:

    * A documentation for the fixed PHY Device Tree binding.

    * An of_phy_is_fixed_link() function that an Ethernet driver can call
    on its PHY phandle to find out whether it's a fixed link PHY or
    not. It should typically be used to know if
    of_phy_register_fixed_link() should be called.

    * An of_phy_register_fixed_link() function that instantiates the
    fixed PHY into the PHY subsystem, so that when the driver calls
    of_phy_connect(), the PHY device associated to the OF node will be
    found.

    These two additional functions also support the old fixed-link Device
    Tree binding used on PowerPC platforms, so that ultimately, the
    network device drivers for those platforms could be converted to use
    of_phy_is_fixed_link() and of_phy_register_fixed_link() instead of
    of_phy_connect_fixed_link(), while keeping compatibility with their
    respective Device Tree bindings.

    Signed-off-by: Thomas Petazzoni
    Reviewed-by: Florian Fainelli
    Tested-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Thomas Petazzoni
     

21 Mar, 2014

1 commit

  • This makes the generic of_mdiobus_register parse the DT compatible string for
    the pattern ethernet-phy-idAAAA.BBBB. If present it should be a value that
    matches the phy-id register normally readable through MDIO.

    When the ID is given the phy autoprobing is defeated and the phy is
    created directly.

    This is necessary to support phy's that cannot be autoprobed when
    of_mdiobus_register is called. Specifically, my case has the phy in reset at
    of_mdiobus_register, the reset is only released once the ethernet driver
    starts, before it attaches to the phy.

    Tested on ARM Kirkwood with phy id 0x01410e90 (Marvell 88E1318)

    Signed-off-by: Jason Gunthorpe
    Acked-by: Florian Fainelli
    Acked-by: Rob Herring
    Signed-off-by: David S. Miller

    Jason Gunthorpe
     

19 Feb, 2014

1 commit

  • The of_mdiobus_register_phy() is not setting phy->irq thus causing
    some drivers to incorrectly assume that the PHY does not have an
    IRQ associated with it. Not only do some drivers report no IRQ
    they do not install an interrupt handler for the PHY.

    Simplify the code setting irq and set the phy->irq at the same
    time so that we cover the following issues, which should cover
    all the cases the code will find:

    - Set phy->irq if node has irq property and mdio->irq is NULL
    - Set phy->irq if node has no irq and mdio->irq is not NULL
    - Leave phy->irq as PHY_POLL default if none of the above

    This fixes the issue:
    net eth0: attached PHY 1 (IRQ -1) to driver Micrel KSZ8041RNLI

    to the correct:
    net eth0: attached PHY 1 (IRQ 416) to driver Micrel KSZ8041RNLI

    Signed-off-by: Ben Dooks
    Signed-off-by: David S. Miller

    Ben Dooks
     

15 Feb, 2014

1 commit

  • Commit 8fdade4 ("net: of_mdio: parse "max-speed" property to set PHY
    supported features") introduced a typo in of_set_phy_supported for the
    first assignment of phydev->supported which will not effectively limit
    the PHY device supported features bits if the PHY driver contains
    "higher" features (e.g: max-speed = and PHY driver has
    PHY_GBIT_FEATURES set).

    Fix this by making sure that the very first thing is to reset to sane
    defaults (PHY_BASIC_FEATURES) and then progressively add speed features
    as we parse them.

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

14 Jan, 2014

1 commit

  • 10G PHYs don't currently support running the state machine, which
    is implicitly setup via of_phy_connect(). Therefore, it is necessary
    to implement an OF version of phy_attach(), which does everything
    except start the state machine.

    Signed-off-by: Andy Fleming
    Signed-off-by: Shaohui Xie
    Acked-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andy Fleming
     

07 Dec, 2013

4 commits


09 May, 2013

1 commit

  • of_mdiobus_register creates a phy_device even if get_phy_device failed
    to create it previously. This causes indefinite polling on non-existent
    PHYs. This fix makes of_mdio_register rely on get_phy_device to
    properly create the device or fail otherwise.

    Signed-off-by: Sebastian Hesselbarth
    Signed-off-by: David S. Miller

    Sebastian Hesselbarth
     

09 Apr, 2013

1 commit

  • Using DT for mdiobus and ethernet-phy requires to know the PHY address, which
    is hard to guess if you don't know it. This patch extends of_mdiobus_register
    to scan mdiobus for PHYs if reg property of the corresponding node is not set.
    This also allows to have phy nodes in SoC DT files where the reg property can
    be overwritten in the board file later. To encourage people to finally set the
    actual phy address, the mdiobus scan is noisier than required.

    Signed-off-by: Sebastian Hesselbarth
    Signed-off-by: David S. Miller

    Sebastian Hesselbarth
     

15 Jan, 2013

1 commit

  • The flags argument of the phy_{attach,connect,connect_direct} functions
    is then used to assign a struct phy_device dev_flags with its value.
    All callers but the tg3 driver pass the flag 0, which results in the
    underlying PHY drivers in drivers/net/phy/ not being able to actually
    use any of the flags they would set in dev_flags. This patch gets rid of
    the flags argument, and passes phydev->dev_flags to the internal PHY
    library call phy_attach_direct() such that drivers which actually modify
    a phy device dev_flags get the value preserved for use by the underlying
    phy driver.

    Acked-by: Kosta Zertsekel
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

30 Nov, 2012

1 commit

  • Currently of_mdiobus_register() function registers all PHY devices,
    independetly from their status property in device tree. According to
    "ePAPR 1.1" spec, device should only be registered if there is no
    "status" property, or it has "ok" (or "okay") value (see
    of_device_is_available()). In case of "platform devices",
    of_platform_device_create_pdata() checks for "status" and ensures
    that disabled devices are not pupulated. But such check for MDIO buses
    was missing until now. Fix it.

    Signed-off-by: Alexander Sverdlin
    Signed-off-by: Grant Likely

    Alexander Sverdlin
     

28 Jun, 2012

2 commits

  • Define two new "compatible" values for Ethernet
    PHYs. "ethernet-phy-ieee802.3-c22" and "ethernet-phy-ieee802.3-c45"
    are used to indicate a PHY uses the corresponding protocol.

    If a PHY is "compatible" with "ethernet-phy-ieee802.3-c45", we
    indicate this so that get_phy_device() can properly probe the device.

    If get_phy_device() fails, it was probably due to failing the probe of
    the PHY identifier registers. Since we have the device tree telling
    us the PHY exists, go ahead and add it anyhow with a phy_id of zero.
    There may be a driver match based on the "compatible" property.

    Signed-off-by: David Daney
    Signed-off-by: David S. Miller

    David Daney
     
  • The IEEE802.3 clause 45 MDIO bus protocol allows for directly
    addressing PHY registers using a 21 bit address, and is used by many
    10G Ethernet PHYS. Already existing is the ability of MDIO bus
    drivers to use clause 45, with the MII_ADDR_C45 flag. Here we add
    struct phy_c45_device_ids to hold the device identifier registers
    present in clause 45. struct phy_device gets a couple of new fields:
    c45_ids to hold the identifiers and is_c45 to signal that it is clause
    45.

    get_phy_device() gets a new parameter is_c45 to indicate that the PHY
    device should use the clause 45 protocol, and its callers are adjusted
    to pass false. The follow-on patch to of_mdio.c will pass true where
    appropriate.

    EXPORT phy_device_create() so that the follow-on patch to of_mdio.c
    can use it to create phy devices for PHYs, that have non-standard
    device identifier registers, based on the device tree bindings.

    Signed-off-by: David Daney
    Signed-off-by: David S. Miller

    David Daney
     

08 May, 2012

1 commit

  • Add of_mdio_find_bus() which allows an mii_bus to be located given its
    associated the device tree node.

    This is needed by the follow-on patch to add a driver for MDIO bus
    multiplexers.

    The of_mdiobus_register() function is modified so that the device tree
    node is recorded in the mii_bus. Then we can find it again by
    iterating over all mdio_bus_class devices.

    Because the OF device tree has now become an integral part of the
    kernel, this can live in mdio_bus.c (which contains the needed
    mdio_bus_class structure) instead of of_mdio.c.

    Signed-off-by: David Daney
    Cc: Grant Likely
    Cc: "David S. Miller"
    Signed-off-by: David S. Miller

    David Daney
     

28 Feb, 2012

1 commit

  • Since 9e6c643b (phy/fixed: use an unique MDIO bus name) the name of the fixed
    PHY bus is "fixed-0". Teach of_phy_connect_fixed_link() the new name.

    Tested on a P1020RDB PowerPC system.

    Signed-off-by: Baruch Siach
    Acked-by: Florian Fainelli
    Signed-off-by: Rob Herring

    Baruch Siach
     

25 Oct, 2011

1 commit


31 Mar, 2011

1 commit


24 Dec, 2010

1 commit

  • In of_mdiobus_register(), the __be32 *addr variable is dereferenced.
    This will not work on little-endian targets. Also since it is
    unsigned, checking for less than zero is redundant.

    Fix these two issues.

    Signed-off-by: David Daney
    [grant.likely@secretlab.ca: removed goto]
    Signed-off-by: Grant Likely

    David Daney
     

29 Jun, 2010

1 commit

  • Merge common code between PowerPC and Microblaze. SPARC implements
    irq_of_parse_and_map(), but the implementation is different, so it
    does not use this code.

    Signed-off-by: Grant Likely
    Acked-by: Benjamin Herrenschmidt
    Cc: Michal Simek
    Cc: "David S. Miller"
    Cc: Stephen Rothwell
    Cc: Jeremy Kerr

    Grant Likely
     

22 May, 2010

1 commit


19 May, 2010

2 commits

  • This patch eliminates the node pointer from struct of_device and the
    of_node (or prom_node) pointer from struct dev_archdata since the node
    pointer is now part of struct device proper when CONFIG_OF is set, and
    all users of the old pointer locations have already been converted over
    to use device->of_node.

    Also remove dev_archdata_{get,set}_node() as it is no longer used by
    anything.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • The following structure elements duplicate the information in
    'struct device.of_node' and so are being eliminated. This patch
    makes all readers of these elements use device.of_node instead.

    (struct of_device *)->node
    (struct dev_archdata *)->prom_node (sparc)
    (struct dev_archdata *)->of_node (powerpc & microblaze)

    Signed-off-by: Grant Likely

    Grant Likely
     

29 Apr, 2010

1 commit

  • Currently, platforms using CONFIG_OF add a 'struct device_node *of_node'
    to dev->archdata. However, with CONFIG_OF becoming generic for all
    architectures, it makes sense for commonality to move it out of archdata
    and into struct device proper.

    This patch adds a struct device_node *of_node member to struct device
    and updates all locations which currently write the device_node pointer
    into archdata to also update dev->of_node. Subsequent patches will
    modify callers to use the archdata location and ultimately remove
    the archdata member entirely.

    Signed-off-by: Grant Likely
    Acked-by: Greg Kroah-Hartman
    CC: Michal Simek
    CC: Greg Kroah-Hartman
    CC: Benjamin Herrenschmidt
    CC: "David S. Miller"
    CC: Stephen Rothwell
    CC: Jeremy Kerr
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linux-kernel@vger.kernel.org
    CC: linuxppc-dev@ozlabs.org
    CC: sparclinux@vger.kernel.org

    Grant Likely
     

28 Apr, 2010

1 commit


09 Feb, 2010

1 commit

  • Properties in the device tree are specified as big-endian. At present,
    the only platforms to support device trees are also big-endian, so we've
    been acessing the properties as raw values.

    We'd like to add device tree support to little-endian platforms too, so
    add endian conversion to the sites where we access property values in
    the common of code.

    Compiled on powerpc (ppc44x_defconfig & ppc64_defconfig) and arm (fdt
    support only for now).

    Signed-off-by: Jeremy Kerr
    Signed-off-by: Grant Likely

    Jeremy Kerr
     

15 Oct, 2009

1 commit