diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wimax/i2400m/driver.c | 54 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m.h | 2 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/sdio.c | 14 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb.c | 8 |
4 files changed, 64 insertions, 14 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c index 304f0443ca4b..20d574ca9183 100644 --- a/drivers/net/wimax/i2400m/driver.c +++ b/drivers/net/wimax/i2400m/driver.c | |||
@@ -619,6 +619,46 @@ EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle); | |||
619 | 619 | ||
620 | 620 | ||
621 | /** | 621 | /** |
622 | * i2400m_bm_buf_alloc - Alloc the command and ack buffers for boot mode | ||
623 | * | ||
624 | * Get the buffers needed to deal with boot mode messages. These | ||
625 | * buffers need to be allocated before the sdio recieve irq is setup. | ||
626 | */ | ||
627 | int i2400m_bm_buf_alloc(struct i2400m *i2400m) | ||
628 | { | ||
629 | int result; | ||
630 | |||
631 | result = -ENOMEM; | ||
632 | i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); | ||
633 | if (i2400m->bm_cmd_buf == NULL) | ||
634 | goto error_bm_cmd_kzalloc; | ||
635 | i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL); | ||
636 | if (i2400m->bm_ack_buf == NULL) | ||
637 | goto error_bm_ack_buf_kzalloc; | ||
638 | return 0; | ||
639 | |||
640 | error_bm_ack_buf_kzalloc: | ||
641 | kfree(i2400m->bm_cmd_buf); | ||
642 | error_bm_cmd_kzalloc: | ||
643 | return result; | ||
644 | } | ||
645 | EXPORT_SYMBOL_GPL(i2400m_bm_buf_alloc); | ||
646 | |||
647 | /** | ||
648 | * i2400m_bm_buf_free - Free boot mode command and ack buffers. | ||
649 | * | ||
650 | * Free the command and ack buffers | ||
651 | * | ||
652 | */ | ||
653 | void i2400m_bm_buf_free(struct i2400m *i2400m) | ||
654 | { | ||
655 | kfree(i2400m->bm_ack_buf); | ||
656 | kfree(i2400m->bm_cmd_buf); | ||
657 | return; | ||
658 | } | ||
659 | EXPORT_SYMBOL_GPL(i2400m_bm_buf_free | ||
660 | ); | ||
661 | /** | ||
622 | * i2400m_setup - bus-generic setup function for the i2400m device | 662 | * i2400m_setup - bus-generic setup function for the i2400m device |
623 | * | 663 | * |
624 | * @i2400m: device descriptor (bus-specific parts have been initialized) | 664 | * @i2400m: device descriptor (bus-specific parts have been initialized) |
@@ -645,16 +685,6 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags) | |||
645 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), | 685 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), |
646 | "i2400m-%s:%s", dev->bus->name, dev_name(dev)); | 686 | "i2400m-%s:%s", dev->bus->name, dev_name(dev)); |
647 | 687 | ||
648 | i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); | ||
649 | if (i2400m->bm_cmd_buf == NULL) { | ||
650 | dev_err(dev, "cannot allocate USB command buffer\n"); | ||
651 | goto error_bm_cmd_kzalloc; | ||
652 | } | ||
653 | i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL); | ||
654 | if (i2400m->bm_ack_buf == NULL) { | ||
655 | dev_err(dev, "cannot allocate USB ack buffer\n"); | ||
656 | goto error_bm_ack_buf_kzalloc; | ||
657 | } | ||
658 | result = i2400m_bootrom_init(i2400m, bm_flags); | 688 | result = i2400m_bootrom_init(i2400m, bm_flags); |
659 | if (result < 0) { | 689 | if (result < 0) { |
660 | dev_err(dev, "read mac addr: bootrom init " | 690 | dev_err(dev, "read mac addr: bootrom init " |
@@ -713,10 +743,6 @@ error_dev_start: | |||
713 | error_register_netdev: | 743 | error_register_netdev: |
714 | error_read_mac_addr: | 744 | error_read_mac_addr: |
715 | error_bootrom_init: | 745 | error_bootrom_init: |
716 | kfree(i2400m->bm_ack_buf); | ||
717 | error_bm_ack_buf_kzalloc: | ||
718 | kfree(i2400m->bm_cmd_buf); | ||
719 | error_bm_cmd_kzalloc: | ||
720 | d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); | 746 | d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); |
721 | return result; | 747 | return result; |
722 | } | 748 | } |
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index 60330f313f27..a6e59f1c881d 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h | |||
@@ -725,6 +725,8 @@ void i2400m_put(struct i2400m *i2400m) | |||
725 | } | 725 | } |
726 | 726 | ||
727 | extern int i2400m_dev_reset_handle(struct i2400m *); | 727 | extern int i2400m_dev_reset_handle(struct i2400m *); |
728 | extern int i2400m_bm_buf_alloc(struct i2400m *i2400m); | ||
729 | extern void i2400m_bm_buf_free(struct i2400m *i2400m); | ||
728 | 730 | ||
729 | /* | 731 | /* |
730 | * _setup()/_release() are called by the probe/disconnect functions of | 732 | * _setup()/_release() are called by the probe/disconnect functions of |
diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index c67b0264a282..a68232aa2915 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c | |||
@@ -451,6 +451,18 @@ int i2400ms_probe(struct sdio_func *func, | |||
451 | goto error_func_enable; | 451 | goto error_func_enable; |
452 | } | 452 | } |
453 | 453 | ||
454 | /* | ||
455 | * Before we are enabling the device interrupt register, make | ||
456 | * sure the buffer used during bootmode operation is setup so | ||
457 | * when the first D2H data interrupt comes, the memory is | ||
458 | * available for copying the D2H data. | ||
459 | */ | ||
460 | result = i2400m_bm_buf_alloc(i2400m); | ||
461 | if (result < 0) { | ||
462 | dev_err(dev, "cannot allocate SDIO bootmode buffer\n"); | ||
463 | goto error_bootmode_buf_setup; | ||
464 | } | ||
465 | |||
454 | result = i2400ms_rx_setup(i2400ms); | 466 | result = i2400ms_rx_setup(i2400ms); |
455 | if (result < 0) | 467 | if (result < 0) |
456 | goto error_rx_setup; | 468 | goto error_rx_setup; |
@@ -474,6 +486,8 @@ error_debugfs_add: | |||
474 | error_setup: | 486 | error_setup: |
475 | i2400ms_rx_release(i2400ms); | 487 | i2400ms_rx_release(i2400ms); |
476 | error_rx_setup: | 488 | error_rx_setup: |
489 | i2400m_bm_buf_free(i2400m); | ||
490 | error_bootmode_buf_setup: | ||
477 | sdio_claim_host(func); | 491 | sdio_claim_host(func); |
478 | sdio_disable_func(func); | 492 | sdio_disable_func(func); |
479 | sdio_release_host(func); | 493 | sdio_release_host(func); |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index bfa45f571341..49d7554ad707 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -419,6 +419,12 @@ int i2400mu_probe(struct usb_interface *iface, | |||
419 | usb_dev->autosuspend_disabled = 0; | 419 | usb_dev->autosuspend_disabled = 0; |
420 | #endif | 420 | #endif |
421 | 421 | ||
422 | result = i2400m_bm_buf_alloc(i2400m); | ||
423 | if (result < 0) { | ||
424 | dev_err(dev, "cannot allocate USB bootmode buffer\n"); | ||
425 | goto error_bm_buf_alloc; | ||
426 | } | ||
427 | |||
422 | result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); | 428 | result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); |
423 | if (result < 0) { | 429 | if (result < 0) { |
424 | dev_err(dev, "cannot setup device: %d\n", result); | 430 | dev_err(dev, "cannot setup device: %d\n", result); |
@@ -434,6 +440,8 @@ int i2400mu_probe(struct usb_interface *iface, | |||
434 | error_debugfs_add: | 440 | error_debugfs_add: |
435 | i2400m_release(i2400m); | 441 | i2400m_release(i2400m); |
436 | error_setup: | 442 | error_setup: |
443 | i2400m_bm_buf_free(i2400m); | ||
444 | error_bm_buf_alloc: | ||
437 | usb_set_intfdata(iface, NULL); | 445 | usb_set_intfdata(iface, NULL); |
438 | usb_put_dev(i2400mu->usb_dev); | 446 | usb_put_dev(i2400mu->usb_dev); |
439 | free_netdev(net_dev); | 447 | free_netdev(net_dev); |