aboutsummaryrefslogtreecommitdiff
path: root/drivers/soc/qcom/qcom-geni-se.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/soc/qcom/qcom-geni-se.c')
-rw-r--r--drivers/soc/qcom/qcom-geni-se.c39
1 files changed, 38 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;