Commit 2093586d authored by Dirk Brandewie's avatar Dirk Brandewie Committed by Inaky Perez-Gonzalez

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: default avatarDirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: default avatarInaky Perez-Gonzalez <inaky@linux.intel.com>
parent 8bec9a5e
...@@ -88,6 +88,13 @@ struct edc { ...@@ -88,6 +88,13 @@ struct edc {
u16 errorcount; u16 errorcount;
}; };
struct i2400m_endpoint_cfg {
unsigned char bulk_out;
unsigned char notification;
unsigned char reset_cold;
unsigned char bulk_in;
};
static inline void edc_init(struct edc *edc) static inline void edc_init(struct edc *edc)
{ {
edc->timestart = jiffies; edc->timestart = jiffies;
...@@ -141,12 +148,6 @@ enum { ...@@ -141,12 +148,6 @@ enum {
I2400MU_MAX_NOTIFICATION_LEN = 256, I2400MU_MAX_NOTIFICATION_LEN = 256,
I2400MU_BLK_SIZE = 16, I2400MU_BLK_SIZE = 16,
I2400MU_PL_SIZE_MAX = 0x3EFF, I2400MU_PL_SIZE_MAX = 0x3EFF,
/* Endpoints */
I2400MU_EP_BULK_OUT = 0,
I2400MU_EP_NOTIFICATION,
I2400MU_EP_RESET_COLD,
I2400MU_EP_BULK_IN,
}; };
...@@ -216,6 +217,7 @@ struct i2400mu { ...@@ -216,6 +217,7 @@ struct i2400mu {
struct usb_device *usb_dev; struct usb_device *usb_dev;
struct usb_interface *usb_iface; struct usb_interface *usb_iface;
struct edc urb_edc; /* Error density counter */ struct edc urb_edc; /* Error density counter */
struct i2400m_endpoint_cfg endpoint_cfg;
struct urb *notif_urb; struct urb *notif_urb;
struct task_struct *tx_kthread; struct task_struct *tx_kthread;
......
...@@ -99,7 +99,7 @@ ssize_t i2400mu_tx_bulk_out(struct i2400mu *i2400mu, void *buf, size_t buf_size) ...@@ -99,7 +99,7 @@ ssize_t i2400mu_tx_bulk_out(struct i2400mu *i2400mu, void *buf, size_t buf_size)
dev_err(dev, "BM-CMD: can't get autopm: %d\n", result); dev_err(dev, "BM-CMD: can't get autopm: %d\n", result);
do_autopm = 0; do_autopm = 0;
} }
epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT); epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_out);
pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
retry: retry:
result = usb_bulk_msg(i2400mu->usb_dev, pipe, buf, buf_size, &len, HZ); 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,7 +226,8 @@ int i2400mu_notif_submit(struct i2400mu *i2400mu, struct urb *urb,
struct usb_endpoint_descriptor *epd; struct usb_endpoint_descriptor *epd;
int pipe; int pipe;
epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION); epd = usb_get_epd(i2400mu->usb_iface,
i2400mu->endpoint_cfg.notification);
pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress);
usb_fill_int_urb(urb, i2400mu->usb_dev, pipe, usb_fill_int_urb(urb, i2400mu->usb_dev, pipe,
i2400m->bm_ack_buf, I2400M_BM_ACK_BUF_SIZE, i2400m->bm_ack_buf, I2400M_BM_ACK_BUF_SIZE,
......
...@@ -220,7 +220,8 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu) ...@@ -220,7 +220,8 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu)
dev_err(dev, "notification: cannot allocate URB\n"); dev_err(dev, "notification: cannot allocate URB\n");
goto error_alloc_urb; goto error_alloc_urb;
} }
epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_NOTIFICATION); epd = usb_get_epd(i2400mu->usb_iface,
i2400mu->endpoint_cfg.notification);
usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress); usb_pipe = usb_rcvintpipe(i2400mu->usb_dev, epd->bEndpointAddress);
usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe, usb_fill_int_urb(i2400mu->notif_urb, i2400mu->usb_dev, usb_pipe,
buf, I2400MU_MAX_NOTIFICATION_LEN, buf, I2400MU_MAX_NOTIFICATION_LEN,
......
...@@ -204,7 +204,7 @@ struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb) ...@@ -204,7 +204,7 @@ struct sk_buff *i2400mu_rx(struct i2400mu *i2400mu, struct sk_buff *rx_skb)
dev_err(dev, "RX: can't get autopm: %d\n", result); dev_err(dev, "RX: can't get autopm: %d\n", result);
do_autopm = 0; do_autopm = 0;
} }
epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_IN); epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_in);
usb_pipe = usb_rcvbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); usb_pipe = usb_rcvbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
retry: retry:
rx_size = skb_end_pointer(rx_skb) - rx_skb->data - rx_skb->len; rx_size = skb_end_pointer(rx_skb) - rx_skb->data - rx_skb->len;
......
...@@ -101,7 +101,7 @@ int i2400mu_tx(struct i2400mu *i2400mu, struct i2400m_msg_hdr *tx_msg, ...@@ -101,7 +101,7 @@ int i2400mu_tx(struct i2400mu *i2400mu, struct i2400m_msg_hdr *tx_msg,
dev_err(dev, "TX: can't get autopm: %d\n", result); dev_err(dev, "TX: can't get autopm: %d\n", result);
do_autopm = 0; do_autopm = 0;
} }
epd = usb_get_epd(i2400mu->usb_iface, I2400MU_EP_BULK_OUT); epd = usb_get_epd(i2400mu->usb_iface, i2400mu->endpoint_cfg.bulk_out);
usb_pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress); usb_pipe = usb_sndbulkpipe(i2400mu->usb_dev, epd->bEndpointAddress);
retry: retry:
result = usb_bulk_msg(i2400mu->usb_dev, usb_pipe, result = usb_bulk_msg(i2400mu->usb_dev, usb_pipe,
......
...@@ -232,13 +232,15 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) ...@@ -232,13 +232,15 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt); d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt);
if (rt == I2400M_RT_WARM) if (rt == I2400M_RT_WARM)
result = __i2400mu_send_barker(i2400mu, i2400m_WARM_BOOT_BARKER, result = __i2400mu_send_barker(
i2400mu, i2400m_WARM_BOOT_BARKER,
sizeof(i2400m_WARM_BOOT_BARKER), sizeof(i2400m_WARM_BOOT_BARKER),
I2400MU_EP_BULK_OUT); i2400mu->endpoint_cfg.bulk_out);
else if (rt == I2400M_RT_COLD) else if (rt == I2400M_RT_COLD)
result = __i2400mu_send_barker(i2400mu, i2400m_COLD_BOOT_BARKER, result = __i2400mu_send_barker(
i2400mu, i2400m_COLD_BOOT_BARKER,
sizeof(i2400m_COLD_BOOT_BARKER), sizeof(i2400m_COLD_BOOT_BARKER),
I2400MU_EP_RESET_COLD); i2400mu->endpoint_cfg.reset_cold);
else if (rt == I2400M_RT_BUS) { else if (rt == I2400M_RT_BUS) {
do_bus_reset: do_bus_reset:
result = usb_reset_device(i2400mu->usb_dev); result = usb_reset_device(i2400mu->usb_dev);
...@@ -412,6 +414,12 @@ int i2400mu_probe(struct usb_interface *iface, ...@@ -412,6 +414,12 @@ int i2400mu_probe(struct usb_interface *iface,
i2400m->bus_fw_names = i2400mu_bus_fw_names; i2400m->bus_fw_names = i2400mu_bus_fw_names;
i2400m->bus_bm_mac_addr_impaired = 0; i2400m->bus_bm_mac_addr_impaired = 0;
{
i2400mu->endpoint_cfg.bulk_out = 0;
i2400mu->endpoint_cfg.notification = 1;
i2400mu->endpoint_cfg.reset_cold = 2;
i2400mu->endpoint_cfg.bulk_in = 3;
}
#ifdef CONFIG_PM #ifdef CONFIG_PM
iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */
device_init_wakeup(dev, 1); device_init_wakeup(dev, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment