1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Anybus-S controller definitions
4  *
5  * Copyright 2018 Arcx Inc
6  */
7 
8 #ifndef __LINUX_ANYBUSS_CONTROLLER_H__
9 #define __LINUX_ANYBUSS_CONTROLLER_H__
10 
11 #include <linux/device.h>
12 #include <linux/regmap.h>
13 
14 /*
15  * To instantiate an Anybus-S host, a controller should provide the following:
16  * - a reset function which resets the attached card;
17  * - a regmap which provides access to the attached card's dpram;
18  * - the irq of the attached card
19  */
20 /**
21  * struct anybuss_ops - Controller resources to instantiate an Anybus-S host
22  *
23  * @reset:	asserts/deasserts the anybus card's reset line.
24  * @regmap:	provides access to the card's dual-port RAM area.
25  * @irq:	number of the interrupt connected to the card's interrupt line.
26  * @host_idx:	for multi-host controllers, the host index:
27  *		0 for the first host on the controller, 1 for the second, etc.
28  */
29 struct anybuss_ops {
30 	void (*reset)(struct device *dev, bool assert);
31 	struct regmap *regmap;
32 	int irq;
33 	int host_idx;
34 };
35 
36 struct anybuss_host;
37 
38 struct anybuss_host * __must_check
39 anybuss_host_common_probe(struct device *dev,
40 			  const struct anybuss_ops *ops);
41 void anybuss_host_common_remove(struct anybuss_host *host);
42 
43 struct anybuss_host * __must_check
44 devm_anybuss_host_common_probe(struct device *dev,
45 			       const struct anybuss_ops *ops);
46 
47 #endif /* __LINUX_ANYBUSS_CONTROLLER_H__ */
48