remoteproc: Change typo FW_CONFIG to FW_LOADER for REMOTEPROC
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ohad Ben-Cohen
AppliedPATCH v9 2/6 remoteproc: Change typo FW_CONFIG to FW_LOADER for REMOTEPROC
Quoted 4 lines · Robert Tivy
Fix obvious typo introduced in commit
e121aefa7d9f10eee5cf26ed47129237a05d940b("remoteproc: fix missingCONFIG_FW_LOADERconfigurations").Signed-off-by Robert Tivy <[email protected]>
Applied, thanks.
BTW - we don't usually want to directly cc stable at vger.kernel.org. Instead we just add a Cc tag in the commit log (fixed before applying).
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v9 3/6 remoteproc: Add support to rproc_alloc() for a default firmware name
Quoted 1 line · Robert Tivy
Signed-off-by Robert Tivy <[email protected]>
Applied with the following changes:
- add commit log
- document change in function description
- use snprintf instead
- minor style change
Thanks!
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v9 1/6 rpmsg: Process all available messages in virtqueue callback
Quoted 4 lines · Robert Tivy
Change virtqueue callback function
rpmsg_recv_done()to process all available messages instead of just one message.Signed-off-by Robert Tivy <[email protected]>
I'm thinking instead of adding an indentation level, let's split the _recv function.
This is what I have in mind - let me know if it works for you - thanks:
drivers/rpmsg/virtio_rpmsg_bus.c +33 -14
@@ -776,22 +776,11 @@ out: }EXPORT_SYMBOL (rpmsg_send_offchannel_raw); -/* called when an rx buffer is used, and it's time to digest a message */ -static void rpmsg_recv_done (struct virtqueue *rvq) +static int rpmsg_recv_single (struct virtproc_info *vrp,struct device *dev, +struct rpmsg_hdr *msg,unsigned int len) { -struct rpmsg_hdr *msg; -unsigned int len;struct rpmsg_endpoint *ept;struct scatterlist sg; -struct virtproc_info *vrp = rvq->vdev->priv; -struct device *dev = &rvq->vdev->dev; -int err; - - msg =virtqueue_get_buf (rvq, &len); -if (!msg) { -dev_err (dev,"uhm, incoming signal, but no used buffer ?\n" ); -return ; - } dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", msg->src, msg->dst, msg->len,
@@ -806,7 +795,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)if (len >RPMSG_BUF_SIZE || msg->len > (len -sizeof (struct rpmsg_hdr ))) {dev_warn (dev,"inbound msg too big: (%d, %d)\n" , len, msg->len); -return ; +return -EINVAL ; }/* use the dst addr to fetch the callback of the appropriate user */
@@ -842,9 +831,39 @@ static void rpmsg_recv_done(struct virtqueue *rvq) err =virtqueue_add_buf (vrp->rvq, &sg,0 ,1 , msg,GFP_KERNEL );if (err <0 ) {dev_err (dev,"failed to add a virtqueue buffer: %d\n" , err); +return err; + } + +return 0 ; +} + +/* called when an rx buffer is used, and it's time to digest a message */ +static void rpmsg_recv_done (struct virtqueue *rvq) +{ +struct virtproc_info *vrp = rvq->vdev->priv; +struct device *dev = &rvq->vdev->dev; +struct rpmsg_hdr *msg; +unsigned int len, msgs_received =0 ; +int err; + + msg =virtqueue_get_buf (rvq, &len); +if (!msg) { +dev_err (dev,"uhm, incoming signal, but no used buffer ?\n" );return ; } +while (msg) { + err =rpmsg_recv_single (vrp, dev, msg, len); +if (err) +break ; + + msgs_received++; + + msg =virtqueue_get_buf (rvq, &len); + }; + +dev_dbg (dev,"Received %u messages\n" , msgs_received); +/* tell the remote processor we added another available rx buffer */ virtqueue_kick (vrp->rvq); }
PATCH v9 1/6 rpmsg: Process all available messages in virtqueue callback
Quoted 103 lines
-----Original Message-----
From: Ohad Ben-Cohen [mailto:ohad at wizery.com]
Sent: Sunday, April 07, 2013 5:51 AMQuoted 4 lines · Robert Tivy
Change virtqueue callback function
rpmsg_recv_done()to process all available messages instead of just one message.Signed-off-by Robert Tivy <[email protected]>I'm thinking instead of adding an indentation level, let's split the
_recvfunction.This is what I have in mind - let me know if it works for you - thanks:
drivers/rpmsg/virtio_rpmsg_bus.c +2
-13@@ -776,22 +776,11 @@ out:} EXPORT_SYMBOL(rpmsg_send_offchannel_raw); -/* called when an rx buffer is used, and it's time to digest a message */ -static void rpmsg_recv_done(struct virtqueue *rvq) +static int rpmsg_recv_single (struct virtproc_info *vrp,struct device *dev, +struct rpmsg_hdr *msg,unsigned int len) { -struct rpmsg_hdr *msg; -unsigned int len;struct rpmsg_endpoint *ept;struct scatterlist sg; -struct virtproc_info *vrp = rvq->vdev->priv; -struct device *dev = &rvq->vdev->dev; -int err; - - msg =virtqueue_get_buf (rvq, &len); -if (!msg) { -dev_err (dev,"uhm, incoming signal, but no used buffer ?\n"); -return ; - }dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", msg->src, msg->dst, msg->len,drivers/rpmsg/virtio_rpmsg_bus.c +1
-1@@ -806,7 +795,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)if (len >RPMSG_BUF_SIZE || msg->len > (len -sizeof (struct rpmsg_hdr ))) {dev_warn (dev,"inbound msg too big: (%d, %d)\n" , len, msg->len); -return ; +return -EINVAL ; }/* use the dst addr to fetch the callback of the appropriateuser */
drivers/rpmsg/virtio_rpmsg_bus.c +30
-0@@ -842,9 +831,39 @@ static void rpmsg_recv_done(struct virtqueue *rvq) err =virtqueue_add_buf (vrp->rvq, &sg,0 ,1 , msg,GFP_KERNEL );if (err <0 ) {dev_err (dev,"failed to add a virtqueue buffer: %d\n" , err); +return err; + } + +return 0 ; +} + +/* called when an rx buffer is used, and it's time to digest a message */ +static void rpmsg_recv_done (struct virtqueue *rvq) +{ +struct virtproc_info *vrp = rvq->vdev->priv; +struct device *dev = &rvq->vdev->dev; +struct rpmsg_hdr *msg; +unsigned int len, msgs_received =0 ; +int err; + + msg =virtqueue_get_buf (rvq, &len); +if (!msg) { +dev_err (dev,"uhm, incoming signal, but no used buffer ?\n");return ; } +while (msg) { + err =rpmsg_recv_single (vrp, dev, msg, len); +if (err) +break ; + + msgs_received++; + + msg =virtqueue_get_buf (rvq, &len); + }; + +dev_dbg (dev,"Received %u messages\n" , msgs_received); +/* tell the remote processor we added another available rx buffer */ virtqueue_kick(vrp->rvq);
Quoted 1 line
}
Shouldn't the virtqueue_kick() be called only when we successfully added a buffer with virtqueue_add_buf()?
If so, we should make it:
if (msgs_received) /* tell the remote processor we added another available rx buffer */ virtqueue_kick(vrp->rvp); }
Thanks for the rewrite, looks better. I'll give it a try and let you know how it goes.
Regards,
- Rob
PATCH v9 1/6 rpmsg: Process all available messages in virtqueue callback
Quoted 1 line · Robert
Shouldn't the
virtqueue_kick()be called only when we successfully added a buffer withvirtqueue_add_buf()?
Definitely, thanks for noticing!
Take 2:
drivers/rpmsg/virtio_rpmsg_bus.c +35 -15
@@ -776,22 +776,11 @@ out: }EXPORT_SYMBOL (rpmsg_send_offchannel_raw); -/* called when an rx buffer is used, and it's time to digest a message */ -static void rpmsg_recv_done (struct virtqueue *rvq) +static int rpmsg_recv_single (struct virtproc_info *vrp,struct device *dev, +struct rpmsg_hdr *msg,unsigned int len) { -struct rpmsg_hdr *msg; -unsigned int len;struct rpmsg_endpoint *ept;struct scatterlist sg; -struct virtproc_info *vrp = rvq->vdev->priv; -struct device *dev = &rvq->vdev->dev; -int err; - - msg =virtqueue_get_buf (rvq, &len); -if (!msg) { -dev_err (dev,"uhm, incoming signal, but no used buffer ?\n" ); -return ; - } dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", msg->src, msg->dst, msg->len,
@@ -806,7 +795,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)if (len >RPMSG_BUF_SIZE || msg->len > (len -sizeof (struct rpmsg_hdr ))) {dev_warn (dev,"inbound msg too big: (%d, %d)\n" , len, msg->len); -return ; +return -EINVAL ; }/* use the dst addr to fetch the callback of the appropriate user */
@@ -842,11 +831,42 @@ static void rpmsg_recv_done(struct virtqueue *rvq) err =virtqueue_add_buf (vrp->rvq, &sg,0 ,1 , msg,GFP_KERNEL );if (err <0 ) {dev_err (dev,"failed to add a virtqueue buffer: %d\n" , err); +return err; + } + +return 0 ; +} + +/* called when an rx buffer is used, and it's time to digest a message */ +static void rpmsg_recv_done (struct virtqueue *rvq) +{ +struct virtproc_info *vrp = rvq->vdev->priv; +struct device *dev = &rvq->vdev->dev; +struct rpmsg_hdr *msg; +unsigned int len, msgs_received =0 ; +int err; + + msg =virtqueue_get_buf (rvq, &len); +if (!msg) { +dev_err (dev,"uhm, incoming signal, but no used buffer ?\n" );return ; } +while (msg) { + err =rpmsg_recv_single (vrp, dev, msg, len); +if (err) +break ; + + msgs_received++; + + msg =virtqueue_get_buf (rvq, &len); + }; + +dev_dbg (dev,"Received %u messages\n" , msgs_received); +/* tell the remote processor we added another available rx buffer */ -virtqueue_kick (vrp->rvq); +if (msgs_received) +virtqueue_kick (vrp->rvq); }/*
Quoted 1 line
Thanks for the rewrite, looks better. I'll give it a try and let you know how it goes.
Thanks!
Ohad.
PATCH v9 1/6 rpmsg: Process all available messages in virtqueue callback
Just one small fix needed (see below) and it's good-to-go.
Quoted 25 lines
-----Original Message-----
From: Ohad Ben-Cohen [mailto:ohad at wizery.com]
Sent: Tuesday, April 09, 2013 1:26 AMQuoted 1 line · Robert
Shouldn't the
virtqueue_kick()be called only when we successfullyadded a buffer with
virtqueue_add_buf()?Definitely, thanks for noticing!
Take 2:
drivers/rpmsg/virtio_rpmsg_bus.c +1
-2@@ -776,22 +776,11 @@ out:} EXPORT_SYMBOL(rpmsg_send_offchannel_raw); -/* called when an rx buffer is used, and it's time to digest a message */ -static void rpmsg_recv_done (struct virtqueue *rvq) +static int rpmsg_recv_single(struct virtproc_info *vrp, struct device
drivers/rpmsg/virtio_rpmsg_bus.c out: · line 790
Quoted 10 lines
drivers/rpmsg/virtio_rpmsg_bus.c +1
-5*dev, + struct rpmsg_hdr *msg, unsigned int len) { -struct rpmsg_hdr *msg; -unsigned int len;struct rpmsg_endpoint *ept;struct scatterlist sg; -struct virtproc_info *vrp = rvq->vdev->priv; -struct device *dev = &rvq->vdev->dev; -int err;
This new function also uses an 'int err;', so the above line should not be removed.
Quoted 72 lines
drivers/rpmsg/virtio_rpmsg_bus.c +0
-6- - msg =virtqueue_get_buf (rvq, &len); -if (!msg) { -dev_err (dev,"uhm, incoming signal, but no used buffer ?\n"); -return ; - }dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", msg->src, msg->dst, msg->len,drivers/rpmsg/virtio_rpmsg_bus.c +1
-1@@ -806,7 +795,7 @@ static void rpmsg_recv_done(struct virtqueue *rvq)if (len >RPMSG_BUF_SIZE || msg->len > (len -sizeof (struct rpmsg_hdr ))) {dev_warn (dev,"inbound msg too big: (%d, %d)\n" , len, msg->len); -return ; +return -EINVAL ; }/* use the dst addr to fetch the callback of the appropriateuser */
drivers/rpmsg/virtio_rpmsg_bus.c +30
-0@@ -842,11 +831,42 @@ static void rpmsg_recv_done(struct virtqueue *rvq) err =virtqueue_add_buf (vrp->rvq, &sg,0 ,1 , msg,GFP_KERNEL );if (err <0 ) {dev_err (dev,"failed to add a virtqueue buffer: %d\n" , err); +return err; + } + +return 0 ; +} + +/* called when an rx buffer is used, and it's time to digest a message */ +static void rpmsg_recv_done (struct virtqueue *rvq) +{ +struct virtproc_info *vrp = rvq->vdev->priv; +struct device *dev = &rvq->vdev->dev; +struct rpmsg_hdr *msg; +unsigned int len, msgs_received =0 ; +int err; + + msg =virtqueue_get_buf (rvq, &len); +if (!msg) { +dev_err (dev,"uhm, incoming signal, but no used buffer ?\n");return ; } +while (msg) { + err =rpmsg_recv_single (vrp, dev, msg, len); +if (err) +break ; + + msgs_received++; + + msg =virtqueue_get_buf (rvq, &len); + }; + +dev_dbg (dev,"Received %u messages\n" , msgs_received); +/* tell the remote processor we added another available rx buffer */
drivers/rpmsg/virtio_rpmsg_bus.c +2
-1-virtqueue_kick (vrp->rvq); +if (msgs_received) +virtqueue_kick (vrp->rvq); }/*
Quoted 5 lines
Quoted 1 line
Thanks for the rewrite, looks better. I'll give it a try and let you
know how it goes.
Thanks!
Ohad.
I added the above-mentioned 'int err;' to my tree's rpmsg_recv_single() and tested it out, it worked well. So once that is corrected, you can add:
Regards,
- Rob
PATCH v9 1/6 rpmsg: Process all available messages in virtqueue callback
Quoted 1 line · Robert
This new function also uses an 'int err;', so the above line should not be removed.
Added, thanks!
Quoted 2 lines
I added the above-mentioned 'int err;' to my tree's
rpmsg_recv_single()and tested it out, it worked well. So once that is corrected, you can add:Acked-by Robert Tivy <[email protected]>
No need to add your Acked-by as you are the author :)
Applied - will show up in linux next soon, please check it out there.
Thanks,
Ohad.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
Hi Rob,
On Fri, Mar 29, 2013 at 4:41 AM, Robert Tivy <[email protected]> wrote:> +
Quoted 96 lines
(quoted diff) +96
-0+static int da8xx_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct da8xx_rproc *drproc; + struct rproc *rproc; + struct irq_data *irq_data; + struct resource *bootreg_res; + struct resource *chipsig_res; + struct clk *dsp_clk; + void __iomem *chipsig; + void __iomem *bootreg; + int irq; + int ret; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(dev, "platform_get_irq(pdev, 0) error: %d\n", irq); + return irq; + } + + irq_data = irq_get_irq_data(irq); + if (!irq_data) { + dev_err(dev, "irq_get_irq_data(%d): NULL\n", irq); + return -EINVAL; + } + + bootreg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!bootreg_res) { + dev_err(dev, + "platform_get_resource(IORESOURCE_MEM, 0): NULL\n"); + return -EADDRNOTAVAIL; + } + + chipsig_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!chipsig_res) { + dev_err(dev, + "platform_get_resource(IORESOURCE_MEM, 1): NULL\n"); + return -EADDRNOTAVAIL; + } + + bootreg = devm_request_and_ioremap(dev, bootreg_res); + if (!bootreg) { + dev_err(dev, "unable to map boot register\n"); + return -EADDRNOTAVAIL; + } + + chipsig = devm_request_and_ioremap(dev, chipsig_res); + if (!chipsig) { + dev_err(dev, "unable to map CHIPSIG register\n"); + return -EADDRNOTAVAIL; + } + + dsp_clk = devm_clk_get(dev, NULL); + if (IS_ERR(dsp_clk)) { + dev_err(dev, "clk_get error: %ld\n", PTR_ERR(dsp_clk)); + + return PTR_RET(dsp_clk); + } + + rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name, + sizeof(*drproc)); + if (!rproc) + return -ENOMEM; + + drproc = rproc->priv; + drproc->rproc = rproc; + + platform_set_drvdata(pdev, rproc); + + /* everything the ISR needs is now setup, so hook it up */ + ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback, + handle_event, 0, "da8xx-remoteproc", rproc); + if (ret) { + dev_err(dev, "devm_request_threaded_irq error: %d\n", ret); + goto free_rproc; + } + + /* + * rproc_add() can end up enabling the DSP's clk with the DSP + * *not* in reset, but da8xx_rproc_start() needs the DSP to be + * held in reset at the time it is called. + */ + ret = reset_assert(dev); + if (ret) + goto free_rproc; + + ret = rproc_add(rproc); + if (ret) { + dev_err(dev, "rproc_add failed: %d\n", ret); + goto free_rproc; + } + + drproc->chipsig = chipsig; + drproc->bootreg = bootreg; + drproc->ack_fxn = irq_data->chip->irq_ack; + drproc->irq_data = irq_data;
Review
Quoted 10 lines
(quoted diff) +10
-0+ drproc->irq = irq; + drproc->dsp_clk = dsp_clk; + + return 0; + +free_rproc: + rproc_put(rproc); + + return ret; +}
Two small changes please:
- could you please fix the error path of probe? it seems that some resources are taken but not freed in case a failure shows up subsequently
- seems like it's safer to set drproc before calling rproc_add otherwise you have a small race there
If you could respin this one quickly it'd be great, thanks!
Ohad.
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
Hello.
Quoted 15 lines · Ohad Ben-Cohen
Quoted 15 lines
(quoted diff) +14
-0+static int da8xx_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct da8xx_rproc *drproc; + struct rproc *rproc; + struct irq_data *irq_data; + struct resource *bootreg_res; + struct resource *chipsig_res; + struct clk *dsp_clk; + void __iomem *chipsig; + void __iomem *bootreg; + int irq; + int ret; +
[...]
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ bootreg = devm_request_and_ioremap(dev, bootreg_res); + if (!bootreg) { + dev_err(dev, "unable to map boot register\n"); + return -EADDRNOTAVAIL; + } + + chipsig = devm_request_and_ioremap(dev, chipsig_res);
I suggest that you use more modern (yes, already a newer interface :-)devm_ioremap_resource() instead -- it returns the error code (as a pointer) in case of error, and it certainly doesn't require you to print error messages.
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +4
-0+ if (!chipsig) { + dev_err(dev, "unable to map CHIPSIG register\n"); + return -EADDRNOTAVAIL; + }
WBR, Sergei
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
Hi Sergei,
Quoted 32 lines
-----Original Message-----
From: Sergei Shtylyov [mailto:sergei.shtylyov at cogentembedded.com]
Sent: Sunday, April 07, 2013 10:55 AMHello.
Quoted 15 lines · Ohad Ben-Cohen
Quoted 15 lines
(quoted diff) +14
-0+static int da8xx_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct da8xx_rproc *drproc; + struct rproc *rproc; + struct irq_data *irq_data; + struct resource *bootreg_res; + struct resource *chipsig_res; + struct clk *dsp_clk; + void __iomem *chipsig; + void __iomem *bootreg; + int irq; + int ret; +[...]
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ bootreg = devm_request_and_ioremap(dev, bootreg_res); + if (!bootreg) { + dev_err(dev, "unable to map boot register\n"); + return -EADDRNOTAVAIL; + } + + chipsig = devm_request_and_ioremap(dev, chipsig_res);
Quoted 6 lines
I suggest that you use more modern (yes, already a newer interface
:-)devm_ioremap_resource()instead -- it returns the error code (as a pointer)
in case of error, and it certainly doesn't require you to print error messages.
Thanks, will do.
I appreciate the notice of a more modern function, it's really tough to keep up with the flurry of activity to the kernel.
Regarding this change, should the code use
return PTR_ERR(bootreg); or return PTR_RET(bootreg);
I ask because PTR_ERR() returns 'long' whereas PTR_RET() returns 'int' (and probe returns 'int'), but I see that the majority of existing code uses "return PTR_ERR()" in probe functions.
Quoted 8 lines
Quoted 6 lines
Review
Quoted 6 lines
(quoted diff) +4
-0+ if (!chipsig) { + dev_err(dev, "unable to map CHIPSIG register\n"); + return -EADDRNOTAVAIL; + }WBR, Sergei
Regards,
- Rob
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
Hello.
Quoted 30 lines · Robert
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
(quoted diff) +14
-0+static int da8xx_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct da8xx_rproc *drproc; + struct rproc *rproc; + struct irq_data *irq_data; + struct resource *bootreg_res; + struct resource *chipsig_res; + struct clk *dsp_clk; + void __iomem *chipsig; + void __iomem *bootreg; + int irq; + int ret; +[...]
Quoted 7 lines
Review
Quoted 7 lines
(quoted diff) +7
-0+ bootreg = devm_request_and_ioremap(dev, bootreg_res); + if (!bootreg) { + dev_err(dev, "unable to map boot register\n"); + return -EADDRNOTAVAIL; + } + + chipsig = devm_request_and_ioremap(dev, chipsig_res);Quoted 6 lines
I suggest that you use more modern (yes, already a newer interface
:-)devm_ioremap_resource()instead -- it returns the error code (as a pointer)
in case of error, and it certainly doesn't require you to print error messages.
Quoted 8 lines
Thanks, will do.
I appreciate the notice of a more modern function, it's really tough to keep up with the flurry of activity to the kernel.
Regarding this change, should the code use
return PTR_ERR(bootreg); or return PTR_RET(bootreg);
The former, to avoid duplicate IS_ERR() check.
Quoted 1 line
I ask because
PTR_ERR()returns 'long' whereasPTR_RET()returns 'int' (and probe returns 'int'), but I see that the majority of existing code uses "returnPTR_ERR()" in probe functions.
But PTR_RET() uses PTR_ERR() internally anyway.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (!chipsig) { + dev_err(dev, "unable to map CHIPSIG register\n"); + return -EADDRNOTAVAIL; + }
WBR, Sergei
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
In reply to Ohad Ben-CohenHi Ohad,
Quoted 129 lines
-----Original Message-----
From: Ohad Ben-Cohen [mailto:ohad at wizery.com]
Sent: Sunday, April 07, 2013 6:03 AM
To: Tivy, Robert
Cc: davinci-linux-open-source; linux-arm; Nori, Sekhar; Rob Landley; linux-doc at vger.kernel.org; Grosen, Mark; Ring, Chris
Subject: Re: [PATCH v9 4/6] ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSPHi Rob,
On Fri, Mar 29, 2013 at 4:41 AM, Robert Tivy <[email protected]> wrote:> +
Quoted 7 lines
(quoted diff) +7
-0+static int da8xx_rproc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct da8xx_rproc *drproc; + struct rproc *rproc; + struct irq_data *irq_data; + struct resource *bootreg_res;Review
Quoted 10 lines
(quoted diff) +10
-0+ struct resource *chipsig_res; + struct clk *dsp_clk; + void __iomem *chipsig; + void __iomem *bootreg; + int irq; + int ret; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(dev, "platform_get_irq(pdev, 0) error: %d\n",irq);
Review
Quoted 13 lines
(quoted diff) +13
-0+ return irq; + } + + irq_data = irq_get_irq_data(irq); + if (!irq_data) { + dev_err(dev, "irq_get_irq_data(%d): NULL\n", irq); + return -EINVAL; + } + + bootreg_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!bootreg_res) { + dev_err(dev, + "platform_get_resource(IORESOURCE_MEM, 0):NULL\n");
Review
Quoted 7 lines
(quoted diff) +7
-0+ return -EADDRNOTAVAIL; + } + + chipsig_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!chipsig_res) { + dev_err(dev, + "platform_get_resource(IORESOURCE_MEM, 1):NULL\n");
Quoted 8 lines
(quoted diff) +8
-0+ return -EADDRNOTAVAIL; + } + + bootreg = devm_request_and_ioremap(dev, bootreg_res); + if (!bootreg) { + dev_err(dev, "unable to map boot register\n"); + return -EADDRNOTAVAIL; + }Review
Quoted 10 lines
(quoted diff) +10
-0+ + chipsig = devm_request_and_ioremap(dev, chipsig_res); + if (!chipsig) { + dev_err(dev, "unable to map CHIPSIG register\n"); + return -EADDRNOTAVAIL; + } + + dsp_clk = devm_clk_get(dev, NULL); + if (IS_ERR(dsp_clk)) { + dev_err(dev, "clk_get error: %ld\n",
PTR_ERR(dsp_clk));Review
Quoted 5 lines
(quoted diff) +5
-0+ + return PTR_RET(dsp_clk); + } + + rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops,
da8xx_fw_name,Review
Quoted 11 lines
(quoted diff) +11
-0+ sizeof(*drproc)); + if (!rproc) + return -ENOMEM; + + drproc = rproc->priv; + drproc->rproc = rproc; + + platform_set_drvdata(pdev, rproc); + + /* everything the ISR needs is now setup, so hook it up */ + ret = devm_request_threaded_irq(dev, irq,
da8xx_rproc_callback,Review
Quoted 3 lines
(quoted diff) +3
-0+ handle_event, 0, "da8xx-remoteproc", rproc); + if (ret) { + dev_err(dev, "devm_request_threaded_irq error: %d\n",ret);
Review
Quoted 6 lines
(quoted diff) +6
-0+ goto free_rproc; + } + + /* + * rproc_add() can end up enabling the DSP's clk with the DSP + * *not* in reset, but da8xx_rproc_start() needs the DSP tobe
Quoted 16 lines
(quoted diff) +16
-0+ * held in reset at the time it is called. + */ + ret = reset_assert(dev); + if (ret) + goto free_rproc; + + ret = rproc_add(rproc); + if (ret) { + dev_err(dev, "rproc_add failed: %d\n", ret); + goto free_rproc; + } + + drproc->chipsig = chipsig; + drproc->bootreg = bootreg; + drproc->ack_fxn = irq_data->chip->irq_ack; + drproc->irq_data = irq_data;Review
Quoted 10 lines
(quoted diff) +10
-0+ drproc->irq = irq; + drproc->dsp_clk = dsp_clk; + + return 0; + +free_rproc: + rproc_put(rproc); + + return ret; +}Two small changes please:
Quoted 3 lines
- could you please fix the error path of probe? it seems that some resources are taken but not freed in case a failure shows up subsequently
I'm not sure what resources you mean?
The platform_get_irq()/irq_get_irq_data()/platform_get_resource() calls don't have "put" counterparts. The "devm_*" calls get automatically cleaned up (and I wasn't able to find any existing example of some code that actually does the cleanup explicitly).
Quoted 2 lines
- seems like it's safer to set drproc before calling
rproc_addotherwise you have a small race there
Agreed, will change.
Quoted 4 lines
If you could respin this one quickly it'd be great, thanks!
Ohad.
Sergei had a comment to change devm_request_and_ioremap() to devm_ioremap_resource(), so I will submit a new patch with your and Sergei's comments applied.
Regards,
- Rob
PATCH v9 4/6 ARM: davinci: Add a remoteproc driver implementation for OMAP-L13x DSP
Quoted 1 line · Robert
The platform_get_irq()/irq_get_irq_data()/platform_get_resource() calls don't have "put" counterparts. The "devm_*" calls get automatically cleaned up (and I wasn't able to find any existing example of some code that actually does the cleanup explicitly).
Fair enough, thanks for looking.
Quoted 1 line
Sergei had a comment to change
devm_request_and_ioremap()todevm_ioremap_resource(), so I will submit a new patch with your and Sergei's comments applied.
Thanks!
v9 cover ARM: davinci: remoteproc support
In reply to a message not in the archiveHi Rob,
Quoted 2 lines · Robert Tivy
This patch series adds remoteproc support for OMAP-L13x, along with needed supporting mach-davinci infrastructure.
Patches look good, thanks for pushing.
I'm applying 2 and 3 now. Please ack the change I've done for 1 and I'll apply it too. No. 4 just needs a small change, if you could please respin quickly I'll apply it immediately.
I prefer patches 5 and 6 go through Sekhar, guess after I'll have no. 4 applied in an immutable branch Sekhar could pull it and apply 5 and 6.
Thanks,
Ohad.
v9 cover ARM: davinci: remoteproc support
Quoted 8 lines · Ohad Ben-Cohen
Hi Rob,
Quoted 2 lines · Robert Tivy
This patch series adds remoteproc support for OMAP-L13x, along with needed supporting mach-davinci infrastructure.
Patches look good, thanks for pushing.
Quoted 7 lines
I'm applying 2 and 3 now. Please ack the change I've done for 1 and I'll apply it too. No. 4 just needs a small change, if you could please respin quickly I'll apply it immediately.
I prefer patches 5 and 6 go through Sekhar, guess after I'll have no. 4 applied in an immutable branch Sekhar could pull it and apply 5 and 6.
That should be fine. Please let me know once you have the immutable branch.
Thanks,
Sekhar