cryp_irq.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Copyright (C) ST-Ericsson SA 2010
  3. * Author: Shujuan Chen <shujuan.chen@stericsson.com> for ST-Ericsson.
  4. * Author: Jonas Linde <jonas.linde@stericsson.com> for ST-Ericsson.
  5. * Author: Joakim Bech <joakim.xx.bech@stericsson.com> for ST-Ericsson.
  6. * Author: Berne Hebark <berne.herbark@stericsson.com> for ST-Ericsson.
  7. * Author: Niklas Hernaeus <niklas.hernaeus@stericsson.com> for ST-Ericsson.
  8. * License terms: GNU General Public License (GPL) version 2.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/bitmap.h>
  12. #include <linux/device.h>
  13. #include "cryp.h"
  14. #include "cryp_p.h"
  15. #include "cryp_irq.h"
  16. #include "cryp_irqp.h"
  17. void cryp_enable_irq_src(struct cryp_device_data *device_data, u32 irq_src)
  18. {
  19. u32 i;
  20. dev_dbg(device_data->dev, "[%s]", __func__);
  21. i = readl_relaxed(&device_data->base->imsc);
  22. i = i | irq_src;
  23. writel_relaxed(i, &device_data->base->imsc);
  24. }
  25. void cryp_disable_irq_src(struct cryp_device_data *device_data, u32 irq_src)
  26. {
  27. u32 i;
  28. dev_dbg(device_data->dev, "[%s]", __func__);
  29. i = readl_relaxed(&device_data->base->imsc);
  30. i = i & ~irq_src;
  31. writel_relaxed(i, &device_data->base->imsc);
  32. }
  33. bool cryp_pending_irq_src(struct cryp_device_data *device_data, u32 irq_src)
  34. {
  35. return (readl_relaxed(&device_data->base->mis) & irq_src) > 0;
  36. }