of_device.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef _ASM_SPARC_OF_DEVICE_H
  2. #define _ASM_SPARC_OF_DEVICE_H
  3. #ifdef __KERNEL__
  4. #include <linux/device.h>
  5. #include <linux/mod_devicetable.h>
  6. #include <asm/prom.h>
  7. extern struct bus_type ebus_bus_type;
  8. extern struct bus_type sbus_bus_type;
  9. /*
  10. * The of_device is a kind of "base class" that is a superset of
  11. * struct device for use by devices attached to an OF node and
  12. * probed using OF properties.
  13. */
  14. struct of_device
  15. {
  16. struct device_node *node; /* OF device node */
  17. struct device dev; /* Generic device interface */
  18. };
  19. #define to_of_device(d) container_of(d, struct of_device, dev)
  20. extern const struct of_device_id *of_match_device(
  21. const struct of_device_id *matches, const struct of_device *dev);
  22. extern struct of_device *of_dev_get(struct of_device *dev);
  23. extern void of_dev_put(struct of_device *dev);
  24. /*
  25. * An of_platform_driver driver is attached to a basic of_device on
  26. * the ISA, EBUS, and SBUS busses on sparc64.
  27. */
  28. struct of_platform_driver
  29. {
  30. char *name;
  31. struct of_device_id *match_table;
  32. struct module *owner;
  33. int (*probe)(struct of_device* dev, const struct of_device_id *match);
  34. int (*remove)(struct of_device* dev);
  35. int (*suspend)(struct of_device* dev, pm_message_t state);
  36. int (*resume)(struct of_device* dev);
  37. int (*shutdown)(struct of_device* dev);
  38. struct device_driver driver;
  39. };
  40. #define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
  41. extern int of_register_driver(struct of_platform_driver *drv,
  42. struct bus_type *bus);
  43. extern void of_unregister_driver(struct of_platform_driver *drv);
  44. extern int of_device_register(struct of_device *ofdev);
  45. extern void of_device_unregister(struct of_device *ofdev);
  46. extern struct of_device *of_platform_device_create(struct device_node *np,
  47. const char *bus_id,
  48. struct device *parent,
  49. struct bus_type *bus);
  50. extern void of_release_dev(struct device *dev);
  51. #endif /* __KERNEL__ */
  52. #endif /* _ASM_SPARC_OF_DEVICE_H */