aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2010-10-22 02:01:47 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-10-22 03:26:46 -0400
commit73e1ac16258fe7e55cce4691e32c0b44d4579e08 (patch)
treeaaa8fe91c600c5c07fdc105ba65dee42192dc4cf
parent782a895693a52fd8b288c33bdd7e98357888fc1f (diff)
spi/bfin_spi: only request GPIO on first load
The gpiolib code does not allow people to do gpio_request() on a GPIO once it has already been requested. So make sure we only request the pin on the first setup of a SPI device. Otherwise, if you attempts to reconfigure a SPI device on the fly (like change bit sizes), the setup function incorrectly fails. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/spi/spi_bfin5xx.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index d3da41d3f92d..3f223511127b 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -1108,12 +1108,15 @@ static int bfin_spi_setup(struct spi_device *spi)
1108 } 1108 }
1109 1109
1110 if (chip->chip_select_num >= MAX_CTRL_CS) { 1110 if (chip->chip_select_num >= MAX_CTRL_CS) {
1111 ret = gpio_request(chip->cs_gpio, spi->modalias); 1111 /* Only request on first setup */
1112 if (ret) { 1112 if (spi_get_ctldata(spi) == NULL) {
1113 dev_err(&spi->dev, "gpio_request() error\n"); 1113 ret = gpio_request(chip->cs_gpio, spi->modalias);
1114 goto pin_error; 1114 if (ret) {
1115 dev_err(&spi->dev, "gpio_request() error\n");
1116 goto pin_error;
1117 }
1118 gpio_direction_output(chip->cs_gpio, 1);
1115 } 1119 }
1116 gpio_direction_output(chip->cs_gpio, 1);
1117 } 1120 }
1118 1121
1119 dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d\n", 1122 dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d\n",