14 Jun, 2017

1 commit

  • The of_mdio_parse_addr() helper function is useful to other code, but
    the module dependency chain causes issues. To work around this, we can
    move of_mdio_parse_addr() to be an inline function in the header file.
    This gets rid of the dependencies and still allows for the reuse of
    code.

    Reported-by: Liviu Dudau
    Signed-off-by: Jon Mason
    Fixes: 342fa1964439 ("mdio: mux: make child bus walking more permissive and errors more verbose")
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Jon Mason
     

25 Mar, 2017

1 commit


30 Nov, 2016

1 commit

  • Add helper to deregister fixed-link PHYs registered using
    of_phy_register_fixed_link().

    Convert the two drivers that care to deregister their fixed-link PHYs to
    use the new helper, but note that most drivers currently fail to do so.

    Signed-off-by: Johan Hovold
    Signed-off-by: David S. Miller

    Johan Hovold
     

17 Jul, 2016

1 commit


28 Jun, 2016

1 commit

  • Calling the fixed-phy functions when CONFIG_FIXED_PHY=m as a previous
    change tried cannot work if the caller is in built-in code:

    drivers/of/built-in.o: In function `of_phy_register_fixed_link':
    of_reserved_mem.c:(.text+0x85e0): undefined reference to `fixed_phy_register'

    Making of_mdio depend on 'FIXED_PHY || !FIXED_PHY' would solve this
    dependency by enforcing that OF_MDIO itself becomes a loadable module
    when FIXED_PHY=y, but that creates a different dependency as it
    breaks any built-in ethernet driver that uses of_mdio.

    Making FIXED_PHY a bool option also cannot work, since it depends on
    PHYLIB, which again is tristate.

    This version now uses 'select FIXED_PHY' to ensure that the fixed-phy
    portion of of_mdio is not optional. The main downside of this is
    a small increase in code size for cases that do not need fixed phy
    support, but it should avoid all of the link-time problems.

    Signed-off-by: Arnd Bergmann
    Fixes: d1bd330a229f ("of_mdio: Enable fixed PHY support if driver is a module")
    Acked-by: Randy Dunlap
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

24 Jun, 2016

1 commit


12 Mar, 2015

1 commit

  • Export of_mdio_parse_addr() which allows parsing a given Ethernet PHY
    node MDIO address, verify it is within the allowed range, and return
    its value. This is going to be useful for the DSA code which needs to
    deal with multiple layers of MDIO buses.

    Signed-off-by: Florian Fainelli
    Acked-by: Rob Herring
    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
     

30 May, 2014

1 commit

  • Add a function to walk the list of subnodes of a mdio bus and look for
    a node that matches the phy's address with its 'reg' property. If found,
    set the of_node pointer for the phy. This allows auto-probed pyh
    devices to be augmented by information passed in via DT.

    Signed-off-by: Daniel Mack
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Daniel Mack
     

23 May, 2014

1 commit


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
     

08 May, 2014

1 commit


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
     

11 Oct, 2012

1 commit

  • The !CONFIG_OF stubs aren't static so if multiple files include the
    header with this configuration then the linker will see multiple
    definitions of the stubs.

    Reported-by: Fengguang Wu
    Signed-off-by: Mark Brown
    Acked-by: Thomas Petazzoni
    Acked-by: Srinivas Kandagatla
    Signed-off-by: David S. Miller

    Mark Brown
     

31 Aug, 2012

1 commit


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
     

23 Jul, 2009

1 commit

  • Fixed-link support is broken for the ucc_eth, gianfar, and fs_enet
    device drivers. The "OF MDIO rework" patches removed most of the
    support. Instead of re-adding fixed-link stuff to the drivers, this
    patch adds a support function for parsing the fixed-link property
    and obtaining a dummy phy to match.

    Note: the dummy phy handling in arch/powerpc is a bit of a hack and
    needs to be reworked. This function is being added now to solve the
    regression in the Ethernet drivers, but it should be considered a
    temporary measure until the fixed link handling can be reworked.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Grant Likely
    Signed-off-by: David S. Miller

    Anton Vorontsov
     

27 Apr, 2009

1 commit

  • Add support for parsing the device tree for PHY devices on an MDIO bus.
    Currently many of the PowerPC ethernet drivers are open coding a solution
    for reading data out of the device tree to find the correct PHY device.
    This patch implements a set of common routines to:

    a) let MDIO bus drivers register phy_devices described in the tree, and
    b) let MAC drivers find the correct phy_device via the tree.

    Signed-off-by: Grant Likely
    Acked-by: Andy Fleming
    Signed-off-by: David S. Miller

    Grant Likely