Title: [7883] trunk/drivers/spi/bfin_sport_spi.c: bug[#5722]use the new gpio cs scheme
Revision
7883
Author
cliff
Date
2009-11-25 22:06:52 -0500 (Wed, 25 Nov 2009)

Log Message

bug[#5722]use the new gpio cs scheme

Modified Paths

Diff

Modified: trunk/drivers/spi/bfin_sport_spi.c (7882 => 7883)


--- trunk/drivers/spi/bfin_sport_spi.c	2009-11-25 20:25:50 UTC (rev 7882)
+++ trunk/drivers/spi/bfin_sport_spi.c	2009-11-26 03:06:52 UTC (rev 7883)
@@ -149,15 +149,18 @@
 /* Chip select operation functions for cs_change flag */
 static void bfin_sport_spi_cs_active(struct master_data *drv_data, struct slave_data *chip)
 {
-	gpio_direction_output(chip->cs_gpio, 0);
+	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)
 {
-	gpio_direction_output(chip->cs_gpio, 1);
-	/* Move delay here for consistency */
-	if (chip->cs_chg_udelay)
-		udelay(chip->cs_chg_udelay);
+	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*/
@@ -673,7 +676,6 @@
 		chip->enable_dma = chip_info->enable_dma;
 		chip->bits_per_word = chip_info->bits_per_word;
 		chip->cs_chg_udelay = chip_info->cs_chg_udelay;
-		chip->cs_gpio = chip_info->cs_gpio;
 		chip->idle_tx_val = chip_info->idle_tx_val;
 	}
 
@@ -728,7 +730,11 @@
 
 	spi_set_ctldata(spi, chip);
 
-	if (chip->chip_select_num == 0) {
+	/* Use GPIO as CS, otherwise, we can do nothing to control the CS,
+	 * SPORT is in charge of controlling it.
+	 */
+	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");
@@ -752,7 +758,7 @@
 	if (!chip)
 		return;
 
-	if (chip->chip_select_num == 0)
+	if (chip->chip_select_num > MAX_CTRL_CS)
 		gpio_free(chip->cs_gpio);
 
 	kfree(chip);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to