USB device driver of Topcliff PCH
PATCH v4 1/1 USB device driver of Topcliff PCH
Hi Maurus and Michal.
Thank you for your comments.
This patch was modified.
Add MODULE_AUTHOR()
Modify struct pch_udc_stp_dma_desc.
Delete union pch_udc_setup_data.
Modify as only one "unlock"
Modify while loop.
Modify loop count.
Refactored function
-pch_udc_free_dma_chain()
-pch_udc_create_dma_chain()
and so on
--- drivers/usb/gadget/Kconfig | 24 + drivers/usb/gadget/Makefile | 2 +- drivers/usb/gadget/gadget_chips.h | 7 + drivers/usb/gadget/pch_udc.c | 3283 +++++++++++++++++++++++++++++++++++++ 4 files changed, 3315 insertions(+), 1 deletions(-) create mode 100644 drivers/usb/gadget/pch_udc.c
drivers/usb/gadget/Kconfig +24 -0
@@ -220,6 +220,30 @@ config USB_OTG Select this only if your OMAP board has a Mini-AB connector. +config USB_GADGET_PCH + boolean "PCH USB Device controller" + depends on PCI + select USB_GADGET_DUALSPEED + help + This is a USB device driver for Topcliff PCH. + Topcliff PCH is the platform controller hub that is used in Intel's + general embedded platform. + Topcliff PCH has USB device interface. + Using this interface, it is able to access system devices connected + to USB device. + This driver enables USB device function. + USB device is a USB peripheral controller which + supports both full and high speed USB 2.0 data transfers. + This driver supports for control transfer, and bulk transfer modes. + This driver dose not support interrupt transfer, and isochronous + transfer modes. + +config PCH_USBDEV + tristate + depends on USB_GADGET_PCH + default USB_GADGET + select USB_GADGET_SELECTED + config USB_GADGET_PXA25X boolean "PXA 25x or IXP 4xx" depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
drivers/usb/gadget/Makefile +1 -1
@@ -63,4 +63,4 @@ obj-$(CONFIG_USB_G_HID) += g_hid.o obj-$(CONFIG_USB_G_MULTI) += g_multi.o obj-$(CONFIG_USB_G_NOKIA) += g_nokia.o obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o - +obj-$(CONFIG_PCH_USBDEV) += pch_udc.o
drivers/usb/gadget/gadget_chips.h +7 -0
@@ -142,6 +142,11 @@#define gadget_is_s3c_hsotg (g) 0#endif +#ifdef CONFIG_USB_GADGET_PCH +#define gadget_is_pch (g) (!strcmp("pch_udc", (g)->name)) +#else +#define gadget_is_pch (g) 0 +#endif /** * usb_gadget_controller_number - support bcdDevice id convention
@@ -200,6 +205,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)return 0x25 ; else if (gadget_is_s3c_hsotg(gadget)) return 0x26; + else if (gadget_is_pch(gadget)) + return 0x27;return -ENOENT ; }
drivers/usb/gadget/pch_udc.c new file +3283 -0
2,946 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.2.5
Part of the diff is not shown here. View the raw message.
Quoted 4 lines · Masayuki Ohtake
Hi Maurus and Michal.
Thank you for your comments.
Quoted 11 lines
This patch was modified.
AddMODULE_AUTHOR()
Modify structpch_udc_stp_dma_desc.
Delete unionpch_udc_setup_data.
Modify as only one "unlock"
Modify while loop.
Modify loop count.
Refactored function
-pch_udc_free_dma_chain()
-pch_udc_create_dma_chain()
and so on
As Maurus commented before, this is not a proper commit message. Describe what the patch does. All other comments should go after the "---" marker.
drivers/usb/gadget/pch_udc.c line 429
Quoted 6 lines
drivers/usb/gadget/pch_udc.c +5
-0+static inline void pch_udc_writel (struct pch_udc_dev *dev, +unsigned long val,unsigned long reg) +{ +iowrite32 (val, dev->base_addr + reg); +}
Empty line please.
drivers/usb/gadget/pch_udc.c line 441
Quoted 12 lines
drivers/usb/gadget/pch_udc.c +12
-0+static inline void pch_udc_bit_set (struct pch_udc_dev *dev, +unsigned long reg, +unsigned long bitmask) +{ +pch_udc_writel ((dev),pch_udc_readl ((dev), (reg)) | (bitmask), (reg)); +} +static inline void pch_udc_bit_clr (struct pch_udc_dev *dev, +unsigned long reg, +unsigned long bitmask) +{ +pch_udc_writel ((dev),pch_udc_readl ((dev), (reg)) & ~(bitmask), (reg)); +}
Definitely too many parenthesis here. It's no longer a macro so parens around arguments are not needed and only clutter the code.
drivers/usb/gadget/pch_udc.c line 452
Quoted 11 lines
drivers/usb/gadget/pch_udc.c +11
-0+ +static inline u32 pch_udc_ep_readl (struct pch_udc_ep *ep,unsigned long reg) +{ +return ioread32 (ep->dev->base_addr + ep->offset_addr + reg); +} + +static inline void pch_udc_ep_writel (struct pch_udc_ep *ep, +unsigned long val,unsigned long reg) +{ +iowrite32 (val, ep->dev->base_addr + ep->offset_addr + reg); +}
Again, empty line please.
Quoted 4 lines
drivers/usb/gadget/pch_udc.c +4
-0+static inline void pch_udc_ep_bit_set (struct pch_udc_ep *ep, +unsigned long reg, +unsigned long bitmask) +{
drivers/usb/gadget/pch_udc.c line 466
Quoted 10 lines
drivers/usb/gadget/pch_udc.c +10
-0+pch_udc_ep_writel ((ep),pch_udc_ep_readl ((ep), (reg)) | (bitmask), + (reg)); +} +static inline void pch_udc_ep_bit_clr (struct pch_udc_ep *ep, +unsigned long reg, +unsigned long bitmask) +{ +pch_udc_ep_writel ((ep),pch_udc_ep_readl ((ep), (reg)) & ~(bitmask), + (reg)); +}
And again, too many parenthesis.
Quoted 9 lines
drivers/usb/gadget/pch_udc.c +9
-0+static void process_zlp (struct pch_udc_ep *ep,struct pch_udc_request *req) +{ +struct pch_udc_dev *dev = ep->dev; + +dev_dbg (&dev->pdev->dev,"%s: enter ep%d%s" , __func__, ep->num, + (ep->in ?"in" :"out" )); +/* IN zlp's are handled by hardware */ +complete_req (ep, req,0 ); +
drivers/usb/gadget/pch_udc.c line 1466
Quoted 10 lines
drivers/usb/gadget/pch_udc.c +10
-0+/* if set_config or set_intf is waiting for ack by zlp +* then set CSR_DONE +*/ +if (dev->set_cfg_not_acked) { +dev_dbg (&dev->pdev->dev,"%s: process_zlp: csr done" , __func__); +pch_udc_set_csr_done (dev); + dev->set_cfg_not_acked =0 ; + } +/* setup command is ACK'ed now by zlp */ +if ((!dev->stall) && (dev->waiting_zlp_ack)) {
Useless parenthesis.
drivers/usb/gadget/pch_udc.c
Quoted 10 lines
drivers/usb/gadget/pch_udc.c +8
-0+/* clear NAK by writing CNAK in EP0_IN */ +pch_udc_ep_clear_nak (&(dev->ep[UDC_EP0IN_IDX ])); + dev->waiting_zlp_ack =0 ; + } +} +/** +* pch_udc_alloc_request() - This function allocates request structure. +* It iscalled by gadget driver
"is called" -- typo.
Quoted 6 lines
+ * @usbep: Reference to the USB endpoint structure
+ * @gfp: Flag to be used while allocating memory
+ * Returns
+ * NULL: Failure
+ * Allocated address: Success
+ */
Other then those trivial mistakes, I haven't noticed any obvious problems so I guess "Acked-by" me.
Signature · 4 lines
Best regards, _ _ | Humble Liege of Serenely Enlightened Majesty of o' \,=./ `o | Computer Science, Michał "mina86" Nazarewicz (o o) +----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--