staging: board: Add support for devices with complex dependencies
[pandora-kernel.git] / drivers / staging / board / board.h
1 #ifndef __BOARD_H__
2 #define __BOARD_H__
3
4 #include <linux/init.h>
5 #include <linux/of.h>
6
7 struct board_staging_clk {
8         const char *clk;
9         const char *con_id;
10         const char *dev_id;
11 };
12
13 struct board_staging_dev {
14         /* Platform Device */
15         struct platform_device *pdev;
16         /* Clocks (optional) */
17         const struct board_staging_clk *clocks;
18         unsigned int nclocks;
19         /* Generic PM Domain (optional) */
20         const char *domain;
21 };
22
23 struct resource;
24
25 bool board_staging_dt_node_available(const struct resource *resource,
26                                      unsigned int num_resources);
27 int board_staging_gic_setup_xlate(const char *gic_match, unsigned int base);
28 void board_staging_gic_fixup_resources(struct resource *res, unsigned int nres);
29 int board_staging_register_clock(const struct board_staging_clk *bsc);
30 int board_staging_register_device(const struct board_staging_dev *dev);
31 void board_staging_register_devices(const struct board_staging_dev *devs,
32                                     unsigned int ndevs);
33
34 #define board_staging(str, fn)                  \
35 static int __init runtime_board_check(void)     \
36 {                                               \
37         if (of_machine_is_compatible(str))      \
38                 fn();                           \
39                                                 \
40         return 0;                               \
41 }                                               \
42                                                 \
43 device_initcall(runtime_board_check)
44
45 #endif /* __BOARD_H__ */