diff options
Diffstat (limited to 'include/linux/ti_wilink_st.h')
-rw-r--r-- | include/linux/ti_wilink_st.h | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 4c7be226301..7071ec5d011 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h | |||
@@ -26,15 +26,6 @@ | |||
26 | #define TI_WILINK_ST_H | 26 | #define TI_WILINK_ST_H |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW | ||
30 | * gpio states for their chip/core enable gpios | ||
31 | */ | ||
32 | enum kim_gpio_state { | ||
33 | KIM_GPIO_INACTIVE, | ||
34 | KIM_GPIO_ACTIVE, | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * enum proto-type - The protocol on WiLink chips which share a | 29 | * enum proto-type - The protocol on WiLink chips which share a |
39 | * common physical interface like UART. | 30 | * common physical interface like UART. |
40 | */ | 31 | */ |
@@ -42,7 +33,7 @@ enum proto_type { | |||
42 | ST_BT, | 33 | ST_BT, |
43 | ST_FM, | 34 | ST_FM, |
44 | ST_GPS, | 35 | ST_GPS, |
45 | ST_MAX, | 36 | ST_MAX_CHANNELS = 16, |
46 | }; | 37 | }; |
47 | 38 | ||
48 | /** | 39 | /** |
@@ -62,6 +53,17 @@ enum proto_type { | |||
62 | * @priv_data: privdate data holder for the protocol drivers, sent | 53 | * @priv_data: privdate data holder for the protocol drivers, sent |
63 | * from the protocol drivers during registration, and sent back on | 54 | * from the protocol drivers during registration, and sent back on |
64 | * reg_complete_cb and recv. | 55 | * reg_complete_cb and recv. |
56 | * @chnl_id: channel id the protocol driver is interested in, the channel | ||
57 | * id is nothing but the 1st byte of the packet in UART frame. | ||
58 | * @max_frame_size: size of the largest frame the protocol can receive. | ||
59 | * @hdr_len: length of the header structure of the protocol. | ||
60 | * @offset_len_in_hdr: this provides the offset of the length field in the | ||
61 | * header structure of the protocol header, to assist ST to know | ||
62 | * how much to receive, if the data is split across UART frames. | ||
63 | * @len_size: whether the length field inside the header is 2 bytes | ||
64 | * or 1 byte. | ||
65 | * @reserve: the number of bytes ST needs to reserve in the skb being | ||
66 | * prepared for the protocol driver. | ||
65 | */ | 67 | */ |
66 | struct st_proto_s { | 68 | struct st_proto_s { |
67 | enum proto_type type; | 69 | enum proto_type type; |
@@ -70,10 +72,17 @@ struct st_proto_s { | |||
70 | void (*reg_complete_cb) (void *, char data); | 72 | void (*reg_complete_cb) (void *, char data); |
71 | long (*write) (struct sk_buff *skb); | 73 | long (*write) (struct sk_buff *skb); |
72 | void *priv_data; | 74 | void *priv_data; |
75 | |||
76 | unsigned char chnl_id; | ||
77 | unsigned short max_frame_size; | ||
78 | unsigned char hdr_len; | ||
79 | unsigned char offset_len_in_hdr; | ||
80 | unsigned char len_size; | ||
81 | unsigned char reserve; | ||
73 | }; | 82 | }; |
74 | 83 | ||
75 | extern long st_register(struct st_proto_s *); | 84 | extern long st_register(struct st_proto_s *); |
76 | extern long st_unregister(enum proto_type); | 85 | extern long st_unregister(struct st_proto_s *); |
77 | 86 | ||
78 | 87 | ||
79 | /* | 88 | /* |
@@ -114,6 +123,7 @@ extern long st_unregister(enum proto_type); | |||
114 | * @rx_skb: the skb where all data for a protocol gets accumulated, | 123 | * @rx_skb: the skb where all data for a protocol gets accumulated, |
115 | * since tty might not call receive when a complete event packet | 124 | * since tty might not call receive when a complete event packet |
116 | * is received, the states, count and the skb needs to be maintained. | 125 | * is received, the states, count and the skb needs to be maintained. |
126 | * @rx_chnl: the channel ID for which the data is getting accumalated for. | ||
117 | * @txq: the list of skbs which needs to be sent onto the TTY. | 127 | * @txq: the list of skbs which needs to be sent onto the TTY. |
118 | * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued | 128 | * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued |
119 | * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs | 129 | * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs |
@@ -135,10 +145,11 @@ struct st_data_s { | |||
135 | #define ST_TX_SENDING 1 | 145 | #define ST_TX_SENDING 1 |
136 | #define ST_TX_WAKEUP 2 | 146 | #define ST_TX_WAKEUP 2 |
137 | unsigned long tx_state; | 147 | unsigned long tx_state; |
138 | struct st_proto_s *list[ST_MAX]; | 148 | struct st_proto_s *list[ST_MAX_CHANNELS]; |
139 | unsigned long rx_state; | 149 | unsigned long rx_state; |
140 | unsigned long rx_count; | 150 | unsigned long rx_count; |
141 | struct sk_buff *rx_skb; | 151 | struct sk_buff *rx_skb; |
152 | unsigned char rx_chnl; | ||
142 | struct sk_buff_head txq, tx_waitq; | 153 | struct sk_buff_head txq, tx_waitq; |
143 | spinlock_t lock; | 154 | spinlock_t lock; |
144 | unsigned char protos_registered; | 155 | unsigned char protos_registered; |
@@ -146,6 +157,11 @@ struct st_data_s { | |||
146 | void *kim_data; | 157 | void *kim_data; |
147 | }; | 158 | }; |
148 | 159 | ||
160 | /* | ||
161 | * wrapper around tty->ops->write_room to check | ||
162 | * availability during firmware download | ||
163 | */ | ||
164 | int st_get_uart_wr_room(struct st_data_s *st_gdata); | ||
149 | /** | 165 | /** |
150 | * st_int_write - | 166 | * st_int_write - |
151 | * point this to tty->driver->write or tty->ops->write | 167 | * point this to tty->driver->write or tty->ops->write |
@@ -186,8 +202,9 @@ void gps_chrdrv_stub_init(void); | |||
186 | /* time in msec to wait for | 202 | /* time in msec to wait for |
187 | * line discipline to be installed | 203 | * line discipline to be installed |
188 | */ | 204 | */ |
189 | #define LDISC_TIME 500 | 205 | #define LDISC_TIME 1000 |
190 | #define CMD_RESP_TIME 500 | 206 | #define CMD_RESP_TIME 800 |
207 | #define CMD_WR_TIME 5000 | ||
191 | #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ | 208 | #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ |
192 | | ((unsigned short)((unsigned char)(b))) << 8)) | 209 | | ((unsigned short)((unsigned char)(b))) << 8)) |
193 | 210 | ||
@@ -210,6 +227,7 @@ struct chip_version { | |||
210 | unsigned short maj_ver; | 227 | unsigned short maj_ver; |
211 | }; | 228 | }; |
212 | 229 | ||
230 | #define UART_DEV_NAME_LEN 32 | ||
213 | /** | 231 | /** |
214 | * struct kim_data_s - the KIM internal data, embedded as the | 232 | * struct kim_data_s - the KIM internal data, embedded as the |
215 | * platform's drv data. One for each ST device in the system. | 233 | * platform's drv data. One for each ST device in the system. |
@@ -225,14 +243,11 @@ struct chip_version { | |||
225 | * the ldisc was properly installed. | 243 | * the ldisc was properly installed. |
226 | * @resp_buffer: data buffer for the .bts fw file name. | 244 | * @resp_buffer: data buffer for the .bts fw file name. |
227 | * @fw_entry: firmware class struct to request/release the fw. | 245 | * @fw_entry: firmware class struct to request/release the fw. |
228 | * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. | ||
229 | * @rx_state: the rx state for kim's receive func during fw download. | 246 | * @rx_state: the rx state for kim's receive func during fw download. |
230 | * @rx_count: the rx count for the kim's receive func during fw download. | 247 | * @rx_count: the rx count for the kim's receive func during fw download. |
231 | * @rx_skb: all of fw data might not come at once, and hence data storage for | 248 | * @rx_skb: all of fw data might not come at once, and hence data storage for |
232 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's | 249 | * whole of the fw response, only HCI_EVENTs and hence diff from ST's |
233 | * response. | 250 | * response. |
234 | * @rfkill: rfkill data for each of the cores to be registered with rfkill. | ||
235 | * @rf_protos: proto types of the data registered with rfkill sub-system. | ||
236 | * @core_data: ST core's data, which mainly is the tty's disc_data | 251 | * @core_data: ST core's data, which mainly is the tty's disc_data |
237 | * @version: chip version available via a sysfs entry. | 252 | * @version: chip version available via a sysfs entry. |
238 | * | 253 | * |
@@ -243,14 +258,16 @@ struct kim_data_s { | |||
243 | struct completion kim_rcvd, ldisc_installed; | 258 | struct completion kim_rcvd, ldisc_installed; |
244 | char resp_buffer[30]; | 259 | char resp_buffer[30]; |
245 | const struct firmware *fw_entry; | 260 | const struct firmware *fw_entry; |
246 | long gpios[ST_MAX]; | 261 | long nshutdown; |
247 | unsigned long rx_state; | 262 | unsigned long rx_state; |
248 | unsigned long rx_count; | 263 | unsigned long rx_count; |
249 | struct sk_buff *rx_skb; | 264 | struct sk_buff *rx_skb; |
250 | struct rfkill *rfkill[ST_MAX]; | ||
251 | enum proto_type rf_protos[ST_MAX]; | ||
252 | struct st_data_s *core_data; | 265 | struct st_data_s *core_data; |
253 | struct chip_version version; | 266 | struct chip_version version; |
267 | unsigned char ldisc_install; | ||
268 | unsigned char dev_name[UART_DEV_NAME_LEN]; | ||
269 | unsigned char flow_cntrl; | ||
270 | unsigned long baud_rate; | ||
254 | }; | 271 | }; |
255 | 272 | ||
256 | /** | 273 | /** |
@@ -262,7 +279,6 @@ long st_kim_start(void *); | |||
262 | long st_kim_stop(void *); | 279 | long st_kim_stop(void *); |
263 | 280 | ||
264 | void st_kim_recv(void *, const unsigned char *, long count); | 281 | void st_kim_recv(void *, const unsigned char *, long count); |
265 | void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); | ||
266 | void st_kim_complete(void *); | 282 | void st_kim_complete(void *); |
267 | void kim_st_list_protocols(struct st_data_s *, void *); | 283 | void kim_st_list_protocols(struct st_data_s *, void *); |
268 | 284 | ||
@@ -338,12 +354,8 @@ struct hci_command { | |||
338 | 354 | ||
339 | /* ST LL receiver states */ | 355 | /* ST LL receiver states */ |
340 | #define ST_W4_PACKET_TYPE 0 | 356 | #define ST_W4_PACKET_TYPE 0 |
341 | #define ST_BT_W4_EVENT_HDR 1 | 357 | #define ST_W4_HEADER 1 |
342 | #define ST_BT_W4_ACL_HDR 2 | 358 | #define ST_W4_DATA 2 |
343 | #define ST_BT_W4_SCO_HDR 3 | ||
344 | #define ST_BT_W4_DATA 4 | ||
345 | #define ST_FM_W4_EVENT_HDR 5 | ||
346 | #define ST_GPS_W4_EVENT_HDR 6 | ||
347 | 359 | ||
348 | /* ST LL state machines */ | 360 | /* ST LL state machines */ |
349 | #define ST_LL_ASLEEP 0 | 361 | #define ST_LL_ASLEEP 0 |
@@ -397,4 +409,14 @@ struct gps_event_hdr { | |||
397 | u16 plen; | 409 | u16 plen; |
398 | } __attribute__ ((packed)); | 410 | } __attribute__ ((packed)); |
399 | 411 | ||
412 | /* platform data */ | ||
413 | struct ti_st_plat_data { | ||
414 | long nshutdown_gpio; | ||
415 | unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ | ||
416 | unsigned char flow_cntrl; /* flow control flag */ | ||
417 | unsigned long baud_rate; | ||
418 | int (*suspend)(struct platform_device *, pm_message_t); | ||
419 | int (*resume)(struct platform_device *); | ||
420 | }; | ||
421 | |||
400 | #endif /* TI_WILINK_ST_H */ | 422 | #endif /* TI_WILINK_ST_H */ |