Date   

Updated Event: Zephyr: Networking Forum #cal-invite

devel@lists.zephyrproject.org Calendar <noreply@...>
 

Zephyr: Networking Forum

When:
Tuesday, 6 April 2021
3:00pm to 4:00pm
(UTC+00:00) UTC
Repeats: Monthly on the first Tuesday

Where:
Microsoft Teams Meeting

Organizer: tsc@...

An RSVP is requested. Click here to RSVP

Description:


________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 458 216 365#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 
________________________________________________________________________________


Updated Event: Zephyr: Toolchain Working Group #cal-invite

devel@lists.zephyrproject.org Calendar <noreply@...>
 

Zephyr: Toolchain Working Group

When:
Monday, 22 March 2021
3:00pm to 4:00pm
(UTC+00:00) UTC
Repeats: Every 2 weeks on Monday

Where:
Microsoft Teams Meeting

Organizer: Torsten Rasmussen

An RSVP is requested. Click here to RSVP

Description:

________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 682 738 030#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 


Re: [EXT] about DMA API updates proposal

Kumar Gala
 

We didn’t get a chance to discuss in this week’s meeting. Will ask Carles to have it on the agenda for next week.

- k

On Mar 11, 2021, at 10:18 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala, Carles,

Is there any feedback on API meeting on this PR?

https://github.com/zephyrproject-rtos/zephyr/pull/33174

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月10日 12:05
To: 'Kumar Gala' <kumar.gala@linaro.org>; 'Carles Cufi' <Carles.Cufi@nordicsemi.no>
Cc: 'devel@lists.zephyrproject.org' <devel@lists.zephyrproject.org>; Maureen Helm <maureen.helm@nxp.com>; 'Erwan Gouriou' <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

This is a brief introductions for these changes. Hopefully it can help you to explain the context. Please note in Page 8, 9, there are some special data structure changes. Thanks again.

Regards,
Hake
-----Original Message-----
From: Hake Huang
Sent: 2021年3月10日 10:49
To: Kumar Gala <kumar.gala@linaro.org>; Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Thanks Gala. Really appreciated.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月9日 21:31
To: Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

I can present the two options that Hake and I have discussed in this thread to see if there’s any feedback on which direction to take for the new API that is being suggested.

(Happy to do this so Hake doesn’t have to be awake at a crazy hour for him).

- k

On Mar 9, 2021, at 6:17 AM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Hake,

Is this something you want to discuss at the API meeting today? It's at 18h CET.

Thanks,

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org>
On Behalf Of Hake Huang via lists.zephyrproject.org
Sent: 09 March 2021 12:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I create a new PR
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F33174&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620655760%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=xJlwTcev
57aEZ
bDlldIUODWfUpNLzH7SbIUnbTvqMNw%3D&amp;reserved=0 dedicated for the
two new APIS, please check. Thanks in advance.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月5日 11:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I try to find some reference from Linux code, and below is my finding.

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc
s.hui
hoo.com%2Fdoxygen%2Flinux%2Fkernel%2F3.7%2Fdmatest_8c_source.html&amp
;data
=04%7C01%7Ccarles.cufi%40nordicsemi.no%7C2f7fefddf3df4385a77008d8e2f2
6416%
7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637508879620665756%7CUnk
nown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6
Mn0%3D%7C3000&amp;sdata=Sq5QarVur4smW1zz1sWY6nRBMwca2lCnzmMVW9Z9kNI%3
D&amp
;reserved=0
614 static bool filter(struct dma_chan *chan, void *param)
615 {
616 if (!dmatest_match_channel(chan) || !dmatest_match_device(chan-
device))
617 return false;
618 else
619 return true;
620 }
621
622 static int __init dmatest_init(void)
623 {
624 dma_cap_mask_t mask;
625 struct dma_chan *chan;
626 int err = 0;
627
628 dma_cap_zero(mask);
629 dma_cap_set(DMA_MEMCPY, mask);
630 for (;;) {
631 chan = dma_request_channel(mask, filter, NULL);
632 if (chan) {
633 err = dmatest_add_channel(chan);
634 if (err) {
635 dma_release_channel(chan);
636 break; /* add_channel failed, punt */
637 }
638 } else
639 break; /* no more channels available */
640 if (max_channels && nr_channels >= max_channels)
641 break; /* we have all we need */
642 }
643
644 return err;
645 }

In Linux the dma api use a filter function point as its parameter, so
the zephyr request API can be

static int dma_edma_request_channel(const struct device *dev,
channel_filter_func filter, void
*
filter_param) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
if (fn && !fn(filter_param)) {
continue;
}
break;
}
}
k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

And each SOC vender response to provide the filter function, if no
filter then just give NULL.


How about this solution?

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月4日 23:00
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

1. I think we handle that on a case by case basis and wait and see
how it develops over time. If we keep these APIs vendor specific for
now we can refactor or introduce a general API for ‘filter’ when we see the pattern.

2. The ‘if’ has to exist somewhere. The ‘if’ is either in the API or
the caller.

The concern I have is we don’t know what kinda of ‘filters’ we need
today beyond the ‘periodic’ one which is specific to NXP hardware.

- k

On Mar 3, 2021, at 9:27 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

According to the usage of these two APIs, I have two concerns

1. What if there are other special DMA attribute than periodic? We
will
have to add more APIs?
2. in the peripheral driver, the DMA request can be periodic or not
periodic, then we have to use if else instead of a simple call with
filter.

Regards,
Hake
-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 22:49
To: Kumar Gala <kumar.gala@linaro.org>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org;
Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou
<erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

Hake,

So I was thinking about the following idea:

Having 2 general purpose APIs:

dma_request_channel(const struct device *dev)
dma_release_channel(const struct device *dev)

Than 2 eDMA specific APIs:

mcux_edma_request_periodic_channel(const struct device *dev)
mcux_edma_release_periodic_channel(const struct device *dev)

- k

On Mar 2, 2021, at 9:28 PM, Kumar Gala via lists.zephyrproject.org
<kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Hake,

The ‘filter’ feature I’m still trying to figure out how we handle.
I’m
curious if other vendors have channels that have specific features
like ‘periodic’ that only are supported on specific channels or not.

Hopefully, Erwan might be able to know for STM32.

- k

On Mar 2, 2021, at 9:06 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

I will create a separated PR for DMA new API only.

and one question for below:
"use some of the generic devicetree properties in
"dts/bindings/dma/dma-controller.yaml”. The number space allocation
code seems pretty generic"

Do you mean, instead of just add API call but move below implement
to
common code?

static int dma_mcux_edma_request_channel(const struct device *dev,
enum dma_channel_filter
filter) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
/* channel 0-3 is Period trigger enabled */
if (filter == DMA_CHANNEL_PERIODIC && i > 3) {
break;
}
if
(!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
break;
}
}

k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

If so the filter is hard to aligned, as different SOC has
different
filter setting.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 1:43
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>
Subject: [EXT] Re: about DMA API updates proposal

Caution: EXT Email

On Feb 26, 2021, at 5:46 AM, Hake Huang <hake.huang@nxp.com> wrote:

Hi All,

I am working on enable NXP EDMA drivers to Zephyr DMA framework,
and
I have two DMA API changes need to discussion.
1.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F28895&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620665756%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HpXjVqCH
dnoRg
IbGlttgT2pLgUWUr%2Fx3oaLgsR479F4%3D&amp;reserved=0
in this PR, I add chain_link by using the dest_chaining_en(Major)
and
source_chaining_en(minor).
2.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737&amp;data=04%7
C0
1
%7
Chake.huang%40nxp.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1
d3
b
c2
b4c6fa92cd99c5c301635%7C0%7C0%7C637503037637038943%7CUnknown%7CTW
Fp
b
GZ
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
Mn
0
%3
D%7C1000&amp;sdata=3QEP18IvoC9MS3C9o274Z0eMIdbIWTzaoZp18la0OzQ%3D
&a
m
p;
reserved=0 in this PR,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737%2Fcommits%2F2
5e
1
9f
5b4e4ef07b1598104a02c4722386f2f17b&amp;data=04%7C01%7Chake.huang%
40
n
xp
.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3bc2b4c6fa92cd99c5c3
01635
%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
wMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wp3iD
OFIDk
csLjHRqk9OMWe3yiDfBXko6SHkIDrjQeA%3D&amp;reserved=0 two helper APIs
is added dma_api_request_channel request_channel;
dma_api_release_channel release_channel; the two APIs are for DMA
engine which is capable to dynamically allocate its channels to
different DMA requests. and a filter is also added in case of special DMA channel features.

Slack topic discussion is here

Can this topic be scheduled in next API meeting? Thanks.


Regards,
Hake
I wonder if we should pull this into a separate PR. I think a
fair
amount of the code for these APIs could be generic.

For example I think we can use some of the generic devicetree
properties in "dts/bindings/dma/dma-controller.yaml”. The number
space allocation code seems pretty generic, even if it just library
code used by all the drivers.

- k








Re: [EXT] about DMA API updates proposal

Hake Huang
 

Hi Gala, Carles,

Is there any feedback on API meeting on this PR?

https://github.com/zephyrproject-rtos/zephyr/pull/33174

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月10日 12:05
To: 'Kumar Gala' <kumar.gala@linaro.org>; 'Carles Cufi' <Carles.Cufi@nordicsemi.no>
Cc: 'devel@lists.zephyrproject.org' <devel@lists.zephyrproject.org>; Maureen Helm <maureen.helm@nxp.com>; 'Erwan Gouriou' <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

This is a brief introductions for these changes. Hopefully it can help you to explain the context. Please note in Page 8, 9, there are some special data structure changes. Thanks again.

Regards,
Hake
-----Original Message-----
From: Hake Huang
Sent: 2021年3月10日 10:49
To: Kumar Gala <kumar.gala@linaro.org>; Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Thanks Gala. Really appreciated.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月9日 21:31
To: Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

I can present the two options that Hake and I have discussed in this thread to see if there’s any feedback on which direction to take for the new API that is being suggested.

(Happy to do this so Hake doesn’t have to be awake at a crazy hour for him).

- k

On Mar 9, 2021, at 6:17 AM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Hake,

Is this something you want to discuss at the API meeting today? It's at 18h CET.

Thanks,

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org>
On Behalf Of Hake Huang via lists.zephyrproject.org
Sent: 09 March 2021 12:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I create a new PR
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F33174&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620655760%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=xJlwTcev
57aEZ
bDlldIUODWfUpNLzH7SbIUnbTvqMNw%3D&amp;reserved=0 dedicated for the
two new APIS, please check. Thanks in advance.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月5日 11:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I try to find some reference from Linux code, and below is my finding.

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc
s.hui
hoo.com%2Fdoxygen%2Flinux%2Fkernel%2F3.7%2Fdmatest_8c_source.html&amp
;data
=04%7C01%7Ccarles.cufi%40nordicsemi.no%7C2f7fefddf3df4385a77008d8e2f2
6416%
7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637508879620665756%7CUnk
nown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6
Mn0%3D%7C3000&amp;sdata=Sq5QarVur4smW1zz1sWY6nRBMwca2lCnzmMVW9Z9kNI%3
D&amp
;reserved=0
614 static bool filter(struct dma_chan *chan, void *param)
615 {
616 if (!dmatest_match_channel(chan) || !dmatest_match_device(chan-
device))
617 return false;
618 else
619 return true;
620 }
621
622 static int __init dmatest_init(void)
623 {
624 dma_cap_mask_t mask;
625 struct dma_chan *chan;
626 int err = 0;
627
628 dma_cap_zero(mask);
629 dma_cap_set(DMA_MEMCPY, mask);
630 for (;;) {
631 chan = dma_request_channel(mask, filter, NULL);
632 if (chan) {
633 err = dmatest_add_channel(chan);
634 if (err) {
635 dma_release_channel(chan);
636 break; /* add_channel failed, punt */
637 }
638 } else
639 break; /* no more channels available */
640 if (max_channels && nr_channels >= max_channels)
641 break; /* we have all we need */
642 }
643
644 return err;
645 }

In Linux the dma api use a filter function point as its parameter, so
the zephyr request API can be

static int dma_edma_request_channel(const struct device *dev,
channel_filter_func filter, void
*
filter_param) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
if (fn && !fn(filter_param)) {
continue;
}
break;
}
}
k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

And each SOC vender response to provide the filter function, if no
filter then just give NULL.


How about this solution?

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月4日 23:00
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

1. I think we handle that on a case by case basis and wait and see
how it develops over time. If we keep these APIs vendor specific for
now we can refactor or introduce a general API for ‘filter’ when we see the pattern.

2. The ‘if’ has to exist somewhere. The ‘if’ is either in the API or
the caller.

The concern I have is we don’t know what kinda of ‘filters’ we need
today beyond the ‘periodic’ one which is specific to NXP hardware.

- k

On Mar 3, 2021, at 9:27 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

According to the usage of these two APIs, I have two concerns

1. What if there are other special DMA attribute than periodic? We
will
have to add more APIs?
2. in the peripheral driver, the DMA request can be periodic or not
periodic, then we have to use if else instead of a simple call with
filter.

Regards,
Hake
-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 22:49
To: Kumar Gala <kumar.gala@linaro.org>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org;
Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou
<erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

Hake,

So I was thinking about the following idea:

Having 2 general purpose APIs:

dma_request_channel(const struct device *dev)
dma_release_channel(const struct device *dev)

Than 2 eDMA specific APIs:

mcux_edma_request_periodic_channel(const struct device *dev)
mcux_edma_release_periodic_channel(const struct device *dev)

- k

On Mar 2, 2021, at 9:28 PM, Kumar Gala via lists.zephyrproject.org
<kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Hake,

The ‘filter’ feature I’m still trying to figure out how we handle.
I’m
curious if other vendors have channels that have specific features
like ‘periodic’ that only are supported on specific channels or not.

Hopefully, Erwan might be able to know for STM32.

- k

On Mar 2, 2021, at 9:06 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

I will create a separated PR for DMA new API only.

and one question for below:
"use some of the generic devicetree properties in
"dts/bindings/dma/dma-controller.yaml”. The number space allocation
code seems pretty generic"

Do you mean, instead of just add API call but move below implement
to
common code?

static int dma_mcux_edma_request_channel(const struct device *dev,
enum dma_channel_filter
filter) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
/* channel 0-3 is Period trigger enabled */
if (filter == DMA_CHANNEL_PERIODIC && i > 3) {
break;
}
if
(!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
break;
}
}

k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

If so the filter is hard to aligned, as different SOC has
different
filter setting.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 1:43
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>
Subject: [EXT] Re: about DMA API updates proposal

Caution: EXT Email

On Feb 26, 2021, at 5:46 AM, Hake Huang <hake.huang@nxp.com> wrote:

Hi All,

I am working on enable NXP EDMA drivers to Zephyr DMA framework,
and
I have two DMA API changes need to discussion.
1.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F28895&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620665756%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HpXjVqCH
dnoRg
IbGlttgT2pLgUWUr%2Fx3oaLgsR479F4%3D&amp;reserved=0
in this PR, I add chain_link by using the dest_chaining_en(Major)
and
source_chaining_en(minor).
2.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737&amp;data=04%7
C0
1
%7
Chake.huang%40nxp.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1
d3
b
c2
b4c6fa92cd99c5c301635%7C0%7C0%7C637503037637038943%7CUnknown%7CTW
Fp
b
GZ
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
Mn
0
%3
D%7C1000&amp;sdata=3QEP18IvoC9MS3C9o274Z0eMIdbIWTzaoZp18la0OzQ%3D
&a
m
p;
reserved=0 in this PR,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737%2Fcommits%2F2
5e
1
9f
5b4e4ef07b1598104a02c4722386f2f17b&amp;data=04%7C01%7Chake.huang%
40
n
xp
.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3bc2b4c6fa92cd99c5c3
01635
%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
wMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wp3iD
OFIDk
csLjHRqk9OMWe3yiDfBXko6SHkIDrjQeA%3D&amp;reserved=0 two helper APIs
is added dma_api_request_channel request_channel;
dma_api_release_channel release_channel; the two APIs are for DMA
engine which is capable to dynamically allocate its channels to
different DMA requests. and a filter is also added in case of special DMA channel features.

Slack topic discussion is here

Can this topic be scheduled in next API meeting? Thanks.


Regards,
Hake
I wonder if we should pull this into a separate PR. I think a
fair
amount of the code for these APIs could be generic.

For example I think we can use some of the generic devicetree
properties in "dts/bindings/dma/dma-controller.yaml”. The number
space allocation code seems pretty generic, even if it just library
code used by all the drivers.

- k








Updated Event: Zephyr Project: Dev Meeting #cal-invite

devel@lists.zephyrproject.org Calendar <noreply@...>
 

Zephyr Project: Dev Meeting

When:
Thursday, 18 March 2021
3:00pm to 4:00pm
(UTC+00:00) UTC
Repeats: Weekly on Thursday

Where:
Microsoft Teams Meeting

Organizer: devel@...

An RSVP is requested. Click here to RSVP

Description:

________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 483 314 739#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 
________________________________________________________________________________


Re: Changing default branch name on GitHub - possible action required

Kumar Gala
 

Will see if other downstream users request such support.

How long would want for the various phases?

- k

On Mar 11, 2021, at 11:45 AM, Jack Rosenthal <jrosenth@chromium.org> wrote:

The typical way I've seen this done is:

Phase 1: Create the main branch at the same commit hash as master. Repo maintainers make sure that the main branch is synced to master.
Phase 2: Set the default branch to "main". Continue syncing "main" and "master".
Phase 3: Stop syncing "main" and "master". Master goes stale.
Phase 4: Delete the (now stale) master branch.

I'm not sure if GitHub has tools for branch syncing, but it can be done easy enough from the command line by someone with push access.

On Thu, Mar 11, 2021 at 10:38 AM Kumar Gala <kumar.gala@linaro.org> wrote:
Jack,

We are utilizing what GitHub provides and as far as I can tell once we make the change to the default branch from ‘master’ to ‘main’ the ‘master’ branch will no longer exist in the repository.

So downstream users will need to adjust after the change is made.

If you have some means to handle such a synchronization its something that we can discuss.

- k

On Mar 11, 2021, at 10:12 AM, Jack Rosenthal <jrosenth@chromium.org> wrote:

Hi,

Will there be a period of time that we have two main branches ("master" and "main") that are auto-synced to give time for people to adjust their tools?

Thanks,

Jack

On Thu, Mar 11, 2021 at 6:32 AM Kumar Gala <kumar.gala@linaro.org> wrote:
We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).

There is no action required for any open PRs, however you’ll need to update your local git clone as follows:

git branch -m master main
git fetch origin
git branch -u origin/main main

Will announce here when this change is made on Friday.

thanks

- k




Re: Changing default branch name on GitHub - possible action required

Jack Rosenthal
 

The typical way I've seen this done is:

Phase 1: Create the main branch at the same commit hash as master. Repo maintainers make sure that the main branch is synced to master.
Phase 2: Set the default branch to "main". Continue syncing "main" and "master".
Phase 3: Stop syncing "main" and "master". Master goes stale.
Phase 4: Delete the (now stale) master branch.

I'm not sure if GitHub has tools for branch syncing, but it can be done easy enough from the command line by someone with push access.

On Thu, Mar 11, 2021 at 10:38 AM Kumar Gala <kumar.gala@...> wrote:
Jack,

We are utilizing what GitHub provides and as far as I can tell once we make the change to the default branch from ‘master’ to ‘main’ the ‘master’ branch will no longer exist in the repository.

So downstream users will need to adjust after the change is made.

If you have some means to handle such a synchronization its something that we can discuss.

- k

> On Mar 11, 2021, at 10:12 AM, Jack Rosenthal <jrosenth@...> wrote:
>
> Hi,
>
> Will there be a period of time that we have two main branches ("master" and "main") that are auto-synced to give time for people to adjust their tools?
>
> Thanks,
>
> Jack
>
> On Thu, Mar 11, 2021 at 6:32 AM Kumar Gala <kumar.gala@...> wrote:
> We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).
>
> There is no action required for any open PRs, however you’ll need to update your local git clone as follows:
>
> git branch -m master main
> git fetch origin
> git branch -u origin/main main
>
> Will announce here when this change is made on Friday.
>
> thanks
>
> - k
>
>
>
>


Re: Changing default branch name on GitHub - possible action required

Kumar Gala
 

Jack,

We are utilizing what GitHub provides and as far as I can tell once we make the change to the default branch from ‘master’ to ‘main’ the ‘master’ branch will no longer exist in the repository.

So downstream users will need to adjust after the change is made.

If you have some means to handle such a synchronization its something that we can discuss.

- k

On Mar 11, 2021, at 10:12 AM, Jack Rosenthal <jrosenth@chromium.org> wrote:

Hi,

Will there be a period of time that we have two main branches ("master" and "main") that are auto-synced to give time for people to adjust their tools?

Thanks,

Jack

On Thu, Mar 11, 2021 at 6:32 AM Kumar Gala <kumar.gala@linaro.org> wrote:
We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).

There is no action required for any open PRs, however you’ll need to update your local git clone as follows:

git branch -m master main
git fetch origin
git branch -u origin/main main

Will announce here when this change is made on Friday.

thanks

- k




Re: Changing default branch name on GitHub - possible action required

Jack Rosenthal
 

Hi,

Will there be a period of time that we have two main branches ("master" and "main") that are auto-synced to give time for people to adjust their tools?

Thanks,

Jack

On Thu, Mar 11, 2021 at 6:32 AM Kumar Gala <kumar.gala@...> wrote:
We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).

There is no action required for any open PRs, however you’ll need to update your local git clone as follows:

git branch -m master main
git fetch origin
git branch -u origin/main main

Will announce here when this change is made on Friday.

thanks

- k





Re: Changing default branch name on GitHub (delayed)

Kumar Gala
 

All,

We’ve identified some changes we need to make to west to make the transition of branch name cleaner. We will delay the branch name change until these changes are made to west and a version of west is released.

Sorry for the inconvenience.

- k

On Mar 11, 2021, at 7:32 AM, Kumar Gala via lists.zephyrproject.org <kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).

There is no action required for any open PRs, however you’ll need to update your local git clone as follows:

git branch -m master main
git fetch origin
git branch -u origin/main main

Will announce here when this change is made on Friday.

thanks

- k




Zephyr Project: Dev Meeting - Thu, 03/11/2021 4:00pm-5:00pm, Please RSVP #cal-reminder

devel@lists.zephyrproject.org Calendar <devel@...>
 

Reminder: Zephyr Project: Dev Meeting

When: Thursday, 11 March 2021, 4:00pm to 5:00pm, (GMT+00:00) UTC

Where:Microsoft Teams Meeting

An RSVP is requested. Click here to RSVP

Organizer: devel@...

Description:

________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 483 314 739#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 
________________________________________________________________________________


Kconfig with choice for integers

Michael Alleblas
 

I am trying to add some changes to the NXP iMX RT1060 SOC so that
different video PLLs can be configured. I have created the options for
selection in menuconfig and they work good in that environment but
when trying to set them by prj.conf I get an error.. An example of the
configurations I have is embodied by this:

**********
choice
prompt "Video PLL loop divider"
depends on INIT_VIDEO_PLL
default MCUX_VIDEO_PLL_LOOP_DIVIDER_31
config MCUX_VIDEO_PLL_LOOP_DIVIDER_27
bool "27"
...
config MCUX_VIDEO_PLL_LOOP_DIVIDER_54
bool "54"
endchoice

config MCUX_VIDEO_PLL_LOOP_DIVIDER
int
default 31
default 27 if MCUX_VIDEO_PLL_LOOP_DIVIDER_27
...
default 54 if MCUX_VIDEO_PLL_LOOP_DIVIDER_54
**********

When trying to set CONFIG_MCUX_LCDIF_PRE_DIV=1 in prj.config for
instance, I get the error

**********
error: MCUX_VIDEO_PLL_LOOP_DIVIDER (defined at
soc/arm/nxp_imx/rt/Kconfig.soc:425) is assigned in a configuration
file, but is not directly user-configurable (has no prompt). It gets
its value indirectly from other symbols.
**********

I understand why I get this error, I just can't wrap my head around
the best way to structure my Kconfig menu items to get the desired end
result in both menuconfig and in the prj.conf file.

Two of my changes which work perfectly fine are as follows:

**********
config MCUX_VIDEO_PLL_NUMERATOR
int "Video PLL numerator"
range 0 1073741823
default 0

config MCUX_VIDEO_PLL_DENOMINATOR
int "Video PLL denominator"
range 0 1073741823
default 0
**********

Any guidance would be appreciated.

Regards,

Michael A


Re: Dev-Review Meeting Agenda Mar 11

Kumar Gala
 

On Mar 10, 2021, at 7:31 PM, Kumar Gala via lists.zephyrproject.org <kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Here’s the agenda topics for this week:

checkpatch: Disable "blank line after declarations” warning (@carles)
- https://github.com/zephyrproject-rtos/zephyr/pull/32850

npcx: move scfg driver from pinctrl to soc/arm/nuvoton_npcx/common (@Piotr)
- https://github.com/zephyrproject-rtos/zephyr/pull/32859

docs: enable Algolia based search (@Gerard)
- https://github.com/zephyrproject-rtos/zephyr/pull/32998

https://github.com/zephyrproject-rtos/zephyr/labels/dev-review

* Any topics anyone else has.

- k
Adding:

Improve documentation user experience
- https://github.com/zephyrproject-rtos/zephyr/issues/33127

Where should a few include/ headers live:
- https://github.com/zephyrproject-rtos/zephyr/issues/32975

- k


Changing default branch name on GitHub - possible action required

Kumar Gala
 

We will be changing the default branch on github from ‘master' to ‘main' on Friday (Mar 11, 2021).

There is no action required for any open PRs, however you’ll need to update your local git clone as follows:

git branch -m master main
git fetch origin
git branch -u origin/main main

Will announce here when this change is made on Friday.

thanks

- k


Dev-Review Meeting Agenda Mar 11

Kumar Gala
 

Here’s the agenda topics for this week:

checkpatch: Disable "blank line after declarations” warning (@carles)
- https://github.com/zephyrproject-rtos/zephyr/pull/32850

npcx: move scfg driver from pinctrl to soc/arm/nuvoton_npcx/common (@Piotr)
- https://github.com/zephyrproject-rtos/zephyr/pull/32859

docs: enable Algolia based search (@Gerard)
- https://github.com/zephyrproject-rtos/zephyr/pull/32998

https://github.com/zephyrproject-rtos/zephyr/labels/dev-review

* Any topics anyone else has.

- k


Updated Event: Zephyr Project: APIs #cal-invite

devel@lists.zephyrproject.org Calendar <noreply@...>
 

Zephyr Project: APIs

When:
Tuesday, 16 March 2021
4:00pm to 5:00pm
(UTC+00:00) UTC
Repeats: Weekly on Tuesday

Where:
Microsoft Teams Meeting

Organizer: devel@...

An RSVP is requested. Click here to RSVP

Description:

Meeting decisions/discussions in their respective PRs, tracked here: https://github.com/zephyrproject-rtos/zephyr/projects/18


________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 317 990 129#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 
________________________________________________________________________________


Re: [EXT] about DMA API updates proposal

Hake Huang
 

Hi Gala,

This is a brief introductions for these changes. Hopefully it can help you to explain the context. Please note in Page 8, 9, there are some special data structure changes. Thanks again.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月10日 10:49
To: Kumar Gala <kumar.gala@linaro.org>; Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Thanks Gala. Really appreciated.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月9日 21:31
To: Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

I can present the two options that Hake and I have discussed in this thread to see if there’s any feedback on which direction to take for the new API that is being suggested.

(Happy to do this so Hake doesn’t have to be awake at a crazy hour for him).

- k

On Mar 9, 2021, at 6:17 AM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Hake,

Is this something you want to discuss at the API meeting today? It's at 18h CET.

Thanks,

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org>
On Behalf Of Hake Huang via lists.zephyrproject.org
Sent: 09 March 2021 12:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I create a new PR
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F33174&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620655760%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=xJlwTcev
57aEZ
bDlldIUODWfUpNLzH7SbIUnbTvqMNw%3D&amp;reserved=0 dedicated for the
two new APIS, please check. Thanks in advance.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月5日 11:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I try to find some reference from Linux code, and below is my finding.

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc
s.hui
hoo.com%2Fdoxygen%2Flinux%2Fkernel%2F3.7%2Fdmatest_8c_source.html&amp
;data
=04%7C01%7Ccarles.cufi%40nordicsemi.no%7C2f7fefddf3df4385a77008d8e2f2
6416%
7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637508879620665756%7CUnk
nown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6
Mn0%3D%7C3000&amp;sdata=Sq5QarVur4smW1zz1sWY6nRBMwca2lCnzmMVW9Z9kNI%3
D&amp
;reserved=0
614 static bool filter(struct dma_chan *chan, void *param)
615 {
616 if (!dmatest_match_channel(chan) || !dmatest_match_device(chan-
device))
617 return false;
618 else
619 return true;
620 }
621
622 static int __init dmatest_init(void)
623 {
624 dma_cap_mask_t mask;
625 struct dma_chan *chan;
626 int err = 0;
627
628 dma_cap_zero(mask);
629 dma_cap_set(DMA_MEMCPY, mask);
630 for (;;) {
631 chan = dma_request_channel(mask, filter, NULL);
632 if (chan) {
633 err = dmatest_add_channel(chan);
634 if (err) {
635 dma_release_channel(chan);
636 break; /* add_channel failed, punt */
637 }
638 } else
639 break; /* no more channels available */
640 if (max_channels && nr_channels >= max_channels)
641 break; /* we have all we need */
642 }
643
644 return err;
645 }

In Linux the dma api use a filter function point as its parameter, so
the zephyr request API can be

static int dma_edma_request_channel(const struct device *dev,
channel_filter_func filter, void
*
filter_param) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
if (fn && !fn(filter_param)) {
continue;
}
break;
}
}
k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

And each SOC vender response to provide the filter function, if no
filter then just give NULL.


How about this solution?

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月4日 23:00
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

1. I think we handle that on a case by case basis and wait and see
how it develops over time. If we keep these APIs vendor specific for
now we can refactor or introduce a general API for ‘filter’ when we see the pattern.

2. The ‘if’ has to exist somewhere. The ‘if’ is either in the API or
the caller.

The concern I have is we don’t know what kinda of ‘filters’ we need
today beyond the ‘periodic’ one which is specific to NXP hardware.

- k

On Mar 3, 2021, at 9:27 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

According to the usage of these two APIs, I have two concerns

1. What if there are other special DMA attribute than periodic? We
will
have to add more APIs?
2. in the peripheral driver, the DMA request can be periodic or not
periodic, then we have to use if else instead of a simple call with
filter.

Regards,
Hake
-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 22:49
To: Kumar Gala <kumar.gala@linaro.org>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org;
Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou
<erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

Hake,

So I was thinking about the following idea:

Having 2 general purpose APIs:

dma_request_channel(const struct device *dev)
dma_release_channel(const struct device *dev)

Than 2 eDMA specific APIs:

mcux_edma_request_periodic_channel(const struct device *dev)
mcux_edma_release_periodic_channel(const struct device *dev)

- k

On Mar 2, 2021, at 9:28 PM, Kumar Gala via lists.zephyrproject.org
<kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Hake,

The ‘filter’ feature I’m still trying to figure out how we handle.
I’m
curious if other vendors have channels that have specific features
like ‘periodic’ that only are supported on specific channels or not.

Hopefully, Erwan might be able to know for STM32.

- k

On Mar 2, 2021, at 9:06 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

I will create a separated PR for DMA new API only.

and one question for below:
"use some of the generic devicetree properties in
"dts/bindings/dma/dma-controller.yaml”. The number space allocation
code seems pretty generic"

Do you mean, instead of just add API call but move below implement
to
common code?

static int dma_mcux_edma_request_channel(const struct device *dev,
enum dma_channel_filter
filter) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
/* channel 0-3 is Period trigger enabled */
if (filter == DMA_CHANNEL_PERIODIC && i > 3) {
break;
}
if
(!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
break;
}
}

k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

If so the filter is hard to aligned, as different SOC has
different
filter setting.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 1:43
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>
Subject: [EXT] Re: about DMA API updates proposal

Caution: EXT Email

On Feb 26, 2021, at 5:46 AM, Hake Huang <hake.huang@nxp.com> wrote:

Hi All,

I am working on enable NXP EDMA drivers to Zephyr DMA framework,
and
I have two DMA API changes need to discussion.
1.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F28895&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620665756%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HpXjVqCH
dnoRg
IbGlttgT2pLgUWUr%2Fx3oaLgsR479F4%3D&amp;reserved=0
in this PR, I add chain_link by using the dest_chaining_en(Major)
and
source_chaining_en(minor).
2.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737&amp;data=04%7
C0
1
%7
Chake.huang%40nxp.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1
d3
b
c2
b4c6fa92cd99c5c301635%7C0%7C0%7C637503037637038943%7CUnknown%7CTW
Fp
b
GZ
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
Mn
0
%3
D%7C1000&amp;sdata=3QEP18IvoC9MS3C9o274Z0eMIdbIWTzaoZp18la0OzQ%3D
&a
m
p;
reserved=0 in this PR,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737%2Fcommits%2F2
5e
1
9f
5b4e4ef07b1598104a02c4722386f2f17b&amp;data=04%7C01%7Chake.huang%
40
n
xp
.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3bc2b4c6fa92cd99c5c3
01635
%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
wMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wp3iD
OFIDk
csLjHRqk9OMWe3yiDfBXko6SHkIDrjQeA%3D&amp;reserved=0 two helper APIs
is added dma_api_request_channel request_channel;
dma_api_release_channel release_channel; the two APIs are for DMA
engine which is capable to dynamically allocate its channels to
different DMA requests. and a filter is also added in case of special DMA channel features.

Slack topic discussion is here

Can this topic be scheduled in next API meeting? Thanks.


Regards,
Hake
I wonder if we should pull this into a separate PR. I think a
fair
amount of the code for these APIs could be generic.

For example I think we can use some of the generic devicetree
properties in "dts/bindings/dma/dma-controller.yaml”. The number
space allocation code seems pretty generic, even if it just library
code used by all the drivers.

- k








Re: [EXT] about DMA API updates proposal

Hake Huang
 

Thanks Gala. Really appreciated.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月9日 21:31
To: Carles Cufi <Carles.Cufi@nordicsemi.no>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

I can present the two options that Hake and I have discussed in this thread to see if there’s any feedback on which direction to take for the new API that is being suggested.

(Happy to do this so Hake doesn’t have to be awake at a crazy hour for him).

- k

On Mar 9, 2021, at 6:17 AM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Hake,

Is this something you want to discuss at the API meeting today? It's at 18h CET.

Thanks,

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org>
On Behalf Of Hake Huang via lists.zephyrproject.org
Sent: 09 March 2021 12:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I create a new PR
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F33174&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620655760%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=xJlwTcev
57aEZ
bDlldIUODWfUpNLzH7SbIUnbTvqMNw%3D&amp;reserved=0 dedicated for the
two new APIS, please check. Thanks in advance.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月5日 11:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I try to find some reference from Linux code, and below is my finding.

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc
s.hui
hoo.com%2Fdoxygen%2Flinux%2Fkernel%2F3.7%2Fdmatest_8c_source.html&amp
;data
=04%7C01%7Ccarles.cufi%40nordicsemi.no%7C2f7fefddf3df4385a77008d8e2f2
6416%
7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637508879620665756%7CUnk
nown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6
Mn0%3D%7C3000&amp;sdata=Sq5QarVur4smW1zz1sWY6nRBMwca2lCnzmMVW9Z9kNI%3
D&amp
;reserved=0
614 static bool filter(struct dma_chan *chan, void *param)
615 {
616 if (!dmatest_match_channel(chan) || !dmatest_match_device(chan-
device))
617 return false;
618 else
619 return true;
620 }
621
622 static int __init dmatest_init(void)
623 {
624 dma_cap_mask_t mask;
625 struct dma_chan *chan;
626 int err = 0;
627
628 dma_cap_zero(mask);
629 dma_cap_set(DMA_MEMCPY, mask);
630 for (;;) {
631 chan = dma_request_channel(mask, filter, NULL);
632 if (chan) {
633 err = dmatest_add_channel(chan);
634 if (err) {
635 dma_release_channel(chan);
636 break; /* add_channel failed, punt */
637 }
638 } else
639 break; /* no more channels available */
640 if (max_channels && nr_channels >= max_channels)
641 break; /* we have all we need */
642 }
643
644 return err;
645 }

In Linux the dma api use a filter function point as its parameter, so
the zephyr request API can be

static int dma_edma_request_channel(const struct device *dev,
channel_filter_func filter, void
*
filter_param) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
if (fn && !fn(filter_param)) {
continue;
}
break;
}
}
k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

And each SOC vender response to provide the filter function, if no
filter then just give NULL.


How about this solution?

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月4日 23:00
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>; Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

1. I think we handle that on a case by case basis and wait and see
how it develops over time. If we keep these APIs vendor specific for
now we can refactor or introduce a general API for ‘filter’ when we see the pattern.

2. The ‘if’ has to exist somewhere. The ‘if’ is either in the API or
the caller.

The concern I have is we don’t know what kinda of ‘filters’ we need
today beyond the ‘periodic’ one which is specific to NXP hardware.

- k

On Mar 3, 2021, at 9:27 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

According to the usage of these two APIs, I have two concerns

1. What if there are other special DMA attribute than periodic? We
will
have to add more APIs?
2. in the peripheral driver, the DMA request can be periodic or not
periodic, then we have to use if else instead of a simple call with
filter.

Regards,
Hake
-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 22:49
To: Kumar Gala <kumar.gala@linaro.org>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org;
Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou
<erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

Hake,

So I was thinking about the following idea:

Having 2 general purpose APIs:

dma_request_channel(const struct device *dev)
dma_release_channel(const struct device *dev)

Than 2 eDMA specific APIs:

mcux_edma_request_periodic_channel(const struct device *dev)
mcux_edma_release_periodic_channel(const struct device *dev)

- k

On Mar 2, 2021, at 9:28 PM, Kumar Gala via lists.zephyrproject.org
<kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Hake,

The ‘filter’ feature I’m still trying to figure out how we handle.
I’m
curious if other vendors have channels that have specific features
like ‘periodic’ that only are supported on specific channels or not.

Hopefully, Erwan might be able to know for STM32.

- k

On Mar 2, 2021, at 9:06 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

I will create a separated PR for DMA new API only.

and one question for below:
"use some of the generic devicetree properties in
"dts/bindings/dma/dma-controller.yaml”. The number space allocation
code seems pretty generic"

Do you mean, instead of just add API call but move below implement
to
common code?

static int dma_mcux_edma_request_channel(const struct device *dev,
enum dma_channel_filter
filter) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
/* channel 0-3 is Period trigger enabled */
if (filter == DMA_CHANNEL_PERIODIC && i > 3) {
break;
}
if
(!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
break;
}
}

k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

If so the filter is hard to aligned, as different SOC has
different
filter setting.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 1:43
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>
Subject: [EXT] Re: about DMA API updates proposal

Caution: EXT Email

On Feb 26, 2021, at 5:46 AM, Hake Huang <hake.huang@nxp.com> wrote:

Hi All,

I am working on enable NXP EDMA drivers to Zephyr DMA framework,
and
I have two DMA API changes need to discussion.
1.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit
hub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F28895&amp;data=04%7C01%7Ccarles.cufi%40nordics
emi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e
8d%7C
0%7C0%7C637508879620665756%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
AiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HpXjVqCH
dnoRg
IbGlttgT2pLgUWUr%2Fx3oaLgsR479F4%3D&amp;reserved=0
in this PR, I add chain_link by using the dest_chaining_en(Major)
and
source_chaining_en(minor).
2.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737&amp;data=04%7
C0
1
%7
Chake.huang%40nxp.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1
d3
b
c2
b4c6fa92cd99c5c301635%7C0%7C0%7C637503037637038943%7CUnknown%7CTW
Fp
b
GZ
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
Mn
0
%3
D%7C1000&amp;sdata=3QEP18IvoC9MS3C9o274Z0eMIdbIWTzaoZp18la0OzQ%3D
&a
m
p;
reserved=0 in this PR,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2
Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737%2Fcommits%2F2
5e
1
9f
5b4e4ef07b1598104a02c4722386f2f17b&amp;data=04%7C01%7Chake.huang%
40
n
xp
.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3bc2b4c6fa92cd99c5c3
01635
%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
wMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wp3iD
OFIDk
csLjHRqk9OMWe3yiDfBXko6SHkIDrjQeA%3D&amp;reserved=0 two helper APIs
is added dma_api_request_channel request_channel;
dma_api_release_channel release_channel; the two APIs are for DMA
engine which is capable to dynamically allocate its channels to
different DMA requests. and a filter is also added in case of special DMA channel features.

Slack topic discussion is here

Can this topic be scheduled in next API meeting? Thanks.


Regards,
Hake
I wonder if we should pull this into a separate PR. I think a
fair
amount of the code for these APIs could be generic.

For example I think we can use some of the generic devicetree
properties in "dts/bindings/dma/dma-controller.yaml”. The number
space allocation code seems pretty generic, even if it just library
code used by all the drivers.

- k








Zephyr Project: APIs - Tue, 03/09/2021 5:00pm-6:00pm, Please RSVP #cal-reminder

devel@lists.zephyrproject.org Calendar <devel@...>
 

Reminder: Zephyr Project: APIs

When: Tuesday, 9 March 2021, 5:00pm to 6:00pm, (GMT+00:00) UTC

Where:Microsoft Teams Meeting

An RSVP is requested. Click here to RSVP

Organizer: devel@...

Description:

Meeting decisions/discussions in their respective PRs, tracked here: https://github.com/zephyrproject-rtos/zephyr/projects/18


________________________________________________________________________________
+1 321-558-6518 United States, Orlando (Toll)
Conference ID: 317 990 129#
Local numbers | Reset PIN | Learn more about Teams | Meeting options
 
 
________________________________________________________________________________


Re: [EXT] about DMA API updates proposal

Kumar Gala
 

I can present the two options that Hake and I have discussed in this thread to see if there’s any feedback on which direction to take for the new API that is being suggested.

(Happy to do this so Hake doesn’t have to be awake at a crazy hour for him).

- k

On Mar 9, 2021, at 6:17 AM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:

Hi Hake,

Is this something you want to discuss at the API meeting today? It's at 18h CET.

Thanks,

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> On
Behalf Of Hake Huang via lists.zephyrproject.org
Sent: 09 March 2021 12:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>;
Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I create a new PR
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F33174&amp;data=04%7C01%7Ccarles.cufi%40nordicsemi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C
0%7C0%7C637508879620655760%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=xJlwTcev57aEZ
bDlldIUODWfUpNLzH7SbIUnbTvqMNw%3D&amp;reserved=0 dedicated for the two new
APIS, please check. Thanks in advance.

Regards,
Hake

-----Original Message-----
From: Hake Huang
Sent: 2021年3月5日 11:56
To: Kumar Gala <kumar.gala@linaro.org>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>;
Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: RE: [Zephyr-devel] [EXT] about DMA API updates proposal

Hi Gala,

I try to find some reference from Linux code, and below is my finding.

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.hui
hoo.com%2Fdoxygen%2Flinux%2Fkernel%2F3.7%2Fdmatest_8c_source.html&amp;data
=04%7C01%7Ccarles.cufi%40nordicsemi.no%7C2f7fefddf3df4385a77008d8e2f26416%
7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C0%7C0%7C637508879620665756%7CUnknown%
7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
Mn0%3D%7C3000&amp;sdata=Sq5QarVur4smW1zz1sWY6nRBMwca2lCnzmMVW9Z9kNI%3D&amp
;reserved=0
614 static bool filter(struct dma_chan *chan, void *param)
615 {
616 if (!dmatest_match_channel(chan) || !dmatest_match_device(chan-
device))
617 return false;
618 else
619 return true;
620 }
621
622 static int __init dmatest_init(void)
623 {
624 dma_cap_mask_t mask;
625 struct dma_chan *chan;
626 int err = 0;
627
628 dma_cap_zero(mask);
629 dma_cap_set(DMA_MEMCPY, mask);
630 for (;;) {
631 chan = dma_request_channel(mask, filter, NULL);
632 if (chan) {
633 err = dmatest_add_channel(chan);
634 if (err) {
635 dma_release_channel(chan);
636 break; /* add_channel failed, punt */
637 }
638 } else
639 break; /* no more channels available */
640 if (max_channels && nr_channels >= max_channels)
641 break; /* we have all we need */
642 }
643
644 return err;
645 }

In Linux the dma api use a filter function point as its parameter, so the
zephyr request API can be

static int dma_edma_request_channel(const struct device *dev,
channel_filter_func filter, void *
filter_param) {
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels, i))
{
channel = i;
if (fn && !fn(filter_param)) {
continue;
}
break;
}
}
k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

And each SOC vender response to provide the filter function, if no filter
then just give NULL.


How about this solution?

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月4日 23:00
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm <maureen.helm@nxp.com>;
Erwan Gouriou <erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

1. I think we handle that on a case by case basis and wait and see how it
develops over time. If we keep these APIs vendor specific for now we can
refactor or introduce a general API for ‘filter’ when we see the pattern.

2. The ‘if’ has to exist somewhere. The ‘if’ is either in the API or the
caller.

The concern I have is we don’t know what kinda of ‘filters’ we need today
beyond the ‘periodic’ one which is specific to NXP hardware.

- k

On Mar 3, 2021, at 9:27 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

According to the usage of these two APIs, I have two concerns

1. What if there are other special DMA attribute than periodic? We will
have to add more APIs?
2. in the peripheral driver, the DMA request can be periodic or not
periodic, then we have to use if else instead of a simple call with
filter.

Regards,
Hake
-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 22:49
To: Kumar Gala <kumar.gala@linaro.org>
Cc: Hake Huang <hake.huang@nxp.com>; devel@lists.zephyrproject.org;
Maureen Helm <maureen.helm@nxp.com>; Erwan Gouriou
<erwan.gouriou@linaro.org>
Subject: Re: [Zephyr-devel] [EXT] about DMA API updates proposal

Caution: EXT Email

Hake,

So I was thinking about the following idea:

Having 2 general purpose APIs:

dma_request_channel(const struct device *dev)
dma_release_channel(const struct device *dev)

Than 2 eDMA specific APIs:

mcux_edma_request_periodic_channel(const struct device *dev)
mcux_edma_release_periodic_channel(const struct device *dev)

- k

On Mar 2, 2021, at 9:28 PM, Kumar Gala via lists.zephyrproject.org
<kumar.gala=linaro.org@lists.zephyrproject.org> wrote:

Hake,

The ‘filter’ feature I’m still trying to figure out how we handle. I’m
curious if other vendors have channels that have specific features like
‘periodic’ that only are supported on specific channels or not.

Hopefully, Erwan might be able to know for STM32.

- k

On Mar 2, 2021, at 9:06 PM, Hake Huang <hake.huang@nxp.com> wrote:

Hi Gala,

I will create a separated PR for DMA new API only.

and one question for below:
"use some of the generic devicetree properties in
"dts/bindings/dma/dma-controller.yaml”. The number space allocation code
seems pretty generic"

Do you mean, instead of just add API call but move below implement to
common code?

static int dma_mcux_edma_request_channel(const struct device *dev,
enum dma_channel_filter filter)
{
int i = 0;
int channel = -EINVAL;

k_mutex_lock(&DEV_DATA(dev)->dma_mutex, K_FOREVER);

for (i = 0; i < DEV_CFG(dev)->dma_channels; i++) {
/* channel 0-3 is Period trigger enabled */
if (filter == DMA_CHANNEL_PERIODIC && i > 3) {
break;
}
if (!atomic_test_and_set_bit(DEV_DATA(dev)->dma_channels,
i)) {
channel = i;
break;
}
}

k_mutex_unlock(&DEV_DATA(dev)->dma_mutex);

return channel;
}

If so the filter is hard to aligned, as different SOC has different
filter setting.

Regards,
Hake

-----Original Message-----
From: Kumar Gala <kumar.gala@linaro.org>
Sent: 2021年3月3日 1:43
To: Hake Huang <hake.huang@nxp.com>
Cc: devel@lists.zephyrproject.org; Maureen Helm
<maureen.helm@nxp.com>
Subject: [EXT] Re: about DMA API updates proposal

Caution: EXT Email

On Feb 26, 2021, at 5:46 AM, Hake Huang <hake.huang@nxp.com> wrote:

Hi All,

I am working on enable NXP EDMA drivers to Zephyr DMA framework, and
I have two DMA API changes need to discussion.
1.
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
om%2Fzephyrproject-
rtos%2Fzephyr%2Fpull%2F28895&amp;data=04%7C01%7Ccarles.cufi%40nordicsemi.n
o%7C2f7fefddf3df4385a77008d8e2f26416%7C28e5afa2bf6f419a8cf6b31c6e9e5e8d%7C
0%7C0%7C637508879620665756%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=HpXjVqCHdnoRg
IbGlttgT2pLgUWUr%2Fx3oaLgsR479F4%3D&amp;reserved=0
in this PR, I add chain_link by using the dest_chaining_en(Major) and
source_chaining_en(minor).
2.
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737&amp;data=04%7C0
1
%7
Chake.huang%40nxp.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3
b
c2
b4c6fa92cd99c5c301635%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFp
b
GZ
sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
0
%3
D%7C1000&amp;sdata=3QEP18IvoC9MS3C9o274Z0eMIdbIWTzaoZp18la0OzQ%3D&a
m
p;
reserved=0 in this PR,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fg
i
th
ub.com%2Fzephyrproject-rtos%2Fzephyr%2Fpull%2F27737%2Fcommits%2F25e
1
9f
5b4e4ef07b1598104a02c4722386f2f17b&amp;data=04%7C01%7Chake.huang%40
n
xp
.com%7C3753d08aba3a4799ddb008d8dda294b0%7C686ea1d3bc2b4c6fa92cd99c5c301635
%7C0%7C0%7C637503037637038943%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAi
LCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=wp3iDOFIDk
csLjHRqk9OMWe3yiDfBXko6SHkIDrjQeA%3D&amp;reserved=0 two helper APIs is
added dma_api_request_channel request_channel; dma_api_release_channel
release_channel; the two APIs are for DMA engine which is capable to
dynamically allocate its channels to different DMA requests. and a filter
is also added in case of special DMA channel features.

Slack topic discussion is here

Can this topic be scheduled in next API meeting? Thanks.


Regards,
Hake
I wonder if we should pull this into a separate PR. I think a fair
amount of the code for these APIs could be generic.

For example I think we can use some of the generic devicetree
properties in "dts/bindings/dma/dma-controller.yaml”. The number space
allocation code seems pretty generic, even if it just library code used by
all the drivers.

- k







561 - 580 of 8185