diff options
| -rw-r--r-- | drivers/spi/spi-pxa2xx.c | 32 | ||||
| -rw-r--r-- | drivers/spi/spi-pxa2xx.h | 2 |
2 files changed, 17 insertions, 17 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 6e5af88b7c6f..4cb515a3104c 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
| @@ -402,8 +402,8 @@ static void cs_assert(struct driver_data *drv_data) | |||
| 402 | return; | 402 | return; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | if (gpio_is_valid(chip->gpio_cs)) { | 405 | if (chip->gpiod_cs) { |
| 406 | gpio_set_value(chip->gpio_cs, chip->gpio_cs_inverted); | 406 | gpiod_set_value(chip->gpiod_cs, chip->gpio_cs_inverted); |
| 407 | return; | 407 | return; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| @@ -424,8 +424,8 @@ static void cs_deassert(struct driver_data *drv_data) | |||
| 424 | return; | 424 | return; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | if (gpio_is_valid(chip->gpio_cs)) { | 427 | if (chip->gpiod_cs) { |
| 428 | gpio_set_value(chip->gpio_cs, !chip->gpio_cs_inverted); | 428 | gpiod_set_value(chip->gpiod_cs, !chip->gpio_cs_inverted); |
| 429 | return; | 429 | return; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| @@ -1213,17 +1213,16 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, | |||
| 1213 | struct pxa2xx_spi_chip *chip_info) | 1213 | struct pxa2xx_spi_chip *chip_info) |
| 1214 | { | 1214 | { |
| 1215 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | 1215 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); |
| 1216 | struct gpio_desc *gpiod; | ||
| 1216 | int err = 0; | 1217 | int err = 0; |
| 1217 | 1218 | ||
| 1218 | if (chip == NULL) | 1219 | if (chip == NULL) |
| 1219 | return 0; | 1220 | return 0; |
| 1220 | 1221 | ||
| 1221 | if (drv_data->cs_gpiods) { | 1222 | if (drv_data->cs_gpiods) { |
| 1222 | struct gpio_desc *gpiod; | ||
| 1223 | |||
| 1224 | gpiod = drv_data->cs_gpiods[spi->chip_select]; | 1223 | gpiod = drv_data->cs_gpiods[spi->chip_select]; |
| 1225 | if (gpiod) { | 1224 | if (gpiod) { |
| 1226 | chip->gpio_cs = desc_to_gpio(gpiod); | 1225 | chip->gpiod_cs = gpiod; |
| 1227 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; | 1226 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; |
| 1228 | gpiod_set_value(gpiod, chip->gpio_cs_inverted); | 1227 | gpiod_set_value(gpiod, chip->gpio_cs_inverted); |
| 1229 | } | 1228 | } |
| @@ -1237,8 +1236,10 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, | |||
| 1237 | /* NOTE: setup() can be called multiple times, possibly with | 1236 | /* NOTE: setup() can be called multiple times, possibly with |
| 1238 | * different chip_info, release previously requested GPIO | 1237 | * different chip_info, release previously requested GPIO |
| 1239 | */ | 1238 | */ |
| 1240 | if (gpio_is_valid(chip->gpio_cs)) | 1239 | if (chip->gpiod_cs) { |
| 1241 | gpio_free(chip->gpio_cs); | 1240 | gpio_free(desc_to_gpio(chip->gpiod_cs)); |
| 1241 | chip->gpiod_cs = NULL; | ||
| 1242 | } | ||
| 1242 | 1243 | ||
| 1243 | /* If (*cs_control) is provided, ignore GPIO chip select */ | 1244 | /* If (*cs_control) is provided, ignore GPIO chip select */ |
| 1244 | if (chip_info->cs_control) { | 1245 | if (chip_info->cs_control) { |
| @@ -1254,11 +1255,11 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, | |||
| 1254 | return err; | 1255 | return err; |
| 1255 | } | 1256 | } |
| 1256 | 1257 | ||
| 1257 | chip->gpio_cs = chip_info->gpio_cs; | 1258 | gpiod = gpio_to_desc(chip_info->gpio_cs); |
| 1259 | chip->gpiod_cs = gpiod; | ||
| 1258 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; | 1260 | chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH; |
| 1259 | 1261 | ||
| 1260 | err = gpio_direction_output(chip->gpio_cs, | 1262 | err = gpiod_direction_output(gpiod, !chip->gpio_cs_inverted); |
| 1261 | !chip->gpio_cs_inverted); | ||
| 1262 | } | 1263 | } |
| 1263 | 1264 | ||
| 1264 | return err; | 1265 | return err; |
| @@ -1317,8 +1318,7 @@ static int setup(struct spi_device *spi) | |||
| 1317 | } | 1318 | } |
| 1318 | 1319 | ||
| 1319 | chip->frm = spi->chip_select; | 1320 | chip->frm = spi->chip_select; |
| 1320 | } else | 1321 | } |
| 1321 | chip->gpio_cs = -1; | ||
| 1322 | chip->enable_dma = drv_data->master_info->enable_dma; | 1322 | chip->enable_dma = drv_data->master_info->enable_dma; |
| 1323 | chip->timeout = TIMOUT_DFLT; | 1323 | chip->timeout = TIMOUT_DFLT; |
| 1324 | } | 1324 | } |
| @@ -1416,8 +1416,8 @@ static void cleanup(struct spi_device *spi) | |||
| 1416 | return; | 1416 | return; |
| 1417 | 1417 | ||
| 1418 | if (drv_data->ssp_type != CE4100_SSP && !drv_data->cs_gpiods && | 1418 | if (drv_data->ssp_type != CE4100_SSP && !drv_data->cs_gpiods && |
| 1419 | gpio_is_valid(chip->gpio_cs)) | 1419 | chip->gpiod_cs) |
| 1420 | gpio_free(chip->gpio_cs); | 1420 | gpio_free(desc_to_gpio(chip->gpiod_cs)); |
| 1421 | 1421 | ||
| 1422 | kfree(chip); | 1422 | kfree(chip); |
| 1423 | } | 1423 | } |
diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h index 2823a00a9405..94f7b0713281 100644 --- a/drivers/spi/spi-pxa2xx.h +++ b/drivers/spi/spi-pxa2xx.h | |||
| @@ -83,7 +83,7 @@ struct chip_data { | |||
| 83 | u16 lpss_tx_threshold; | 83 | u16 lpss_tx_threshold; |
| 84 | u8 enable_dma; | 84 | u8 enable_dma; |
| 85 | union { | 85 | union { |
| 86 | int gpio_cs; | 86 | struct gpio_desc *gpiod_cs; |
| 87 | unsigned int frm; | 87 | unsigned int frm; |
| 88 | }; | 88 | }; |
| 89 | int gpio_cs_inverted; | 89 | int gpio_cs_inverted; |
