* [PATCH] dma: tegra: add support for Tegra114 SoC
@ 2013-01-05 12:06 ` Laxman Dewangan
0 siblings, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2013-01-05 12:06 UTC (permalink / raw)
To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w, djbw-b10kYP2dOMg
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan
NVIDIA's Tegra114 has APB DMA controller which supports channel wise
pause control. The global pause is used for clock gating and hence
DMA registers are not accessible if DMAs are globally disabled.
Add support for use of channel wise pause feature for Tegra114 SOCs.
Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
drivers/dma/tegra20-apb-dma.c | 54 +++++++++++++++++++++++++++++++++++++----
1 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index c39e61b..d33c1ae 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -62,6 +62,9 @@
#define TEGRA_APBDMA_STATUS_COUNT_SHIFT 2
#define TEGRA_APBDMA_STATUS_COUNT_MASK 0xFFFC
+#define TEGRA_APBDMA_CHAN_CSRE 0x00C
+#define TEGRA_APBDMA_CHAN_CSRE_PAUSE (1 << 31)
+
/* AHB memory address */
#define TEGRA_APBDMA_CHAN_AHBPTR 0x010
@@ -112,10 +115,12 @@ struct tegra_dma;
* tegra_dma_chip_data Tegra chip specific DMA data
* @nr_channels: Number of channels available in the controller.
* @max_dma_count: Maximum DMA transfer count supported by DMA controller.
+ * @support_channel_pause: Support channel wise pause of dma.
*/
struct tegra_dma_chip_data {
int nr_channels;
int max_dma_count;
+ bool support_channel_pause;
};
/* DMA channel registers */
@@ -353,6 +358,32 @@ static void tegra_dma_global_resume(struct tegra_dma_channel *tdc)
spin_unlock(&tdma->global_lock);
}
+static void tegra_dma_pause(struct tegra_dma_channel *tdc,
+ bool wait_for_burst_complete)
+{
+ struct tegra_dma *tdma = tdc->tdma;
+
+ if (tdma->chip_data->support_channel_pause) {
+ tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE,
+ TEGRA_APBDMA_CHAN_CSRE_PAUSE);
+ if (wait_for_burst_complete)
+ udelay(TEGRA_APBDMA_BURST_COMPLETE_TIME);
+ } else {
+ tegra_dma_global_pause(tdc, wait_for_burst_complete);
+ }
+}
+
+static void tegra_dma_resume(struct tegra_dma_channel *tdc)
+{
+ struct tegra_dma *tdma = tdc->tdma;
+
+ if (tdma->chip_data->support_channel_pause) {
+ tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE, 0);
+ } else {
+ tegra_dma_global_resume(tdc);
+ }
+}
+
static void tegra_dma_stop(struct tegra_dma_channel *tdc)
{
u32 csr;
@@ -408,7 +439,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
* If there is already IEC status then interrupt handler need to
* load new configuration.
*/
- tegra_dma_global_pause(tdc, false);
+ tegra_dma_pause(tdc, false);
status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
/*
@@ -418,7 +449,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
dev_err(tdc2dev(tdc),
"Skipping new configuration as interrupt is pending\n");
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
return;
}
@@ -429,7 +460,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
nsg_req->ch_regs.csr | TEGRA_APBDMA_CSR_ENB);
nsg_req->configured = true;
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
}
static void tdc_start_head_req(struct tegra_dma_channel *tdc)
@@ -690,7 +721,7 @@ static void tegra_dma_terminate_all(struct dma_chan *dc)
goto skip_dma_stop;
/* Pause DMA before checking the queue status */
- tegra_dma_global_pause(tdc, true);
+ tegra_dma_pause(tdc, true);
status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
@@ -708,7 +739,7 @@ static void tegra_dma_terminate_all(struct dma_chan *dc)
sgreq->dma_desc->bytes_transferred +=
get_current_xferred_count(tdc, sgreq, status);
}
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
skip_dma_stop:
tegra_dma_abort_all(tdc);
@@ -1175,6 +1206,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
.nr_channels = 16,
.max_dma_count = 1024UL * 64,
+ .support_channel_pause = false,
};
#if defined(CONFIG_OF)
@@ -1182,10 +1214,22 @@ static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
static const struct tegra_dma_chip_data tegra30_dma_chip_data = {
.nr_channels = 32,
.max_dma_count = 1024UL * 64,
+ .support_channel_pause = false,
};
+/* Tegra114 specific DMA controller information */
+static const struct tegra_dma_chip_data tegra114_dma_chip_data = {
+ .nr_channels = 32,
+ .max_dma_count = 1024UL * 64,
+ .support_channel_pause = true,
+};
+
+
static const struct of_device_id tegra_dma_of_match[] = {
{
+ .compatible = "nvidia,tegra114-apbdma",
+ .data = &tegra114_dma_chip_data,
+ }, {
.compatible = "nvidia,tegra30-apbdma",
.data = &tegra30_dma_chip_data,
}, {
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] dma: tegra: add support for Tegra114 SoC
@ 2013-01-05 12:06 ` Laxman Dewangan
0 siblings, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2013-01-05 12:06 UTC (permalink / raw)
To: vinod.koul, djbw; +Cc: linux-kernel, linux-tegra, Laxman Dewangan
NVIDIA's Tegra114 has APB DMA controller which supports channel wise
pause control. The global pause is used for clock gating and hence
DMA registers are not accessible if DMAs are globally disabled.
Add support for use of channel wise pause feature for Tegra114 SOCs.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/dma/tegra20-apb-dma.c | 54 +++++++++++++++++++++++++++++++++++++----
1 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index c39e61b..d33c1ae 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -62,6 +62,9 @@
#define TEGRA_APBDMA_STATUS_COUNT_SHIFT 2
#define TEGRA_APBDMA_STATUS_COUNT_MASK 0xFFFC
+#define TEGRA_APBDMA_CHAN_CSRE 0x00C
+#define TEGRA_APBDMA_CHAN_CSRE_PAUSE (1 << 31)
+
/* AHB memory address */
#define TEGRA_APBDMA_CHAN_AHBPTR 0x010
@@ -112,10 +115,12 @@ struct tegra_dma;
* tegra_dma_chip_data Tegra chip specific DMA data
* @nr_channels: Number of channels available in the controller.
* @max_dma_count: Maximum DMA transfer count supported by DMA controller.
+ * @support_channel_pause: Support channel wise pause of dma.
*/
struct tegra_dma_chip_data {
int nr_channels;
int max_dma_count;
+ bool support_channel_pause;
};
/* DMA channel registers */
@@ -353,6 +358,32 @@ static void tegra_dma_global_resume(struct tegra_dma_channel *tdc)
spin_unlock(&tdma->global_lock);
}
+static void tegra_dma_pause(struct tegra_dma_channel *tdc,
+ bool wait_for_burst_complete)
+{
+ struct tegra_dma *tdma = tdc->tdma;
+
+ if (tdma->chip_data->support_channel_pause) {
+ tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE,
+ TEGRA_APBDMA_CHAN_CSRE_PAUSE);
+ if (wait_for_burst_complete)
+ udelay(TEGRA_APBDMA_BURST_COMPLETE_TIME);
+ } else {
+ tegra_dma_global_pause(tdc, wait_for_burst_complete);
+ }
+}
+
+static void tegra_dma_resume(struct tegra_dma_channel *tdc)
+{
+ struct tegra_dma *tdma = tdc->tdma;
+
+ if (tdma->chip_data->support_channel_pause) {
+ tdc_write(tdc, TEGRA_APBDMA_CHAN_CSRE, 0);
+ } else {
+ tegra_dma_global_resume(tdc);
+ }
+}
+
static void tegra_dma_stop(struct tegra_dma_channel *tdc)
{
u32 csr;
@@ -408,7 +439,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
* If there is already IEC status then interrupt handler need to
* load new configuration.
*/
- tegra_dma_global_pause(tdc, false);
+ tegra_dma_pause(tdc, false);
status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
/*
@@ -418,7 +449,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
dev_err(tdc2dev(tdc),
"Skipping new configuration as interrupt is pending\n");
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
return;
}
@@ -429,7 +460,7 @@ static void tegra_dma_configure_for_next(struct tegra_dma_channel *tdc,
nsg_req->ch_regs.csr | TEGRA_APBDMA_CSR_ENB);
nsg_req->configured = true;
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
}
static void tdc_start_head_req(struct tegra_dma_channel *tdc)
@@ -690,7 +721,7 @@ static void tegra_dma_terminate_all(struct dma_chan *dc)
goto skip_dma_stop;
/* Pause DMA before checking the queue status */
- tegra_dma_global_pause(tdc, true);
+ tegra_dma_pause(tdc, true);
status = tdc_read(tdc, TEGRA_APBDMA_CHAN_STATUS);
if (status & TEGRA_APBDMA_STATUS_ISE_EOC) {
@@ -708,7 +739,7 @@ static void tegra_dma_terminate_all(struct dma_chan *dc)
sgreq->dma_desc->bytes_transferred +=
get_current_xferred_count(tdc, sgreq, status);
}
- tegra_dma_global_resume(tdc);
+ tegra_dma_resume(tdc);
skip_dma_stop:
tegra_dma_abort_all(tdc);
@@ -1175,6 +1206,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
.nr_channels = 16,
.max_dma_count = 1024UL * 64,
+ .support_channel_pause = false,
};
#if defined(CONFIG_OF)
@@ -1182,10 +1214,22 @@ static const struct tegra_dma_chip_data tegra20_dma_chip_data = {
static const struct tegra_dma_chip_data tegra30_dma_chip_data = {
.nr_channels = 32,
.max_dma_count = 1024UL * 64,
+ .support_channel_pause = false,
};
+/* Tegra114 specific DMA controller information */
+static const struct tegra_dma_chip_data tegra114_dma_chip_data = {
+ .nr_channels = 32,
+ .max_dma_count = 1024UL * 64,
+ .support_channel_pause = true,
+};
+
+
static const struct of_device_id tegra_dma_of_match[] = {
{
+ .compatible = "nvidia,tegra114-apbdma",
+ .data = &tegra114_dma_chip_data,
+ }, {
.compatible = "nvidia,tegra30-apbdma",
.data = &tegra30_dma_chip_data,
}, {
--
1.7.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
2013-01-05 12:06 ` Laxman Dewangan
@ 2013-01-06 14:37 ` Vinod Koul
-1 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2013-01-06 14:37 UTC (permalink / raw)
To: Laxman Dewangan
Cc: djbw-b10kYP2dOMg, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Sat, Jan 05, 2013 at 05:36:08PM +0530, Laxman Dewangan wrote:
> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
> pause control. The global pause is used for clock gating and hence
> DMA registers are not accessible if DMAs are globally disabled.
>
> Add support for use of channel wise pause feature for Tegra114 SOCs.
Looks fine to me. Only issue being that changelog tells me you are adding
support for 114, but patch seems more of adding pause support and while at it
also add entries for 114.
Care to update changelog & title...
--
~Vinod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
@ 2013-01-06 14:37 ` Vinod Koul
0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2013-01-06 14:37 UTC (permalink / raw)
To: Laxman Dewangan; +Cc: djbw, linux-kernel, linux-tegra
On Sat, Jan 05, 2013 at 05:36:08PM +0530, Laxman Dewangan wrote:
> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
> pause control. The global pause is used for clock gating and hence
> DMA registers are not accessible if DMAs are globally disabled.
>
> Add support for use of channel wise pause feature for Tegra114 SOCs.
Looks fine to me. Only issue being that changelog tells me you are adding
support for 114, but patch seems more of adding pause support and while at it
also add entries for 114.
Care to update changelog & title...
--
~Vinod
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
2013-01-06 14:37 ` Vinod Koul
@ 2013-01-06 15:57 ` Laxman Dewangan
-1 siblings, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2013-01-06 15:57 UTC (permalink / raw)
To: Vinod Koul
Cc: djbw-b10kYP2dOMg, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On Sunday 06 January 2013 08:07 PM, Vinod Koul wrote:
> On Sat, Jan 05, 2013 at 05:36:08PM +0530, Laxman Dewangan wrote:
>> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
>> pause control. The global pause is used for clock gating and hence
>> DMA registers are not accessible if DMAs are globally disabled.
>>
>> Add support for use of channel wise pause feature for Tegra114 SOCs.
> Looks fine to me. Only issue being that changelog tells me you are adding
> support for 114, but patch seems more of adding pause support and while at it
> also add entries for 114.
> Care to update changelog & title...
The channel wise pause come along with T114 and that's why it is
together in this change.
Probably I need to split the change into two patches: One for adding
feature of channel wise pause and other for adding support of T114.
This way it will not mixup the stuff and will much clear about change.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
@ 2013-01-06 15:57 ` Laxman Dewangan
0 siblings, 0 replies; 8+ messages in thread
From: Laxman Dewangan @ 2013-01-06 15:57 UTC (permalink / raw)
To: Vinod Koul; +Cc: djbw, linux-kernel, linux-tegra
On Sunday 06 January 2013 08:07 PM, Vinod Koul wrote:
> On Sat, Jan 05, 2013 at 05:36:08PM +0530, Laxman Dewangan wrote:
>> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
>> pause control. The global pause is used for clock gating and hence
>> DMA registers are not accessible if DMAs are globally disabled.
>>
>> Add support for use of channel wise pause feature for Tegra114 SOCs.
> Looks fine to me. Only issue being that changelog tells me you are adding
> support for 114, but patch seems more of adding pause support and while at it
> also add entries for 114.
> Care to update changelog & title...
The channel wise pause come along with T114 and that's why it is
together in this change.
Probably I need to split the change into two patches: One for adding
feature of channel wise pause and other for adding support of T114.
This way it will not mixup the stuff and will much clear about change.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
2013-01-05 12:06 ` Laxman Dewangan
@ 2013-01-07 17:03 ` Stephen Warren
-1 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2013-01-07 17:03 UTC (permalink / raw)
To: Laxman Dewangan
Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w, djbw-b10kYP2dOMg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
On 01/05/2013 05:06 AM, Laxman Dewangan wrote:
> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
> pause control. The global pause is used for clock gating and hence
> DMA registers are not accessible if DMAs are globally disabled.
>
> Add support for use of channel wise pause feature for Tegra114 SOCs.
Aside from the comments already made by Vinod,
Reviewed-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] dma: tegra: add support for Tegra114 SoC
@ 2013-01-07 17:03 ` Stephen Warren
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2013-01-07 17:03 UTC (permalink / raw)
To: Laxman Dewangan; +Cc: vinod.koul, djbw, linux-kernel, linux-tegra
On 01/05/2013 05:06 AM, Laxman Dewangan wrote:
> NVIDIA's Tegra114 has APB DMA controller which supports channel wise
> pause control. The global pause is used for clock gating and hence
> DMA registers are not accessible if DMAs are globally disabled.
>
> Add support for use of channel wise pause feature for Tegra114 SOCs.
Aside from the comments already made by Vinod,
Reviewed-by: Stephen Warren <swarren@nvidia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-07 17:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-05 12:06 [PATCH] dma: tegra: add support for Tegra114 SoC Laxman Dewangan
2013-01-05 12:06 ` Laxman Dewangan
[not found] ` <1357387568-26010-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-06 14:37 ` Vinod Koul
2013-01-06 14:37 ` Vinod Koul
[not found] ` <20130106143738.GC29209-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-06 15:57 ` Laxman Dewangan
2013-01-06 15:57 ` Laxman Dewangan
2013-01-07 17:03 ` Stephen Warren
2013-01-07 17:03 ` Stephen Warren
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.