of_device.h 2.0 KB

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