~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/greybus/connection.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Greybus connections
  4  *
  5  * Copyright 2014 Google Inc.
  6  * Copyright 2014 Linaro Ltd.
  7  */
  8 
  9 #ifndef __CONNECTION_H
 10 #define __CONNECTION_H
 11 
 12 #include <linux/bits.h>
 13 #include <linux/list.h>
 14 #include <linux/kfifo.h>
 15 #include <linux/kref.h>
 16 #include <linux/workqueue.h>
 17 
 18 #define GB_CONNECTION_FLAG_CSD          BIT(0)
 19 #define GB_CONNECTION_FLAG_NO_FLOWCTRL  BIT(1)
 20 #define GB_CONNECTION_FLAG_OFFLOADED    BIT(2)
 21 #define GB_CONNECTION_FLAG_CDSI1        BIT(3)
 22 #define GB_CONNECTION_FLAG_CONTROL      BIT(4)
 23 #define GB_CONNECTION_FLAG_HIGH_PRIO    BIT(5)
 24 
 25 #define GB_CONNECTION_FLAG_CORE_MASK    GB_CONNECTION_FLAG_CONTROL
 26 
 27 enum gb_connection_state {
 28         GB_CONNECTION_STATE_DISABLED            = 0,
 29         GB_CONNECTION_STATE_ENABLED_TX          = 1,
 30         GB_CONNECTION_STATE_ENABLED             = 2,
 31         GB_CONNECTION_STATE_DISCONNECTING       = 3,
 32 };
 33 
 34 struct gb_operation;
 35 
 36 typedef int (*gb_request_handler_t)(struct gb_operation *);
 37 
 38 struct gb_connection {
 39         struct gb_host_device           *hd;
 40         struct gb_interface             *intf;
 41         struct gb_bundle                *bundle;
 42         struct kref                     kref;
 43         u16                             hd_cport_id;
 44         u16                             intf_cport_id;
 45 
 46         struct list_head                hd_links;
 47         struct list_head                bundle_links;
 48 
 49         gb_request_handler_t            handler;
 50         unsigned long                   flags;
 51 
 52         struct mutex                    mutex;
 53         spinlock_t                      lock;
 54         enum gb_connection_state        state;
 55         struct list_head                operations;
 56 
 57         char                            name[16];
 58         struct workqueue_struct         *wq;
 59 
 60         atomic_t                        op_cycle;
 61 
 62         void                            *private;
 63 
 64         bool                            mode_switch;
 65 };
 66 
 67 struct gb_connection *gb_connection_create_static(struct gb_host_device *hd,
 68                                 u16 hd_cport_id, gb_request_handler_t handler);
 69 struct gb_connection *gb_connection_create_control(struct gb_interface *intf);
 70 struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
 71                                 u16 cport_id, gb_request_handler_t handler);
 72 struct gb_connection *gb_connection_create_flags(struct gb_bundle *bundle,
 73                                 u16 cport_id, gb_request_handler_t handler,
 74                                 unsigned long flags);
 75 struct gb_connection *gb_connection_create_offloaded(struct gb_bundle *bundle,
 76                                 u16 cport_id, unsigned long flags);
 77 void gb_connection_destroy(struct gb_connection *connection);
 78 
 79 static inline bool gb_connection_is_static(struct gb_connection *connection)
 80 {
 81         return !connection->intf;
 82 }
 83 
 84 int gb_connection_enable(struct gb_connection *connection);
 85 int gb_connection_enable_tx(struct gb_connection *connection);
 86 void gb_connection_disable_rx(struct gb_connection *connection);
 87 void gb_connection_disable(struct gb_connection *connection);
 88 void gb_connection_disable_forced(struct gb_connection *connection);
 89 
 90 void gb_connection_mode_switch_prepare(struct gb_connection *connection);
 91 void gb_connection_mode_switch_complete(struct gb_connection *connection);
 92 
 93 void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
 94                        u8 *data, size_t length);
 95 
 96 void gb_connection_latency_tag_enable(struct gb_connection *connection);
 97 void gb_connection_latency_tag_disable(struct gb_connection *connection);
 98 
 99 static inline bool gb_connection_e2efc_enabled(struct gb_connection *connection)
100 {
101         return !(connection->flags & GB_CONNECTION_FLAG_CSD);
102 }
103 
104 static inline bool
105 gb_connection_flow_control_disabled(struct gb_connection *connection)
106 {
107         return connection->flags & GB_CONNECTION_FLAG_NO_FLOWCTRL;
108 }
109 
110 static inline bool gb_connection_is_offloaded(struct gb_connection *connection)
111 {
112         return connection->flags & GB_CONNECTION_FLAG_OFFLOADED;
113 }
114 
115 static inline bool gb_connection_is_control(struct gb_connection *connection)
116 {
117         return connection->flags & GB_CONNECTION_FLAG_CONTROL;
118 }
119 
120 static inline void *gb_connection_get_data(struct gb_connection *connection)
121 {
122         return connection->private;
123 }
124 
125 static inline void gb_connection_set_data(struct gb_connection *connection,
126                                           void *data)
127 {
128         connection->private = data;
129 }
130 
131 #endif /* __CONNECTION_H */
132 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php