xref: /OK3568_Linux_fs/kernel/include/net/caif/cfcnfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) ST-Ericsson AB 2010
4*4882a593Smuzhiyun  * Author:	Sjur Brendeland
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef CFCNFG_H_
8*4882a593Smuzhiyun #define CFCNFG_H_
9*4882a593Smuzhiyun #include <linux/spinlock.h>
10*4882a593Smuzhiyun #include <linux/netdevice.h>
11*4882a593Smuzhiyun #include <net/caif/caif_layer.h>
12*4882a593Smuzhiyun #include <net/caif/cfctrl.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun struct cfcnfg;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /**
17*4882a593Smuzhiyun  * enum cfcnfg_phy_preference - Physical preference HW Abstraction
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * @CFPHYPREF_UNSPECIFIED:	Default physical interface
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * @CFPHYPREF_LOW_LAT:		Default physical interface for low-latency
22*4882a593Smuzhiyun  *				traffic
23*4882a593Smuzhiyun  * @CFPHYPREF_HIGH_BW:		Default physical interface for high-bandwidth
24*4882a593Smuzhiyun  *				traffic
25*4882a593Smuzhiyun  * @CFPHYPREF_LOOP:		TEST only Loopback interface simulating modem
26*4882a593Smuzhiyun  *				responses.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun enum cfcnfg_phy_preference {
30*4882a593Smuzhiyun 	CFPHYPREF_UNSPECIFIED,
31*4882a593Smuzhiyun 	CFPHYPREF_LOW_LAT,
32*4882a593Smuzhiyun 	CFPHYPREF_HIGH_BW,
33*4882a593Smuzhiyun 	CFPHYPREF_LOOP
34*4882a593Smuzhiyun };
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /**
37*4882a593Smuzhiyun  * cfcnfg_create() - Get the CAIF configuration object given network.
38*4882a593Smuzhiyun  * @net:	Network for the CAIF configuration object.
39*4882a593Smuzhiyun  */
40*4882a593Smuzhiyun struct cfcnfg *get_cfcnfg(struct net *net);
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun /**
43*4882a593Smuzhiyun  * cfcnfg_create() - Create the CAIF configuration object.
44*4882a593Smuzhiyun  */
45*4882a593Smuzhiyun struct cfcnfg *cfcnfg_create(void);
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /**
48*4882a593Smuzhiyun  * cfcnfg_remove() -  Remove the CFCNFG object
49*4882a593Smuzhiyun  * @cfg: config object
50*4882a593Smuzhiyun  */
51*4882a593Smuzhiyun void cfcnfg_remove(struct cfcnfg *cfg);
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun /**
54*4882a593Smuzhiyun  * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
55*4882a593Smuzhiyun  * @cnfg:	Pointer to a CAIF configuration object, created by
56*4882a593Smuzhiyun  *		cfcnfg_create().
57*4882a593Smuzhiyun  * @dev:	Pointer to link layer device
58*4882a593Smuzhiyun  * @phy_layer:	Specify the physical layer. The transmit function
59*4882a593Smuzhiyun  *		MUST be set in the structure.
60*4882a593Smuzhiyun  * @pref:	The phy (link layer) preference.
61*4882a593Smuzhiyun  * @link_support: Protocol implementation for link layer specific protocol.
62*4882a593Smuzhiyun  * @fcs:	Specify if checksum is used in CAIF Framing Layer.
63*4882a593Smuzhiyun  * @head_room:	Head space needed by link specific protocol.
64*4882a593Smuzhiyun  */
65*4882a593Smuzhiyun int
66*4882a593Smuzhiyun cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
67*4882a593Smuzhiyun 		     struct net_device *dev, struct cflayer *phy_layer,
68*4882a593Smuzhiyun 		     enum cfcnfg_phy_preference pref,
69*4882a593Smuzhiyun 		     struct cflayer *link_support,
70*4882a593Smuzhiyun 		     bool fcs, int head_room);
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun /**
73*4882a593Smuzhiyun  * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
74*4882a593Smuzhiyun  *
75*4882a593Smuzhiyun  * @cnfg:	Pointer to a CAIF configuration object, created by
76*4882a593Smuzhiyun  *		cfcnfg_create().
77*4882a593Smuzhiyun  * @phy_layer:	Adaptation layer to be removed.
78*4882a593Smuzhiyun  */
79*4882a593Smuzhiyun int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun /**
82*4882a593Smuzhiyun  * cfcnfg_set_phy_state() - Set the state of the physical interface device.
83*4882a593Smuzhiyun  * @cnfg:	Configuration object
84*4882a593Smuzhiyun  * @phy_layer:	Physical Layer representation
85*4882a593Smuzhiyun  * @up:	State of device
86*4882a593Smuzhiyun  */
87*4882a593Smuzhiyun int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer,
88*4882a593Smuzhiyun 				bool up);
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun #endif				/* CFCNFG_H_ */
91