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

Commit 7fd303f5 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: Disable dma mode for SSC QUPV3 for SM8150"

parents 5c051187 85a04924
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -47,6 +47,10 @@ Optional properties:

- qcom,slv-ctrl : Set this flag to configure QUPV3 as SPI slave controller.

- qcom,disable-dma : Set this flag to ensure only fifo mode is used for
			transfers. FIFO mode does not work when FW of SE
			is configured in GSI mode.

Other optional properties described in
Documentation/devicetree/bindings/spi/spi-bus.txt

+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1073,6 +1073,7 @@
		pinctrl-1 = <&qupv3_se22_spi_sleep>;
		spi-max-frequency = <50000000>;
		qcom,wrapper-core = <&qupv3_3>;
		qcom,disable-dma;
		status = "disabled";
	};
};
+28 −11
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -152,6 +152,7 @@ struct spi_geni_master {
	struct completion tx_cb;
	struct completion rx_cb;
	bool qn_err;
	bool disable_dma_mode;
	int cur_xfer_mode;
	int num_tx_eot;
	int num_rx_eot;
@@ -1063,17 +1064,30 @@ static void setup_fifo_xfer(struct spi_transfer *xfer,
		mas->rx_rem_bytes = xfer->len;
	}

	fifo_size =
		(mas->tx_fifo_depth * mas->tx_fifo_width / mas->cur_word_len);
	/*
	 * Controller has support to transfer data either in FIFO mode
	 * or in SE_DMA mode. Either force the controller to choose FIFO
	 * mode for transfers or select the mode dynamically based on
	 * size of data.
	 */
	if (mas->disable_dma_mode) {
		mas->cur_xfer_mode = FIFO_MODE;
		geni_se_select_mode(mas->base, mas->cur_xfer_mode);
	} else {
		fifo_size = (mas->tx_fifo_depth *
				mas->tx_fifo_width / mas->cur_word_len);
		if (trans_len > fifo_size) {
			if (mas->cur_xfer_mode != SE_DMA) {
				mas->cur_xfer_mode = SE_DMA;
			geni_se_select_mode(mas->base, mas->cur_xfer_mode);
				geni_se_select_mode(mas->base,
						mas->cur_xfer_mode);
			}
		} else {
			if (mas->cur_xfer_mode != FIFO_MODE) {
				mas->cur_xfer_mode = FIFO_MODE;
			geni_se_select_mode(mas->base, mas->cur_xfer_mode);
				geni_se_select_mode(mas->base,
						mas->cur_xfer_mode);
			}
		}
	}

@@ -1580,6 +1594,9 @@ static int spi_geni_probe(struct platform_device *pdev)
		spi->slave_abort = spi_slv_abort;
	}

	geni_mas->disable_dma_mode = of_property_read_bool(pdev->dev.of_node,
			"qcom,disable-dma");

	spi->mode_bits = (SPI_CPOL | SPI_CPHA | SPI_LOOP | SPI_CS_HIGH);
	spi->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
	spi->num_chipselect = SPI_NUM_CHIPSELECT;