1 /*
2 * Broadcom SPI Host Controller Driver - Linux Per-port
3 *
4 * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
5 *
6 * Copyright (C) 1999-2017, Broadcom Corporation
7 *
8 * Unless you and Broadcom execute a separate written software license
9 * agreement governing use of this software, this software is licensed to you
10 * under the terms of the GNU General Public License version 2 (the "GPL"),
11 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12 * following added to such license:
13 *
14 * As a special exception, the copyright holders of this software give you
15 * permission to link this software with independent modules, and to copy and
16 * distribute the resulting executable under terms of your choice, provided that
17 * you also meet, for each linked independent module, the terms and conditions of
18 * the license of that module. An independent module is a module which is not
19 * derived from this software. The special exception does not apply to any
20 * modifications of the software.
21 *
22 * Notwithstanding the above, under no circumstances may you combine this
23 * software in any way with any other Broadcom software provided under a license
24 * other than the GPL, without Broadcom's express prior written consent.
25 *
26 *
27 * <<Broadcom-WL-IPTag/Open:>>
28 *
29 * $Id: bcmsdspi_linux.c 514727 2014-11-12 03:02:48Z $
30 */
31
32 #include <typedefs.h>
33 #include <bcmutils.h>
34
35 #include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
36 #include <sdiovar.h> /* to get msglevel bit values */
37
38 #ifdef BCMSPI_ANDROID
39 #include <bcmsdh.h>
40 #include <bcmspibrcm.h>
41 #include <linux/spi/spi.h>
42 #else
43 #include <pcicfg.h>
44 #include <sdio.h> /* SDIO Device and Protocol Specs */
45 #include <linux/sched.h> /* request_irq(), free_irq() */
46 #include <bcmsdspi.h>
47 #include <bcmdevs.h>
48 #include <bcmspi.h>
49 #endif /* BCMSPI_ANDROID */
50
51 #ifndef GSPIBCM
52 #ifndef BCMSPI_ANDROID
53 extern uint sd_crc;
54 module_param(sd_crc, uint, 0);
55
56 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
57 #define KERNEL26
58 #endif // endif
59 #endif /* !BCMSPI_ANDROID */
60
61 struct sdos_info {
62 sdioh_info_t *sd;
63 spinlock_t lock;
64 #ifndef BCMSPI_ANDROID
65 wait_queue_head_t intr_wait_queue;
66 #endif /* !BCMSPI_ANDROID */
67 };
68 #endif /* !GSPIBCM */
69
70 #ifndef BCMSPI_ANDROID
71 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
72 #define BLOCKABLE() (!in_atomic())
73 #else
74 #define BLOCKABLE() (!in_interrupt())
75 #endif // endif
76
77 /* For Broadcom PCI-SPI Host controller (Raggedstone) */
78 #if defined(BCMSPI) && (defined(BCMPCISPIHOST) || defined(GSPIBCM))
79 #ifndef SDLX_MSG
80 #define SDLX_MSG(x) printf x
81 #endif // endif
82 extern void* bcmsdh_probe(osl_t *osh, void *dev, void *sdioh, void *adapter_info,
83 uint bus_type, uint bus_num, uint slot_num);
84 extern int bcmsdh_remove(bcmsdh_info_t *bcmsdh);
85 extern sdioh_info_t * sdioh_attach(osl_t *osh, void *bar0, uint irq);
86 extern SDIOH_API_RC sdioh_detach(osl_t *osh, sdioh_info_t *sd);
87
88 /* forward declarations for PCI probe and remove functions. */
89 static int __devinit bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
90 static void __devexit bcmsdh_pci_remove(struct pci_dev *pdev);
91
92 /* forward declarations for PCI probe and remove functions. */
93 static int __devinit bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
94 static void __devexit bcmsdh_pci_remove(struct pci_dev *pdev);
95
96 /**
97 * pci id table
98 */
99 static struct pci_device_id bcmsdh_pci_devid[] __devinitdata = {
100 { vendor: PCI_ANY_ID,
101 device: PCI_ANY_ID,
102 subvendor: PCI_ANY_ID,
103 subdevice: PCI_ANY_ID,
104 class: 0,
105 class_mask: 0,
106 driver_data: 0,
107 },
108 { 0, }
109 };
110 MODULE_DEVICE_TABLE(pci, bcmsdh_pci_devid);
111
112 /**
113 * PCI-SPI Host Controller: pci driver info
114 */
115 static struct pci_driver bcmsdh_pci_driver = {
116 node: {},
117 name: "bcmsdh",
118 id_table: bcmsdh_pci_devid,
119 probe: bcmsdh_pci_probe,
120 remove: bcmsdh_pci_remove,
121 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
122 save_state: NULL,
123 #endif // endif
124 suspend: NULL,
125 resume: NULL,
126 };
127
128 /* Force detection to a particular PCI */
129 /* slot only . Allows for having multiple */
130 /* WL devices at once in a PC */
131 /* Only one instance of dhd will be */
132 /* usable at a time */
133 /* Upper word is bus number, */
134 /* lower word is slot number */
135 /* Default value of 0xffffffff turns this off */
136 extern uint sd_pci_slot;
137 module_param(sd_pci_slot, uint, 0);
138
139 /**
140 * Detect supported Host Controller and attach if found.
141 *
142 * Determine if the device described by pdev is a supported PCI Host
143 * Controller. If so, attach to it and attach to the target device.
144 */
145 static int __devinit
bcmsdh_pci_probe(struct pci_dev * pdev,const struct pci_device_id * ent)146 bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
147 {
148 osl_t *osh = NULL;
149 sdioh_info_t *sdioh = NULL;
150 void *bcmsdh;
151
152 int rc;
153
154 if (sd_pci_slot != 0xFFFFFFFF) {
155 if (pdev->bus->number != (sd_pci_slot>>16) ||
156 PCI_SLOT(pdev->devfn) != (sd_pci_slot&0xffff)) {
157 SDLX_MSG(("%s: %s: bus %X, slot %X, vend %X, dev %X\n",
158 __FUNCTION__,
159 bcmsdh_chipmatch(pdev->vendor, pdev->device)
160 ?"Found compatible SDIOHC"
161 :"Probing unknown device",
162 pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor,
163 pdev->device));
164 return -ENODEV;
165 }
166 SDLX_MSG(("%s: %s: bus %X, slot %X, vendor %X, device %X (good PCI location)\n",
167 __FUNCTION__,
168 bcmsdh_chipmatch(pdev->vendor, pdev->device)
169 ?"Using compatible SDIOHC"
170 :"WARNING, forced use of unkown device",
171 pdev->bus->number, PCI_SLOT(pdev->devfn), pdev->vendor, pdev->device));
172 }
173
174 if ((pdev->vendor == VENDOR_TI) && ((pdev->device == PCIXX21_FLASHMEDIA_ID) ||
175 (pdev->device == PCIXX21_FLASHMEDIA0_ID))) {
176 uint32 config_reg;
177
178 SDLX_MSG(("%s: Disabling TI FlashMedia Controller.\n", __FUNCTION__));
179 if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) {
180 SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__));
181 goto err;
182 }
183 config_reg = OSL_PCI_READ_CONFIG(osh, 0x4c, 4);
184
185 /*
186 * Set MMC_SD_DIS bit in FlashMedia Controller.
187 * Disbling the SD/MMC Controller in the FlashMedia Controller
188 * allows the Standard SD Host Controller to take over control
189 * of the SD Slot.
190 */
191 config_reg |= 0x02;
192 OSL_PCI_WRITE_CONFIG(osh, 0x4c, 4, config_reg);
193 osl_detach(osh);
194 }
195 /* match this pci device with what we support */
196 /* we can't solely rely on this to believe it is our SDIO Host Controller! */
197 if (!bcmsdh_chipmatch(pdev->vendor, pdev->device)) {
198 if (pdev->vendor == VENDOR_BROADCOM) {
199 SDLX_MSG(("%s: Unknown Broadcom device (vendor: %#x, device: %#x).\n",
200 __FUNCTION__, pdev->vendor, pdev->device));
201 }
202 return -ENODEV;
203 }
204
205 /* this is a pci device we might support */
206 SDLX_MSG(("%s: Found possible SDIO Host Controller: bus %d slot %d func %d irq %d\n",
207 __FUNCTION__,
208 pdev->bus->number, PCI_SLOT(pdev->devfn),
209 PCI_FUNC(pdev->devfn), pdev->irq));
210
211 /* use bcmsdh_query_device() to get the vendor ID of the target device so
212 * it will eventually appear in the Broadcom string on the console
213 */
214
215 /* allocate SDIO Host Controller state info */
216 if (!(osh = osl_attach(pdev, PCI_BUS, FALSE))) {
217 SDLX_MSG(("%s: osl_attach failed\n", __FUNCTION__));
218 goto err;
219 }
220
221 /* map to address where host can access */
222 pci_set_master(pdev);
223 rc = pci_enable_device(pdev);
224 if (rc) {
225 SDLX_MSG(("%s: Cannot enable PCI device\n", __FUNCTION__));
226 goto err;
227 }
228
229 if (!(sdioh = sdioh_attach(osh, (void *)(ulong)pci_resource_start(pdev, 0), pdev->irq))) {
230 SDLX_MSG(("%s: bcmsdh_attach failed\n", __FUNCTION__));
231 goto err;
232 }
233
234 #ifdef GSPIBCM
235 bcmsdh = bcmsdh_probe(osh, &pdev->dev, sdioh, NULL, PCI_BUS, -1, -1);
236 if (bcmsdh == NULL) {
237 #else
238 sdioh->bcmsdh = bcmsdh_probe(osh, &pdev->dev, sdioh, NULL, PCI_BUS, -1, -1);
239 if (sdioh->bcmsdh == NULL) {
240 #endif /* GSPIBCM */
241 sd_err(("%s: bcmsdh_probe failed\n", __FUNCTION__));
242 goto err;
243 }
244
245 pci_set_drvdata(pdev, sdioh);
246 return 0;
247
248 /* error handling */
249 err:
250 if (sdioh != NULL)
251 sdioh_detach(osh, sdioh);
252 if (osh != NULL)
253 osl_detach(osh);
254 return -ENOMEM;
255
256 }
257
258 /**
259 * Detach from target devices and PCI-SPI Host Controller
260 */
261 static void __devexit
262 bcmsdh_pci_remove(struct pci_dev *pdev)
263 {
264
265 sdioh_info_t *sdioh = NULL;
266 osl_t *osh;
267
268 sdioh = pci_get_drvdata(pdev);
269 if (sdioh == NULL) {
270 sd_err(("%s: error, no sdh handler found\n", __FUNCTION__));
271 return;
272 }
273
274 osh = sdioh->osh;
275 bcmsdh_remove(sdioh->bcmsdh);
276 sdioh_detach(osh, sdioh);
277 osl_detach(osh);
278
279 }
280 #endif /* BCMSPI && BCMPCISPIHOST */
281
282 #ifndef GSPIBCM
283 /* Interrupt handler */
284 static irqreturn_t
285 sdspi_isr(int irq, void *dev_id
286 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
287 , struct pt_regs *ptregs
288 #endif // endif
289 )
290 {
291 sdioh_info_t *sd;
292 struct sdos_info *sdos;
293 bool ours;
294
295 sd = (sdioh_info_t *)dev_id;
296 sd->local_intrcount++;
297
298 if (!sd->card_init_done) {
299 sd_err(("%s: Hey Bogus intr...not even initted: irq %d\n", __FUNCTION__, irq));
300 return IRQ_RETVAL(FALSE);
301 } else {
302 ours = spi_check_client_intr(sd, NULL);
303
304 /* For local interrupts, wake the waiting process */
305 if (ours && sd->got_hcint) {
306 sdos = (struct sdos_info *)sd->sdos_info;
307 wake_up_interruptible(&sdos->intr_wait_queue);
308 }
309
310 return IRQ_RETVAL(ours);
311 }
312 }
313 #endif /* !GSPIBCM */
314 #endif /* !BCMSPI_ANDROID */
315
316 #ifdef BCMSPI_ANDROID
317 static struct spi_device *gBCMSPI = NULL;
318
319 extern int bcmsdh_probe(struct device *dev);
320 extern int bcmsdh_remove(struct device *dev);
321
322 static int bcmsdh_spi_probe(struct spi_device *spi_dev)
323 {
324 int ret = 0;
325
326 gBCMSPI = spi_dev;
327
328 #ifdef SPI_PIO_32BIT_RW
329 spi_dev->bits_per_word = 32;
330 #else
331 spi_dev->bits_per_word = 8;
332 #endif /* SPI_PIO_32BIT_RW */
333 ret = spi_setup(spi_dev);
334
335 if (ret) {
336 sd_err(("bcmsdh_spi_probe: spi_setup fail with %d\n", ret));
337 }
338 sd_err(("bcmsdh_spi_probe: spi_setup with %d, bits_per_word=%d\n",
339 ret, spi_dev->bits_per_word));
340 ret = bcmsdh_probe(&spi_dev->dev);
341
342 return ret;
343 }
344
345 static int bcmsdh_spi_remove(struct spi_device *spi_dev)
346 {
347 int ret = 0;
348
349 ret = bcmsdh_remove(&spi_dev->dev);
350 gBCMSPI = NULL;
351
352 return ret;
353 }
354
355 static struct spi_driver bcmsdh_spi_driver = {
356 .probe = bcmsdh_spi_probe,
357 .remove = bcmsdh_spi_remove,
358 .driver = {
359 .name = "wlan_spi",
360 .bus = &spi_bus_type,
361 .owner = THIS_MODULE,
362 },
363 };
364 #endif /* BCMSPI_ANDROID */
365
366 /*
367 * module init
368 */
369 int bcmsdh_register_client_driver(void)
370 {
371 int error = 0;
372 sd_trace(("bcmsdh_gspi: %s Enter\n", __FUNCTION__));
373 #if defined(BCMSPI) && (defined(BCMPCISPIHOST) || defined(GSPIBCM))
374 error = pci_module_init(&bcmsdh_pci_driver);
375 #else
376 error = spi_register_driver(&bcmsdh_spi_driver);
377 #endif /* BCMSPI && BCMPCISPIHOST */
378
379 return error;
380 }
381
382 /*
383 * module cleanup
384 */
385 void bcmsdh_unregister_client_driver(void)
386 {
387 sd_trace(("%s Enter\n", __FUNCTION__));
388 #if defined(BCMSPI) && (defined(BCMPCISPIHOST) || defined(GSPIBCM))
389 pci_unregister_driver(&bcmsdh_pci_driver);
390 #else
391 spi_unregister_driver(&bcmsdh_spi_driver);
392 #endif /* BCMSPI && BCMPCISPIHOST */
393 }
394
395 #ifndef GSPIBCM
396 /* Register with Linux for interrupts */
397 int
398 spi_register_irq(sdioh_info_t *sd, uint irq)
399 {
400 #ifndef BCMSPI_ANDROID
401 sd_trace(("Entering %s: irq == %d\n", __FUNCTION__, irq));
402 if (request_irq(irq, sdspi_isr, IRQF_SHARED, "bcmsdspi", sd) < 0) {
403 sd_err(("%s: request_irq() failed\n", __FUNCTION__));
404 return ERROR;
405 }
406 #endif /* !BCMSPI_ANDROID */
407 return SUCCESS;
408 }
409
410 /* Free Linux irq */
411 void
412 spi_free_irq(uint irq, sdioh_info_t *sd)
413 {
414 #ifndef BCMSPI_ANDROID
415 free_irq(irq, sd);
416 #endif /* !BCMSPI_ANDROID */
417 }
418
419 /* Map Host controller registers */
420 #ifndef BCMSPI_ANDROID
421 uint32 *
422 spi_reg_map(osl_t *osh, uintptr addr, int size)
423 {
424 return (uint32 *)REG_MAP(addr, size);
425 }
426
427 void
428 spi_reg_unmap(osl_t *osh, uintptr addr, int size)
429 {
430 REG_UNMAP((void*)(uintptr)addr);
431 }
432 #endif /* !BCMSPI_ANDROID */
433
434 int
435 spi_osinit(sdioh_info_t *sd)
436 {
437 struct sdos_info *sdos;
438
439 sdos = (struct sdos_info*)MALLOC(sd->osh, sizeof(struct sdos_info));
440 sd->sdos_info = (void*)sdos;
441 if (sdos == NULL)
442 return BCME_NOMEM;
443
444 sdos->sd = sd;
445 spin_lock_init(&sdos->lock);
446 #ifndef BCMSPI_ANDROID
447 init_waitqueue_head(&sdos->intr_wait_queue);
448 #endif /* !BCMSPI_ANDROID */
449 return BCME_OK;
450 }
451
452 void
453 spi_osfree(sdioh_info_t *sd)
454 {
455 struct sdos_info *sdos;
456 ASSERT(sd && sd->sdos_info);
457
458 sdos = (struct sdos_info *)sd->sdos_info;
459 MFREE(sd->osh, sdos, sizeof(struct sdos_info));
460 }
461
462 /* Interrupt enable/disable */
463 SDIOH_API_RC
464 sdioh_interrupt_set(sdioh_info_t *sd, bool enable)
465 {
466 ulong flags;
467 struct sdos_info *sdos;
468
469 sd_trace(("%s: %s\n", __FUNCTION__, enable ? "Enabling" : "Disabling"));
470
471 sdos = (struct sdos_info *)sd->sdos_info;
472 ASSERT(sdos);
473
474 if (!(sd->host_init_done && sd->card_init_done)) {
475 sd_err(("%s: Card & Host are not initted - bailing\n", __FUNCTION__));
476 return SDIOH_API_RC_FAIL;
477 }
478
479 #ifndef BCMSPI_ANDROID
480 if (enable && !(sd->intr_handler && sd->intr_handler_arg)) {
481 sd_err(("%s: no handler registered, will not enable\n", __FUNCTION__));
482 return SDIOH_API_RC_FAIL;
483 }
484 #endif /* !BCMSPI_ANDROID */
485
486 /* Ensure atomicity for enable/disable calls */
487 spin_lock_irqsave(&sdos->lock, flags);
488
489 sd->client_intr_enabled = enable;
490 #ifndef BCMSPI_ANDROID
491 if (enable && !sd->lockcount)
492 spi_devintr_on(sd);
493 else
494 spi_devintr_off(sd);
495 #endif /* !BCMSPI_ANDROID */
496
497 spin_unlock_irqrestore(&sdos->lock, flags);
498
499 return SDIOH_API_RC_SUCCESS;
500 }
501
502 /* Protect against reentrancy (disable device interrupts while executing) */
503 void
504 spi_lock(sdioh_info_t *sd)
505 {
506 ulong flags;
507 struct sdos_info *sdos;
508
509 sdos = (struct sdos_info *)sd->sdos_info;
510 ASSERT(sdos);
511
512 sd_trace(("%s: %d\n", __FUNCTION__, sd->lockcount));
513
514 spin_lock_irqsave(&sdos->lock, flags);
515 if (sd->lockcount) {
516 sd_err(("%s: Already locked!\n", __FUNCTION__));
517 ASSERT(sd->lockcount == 0);
518 }
519 #ifdef BCMSPI_ANDROID
520 if (sd->client_intr_enabled)
521 bcmsdh_oob_intr_set(0);
522 #else
523 spi_devintr_off(sd);
524 #endif /* BCMSPI_ANDROID */
525 sd->lockcount++;
526 spin_unlock_irqrestore(&sdos->lock, flags);
527 }
528
529 /* Enable client interrupt */
530 void
531 spi_unlock(sdioh_info_t *sd)
532 {
533 ulong flags;
534 struct sdos_info *sdos;
535
536 sd_trace(("%s: %d, %d\n", __FUNCTION__, sd->lockcount, sd->client_intr_enabled));
537 ASSERT(sd->lockcount > 0);
538
539 sdos = (struct sdos_info *)sd->sdos_info;
540 ASSERT(sdos);
541
542 spin_lock_irqsave(&sdos->lock, flags);
543 if (--sd->lockcount == 0 && sd->client_intr_enabled) {
544 #ifdef BCMSPI_ANDROID
545 bcmsdh_oob_intr_set(1);
546 #else
547 spi_devintr_on(sd);
548 #endif /* BCMSPI_ANDROID */
549 }
550 spin_unlock_irqrestore(&sdos->lock, flags);
551 }
552
553 #ifndef BCMSPI_ANDROID
554 void spi_waitbits(sdioh_info_t *sd, bool yield)
555 {
556 #ifndef BCMSDYIELD
557 ASSERT(!yield);
558 #endif // endif
559 sd_trace(("%s: yield %d canblock %d\n",
560 __FUNCTION__, yield, BLOCKABLE()));
561
562 /* Clear the "interrupt happened" flag and last intrstatus */
563 sd->got_hcint = FALSE;
564
565 #ifdef BCMSDYIELD
566 if (yield && BLOCKABLE()) {
567 struct sdos_info *sdos;
568 sdos = (struct sdos_info *)sd->sdos_info;
569 /* Wait for the indication, the interrupt will be masked when the ISR fires. */
570 wait_event_interruptible(sdos->intr_wait_queue, (sd->got_hcint));
571 } else
572 #endif /* BCMSDYIELD */
573 {
574 spi_spinbits(sd);
575 }
576
577 }
578 #else /* !BCMSPI_ANDROID */
579 int bcmgspi_dump = 0; /* Set to dump complete trace of all SPI bus transactions */
580
581 static void
582 hexdump(char *pfx, unsigned char *msg, int msglen)
583 {
584 int i, col;
585 char buf[80];
586
587 ASSERT(strlen(pfx) + 49 <= sizeof(buf));
588
589 col = 0;
590
591 for (i = 0; i < msglen; i++, col++) {
592 if (col % 16 == 0)
593 strcpy(buf, pfx);
594 sprintf(buf + strlen(buf), "%02x", msg[i]);
595 if ((col + 1) % 16 == 0)
596 printf("%s\n", buf);
597 else
598 sprintf(buf + strlen(buf), " ");
599 }
600
601 if (col % 16 != 0)
602 printf("%s\n", buf);
603 }
604
605 /* Send/Receive an SPI Packet */
606 void
607 spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen)
608 {
609 int write = 0;
610 int tx_len = 0;
611 struct spi_message msg;
612 struct spi_transfer t[2];
613
614 spi_message_init(&msg);
615 memset(t, 0, 2*sizeof(struct spi_transfer));
616
617 if (sd->wordlen == 2)
618 #if !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW))
619 write = msg_out[2] & 0x80;
620 #else
621 write = msg_out[1] & 0x80;
622 #endif /* !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW)) */
623 if (sd->wordlen == 4)
624 #if !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW))
625 write = msg_out[0] & 0x80;
626 #else
627 write = msg_out[3] & 0x80;
628 #endif /* !(defined(SPI_PIO_RW_BIGENDIAN) && defined(SPI_PIO_32BIT_RW)) */
629
630 if (bcmgspi_dump) {
631 hexdump(" OUT: ", msg_out, msglen);
632 }
633
634 tx_len = write ? msglen-4 : 4;
635
636 sd_trace(("spi_sendrecv: %s, wordlen %d, cmd : 0x%02x 0x%02x 0x%02x 0x%02x\n",
637 write ? "WR" : "RD", sd->wordlen,
638 msg_out[0], msg_out[1], msg_out[2], msg_out[3]));
639
640 t[0].tx_buf = (char *)&msg_out[0];
641 t[0].rx_buf = 0;
642 t[0].len = tx_len;
643
644 spi_message_add_tail(&t[0], &msg);
645
646 t[1].rx_buf = (char *)&msg_in[tx_len];
647 t[1].tx_buf = 0;
648 t[1].len = msglen-tx_len;
649
650 spi_message_add_tail(&t[1], &msg);
651 spi_sync(gBCMSPI, &msg);
652
653 if (bcmgspi_dump) {
654 hexdump(" IN : ", msg_in, msglen);
655 }
656 }
657 #endif /* !BCMSPI_ANDROID */
658 #endif /* !GSPIBCM */
659