1. 21 7月, 2015 6 次提交
    • F
      net: bcmgenet: Remove init parameter from bcmgenet_mii_config · 28b45910
      Florian Fainelli 提交于
      Now that we have reworked the way we perform the PHY initialization, we
      no longer need to differentiate between init time vs. non-init time
      calls, just use a dev_info_once() print to print the PHY type.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28b45910
    • F
      net: bcmgenet: Delay PHY initialization to bcmgenet_open() · 6cc8e6d4
      Florian Fainelli 提交于
      We are currently doing a full PHY initialization and even starting the
      pHY state machine during bcmgenet_mii_init() which is executed in the
      driver's probe function. This is convenient to determine whether we can
      attach to a proper PHY device but comes at the expense of spending up to
      10ms per MDIO transactions (to reach the waitqueue timeout), which slows
      things down.
      
      This also creates a sitaution where we end-up attaching twice to the
      PHY, which is not quite correct either.
      
      Fix this by moving bcmgenet_mii_probe() into bcmgenet_open() and update
      its error path accordingly.
      
      Avoid printing the message "attached PHY at address 1 [...]" every time
      we bring up/down the interface and remove this print since it duplicates
      what the PHY driver already does for us.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6cc8e6d4
    • F
      net: bcmgenet: Determine PHY type before scanning MDIO bus · c624f891
      Florian Fainelli 提交于
      Our internal GPHY might be powered off before we attempt scanning the
      MDIO bus and bind a driver to it. The way we are currently determining
      whether a PHY is internal or not is done *after* we have successfully
      matched its driver. If the PHY is powered down, it will not respond to
      the MDIO bus, so we will not be able to bind a driver to it.
      
      Our Device Tree for GENET interfaces specifies a "phy-mode" value:
      "internal" which tells if this internal uses an internal PHY or not.
      
      If of_get_phy_mode() fails to parse the 'phy-mode' property, do an
      additional manual lookup, and if we find "internal" set the
      corresponding internal variable accordingly.
      
      Replace all uses of phy_is_internal() with a check against
      priv->internal_phy to avoid having to rely on whether or not
      priv->phydev is set correctly.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c624f891
    • F
      net: bcmgenet: Power on integrated GPHY in bcmgenet_power_up() · bd4060a6
      Florian Fainelli 提交于
      We are currently disabling the GPHY interface during bcmgenet_close(),
      and attempting to power it back on during bcmgenet_open(). This works
      fine for the first time, because we called bcmgenet_mii_config() which
      took care of enabling the interface, however, bcmgenet_power_up() really
      needs to power on the GPHY for correctness.
      
      This will be particularly important as we want to move
      bcmgenet_mii_probe() down to bcmgenet_open() to avoid seeing the "PHY
      already attached" message.
      
      Fixes: a642c4f7 ("net: bcmgenet: power up and down integrated GPHY when unused")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd4060a6
    • F
      net: bcmgenet: Use correct dev_id for free_irq · 978ffac4
      Florian Fainelli 提交于
      bcmgenet_open()'s error path call free_irq() with a dev_id argument
      different from the one we used to call request_irq() with, this will
      make us trip over the warning in kernel/irq/manage.c:__free_irq()
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      978ffac4
    • F
      net: bcmgenet: Remove excessive PHY reset · 6ac3ce82
      Florian Fainelli 提交于
      We are currently issuing multiple PHY resets during a suspend/resume,
      first during bcmgenet_power_up() which does a hardware reset, then a
      software reset by calling bcmgenet_mii_reset(). This is both unnecessary
      and can take as long as 10ms per MDIO transactions while we re-apply
      workarounds because we do not yet have MDIO interrupts enabled.
      
      phy_resume() takes care of re-apply our workarounds in case we need any,
      and bcmgenet_power_up() does a PHY hardware reset, all of this is more
      than enough to guarantee that the PHY operates correctly.
      
      Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6ac3ce82
  2. 12 7月, 2015 1 次提交
  3. 08 6月, 2015 1 次提交
  4. 02 4月, 2015 1 次提交
    • P
      net: bcmgenet: enable MoCA link state change detection · 8d88c6eb
      Petri Gynther 提交于
      Currently, MoCA fixed PHYs are always in link-up state, regardless of
      whether the link is actually up or not.
      
      Add code to properly detect MoCA link state changes and to reflect the
      new state in MoCA fixed PHY. Only GENET V3 and V4 MACs are capable of
      detecting MoCA link state changes.
      
      The code works as follows:
      1. GENET MAC detects MoCA link state change and issues UMAC_IRQ_LINK_UP
         or UMAC_IRQ_LINK_DOWN interrupt.
      2. Link up/down interrupt is processed in bcmgenet_irq_task(), which
         calls phy_mac_interrupt().
      3. phy_mac_interrupt() updates the fixed PHY phydev->link and kicks
         the PHY state machine.
      4. PHY state machine proceeds to read the fixed PHY link status
         register.
      5. When the fixed PHY link status register is being read, the new
         function bcmgenet_fixed_phy_link_update() gets called. It copies
         the fixed PHY phydev->link value to the fixed PHY status->link.
      6. PHY state machine receives the new link state of the fixed PHY.
      7. MoCA fixed PHY link state now correctly reflects the real MoCA
         hardware link state.
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d88c6eb
  5. 01 4月, 2015 5 次提交
  6. 28 3月, 2015 7 次提交
  7. 24 3月, 2015 3 次提交
  8. 16 3月, 2015 1 次提交
  9. 14 3月, 2015 3 次提交
  10. 12 3月, 2015 1 次提交
  11. 10 3月, 2015 1 次提交
  12. 08 3月, 2015 1 次提交
    • P
      net: bcmgenet: rework Rx queue init · 6f5a272c
      Petri Gynther 提交于
      In preparation for supporting multiple Rx queues:
      1. Move the initialization of priv->num_rx_bds, priv->rx_bds, and
         priv->rx_cbs from bcmgenet_init_rx_ring() to bcmgenet_init_dma()
         since they are not specific to a single Rx queue. Mimics the Tx
         init model where priv->num_tx_bds, priv->tx_bds, and priv->tx_cbs
         are initialized in bcmgenet_init_dma().
      2. Program DMA_MBUF_DONE_THRESH = 1 so that future Rx queues Q0-Q15
         will get per-packet Rx interrupt.
      3. Group DMA_START_ADDR, RDMA_READ_PTR, RDMA_WRITE_PTR, and DMA_END_ADDR
         initialization together. Mimics the Tx init model.
      4. There is 1-to-1 mapping between RxCBs and RxBDs.
         Precalculate RxCB->bd_addr so that it can be used in the future.
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f5a272c
  13. 07 3月, 2015 3 次提交
  14. 05 3月, 2015 1 次提交
    • P
      net: bcmgenet: simplify __bcmgenet_tx_reclaim() · 66d06757
      Petri Gynther 提交于
      1. Use c_index and ring->c_index to determine how many TxCBs/TxBDs are
         ready for cleanup
         - c_index = the current value of TDMA_CONS_INDEX
         - TDMA_CONS_INDEX is HW-incremented and auto-wraparound (0x0-0xFFFF)
         - ring->c_index = __bcmgenet_tx_reclaim() cleaned up to this point on
           the previous invocation
      
      2. Add bcmgenet_tx_ring->clean_ptr
         - index of the next TxCB to be cleaned
         - incremented as TxCBs/TxBDs are processed
         - value always in range [ring->cb_ptr, ring->end_ptr]
      
      3. Fix incrementing of dev->stats.tx_packets
         - should be incremented only when tx_cb_ptr->skb != NULL
      
      These changes simplify __bcmgenet_tx_reclaim(). Furthermore, Tx ring size
      can now be any value.
      
      With the old code, Tx ring size had to be a power-of-2:
         num_tx_bds = ring->size;
         c_index &= (num_tx_bds - 1);
         last_c_index &= (num_tx_bds - 1);
      Signed-off-by: NPetri Gynther <pgynther@google.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      66d06757
  15. 02 3月, 2015 1 次提交
    • F
      net: bcmgenet: fix software maintained statistics · f62ba9c1
      Florian Fainelli 提交于
      Commit 44c8bc3c ("net: bcmgenet: log RX buffer allocation and RX/TX dma
      failures") added a few software maintained statistics using
      BCMGENET_STAT_MIB_RX and BCMGENET_STAT_MIB_TX. These statistics are read from
      the hardware MIB counters, such that bcmgenet_update_mib_counters() was trying
      to read from a non-existing MIB offset for these counters.
      
      Fix this by introducing a special type: BCMGENET_STAT_SOFT, similar to
      BCMGENET_STAT_NETDEV, such that bcmgenet_get_ethtool_stats will read from the
      software mib.
      
      Fixes: 44c8bc3c ("net: bcmgenet: log RX buffer allocation and RX/TX dma failures")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f62ba9c1
  16. 01 3月, 2015 1 次提交
  17. 25 2月, 2015 3 次提交