Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ti-st: mv headers to ti_wilink_st

move all the header information to ti_wilink_st.h.
This header would then not only serve the local modules like the st_core.c,
st_kim.c and st_ll.c but also the external modules/protocol drivers that are
dependent on the shared transport driver.
Modify the source files to include the new header ti_wilink_st.h,

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Pavan Savoy and committed by
Greg Kroah-Hartman
83ef41f0 5d702ea3

+417 -486
+1 -1
drivers/staging/ti-st/bt_drv.c
··· 24 24 #include <net/bluetooth/bluetooth.h> 25 25 #include <net/bluetooth/hci_core.h> 26 26 27 - #include "st.h" 27 + #include "ti_wilink_st.h" 28 28 #include "bt_drv.h" 29 29 30 30 /* Define this macro to get debug msg */
-13
drivers/staging/ti-st/fm.h
··· 1 - struct fm_event_hdr { 2 - u8 plen; 3 - } __attribute__ ((packed)); 4 - 5 - #define FM_MAX_FRAME_SIZE 0xFF /* TODO: */ 6 - #define FM_EVENT_HDR_SIZE 1 /* size of fm_event_hdr */ 7 - #define ST_FM_CH8_PKT 0x8 8 - 9 - /* gps stuff */ 10 - struct gps_event_hdr { 11 - u8 opcode; 12 - u16 plen; 13 - } __attribute__ ((packed));
-83
drivers/staging/ti-st/st.h
··· 1 - /* 2 - * Shared Transport Header file 3 - * To be included by the protocol stack drivers for 4 - * Texas Instruments BT,FM and GPS combo chip drivers 5 - * 6 - * Copyright (C) 2009 Texas Instruments 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 - * 21 - */ 22 - 23 - #ifndef ST_H 24 - #define ST_H 25 - 26 - #include <linux/skbuff.h> 27 - 28 - /* TODO: 29 - * Move the following to tty.h upon acceptance 30 - */ 31 - #define N_TI_WL 20 /* Ldisc for TI's WL BT, FM, GPS combo chips */ 32 - 33 - /** 34 - * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW 35 - * gpio states for their chip/core enable gpios 36 - */ 37 - enum kim_gpio_state { 38 - KIM_GPIO_INACTIVE, 39 - KIM_GPIO_ACTIVE, 40 - }; 41 - 42 - /** 43 - * enum proto-type - The protocol on WiLink chips which share a 44 - * common physical interface like UART. 45 - */ 46 - enum proto_type { 47 - ST_BT, 48 - ST_FM, 49 - ST_GPS, 50 - ST_MAX, 51 - }; 52 - 53 - /** 54 - * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST 55 - * @type: type of the protocol being registered among the 56 - * available proto_type(BT, FM, GPS the protocol which share TTY). 57 - * @recv: the receiver callback pointing to a function in the 58 - * protocol drivers called by the ST driver upon receiving 59 - * relevant data. 60 - * @match_packet: reserved for future use, to make ST more generic 61 - * @reg_complete_cb: callback handler pointing to a function in protocol 62 - * handler called by ST when the pending registrations are complete. 63 - * The registrations are marked pending, in situations when fw 64 - * download is in progress. 65 - * @write: pointer to function in ST provided to protocol drivers from ST, 66 - * to be made use when protocol drivers have data to send to TTY. 67 - * @priv_data: privdate data holder for the protocol drivers, sent 68 - * from the protocol drivers during registration, and sent back on 69 - * reg_complete_cb and recv. 70 - */ 71 - struct st_proto_s { 72 - enum proto_type type; 73 - long (*recv) (void *, struct sk_buff *); 74 - unsigned char (*match_packet) (const unsigned char *data); 75 - void (*reg_complete_cb) (void *, char data); 76 - long (*write) (struct sk_buff *skb); 77 - void *priv_data; 78 - }; 79 - 80 - extern long st_register(struct st_proto_s *); 81 - extern long st_unregister(enum proto_type); 82 - 83 - #endif /* ST_H */
+1 -9
drivers/staging/ti-st/st_core.c
··· 28 28 #include <net/bluetooth/bluetooth.h> 29 29 #include <net/bluetooth/hci_core.h> 30 30 #include <net/bluetooth/hci.h> 31 - #include "fm.h" 32 - /* 33 - * packet formats for fm and gps 34 - * #include "gps.h" 35 - */ 36 - #include "st_core.h" 37 - #include "st_kim.h" 38 - #include "st_ll.h" 39 - #include "st.h" 31 + #include "ti_wilink_st.h" 40 32 41 33 /* strings to be used for rfkill entries and by 42 34 * ST Core to be used for sysfs debug entry
-128
drivers/staging/ti-st/st_core.h
··· 1 - /* 2 - * Shared Transport Core header file 3 - * 4 - * Copyright (C) 2009 Texas Instruments 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 - * 19 - */ 20 - 21 - #ifndef ST_CORE_H 22 - #define ST_CORE_H 23 - 24 - #include <linux/skbuff.h> 25 - #include "st.h" 26 - 27 - /* states of protocol list */ 28 - #define ST_NOTEMPTY 1 29 - #define ST_EMPTY 0 30 - 31 - /* 32 - * possible st_states 33 - */ 34 - #define ST_INITIALIZING 1 35 - #define ST_REG_IN_PROGRESS 2 36 - #define ST_REG_PENDING 3 37 - #define ST_WAITING_FOR_RESP 4 38 - 39 - /** 40 - * struct st_data_s - ST core internal structure 41 - * @st_state: different states of ST like initializing, registration 42 - * in progress, this is mainly used to return relevant err codes 43 - * when protocol drivers are registering. It is also used to track 44 - * the recv function, as in during fw download only HCI events 45 - * can occur , where as during other times other events CH8, CH9 46 - * can occur. 47 - * @tty: tty provided by the TTY core for line disciplines. 48 - * @ldisc_ops: the procedures that this line discipline registers with TTY. 49 - * @tx_skb: If for some reason the tty's write returns lesser bytes written 50 - * then to maintain the rest of data to be written on next instance. 51 - * This needs to be protected, hence the lock inside wakeup func. 52 - * @tx_state: if the data is being written onto the TTY and protocol driver 53 - * wants to send more, queue up data and mark that there is 54 - * more data to send. 55 - * @list: the list of protocols registered, only MAX can exist, one protocol 56 - * can register only once. 57 - * @rx_state: states to be maintained inside st's tty receive 58 - * @rx_count: count to be maintained inside st's tty receieve 59 - * @rx_skb: the skb where all data for a protocol gets accumulated, 60 - * since tty might not call receive when a complete event packet 61 - * is received, the states, count and the skb needs to be maintained. 62 - * @txq: the list of skbs which needs to be sent onto the TTY. 63 - * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued 64 - * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs 65 - * from waitq can be moved onto the txq. 66 - * Needs locking too. 67 - * @lock: the lock to protect skbs, queues, and ST states. 68 - * @protos_registered: count of the protocols registered, also when 0 the 69 - * chip enable gpio can be toggled, and when it changes to 1 the fw 70 - * needs to be downloaded to initialize chip side ST. 71 - * @ll_state: the various PM states the chip can be, the states are notified 72 - * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND). 73 - * @kim_data: reference to the parent encapsulating structure. 74 - * 75 - */ 76 - struct st_data_s { 77 - unsigned long st_state; 78 - struct tty_struct *tty; 79 - struct tty_ldisc_ops *ldisc_ops; 80 - struct sk_buff *tx_skb; 81 - #define ST_TX_SENDING 1 82 - #define ST_TX_WAKEUP 2 83 - unsigned long tx_state; 84 - struct st_proto_s *list[ST_MAX]; 85 - unsigned long rx_state; 86 - unsigned long rx_count; 87 - struct sk_buff *rx_skb; 88 - struct sk_buff_head txq, tx_waitq; 89 - spinlock_t lock; 90 - unsigned char protos_registered; 91 - unsigned long ll_state; 92 - void *kim_data; 93 - }; 94 - 95 - /** 96 - * st_int_write - 97 - * point this to tty->driver->write or tty->ops->write 98 - * depending upon the kernel version 99 - */ 100 - int st_int_write(struct st_data_s*, const unsigned char*, int); 101 - 102 - /** 103 - * st_write - 104 - * internal write function, passed onto protocol drivers 105 - * via the write function ptr of protocol struct 106 - */ 107 - long st_write(struct sk_buff *); 108 - 109 - /* function to be called from ST-LL */ 110 - void st_ll_send_frame(enum proto_type, struct sk_buff *); 111 - 112 - /* internal wake up function */ 113 - void st_tx_wakeup(struct st_data_s *st_data); 114 - 115 - /* init, exit entry funcs called from KIM */ 116 - int st_core_init(struct st_data_s **); 117 - void st_core_exit(struct st_data_s *); 118 - 119 - /* ask for reference from KIM */ 120 - void st_kim_ref(struct st_data_s **, int); 121 - 122 - #define GPS_STUB_TEST 123 - #ifdef GPS_STUB_TEST 124 - int gps_chrdrv_stub_write(const unsigned char*, int); 125 - void gps_chrdrv_stub_init(void); 126 - #endif 127 - 128 - #endif /*ST_CORE_H */
+3 -2
drivers/staging/ti-st/st_kim.c
··· 28 28 #include <linux/gpio.h> 29 29 #include <linux/debugfs.h> 30 30 #include <linux/seq_file.h> 31 - 32 31 #include <linux/sched.h> 32 + #include <linux/rfkill.h> 33 33 34 - #include "st_kim.h" 35 34 /* understand BT events for fw response */ 36 35 #include <net/bluetooth/bluetooth.h> 37 36 #include <net/bluetooth/hci_core.h> 38 37 #include <net/bluetooth/hci.h> 38 + 39 + #include "ti_wilink_st.h" 39 40 40 41 41 42 static int kim_probe(struct platform_device *pdev);
-180
drivers/staging/ti-st/st_kim.h
··· 1 - /* 2 - * Shared Transport Line discipline driver Core 3 - * Init Manager Module header file 4 - * Copyright (C) 2009 Texas Instruments 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 - * 19 - */ 20 - 21 - #ifndef ST_KIM_H 22 - #define ST_KIM_H 23 - 24 - #include <linux/types.h> 25 - #include "st.h" 26 - #include "st_core.h" 27 - #include "st_ll.h" 28 - #include <linux/rfkill.h> 29 - 30 - /* time in msec to wait for 31 - * line discipline to be installed 32 - */ 33 - #define LDISC_TIME 500 34 - #define CMD_RESP_TIME 500 35 - #define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ 36 - | ((unsigned short)((unsigned char)(b))) << 8)) 37 - 38 - #define GPIO_HIGH 1 39 - #define GPIO_LOW 0 40 - 41 - /* the Power-On-Reset logic, requires to attempt 42 - * to download firmware onto chip more than once 43 - * since the self-test for chip takes a while 44 - */ 45 - #define POR_RETRY_COUNT 5 46 - 47 - /** 48 - * struct chip_version - save the chip version 49 - */ 50 - struct chip_version { 51 - unsigned short full; 52 - unsigned short chip; 53 - unsigned short min_ver; 54 - unsigned short maj_ver; 55 - }; 56 - 57 - /** 58 - * struct kim_data_s - the KIM internal data, embedded as the 59 - * platform's drv data. One for each ST device in the system. 60 - * @uim_pid: KIM needs to communicate with UIM to request to install 61 - * the ldisc by opening UART when protocol drivers register. 62 - * @kim_pdev: the platform device added in one of the board-XX.c file 63 - * in arch/XX/ directory, 1 for each ST device. 64 - * @kim_rcvd: completion handler to notify when data was received, 65 - * mainly used during fw download, which involves multiple send/wait 66 - * for each of the HCI-VS commands. 67 - * @ldisc_installed: completion handler to notify that the UIM accepted 68 - * the request to install ldisc, notify from tty_open which suggests 69 - * the ldisc was properly installed. 70 - * @resp_buffer: data buffer for the .bts fw file name. 71 - * @fw_entry: firmware class struct to request/release the fw. 72 - * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. 73 - * @rx_state: the rx state for kim's receive func during fw download. 74 - * @rx_count: the rx count for the kim's receive func during fw download. 75 - * @rx_skb: all of fw data might not come at once, and hence data storage for 76 - * whole of the fw response, only HCI_EVENTs and hence diff from ST's 77 - * response. 78 - * @rfkill: rfkill data for each of the cores to be registered with rfkill. 79 - * @rf_protos: proto types of the data registered with rfkill sub-system. 80 - * @core_data: ST core's data, which mainly is the tty's disc_data 81 - * @version: chip version available via a sysfs entry. 82 - * 83 - */ 84 - struct kim_data_s { 85 - long uim_pid; 86 - struct platform_device *kim_pdev; 87 - struct completion kim_rcvd, ldisc_installed; 88 - char resp_buffer[30]; 89 - const struct firmware *fw_entry; 90 - long gpios[ST_MAX]; 91 - unsigned long rx_state; 92 - unsigned long rx_count; 93 - struct sk_buff *rx_skb; 94 - struct rfkill *rfkill[ST_MAX]; 95 - enum proto_type rf_protos[ST_MAX]; 96 - struct st_data_s *core_data; 97 - struct chip_version version; 98 - }; 99 - 100 - /** 101 - * functions called when 1 of the protocol drivers gets 102 - * registered, these need to communicate with UIM to request 103 - * ldisc installed, read chip_version, download relevant fw 104 - */ 105 - long st_kim_start(void *); 106 - long st_kim_stop(void *); 107 - 108 - void st_kim_recv(void *, const unsigned char *, long count); 109 - void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); 110 - void st_kim_complete(void *); 111 - void kim_st_list_protocols(struct st_data_s *, void *); 112 - 113 - /* 114 - * BTS headers 115 - */ 116 - #define ACTION_SEND_COMMAND 1 117 - #define ACTION_WAIT_EVENT 2 118 - #define ACTION_SERIAL 3 119 - #define ACTION_DELAY 4 120 - #define ACTION_RUN_SCRIPT 5 121 - #define ACTION_REMARKS 6 122 - 123 - /** 124 - * struct bts_header - the fw file is NOT binary which can 125 - * be sent onto TTY as is. The .bts is more a script 126 - * file which has different types of actions. 127 - * Each such action needs to be parsed by the KIM and 128 - * relevant procedure to be called. 129 - */ 130 - struct bts_header { 131 - u32 magic; 132 - u32 version; 133 - u8 future[24]; 134 - u8 actions[0]; 135 - } __attribute__ ((packed)); 136 - 137 - /** 138 - * struct bts_action - Each .bts action has its own type of 139 - * data. 140 - */ 141 - struct bts_action { 142 - u16 type; 143 - u16 size; 144 - u8 data[0]; 145 - } __attribute__ ((packed)); 146 - 147 - struct bts_action_send { 148 - u8 data[0]; 149 - } __attribute__ ((packed)); 150 - 151 - struct bts_action_wait { 152 - u32 msec; 153 - u32 size; 154 - u8 data[0]; 155 - } __attribute__ ((packed)); 156 - 157 - struct bts_action_delay { 158 - u32 msec; 159 - } __attribute__ ((packed)); 160 - 161 - struct bts_action_serial { 162 - u32 baud; 163 - u32 flow_control; 164 - } __attribute__ ((packed)); 165 - 166 - /** 167 - * struct hci_command - the HCI-VS for intrepreting 168 - * the change baud rate of host-side UART, which 169 - * needs to be ignored, since UIM would do that 170 - * when it receives request from KIM for ldisc installation. 171 - */ 172 - struct hci_command { 173 - u8 prefix; 174 - u16 opcode; 175 - u8 plen; 176 - u32 speed; 177 - } __attribute__ ((packed)); 178 - 179 - 180 - #endif /* ST_KIM_H */
+3 -1
drivers/staging/ti-st/st_ll.c
··· 19 19 */ 20 20 21 21 #define pr_fmt(fmt) "(stll) :" fmt 22 - #include "st_ll.h" 22 + #include <linux/skbuff.h> 23 + #include <linux/module.h> 24 + #include "ti_wilink_st.h" 23 25 24 26 /**********************************************************************/ 25 27 /* internal functions */
-69
drivers/staging/ti-st/st_ll.h
··· 1 - /* 2 - * Shared Transport Low Level (ST LL) 3 - * 4 - * Copyright (C) 2009 Texas Instruments 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 - * 19 - */ 20 - 21 - #ifndef ST_LL_H 22 - #define ST_LL_H 23 - 24 - #include <linux/skbuff.h> 25 - #include "st.h" 26 - #include "st_core.h" 27 - 28 - /* ST LL receiver states */ 29 - #define ST_W4_PACKET_TYPE 0 30 - #define ST_BT_W4_EVENT_HDR 1 31 - #define ST_BT_W4_ACL_HDR 2 32 - #define ST_BT_W4_SCO_HDR 3 33 - #define ST_BT_W4_DATA 4 34 - #define ST_FM_W4_EVENT_HDR 5 35 - #define ST_GPS_W4_EVENT_HDR 6 36 - 37 - /* ST LL state machines */ 38 - #define ST_LL_ASLEEP 0 39 - #define ST_LL_ASLEEP_TO_AWAKE 1 40 - #define ST_LL_AWAKE 2 41 - #define ST_LL_AWAKE_TO_ASLEEP 3 42 - #define ST_LL_INVALID 4 43 - 44 - /* different PM notifications coming from chip */ 45 - #define LL_SLEEP_IND 0x30 46 - #define LL_SLEEP_ACK 0x31 47 - #define LL_WAKE_UP_IND 0x32 48 - #define LL_WAKE_UP_ACK 0x33 49 - 50 - /* initialize and de-init ST LL */ 51 - long st_ll_init(struct st_data_s *); 52 - long st_ll_deinit(struct st_data_s *); 53 - 54 - /** 55 - * enable/disable ST LL along with KIM start/stop 56 - * called by ST Core 57 - */ 58 - void st_ll_enable(struct st_data_s *); 59 - void st_ll_disable(struct st_data_s *); 60 - 61 - /** 62 - * various funcs used by ST core to set/get the various PM states 63 - * of the chip. 64 - */ 65 - unsigned long st_ll_getstate(struct st_data_s *); 66 - unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); 67 - void st_ll_wakeup(struct st_data_s *); 68 - 69 - #endif /* ST_LL_H */