diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-02-03 09:04:20 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-09 15:03:48 -0500 |
commit | 0c2bec96945ccfc4a58a88d73531e392972ba6c5 (patch) | |
tree | c3bfabe4cc063031e0a647f519499d9053099ec0 /drivers/net/wireless/libertas/if_spi.c | |
parent | d43e87868f67c5b52defd8d82bc3f54347ed2408 (diff) |
libertas: if_spi: add ability to call board specific setup/teardown methods
In certain cases it is required to perform board specific actions
before activating libertas G-SPI interface. These actions may include
power up of the chip, GPIOs setup, proper pin-strapping and SPI
controller config.
This patch adds ability to call board specific setup/teardown methods
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Andrey Yurovsky <andrey@cozybit.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/if_spi.c')
-rw-r--r-- | drivers/net/wireless/libertas/if_spi.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index 7c02ea314fd..07311e71af9 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c @@ -42,6 +42,7 @@ struct if_spi_packet { struct if_spi_card { struct spi_device *spi; struct lbs_private *priv; + struct libertas_spi_platform_data *pdata; char helper_fw_name[FIRMWARE_NAME_MAX]; char main_fw_name[FIRMWARE_NAME_MAX]; @@ -1022,6 +1023,17 @@ static int __devinit if_spi_probe(struct spi_device *spi) lbs_deb_enter(LBS_DEB_SPI); + if (!pdata) { + err = -EINVAL; + goto out; + } + + if (pdata->setup) { + err = pdata->setup(spi); + if (err) + goto out; + } + /* Allocate card structure to represent this specific device */ card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL); if (!card) { @@ -1029,6 +1041,7 @@ static int __devinit if_spi_probe(struct spi_device *spi) goto out; } spi_set_drvdata(spi, card); + card->pdata = pdata; card->spi = spi; card->gpio_cs = pdata->gpio_cs; card->prev_xfer_time = jiffies; @@ -1158,6 +1171,8 @@ static int __devexit libertas_spi_remove(struct spi_device *spi) if_spi_terminate_spi_thread(card); lbs_remove_card(priv); /* will call free_netdev */ gpio_free(card->gpio_cs); + if (card->pdata->teardown) + card->pdata->teardown(spi); free_if_spi_card(card); lbs_deb_leave(LBS_DEB_SPI); return 0; |