Conversation
| @@ -18,6 +18,17 @@ static SHARED_DATA struct dai sai[] = { | |||
| .index = 3, | |||
| .plat_data = { | |||
| .base = SAI_3_BASE, | |||
There was a problem hiding this comment.
This can go as a separate PR. Please add some more info in the commit message. The current commit message is not very informative.
| .offset = SAI_3_BASE + REG_SAI_RDR0, | ||
| .depth = 16, | ||
| .handshake = 4, | ||
| }, |
There was a problem hiding this comment.
Maybe we could add some meaningful macros for event 4 and 5.
| .fifo[SOF_IPC_STREAM_PLAYBACK] = { | ||
| .offset = SAI_3_BASE + REG_SAI_TDR0, | ||
| .depth = 16, | ||
| /* Handshake is SDMA hardware event */ |
There was a problem hiding this comment.
Looking in the upstream SAI Linux driver (sound/soc/fsl/fsl_sai.c) depth for i.MX8MQ is 128. I think that SAI is the same on 8MP vs 8MP.
There was a problem hiding this comment.
Depth is in number of words and is interpreted by SDMA driver. Will need to check.
|
|
||
| #define SDMA2_IRQ 7 /* TODO What? */ | ||
| #define SDMA2_IRQ_NAME "irqstr2" /* TODO find the correct one */ | ||
|
|
There was a problem hiding this comment.
Whe should remove the TODOs here. If we are sure the numbers are correct.
There was a problem hiding this comment.
I am not 100% certain. I may also end up using irqstr_get_sof_int like on the other platforms (perhaps my calculations were in fact incorrect).
| @@ -12,6 +12,7 @@ | |||
| #include <sof/spinlock.h> | |||
|
|
|||
| extern struct dma_ops dummy_dma_ops; | |||
There was a problem hiding this comment.
Here we should update the commit message once all questions are answered.
|
|
||
| #define DMA_ID_EDMA0 0 | ||
| #define DMA_ID_SDMA2 0 | ||
| #define DMA_ID_HOST 1 |
There was a problem hiding this comment.
good catch. I think we can make the following PRs:
- PR with cleanups in preparation for SDMA driver.
- PR adding SDMA driver
We could get 1) accepted faster so that i.MX8MP boots fine with qemu.
| timer.c | ||
| sdma.c | ||
| ) | ||
|
|
There was a problem hiding this comment.
TODO: Add selectable config for SDMA. e.g: CONFIG_IMX_SDMA. This can be done later.
There was a problem hiding this comment.
I think I can do this in the same PR that will have the implementation.
| @@ -6,6 +6,7 @@ add_local_sources(sof | |||
| interrupt.c | |||
There was a problem hiding this comment.
We could cleanup commit message, be deleting DO NOT MERGE and this commit requires the cleanup. Also, would be nice to add a link to a RM containing SDMA bits. Maybe link to 8MQ RM.
There was a problem hiding this comment.
That's a reminder for myself that I need to clean up some bits from this commit. We have seen how unreliable direct links for the RM are so I will look into how to make a reasonably-persistent link for future reference.
|
|
||
| struct sdma_bd { | ||
| /* SDMA BD configuration */ | ||
| uint32_t config; |
There was a problem hiding this comment.
maybe first time use full name for BD, not sure what it stands for.
| trace_sdma_error("sdma_set_overrides(%d, %d)", event_override, host_override); | ||
| dma_reg_update_bits(channel->dma, SDMA_EVTOVR, BIT(channel->index), event_override ? BIT(channel->index) : 0); | ||
| dma_reg_update_bits(channel->dma, SDMA_HOSTOVR, BIT(channel->index), host_override ? BIT(channel->index) : 0); | ||
| } |
There was a problem hiding this comment.
I think this line goes over 80 chars. In fact I think there are several places where this happens. Maybe run checkpatch.ppl with --strict?
There was a problem hiding this comment.
Will fix the lines-too-long issues as I look again into this file. I still have a few dummy functions that need to go.
src/drivers/imx/sdma.c
Outdated
|
|
||
| /* Writeback descriptors and CCB */ | ||
|
|
||
| dcache_writeback_region(c0data->descriptors, sizeof(c0data->descriptors[0])); |
There was a problem hiding this comment.
No need for new line here.
| sdma_set_overrides(c0, true, false); | ||
| ret = dma_start(&dma->chan[0]); | ||
|
|
||
| if (ret < 0) |
There was a problem hiding this comment.
Same here, no need for new line.
|
|
||
| trace_sdma("SDMA: probe"); | ||
| trace_sdma_error("sdma_probe"); | ||
|
|
There was a problem hiding this comment.
Just keep trace_sdma here.
There was a problem hiding this comment.
The trace_sdma_error calls will all go (some may be converted to trace or trace_verbose if they are important enough)
src/drivers/imx/sdma.c
Outdated
| } | ||
| trace_sdma_error("sdma_set_event(%d, %d)", channel->index, eventnum); | ||
| struct sdma_chan *pdata = dma_chan_get_data(channel); | ||
| dma_reg_update_bits(channel->dma, SDMA_CHNENBL(eventnum), BIT(channel->index), BIT(channel->index)); |
There was a problem hiding this comment.
I would suggest on declaring all the variables at the beginning of function.
src/drivers/imx/sdma.c
Outdated
| for (int i = 0; i < dma->plat_data.channels; i++) { | ||
| struct dma_chan_data *channel = &dma->chan[i]; | ||
| struct sdma_chan *cdata = &pdata->chan_pdata[i]; | ||
|
|
There was a problem hiding this comment.
Declare all the variable at the beginning of function. Hope this wont trigger an compiler error for unused variable.
| return -EINVAL; | ||
| } | ||
| bool src_may_change, dst_may_change; | ||
| switch (config->direction) { |
There was a problem hiding this comment.
move declaration at the beginning of function.
| #define SDMA_SCRIPT_SHP2MCU_OFF 979 | ||
| #define SDMA_SCRIPT_MCU2SHP_OFF 1048 | ||
|
|
||
| #endif /* __SOF_DRIVERS_SDMA_H__ */ |
There was a problem hiding this comment.
Other than that it looks good.
09ecb50 to
f9ca3f6
Compare
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
The extra memory blocks are required for SDMA proper functioning. TODO figure out which of the increases are actually required. Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
Some i.MX platforms use SDMA (Smart DMA) controller for DMA related operations. This commit adds the initial functionality for SDMA. Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This includes interrupt number and a tweak used when probing the driver (which must match hardware configuration). Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit adds the definition of the SDMA controller we use for SOF, namely SDMA2 (the other instances of SDMA are used for non-audio-related DMA in the system). This DMAC can serve the SAI. [DO NOT MERGE] because I need help in how to account for channel 0 being used for management functionality, with only channels 1-31 being usable by SOF directly. Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
SDMA is in dma_array[1], and uses a single interrupt for all channels. Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
f9ca3f6 to
3059764
Compare
No description provided.