Title: [7894] trunk/drivers/spi/bfin_sport_spi.c: bug[#5722]force using GPIO to generate CS singal
- Revision
- 7894
- Author
- cliff
- Date
- 2009-11-30 01:33:29 -0500 (Mon, 30 Nov 2009)
Log Message
bug[#5722]force using GPIO to generate CS singal
Modified Paths
Diff
Modified: trunk/drivers/spi/bfin_sport_spi.c (7893 => 7894)
--- trunk/drivers/spi/bfin_sport_spi.c 2009-11-30 06:12:35 UTC (rev 7893)
+++ trunk/drivers/spi/bfin_sport_spi.c 2009-11-30 06:33:29 UTC (rev 7894)
@@ -149,18 +149,15 @@
/* Chip select operation functions for cs_change flag */
static void bfin_sport_spi_cs_active(struct master_data *drv_data, struct slave_data *chip)
{
- if (chip->chip_select_num > MAX_CTRL_CS)
gpio_direction_output(chip->cs_gpio, 0);
}
static void bfin_sport_spi_cs_deactive(struct master_data *drv_data, struct slave_data *chip)
{
- if (chip->chip_select_num > MAX_CTRL_CS) {
gpio_direction_output(chip->cs_gpio, 1);
/* Move delay here for consistency */
if (chip->cs_chg_udelay)
udelay(chip->cs_chg_udelay);
- }
}
/* stop controller and re-config current chip*/
@@ -730,18 +727,19 @@
spi_set_ctldata(spi, chip);
- /* Use GPIO as CS, otherwise, we can do nothing to control the CS,
- * SPORT is in charge of issuing cs-change-per-word kind of CS.
+ /* CS must be got by manipulating GPIO.
*/
- if (chip->chip_select_num > MAX_CTRL_CS) {
- chip->cs_gpio = chip->chip_select_num - MAX_CTRL_CS;;
- ret = gpio_request(chip->cs_gpio, spi->modalias);
- if (ret)
- dev_err(&spi->dev, "request GPIO CS failed\n");
- else
- gpio_direction_output(chip->cs_gpio, 1);
- }
+ if (chip->chip_select_num < MAX_CTRL_CS)
+ return -EINVAL;
+ chip->cs_gpio = chip->chip_select_num - MAX_CTRL_CS;;
+ ret = gpio_request(chip->cs_gpio, spi->modalias);
+ if (ret)
+ dev_err(&spi->dev, "request GPIO CS failed\n");
+ else
+ gpio_direction_output(chip->cs_gpio, 1);
+
+
bfin_sport_spi_cs_deactive(drv_data, chip);
return ret;
@@ -758,8 +756,7 @@
if (!chip)
return;
- if (chip->chip_select_num > MAX_CTRL_CS)
- gpio_free(chip->cs_gpio);
+ gpio_free(chip->cs_gpio);
kfree(chip);
}
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits