Skip to content

Commit

Permalink
Merge remote-tracking branches 'spi/topic/pxa', 'spi/topic/pxa2xx', '…
Browse files Browse the repository at this point in the history
…spi/topic/qup', 'spi/topic/rockchip' and 'spi/topic/sh' into spi-next
  • Loading branch information
Mark Brown committed Sep 4, 2017
6 parents 817ef6e + 128345b + c18d925 + 88a1981 + 04b37d2 + 345fef7 commit 17c49e5
Show file tree
Hide file tree
Showing 7 changed files with 444 additions and 226 deletions.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/spi/spi-rockchip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and display controllers using the SPI communication interface.
Required Properties:

- compatible: should be one of the following.
"rockchip,rv1108-spi" for rv1108 SoCs.
"rockchip,rk3036-spi" for rk3036 SoCS.
"rockchip,rk3066-spi" for rk3066 SoCs.
"rockchip,rk3188-spi" for rk3188 SoCs.
Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ config SPI_PPC4xx

config SPI_PXA2XX
tristate "PXA2xx SSP SPI master"
depends on (ARCH_PXA || PCI || ACPI)
select PXA_SSP if ARCH_PXA
depends on (ARCH_PXA || ARCH_MMP || PCI || ACPI)
select PXA_SSP if ARCH_PXA || ARCH_MMP
help
This enables using a PXA2xx or Sodaville SSP port as a SPI master
controller. The driver can be configured to use any SSP port and
Expand Down
35 changes: 17 additions & 18 deletions drivers/spi/spi-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ static void cs_assert(struct driver_data *drv_data)
return;
}

if (gpio_is_valid(chip->gpio_cs)) {
gpio_set_value(chip->gpio_cs, chip->gpio_cs_inverted);
if (chip->gpiod_cs) {
gpiod_set_value(chip->gpiod_cs, chip->gpio_cs_inverted);
return;
}

Expand All @@ -424,8 +424,8 @@ static void cs_deassert(struct driver_data *drv_data)
return;
}

if (gpio_is_valid(chip->gpio_cs)) {
gpio_set_value(chip->gpio_cs, !chip->gpio_cs_inverted);
if (chip->gpiod_cs) {
gpiod_set_value(chip->gpiod_cs, !chip->gpio_cs_inverted);
return;
}

Expand Down Expand Up @@ -1213,17 +1213,16 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
struct pxa2xx_spi_chip *chip_info)
{
struct driver_data *drv_data = spi_master_get_devdata(spi->master);
struct gpio_desc *gpiod;
int err = 0;

if (chip == NULL)
return 0;

if (drv_data->cs_gpiods) {
struct gpio_desc *gpiod;

gpiod = drv_data->cs_gpiods[spi->chip_select];
if (gpiod) {
chip->gpio_cs = desc_to_gpio(gpiod);
chip->gpiod_cs = gpiod;
chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH;
gpiod_set_value(gpiod, chip->gpio_cs_inverted);
}
Expand All @@ -1237,8 +1236,10 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
/* NOTE: setup() can be called multiple times, possibly with
* different chip_info, release previously requested GPIO
*/
if (gpio_is_valid(chip->gpio_cs))
gpio_free(chip->gpio_cs);
if (chip->gpiod_cs) {
gpio_free(desc_to_gpio(chip->gpiod_cs));
chip->gpiod_cs = NULL;
}

/* If (*cs_control) is provided, ignore GPIO chip select */
if (chip_info->cs_control) {
Expand All @@ -1254,11 +1255,11 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
return err;
}

chip->gpio_cs = chip_info->gpio_cs;
gpiod = gpio_to_desc(chip_info->gpio_cs);
chip->gpiod_cs = gpiod;
chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH;

err = gpio_direction_output(chip->gpio_cs,
!chip->gpio_cs_inverted);
err = gpiod_direction_output(gpiod, !chip->gpio_cs_inverted);
}

return err;
Expand Down Expand Up @@ -1317,8 +1318,7 @@ static int setup(struct spi_device *spi)
}

chip->frm = spi->chip_select;
} else
chip->gpio_cs = -1;
}
chip->enable_dma = drv_data->master_info->enable_dma;
chip->timeout = TIMOUT_DFLT;
}
Expand Down Expand Up @@ -1416,8 +1416,8 @@ static void cleanup(struct spi_device *spi)
return;

if (drv_data->ssp_type != CE4100_SSP && !drv_data->cs_gpiods &&
gpio_is_valid(chip->gpio_cs))
gpio_free(chip->gpio_cs);
chip->gpiod_cs)
gpio_free(desc_to_gpio(chip->gpiod_cs));

kfree(chip);
}
Expand Down Expand Up @@ -1769,8 +1769,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
for (i = 0; i < master->num_chipselect; i++) {
struct gpio_desc *gpiod;

gpiod = devm_gpiod_get_index(dev, "cs", i,
GPIOD_OUT_HIGH);
gpiod = devm_gpiod_get_index(dev, "cs", i, GPIOD_ASIS);
if (IS_ERR(gpiod)) {
/* Means use native chip select */
if (PTR_ERR(gpiod) == -ENOENT)
Expand Down
2 changes: 1 addition & 1 deletion drivers/spi/spi-pxa2xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct chip_data {
u16 lpss_tx_threshold;
u8 enable_dma;
union {
int gpio_cs;
struct gpio_desc *gpiod_cs;
unsigned int frm;
};
int gpio_cs_inverted;
Expand Down
Loading

0 comments on commit 17c49e5

Please sign in to comment.