diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-09-16 21:23:27 -0400 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-19 02:56:08 -0400 |
commit | 0856ccf29dfbaf957e4be80dd3eb88d97810b633 (patch) | |
tree | a33cf96b010ce3814747b67eb60743554af2070f /drivers/net/wimax/i2400m/driver.c | |
parent | c2315b4ea9ac9c3f8caf03c3511d86fabe4a5fcd (diff) |
wimax/i2400m: introduce i2400m->bus_setup/release
The SDIO subdriver of the i2400m requires certain steps to be done
before we do any acces to the device, even for doing firmware upload.
This lead to a few ugly hacks, which basically involve doing those
steps in probe() before calling i2400m_setup() and undoing them in
disconnect() after claling i2400m_release(); but then, much of those
steps have to be repeated when resetting the device, suspending, etc
(in upcoming pre/post reset support).
Thus, a new pair of optional, bus-specific calls
i2400m->bus_{setup/release} are introduced. These are used to setup
basic infrastructure needed to load firmware onto the device.
This commit also updates the SDIO subdriver to use said calls.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/driver.c')
-rw-r--r-- | drivers/net/wimax/i2400m/driver.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c index 6280646d7d7f..c57020f811cd 100644 --- a/drivers/net/wimax/i2400m/driver.c +++ b/drivers/net/wimax/i2400m/driver.c | |||
@@ -41,8 +41,10 @@ | |||
41 | * __i2400m_dev_start() | 41 | * __i2400m_dev_start() |
42 | * | 42 | * |
43 | * i2400m_setup() | 43 | * i2400m_setup() |
44 | * i2400m->bus_setup() | ||
44 | * i2400m_bootrom_init() | 45 | * i2400m_bootrom_init() |
45 | * register_netdev() | 46 | * register_netdev() |
47 | * wimax_dev_add() | ||
46 | * i2400m_dev_start() | 48 | * i2400m_dev_start() |
47 | * __i2400m_dev_start() | 49 | * __i2400m_dev_start() |
48 | * i2400m_dev_bootstrap() | 50 | * i2400m_dev_bootstrap() |
@@ -50,15 +52,15 @@ | |||
50 | * i2400m->bus_dev_start() | 52 | * i2400m->bus_dev_start() |
51 | * i2400m_firmware_check() | 53 | * i2400m_firmware_check() |
52 | * i2400m_check_mac_addr() | 54 | * i2400m_check_mac_addr() |
53 | * wimax_dev_add() | ||
54 | * | 55 | * |
55 | * i2400m_release() | 56 | * i2400m_release() |
56 | * wimax_dev_rm() | ||
57 | * i2400m_dev_stop() | 57 | * i2400m_dev_stop() |
58 | * __i2400m_dev_stop() | 58 | * __i2400m_dev_stop() |
59 | * i2400m_dev_shutdown() | 59 | * i2400m_dev_shutdown() |
60 | * i2400m->bus_dev_stop() | 60 | * i2400m->bus_dev_stop() |
61 | * i2400m_tx_release() | 61 | * i2400m_tx_release() |
62 | * i2400m->bus_release() | ||
63 | * wimax_dev_rm() | ||
62 | * unregister_netdev() | 64 | * unregister_netdev() |
63 | */ | 65 | */ |
64 | #include "i2400m.h" | 66 | #include "i2400m.h" |
@@ -784,6 +786,15 @@ int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags) | |||
784 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), | 786 | snprintf(wimax_dev->name, sizeof(wimax_dev->name), |
785 | "i2400m-%s:%s", dev->bus->name, dev_name(dev)); | 787 | "i2400m-%s:%s", dev->bus->name, dev_name(dev)); |
786 | 788 | ||
789 | if (i2400m->bus_setup) { | ||
790 | result = i2400m->bus_setup(i2400m); | ||
791 | if (result < 0) { | ||
792 | dev_err(dev, "bus-specific setup failed: %d\n", | ||
793 | result); | ||
794 | goto error_bus_setup; | ||
795 | } | ||
796 | } | ||
797 | |||
787 | result = i2400m_bootrom_init(i2400m, bm_flags); | 798 | result = i2400m_bootrom_init(i2400m, bm_flags); |
788 | if (result < 0) { | 799 | if (result < 0) { |
789 | dev_err(dev, "read mac addr: bootrom init " | 800 | dev_err(dev, "read mac addr: bootrom init " |
@@ -846,6 +857,9 @@ error_register_netdev: | |||
846 | unregister_pm_notifier(&i2400m->pm_notifier); | 857 | unregister_pm_notifier(&i2400m->pm_notifier); |
847 | error_read_mac_addr: | 858 | error_read_mac_addr: |
848 | error_bootrom_init: | 859 | error_bootrom_init: |
860 | if (i2400m->bus_release) | ||
861 | i2400m->bus_release(i2400m); | ||
862 | error_bus_setup: | ||
849 | d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); | 863 | d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); |
850 | return result; | 864 | return result; |
851 | } | 865 | } |
@@ -872,6 +886,8 @@ void i2400m_release(struct i2400m *i2400m) | |||
872 | wimax_dev_rm(&i2400m->wimax_dev); | 886 | wimax_dev_rm(&i2400m->wimax_dev); |
873 | unregister_netdev(i2400m->wimax_dev.net_dev); | 887 | unregister_netdev(i2400m->wimax_dev.net_dev); |
874 | unregister_pm_notifier(&i2400m->pm_notifier); | 888 | unregister_pm_notifier(&i2400m->pm_notifier); |
889 | if (i2400m->bus_release) | ||
890 | i2400m->bus_release(i2400m); | ||
875 | i2400m_bm_buf_free(i2400m); | 891 | i2400m_bm_buf_free(i2400m); |
876 | d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); | 892 | d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); |
877 | } | 893 | } |