1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 2 /* 3 * Shared Transport Header file 3 * Shared Transport Header file 4 * To be included by the protocol stack d 4 * To be included by the protocol stack drivers for 5 * Texas Instruments BT,FM and GPS combo 5 * Texas Instruments BT,FM and GPS combo chip drivers 6 * and also serves the sub-modules of the 6 * and also serves the sub-modules of the shared transport driver. 7 * 7 * 8 * Copyright (C) 2009-2010 Texas Instruments 8 * Copyright (C) 2009-2010 Texas Instruments 9 * Author: Pavan Savoy <pavan_savoy@ti.com> 9 * Author: Pavan Savoy <pavan_savoy@ti.com> 10 */ 10 */ 11 11 12 #ifndef TI_WILINK_ST_H 12 #ifndef TI_WILINK_ST_H 13 #define TI_WILINK_ST_H 13 #define TI_WILINK_ST_H 14 14 15 #include <linux/skbuff.h> 15 #include <linux/skbuff.h> 16 16 17 /** 17 /** 18 * enum proto-type - The protocol on WiLink ch 18 * enum proto-type - The protocol on WiLink chips which share a 19 * common physical interface like UART. 19 * common physical interface like UART. 20 */ 20 */ 21 enum proto_type { 21 enum proto_type { 22 ST_BT, 22 ST_BT, 23 ST_FM, 23 ST_FM, 24 ST_GPS, 24 ST_GPS, 25 ST_MAX_CHANNELS = 16, 25 ST_MAX_CHANNELS = 16, 26 }; 26 }; 27 27 28 /** 28 /** 29 * struct st_proto_s - Per Protocol structure 29 * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST 30 * @type: type of the protocol being registere 30 * @type: type of the protocol being registered among the 31 * available proto_type(BT, FM, GPS the p 31 * available proto_type(BT, FM, GPS the protocol which share TTY). 32 * @recv: the receiver callback pointing to a 32 * @recv: the receiver callback pointing to a function in the 33 * protocol drivers called by the ST driv 33 * protocol drivers called by the ST driver upon receiving 34 * relevant data. 34 * relevant data. 35 * @match_packet: reserved for future use, to 35 * @match_packet: reserved for future use, to make ST more generic 36 * @reg_complete_cb: callback handler pointing 36 * @reg_complete_cb: callback handler pointing to a function in protocol 37 * handler called by ST when the pending 37 * handler called by ST when the pending registrations are complete. 38 * The registrations are marked pending, 38 * The registrations are marked pending, in situations when fw 39 * download is in progress. 39 * download is in progress. 40 * @write: pointer to function in ST provided 40 * @write: pointer to function in ST provided to protocol drivers from ST, 41 * to be made use when protocol drivers h 41 * to be made use when protocol drivers have data to send to TTY. 42 * @priv_data: privdate data holder for the pr 42 * @priv_data: privdate data holder for the protocol drivers, sent 43 * from the protocol drivers during regis 43 * from the protocol drivers during registration, and sent back on 44 * reg_complete_cb and recv. 44 * reg_complete_cb and recv. 45 * @chnl_id: channel id the protocol driver is 45 * @chnl_id: channel id the protocol driver is interested in, the channel 46 * id is nothing but the 1st byte of the 46 * id is nothing but the 1st byte of the packet in UART frame. 47 * @max_frame_size: size of the largest frame 47 * @max_frame_size: size of the largest frame the protocol can receive. 48 * @hdr_len: length of the header structure of 48 * @hdr_len: length of the header structure of the protocol. 49 * @offset_len_in_hdr: this provides the offse 49 * @offset_len_in_hdr: this provides the offset of the length field in the 50 * header structure of the protocol heade 50 * header structure of the protocol header, to assist ST to know 51 * how much to receive, if the data is sp 51 * how much to receive, if the data is split across UART frames. 52 * @len_size: whether the length field inside 52 * @len_size: whether the length field inside the header is 2 bytes 53 * or 1 byte. 53 * or 1 byte. 54 * @reserve: the number of bytes ST needs to r 54 * @reserve: the number of bytes ST needs to reserve in the skb being 55 * prepared for the protocol driver. 55 * prepared for the protocol driver. 56 */ 56 */ 57 struct st_proto_s { 57 struct st_proto_s { 58 enum proto_type type; 58 enum proto_type type; 59 long (*recv) (void *, struct sk_buff * 59 long (*recv) (void *, struct sk_buff *); 60 unsigned char (*match_packet) (const u 60 unsigned char (*match_packet) (const unsigned char *data); 61 void (*reg_complete_cb) (void *, int d 61 void (*reg_complete_cb) (void *, int data); 62 long (*write) (struct sk_buff *skb); 62 long (*write) (struct sk_buff *skb); 63 void *priv_data; 63 void *priv_data; 64 64 65 unsigned char chnl_id; 65 unsigned char chnl_id; 66 unsigned short max_frame_size; 66 unsigned short max_frame_size; 67 unsigned char hdr_len; 67 unsigned char hdr_len; 68 unsigned char offset_len_in_hdr; 68 unsigned char offset_len_in_hdr; 69 unsigned char len_size; 69 unsigned char len_size; 70 unsigned char reserve; 70 unsigned char reserve; 71 }; 71 }; 72 72 73 extern long st_register(struct st_proto_s *); 73 extern long st_register(struct st_proto_s *); 74 extern long st_unregister(struct st_proto_s *) 74 extern long st_unregister(struct st_proto_s *); 75 75 76 76 77 /* 77 /* 78 * header information used by st_core.c 78 * header information used by st_core.c 79 */ 79 */ 80 80 81 /* states of protocol list */ 81 /* states of protocol list */ 82 #define ST_NOTEMPTY 1 82 #define ST_NOTEMPTY 1 83 #define ST_EMPTY 0 83 #define ST_EMPTY 0 84 84 85 /* 85 /* 86 * possible st_states 86 * possible st_states 87 */ 87 */ 88 #define ST_INITIALIZING 1 88 #define ST_INITIALIZING 1 89 #define ST_REG_IN_PROGRESS 2 89 #define ST_REG_IN_PROGRESS 2 90 #define ST_REG_PENDING 3 90 #define ST_REG_PENDING 3 91 #define ST_WAITING_FOR_RESP 4 91 #define ST_WAITING_FOR_RESP 4 92 92 93 /** 93 /** 94 * struct st_data_s - ST core internal structu 94 * struct st_data_s - ST core internal structure 95 * @st_state: different states of ST like init 95 * @st_state: different states of ST like initializing, registration 96 * in progress, this is mainly used to re 96 * in progress, this is mainly used to return relevant err codes 97 * when protocol drivers are registering. 97 * when protocol drivers are registering. It is also used to track 98 * the recv function, as in during fw dow 98 * the recv function, as in during fw download only HCI events 99 * can occur , where as during other time 99 * can occur , where as during other times other events CH8, CH9 100 * can occur. 100 * can occur. 101 * @tty: tty provided by the TTY core for line 101 * @tty: tty provided by the TTY core for line disciplines. 102 * @tx_skb: If for some reason the tty's write 102 * @tx_skb: If for some reason the tty's write returns lesser bytes written 103 * then to maintain the rest of data to b 103 * then to maintain the rest of data to be written on next instance. 104 * This needs to be protected, hence the 104 * This needs to be protected, hence the lock inside wakeup func. 105 * @tx_state: if the data is being written ont 105 * @tx_state: if the data is being written onto the TTY and protocol driver 106 * wants to send more, queue up data and 106 * wants to send more, queue up data and mark that there is 107 * more data to send. 107 * more data to send. 108 * @list: the list of protocols registered, on 108 * @list: the list of protocols registered, only MAX can exist, one protocol 109 * can register only once. 109 * can register only once. 110 * @rx_state: states to be maintained inside s 110 * @rx_state: states to be maintained inside st's tty receive 111 * @rx_count: count to be maintained inside st 111 * @rx_count: count to be maintained inside st's tty receieve 112 * @rx_skb: the skb where all data for a proto 112 * @rx_skb: the skb where all data for a protocol gets accumulated, 113 * since tty might not call receive when 113 * since tty might not call receive when a complete event packet 114 * is received, the states, count and the 114 * is received, the states, count and the skb needs to be maintained. 115 * @rx_chnl: the channel ID for which the data 115 * @rx_chnl: the channel ID for which the data is getting accumalated for. 116 * @txq: the list of skbs which needs to be se 116 * @txq: the list of skbs which needs to be sent onto the TTY. 117 * @tx_waitq: if the chip is not in AWAKE stat 117 * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued 118 * up in here, PM(WAKEUP_IND) data needs 118 * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs 119 * from waitq can be moved onto the txq. 119 * from waitq can be moved onto the txq. 120 * Needs locking too. 120 * Needs locking too. 121 * @lock: the lock to protect skbs, queues, an 121 * @lock: the lock to protect skbs, queues, and ST states. 122 * @protos_registered: count of the protocols 122 * @protos_registered: count of the protocols registered, also when 0 the 123 * chip enable gpio can be toggled, and w 123 * chip enable gpio can be toggled, and when it changes to 1 the fw 124 * needs to be downloaded to initialize c 124 * needs to be downloaded to initialize chip side ST. 125 * @ll_state: the various PM states the chip c 125 * @ll_state: the various PM states the chip can be, the states are notified 126 * to us, when the chip sends relevant PM 126 * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND). 127 * @kim_data: reference to the parent encapsul 127 * @kim_data: reference to the parent encapsulating structure. 128 * 128 * 129 */ 129 */ 130 struct st_data_s { 130 struct st_data_s { 131 unsigned long st_state; 131 unsigned long st_state; 132 struct sk_buff *tx_skb; 132 struct sk_buff *tx_skb; 133 #define ST_TX_SENDING 1 133 #define ST_TX_SENDING 1 134 #define ST_TX_WAKEUP 2 134 #define ST_TX_WAKEUP 2 135 unsigned long tx_state; 135 unsigned long tx_state; 136 struct st_proto_s *list[ST_MAX_CHANNEL 136 struct st_proto_s *list[ST_MAX_CHANNELS]; 137 bool is_registered[ST_MAX_CHANNELS]; 137 bool is_registered[ST_MAX_CHANNELS]; 138 unsigned long rx_state; 138 unsigned long rx_state; 139 unsigned long rx_count; 139 unsigned long rx_count; 140 struct sk_buff *rx_skb; 140 struct sk_buff *rx_skb; 141 unsigned char rx_chnl; 141 unsigned char rx_chnl; 142 struct sk_buff_head txq, tx_waitq; 142 struct sk_buff_head txq, tx_waitq; 143 spinlock_t lock; 143 spinlock_t lock; 144 unsigned char protos_registered; 144 unsigned char protos_registered; 145 unsigned long ll_state; 145 unsigned long ll_state; 146 void *kim_data; 146 void *kim_data; 147 struct tty_struct *tty; 147 struct tty_struct *tty; 148 struct work_struct work_write_wakeup; 148 struct work_struct work_write_wakeup; 149 }; 149 }; 150 150 151 /* 151 /* 152 * wrapper around tty->ops->write_room to chec 152 * wrapper around tty->ops->write_room to check 153 * availability during firmware download 153 * availability during firmware download 154 */ 154 */ 155 int st_get_uart_wr_room(struct st_data_s *st_g 155 int st_get_uart_wr_room(struct st_data_s *st_gdata); 156 /** 156 /** 157 * st_int_write - 157 * st_int_write - 158 * point this to tty->driver->write or tty->op 158 * point this to tty->driver->write or tty->ops->write 159 * depending upon the kernel version 159 * depending upon the kernel version 160 */ 160 */ 161 int st_int_write(struct st_data_s*, const unsi 161 int st_int_write(struct st_data_s*, const unsigned char*, int); 162 162 163 /** 163 /** 164 * st_write - 164 * st_write - 165 * internal write function, passed onto protoc 165 * internal write function, passed onto protocol drivers 166 * via the write function ptr of protocol stru 166 * via the write function ptr of protocol struct 167 */ 167 */ 168 long st_write(struct sk_buff *); 168 long st_write(struct sk_buff *); 169 169 170 /* function to be called from ST-LL */ 170 /* function to be called from ST-LL */ 171 void st_ll_send_frame(enum proto_type, struct 171 void st_ll_send_frame(enum proto_type, struct sk_buff *); 172 172 173 /* internal wake up function */ 173 /* internal wake up function */ 174 void st_tx_wakeup(struct st_data_s *st_data); 174 void st_tx_wakeup(struct st_data_s *st_data); 175 175 176 /* init, exit entry funcs called from KIM */ 176 /* init, exit entry funcs called from KIM */ 177 int st_core_init(struct st_data_s **); 177 int st_core_init(struct st_data_s **); 178 void st_core_exit(struct st_data_s *); 178 void st_core_exit(struct st_data_s *); 179 179 180 /* ask for reference from KIM */ 180 /* ask for reference from KIM */ 181 void st_kim_ref(struct st_data_s **, int); 181 void st_kim_ref(struct st_data_s **, int); 182 182 183 #define GPS_STUB_TEST 183 #define GPS_STUB_TEST 184 #ifdef GPS_STUB_TEST 184 #ifdef GPS_STUB_TEST 185 int gps_chrdrv_stub_write(const unsigned char* 185 int gps_chrdrv_stub_write(const unsigned char*, int); 186 void gps_chrdrv_stub_init(void); 186 void gps_chrdrv_stub_init(void); 187 #endif 187 #endif 188 188 189 /* 189 /* 190 * header information used by st_kim.c 190 * header information used by st_kim.c 191 */ 191 */ 192 192 193 /* time in msec to wait for 193 /* time in msec to wait for 194 * line discipline to be installed 194 * line discipline to be installed 195 */ 195 */ 196 #define LDISC_TIME 1000 196 #define LDISC_TIME 1000 197 #define CMD_RESP_TIME 800 197 #define CMD_RESP_TIME 800 198 #define CMD_WR_TIME 5000 198 #define CMD_WR_TIME 5000 199 #define MAKEWORD(a, b) ((unsigned short)(((un 199 #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ 200 | ((unsigned short)((unsigned char)(b) 200 | ((unsigned short)((unsigned char)(b))) << 8)) 201 201 202 #define GPIO_HIGH 1 202 #define GPIO_HIGH 1 203 #define GPIO_LOW 0 203 #define GPIO_LOW 0 204 204 205 /* the Power-On-Reset logic, requires to attem 205 /* the Power-On-Reset logic, requires to attempt 206 * to download firmware onto chip more than on 206 * to download firmware onto chip more than once 207 * since the self-test for chip takes a while 207 * since the self-test for chip takes a while 208 */ 208 */ 209 #define POR_RETRY_COUNT 5 209 #define POR_RETRY_COUNT 5 210 210 211 /** 211 /** 212 * struct chip_version - save the chip version 212 * struct chip_version - save the chip version 213 */ 213 */ 214 struct chip_version { 214 struct chip_version { 215 unsigned short full; 215 unsigned short full; 216 unsigned short chip; 216 unsigned short chip; 217 unsigned short min_ver; 217 unsigned short min_ver; 218 unsigned short maj_ver; 218 unsigned short maj_ver; 219 }; 219 }; 220 220 221 #define UART_DEV_NAME_LEN 32 221 #define UART_DEV_NAME_LEN 32 222 /** 222 /** 223 * struct kim_data_s - the KIM internal data, 223 * struct kim_data_s - the KIM internal data, embedded as the 224 * platform's drv data. One for each ST d 224 * platform's drv data. One for each ST device in the system. 225 * @uim_pid: KIM needs to communicate with UIM 225 * @uim_pid: KIM needs to communicate with UIM to request to install 226 * the ldisc by opening UART when protoco 226 * the ldisc by opening UART when protocol drivers register. 227 * @kim_pdev: the platform device added in one 227 * @kim_pdev: the platform device added in one of the board-XX.c file 228 * in arch/XX/ directory, 1 for each ST d 228 * in arch/XX/ directory, 1 for each ST device. 229 * @kim_rcvd: completion handler to notify whe 229 * @kim_rcvd: completion handler to notify when data was received, 230 * mainly used during fw download, which 230 * mainly used during fw download, which involves multiple send/wait 231 * for each of the HCI-VS commands. 231 * for each of the HCI-VS commands. 232 * @ldisc_installed: completion handler to not 232 * @ldisc_installed: completion handler to notify that the UIM accepted 233 * the request to install ldisc, notify f 233 * the request to install ldisc, notify from tty_open which suggests 234 * the ldisc was properly installed. 234 * the ldisc was properly installed. 235 * @resp_buffer: data buffer for the .bts fw f 235 * @resp_buffer: data buffer for the .bts fw file name. 236 * @fw_entry: firmware class struct to request 236 * @fw_entry: firmware class struct to request/release the fw. 237 * @rx_state: the rx state for kim's receive f 237 * @rx_state: the rx state for kim's receive func during fw download. 238 * @rx_count: the rx count for the kim's recei 238 * @rx_count: the rx count for the kim's receive func during fw download. 239 * @rx_skb: all of fw data might not come at o 239 * @rx_skb: all of fw data might not come at once, and hence data storage for 240 * whole of the fw response, only HCI_EVE 240 * whole of the fw response, only HCI_EVENTs and hence diff from ST's 241 * response. 241 * response. 242 * @core_data: ST core's data, which mainly is 242 * @core_data: ST core's data, which mainly is the tty's disc_data 243 * @version: chip version available via a sysf 243 * @version: chip version available via a sysfs entry. 244 * 244 * 245 */ 245 */ 246 struct kim_data_s { 246 struct kim_data_s { 247 long uim_pid; 247 long uim_pid; 248 struct platform_device *kim_pdev; 248 struct platform_device *kim_pdev; 249 struct completion kim_rcvd, ldisc_inst 249 struct completion kim_rcvd, ldisc_installed; 250 char resp_buffer[30]; 250 char resp_buffer[30]; 251 const struct firmware *fw_entry; 251 const struct firmware *fw_entry; 252 unsigned nshutdown; 252 unsigned nshutdown; 253 unsigned long rx_state; 253 unsigned long rx_state; 254 unsigned long rx_count; 254 unsigned long rx_count; 255 struct sk_buff *rx_skb; 255 struct sk_buff *rx_skb; 256 struct st_data_s *core_data; 256 struct st_data_s *core_data; 257 struct chip_version version; 257 struct chip_version version; 258 unsigned char ldisc_install; 258 unsigned char ldisc_install; 259 unsigned char dev_name[UART_DEV_NAME_L 259 unsigned char dev_name[UART_DEV_NAME_LEN + 1]; 260 unsigned flow_cntrl; 260 unsigned flow_cntrl; 261 unsigned baud_rate; 261 unsigned baud_rate; 262 }; 262 }; 263 263 264 /** 264 /** 265 * functions called when 1 of the protocol dri 265 * functions called when 1 of the protocol drivers gets 266 * registered, these need to communicate with 266 * registered, these need to communicate with UIM to request 267 * ldisc installed, read chip_version, downloa 267 * ldisc installed, read chip_version, download relevant fw 268 */ 268 */ 269 long st_kim_start(void *); 269 long st_kim_start(void *); 270 long st_kim_stop(void *); 270 long st_kim_stop(void *); 271 271 272 void st_kim_complete(void *); 272 void st_kim_complete(void *); 273 void kim_st_list_protocols(struct st_data_s *, 273 void kim_st_list_protocols(struct st_data_s *, void *); 274 void st_kim_recv(void *disc_data, const u8 *da !! 274 void st_kim_recv(void *, const unsigned char *, long); 275 275 276 276 277 /* 277 /* 278 * BTS headers 278 * BTS headers 279 */ 279 */ 280 #define ACTION_SEND_COMMAND 1 280 #define ACTION_SEND_COMMAND 1 281 #define ACTION_WAIT_EVENT 2 281 #define ACTION_WAIT_EVENT 2 282 #define ACTION_SERIAL 3 282 #define ACTION_SERIAL 3 283 #define ACTION_DELAY 4 283 #define ACTION_DELAY 4 284 #define ACTION_RUN_SCRIPT 5 284 #define ACTION_RUN_SCRIPT 5 285 #define ACTION_REMARKS 6 285 #define ACTION_REMARKS 6 286 286 287 /** 287 /** 288 * struct bts_header - the fw file is NOT bina 288 * struct bts_header - the fw file is NOT binary which can 289 * be sent onto TTY as is. The .bts is mo 289 * be sent onto TTY as is. The .bts is more a script 290 * file which has different types of acti 290 * file which has different types of actions. 291 * Each such action needs to be parsed by 291 * Each such action needs to be parsed by the KIM and 292 * relevant procedure to be called. 292 * relevant procedure to be called. 293 */ 293 */ 294 struct bts_header { 294 struct bts_header { 295 u32 magic; 295 u32 magic; 296 u32 version; 296 u32 version; 297 u8 future[24]; 297 u8 future[24]; 298 u8 actions[]; 298 u8 actions[]; 299 } __attribute__ ((packed)); 299 } __attribute__ ((packed)); 300 300 301 /** 301 /** 302 * struct bts_action - Each .bts action has it 302 * struct bts_action - Each .bts action has its own type of 303 * data. 303 * data. 304 */ 304 */ 305 struct bts_action { 305 struct bts_action { 306 u16 type; 306 u16 type; 307 u16 size; 307 u16 size; 308 u8 data[]; 308 u8 data[]; 309 } __attribute__ ((packed)); 309 } __attribute__ ((packed)); 310 310 311 struct bts_action_send { 311 struct bts_action_send { 312 u8 data[0]; 312 u8 data[0]; 313 } __attribute__ ((packed)); 313 } __attribute__ ((packed)); 314 314 315 struct bts_action_wait { 315 struct bts_action_wait { 316 u32 msec; 316 u32 msec; 317 u32 size; 317 u32 size; 318 u8 data[]; 318 u8 data[]; 319 } __attribute__ ((packed)); 319 } __attribute__ ((packed)); 320 320 321 struct bts_action_delay { 321 struct bts_action_delay { 322 u32 msec; 322 u32 msec; 323 } __attribute__ ((packed)); 323 } __attribute__ ((packed)); 324 324 325 struct bts_action_serial { 325 struct bts_action_serial { 326 u32 baud; 326 u32 baud; 327 u32 flow_control; 327 u32 flow_control; 328 } __attribute__ ((packed)); 328 } __attribute__ ((packed)); 329 329 330 /** 330 /** 331 * struct hci_command - the HCI-VS for intrepr 331 * struct hci_command - the HCI-VS for intrepreting 332 * the change baud rate of host-side UART 332 * the change baud rate of host-side UART, which 333 * needs to be ignored, since UIM would d 333 * needs to be ignored, since UIM would do that 334 * when it receives request from KIM for 334 * when it receives request from KIM for ldisc installation. 335 */ 335 */ 336 struct hci_command { 336 struct hci_command { 337 u8 prefix; 337 u8 prefix; 338 u16 opcode; 338 u16 opcode; 339 u8 plen; 339 u8 plen; 340 u32 speed; 340 u32 speed; 341 } __attribute__ ((packed)); 341 } __attribute__ ((packed)); 342 342 343 /* 343 /* 344 * header information used by st_ll.c 344 * header information used by st_ll.c 345 */ 345 */ 346 346 347 /* ST LL receiver states */ 347 /* ST LL receiver states */ 348 #define ST_W4_PACKET_TYPE 0 348 #define ST_W4_PACKET_TYPE 0 349 #define ST_W4_HEADER 1 349 #define ST_W4_HEADER 1 350 #define ST_W4_DATA 2 350 #define ST_W4_DATA 2 351 351 352 /* ST LL state machines */ 352 /* ST LL state machines */ 353 #define ST_LL_ASLEEP 0 353 #define ST_LL_ASLEEP 0 354 #define ST_LL_ASLEEP_TO_AWAKE 1 354 #define ST_LL_ASLEEP_TO_AWAKE 1 355 #define ST_LL_AWAKE 2 355 #define ST_LL_AWAKE 2 356 #define ST_LL_AWAKE_TO_ASLEEP 3 356 #define ST_LL_AWAKE_TO_ASLEEP 3 357 #define ST_LL_INVALID 4 357 #define ST_LL_INVALID 4 358 358 359 /* different PM notifications coming from chip 359 /* different PM notifications coming from chip */ 360 #define LL_SLEEP_IND 0x30 360 #define LL_SLEEP_IND 0x30 361 #define LL_SLEEP_ACK 0x31 361 #define LL_SLEEP_ACK 0x31 362 #define LL_WAKE_UP_IND 0x32 362 #define LL_WAKE_UP_IND 0x32 363 #define LL_WAKE_UP_ACK 0x33 363 #define LL_WAKE_UP_ACK 0x33 364 364 365 /* initialize and de-init ST LL */ 365 /* initialize and de-init ST LL */ 366 long st_ll_init(struct st_data_s *); 366 long st_ll_init(struct st_data_s *); 367 long st_ll_deinit(struct st_data_s *); 367 long st_ll_deinit(struct st_data_s *); 368 368 369 /** 369 /** 370 * enable/disable ST LL along with KIM start/s 370 * enable/disable ST LL along with KIM start/stop 371 * called by ST Core 371 * called by ST Core 372 */ 372 */ 373 void st_ll_enable(struct st_data_s *); 373 void st_ll_enable(struct st_data_s *); 374 void st_ll_disable(struct st_data_s *); 374 void st_ll_disable(struct st_data_s *); 375 375 376 /** 376 /** 377 * various funcs used by ST core to set/get th 377 * various funcs used by ST core to set/get the various PM states 378 * of the chip. 378 * of the chip. 379 */ 379 */ 380 unsigned long st_ll_getstate(struct st_data_s 380 unsigned long st_ll_getstate(struct st_data_s *); 381 unsigned long st_ll_sleep_state(struct st_data 381 unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); 382 void st_ll_wakeup(struct st_data_s *); 382 void st_ll_wakeup(struct st_data_s *); 383 383 384 /* 384 /* 385 * header information used by st_core.c for FM 385 * header information used by st_core.c for FM and GPS 386 * packet parsing, the bluetooth headers are a 386 * packet parsing, the bluetooth headers are already available 387 * at net/bluetooth/ 387 * at net/bluetooth/ 388 */ 388 */ 389 389 390 struct fm_event_hdr { 390 struct fm_event_hdr { 391 u8 plen; 391 u8 plen; 392 } __attribute__ ((packed)); 392 } __attribute__ ((packed)); 393 393 394 #define FM_MAX_FRAME_SIZE 0xFF /* TODO: */ 394 #define FM_MAX_FRAME_SIZE 0xFF /* TODO: */ 395 #define FM_EVENT_HDR_SIZE 1 /* size of fm_ 395 #define FM_EVENT_HDR_SIZE 1 /* size of fm_event_hdr */ 396 #define ST_FM_CH8_PKT 0x8 396 #define ST_FM_CH8_PKT 0x8 397 397 398 /* gps stuff */ 398 /* gps stuff */ 399 struct gps_event_hdr { 399 struct gps_event_hdr { 400 u8 opcode; 400 u8 opcode; 401 u16 plen; 401 u16 plen; 402 } __attribute__ ((packed)); 402 } __attribute__ ((packed)); 403 403 404 /** 404 /** 405 * struct ti_st_plat_data - platform data shar 405 * struct ti_st_plat_data - platform data shared between ST driver and 406 * platform specific board file which add 406 * platform specific board file which adds the ST device. 407 * @nshutdown_gpio: Host's GPIO line to which 407 * @nshutdown_gpio: Host's GPIO line to which chip's BT_EN is connected. 408 * @dev_name: The UART/TTY name to which chip 408 * @dev_name: The UART/TTY name to which chip is interfaced. (eg: /dev/ttyS1) 409 * @flow_cntrl: Should always be 1, since UART 409 * @flow_cntrl: Should always be 1, since UART's CTS/RTS is used for PM 410 * purposes. 410 * purposes. 411 * @baud_rate: The baud rate supported by the 411 * @baud_rate: The baud rate supported by the Host UART controller, this will 412 * be shared across with the chip via a H 412 * be shared across with the chip via a HCI VS command from User-Space Init 413 * Mgr application. 413 * Mgr application. 414 * @suspend: 414 * @suspend: 415 * @resume: legacy PM routines hooked to platf 415 * @resume: legacy PM routines hooked to platform specific board file, so as 416 * to take chip-host interface specific a 416 * to take chip-host interface specific action. 417 * @chip_enable: 417 * @chip_enable: 418 * @chip_disable: Platform/Interface specific 418 * @chip_disable: Platform/Interface specific mux mode setting, GPIO 419 * configuring, Host side PM disabling et 419 * configuring, Host side PM disabling etc.. can be done here. 420 * @chip_asleep: 420 * @chip_asleep: 421 * @chip_awake: Chip specific deep sleep state 421 * @chip_awake: Chip specific deep sleep states is communicated to Host 422 * specific board-xx.c to take actions su 422 * specific board-xx.c to take actions such as cut UART clocks when chip 423 * asleep or run host faster when chip aw 423 * asleep or run host faster when chip awake etc.. 424 * 424 * 425 */ 425 */ 426 struct ti_st_plat_data { 426 struct ti_st_plat_data { 427 u32 nshutdown_gpio; 427 u32 nshutdown_gpio; 428 unsigned char dev_name[UART_DEV_NAME_L 428 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ 429 u32 flow_cntrl; /* flow control flag * 429 u32 flow_cntrl; /* flow control flag */ 430 u32 baud_rate; 430 u32 baud_rate; 431 int (*suspend)(struct platform_device 431 int (*suspend)(struct platform_device *, pm_message_t); 432 int (*resume)(struct platform_device * 432 int (*resume)(struct platform_device *); 433 int (*chip_enable) (struct kim_data_s 433 int (*chip_enable) (struct kim_data_s *); 434 int (*chip_disable) (struct kim_data_s 434 int (*chip_disable) (struct kim_data_s *); 435 int (*chip_asleep) (struct kim_data_s 435 int (*chip_asleep) (struct kim_data_s *); 436 int (*chip_awake) (struct kim_data_s * 436 int (*chip_awake) (struct kim_data_s *); 437 }; 437 }; 438 438 439 #endif /* TI_WILINK_ST_H */ 439 #endif /* TI_WILINK_ST_H */ 440 440
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.