1. 18 Feb, 2014 7 commits
    • David S. Miller's avatar
      Merge branch 'gianfar' · 81206ebc
      David S. Miller authored
      Claudiu Manoil says:
      
      ====================
      gianfar: Device configuration fixes
      
      This patchset represents the first part of an effort
      to solve some old device configuration issues in gianfar,
      especially run-time reset and re-configuration problems.
      I'm referring to "on-the-fly" configuration of registers
      against HW specification, concurrency issues during device
      reset / re-configuration operations, and implementing HW
      advisories for these operations.
      
      There's also a good deal of code cleanup and refactoring,
      and some other (minor) fixes as well.
      
      v2: Remove sysfs stubs w/o replacing them with module
          params (patch 2).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      81206ebc
    • Claudiu Manoil's avatar
      gianfar: Remove clean_rx_ring race from gfar_ethtool · 7cca336a
      Claudiu Manoil authored
      gfar_clean_rx_ring() was designed to be called from napi
      (rx softirq) context to do the Rx processing. Calling it
      from a process context like this is a bug as it will
      clearly race with the napi Rx processing.
      
      There's also no point in initializing num_txbdfree since
      startup_gfar() already does that, when bringing the device
      up again (after reset). Changing num_txbdfree "on-the-fly"
      like this is also subject to race conditions.  num_txbdfree
      is handled by the Tx processing path and the device reset
      procedure.  Also, don't assume that num_rx_queues is always
      equal to num_tx_queues.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7cca336a
    • Claudiu Manoil's avatar
      gianfar: Add missing graceful reset steps and fixes · c10650b6
      Claudiu Manoil authored
      gfar_halt() and gfar_start() are responsible for stopping
      and starting the DMA and the Rx/Tx hw rings. They implement
      the support for the "graceful Rx/Tx stop/start" hw procedure,
      and also disable/enable eTSEC's hw interrupts in the process.
      
      The GRS/GTS procedure requires however to have the RQUEUE/TQUEUE
      registers cleared first and to wait for a period of time for the
      current frame to pass through the interface (around ~10ms for a
      jumbo frame). Only then may the GTS and GRS bits from DMACTRL be
      set to shut down the DMA, and finally the Tx_EN and Rx_EN bits in
      MACCFG1 may be cleared to disable the Tx/Rx blocks.
      
      The same register programming order applies to start the Rx/Tx:
      enabling the RQUEUE/TQUEUE *before* clearing the GRS/GTS bits.
      
      This is a HW recommendation in order to avoid a possible
      controller "lock up" during graceful reset.
      
      Cleanup the gfar_halt()/start() prototypes, to take priv instead
      of ndev as their purpose is to operate on HW. Enabling the
      RQUEUE/TQUEUE in the hw_init() is not needed anymore since
      that's the job of gfar_start().
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c10650b6
    • Claudiu Manoil's avatar
      gianfar: Factor out enabling/disabling of hw interrupts · efeddce7
      Claudiu Manoil authored
      Throughout the code there are places where the controller's
      hw interrupt sources need to get disabled/enabled (masked/
      un-masked) all at once.  The recommendation for disabling
      the interrupts is to clear the ievent first then the imask
      register (not the other way around).
      Use the gfar_ints_enable/disable() helpers to make these
      operations consistent.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      efeddce7
    • Claudiu Manoil's avatar
      gianfar: Remove useless HAS_PADDING device flag · 532c37bc
      Claudiu Manoil authored
      The RCTRL updates of the FSL_GIANFAR_DEV_HAS_PADDING device
      flag get overriden by the FSL_GIANFAR_DEV_HAS_TIMER flag
      settings, which impose a Rx padding alignment of 8 bytes.
      As all the eTSEC devices that set HAS_PADDING also set the
      HAS_TIMER flag, the HAS_PADDING flag is now obsolete.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      532c37bc
    • Claudiu Manoil's avatar
      gianfar: Remove sysfs stubs for FIFOCFG and stashing · 34018fd4
      Claudiu Manoil authored
      Removing the sysfs stubs for the Tx FIFOCFG and ATTRELI
      (stashing) config registers, as these registers may only
      be configured after a MAC reset, with the controller stopped
      (i.e. during hw init, at probe() time).  The current sysfs
      stubs allow on-the-fly updates of these registers (the locking
      measures are useless and only add unecessary code).
      
      Changing these registers is discouraged. Only the default values
      will be used instead.
      
      Moreover, the stashing (ATTRELI) configuration options were
      effectively disabled (didn't get to the hw anyway if changed)
      because the stashing device_flags (HAS_BD_STASHING|HAS_BUF_STASHING)
      were "accidentally" cleared during probe().
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34018fd4
    • Claudiu Manoil's avatar
      gianfar: Cleanup/Fix gfar_probe and the hw init code · 20862788
      Claudiu Manoil authored
      Factor out gfar_hw_init() to contain all the controller hw
      initialization steps for a better control of register writes,
      and to significantly simplify the tangled code from gfar_probe().
      This results in code size and stack usage reduction (besides
      code readability).
      
      Fix memory leak on device removal, by freeing the rx_/tx_queue
      structures.
      
      Replace custom bit swapping function with a library one (bitrev8).
      
      Move allocation of rx_/tx_queue struct arrays before the group
      structure init, because in order to assign Rx/Tx queues
      to groups we need to have the queues first.  This also allows
      earlier bail out of gfar_probe(), in case the memory allocation
      fails.
      
      The flow control checks for maccfg1 were removed from gfar_probe(),
      since flow control is disabled at probe time (priv->rx_/tx_pause_en
      are 0). Redundant initializations (by 0) also removed.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      20862788
  2. 17 Feb, 2014 33 commits