Re: [PATCH 6/7] usb: chipidea: udc: add force-full-speed option
On Fri, May 31, 2013 at 08:38:48PM +0200, Michael Grzeschik wrote: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. [...] +/* force full-speed operation */ +static bool full_speed; +module_param(full_speed, bool, 0444); +MODULE_PARM_DESC(full_speed, force full-speed mode); + ??? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] usb: chipidea: udc: add force-full-speed option
On Sat, Jun 01, 2013 at 09:39:33AM +0200, Sascha Hauer wrote: On Fri, May 31, 2013 at 08:38:48PM +0200, Michael Grzeschik wrote: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. [...] +/* force full-speed operation */ +static bool full_speed; +module_param(full_speed, bool, 0444); +MODULE_PARM_DESC(full_speed, force full-speed mode); + ??? Right, i reworked that one to get rid of yet another of property. But i forgot to change the description. I will fix that, thanks. Regards, Michael -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] usb: chipidea: udc: add force-full-speed option
On Sat, Jun 01, 2013 at 10:19:32AM +0200, Michael Grzeschik wrote: On Sat, Jun 01, 2013 at 09:39:33AM +0200, Sascha Hauer wrote: On Fri, May 31, 2013 at 08:38:48PM +0200, Michael Grzeschik wrote: From: Michael Grzeschik m.grzesc...@pengutronix.de This patch makes it possible to set the chipidea udc into full-speed only mode. It can be set by the oftree property force-full-speed. [...] +/* force full-speed operation */ +static bool full_speed; +module_param(full_speed, bool, 0444); +MODULE_PARM_DESC(full_speed, force full-speed mode); + ??? Right, i reworked that one to get rid of yet another of property. But i forgot to change the description. I will fix that, thanks. But a module parameter limits all instances to full speed. Is that what you want? I like a devicetree property better. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: Cocci spatch memdup.spatch
Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -1928,11 +1928,10 @@ static int ene_load_bincode(struct us_da usb_stor_dbg(us, load firmware %s failed\n, fw_name); goto nofw; } - buf = kmalloc(sd_fw-size, GFP_KERNEL); + buf = kmemdup(sd_fw-data, sd_fw-size, GFP_KERNEL); if (buf == NULL) goto nofw; - memcpy(buf, sd_fw-data, sd_fw-size); memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb-Signature = cpu_to_le32(US_BULK_CB_SIGN); bcb-DataTransferLength = sd_fw-size; -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: gadget: lpc32xx_udc: Cocci spatch memdup.spatch
Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c @@ -3046,11 +3046,10 @@ static int __init lpc32xx_udc_probe(stru dma_addr_t dma_handle; struct device_node *isp1301_node; - udc = kzalloc(sizeof(*udc), GFP_KERNEL); + udc = kmemdup(controller_template, sizeof(*udc), GFP_KERNEL); if (!udc) return -ENOMEM; - memcpy(udc, controller_template, sizeof(*udc)); for (i = 0; i = 15; i++) udc-ep[i].udc = udc; udc-gadget.ep0 = udc-ep[0].ep; -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: gadget: Cocci spatch ptr_ret.spatch
Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c @@ -274,7 +274,7 @@ static int geth_set_alt(struct usb_funct } net = gether_connect(geth-port); - return IS_ERR(net) ? PTR_ERR(net) : 0; + return PTR_RET(net); } static void geth_disable(struct usb_function *f) -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: gadget: Cocci spatch err_cast.spatch
Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1138,7 +1138,7 @@ struct usb_string *usb_gstrings_attach(s uc = copy_gadget_strings(sp, n_gstrings, n_strings); if (IS_ERR(uc)) - return ERR_PTR(PTR_ERR(uc)); + return ERR_CAST(uc); n_gs = get_containers_gs(uc); ret = usb_string_ids_tab(cdev, n_gs[0]-strings); diff -u -p a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -557,7 +557,7 @@ static struct config_group *function_mak fi = usb_get_function_instance(func_name); if (IS_ERR(fi)) - return ERR_PTR(PTR_ERR(fi)); + return ERR_CAST(fi); ret = config_item_set_name(fi-group.cg_item, name); if (ret) { -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: dwc3: core: Cocci spatch odd_ptr_err.spatch
Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -450,7 +450,7 @@ static int dwc3_probe(struct platform_de } if (IS_ERR(dwc-usb3_phy)) { - ret = PTR_ERR(dwc-usb2_phy); + ret = PTR_ERR(dwc-usb3_phy); /* * if -ENXIO is returned, it means PHY layer wasn't -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: MUSB multiplatform work?
On 31 May 2013 02:01, Tony Lindgren t...@atomide.com wrote: * Linus Walleij linus.wall...@linaro.org [130530 13:27]: On Thu, May 30, 2013 at 10:18 PM, Tony Lindgren t...@atomide.com wrote: TUSB would work with dmaengine, but AFAIK we're still missing the dmaengine configuration options to support increasing device end FIFO address. Can you elaborate on this? What is the usecase here? There are many devices where the device FIFO is memory mapped to the GPMC bus on omaps, like TUSB, OneNAND, smc911x etc. I believe the only reason why these have not been converted to the dmaengine is the fact that dmaengine cannot configure the DMA hardware to do autoincrement and loop over the device FIFO. Doesn't device_prep_interleaved_dma() help? -jassi -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: Fix format specifier warning
On Sat, Jun 1, 2013 at 1:39 AM, Randy Dunlap rdun...@infradead.org wrote: On 05/31/13 15:34, Andy Shevchenko wrote: On Fri, May 31, 2013 at 11:22 PM, Emil Goode emilgo...@gmail.com wrote: This patch fixes a format specifier warning. dma_addr_t can be either u32 or u64 so we should cast to the largest type and change the format specifier to %llx. dma_addr_t is derived from phys_addr_t, thus you may use %pa specifier which is available from v3.8(?). Something like this: dma_addr_t src_addr; dev_dbg(dev, DMA addr: %pa\n, src_addr); Isn't that: deb_dbg(dev, DMA addr: %pa\n, src_addr); It's. You are right. -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: gadget: lpc32xx_udc: Cocci spatch memdup.spatch
On Sat, Jun 01, 2013 at 11:36:46AM +0200, Thomas Meyer wrote: -ENOLOG please add a commit log. Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c @@ -3046,11 +3046,10 @@ static int __init lpc32xx_udc_probe(stru dma_addr_t dma_handle; struct device_node *isp1301_node; - udc = kzalloc(sizeof(*udc), GFP_KERNEL); + udc = kmemdup(controller_template, sizeof(*udc), GFP_KERNEL); if (!udc) return -ENOMEM; - memcpy(udc, controller_template, sizeof(*udc)); for (i = 0; i = 15; i++) udc-ep[i].udc = udc; udc-gadget.ep0 = udc-ep[0].ep; -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: Cocci spatch ptr_ret.spatch
On Sat, Jun 01, 2013 at 11:59:25AM +0200, Thomas Meyer wrote: -ENOLOG Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c --- a/drivers/usb/gadget/f_subset.c +++ b/drivers/usb/gadget/f_subset.c @@ -274,7 +274,7 @@ static int geth_set_alt(struct usb_funct } net = gether_connect(geth-port); - return IS_ERR(net) ? PTR_ERR(net) : 0; + return PTR_RET(net); } static void geth_disable(struct usb_function *f) -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: gadget: Cocci spatch err_cast.spatch
On Sat, Jun 01, 2013 at 12:08:45PM +0200, Thomas Meyer wrote: -ENOLOG Signed-off-by: Thomas Meyer tho...@m3y3r.de --- diff -u -p a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1138,7 +1138,7 @@ struct usb_string *usb_gstrings_attach(s uc = copy_gadget_strings(sp, n_gstrings, n_strings); if (IS_ERR(uc)) - return ERR_PTR(PTR_ERR(uc)); + return ERR_CAST(uc); n_gs = get_containers_gs(uc); ret = usb_string_ids_tab(cdev, n_gs[0]-strings); diff -u -p a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -557,7 +557,7 @@ static struct config_group *function_mak fi = usb_get_function_instance(func_name); if (IS_ERR(fi)) - return ERR_PTR(PTR_ERR(fi)); + return ERR_CAST(fi); ret = config_item_set_name(fi-group.cg_item, name); if (ret) { -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: dwc3: core: Cocci spatch odd_ptr_err.spatch
On Sat, Jun 01, 2013 at 12:10:59PM +0200, Thomas Meyer wrote: Signed-off-by: Thomas Meyer tho...@m3y3r.de -ENOLOG -- balbi signature.asc Description: Digital signature
Re: [PATCH] usb: musb: Fix format specifier warning
Hello, Thank's for your pointers. I will send a patch that applies on top of Felipe's patch. Best regards, Emil Goode On Sat, Jun 01, 2013 at 04:15:03PM +0300, Andy Shevchenko wrote: On Sat, Jun 1, 2013 at 1:39 AM, Randy Dunlap rdun...@infradead.org wrote: On 05/31/13 15:34, Andy Shevchenko wrote: On Fri, May 31, 2013 at 11:22 PM, Emil Goode emilgo...@gmail.com wrote: This patch fixes a format specifier warning. dma_addr_t can be either u32 or u64 so we should cast to the largest type and change the format specifier to %llx. dma_addr_t is derived from phys_addr_t, thus you may use %pa specifier which is available from v3.8(?). Something like this: dma_addr_t src_addr; dev_dbg(dev, DMA addr: %pa\n, src_addr); Isn't that: deb_dbg(dev, DMA addr: %pa\n, src_addr); It's. You are right. -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) The addition of urb-transfer_dma and urb-actual_length is also done a few lines below. I have moved this code up and pass the variable buf to dev_dbg. Signed-off-by: Emil Goode emilgo...@gmail.com --- I also added braces to the else statement for consistency. (Didn't want to send a separate patch for that) drivers/usb/musb/musb_host.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index a9695f5..701f668 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) dma_addr_t buf; rx_count = musb_readw(epio, MUSB_RXCOUNT); + buf = urb-transfer_dma + urb-actual_length; - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer 0x%pa len %d/%d\n, epnum, rx_count, - (unsigned long long) urb-transfer_dma - + urb-actual_length, - qh-offset, + buf, qh-offset, urb-transfer_buffer_length); c = musb-dma_controller; @@ -1785,14 +1784,13 @@ void musb_host_rx(struct musb *musb, u8 epnum) rx_count, d-length); length = d-length; - } else + } else { length = rx_count; + } d-status = d_status; buf = urb-transfer_dma + d-offset; } else { length = rx_count; - buf = urb-transfer_dma + - urb-actual_length; } dma-desired_mode = 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
On Sat, 2013-06-01 at 20:02 +0200, Emil Goode wrote: This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) [] diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c [] @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) [] - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer 0x%pa len %d/%d\n, This would emit 0x0xaddr When you use %pa, don't add 0x -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
I see, will send a second version. Thank's Emil On Sat, Jun 01, 2013 at 11:29:10AM -0700, Joe Perches wrote: On Sat, 2013-06-01 at 20:02 +0200, Emil Goode wrote: This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) [] diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c [] @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) [] - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer 0x%pa len %d/%d\n, This would emit 0x0xaddr When you use %pa, don't add 0x -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] usb: musb: use the new %pa format specifier for dma_addr_t
This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) The addition of urb-transfer_dma and urb-actual_length is also done a few lines below. I have moved this code up and pass the variable buf to dev_dbg. Signed-off-by: Emil Goode emilgo...@gmail.com --- v2: Remove 0x from string as it will print as 0x0x This applies on top of commit 43d5ad743c6f (usb: musb: host: fix build warning) I also added braces to the else statement for consistency. (Didn't want to send a separate patch for that) drivers/usb/musb/musb_host.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index a9695f5..ee7730a 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) dma_addr_t buf; rx_count = musb_readw(epio, MUSB_RXCOUNT); + buf = urb-transfer_dma + urb-actual_length; - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer %pa len %d/%d\n, epnum, rx_count, - (unsigned long long) urb-transfer_dma - + urb-actual_length, - qh-offset, + buf, qh-offset, urb-transfer_buffer_length); c = musb-dma_controller; @@ -1785,14 +1784,13 @@ void musb_host_rx(struct musb *musb, u8 epnum) rx_count, d-length); length = d-length; - } else + } else { length = rx_count; + } d-status = d_status; buf = urb-transfer_dma + d-offset; } else { length = rx_count; - buf = urb-transfer_dma + - urb-actual_length; } dma-desired_mode = 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
On Sat, 2013-06-01 at 21:09 +0200, Emil Goode wrote: I see, will send a second version. Hey Emil. I believe you can not use %pa with a dma_addr_t because that could be a different size than a phy_addr_t. (the vsprintf cast and deref is to a phy_addr_t) The definitions are: (types.h) #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT typedef u64 dma_addr_t; #else typedef u32 dma_addr_t; #endif /* dma_addr_t */ [] #ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 phys_addr_t; #else typedef u32 phys_addr_t; #endif On Sat, Jun 01, 2013 at 11:29:10AM -0700, Joe Perches wrote: On Sat, 2013-06-01 at 20:02 +0200, Emil Goode wrote: This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) [] diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c [] @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) [] - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer 0x%pa len %d/%d\n, This would emit 0x0xaddr -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 0/9] Reorganize R8A7779/Marzen USB code
Hello. Here's the set of 9 patches against the Simon Horman's 'renesas.git' repo, 'renesas-next-20130528' tag. It was created to fix the shortcomings in the R8A7779/Marzen USB platform code and R8A7779 USB common PHY driver, and so spans both arch/arm/mach-shmobile/ and drivers/usb/ subtrees (some patches have to touch both subtrees). The patches were conceived with the complete bisectability goal in mind. [1/9] ARM: shmobile: Marzen: move USB EHCI, OHCI, and PHY devices to R8A7779 code [2/9] ehci-platform: add pre_setup() method to platform data [3/9] ARM: shmobile: r8a7779: setup EHCI internal buffer [4/9] phy-rcar-usb: remove EHCI internal buffer setup [5/9] ARM: shmobile: r8a7779: remove USB PHY 2nd memory resource [6/9] phy-rcar-usb: correct base address [7/9] phy-rcar-usb: add platform data [8/9] ARM: shmobile: Marzen: pass platform data to USB PHY device [9/9] phy-rcar-usb: handle platform data The patchset is completely ready to be merged now. WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 1/9] ARM: shmobile: Marzen: move USB EHCI, OHCI, and PHY devices to R8A7779 code
USB EHCI, OHCI, and common PHY are the SoC devices but are wrongly defined and registered in the Marzen board file. Move the data and code to their proper place in setup-r8a7779.c; while at it, we have to rename r8a7779_late_devices[] to r8a7779_standard_devices[] -- this seems legitimate since they are registered from r8a7779_add_standard_devices() anyway. Note that I'm deliberately changing the USB PHY platform device's 'id' field from (previously just omitted) 0 to -1 as the device is a single of its kind. Note also that the board and SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au --- Changes since version 7: - resolved reject, changed PHY checks to IS_ERR(phy) and returning PTR_ERR(phy) where applicable. Changes since version 5: - fixed typos in the changelog. Changes since version 4: - resolved reject in the 'board-marzen.c' file, refreshed the patch. Changes since version 3: - refreshed the 'board-marzen.c' file. Changes since version 2: - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - added a note about bisectability to the changelog. arch/arm/mach-shmobile/board-marzen.c | 178 - arch/arm/mach-shmobile/include/mach/r8a7779.h |1 arch/arm/mach-shmobile/setup-r8a7779.c| 185 +- 3 files changed, 184 insertions(+), 180 deletions(-) Index: renesas/arch/arm/mach-shmobile/board-marzen.c === --- renesas.orig/arch/arm/mach-shmobile/board-marzen.c +++ renesas/arch/arm/mach-shmobile/board-marzen.c @@ -37,10 +37,6 @@ #include linux/mmc/host.h #include linux/mmc/sh_mobile_sdhi.h #include linux/mfd/tmio.h -#include linux/usb/otg.h -#include linux/usb/ehci_pdriver.h -#include linux/usb/ohci_pdriver.h -#include linux/pm_runtime.h #include mach/hardware.h #include mach/r8a7779.h #include mach/common.h @@ -150,26 +146,6 @@ static struct platform_device hspi_devic .num_resources = ARRAY_SIZE(hspi_resources), }; -/* USB PHY */ -static struct resource usb_phy_resources[] = { - [0] = { - .start = 0xffe7, - .end= 0xffe70900 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = 0xfff7, - .end= 0xfff70900 - 1, - .flags = IORESOURCE_MEM, - }, -}; - -static struct platform_device usb_phy_device = { - .name = rcar_usb_phy, - .resource = usb_phy_resources, - .num_resources = ARRAY_SIZE(usb_phy_resources), -}; - /* LEDS */ static struct gpio_led marzen_leds[] = { { @@ -205,161 +181,9 @@ static struct platform_device *marzen_de sdhi0_device, thermal_device, hspi_device, - usb_phy_device, leds_device, }; -/* USB */ -static struct usb_phy *phy; -static int usb_power_on(struct platform_device *pdev) -{ - if (IS_ERR(phy)) - return PTR_ERR(phy); - - pm_runtime_enable(pdev-dev); - pm_runtime_get_sync(pdev-dev); - - usb_phy_init(phy); - - return 0; -} - -static void usb_power_off(struct platform_device *pdev) -{ - if (IS_ERR(phy)) - return; - - usb_phy_shutdown(phy); - - pm_runtime_put_sync(pdev-dev); - pm_runtime_disable(pdev-dev); -} - -static struct usb_ehci_pdata ehcix_pdata = { - .power_on = usb_power_on, - .power_off = usb_power_off, - .power_suspend = usb_power_off, -}; - -static struct resource ehci0_resources[] = { - [0] = { - .start = 0xffe7, - .end= 0xffe70400 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = gic_iid(0x4c), - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device ehci0_device = { - .name = ehci-platform, - .id = 0, - .dev= { - .dma_mask = ehci0_device.dev.coherent_dma_mask, - .coherent_dma_mask = 0x, - .platform_data = ehcix_pdata, - }, - .num_resources = ARRAY_SIZE(ehci0_resources), - .resource = ehci0_resources, -}; - -static struct resource ehci1_resources[] = { - [0] = { - .start = 0xfff7, - .end= 0xfff70400 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = gic_iid(0x4d), - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device ehci1_device = { - .name =
[PATCH v8 2/9] ehci-platform: add pre_setup() method to platform data
Sometimes there is a need to initialize some non-standard registers mapped to the EHCI region before accessing the standard EHCI registers. Add pre_setup() method with 'struct usb_hcd *' parameter to be called just before ehci_setup() to the 'ehci-platform' driver's platform data for this purpose... While at it, add the missing incomplete declaration of 'struct platform_device' to linux/usb/ehci_pdriver.h... The patch has been tested on the Marzen and BOCK-W boards. Suggested-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au Acked-by: Alan Stern st...@rowland.harvard.edu --- Changes since version 7: - refreshed the patch. Changes since version 3: - added ACK from Alan Stern. Changes since version 2: - replaced #include with incomplete declarations of 'struct platform_device' and 'struct usb_hcd'; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - changed init() method to pre_setup() with different parameters and call site. drivers/usb/host/ehci-platform.c |6 ++ include/linux/usb/ehci_pdriver.h |4 2 files changed, 10 insertions(+) Index: renesas/drivers/usb/host/ehci-platform.c === --- renesas.orig/drivers/usb/host/ehci-platform.c +++ renesas/drivers/usb/host/ehci-platform.c @@ -48,6 +48,12 @@ static int ehci_platform_reset(struct us ehci-big_endian_desc = pdata-big_endian_desc; ehci-big_endian_mmio = pdata-big_endian_mmio; + if (pdata-pre_setup) { + retval = pdata-pre_setup(hcd); + if (retval 0) + return retval; + } + ehci-caps = hcd-regs + pdata-caps_offset; retval = ehci_setup(hcd); if (retval) Index: renesas/include/linux/usb/ehci_pdriver.h === --- renesas.orig/include/linux/usb/ehci_pdriver.h +++ renesas/include/linux/usb/ehci_pdriver.h @@ -19,6 +19,9 @@ #ifndef __USB_CORE_EHCI_PDRIVER_H #define __USB_CORE_EHCI_PDRIVER_H +struct platform_device; +struct usb_hcd; + /** * struct usb_ehci_pdata - platform_data for generic ehci driver * @@ -50,6 +53,7 @@ struct usb_ehci_pdata { /* Turn on only VBUS suspend power and hotplug detection, * turn off everything else */ void (*power_suspend)(struct platform_device *pdev); + int (*pre_setup)(struct usb_hcd *hcd); }; #endif /* __USB_CORE_EHCI_PDRIVER_H */ -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 3/9] ARM: shmobile: r8a7779: setup EHCI internal buffer
Setup the EHCI internal buffer (before EHCI driver has a chance to touch the registers) using the pre_setup() method in 'struct usb_ehci_pdata'. The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au --- Changes since version 4: - refreshed the patch. Changes since version 3: - lowercased the SoC name in the subject. Changes since version 2: - added #include linux/usb/hcd.h; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - changed from init() platform device method to pre_setup() as per the previous patch. arch/arm/mach-shmobile/setup-r8a7779.c | 16 1 file changed, 16 insertions(+) Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c === --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -33,6 +33,7 @@ #include linux/sh_timer.h #include linux/dma-mapping.h #include linux/usb/otg.h +#include linux/usb/hcd.h #include linux/usb/ehci_pdriver.h #include linux/usb/ohci_pdriver.h #include linux/pm_runtime.h @@ -435,10 +436,25 @@ static void usb_power_off(struct platfor pm_runtime_disable(pdev-dev); } +static int ehci_init_internal_buffer(struct usb_hcd *hcd) +{ + /* +* Below are recommended values from the datasheet; +* see [USB :: Setting of EHCI Internal Buffer]. +*/ + /* EHCI IP internal buffer setting */ + iowrite32(0x00ff0040, hcd-regs + 0x0094); + /* EHCI IP internal buffer enable */ + iowrite32(0x0001, hcd-regs + 0x009C); + + return 0; +} + static struct usb_ehci_pdata ehcix_pdata = { .power_on = usb_power_on, .power_off = usb_power_off, .power_suspend = usb_power_off, + .pre_setup = ehci_init_internal_buffer, }; static struct resource ehci0_resources[] = { -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 4/9] phy-rcar-usb: remove EHCI internal buffer setup
Now that the EHCI internal buffer setup is done by the platform code, we can remove such code from this driver as it never really belonged here. We also no longer need the 2nd memory region now (2nd EHCI controller is simply missing in e.g. R8A7778 SoC). The patch has been tested on the Marzen and BOCK-W boards. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au Acked-by: Felipe Balbi ba...@ti.com --- Changes since version 7: - renamed the PHY driver and changed the patch subject accordingly. Changes since version 6: - added an ACK from Felipe Balbi. Changes since version 2: - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - split R8A7779 SoC file change to a separate patch. drivers/usb/phy/phy-rcar-usb.c | 28 1 file changed, 4 insertions(+), 24 deletions(-) Index: renesas/drivers/usb/phy/phy-rcar-usb.c === --- renesas.orig/drivers/usb/phy/phy-rcar-usb.c +++ renesas/drivers/usb/phy/phy-rcar-usb.c @@ -23,8 +23,6 @@ #define USBEH0 0x080C #define USBOH0 0x081C #define USBCTL00x0858 -#define EIIBC1 0x0094 -#define EIIBC2 0x009C /* USBPCTRL1 */ #define PHY_RST(1 2) @@ -40,7 +38,6 @@ struct rcar_usb_phy_priv { spinlock_t lock; void __iomem *reg0; - void __iomem *reg1; int counter; }; @@ -59,7 +56,6 @@ static int rcar_usb_phy_init(struct usb_ struct rcar_usb_phy_priv *priv = usb_phy_to_priv(phy); struct device *dev = phy-dev; void __iomem *reg0 = priv-reg0; - void __iomem *reg1 = priv-reg1; int i; u32 val; unsigned long flags; @@ -97,19 +93,6 @@ static int rcar_usb_phy_init(struct usb_ iowrite32(0x, (reg0 + USBPCTRL0)); /* -* EHCI IP internal buffer setting -* EHCI IP internal buffer enable -* -* These are recommended value of a datasheet -* see [USB :: EHCI internal buffer setting] -*/ - iowrite32(0x00ff0040, (reg0 + EIIBC1)); - iowrite32(0x00ff0040, (reg1 + EIIBC1)); - - iowrite32(0x0001, (reg0 + EIIBC2)); - iowrite32(0x0001, (reg1 + EIIBC2)); - - /* * Bus alignment settings */ @@ -145,14 +128,13 @@ static void rcar_usb_phy_shutdown(struct static int rcar_usb_phy_probe(struct platform_device *pdev) { struct rcar_usb_phy_priv *priv; - struct resource *res0, *res1; + struct resource *res0; struct device *dev = pdev-dev; - void __iomem *reg0, *reg1; + void __iomem *reg0; int ret; res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); - res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!res0 || !res1) { + if (!res0) { dev_err(dev, Not enough platform resources\n); return -EINVAL; } @@ -164,8 +146,7 @@ static int rcar_usb_phy_probe(struct pla * this driver can't use devm_request_and_ioremap(dev, res) here */ reg0 = devm_ioremap_nocache(dev, res0-start, resource_size(res0)); - reg1 = devm_ioremap_nocache(dev, res1-start, resource_size(res1)); - if (!reg0 || !reg1) { + if (!reg0) { dev_err(dev, ioremap error\n); return -ENOMEM; } @@ -177,7 +158,6 @@ static int rcar_usb_phy_probe(struct pla } priv-reg0 = reg0; - priv-reg1 = reg1; priv-counter = 0; priv-phy.dev = dev; priv-phy.label = dev_name(dev); -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 5/9] ARM: shmobile: r8a7779: remove USB PHY 2nd memory resource
Now that 'drivers/usb/phy/phy-rcar-usb.c' doesn't require the second memory resource anymore, we can remove it from the R8A7779's USB PHY platform device. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au --- Changes since version 7: - updated the driver file name in the changelog. Changes since version 4: - refreshed the patch. Changes since version 3: - lowercased the SoC name in the subject. Changes since version 2: - refreshed atop of the prior patches; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - new patch in this version, split from the previous one. arch/arm/mach-shmobile/setup-r8a7779.c |5 - 1 file changed, 5 deletions(-) Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c === --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -395,11 +395,6 @@ static struct resource usb_phy_resources .end= 0xffe70900 - 1, .flags = IORESOURCE_MEM, }, - [1] = { - .start = 0xfff7, - .end= 0xfff70900 - 1, - .flags = IORESOURCE_MEM, - }, }; static struct platform_device usb_phy_device = { -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 6/9] phy-rcar-usb: correct base address
The memory region that is used by the driver overlaps EHCI and OHCI register regions for absolutely no reason now -- fix it by adding offset of 0x800 to the base address, changing the register #define's accordingly. This has extra positive effect that we now can use devm_ioremap_resource()... Note that the driver and the SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au Acked-by: Felipe Balbi ba...@ti.com --- Changes since version 7: - renamed the PHY driver and changed the patch subject accordingly. Changes since version 6: - added an ACK from Felipe Balbi. Changes since version 4: - refreshed the patch. Changes since version 2: - refreshed atop of the prior patches; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - added a note about bisectability to the changelog. arch/arm/mach-shmobile/setup-r8a7779.c |2 +- drivers/usb/phy/phy-rcar-usb.c | 28 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c === --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -391,7 +391,7 @@ static struct platform_device sata_devic /* USB PHY */ static struct resource usb_phy_resources[] = { [0] = { - .start = 0xffe7, + .start = 0xffe70800, .end= 0xffe70900 - 1, .flags = IORESOURCE_MEM, }, Index: renesas/drivers/usb/phy/phy-rcar-usb.c === --- renesas.orig/drivers/usb/phy/phy-rcar-usb.c +++ renesas/drivers/usb/phy/phy-rcar-usb.c @@ -16,13 +16,13 @@ #include linux/spinlock.h #include linux/module.h -/* USBH common register */ -#define USBPCTRL0 0x0800 -#define USBPCTRL1 0x0804 -#define USBST 0x0808 -#define USBEH0 0x080C -#define USBOH0 0x081C -#define USBCTL00x0858 +/* REGS block */ +#define USBPCTRL0 0x00 +#define USBPCTRL1 0x04 +#define USBST 0x08 +#define USBEH0 0x0C +#define USBOH0 0x1C +#define USBCTL00x58 /* USBPCTRL1 */ #define PHY_RST(1 2) @@ -139,17 +139,9 @@ static int rcar_usb_phy_probe(struct pla return -EINVAL; } - /* -* CAUTION -* -* Because this phy address is also mapped under OHCI/EHCI address area, -* this driver can't use devm_request_and_ioremap(dev, res) here -*/ - reg0 = devm_ioremap_nocache(dev, res0-start, resource_size(res0)); - if (!reg0) { - dev_err(dev, ioremap error\n); - return -ENOMEM; - } + reg0 = devm_ioremap_resource(dev, res0); + if (IS_ERR(reg0)) + return PTR_ERR(reg0); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 7/9] phy-rcar-usb: add platform data
Currently the driver hard-codes USBPCTRL0 register to 0. It is wrong since this register contains board-specific USB ports configuration and so its value should be somehow passed via the platform data. Add the global header file containing 'struct rcar_phy_platform_data' consisting of the various bit fields describing USB ports' pin configuration. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au Acked-by: Felipe Balbi ba...@ti.com --- Changes since version 7: - changed the patch subject to reflect the PHY driver rename; - added an ACK from Felipe Balbi. Changes since version 6: - renamed the header file into linux/platform_data/usb-rcar-phy.h, renamed the guarding #define accordingly; - rephrased the changelog. Changes since version 3: - moved USBPCTRL0 register bit #define's to patch #9; - replaced USBPCTRL0 register value in the platform data structure by a set of bit fields describing the configuration of the board, rewrote changelog; Changes since version 2: - added #include linux/types.h; - added ACKs from Simon Horman and Kuninori Morimoto. include/linux/platform_data/usb-rcar-phy.h | 26 ++ 1 file changed, 26 insertions(+) Index: renesas/include/linux/platform_data/usb-rcar-phy.h === --- /dev/null +++ renesas/include/linux/platform_data/usb-rcar-phy.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2013 Renesas Solutions Corp. + * Copyright (C) 2013 Cogent Embedded, Inc. + * + * 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. + */ + +#ifndef __USB_RCAR_PHY_H +#define __USB_RCAR_PHY_H + +#include linux/types.h + +struct rcar_phy_platform_data { + bool port1_func:1; /* true: port 1 used by function, false: host */ + unsigned penc1:1; /* Output of the PENC1 pin in function mode */ + struct {/* Overcurrent pin control for ports 0..2 */ + bool select_3_3v:1; /* true: USB_OVCn pin, false: OVCn pin */ + /* Set to false on port 1 in function mode */ + bool active_high:1; /* true: active high, false: active low */ + /* Set to true on port 1 in function mode */ + } ovc_pin[3]; +}; + +#endif /* __USB_RCAR_PHY_H */ -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 8/9] ARM: shmobile: Marzen: pass platform data to USB PHY device
Since we're now going to setup the USBPCTRL0 register using the USB PHY device's platform data, we now need a way to pass those platform data from the board file to the device which is situated in setup-r8a7779.c -- and what I'm suggesting is r8a7779_add_usb_phy_device() that will register USB PHY platform device with the passed platform data using platform_device_register_resndata() call; creating this function involves deletion of 'usb_phy_device' from r8a7779_devices_dt[], so that it will no longer be registered for the generic R8A7779 machine (where we can't provide the platform data anyway), hence EHCI/OHCI drivers will fail to load as well. For the Marzen board, this new function will be called from marzen_init() to register the USB PHY device early enough. Note that the board and the SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au --- Changes since version 6: - renamed the R-Car PHY driver header file in #include. Changes since version 5: - annotated USB PHY resources and platform data as '__initdata' since they're kmemdup()'ed while registering the platform device anyway; - fixed typo in the changelog. Changes since version 4: - refreshed the patch. Changes since version 3: - removed the initializer for 'usb_phy_platform_data'; - refreshed the 'board-marzen.c' file. Changes since version 2: - refreshed atop of the prior patches; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - added a note about bisectability to the changelog. arch/arm/mach-shmobile/board-marzen.c |3 +++ arch/arm/mach-shmobile/include/mach/r8a7779.h |2 ++ arch/arm/mach-shmobile/setup-r8a7779.c| 18 +- 3 files changed, 14 insertions(+), 9 deletions(-) Index: renesas/arch/arm/mach-shmobile/board-marzen.c === --- renesas.orig/arch/arm/mach-shmobile/board-marzen.c +++ renesas/arch/arm/mach-shmobile/board-marzen.c @@ -57,6 +57,8 @@ static struct regulator_consumer_supply REGULATOR_SUPPLY(vdd33a, smsc911x), }; +static struct rcar_phy_platform_data usb_phy_platform_data __initdata; + /* SMSC LAN89218 */ static struct resource smsc911x_resources[] = { [0] = { @@ -232,6 +234,7 @@ static void __init marzen_init(void) r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ r8a7779_add_standard_devices(); + r8a7779_add_usb_phy_device(usb_phy_platform_data); platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); } Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7779.h === --- renesas.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ renesas/arch/arm/mach-shmobile/include/mach/r8a7779.h @@ -4,6 +4,7 @@ #include linux/sh_clk.h #include linux/pm_domain.h #include linux/sh_eth.h +#include linux/platform_data/usb-rcar-phy.h struct platform_device; @@ -33,6 +34,7 @@ extern void r8a7779_add_early_devices(vo extern void r8a7779_add_standard_devices(void); extern void r8a7779_add_standard_devices_dt(void); extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); +extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata); extern void r8a7779_init_late(void); extern void r8a7779_clock_init(void); extern void r8a7779_pinmux_init(void); Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c === --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -389,7 +389,7 @@ static struct platform_device sata_devic }; /* USB PHY */ -static struct resource usb_phy_resources[] = { +static struct resource usb_phy_resources[] __initdata = { [0] = { .start = 0xffe70800, .end= 0xffe70900 - 1, @@ -397,13 +397,6 @@ static struct resource usb_phy_resources }, }; -static struct platform_device usb_phy_device = { - .name = rcar_usb_phy, - .id = -1, - .resource = usb_phy_resources, - .num_resources = ARRAY_SIZE(usb_phy_resources), -}; - /* USB */ static struct usb_phy *phy; @@ -575,7 +568,6 @@ static struct platform_device *r8a7779_d scif5_device, tmu00_device, tmu01_device, - usb_phy_device, }; static struct platform_device *r8a7779_standard_devices[] __initdata = { @@ -610,6 +602,14 @@ void __init r8a7779_add_ether_device(str pdata, sizeof(*pdata)); } +void __init r8a7779_add_usb_phy_device(struct
[PATCH v8 9/9] phy-rcar-usb: handle platform data
Set the USBPCTRL0 register from the passed platform data in rcar_usb_phy_init(); don't reset it to 0 in rcar_usb_phy_shutdown() anymore as that does not make sense. Also, don't allow the driver's probe to succeed when the platform data are not supplied with a device. The patch has been tested on the Marzen and BOCK-W boards. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com Acked-by: Simon Horman horms+rene...@verge.net.au Acked-by: Felipe Balbi ba...@ti.com --- Changes since version 7: - renamed the PHY driver and changed the patch subject accordingly; - added *static* to ovcn_act[] definition. Changes since version 6: - renamed the R-Car PHY driver header file in #include; - added an ACK from Felipe Balbi. Changes since version 3: - moved USBPCTRL0 register bit #define's from patch #7, removing the prefixes; - implemented parsing of the platform data to set USBPCTRL0 register. Changes since version 2: - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. drivers/usb/phy/phy-rcar-usb.c | 51 - 1 file changed, 45 insertions(+), 6 deletions(-) Index: renesas/drivers/usb/phy/phy-rcar-usb.c === --- renesas.orig/drivers/usb/phy/phy-rcar-usb.c +++ renesas/drivers/usb/phy/phy-rcar-usb.c @@ -1,8 +1,9 @@ /* * Renesas R-Car USB phy driver * - * Copyright (C) 2012 Renesas Solutions Corp. + * Copyright (C) 2012-2013 Renesas Solutions Corp. * Kuninori Morimoto kuninori.morimoto...@renesas.com + * Copyright (C) 2013 Cogent Embedded, Inc. * * 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 @@ -15,6 +16,7 @@ #include linux/platform_device.h #include linux/spinlock.h #include linux/module.h +#include linux/platform_data/usb-rcar-phy.h /* REGS block */ #define USBPCTRL0 0x00 @@ -24,6 +26,25 @@ #define USBOH0 0x1C #define USBCTL00x58 +/* USBPCTRL0 */ +#define OVC2 (1 10) /* Switches the OVC input pin for port 2: */ + /* 1: USB_OVC2, 0: OVC2 */ +#define OVC1_VBUS1 (1 9) /* Switches the OVC input pin for port 1: */ + /* 1: USB_OVC1, 0: OVC1/VBUS1 */ + /* Function mode: set to 0 */ +#define OVC0 (1 8) /* Switches the OVC input pin for port 0: */ + /* 1: USB_OVC0 pin, 0: OVC0 */ +#define OVC2_ACT (1 6) /* Host mode: OVC2 polarity: */ + /* 1: active-high, 0: active-low*/ +#define PENC (1 4) /* Function mode: output level of PENC1 pin: */ + /* 1: high, 0: low */ +#define OVC0_ACT (1 3) /* Host mode: OVC0 polarity: */ + /* 1: active-high, 0: active-low*/ +#define OVC1_ACT (1 1) /* Host mode: OVC1 polarity: */ + /* 1: active-high, 0: active-low*/ + /* Function mode: be sure to set to 1 */ +#define PORT1 (1 0) /* Selects port 1 mode:*/ + /* 1: function, 0: host */ /* USBPCTRL1 */ #define PHY_RST(1 2) #define PLL_ENB(1 1) @@ -55,7 +76,9 @@ static int rcar_usb_phy_init(struct usb_ { struct rcar_usb_phy_priv *priv = usb_phy_to_priv(phy); struct device *dev = phy-dev; + struct rcar_phy_platform_data *pdata = dev-platform_data; void __iomem *reg0 = priv-reg0; + static const u8 ovcn_act[] = { OVC0_ACT, OVC1_ACT, OVC2_ACT }; int i; u32 val; unsigned long flags; @@ -89,8 +112,21 @@ static int rcar_usb_phy_init(struct usb_ /* (4) USB-PHY reset clear */ iowrite32(PHY_ENB | PLL_ENB | PHY_RST, (reg0 + USBPCTRL1)); - /* set platform specific port settings */ - iowrite32(0x, (reg0 + USBPCTRL0)); + /* Board specific port settings */ + val = 0; + if (pdata-port1_func) + val |= PORT1; + if (pdata-penc1) + val |= PENC; + for (i = 0; i 3; i++) { + /* OVCn bits follow each other in the right order */ + if (pdata-ovc_pin[i].select_3_3v) + val |= OVC0 i; + /* OVCn_ACT bits are spaced by irregular intervals */ + if (pdata-ovc_pin[i].active_high) + val |= ovcn_act[i]; + } + iowrite32(val, (reg0 + USBPCTRL0));
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
On 06/01/13 13:31, Joe Perches wrote: On Sat, 2013-06-01 at 21:09 +0200, Emil Goode wrote: I see, will send a second version. Hey Emil. I believe you can not use %pa with a dma_addr_t because that could be a different size than a phy_addr_t. (the vsprintf cast and deref is to a phy_addr_t) Hi Joe, Thank you for pointing that out. It's a bit of a shame that this comment was deleted from include/asm-generic/types.h in commit 3e50594e8e72932ad4cfcb0b3cbdf58fc3bce416: -/* - * DMA addresses may be very different from physical addresses - * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit - * systems, while sparc64 uses 32 bit DMA addresses for 64 bit - * physical addresses. - * This default defines dma_addr_t to have the same size as - * phys_addr_t, which is the most common way. - * Do not define the dma64_addr_t type, which never really - * worked. - */ The definitions are: (types.h) #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT typedef u64 dma_addr_t; #else typedef u32 dma_addr_t; #endif /* dma_addr_t */ [] #ifdef CONFIG_PHYS_ADDR_T_64BIT typedef u64 phys_addr_t; #else typedef u32 phys_addr_t; #endif On Sat, Jun 01, 2013 at 11:29:10AM -0700, Joe Perches wrote: On Sat, 2013-06-01 at 20:02 +0200, Emil Goode wrote: This patch makes use of the new format specifier %pa that was introduced by the following commit. 7d7992108d02aa92ad4c77e5d9ce14088c942e75 (lib/vsprintf.c: add %pa format specifier for phys_addr_t types) [] diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c [] @@ -1756,12 +1756,11 @@ void musb_host_rx(struct musb *musb, u8 epnum) [] - dev_dbg(musb-controller, RX%d count %d, buffer 0x%llx len %d/%d\n, + dev_dbg(musb-controller, RX%d count %d, buffer 0x%pa len %d/%d\n, This would emit 0x0xaddr -- ~Randy -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 0/3] Add USB support to R8A7778/BOCK-W
Hello. Here's the set of 3 patches against the Simon Horman's 'renesas.git' repo, 'renesas-next-20130528' tag, and the R8A7779/Marzen USB patchset I've posted. It was created to add support of R8A7778/BOCK-W USB to the platform code and the USB common PHY driver, and so spans both arch/arm/mach-shmobile/ and drivers/usb/phy/ subtrees. [1/3] phy-rcar-usb: add R8A7778 support [2/3] ARM: shmobile: r8a7778: add USB support [3/3] ARM: shmobile: BOCK-W: add USB support The patch #4 (ARM: shmobile: BOCK-W: enable USB in defconfig) that has been already merged, is not reposted. The patchset is completely ready for merging now. WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 1/3] phy-rcar-usb: add R8A7778 support
The driver currently only supports R8A7779 SoC. Compared to it, R8A7778 USB-PHY has extra register range containing two high-speed signal quality characteristic control registers which should be set up during USB-PHY startup depending on whether a ferrite bead is in use or not. So, we now handle an optional second memory range in the driver's probe method, add the 'ferrite_bead' field to the driver's platform data, and add an extra (optional) step to the USB-PHY startup routine which sets up the extended registers. Also mark in the driver's Kconfig section that R8A7778 is now supported and generally clarify that section, uppercasing the word phy and also changing the module name that got lost in the big driver rename, while at it... The patch has been tested on the Marzen and BOCK-W boards. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com Acked-by: Felipe Balbi ba...@ti.com --- Changes since version 7: - renamed the PHY driver and changed the patch subject accordingly; - changed the module name mentioned in the driver's Kconfig entry; - resolved rejects. Changes since version 5: - renamed the header file into linux/platform_data/usb-rcar-phy.h. Changes since version 3: - removed stray debugging printk() call. Changes since version 2: - moved 'ferrite_bead' bitfield to the start of 'struct rcar_phy_platform_data' which allowed to cut the size of the structure from 8 bytes back to 4; - added a comment about only 2 USB ports on R8A7778' - added an ACK from Felipe Balbi. Changes since the original posting: - made the necessary changes atop of the R8A7779/Marzen pathset version 4. drivers/usb/phy/Kconfig| 10 +++ drivers/usb/phy/phy-rcar-usb.c | 37 - include/linux/platform_data/usb-rcar-phy.h |4 ++- 3 files changed, 39 insertions(+), 12 deletions(-) Index: renesas/drivers/usb/phy/Kconfig === --- renesas.orig/drivers/usb/phy/Kconfig +++ renesas/drivers/usb/phy/Kconfig @@ -181,15 +181,15 @@ config USB_MXS_PHY MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x. config USB_RCAR_PHY - tristate Renesas R-Car USB phy support + tristate Renesas R-Car USB PHY support depends on USB || USB_GADGET help - Say Y here to add support for the Renesas R-Car USB phy driver. - This chip is typically used as USB phy for USB host, gadget. - This driver supports: R8A7779 + Say Y here to add support for the Renesas R-Car USB common PHY driver. + This chip is typically used as USB PHY for USB host, gadget. + This driver supports R8A7778 and R8A7779. To compile this driver as a module, choose M here: the - module will be called rcar-phy. + module will be called phy-rcar-usb. config USB_ULPI bool Generic ULPI Transceiver Driver Index: renesas/drivers/usb/phy/phy-rcar-usb.c === --- renesas.orig/drivers/usb/phy/phy-rcar-usb.c +++ renesas/drivers/usb/phy/phy-rcar-usb.c @@ -26,15 +26,21 @@ #define USBOH0 0x1C #define USBCTL00x58 +/* High-speed signal quality characteristic control registers (R8A7778 only) */ +#define HSQCTL10x24 +#define HSQCTL20x28 + /* USBPCTRL0 */ -#define OVC2 (1 10) /* Switches the OVC input pin for port 2: */ +#define OVC2 (1 10) /* (R8A7779 only) */ + /* Switches the OVC input pin for port 2: */ /* 1: USB_OVC2, 0: OVC2 */ #define OVC1_VBUS1 (1 9) /* Switches the OVC input pin for port 1: */ /* 1: USB_OVC1, 0: OVC1/VBUS1 */ /* Function mode: set to 0 */ #define OVC0 (1 8) /* Switches the OVC input pin for port 0: */ /* 1: USB_OVC0 pin, 0: OVC0 */ -#define OVC2_ACT (1 6) /* Host mode: OVC2 polarity: */ +#define OVC2_ACT (1 6) /* (R8A7779 only) */ + /* Host mode: OVC2 polarity:*/ /* 1: active-high, 0: active-low*/ #define PENC (1 4) /* Function mode: output level of PENC1 pin: */ /* 1: high, 0: low */ @@ -59,6 +65,7 @@ struct rcar_usb_phy_priv { spinlock_t lock; void __iomem *reg0; + void __iomem *reg1; int counter; }; @@ -78,6 +85,7 @@ static int rcar_usb_phy_init(struct usb_ struct device *dev = phy-dev; struct rcar_phy_platform_data *pdata = dev-platform_data; void __iomem *reg0 = priv-reg0; + void __iomem *reg1 = priv-reg1; static const u8 ovcn_act[] = {
[PATCH v8 2/3] ARM: shmobile: r8a7778: add USB support
Add USB clock and EHCI, OHCI, and USB PHY platform devices for R8A7778 SoC; add a function to register PHY device with board-specific platform data and register EHCI and OHCI platfrom devices from the init_late() board method. Also, don't forget to enable CONFIG_ARCH_HAS_[EO]HCI options for R8A7778 SoC in Kconfig... The patch has been tested on the BOCK-W board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- Changes since version 7: - changed PHY checks to IS_ERR(phy) and returning PTR_ERR(phy) where applicable; - resolved reject. Changes since version 5: - renamed the R-Car PHY driver header file in #include. Changes since version 4: - annotated USB resources and '[eo]hci_info' as '__initdata' since they're kmemdup()'ed while registering the platform devices anyway; - refreshed the patch. Changes since version 3: - resolved reject in the 'clock-r8a7778.c' file, refreshed the patch. Changes since version 2: - refreshed the patch. Changes since the original posting: - resolved rejects in the 'clock-r8a7778.c' file; - lowercased the SoC name in the subject. arch/arm/mach-shmobile/Kconfig|2 arch/arm/mach-shmobile/clock-r8a7778.c|4 arch/arm/mach-shmobile/include/mach/r8a7778.h |3 arch/arm/mach-shmobile/setup-r8a7778.c| 108 ++ 4 files changed, 117 insertions(+) Index: renesas/arch/arm/mach-shmobile/Kconfig === --- renesas.orig/arch/arm/mach-shmobile/Kconfig +++ renesas/arch/arm/mach-shmobile/Kconfig @@ -41,6 +41,8 @@ config ARCH_R8A7778 select CPU_V7 select SH_CLK_CPG select ARM_GIC + select USB_ARCH_HAS_EHCI + select USB_ARCH_HAS_OHCI config ARCH_R8A7779 bool R-Car H1 (R8A77790) Index: renesas/arch/arm/mach-shmobile/clock-r8a7778.c === --- renesas.orig/arch/arm/mach-shmobile/clock-r8a7778.c +++ renesas/arch/arm/mach-shmobile/clock-r8a7778.c @@ -105,6 +105,7 @@ static struct clk *main_clks[] = { enum { MSTP323, MSTP322, MSTP321, MSTP114, + MSTP100, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, MSTP016, MSTP015, MSTP_NR }; @@ -114,6 +115,7 @@ static struct clk mstp_clks[MSTP_NR] = { [MSTP322] = SH_CLK_MSTP32(p_clk, MSTPCR3, 22, 0), /* SDHI1 */ [MSTP321] = SH_CLK_MSTP32(p_clk, MSTPCR3, 21, 0), /* SDHI2 */ [MSTP114] = SH_CLK_MSTP32(p_clk, MSTPCR1, 14, 0), /* Ether */ + [MSTP100] = SH_CLK_MSTP32(p_clk, MSTPCR1, 0, 0), /* USB0/1 */ [MSTP026] = SH_CLK_MSTP32(p_clk, MSTPCR0, 26, 0), /* SCIF0 */ [MSTP025] = SH_CLK_MSTP32(p_clk, MSTPCR0, 25, 0), /* SCIF1 */ [MSTP024] = SH_CLK_MSTP32(p_clk, MSTPCR0, 24, 0), /* SCIF2 */ @@ -130,6 +132,8 @@ static struct clk_lookup lookups[] = { CLKDEV_DEV_ID(sh_mobile_sdhi.1, mstp_clks[MSTP322]), /* SDHI1 */ CLKDEV_DEV_ID(sh_mobile_sdhi.2, mstp_clks[MSTP321]), /* SDHI2 */ CLKDEV_DEV_ID(sh-eth, mstp_clks[MSTP114]), /* Ether */ + CLKDEV_DEV_ID(ehci-platform, mstp_clks[MSTP100]), /* USB EHCI port0/1 */ + CLKDEV_DEV_ID(ohci-platform, mstp_clks[MSTP100]), /* USB OHCI port0/1 */ CLKDEV_DEV_ID(sh-sci.0, mstp_clks[MSTP026]), /* SCIF0 */ CLKDEV_DEV_ID(sh-sci.1, mstp_clks[MSTP025]), /* SCIF1 */ CLKDEV_DEV_ID(sh-sci.2, mstp_clks[MSTP024]), /* SCIF2 */ Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h === --- renesas.orig/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h @@ -20,10 +20,13 @@ #include linux/mmc/sh_mobile_sdhi.h #include linux/sh_eth.h +#include linux/platform_data/usb-rcar-phy.h extern void r8a7778_add_standard_devices(void); extern void r8a7778_add_standard_devices_dt(void); extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); +extern void r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata); +extern void r8a7778_init_late(void); extern void r8a7778_init_delay(void); extern void r8a7778_init_irq(void); extern void r8a7778_init_irq_dt(void); Index: renesas/arch/arm/mach-shmobile/setup-r8a7778.c === --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7778.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7778.c @@ -30,6 +30,12 @@ #include linux/irqchip.h #include linux/serial_sci.h #include linux/sh_timer.h +#include linux/pm_runtime.h +#include linux/usb/phy.h +#include linux/usb/hcd.h +#include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h +#include linux/dma-mapping.h #include mach/irqs.h #include mach/r8a7778.h #include mach/common.h @@ -89,6 +95,99 @@ static struct sh_timer_config sh_tmu1_pl sh_tmu##idx##_platform_data, \
[PATCH v8 3/3] ARM: shmobile: BOCK-W: add USB support
Register the USB PHY device from bockw_init(), passing the platform data to it. Set machine's init_late() method to r8a7778_init_late() in order for [EO]HCI to get registered too... Don't forget to add USB PENC0/1 pins to bockw_pinctrl_map[]. The patch has been tested on the BOCK-W board. Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com --- Changes since version 6: - added USB PENC0/1 pins to bockw_pinctrl_map[]. Changes since version 4: - annotated 'usb_phy_platform_data' as '__initdata' since it's kmemdup()'ed while registering the platform device anyway; - refreshed the patch. Changes since version 3: - removed initializer for 'usb_phy_platform_data' letting it be set to all 0s; - refreshed the patch. Changes since version 2: - refreshed the patch. Changes since the original posting: - removed initializer for no longer existing field in 'usb_phy_platform_data', modified the comment to the 'ferrite_bead' field initializer. arch/arm/mach-shmobile/board-bockw.c |8 1 file changed, 8 insertions(+) Index: renesas/arch/arm/mach-shmobile/board-bockw.c === --- renesas.orig/arch/arm/mach-shmobile/board-bockw.c +++ renesas/arch/arm/mach-shmobile/board-bockw.c @@ -63,6 +63,8 @@ static struct sh_mobile_sdhi_info sdhi0_ .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, }; +static struct rcar_phy_platform_data usb_phy_platform_data __initdata; + static const struct pinctrl_map bockw_pinctrl_map[] = { /* SCIF0 */ PIN_MAP_MUX_GROUP_DEFAULT(sh-sci.0, pfc-r8a7778, @@ -78,6 +80,10 @@ static const struct pinctrl_map bockw_pi sdhi0_data4, sdhi0), PIN_MAP_MUX_GROUP_DEFAULT(sh_mobile_sdhi.0, pfc-r8a7778, sdhi0_wp, sdhi0), + PIN_MAP_MUX_GROUP_DEFAULT(ehci-platform, pfc-r8a7778, + usb0, usb0), + PIN_MAP_MUX_GROUP_DEFAULT(ehci-platform, pfc-r8a7778, + usb1, usb1), }; #define FPGA 0x1820 @@ -91,6 +97,7 @@ static void __init bockw_init(void) r8a7778_clock_init(); r8a7778_init_irq_extpin(1); r8a7778_add_standard_devices(); + r8a7778_add_usb_phy_device(usb_phy_platform_data); pinctrl_register_mappings(bockw_pinctrl_map, ARRAY_SIZE(bockw_pinctrl_map)); @@ -146,4 +153,5 @@ DT_MACHINE_START(BOCKW_DT, bockw) .init_machine = bockw_init, .init_time = shmobile_timer_init, .dt_compat = bockw_boards_compat_dt, + .init_late = r8a7778_init_late, MACHINE_END -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
On Sat, 2013-06-01 at 14:56 -0700, Randy Dunlap wrote: It's a bit of a shame that this comment was deleted from include/asm-generic/types.h in commit 3e50594e8e72932ad4cfcb0b3cbdf58fc3bce416: -/* - * DMA addresses may be very different from physical addresses - * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit - * systems, while sparc64 uses 32 bit DMA addresses for 64 bit - * physical addresses. - * This default defines dma_addr_t to have the same size as - * phys_addr_t, which is the most common way. - * Do not define the dma64_addr_t type, which never really - * worked. - */ Hey Randy. You could always put it back. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: Fix format specifier warning
On Sat, Jun 1, 2013 at 8:11 PM, Emil Goode emilgo...@gmail.com wrote: Thank's for your pointers. I will send a patch that applies on top of Felipe's patch. I guess there is not much sense to do that since Felipe applied your patch already. Just keep in mind the hint for future changes. -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
Hello Joe and Randy, Maybe there should be another format specifier %da and Randy's clarifying comment can be added there to the documentation? Best regards, Emil Goode On Sat, Jun 01, 2013 at 03:16:00PM -0700, Joe Perches wrote: On Sat, 2013-06-01 at 14:56 -0700, Randy Dunlap wrote: It's a bit of a shame that this comment was deleted from include/asm-generic/types.h in commit 3e50594e8e72932ad4cfcb0b3cbdf58fc3bce416: -/* - * DMA addresses may be very different from physical addresses - * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit - * systems, while sparc64 uses 32 bit DMA addresses for 64 bit - * physical addresses. - * This default defines dma_addr_t to have the same size as - * phys_addr_t, which is the most common way. - * Do not define the dma64_addr_t type, which never really - * worked. - */ Hey Randy. You could always put it back. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: musb: use the new %pa format specifier for dma_addr_t
On Sun, 2013-06-02 at 01:06 +0200, Emil Goode wrote: Maybe there should be another format specifier %da and Randy's clarifying comment maybe %pad but I think the whole thing isn't much necessary. It seems there are a grand total of 3 uses of %pa today. Maybe: --- Documentation/printk-formats.txt | 7 +++ lib/vsprintf.c | 19 +++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt index 3af5ae6..fa48403 100644 --- a/Documentation/printk-formats.txt +++ b/Documentation/printk-formats.txt @@ -63,6 +63,13 @@ Physical addresses: resource_size_t) which can vary based on build options, regardless of the width of the CPU data path. Passed by reference. +dma_addr_t addresses: + + %pad0x01234567 or 0x0123456789abcdef + + For printing a dma_addr_t type which can vary based on build options, + regardless of the width of the CPU data path. Passed by reference. + Raw buffer as a hex string: %*ph00 01 02 ... 3f %*phC 00:01:02: ... :3f diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 7d84676..b6b8390 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1039,6 +1039,7 @@ int kptr_restrict __read_mostly; *The maximum supported length is 64 bytes of the input. Consider *to use print_hex_dump() for the larger input. * - 'a' For a phys_addr_t type and its derivative types (passed by reference) + * - 'ad' For a dma_addr_t type * * Note: The difference between 'S' and 'F' is that on ia64 and ppc64 * function pointers are really function descriptors, which contain a @@ -1129,12 +1130,22 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, return netdev_feature_string(buf, end, ptr, spec); } break; - case 'a': + case 'a': { + unsigned long long val; spec.flags |= SPECIAL | SMALL | ZEROPAD; - spec.field_width = sizeof(phys_addr_t) * 2 + 2; spec.base = 16; - return number(buf, end, - (unsigned long long) *((phys_addr_t *)ptr), spec); + switch (fmt[1]) { + case 'd': + spec.field_width = sizeof(dma_addr_t) * 2 + 2; + val = (unsigned long long)*((dma_addr_t *)ptr); + break; + default: + spec.field_width = sizeof(phys_addr_t) * 2 + 2; + val = (unsigned long long)*((phys_addr_t *)ptr); + break; + } + return number(buf, end, val, spec); + } } spec.flags |= SMALL; if (spec.field_width == -1) { -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html