1. 21 9月, 2021 1 次提交
  2. 18 9月, 2021 1 次提交
    • F
      net: bcmgenet: Patch PHY interface for dedicated PHY driver · b972b54a
      Florian Fainelli 提交于
      When we are using a dedicated PHY driver (not the Generic PHY driver)
      chances are that it is going to configure RGMII delays and do that in a
      way that is incompatible with our incorrect interpretation of the
      phy_interface value.
      
      Add a quirk in order to reverse the PHY_INTERFACE_MODE_RGMII to the
      value of PHY_INTERFACE_MODE_RGMII_ID such that the MAC continues to be
      configured the way it used to be, but the PHY driver can account for
      adding delays. Conversely when PHY_INTERFACE_MODE_RGMII_TXID is
      specified, return PHY_INTERFACE_MODE_RGMII_RXID to the PHY since we will
      have enabled a TXC MAC delay (id_mode_dis=0, meaning there is a delay
      inserted).
      
      This is not considered a bug fix at this point since it only affects
      Broadcom STB platforms shipping with a Device Tree blob that is not
      updatable in the field (quite a few devices out there) and which was
      generated using the scripted Device Tree environment shipped with those
      platforms' SDK.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b972b54a
  3. 08 6月, 2021 1 次提交
  4. 16 2月, 2021 1 次提交
  5. 09 1月, 2021 1 次提交
  6. 24 8月, 2020 1 次提交
  7. 18 3月, 2020 2 次提交
    • D
      net: bcmgenet: keep MAC in reset until PHY is up · 88f6c8bf
      Doug Berger 提交于
      As noted in commit 28c2d1a7 ("net: bcmgenet: enable loopback
      during UniMAC sw_reset") the UniMAC must be clocked at least 5
      cycles while the sw_reset is asserted to ensure a clean reset.
      
      That commit enabled local loopback to provide an Rx clock from the
      GENET sourced Tx clk. However, when connected in MII mode the Tx
      clk is sourced by the PHY so if an EPHY is not supplying clocks
      (e.g. when the link is down) the UniMAC does not receive the
      necessary clocks.
      
      This commit extends the sw_reset window until the PHY reports that
      the link is up thereby ensuring that the clocks are being provided
      to the MAC to produce a clean reset.
      
      One consequence is that if the system attempts to enter a Wake on
      LAN suspend state when the PHY link has not been active the MAC
      may not have had a chance to initialize cleanly. In this case, we
      remove the sw_reset and enable the WoL reception path as normal
      with the hope that the PHY will provide the necessary clocks to
      drive the WoL blocks if the link becomes active after the system
      has entered suspend.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88f6c8bf
    • D
      Revert "net: bcmgenet: use RGMII loopback for MAC reset" · 612eb1c3
      Doug Berger 提交于
      This reverts commit 3a55402c.
      
      This is not a good solution when connecting to an external switch
      that may not support the isolation of the TXC signal resulting in
      output driver contention on the pin.
      
      A different solution is necessary.
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      612eb1c3
  8. 27 2月, 2020 1 次提交
  9. 25 2月, 2020 2 次提交
  10. 13 11月, 2019 2 次提交
  11. 07 11月, 2019 2 次提交
    • D
      Revert "net: bcmgenet: soft reset 40nm EPHYs before MAC init" · 6b6d017f
      Doug Berger 提交于
      This reverts commit 1f515486.
      
      This commit improved the chances of the umac resetting cleanly by
      ensuring that the PHY was restored to its normal operation prior
      to resetting the umac. However, there were still cases when the
      PHY might not be driving a Tx clock to the umac during this window
      (e.g. when the PHY detects no link).
      
      The previous commit now ensures that the unimac receives clocks
      from the MAC during its reset window so this commit is no longer
      needed. This commit also has an unintended negative impact on the
      MDIO performance of the UniMAC MDIO interface because it is used
      before the MDIO interrupts are reenabled, so it should be removed.
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6b6d017f
    • D
      net: bcmgenet: use RGMII loopback for MAC reset · 3a55402c
      Doug Berger 提交于
      As noted in commit 28c2d1a7 ("net: bcmgenet: enable loopback
      during UniMAC sw_reset") the UniMAC must be clocked while sw_reset
      is asserted for its state machines to reset cleanly.
      
      The transmit and receive clocks used by the UniMAC are derived from
      the signals used on its PHY interface. The bcmgenet MAC can be
      configured to work with different PHY interfaces including MII,
      GMII, RGMII, and Reverse MII on internal and external interfaces.
      Unfortunately for the UniMAC, when configured for MII the Tx clock
      is always driven from the PHY which places it outside of the direct
      control of the MAC.
      
      The earlier commit enabled a local loopback mode within the UniMAC
      so that the receive clock would be derived from the transmit clock
      which addressed the observed issue with an external GPHY disabling
      it's Rx clock. However, when a Tx clock is not available this
      loopback is insufficient.
      
      This commit implements a workaround that leverages the fact that
      the MAC can reliably generate all of its necessary clocking by
      enterring the external GPHY RGMII interface mode with the UniMAC in
      local loopback during the sw_reset interval. Unfortunately, this
      has the undesirable side efect of the RGMII GTXCLK signal being
      driven during the same window.
      
      In most configurations this is a benign side effect as the signal
      is either not routed to a pin or is already expected to drive the
      pin. The one exception is when an external MII PHY is expected to
      drive the same pin with its TX_CLK output creating output driver
      contention.
      
      This commit exploits the IEEE 802.3 clause 22 standard defined
      isolate mode to force an external MII PHY to present a high
      impedance on its TX_CLK output during the window to prevent any
      contention at the pin.
      
      The MII interface is used internally with the 40nm internal EPHY
      which agressively disables its clocks for power savings leading to
      incomplete resets of the UniMAC and many instabilities observed
      over the years. The workaround of this commit is expected to put
      an end to those problems.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3a55402c
  12. 05 11月, 2019 1 次提交
    • A
      net: of_get_phy_mode: Change API to solve int/unit warnings · 0c65b2b9
      Andrew Lunn 提交于
      Before this change of_get_phy_mode() returned an enum,
      phy_interface_t. On error, -ENODEV etc, is returned. If the result of
      the function is stored in a variable of type phy_interface_t, and the
      compiler has decided to represent this as an unsigned int, comparision
      with -ENODEV etc, is a signed vs unsigned comparision.
      
      Fix this problem by changing the API. Make the function return an
      error, or 0 on success, and pass a pointer, of type phy_interface_t,
      where the phy mode should be stored.
      
      v2:
      Return with *interface set to PHY_INTERFACE_MODE_NA on error.
      Add error checks to all users of of_get_phy_mode()
      Fixup a few reverse christmas tree errors
      Fixup a few slightly malformed reverse christmas trees
      
      v3:
      Fix 0-day reported errors.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c65b2b9
  13. 19 10月, 2019 1 次提交
    • D
      net: bcmgenet: soft reset 40nm EPHYs before MAC init · 1f515486
      Doug Berger 提交于
      It turns out that the "Workaround for putting the PHY in IDDQ mode"
      used by the internal EPHYs on 40nm Set-Top Box chips when powering
      down puts the interface to the GENET MAC in a state that can cause
      subsequent MAC resets to be incomplete.
      
      Rather than restore the forced soft reset when powering up internal
      PHYs, this commit moves the invocation of phy_init_hw earlier in
      the MAC initialization sequence to just before the MAC reset in the
      open and resume functions. This allows the interface to be stable
      and allows the MAC resets to be successful.
      
      The bcmgenet_mii_probe() function is split in two to accommodate
      this. The new function bcmgenet_mii_connect() handles the first
      half of the functionality before the MAC initialization, and the
      bcmgenet_mii_config() function is extended to provide the remaining
      PHY configuration following the MAC initialization.
      
      Fixes: 484bfa15 ("Revert "net: bcmgenet: Software reset EPHY after power on"")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1f515486
  14. 16 10月, 2019 2 次提交
  15. 19 6月, 2019 1 次提交
  16. 05 2月, 2019 1 次提交
    • L
      net: phy: fixed-phy: Drop GPIO from fixed_phy_add() · 5468e82f
      Linus Walleij 提交于
      All users of the fixed_phy_add() pass -1 as GPIO number
      to the fixed phy driver, and all users of fixed_phy_register()
      pass -1 as GPIO number as well, except for the device
      tree MDIO bus.
      
      Any new users should create a proper device and pass the
      GPIO as a descriptor associated with the device so delete
      the GPIO argument from the calls and drop the code looking
      requesting a GPIO in fixed_phy_add().
      
      In fixed phy_register(), investigate the "fixed-link"
      node and pick the GPIO descriptor from "link-gpios" if
      this property exists. Move the corresponding code out
      of of_mdio.c as the fixed phy code anyways requires
      OF to be in use.
      Tested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5468e82f
  17. 12 11月, 2018 1 次提交
  18. 24 10月, 2018 1 次提交
    • J
      net: bcmgenet: fix OF child-node lookup · d397dbe6
      Johan Hovold 提交于
      Use the new of_get_compatible_child() helper to lookup the mdio child
      node instead of using of_find_compatible_node(), which searches the
      entire tree from a given start node and thus can return an unrelated
      (i.e. non-child) node.
      
      This also addresses a potential use-after-free (e.g. after probe
      deferral) as the tree-wide helper drops a reference to its first
      argument (i.e. the node of the device being probed).
      
      Fixes: aa09677c ("net: bcmgenet: add MDIO routines")
      Cc: stable <stable@vger.kernel.org>     # 3.15
      Cc: David S. Miller <davem@davemloft.net>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      d397dbe6
  19. 16 10月, 2018 1 次提交
  20. 13 9月, 2018 2 次提交
  21. 30 8月, 2018 1 次提交
  22. 01 11月, 2017 1 次提交
  23. 26 10月, 2017 2 次提交
  24. 01 8月, 2017 4 次提交
  25. 24 6月, 2017 1 次提交
  26. 23 3月, 2017 1 次提交
    • D
      net: bcmgenet: remove bcmgenet_internal_phy_setup() · 31739eae
      Doug Berger 提交于
      Commit 6ac3ce82 ("net: bcmgenet: Remove excessive PHY reset")
      removed the bcmgenet_mii_reset() function from bcmgenet_power_up() and
      bcmgenet_internal_phy_setup() functions.  In so doing it broke the reset
      of the internal PHY devices used by the GENETv1-GENETv3 which required
      this reset before the UniMAC was enabled.  It also broke the internal
      GPHY devices used by the GENETv4 because the config_init that installed
      the AFE workaround was no longer occurring after the reset of the GPHY
      performed by bcmgenet_phy_power_set() in bcmgenet_internal_phy_setup().
      In addition the code in bcmgenet_internal_phy_setup() related to the
      "enable APD" comment goes with the bcmgenet_mii_reset() so it should
      have also been removed.
      
      Commit bd4060a6 ("net: bcmgenet: Power on integrated GPHY in
      bcmgenet_power_up()") moved the bcmgenet_phy_power_set() call to the
      bcmgenet_power_up() function, but failed to remove it from the
      bcmgenet_internal_phy_setup() function.  Had it done so, the
      bcmgenet_internal_phy_setup() function would have been empty and could
      have been removed at that time.
      
      Commit 5dbebbb4 ("net: bcmgenet: Software reset EPHY after power on")
      was submitted to correct the functional problems introduced by
      commit 6ac3ce82 ("net: bcmgenet: Remove excessive PHY reset"). It
      was included in v4.4 and made available on 4.3-stable. Unfortunately,
      it didn't fully revert the commit because this bcmgenet_mii_reset()
      doesn't apply the soft reset to the internal GPHY used by GENETv4 like
      the previous one did. This prevents the restoration of the AFE work-
      arounds for internal GPHY devices after the bcmgenet_phy_power_set() in
      bcmgenet_internal_phy_setup().
      
      This commit takes the alternate approach of removing the unnecessary
      bcmgenet_internal_phy_setup() function which shouldn't have been in v4.3
      so that when bcmgenet_mii_reset() was restored it should have only gone
      into bcmgenet_power_up().  This will avoid the problems while also
      removing the redundancy (and hopefully some of the confusion).
      
      Fixes: 6ac3ce82 ("net: bcmgenet: Remove excessive PHY reset")
      Signed-off-by: NDoug Berger <opendmb@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      31739eae
  27. 14 3月, 2017 1 次提交
  28. 30 11月, 2016 1 次提交
  29. 28 11月, 2016 1 次提交
  30. 27 9月, 2016 1 次提交
    • F
      Revert "net: ethernet: bcmgenet: use phydev from struct net_device" · 0299b6ac
      Florian Fainelli 提交于
      This reverts commit 62469c76 ("net: ethernet: bcmgenet: use phydev
      from struct net_device") because it causes GENETv1/2/3 adapters to
      expose the following behavior after an ifconfig down/up sequence:
      
      PING fainelli-linux (10.112.156.244): 56 data bytes
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.352 ms
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.472 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.496 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.517 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.536 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=1.557 ms (DUP!)
      64 bytes from 10.112.156.244: seq=1 ttl=61 time=752.448 ms (DUP!)
      
      This was previously fixed by commit 5dbebbb4 ("net: bcmgenet:
      Software reset EPHY after power on") but the commit we are reverting was
      essentially making this previous commit void, here is why.
      
      Without commit 62469c76 we would have the following scenario after
      an ifconfig down then up sequence:
      
      - bcmgenet_open() calls bcmgenet_power_up() to make sure the PHY is
        initialized *before* we get to initialize the UniMAC, this is
        critical to ensure the PHY is in a correct state, priv->phydev is
        valid, this code executes fine
      
      - second time from bcmgenet_mii_probe(), through the normal
        phy_init_hw() call (which arguably could be optimized out)
      
      Everything is fine in that case. With commit 62469c76, we would have
      the following scenario to happen after an ifconfig down then up
      sequence:
      
      - bcmgenet_close() calls phy_disonnect() which makes dev->phydev become
        NULL
      
      - when bcmgenet_open() executes again and calls bcmgenet_mii_reset() from
        bcmgenet_power_up() to initialize the internal PHY, the NULL check
        becomes true, so we do not reset the PHY, yet we keep going on and
        initialize the UniMAC, causing MAC activity to occur
      
      - we call bcmgenet_mii_reset() from bcmgenet_mii_probe(), but this is
        too late, the PHY is botched, and causes the above bogus pings/packets
        transmission/reception to occur
      Reported-by: NJaedon Shin <jaedon.shin@gmail.com>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0299b6ac