aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-05-12 17:10:46 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-05-12 17:10:46 +0530
commit660d749fa635fc621bee5813a8dfc4c93ba44918 (patch)
tree0bae2b30d09fe61ced0c80c76d6b5dcc448df401
parent8c0bd94c14260b1e599ccc51dd0e530985a7ffd9 (diff)
download96b-common-sdm845-spi-dma.tar.gz
[TEMP]: Add GPI DMA support to GENI Serial Enginesdm845-spi-dma
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-rw-r--r--drivers/soc/qcom/qcom-geni-se.c39
-rw-r--r--include/linux/qcom-geni-se.h1
2 files changed, 39 insertions, 1 deletions
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index 38aa9219b669..79bcca1a5d1a 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -290,6 +290,39 @@ static void geni_se_select_dma_mode(struct geni_se *se)
writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN);
}
+static int geni_se_select_gpi_mode(struct geni_se *se)
+{
+ unsigned int geni_dma_mode = 0;
+ unsigned int gpi_event_en = 0;
+ unsigned int common_geni_m_irq_en = 0;
+ unsigned int common_geni_s_irq_en = 0;
+
+ common_geni_m_irq_en = readl_relaxed(se->base + SE_GENI_M_IRQ_EN);
+ common_geni_s_irq_en = readl_relaxed(se->base + SE_GENI_S_IRQ_EN);
+ common_geni_m_irq_en &=
+ ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN |
+ M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN);
+ common_geni_s_irq_en &= ~S_CMD_DONE_EN;
+ geni_dma_mode = readl_relaxed(se->base + SE_GENI_DMA_MODE_EN);
+ gpi_event_en = readl_relaxed(se->base + SE_GSI_EVENT_EN);
+
+ geni_dma_mode |= GENI_DMA_MODE_EN;
+ gpi_event_en |= (DMA_RX_EVENT_EN | DMA_TX_EVENT_EN |
+ GENI_M_EVENT_EN | GENI_S_EVENT_EN);
+
+ writel_relaxed(0, se->base + SE_IRQ_EN);
+ writel_relaxed(common_geni_s_irq_en, se->base + SE_GENI_S_IRQ_EN);
+ writel_relaxed(common_geni_m_irq_en, se->base + SE_GENI_M_IRQ_EN);
+ writel_relaxed(0xFFFFFFFF, se->base + SE_GENI_M_IRQ_CLEAR);
+ writel_relaxed(0xFFFFFFFF, se->base + SE_GENI_S_IRQ_CLEAR);
+ writel_relaxed(0xFFFFFFFF, se->base + SE_DMA_TX_IRQ_CLR);
+ writel_relaxed(0xFFFFFFFF, se->base + SE_DMA_RX_IRQ_CLR);
+ writel_relaxed(geni_dma_mode, se->base + SE_GENI_DMA_MODE_EN);
+ writel_relaxed(gpi_event_en, se->base + SE_GSI_EVENT_EN);
+
+ return 0;
+}
+
/**
* geni_se_select_mode() - Select the serial engine transfer mode
* @se: Pointer to the concerned serial engine.
@@ -297,7 +330,8 @@ static void geni_se_select_dma_mode(struct geni_se *se)
*/
void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
{
- WARN_ON(mode != GENI_SE_FIFO && mode != GENI_SE_DMA);
+ WARN_ON(mode != GENI_SE_FIFO && mode != GENI_SE_DMA &&
+ mode != GENI_GPI_DMA);
switch (mode) {
case GENI_SE_FIFO:
@@ -306,6 +340,9 @@ void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
case GENI_SE_DMA:
geni_se_select_dma_mode(se);
break;
+ case GENI_GPI_DMA:
+ geni_se_select_gpi_mode(se);
+ break;
case GENI_SE_INVALID:
default:
break;
diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
index 698b11caba92..7ee8ac2a1f0c 100644
--- a/include/linux/qcom-geni-se.h
+++ b/include/linux/qcom-geni-se.h
@@ -10,6 +10,7 @@
enum geni_se_xfer_mode {
GENI_SE_INVALID,
GENI_SE_FIFO,
+ GENI_GPI_DMA,
GENI_SE_DMA,
};