of_platform.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef _LINUX_OF_PLATFORM_H
  2. #define _LINUX_OF_PLATFORM_H
  3. /*
  4. * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  5. * <benh@kernel.crashing.org>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. *
  12. */
  13. #ifdef CONFIG_OF_DEVICE
  14. #include <linux/module.h>
  15. #include <linux/device.h>
  16. #include <linux/mod_devicetable.h>
  17. #include <linux/pm.h>
  18. #include <linux/of_device.h>
  19. #include <linux/platform_device.h>
  20. /**
  21. * of_platform_driver - Legacy of-aware driver for platform devices.
  22. *
  23. * An of_platform_driver driver is attached to a basic platform_device on
  24. * the ibm ebus (ibmebus_bus_type).
  25. */
  26. struct of_platform_driver
  27. {
  28. int (*probe)(struct platform_device* dev,
  29. const struct of_device_id *match);
  30. int (*remove)(struct platform_device* dev);
  31. int (*suspend)(struct platform_device* dev, pm_message_t state);
  32. int (*resume)(struct platform_device* dev);
  33. int (*shutdown)(struct platform_device* dev);
  34. struct device_driver driver;
  35. };
  36. #define to_of_platform_driver(drv) \
  37. container_of(drv,struct of_platform_driver, driver)
  38. /* Platform drivers register/unregister */
  39. extern struct platform_device *of_device_alloc(struct device_node *np,
  40. const char *bus_id,
  41. struct device *parent);
  42. extern struct platform_device *of_find_device_by_node(struct device_node *np);
  43. #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
  44. /* Platform devices and busses creation */
  45. extern struct platform_device *of_platform_device_create(struct device_node *np,
  46. const char *bus_id,
  47. struct device *parent);
  48. /* pseudo "matches" value to not do deep probe */
  49. #define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
  50. extern int of_platform_bus_probe(struct device_node *root,
  51. const struct of_device_id *matches,
  52. struct device *parent);
  53. #endif /* !CONFIG_SPARC */
  54. #endif /* CONFIG_OF_DEVICE */
  55. #endif /* _LINUX_OF_PLATFORM_H */