From: Vinod Koul <vkoul@kernel.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
Mark Brown <broonie@kernel.org>, Wolfram Sang <wsa@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, Vinod Koul <vkoul@kernel.org>,
Andy Gross <agross@kernel.org>,
Matthias Kaehlcke <mka@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
Sumit Semwal <sumit.semwal@linaro.org>,
Amit Pundir <amit.pundir@linaro.org>,
linux-spi@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/7] soc: qcom: geni: Add support for gpi dma
Date: Mon, 11 Jan 2021 20:46:47 +0530 [thread overview]
Message-ID: <20210111151651.1616813-4-vkoul@kernel.org> (raw)
In-Reply-To: <20210111151651.1616813-1-vkoul@kernel.org>
GPI DMA is one of the DMA modes supported on geni, this adds support to
enable that mode
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/soc/qcom/qcom-geni-se.c | 39 ++++++++++++++++++++++++++++++++-
include/linux/qcom-geni-se.h | 4 ++++
2 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index a3868228ea05..db44dc32e049 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -310,6 +310,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.
@@ -317,7 +350,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:
@@ -326,6 +360,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 cb4e40908f9f..12003a6cb133 100644
--- a/include/linux/qcom-geni-se.h
+++ b/include/linux/qcom-geni-se.h
@@ -12,6 +12,7 @@
enum geni_se_xfer_mode {
GENI_SE_INVALID,
GENI_SE_FIFO,
+ GENI_GPI_DMA,
GENI_SE_DMA,
};
@@ -123,6 +124,9 @@ struct geni_se {
#define CLK_DIV_MSK GENMASK(15, 4)
#define CLK_DIV_SHFT 4
+/* GENI_IF_DISABLE_RO fields */
+#define FIFO_IF_DISABLE (BIT(0))
+
/* GENI_FW_REVISION_RO fields */
#define FW_REV_PROTOCOL_MSK GENMASK(15, 8)
#define FW_REV_PROTOCOL_SHFT 8
--
2.26.2
next prev parent reply other threads:[~2021-01-11 15:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 15:16 [PATCH 0/7] Add and enable GPI DMA users Vinod Koul
2021-01-11 15:16 ` [PATCH 1/7] soc: qcom: geni: move GENI_IF_DISABLE_RO to common header Vinod Koul
2021-01-11 15:31 ` Bjorn Andersson
2021-01-11 15:16 ` [PATCH 2/7] soc: qcom: geni: move struct geni_wrapper to header Vinod Koul
2021-01-11 15:34 ` Bjorn Andersson
2021-01-11 17:43 ` Vinod Koul
2021-01-11 18:51 ` Bjorn Andersson
2021-01-11 15:16 ` Vinod Koul [this message]
2021-01-11 15:40 ` [PATCH 3/7] soc: qcom: geni: Add support for gpi dma Bjorn Andersson
2021-01-11 17:22 ` Vinod Koul
2021-01-13 0:01 ` Doug Anderson
2021-01-13 3:22 ` Vinod Koul
2021-01-11 15:16 ` [PATCH 4/7] spi: spi-geni-qcom: Add support for GPI dma Vinod Koul
2021-01-11 16:35 ` Mark Brown
2021-06-16 8:50 ` Vinod Koul
2021-06-16 11:35 ` Mark Brown
2021-06-16 12:02 ` Vinod Koul
2021-06-17 6:20 ` Vinod Koul
2021-01-11 17:19 ` Bjorn Andersson
2021-01-12 7:31 ` Lukas Wunner
2021-01-13 0:01 ` Doug Anderson
2021-01-13 3:24 ` Vinod Koul
2021-02-04 21:34 ` Dmitry Baryshkov
2021-01-11 15:16 ` [PATCH 5/7] i2c: qcom-geni: Add support for GPI DMA Vinod Koul
2021-01-11 18:14 ` Bjorn Andersson
2021-01-12 5:50 ` Vinod Koul
2021-01-11 15:16 ` [PATCH 6/7] arm64: dts: qcom: sdm845: Add gpi dma node Vinod Koul
2021-01-11 18:23 ` Bjorn Andersson
2021-01-12 4:21 ` Vinod Koul
2021-01-11 15:16 ` [PATCH 7/7] arm64: dts: qcom: sdm845: enable dma for spi Vinod Koul
2021-01-11 16:04 ` Konrad Dybcio
2021-01-11 17:46 ` Vinod Koul
2021-01-11 20:45 ` Konrad Dybcio
2021-01-12 4:19 ` Vinod Koul
2021-01-11 16:47 ` Doug Anderson
2021-01-11 17:56 ` Vinod Koul
2021-01-13 0:01 ` [PATCH 0/7] Add and enable GPI DMA users Doug Anderson
2021-01-13 3:03 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210111151651.1616813-4-vkoul@kernel.org \
--to=vkoul@kernel.org \
--cc=agross@kernel.org \
--cc=amit.pundir@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mka@chromium.org \
--cc=sumit.semwal@linaro.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).