aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_bfin5xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi_bfin5xx.c')
-rw-r--r--drivers/spi/spi_bfin5xx.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index ab483a0ec6d0..3f223511127b 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -504,6 +504,15 @@ static irqreturn_t bfin_spi_dma_irq_handler(int irq, void *dev_id)
504 "in dma_irq_handler dmastat:0x%x spistat:0x%x\n", 504 "in dma_irq_handler dmastat:0x%x spistat:0x%x\n",
505 dmastat, spistat); 505 dmastat, spistat);
506 506
507 if (drv_data->rx != NULL) {
508 u16 cr = read_CTRL(drv_data);
509 /* discard old RX data and clear RXS */
510 bfin_spi_dummy_read(drv_data);
511 write_CTRL(drv_data, cr & ~BIT_CTL_ENABLE); /* Disable SPI */
512 write_CTRL(drv_data, cr & ~BIT_CTL_TIMOD); /* Restore State */
513 write_STAT(drv_data, BIT_STAT_CLR); /* Clear Status */
514 }
515
507 clear_dma_irqstat(drv_data->dma_channel); 516 clear_dma_irqstat(drv_data->dma_channel);
508 517
509 /* 518 /*
@@ -1099,12 +1108,15 @@ static int bfin_spi_setup(struct spi_device *spi)
1099 } 1108 }
1100 1109
1101 if (chip->chip_select_num >= MAX_CTRL_CS) { 1110 if (chip->chip_select_num >= MAX_CTRL_CS) {
1102 ret = gpio_request(chip->cs_gpio, spi->modalias); 1111 /* Only request on first setup */
1103 if (ret) { 1112 if (spi_get_ctldata(spi) == NULL) {
1104 dev_err(&spi->dev, "gpio_request() error\n"); 1113 ret = gpio_request(chip->cs_gpio, spi->modalias);
1105 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);
1106 } 1119 }
1107 gpio_direction_output(chip->cs_gpio, 1);
1108 } 1120 }
1109 1121
1110 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",