From: Amelie Delaunay <amelie.delaunay@foss.st.com>
To: Marek Vasut <marex@denx.de>, Jonathan Corbet <corbet@lwn.net>,
Vinod Koul <vkoul@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: <linux-doc@vger.kernel.org>, <dmaengine@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/4] dmaengine: stm32-dma: add support to trigger STM32 MDMA
Date: Tue, 19 Jul 2022 17:30:49 +0200 [thread overview]
Message-ID: <d46e5eee-c8ae-545f-e69e-1dd2f2e71323@foss.st.com> (raw)
In-Reply-To: <e1fbf7cf-1bb7-6583-3713-7dbd58a4898e@denx.de>
Hi Marek,
Thanks for reviewing.
On 7/14/22 21:02, Marek Vasut wrote:
> On 7/13/22 16:21, Amelie Delaunay wrote:
>
> [...]
>
>> diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
>> index adb25a11c70f..3916295fe154 100644
>> --- a/drivers/dma/stm32-dma.c
>> +++ b/drivers/dma/stm32-dma.c
>> @@ -142,6 +142,8 @@
>> #define STM32_DMA_DIRECT_MODE_GET(n) (((n) &
>> STM32_DMA_DIRECT_MODE_MASK) >> 2)
>> #define STM32_DMA_ALT_ACK_MODE_MASK BIT(4)
>> #define STM32_DMA_ALT_ACK_MODE_GET(n) (((n) &
>> STM32_DMA_ALT_ACK_MODE_MASK) >> 4)
>> +#define STM32_DMA_MDMA_STREAM_ID_MASK GENMASK(19, 16)
>> +#define STM32_DMA_MDMA_STREAM_ID_GET(n) (((n) &
>> STM32_DMA_MDMA_STREAM_ID_MASK) >> 16)
>
> Try FIELD_GET() from include/linux/bitfield.h
>
> [...]
>
Yes, but not only on this new line. I'll add a prior patch to the
patchset to use FIELD_{GET,PREP}() helpers every where custom macros are
used.
>> @@ -1630,6 +1670,20 @@ static int stm32_dma_probe(struct
>> platform_device *pdev)
>> chan->id = i;
>> chan->vchan.desc_free = stm32_dma_desc_free;
>> vchan_init(&chan->vchan, dd);
>> +
>> + chan->mdma_config.ifcr = res->start;
>> + chan->mdma_config.ifcr += (chan->id & 4) ? STM32_DMA_HIFCR :
>> STM32_DMA_LIFCR;
>> +
>> + chan->mdma_config.tcf = STM32_DMA_TCI;
>> + /*
>> + * bit0 of chan->id represents the need to left shift by 6
>> + * bit1 of chan->id represents the need to extra left shift
>> by 16
>> + * TCIF0, chan->id = b0000; TCIF4, chan->id = b0100: left
>> shift by 0*6 + 0*16
>> + * TCIF1, chan->id = b0001; TCIF5, chan->id = b0101: left
>> shift by 1*6 + 0*16
>> + * TCIF2, chan->id = b0010; TCIF6, chan->id = b0110: left
>> shift by 0*6 + 1*16
>> + * TCIF3, chan->id = b0011; TCIF7, chan->id = b0111: left
>> shift by 1*6 + 1*16
>> + */
>> + chan->mdma_config.tcf <<= (6 * (chan->id & 0x1) + 16 *
>> ((chan->id & 0x2) >> 1));
>
> Some sort of symbolic macros instead of open-coded constants could help
> readability here.
>
I agree. As the same kind of computation is done in
stm32_dma_irq_status() and stm32_dma_irq_clear(), I'll add another prior
patch to the patchset to introduce new macro helpers to get ISR/IFCR
offset depending on channel id, and to get channel flags mask depending
on channel id.
> [...]
Regards,
Amelie
WARNING: multiple messages have this Message-ID (diff)
From: Amelie Delaunay <amelie.delaunay@foss.st.com>
To: Marek Vasut <marex@denx.de>, Jonathan Corbet <corbet@lwn.net>,
Vinod Koul <vkoul@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: <linux-doc@vger.kernel.org>, <dmaengine@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 3/4] dmaengine: stm32-dma: add support to trigger STM32 MDMA
Date: Tue, 19 Jul 2022 17:30:49 +0200 [thread overview]
Message-ID: <d46e5eee-c8ae-545f-e69e-1dd2f2e71323@foss.st.com> (raw)
In-Reply-To: <e1fbf7cf-1bb7-6583-3713-7dbd58a4898e@denx.de>
Hi Marek,
Thanks for reviewing.
On 7/14/22 21:02, Marek Vasut wrote:
> On 7/13/22 16:21, Amelie Delaunay wrote:
>
> [...]
>
>> diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
>> index adb25a11c70f..3916295fe154 100644
>> --- a/drivers/dma/stm32-dma.c
>> +++ b/drivers/dma/stm32-dma.c
>> @@ -142,6 +142,8 @@
>> #define STM32_DMA_DIRECT_MODE_GET(n) (((n) &
>> STM32_DMA_DIRECT_MODE_MASK) >> 2)
>> #define STM32_DMA_ALT_ACK_MODE_MASK BIT(4)
>> #define STM32_DMA_ALT_ACK_MODE_GET(n) (((n) &
>> STM32_DMA_ALT_ACK_MODE_MASK) >> 4)
>> +#define STM32_DMA_MDMA_STREAM_ID_MASK GENMASK(19, 16)
>> +#define STM32_DMA_MDMA_STREAM_ID_GET(n) (((n) &
>> STM32_DMA_MDMA_STREAM_ID_MASK) >> 16)
>
> Try FIELD_GET() from include/linux/bitfield.h
>
> [...]
>
Yes, but not only on this new line. I'll add a prior patch to the
patchset to use FIELD_{GET,PREP}() helpers every where custom macros are
used.
>> @@ -1630,6 +1670,20 @@ static int stm32_dma_probe(struct
>> platform_device *pdev)
>> chan->id = i;
>> chan->vchan.desc_free = stm32_dma_desc_free;
>> vchan_init(&chan->vchan, dd);
>> +
>> + chan->mdma_config.ifcr = res->start;
>> + chan->mdma_config.ifcr += (chan->id & 4) ? STM32_DMA_HIFCR :
>> STM32_DMA_LIFCR;
>> +
>> + chan->mdma_config.tcf = STM32_DMA_TCI;
>> + /*
>> + * bit0 of chan->id represents the need to left shift by 6
>> + * bit1 of chan->id represents the need to extra left shift
>> by 16
>> + * TCIF0, chan->id = b0000; TCIF4, chan->id = b0100: left
>> shift by 0*6 + 0*16
>> + * TCIF1, chan->id = b0001; TCIF5, chan->id = b0101: left
>> shift by 1*6 + 0*16
>> + * TCIF2, chan->id = b0010; TCIF6, chan->id = b0110: left
>> shift by 0*6 + 1*16
>> + * TCIF3, chan->id = b0011; TCIF7, chan->id = b0111: left
>> shift by 1*6 + 1*16
>> + */
>> + chan->mdma_config.tcf <<= (6 * (chan->id & 0x1) + 16 *
>> ((chan->id & 0x2) >> 1));
>
> Some sort of symbolic macros instead of open-coded constants could help
> readability here.
>
I agree. As the same kind of computation is done in
stm32_dma_irq_status() and stm32_dma_irq_clear(), I'll add another prior
patch to the patchset to introduce new macro helpers to get ISR/IFCR
offset depending on channel id, and to get channel flags mask depending
on channel id.
> [...]
Regards,
Amelie
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-07-19 15:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 14:21 [PATCH v2 0/4] STM32 DMA-MDMA chaining feature Amelie Delaunay
2022-07-13 14:21 ` Amelie Delaunay
2022-07-13 14:21 ` [PATCH v2 1/4] docs: arm: stm32: introduce " Amelie Delaunay
2022-07-13 14:21 ` Amelie Delaunay
2022-07-13 14:21 ` [PATCH v2 2/4] dmaengine: stm32-dmamux: set dmamux channel id in dma features bitfield Amelie Delaunay
2022-07-13 14:21 ` Amelie Delaunay
2022-07-13 14:21 ` [PATCH v2 3/4] dmaengine: stm32-dma: add support to trigger STM32 MDMA Amelie Delaunay
2022-07-13 14:21 ` Amelie Delaunay
2022-07-14 19:02 ` Marek Vasut
2022-07-14 19:02 ` Marek Vasut
2022-07-19 15:30 ` Amelie Delaunay [this message]
2022-07-19 15:30 ` Amelie Delaunay
2022-07-15 18:01 ` kernel test robot
2022-07-15 18:01 ` kernel test robot
2022-07-13 14:21 ` [PATCH v2 4/4] dmaengine: stm32-mdma: add support to be triggered by STM32 DMA Amelie Delaunay
2022-07-13 14:21 ` Amelie Delaunay
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=d46e5eee-c8ae-545f-e69e-1dd2f2e71323@foss.st.com \
--to=amelie.delaunay@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=corbet@lwn.net \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=marex@denx.de \
--cc=mcoquelin.stm32@gmail.com \
--cc=vkoul@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 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.