dmaengine: cppi41: Make CPPI 4.1 driver more generic
v2 cover dmaengine: cppi41: Make CPPI 4.1 driver more generic
Most of the patch of this series were part of "[PATCH 00/11] dmaengine: cppi41: Add dma support to da8xx"
This series intend to make the CPPI 4.1 more generic in order to add a new platform (the DA8xx).
To achieve that, all the IRQ code present in CPPI 4.1 driver has been moved to MUSB DSPS driver.
Other changes mainly update the glue layer and platform code to make the whole driver more generic.
This series needs the patchset
"[PATCH v2 0/2] usb: musb: cppi41: Add a way to manage DMA irq" to build.
Alexandre Bailon (7):
usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in dsps
usb: usb: dsps: update device tree bindings
dmaengine: cppi41: Remove usbss_mem
dmaengine: cppi41: rename platform variables
dmaengine: cppi41: Move some constants to glue layer
dmaengine: cppi41: init_sched(): Get number of channels from DT
dmaengine: cppi41: Fix a race between PM runtime and channel abort
.../devicetree/bindings/usb/am33xx-usb.txt | 9 +- drivers/dma/cppi41.c | 120 +++++++++++---------- drivers/usb/musb/musb_dsps.c | 73 ++++++++++++- 3 files changed, 138 insertions(+), 64 deletions(-)
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/7 usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in dsps
In reply to a message not in the archiveDespite the CPPI 4.1 is a generic DMA, it is tied to USB.
On the dsps, CPPI 4.1 interrupt's registers are in USBSS (the MUSB glue). Currently, to enable / disable and clear interrupts, the CPPI 4.1 driver maps and accesses to USBSS's register, which making CPPI 4.1 driver not really generic.
Move the interrupt management to dsps driver.
--- drivers/dma/cppi41.c | 28 +++++------------ drivers/usb/musb/musb_dsps.c | 73 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 78 insertions(+), 23 deletions(-)
drivers/dma/cppi41.c +7 -21
@@ -79,14 +79,6 @@#define QMGR_QUEUE_C (n) (0x2008 + (n) * 0x10)#define QMGR_QUEUE_D (n) (0x200c + (n) * 0x10) -/* Glue layer specific */ -/* USBSS / USB AM335x */ -#define USBSS_IRQ_STATUS 0x28 -#define USBSS_IRQ_ENABLER 0x2c -#define USBSS_IRQ_CLEARR 0x30 - -#define USBSS_IRQ_PD_COMP (1 << 2) -/* Packet Descriptor */ #define PD2_ZERO_LENGTH (1 << 19)
@@ -288,14 +280,8 @@ static irqreturn_t cppi41_irq(int irq, void *data) {struct cppi41_dd *cdd = data;struct cppi41_channel *c; -u32 status;int i; - status =cppi_readl (cdd->usbss_mem +USBSS_IRQ_STATUS ); -if (!(status &USBSS_IRQ_PD_COMP )) -return IRQ_NONE ; -cppi_writel (status, cdd->usbss_mem +USBSS_IRQ_STATUS ); -for (i =QMGR_PENDING_SLOT_Q (FIST_COMPLETION_QUEUE ); i <QMGR_NUM_PEND ; i++) {u32 val;
@@ -599,6 +585,7 @@ static void cppi41_compute_td_desc(struct cppi41_desc *d)static int cppi41_tear_down_chan (struct cppi41_channel *c) { +struct dmaengine_result abort_result;struct cppi41_dd *cdd = c->cdd;struct cppi41_desc *td;u32 reg;
@@ -682,6 +669,12 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c) c->td_seen =0 ; c->td_desc_seen =0 ;cppi_writel (0 , c->gcr_reg); + +/* Invoke the callback to do the necessary clean-up */ + abort_result.result =DMA_TRANS_ABORTED ; +dma_cookie_complete (&c->txd); +dmaengine_desc_get_callback_invoke (&c->txd, &abort_result); +return 0 ; }
@@ -1044,8 +1037,6 @@ static int cppi41_dma_probe(struct platform_device *pdev) goto err_irq; } -cppi_writel (USBSS_IRQ_PD_COMP , cdd->usbss_mem +USBSS_IRQ_ENABLER ); - ret =devm_request_irq (&pdev->dev, irq, glue_info->isr,IRQF_SHARED ,dev_name (dev), cdd);if (ret)
@@ -1069,7 +1060,6 @@ static int cppi41_dma_probe(struct platform_device *pdev)dma_async_device_unregister (&cdd->ddev); err_dma_reg: err_irq: -cppi_writel (0 , cdd->usbss_mem +USBSS_IRQ_CLEARR );cleanup_chans (cdd); err_chans:deinit_cppi41 (dev, cdd);
@@ -1097,7 +1087,6 @@ static int cppi41_dma_remove(struct platform_device *pdev)of_dma_controller_free (pdev->dev.of_node);dma_async_device_unregister (&cdd->ddev); -cppi_writel (0 , cdd->usbss_mem +USBSS_IRQ_CLEARR );devm_free_irq (&pdev->dev, cdd->irq, cdd);cleanup_chans (cdd);deinit_cppi41 (&pdev->dev, cdd);
@@ -1116,7 +1105,6 @@ static int __maybe_unused cppi41_suspend(struct device *dev)struct cppi41_dd *cdd =dev_get_drvdata (dev); cdd->dma_tdfdq =cppi_readl (cdd->ctrl_mem +DMA_TDFDQ ); -cppi_writel (0 , cdd->usbss_mem +USBSS_IRQ_CLEARR );disable_sched (cdd);return 0 ;
@@ -1142,8 +1130,6 @@ static int __maybe_unused cppi41_resume(struct device *dev)cppi_writel (QMGR_SCRATCH_SIZE , cdd->qmgr_mem +QMGR_LRAM_SIZE );cppi_writel (0 , cdd->qmgr_mem +QMGR_LRAM1_BASE ); -cppi_writel (USBSS_IRQ_PD_COMP , cdd->usbss_mem +USBSS_IRQ_ENABLER ); -return 0 ; }
drivers/usb/musb/musb_dsps.c +71 -2
115 lines not on this page · raw message
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/7 usb: usb: dsps: update device tree bindings
In reply to a message not in the archiveIn order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to define "glue" register's address and size in DT.
Update dsps device tree bindings.
--- Documentation/devicetree/bindings/usb/am33xx-usb.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/usb/am33xx-usb.txt +4 -5
@@ -54,9 +54,9 @@ node. DMA ~~~ - compatible: ti,am3359-cppi41 -- reg: offset and length of the following register spaces: USBSS, USB +- reg: offset and length of the following register spaces: USB CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager -- reg-names: glue, controller, scheduler, queuemgr +- reg-names: controller, scheduler, queuemgr - #dma-cells: should be set to 2. The first number represents the endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29 for endpoints 1 … 15 on instance 1). The second number is 0 for RX and
@@ -183,11 +183,10 @@ usb: usb@47400000 { cppi41dma: dma-controller@07402000 { compatible = "ti,am3359-cppi41"; - reg = <0x47400000 0x1000 - 0x47402000 0x1000 + reg = <0x47402000 0x1000 0x47403000 0x1000 0x47404000 0x4000>; - reg-names = "glue", "controller", "scheduler", "queuemgr"; + reg-names = "controller", "scheduler", "queuemgr"; interrupts = <17>; interrupt-names = "glue"; #dma-cells = <2>;
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/7 dmaengine: cppi41: Remove usbss_mem
In reply to a message not in the archiveIn order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to map the "glue" register's.
Remove usbss_mem.
--- drivers/dma/cppi41.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/dma/cppi41.c +4 -8
@@ -131,7 +131,6 @@ struct cppi41_dd {u32 first_td_desc;struct cppi41_channel *chan_busy[ALLOC_DECS_NUM ]; -void __iomem *usbss_mem;void __iomem *ctrl_mem;void __iomem *sched_mem;void __iomem *qmgr_mem;
@@ -999,16 +998,15 @@ static int cppi41_dma_probe(struct platform_device *pdev)INIT_LIST_HEAD (&cdd->ddev.channels); cpp41_dma_info.dma_cap = cdd->ddev.cap_mask; - cdd->usbss_mem =of_iomap (dev->of_node,0 ); - cdd->ctrl_mem =of_iomap (dev->of_node,1 ); - cdd->sched_mem =of_iomap (dev->of_node,2 ); - cdd->qmgr_mem =of_iomap (dev->of_node,3 ); + cdd->ctrl_mem =of_iomap (dev->of_node,0 ); + cdd->sched_mem =of_iomap (dev->of_node,1 ); + cdd->qmgr_mem =of_iomap (dev->of_node,2 );spin_lock_init (&cdd->lock);INIT_LIST_HEAD (&cdd->pending);platform_set_drvdata (pdev, cdd); -if (!cdd->usbss_mem || !cdd->ctrl_mem || !cdd->sched_mem || +if (!cdd->ctrl_mem || !cdd->sched_mem || !cdd->qmgr_mem)return -ENXIO ;
@@ -1068,7 +1066,6 @@ static int cppi41_dma_probe(struct platform_device *pdev) err_get_sync:pm_runtime_put_sync (dev);pm_runtime_disable (dev); -iounmap (cdd->usbss_mem);iounmap (cdd->ctrl_mem);iounmap (cdd->sched_mem);iounmap (cdd->qmgr_mem);
@@ -1090,7 +1087,6 @@ static int cppi41_dma_remove(struct platform_device *pdev)devm_free_irq (&pdev->dev, cdd->irq, cdd);cleanup_chans (cdd);deinit_cppi41 (&pdev->dev, cdd); -iounmap (cdd->usbss_mem);iounmap (cdd->ctrl_mem);iounmap (cdd->sched_mem);iounmap (cdd->qmgr_mem);
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/7 dmaengine: cppi41: rename platform variables
In reply to a message not in the archiveCurrently, only the AM335x is supported by the driver. Though the driver has a glue layer to support different platforms, some platform variable names are not prefixed with the platform name. To facilitate the addition of a new platform,
rename some variables owned by the AM335x glue.
--- drivers/dma/cppi41.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/dma/cppi41.c +9 -8
@@ -147,7 +147,7 @@ struct cppi41_dd { };#define FIST_COMPLETION_QUEUE 93 -static struct chan_queues usb_queues_tx[] = { +static struct chan_queues am335x_usb_queues_tx[] = {/* USB0 ENDP 1 */ [0 ] = { .submit =32 , .complete =93 }, [1 ] = { .submit =34 , .complete =94 },
@@ -183,7 +183,7 @@ static struct chan_queues usb_queues_tx[] = { [29] = { .submit = 90, .complete = 139}, }; -static const struct chan_queues usb_queues_rx[] = { +static const struct chan_queues am335x_usb_queues_rx[] = {/* USB0 ENDP 1 */ [0 ] = { .submit =1 , .complete =109 }, [1 ] = { .submit =2 , .complete =110 },
@@ -910,8 +910,9 @@ static bool cpp41_dma_filter_fn(struct dma_chan *chan, void *param)else queues = cdd->queues_rx; -BUILD_BUG_ON (ARRAY_SIZE (usb_queues_rx) !=ARRAY_SIZE (usb_queues_tx)); -if (WARN_ON (cchan->port_num >ARRAY_SIZE (usb_queues_rx))) +BUILD_BUG_ON (ARRAY_SIZE (am335x_usb_queues_rx) != +ARRAY_SIZE (am335x_usb_queues_tx)); +if (WARN_ON (cchan->port_num >ARRAY_SIZE (am335x_usb_queues_rx)))return false; cchan->q_num = queues[cchan->port_num].submit;
@@ -939,15 +940,15 @@ static struct dma_chan *cppi41_dma_xlate(struct of_phandle_args *dma_spec, &dma_spec->args[0]); } -static const struct cppi_glue_infos usb_infos = { +static const struct cppi_glue_infos am335x_usb_infos = { .isr = cppi41_irq, - .queues_rx = usb_queues_rx, - .queues_tx = usb_queues_tx, + .queues_rx = am335x_usb_queues_rx, + .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit =31 , .complete =0 }, };static const struct of_device_id cppi41_dma_ids[] = { - { .compatible ="ti,am3359-cppi41" , .data = &usb_infos}, + { .compatible ="ti,am3359-cppi41" , .data = &am335x_usb_infos}, {}, };MODULE_DEVICE_TABLE (of, cppi41_dma_ids);
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 5/7 dmaengine: cppi41: Move some constants to glue layer
In reply to a message not in the archiveSome constants are defined and use by the driver whereas they are specifics to AM335x.
Add new variables to the glue layer, initialize them with the constants, and use them in the driver.
--- drivers/dma/cppi41.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/dma/cppi41.c +14 -6
@@ -68,7 +68,6 @@#define QMGR_MEMCTRL_IDX_SH 16#define QMGR_MEMCTRL_DESC_SH 8 -#define QMGR_NUM_PEND 5#define QMGR_PEND (x) (0x90 + (x) * 4)#define QMGR_PENDING_SLOT_Q (x) (x / 32)
@@ -138,6 +137,8 @@ struct cppi41_dd {const struct chan_queues *queues_rx;const struct chan_queues *queues_tx;struct chan_queues td_queue; +u16 first_completion_queue; +u16 qmgr_num_pend;struct list_head pending;/* Pending queued transfers */ spinlock_t lock;/* Lock for pending list */
@@ -146,7 +147,6 @@ struct cppi41_dd {unsigned int dma_tdfdq; }; -#define FIST_COMPLETION_QUEUE 93static struct chan_queues am335x_usb_queues_tx[] = {/* USB0 ENDP 1 */ [0 ] = { .submit =32 , .complete =93 },
@@ -224,6 +224,8 @@ struct cppi_glue_infos {const struct chan_queues *queues_rx;const struct chan_queues *queues_tx;struct chan_queues td_queue; +u16 first_completion_queue; +u16 qmgr_num_pend; };static struct cppi41_channel *to_cpp41_chan (struct dma_chan *c)
@@ -278,19 +280,21 @@ static u32 cppi41_pop_desc(struct cppi41_dd *cdd, unsigned queue_num)static irqreturn_t cppi41_irq (int irq,void *data) {struct cppi41_dd *cdd = data; +u16 first_completion_queue = cdd->first_completion_queue; +u16 qmgr_num_pend = cdd->qmgr_num_pend;struct cppi41_channel *c;int i; -for (i =QMGR_PENDING_SLOT_Q (FIST_COMPLETION_QUEUE ); i <QMGR_NUM_PEND ; +for (i =QMGR_PENDING_SLOT_Q (first_completion_queue); i < qmgr_num_pend; i++) {u32 val;u32 q_num; val =cppi_readl (cdd->qmgr_mem +QMGR_PEND (i)); -if (i ==QMGR_PENDING_SLOT_Q (FIST_COMPLETION_QUEUE ) && val) { +if (i ==QMGR_PENDING_SLOT_Q (first_completion_queue) && val) {u32 mask;/* set corresponding bit for completetion Q 93 */ - mask =1 <<QMGR_PENDING_BIT_Q (FIST_COMPLETION_QUEUE ); + mask =1 <<QMGR_PENDING_BIT_Q (first_completion_queue);/* not set all bits for queues less than Q 93 */ mask--;/* now invert and keep only Q 93+ set */
@@ -862,7 +866,7 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd)return -ENOMEM ;cppi_writel (cdd->scratch_phys, cdd->qmgr_mem +QMGR_LRAM0_BASE ); -cppi_writel (QMGR_SCRATCH_SIZE , cdd->qmgr_mem +QMGR_LRAM_SIZE ); +cppi_writel (TOTAL_DESCS_NUM , cdd->qmgr_mem +QMGR_LRAM_SIZE );cppi_writel (0 , cdd->qmgr_mem +QMGR_LRAM1_BASE ); ret =init_descs (dev, cdd);
@@ -945,6 +949,8 @@ static const struct cppi_glue_infos am335x_usb_infos = { .queues_rx = am335x_usb_queues_rx, .queues_tx = am335x_usb_queues_tx, .td_queue = { .submit = 31, .complete = 0 }, + .first_completion_queue = 93, + .qmgr_num_pend = 5, };static const struct of_device_id cppi41_dma_ids[] = {
@@ -1021,6 +1027,8 @@ static int cppi41_dma_probe(struct platform_device *pdev) cdd->queues_rx = glue_info->queues_rx; cdd->queues_tx = glue_info->queues_tx; cdd->td_queue = glue_info->td_queue; + cdd->qmgr_num_pend = glue_info->qmgr_num_pend; + cdd->first_completion_queue = glue_info->first_completion_queue; ret =init_cppi41 (dev, cdd);if (ret)
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 6/7 dmaengine: cppi41: init_sched(): Get number of channels from DT
In reply to a message not in the archiveDespite the driver is already using DT to get the number of channels, init_sched() is using an hardcoded value to get it.
Use DT to get the number of channels.
--- drivers/dma/cppi41.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/dma/cppi41.c +20 -13
@@ -139,6 +139,8 @@ struct cppi41_dd {struct chan_queues td_queue;u16 first_completion_queue;u16 qmgr_num_pend; +u32 n_chans; +u8 platform;struct list_head pending;/* Pending queued transfers */ spinlock_t lock;/* Lock for pending list */
@@ -720,13 +722,8 @@ static int cppi41_add_chans(struct device *dev, struct cppi41_dd *cdd) {struct cppi41_channel *cchan;int i; -int ret; -u32 n_chans; +u32 n_chans = cdd->n_chans; - ret =of_property_read_u32 (dev->of_node,"#dma-channels" , - &n_chans); -if (ret) -return ret;/* * The channels can only be used as TX or as RX. So we add twice * that much dma channels because USB can only do RX or TX.
@@ -832,7 +829,7 @@ static int init_descs(struct device *dev, struct cppi41_dd *cdd)return 0 ; } -static void init_sched (struct cppi41_dd *cdd) +static int init_sched (struct device *dev,struct cppi41_dd *cdd) {unsigned ch;unsigned word;
@@ -840,7 +837,7 @@ static void init_sched(struct cppi41_dd *cdd) word =0 ;cppi_writel (0 , cdd->sched_mem +DMA_SCHED_CTRL ); -for (ch =0 ; ch <15 *2 ; ch +=2 ) { +for (ch =0 ; ch < cdd->n_chans; ch +=2 ) { reg =SCHED_ENTRY0_CHAN (ch); reg |=SCHED_ENTRY1_CHAN (ch) |SCHED_ENTRY1_IS_RX ;
@@ -850,9 +847,11 @@ static void init_sched(struct cppi41_dd *cdd)cppi_writel (reg, cdd->sched_mem +DMA_SCHED_WORD (word)); word++; } - reg =15 *2 *2 -1 ; + reg = cdd->n_chans *2 -1 ; reg |=DMA_SCHED_CTRL_EN ;cppi_writel (reg, cdd->sched_mem +DMA_SCHED_CTRL ); + +return 0 ; }static int init_cppi41 (struct device *dev,struct cppi41_dd *cdd)
@@ -871,12 +870,14 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) ret =init_descs (dev, cdd);if (ret) - goto err_td; + goto deinit;cppi_writel (cdd->td_queue.submit, cdd->ctrl_mem +DMA_TDFDQ ); -init_sched (cdd); + ret =init_sched (dev, cdd); +if (ret) + goto deinit;return 0 ; -err_td: +deinit:deinit_cppi41 (dev, cdd);return ret; }
@@ -1030,6 +1031,11 @@ static int cppi41_dma_probe(struct platform_device *pdev) cdd->qmgr_num_pend = glue_info->qmgr_num_pend; cdd->first_completion_queue = glue_info->first_completion_queue; + ret =of_property_read_u32 (dev->of_node, +"#dma-channels" , &cdd->n_chans); +if (ret) + goto err_get_n_chans; + ret =init_cppi41 (dev, cdd);if (ret) goto err_init_cppi;
@@ -1072,6 +1078,7 @@ static int cppi41_dma_probe(struct platform_device *pdev)deinit_cppi41 (dev, cdd); err_init_cppi:pm_runtime_dont_use_autosuspend (dev); +err_get_n_chans: err_get_sync:pm_runtime_put_sync (dev);pm_runtime_disable (dev);
@@ -1128,7 +1135,7 @@ static int __maybe_unused cppi41_resume(struct device *dev)if (!c->is_tx)cppi_writel (c->q_num, c->gcr_reg +RXHPCRA0 ); -init_sched (cdd); +init_sched (dev, cdd);cppi_writel (cdd->dma_tdfdq, cdd->ctrl_mem +DMA_TDFDQ );cppi_writel (cdd->scratch_phys, cdd->qmgr_mem +QMGR_LRAM0_BASE );
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/7 dmaengine: cppi41: Fix a race between PM runtime and channel abort
In reply to a message not in the archivecppi41_dma_issue_pending() may be called while the device is runtime suspended. In that case, the descriptor will be pushed to the pending list and then be queued to hardware queue.
But if cppi41_stop_chan() is called before the device got time to resume, then the descriptor will remain in the pending list and be queued to hardware queue after the teardown.
During the channel stop, check if there is a pending descriptor and if so, remove it.
--- drivers/dma/cppi41.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/cppi41.c +9 -1
@@ -687,10 +687,17 @@ static int cppi41_stop_chan(struct dma_chan *chan) {struct cppi41_channel *c =to_cpp41_chan (chan);struct cppi41_dd *cdd = c->cdd; +unsigned long flags;u32 desc_num;u32 desc_phys;int ret; +/* Remove pending descriptor that haven't been pushed to queue */ +spin_lock_irqsave (&cdd->lock, flags); +if (!list_empty (&c->node)) +list_del_init (&c->node); +spin_unlock_irqrestore (&cdd->lock, flags); + desc_phys =lower_32_bits (c->desc_phys); desc_num = (desc_phys - cdd->descs_phys) /sizeof (struct cppi41_desc );if (!cdd->chan_busy[desc_num])
@@ -748,6 +755,7 @@ static int cppi41_add_chans(struct device *dev, struct cppi41_dd *cdd) cchan->desc_phys = cdd->descs_phys; cchan->desc_phys += i *sizeof (struct cppi41_desc ); cchan->chan.device = &cdd->ddev; +INIT_LIST_HEAD (&cchan->node);list_add_tail (&cchan->chan.device_node, &cdd->ddev.channels); } cdd->first_td_desc = n_chans;
@@ -1163,7 +1171,7 @@ static int __maybe_unused cppi41_runtime_resume(struct device *dev)spin_lock_irqsave (&cdd->lock, flags);list_for_each_entry_safe (c, _c, &cdd->pending, node) {push_desc_queue (c); -list_del (&c->node); +list_del_init (&c->node); }spin_unlock_irqrestore (&cdd->lock, flags);
Signature · 6 lines
2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Alexandre Bailon
Most of the patch of this series were part of "[PATCH 00/11] dmaengine: cppi41: Add dma support to da8xx"
This series intend to make the CPPI 4.1 more generic in order to add a new platform (the DA8xx).
To achieve that, all the IRQ code present in CPPI 4.1 driver has been moved to MUSB DSPS driver.
Other changes mainly update the glue layer and platform code to make the whole driver more generic.
So does da8xx use CPPI 4.1 DMA for other devices also in addition to musb?
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Tony Lindgren
Quoted 9 lines
Most of the patch of this series were part of "[PATCH 00/11] dmaengine: cppi41: Add dma support to da8xx"
This series intend to make the CPPI 4.1 more generic in order to add a new platform (the DA8xx).
To achieve that, all the IRQ code present in CPPI 4.1 driver has been moved to MUSB DSPS driver.
Other changes mainly update the glue layer and platform code to make the whole driver more generic.
Quoted 2 lines
So does da8xx use CPPI 4.1 DMA for other devices also in addition to musb?
No. DA8xx CPPI 4.1 is implemented as a part of the MUSB peripheral.
But there were a SoC (support for which never got merged upstream) where CPPI 4.1 DMA is not limited to USB.
Quoted 3 lines
Regards,
Tony
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · Sergei Shtylyov
Quoted 10 lines · Tony Lindgren
Quoted 9 lines
Most of the patch of this series were part of "[PATCH 00/11] dmaengine: cppi41: Add dma support to da8xx"
This series intend to make the CPPI 4.1 more generic in order to add a new platform (the DA8xx).
To achieve that, all the IRQ code present in CPPI 4.1 driver has been moved to MUSB DSPS driver.
Other changes mainly update the glue layer and platform code to make the whole driver more generic.
Quoted 6 lines
Quoted 2 lines
So does da8xx use CPPI 4.1 DMA for other devices also in addition to musb?
No. DA8xx CPPI 4.1 is implemented as a part of the MUSB peripheral.
But there were a SoC (support for which never got merged upstream) where CPPI 4.1 DMA is not limited to USB.
OK thanks for confirming it may pop up in some other devices too.
Anyways that means we can make the cppi41.c runtime PM support simpler as it's always guaranteed to be enabled when in use with musb.
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Sergei Shtylyov
Quoted 10 lines
Quoted 9 lines
Most of the patch of this series were part of "[PATCH 00/11] dmaengine: cppi41: Add dma support to da8xx"
This series intend to make the CPPI 4.1 more generic in order to add a new platform (the DA8xx).
To achieve that, all the IRQ code present in CPPI 4.1 driver has been moved to MUSB DSPS driver.
Other changes mainly update the glue layer and platform code to make the whole driver more generic.
Quoted 6 lines
Quoted 2 lines
So does da8xx use CPPI 4.1 DMA for other devices also in addition to musb?
No. DA8xx CPPI 4.1 is implemented as a part of the MUSB peripheral.
But there were a SoC (support for which never got merged upstream) where CPPI 4.1 DMA is not limited to USB.
FWIW, the SoC was called TI Puma5, the support for it was filed by TI intoarch/arm/mach-avalanche/...
Quoted 3 lines
Quoted 3 lines
Regards,
Tony
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] dmaengine: cppi41: init_sched(): Get number of channels from DT
In reply to a message not in the archiveQuoted 13 lines · Alexandre Bailon
Despite the driver is already using DT to get the number of channels,
init_sched()is using an hardcoded value to get it.
Use DT to get the number of channels.--- drivers/dma/cppi41.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)drivers/dma/cppi41.c +0
-0
[...]
Quoted 9 lines
drivers/dma/cppi41.c +1
-1@@ -832,7 +829,7 @@ static int init_descs(struct device *dev, struct cppi41_dd *cdd)return 0 ; } -static void init_sched (struct cppi41_dd *cdd) +static int init_sched (struct device *dev,struct cppi41_dd *cdd) {unsigned ch;unsigned word;
[...]
Quoted 14 lines
drivers/dma/cppi41.c +3
-1@@ -850,9 +847,11 @@ static void init_sched(struct cppi41_dd *cdd)cppi_writel (reg, cdd->sched_mem +DMA_SCHED_WORD (word)); word++; } - reg =15 *2 *2 -1 ; + reg = cdd->n_chans *2 -1 ; reg |=DMA_SCHED_CTRL_EN ;cppi_writel (reg, cdd->sched_mem +DMA_SCHED_CTRL ); + +return 0 ; }static int init_cppi41 (struct device *dev,struct cppi41_dd *cdd)
drivers/dma/cppi41.c static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) · line 877
Quoted 10 lines
drivers/dma/cppi41.c +3
-2@@ -871,12 +870,14 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) ret =init_descs (dev, cdd);if (ret) - goto err_td; + goto deinit;cppi_writel (cdd->td_queue.submit, cdd->ctrl_mem +DMA_TDFDQ ); -init_sched (cdd); + ret =init_sched (dev, cdd); +if (ret)
What's the point if init_sched() always returns 0?
[...]
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
kbuild test robot
build botRe: [PATCH v2 1/7] usb: musb: dsps: Manage CPPI 4.1 DMA interrupt in dsps
In reply to a message not in the archiveurl: https://github.com/0day-ci/linux/commits/Alexandre-Bailon/dmaengine-cppi41-Make-CPPI-4-1-driver-more-generic/20170118-002219 config: xtensa-allmodconfig (attached as .config) compiler…
Hi Alexandre,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc4 next-20170117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Alexandre-Bailon/dmaengine-cppi41-Make-CPPI-4-1-driver-more-generic/20170118-002219
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All error/warnings (new ones prefixed by >>):
drivers/usb/musb/musb_dsps.c: In function 'dsps_dma_controller_create':
>> drivers/usb/musb/musb_dsps.c:642:3: error: implicit declaration of function 'cppi41_register_dma_callback' [-Werror=implicit-function-declaration]
cppi41_register_dma_callback(controller,
^
drivers/usb/musb/musb_dsps.c: In function 'dsps_dma_controller_destroy':
>> drivers/usb/musb/musb_dsps.c:651:9: error: implicit declaration of function 'cppi41_dma_controller_to_musb' [-Werror=implicit-function-declaration]
struct musb *musb = cppi41_dma_controller_to_musb(c);
^
>> drivers/usb/musb/musb_dsps.c:651:22: warning: initialization makes pointer from integer without a cast
struct musb *musb = cppi41_dma_controller_to_musb(c);
^ drivers/usb/musb/musb_dsps.c: At top level:
drivers/usb/musb/musb_dsps.c:633:1: warning: 'dsps_dma_controller_create' defined but not used [-Wunused-function]
dsps_dma_controller_create(struct musb *musb, void __iomem *base)
^
drivers/usb/musb/musb_dsps.c:649:13: warning: 'dsps_dma_controller_destroy' defined but not used [-Wunused-function]
static void dsps_dma_controller_destroy(struct dma_controller *c)
^
drivers/usb/musb/musb_dsps.c:659:13: warning: 'dsps_dma_controller_suspend' defined but not used [-Wunused-function]
static void dsps_dma_controller_suspend(struct dsps_glue *glue)
^
drivers/usb/musb/musb_dsps.c:666:13: warning: 'dsps_dma_controller_resume' defined but not used [-Wunused-function]
static void dsps_dma_controller_resume(struct dsps_glue *glue)
^
cc1: some warnings being treated as errors
vim +/cppi41_register_dma_callback +642 drivers/usb/musb/musb_dsps.c
636 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
637 void __iomem *usbss_base = glue->usbss_base;
638
639 controller = cppi41_dma_controller_create(musb, base);
640 if (!IS_ERR_OR_NULL(controller)) {
641 musb_writel(usbss_base, USBSS_IRQ_ENABLER, USBSS_IRQ_PD_COMP);
> 642 cppi41_register_dma_callback(controller,
643 dsps_dma_controller_callback);
644 }
645
646 return controller;
647 }
648
649 static void dsps_dma_controller_destroy(struct dma_controller *c)
650 {
> 651 struct musb *musb = cppi41_dma_controller_to_musb(c); 652 struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
653 void __iomem *usbss_base = glue->usbss_base;
654
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v2 6/7] dmaengine: cppi41: init_sched(): Get number of channels from DT
In reply to a message not in the archiveQuoted 48 lines · Sergei Shtylyov
Quoted 13 lines · Alexandre Bailon
Despite the driver is already using DT to get the number of channels,
init_sched()is using an hardcoded value to get it.
Use DT to get the number of channels.--- drivers/dma/cppi41.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)drivers/dma/cppi41.c +0
-0[...]
Quoted 10 lines
drivers/dma/cppi41.c +1
-1@@ -832,7 +829,7 @@ static int init_descs(struct device *dev, struct cppi41_dd *cdd)return 0 ; } -static void init_sched (struct cppi41_dd *cdd) +static int init_sched (struct device *dev,struct cppi41_dd *cdd) {unsigned ch;unsigned word;[...]
Quoted 21 lines
drivers/dma/cppi41.c +4
-2@@ -850,9 +847,11 @@ static void init_sched(struct cppi41_dd *cdd)cppi_writel (reg, cdd->sched_mem +DMA_SCHED_WORD (word)); word++; } - reg =15 *2 *2 -1 ; + reg = cdd->n_chans *2 -1 ; reg |=DMA_SCHED_CTRL_EN ;cppi_writel (reg, cdd->sched_mem +DMA_SCHED_CTRL ); + +return 0 ; }static int init_cppi41 (struct device *dev,struct cppi41_dd *cdd)@@ -871,12 +870,14 @@ static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) ret =init_descs (dev, cdd);if (ret) - goto err_td; + goto deinit;
Quoted 6 lines
drivers/dma/cppi41.c static int init_cppi41(struct device *dev, struct cppi41_dd *cdd) · line 877
Quoted 4 lines
drivers/dma/cppi41.c +2
-1cppi_writel (cdd->td_queue.submit, cdd->ctrl_mem +DMA_TDFDQ ); -init_sched (cdd); + ret =init_sched (dev, cdd); +if (ret)What's the point if
init_sched()always returns 0?
In older version of this patch, I was able to return non zero in case of error.
I will fix it.
Best Regards,
Alexandre
Quoted 5 lines
[...]
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/7] usb: usb: dsps: update device tree bindings
In reply to a message not in the archiveQuoted 4 lines · Alexandre Bailon
In order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to define "glue" register's address and size in DT.
Update dsps device tree bindings.
Looks like you are breaking compatibility here.
Are the glue registers already in the USB node? If so, then the DMA driver just needs to ignore the first reg entry when 4 entries are present. Or add a fixup to the DT somewhere.
Quoted 39 lines
--- Documentation/devicetree/bindings/usb/am33xx-usb.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/usb/am33xx-usb.txt +4
-5@@ -54,9 +54,9 @@ node. DMA ~~~ - compatible: ti,am3359-cppi41 -- reg: offset and length of the following register spaces: USBSS, USB +- reg: offset and length of the following register spaces: USB CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager -- reg-names: glue, controller, scheduler, queuemgr +- reg-names: controller, scheduler, queuemgr - #dma-cells: should be set to 2. The first number represents the endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29 for endpoints 1 … 15 on instance 1). The second number is 0 for RX and@@ -183,11 +183,10 @@ usb: usb@47400000 { cppi41dma: dma-controller@07402000 { compatible = "ti,am3359-cppi41"; - reg = <0x47400000 0x1000 - 0x47402000 0x1000 + reg = <0x47402000 0x1000 0x47403000 0x1000 0x47404000 0x4000>; - reg-names = "glue", "controller", "scheduler", "queuemgr"; + reg-names = "controller", "scheduler", "queuemgr"; interrupts = <17>; interrupt-names = "glue"; #dma-cells = <2>;Signature · 1 line
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/7] usb: usb: dsps: update device tree bindings
Quoted 11 lines · Rob Herring
Quoted 4 lines · Alexandre Bailon
In order to make CPPI 4.1 DMA driver more generic, accesses to USBSS have been removed. So it is not required anymore to define "glue" register's address and size in DT.
Update dsps device tree bindings.Looks like you are breaking compatibility here.
Are the glue registers already in the USB node? If so, then the DMA driver just needs to ignore the first reg entry when 4 entries are present. Or add a fixup to the DT somewhere.
In the v3 of the patch updating the driver, I have the made the driver compatible with the old and new bindings.
It gets the index of "controller" and so just ignore "glue" if it defined.
Best Regards,
Alexandre
Quoted 25 lines
Quoted 25 lines
--- Documentation/devicetree/bindings/usb/am33xx-usb.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)Documentation/devicetree/bindings/usb/am33xx-usb.txt +2
-2@@ -54,9 +54,9 @@ node. DMA ~~~ - compatible: ti,am3359-cppi41 -- reg: offset and length of the following register spaces: USBSS, USB +- reg: offset and length of the following register spaces: USB CPPI DMA Controller, USB CPPI DMA Scheduler, USB Queue Manager -- reg-names: glue, controller, scheduler, queuemgr +- reg-names: controller, scheduler, queuemgr - #dma-cells: should be set to 2. The first number represents the endpoint number (0 … 14 for endpoints 1 … 15 on instance 0 and 15 … 29 for endpoints 1 … 15 on instance 1). The second number is 0 for RX and@@ -183,11 +183,10 @@ usb: usb@47400000 {
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/usb/am33xx-usb.txt +2
-3cppi41dma: dma-controller@07402000 { compatible = "ti,am3359-cppi41"; - reg = <0x47400000 0x1000 - 0x47402000 0x1000 + reg = <0x47402000 0x1000 0x47403000 0x1000 0x47404000 0x4000>; - reg-names = "glue", "controller", "scheduler", "queuemgr"; + reg-names = "controller", "scheduler", "queuemgr"; interrupts = <17>; interrupt-names = "glue"; #dma-cells = <2>;Signature · 1 line
2.10.2
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html