From 10b1de6b774a531c9054ee01e734a85ffbab179e Mon Sep 17 00:00:00 2001 From: Dirk Brandewie Date: Tue, 12 May 2009 07:54:00 -0700 Subject: wimax/i2400m/sdio: Implement I2400M_RT_BUS reset type This reset type causes the WiMAX function to be disabled and re-enabled, which will force the WiMAX device to reset and enter boot mode. Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Dirk Brandewie --- drivers/net/wimax/i2400m/sdio.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'drivers/net/wimax/i2400m/sdio.c') diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index 777c981676f..d6fac5ccf93 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c @@ -255,7 +255,7 @@ error_kzalloc: static int i2400ms_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) { - int result; + int result = 0; struct i2400ms *i2400ms = container_of(i2400m, struct i2400ms, i2400m); struct device *dev = i2400m_dev(i2400m); @@ -280,8 +280,22 @@ int i2400ms_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) sizeof(i2400m_COLD_BOOT_BARKER)); else if (rt == I2400M_RT_BUS) { do_bus_reset: - dev_err(dev, "FIXME: SDIO bus reset not implemented\n"); - result = rt == I2400M_RT_WARM ? -ENODEV : -ENOSYS; + /* call netif_tx_disable() before sending IOE disable, + * so that all the tx from network layer are stopped + * while IOE is being reset. Make sure it is called + * only after register_netdev() was issued. + */ + if (i2400m->wimax_dev.net_dev->reg_state == NETREG_REGISTERED) + netif_tx_disable(i2400m->wimax_dev.net_dev); + + sdio_claim_host(i2400ms->func); + sdio_disable_func(i2400ms->func); + sdio_release_host(i2400ms->func); + + /* Wait for the device to settle */ + msleep(40); + + result = i2400ms_enable_function(i2400ms->func); } else BUG(); if (result < 0 && rt != I2400M_RT_BUS) { -- cgit v1.2.3 From ecddfd5ed73c070413f07a5251c16c10e69f35a2 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Wed, 3 Jun 2009 16:13:14 +0800 Subject: wimax/i2400m: Allow bus-specific driver to specify retry count The code that sets up the i2400m (firmware load and general driver setup after it) includes a couple of retry loops. The SDIO device sometimes can get in more complicated corners than the USB one (due to its interaction with other SDIO functions), that require trying a few more times. To solve that, without having a failing USB device taking longer to be considered dead, allow the retry counts to be specified by the bus-specific driver, which the general driver takes as a parameter. Signed-off-by: Inaky Perez-Gonzalez --- drivers/net/wimax/i2400m/sdio.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/wimax/i2400m/sdio.c') diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index d6fac5ccf93..afde8977004 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c @@ -418,6 +418,9 @@ int i2400ms_probe(struct sdio_func *func, i2400m->bus_dev_stop = i2400ms_bus_dev_stop; i2400m->bus_tx_kick = i2400ms_bus_tx_kick; i2400m->bus_reset = i2400ms_bus_reset; + /* The iwmc3200-wimax sometimes requires the driver to try + * hard when we paint it into a corner. */ + i2400m->bus_bm_retries = I3200_BOOT_RETRIES; i2400m->bus_bm_cmd_send = i2400ms_bus_bm_cmd_send; i2400m->bus_bm_wait_for_ack = i2400ms_bus_bm_wait_for_ack; i2400m->bus_fw_names = i2400ms_bus_fw_names; -- cgit v1.2.3 From 1c0b2dd75772cbce0aef8886b7f38313542216de Mon Sep 17 00:00:00 2001 From: Dirk Brandewie Date: Thu, 21 May 2009 11:56:35 -0700 Subject: wimax/i2400m/sdio: Add device specific poke table. Add a poke table for the SDIO device (as it is different than USB). Signed-off-by: Dirk Brandewie --- drivers/net/wimax/i2400m/sdio.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/net/wimax/i2400m/sdio.c') diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index afde8977004..74de174a4c4 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c @@ -78,6 +78,14 @@ static const char *i2400ms_bus_fw_names[] = { }; +static const struct i2400m_poke_table i2400ms_pokes[] = { + I2400M_FW_POKE(0x6BE260, 0x00000088), + I2400M_FW_POKE(0x080550, 0x00000005), + I2400M_FW_POKE(0xAE0000, 0x00000000), + I2400M_FW_POKE(0x000000, 0x00000000), /* MUST be 0 terminated or bad + * things will happen */ +}; + /* * Enable the SDIO function * @@ -425,6 +433,7 @@ int i2400ms_probe(struct sdio_func *func, i2400m->bus_bm_wait_for_ack = i2400ms_bus_bm_wait_for_ack; i2400m->bus_fw_names = i2400ms_bus_fw_names; i2400m->bus_bm_mac_addr_impaired = 1; + i2400m->bus_bm_pokes_table = &i2400ms_pokes[0]; sdio_claim_host(func); result = sdio_set_block_size(func, I2400MS_BLK_SIZE); -- cgit v1.2.3 From 16820c166d3ad5973d388b5aa70ee7e535386657 Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Thu, 7 May 2009 01:02:39 -0700 Subject: wimax/i2400m/sdio: Move all the RX code to a unified, IRQ based receive routine The current SDIO code was working in polling mode for boot-mode (firmware load) mode. This was causing issues on some hardware. Moved all the RX code to use a unified IRQ handler that based on the type of data the device is sending can discriminate and decide which is the right destination. As well, all the reads from the device are made to be at least the block size (256); the driver will ignore the rest when not needed. Signed-off-by: Dirk Brandewie Signed-off-by: Inaky Perez-Gonzalez --- drivers/net/wimax/i2400m/sdio.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'drivers/net/wimax/i2400m/sdio.c') diff --git a/drivers/net/wimax/i2400m/sdio.c b/drivers/net/wimax/i2400m/sdio.c index 74de174a4c4..2538825d1c6 100644 --- a/drivers/net/wimax/i2400m/sdio.c +++ b/drivers/net/wimax/i2400m/sdio.c @@ -156,19 +156,14 @@ int i2400ms_bus_dev_start(struct i2400m *i2400m) d_fnstart(3, dev, "(i2400m %p)\n", i2400m); msleep(200); - result = i2400ms_rx_setup(i2400ms); - if (result < 0) - goto error_rx_setup; result = i2400ms_tx_setup(i2400ms); if (result < 0) goto error_tx_setup; d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); return result; - i2400ms_tx_release(i2400ms); error_tx_setup: - i2400ms_rx_release(i2400ms); -error_rx_setup: + i2400ms_tx_release(i2400ms); d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); return result; } @@ -182,7 +177,6 @@ void i2400ms_bus_dev_stop(struct i2400m *i2400m) struct device *dev = &func->dev; d_fnstart(3, dev, "(i2400m %p)\n", i2400m); - i2400ms_rx_release(i2400ms); i2400ms_tx_release(i2400ms); d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); } @@ -296,6 +290,7 @@ do_bus_reset: if (i2400m->wimax_dev.net_dev->reg_state == NETREG_REGISTERED) netif_tx_disable(i2400m->wimax_dev.net_dev); + i2400ms_rx_release(i2400ms); sdio_claim_host(i2400ms->func); sdio_disable_func(i2400ms->func); sdio_release_host(i2400ms->func); @@ -304,6 +299,8 @@ do_bus_reset: msleep(40); result = i2400ms_enable_function(i2400ms->func); + if (result >= 0) + i2400ms_rx_setup(i2400ms); } else BUG(); if (result < 0 && rt != I2400M_RT_BUS) { @@ -449,6 +446,10 @@ int i2400ms_probe(struct sdio_func *func, goto error_func_enable; } + result = i2400ms_rx_setup(i2400ms); + if (result < 0) + goto error_rx_setup; + result = i2400m_setup(i2400m, I2400M_BRI_NO_REBOOT); if (result < 0) { dev_err(dev, "cannot setup device: %d\n", result); @@ -466,6 +467,8 @@ int i2400ms_probe(struct sdio_func *func, error_debugfs_add: i2400m_release(i2400m); error_setup: + i2400ms_rx_release(i2400ms); +error_rx_setup: sdio_claim_host(func); sdio_disable_func(func); sdio_release_host(func); @@ -488,6 +491,7 @@ void i2400ms_remove(struct sdio_func *func) d_fnstart(3, dev, "SDIO func %p\n", func); debugfs_remove_recursive(i2400ms->debugfs_dentry); + i2400ms_rx_release(i2400ms); i2400m_release(i2400m); sdio_set_drvdata(func, NULL); sdio_claim_host(func); -- cgit v1.2.3