Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode
On Wednesday 08 July 2015 01:23 PM, Herbert Xu wrote: On Wed, Jul 08, 2015 at 03:48:05PM +0800, Herbert Xu wrote: On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: + if (req-assoclen + req-cryptlen == 0) { + scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); + return 0; + } How can this be right? Did you enable the selftest? Why not? Self tests are passed for this case. As per the equation given in GCM spec[1], we can see that if assoclen and cryptlen is 0, then output of GCM is just E(K, Y0) where Y0 = IV||(0^31)1 I have E(K, Y0) calculated in previous step. And copying it to destination if assoclen and cryptlen is 0. Correct me if I am wrong. It should be E(K, Y0) ^ GHASH(0). So unless GHASH(0) == 0, your code doesn't work. OK, GHASH(0) is indeed zero so I guess your code does work after all. Sorry. I did not see this message and replied on the other thread. Thanks and regards, Lokesh Cheers, -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/9] usb: dwc3: dwc3-omap: Make the wrapper interrupt shared
The wrapper interrupt is shared with OTG core so mark it IRQF_SHARED. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 6b486a3..1bc1766 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -542,8 +542,8 @@ static int dwc3_omap_probe(struct platform_device *pdev) reg = dwc3_omap_readl(omap-base, USBOTGSS_SYSCONFIG); omap-dma_status = !!(reg USBOTGSS_SYSCONFIG_DMADISABLE); - ret = devm_request_irq(dev, omap-irq, dwc3_omap_interrupt, 0, - dwc3-omap, omap); + ret = devm_request_irq(dev, omap-irq, dwc3_omap_interrupt, IRQF_SHARED, + dwc3-omap, omap); if (ret) { dev_err(dev, failed to request IRQ #%d -- %d\n, omap-irq, ret); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 37/37] usb: gadget: epautoconf: add endpoint capabilities flags verification
Introduce endpoint matching mechanism basing on endpoint capabilities flags. We check if endpoint supports transfer type and direction requested in ep descriptor. Since we have this new endpoint matching mechanism there is no need to have old code guessing endpoint capabilities basing on its name, so we are getting rid of it. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/epautoconf.c | 72 + 1 file changed, 22 insertions(+), 50 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 8e00ca7..38df22a 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -47,7 +47,6 @@ ep_matches ( ) { u8 type; - const char *tmp; u16 max; int num_req_streams = 0; @@ -56,58 +55,31 @@ ep_matches ( if (ep-claimed) return 0; - /* only support ep0 for portable CONTROL traffic */ type = usb_endpoint_type(desc); - if (USB_ENDPOINT_XFER_CONTROL == type) - return 0; - - /* some other naming convention */ - if ('e' != ep-name[0]) + switch (type) { + case USB_ENDPOINT_XFER_CONTROL: + /* only support ep0 for portable CONTROL traffic */ return 0; + case USB_ENDPOINT_XFER_ISOC: + if (!ep-caps.type_iso) + return 0; + break; + case USB_ENDPOINT_XFER_BULK: + if (!ep-caps.type_bulk) + return 0; + break; + case USB_ENDPOINT_XFER_INT: + if (!ep-caps.type_int) + return 0; + break; + } - /* type-restriction: -iso, -bulk, or -int. -* direction-restriction: in, out. -*/ - if ('-' != ep-name[2]) { - tmp = strrchr (ep-name, '-'); - if (tmp) { - switch (type) { - case USB_ENDPOINT_XFER_INT: - /* bulk endpoints handle interrupt transfers, -* except the toggle-quirky iso-synch kind -*/ - if ('s' == tmp[2]) // == -iso - return 0; - /* for now, avoid PXA interrupt-in; -* it's documented as never using DATA1. -*/ - if (gadget_is_pxa (gadget) -'i' == tmp [1]) - return 0; - break; - case USB_ENDPOINT_XFER_BULK: - if ('b' != tmp[1]) // != -bulk - return 0; - break; - case USB_ENDPOINT_XFER_ISOC: - if ('s' != tmp[2]) // != -iso - return 0; - } - } else { - tmp = ep-name + strlen (ep-name); - } - - /* direction-restriction: ..in-.., out-.. */ - tmp--; - if (!isdigit (*tmp)) { - if (desc-bEndpointAddress USB_DIR_IN) { - if ('n' != *tmp) - return 0; - } else { - if ('t' != *tmp) - return 0; - } - } + if (usb_endpoint_dir_in(desc)) { + if (!ep-caps.dir_in) + return 0; + } else { + if (!ep-caps.dir_out) + return 0; } /* -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 36/37] usb: gadget: atmel_usba_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/atmel_usba_udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 37d414e..267d84f 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -2067,6 +2067,17 @@ static struct usba_ep * usba_udc_pdata(struct platform_device *pdev, ep-can_dma = pdata-ep[i].can_dma; ep-can_isoc = pdata-ep[i].can_isoc; + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = ep-can_isoc; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; + if (i) list_add_tail(ep-ep.ep_list, udc-gadget.ep_list); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 30/37] usb: gadget: s3c-hsudc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/s3c-hsudc.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/gadget/udc/s3c-hsudc.c b/drivers/usb/gadget/udc/s3c-hsudc.c index 85a712a..e9def42 100644 --- a/drivers/usb/gadget/udc/s3c-hsudc.c +++ b/drivers/usb/gadget/udc/s3c-hsudc.c @@ -1005,6 +1005,21 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc, hsep-stopped = 0; hsep-wedge = 0; + if (epnum == 0) { + hsep-ep.caps.type_control = true; + hsep-ep.caps.dir_in = true; + hsep-ep.caps.dir_out = true; + } else { + hsep-ep.caps.type_iso = true; + hsep-ep.caps.type_bulk = true; + hsep-ep.caps.type_int = true; + } + + if (epnum 1) + hsep-ep.caps.dir_in = true; + else + hsep-ep.caps.dir_out = true; + set_index(hsudc, epnum); writel(hsep-ep.maxpacket, hsudc-regs + S3C_MPR); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 34/37] usb: musb: gadget: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/musb/musb_gadget.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 625d482f..043248a 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1729,6 +1729,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) INIT_LIST_HEAD(ep-end_point.ep_list); if (!epnum) { usb_ep_set_maxpacket_limit(ep-end_point, 64); + ep-end_point.caps.type_control = true; ep-end_point.ops = musb_g_ep0_ops; musb-g.ep0 = ep-end_point; } else { @@ -1736,9 +1737,20 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) usb_ep_set_maxpacket_limit(ep-end_point, hw_ep-max_packet_sz_tx); else usb_ep_set_maxpacket_limit(ep-end_point, hw_ep-max_packet_sz_rx); + ep-end_point.caps.type_iso = true; + ep-end_point.caps.type_bulk = true; + ep-end_point.caps.type_int = true; ep-end_point.ops = musb_ep_ops; list_add_tail(ep-end_point.ep_list, musb-g.ep_list); } + + if (!epnum || hw_ep-is_shared_fifo) { + ep-end_point.caps.dir_in = true; + ep-end_point.caps.dir_out = true; + } else if (is_in) + ep-end_point.caps.dir_in = true; + else + ep-end_point.caps.dir_out = true; } /* -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 33/37] usb: isp1760: udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/isp1760/isp1760-udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c index 3699962..1c3d0fd 100644 --- a/drivers/usb/isp1760/isp1760-udc.c +++ b/drivers/usb/isp1760/isp1760-udc.c @@ -1383,13 +1383,24 @@ static void isp1760_udc_init_eps(struct isp1760_udc *udc) */ if (ep_num == 0) { usb_ep_set_maxpacket_limit(ep-ep, 64); + ep-ep.caps.type_control = true; + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; ep-maxpacket = 64; udc-gadget.ep0 = ep-ep; } else { usb_ep_set_maxpacket_limit(ep-ep, 512); + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; ep-maxpacket = 0; list_add_tail(ep-ep.ep_list, udc-gadget.ep_list); } + + if (is_in) + ep-ep.caps.dir_in = true; + else + ep-ep.caps.dir_out = true; } } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 35/37] usb: renesas: gadget: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/renesas_usbhs/mod_gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index dc2aa32..ed8d890 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -1041,12 +1041,18 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) if (usbhsg_is_dcp(uep)) { gpriv-gadget.ep0 = uep-ep; usb_ep_set_maxpacket_limit(uep-ep, 64); + uep-ep.caps.type_control = true; } /* init normal pipe */ else { usb_ep_set_maxpacket_limit(uep-ep, 512); + uep-ep.caps.type_iso = true; + uep-ep.caps.type_bulk = true; + uep-ep.caps.type_int = true; list_add_tail(uep-ep.ep_list, gpriv-gadget.ep_list); } + uep-ep.caps.dir_in = true; + uep-ep.caps.dir_out = true; } ret = usb_add_gadget_udc(dev, gpriv-gadget); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/37] usb: gadget: encapsulate endpoint claiming mechanism
So far it was necessary for usb functions to set ep-driver_data in endpoint obtained from autoconfig to non-null value, to indicate that endpoint is claimed by function (in autoconfig it was checked if endpoint has set this field to non-null value, and if it has, it was assumed that it is claimed). It could cause bugs becouse if some function doesn't set this field autoconfig could return the same endpoint more than one time. To help to avoid such bugs this patch adds claimed flag to struct usb_ep, and encapsulates endpoint claiming mechanism inside usb_ep_autoconfig_ss() and usb_ep_autoconfig_reset(), so now usb functions doesn't need to perform any additional actions to mark endpoint obtained from autoconfig as claimed. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/epautoconf.c | 11 ++- include/linux/usb/gadget.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 919cdfd..8e00ca7 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -53,7 +53,7 @@ ep_matches ( int num_req_streams = 0; /* endpoint already claimed? */ - if (NULL != ep-driver_data) + if (ep-claimed) return 0; /* only support ep0 for portable CONTROL traffic */ @@ -240,7 +240,7 @@ find_ep (struct usb_gadget *gadget, const char *name) * updated with the assigned number of streams if it is * different from the original value. To prevent the endpoint * from being returned by a later autoconfig call, claim it by - * assigning ep-driver_data to some non-null value. + * assigning ep-claimed to true. * * On failure, this returns a null endpoint descriptor. */ @@ -323,6 +323,7 @@ struct usb_ep *usb_ep_autoconfig_ss( found_ep: ep-desc = NULL; ep-comp_desc = NULL; + ep-claimed = true; return ep; } EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); @@ -354,7 +355,7 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); * descriptor bEndpointAddress. For bulk endpoints, the wMaxPacket value * is initialized as if the endpoint were used at full speed. To prevent * the endpoint from being returned by a later autoconfig call, claim it - * by assigning ep-driver_data to some non-null value. + * by assigning ep-claimed to true. * * On failure, this returns a null endpoint descriptor. */ @@ -373,7 +374,7 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig); * * Use this for devices where one configuration may need to assign * endpoint resources very differently from the next one. It clears - * state such as ep-driver_data and the record of assigned endpoints + * state such as ep-claimed and the record of assigned endpoints * used by usb_ep_autoconfig(). */ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) @@ -381,7 +382,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget) struct usb_ep *ep; list_for_each_entry (ep, gadget-ep_list, ep_list) { - ep-driver_data = NULL; + ep-claimed = false; } gadget-in_epnum = 0; gadget-out_epnum = 0; diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 4f3dfb7..fcb0a4e 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -173,6 +173,7 @@ struct usb_ep { const char *name; const struct usb_ep_ops *ops; struct list_headep_list; + boolclaimed; unsignedmaxpacket:16; unsignedmaxpacket_limit:16; unsignedmax_streams:16; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/37] usb: gadget: add endpoint capabilities flags
Introduce struct usb_ep_caps which contains information about capabilities of usb endpoints - supported transfer types and directions. This structure should be filled by UDC driver for each of its endpoints, and will be used in epautoconf in new ep matching mechanism which will replace ugly guessing of endpoint capabilities basing on its name. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- include/linux/usb/gadget.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index fcb0a4e..6f3e0fb 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -141,10 +141,29 @@ struct usb_ep_ops { }; /** + * struct usb_ep_caps - endpoint capabilities description + * @type_control:Endpoint supports control type (reserved for ep0). + * @type_iso:Endpoint supports isochronous transfers. + * @type_bulk:Endpoint supports bulk transfers. + * @type_int:Endpoint supports interrupt transfers. + * @dir_in:Endpoint supports IN direction. + * @dir_out:Endpoint supports OUT direction. + */ +struct usb_ep_caps { + unsigned type_control:1; + unsigned type_iso:1; + unsigned type_bulk:1; + unsigned type_int:1; + unsigned dir_in:1; + unsigned dir_out:1; +}; + +/** * struct usb_ep - device side representation of USB endpoint * @name:identifier for the endpoint, such as ep-a or ep9in-bulk * @ops: Function pointers used to access hardware-specific operations. * @ep_list:the gadget's ep_list holds all of its endpoints + * @caps:The structure describing types and directions supported by endoint. * @maxpacket:The maximum packet size used on this endpoint. The initial * value can sometimes be reduced (hardware allowing), according to * the endpoint descriptor used to configure the endpoint. @@ -167,12 +186,14 @@ struct usb_ep_ops { * gadget-ep_list. the control endpoint (gadget-ep0) is not in that list, * and is accessed only in response to a driver setup() callback. */ + struct usb_ep { void*driver_data; const char *name; const struct usb_ep_ops *ops; struct list_headep_list; + struct usb_ep_caps caps; boolclaimed; unsignedmaxpacket:16; unsignedmaxpacket_limit:16; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 23/37] usb: gadget: net2272: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/net2272.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c index 195baf3..34ec1ec 100644 --- a/drivers/usb/gadget/udc/net2272.c +++ b/drivers/usb/gadget/udc/net2272.c @@ -1404,6 +1404,17 @@ net2272_usb_reinit(struct net2272 *dev) else ep-fifo_size = 64; net2272_ep_reset(ep); + + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } usb_ep_set_maxpacket_limit(dev-ep[0].ep, 64); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 27/37] usb: gadget: pxa25x_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/pxa25x_udc.c | 32 1 file changed, 32 insertions(+) diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index f6cbe66..1301e29 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -1821,6 +1821,8 @@ static struct pxa25x_udc memory = { .name = ep0name, .ops= pxa25x_ep_ops, .maxpacket = EP0_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, .reg_udccs = UDCCS0, @@ -1833,6 +1835,8 @@ static struct pxa25x_udc memory = { .name = ep1in-bulk, .ops= pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_IN), }, .dev= memory, .fifo_size = BULK_FIFO_SIZE, @@ -1846,6 +1850,8 @@ static struct pxa25x_udc memory = { .name = ep2out-bulk, .ops= pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_OUT), }, .dev= memory, .fifo_size = BULK_FIFO_SIZE, @@ -1861,6 +1867,8 @@ static struct pxa25x_udc memory = { .name = ep3in-iso, .ops= pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_IN), }, .dev= memory, .fifo_size = ISO_FIFO_SIZE, @@ -1874,6 +1882,8 @@ static struct pxa25x_udc memory = { .name = ep4out-iso, .ops= pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_OUT), }, .dev= memory, .fifo_size = ISO_FIFO_SIZE, @@ -1888,6 +1898,8 @@ static struct pxa25x_udc memory = { .name = ep5in-int, .ops= pxa25x_ep_ops, .maxpacket = INT_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, + USB_EP_CAPS_DIR_IN), }, .dev= memory, .fifo_size = INT_FIFO_SIZE, @@ -1903,6 +1915,8 @@ static struct pxa25x_udc memory = { .name = ep6in-bulk, .ops= pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_IN), }, .dev= memory, .fifo_size = BULK_FIFO_SIZE, @@ -1916,6 +1930,8 @@ static struct pxa25x_udc memory = { .name = ep7out-bulk, .ops= pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_OUT), }, .dev= memory, .fifo_size = BULK_FIFO_SIZE, @@ -1930,6 +1946,8 @@ static struct pxa25x_udc memory = { .name = ep8in-iso, .ops= pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_IN), }, .dev= memory, .fifo_size = ISO_FIFO_SIZE, @@ -1943,6 +1961,8 @@ static struct pxa25x_udc memory = { .name = ep9out-iso, .ops= pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, +
[PATCH 21/37] usb: gadget: mv_u3d_core: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/mv_u3d_core.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c index ea35a24..4c48969 100644 --- a/drivers/usb/gadget/udc/mv_u3d_core.c +++ b/drivers/usb/gadget/udc/mv_u3d_core.c @@ -1324,6 +1324,9 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d) ep-ep.ops = mv_u3d_ep_ops; ep-wedge = 0; usb_ep_set_maxpacket_limit(ep-ep, MV_U3D_EP0_MAX_PKT_SIZE); + ep-ep.caps.type_control = true; + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; ep-ep_num = 0; ep-ep.desc = mv_u3d_ep0_desc; INIT_LIST_HEAD(ep-queue); @@ -1339,14 +1342,20 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d) if (i 1) { snprintf(name, sizeof(name), ep%din, i 1); ep-direction = MV_U3D_EP_DIR_IN; + ep-ep.caps.dir_in = true; } else { snprintf(name, sizeof(name), ep%dout, i 1); ep-direction = MV_U3D_EP_DIR_OUT; + ep-ep.caps.dir_out = true; } ep-u3d = u3d; strncpy(ep-name, name, sizeof(ep-name)); ep-ep.name = ep-name; + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + ep-ep.ops = mv_u3d_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, (unsigned short) ~0); ep-ep_num = i / 2; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 26/37] usb: gadget: pch_ud: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/pch_udc.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c index 613547f..cc8fb3c 100644 --- a/drivers/usb/gadget/udc/pch_udc.c +++ b/drivers/usb/gadget/udc/pch_udc.c @@ -2895,11 +2895,21 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev) ep-in = ~i 1; ep-ep.name = ep_string[i]; ep-ep.ops = pch_udc_ep_ops; - if (ep-in) + if (ep-in) { ep-offset_addr = ep-num * UDC_EP_REG_SHIFT; - else + ep-ep.caps.dir_in = true; + } else { ep-offset_addr = (UDC_EPINT_OUT_SHIFT + ep-num) * UDC_EP_REG_SHIFT; + ep-ep.caps.dir_out = true; + } + if (i == UDC_EP0IN_IDX || i == UDC_EP0OUT_IDX) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } /* need to set ep-ep.maxpacket and set Default Configuration?*/ usb_ep_set_maxpacket_limit(ep-ep, UDC_BULK_MAX_PKT_SIZE); list_add_tail(ep-ep.ep_list, dev-gadget.ep_list); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 28/37] usb: gadget: pxa27x_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/pxa27x_udc.h | 33 ++--- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h index 11e1423..ded058c 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.h +++ b/drivers/usb/gadget/udc/pxa27x_udc.h @@ -234,25 +234,28 @@ /* * Endpoint definition helpers */ -#define USB_EP_DEF(addr, bname, dir, type, maxpkt) \ -{ .usb_ep = { .name = bname, .ops = pxa_ep_ops, .maxpacket = maxpkt, }, \ +#define USB_EP_DEF(addr, bname, dir, type, maxpkt, ctype, cdir) \ +{ .usb_ep = { .name = bname, .ops = pxa_ep_ops, .maxpacket = maxpkt, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## ctype, \ + USB_EP_CAPS_DIR_ ## cdir), }, \ .desc = {.bEndpointAddress = addr | (dir ? USB_DIR_IN : 0), \ - .bmAttributes = type, \ + .bmAttributes = USB_ENDPOINT_XFER_ ## type, \ .wMaxPacketSize = maxpkt, }, \ .dev = memory \ } -#define USB_EP_BULK(addr, bname, dir) \ - USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_BULK, BULK_FIFO_SIZE) -#define USB_EP_ISO(addr, bname, dir) \ - USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_ISOC, ISO_FIFO_SIZE) -#define USB_EP_INT(addr, bname, dir) \ - USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_INT, INT_FIFO_SIZE) -#define USB_EP_IN_BULK(n) USB_EP_BULK(n, ep #n in-bulk, 1) -#define USB_EP_OUT_BULK(n) USB_EP_BULK(n, ep #n out-bulk, 0) -#define USB_EP_IN_ISO(n) USB_EP_ISO(n, ep #n in-iso, 1) -#define USB_EP_OUT_ISO(n) USB_EP_ISO(n, ep #n out-iso, 0) -#define USB_EP_IN_INT(n) USB_EP_INT(n, ep #n in-int, 1) -#define USB_EP_CTRLUSB_EP_DEF(0, ep0, 0, 0, EP0_FIFO_SIZE) +#define USB_EP_BULK(addr, bname, dir, cdir) \ + USB_EP_DEF(addr, bname, dir, BULK, BULK_FIFO_SIZE, BULK, cdir) +#define USB_EP_ISO(addr, bname, dir, cdir) \ + USB_EP_DEF(addr, bname, dir, ISOC, ISO_FIFO_SIZE, ISO, cdir) +#define USB_EP_INT(addr, bname, dir, cdir) \ + USB_EP_DEF(addr, bname, dir, INT, INT_FIFO_SIZE, INT, cdir) +#define USB_EP_IN_BULK(n) USB_EP_BULK(n, ep #n in-bulk, 1, IN) +#define USB_EP_OUT_BULK(n) USB_EP_BULK(n, ep #n out-bulk, 0, OUT) +#define USB_EP_IN_ISO(n) USB_EP_ISO(n, ep #n in-iso, 1, IN) +#define USB_EP_OUT_ISO(n) USB_EP_ISO(n, ep #n out-iso, 0, OUT) +#define USB_EP_IN_INT(n) USB_EP_INT(n, ep #n in-int, 1, IN) +#define USB_EP_CTRLUSB_EP_DEF(0, ep0, 0, CONTROL, \ + EP0_FIFO_SIZE, CONTROL, ALL) #define PXA_EP_DEF(_idx, _addr, dir, _type, maxpkt, _config, iface, altset) \ { \ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/37] usb: gadget: dummy-hcd: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/dummy_hcd.c | 65 +- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 181112c..69fd29a 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -127,23 +127,57 @@ static inline struct dummy_request *usb_request_to_dummy_request static const char ep0name[] = ep0; -static const char *const ep_name[] = { - ep0name,/* everyone has ep0 */ +static const struct { + const char *name; + const struct usb_ep_caps caps; +} ep_info[] = { +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + /* everyone has ep0 */ + EP_INFO(ep0name,CONTROL, ALL), /* act like a pxa250: fifteen fixed function endpoints */ - ep1in-bulk, ep2out-bulk, ep3in-iso, ep4out-iso, ep5in-int, - ep6in-bulk, ep7out-bulk, ep8in-iso, ep9out-iso, ep10in-int, - ep11in-bulk, ep12out-bulk, ep13in-iso, ep14out-iso, - ep15in-int, - + EP_INFO(ep1in-bulk, BULK, IN), + EP_INFO(ep2out-bulk, BULK, OUT), + EP_INFO(ep3in-iso,ISO,IN), + EP_INFO(ep4out-iso, ISO,OUT), + EP_INFO(ep5in-int,INT,IN), + EP_INFO(ep6in-bulk, BULK, IN), + EP_INFO(ep7out-bulk, BULK, OUT), + EP_INFO(ep8in-iso,ISO,IN), + EP_INFO(ep9out-iso, ISO,OUT), + EP_INFO(ep10in-int, INT,IN), + EP_INFO(ep11in-bulk, BULK, IN), + EP_INFO(ep12out-bulk, BULK, OUT), + EP_INFO(ep13in-iso, ISO,IN), + EP_INFO(ep14out-iso, ISO,OUT), + EP_INFO(ep15in-int, INT,IN), /* or like sa1100: two fixed function endpoints */ - ep1out-bulk, ep2in-bulk, - + EP_INFO(ep1out-bulk, BULK, OUT), + EP_INFO(ep2in-bulk, BULK, IN), /* and now some generic EPs so we have enough in multi config */ - ep3out, ep4in, ep5out, ep6out, ep7in, ep8out, ep9in, - ep10out, ep11out, ep12in, ep13out, ep14in, ep15out, + EP_INFO(ep3out, ALL,OUT), + EP_INFO(ep4in,ALL,IN), + EP_INFO(ep5out, ALL,OUT), + EP_INFO(ep6out, ALL,OUT), + EP_INFO(ep7in,ALL,IN), + EP_INFO(ep8out, ALL,OUT), + EP_INFO(ep9in,ALL,IN), + EP_INFO(ep10out, ALL,OUT), + EP_INFO(ep11out, ALL,OUT), + EP_INFO(ep12in, ALL,IN), + EP_INFO(ep13out, ALL,OUT), + EP_INFO(ep14in, ALL,IN), + EP_INFO(ep15out, ALL,OUT), + +#undef EP_INFO }; -#define DUMMY_ENDPOINTSARRAY_SIZE(ep_name) + +#define DUMMY_ENDPOINTSARRAY_SIZE(ep_info) /*-*/ @@ -938,9 +972,10 @@ static void init_dummy_udc_hw(struct dummy *dum) for (i = 0; i DUMMY_ENDPOINTS; i++) { struct dummy_ep *ep = dum-ep[i]; - if (!ep_name[i]) + if (!ep_info[i].name) break; - ep-ep.name = ep_name[i]; + ep-ep.name = ep_info[i].name; + ep-ep.caps = ep_info[i].caps; ep-ep.ops = dummy_ep_ops; list_add_tail(ep-ep.ep_list, dum-gadget.ep_list); ep-halted = ep-wedged = ep-already_seen = @@ -1684,7 +1719,7 @@ static void dummy_timer(unsigned long _dum_hcd) } for (i = 0; i DUMMY_ENDPOINTS; i++) { - if (!ep_name[i]) + if (!ep_info[i].name) break; dum-ep[i].already_seen = 0; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/37] usb: gadget: goku_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/goku_udc.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/gadget/udc/goku_udc.c b/drivers/usb/gadget/udc/goku_udc.c index 9e8d842..46b8d14 100644 --- a/drivers/usb/gadget/udc/goku_udc.c +++ b/drivers/usb/gadget/udc/goku_udc.c @@ -1257,6 +1257,14 @@ static void udc_reinit (struct goku_udc *dev) INIT_LIST_HEAD (ep-queue); ep_reset(NULL, ep); + + if (i == 0) + ep-ep.caps.type_control = true; + else + ep-ep.caps.type_bulk = true; + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } dev-ep[0].reg_mode = NULL; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/37] usb: gadget: lpc32xx_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/lpc32xx_udc.c | 32 1 file changed, 32 insertions(+) diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index 3b6a785..00b5006 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -2575,6 +2575,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep0, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 0, @@ -2586,6 +2588,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep1-int, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 2, @@ -2597,6 +2601,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep2-bulk, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 4, @@ -2608,6 +2614,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep3-iso, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 1023, .hwep_num_base = 6, @@ -2619,6 +2627,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep4-int, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 8, @@ -2630,6 +2640,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep5-bulk, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 10, @@ -2641,6 +2653,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep6-iso, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 1023, .hwep_num_base = 12, @@ -2652,6 +2666,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep7-int, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 14, @@ -2663,6 +2679,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep8-bulk, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 64, .hwep_num_base = 16, @@ -2674,6 +2692,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep9-iso, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, + USB_EP_CAPS_DIR_ALL), }, .maxpacket = 1023, .hwep_num_base = 18, @@ -2685,6 +2705,8 @@ static const struct lpc32xx_udc controller_template = { .ep = { .name = ep10-int, .ops= lpc32xx_ep_ops, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, + USB_EP_CAPS_DIR_ALL), },
[PATCH 04/37] staging: emxx_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Fixed typo in epc-nulk to epc-bulk. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/staging/emxx_udc/emxx_udc.c | 60 ++--- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 3b7aa36..0d64bee 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -3153,36 +3153,33 @@ static const struct usb_gadget_ops nbu2ss_gadget_ops = { .ioctl = nbu2ss_gad_ioctl, }; -static const char g_ep0_name[] = ep0; -static const char g_ep1_name[] = ep1-bulk; -static const char g_ep2_name[] = ep2-bulk; -static const char g_ep3_name[] = ep3in-int; -static const char g_ep4_name[] = ep4-iso; -static const char g_ep5_name[] = ep5-iso; -static const char g_ep6_name[] = ep6-bulk; -static const char g_ep7_name[] = ep7-bulk; -static const char g_ep8_name[] = ep8in-int; -static const char g_ep9_name[] = ep9-iso; -static const char g_epa_name[] = epa-iso; -static const char g_epb_name[] = epb-bulk; -static const char g_epc_name[] = epc-nulk; -static const char g_epd_name[] = epdin-int; - -static const char *gp_ep_name[NUM_ENDPOINTS] = { - g_ep0_name, - g_ep1_name, - g_ep2_name, - g_ep3_name, - g_ep4_name, - g_ep5_name, - g_ep6_name, - g_ep7_name, - g_ep8_name, - g_ep9_name, - g_epa_name, - g_epb_name, - g_epc_name, - g_epd_name, +static const struct { + const char *name; + const struct usb_ep_caps caps; +} ep_info[NUM_ENDPOINTS] = { +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + + EP_INFO(ep0, CONTROL, ALL), + EP_INFO(ep1-bulk, BULK, ALL), + EP_INFO(ep2-bulk, BULK, ALL), + EP_INFO(ep3in-int,INT,IN), + EP_INFO(ep4-iso, INT,ALL), + EP_INFO(ep5-iso, ISO,ALL), + EP_INFO(ep6-bulk, ISO,ALL), + EP_INFO(ep7-bulk, BULK, ALL), + EP_INFO(ep8in-int,INT,IN), + EP_INFO(ep9-iso, ISO,ALL), + EP_INFO(epa-iso, ISO,ALL), + EP_INFO(epb-bulk, BULK, ALL), + EP_INFO(epc-bulk, BULK, ALL), + EP_INFO(epdin-int,INT,IN), + +#undef EP_INFO }; /*-*/ @@ -3200,7 +3197,8 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc) ep-desc = NULL; ep-ep.driver_data = NULL; - ep-ep.name = gp_ep_name[i]; + ep-ep.name = ep_info[i].name; + ep-ep.caps = ep_info[i].caps; ep-ep.ops = nbu2ss_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/37] usb: gadget: m66592-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/m66592-udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index 309706f..e404553 100644 --- a/drivers/usb/gadget/udc/m66592-udc.c +++ b/drivers/usb/gadget/udc/m66592-udc.c @@ -1644,6 +1644,17 @@ static int m66592_probe(struct platform_device *pdev) ep-ep.name = m66592_ep_name[i]; ep-ep.ops = m66592_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, 512); + + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } usb_ep_set_maxpacket_limit(m66592-ep[0].ep, 64); m66592-ep[0].pipenum = 0; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/37] usb: gadget: at91_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/at91_udc.c | 33 - 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index fc42264..a04b073 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c @@ -59,15 +59,29 @@ #defineDRIVER_VERSION 3 May 2006 static const char driver_name [] = at91_udc; -static const char * const ep_names[] = { - ep0, - ep1, - ep2, - ep3-int, - ep4, - ep5, + +static const struct { + const char *name; + const struct usb_ep_caps caps; +} ep_info[] = { +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + + EP_INFO(ep0, CONTROL, ALL), + EP_INFO(ep1, ALL,ALL), + EP_INFO(ep2, ALL,ALL), + EP_INFO(ep3-int, INT,ALL), + EP_INFO(ep4, ALL,ALL), + EP_INFO(ep5, ALL,ALL), + +#undef EP_INFO }; -#define ep0nameep_names[0] + +#define ep0nameep_info[0].name #define VBUS_POLL_TIMEOUT msecs_to_jiffies(1000) @@ -1830,7 +1844,8 @@ static int at91udc_probe(struct platform_device *pdev) for (i = 0; i NUM_ENDPOINTS; i++) { ep = udc-ep[i]; - ep-ep.name = ep_names[i]; + ep-ep.name = ep_info[i].name; + ep-ep.caps = ep_info[i].caps; ep-ep.ops = at91_ep_ops; ep-udc = udc; ep-int_mask = BIT(i); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/37] usb: gadget: amd5536udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/amd5536udc.c | 57 ++--- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/udc/amd5536udc.c b/drivers/usb/gadget/udc/amd5536udc.c index de7e5e2..1a1d91c 100644 --- a/drivers/usb/gadget/udc/amd5536udc.c +++ b/drivers/usb/gadget/udc/amd5536udc.c @@ -138,15 +138,51 @@ static DECLARE_TASKLET(disconnect_tasklet, udc_tasklet_disconnect, /* endpoint names used for print */ static const char ep0_string[] = ep0in; -static const char *const ep_string[] = { - ep0_string, - ep1in-int, ep2in-bulk, ep3in-bulk, ep4in-bulk, ep5in-bulk, - ep6in-bulk, ep7in-bulk, ep8in-bulk, ep9in-bulk, ep10in-bulk, - ep11in-bulk, ep12in-bulk, ep13in-bulk, ep14in-bulk, - ep15in-bulk, ep0out, ep1out-bulk, ep2out-bulk, ep3out-bulk, - ep4out-bulk, ep5out-bulk, ep6out-bulk, ep7out-bulk, - ep8out-bulk, ep9out-bulk, ep10out-bulk, ep11out-bulk, - ep12out-bulk, ep13out-bulk, ep14out-bulk, ep15out-bulk +static const struct { + const char *name; + const struct usb_ep_caps caps; +} ep_info[] = { +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + + EP_INFO(ep0_string, CONTROL, IN), + EP_INFO(ep1in-int,BULK, IN), + EP_INFO(ep2in-bulk, BULK, IN), + EP_INFO(ep3in-bulk, BULK, IN), + EP_INFO(ep4in-bulk, BULK, IN), + EP_INFO(ep5in-bulk, BULK, IN), + EP_INFO(ep6in-bulk, BULK, IN), + EP_INFO(ep7in-bulk, BULK, IN), + EP_INFO(ep8in-bulk, BULK, IN), + EP_INFO(ep9in-bulk, BULK, IN), + EP_INFO(ep10in-bulk, BULK, IN), + EP_INFO(ep11in-bulk, BULK, IN), + EP_INFO(ep12in-bulk, BULK, IN), + EP_INFO(ep13in-bulk, BULK, IN), + EP_INFO(ep14in-bulk, BULK, IN), + EP_INFO(ep15in-bulk, BULK, IN), + EP_INFO(ep0out, CONTROL, OUT), + EP_INFO(ep1out-bulk, BULK, OUT), + EP_INFO(ep2out-bulk, BULK, OUT), + EP_INFO(ep3out-bulk, BULK, OUT), + EP_INFO(ep4out-bulk, BULK, OUT), + EP_INFO(ep5out-bulk, BULK, OUT), + EP_INFO(ep6out-bulk, BULK, OUT), + EP_INFO(ep7out-bulk, BULK, OUT), + EP_INFO(ep8out-bulk, BULK, OUT), + EP_INFO(ep9out-bulk, BULK, OUT), + EP_INFO(ep10out-bulk, BULK, OUT), + EP_INFO(ep11out-bulk, BULK, OUT), + EP_INFO(ep12out-bulk, BULK, OUT), + EP_INFO(ep13out-bulk, BULK, OUT), + EP_INFO(ep14out-bulk, BULK, OUT), + EP_INFO(ep15out-bulk, BULK, OUT), + +#undef EP_INFO }; /* DMA usage flag */ @@ -1517,7 +1553,8 @@ static void udc_setup_endpoints(struct udc *dev) for (tmp = 0; tmp UDC_EP_NUM; tmp++) { ep = dev-ep[tmp]; ep-dev = dev; - ep-ep.name = ep_string[tmp]; + ep-ep.name = ep_info[tmp].name; + ep-ep.caps = ep_info[tmp].caps; ep-num = tmp; /* txfifo size is calculated at enable time */ ep-txfifo = dev-txfifo; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/37] usb: dwc2: gadget: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/dwc2/gadget.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 4d47b7c..8771b66 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3289,6 +3289,19 @@ static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg, usb_ep_set_maxpacket_limit(hs_ep-ep, epnum ? 1024 : EP0_MPS_LIMIT); hs_ep-ep.ops = s3c_hsotg_ep_ops; + if (epnum == 0) { + hs_ep-ep.caps.type_control = true; + } else { + hs_ep-ep.caps.type_iso = true; + hs_ep-ep.caps.type_bulk = true; + hs_ep-ep.caps.type_int = true; + } + + if (dir_in) + hs_ep-ep.caps.dir_in = true; + else + hs_ep-ep.caps.dir_out = true; + /* * if we're using dma, we need to set the next-endpoint pointer * to be something valid. -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/37] usb: dwc3: gadget: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/dwc3/gadget.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 333a7c0..8d1f768 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1713,6 +1713,19 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, return ret; } + if (epnum == 0) { + dep-endpoint.caps.type_control = true; + } else { + dep-endpoint.caps.type_iso = true; + dep-endpoint.caps.type_bulk = true; + dep-endpoint.caps.type_int = true; + } + + if (epnum 1) + dep-endpoint.caps.dir_in = true; + else + dep-endpoint.caps.dir_out = true; + INIT_LIST_HEAD(dep-request_list); INIT_LIST_HEAD(dep-req_queued); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 15/37] usb: gadget: fsl_udc_core: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/fsl_udc_core.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c index c60022b..aab5221 100644 --- a/drivers/usb/gadget/udc/fsl_udc_core.c +++ b/drivers/usb/gadget/udc/fsl_udc_core.c @@ -2313,6 +2313,19 @@ static int struct_ep_setup(struct fsl_udc *udc, unsigned char index, ep-ep.ops = fsl_ep_ops; ep-stopped = 0; + if (index == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + if (index 1) + ep-ep.caps.dir_in = true; + else + ep-ep.caps.dir_out = true; + /* for ep0: maxP defined in desc * for other eps, maxP is set by epautoconfig() called by gadget layer */ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 31/37] usb: gadget: s3c2410_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/s3c2410_udc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index 5d9aa81..eb3571e 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -1691,6 +1691,8 @@ static struct s3c2410_udc memory = { .name = ep0name, .ops= s3c2410_ep_ops, .maxpacket = EP0_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, }, @@ -1702,6 +1704,8 @@ static struct s3c2410_udc memory = { .name = ep1-bulk, .ops= s3c2410_ep_ops, .maxpacket = EP_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, .fifo_size = EP_FIFO_SIZE, @@ -1714,6 +1718,8 @@ static struct s3c2410_udc memory = { .name = ep2-bulk, .ops= s3c2410_ep_ops, .maxpacket = EP_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, .fifo_size = EP_FIFO_SIZE, @@ -1726,6 +1732,8 @@ static struct s3c2410_udc memory = { .name = ep3-bulk, .ops= s3c2410_ep_ops, .maxpacket = EP_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, .fifo_size = EP_FIFO_SIZE, @@ -1738,6 +1746,8 @@ static struct s3c2410_udc memory = { .name = ep4-bulk, .ops= s3c2410_ep_ops, .maxpacket = EP_FIFO_SIZE, + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, + USB_EP_CAPS_DIR_ALL), }, .dev= memory, .fifo_size = EP_FIFO_SIZE, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 24/37] usb: gadget: net2280: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/net2280.c | 50 ++-- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index 2bee912..0295cf7 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c @@ -74,19 +74,41 @@ static const char driver_desc[] = DRIVER_DESC; static const u32 ep_bit[9] = { 0, 17, 2, 19, 4, 1, 18, 3, 20 }; static const char ep0name[] = ep0; -static const char *const ep_name[] = { - ep0name, - ep-a, ep-b, ep-c, ep-d, - ep-e, ep-f, ep-g, ep-h, -}; -/* Endpoint names for usb3380 advance mode */ -static const char *const ep_name_adv[] = { - ep0name, - ep1in, ep2out, ep3in, ep4out, - ep1out, ep2in, ep3out, ep4in, +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + +static const struct { + const char *name; + const struct usb_ep_caps caps; +} ep_info_dft[] = { /* Default endpoint configuration */ + EP_INFO(ep0name, CONTROL, ALL), + EP_INFO(ep-a, ALL,ALL), + EP_INFO(ep-b, ALL,ALL), + EP_INFO(ep-c, ALL,ALL), + EP_INFO(ep-d, ALL,ALL), + EP_INFO(ep-e, ALL,ALL), + EP_INFO(ep-f, ALL,ALL), + EP_INFO(ep-g, ALL,ALL), + EP_INFO(ep-h, ALL,ALL), +}, ep_info_adv[] = { /* Endpoints for usb3380 advance mode */ + EP_INFO(ep0name, CONTROL, ALL), + EP_INFO(ep1in,ALL,IN), + EP_INFO(ep2out, ALL,OUT), + EP_INFO(ep3in,ALL,IN), + EP_INFO(ep4out, ALL,OUT), + EP_INFO(ep1out, ALL,OUT), + EP_INFO(ep2in,ALL,IN), + EP_INFO(ep3out, ALL,OUT), + EP_INFO(ep4in,ALL,IN), }; +#undef EP_INFO + /* mode 0 == ep-{a,b,c,d} 1K fifo each * mode 1 == ep-{a,b} 2K fifo each, ep-{c,d} unavailable * mode 2 == ep-a 2K fifo, ep-{b,c} 1K each, ep-d unavailable @@ -2055,7 +2077,8 @@ static void usb_reinit_228x(struct net2280 *dev) for (tmp = 0; tmp 7; tmp++) { struct net2280_ep *ep = dev-ep[tmp]; - ep-ep.name = ep_name[tmp]; + ep-ep.name = ep_info_dft[tmp].name; + ep-ep.caps = ep_info_dft[tmp].caps; ep-dev = dev; ep-num = tmp; @@ -2095,7 +2118,10 @@ static void usb_reinit_338x(struct net2280 *dev) for (i = 0; i dev-n_ep; i++) { struct net2280_ep *ep = dev-ep[i]; - ep-ep.name = dev-enhanced_mode ? ep_name_adv[i] : ep_name[i]; + ep-ep.name = dev-enhanced_mode ? ep_info_adv[i].name : + ep_info_dft[i].name; + ep-ep.caps = dev-enhanced_mode ? ep_info_adv[i].caps : + ep_info_dft[i].caps; ep-dev = dev; ep-num = i; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/37] usb: gadget: fsl_qe_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/fsl_qe_udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c index e0822f1..5fb6f8b 100644 --- a/drivers/usb/gadget/udc/fsl_qe_udc.c +++ b/drivers/usb/gadget/udc/fsl_qe_udc.c @@ -2417,6 +2417,17 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num) strcpy(ep-name, ep_name[pipe_num]); ep-ep.name = ep_name[pipe_num]; + if (pipe_num == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; + ep-ep.ops = qe_ep_ops; ep-stopped = 1; usb_ep_set_maxpacket_limit(ep-ep, (unsigned short) ~0); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/37] usb: gadget: bdc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/bdc/bdc_ep.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index b04980c..f9a8f57 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c @@ -1952,12 +1952,18 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir) ep-bdc = bdc; ep-dir = dir; + if (dir) + ep-usb_ep.caps.dir_in = true; + else + ep-usb_ep.caps.dir_out = true; + /* ep-ep_num is the index inside bdc_ep */ if (epnum == 1) { ep-ep_num = 1; bdc-bdc_ep_array[ep-ep_num] = ep; snprintf(ep-name, sizeof(ep-name), ep%d, epnum - 1); usb_ep_set_maxpacket_limit(ep-usb_ep, EP0_MAX_PKT_SIZE); + ep-usb_ep.caps.type_control = true; ep-comp_desc = NULL; bdc-gadget.ep0 = ep-usb_ep; } else { @@ -1971,6 +1977,9 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir) dir 1 ? in : out); usb_ep_set_maxpacket_limit(ep-usb_ep, 1024); + ep-usb_ep.caps.type_iso = true; + ep-usb_ep.caps.type_bulk = true; + ep-usb_ep.caps.type_int = true; ep-usb_ep.max_streams = 0; list_add_tail(ep-usb_ep.ep_list, bdc-gadget.ep_list); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/37] usb: gadget: gr_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/gr_udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index c886887..8aa2593 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -2018,12 +2018,23 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit) usb_ep_set_maxpacket_limit(ep-ep, MAX_CTRL_PL_SIZE); ep-bytes_per_buffer = MAX_CTRL_PL_SIZE; + + ep-ep.caps.type_control = true; } else { usb_ep_set_maxpacket_limit(ep-ep, (u16)maxplimit); list_add_tail(ep-ep.ep_list, dev-gadget.ep_list); + + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; } list_add_tail(ep-ep_list, dev-ep_list); + if (is_in) + ep-ep.caps.dir_in = true; + else + ep-ep.caps.dir_out = true; + ep-tailbuf = dma_alloc_coherent(dev-dev, ep-ep.maxpacket_limit, ep-tailbuf_paddr, GFP_ATOMIC); if (!ep-tailbuf) -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 25/37] usb: gadget: omap_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/omap_udc.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c index e2fcdb8..9b7d394 100644 --- a/drivers/usb/gadget/udc/omap_udc.c +++ b/drivers/usb/gadget/udc/omap_udc.c @@ -2579,6 +2579,28 @@ omap_ep_setup(char *name, u8 addr, u8 type, ep-double_buf = dbuf; ep-udc = udc; + switch (type) { + case USB_ENDPOINT_XFER_CONTROL: + ep-ep.caps.type_control = true; + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; + break; + case USB_ENDPOINT_XFER_ISOC: + ep-ep.caps.type_iso = true; + break; + case USB_ENDPOINT_XFER_BULK: + ep-ep.caps.type_bulk = true; + break; + case USB_ENDPOINT_XFER_INT: + ep-ep.caps.type_int = true; + break; + }; + + if (addr USB_DIR_IN) + ep-ep.caps.dir_in = true; + else + ep-ep.caps.dir_out = true; + ep-ep.name = ep-name; ep-ep.ops = omap_ep_ops; ep-maxpacket = maxp; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/37] usb: gadget: fotg210-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/fotg210-udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index e547ea7..960c70c 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -1153,6 +1153,17 @@ static int fotg210_udc_probe(struct platform_device *pdev) ep-ep.name = fotg210_ep_name[i]; ep-ep.ops = fotg210_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, (unsigned short) ~0); + + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } usb_ep_set_maxpacket_limit(fotg210-ep[0]-ep, 0x40); fotg210-gadget.ep0 = fotg210-ep[0]-ep; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 22/37] usb: gadget: mv_udc_core: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/mv_udc_core.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c index d32160d..306a7ff 100644 --- a/drivers/usb/gadget/udc/mv_udc_core.c +++ b/drivers/usb/gadget/udc/mv_udc_core.c @@ -1257,6 +1257,9 @@ static int eps_init(struct mv_udc *udc) ep-wedge = 0; ep-stopped = 0; usb_ep_set_maxpacket_limit(ep-ep, EP0_MAX_PKT_SIZE); + ep-ep.caps.type_control = true; + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; ep-ep_num = 0; ep-ep.desc = mv_ep0_desc; INIT_LIST_HEAD(ep-queue); @@ -1269,14 +1272,20 @@ static int eps_init(struct mv_udc *udc) if (i % 2) { snprintf(name, sizeof(name), ep%din, i / 2); ep-direction = EP_DIR_IN; + ep-ep.caps.dir_in = true; } else { snprintf(name, sizeof(name), ep%dout, i / 2); ep-direction = EP_DIR_OUT; + ep-ep.caps.dir_out = true; } ep-udc = udc; strncpy(ep-name, name, sizeof(ep-name)); ep-ep.name = ep-name; + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + ep-ep.ops = mv_ep_ops; ep-stopped = 0; usb_ep_set_maxpacket_limit(ep-ep, (unsigned short) ~0); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/37] usb: gadget: fusb300_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/fusb300_udc.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/gadget/udc/fusb300_udc.c b/drivers/usb/gadget/udc/fusb300_udc.c index 3970f45..948845c 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.c +++ b/drivers/usb/gadget/udc/fusb300_udc.c @@ -1450,6 +1450,17 @@ static int fusb300_probe(struct platform_device *pdev) ep-ep.name = fusb300_ep_name[i]; ep-ep.ops = fusb300_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, HS_BULK_MAX_PACKET_SIZE); + + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } usb_ep_set_maxpacket_limit(fusb300-ep[0]-ep, HS_CTL_MAX_PACKET_SIZE); fusb300-ep[0]-epnum = 0; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/37] usb: gadget: bcm63xx_udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/bcm63xx_udc.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index 9db968b..c5e0894 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -44,9 +44,25 @@ #define DRV_MODULE_NAMEbcm63xx_udc static const char bcm63xx_ep0name[] = ep0; -static const char *const bcm63xx_ep_name[] = { - bcm63xx_ep0name, - ep1in-bulk, ep2out-bulk, ep3in-int, ep4out-int, + +static const struct { + const char *name; + const struct usb_ep_caps caps; +} bcm63xx_ep_info[] = { +#define EP_INFO(_name, _type, _dir) \ + { \ + .name = _name, \ + .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \ + USB_EP_CAPS_DIR_ ## _dir), \ + } + + EP_INFO(bcm63xx_ep0name, CONTROL, ALL), + EP_INFO(ep1in-bulk, BULK, IN), + EP_INFO(ep2out-bulk, BULK, OUT), + EP_INFO(ep3in-int,INT,IN), + EP_INFO(ep4out-int, INT,OUT), + +#undef EP_INFO }; static bool use_fullspeed; @@ -943,7 +959,8 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc) for (i = 0; i BCM63XX_NUM_EP; i++) { struct bcm63xx_ep *bep = udc-bep[i]; - bep-ep.name = bcm63xx_ep_name[i]; + bep-ep.name = bcm63xx_ep_info[i].name; + bep-ep.caps = bcm63xx_ep_info[i].caps; bep-ep_num = i; bep-ep.ops = bcm63xx_udc_ep_ops; list_add_tail(bep-ep.ep_list, udc-gadget.ep_list); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/37] usb: gadget: rework ep matching and claiming mechanism
Hello, This patch series reworks endpoint matching and claiming mechanism in epautoconf. The patch (1) introduces new safer endpoint claiming method, basing on new 'claimed' flag. It was discussed here [1]. I proposed this solution over year ago and it was accepted, but apparently I forgot to send the final version of patch. Patches (2-3) add the 'capabilities flags' structure and helper macros. This solution is inspired by the 'feature flags' originally proposed by Felipe Balbi in 2013 [2], but unfortunately implementation of this feature has never been completed. Patches (4-36) add' capabilites flags' support to all UDC drivers present in the kernel tree. It's needed to be done before replacing old endpoint matching mechanism, otherwise UDC drivers which doesn't set 'capabilities flags' won't work with new autoconfig. Patch (37) finally replaces old endpoint matching method with the new one basing on capabilities flags. These changes aims to get rid of code, which guesses endpoint capabilities basing on it's name, and introduce new better replacement. In result we have better way to describe types and directions supported by each endpoint. For example the old name-based method didn't allow to have endpoint supporing two types of transfers - there were only ability to support one or all endpoint types. The 'capabilities flags' feature supply precise, flexible and extendible mechanism of description of endpoint hardware limitations, which is desired for proper endpoint matching. Best regards, Robert Baldyga [1] https://lkml.org/lkml/2014/6/16/94 [2] http://www.spinics.net/lists/linux-usb/msg99662.html Robert Baldyga (37): usb: gadget: encapsulate endpoint claiming mechanism usb: gadget: add endpoint capabilities flags usb: gadget: add endpoint capabilities helper macros staging: emxx_udc: add ep capabilities support usb: chipidea: udc: add ep capabilities support usb: dwc2: gadget: add ep capabilities support usb: dwc3: gadget: add ep capabilities support usb: gadget: amd5536udc: add ep capabilities support usb: gadget: at91_udc: add ep capabilities support usb: gadget: bcm63xx_udc: add ep capabilities support usb: gadget: bdc: add ep capabilities support usb: gadget: dummy-hcd: add ep capabilities support usb: gadget: fotg210-udc: add ep capabilities support usb: gadget: fsl_qe_udc: add ep capabilities support usb: gadget: fsl_udc_core: add ep capabilities support usb: gadget: fusb300_udc: add ep capabilities support usb: gadget: goku_udc: add ep capabilities support usb: gadget: gr_udc: add ep capabilities support usb: gadget: lpc32xx_udc: add ep capabilities support usb: gadget: m66592-udc: add ep capabilities support usb: gadget: mv_u3d_core: add ep capabilities support usb: gadget: mv_udc_core: add ep capabilities support usb: gadget: net2272: add ep capabilities support usb: gadget: net2280: add ep capabilities support usb: gadget: omap_udc: add ep capabilities support usb: gadget: pch_ud: add ep capabilities support usb: gadget: pxa25x_udc: add ep capabilities support usb: gadget: pxa27x_udc: add ep capabilities support usb: gadget: r8a66597-udc: add ep capabilities support usb: gadget: s3c-hsudc: add ep capabilities support usb: gadget: s3c2410_udc: add ep capabilities support usb: gadget: udc-xilinx: add ep capabilities support usb: isp1760: udc: add ep capabilities support usb: musb: gadget: add ep capabilities support usb: renesas: gadget: add ep capabilities support usb: gadget: atmel_usba_udc: add ep capabilities support usb: gadget: epautoconf: add endpoint capabilities flags verification drivers/staging/emxx_udc/emxx_udc.c | 60 drivers/usb/chipidea/udc.c | 14 ++ drivers/usb/dwc2/gadget.c | 13 ++ drivers/usb/dwc3/gadget.c | 13 ++ drivers/usb/gadget/epautoconf.c | 83 +++-- drivers/usb/gadget/udc/amd5536udc.c | 57 ++ drivers/usb/gadget/udc/at91_udc.c | 33 + drivers/usb/gadget/udc/atmel_usba_udc.c | 11 + drivers/usb/gadget/udc/bcm63xx_udc.c| 25 -- drivers/usb/gadget/udc/bdc/bdc_ep.c | 9 drivers/usb/gadget/udc/dummy_hcd.c | 65 -- drivers/usb/gadget/udc/fotg210-udc.c| 11 + drivers/usb/gadget/udc/fsl_qe_udc.c | 11 + drivers/usb/gadget/udc/fsl_udc_core.c | 13 ++ drivers/usb/gadget/udc/fusb300_udc.c| 11 + drivers/usb/gadget/udc/goku_udc.c | 8 drivers/usb/gadget/udc/gr_udc.c | 11 + drivers/usb/gadget/udc/lpc32xx_udc.c| 32 + drivers/usb/gadget/udc/m66592-udc.c | 11 + drivers/usb/gadget/udc/mv_u3d_core.c| 9 drivers/usb/gadget/udc/mv_udc_core.c| 9 drivers/usb/gadget/udc/net2272.c| 11 + drivers/usb/gadget/udc/net2280.c| 50 +++-
[PATCH v2 1/2] net: can: c_can: Fix default pinmux glitch at init
From: J.D. Schroeder jay.schroe...@garmin.com The previous change 3973c526ae9c (net: can: c_can: Disable pins when CAN interface is down) causes a slight glitch on the pinctrl settings when used. Since commit ab78029 (drivers/pinctrl: grab default handles from device core), the device core will automatically set the default pins. This causes the pins to be momentarily set to the default and then to the sleep state in register_c_can_dev(). By adding an optional enable state, boards can set the default pin state to be disabled and avoid the glitch when the switch from default to sleep first occurs. If the enable state is not available c_can_pinctrl_select_state() falls back to using the default pinctrl state. [Roger Q] - Forward port to v4.2 and use pinctrl_get_select(). Signed-off-by: J.D. Schroeder jay.schroe...@garmin.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/net/can/c_can/c_can.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d..5d214d1 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -592,6 +592,7 @@ static int c_can_start(struct net_device *dev) { struct c_can_priv *priv = netdev_priv(dev); int err; + struct pinctrl *p; /* basic c_can configuration */ err = c_can_chip_config(dev); @@ -604,8 +605,13 @@ static int c_can_start(struct net_device *dev) priv-can.state = CAN_STATE_ERROR_ACTIVE; - /* activate pins */ - pinctrl_pm_select_default_state(dev-dev.parent); + /* Attempt to use active if available else use default */ + p = pinctrl_get_select(priv-device, active); + if (!IS_ERR(p)) + pinctrl_put(p); + else + pinctrl_pm_select_default_state(priv-device); + return 0; } -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/37] usb: gadget: add endpoint capabilities helper macros
Add macros useful while initializing array of endpoint capabilities structures. These macros makes structure initialization more compact to decrease number of code lines and increase readability of code. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- include/linux/usb/gadget.h | 20 1 file changed, 20 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 6f3e0fb..e6cbc25 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -158,6 +158,26 @@ struct usb_ep_caps { unsigned dir_out:1; }; +#define USB_EP_CAPS_TYPE_CONTROL 0x01 +#define USB_EP_CAPS_TYPE_ISO 0x02 +#define USB_EP_CAPS_TYPE_BULK0x04 +#define USB_EP_CAPS_TYPE_INT 0x08 +#define USB_EP_CAPS_TYPE_ALL \ + (USB_EP_CAPS_TYPE_ISO | USB_EP_CAPS_TYPE_BULK | USB_EP_CAPS_TYPE_INT) +#define USB_EP_CAPS_DIR_IN 0x01 +#define USB_EP_CAPS_DIR_OUT 0x02 +#define USB_EP_CAPS_DIR_ALL (USB_EP_CAPS_DIR_IN | USB_EP_CAPS_DIR_OUT) + +#define USB_EP_CAPS(_type, _dir) \ + { \ + .type_control = !!(_type USB_EP_CAPS_TYPE_CONTROL), \ + .type_iso = !!(_type USB_EP_CAPS_TYPE_ISO), \ + .type_bulk = !!(_type USB_EP_CAPS_TYPE_BULK), \ + .type_int = !!(_type USB_EP_CAPS_TYPE_INT), \ + .dir_in = !!(_dir USB_EP_CAPS_DIR_IN), \ + .dir_out = !!(_dir USB_EP_CAPS_DIR_OUT), \ + } + /** * struct usb_ep - device side representation of USB endpoint * @name:identifier for the endpoint, such as ep-a or ep9in-bulk -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/37] usb: chipidea: udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/chipidea/udc.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 764f668..eff7cfb 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1624,6 +1624,20 @@ static int init_eps(struct ci_hdrc *ci) hwep-ep.name = hwep-name; hwep-ep.ops = usb_ep_ops; + + if (i == 0) { + hwep-ep.caps.type_control = true; + } else { + hwep-ep.caps.type_iso = true; + hwep-ep.caps.type_bulk = true; + hwep-ep.caps.type_int = true; + } + + if (j == TX) + hwep-ep.caps.dir_in = true; + else + hwep-ep.caps.dir_out = true; + /* * for ep0: maxP defined in desc, for other * eps, maxP is set by epautoconfig() called -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 32/37] usb: gadget: udc-xilinx: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/udc-xilinx.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 1f24274..1cbb0ac 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -1317,12 +1317,21 @@ static void xudc_eps_init(struct xusb_udc *udc) snprintf(ep-name, EPNAME_SIZE, ep%d, ep_number); ep-ep_usb.name = ep-name; ep-ep_usb.ops = xusb_ep_ops; + + ep-ep_usb.caps.type_iso = true; + ep-ep_usb.caps.type_bulk = true; + ep-ep_usb.caps.type_int = true; } else { ep-ep_usb.name = ep0name; usb_ep_set_maxpacket_limit(ep-ep_usb, EP0_MAX_PACKET); ep-ep_usb.ops = xusb_ep0_ops; + + ep-ep_usb.caps.type_control = true; } + ep-ep_usb.caps.dir_in = true; + ep-ep_usb.caps.dir_out = true; + ep-udc = udc; ep-epnumber = ep_number; ep-desc = NULL; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 29/37] usb: gadget: r8a66597-udc: add ep capabilities support
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga r.bald...@samsung.com --- drivers/usb/gadget/udc/r8a66597-udc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 0293f71..baa0609 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1935,6 +1935,16 @@ static int r8a66597_probe(struct platform_device *pdev) ep-ep.name = r8a66597_ep_name[i]; ep-ep.ops = r8a66597_ep_ops; usb_ep_set_maxpacket_limit(ep-ep, 512); + + if (i == 0) { + ep-ep.caps.type_control = true; + } else { + ep-ep.caps.type_iso = true; + ep-ep.caps.type_bulk = true; + ep-ep.caps.type_int = true; + } + ep-ep.caps.dir_in = true; + ep-ep.caps.dir_out = true; } usb_ep_set_maxpacket_limit(r8a66597-ep[0].ep, 64); r8a66597-ep[0].pipenum = 0; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode
On Wed, Jul 08, 2015 at 03:48:05PM +0800, Herbert Xu wrote: On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: +if (req-assoclen + req-cryptlen == 0) { +scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); +return 0; +} How can this be right? Did you enable the selftest? Why not? Self tests are passed for this case. As per the equation given in GCM spec[1], we can see that if assoclen and cryptlen is 0, then output of GCM is just E(K, Y0) where Y0 = IV||(0^31)1 I have E(K, Y0) calculated in previous step. And copying it to destination if assoclen and cryptlen is 0. Correct me if I am wrong. It should be E(K, Y0) ^ GHASH(0). So unless GHASH(0) == 0, your code doesn't work. OK, GHASH(0) is indeed zero so I guess your code does work after all. Cheers, -- Email: Herbert Xu herb...@gondor.apana.org.au Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] net: can: c_can: Fix default pinmux glitch at init
On 07/08/2015 11:13 AM, Roger Quadros wrote: On 07/07/15 18:49, Grygorii Strashko wrote: On 07/07/2015 05:37 PM, Roger Quadros wrote: On 07/07/15 17:35, Roger Quadros wrote: On 07/07/15 17:33, Marc Kleine-Budde wrote: On 07/07/2015 04:27 PM, Roger Quadros wrote: From: J.D. Schroeder jay.schroe...@garmin.com The previous change 3973c526ae9c (net: can: c_can: Disable pins when CAN interface is down) causes a slight glitch on the pinctrl settings when used. Since commit ab78029 (drivers/pinctrl: grab default handles from device core), the device core will automatically set the default pins. This causes the pins to be momentarily set to the default and then to the sleep state in register_c_can_dev(). By adding an optional enable state, boards can set the default pin state to be disabled and avoid the glitch when the switch from default to sleep first occurs. If the enable state is not available c_can_pinctrl_select_state() falls back to using the default pinctrl state. [Roger Q] - Forward port to v4.2 Signed-off-by: J.D. Schroeder jay.schroe...@garmin.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/net/can/c_can/c_can.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d..66e98e7 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -605,7 +605,18 @@ static int c_can_start(struct net_device *dev) priv-can.state = CAN_STATE_ERROR_ACTIVE; /* activate pins */ -pinctrl_pm_select_default_state(dev-dev.parent); +#ifdef CONFIG_PINCTRL Please remove the ifdef, AFAICS there are static inline noop functions if CONFIG_PINCTRL switched off. yes, you are right. On second thoughts device-pins are not defined if CONFIG_PINCTRL is not set. so we can't remove the #ifdef. May be you can use [devm_]pinctrl_get? Why should we do that? The device core has already done the pinctrl_get() and it is available in device-pins-p. True. But It seems, you are going to be only one direct user of pin-p in whole kernel (outside of pictrl core) !? ;) pinctrl_get() will just return a pointer on pinctrl associated with dev if called not the first time and increment kbobj use-counter. Also, there is nice API pinctrl_get_select() and example in kernel 2c7c2c1d. So, according to the documentation and pinctrl code, below sequence should work: struct pinctrl *p; p = pinctrl_get_select(priv-device, active); if (!IS_ERR(p)) pinctrl_put(p); else pinctrl_pm_select_default_state(priv-device); +if (priv-device-pins) { +struct pinctrl_state *s; + +/* Attempt to use active if available else use default */ +s = pinctrl_lookup_state(priv-device-pins-p, active); +if (!IS_ERR(s)) +pinctrl_select_state(priv-device-pins-p, s); ^^ different devices passed here +else +pinctrl_pm_select_default_state(dev-dev.parent); ^^ and here ? Is it ok? +} +#endif return 0; } -- regards, -grygorii -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/9] usb: dwc3: add dual-role support
Register with the USB OTG core. Since we don't support OTG yet we just work as a dual-role device even if device tree says otg. Use extcon framework to get VBUS/ID cable events and kick the OTG state machine. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 155 ++- drivers/usb/dwc3/core.h | 6 ++ drivers/usb/dwc3/platform_data.h | 1 + 3 files changed, 161 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index ff5773c..a7498e0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -706,6 +706,133 @@ static int dwc3_core_get_phy(struct dwc3 *dwc) return 0; } +/* - Dual-Role management --- */ + +static void dwc3_drd_fsm_sync(struct dwc3 *dwc) +{ + int id, vbus; + + /* get ID */ + id = extcon_get_cable_state(dwc-edev, USB-HOST); + /* Host means ID == 0 */ + id = !id; + + /* get VBUS */ + vbus = extcon_get_cable_state(dwc-edev, USB); + dev_dbg(dwc-dev, id %d vbus %d\n, id, vbus); + + dwc-fsm-id = id; + dwc-fsm-vbus = vbus; + usb_otg_sync_inputs(dwc-fsm); +} + +static int dwc3_drd_start_host(struct otg_fsm *fsm, int on) +{ + struct device *dev = usb_otg_fsm_to_dev(fsm); + struct dwc3 *dwc = dev_get_drvdata(dev); + + dev_dbg(dwc-dev, %s: %d\n, __func__, on); + if (on) + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); + + return 0; +} + +static int dwc3_drd_start_gadget(struct otg_fsm *fsm, int on) +{ + struct device *dev = usb_otg_fsm_to_dev(fsm); + struct dwc3 *dwc = dev_get_drvdata(dev); + + dev_dbg(dwc-dev, %s: %d\n, __func__, on); + if (on) { + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); + dwc3_event_buffers_setup(dwc); + } + + return 0; +} + +static struct otg_fsm_ops dwc3_drd_ops = { + .start_host = dwc3_drd_start_host, + .start_gadget = dwc3_drd_start_gadget, +}; + +static int dwc3_drd_notifier(struct notifier_block *nb, + unsigned long event, void *ptr) +{ + struct dwc3 *dwc = container_of(nb, struct dwc3, otg_nb); + + dwc3_drd_fsm_sync(dwc); + + return NOTIFY_DONE; +} + +static int dwc3_drd_init(struct dwc3 *dwc) +{ + int ret, id, vbus; + + if (!dwc-edev) { + dev_err(dwc-dev, No extcon device found for OTG mode\n); + return -ENODEV; + } + + dwc-otg_nb.notifier_call = dwc3_drd_notifier; + ret = extcon_register_notifier(dwc-edev, EXTCON_USB, dwc-otg_nb); + if (ret 0) { + dev_err(dwc-dev, Couldn't register USB cable notifier\n); + return -ENODEV; + } + + ret = extcon_register_notifier(dwc-edev, EXTCON_USB_HOST, + dwc-otg_nb); + if (ret 0) { + dev_err(dwc-dev, Couldn't register USB-HOST cable notifier\n); + ret = -ENODEV; + goto extcon_fail; + } + + /* sanity check id vbus states */ + id = extcon_get_cable_state(dwc-edev, USB-HOST); + vbus = extcon_get_cable_state(dwc-edev, USB); + if (id 0 || vbus 0) { + dev_err(dwc-dev, Invalid USB cable state. id %d, vbus %d\n, + id, vbus); + ret = -ENODEV; + goto fail; + } + + /* register parent as DRD device with OTG core */ + dwc-fsm = usb_otg_register(dwc-dev, dwc3_drd_ops, true); + if (IS_ERR(dwc-fsm)) { + ret = PTR_ERR(dwc-fsm); + if (ret == -ENOSYS) + dev_err(dwc-dev, CONFIG_USB_OTG needed for dual-role\n); + else + dev_err(dwc-dev, Failed to register with OTG core\n); + + goto fail; + } + + dwc3_drd_fsm_sync(dwc); + + return 0; +fail: + extcon_unregister_notifier(dwc-edev, EXTCON_USB_HOST, dwc-otg_nb); +extcon_fail: + extcon_unregister_notifier(dwc-edev, EXTCON_USB, dwc-otg_nb); + + return ret; +} + +static void dwc3_drd_exit(struct dwc3 *dwc) +{ + usb_otg_unregister(dwc-dev); + extcon_unregister_notifier(dwc-edev, EXTCON_USB_HOST, dwc-otg_nb); + extcon_unregister_notifier(dwc-edev, EXTCON_USB,dwc-otg_nb); +} + +/* -- */ + static int dwc3_core_init_mode(struct dwc3 *dwc) { struct device *dev = dwc-dev; @@ -729,13 +856,21 @@ static int dwc3_core_init_mode(struct dwc3 *dwc) } break; case USB_DR_MODE_OTG: - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); + ret = dwc3_drd_init(dwc); + if (ret) { + dev_err(dev, limiting to peripheral only\n); + dwc-dr_mode = USB_DR_MODE_PERIPHERAL; +
[PATCH v3 05/11] usb: hcd.h: Add OTG to HCD interface
The OTG core will use struct otg_hcd_ops to add/remove the HCD controller. The main purpose of this interface is to avoid directly calling usb_add/remove_hcd() from the OTG core as they wouldn't be defined in the built-in symbol table if CONFIG_USB is m. Signed-off-by: Roger Quadros rog...@ti.com --- include/linux/usb/hcd.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index c9aa779..4108288 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -386,6 +386,20 @@ struct hc_driver { }; +/** + * struct otg_hcd_ops - Interface between OTG core and HCD + * + * Provided by the HCD core to allow the OTG core to start/stop the HCD + * + * @add: function to add the HCD + * @remove: function to remove the HCD + */ +struct otg_hcd_ops { + int (*add)(struct usb_hcd *hcd, + unsigned int irqnum, unsigned long irqflags); + void (*remove)(struct usb_hcd *hcd); +}; + static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd) { return hcd-driver-flags HCD_BH; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 01/11] usb: otg-fsm: Add documentation for struct otg_fsm
struct otg_fsm is the interface to the OTG state machine. Document the input, output and internal state variables. Definations are taken from Table 7-2 and Table 7-4 of the USB OTG EH Specification Rev.2.0 Re-arrange some of the members as per use case for more clarity. Signed-off-by: Roger Quadros rog...@ti.com --- include/linux/usb/otg-fsm.h | 89 + 1 file changed, 82 insertions(+), 7 deletions(-) diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index f728f18..ca508c2 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -59,37 +59,112 @@ enum otg_fsm_timer { NUM_OTG_FSM_TIMERS, }; -/* OTG state machine according to the OTG spec */ +/** + * struct otg_fsm - OTG state machine according to the OTG spec + * + * OTG hardware Inputs + * + * Common inputs for A and B device + * @id:TRUE for B-device, FALSE for A-device. + * @adp_change: TRUE when current ADP measurement (n) value, compared to the + * ADP measurement taken at n-2, differs by more than CADP_THR + * @power_up: TRUE when the OTG device first powers up its USB system and + * ADP measurement taken if ADP capable + * + * A-Device state inputs + * @a_srp_det: TRUE if the A-device detects SRP + * @a_vbus_vld:TRUE when VBUS voltage is in regulation + * @b_conn:TRUE if the A-device detects connection from the B-device + * @a_bus_resume: TRUE when the B-device detects that the A-device is signaling + * a resume (K state) + * B-Device state inputs + * @a_bus_suspend: TRUE when the B-device detects that the A-device has put the + * bus into suspend + * @a_conn:TRUE if the B-device detects a connection from the A-device + * @b_se0_srp: TRUE when the line has been at SE0 for more than the minimum + * time before generating SRP + * @b_ssend_srp: TRUE when the VBUS has been below VOTG_SESS_VLD for more than + * the minimum time before generating SRP + * @b_sess_vld:TRUE when the B-device detects that the voltage on VBUS is + * above VOTG_SESS_VLD + * @test_device: TRUE when the B-device switches to B-Host and detects an OTG + * test device. This must be set by host/hub driver + * + * Application inputs (A-Device) + * @a_bus_drop:TRUE when A-device application needs to power down the bus + * @a_bus_req: TRUE when A-device application wants to use the bus. + * FALSE to suspend the bus + * + * Application inputs (B-Device) + * @b_bus_req: TRUE during the time that the Application running on the + * B-device wants to use the bus + * + * Auxilary inputs (OTG v1.3 only. Obsolete now.) + * @a_sess_vld:TRUE if the A-device detects that VBUS is above VA_SESS_VLD + * @b_bus_suspend: TRUE when the A-device detects that the B-device has put + * the bus into suspend + * @b_bus_resume: TRUE when the A-device detects that the B-device is signaling + * resume on the bus + * + * OTG Output status. Read only for users. updated by otg_ops() helpers + * + * Outputs for Both A and B device + * @drv_vbus: TRUE when A-device is driving VBUS + * @loc_conn: TRUE when the local device has signaled that it is connected + * to the bus + * @loc_sof: TRUE when the local device is generating activity on the bus + * @adp_prb: TRUE when the local device is in the process of doing + * ADP probing + * + * Outputs for B-device state + * @adp_sns: TRUE when the B-device is in the process of carrying out + * ADP sensing + * @data_pulse: TRUE when the B-device is performing data line pulsing + * + * Internal Variables + * + * a_set_b_hnp_en: TRUE when the A-device has successfully set the + * b_hnp_enable bit in the B-device. + *Unused as OTG fsm uses otg-host-b_hnp_enable instead + * b_srp_done: TRUE when the B-device has completed initiating SRP + * b_hnp_enable: TRUE when the B-device has accepted the + * SetFeature(b_hnp_enable) B-device. + * Unused as OTG fsm uses otg-gadget-b_hnp_enable instead + * a_clr_err: Asserted (by application ?) to clear a_vbus_err due to an + * overcurrent condition and causes the A-device to transition + * to a_wait_vfall + */ struct otg_fsm { /* Input */ int id; int adp_change; int power_up; - int test_device; - int a_bus_drop; - int a_bus_req; int a_srp_det; int a_vbus_vld; int b_conn; int a_bus_resume; int a_bus_suspend; int a_conn; - int b_bus_req; int b_se0_srp; int b_ssend_srp; int b_sess_vld; + int test_device; + int a_bus_drop; + int a_bus_req; + int b_bus_req; + /* Auxilary inputs */ int a_sess_vld; int b_bus_resume;
[PATCH v3 03/11] usb: otg-fsm: Prevent build warning VDBG redefined
If usb/otg-fsm.h and usb/composite.h are included together then it results in the build warning [1]. Prevent that by using dev_vdbg() instead. Also get rid of MPC_LOC which doesn't seem to be used by anyone. [1] - warning fixed by this patch: In file included from drivers/usb/dwc3/core.h:33, from drivers/usb/dwc3/ep0.c:33: include/linux/usb/otg-fsm.h:30:1: warning: VDBG redefined In file included from drivers/usb/dwc3/ep0.c:31: include/linux/usb/composite.h:615:1: warning: this is the location of the previous definition Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/chipidea/otg_fsm.c | 1 + drivers/usb/common/usb-otg-fsm.c | 12 +++- drivers/usb/phy/phy-fsl-usb.c| 1 + include/linux/usb/otg-fsm.h | 19 --- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 19d655a..6e67f94 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -777,6 +777,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) ci-fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; ci-fsm.otg-state = OTG_STATE_UNDEFINED; ci-fsm.ops = ci_otg_ops; + ci-fsm.dev = ci-dev; mutex_init(ci-fsm.lock); diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 42c6376..1873eb3 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -36,8 +36,9 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol) int ret = 0; if (fsm-protocol != protocol) { - VDBG(Changing role fsm-protocol= %d; new protocol= %d\n, - fsm-protocol, protocol); + dev_vdbg(fsm-dev, +Changing role fsm-protocol= %d; new protocol= %d\n, +fsm-protocol, protocol); /* stop old protocol */ if (fsm-protocol == PROTO_HOST) ret = otg_start_host(fsm, 0); @@ -124,7 +125,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) fsm-state_changed = 1; if (fsm-otg-state == new_state) return 0; - VDBG(Set state: %s\n, usb_otg_state_string(new_state)); + dev_vdbg(fsm-dev, Set state: %s\n, usb_otg_state_string(new_state)); otg_leave_state(fsm, fsm-otg-state); switch (new_state) { case OTG_STATE_B_IDLE: @@ -251,7 +252,7 @@ int otg_statemachine(struct otg_fsm *fsm) switch (state) { case OTG_STATE_UNDEFINED: - VDBG(fsm-id = %d\n, fsm-id); + dev_vdbg(fsm-dev, fsm-id = %d\n, fsm-id); if (fsm-id) otg_set_state(fsm, OTG_STATE_B_IDLE); else @@ -359,7 +360,8 @@ int otg_statemachine(struct otg_fsm *fsm) } mutex_unlock(fsm-lock); - VDBG(quit statemachine, changed = %d\n, fsm-state_changed); + dev_vdbg(fsm-dev, quit statemachine, changed = %d\n, +fsm-state_changed); return fsm-state_changed; } EXPORT_SYMBOL_GPL(otg_statemachine); diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 94eb292..ee3f2c2 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -817,6 +817,7 @@ static int fsl_otg_conf(struct platform_device *pdev) /* Set OTG state machine operations */ fsl_otg_tc-fsm.ops = fsl_otg_ops; + fsl_otg_tc-fsm.dev = pdev-dev; /* initialize the otg structure */ fsl_otg_tc-phy.label = DRIVER_DESC; diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index 243274f..c631dde 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -18,24 +18,10 @@ #ifndef __LINUX_USB_OTG_FSM_H #define __LINUX_USB_OTG_FSM_H +#include linux/device.h #include linux/mutex.h #include linux/errno.h -#undef VERBOSE - -#ifdef VERBOSE -#define VDBG(fmt, args...) pr_debug([%s] fmt , \ -__func__, ## args) -#else -#define VDBG(stuff...) do {} while (0) -#endif - -#ifdef VERBOSE -#define MPC_LOC printk(Current Location [%s]:[%d]\n, __FILE__, __LINE__) -#else -#define MPC_LOC do {} while (0) -#endif - #define PROTO_UNDEF(0) #define PROTO_HOST (1) #define PROTO_GADGET (2) @@ -195,6 +181,9 @@ struct otg_fsm { int protocol; struct mutex lock; bool state_changed; + + /* for debug prints */ + struct device *dev; }; struct otg_fsm_ops { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 06/11] usb: gadget.h: Add OTG to gadget interface
The OTG core will use struct otg_gadget_ops to start/stop the gadget controller. The main purpose of this interface is to avoid directly calling usb_gadget_start/stop() from the OTG core as they wouldn't be defined in the built-in symbol table if CONFIG_USB_GADGET is m. Signed-off-by: Roger Quadros rog...@ti.com --- include/linux/usb/gadget.h | 14 ++ 1 file changed, 14 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 4f3dfb7..0b4b341 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -887,6 +887,20 @@ struct usb_gadget_driver { }; +/*-*/ + +/** + * struct otg_gadget_ops - Interface between OTG core and gadget + * + * Provided by the gadget core to allow the OTG core to start/stop the gadget + * + * @start: function to start the gadget + * @stop: function to stop the gadget + */ +struct otg_gadget_ops { + int (*start)(struct usb_gadget *gadget); + int (*stop)(struct usb_gadget *gadget); +}; /*-*/ -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 04/11] otg-fsm: move usb_bus_start_enum into otg-fsm-ops
This is to prevent missing symbol build error if OTG is enabled (built-in) and HCD core (CONFIG_USB) is module. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/common/usb-otg-fsm.c | 6 -- drivers/usb/phy/phy-fsl-usb.c| 2 ++ include/linux/usb/otg-fsm.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 1873eb3..156fd25 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -166,8 +166,10 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) otg_loc_conn(fsm, 0); otg_loc_sof(fsm, 1); otg_set_protocol(fsm, PROTO_HOST); - usb_bus_start_enum(fsm-otg-host, - fsm-otg-host-otg_port); + if (fsm-ops-start_enum) { + fsm-ops-start_enum(fsm-otg-host, +fsm-otg-host-otg_port); + } break; case OTG_STATE_A_IDLE: otg_drv_vbus(fsm, 0); diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index ee3f2c2..19541ed 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -783,6 +783,8 @@ static struct otg_fsm_ops fsl_otg_ops = { .start_host = fsl_otg_start_host, .start_gadget = fsl_otg_start_gadget, + + .start_enum = usb_bus_start_enum, }; /* Initialize the global variable fsl_otg_dev and request IRQ for OTG */ diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index c631dde..22d8baa 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -198,6 +198,7 @@ struct otg_fsm_ops { void(*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer); int (*start_host)(struct otg_fsm *fsm, int on); int (*start_gadget)(struct otg_fsm *fsm, int on); + int (*start_enum)(struct usb_bus *bus, unsigned port_num); }; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 12/12] usb: chipidea: move from CONFIG_USB_OTG_FSM to CONFIG_USB_OTG
CONFIG_USB_OTG_FSM no longer exists and the OTG FSM is available if CONFIG_USB_OTG is defined so move to using CONFIG_USB_OTG. Signed-off-by: Roger Quadros rog...@ti.com --- Documentation/usb/chipidea.txt | 2 +- drivers/usb/chipidea/Makefile | 2 +- drivers/usb/chipidea/ci.h | 2 +- drivers/usb/chipidea/otg_fsm.h | 2 +- drivers/usb/phy/Kconfig| 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt index 3f848c1..e7f97da 100644 --- a/Documentation/usb/chipidea.txt +++ b/Documentation/usb/chipidea.txt @@ -5,7 +5,7 @@ with 2 Freescale i.MX6Q sabre SD boards. 1.1 How to enable OTG FSM in menuconfig --- -Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules. +Select CONFIG_USB_OTG, rebuild kernel Image and modules. If you want to check some internal variables for otg fsm, select CONFIG_USB_CHIPIDEA_DEBUG, there are 2 files which can show otg fsm variables and some controller registers value: diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 4decb12..63f2394 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile @@ -6,7 +6,7 @@ ci_hdrc-y := core.o otg.o ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST)+= host.o ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o -ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o +ci_hdrc-$(CONFIG_USB_OTG) += otg_fsm.o # Glue/Bridge layers go here diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 6d6200e..c04305e 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -405,7 +405,7 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg, */ static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci) { -#ifdef CONFIG_USB_OTG_FSM +#ifdef CONFIG_USB_OTG return ci-is_otg ci-roles[CI_ROLE_HOST] ci-roles[CI_ROLE_GADGET]; #else diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index 2689375..fb66695 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -62,7 +62,7 @@ /* SSEND time before SRP */ #define TB_SSEND_SRP (1500)/* minimum 1.5 sec, section:5.1.2 */ -#ifdef CONFIG_USB_OTG_FSM +#ifdef CONFIG_USB_OTG int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci); int ci_otg_fsm_work(struct ci_hdrc *ci); diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 869c0cfcad..7e3459f 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -20,7 +20,7 @@ config AB8500_USB config FSL_USB2_OTG bool Freescale USB OTG Transceiver Driver - depends on USB_EHCI_FSL USB_FSL_USB2 USB_OTG_FSM PM + depends on USB_EHCI_FSL USB_FSL_USB2 PM select USB_OTG select USB_PHY help -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 8/9] usb: dwc3: core: Prevent otg events from disabling themselves
There is a race happening during dwc3_drd_init() that causes otg events to get disabled. This is what happens. dwc3_otg_irq() happens immediately when PRTCAP is set to OTG, even though OEVTEN is 0. This is because BIT 31 IRQ of OEVT can't be disabled by OEVTEN. We configure OEVTEN in dwc3_otg_init() but dwc3_otg_irq() has already saved OEVTEN as 0 into dwc-oevten. So finally when dwc3_irq_thread_irq() is called we save 0 into OEVTEN thus disabling OTG irqs forever. We fix this by disabling IRQs when configuring OEVTEN in dwc3_otg_init(). Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d050e0e..e3c094d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -905,6 +905,7 @@ static int dwc3_drd_init(struct dwc3 *dwc) int ret, id, vbus; u32 reg; struct dwc3_hwparams *parms = dwc-hwparams; + unsigned long flags; /* If extcon device is not present we rely on OTG core for ID event */ if (!dwc-edev) { @@ -982,6 +983,8 @@ try_otg_core: goto error; } + spin_lock_irqsave(dwc-lock, flags); + /* we need to set OTG to get events from OTG core */ dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); /* GUSB2PHYCFG0.SusPHY=0 */ @@ -1007,6 +1010,8 @@ try_otg_core: /* OCTL.PeriMode = 1 */ dwc3_writel(dwc-regs, DWC3_OCTL, DWC3_OCTL_PERIMODE); + spin_unlock_irqrestore(dwc-lock, flags); + dwc3_otg_fsm_sync(dwc); usb_otg_sync_inputs(dwc-fsm); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 7/9] usb: dwc3: gadget: Fix suspend/resume during dual-role mode
Gdget controller might not be always active during suspend/ resume when we are operating in dual-role/otg mode. Check if we're active and only if we are then perform necessary actions during suspend/resume. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index cf6b945..3cc8c18 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2779,6 +2779,9 @@ void dwc3_gadget_exit(struct dwc3 *dwc) int dwc3_gadget_suspend(struct dwc3 *dwc) { + if (!dwc-gadget_driver) + return 0; + if (dwc-pullups_connected) { dwc3_gadget_disable_irq(dwc); dwc3_gadget_run_stop(dwc, true, true); @@ -2797,6 +2800,9 @@ int dwc3_gadget_resume(struct dwc3 *dwc) struct dwc3_ep *dep; int ret; + if (!dwc-gadget_driver) + return 0; + /* Start with SuperSpeed Default */ dwc3_gadget_ep0_desc.wMaxPacketSize = cpu_to_le16(512); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/9] usb: dwc3: core: make dual-role work with OTG irq
If the ID pin event is not available over extcon then we rely on the OTG controller to provide us ID and VBUS information. We still don't support any OTG features but just dual-role operation. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 225 drivers/usb/dwc3/core.h | 14 +++ 2 files changed, 223 insertions(+), 16 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7b33d7b..138847f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -706,6 +706,63 @@ static int dwc3_core_get_phy(struct dwc3 *dwc) return 0; } +/* Get OTG events and sync it to OTG fsm */ +static void dwc3_otg_fsm_sync(struct dwc3 *dwc) +{ + u32 reg; + int id, vbus; + + reg = dwc3_readl(dwc-regs, DWC3_OSTS); + dev_dbg(dwc-dev, otgstatus 0x%x\n, reg); + + id = !!(reg DWC3_OSTS_CONIDSTS); + vbus = !!(reg DWC3_OSTS_BSESVLD); + + if (id != dwc-fsm-id || vbus != dwc-fsm-vbus) { + dev_dbg(dwc-dev, id %d vbus %d\n, id, vbus); + dwc-fsm-id = id; + dwc-fsm-vbus = vbus; + usb_otg_sync_inputs(dwc-fsm); + } +} + +static irqreturn_t dwc3_otg_thread_irq(int irq, void *_dwc) +{ + struct dwc3 *dwc = _dwc; + unsigned long flags; + irqreturn_t ret = IRQ_NONE; + + spin_lock_irqsave(dwc-lock, flags); + dwc3_otg_fsm_sync(dwc); + /* unmask interrupts */ + dwc3_writel(dwc-regs, DWC3_OEVTEN, dwc-oevten); + spin_unlock_irqrestore(dwc-lock, flags); + + return ret; +} + +static irqreturn_t dwc3_otg_irq(int irq, void *_dwc) +{ + struct dwc3 *dwc = _dwc; + irqreturn_t ret = IRQ_NONE; + u32 reg; + + spin_lock(dwc-lock); + + reg = dwc3_readl(dwc-regs, DWC3_OEVT); + if (reg) { + dwc3_writel(dwc-regs, DWC3_OEVT, reg); + /* mask interrupts till processed */ + dwc-oevten = dwc3_readl(dwc-regs, DWC3_OEVTEN); + dwc3_writel(dwc-regs, DWC3_OEVTEN, 0); + ret = IRQ_WAKE_THREAD; + } + + spin_unlock(dwc-lock); + + return ret; +} + /* - Dual-Role management --- */ static void dwc3_drd_fsm_sync(struct dwc3 *dwc) @@ -730,10 +787,35 @@ static int dwc3_drd_start_host(struct otg_fsm *fsm, int on) { struct device *dev = usb_otg_fsm_to_dev(fsm); struct dwc3 *dwc = dev_get_drvdata(dev); + u32 reg; dev_dbg(dwc-dev, %s: %d\n, __func__, on); - if (on) - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); + if (dwc-edev) { + if (on) + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); + + return 0; + } + + /* switch OTG core */ + if (on) { + /* OCTL.PeriMode = 0 */ + reg = dwc3_readl(dwc-regs, DWC3_OCTL); + reg = ~DWC3_OCTL_PERIMODE; + dwc3_writel(dwc-regs, DWC3_OCTL, reg); + /* unconditionally turn on VBUS */ + reg |= DWC3_OCTL_PRTPWRCTL; + dwc3_writel(dwc-regs, DWC3_OCTL, reg); + } else { + /* turn off VBUS */ + reg = dwc3_readl(dwc-regs, DWC3_OCTL); + reg = ~DWC3_OCTL_PRTPWRCTL; + dwc3_writel(dwc-regs, DWC3_OCTL, reg); + /* OCTL.PeriMode = 1 */ + reg = dwc3_readl(dwc-regs, DWC3_OCTL); + reg |= DWC3_OCTL_PERIMODE; + dwc3_writel(dwc-regs, DWC3_OCTL, reg); + } return 0; } @@ -742,11 +824,42 @@ static int dwc3_drd_start_gadget(struct otg_fsm *fsm, int on) { struct device *dev = usb_otg_fsm_to_dev(fsm); struct dwc3 *dwc = dev_get_drvdata(dev); + u32 reg; dev_dbg(dwc-dev, %s: %d\n, __func__, on); - if (on) { - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); + if (on) dwc3_event_buffers_setup(dwc); + + if (dwc-edev) { + if (on) + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); + + return 0; + } + + /* switch OTG core */ + if (on) { + /* OCTL.PeriMode = 1 */ + reg = dwc3_readl(dwc-regs, DWC3_OCTL); + reg |= DWC3_OCTL_PERIMODE; + dwc3_writel(dwc-regs, DWC3_OCTL, reg); + /* GUSB2PHYCFG0.SusPHY = 1 */ + if (!dwc-dis_u2_susphy_quirk) { + reg = dwc3_readl(dwc-regs, DWC3_GUSB2PHYCFG(0)); + reg |= DWC3_GUSB2PHYCFG_SUSPHY; + dwc3_writel(dwc-regs, DWC3_GUSB2PHYCFG(0), reg); + } + } else { + /* GUSB2PHYCFG0.SusPHY=0 */ + if (!dwc-dis_u2_susphy_quirk) { + reg = dwc3_readl(dwc-regs, DWC3_GUSB2PHYCFG(0)); + reg =
[PATCH v3 9/9] usb: dwc3: core: don't break during suspend/resume while we're dual-role
We can't rely just on dr_mode to decide if we're in host or gadget mode when we're configured as otg/dual-role. So while dr_mode is OTG, we find out from the otg state machine if we're in host or gadget mode and take the necessary actions during suspend/resume. Also make sure that we disable OTG irq and events during system suspend so that we don't lockup the system during system suspend/resume. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e3c094d..3784287 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1444,18 +1444,15 @@ static int dwc3_suspend(struct device *dev) dwc-octl = dwc3_readl(dwc-regs, DWC3_OCTL); dwc-oevt = dwc3_readl(dwc-regs, DWC3_OEVT); dwc-oevten = dwc3_readl(dwc-regs, DWC3_OEVTEN); + dwc3_writel(dwc-regs, DWC3_OEVTEN, 0); + disable_irq(dwc-otg_irq); } - switch (dwc-dr_mode) { - case USB_DR_MODE_PERIPHERAL: - case USB_DR_MODE_OTG: + if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || + ((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) dwc3_gadget_suspend(dwc); - /* FALLTHROUGH */ - case USB_DR_MODE_HOST: - default: - dwc3_event_buffers_cleanup(dwc); - break; - } + + dwc3_event_buffers_cleanup(dwc); dwc-gctl = dwc3_readl(dwc-regs, DWC3_GCTL); spin_unlock_irqrestore(dwc-lock, flags); @@ -1495,18 +1492,12 @@ static int dwc3_resume(struct device *dev) dwc3_writel(dwc-regs, DWC3_OCTL, dwc-octl); dwc3_writel(dwc-regs, DWC3_OEVT, dwc-oevt); dwc3_writel(dwc-regs, DWC3_OEVTEN, dwc-oevten); + enable_irq(dwc-otg_irq); } - switch (dwc-dr_mode) { - case USB_DR_MODE_PERIPHERAL: - case USB_DR_MODE_OTG: + if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || + ((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) dwc3_gadget_resume(dwc); - /* FALLTHROUGH */ - case USB_DR_MODE_HOST: - default: - /* do nothing */ - break; - } spin_unlock_irqrestore(dwc-lock, flags); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 6/9] usb: dwc3: save/restore OTG registers during suspend/resume
Without this we loose OTG controller register context and malfunction after a system suspend-resume. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 17 + drivers/usb/dwc3/core.h | 6 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 138847f..d050e0e 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -56,6 +56,7 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode) reg = dwc3_readl(dwc-regs, DWC3_GCTL); reg = ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG)); reg |= DWC3_GCTL_PRTCAPDIR(mode); + dwc-current_mode = mode; dwc3_writel(dwc-regs, DWC3_GCTL, reg); } @@ -1432,6 +1433,14 @@ static int dwc3_suspend(struct device *dev) spin_lock_irqsave(dwc-lock, flags); + /* Save OTG state only if we're really using it */ + if (dwc-current_mode == DWC3_GCTL_PRTCAP_OTG) { + dwc-ocfg = dwc3_readl(dwc-regs, DWC3_OCFG); + dwc-octl = dwc3_readl(dwc-regs, DWC3_OCTL); + dwc-oevt = dwc3_readl(dwc-regs, DWC3_OEVT); + dwc-oevten = dwc3_readl(dwc-regs, DWC3_OEVTEN); + } + switch (dwc-dr_mode) { case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_OTG: @@ -1475,6 +1484,14 @@ static int dwc3_resume(struct device *dev) dwc3_event_buffers_setup(dwc); dwc3_writel(dwc-regs, DWC3_GCTL, dwc-gctl); + /* Restore OTG state only if we're really using it */ + if (dwc-current_mode == DWC3_GCTL_PRTCAP_OTG) { + dwc3_writel(dwc-regs, DWC3_OCFG, dwc-ocfg); + dwc3_writel(dwc-regs, DWC3_OCTL, dwc-octl); + dwc3_writel(dwc-regs, DWC3_OEVT, dwc-oevt); + dwc3_writel(dwc-regs, DWC3_OEVTEN, dwc-oevten); + } + switch (dwc-dr_mode) { case USB_DR_MODE_PERIPHERAL: case USB_DR_MODE_OTG: diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 744a5ff..c9c64c9 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -737,6 +737,7 @@ struct dwc3_scratchpad_array { * @regs: base address for our registers * @regs_size: address space size * @oevten: otg interrupt enable mask copy + * @current_mode: current mode of operation written to PRTCAPDIR * @nr_scratch: number of scratch buffers * @num_event_buffers: calculated number of event buffers * @u1u2: only used on revisions 1.83a for workaround @@ -862,9 +863,12 @@ struct dwc3 { /* used for suspend/resume */ u32 dcfg; u32 gctl; - + u32 ocfg; + u32 octl; + u32 oevt; u32 oevten; + u32 current_mode; u32 nr_scratch; u32 num_event_buffers; u32 u1u2; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/9] usb: dwc3: core.h: add some register definitions
Add OTG and GHWPARAMS6 register definitions Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.h | 82 + 1 file changed, 82 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index d0fda04..9c1c094 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -173,6 +173,15 @@ #define DWC3_GCTL_GBLHIBERNATIONEN (1 1) #define DWC3_GCTL_DSBLCLKGTNG (1 0) +/* Global Status Register */ +#define DWC3_GSTS_OTG_IP (1 10) +#define DWC3_GSTS_BC_IP(1 9) +#define DWC3_GSTS_ADP_IP (1 8) +#define DWC3_GSTS_HOST_IP (1 7) +#define DWC3_GSTS_DEVICE_IP(1 6) +#define DWC3_GSTS_CSR_TIMEOUT (1 5) +#define DWC3_GSTS_BUS_ERR_ADDR_VLD (1 4) + /* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST(1 31) #define DWC3_GUSB2PHYCFG_SUSPHY(1 6) @@ -234,6 +243,11 @@ #define DWC3_MAX_HIBER_SCRATCHBUFS 15 /* Global HWPARAMS6 Register */ +#define DWC3_GHWPARAMS6_BCSUPPORT (1 14) +#define DWC3_GHWPARAMS6_OTG3SUPPORT(1 13) +#define DWC3_GHWPARAMS6_ADPSUPPORT (1 12) +#define DWC3_GHWPARAMS6_HNPSUPPORT (1 11) +#define DWC3_GHWPARAMS6_SRPSUPPORT (1 10) #define DWC3_GHWPARAMS6_EN_FPGA(1 7) /* Device Configuration Register */ @@ -393,6 +407,74 @@ #define DWC3_DEPCMD_TYPE_BULK 2 #define DWC3_DEPCMD_TYPE_INTR 3 +/* OTG Configuration Register */ +#define DWC3_OCFG_DISPWRCUTTOFF(1 5) +#define DWC3_OCFG_HIBDISMASK (1 4) +#define DWC3_OCFG_SFTRSTMASK (1 3) +#define DWC3_OCFG_OTGVERSION (1 2) +#define DWC3_OCFG_HNPCAP (1 1) +#define DWC3_OCFG_SRPCAP (1 0) + +/* OTG CTL Register */ +#define DWC3_OCTL_OTG3GOERR(1 7) +#define DWC3_OCTL_PERIMODE (1 6) +#define DWC3_OCTL_PRTPWRCTL(1 5) +#define DWC3_OCTL_HNPREQ (1 4) +#define DWC3_OCTL_SESREQ (1 3) +#define DWC3_OCTL_TERMSELIDPULSE (1 2) +#define DWC3_OCTL_DEVSETHNPEN (1 1) +#define DWC3_OCTL_HSTSETHNPEN (1 0) + +/* OTG Event Register */ +#define DWC3_OEVT_DEVICEMODE (1 31) +#define DWC3_OEVT_XHCIRUNSTPSET(1 27) +#define DWC3_OEVT_DEVRUNSTPSET (1 26) +#define DWC3_OEVT_HIBENTRY (1 25) +#define DWC3_OEVT_CONIDSTSCHNG (1 24) +#define DWC3_OEVT_HRRCONFNOTIF (1 23) +#define DWC3_OEVT_HRRINITNOTIF (1 22) +#define DWC3_OEVT_ADEVIDLE (1 21) +#define DWC3_OEVT_ADEVBHOSTEND (1 20) +#define DWC3_OEVT_ADEVHOST (1 19) +#define DWC3_OEVT_ADEVHNPCHNG (1 18) +#define DWC3_OEVT_ADEVSRPDET (1 17) +#define DWC3_OEVT_ADEVSESSENDDET (1 16) +#define DWC3_OEVT_BDEVBHOSTEND (1 11) +#define DWC3_OEVT_BDEVHNPCHNG (1 10) +#define DWC3_OEVT_BDEVSESSVLDDET (1 9) +#define DWC3_OEVT_BDEVVBUSCHNG (1 8) +#define DWC3_OEVT_BSESSVLD (1 3) +#define DWC3_OEVT_HSTNEGSTS(1 2) +#define DWC3_OEVT_SESREQSTS(1 1) +#define DWC3_OEVT_ERROR(1 0) + +/* OTG Event Enable Register */ +#define DWC3_OEVTEN_XHCIRUNSTPSETEN(1 27) +#define DWC3_OEVTEN_DEVRUNSTPSETEN (1 26) +#define DWC3_OEVTEN_HIBENTRYEN (1 25) +#define DWC3_OEVTEN_CONIDSTSCHNGEN (1 24) +#define DWC3_OEVTEN_HRRCONFNOTIFEN (1 23) +#define DWC3_OEVTEN_HRRINITNOTIFEN (1 22) +#define DWC3_OEVTEN_ADEVIDLEEN (1 21) +#define DWC3_OEVTEN_ADEVBHOSTENDEN (1 20) +#define DWC3_OEVTEN_ADEVHOSTEN (1 19) +#define DWC3_OEVTEN_ADEVHNPCHNGEN (1 18) +#define DWC3_OEVTEN_ADEVSRPDETEN (1 17) +#define DWC3_OEVTEN_ADEVSESSENDDETEN (1 16) +#define DWC3_OEVTEN_BDEVHOSTENDEN (1 11) +#define DWC3_OEVTEN_BDEVHNPCHNGEN (1 10) +#define DWC3_OEVTEN_BDEVSESSVLDDETEN (1 9) +#define DWC3_OEVTEN_BDEVVBUSCHNGE (1 8) + +/* OTG Status Register */ +#define DWC3_OSTS_DEVRUNSTP(1 13) +#define DWC3_OSTS_XHCIRUNSTP (1 12) +#define DWC3_OSTS_PERIPHERALSTATE (1 4) +#define DWC3_OSTS_XHCIPRTPOWER (1 3) +#define DWC3_OSTS_BSESVLD (1 2) +#define DWC3_OSTS_VBUSVLD (1 1) +#define DWC3_OSTS_CONIDSTS (1 0) + /* Structures */ struct dwc3_trb; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/9] usb: dwc3: add dual-role support
Hi, Adds dual role support to dwc3 controller driver. Series depends on [1] for core OTG/dual-role support. Patches are based on v4.2-rc1. Tested on am437x-gp-evm and dra7-evm after platform related patches are applied. Those are sent seprately. You will also need the fixes mentioned in [2] [1] core OTG/DRD support - http://thread.gmane.org/gmane.linux.kernel/1991413 [2] fixes needed for dwc3 to work on dra7 - https://patchwork.kernel.org/patch/6732611/ - https://patchwork.kernel.org/patch/6725291/ - http://article.gmane.org/gmane.linux.usb.general/127693 cheers, -roger Felipe Balbi (1): usb: dwc3: core: Adapt to named interrupts George Cherian (1): usb: dwc3: dwc3-omap: Make the wrapper interrupt shared Roger Quadros (7): usb: dwc3: add dual-role support usb: dwc3: core.h: add some register definitions usb: dwc3: core: make dual-role work with OTG irq usb: dwc3: save/restore OTG registers during suspend/resume usb: dwc3: gadget: Fix suspend/resume during dual-role mode usb: dwc3: core: Prevent otg events from disabling themselves usb: dwc3: core: don't break during suspend/resume while we're dual-role drivers/usb/dwc3/core.c | 409 +-- drivers/usb/dwc3/core.h | 113 +++ drivers/usb/dwc3/dwc3-omap.c | 4 +- drivers/usb/dwc3/gadget.c| 8 +- drivers/usb/dwc3/platform_data.h | 1 + 5 files changed, 513 insertions(+), 22 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/5] ARM: dts: am4372: Add named interrupt property for dwc3
From: Felipe Balbi ba...@ti.com Add interrupt names so that the same can be used for OTG easily. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/am4372.dtsi | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index c80a3e2..3f68b27 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi @@ -859,7 +859,12 @@ usb1: usb@4839 { compatible = synopsys,dwc3; reg = 0x4839 0x1; - interrupts = GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; phys = usb2_phy1; phy-names = usb2-phy; maximum-speed = high-speed; @@ -883,7 +888,12 @@ usb2: usb@483d { compatible = synopsys,dwc3; reg = 0x483d 0x1; - interrupts = GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; phys = usb2_phy2; phy-names = usb2-phy; maximum-speed = high-speed; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/5] ARM: dts: omap5: Add named interrupt property for dwc3
Add interrupt names so that the same can be used for OTG easily. Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/omap5.dtsi | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 7d24ae0..0b25c96 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi @@ -870,7 +870,12 @@ dwc3@4a03 { compatible = snps,dwc3; reg = 0x4a03 0x1; - interrupts = GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; phys = usb2_phy, usb3_phy; phy-names = usb2-phy, usb3-phy; dr_mode = peripheral; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 02/11] usb: otg-fsm: support multiple instances
Move the state_changed variable into struct otg_fsm so that we can support multiple instances. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/common/usb-otg-fsm.c | 10 -- include/linux/usb/otg-fsm.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 61d538a..42c6376 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -61,8 +61,6 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol) return 0; } -static int state_changed; - /* Called when leaving a state. Do state clean up jobs here */ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) { @@ -123,7 +121,7 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) /* Called when entering a state */ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) { - state_changed = 1; + fsm-state_changed = 1; if (fsm-otg-state == new_state) return 0; VDBG(Set state: %s\n, usb_otg_state_string(new_state)); @@ -248,7 +246,7 @@ int otg_statemachine(struct otg_fsm *fsm) mutex_lock(fsm-lock); state = fsm-otg-state; - state_changed = 0; + fsm-state_changed = 0; /* State machine state change judgement */ switch (state) { @@ -361,7 +359,7 @@ int otg_statemachine(struct otg_fsm *fsm) } mutex_unlock(fsm-lock); - VDBG(quit statemachine, changed = %d\n, state_changed); - return state_changed; + VDBG(quit statemachine, changed = %d\n, fsm-state_changed); + return fsm-state_changed; } EXPORT_SYMBOL_GPL(otg_statemachine); diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index ca508c2..243274f 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -194,6 +194,7 @@ struct otg_fsm { /* Current usb protocol used: 0:undefine; 1:host; 2:client */ int protocol; struct mutex lock; + bool state_changed; }; struct otg_fsm_ops { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/5] ARM: dts: OMAP2+: Enable USB dual-role on supported boards
Hi, Enables dual-role feaure on supported boards. Depends on [1] - core USB DRD support - http://thread.gmane.org/gmane.linux.kernel/1991413 [2] - dwc3 DRD support - http://thread.gmane.org/gmane.linux.usb.general/127890 Tested on am437x-gp-evm and dra7-evm. cheers, -roger Felipe Balbi (1): ARM: dts: am4372: Add named interrupt property for dwc3 Roger Quadros (4): ARM: dts: omap5: Add named interrupt property for dwc3 ARM: dts: dra7: Add named interrupt property for dwc3 ARM: dts: dra7*-evm: Enable dual-role for usb1 ARM: dts: am43xx: Enable dual-role on USB1 arch/arm/boot/dts/am4372.dtsi| 14 -- arch/arm/boot/dts/am437x-gp-evm.dts | 2 +- arch/arm/boot/dts/am437x-sk-evm.dts | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- arch/arm/boot/dts/dra7-evm.dts | 2 +- arch/arm/boot/dts/dra7.dtsi | 21 ++--- arch/arm/boot/dts/dra72-evm.dts | 2 +- arch/arm/boot/dts/dra74x.dtsi| 7 ++- arch/arm/boot/dts/omap5.dtsi | 7 ++- 9 files changed, 47 insertions(+), 12 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] thermal: consistently use int for temperatures
Sascha Hauer writes: The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de Cc: Zhang Rui rui.zh...@intel.com Cc: Eduardo Valentin edubez...@gmail.com Cc: linux...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: Jean Delvare jdelv...@suse.de Cc: Peter Feuerer pe...@piie.net Cc: Heiko Stuebner he...@sntech.de Cc: Lukasz Majewski l.majew...@samsung.com Cc: Stephen Warren swar...@wwwdotorg.org Cc: Thierry Reding thierry.red...@gmail.com Cc: linux-a...@vger.kernel.org Cc: platform-driver-...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-...@vger.kernel.org Cc: Guenter Roeck li...@roeck-us.net Cc: Rafael J. Wysocki r...@rjwysocki.net Cc: Maxime Ripard maxime.rip...@free-electrons.com Cc: Darren Hart dvh...@infradead.org Cc: lm-sens...@lm-sensors.org --- [...] For: drivers/platform/x86/acerhdf.c | 9 drivers/thermal/gov_bang_bang.c| 5 ++-- Reviewed-by: Peter Feuerer pe...@piie.net [...] -- --peter; -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode
On Wednesday 08 July 2015 01:18 PM, Herbert Xu wrote: On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: + if (req-assoclen + req-cryptlen == 0) { + scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); + return 0; + } How can this be right? Did you enable the selftest? Why not? Self tests are passed for this case. As per the equation given in GCM spec[1], we can see that if assoclen and cryptlen is 0, then output of GCM is just E(K, Y0) where Y0 = IV||(0^31)1 I have E(K, Y0) calculated in previous step. And copying it to destination if assoclen and cryptlen is 0. Correct me if I am wrong. It should be E(K, Y0) ^ GHASH(0). So unless GHASH(0) == 0, your code doesn't work. Yes, thats right. I have considered that. So, we need GHASH(H, {}, {}). As per the spec, GHASH(H, A, C) = X(m + n + 1). m = n = 0 in our case. X0 = 0 X1 = (X(m + n) ^ (len(A) || len(C)) . H X1 = 0 . H (GF(128) Multiplication) X1 = 0 The same thing is given in the Test case 1 of the spec. GHASH(H, {}, {}) = 0 Thanks and regards, Lokesh Cheers, -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] net: can: c_can: Fix default pinmux glitch at init
On 07/08/2015 10:09 AM, Roger Quadros wrote: device-pins are not defined if CONFIG_PINCTRL is not set. so we can't remove the #ifdef. Too bad :( okay - should I add stable@v.k.o on Cc? I'm not sure if it would help. This patch by itself won't fix anything. It needs to go in together with the DTS change in patch 2. Of course. Maybe if Tony can Ack the second patch then both should be applicable on v4.0+ for stable. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions| Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917- | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | signature.asc Description: OpenPGP digital signature
[PATCH v3 10/11] usb: otg: Add dual-role device (DRD) support
DRD mode is a reduced functionality OTG mode. In this mode we don't support SRP, HNP and dynamic role-swap. In DRD operation, the controller mode (Host or Peripheral) is decided based on the ID pin status. Once a cable plug (Type-A or Type-B) is attached the controller selects the state and doesn't change till the cable in unplugged and a different cable type is inserted. As we don't need most of the complex OTG states and OTG timers we implement a lean DRD state machine in usb-otg.c. The DRD state machine is only interested in 2 hardware inputs 'id' and 'vbus; that are still passed via the origintal struct otg_fsm. Most of the usb-otg.c functionality remains the same except adding a new parameter to usb_otg_register() to indicate that the OTG controller needs to operate in DRD mode. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/common/usb-otg.c | 179 --- include/linux/usb/otg-fsm.h | 8 +- include/linux/usb/otg.h | 5 +- 3 files changed, 180 insertions(+), 12 deletions(-) diff --git a/drivers/usb/common/usb-otg.c b/drivers/usb/common/usb-otg.c index 1f19001..9b89f4b 100644 --- a/drivers/usb/common/usb-otg.c +++ b/drivers/usb/common/usb-otg.c @@ -44,6 +44,7 @@ struct otg_hcd { struct otg_data { struct device *dev; /* HCD GCD's parent device */ + bool drd_only; /* Dual-role only, no OTG features */ struct otg_fsm fsm; /* HCD, GCD and usb_otg_state are present in otg_fsm-otg * HCD is bus_to_hcd(fsm-otg-host) @@ -272,20 +273,172 @@ static int usb_otg_start_gadget(struct otg_fsm *fsm, int on) return 0; } +/* Change USB protocol when there is a protocol change */ +static int drd_set_protocol(struct otg_fsm *fsm, int protocol) +{ + struct otg_data *otgd = container_of(fsm, struct otg_data, fsm); + int ret = 0; + + if (fsm-protocol != protocol) { + dev_dbg(otgd-dev, otg: changing role fsm-protocol= %d; new protocol= %d\n, + fsm-protocol, protocol); + /* stop old protocol */ + if (fsm-protocol == PROTO_HOST) + ret = otg_start_host(fsm, 0); + else if (fsm-protocol == PROTO_GADGET) + ret = otg_start_gadget(fsm, 0); + if (ret) + return ret; + + /* start new protocol */ + if (protocol == PROTO_HOST) + ret = otg_start_host(fsm, 1); + else if (protocol == PROTO_GADGET) + ret = otg_start_gadget(fsm, 1); + if (ret) + return ret; + + fsm-protocol = protocol; + return 0; + } + + return 0; +} + +/* Called when entering a DRD state */ +static void drd_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) +{ + struct otg_data *otgd = container_of(fsm, struct otg_data, fsm); + + if (fsm-otg-state == new_state) + return; + + fsm-state_changed = 1; + dev_dbg(otgd-dev, otg: set state: %s\n, + usb_otg_state_string(new_state)); + switch (new_state) { + case OTG_STATE_B_IDLE: + drd_set_protocol(fsm, PROTO_UNDEF); + break; + case OTG_STATE_B_PERIPHERAL: + drd_set_protocol(fsm, PROTO_GADGET); + break; + case OTG_STATE_A_HOST: + drd_set_protocol(fsm, PROTO_HOST); + break; + case OTG_STATE_UNDEFINED: + case OTG_STATE_B_SRP_INIT: + case OTG_STATE_B_WAIT_ACON: + case OTG_STATE_B_HOST: + case OTG_STATE_A_IDLE: + case OTG_STATE_A_WAIT_VRISE: + case OTG_STATE_A_WAIT_BCON: + case OTG_STATE_A_SUSPEND: + case OTG_STATE_A_PERIPHERAL: + case OTG_STATE_A_WAIT_VFALL: + case OTG_STATE_A_VBUS_ERR: + default: + dev_warn(otgd-dev, %s: otg: invalid state: %s\n, +__func__, usb_otg_state_string(new_state)); + break; + } + + fsm-otg-state = new_state; +} + /** - * OTG FSM work function + * DRD state change judgement + * + * For DRD we're only interested in some of the OTG states + * i.e. OTG_STATE_B_IDLE: both peripheral and host are stopped + * OTG_STATE_B_PERIPHERAL: peripheral active + * OTG_STATE_A_HOST: host active + * we're only interested in the following inputs + * fsm-id, fsm-vbus + */ +static int drd_statemachine(struct otg_fsm *fsm) +{ + struct otg_data *otgd = container_of(fsm, struct otg_data, fsm); + enum usb_otg_state state; + + mutex_lock(fsm-lock); + + state = fsm-otg-state; + + switch (state) { + case OTG_STATE_UNDEFINED: + if (!fsm-id) + drd_set_state(fsm, OTG_STATE_A_HOST); + else if (fsm-id fsm-vbus) + drd_set_state(fsm, OTG_STATE_B_PERIPHERAL); +
[PATCH v3 07/11] usb: otg: add OTG core
The OTG core instantiates the OTG Finite State Machine per OTG controller and manages starting/stopping the host and gadget controllers based on the bus state. It provides APIs for the following tasks - Registering an OTG capable controller - Registering Host and Gadget controllers to OTG core - Providing inputs to and kicking the OTG state machine Signed-off-by: Roger Quadros rog...@ti.com --- MAINTAINERS | 4 +- drivers/usb/Kconfig | 2 +- drivers/usb/Makefile | 1 + drivers/usb/common/Makefile | 3 +- drivers/usb/common/usb-otg.c | 768 +++ drivers/usb/common/usb-otg.h | 71 drivers/usb/core/Kconfig | 11 +- include/linux/usb/otg.h | 91 - 8 files changed, 930 insertions(+), 21 deletions(-) create mode 100644 drivers/usb/common/usb-otg.c create mode 100644 drivers/usb/common/usb-otg.h diff --git a/MAINTAINERS b/MAINTAINERS index 8133cef..b21278e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10640,12 +10640,14 @@ S:Maintained F: Documentation/usb/ohci.txt F: drivers/usb/host/ohci* -USB OTG FSM (Finite State Machine) +USB OTG/DRD core and FSM (Finite State Machine) M: Peter Chen peter.c...@freescale.com +M: Roger Quadros rog...@ti.com T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git L: linux-...@vger.kernel.org S: Maintained F: drivers/usb/common/usb-otg-fsm.c +F: drivers/usb/common/usb-otg.c USB OVER IP DRIVER M: Valentina Manea valentina.mane...@gmail.com diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 8ed451d..5b625e2 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -32,7 +32,7 @@ if USB_SUPPORT config USB_COMMON tristate default y - depends on USB || USB_GADGET + depends on USB || USB_GADGET || USB_OTG config USB_ARCH_HAS_HCD def_bool y diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index d8926c6..769d13b 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -60,5 +60,6 @@ obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/ obj-$(CONFIG_USB_GADGET) += gadget/ obj-$(CONFIG_USB_COMMON) += common/ +obj-$(CONFIG_USB_OTG) += common/ obj-$(CONFIG_USBIP_CORE) += usbip/ diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile index 6bbb3ec..730d928 100644 --- a/drivers/usb/common/Makefile +++ b/drivers/usb/common/Makefile @@ -6,5 +6,6 @@ obj-$(CONFIG_USB_COMMON) += usb-common.o usb-common-y += common.o usb-common-$(CONFIG_USB_LED_TRIG) += led.o -obj-$(CONFIG_USB_OTG_FSM) += usb-otg-fsm.o obj-$(CONFIG_USB_ULPI_BUS) += ulpi.o +usbotg-y := usb-otg.o usb-otg-fsm.o +obj-$(CONFIG_USB_OTG) += usbotg.o diff --git a/drivers/usb/common/usb-otg.c b/drivers/usb/common/usb-otg.c new file mode 100644 index 000..0379034 --- /dev/null +++ b/drivers/usb/common/usb-otg.c @@ -0,0 +1,768 @@ +/** + * drivers/usb/common/usb-otg.c - USB OTG core + * + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com + * Author: Roger Quadros rog...@ti.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/kernel.h +#include linux/ktime.h +#include linux/hrtimer.h +#include linux/list.h +#include linux/usb/otg.h +#include linux/usb/phy.h /* enum usb_otg_state */ +#include linux/usb/gadget.h +#include linux/workqueue.h + +#include usb-otg.h + +/* to link timer with callback data */ +struct otg_timer { + struct hrtimer timer; + ktime_t timeout; + /* callback data */ + int *timeout_bit; + struct otg_data *otgd; +}; + +struct otg_hcd { + struct usb_hcd *hcd; + unsigned int irqnum; + unsigned long irqflags; + struct otg_hcd_ops *ops; +}; + +struct otg_data { + struct device *dev; /* HCD GCD's parent device */ + + struct otg_fsm fsm; + /* HCD, GCD and usb_otg_state are present in otg_fsm-otg +* HCD is bus_to_hcd(fsm-otg-host) +* GCD is fsm-otg-gadget +*/ + struct otg_fsm_ops fsm_ops; /* private copy for override */ + struct usb_otg otg; /* allocator for fsm-otg */ + + struct otg_hcd primary_hcd; + struct otg_hcd shared_hcd; + + struct otg_gadget_ops *gadget_ops; /* interface to gadget f/w */ + + /* saved hooks to OTG device */ + int (*start_host)(struct otg_fsm *fsm, int on); + int (*start_gadget)(struct otg_fsm *fsm, int on); + + struct list_head list; + +
[PATCH v3 11/11] usb: otg: hub: Notify OTG fsm when A device sets b_hnp_enable
This is the a_set_b_hnp_enable flag in the OTG state machine diagram and must be set when the A-Host has successfully set the b_hnp_enable feature of the OTG-B-Peripheral attached to it. When this bit changes we kick our OTG FSM to make note of the change and act accordingly. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/core/hub.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 43cb2f2..c358419 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2271,6 +2271,9 @@ static int usb_enumerate_device_otg(struct usb_device *udev) can't set HNP mode: %d\n, err); bus-b_hnp_enable = 0; + } else { + /* notify OTG fsm about a_set_b_hnp_enable */ + usb_otg_kick_fsm(udev-bus-controller); } } } @@ -4234,8 +4237,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, */ if (!hdev-parent) { delay = HUB_ROOT_RESET_TIME; - if (port1 == hdev-bus-otg_port) + if (port1 == hdev-bus-otg_port) { hdev-bus-b_hnp_enable = 0; +#ifdef CONFIG_USB_OTG + /* notify OTG fsm about a_set_b_hnp_enable change */ + usb_otg_kick_fsm(hdev-bus-controller); +#endif + } } /* Some low speed devices have problems with the quick delay, so */ -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 09/11] usb: gadget: udc: adapt to OTG core
The OTG state machine needs a mechanism to start and stop the gadget controller. Add usb_gadget_start() and usb_gadget_stop(). Register with OTG core when gadget function driver is available and unregister when function driver is unbound. We need to unlock the usb_lock mutexbefore calling usb_otg_register_gadget() in udc_bind_to_driver() and usb_gadget_remove_driver() else it will cause a circular locking dependency. Ignore softconnect sysfs control when we're in OTG mode as OTG FSM takes care of gadget softconnect using the b_bus_req mechanism. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/gadget/udc/udc-core.c | 124 +++--- 1 file changed, 114 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index d69c355..3380d03 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -28,6 +28,7 @@ #include linux/usb/ch9.h #include linux/usb/gadget.h #include linux/usb.h +#include linux/usb/otg.h /** * struct usb_udc - describes one usb device controller @@ -37,6 +38,7 @@ * @list - for use by the udc class driver * @vbus - for udcs who care about vbus status, this value is real vbus status; * for udcs who do not care about vbus status, this value is always true + * @is_otg - we're registered with OTG core and it takes care of UDC start/stop * * This represents the internal data structure which is used by the UDC-class * to hold information about udc driver and gadget together. @@ -47,6 +49,7 @@ struct usb_udc { struct device dev; struct list_headlist; boolvbus; + boolis_otg; }; static struct class *udc_class; @@ -208,6 +211,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_udc_reset); */ static inline int usb_gadget_udc_start(struct usb_udc *udc) { + dev_dbg(udc-dev, %s\n, __func__); return udc-gadget-ops-udc_start(udc-gadget, udc-driver); } @@ -225,10 +229,81 @@ static inline int usb_gadget_udc_start(struct usb_udc *udc) */ static inline void usb_gadget_udc_stop(struct usb_udc *udc) { + dev_dbg(udc-dev, %s\n, __func__); udc-gadget-ops-udc_stop(udc-gadget); } /** + * usb_gadget_start - start the usb gadget controller and connect to bus + * @gadget: the gadget device to start + * + * This is external API for use by OTG core. + * + * Start the usb device controller and connect to bus (enable pull). + */ +static int usb_gadget_start(struct usb_gadget *gadget) +{ + int ret; + struct usb_udc *udc = NULL; + + dev_dbg(gadget-dev, %s\n, __func__); + mutex_lock(udc_lock); + list_for_each_entry(udc, udc_list, list) + if (udc-gadget == gadget) + goto found; + + dev_err(gadget-dev.parent, %s: gadget not registered.\n, + __func__); + mutex_unlock(udc_lock); + return -EINVAL; + +found: + ret = usb_gadget_udc_start(udc); + if (ret) + dev_err(udc-dev, USB Device Controller didn't start: %d\n, + ret); + else + usb_udc_connect_control(udc); + + mutex_unlock(udc_lock); + + return ret; +} + +/** + * usb_gadget_stop - disconnect from bus and stop the usb gadget + * @gadget: The gadget device we want to stop + * + * This is external API for use by OTG core. + * + * Disconnect from the bus (disable pull) and stop the + * gadget controller. + */ +static int usb_gadget_stop(struct usb_gadget *gadget) +{ + struct usb_udc *udc = NULL; + + dev_dbg(gadget-dev, %s\n, __func__); + mutex_lock(udc_lock); + list_for_each_entry(udc, udc_list, list) + if (udc-gadget == gadget) + goto found; + + dev_err(gadget-dev.parent, %s: gadget not registered.\n, + __func__); + mutex_unlock(udc_lock); + return -EINVAL; + +found: + usb_gadget_disconnect(udc-gadget); + udc-driver-disconnect(udc-gadget); + usb_gadget_udc_stop(udc); + mutex_unlock(udc_lock); + + return 0; +} + +/** * usb_udc_release - release the usb_udc struct * @dev: the dev member within usb_udc * @@ -345,6 +420,7 @@ int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget) } EXPORT_SYMBOL_GPL(usb_add_gadget_udc); +/* udc_lock must be held */ static void usb_gadget_remove_driver(struct usb_udc *udc) { dev_dbg(udc-dev, unregistering UDC driver [%s]\n, @@ -352,10 +428,18 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) kobject_uevent(udc-dev.kobj, KOBJ_CHANGE); - usb_gadget_disconnect(udc-gadget); - udc-driver-disconnect(udc-gadget); + /* If OTG, the otg core ensures UDC is stopped on unregister */ + if (udc-is_otg) { + mutex_unlock(udc_lock); +
[PATCH v3 08/11] usb: hcd: Adapt to OTG core
The existing usb_add/remove_hcd() functionality remains unchanged for non-OTG devices. For OTG devices they only register the HCD with the OTG core. Introduce usb_otg_add/remove_hcd() for use by OTG core. These functions actually add/remove the HCD. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/common/usb-otg.c | 6 ++--- drivers/usb/core/hcd.c | 55 2 files changed, 53 insertions(+), 8 deletions(-) diff --git a/drivers/usb/common/usb-otg.c b/drivers/usb/common/usb-otg.c index 0379034..1f19001 100644 --- a/drivers/usb/common/usb-otg.c +++ b/drivers/usb/common/usb-otg.c @@ -496,7 +496,7 @@ int usb_otg_kick_fsm(struct device *hcd_gcd_device) mutex_lock(otg_list_mutex); otgd = usb_otg_device_get_otgd(hcd_gcd_device-parent); if (!otgd) { - dev_err(hcd_gcd_device, otg: %s: invalid host/gadget device\n, + dev_dbg(hcd_gcd_device, otg: %s: invalid host/gadget device\n, __func__); mutex_unlock(otg_list_mutex); return -ENODEV; @@ -678,7 +678,7 @@ int usb_otg_register_gadget(struct usb_gadget *gadget, mutex_lock(otg_list_mutex); otgd = usb_otg_device_get_otgd(otg_dev); if (!otgd) { - dev_err(otg_dev, otg: %s: device not registered to otg core\n, + dev_dbg(otg_dev, otg: %s: device not registered to otg core\n, __func__); mutex_unlock(otg_list_mutex); return -EINVAL; @@ -724,7 +724,7 @@ int usb_otg_unregister_gadget(struct usb_gadget *gadget) mutex_lock(otg_list_mutex); otgd = usb_otg_device_get_otgd(otg_dev); if (!otgd) { - dev_err(otg_dev, otg: %s: device not registered to otg core\n, + dev_dbg(otg_dev, otg: %s: device not registered to otg core\n, __func__); mutex_unlock(otg_list_mutex); return -EINVAL; diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index be5b207..3a19607 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -46,6 +46,7 @@ #include linux/usb.h #include linux/usb/hcd.h #include linux/usb/phy.h +#include linux/usb/otg.h #include usb.h @@ -2622,8 +2623,8 @@ static void usb_put_invalidate_rhdev(struct usb_hcd *hcd) * buffers of consistent memory, register the bus, request the IRQ line, * and call the driver's reset() and start() routines. */ -int usb_add_hcd(struct usb_hcd *hcd, - unsigned int irqnum, unsigned long irqflags) +static int usb_otg_add_hcd(struct usb_hcd *hcd, + unsigned int irqnum, unsigned long irqflags) { int retval; struct usb_device *rhdev; @@ -2828,17 +2829,16 @@ err_phy: } return retval; } -EXPORT_SYMBOL_GPL(usb_add_hcd); /** - * usb_remove_hcd - shutdown processing for generic HCDs + * usb_otg_remove_hcd - shutdown processing for generic HCDs * @hcd: the usb_hcd structure to remove * Context: !in_interrupt() * * Disconnects the root hub, then reverses the effects of usb_add_hcd(), * invoking the HCD's stop() method. */ -void usb_remove_hcd(struct usb_hcd *hcd) +static void usb_otg_remove_hcd(struct usb_hcd *hcd) { struct usb_device *rhdev = hcd-self.root_hub; @@ -2912,6 +2912,51 @@ void usb_remove_hcd(struct usb_hcd *hcd) usb_put_invalidate_rhdev(hcd); } + +static struct otg_hcd_ops otg_hcd_intf = { + .add = usb_otg_add_hcd, + .remove = usb_otg_remove_hcd, +}; + +/** + * usb_add_hcd - finish generic HCD structure initialization and register + * @hcd: the usb_hcd structure to initialize + * @irqnum: Interrupt line to allocate + * @irqflags: Interrupt type flags + * + * Finish the remaining parts of generic HCD initialization: allocate the + * buffers of consistent memory, register the bus, request the IRQ line, + * and call the driver's reset() and start() routines. + * If it is an OTG device then it only registers the HCD with OTG core. + * + */ +int usb_add_hcd(struct usb_hcd *hcd, + unsigned int irqnum, unsigned long irqflags) +{ + /* If OTG device, OTG core takes care of adding HCD */ + if (usb_otg_register_hcd(hcd, irqnum, irqflags, otg_hcd_intf)) + return usb_otg_add_hcd(hcd, irqnum, irqflags); + + return 0; +} +EXPORT_SYMBOL_GPL(usb_add_hcd); + +/** + * usb_remove_hcd - shutdown processing for generic HCDs + * @hcd: the usb_hcd structure to remove + * Context: !in_interrupt() + * + * Disconnects the root hub, then reverses the effects of usb_add_hcd(), + * invoking the HCD's stop() method. + * If it is an OTG device then it unregisters the HCD from OTG core + * as well. + */ +void usb_remove_hcd(struct usb_hcd *hcd) +{ + /* If OTG device, OTG core takes care of stopping HCD */ + if (usb_otg_unregister_hcd(hcd)) + usb_otg_remove_hcd(hcd); +}
[PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts
From: Felipe Balbi ba...@ti.com Add support to use interrupt names, Following are the interrupt names Peripheral Interrupt - peripheral HOST Interrupt - host OTG Interrupt - otg [Roger Q] - If any of these are missing we use the first available IRQ resource so that we don't break with older DTBs. - Use gadget_irq in gadget driver. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 12 drivers/usb/dwc3/core.h | 7 +++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a7498e0..7b33d7b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev) dwc-xhci_resources[1].flags = res-flags; dwc-xhci_resources[1].name = res-name; + dwc-otg_irq = platform_get_irq_byname(pdev, otg); + if (!dwc-otg_irq) + dwc-otg_irq = res-start; + + dwc-gadget_irq = platform_get_irq_byname(pdev, peripheral); + if (!dwc-gadget_irq) + dwc-gadget_irq = res-start; + + dwc-xhci_irq = platform_get_irq_byname(pdev, host); + if (!dwc-xhci_irq) + dwc-xhci_irq = res-start; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, missing memory resource\n); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 9c1c094..c3431b2 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -742,6 +742,9 @@ struct dwc3_scratchpad_array { * @maximum_speed: maximum speed requested (mainly for testing purposes) * @revision: revision register contents * @dr_mode: requested mode of operation + * @xhci_irq: IRQ number for XHCI IRQs + * @gadget_irq: IRQ number for Peripheral IRQs + * @otg_irq: IRQ number for OTG IRQs * @usb2_phy: pointer to USB2 PHY * @usb3_phy: pointer to USB3 PHY * @usb2_generic_phy: pointer to USB2 PHY @@ -846,6 +849,10 @@ struct dwc3 { enum usb_dr_modedr_mode; + int gadget_irq; + int xhci_irq; + int otg_irq; + /* used for suspend/resume */ u32 dcfg; u32 gctl; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 333a7c0..cf6b945 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1531,7 +1531,7 @@ static int dwc3_gadget_start(struct usb_gadget *g, int irq; u32 reg; - irq = platform_get_irq(to_platform_device(dwc-dev), 0); + irq = dwc-gadget_irq; ret = request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt, IRQF_SHARED, dwc3, dwc); if (ret) { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] net: can: c_can: Fix default pinmux glitch at init
On 08/07/15 13:31, Grygorii Strashko wrote: On 07/08/2015 11:13 AM, Roger Quadros wrote: On 07/07/15 18:49, Grygorii Strashko wrote: On 07/07/2015 05:37 PM, Roger Quadros wrote: On 07/07/15 17:35, Roger Quadros wrote: On 07/07/15 17:33, Marc Kleine-Budde wrote: On 07/07/2015 04:27 PM, Roger Quadros wrote: From: J.D. Schroeder jay.schroe...@garmin.com The previous change 3973c526ae9c (net: can: c_can: Disable pins when CAN interface is down) causes a slight glitch on the pinctrl settings when used. Since commit ab78029 (drivers/pinctrl: grab default handles from device core), the device core will automatically set the default pins. This causes the pins to be momentarily set to the default and then to the sleep state in register_c_can_dev(). By adding an optional enable state, boards can set the default pin state to be disabled and avoid the glitch when the switch from default to sleep first occurs. If the enable state is not available c_can_pinctrl_select_state() falls back to using the default pinctrl state. [Roger Q] - Forward port to v4.2 Signed-off-by: J.D. Schroeder jay.schroe...@garmin.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/net/can/c_can/c_can.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d..66e98e7 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -605,7 +605,18 @@ static int c_can_start(struct net_device *dev) priv-can.state = CAN_STATE_ERROR_ACTIVE; /* activate pins */ -pinctrl_pm_select_default_state(dev-dev.parent); +#ifdef CONFIG_PINCTRL Please remove the ifdef, AFAICS there are static inline noop functions if CONFIG_PINCTRL switched off. yes, you are right. On second thoughts device-pins are not defined if CONFIG_PINCTRL is not set. so we can't remove the #ifdef. May be you can use [devm_]pinctrl_get? Why should we do that? The device core has already done the pinctrl_get() and it is available in device-pins-p. True. But It seems, you are going to be only one direct user of pin-p in whole kernel (outside of pictrl core) !? ;) good point :). pinctrl_get() will just return a pointer on pinctrl associated with dev if called not the first time and increment kbobj use-counter. Also, there is nice API pinctrl_get_select() and example in kernel 2c7c2c1d. So, according to the documentation and pinctrl code, below sequence should work: struct pinctrl *p; p = pinctrl_get_select(priv-device, active); if (!IS_ERR(p)) pinctrl_put(p); else pinctrl_pm_select_default_state(priv-device); This is much neater. I will give that a try. Thanks. cheers, -roger +if (priv-device-pins) { +struct pinctrl_state *s; + +/* Attempt to use active if available else use default */ +s = pinctrl_lookup_state(priv-device-pins-p, active); +if (!IS_ERR(s)) +pinctrl_select_state(priv-device-pins-p, s); ^^ different devices passed here +else +pinctrl_pm_select_default_state(dev-dev.parent); ^^ and here ? Is it ok? +} +#endif return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] net: can: c_can: Fix default pinmux glitch at init
Marc, On 07/07/15 17:43, Marc Kleine-Budde wrote: On 07/07/2015 04:37 PM, Roger Quadros wrote: diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d..66e98e7 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -605,7 +605,18 @@ static int c_can_start(struct net_device *dev) priv-can.state = CAN_STATE_ERROR_ACTIVE; /* activate pins */ -pinctrl_pm_select_default_state(dev-dev.parent); +#ifdef CONFIG_PINCTRL Please remove the ifdef, AFAICS there are static inline noop functions if CONFIG_PINCTRL switched off. yes, you are right. On second thoughts device-pins are not defined if CONFIG_PINCTRL is not set. so we can't remove the #ifdef. Too bad :( okay - should I add stable@v.k.o on Cc? I'm not sure if it would help. This patch by itself won't fix anything. It needs to go in together with the DTS change in patch 2. Maybe if Tony can Ack the second patch then both should be applicable on v4.0+ for stable. cheers, -roger -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 00/11] USB: OTG/DRD Core functionality
Hi, This series centralizes OTG/Dual-role functionality in the kernel. As of now I've got Dual-role functionality working pretty reliably on dra7-evm and am437x-gp-evm. xhci side of things for OTG/DRD use are already in v4.2 http://thread.gmane.org/gmane.linux.kernel/1923161 DWC3 controller and platform related patches are sent separately. Changelog: - v3: - all otg related definations now in otg.h - single kernel config USB_OTG to enable OTG core and FSM. - resolved symbol dependency issues. - use dev_vdbg instead of VDBG() in usb-otg-fsm.c - rebased on v4.2-rc1 v2: - Use add/remove_hcd() instead of start/stop_hcd() to enable/disable the host controller - added dual-role-device (DRD) state machine which is a much simpler mode of operation when compared to OTG. Here we don't support fancy OTG features like HNP, SRP, on the fly role-swap. The mode of operation is determined based on ID pin (cable type) and the role doesn't change till the cable type changes. Why?: Most of the OTG drivers have been dealing with the OTG state machine themselves and there is a scope for code re-use. This has been partly addressed by the usb/common/usb-otg-fsm.c but it still leaves the instantiation of the state machine and OTG timers to the controller drivers. We re-use usb-otg-fsm.c but go one step further by instantiating the state machine and timers thus making it easier for drivers to implement OTG functionality. Newer OTG cores support standard host interface (e.g. xHCI?) so host and gadget functionality are no longer closely knit like older cores. There needs to be a way to co-ordinate the operation of the host and gadget in OTG mode. i.e. to stop and start them from a central location. This central location should be the USB OTG core. Host and gadget controllers might be sharing resources and can't be always running. One has to be stopped for the other to run. This can't be done as of now and can be done from the OTG core. What?: - The OTG core instantiates the OTG/DRD Finite State Machine per OTG controller and manages starting/stopping the host and gadget controllers based on the bus state. It provides APIs for the following - Registering an OTG capable controller struct otg_fsm *usb_otg_register(struct device *parent_dev, struct otg_fsm_ops *fsm_ops, bool drd_only); int usb_otg_unregister(struct device *parent_dev); - Registering Host controllers to OTG core (used by hcd-core) int usb_otg_register_hcd(struct usb_hcd *hcd, unsigned int irqnum, unsigned long irqflags, struct otg_hcd_ops *ops); int usb_otg_unregister_hcd(struct usb_hcd *hcd); - Registering Gadget controllers to OTG core (used by udc-core) int usb_otg_register_gadget(struct usb_gadget *gadget, struct otg_gadget_ops *ops); int usb_otg_unregister_gadget(struct usb_gadget *gadget); - Providing inputs to and kicking the OTG state machine void usb_otg_sync_inputs(struct otg_fsm *fsm); int usb_otg_kick_fsm(struct device *hcd_gcd_device); - Getting controller device structure from OTG state machine instance struct device *usb_otg_fsm_to_dev(struct otg_fsm *fsm); 'struct otg_fsm' is the interface to the OTG state machine. It contains inputs to the fsm, status of the fsm and operations for the OTG controller driver. Usage model: --- - The OTG controller device is assumed to be the parent of the host and gadget controller. It must call usb_otg_register() before populating the host and gadget devices so that the OTG core is aware that it is an OTG device before the host gadget register. The OTG controller must provide struct otg_fsm_ops * which will be called by the OTG core depending on OTG bus state. - The host/gadget core stacks are modified to inform the OTG core whenever a new host/gadget device is added. The OTG core then checks if the host/gadget is part of the OTG controller and if yes then prevents the host/gadget from starting till both host and gadget are registered, OTG state machine is running and the USB bus state is appropriate to start host/gadget. For this APIs have been added to host/gadget stacks to start/stop the controllers from the OTG core. - No modification is needed for the host/gadget controller drivers. They must ensure that their start/stop methods can be called repeatedly and any shared resources between host gadget are properly managed. The OTG core ensures that both are not started simultaneously. - The OTG core instantiates one OTG state machine per OTG controller and the necessary OTG timers to manage OTG state timeouts. If drd_only parameter is set during usb_otg_register() then it instanciates a DRD (dual-role device) state machine instead. The state machine is started when both host gadget register and stopped when either of them unregisters. The controllers are started and stopped depending on bus state. - During the lifetime of the OTG state
Re: [PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts
Hello. On 7/8/2015 1:36 PM, Roger Quadros wrote: From: Felipe Balbi ba...@ti.com Add support to use interrupt names, Following are the interrupt names Peripheral Interrupt - peripheral HOST Interrupt - host OTG Interrupt - otg [Roger Q] - If any of these are missing we use the first available IRQ resource so that we don't break with older DTBs. - Use gadget_irq in gadget driver. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 12 drivers/usb/dwc3/core.h | 7 +++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a7498e0..7b33d7b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev) dwc-xhci_resources[1].flags = res-flags; dwc-xhci_resources[1].name = res-name; + dwc-otg_irq = platform_get_irq_byname(pdev, otg); + if (!dwc-otg_irq) The usual mistake repeated again: that function reutrns error # on failure, not 0. + dwc-otg_irq = res-start; + + dwc-gadget_irq = platform_get_irq_byname(pdev, peripheral); + if (!dwc-gadget_irq) + dwc-gadget_irq = res-start; Likewise. + + dwc-xhci_irq = platform_get_irq_byname(pdev, host); + if (!dwc-xhci_irq) Likewise. [...] WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 9/9] usb: dwc3: core: don't break during suspend/resume while we're dual-role
Hello. On 7/8/2015 1:37 PM, Roger Quadros wrote: We can't rely just on dr_mode to decide if we're in host or gadget mode when we're configured as otg/dual-role. So while dr_mode is OTG, we find out from the otg state machine if we're in host or gadget mode and take the necessary actions during suspend/resume. Also make sure that we disable OTG irq and events during system suspend so that we don't lockup the system during system suspend/resume. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e3c094d..3784287 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1444,18 +1444,15 @@ static int dwc3_suspend(struct device *dev) dwc-octl = dwc3_readl(dwc-regs, DWC3_OCTL); dwc-oevt = dwc3_readl(dwc-regs, DWC3_OEVT); dwc-oevten = dwc3_readl(dwc-regs, DWC3_OEVTEN); + dwc3_writel(dwc-regs, DWC3_OEVTEN, 0); + disable_irq(dwc-otg_irq); } - switch (dwc-dr_mode) { - case USB_DR_MODE_PERIPHERAL: - case USB_DR_MODE_OTG: + if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || + ((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) Hum, enclosing the first == op into parens and not doing it to the second == op doesn't look very consistent... :-) [...] @@ -1495,18 +1492,12 @@ static int dwc3_resume(struct device *dev) dwc3_writel(dwc-regs, DWC3_OCTL, dwc-octl); dwc3_writel(dwc-regs, DWC3_OEVT, dwc-oevt); dwc3_writel(dwc-regs, DWC3_OEVTEN, dwc-oevten); + enable_irq(dwc-otg_irq); } - switch (dwc-dr_mode) { - case USB_DR_MODE_PERIPHERAL: - case USB_DR_MODE_OTG: + if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || + ((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) Same here... [...] WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND 1/7] tty: serial: 8250: omap: fix kernel crash in suspend-to-ram
Hi Sekhar, On 07/06/2015 05:47 AM, Sekhar Nori wrote: omap_device infrastructure has a suspend_noirq hook which runtime suspends all devices late in the suspend cycle (see _od_suspend_noirq() in arch/arm/mach-omap2/omap_device.c) Why is omap2 the only arch/SoC that does this; ie., call the runtime callbacks after the system pm callbacks? Whatever positive it brings, it's a mess at the driver level. For example, this driver has to hook prepare()/complete() so it can set local state so that it can detect when the runtime suspend is being called during system suspend. Regards, Peter Hurley This leads to a NULL pointer exception in 8250_omap driver since by the time omap8250_runtime_suspend() is called, 8250_dma driver has already set rxchan to NULL via serial8250_release_dma(). Make an explicit check to see if rxchan is NULL in runtime_{suspend|resume} hooks to fix this. Signed-off-by: Sekhar Nori nsek...@ti.com --- Previous version: http://www.spinics.net/lists/linux-omap/msg119459.html No change in this version except rebased to v4.2-rc1 drivers/tty/serial/8250/8250_omap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index d75a66c72750..20c5b9c4c288 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -1285,7 +1285,7 @@ static int omap8250_runtime_suspend(struct device *dev) return -EBUSY; } - if (up-dma) + if (up-dma up-dma-rxchan) omap_8250_rx_dma(up, UART_IIR_RX_TIMEOUT); priv-latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; @@ -1310,7 +1310,7 @@ static int omap8250_runtime_resume(struct device *dev) if (loss_cntx) omap8250_restore_regs(up); - if (up-dma) + if (up-dma up-dma-rxchan) omap_8250_rx_dma(up, 0); priv-latency = priv-calc_latency; -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/10] fbdev: omap2: connector-dvi: use of_get_i2c_adapter_by_node interface
This change is needed to properly lock I2C bus driver, which serves DDC. Prior to this change i2c_put_adapter() is misused, which may lead to an overflow over zero of I2C bus driver user counter. Signed-off-by: Vladimir Zapolskiy vladimir_zapols...@mentor.com --- drivers/video/fbdev/omap2/displays-new/connector-dvi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c index a8ce920..d811e6d 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c @@ -294,7 +294,7 @@ static int dvic_probe_of(struct platform_device *pdev) adapter_node = of_parse_phandle(node, ddc-i2c-bus, 0); if (adapter_node) { - adapter = of_find_i2c_adapter_by_node(adapter_node); + adapter = of_get_i2c_adapter_by_node(adapter_node); if (adapter == NULL) { dev_err(pdev-dev, failed to parse ddc-i2c-bus\n); omap_dss_put_device(ddata-in); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/10] i2c/drm: fix i2c adapter device driver user counter
The 01/10 change adds and exports new of_get_i2c_adapter_by_node() interface of i2c core, the rest of patches fix current users of of_find_i2c_adapter_by_node() interface. of_find_i2c_adapter_by_node() call requires quite often missing put_device(), and i2c_put_adapter() releases a device locked by i2c_get_adapter() only. In general module_put(adapter-owner) and put_device(dev) are not interchangeable. This is a common error reproduction scenario as a result of the misusage described above (this is run on iMX6 platform with HDMI and I2C bus drivers compiled as kernel modules for clearness): root@mx6q:~# lsmod | grep i2c i2c_imx10213 0 root@mx6q:~# lsmod | grep dw_hdmi_imx dw_hdmi_imx 3631 0 dw_hdmi11846 1 dw_hdmi_imx imxdrm 8674 3 dw_hdmi_imx,imx_ipuv3_crtc,imx_ldb drm_kms_helper113765 5 dw_hdmi,imxdrm,imx_ipuv3_crtc,imx_ldb root@mx6q:~# rmmod dw_hdmi_imx root@mx6q:~# lsmod | grep i2c i2c_imx10213 -1 ^ root@mx6q:~# rmmod i2c_imx rmmod: ERROR: Module i2c_imx is in use To fix existing users of these interfaces and to avoid any further confusion and misusage in future, add one more interface of_get_i2c_adapter_by_node(), it is similar to i2c_get_adapter() in sense that an I2C bus device driver found and locked by user can be correctly unlocked by i2c_put_adapter(). Mainly the change concerns DRM users of I2C bus device. The change is based on torvalds/master branch, d6ac4ffc61a RFC of the 01/10 change is http://www.spinics.net/lists/linux-i2c/msg20257.html Vladimir Zapolskiy (10): i2c: add and export of_get_i2c_adapter_by_node() interface drm: dw_hdmi: use of_get_i2c_adapter_by_node interface drm: exynos_hdmi: use of_get_i2c_adapter_by_node interface drm: imx-tve: use of_get_i2c_adapter_by_node interface drm: panel-simple: use of_get_i2c_adapter_by_node interface drm: sti_hdmi: use of_get_i2c_adapter_by_node interface drm: tegra: use of_get_i2c_adapter_by_node interface drm: tilcdc: use of_get_i2c_adapter_by_node interface fbdev: omap2: connector-dvi: use of_get_i2c_adapter_by_node interface i2c: i2c-arb-gpio-challenge: use of_get_i2c_adapter_by_node interface drivers/gpu/drm/bridge/dw_hdmi.c | 14 -- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 +-- drivers/gpu/drm/imx/imx-tve.c | 56 +++--- drivers/gpu/drm/panel/panel-simple.c | 9 ++-- drivers/gpu/drm/sti/sti_hdmi.c | 19 +++- drivers/gpu/drm/tegra/output.c | 19 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 6 +-- drivers/i2c/i2c-core.c | 20 drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 3 +- .../video/fbdev/omap2/displays-new/connector-dvi.c | 2 +- include/linux/i2c.h| 6 +++ 11 files changed, 104 insertions(+), 57 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/1] ARM: DRA7: hwmod: fix gpmc hwmod
Paul/Tony, On 03/06/15 15:38, Roger Quadros wrote: GPMC smart idle is not really broken but it does not support smart idle with wakeup. Fixes: 556708fe8718 (ARM: OMAP: DRA7: hwmod: Make gpmc software supervised as the smart idle is broken) Signed-off-by: Roger Quadros rog...@ti.com --- v2 - Rebased on top of for-v4.2/omap-hwmod-a Patch 2/2 is no longer needed arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index a0411f3..152526a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c @@ -820,7 +820,7 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = { .class= dra7xx_gpmc_hwmod_class, .clkdm_name= l3main1_clkdm, /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */ -.flags= HWMOD_SWSUP_SIDLE | DEBUG_OMAP_GPMC_HWMOD_FLAGS, +.flags= DEBUG_OMAP_GPMC_HWMOD_FLAGS, .main_clk= l3_iclk_div, .prcm = { .omap4 = { @@ -1421,8 +1421,7 @@ static struct omap_hwmod_class_sysconfig dra7xx_ocp2scp_sysc = { .syss_offs= 0x0014, .sysc_flags= (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), -.idlemodes= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | - SIDLE_SMART_WKUP), +.idlemodes= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), This bit is wrong. We're modifying ocp2scp idlemode instead of gpmc idle mode. I'll resend this. Hope this is not already in your v4.2-rc queue. .sysc_fields= omap_hwmod_sysc_type1, }; cheers, -roger -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] i2c: core: only use set_scl for bus recovery after calling prepare_recovery
Using set_scl may be ineffective before calling the driver specific prepare_recovery callback, which might change into a test mode. So instead of setting SCL in i2c_generic_scl_recovery, move it to i2c_generic_recovery (after the optional prepare_recovery). Signed-off-by: Jan Luebbe j...@pengutronix.de --- drivers/i2c/i2c-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 069a41f116dd..be992b3e0be8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -567,6 +567,9 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) if (bri-prepare_recovery) bri-prepare_recovery(adap); + bri-set_scl(adap, val); + ndelay(RECOVERY_NDELAY); + /* * By this time SCL is high, as we need to give 9 falling-rising edges */ @@ -597,7 +600,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) int i2c_generic_scl_recovery(struct i2c_adapter *adap) { - adap-bus_recovery_info-set_scl(adap, 1); return i2c_generic_recovery(adap); } EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] i2c: omap: fix bus recovery setup
At least on the AM335x, enabling OMAP_I2C_SYSTEST_ST_EN is not enough to allow direct access to the SCL and SDA pins. In addition to ST_EN, we need to set the TMODE to 0b11 (Loop back SDA/SCL IO mode select). Also, as the reset values of SCL_O and SDA_O are 0 (which means drive low level), we need to set them to 1 (which means high-impedance) to avoid unwanted changes on the pins. As a precaution, reset all these bits to their default values after recovery is complete. Signed-off-by: Jan Luebbe j...@pengutronix.de --- drivers/i2c/busses/i2c-omap.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index d1c22e3fdd14..fc9bf7f30e35 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1247,7 +1247,14 @@ static void omap_i2c_prepare_recovery(struct i2c_adapter *adap) u32 reg; reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); + /* enable test mode */ reg |= OMAP_I2C_SYSTEST_ST_EN; + /* select SDA/SCL IO mode */ + reg |= 3 OMAP_I2C_SYSTEST_TMODE_SHIFT; + /* set SCL to high-impedance state (reset value is 0) */ + reg |= OMAP_I2C_SYSTEST_SCL_O; + /* set SDA to high-impedance state (reset value is 0) */ + reg |= OMAP_I2C_SYSTEST_SDA_O; omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); } @@ -1257,7 +1264,11 @@ static void omap_i2c_unprepare_recovery(struct i2c_adapter *adap) u32 reg; reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); + /* restore reset values */ reg = ~OMAP_I2C_SYSTEST_ST_EN; + reg = ~OMAP_I2C_SYSTEST_TMODE_MASK; + reg = ~OMAP_I2C_SYSTEST_SCL_O; + reg = ~OMAP_I2C_SYSTEST_SDA_O; omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); } -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/1] ARM: DRA7: hwmod: fix gpmc hwmod
GPMC smart idle is not really broken but it does not support smart idle with wakeup. Fixes: 556708fe8718 (ARM: OMAP: DRA7: hwmod: Make gpmc software supervised as the smart idle is broken) Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index a0411f3..1a22737 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c @@ -803,8 +803,7 @@ static struct omap_hwmod_class_sysconfig dra7xx_gpmc_sysc = { .syss_offs = 0x0014, .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), - .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | - SIDLE_SMART_WKUP), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), .sysc_fields= omap_hwmod_sysc_type1, }; @@ -820,7 +819,7 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = { .class = dra7xx_gpmc_hwmod_class, .clkdm_name = l3main1_clkdm, /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */ - .flags = HWMOD_SWSUP_SIDLE | DEBUG_OMAP_GPMC_HWMOD_FLAGS, + .flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS, .main_clk = l3_iclk_div, .prcm = { .omap4 = { -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts
Hi, On 08/07/15 16:06, Sergei Shtylyov wrote: Hello. On 7/8/2015 1:36 PM, Roger Quadros wrote: From: Felipe Balbi ba...@ti.com Add support to use interrupt names, Following are the interrupt names Peripheral Interrupt - peripheral HOST Interrupt - host OTG Interrupt - otg [Roger Q] - If any of these are missing we use the first available IRQ resource so that we don't break with older DTBs. - Use gadget_irq in gadget driver. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 12 drivers/usb/dwc3/core.h | 7 +++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a7498e0..7b33d7b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev) dwc-xhci_resources[1].flags = res-flags; dwc-xhci_resources[1].name = res-name; +dwc-otg_irq = platform_get_irq_byname(pdev, otg); +if (!dwc-otg_irq) The usual mistake repeated again: that function reutrns error # on failure, not 0. +dwc-otg_irq = res-start; + +dwc-gadget_irq = platform_get_irq_byname(pdev, peripheral); +if (!dwc-gadget_irq) +dwc-gadget_irq = res-start; Likewise. + +dwc-xhci_irq = platform_get_irq_byname(pdev, host); +if (!dwc-xhci_irq) Likewise. Right. I'll fix it up. Thanks. cheers, -roger -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] ARM: omap2plus_defconfig: enable support for M25P80 SPI NOR
M25P80 driver provides support for most common SPI NOR devices. These devices are commonly found on TI EVMs for AM437x and DRA7x SoCs. Enable support for this driver in defconfig for omap2plus devices. Signed-off-by: Sekhar Nori nsek...@ti.com --- arch/arm/configs/omap2plus_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 4cb1c11d83ad..f7dec31bc264 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -136,6 +136,8 @@ CONFIG_MTD_ONENAND=y CONFIG_MTD_ONENAND_VERIFY_WRITE=y CONFIG_MTD_ONENAND_OMAP2=y CONFIG_MTD_UBI=y +CONFIG_MTD_SPI_NOR=m +CONFIG_MTD_M25P80=m CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=16384 -- 2.4.4.408.g16da57c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/4] ARM: omap2plus_defconfig: enable support for TI touchscreen
Enable support for on-chip resistive touchscreen m found on AM335x and AM437x devices. Signed-off-by: Sekhar Nori nsek...@ti.com --- arch/arm/configs/omap2plus_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index a8eb36454b14..294059d5ef80 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -208,6 +208,7 @@ CONFIG_TOUCHSCREEN_EDT_FT5X06=m CONFIG_TOUCHSCREEN_PIXCIR=m CONFIG_TOUCHSCREEN_TSC2005=m CONFIG_TOUCHSCREEN_TSC2007=m +CONFIG_TOUCHSCREEN_TI_AM335X_TSC=m CONFIG_INPUT_MISC=y CONFIG_INPUT_TPS65218_PWRBUTTON=m CONFIG_INPUT_TWL4030_PWRBUTTON=m -- 2.4.4.408.g16da57c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/4] ARM: omap2plus_defconfig updates
Hi Tony, Here are some defconfig updates for commonly used drivers on platforms supported by omap2plus_defconfig. Applies to v4.2-rc1 Thanks, Sekhar Sekhar Nori (4): ARM: omap2plus_defconfig: enable support for TI ADC ARM: omap2plus_defconfig: enable support for TI touchscreen ARM: omap2plus_defconfig: enable support for TI CPTS ARM: omap2plus_defconfig: enable support for M25P80 SPI NOR arch/arm/configs/omap2plus_defconfig | 7 +++ 1 file changed, 7 insertions(+) -- 2.4.4.408.g16da57c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] ARM: omap2plus_defconfig: enable support for TI ADC
Enable support for on-chip ADC found on AM335x and AM437x devices. Signed-off-by: Sekhar Nori nsek...@ti.com --- arch/arm/configs/omap2plus_defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index ac521e764d10..a8eb36454b14 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -269,6 +269,7 @@ CONFIG_MFD_PALMAS=y CONFIG_MFD_TPS65217=y CONFIG_MFD_TPS65218=y CONFIG_MFD_TPS65910=y +CONFIG_MFD_TI_AM335X_TSCADC=m CONFIG_TWL6040_CORE=y CONFIG_REGULATOR_PALMAS=y CONFIG_REGULATOR_PBIAS=y @@ -398,6 +399,8 @@ CONFIG_EXTCON=m CONFIG_EXTCON_USB_GPIO=m CONFIG_EXTCON_PALMAS=m CONFIG_TI_EMIF=m +CONFIG_IIO=m +CONFIG_TI_AM335X_ADC=m CONFIG_PWM=y CONFIG_PWM_TIECAP=m CONFIG_PWM_TIEHRPWM=m -- 2.4.4.408.g16da57c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] ARM: omap2plus_defconfig: enable support for TI CPTS
CPTS module of CPSW IP enables timestamp synchronization using PTP. Enable CPTS feature of CPSW driver. Available on AM335x, AM437x and DRA7x SoCs. Signed-off-by: Sekhar Nori nsek...@ti.com --- arch/arm/configs/omap2plus_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 294059d5ef80..4cb1c11d83ad 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -169,6 +169,7 @@ CONFIG_SMSC911X=y # CONFIG_NET_VENDOR_STMICRO is not set CONFIG_TI_DAVINCI_EMAC=y CONFIG_TI_CPSW=y +CONFIG_TI_CPTS=y # CONFIG_NET_VENDOR_VIA is not set # CONFIG_NET_VENDOR_WIZNET is not set CONFIG_AT803X_PHY=y -- 2.4.4.408.g16da57c -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 9/9] usb: dwc3: core: don't break during suspend/resume while we're dual-role
On 08/07/15 16:11, Sergei Shtylyov wrote: Hello. On 7/8/2015 1:37 PM, Roger Quadros wrote: We can't rely just on dr_mode to decide if we're in host or gadget mode when we're configured as otg/dual-role. So while dr_mode is OTG, we find out from the otg state machine if we're in host or gadget mode and take the necessary actions during suspend/resume. Also make sure that we disable OTG irq and events during system suspend so that we don't lockup the system during system suspend/resume. Signed-off-by: Roger Quadros rog...@ti.com --- drivers/usb/dwc3/core.c | 27 +-- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e3c094d..3784287 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1444,18 +1444,15 @@ static int dwc3_suspend(struct device *dev) dwc-octl = dwc3_readl(dwc-regs, DWC3_OCTL); dwc-oevt = dwc3_readl(dwc-regs, DWC3_OEVT); dwc-oevten = dwc3_readl(dwc-regs, DWC3_OEVTEN); +dwc3_writel(dwc-regs, DWC3_OEVTEN, 0); +disable_irq(dwc-otg_irq); } -switch (dwc-dr_mode) { -case USB_DR_MODE_PERIPHERAL: -case USB_DR_MODE_OTG: +if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || +((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) Hum, enclosing the first == op into parens and not doing it to the second == op doesn't look very consistent... :-) Agreed :). Will fix it. Thanks. [...] @@ -1495,18 +1492,12 @@ static int dwc3_resume(struct device *dev) dwc3_writel(dwc-regs, DWC3_OCTL, dwc-octl); dwc3_writel(dwc-regs, DWC3_OEVT, dwc-oevt); dwc3_writel(dwc-regs, DWC3_OEVTEN, dwc-oevten); +enable_irq(dwc-otg_irq); } -switch (dwc-dr_mode) { -case USB_DR_MODE_PERIPHERAL: -case USB_DR_MODE_OTG: +if (dwc-dr_mode == USB_DR_MODE_PERIPHERAL || +((dwc-dr_mode == USB_DR_MODE_OTG) dwc-fsm-protocol == PROTO_GADGET)) Same here... OK. [...] cheers, -roger -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode
On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: + if (req-assoclen + req-cryptlen == 0) { + scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); + return 0; + } How can this be right? Did you enable the selftest? Why not? Self tests are passed for this case. As per the equation given in GCM spec[1], we can see that if assoclen and cryptlen is 0, then output of GCM is just E(K, Y0) where Y0 = IV||(0^31)1 I have E(K, Y0) calculated in previous step. And copying it to destination if assoclen and cryptlen is 0. Correct me if I am wrong. It should be E(K, Y0) ^ GHASH(0). So unless GHASH(0) == 0, your code doesn't work. Cheers, -- Email: Herbert Xu herb...@gondor.apana.org.au Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] net: can: c_can: Fix default pinmux glitch at init
On 07/07/15 18:49, Grygorii Strashko wrote: On 07/07/2015 05:37 PM, Roger Quadros wrote: On 07/07/15 17:35, Roger Quadros wrote: On 07/07/15 17:33, Marc Kleine-Budde wrote: On 07/07/2015 04:27 PM, Roger Quadros wrote: From: J.D. Schroeder jay.schroe...@garmin.com The previous change 3973c526ae9c (net: can: c_can: Disable pins when CAN interface is down) causes a slight glitch on the pinctrl settings when used. Since commit ab78029 (drivers/pinctrl: grab default handles from device core), the device core will automatically set the default pins. This causes the pins to be momentarily set to the default and then to the sleep state in register_c_can_dev(). By adding an optional enable state, boards can set the default pin state to be disabled and avoid the glitch when the switch from default to sleep first occurs. If the enable state is not available c_can_pinctrl_select_state() falls back to using the default pinctrl state. [Roger Q] - Forward port to v4.2 Signed-off-by: J.D. Schroeder jay.schroe...@garmin.com Signed-off-by: Roger Quadros rog...@ti.com --- drivers/net/can/c_can/c_can.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 041525d..66e98e7 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -605,7 +605,18 @@ static int c_can_start(struct net_device *dev) priv-can.state = CAN_STATE_ERROR_ACTIVE; /* activate pins */ -pinctrl_pm_select_default_state(dev-dev.parent); +#ifdef CONFIG_PINCTRL Please remove the ifdef, AFAICS there are static inline noop functions if CONFIG_PINCTRL switched off. yes, you are right. On second thoughts device-pins are not defined if CONFIG_PINCTRL is not set. so we can't remove the #ifdef. May be you can use [devm_]pinctrl_get? Why should we do that? The device core has already done the pinctrl_get() and it is available in device-pins-p. cheers, -roger +if (priv-device-pins) { +struct pinctrl_state *s; + +/* Attempt to use active if available else use default */ +s = pinctrl_lookup_state(priv-device-pins-p, active); +if (!IS_ERR(s)) +pinctrl_select_state(priv-device-pins-p, s); +else +pinctrl_pm_select_default_state(dev-dev.parent); +} +#endif return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5] clk: change clk_ops' -determine_rate() prototype
Hi Stephen, On Tue, 7 Jul 2015 17:57:48 -0700 Stephen Boyd sb...@codeaurora.org wrote: On 07/07, Boris Brezillon wrote: Clock rates are stored in an unsigned long field, but -determine_rate() (which returns a rounded rate from a requested one) returns a long value (errors are reported using negative error codes), which can lead to long overflow if the clock rate exceed 2Ghz. Change -determine_rate() prototype to return 0 or an error code, and pass a pointer to a clk_rate_request structure containing the expected target rate and the rate constraints imposed by clk users. The clk_rate_request structure might be extended in the future to contain other kind of constraints like the rounding policy, the maximum clock inaccuracy or other things that are not yet supported by the CCF (power consumption constraints ?). Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com CC: Jonathan Corbet cor...@lwn.net CC: Tony Lindgren t...@atomide.com CC: Ralf Baechle r...@linux-mips.org CC: Emilio López emi...@elopez.com.ar CC: Maxime Ripard maxime.rip...@free-electrons.com CC: Tero Kristo t-kri...@ti.com CC: Peter De Schrijver pdeschrij...@nvidia.com CC: Prashant Gaikwad pgaik...@nvidia.com CC: Stephen Warren swar...@wwwdotorg.org CC: Thierry Reding thierry.red...@gmail.com CC: Alexandre Courbot gnu...@gmail.com CC: linux-...@vger.kernel.org CC: linux-ker...@vger.kernel.org CC: linux-arm-ker...@lists.infradead.org CC: linux-omap@vger.kernel.org CC: linux-m...@linux-mips.org CC: linux-te...@vger.kernel.org --- I'll throw this patch into -next now to see if any other problems shake out. I'm hoping we get some more acks though, so it'll be on it's own branch and become immutable in a week or so. One question below. diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 616f5ae..9e69f34 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -99,33 +99,33 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate, parent_rate = __clk_get_rate(parent); - tmp_rate = rate_ops-round_rate(rate_hw, rate, + tmp_rate = rate_ops-round_rate(rate_hw, req-rate, parent_rate); if (tmp_rate 0) continue; - rate_diff = abs(rate - tmp_rate); + rate_diff = abs(req-rate - tmp_rate); - if (!rate_diff || !*best_parent_p + if (!rate_diff || !req-best_parent_hw || best_rate_diff rate_diff) { - *best_parent_p = __clk_get_hw(parent); - *best_parent_rate = parent_rate; + req-best_parent_hw = __clk_get_hw(parent); + req-best_parent_rate = parent_rate; best_rate_diff = rate_diff; best_rate = tmp_rate; } if (!rate_diff) - return rate; + return 0; } - return best_rate; + req-rate = best_rate; + return 0; } else if (mux_hw mux_ops mux_ops-determine_rate) { __clk_hw_set_clk(mux_hw, hw); - return mux_ops-determine_rate(mux_hw, rate, min_rate, - max_rate, best_parent_rate, - best_parent_p); + return mux_ops-determine_rate(mux_hw, req); } else { pr_err(clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n); + req-rate = 0; return 0; Shouldn't this return an error now? And then assigning req-rate wouldn't be necessary. Sorry I must have missed this last round. Actually I wanted to keep the existing behavior: return a 0 rate (not an error) when there is no mux or rate ops. That's something we can change afterwards, but it might reveals new bugs if some users are checking for a 0 rate to detect errors. Best Regards, Boris -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 5/5] ARM: dts: am43xx: Enable dual-role on USB1
USB1 port is micro-AB type and can function as peripheral as well as host. Enable dual-role mode for USB1. Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/am437x-gp-evm.dts | 2 +- arch/arm/boot/dts/am437x-sk-evm.dts | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index 84aa30c..eaae329 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts @@ -613,7 +613,7 @@ }; usb1 { - dr_mode = peripheral; + dr_mode = otg; status = okay; }; diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts index c17097d..05d874c 100644 --- a/arch/arm/boot/dts/am437x-sk-evm.dts +++ b/arch/arm/boot/dts/am437x-sk-evm.dts @@ -539,7 +539,7 @@ }; usb1 { - dr_mode = peripheral; + dr_mode = otg; status = okay; pinctrl-names = default; pinctrl-0 = usb1_pins; diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index 795d68a..30121a0 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts @@ -585,7 +585,7 @@ }; usb1 { - dr_mode = peripheral; + dr_mode = otg; status = okay; }; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/5] ARM: dts: dra7*-evm: Enable dual-role for usb1
Now that we have dual-role support working at USB core, enable dual-role support for usb1 controller. Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/dra7-evm.dts | 2 +- arch/arm/boot/dts/dra72-evm.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts index aa46590..9daaf46 100644 --- a/arch/arm/boot/dts/dra7-evm.dts +++ b/arch/arm/boot/dts/dra7-evm.dts @@ -550,7 +550,7 @@ }; usb1 { - dr_mode = peripheral; + dr_mode = otg; pinctrl-names = default; pinctrl-0 = usb1_pins; }; diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts index 4e1b605..2ec0985 100644 --- a/arch/arm/boot/dts/dra72-evm.dts +++ b/arch/arm/boot/dts/dra72-evm.dts @@ -476,7 +476,7 @@ }; usb1 { - dr_mode = peripheral; + dr_mode = otg; pinctrl-names = default; pinctrl-0 = usb1_pins; }; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/5] ARM: dts: dra7: Add named interrupt property for dwc3
Add interrupt names so that the same can be used for OTG easily. Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/boot/dts/dra7.dtsi | 21 ++--- arch/arm/boot/dts/dra74x.dtsi | 7 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 8f1e25b..6596baf 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi @@ -1295,7 +1295,12 @@ usb1: usb@4889 { compatible = snps,dwc3; reg = 0x4889 0x17000; - interrupts = GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; phys = usb2_phy1, usb3_phy1; phy-names = usb2-phy, usb3-phy; tx-fifo-resize; @@ -1318,7 +1323,12 @@ usb2: usb@488d { compatible = snps,dwc3; reg = 0x488d 0x17000; - interrupts = GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; phys = usb2_phy2; phy-names = usb2-phy; tx-fifo-resize; @@ -1343,7 +1353,12 @@ usb3: usb@4891 { compatible = snps,dwc3; reg = 0x4891 0x17000; - interrupts = GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 344 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; tx-fifo-resize; maximum-speed = high-speed; dr_mode = otg; diff --git a/arch/arm/boot/dts/dra74x.dtsi b/arch/arm/boot/dts/dra74x.dtsi index fa995d0..feea98e 100644 --- a/arch/arm/boot/dts/dra74x.dtsi +++ b/arch/arm/boot/dts/dra74x.dtsi @@ -65,7 +65,12 @@ usb4: usb@4895 { compatible = snps,dwc3; reg = 0x4895 0x17000; - interrupts = GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH; + interrupts = GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 345 IRQ_TYPE_LEVEL_HIGH, +GIC_SPI 346 IRQ_TYPE_LEVEL_HIGH; + interrupt-names = peripheral, + host, + otg; tx-fifo-resize; maximum-speed = high-speed; dr_mode = otg; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5] clk: change clk_ops' -determine_rate() prototype
On 07/08/2015 02:00 AM, Boris Brezillon wrote: Hi Stephen, On Tue, 7 Jul 2015 17:57:48 -0700 Stephen Boyd sb...@codeaurora.org wrote: On 07/07, Boris Brezillon wrote: } else { pr_err(clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n); + req-rate = 0; return 0; Shouldn't this return an error now? And then assigning req-rate wouldn't be necessary. Sorry I must have missed this last round. Actually I wanted to keep the existing behavior: return a 0 rate (not an error) when there is no mux or rate ops. That's something we can change afterwards, but it might reveals new bugs if some users are checking for a 0 rate to detect errors. Ok. Care to send the patch now to do that while we're thinking about it? We can test it out for a month or two. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 28/37] usb: gadget: pxa27x_udc: add ep capabilities support
Robert Baldyga r.bald...@samsung.com writes: Convert endpoint configuration to new capabilities model. The commit message is very short to judge the patch's correctness. I'll side up with Felipe's opinion. If it's fine by him, so it is by me. Cheers. -- Robert -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode
On Wednesday 08 July 2015 09:48 AM, Herbert Xu wrote: On Tue, Jul 07, 2015 at 09:01:48PM +0530, Lokesh Vutla wrote: +static int omap_aes_gcm_copy_buffers(struct omap_aes_dev *dd, + struct aead_request *req) +{ +void *buf_in; +int pages, alen, clen, cryptlen, nsg; +struct crypto_aead *aead = crypto_aead_reqtfm(req); +unsigned int authlen = crypto_aead_authsize(aead); +u32 dec = !(dd-flags FLAGS_ENCRYPT); +struct scatterlist *input, *assoc, tmp[2]; + +alen = ALIGN(req-assoclen, AES_BLOCK_SIZE); +cryptlen = req-cryptlen - (dec * authlen); +clen = ALIGN(cryptlen, AES_BLOCK_SIZE); + +dd-sgs_copied = 0; + +nsg = !!(req-assoclen req-cryptlen); + +assoc = req-src[0]; +sg_init_table(dd-in_sgl, nsg + 1); +if (req-assoclen) { +if (omap_aes_check_aligned(assoc, req-assoclen)) { +dd-sgs_copied |= AES_ASSOC_DATA_COPIED; +pages = get_order(alen); +buf_in = (void *)__get_free_pages(GFP_ATOMIC, pages); +if (!buf_in) { +pr_err(Couldn't allocate for unaligncases.\n); +return -1; +} + +scatterwalk_map_and_copy(buf_in, assoc, 0, + req-assoclen, 0); +memset(buf_in + req-assoclen, 0, alen - req-assoclen); +} else { +buf_in = sg_virt(req-assoc); req-assoc is now obsolete. Did you test this code? Sorry, I missed it. Ill update. +static int do_encrypt_iv(struct aead_request *req, u32 *tag) +{ +struct scatterlist iv_sg; +struct ablkcipher_request *ablk_req; +struct crypto_ablkcipher *tfm; +struct tcrypt_result result; +struct omap_aes_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req)); +int ret = 0; + +tfm = crypto_alloc_ablkcipher(ctr(aes), 0, 0); Ugh, you cannot allocate crypto transforms in the data path. You should allocate it in init instead. Also using ctr(aes) is overkill. Just use aes and do the xor by hand. Ill take care of this. +static int omap_aes_gcm_crypt(struct aead_request *req, unsigned long mode) +{ +struct omap_aes_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req)); +struct omap_aes_reqctx *rctx = aead_request_ctx(req); +struct crypto_aead *aead = crypto_aead_reqtfm(req); +unsigned int authlen = crypto_aead_authsize(aead); +struct omap_aes_dev *dd; +__be32 counter = cpu_to_be32(1); +int err; + +memset(ctx-auth_tag, 0, sizeof(ctx-auth_tag)); The ctx is shared memory and you must not write to it as multiple requests can be called on the same tfm. Use rctx instead. +memcpy(req-iv + 12, counter, 4); The IV is only 12 bytes long so you're corrupting memory here. You should use rctx here too. Ok, Ill use rctx. Thanks for pointing. +if (req-assoclen + req-cryptlen == 0) { +scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); +return 0; +} How can this be right? Did you enable the selftest? Why not? Self tests are passed for this case. As per the equation given in GCM spec[1], we can see that if assoclen and cryptlen is 0, then output of GCM is just E(K, Y0) where Y0 = IV||(0^31)1 I have E(K, Y0) calculated in previous step. And copying it to destination if assoclen and cryptlen is 0. Correct me if I am wrong. Thanks and regards, Lokesh [1] http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf Cheers, -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 0/7] crypto: omap-aes: Add support for GCM mode
On Tue, Jul 07, 2015 at 09:01:42PM +0530, Lokesh Vutla wrote: This series does some basic cleanup and adds support for AES GCM mode for omap aes driver. Changes since v1: - Switched GCM to new AEAD interface Patches 1-4 and 7 applied. Cheers, -- Email: Herbert Xu herb...@gondor.apana.org.au Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] arm:irqchip: IRQCHIP_DECLARE macro is now accessible
* Krzysztof Kozlowski k.kozlow...@samsung.com [150707 16:49]: On 08.07.2015 05:02, Joel Porquet wrote: The IRQCHIP_DECLARE macro migrated to 'include/linux/irqchip.h', making it globally accessible. See commit 91e20b5040c67c51aad88cf87db4305c5bd7f79d (irqchip: Move IRQCHIP_DECLARE macro to include/linux/irqchip.h). This patch adds inclusions of 'include/linux/irqchip.h' and replaces uses of macro OF_DECLARE_2 with IRQCHIP_DECLARE. Signed-off-by: Joel Porquet j...@porquet.org --- arch/arm/mach-exynos/suspend.c | 3 ++- arch/arm/mach-imx/gpc.c | 7 ++- arch/arm/mach-omap2/omap-wakeupgen.c | 7 ++- 3 files changed, 6 insertions(+), 11 deletions(-) For Exynos: Acked-by: Krzysztof Kozlowski k.kozlow...@samsung.com For omap changes: Acked-by: Tony Lindgren t...@atomide.com -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html