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

Commit 0f38af45 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'spi/topic/altera', 'spi/topic/atmel',...

Merge remote-tracking branches 'spi/topic/altera', 'spi/topic/atmel', 'spi/topic/au1550', 'spi/topic/bcm63xx', 'spi/topic/bcm63xx-hsspi', 'spi/topic/bfin5xx', 'spi/topic/bitbang' and 'spi/topic/bpw' into spi-next
Loading
+2 −4
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)

static int altera_spi_probe(struct platform_device *pdev)
{
	struct altera_spi_platform_data *platp = dev_get_platdata(&pdev->dev);
	struct altera_spi *hw;
	struct spi_master *master;
	struct resource *res;
@@ -214,6 +213,8 @@ static int altera_spi_probe(struct platform_device *pdev)
	master->bus_num = pdev->id;
	master->num_chipselect = 16;
	master->mode_bits = SPI_CS_HIGH;
	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16);
	master->dev.of_node = pdev->dev.of_node;

	hw = spi_master_get_devdata(master);
	platform_set_drvdata(pdev, hw);
@@ -245,9 +246,6 @@ static int altera_spi_probe(struct platform_device *pdev)
		if (err)
			goto exit;
	}
	/* find platform data */
	if (!platp)
		hw->bitbang.master->dev.of_node = pdev->dev.of_node;

	/* register our spi controller */
	err = spi_bitbang_start(&hw->bitbang);
+12 −14
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/pinctrl/consumer.h>

/* SPI register offsets */
#define SPI_CR					0x0000
@@ -1087,14 +1088,6 @@ static int atmel_spi_one_transfer(struct spi_master *master,
		}
	}

	if (xfer->bits_per_word > 8) {
		if (xfer->len % 2) {
			dev_dbg(&spi->dev,
			"buffer len should be 16 bits aligned\n");
			return -EINVAL;
		}
	}

	/*
	 * DMA map early, for performance (empties dcache ASAP) and
	 * better fault reporting.
@@ -1221,9 +1214,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,
	dev_dbg(&spi->dev, "new message %p submitted for %s\n",
					msg, dev_name(&spi->dev));

	if (unlikely(list_empty(&msg->transfers)))
		return -EINVAL;

	atmel_spi_lock(as);
	cs_activate(as, spi);

@@ -1244,10 +1234,10 @@ static int atmel_spi_transfer_one_message(struct spi_master *master,

	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
		dev_dbg(&spi->dev,
			"  xfer %p: len %u tx %p/%08x rx %p/%08x\n",
			"  xfer %p: len %u tx %p/%pad rx %p/%pad\n",
			xfer, xfer->len,
			xfer->tx_buf, xfer->tx_dma,
			xfer->rx_buf, xfer->rx_dma);
			xfer->tx_buf, &xfer->tx_dma,
			xfer->rx_buf, &xfer->rx_dma);
	}

msg_done:
@@ -1303,6 +1293,9 @@ static int atmel_spi_probe(struct platform_device *pdev)
	struct spi_master	*master;
	struct atmel_spi	*as;

	/* Select default pin state */
	pinctrl_pm_select_default_state(&pdev->dev);

	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!regs)
		return -ENXIO;
@@ -1465,6 +1458,9 @@ static int atmel_spi_suspend(struct device *dev)
	}

	clk_disable_unprepare(as->clk);

	pinctrl_pm_select_sleep_state(dev);

	return 0;
}

@@ -1474,6 +1470,8 @@ static int atmel_spi_resume(struct device *dev)
	struct atmel_spi	*as = spi_master_get_devdata(master);
	int ret;

	pinctrl_pm_select_default_state(dev);

	clk_prepare_enable(as->clk);

	/* Start the queue running */
+4 −26
Original line number Diff line number Diff line
@@ -55,8 +55,6 @@ struct au1550_spi {

	volatile psc_spi_t __iomem *regs;
	int irq;
	unsigned freq_max;
	unsigned freq_min;

	unsigned len;
	unsigned tx_count;
@@ -248,11 +246,8 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
			hz = t->speed_hz;
	}

	if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) {
		dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n",
			hz);
	if (!hz)
		return -EINVAL;
	}

	au1550_spi_bits_handlers_set(hw, spi->bits_per_word);

@@ -287,23 +282,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
	return 0;
}

static int au1550_spi_setup(struct spi_device *spi)
{
	struct au1550_spi *hw = spi_master_get_devdata(spi->master);

	if (spi->max_speed_hz == 0)
		spi->max_speed_hz = hw->freq_max;
	if (spi->max_speed_hz > hw->freq_max
			|| spi->max_speed_hz < hw->freq_min)
		return -EINVAL;
	/*
	 * NOTE: cannot change speed and other hw settings immediately,
	 *       otherwise sharing of spi bus is not possible,
	 *       so do not call setupxfer(spi, NULL) here
	 */
	return 0;
}

/*
 * for dma spi transfers, we have to setup rx channel, otherwise there is
 * no reliable way how to recognize that spi transfer is done
@@ -838,7 +816,6 @@ static int au1550_spi_probe(struct platform_device *pdev)
	hw->bitbang.master = hw->master;
	hw->bitbang.setup_transfer = au1550_spi_setupxfer;
	hw->bitbang.chipselect = au1550_spi_chipsel;
	hw->bitbang.master->setup = au1550_spi_setup;
	hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs;

	if (hw->usedma) {
@@ -909,8 +886,9 @@ static int au1550_spi_probe(struct platform_device *pdev)
	{
		int min_div = (2 << 0) * (2 * (4 + 1));
		int max_div = (2 << 3) * (2 * (63 + 1));
		hw->freq_max = hw->pdata->mainclk_hz / min_div;
		hw->freq_min = hw->pdata->mainclk_hz / (max_div + 1) + 1;
		master->max_speed_hz = hw->pdata->mainclk_hz / min_div;
		master->min_speed_hz =
				hw->pdata->mainclk_hz / (max_div + 1) + 1;
	}

	au1550_spi_setup_psc_as_spi(hw);
+2 −3
Original line number Diff line number Diff line
@@ -453,9 +453,8 @@ static int bcm63xx_hsspi_resume(struct device *dev)
}
#endif

static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume)
};
static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend,
			 bcm63xx_hsspi_resume);

static struct platform_driver bcm63xx_hsspi_driver = {
	.driver = {
+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@

#include <bcm63xx_dev_spi.h>

#define PFX		KBUILD_MODNAME

#define BCM63XX_SPI_MAX_PREPEND		15

struct bcm63xx_spi {
Loading