diff options
author | Pavan Savoy <pavan_savoy@ti.com> | 2010-04-08 14:16:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 14:35:55 -0400 |
commit | d0088ce183ad111b203adc94dcc7dde2a590a198 (patch) | |
tree | d259e587d0ed23f9c877b95742637a3797379e7f /drivers/staging/ti-st/st_kim.h | |
parent | 53618cc1e51e1f406a467eca9d1dd2675f3ad88e (diff) |
Staging: sources for Init manager module
Kernel Space Init-Manager works along with User-Mode
Init Manager daemon running to maintain the UART state.
Communication between user-space daemon and this module can be
1. Via the pid written onto sysfs entry
2. Via the rfkill subsystem
It also is a platform driver with a relevant platform device
in the board-*.c along with the list of BT/FM/GPS chip enable
gpio configuration
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/ti-st/st_kim.h')
-rw-r--r-- | drivers/staging/ti-st/st_kim.h | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/drivers/staging/ti-st/st_kim.h b/drivers/staging/ti-st/st_kim.h new file mode 100644 index 00000000000..ff3270ec784 --- /dev/null +++ b/drivers/staging/ti-st/st_kim.h | |||
@@ -0,0 +1,150 @@ | |||
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 */ | ||