From: Felipe Balbi <balbi@ti.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Felipe Balbi <balbi@ti.com>,
Linux USB Mailing List <linux-usb@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Thomas Dahlmann <dahlmann.thomas@arcor.de>,
"open list:DESIGNWARE USB3 D..." <linux-omap@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:AMD GEODE CS5536..." <linux-geode@lists.infradead.org>
Subject: Re: [PATCH 4/9] usb: renesas: gadget: use generic map/unmap routines
Date: Tue, 20 Dec 2011 12:51:08 +0200 [thread overview]
Message-ID: <20111220105105.GB31842@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <87d3bkrp4n.wl%kuninori.morimoto.gx@renesas.com>
[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]
Hi,
On Mon, Dec 19, 2011 at 05:46:56PM -0800, Kuninori Morimoto wrote:
> I tried this patch, but renesas_usbhs didn't work.
> It seems have some bugs.
>
> 1. renesas_usbhs dma needs pkt->dma, but this patch didn't care it.
> 2. dma direction seems wrong
> ("dir" needs 0/1, not DMA_xxx_DEVICE for usb_gadget_xx_request())
>
> And, renesas_usbhs can not use scatter/gather type dma
>
> #
> # this is not super important, but
> #
> # int usb_gadget_map_request(struct usb_gadget *gadget,
> # struct usb_request *req, int direction)
> #
> # this "direction = 0/1" is a little bit un-understandable for me.
> # it is difficult to understand "which direction ?" from code.
> # if "direction = DMA_TO_DEVICE/DMA_FROM_DEVICE, it is understandable ;P
I see. The thing is that we want usb_gadget_map/unmap_request() to
handle that. In the long run, we might want to have a direction flag on
the public struct usb_request and remove this extra parameter, but I'm
still considering that :-)
> Can you please add below fix patch ?
thanks, will do as soon as you fix below :-)
> ------------------------------------------------
> diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
> index cb92a1d..c467067 100644
> --- a/drivers/usb/renesas_usbhs/mod_gadget.c
> +++ b/drivers/usb/renesas_usbhs/mod_gadget.c
> @@ -173,15 +173,32 @@ static int usbhsg_dma_map_ctrl(struct usbhs_pkt *pkt, int map)
> struct usbhsg_uep *uep = usbhsg_pipe_to_uep(pipe);
> struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
> enum dma_data_direction dir;
> + int ret;
>
> - dir = usbhs_pipe_is_dir_in(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
> + dir = !usbhs_pipe_is_dir_in(pipe);
>
> if (map) {
> - return usb_gadget_map_request(&gpriv->gadget, req, dir);
> + if (req->num_sgs) /* it can not use scatter/gather */
> + return -EIO;
it would be better to through a big fat WARN() in this case. Gadget
drivers are supposed to check whether you support SGs (by looking into
gadget->sg_suported) before giving you a request with SGs.
> + if (pkt->dma != DMA_ADDR_INVALID)
> + return -EIO;
no no, we want to remove the whole DMA_ADDR_INVALID thing. What we're
doing now is that UDC is required to map the request buffer. So gadget
drivers must not do it. We shouldn't have this DMA_ADDR_INVALID macro
anymore :-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-12-20 10:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-19 10:30 [PATCH 0/9] Add a generic request map/unmap routine Felipe Balbi
2011-12-19 10:30 ` [PATCH 1/9] usb: gadget: add generic map/unmap request utilities Felipe Balbi
2011-12-19 15:19 ` Alan Stern
2011-12-19 15:49 ` Felipe Balbi
2011-12-19 16:27 ` Alan Stern
2011-12-19 10:30 ` [PATCH 2/9] usb: dwc3: gadget: use generic map/unmap routines Felipe Balbi
2011-12-19 10:30 ` [PATCH 3/9] usb: gadget: langwell: use generic map/unmap functions Felipe Balbi
2011-12-19 10:30 ` [PATCH 4/9] usb: renesas: gadget: use generic map/unmap routines Felipe Balbi
2011-12-20 1:46 ` Kuninori Morimoto
2011-12-20 10:51 ` Felipe Balbi [this message]
2011-12-20 2:29 ` Kuninori Morimoto
2011-12-19 10:30 ` [PATCH 5/9] usb: gadget: amd5536: " Felipe Balbi
2011-12-19 10:30 ` [PATCH 6/9] usb: gadget: r8a66597: " Felipe Balbi
2011-12-19 10:30 ` [PATCH 7/9] usb: gadget: net2272: use generic map/umap routines Felipe Balbi
2011-12-19 10:30 ` [PATCH 8/9] usb: gadget: net2280: use generic map/unmap routines Felipe Balbi
2011-12-19 15:21 ` Alan Stern
2011-12-19 15:49 ` Felipe Balbi
2011-12-19 10:30 ` [PATCH 9/9] usb: gadget: goku: " Felipe Balbi
2011-12-19 13:02 ` Sergei Shtylyov
2011-12-19 13:05 ` Sergei Shtylyov
2011-12-19 13:09 ` Felipe Balbi
2011-12-19 13:10 ` Sergei Shtylyov
2012-01-24 11:45 [PATCH 0/9] usb: gadget: " Felipe Balbi
2012-01-24 11:45 ` [PATCH 4/9] usb: renesas: gadget: use " Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111220105105.GB31842@legolas.emea.dhcp.ti.com \
--to=balbi@ti.com \
--cc=dahlmann.thomas@arcor.de \
--cc=gregkh@suse.de \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-geode@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®