7216-dpaa2-evb-Fix-interrupt-handling.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 4efb592d8a931669df5df04bedcae8cbc85c3700 Mon Sep 17 00:00:00 2001
  2. From: Razvan Stefanescu <razvan.stefanescu@freescale.com>
  3. Date: Wed, 17 Feb 2016 16:31:01 +0200
  4. Subject: [PATCH 216/226] dpaa2-evb: Fix interrupt handling
  5. Mask only the events handled by the driver - DPDMUX_IRQ_EVENT_LINK_CHANGED.
  6. Use clear-on-read mechanism for the interrupt status and avoid calling
  7. dpdmux_clear_irq_status(). Status contains the events handled (only link
  8. state change for the moment) and masks the first 16-bits, as they are used
  9. to store the interface ID that generated the event.
  10. Signed-off-by: Razvan Stefanescu <razvan.stefanescu@freescale.com>
  11. ---
  12. drivers/staging/fsl-dpaa2/evb/evb.c | 20 ++++++++++----------
  13. 1 file changed, 10 insertions(+), 10 deletions(-)
  14. --- a/drivers/staging/fsl-dpaa2/evb/evb.c
  15. +++ b/drivers/staging/fsl-dpaa2/evb/evb.c
  16. @@ -151,7 +151,9 @@ static irqreturn_t _evb_irq0_handler_thr
  17. struct fsl_mc_io *io = priv->mc_io;
  18. uint16_t token = priv->mux_handle;
  19. int irq_index = DPDMUX_IRQ_INDEX_IF;
  20. - uint32_t status = 0, clear = 0;
  21. +
  22. + /* Mask the events and the if_id reserved bits to be cleared on read */
  23. + uint32_t status = DPDMUX_IRQ_EVENT_LINK_CHANGED | 0xFFFF0000;
  24. int err;
  25. /* Sanity check */
  26. @@ -163,23 +165,21 @@ static irqreturn_t _evb_irq0_handler_thr
  27. err = dpdmux_get_irq_status(io, 0, token, irq_index, &status);
  28. if (unlikely(err)) {
  29. netdev_err(netdev, "Can't get irq status (err %d)", err);
  30. - clear = 0xffffffff;
  31. + err = dpdmux_clear_irq_status(io, 0, token, irq_index,
  32. + 0xFFFFFFFF);
  33. + if (unlikely(err))
  34. + netdev_err(netdev, "Can't clear irq status (err %d)",
  35. + err);
  36. goto out;
  37. }
  38. - /* FIXME clear irq status */
  39. -
  40. if (status & DPDMUX_IRQ_EVENT_LINK_CHANGED) {
  41. - clear |= DPDMUX_IRQ_EVENT_LINK_CHANGED;
  42. -
  43. err = evb_links_state_update(priv);
  44. if (unlikely(err))
  45. goto out;
  46. }
  47. +
  48. out:
  49. - err = dpdmux_clear_irq_status(io, 0, token, irq_index, clear);
  50. - if (unlikely(err))
  51. - netdev_err(netdev, "Can't clear irq status (err %d)", err);
  52. return IRQ_HANDLED;
  53. }
  54. @@ -191,7 +191,7 @@ static int evb_setup_irqs(struct fsl_mc_
  55. int err = 0;
  56. struct fsl_mc_device_irq *irq;
  57. const int irq_index = DPDMUX_IRQ_INDEX_IF;
  58. - uint32_t mask = ~0x0u; /* FIXME: unmask handled irqs */
  59. + uint32_t mask = DPDMUX_IRQ_EVENT_LINK_CHANGED;
  60. err = fsl_mc_allocate_irqs(evb_dev);
  61. if (unlikely(err)) {