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

Commit 6276c3f6 authored by Ashish Kori's avatar Ashish Kori
Browse files

spi: spi-geni-qcom : Don't configure SPI WORD LEN for SPI Slave



Don't configure SPI word length for SPI Slave as it's an optional
property. Hardware will take care of SPI word length field when the
QUPv3 Serial Engine is configured as SPI Slave(SPI_SLAVE_EN is set).

Change-Id: I714f455589be75d19d8f32e9f04e8cdc518a0430
Signed-off-by: default avatarAshish Kori <akori@codeaurora.org>
parent fcf83531
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -283,6 +283,7 @@ static int get_spi_clk_cfg(u32 speed_hz, struct spi_geni_master *mas,
static void spi_setup_word_len(struct spi_geni_master *mas, u32 mode,
						int bits_per_word)
{
	struct spi_master *spi = get_spi_master(mas->dev);
	int pack_words = 1;
	bool msb_first = (mode & SPI_LSB_FIRST) ? false : true;
	u32 word_len = geni_read_reg(mas->base, SE_SPI_WORD_LEN);
@@ -294,10 +295,18 @@ static void spi_setup_word_len(struct spi_geni_master *mas, u32 mode,
	 */
	if (!(mas->tx_fifo_width % bits_per_word))
		pack_words = mas->tx_fifo_width / bits_per_word;
	se_config_packing(mas->base, bits_per_word, pack_words, msb_first);

	/*
	 * Don't configure SPI word length for SPI Slave it is an optional
	 * property for SPI Slave. H/W will take care of SPI slave word
	 * if SPI_SLAVE_EN bit is set.
	 */
	if (!spi->slave) {
		word_len &= ~WORD_LEN_MSK;
		word_len |= ((bits_per_word - MIN_WORD_LEN) & WORD_LEN_MSK);
	se_config_packing(mas->base, bits_per_word, pack_words, msb_first);
		geni_write_reg(word_len, mas->base, SE_SPI_WORD_LEN);
	}
	se_get_packing_config(bits_per_word, pack_words, msb_first,
							&cfg0, &cfg1);
	GENI_SE_DBG(mas->ipc, false, mas->dev,