Commit | Line | Data |
---|---|---|
d0088ce1 PS |
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 | * legacy rfkill support where-in 3 rfkill | |
48 | * devices are created for the 3 gpios | |
49 | * that ST has requested | |
50 | */ | |
51 | #define LEGACY_RFKILL_SUPPORT | |
52 | /* | |
53 | * header file for ST provided by KIM | |
54 | */ | |
55 | struct kim_data_s { | |
56 | long uim_pid; | |
57 | struct platform_device *kim_pdev; | |
58 | struct completion kim_rcvd, ldisc_installed; | |
59 | /* MAX len of the .bts firmware script name */ | |
60 | char resp_buffer[30]; | |
61 | const struct firmware *fw_entry; | |
62 | long gpios[ST_MAX]; | |
63 | struct kobject *kim_kobj; | |
64 | /* used by kim_int_recv to validate fw response */ | |
65 | unsigned long rx_state; | |
66 | unsigned long rx_count; | |
67 | struct sk_buff *rx_skb; | |
68 | #ifdef LEGACY_RFKILL_SUPPORT | |
69 | struct rfkill *rfkill[ST_MAX]; | |
70 | enum proto_type rf_protos[ST_MAX]; | |
71 | #endif | |
72 | struct st_data_s *core_data; | |
73 | }; | |
74 | ||
75 | long st_kim_start(void); | |
76 | long st_kim_stop(void); | |
77 | /* | |
78 | * called from st_tty_receive to authenticate fw_download | |
79 | */ | |
80 | void st_kim_recv(void *, const unsigned char *, long count); | |
81 | ||
82 | void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); | |
83 | ||
84 | void st_kim_complete(void); | |
85 | ||
86 | /* function called from ST KIM to ST Core, to | |
87 | * list out the protocols registered | |
88 | */ | |
89 | void kim_st_list_protocols(struct st_data_s *, char *); | |
90 | ||
91 | /* | |
92 | * BTS headers | |
93 | */ | |
94 | #define ACTION_SEND_COMMAND 1 | |
95 | #define ACTION_WAIT_EVENT 2 | |
96 | #define ACTION_SERIAL 3 | |
97 | #define ACTION_DELAY 4 | |
98 | #define ACTION_RUN_SCRIPT 5 | |
99 | #define ACTION_REMARKS 6 | |
100 | ||
101 | /* | |
102 | * * BRF Firmware header | |
103 | * */ | |
104 | struct bts_header { | |
105 | uint32_t magic; | |
106 | uint32_t version; | |
107 | uint8_t future[24]; | |
108 | uint8_t actions[0]; | |
109 | } __attribute__ ((packed)); | |
110 | ||
111 | /* | |
112 | * * BRF Actions structure | |
113 | * */ | |
114 | struct bts_action { | |
115 | uint16_t type; | |
116 | uint16_t size; | |
117 | uint8_t data[0]; | |
118 | } __attribute__ ((packed)); | |
119 | ||
120 | struct bts_action_send { | |
121 | uint8_t data[0]; | |
122 | } __attribute__ ((packed)); | |
123 | ||
124 | struct bts_action_wait { | |
125 | uint32_t msec; | |
126 | uint32_t size; | |
127 | uint8_t data[0]; | |
128 | } __attribute__ ((packed)); | |
129 | ||
130 | struct bts_action_delay { | |
131 | uint32_t msec; | |
132 | } __attribute__ ((packed)); | |
133 | ||
134 | struct bts_action_serial { | |
135 | uint32_t baud; | |
136 | uint32_t flow_control; | |
137 | } __attribute__ ((packed)); | |
138 | ||
139 | /* for identifying the change speed HCI VS | |
140 | * command | |
141 | */ | |
142 | struct hci_command { | |
143 | uint8_t prefix; | |
144 | uint16_t opcode; | |
145 | uint8_t plen; | |
146 | uint32_t speed; | |
147 | } __attribute__ ((packed)); | |
148 | ||
149 | ||
150 | #endif /* ST_KIM_H */ |