aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-tegra20-slink.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 17224f0f4d56..d35315408f64 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -189,7 +189,6 @@ struct tegra_slink_data {
189 unsigned dma_buf_size; 189 unsigned dma_buf_size;
190 unsigned max_buf_size; 190 unsigned max_buf_size;
191 bool is_curr_dma_xfer; 191 bool is_curr_dma_xfer;
192 bool is_hw_based_cs;
193 192
194 struct completion rx_dma_complete; 193 struct completion rx_dma_complete;
195 struct completion tx_dma_complete; 194 struct completion tx_dma_complete;
@@ -717,7 +716,6 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
717 u8 bits_per_word; 716 u8 bits_per_word;
718 unsigned total_fifo_words; 717 unsigned total_fifo_words;
719 int ret; 718 int ret;
720 struct tegra_spi_device_controller_data *cdata = spi->controller_data;
721 unsigned long command; 719 unsigned long command;
722 unsigned long command2; 720 unsigned long command2;
723 721
@@ -740,39 +738,11 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
740 738
741 command = tspi->def_command_reg; 739 command = tspi->def_command_reg;
742 command |= SLINK_BIT_LENGTH(bits_per_word - 1); 740 command |= SLINK_BIT_LENGTH(bits_per_word - 1);
741 command |= SLINK_CS_SW | SLINK_CS_VALUE;
743 742
744 command2 = tspi->def_command2_reg; 743 command2 = tspi->def_command2_reg;
745 command2 |= SLINK_SS_EN_CS(spi->chip_select); 744 command2 |= SLINK_SS_EN_CS(spi->chip_select);
746 745
747 /* possibly use the hw based chip select */
748 tspi->is_hw_based_cs = false;
749 if (cdata && cdata->is_hw_based_cs && is_single_xfer &&
750 ((tspi->curr_dma_words * tspi->bytes_per_word) ==
751 (t->len - tspi->cur_pos))) {
752 int setup_count;
753 int sts2;
754
755 setup_count = cdata->cs_setup_clk_count >> 1;
756 setup_count = max(setup_count, 3);
757 command2 |= SLINK_SS_SETUP(setup_count);
758 if (tspi->chip_data->cs_hold_time) {
759 int hold_count;
760
761 hold_count = cdata->cs_hold_clk_count;
762 hold_count = max(hold_count, 0xF);
763 sts2 = tegra_slink_readl(tspi, SLINK_STATUS2);
764 sts2 &= ~SLINK_SS_HOLD_TIME(0xF);
765 sts2 |= SLINK_SS_HOLD_TIME(hold_count);
766 tegra_slink_writel(tspi, sts2, SLINK_STATUS2);
767 }
768 tspi->is_hw_based_cs = true;
769 }
770
771 if (tspi->is_hw_based_cs)
772 command &= ~SLINK_CS_SW;
773 else
774 command |= SLINK_CS_SW | SLINK_CS_VALUE;
775
776 command &= ~SLINK_MODES; 746 command &= ~SLINK_MODES;
777 if (spi->mode & SPI_CPHA) 747 if (spi->mode & SPI_CPHA)
778 command |= SLINK_CK_SDA; 748 command |= SLINK_CK_SDA;