Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chromeos/drivers/ath6kl/os/linux/hci_bridge.c

Issue 3579004: ath6kl: Bringing in the upstream version (Closed) Base URL: http://git.chromium.org/git/kernel.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 //------------------------------------------------------------------------------ 1 //------------------------------------------------------------------------------
2 // <copyright file="hci_bridge.c" company="Atheros"> 2 // Copyright (c) 2009-2010 Atheros Corporation. All rights reserved.
3 // Copyright (c) 2009 Atheros Corporation. All rights reserved.
4 // 3 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 // 4 //
9 // Software distributed under the License is distributed on an "AS 5 // Permission to use, copy, modify, and/or distribute this software for any
10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 6 // purpose with or without fee is hereby granted, provided that the above
11 // implied. See the License for the specific language governing 7 // copyright notice and this permission notice appear in all copies.
12 // rights and limitations under the License. 8 //
9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13 // 16 //
14 // 17 //
15 //------------------------------------------------------------------------------ 18 //------------------------------------------------------------------------------
16 //============================================================================== 19 //==============================================================================
17 // HCI bridge implementation 20 // HCI bridge implementation
18 // 21 //
19 // Author(s): ="Atheros" 22 // Author(s): ="Atheros"
20 //============================================================================== 23 //==============================================================================
21 24
22 #ifdef EXPORT_HCI_BRIDGE_INTERFACE 25 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
(...skipping 21 matching lines...) Expand all
44 #include "export_hci_transport.h" 47 #include "export_hci_transport.h"
45 #else 48 #else
46 #include "hci_transport_api.h" 49 #include "hci_transport_api.h"
47 #endif 50 #endif
48 #include "epping_test.h" 51 #include "epping_test.h"
49 #include "gmboxif.h" 52 #include "gmboxif.h"
50 #include "ar3kconfig.h" 53 #include "ar3kconfig.h"
51 #include <net/bluetooth/bluetooth.h> 54 #include <net/bluetooth/bluetooth.h>
52 #include <net/bluetooth/hci_core.h> 55 #include <net/bluetooth/hci_core.h>
53 56
54 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
55 /* only build on newer kernels which have BT configured */ 57 /* only build on newer kernels which have BT configured */
56 #if defined(CONFIG_BT_MODULE) || defined(CONFIG_BT) 58 #if defined(CONFIG_BT_MODULE) || defined(CONFIG_BT)
57 #define CONFIG_BLUEZ_HCI_BRIDGE 59 #define CONFIG_BLUEZ_HCI_BRIDGE
58 #endif 60 #endif
59 #endif
60 61
61 #ifdef EXPORT_HCI_BRIDGE_INTERFACE 62 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
62 unsigned int ar3khcibaud = 0; 63 unsigned int ar3khcibaud = 0;
63 unsigned int hciuartscale = 0; 64 unsigned int hciuartscale = 0;
64 unsigned int hciuartstep = 0; 65 unsigned int hciuartstep = 0;
65 66
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
67 module_param(ar3khcibaud, int, 0644); 67 module_param(ar3khcibaud, int, 0644);
68 module_param(hciuartscale, int, 0644); 68 module_param(hciuartscale, int, 0644);
69 module_param(hciuartstep, int, 0644); 69 module_param(hciuartstep, int, 0644);
70 #else 70 #else
71
72 #define __user
73 /* for linux 2.4 and lower */
74 MODULE_PARM(ar3khcibaud, "i");
75 MODULE_PARM(hciuartscale, "i");
76 MODULE_PARM(hciuartstep, "i");
77 #endif
78 #else
79 extern unsigned int ar3khcibaud; 71 extern unsigned int ar3khcibaud;
80 extern unsigned int hciuartscale; 72 extern unsigned int hciuartscale;
81 extern unsigned int hciuartstep; 73 extern unsigned int hciuartstep;
82 #endif /* EXPORT_HCI_BRIDGE_INTERFACE */ 74 #endif /* EXPORT_HCI_BRIDGE_INTERFACE */
83 75
84 typedef struct { 76 typedef struct {
85 void *pHCIDev; /* HCI bridge device */ 77 void *pHCIDev; /* HCI bridge device */
86 HCI_TRANSPORT_PROPERTIES HCIProps; /* HCI bridge props */ 78 HCI_TRANSPORT_PROPERTIES HCIProps; /* HCI bridge props */
87 struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */ 79 struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */
88 A_BOOL HciNormalMode; /* Actual HCI mode enabled (non-T EST)*/ 80 A_BOOL HciNormalMode; /* Actual HCI mode enabled (non-T EST)*/
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 /* add to queue */ 206 /* add to queue */
215 HTC_PACKET_ENQUEUE(&queue,pPacket); 207 HTC_PACKET_ENQUEUE(&queue,pPacket);
216 } 208 }
217 209
218 if (i > 0) { 210 if (i > 0) {
219 HCI_TransportAddReceivePkts(pHcidevInfo->pHCIDev, &queue); 211 HCI_TransportAddReceivePkts(pHcidevInfo->pHCIDev, &queue);
220 } 212 }
221 } 213 }
222 214
223 #define HOST_INTEREST_ITEM_ADDRESS(ar, item) \ 215 #define HOST_INTEREST_ITEM_ADDRESS(ar, item) \
224 (((ar)->arTargetType == TARGET_TYPE_AR6001) ? AR6001_HOST_INTEREST_ITEM_ ADDRESS(item) : \
225 (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ ADDRESS(item) : \ 216 (((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ ADDRESS(item) : \
226 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ ADDRESS(item) : 0))) 217 (((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ ADDRESS(item) : 0))
227 static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle, 218 static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
228 HCI_TRANSPORT_PROPERTIES *pProps, 219 HCI_TRANSPORT_PROPERTIES *pProps,
229 void *pContext) 220 void *pContext)
230 { 221 {
231 AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext; 222 AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
232 A_STATUS status; 223 A_STATUS status;
233 A_UINT32 address, hci_uart_pwr_mgmt_params; 224 A_UINT32 address, hci_uart_pwr_mgmt_params;
234 // AR3K_CONFIG_INFO ar3kconfig; 225 // AR3K_CONFIG_INFO ar3kconfig;
235 226
236 pHcidevInfo->pHCIDev = HCIHandle; 227 pHcidevInfo->pHCIDev = HCIHandle;
237 228
238 A_MEMCPY(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps)); 229 A_MEMCPY(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps));
239 230
240 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE,("HCI ready (hci:0x%X, headroom:%d, tai lroom:%d blockpad:%d) \n", 231 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE,("HCI ready (hci:0x%lX, headroom:%d, ta ilroom:%d blockpad:%d) \n",
241 (A_UINT32)HCIHandle, 232 (unsigned long)HCIHandle,
242 pHcidevInfo->HCIProps.HeadRoom, 233 pHcidevInfo->HCIProps.HeadRoom,
243 pHcidevInfo->HCIProps.TailRoom, 234 pHcidevInfo->HCIProps.TailRoom,
244 pHcidevInfo->HCIProps.IOBlockPad)); 235 pHcidevInfo->HCIProps.IOBlockPad));
245 236
246 #ifdef EXPORT_HCI_BRIDGE_INTERFACE 237 #ifdef EXPORT_HCI_BRIDGE_INTERFACE
247 A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= (struct net_device *)(pHci devInfo->HCITransHdl.netDevice)->hard_header_len); 238 A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= (struct net_device *)(pHci devInfo->HCITransHdl.netDevice)->hard_header_len);
248 #else 239 #else
249 A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= pHcidevInfo->ar->arNetDev- >hard_header_len); 240 A_ASSERT((pProps->HeadRoom + pProps->TailRoom) <= pHcidevInfo->ar->arNetDev- >hard_header_len);
250 #endif 241 #endif
251 242
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 * will be handled by the HCI transport layer. Enough headroom has alrea dy 791 * will be handled by the HCI transport layer. Enough headroom has alrea dy
801 * been reserved above for the transport header 792 * been reserved above for the transport header
802 */ 793 */
803 SET_HTC_PACKET_INFO_TX(pPacket, 794 SET_HTC_PACKET_INFO_TX(pPacket,
804 txSkb, 795 txSkb,
805 txSkb->data, 796 txSkb->data,
806 txSkb->len, 797 txSkb->len,
807 type, 798 type,
808 AR6K_CONTROL_PKT_TAG); /* HCI packets cannot be d ropped */ 799 AR6K_CONTROL_PKT_TAG); /* HCI packets cannot be d ropped */
809 800
810 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: bt_send_frame skb:0x%X \n",(A_UINT32)txSkb)); 801 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: bt_send_frame skb:0x%l X \n",(unsigned long)txSkb));
811 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: type:%d, Total Length: %d Bytes \n", 802 AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: type:%d, Total Length: %d Bytes \n",
812 type, txSkb->len)); 803 type, txSkb->len));
813 804
814 status = HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE); 805 status = HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE);
815 pPacket = NULL; 806 pPacket = NULL;
816 txSkb = NULL; 807 txSkb = NULL;
817 808
818 } while (FALSE); 809 } while (FALSE);
819 810
820 if (txSkb != NULL) { 811 if (txSkb != NULL) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 /* allocate a BT HCI struct for this device */ 885 /* allocate a BT HCI struct for this device */
895 pHciDev = hci_alloc_dev(); 886 pHciDev = hci_alloc_dev();
896 if (NULL == pHciDev) { 887 if (NULL == pHciDev) {
897 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge - failed to allocate bt struct \n")); 888 AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge - failed to allocate bt struct \n"));
898 status = A_NO_MEMORY; 889 status = A_NO_MEMORY;
899 break; 890 break;
900 } 891 }
901 /* save the device, we'll register this later */ 892 /* save the device, we'll register this later */
902 pHcidevInfo->pBtStackHCIDev = pHciDev; 893 pHcidevInfo->pBtStackHCIDev = pHciDev;
903 SET_HCIDEV_DEV(pHciDev,osDevInfo.pOSDevice); 894 SET_HCIDEV_DEV(pHciDev,osDevInfo.pOSDevice);
904 pHciDev->type = HCI_VIRTUAL; 895 SET_HCI_BUS_TYPE(pHciDev, HCI_VIRTUAL, HCI_BREDR);
905 pHciDev->driver_data = pHcidevInfo; 896 pHciDev->driver_data = pHcidevInfo;
906 pHciDev->open = bt_open; 897 pHciDev->open = bt_open;
907 pHciDev->close = bt_close; 898 pHciDev->close = bt_close;
908 pHciDev->send = bt_send_frame; 899 pHciDev->send = bt_send_frame;
909 pHciDev->ioctl = bt_ioctl; 900 pHciDev->ioctl = bt_ioctl;
910 pHciDev->flush = bt_flush; 901 pHciDev->flush = bt_flush;
911 pHciDev->destruct = bt_destruct; 902 pHciDev->destruct = bt_destruct;
912 pHciDev->owner = THIS_MODULE; 903 pHciDev->owner = THIS_MODULE;
913 /* driver is running in normal BT mode */ 904 /* driver is running in normal BT mode */
914 pHcidevInfo->HciNormalMode = TRUE; 905 pHcidevInfo->HciNormalMode = TRUE;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 return 0; 1133 return 0;
1143 } 1134 }
1144 1135
1145 static void __exit 1136 static void __exit
1146 hcibridge_cleanup_module(void) 1137 hcibridge_cleanup_module(void)
1147 { 1138 {
1148 } 1139 }
1149 1140
1150 module_init(hcibridge_init_module); 1141 module_init(hcibridge_init_module);
1151 module_exit(hcibridge_cleanup_module); 1142 module_exit(hcibridge_cleanup_module);
1152 MODULE_LICENSE("GPL and additional rights"); 1143 MODULE_LICENSE("Dual BSD/GPL");
1153 #endif 1144 #endif
OLDNEW
« no previous file with comments | « chromeos/drivers/ath6kl/os/linux/export_hci_transport.c ('k') | chromeos/drivers/ath6kl/os/linux/include/ar6000_drv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698