[brcm63xx] nb4: fix support, add support for SVC and CLIP BTN
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.3 / 014-spi-bcm63xx-don-t-use-the-stopping-state.patch
1 From 1e41dc0ee2f3807328db95e4f87ff1333245190f Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <florian@openwrt.org>
3 Date: Fri, 20 Apr 2012 15:37:34 +0200
4 Subject: [PATCH] spi/bcm63xx: don't use the stopping state
5
6 We do not need to use a flag to indicate if the master driver is stopping
7 it is sufficient to perform spi master unregistering in the platform
8 driver's remove function.
9
10 Signed-off-by: Florian Fainelli <florian@openwrt.org>
11 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
12 ---
13 drivers/spi/spi-bcm63xx.c | 13 ++-----------
14 1 file changed, 2 insertions(+), 11 deletions(-)
15
16 --- a/drivers/spi/spi-bcm63xx.c
17 +++ b/drivers/spi/spi-bcm63xx.c
18 @@ -39,8 +39,6 @@
19 #define DRV_VER "0.1.2"
20
21 struct bcm63xx_spi {
22 - spinlock_t lock;
23 - int stopping;
24 struct completion done;
25
26 void __iomem *regs;
27 @@ -161,9 +159,6 @@ static int bcm63xx_spi_setup(struct spi_
28
29 bs = spi_master_get_devdata(spi->master);
30
31 - if (bs->stopping)
32 - return -ESHUTDOWN;
33 -
34 if (!spi->bits_per_word)
35 spi->bits_per_word = 8;
36
37 @@ -410,10 +405,8 @@ static int __devinit bcm63xx_spi_probe(s
38 master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer;
39 master->transfer_one_message = bcm63xx_spi_transfer_one;
40 bs->speed_hz = pdata->speed_hz;
41 - bs->stopping = 0;
42 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA));
43 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA));
44 - spin_lock_init(&bs->lock);
45
46 /* Initialize hardware */
47 clk_enable(bs->clk);
48 @@ -447,18 +440,16 @@ static int __devexit bcm63xx_spi_remove(
49 struct spi_master *master = platform_get_drvdata(pdev);
50 struct bcm63xx_spi *bs = spi_master_get_devdata(master);
51
52 + spi_unregister_master(master);
53 +
54 /* reset spi block */
55 bcm_spi_writeb(bs, 0, SPI_INT_MASK);
56 - spin_lock(&bs->lock);
57 - bs->stopping = 1;
58
59 /* HW shutdown */
60 clk_disable(bs->clk);
61 clk_put(bs->clk);
62
63 - spin_unlock(&bs->lock);
64 platform_set_drvdata(pdev, 0);
65 - spi_unregister_master(master);
66
67 return 0;
68 }