of_platform.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  3. * <benh@kernel.crashing.org>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. *
  10. */
  11. #include <asm/of_device.h>
  12. /*
  13. * The of_platform_bus_type is a bus type used by drivers that do not
  14. * attach to a macio or similar bus but still use OF probing
  15. * mechanism
  16. */
  17. extern struct bus_type of_platform_bus_type;
  18. /*
  19. * An of_platform_driver driver is attached to a basic of_device on
  20. * the "platform bus" (of_platform_bus_type)
  21. */
  22. struct of_platform_driver
  23. {
  24. char *name;
  25. struct of_device_id *match_table;
  26. struct module *owner;
  27. int (*probe)(struct of_device* dev,
  28. const struct of_device_id *match);
  29. int (*remove)(struct of_device* dev);
  30. int (*suspend)(struct of_device* dev, pm_message_t state);
  31. int (*resume)(struct of_device* dev);
  32. int (*shutdown)(struct of_device* dev);
  33. struct device_driver driver;
  34. };
  35. #define to_of_platform_driver(drv) \
  36. container_of(drv,struct of_platform_driver, driver)
  37. /* Platform drivers register/unregister */
  38. extern int of_register_platform_driver(struct of_platform_driver *drv);
  39. extern void of_unregister_platform_driver(struct of_platform_driver *drv);
  40. /* Platform devices and busses creation */
  41. extern struct of_device *of_platform_device_create(struct device_node *np,
  42. const char *bus_id,
  43. struct device *parent);
  44. /* pseudo "matches" value to not do deep probe */
  45. #define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
  46. extern int of_platform_bus_probe(struct device_node *root,
  47. struct of_device_id *matches,
  48. struct device *parent);
  49. extern struct of_device *of_find_device_by_node(struct device_node *np);
  50. extern struct of_device *of_find_device_by_phandle(phandle ph);