ibmebus.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * IBM PowerPC eBus Infrastructure Support.
  3. *
  4. * Copyright (c) 2005 IBM Corporation
  5. * Joachim Fenkes <fenkes@de.ibm.com>
  6. * Heiko J Schick <schickhj@de.ibm.com>
  7. *
  8. * All rights reserved.
  9. *
  10. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  11. * BSD.
  12. *
  13. * OpenIB BSD License
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions are met:
  17. *
  18. * Redistributions of source code must retain the above copyright notice, this
  19. * list of conditions and the following disclaimer.
  20. *
  21. * Redistributions in binary form must reproduce the above copyright notice,
  22. * this list of conditions and the following disclaimer in the documentation
  23. * and/or other materials
  24. * provided with the distribution.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  33. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  34. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. */
  38. #ifndef _ASM_EBUS_H
  39. #define _ASM_EBUS_H
  40. #ifdef __KERNEL__
  41. #include <linux/device.h>
  42. #include <linux/interrupt.h>
  43. #include <linux/mod_devicetable.h>
  44. #include <asm/of_device.h>
  45. extern struct bus_type ibmebus_bus_type;
  46. struct ibmebus_dev {
  47. struct of_device ofdev;
  48. };
  49. struct ibmebus_driver {
  50. char *name;
  51. struct of_device_id *id_table;
  52. int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
  53. int (*remove) (struct ibmebus_dev *dev);
  54. struct device_driver driver;
  55. };
  56. int ibmebus_register_driver(struct ibmebus_driver *drv);
  57. void ibmebus_unregister_driver(struct ibmebus_driver *drv);
  58. int ibmebus_request_irq(struct ibmebus_dev *dev,
  59. u32 ist,
  60. irq_handler_t handler,
  61. unsigned long irq_flags, const char * devname,
  62. void *dev_id);
  63. void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id);
  64. static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv)
  65. {
  66. return container_of(drv, struct ibmebus_driver, driver);
  67. }
  68. static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev)
  69. {
  70. return container_of(dev, struct ibmebus_dev, ofdev.dev);
  71. }
  72. #endif /* __KERNEL__ */
  73. #endif /* _ASM_IBMEBUS_H */