xref: /linux/include/linux/mfd/cgbc.h (revision 98b5f7706f6bfd863e50317742f7d566b86fabdc)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Congatec Board Controller driver definitions
4  *
5  * Copyright (C) 2024 Bootlin
6  * Author: Thomas Richard <thomas.richard@bootlin.com>
7  */
8 
9 #ifndef _LINUX_MFD_CGBC_H_
10 
11 /**
12  * struct cgbc_version - Board Controller device version structure
13  * @feature:	Board Controller feature number
14  * @major:	Board Controller major revision
15  * @minor:	Board Controller minor revision
16  */
17 struct cgbc_version {
18 	unsigned char feature;
19 	unsigned char major;
20 	unsigned char minor;
21 };
22 
23 /**
24  * struct cgbc_device_data - Internal representation of the Board Controller device
25  * @io_session:		Pointer to the session IO memory
26  * @io_cmd:		Pointer to the command IO memory
27  * @session:		Session id returned by the Board Controller
28  * @dev:		Pointer to kernel device structure
29  * @cgbc_version:	Board Controller version structure
30  * @mutex:		Board Controller mutex
31  */
32 struct cgbc_device_data {
33 	void __iomem		*io_session;
34 	void __iomem		*io_cmd;
35 	u8			session;
36 	struct device		*dev;
37 	struct cgbc_version	version;
38 	struct mutex		lock;
39 };
40 
41 int cgbc_command(struct cgbc_device_data *cgbc, void *cmd, unsigned int cmd_size,
42 		 void *data, unsigned int data_size, u8 *status);
43 
44 #endif /*_LINUX_MFD_CGBC_H_*/
45