Unverified Commit 60086e23 authored by Gregory CLEMENT's avatar Gregory CLEMENT Committed by Mark Brown
Browse files

spi: atmel: Remove useless private field



Since the conversion to GPIO descriptor, the GPIO used as chip select,
can be directly access from the spi_device struct. So there is no need
to keep the field npcs_pin.

Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20191017141846.7523-5-gregory.clement@bootlin.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 585d18f7
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -284,7 +284,6 @@ struct atmel_spi {

/* Controller-specific per-slave state */
struct atmel_spi_device {
	struct gpio_desc	*npcs_pin;
	u32			csr;
};

@@ -347,8 +346,8 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)
		}

		mr = spi_readl(as, MR);
		if (asd->npcs_pin)
			gpiod_set_value(asd->npcs_pin, 1);
		if (spi->cs_gpiod)
			gpiod_set_value(spi->cs_gpiod, 1);
	} else {
		u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0;
		int i;
@@ -364,8 +363,8 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)

		mr = spi_readl(as, MR);
		mr = SPI_BFINS(PCS, ~(1 << spi->chip_select), mr);
		if (asd->npcs_pin && spi->chip_select != 0)
			gpiod_set_value(asd->npcs_pin, 1);
		if (spi->cs_gpiod && spi->chip_select != 0)
			gpiod_set_value(spi->cs_gpiod, 1);
		spi_writel(as, MR, mr);
	}

@@ -374,7 +373,6 @@ static void cs_activate(struct atmel_spi *as, struct spi_device *spi)

static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi)
{
	struct atmel_spi_device *asd = spi->controller_state;
	u32 mr;

	/* only deactivate *this* device; sometimes transfers to
@@ -388,10 +386,10 @@ static void cs_deactivate(struct atmel_spi *as, struct spi_device *spi)

	dev_dbg(&spi->dev, "DEactivate NPCS, mr %08x\n", mr);

	if (!asd->npcs_pin)
	if (!spi->cs_gpiod)
		spi_writel(as, CR, SPI_BIT(LASTXFER));
	else if (atmel_spi_is_v2(as) || spi->chip_select != 0)
		gpiod_set_value(asd->npcs_pin, 0);
		gpiod_set_value(spi->cs_gpiod, 0);
}

static void atmel_spi_lock(struct atmel_spi *as) __acquires(&as->lock)
@@ -1205,9 +1203,6 @@ static int atmel_spi_setup(struct spi_device *spi)
		if (!asd)
			return -ENOMEM;

		if (spi->cs_gpiod)
			asd->npcs_pin = spi->cs_gpiod;

		spi->controller_state = asd;
	}