Lines Matching +full:bcm43341 +full:- +full:bt
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 /* Generic Bluetooth Type-A SDIO device */
47 /* Generic Bluetooth Type-B SDIO device */
83 BT_DBG("%s", data->hdev->name); in btsdio_tx_packet()
85 /* Prepend Type-A header */ in btsdio_tx_packet()
87 skb->data[0] = (skb->len & 0x0000ff); in btsdio_tx_packet()
88 skb->data[1] = (skb->len & 0x00ff00) >> 8; in btsdio_tx_packet()
89 skb->data[2] = (skb->len & 0xff0000) >> 16; in btsdio_tx_packet()
90 skb->data[3] = hci_skb_pkt_type(skb); in btsdio_tx_packet()
92 err = sdio_writesb(data->func, REG_TDAT, skb->data, skb->len); in btsdio_tx_packet()
95 sdio_writeb(data->func, 0x01, REG_PC_WRT, NULL); in btsdio_tx_packet()
99 data->hdev->stat.byte_tx += skb->len; in btsdio_tx_packet()
112 BT_DBG("%s", data->hdev->name); in btsdio_work()
114 sdio_claim_host(data->func); in btsdio_work()
116 while ((skb = skb_dequeue(&data->txq))) { in btsdio_work()
119 data->hdev->stat.err_tx++; in btsdio_work()
120 skb_queue_head(&data->txq, skb); in btsdio_work()
125 sdio_release_host(data->func); in btsdio_work()
134 BT_DBG("%s", data->hdev->name); in btsdio_rx_packet()
136 err = sdio_readsb(data->func, hdr, REG_RDAT, 4); in btsdio_rx_packet()
142 return -EILSEQ; in btsdio_rx_packet()
144 skb = bt_skb_alloc(len - 4, GFP_KERNEL); in btsdio_rx_packet()
150 return -ENOMEM; in btsdio_rx_packet()
153 skb_put(skb, len - 4); in btsdio_rx_packet()
155 err = sdio_readsb(data->func, skb->data, REG_RDAT, len - 4); in btsdio_rx_packet()
161 data->hdev->stat.byte_rx += len; in btsdio_rx_packet()
165 err = hci_recv_frame(data->hdev, skb); in btsdio_rx_packet()
169 sdio_writeb(data->func, 0x00, REG_PC_RRT, NULL); in btsdio_rx_packet()
179 BT_DBG("%s", data->hdev->name); in btsdio_interrupt()
186 data->hdev->stat.err_rx++; in btsdio_interrupt()
187 sdio_writeb(data->func, 0x01, REG_PC_RRT, NULL); in btsdio_interrupt()
197 BT_DBG("%s", hdev->name); in btsdio_open()
199 sdio_claim_host(data->func); in btsdio_open()
201 err = sdio_enable_func(data->func); in btsdio_open()
205 err = sdio_claim_irq(data->func, btsdio_interrupt); in btsdio_open()
207 sdio_disable_func(data->func); in btsdio_open()
211 if (data->func->class == SDIO_CLASS_BT_B) in btsdio_open()
212 sdio_writeb(data->func, 0x00, REG_MD_SET, NULL); in btsdio_open()
214 sdio_writeb(data->func, 0x01, REG_EN_INTRD, NULL); in btsdio_open()
217 sdio_release_host(data->func); in btsdio_open()
226 BT_DBG("%s", hdev->name); in btsdio_close()
228 sdio_claim_host(data->func); in btsdio_close()
230 sdio_writeb(data->func, 0x00, REG_EN_INTRD, NULL); in btsdio_close()
232 sdio_release_irq(data->func); in btsdio_close()
233 sdio_disable_func(data->func); in btsdio_close()
235 sdio_release_host(data->func); in btsdio_close()
244 BT_DBG("%s", hdev->name); in btsdio_flush()
246 skb_queue_purge(&data->txq); in btsdio_flush()
255 BT_DBG("%s", hdev->name); in btsdio_send_frame()
259 hdev->stat.cmd_tx++; in btsdio_send_frame()
263 hdev->stat.acl_tx++; in btsdio_send_frame()
267 hdev->stat.sco_tx++; in btsdio_send_frame()
271 return -EILSEQ; in btsdio_send_frame()
274 skb_queue_tail(&data->txq, skb); in btsdio_send_frame()
276 schedule_work(&data->work); in btsdio_send_frame()
286 struct sdio_func_tuple *tuple = func->tuples; in btsdio_probe()
289 BT_DBG("func %p id %p class 0x%04x", func, id, func->class); in btsdio_probe()
292 BT_DBG("code 0x%x size %d", tuple->code, tuple->size); in btsdio_probe()
293 tuple = tuple->next; in btsdio_probe()
296 /* BCM43341 devices soldered onto the PCB (non-removable) use an in btsdio_probe()
297 * uart connection for bluetooth, ignore the BT SDIO interface. in btsdio_probe()
299 if (func->vendor == SDIO_VENDOR_ID_BROADCOM && in btsdio_probe()
300 func->device == SDIO_DEVICE_ID_BROADCOM_43341 && in btsdio_probe()
301 !mmc_card_is_removable(func->card->host)) in btsdio_probe()
302 return -ENODEV; in btsdio_probe()
304 data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL); in btsdio_probe()
306 return -ENOMEM; in btsdio_probe()
308 data->func = func; in btsdio_probe()
310 INIT_WORK(&data->work, btsdio_work); in btsdio_probe()
312 skb_queue_head_init(&data->txq); in btsdio_probe()
316 return -ENOMEM; in btsdio_probe()
318 hdev->bus = HCI_SDIO; in btsdio_probe()
321 if (id->class == SDIO_CLASS_BT_AMP) in btsdio_probe()
322 hdev->dev_type = HCI_AMP; in btsdio_probe()
324 hdev->dev_type = HCI_PRIMARY; in btsdio_probe()
326 data->hdev = hdev; in btsdio_probe()
328 SET_HCIDEV_DEV(hdev, &func->dev); in btsdio_probe()
330 hdev->open = btsdio_open; in btsdio_probe()
331 hdev->close = btsdio_close; in btsdio_probe()
332 hdev->flush = btsdio_flush; in btsdio_probe()
333 hdev->send = btsdio_send_frame; in btsdio_probe()
335 if (func->vendor == 0x0104 && func->device == 0x00c5) in btsdio_probe()
336 set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks); in btsdio_probe()
359 hdev = data->hdev; in btsdio_remove()