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