• Roger Quadros's avatar
    net: ethernet: ti: am65-cpsw: Add suspend/resume support · 24bc19b0
    Roger Quadros authored
    Add PM handlers for System suspend/resume.
    
    As DMA driver doesn't yet support suspend/resume we free up
    the DMA channels at suspend and acquire and initialize them
    at resume.
    
    In this revised approach we do not free the TX/RX IRQs at
    am65_cpsw_nuss_common_stop() as it causes problems.
    We will now free them only on .suspend() as we need to release
    the DMA channels (as DMA looses context) and re-acquiring
    them on .resume() may not necessarily give us the same
    IRQs.
    
    To make this easier:
    - introduce am65_cpsw_nuss_remove_rx_chns() which is
       similar to am65_cpsw_nuss_remove_tx_chns(). These will
       be invoked in pm.suspend() to release the DMA channels
       and free up the IRQs.
    - move napi_add() and request_irq() calls to
       am65_cpsw_nuss_init_rx/tx_chns() so we can invoke them
       in pm.resume() to acquire the DMA channels and IRQs.
    
    As CPTS looses contect during suspend/resume, invoke the
    necessary CPTS suspend/resume helpers.
    
    ALE_CLEAR command is issued in cpsw_ale_start() so no need
    to issue it before the call to cpsw_ale_start().
    Signed-off-by: default avatarRoger Quadros <rogerq@kernel.org>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    24bc19b0
am65-cpsw-nuss.c 79.4 KB