From: Li Yang <leoli@freescale.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@ozlabs.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, dbrownell@users.sourceforge.net,
greg@kroah.com
Subject: Re: [PATCH] usb: add Freescale QE/CPM USB peripheral controller driver
Date: Fri, 29 Aug 2008 16:57:45 +0800 [thread overview]
Message-ID: <1220000265.30607.10.camel@Gundam> (raw)
In-Reply-To: <200808281704.20999.arnd@arndb.de>
On Thu, 2008-08-28 at 17:04 +0200, Arnd Bergmann wrote:
> On Thursday 28 August 2008, Li Yang wrote:
> > Some of Freescale SoC chips have a QE or CPM co-processor which
> > supports full speed USB. The driver adds device mode support
> > of both QE and CPM USB controller to Linux USB gadget. The
> > driver is tested with MPC8360 and MPC8272, and should work with
> > other models having QE/CPM given minor tweaks.
>
> Looks pretty good, just a few comments on the driver:
>
> > +config USB_GADGET_FSL_QE
> > + boolean "Freescale QE/CPM USB Device Controller"
> > + depends on FSL_SOC && (QUICC_ENGINE || CPM)
> > + help
> > + Some of Freescale PowerPC processors have a Full Speed
> > + QE/CPM2 USB controller, which support device mode with 4
> > + programmable endpoints. This driver supports the
> > + controller in the MPC8360 and MPC8272, and should work with
> > + controllers having QE or CPM2, given minor tweaks.
> > +
> > + Say "y" to link the driver statically, or "m" to build a
> > + dynamically linked module called "fsl_qe_udc" and force all
> > + gadget drivers to also be dynamically linked.
> > +
> > +config USB_FSL_QE
> > + tristate
> > + depends on USB_GADGET_FSL_QE
> > + default USB_GADGET
> > + select USB_GADGET_SELECTED
>
>
> Why do you need the two config options, not just one?
This is common for udc drivers. I guess this measure is used to make
the selection of udc drivers a choice list while still make it possible
to compiled as module.
>
> > +#ifdef CONFIG_CPM2
> > +#include <asm/cpm.h>
> > +
> > +#define qe_muram_addr cpm_muram_addr
> > +#define qe_muram_offset cpm_muram_offset
> > +#define qe_muram_alloc cpm_muram_alloc
> > +#define qe_muram_free cpm_muram_free
> > +#endif
> ...
> > +static int qe_ep_cmd_restarttx(struct qe_ep *ep)
> > +{
> > + u8 ep_num;
> > +#ifdef CONFIG_CPM2
> > + u32 command;
> > + u8 opcode;
> > +
> > + ep_num = ep->epnum << CPM_USB_EP_SHIFT;
> > + command = CPM_USB_RESTART_TX | (u32)ep_num;
> > + opcode = CPM_USB_RESTART_TX_OPCODE;
> > + cpm_command(command, opcode);
> > +#else
> > + ep_num = ep->epnum;
> > + qe_issue_cmd(QE_USB_RESTART_TX, QE_CR_SUBBLOCK_USB, ep_num, 0);
> > +#endif
> > + return 0;
> > +}
>
> This part doesn't look good, you should try to avoid hardcoding
> the specific type of chip (QE or CPM2) here. AFAICT, you can build
> a multiplatform kernel that supports both QE and CPM2, but your code
> here would be broken in that case if you try to run it on QE.
Ok.
>
> > +static void setup_received_handle(struct qe_udc *udc,
> > + struct usb_ctrlrequest *setup);
> > +static int qe_ep_rxframe_handle(struct qe_ep *ep);
> > +static void ep0_req_complete(struct qe_udc *udc, struct qe_req *req);
>
> Better try to avoid static forward declarations by reordering your
> functions in call order. That is the common coding style and makes
> drivers easier to read when you're used to it.
>
> > +
> > + tasklet_schedule(&udc->rx_tasklet);
>
> Not a problem, but an observation: Most new code uses work queues instead
> of tasklets these days, which gives you more predictable real time
> latencies.
> If you don't have a specific reason to prefer a tasklet, just use
> a workqueue here.
Is this truly a trend? Work queue is more flexible but it has higher
latency. Why are work queues preferred?
- Leo
next prev parent reply other threads:[~2008-08-29 8:41 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 9:43 [PATCH] usb: add Freescale QE/CPM USB peripheral controller driver Li Yang
2008-08-28 15:04 ` Arnd Bergmann
2008-08-28 17:22 ` Alan Stern
2008-08-28 17:53 ` Scott Wood
2008-08-28 20:16 ` Alan Stern
2008-08-28 22:27 ` Arnd Bergmann
2008-08-29 16:05 ` Alan Stern
2008-08-29 16:29 ` Arnd Bergmann
2008-08-29 17:19 ` Alan Stern
2008-08-29 17:38 ` Arnd Bergmann
2008-08-29 21:22 ` Alan Stern
2008-09-24 20:15 ` David Brownell
2008-08-29 8:57 ` Li Yang [this message]
2008-08-29 8:57 ` Arnd Bergmann
2008-09-24 20:10 ` David Brownell
2008-08-28 16:39 ` Scott Wood
2008-08-29 9:35 ` Li Yang
2008-09-01 13:52 ` Anton Vorontsov
2008-09-02 7:08 ` Li Yang
2008-09-01 16:34 ` Anton Vorontsov
2008-09-01 17:11 ` Anton Vorontsov
2008-09-02 7:35 ` Li Yang
2008-09-02 7:57 ` Joakim Tjernlund
2008-09-02 8:12 ` [PATCH] usb: add Freescale QE/CPM USB peripheral controllerdriver Li Yang-R58472
2008-09-02 8:15 ` Joakim Tjernlund
2008-09-24 20:28 ` David Brownell
2008-09-24 21:30 ` Joakim Tjernlund
2008-09-24 21:42 ` David Brownell
2008-09-24 20:26 ` David Brownell
-- strict thread matches above, loose matches on Subject: below --
2008-08-06 7:16 [PATCH] usb: add Freescale QE/CPM USB peripheral controller driver Li Yang
2008-08-06 15:15 ` Anton Vorontsov
2008-08-06 15:47 ` Timur Tabi
2008-08-15 14:16 ` Anton Vorontsov
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=1220000265.30607.10.camel@Gundam \
--to=leoli@freescale.com \
--cc=arnd@arndb.de \
--cc=dbrownell@users.sourceforge.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).