From: "Li Yang" <leoli@freescale.com>
To: avorontsov@ru.mvista.com
Cc: greg@kroah.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, dbrownell@users.sourceforge.net,
linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] usb: add Freescale QE/CPM USB peripheral controller driver
Date: Tue, 2 Sep 2008 15:08:06 +0800 [thread overview]
Message-ID: <2a27d3730809020008i6427954ex2c09c6fa67971a75@mail.gmail.com> (raw)
In-Reply-To: <20080901135235.GA677@oksana.dev.rtsoft.ru>
On Mon, Sep 1, 2008 at 9:52 PM, Anton Vorontsov
<avorontsov@ru.mvista.com> wrote:
> On Thu, Aug 28, 2008 at 05:43:33PM +0800, 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.
>>
>> Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
>> Signed-off-by: Li Yang <leoli@freescale.com>
>> ---
>> This is the second submission of the driver. This version addressed:
>> Comments from Anton Vorontsov.
>> A lot of cosmetic problem.
>> Sparse and various kernel DEBUG warnings.
>
> You might want to consider some of the following changes (they're
> tested with
> http://ozlabs.org/pipermail/linuxppc-dev/2008-September/062360.html).
>
> - remove qe_muram -> cpm_muram defines
Already done to address comment from Arnd.
> - configure clocks per device tree via qe_usb_clock_set(). To use this
> function we should select QE_USB.
>
> NOTE: currently this means that CPM build will break. :-( We should
> probably implement generic cpm_clock_source() and cpm_usb_clock_set().
>
> Or.. we can move this to the board file (Do we ever need to change the
> clocks in this driver? For the Host driver we need this, since it
> can switch between low and full speed).
>
> What do you think?
I'd prefer to leave the clock setting for USB gadget mode in platform
code. There is no need to change the clock in the udc driver. There
is no point to make the speed of a USB device changable.
>
> - change 8360 compatible to 8323 (8323 is the first chip with QE USB,
> device trees for 8360 boards should specify fsl,mpc8323-qe-usb
> as a compatible).
Well. IIRC, 8360 came out earlier than 8323. Whatsoever, 8360 is a
better representative for the PowerQUICC 2 pro family with a QE as it
has the full functionality.
>
> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
> index 4dbf622..e57c298 100644
> --- a/drivers/usb/gadget/Kconfig
> +++ b/drivers/usb/gadget/Kconfig
> @@ -153,6 +153,7 @@ config USB_FSL_USB2
> config USB_GADGET_FSL_QE
> boolean "Freescale QE/CPM USB Device Controller"
> depends on FSL_SOC && (QUICC_ENGINE || CPM)
> + select QE_USB
> help
> Some of Freescale PowerPC processors have a Full Speed
> QE/CPM2 USB controller, which support device mode with 4
> diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
> index e448610..c1a0beb 100644
> --- a/drivers/usb/gadget/fsl_qe_udc.c
> +++ b/drivers/usb/gadget/fsl_qe_udc.c
> @@ -36,20 +36,12 @@
> #include <linux/usb/ch9.h>
> #include <linux/usb/gadget.h>
> #include <linux/usb/otg.h>
> +#include <asm/cpm.h>
> #include <asm/qe.h>
> #include <asm/dma.h>
> #include <asm/reg.h>
> #include "fsl_qe_udc.h"
>
> -#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
> -
> #define DRIVER_DESC "Freescale QE/CPM USB Device Controller driver"
> #define DRIVER_AUTHOR "Xie XiaoBo"
> #define DRIVER_VERSION "1.0"
> @@ -2490,6 +2482,7 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
> const struct of_device_id *match)
> {
> struct device_node *np = ofdev->node;
> + enum qe_clock clk;
> struct qe_ep *ep;
> unsigned int ret = 0;
> unsigned int i;
> @@ -2499,6 +2492,16 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
> if (!prop || strcmp(prop, "peripheral"))
> return -ENODEV;
>
> + prop = of_get_property(np, "fsl,fullspeed-clock", NULL);
> + if (!prop)
> + return -EINVAL;
> +
> + clk = qe_clock_source(prop);
> + if (clk == QE_CLK_NONE || clk == QE_CLK_DUMMY)
> + return -EINVAL;
> +
> + qe_usb_clock_set(clk, USB_CLOCK);
> +
> /* Initialize the udc structure including QH member and other member */
> udc_controller = qe_udc_config(ofdev);
> if (!udc_controller) {
> @@ -2689,7 +2692,7 @@ static int __devexit qe_udc_remove(struct of_device *ofdev)
> /*-------------------------------------------------------------------------*/
> static struct of_device_id qe_udc_match[] = {
> {
> - .compatible = "fsl,mpc8360-qe-usb",
> + .compatible = "fsl,mpc8323-qe-usb",
> },
> {
> .compatible = "fsl,mpc8272-cpm-usb",
> diff --git a/drivers/usb/gadget/fsl_qe_udc.h b/drivers/usb/gadget/fsl_qe_udc.h
> index e2e9639..0ff9c00 100644
> --- a/drivers/usb/gadget/fsl_qe_udc.h
> +++ b/drivers/usb/gadget/fsl_qe_udc.h
> @@ -17,6 +17,8 @@
> #ifndef __FSL_QE_UDC_H
> #define __FSL_QE_UDC_H
>
> +#define USB_CLOCK 48000000
> +
> #define USB_MAX_ENDPOINTS 4
> #define USB_MAX_PIPES USB_MAX_ENDPOINTS
> #define USB_EP0_MAX_SIZE 64
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2008-09-02 7:08 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
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 [this message]
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=2a27d3730809020008i6427954ex2c09c6fa67971a75@mail.gmail.com \
--to=leoli@freescale.com \
--cc=avorontsov@ru.mvista.com \
--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).