Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 907e26b6 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/gpio',...

Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/gpio', 'spi/topic/hspi', 'spi/topic/mpc512x', 'spi/topic/msiof', 'spi/topic/nuc900', 'spi/topic/oc-tiny', 'spi/topic/omap', 'spi/topic/orion' and 'spi/topic/pci' into spi-linus
Loading
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ only 1(SINGLE), 2(DUAL) and 4(QUAD).
Dual/Quad mode is not allowed when 3-wire mode is used.

If a gpio chipselect is used for the SPI slave the gpio number will be passed
via the cs_gpio
via the SPI master node cs-gpios property.

SPI example for an MPC5200 SPI bus:
	spi@f00 {
+3 −1
Original line number Diff line number Diff line
@@ -307,6 +307,7 @@ config SPI_OMAP_UWIRE

config SPI_OMAP24XX
	tristate "McSPI driver for OMAP"
	depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SH
	depends on ARCH_OMAP2PLUS || COMPILE_TEST
	help
	  SPI master controller for OMAP24XX and later Multichannel SPI
@@ -413,7 +414,8 @@ config SPI_SC18IS602

config SPI_SH_MSIOF
	tristate "SuperH MSIOF SPI controller"
	depends on (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
	depends on HAVE_CLK
	depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
	select SPI_BITBANG
	help
	  SPI driver for SuperH and SH Mobile MSIOF blocks.
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ static int spi_resume(struct pci_dev *pdev)
#define spi_resume	NULL
#endif

static DEFINE_PCI_DEVICE_TABLE(pci_ids) = {
static const struct pci_device_id pci_ids[] = {
	/* Intel MID platform SPI controller 0 */
	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) },
	{},
+62 −1
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
		goto err;

	irq = irq_of_parse_and_map(np, 0);
	if (!ret) {
	if (!irq) {
		ret = -EINVAL;
		goto err;
	}
@@ -727,6 +727,66 @@ static int of_fsl_espi_remove(struct platform_device *dev)
	return mpc8xxx_spi_remove(&dev->dev);
}

#ifdef CONFIG_PM_SLEEP
static int of_fsl_espi_suspend(struct device *dev)
{
	struct spi_master *master = dev_get_drvdata(dev);
	struct mpc8xxx_spi *mpc8xxx_spi;
	struct fsl_espi_reg *reg_base;
	u32 regval;
	int ret;

	mpc8xxx_spi = spi_master_get_devdata(master);
	reg_base = mpc8xxx_spi->reg_base;

	ret = spi_master_suspend(master);
	if (ret) {
		dev_warn(dev, "cannot suspend master\n");
		return ret;
	}

	regval = mpc8xxx_spi_read_reg(&reg_base->mode);
	regval &= ~SPMODE_ENABLE;
	mpc8xxx_spi_write_reg(&reg_base->mode, regval);

	return 0;
}

static int of_fsl_espi_resume(struct device *dev)
{
	struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
	struct spi_master *master = dev_get_drvdata(dev);
	struct mpc8xxx_spi *mpc8xxx_spi;
	struct fsl_espi_reg *reg_base;
	u32 regval;
	int i;

	mpc8xxx_spi = spi_master_get_devdata(master);
	reg_base = mpc8xxx_spi->reg_base;

	/* SPI controller initializations */
	mpc8xxx_spi_write_reg(&reg_base->mode, 0);
	mpc8xxx_spi_write_reg(&reg_base->mask, 0);
	mpc8xxx_spi_write_reg(&reg_base->command, 0);
	mpc8xxx_spi_write_reg(&reg_base->event, 0xffffffff);

	/* Init eSPI CS mode register */
	for (i = 0; i < pdata->max_chipselect; i++)
		mpc8xxx_spi_write_reg(&reg_base->csmode[i], CSMODE_INIT_VAL);

	/* Enable SPI interface */
	regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;

	mpc8xxx_spi_write_reg(&reg_base->mode, regval);

	return spi_master_resume(master);
}
#endif /* CONFIG_PM_SLEEP */

static const struct dev_pm_ops espi_pm = {
	SET_SYSTEM_SLEEP_PM_OPS(of_fsl_espi_suspend, of_fsl_espi_resume)
};

static const struct of_device_id of_fsl_espi_match[] = {
	{ .compatible = "fsl,mpc8536-espi" },
	{}
@@ -738,6 +798,7 @@ static struct platform_driver fsl_espi_driver = {
		.name = "fsl_espi",
		.owner = THIS_MODULE,
		.of_match_table = of_fsl_espi_match,
		.pm = &espi_pm,
	},
	.probe		= of_fsl_espi_probe,
	.remove		= of_fsl_espi_remove,
+4 −4
Original line number Diff line number Diff line
@@ -115,17 +115,17 @@ spi_to_pdata(const struct spi_device *spi)

static inline void setsck(const struct spi_device *spi, int is_on)
{
	gpio_set_value(SPI_SCK_GPIO, is_on);
	gpio_set_value_cansleep(SPI_SCK_GPIO, is_on);
}

static inline void setmosi(const struct spi_device *spi, int is_on)
{
	gpio_set_value(SPI_MOSI_GPIO, is_on);
	gpio_set_value_cansleep(SPI_MOSI_GPIO, is_on);
}

static inline int getmiso(const struct spi_device *spi)
{
	return !!gpio_get_value(SPI_MISO_GPIO);
	return !!gpio_get_value_cansleep(SPI_MISO_GPIO);
}

#undef pdata
@@ -229,7 +229,7 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)

	if (cs != SPI_GPIO_NO_CHIPSELECT) {
		/* SPI is normally active-low */
		gpio_set_value(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
		gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
	}
}

Loading