diff options
author | Dirk Brandewie <dirk.j.brandewie@intel.com> | 2009-08-12 14:29:46 -0400 |
---|---|---|
committer | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-19 02:55:44 -0400 |
commit | 2093586de29418820b89aae05746511392f8ad73 (patch) | |
tree | b5d021b77a886380e3ac529e6a837b063cff0779 | |
parent | 8bec9a5efd5691c5a32d85da1da09643290ebb72 (diff) |
wimax/i2400m: USB driver uses a configurable endpoint map
Newer generations of the i2400m USB WiMAX device use a different
endpoint map; in order to make it easy to support it, we make the
endpoint-to-function mapeable instead of static.
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m-usb.h | 14 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb-fw.c | 5 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb-notif.c | 3 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb-rx.c | 2 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb-tx.c | 2 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/usb.c | 20 |
6 files changed, 29 insertions, 17 deletions
diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h index 79c37534c200..f73a067e0668 100644 --- a/drivers/net/wimax/i2400m/i2400m-usb.h +++ b/drivers/net/wimax/i2400m/i2400m-usb.h | |||
@@ -88,6 +88,13 @@ struct edc { | |||
88 | u16 errorcount; | 88 | u16 errorcount; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | struct i2400m_endpoint_cfg { | ||
92 | unsigned char bulk_out; | ||
93 | unsigned char notification; | ||
94 | unsigned char reset_cold; | ||
95 | unsigned char bulk_in; | ||
96 | }; | ||
97 | |||
91 | static inline void edc_init(struct edc *edc) | 98 | static inline void edc_init(struct edc *edc) |
92 | { | 99 | { |
93 | edc->timestart = jiffies; | 100 | edc->timestart = jiffies; |
@@ -141,12 +148,6 @@ enum { | |||
141 | I2400MU_MAX_NOTIFICATION_LEN = 256, | 148 | I2400MU_MAX_NOTIFICATION_LEN = 256, |
142 | I2400MU_BLK_SIZE = 16, | 149 | I2400MU_BLK_SIZE = 16, |
143 | I2400MU_PL_SIZE_MAX = 0x3EFF, | 150 | I2400MU_PL_SIZE_MAX = 0x3EFF, |
144 | |||
145 | /* Endpoints */ | ||
146 | I2400MU_EP_BULK_OUT = 0, | ||
147 | I2400MU_EP_NOTIFICATION, | ||
148 | I2400MU_EP_RESET_COLD, | ||
149 | I2400MU_EP_BULK_IN, | ||
150 | }; | 151 | }; |
151 | 152 | ||
152 | 153 | ||
@@ -216,6 +217,7 @@ struct i2400mu { | |||
216 | struct usb_device *usb_dev; | 217 | struct usb_device *usb_dev; |
217 | struct usb_interface *usb_iface; | 218 | struct usb_interface *usb_iface; |
218 | struct edc urb_edc; /* Error density counter */ | 219 | struct edc urb_edc; /* Error density counter */ |
220 | struct i2400m_endpoint_cfg endpoint_cfg; | ||
219 | 221 | ||
220 | struct urb *notif_urb; | 222 | struct urb *notif_urb; |
221 | struct task_struct *tx_kthread; | 223 | struct task_struct *tx_kthread; |
diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c index 5ad287c228b8..a2250e49a444 100644 --- a/drivers/net/wimax/i2400m/usb-fw.c +++ b/drivers/net/wimax/i2400m/usb-fw.c | |||
@@ -99,7 +99,7 @@ ssize_t i2400mu_tx_bulk_out(struct i2400mu *i2400mu, void *buf, size_t buf_size) | |||
99 | dev_err(dev, "BM-CMD: can't get autopm: %d\n", result); | 99 | dev_err(dev, "BM-CMD: can't get autopm: %d\n", result); |
100 | do_autopm = 0; | 100 | do_autopm = 0; |
101 | } | 101 | } |
102 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT); | 102 | epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_out); |
103 | pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 103 | pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
104 | retry: | 104 | retry: |
105 | result = usb_bulk_msg(i2400mu->usb_dev, pipe, buf, buf_size, &len, HZ); | 105 | result = usb_bulk_msg(i2400mu->usb_dev, pipe, buf, buf_size, &len, HZ); |
@@ -226,7 +226,8 @@ int i2400mu_notif_submit(struct i2400mu *i2400mu, struct urb *urb, | |||
226 | struct usb_endpoint_descriptor *epd; | 226 | struct usb_endpoint_descriptor *epd; |
227 | int pipe; | 227 | int pipe; |
228 | 228 | ||
229 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION); | 229 | epd = usb_get_epd(i2400mu->usb_iface, |
230 | i2400mu->endpoint_cfg.notification); | ||
230 | pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 231 | pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
231 | usb_fill_int_urb(urb, i2400mu->usb_dev, pipe, | 232 | usb_fill_int_urb(urb, i2400mu->usb_dev, pipe, |
232 | i2400m->bm_ack_buf, I2400M_BM_ACK_BUF_SIZE, | 233 | i2400m->bm_ack_buf, I2400M_BM_ACK_BUF_SIZE, |
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c index 6add27c3f35c..3e11e35cd696 100644 --- a/drivers/net/wimax/i2400m/usb-notif.c +++ b/drivers/net/wimax/i2400m/usb-notif.c | |||
@@ -220,7 +220,8 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu) | |||
220 | dev_err(dev, "notification: cannot allocate URB\n"); | 220 | dev_err(dev, "notification: cannot allocate URB\n"); |
221 | goto error_alloc_urb; | 221 | goto error_alloc_urb; |
222 | } | 222 | } |
223 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION); | 223 | epd = usb_get_epd(i2400mu->usb_iface, |
224 | i2400mu->endpoint_cfg.notification); | ||
224 | usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 225 | usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
225 | usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe, | 226 | usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe, |
226 | buf, I2400MU_MAX_NOTIFICATION_LEN, | 227 | buf, I2400MU_MAX_NOTIFICATION_LEN, |
diff --git a/drivers/net/wimax/i2400m/usb-rx.c b/drivers/net/wimax/i2400m/usb-rx.c index a314799967cf..e494e3774ec0 100644 --- a/drivers/net/wimax/i2400m/usb-rx.c +++ b/drivers/net/wimax/i2400m/usb-rx.c | |||
@@ -204,7 +204,7 @@ struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb) | |||
204 | dev_err(dev, "RX: can't get autopm: %d\n", result); | 204 | dev_err(dev, "RX: can't get autopm: %d\n", result); |
205 | do_autopm = 0; | 205 | do_autopm = 0; |
206 | } | 206 | } |
207 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_IN); | 207 | epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_in); |
208 | usb_pipe = usb_rcvbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 208 | usb_pipe = usb_rcvbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
209 | retry: | 209 | retry: |
210 | rx_size = skb_end_pointer(rx_skb) - rx_skb->data - rx_skb->len; | 210 | rx_size = skb_end_pointer(rx_skb) - rx_skb->data - rx_skb->len; |
diff --git a/drivers/net/wimax/i2400m/usb-tx.c b/drivers/net/wimax/i2400m/usb-tx.c index dfd893356f49..90dfff1afb8a 100644 --- a/drivers/net/wimax/i2400m/usb-tx.c +++ b/drivers/net/wimax/i2400m/usb-tx.c | |||
@@ -101,7 +101,7 @@ int i2400mu_tx(struct i2400mu *i2400mu, struct i2400m_msg_hdr *tx_msg, | |||
101 | dev_err(dev, "TX: can't get autopm: %d\n", result); | 101 | dev_err(dev, "TX: can't get autopm: %d\n", result); |
102 | do_autopm = 0; | 102 | do_autopm = 0; |
103 | } | 103 | } |
104 | epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT); | 104 | epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_out); |
105 | usb_pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); | 105 | usb_pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); |
106 | retry: | 106 | retry: |
107 | result = usb_bulk_msg(i2400mu->usb_dev, usb_pipe, | 107 | result = usb_bulk_msg(i2400mu->usb_dev, usb_pipe, |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 8f7b16a6bf3c..a5879e21bbf3 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -232,13 +232,15 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) | |||
232 | 232 | ||
233 | d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt); | 233 | d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt); |
234 | if (rt == I2400M_RT_WARM) | 234 | if (rt == I2400M_RT_WARM) |
235 | result = __i2400mu_send_barker(i2400mu, i2400m_WARM_BOOT_BARKER, | 235 | result = __i2400mu_send_barker( |
236 | sizeof(i2400m_WARM_BOOT_BARKER), | 236 | i2400mu, i2400m_WARM_BOOT_BARKER, |
237 | I2400MU_EP_BULK_OUT); | 237 | sizeof(i2400m_WARM_BOOT_BARKER), |
238 | i2400mu->endpoint_cfg.bulk_out); | ||
238 | else if (rt == I2400M_RT_COLD) | 239 | else if (rt == I2400M_RT_COLD) |
239 | result = __i2400mu_send_barker(i2400mu, i2400m_COLD_BOOT_BARKER, | 240 | result = __i2400mu_send_barker( |
240 | sizeof(i2400m_COLD_BOOT_BARKER), | 241 | i2400mu, i2400m_COLD_BOOT_BARKER, |
241 | I2400MU_EP_RESET_COLD); | 242 | sizeof(i2400m_COLD_BOOT_BARKER), |
243 | i2400mu->endpoint_cfg.reset_cold); | ||
242 | else if (rt == I2400M_RT_BUS) { | 244 | else if (rt == I2400M_RT_BUS) { |
243 | do_bus_reset: | 245 | do_bus_reset: |
244 | result = usb_reset_device(i2400mu->usb_dev); | 246 | result = usb_reset_device(i2400mu->usb_dev); |
@@ -412,6 +414,12 @@ int i2400mu_probe(struct usb_interface *iface, | |||
412 | i2400m->bus_fw_names = i2400mu_bus_fw_names; | 414 | i2400m->bus_fw_names = i2400mu_bus_fw_names; |
413 | i2400m->bus_bm_mac_addr_impaired = 0; | 415 | i2400m->bus_bm_mac_addr_impaired = 0; |
414 | 416 | ||
417 | { | ||
418 | i2400mu->endpoint_cfg.bulk_out = 0; | ||
419 | i2400mu->endpoint_cfg.notification = 1; | ||
420 | i2400mu->endpoint_cfg.reset_cold = 2; | ||
421 | i2400mu->endpoint_cfg.bulk_in = 3; | ||
422 | } | ||
415 | #ifdef CONFIG_PM | 423 | #ifdef CONFIG_PM |
416 | iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ | 424 | iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ |
417 | device_init_wakeup(dev, 1); | 425 | device_init_wakeup(dev, 1); |