Commit e1a7d167 authored by Mark Brown's avatar Mark Brown

Merge branch 'spi-5.1' into spi-5.2

parents 9fda6693 a026525d
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#define CFGR1_PCSPOL BIT(8) #define CFGR1_PCSPOL BIT(8)
#define CFGR1_NOSTALL BIT(3) #define CFGR1_NOSTALL BIT(3)
#define CFGR1_MASTER BIT(0) #define CFGR1_MASTER BIT(0)
#define FSR_RXCOUNT (BIT(16)|BIT(17)|BIT(18)) #define FSR_TXCOUNT (0xFF)
#define RSR_RXEMPTY BIT(1) #define RSR_RXEMPTY BIT(1)
#define TCR_CPOL BIT(31) #define TCR_CPOL BIT(31)
#define TCR_CPHA BIT(30) #define TCR_CPHA BIT(30)
...@@ -771,7 +771,7 @@ static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id) ...@@ -771,7 +771,7 @@ static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id)
} }
if (temp_SR & SR_MBF || if (temp_SR & SR_MBF ||
readl(fsl_lpspi->base + IMX7ULP_FSR) & FSR_RXCOUNT) { readl(fsl_lpspi->base + IMX7ULP_FSR) & FSR_TXCOUNT) {
writel(SR_FCF, fsl_lpspi->base + IMX7ULP_SR); writel(SR_FCF, fsl_lpspi->base + IMX7ULP_SR);
fsl_lpspi_intctrl(fsl_lpspi, IER_FCIE); fsl_lpspi_intctrl(fsl_lpspi, IER_FCIE);
return IRQ_HANDLED; return IRQ_HANDLED;
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
* platform_device->driver_data ... points to spi_gpio * platform_device->driver_data ... points to spi_gpio
* *
* spi->controller_state ... reserved for bitbang framework code * spi->controller_state ... reserved for bitbang framework code
* spi->controller_data ... holds chipselect GPIO
* *
* spi->master->dev.driver_data ... points to spi_gpio->bitbang * spi->master->dev.driver_data ... points to spi_gpio->bitbang
*/ */
......
...@@ -559,7 +559,7 @@ static int pic32_spi_one_transfer(struct spi_master *master, ...@@ -559,7 +559,7 @@ static int pic32_spi_one_transfer(struct spi_master *master,
dev_err(&spi->dev, "wait error/timedout\n"); dev_err(&spi->dev, "wait error/timedout\n");
if (dma_issued) { if (dma_issued) {
dmaengine_terminate_all(master->dma_rx); dmaengine_terminate_all(master->dma_rx);
dmaengine_terminate_all(master->dma_rx); dmaengine_terminate_all(master->dma_tx);
} }
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
} else { } else {
......
This diff is collapsed.
...@@ -717,9 +717,6 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi, ...@@ -717,9 +717,6 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
command2 = tspi->command2_reg; command2 = tspi->command2_reg;
command2 &= ~(SLINK_RXEN | SLINK_TXEN); command2 &= ~(SLINK_RXEN | SLINK_TXEN);
tegra_slink_writel(tspi, command, SLINK_COMMAND);
tspi->command_reg = command;
tspi->cur_direction = 0; tspi->cur_direction = 0;
if (t->rx_buf) { if (t->rx_buf) {
command2 |= SLINK_RXEN; command2 |= SLINK_RXEN;
...@@ -729,9 +726,18 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi, ...@@ -729,9 +726,18 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
command2 |= SLINK_TXEN; command2 |= SLINK_TXEN;
tspi->cur_direction |= DATA_DIR_TX; tspi->cur_direction |= DATA_DIR_TX;
} }
/*
* Writing to the command2 register bevore the command register prevents
* a spike in chip_select line 0. This selects the chip_select line
* before changing the chip_select value.
*/
tegra_slink_writel(tspi, command2, SLINK_COMMAND2); tegra_slink_writel(tspi, command2, SLINK_COMMAND2);
tspi->command2_reg = command2; tspi->command2_reg = command2;
tegra_slink_writel(tspi, command, SLINK_COMMAND);
tspi->command_reg = command;
if (total_fifo_words > SLINK_FIFO_DEPTH) if (total_fifo_words > SLINK_FIFO_DEPTH)
ret = tegra_slink_start_dma_based_transfer(tspi, t); ret = tegra_slink_start_dma_based_transfer(tspi, t);
else else
......
...@@ -1299,18 +1299,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, ...@@ -1299,18 +1299,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
dma->rx_buf_virt, dma->rx_buf_dma); dma->rx_buf_virt, dma->rx_buf_dma);
} }
static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, static int pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
struct pch_spi_data *data) struct pch_spi_data *data)
{ {
struct pch_spi_dma_ctrl *dma; struct pch_spi_dma_ctrl *dma;
int ret;
dma = &data->dma; dma = &data->dma;
ret = 0;
/* Get Consistent memory for Tx DMA */ /* Get Consistent memory for Tx DMA */
dma->tx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, dma->tx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev,
PCH_BUF_SIZE, &dma->tx_buf_dma, GFP_KERNEL); PCH_BUF_SIZE, &dma->tx_buf_dma, GFP_KERNEL);
if (!dma->tx_buf_virt)
ret = -ENOMEM;
/* Get Consistent memory for Rx DMA */ /* Get Consistent memory for Rx DMA */
dma->rx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, dma->rx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev,
PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL); PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL);
if (!dma->rx_buf_virt)
ret = -ENOMEM;
return ret;
} }
static int pch_spi_pd_probe(struct platform_device *plat_dev) static int pch_spi_pd_probe(struct platform_device *plat_dev)
...@@ -1387,7 +1396,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) ...@@ -1387,7 +1396,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
if (use_dma) { if (use_dma) {
dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); dev_info(&plat_dev->dev, "Use DMA for data transfers\n");
pch_alloc_dma_buf(board_dat, data); ret = pch_alloc_dma_buf(board_dat, data);
if (ret)
goto err_spi_register_master;
} }
ret = spi_register_master(master); ret = spi_register_master(master);
......
...@@ -2199,6 +2199,8 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr) ...@@ -2199,6 +2199,8 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr)
*/ */
cs[i] = devm_gpiod_get_index_optional(dev, "cs", i, cs[i] = devm_gpiod_get_index_optional(dev, "cs", i,
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(cs[i]))
return PTR_ERR(cs[i]);
if (cs[i]) { if (cs[i]) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment