firmware.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics.
  3. * Kyungmin Park <kyungmin.park@samsung.com>
  4. * Tomasz Figa <t.figa@samsung.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_FIRMWARE_H
  11. #define __ASM_ARM_FIRMWARE_H
  12. #include <linux/bug.h>
  13. /*
  14. * struct firmware_ops
  15. *
  16. * A structure to specify available firmware operations.
  17. *
  18. * A filled up structure can be registered with register_firmware_ops().
  19. */
  20. struct firmware_ops {
  21. /*
  22. * Inform the firmware we intend to enter CPU idle mode
  23. */
  24. int (*prepare_idle)(void);
  25. /*
  26. * Enters CPU idle mode
  27. */
  28. int (*do_idle)(void);
  29. /*
  30. * Sets boot address of specified physical CPU
  31. */
  32. int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr);
  33. /*
  34. * Boots specified physical CPU
  35. */
  36. int (*cpu_boot)(int cpu);
  37. /*
  38. * Initializes L2 cache
  39. */
  40. int (*l2x0_init)(void);
  41. };
  42. /* Global pointer for current firmware_ops structure, can't be NULL. */
  43. extern const struct firmware_ops *firmware_ops;
  44. /*
  45. * call_firmware_op(op, ...)
  46. *
  47. * Checks if firmware operation is present and calls it,
  48. * otherwise returns -ENOSYS
  49. */
  50. #define call_firmware_op(op, ...) \
  51. ((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : (-ENOSYS))
  52. /*
  53. * register_firmware_ops(ops)
  54. *
  55. * A function to register platform firmware_ops struct.
  56. */
  57. static inline void register_firmware_ops(const struct firmware_ops *ops)
  58. {
  59. BUG_ON(!ops);
  60. firmware_ops = ops;
  61. }
  62. #endif