Thread (8 messages) 8 messages, 3 authors, 2014-01-31

Re: wlcore-spi crash

From: Luca Coelho <hidden>
Date: 2014-01-31 06:17:22
Subsystem: the rest, ti wilink wireless drivers · Maintainer: Linus Torvalds

Hi Charles,

On Thu, 2014-01-30 at 17:20 -0500, Charles wrote:
So my hack was obviously not the right solution, because I'm not
powering the chip.  I know that in wlcore\spi.c, I need to set a
.power function in spi_ops (i.e. .power = wl12xx_spi_power).  And I
already have a wl12xx_platform_data with a .set_power function defined
in my board platform file.  But I don't know how to access my platform
file's set_power function from the wl12xx_spi_power function in spi.c.

In other words, I can' figure out how to do this from wlcore\spi.c:

static int wl12xx_spi_power(struct device *child, bool enable) {

    set_power_function_defined_in_my_board_platform_file(enable);

}
Try this:

diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index b2c018d..1278583 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -316,6 +316,16 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
        return 0;
 }
 
+static int wl12xx_spi_power(struct device *child, bool enable)
+{
+       struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+       struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
+
+       pdev_data->pdata->set_power(enable);
+
+       return 0;
+}
+
 static struct wl1271_if_operations spi_ops = {
        .read           = wl12xx_spi_raw_read,
        .write          = wl12xx_spi_raw_write,
Note that this is only compile-tested, so I have no clue if it really
works.

I'm *not* saying this is the right way to do it, I just hacked it up
quickly.

I hope this helps you go in the right direction.

--
Luca.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help