[PATCH v2 1/3] Documentation: bindings: add assign clock property in u2phy node

2017-03-01 Thread Meng Dongyang
On some platform such as RK3328, the 480m clock may need to assign
clock parent in dts in stead of clock driver. So this patch add
property of assigned-clocks and assigned-clock-parents to assign
parent for 480m clock.

Changes in v2:
 - move u2phy grf specification to grf.txt

Signed-off-by: Meng Dongyang 
---
 Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
index 3c29c77..e71a8d2 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
 
 Required properties (phy (parent) node):
  - compatible : should be one of the listed compatibles:
+   * "rockchip,rk3328-usb2phy"
* "rockchip,rk3366-usb2phy"
* "rockchip,rk3399-usb2phy"
  - reg : the address offset of grf for usb-phy configuration.
@@ -11,6 +12,11 @@ Required properties (phy (parent) node):
 Optional properties:
  - clocks : phandle + phy specifier pair, for the input clock of phy.
  - clock-names : input clock name of phy, must be "phyclk".
+ - assigned-clocks : phandle of usb 480m clock.
+ - assigned-clock-parents : parent of usb 480m clock, select between
+usb-phy output 480m and xin24m.
+Refer to clk/clock-bindings.txt for generic clock
+consumer properties.
 
 Required nodes : a sub-node is required for each port the phy provides.
 The sub-node name is used to identify host or otg port,
-- 
1.9.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


[PATCH v2 2/3] Documentation: bindings: add DT documentation for u2phy and u2phy grf

2017-03-01 Thread Meng Dongyang
Due to the u2phy registers are separated from general grf, we need to
add u2phy grf node and place u2phy node in it. So this patch add u2phy
grf node.

Changes in v2:
 - add u2phy grf specification

Signed-off-by: Meng Dongyang 
---
 Documentation/devicetree/bindings/soc/rockchip/grf.txt | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.txt 
b/Documentation/devicetree/bindings/soc/rockchip/grf.txt
index 013e71a..6ac23f9 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.txt
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.txt
@@ -7,6 +7,9 @@ From RK3368 SoCs, the GRF is divided into two sections,
 - GRF, used for general non-secure system,
 - PMUGRF, used for always on system
 
+On RK3328 SoCs, the GRF is divided into three sections,
+except GRF and PMUGRF, add a section for USB2PHYGRF,
+
 Required Properties:
 
 - compatible: GRF should be one of the followings
@@ -19,6 +22,8 @@ Required Properties:
 - compatible: PMUGRF should be one of the followings
- "rockchip,rk3368-pmugrf", "syscon": for rk3368
- "rockchip,rk3399-pmugrf", "syscon": for rk3399
+- compatible: USB2GRF should be one of the followings
+   - "rockchip,rk3328-usb2phy-grf", "syscon": for rk3328
 - reg: physical base address of the controller and length of memory mapped
   region.
 
@@ -33,3 +38,13 @@ Example: GRF and PMUGRF of RK3399 SoCs
compatible = "rockchip,rk3399-grf", "syscon";
reg = <0x0 0xff77 0x0 0x1>;
};
+
+Example: USB2GRF of RK3328 SoCs
+
+   usb2phy_grf: syscon@ff45 {
+   compatible = "rockchip,rk3328-usb2phy-grf", "syscon",
+"simple-mfd";
+   reg = <0x0 0xff45 0x0 0x1>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   };
-- 
1.9.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


[PATCH v2 0/3] add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
The config information of RK3328 about address and port property
is different from before platform. So add config information in the
data of match table and documentation of the device tree bindings
of u2phy.

Changes in v2:
 - move u2phy grf specification to .../devicetree/bindings/soc/rockchip/grf.txt
 - add otg port config information of rk3328

Meng Dongyang (3):
  Documentation: bindings: add assign clock property in u2phy node
  Documentation: bindings: add DT documentation for u2phy and u2phy grf
  phy: rockchip-inno-usb2: add support of u2phy for rk3328

 .../bindings/phy/phy-rockchip-inno-usb2.txt|  6 +++
 .../devicetree/bindings/soc/rockchip/grf.txt   | 15 +++
 drivers/phy/phy-rockchip-inno-usb2.c   | 52 ++
 3 files changed, 73 insertions(+)

-- 
1.9.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


[PATCH v2 3/3] phy: rockchip-inno-usb2: add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
Add u2phy config information in the data of match table for
rk3328.

Changes in v2:
 - add support of otg port

Signed-off-by: Meng Dongyang 
---
 drivers/phy/phy-rockchip-inno-usb2.c | 52 
 1 file changed, 52 insertions(+)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
index 4ea95c2..0d6 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -1141,6 +1141,57 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
+   {
+   .reg = 0x100,
+   .num_ports  = 2,
+   .phy_tuning = rk3328_usb2phy_tuning,
+   .clkout_ctl = { 0x108, 4, 4, 1, 0 },
+   .port_cfgs  = {
+   [USB2PHY_PORT_OTG] = {
+   .phy_sus= { 0x0100, 15, 0, 0, 0x1d1 },
+   .bvalid_det_en  = { 0x0110, 2, 2, 0, 1 },
+   .bvalid_det_st  = { 0x0114, 2, 2, 0, 1 },
+   .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 },
+   .idfall_det_en  = { 0x0110, 5, 5, 0, 1 },
+   .idfall_det_st  = { 0x0114, 5, 5, 0, 1 },
+   .idfall_det_clr = { 0x0118, 5, 5, 0, 1 },
+   .idrise_det_en  = { 0x0110, 4, 4, 0, 1 },
+   .idrise_det_st  = { 0x0114, 4, 4, 0, 1 },
+   .idrise_det_clr = { 0x0118, 4, 4, 0, 1 },
+   .ls_det_en  = { 0x0110, 0, 0, 0, 1 },
+   .ls_det_st  = { 0x0114, 0, 0, 0, 1 },
+   .ls_det_clr = { 0x0118, 0, 0, 0, 1 },
+   .utmi_avalid= { 0x0120, 10, 10, 0, 1 },
+   .utmi_bvalid= { 0x0120, 9, 9, 0, 1 },
+   .utmi_iddig = { 0x0120, 6, 6, 0, 1 },
+   .utmi_ls= { 0x0120, 5, 4, 0, 1 },
+   },
+   [USB2PHY_PORT_HOST] = {
+   .phy_sus= { 0x104, 15, 0, 0, 0x1d1 },
+   .ls_det_en  = { 0x110, 1, 1, 0, 1 },
+   .ls_det_st  = { 0x114, 1, 1, 0, 1 },
+   .ls_det_clr = { 0x118, 1, 1, 0, 1 },
+   .utmi_ls= { 0x120, 17, 16, 0, 1 },
+   .utmi_hstdet= { 0x120, 19, 19, 0, 1 }
+   }
+   },
+   .chg_det = {
+   .opmode = { 0x0100, 3, 0, 5, 1 },
+   .cp_det = { 0x0120, 24, 24, 0, 1 },
+   .dcp_det= { 0x0120, 23, 23, 0, 1 },
+   .dp_det = { 0x0120, 25, 25, 0, 1 },
+   .idm_sink_en= { 0x0108, 8, 8, 0, 1 },
+   .idp_sink_en= { 0x0108, 7, 7, 0, 1 },
+   .idp_src_en = { 0x0108, 9, 9, 0, 1 },
+   .rdm_pdwn_en= { 0x0108, 10, 10, 0, 1 },
+   .vdm_src_en = { 0x0108, 12, 12, 0, 1 },
+   .vdp_src_en = { 0x0108, 11, 11, 0, 1 },
+   },
+   },
+   { /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
{
.reg = 0x700,
@@ -1223,6 +1274,7 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
 };
 
 static const struct of_device_id rockchip_usb2phy_dt_match[] = {
+   { .compatible = "rockchip,rk3328-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3366-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3399-usb2phy", .data = _phy_cfgs },
{}
-- 
1.9.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


Re: [PATCH v7 0/5] usb: early: add support for early printk through USB3 debug port

2017-03-01 Thread Ingo Molnar

* Lu Baolu  wrote:

> Hi Ingo,
> 
> How about this version? Any further comments?

So I have re-read the review feedback I gave on Jan 19 and found at least one 
thing I pointed out that you didn't address in the latest patches ...

Plus please go beyond the feedback given - for example the Kconfig text 
contains 
at least one typo.

Thanks,

Ingo
--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Dmitry Torokhov
On Wed, Mar 01, 2017 at 09:59:31PM +0200, Avraham Shukron wrote:
> > 
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> > 
> > Regardless, it's a very old driver, just let it be.
> > 
> > Thanks.
> > 
> 
> I can make it Nx8 :)

Or you can leave it as is.

> 
> Seriously now - I don't understand what is so wrong with checkpatch fixes?

Checkpatch is a tool to make sure new code follows standard conversions,
not reshuffling old working code.

> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.
> I thought fixing a driver that I actually use daily will be more satisfying.

You are not using this driver daily, pretty much nobody does. What you
are using is usbhid + hid-input + probably some hardware-specific hid
driver that twiddles the behavior of your keyboard.

> Why driver being old is a good reason to ignore the coding style conventions?

Since there is no active development nor use it is easy to introduce
bugs that won't be caught until much later. Checkpatch fixes are usually
welcome when there are additional fixes to the same driver.

Thanks.

-- 
Dmitry
--
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: dwc2 gadget issues

2017-03-01 Thread Randy Li
You don't need to send me a private mail, I would suggest you CC me next 
time.


On 02/24/2017 03:27 AM, Heiko Stuebner wrote:

Hi Francesco,

Am Donnerstag, 23. Februar 2017, 19:11:37 CET schrieb Francesco Lavra:

I'm having trouble getting the RK3288 OTG controller (the one at
ff58) to work in peripheral mode. I'm using a Firefly Reload board,
and I know the hardware is fine because I can successfully use the port
in device mode with U-Boot's mass storage gadget driver.
Under Linux, the OTG port works fine when used in host mode, but fails
to work in device mode: nothing happens when the a USB host is plugged
into the OTG port, not even a single interrupt is generated by the
controller. I'm using the latest device tree definitions from
git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git.


you shouldn't use my tree as base for any real work :-) . Best to use the
regular mainline kernel or alternatively try linux-next to get all recent usb
changes schedules for the next release.



Tried with different gadget drivers (g_audio, g_ether, g_mass_storage),
but it makes no difference.

I tried g_ether and g_serial, it looks fine for me.

Tried also forcing peripheral mode in the device tree, with dr_mode =
"peripheral", to no avail.

Are there any known problems with the RK3288 OTG controller?


In general the controller is a dwc2 and there was quite some activity on the
driver recently. So maybe really try linux-next first and see if any of the
changes included there improve the situation.

I've included some usb lists + people, maybe they know if anything recent may
have changed things.



Here is the relevant log when the dwc2 driver is loaded at boot:

[1.376935] ff58.usb supply vusb_d not found, using dummy regulator
[1.383683] ff58.usb supply vusb_a not found, using dummy regulator
[1.390627] dwc2 ff58.usb: dwc2_core_reset() HANG! Soft Reset
GRSTCTL=8001
[1.509048] dwc2 ff58.usb: dwc2_wait_for_mode: Couldn't set
device mode
[1.750626] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g-tx-fifo-size, setting to default average
[1.761828] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[1]=104
[1.771192] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[2]=104
[1.780529] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[3]=104
[1.789888] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[4]=104
[1.799245] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[5]=104
[1.808614] dwc2 ff58.usb: dwc2_check_param_tx_fifo_sizes:
Invalid parameter g_tx_fifo_size[6]=104
[1.817993] usb 1-1: new high-speed USB device number 2 using dwc2
[1.824390] dwc2 ff58.usb: EPs: 10, dedicated fifos, 972 entries
in SPRAM
[1.832098] dwc2 ff58.usb: DWC OTG Controller
[1.836924] dwc2 ff58.usb: new USB bus registered, assigned bus
number 2
[1.844125] dwc2 ff58.usb: irq 41, io mem 0xff58
[1.849747] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[1.856598] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[1.863875] usb usb2: Product: DWC OTG Controller
[1.868601] usb usb2: Manufacturer: Linux 4.8.1+ dwc2_hsotg
[1.874215] usb usb2: SerialNumber: ff58.usb

and this is what I get when I load a gadget driver (in this case, g_audio):

[   19.848590] dwc2 ff58.usb: bound driver g_audio
[   19.853816] dwc2 ff58.usb: dwc2_hsotg_enqueue_setup: failed queue
(-11)



Heiko

___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
Randy Li

--
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: usb: gadget: webcam broken?

2017-03-01 Thread Petr Cvek
Dne 2.3.2017 v 00:22 Laurent Pinchart napsal(a):
> Hi Roger,
> 
> On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
>> Hi,
>>
>> I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
>> the end. It looks like we're goofing up on the control endpoint.
>>
>> If I revert the following commit everything works fine.
>> commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
>> Author: Petr Cvek 
>> Date:   Wed Aug 17 12:36:57 2016 +0200
>>
>> usb: gadget: uvc: Add missing call for additional setup data
>>
>> Am I missing something on uvc-gadget side or is the commit really bad?
>> From what I understand, uvc-gadget is responsible for sending response to
>> UVC class specific requests on control endpoint in uvc_send_response()
>> in uvc_v4l2.c.
>>
>> So the reported commit is sending a duplicate response with probably
>> improper data.
> 
> Yes, this looks very dubious to me. I think it should be reverted. My 
> apologies for not having caught the patch during review.

Hi,

Now I've watched all codepaths again and yeah it is probably wrong patch, sorry.

But if the code path is really:

uvc_function_setup() -> userspace setup -> ioctl UVCIOC_SEND_RESPONSE -> 
uvc_send_response() -> usb_ep_queue() -> uvc_function_ep0_complete() -> 
userspace data

it seems the USB timeouts with my hardware (PXA27x UDC) but with my patch it 
gets response immediately.

Petr

--
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 v2] HID: hiddev: allocate minor number hiddev's USB interface is bound to

2017-03-01 Thread Kim Jaejoong
Hi Benjamin

Thanks for the review my patch :)

2017-03-01 2:05 GMT+09:00 Benjamin Tissoires :
> On Feb 15 2017 or thereabouts, Jaejoong Kim wrote:
>> When HID device connected to the PC, HID device driver announces which
>> driver is loaded with a kernel info message. In this case, hiddev's minor
>> number is always '0' even though hiddev's real minor number is not zero.
>>
>> To display hiddev with minor number asked from usb core, we need
>> to fill hiddev's minor number this interface is bound to.
>>
>> Signed-off-by: Jaejoong Kim 
>> ---
>
> That's a single line of code, and I get into some headaches :)
>
> So, the commit that broke this (.minor not being set) is actually commit
> bd25f4dd69727555 ("HID: hiddev: use usb_find_interface, get rid of
> BKL"), from 2010-07-11...
>
> And this patch reverts to the intended behavior.

Could you explain more about 'intended behavior'?

> But I am wondering if we
> should really store the minor in struct hid_device if it is only used by
> hiddev. hidraw does use a minor too, but stores it in struct hidraw
> directly, so IMO it would make sense to store this in struct hiddev. The
> problem is that this struct is not exported, and it's going to be some
> refactoring work to do so.
>

I agree with you. My patch is just allocate 'right' minor number in
struct hid_device.
After got your review mail,I also think struct hiddev and struct hid_device
need some refactoring work for minor number handling as you said.

For example, hid-cp2112.c uses a minor number of struct hid_device.
Based on comment
for minor in struct hid_device, it is for hiddev not hidraw. But,
hid-cp2112's connect_mask
for hid_hw_start is HIDRAW.

I will do some work for this one, so please ignore this patch :)

Thanks, jaejoong

> So, in a way, I am tempted to give my:
> Acked-by: Benjamin Tissoires 
>
> But if Jiri feels that a cleanup of hiddev would be required instead, I
> would follow him :)
>
> Cheers,
> Benjamin
>
>> Changes in v2:
>>  - fix typo in commit message
>> ---
>>
>>  drivers/hid/usbhid/hiddev.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
>> index 700145b..27e1f8d 100644
>> --- a/drivers/hid/usbhid/hiddev.c
>> +++ b/drivers/hid/usbhid/hiddev.c
>> @@ -910,6 +910,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
>> force)
>>   kfree(hiddev);
>>   return -1;
>>   }
>> + hid->minor = usbhid->intf->minor;
>>   return 0;
>>  }
>>
>> --
>> 2.7.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: cppi41: don't check early-TX-interrupt for Isoch transfer

2017-03-01 Thread Bin Liu
On Wed, Mar 01, 2017 at 09:07:03PM -0600, Bin Liu wrote:
> On Wed, Mar 01, 2017 at 01:14:44PM -0600, Bin Liu wrote:
> > 
> > --
> > 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
> 
> Hmm, I barely use --cc when git-send-email, but this time I cc'ed
> Sebastian and Alexandre, the email doesn't have the patch content.
> 
> $ git send-email --to usb --cc "Sebastian Andrzej Siewior
> " --cc "Alexandre Bailon"
> 0001-usb-musb-cppi41-don-t-check-early-TX-interrupt-for-I.patch
> 
> But I then tried --cc myself, the patch was sent correctly. Is there
> anything wrong in the command line above?

Never mind, it seems it was just a hiccup in any of the mail servers. I
run the same command line again an hour ago and it went through.

> 
> Thanks,
> -Bin.
--
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: cppi41: don't check early-TX-interrupt for Isoch transfer

2017-03-01 Thread Bin Liu
The CPPI41 driver polls register to workaround the pre-mature TX
interrupt issue, but it causes audio playback underrun when triggered in
Isoch transfers.

Isoch doesn't do back-to-back transfers, the TX should be done by the
time the next transfer is scheduled. So skip this polling workaround for
Isoch transfer.

Fixes: a655f481d83d6 ("usb: musb: musb_cppi41: handle pre-mature TX complete 
interrupt")
Cc:  #4.1+
Reported-by: Alexandre Bailon 
Signed-off-by: Bin Liu 
---
 drivers/usb/musb/musb_cppi41.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 00e272bfee39..355655f8a3fb 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -238,8 +238,27 @@ static void cppi41_dma_callback(void *private_data,
transferred < cppi41_channel->packet_sz)
cppi41_channel->prog_len = 0;
 
-   if (cppi41_channel->is_tx)
-   empty = musb_is_tx_fifo_empty(hw_ep);
+   if (cppi41_channel->is_tx) {
+   u8 type;
+
+   if (is_host_active(musb))
+   type = hw_ep->out_qh->type;
+   else
+   type = hw_ep->ep_in.type;
+
+   if (type == USB_ENDPOINT_XFER_ISOC)
+   /*
+* Don't use the early-TX-interrupt workaround below
+* for Isoch transfter. Since Isoch are periodic
+* transfer, by the time the next transfer is
+* scheduled, the current one should be done already.
+*
+* This avoids audio playback underrun issue.
+*/
+   empty = true;
+   else
+   empty = musb_is_tx_fifo_empty(hw_ep);
+   }
 
if (!cppi41_channel->is_tx || empty) {
cppi41_trans_done(cppi41_channel);
-- 
1.9.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


Re: [PATCH] usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer

2017-03-01 Thread Bin Liu
On Wed, Mar 01, 2017 at 01:14:44PM -0600, Bin Liu wrote:
> 
> --
> 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

Hmm, I barely use --cc when git-send-email, but this time I cc'ed
Sebastian and Alexandre, the email doesn't have the patch content.

$ git send-email --to usb --cc "Sebastian Andrzej Siewior
" --cc "Alexandre Bailon"
0001-usb-musb-cppi41-don-t-check-early-TX-interrupt-for-I.patch

But I then tried --cc myself, the patch was sent correctly. Is there
anything wrong in the command line above?

Thanks,
-Bin.
--
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: cppi41: don't check early-TX-interrupt for Isoch transfer

2017-03-01 Thread Bin Liu
The CPPI41 driver polls register to workaround the pre-mature TX
interrupt issue, but it causes audio playback underrun when triggered in
Isoch transfers.

Isoch doesn't do back-to-back transfers, the TX should be done by the
time the next transfer is scheduled. So skip this polling workaround for
Isoch transfer.

Fixes: a655f481d83d6 ("usb: musb: musb_cppi41: handle pre-mature TX complete 
interrupt")
Cc:  #4.1+
Reported-by: Alexandre Bailon 
Signed-off-by: Bin Liu 
---
 drivers/usb/musb/musb_cppi41.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 00e272bfee39..355655f8a3fb 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -238,8 +238,27 @@ static void cppi41_dma_callback(void *private_data,
transferred < cppi41_channel->packet_sz)
cppi41_channel->prog_len = 0;
 
-   if (cppi41_channel->is_tx)
-   empty = musb_is_tx_fifo_empty(hw_ep);
+   if (cppi41_channel->is_tx) {
+   u8 type;
+
+   if (is_host_active(musb))
+   type = hw_ep->out_qh->type;
+   else
+   type = hw_ep->ep_in.type;
+
+   if (type == USB_ENDPOINT_XFER_ISOC)
+   /*
+* Don't use the early-TX-interrupt workaround below
+* for Isoch transfter. Since Isoch are periodic
+* transfer, by the time the next transfer is
+* scheduled, the current one should be done already.
+*
+* This avoids audio playback underrun issue.
+*/
+   empty = true;
+   else
+   empty = musb_is_tx_fifo_empty(hw_ep);
+   }
 
if (!cppi41_channel->is_tx || empty) {
cppi41_trans_done(cppi41_channel);
-- 
1.9.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


Re: [PATCH v7 0/5] usb: early: add support for early printk through USB3 debug port

2017-03-01 Thread Lu Baolu
Hi Ingo,

How about this version? Any further comments?

Best regards,
Lu  Baolu

On 02/14/2017 10:27 AM, Lu Baolu wrote:
> xHCI debug capability (DbC) is an optional but standalone
> functionality provided by an xHCI host controller. With DbC
> hardware initialized, the system will present a debug device
> through the USB3 debug port (normally the first USB3 port).
> The debug device is fully compliant with the USB framework
> and provides the equivalent of a very high performance (USB3)
> full-duplex serial link between the debug host and target.
> The DbC functionality is independent of xHCI host. There
> isn't any precondition from xHCI host side for DbC to work.
>
> This patch set adds support for early printk functionality
> through a USB3 debug port by 1) initializing and enabling
> the DbC hardware during early boot; 2) registering a boot
> console to the system so that early printk messages can go
> through the USB3 debug port. It also includes some lines
> of changes in usb_debug driver so that it can be bound when
> a USB3 debug device is enumerated.
>
> ---
> Change log:
> v6->v7:
>   - add a new patch "[PATCH 1/5] x86: add simple udelay
> calibration" to make udelay() work for early drivers.
>   - [PATCH 2/5] usb: dbc: early driver for xhci debug capability
> - add a kernel thread to handle error cases, such as cable
>   unplugging.
> - Fixed several code styles pointed out by Ingo.
>
> v5->v6:
>   - rebase the patches on top of the latest 4.10-rc4
>   - run successfully in a 32-bit kernel
>   - [PATCH 1/4]
> - remove ugly linebreaks to make code more readable
> - rename config names to make them consistency
> - move sleep-able ioremap() out of the lock area
> - rename reserved fields of register structures
> - make the vertical tabulation of struct fields consistent
>   - [PATCH 2/4]
> - remove "#ifdef" in the generic code by creating proper
>   wrappers in header file
>   - [PATCH 3/4]
> - refine the title and commit message
>   - [PATCH 4/4]
> - fix several typos and grammar errors in the document
>
> v4->v5:
>   - add raw_spin_lock to make xdbc_bulk_write() reentrant.
>
> v3->v4:
>   - Rename the document with .dst suffix.
>   - Add the list of hardware that has been succesfuly
> tested on in the document.
>
> v2->v3:
>   - Removed spinlock usage.
>   - Removed work queue usage.
>   - Refined the user guide document.
>
> v1->v2:
>   - Refactor the duplicate code in xdbc_early_start() and
> xdbc_handle_external_reset().
>   - Free resources when hardware not used any more.
>   - Refine the user guide document.
>
> Lu Baolu (5):
>   x86: add simple udelay calibration
>   usb: dbc: early driver for xhci debug capability
>   x86: add support for earlyprintk via USB3 debug port
>   usb: serial: add dbc debug device support to usb_debug
>   usb: doc: add document for USB3 debug port usage
>
>  Documentation/admin-guide/kernel-parameters.txt |1 +
>  Documentation/usb/usb3-debug-port.rst   |   98 +++
>  arch/x86/Kconfig.debug  |   17 +
>  arch/x86/kernel/early_printk.c  |5 +
>  arch/x86/kernel/setup.c |   26 +
>  drivers/usb/Kconfig |3 +
>  drivers/usb/Makefile|2 +-
>  drivers/usb/early/Makefile  |1 +
>  drivers/usb/early/xhci-dbc.c| 1026 
> +++
>  drivers/usb/early/xhci-dbc.h|  210 +
>  drivers/usb/serial/usb_debug.c  |   28 +-
>  include/linux/usb/xhci-dbgp.h   |   29 +
>  12 files changed, 1442 insertions(+), 4 deletions(-)
>  create mode 100644 Documentation/usb/usb3-debug-port.rst
>  create mode 100644 drivers/usb/early/xhci-dbc.c
>  create mode 100644 drivers/usb/early/xhci-dbc.h
>  create mode 100644 include/linux/usb/xhci-dbgp.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] HID: usbhid: Use pr_ and remove unnecessary OOM messages

2017-03-01 Thread Joe Perches
Use a more common logging style and remove the unnecessary
OOM messages as there is default dump_stack when OOM.

Miscellanea:

o Hoist an assignment in an if
o Realign arguments
o Realign a deeply indented if descendent above a printk

Signed-off-by: Joe Perches 
---
 drivers/hid/usbhid/hid-core.c   | 16 +++-
 drivers/hid/usbhid/hid-quirks.c | 11 ---
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 961bc6fdd2d9..cd98db6cf94f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1004,10 +1004,9 @@ static int usbhid_parse(struct hid_device *hid)
return -EINVAL;
}
 
-   if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) {
-   dbg_hid("couldn't allocate rdesc memory\n");
+   rdesc = kmalloc(rsize, GFP_KERNEL);
+   if (!rdesc)
return -ENOMEM;
-   }
 
hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0);
 
@@ -1077,8 +1076,8 @@ static int usbhid_start(struct hid_device *hid)
if (hid->quirks & HID_QUIRK_FULLSPEED_INTERVAL &&
dev->speed == USB_SPEED_HIGH) {
interval = fls(endpoint->bInterval*8);
-   printk(KERN_INFO "%s: Fixing fullspeed to highspeed 
interval: %d -> %d\n",
-  hid->name, endpoint->bInterval, interval);
+   pr_info("%s: Fixing fullspeed to highspeed interval: %d 
-> %d\n",
+   hid->name, endpoint->bInterval, interval);
}
 
/* Change the polling interval of mice. */
@@ -1456,10 +1455,9 @@ static int hid_post_reset(struct usb_interface *intf)
 * the size of the HID report descriptor has not changed.
 */
rdesc = kmalloc(hid->dev_rsize, GFP_KERNEL);
-   if (!rdesc) {
-   dbg_hid("couldn't allocate rdesc memory (post_reset)\n");
+   if (!rdesc)
return -ENOMEM;
-   }
+
status = hid_get_class_descriptor(dev,
interface->desc.bInterfaceNumber,
HID_DT_REPORT, rdesc, hid->dev_rsize);
@@ -1637,7 +1635,7 @@ static int __init hid_init(void)
retval = usb_register(_driver);
if (retval)
goto usb_register_fail;
-   printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
+   pr_info(KBUILD_MODNAME ": " DRIVER_DESC "\n");
 
return 0;
 usb_register_fail:
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index d6847a664446..9287ab03e117 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -237,10 +237,8 @@ static int usbhid_modify_dquirk(const u16 idVendor, const 
u16 idProduct,
}
 
q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL);
-   if (!q_new) {
-   dbg_hid("Could not allocate quirks_list_struct\n");
+   if (!q_new)
return -ENOMEM;
-   }
 
q_new->hid_bl_item.idVendor = idVendor;
q_new->hid_bl_item.idProduct = idProduct;
@@ -306,10 +304,9 @@ int usbhid_quirks_init(char **quirks_param)
, , );
 
if (m != 3 ||
-   usbhid_modify_dquirk(idVendor, idProduct, 
quirks) != 0) {
-   printk(KERN_WARNING
-   "Could not parse HID quirk module param 
%s\n",
-   quirks_param[n]);
+   usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) {
+   pr_warn("Could not parse HID quirk module param %s\n",
+   quirks_param[n]);
}
}
 
-- 
2.10.0.rc2.1.g053435c

--
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: usb: gadget: webcam broken?

2017-03-01 Thread Laurent Pinchart
Hi Roger,

On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
> Hi,
> 
> I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
> the end. It looks like we're goofing up on the control endpoint.
> 
> If I revert the following commit everything works fine.
> commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
> Author: Petr Cvek 
> Date:   Wed Aug 17 12:36:57 2016 +0200
> 
> usb: gadget: uvc: Add missing call for additional setup data
> 
> Am I missing something on uvc-gadget side or is the commit really bad?
> From what I understand, uvc-gadget is responsible for sending response to
> UVC class specific requests on control endpoint in uvc_send_response()
> in uvc_v4l2.c.
> 
> So the reported commit is sending a duplicate response with probably
> improper data.

Yes, this looks very dubious to me. I think it should be reverted. My 
apologies for not having caught the patch during review.

Would you like to send a revert patch ?

> [1] - git://git.ideasonboard.org/uvc-gadget.git

-- 
Regards,

Laurent Pinchart

--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Alan Stern
On Wed, 1 Mar 2017, Avraham Shukron wrote:

> I thought fixing a driver that I actually use daily will be more satisfying.

Unless there are special reasons, you should not be using the usbkbd
driver.  It is legacy code; everyone should now use usbhid instead.

Alan Stern

--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Greg KH
On Wed, Mar 01, 2017 at 09:59:31PM +0200, Avraham Shukron wrote:
> > 
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> > 
> > Regardless, it's a very old driver, just let it be.
> > 
> > Thanks.
> > 
> 
> I can make it Nx8 :)
> 
> Seriously now - I don't understand what is so wrong with checkpatch fixes?
> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.

Start doing this in the drivers/staging/ portion of the kernel.  Other
places usually do not want these types of changes for the reasons people
have given you already.

That is what drivers/staging/ is for, to learn the process.  Please
stick to it there.

thanks,

greg k-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] usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer

2017-03-01 Thread Bin Liu

--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Avraham Shukron

On 01/03/17 22:46, Joe Perches wrote:
> On Wed, 2017-03-01 at 21:59 +0200, Avraham Shukron wrote:
>>>
>>> This kind of change is definitely not helpful. The original table was
>>> Nx16, you converted it to Nx14. Why do you think original table used 16
>>> columns?
>>>
>>> Regardless, it's a very old driver, just let it be.
>>>
>>> Thanks.
>>>
>>
>> I can make it Nx8 :)
>>
>> Seriously now - I don't understand what is so wrong with checkpatch fixes?
> 
> Some say is makes following logical changes more difficult.
> git blame, etc...  I'm not a big adherent of that though.
> 
>> I'm a new to kernel development, and the natural place to start is to do some
>> coding style fixes.
>> I thought fixing a driver that I actually use daily will be more satisfying.
>> Why driver being old is a good reason to ignore the coding style conventions?
> 
> The space after comma rule _should_ be broken when
> alignment is more obvious.  The existing code is just fine.
> 
> Conventions are just that.  It's OK to be unconventional.
> 
> It's better to know when to follow and when not to follow
> those conventions.
> 
> checkpatch messages should be considered guides and not
> dicta that must be followed to the last letter.
> 
> To me, the rest of the patch was OK though.
> 
> If you want to learn the kernel patch process, modifying files
> in drivers/staging is a good place to start.
> 
> Otherwise, it's probably best to find/fix some actual defect
> and suggest actual logical changes that reduce code size,
> improve performance, expand test coverage, better document
> the code, etc..
> 
> cheers, Joe
> 

Thanks you very much for the the answer.
That explains the matter.

--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Joe Perches
On Wed, 2017-03-01 at 21:59 +0200, Avraham Shukron wrote:
> > 
> > This kind of change is definitely not helpful. The original table was
> > Nx16, you converted it to Nx14. Why do you think original table used 16
> > columns?
> > 
> > Regardless, it's a very old driver, just let it be.
> > 
> > Thanks.
> > 
> 
> I can make it Nx8 :)
> 
> Seriously now - I don't understand what is so wrong with checkpatch fixes?

Some say is makes following logical changes more difficult.
git blame, etc...  I'm not a big adherent of that though.

> I'm a new to kernel development, and the natural place to start is to do some
> coding style fixes.
> I thought fixing a driver that I actually use daily will be more satisfying.
> Why driver being old is a good reason to ignore the coding style conventions?

The space after comma rule _should_ be broken when
alignment is more obvious.  The existing code is just fine.

Conventions are just that.  It's OK to be unconventional.

It's better to know when to follow and when not to follow
those conventions.

checkpatch messages should be considered guides and not
dicta that must be followed to the last letter.

To me, the rest of the patch was OK though.

If you want to learn the kernel patch process, modifying files
in drivers/staging is a good place to start.

Otherwise, it's probably best to find/fix some actual defect
and suggest actual logical changes that reduce code size,
improve performance, expand test coverage, better document
the code, etc..

cheers, Joe
--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Avraham Shukron
> 
> This kind of change is definitely not helpful. The original table was
> Nx16, you converted it to Nx14. Why do you think original table used 16
> columns?
> 
> Regardless, it's a very old driver, just let it be.
> 
> Thanks.
> 

I can make it Nx8 :)

Seriously now - I don't understand what is so wrong with checkpatch fixes?
I'm a new to kernel development, and the natural place to start is to do some
coding style fixes.
I thought fixing a driver that I actually use daily will be more satisfying.
Why driver being old is a good reason to ignore the coding style conventions?

--
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 v4 00/19] Replace PCI pool by DMA pool API

2017-03-01 Thread Joe Perches
On Wed, 2017-03-01 at 16:55 +0100, Romain Perier wrote:
> support to warn about this old API in checkpath.pl

checkpatch

This part isn't true anymore, but it seems sensible enough, thanks.

--
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] hid: usbhid: usbkbd: fix checkpatch.pl issues

2017-03-01 Thread Dmitry Torokhov
Hi Avraham,

On Tue, Feb 21, 2017 at 07:26:50PM +0200, Avraham Shukron wrote:
> - Broke long lines
> - Added spaces where needed
> - Removed unnecessary / trailing whitespaces
> - Extracted assignments outside of 'if' statements
> 
> Signed-off-by: Avraham Shukron 
> ---
>  drivers/hid/usbhid/usbkbd.c | 121 
> ++--
>  1 file changed, 72 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
> index 7fb2d1e..ae40b0d 100644
> --- a/drivers/hid/usbhid/usbkbd.c
> +++ b/drivers/hid/usbhid/usbkbd.c
> @@ -45,22 +45,24 @@ MODULE_DESCRIPTION(DRIVER_DESC);
>  MODULE_LICENSE("GPL");
> 
>  static const unsigned char usb_kbd_keycode[256] = {
> -   0,  0,  0,  0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
> -  50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44,  2,  3,
> -   4,  5,  6,  7,  8,  9, 10, 11, 28,  1, 14, 15, 57, 12, 13, 26,
> -  27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64,
> -  65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
> - 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
> -  72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190,
> - 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113,
> - 115,114,  0,  0,  0,121,  0, 89, 93,124, 92, 94, 95,  0,  0,  0,
> - 122,123, 90, 91, 85,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
> -   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
> -   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
> -   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
> -   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
> -  29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
> - 150,158,159,128,136,177,178,176,142,152,173,140
> +   0,   0,   0,   0,  30,  48,  46,  32,  18,  33,  34,  35,  23,  36,
> +  37,  38,  50,  49,  24,  25,  16,  19,  31,  20,  22,  47,  17,  45,
> +  21,  44,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  28,   1,
> +  14,  15,  57,  12,  13,  26,  27,  43,  43,  39,  40,  41,  51,  52,
> +  53,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  87,  88,
> +  99,  70, 119, 110, 102, 104, 111, 107, 109, 106, 105, 108, 103,  69,
> +  98,  55,  74,  78,  96,  79,  80,  81,  75,  76,  77,  71,  72,  73,
> +  82,  83,  86, 127, 116, 117, 183, 184, 185, 186, 187, 188, 189, 190,
> + 191, 192, 193, 194, 134, 138, 130, 132, 128, 129, 131, 137, 133, 135,
> + 136, 113, 115, 114,   0,   0,   0, 121,   0,  89,  93, 124,  92,  94,
> +  95,   0,   0,   0, 122, 123,  90,  91,  85,   0,   0,   0,   0,   0,
> +   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
> +   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
> +   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
> +   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
> +   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
> +  29,  42,  56, 125,  97,  54, 100, 126, 164, 166, 165, 163, 161, 115,
> + 114, 113, 150, 158, 159, 128, 136, 177, 178, 176, 142, 152, 173, 140
>  };

This kind of change is definitely not helpful. The original table was
Nx16, you converted it to Nx14. Why do you think original table used 16
columns?

Regardless, it's a very old driver, just let it be.

Thanks.

-- 
Dmitry
--
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] net: usb: asix_devices: fix missing return code check on call to asix_write_medium_mode

2017-03-01 Thread David Miller
From: Colin King 
Date: Tue, 28 Feb 2017 11:58:22 +

> From: Colin Ian King 
> 
> The call to asix_write_medium_mode is not updating the return code ret
> and yet ret is being checked for an error. Fix this by assigning ret to
> the return code from the call asix_write_medium_mode.
> 
> Detected by CoverityScan, CID#1357148 ("Logically Dead Code")
> 
> Signed-off-by: Colin Ian King 

Applied.
--
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] MAINTAINERS: Orphan usb/net/hso driver

2017-03-01 Thread David Miller
From: Baruch Siach 
Date: Tue, 28 Feb 2017 10:39:48 +0200

> The email address of Jan Dumon bounces, and there is not relevant information
> in the linked website.
> 
> Signed-off-by: Baruch Siach 

Applied.
--
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: [RESEND PATCH 1/2] Documentation: bindings: add DT documentation for u2phy and u2phy grf

2017-03-01 Thread Heiko Stuebner
Hi Daniel,

Am Mittwoch, 1. März 2017, 18:34:22 CET schrieb Meng Dongyang:
> Due to the u2phy registers are separated from general grf, we need to
> add u2phy grf node and place u2phy node in it. And on some platform,
> the 480m clock may need to assign clock parent in dts in stead of
> clock driver. So this patch add u2phy grf node and property of
> assigned-clocks and assigned-clock-parents to assign parent for 480m
> clock.
> 
> Signed-off-by: Meng Dongyang 
> ---
>  .../bindings/phy/phy-rockchip-inno-usb2.txt| 47
> ++ 1 file changed, 47 insertions(+)
> 
> diff --git
> a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
> b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt index
> 3c29c77..dda9f22 100644
> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
> @@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
> 
>  Required properties (phy (parent) node):
>   - compatible : should be one of the listed compatibles:
> + * "rockchip,rk3328-usb2phy"
>   * "rockchip,rk3366-usb2phy"
>   * "rockchip,rk3399-usb2phy"
>   - reg : the address offset of grf for usb-phy configuration.
> @@ -11,6 +12,11 @@ Required properties (phy (parent) node):
>  Optional properties:
>   - clocks : phandle + phy specifier pair, for the input clock of phy.
>   - clock-names : input clock name of phy, must be "phyclk".
> + - assigned-clocks : phandle of usb 480m clock.
> + - assigned-clock-parents : parent of usb 480m clock, select between
> +  usb-phy output 480m and xin24m.
> +  Refer to clk/clock-bindings.txt for generic clock
> +  consumer properties.
> 
>  Required nodes : a sub-node is required for each port the phy provides.
>The sub-node name is used to identify host or otg port,

this block looks good


> @@ -62,3 +68,44 @@ grf: syscon@ff77 {
>   };
>   };
>  };


> +
> +Required properties (usb2phy grf node):
> + - compatible : should be one of the listed compatibles:
> + "rockchip,rk3328-usb2phy-grf", "syscon", "simple-mfd";
> + - reg : the address offset of grf for usb-phy configuration.
> + - #address-cells : should be 1.
> + - #size-cells : should be 1.
> +
> +Required nodes : a sub-node is required for the phy provides.
> +  The sub-node name is used to identify each phy,
> +  and shall be the following entries:
> +
> +Example:
> +
> +usb2phy_grf: syscon@ff45 {
> + compatible = "rockchip,rk3328-usb2phy-grf", "syscon",
> +  "simple-mfd";
> + reg = <0x0 0xff45 0x0 0x1>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + u2phy: usb2-phy@100 {
> + compatible = "rockchip,rk3328-usb2phy";
> + reg = <0x100 0x10>;
> + clocks = <>;
> + clock-names = "phyclk";
> + #clock-cells = <0>;
> + assigned-clocks = < USB480M>;
> + assigned-clock-parents = <>;
> + clock-output-names = "usb480m_phy";
> + status = "disabled";
> +
> + u2phy_host: host-port {
> + #phy-cells = <0>;
> + interrupts = ;
> + interrupt-names = "linestate";
> + status = "disabled";
> + };
> + };
> +};
> +

please don't add this here.

I've looked it up in the TRM and usb2phy-grf are still just "General Register 
Files", which also include some other registers besides this phy - so 
structure-wise this is good.
But please document the new grf-compatible in the regular
Documentation/devicetree/bindings/soc/rockchip/grf.txt .

And there is no need for a duplicate example, as it is the same structure as 
before, so maybe just add the assigned-clocks parts to the existing example.


Thanks
Heiko
--
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: [RESEND PATCH 2/2] phy: rockchip-inno-usb2: add support of u2phy for rk3328

2017-03-01 Thread Heiko Stuebner
Am Mittwoch, 1. März 2017, 18:34:23 CET schrieb Meng Dongyang:
> Add u2phy config information in the data of match table for
> rk3328.
> 
> Signed-off-by: Meng Dongyang 

in general looks good, so
Reviewed-by: Heiko Stuebner 

one question below


>  drivers/phy/phy-rockchip-inno-usb2.c | 21 +
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/phy/phy-rockchip-inno-usb2.c
> b/drivers/phy/phy-rockchip-inno-usb2.c index 4ea95c2..cf2729c 100644
> --- a/drivers/phy/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/phy-rockchip-inno-usb2.c
> @@ -1141,6 +1141,26 @@ static int rockchip_usb2phy_probe(struct
> platform_device *pdev) return ret;
>  }
> 
> +static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
> + {
> + .reg = 0x100,
> + .num_ports  = 2,
> + .phy_tuning = rk3328_usb2phy_tuning,
> + .clkout_ctl = { 0x108, 4, 4, 1, 0 },
> + .port_cfgs  = {
> + [USB2PHY_PORT_HOST] = {
> + .phy_sus= { 0x104, 15, 0, 0, 0x1d1 },
> + .ls_det_en  = { 0x110, 1, 1, 0, 1 },
> + .ls_det_st  = { 0x114, 1, 1, 0, 1 },
> + .ls_det_clr = { 0x118, 1, 1, 0, 1 },
> + .utmi_ls= { 0x120, 17, 16, 0, 1 },
> + .utmi_hstdet= { 0x120, 19, 19, 0, 1 }
> + }
> + },
> + },

The TRM also talks about the otg-port, so is there a reason for not including 
it here?


Heiko

> + { /* sentinel */ }
> +};
> +
>  static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
>   {
>   .reg = 0x700,
> @@ -1223,6 +1243,7 @@ static int rockchip_usb2phy_probe(struct
> platform_device *pdev) };
> 
>  static const struct of_device_id rockchip_usb2phy_dt_match[] = {
> + { .compatible = "rockchip,rk3328-usb2phy", .data = _phy_cfgs },
>   { .compatible = "rockchip,rk3366-usb2phy", .data = _phy_cfgs },
>   { .compatible = "rockchip,rk3399-usb2phy", .data = _phy_cfgs },
>   {}


--
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: storage: karma: remove useless variable

2017-03-01 Thread Alan Stern
On Tue, 28 Feb 2017, Pierre-Yves Kerbrat wrote:

> Remove the useless variable 'partial' storing the actual length
> transferred. Nothing was done with it, so simply get rid of it
> as usb_stor_bulk_transfer_buf can handle having NULL instead.
> 
> This also fixes the following sparse issues (-Wtypesign):
> drivers/usb/storage/karma.c:122:51: warning: incorrect type in argument
> 5 (different signedness)
> drivers/usb/storage/karma.c:122:51:expected unsigned int *act_len
> drivers/usb/storage/karma.c:122:51:got int *
> drivers/usb/storage/karma.c:127:52: warning: incorrect type in argument
> 5 (different signedness)
> drivers/usb/storage/karma.c:127:52:expected unsigned int *act_len
> drivers/usb/storage/karma.c:127:52:got int *
> 
> Signed-off-by: Pierre-Yves Kerbrat 
> ---
>  drivers/usb/storage/karma.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
> index f9d407f0b508..b05ba4929f00 100644
> --- a/drivers/usb/storage/karma.c
> +++ b/drivers/usb/storage/karma.c
> @@ -105,7 +105,7 @@ static struct us_unusual_dev karma_unusual_dev_list[] = {
>   */
>  static int rio_karma_send_command(char cmd, struct us_data *us)
>  {
> - int result, partial;
> + int result;
>   unsigned long timeout;
>   static unsigned char seq = 1;
>   struct karma_data *data = (struct karma_data *) us->extra;
> @@ -119,12 +119,12 @@ static int rio_karma_send_command(char cmd, struct 
> us_data *us)
>   timeout = jiffies + msecs_to_jiffies(6000);
>   for (;;) {
>   result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,
> - us->iobuf, RIO_SEND_LEN, );
> + us->iobuf, RIO_SEND_LEN, NULL);
>   if (result != USB_STOR_XFER_GOOD)
>   goto err;
>  
>   result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe,
> - data->recv, RIO_RECV_LEN, );
> + data->recv, RIO_RECV_LEN, NULL);
>   if (result != USB_STOR_XFER_GOOD)
>   goto err;

Acked-by: Alan Stern 

--
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 v4 10/19] scsi: lpfc: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API. It also updates
some comments, accordingly.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/scsi/lpfc/lpfc.h   |  12 ++---
 drivers/scsi/lpfc/lpfc_init.c  |  16 +++
 drivers/scsi/lpfc/lpfc_mem.c   | 105 -
 drivers/scsi/lpfc/lpfc_nvme.c  |   6 +--
 drivers/scsi/lpfc/lpfc_nvmet.c |   4 +-
 drivers/scsi/lpfc/lpfc_scsi.c  |  12 ++---
 6 files changed, 76 insertions(+), 79 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 0bba2e3..29492bc 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -934,12 +934,12 @@ struct lpfc_hba {
spinlock_t hbalock;
 
/* pci_mem_pools */
-   struct pci_pool *lpfc_sg_dma_buf_pool;
-   struct pci_pool *lpfc_mbuf_pool;
-   struct pci_pool *lpfc_hrb_pool; /* header receive buffer pool */
-   struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */
-   struct pci_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */
-   struct pci_pool *txrdy_payload_pool;
+   struct dma_pool *lpfc_sg_dma_buf_pool;
+   struct dma_pool *lpfc_mbuf_pool;
+   struct dma_pool *lpfc_hrb_pool; /* header receive buffer pool */
+   struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */
+   struct dma_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */
+   struct dma_pool *txrdy_payload_pool;
struct lpfc_dma_pool lpfc_mbuf_safety_pool;
 
mempool_t *mbox_mem_pool;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 0ee429d..b856457 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3151,7 +3151,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
list_for_each_entry_safe(sb, sb_next, >lpfc_scsi_buf_list_put,
 list) {
list_del(>list);
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
  sb->dma_handle);
kfree(sb);
phba->total_scsi_bufs--;
@@ -3162,7 +3162,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
list_for_each_entry_safe(sb, sb_next, >lpfc_scsi_buf_list_get,
 list) {
list_del(>list);
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
  sb->dma_handle);
kfree(sb);
phba->total_scsi_bufs--;
@@ -3193,7 +3193,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
 >lpfc_nvme_buf_list_put, list) {
list_del(_ncmd->list);
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
  lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd);
phba->total_nvme_bufs--;
@@ -3204,7 +3204,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
 >lpfc_nvme_buf_list_get, list) {
list_del(_ncmd->list);
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
  lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd);
phba->total_nvme_bufs--;
@@ -3517,7 +3517,7 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba)
list_remove_head(_sgl_list, psb,
 struct lpfc_scsi_buf, list);
if (psb) {
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool,
  psb->data, psb->dma_handle);
kfree(psb);
}
@@ -3614,7 +3614,7 @@ lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba)
list_remove_head(_sgl_list, lpfc_ncmd,
 struct lpfc_nvme_buf, list);
if (lpfc_ncmd) {
-   pci_pool_free(phba->lpfc_sg_dma_buf_pool,
+   dma_pool_free(phba->lpfc_sg_dma_buf_pool,
  lpfc_ncmd->data,
  lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd);
@@ -6629,8 +6629,8 @@ lpfc_create_shost(struct lpfc_hba *phba)
if (phba->nvmet_support) {
/* Only 

[PATCH v4 12/19] scsi: mpt3sas: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 73 +
 1 file changed, 34 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 5b7aec5..5ae1c23 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3200,9 +3200,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
}
 
if (ioc->sense) {
-   pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
-   if (ioc->sense_dma_pool)
-   pci_pool_destroy(ioc->sense_dma_pool);
+   dma_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
+   dma_pool_destroy(ioc->sense_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT
"sense_pool(0x%p): free\n",
ioc->name, ioc->sense));
@@ -3210,9 +3209,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
}
 
if (ioc->reply) {
-   pci_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
-   if (ioc->reply_dma_pool)
-   pci_pool_destroy(ioc->reply_dma_pool);
+   dma_pool_free(ioc->reply_dma_pool, ioc->reply, ioc->reply_dma);
+   dma_pool_destroy(ioc->reply_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT
"reply_pool(0x%p): free\n",
ioc->name, ioc->reply));
@@ -3220,10 +3218,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
}
 
if (ioc->reply_free) {
-   pci_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
+   dma_pool_free(ioc->reply_free_dma_pool, ioc->reply_free,
ioc->reply_free_dma);
-   if (ioc->reply_free_dma_pool)
-   pci_pool_destroy(ioc->reply_free_dma_pool);
+   dma_pool_destroy(ioc->reply_free_dma_pool);
dexitprintk(ioc, pr_info(MPT3SAS_FMT
"reply_free_pool(0x%p): free\n",
ioc->name, ioc->reply_free));
@@ -3234,7 +3231,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
do {
rps = >reply_post[i];
if (rps->reply_post_free) {
-   pci_pool_free(
+   dma_pool_free(
ioc->reply_post_free_dma_pool,
rps->reply_post_free,
rps->reply_post_free_dma);
@@ -3246,8 +3243,7 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
} while (ioc->rdpq_array_enable &&
   (++i < ioc->reply_queue_count));
 
-   if (ioc->reply_post_free_dma_pool)
-   pci_pool_destroy(ioc->reply_post_free_dma_pool);
+   dma_pool_destroy(ioc->reply_post_free_dma_pool);
kfree(ioc->reply_post);
}
 
@@ -3268,12 +3264,11 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
if (ioc->chain_lookup) {
for (i = 0; i < ioc->chain_depth; i++) {
if (ioc->chain_lookup[i].chain_buffer)
-   pci_pool_free(ioc->chain_dma_pool,
+   dma_pool_free(ioc->chain_dma_pool,
ioc->chain_lookup[i].chain_buffer,
ioc->chain_lookup[i].chain_buffer_dma);
}
-   if (ioc->chain_dma_pool)
-   pci_pool_destroy(ioc->chain_dma_pool);
+   dma_pool_destroy(ioc->chain_dma_pool);
free_pages((ulong)ioc->chain_lookup, ioc->chain_pages);
ioc->chain_lookup = NULL;
}
@@ -3448,23 +3443,23 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc)
ioc->name);
goto out;
}
-   ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool",
-   ioc->pdev, sz, 16, 0);
+   ioc->reply_post_free_dma_pool = dma_pool_create("reply_post_free pool",
+   >pdev->dev, sz, 16, 0);
if (!ioc->reply_post_free_dma_pool) {
pr_err(MPT3SAS_FMT
-"reply_post_free pool: pci_pool_create failed\n",
+"reply_post_free pool: dma_pool_create failed\n",
 ioc->name);
goto out;
}
i = 0;
do {
ioc->reply_post[i].reply_post_free =
-   pci_pool_alloc(ioc->reply_post_free_dma_pool,
+   

[PATCH v4 16/19] usb: gadget: net2280: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/usb/gadget/udc/net2280.c | 12 ++--
 drivers/usb/gadget/udc/net2280.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 8550441..089081e 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -569,7 +569,7 @@ static struct usb_request
if (ep->dma) {
struct net2280_dma  *td;
 
-   td = pci_pool_alloc(ep->dev->requests, gfp_flags,
+   td = dma_pool_alloc(ep->dev->requests, gfp_flags,
>td_dma);
if (!td) {
kfree(req);
@@ -597,7 +597,7 @@ static void net2280_free_request(struct usb_ep *_ep, struct 
usb_request *_req)
req = container_of(_req, struct net2280_request, req);
WARN_ON(!list_empty(>queue));
if (req->td)
-   pci_pool_free(ep->dev->requests, req->td, req->td_dma);
+   dma_pool_free(ep->dev->requests, req->td, req->td_dma);
kfree(req);
 }
 
@@ -3578,10 +3578,10 @@ static void net2280_remove(struct pci_dev *pdev)
for (i = 1; i < 5; i++) {
if (!dev->ep[i].dummy)
continue;
-   pci_pool_free(dev->requests, dev->ep[i].dummy,
+   dma_pool_free(dev->requests, dev->ep[i].dummy,
dev->ep[i].td_dma);
}
-   pci_pool_destroy(dev->requests);
+   dma_pool_destroy(dev->requests);
}
if (dev->got_irq)
free_irq(pdev->irq, dev);
@@ -3723,7 +3723,7 @@ static int net2280_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
 
/* DMA setup */
/* NOTE:  we know only the 32 LSBs of dma addresses may be nonzero */
-   dev->requests = pci_pool_create("requests", pdev,
+   dev->requests = dma_pool_create("requests", >dev,
sizeof(struct net2280_dma),
0 /* no alignment requirements */,
0 /* or page-crossing issues */);
@@ -3735,7 +3735,7 @@ static int net2280_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
for (i = 1; i < 5; i++) {
struct net2280_dma  *td;
 
-   td = pci_pool_alloc(dev->requests, GFP_KERNEL,
+   td = dma_pool_alloc(dev->requests, GFP_KERNEL,
>ep[i].td_dma);
if (!td) {
ep_dbg(dev, "can't get dummy %d\n", i);
diff --git a/drivers/usb/gadget/udc/net2280.h b/drivers/usb/gadget/udc/net2280.h
index 2736a95..1088c37 100644
--- a/drivers/usb/gadget/udc/net2280.h
+++ b/drivers/usb/gadget/udc/net2280.h
@@ -187,7 +187,7 @@ struct net2280 {
struct usb338x_ll_chi_regs  __iomem *ll_chicken_reg;
struct usb338x_pl_regs  __iomem *plregs;
 
-   struct pci_pool *requests;
+   struct dma_pool *requests;
/* statistics...*/
 };
 
-- 
2.9.3

--
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 v4 13/19] scsi: mvsas: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/scsi/mvsas/mv_init.c | 6 +++---
 drivers/scsi/mvsas/mv_sas.c  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 8280046..41d2276 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -125,8 +125,7 @@ static void mvs_free(struct mvs_info *mvi)
else
slot_nr = MVS_CHIP_SLOT_SZ;
 
-   if (mvi->dma_pool)
-   pci_pool_destroy(mvi->dma_pool);
+   dma_pool_destroy(mvi->dma_pool);
 
if (mvi->tx)
dma_free_coherent(mvi->dev,
@@ -296,7 +295,8 @@ static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host 
*shost)
goto err_out;
 
sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id);
-   mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 
16, 0);
+   mvi->dma_pool = dma_pool_create(pool_name, >pdev->dev,
+   MVS_SLOT_BUF_SZ, 16, 0);
if (!mvi->dma_pool) {
printk(KERN_DEBUG "failed to create dma pool %s.\n", 
pool_name);
goto err_out;
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index c7cc803..ee81d10 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -790,7 +790,7 @@ static int mvs_task_prep(struct sas_task *task, struct 
mvs_info *mvi, int is_tmf
slot->n_elem = n_elem;
slot->slot_tag = tag;
 
-   slot->buf = pci_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
+   slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, >buf_dma);
if (!slot->buf) {
rc = -ENOMEM;
goto err_out_tag;
@@ -840,7 +840,7 @@ static int mvs_task_prep(struct sas_task *task, struct 
mvs_info *mvi, int is_tmf
return rc;
 
 err_out_slot_buf:
-   pci_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
+   dma_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
 err_out_tag:
mvs_tag_free(mvi, tag);
 err_out:
@@ -918,7 +918,7 @@ static void mvs_slot_task_free(struct mvs_info *mvi, struct 
sas_task *task,
}
 
if (slot->buf) {
-   pci_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
+   dma_pool_free(mvi->dma_pool, slot->buf, slot->buf_dma);
slot->buf = NULL;
}
list_del_init(>entry);
-- 
2.9.3

--
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 v4 08/19] scsi: be2iscsi: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/scsi/be2iscsi/be_iscsi.c | 6 +++---
 drivers/scsi/be2iscsi/be_main.c  | 6 +++---
 drivers/scsi/be2iscsi/be_main.h  | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a484457..d76ef77 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -87,8 +87,8 @@ struct iscsi_cls_session *beiscsi_session_create(struct 
iscsi_endpoint *ep,
return NULL;
sess = cls_session->dd_data;
beiscsi_sess = sess->dd_data;
-   beiscsi_sess->bhs_pool =  pci_pool_create("beiscsi_bhs_pool",
-  phba->pcidev,
+   beiscsi_sess->bhs_pool =  dma_pool_create("beiscsi_bhs_pool",
+  >pcidev->dev,
   sizeof(struct be_cmd_bhs),
   64, 0);
if (!beiscsi_sess->bhs_pool)
@@ -113,7 +113,7 @@ void beiscsi_session_destroy(struct iscsi_cls_session 
*cls_session)
struct beiscsi_session *beiscsi_sess = sess->dd_data;
 
printk(KERN_INFO "In beiscsi_session_destroy\n");
-   pci_pool_destroy(beiscsi_sess->bhs_pool);
+   dma_pool_destroy(beiscsi_sess->bhs_pool);
iscsi_session_teardown(cls_session);
 }
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 32b2713..dd43480 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4307,7 +4307,7 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
pwrb_context = _ctrlr->wrb_context[cri_index];
 
if (io_task->cmd_bhs) {
-   pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
+   dma_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
  io_task->bhs_pa.u.a64.address);
io_task->cmd_bhs = NULL;
task->hdr = NULL;
@@ -4424,7 +4424,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, 
uint8_t opcode)
struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess;
dma_addr_t paddr;
 
-   io_task->cmd_bhs = pci_pool_alloc(beiscsi_sess->bhs_pool,
+   io_task->cmd_bhs = dma_pool_alloc(beiscsi_sess->bhs_pool,
  GFP_ATOMIC, );
if (!io_task->cmd_bhs)
return -ENOMEM;
@@ -4551,7 +4551,7 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, 
uint8_t opcode)
if (io_task->pwrb_handle)
free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle);
io_task->pwrb_handle = NULL;
-   pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
+   dma_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs,
  io_task->bhs_pa.u.a64.address);
io_task->cmd_bhs = NULL;
return -ENOMEM;
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 2188579..cf58d31 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -446,7 +446,7 @@ struct beiscsi_hba {
 test_bit(BEISCSI_HBA_ONLINE, >state))
 
 struct beiscsi_session {
-   struct pci_pool *bhs_pool;
+   struct dma_pool *bhs_pool;
 };
 
 /**
-- 
2.9.3

--
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 v4 11/19] scsi: megaraid: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/scsi/megaraid/megaraid_mbox.c   | 33 +++
 drivers/scsi/megaraid/megaraid_mm.c | 32 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 29 +++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 66 +
 4 files changed, 77 insertions(+), 83 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
index f0987f2..7dfc2e2 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1153,8 +1153,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 
 
// Allocate memory for 16-bytes aligned mailboxes
-   raid_dev->mbox_pool_handle = pci_pool_create("megaraid mbox pool",
-   adapter->pdev,
+   raid_dev->mbox_pool_handle = dma_pool_create("megaraid mbox pool",
+   >pdev->dev,
sizeof(mbox64_t) + 16,
16, 0);
 
@@ -1164,7 +1164,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 
mbox_pci_blk = raid_dev->mbox_pool;
for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
-   mbox_pci_blk[i].vaddr = pci_pool_alloc(
+   mbox_pci_blk[i].vaddr = dma_pool_alloc(
raid_dev->mbox_pool_handle,
GFP_KERNEL,
_pci_blk[i].dma_addr);
@@ -1181,8 +1181,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 * share common memory pool. Passthru structures piggyback on memory
 * allocted to extended passthru since passthru is smaller of the two
 */
-   raid_dev->epthru_pool_handle = pci_pool_create("megaraid mbox pthru",
-   adapter->pdev, sizeof(mraid_epassthru_t), 128, 0);
+   raid_dev->epthru_pool_handle = dma_pool_create("megaraid mbox pthru",
+   >pdev->dev, sizeof(mraid_epassthru_t), 128, 0);
 
if (raid_dev->epthru_pool_handle == NULL) {
goto fail_setup_dma_pool;
@@ -1190,7 +1190,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 
epthru_pci_blk = raid_dev->epthru_pool;
for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
-   epthru_pci_blk[i].vaddr = pci_pool_alloc(
+   epthru_pci_blk[i].vaddr = dma_pool_alloc(
raid_dev->epthru_pool_handle,
GFP_KERNEL,
_pci_blk[i].dma_addr);
@@ -1202,8 +1202,8 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 
// Allocate memory for each scatter-gather list. Request for 512 bytes
// alignment for each sg list
-   raid_dev->sg_pool_handle = pci_pool_create("megaraid mbox sg",
-   adapter->pdev,
+   raid_dev->sg_pool_handle = dma_pool_create("megaraid mbox sg",
+   >pdev->dev,
sizeof(mbox_sgl64) * MBOX_MAX_SG_SIZE,
512, 0);
 
@@ -1213,7 +1213,7 @@ megaraid_mbox_setup_dma_pools(adapter_t *adapter)
 
sg_pci_blk = raid_dev->sg_pool;
for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
-   sg_pci_blk[i].vaddr = pci_pool_alloc(
+   sg_pci_blk[i].vaddr = dma_pool_alloc(
raid_dev->sg_pool_handle,
GFP_KERNEL,
_pci_blk[i].dma_addr);
@@ -1249,29 +1249,26 @@ megaraid_mbox_teardown_dma_pools(adapter_t *adapter)
 
sg_pci_blk = raid_dev->sg_pool;
for (i = 0; i < MBOX_MAX_SCSI_CMDS && sg_pci_blk[i].vaddr; i++) {
-   pci_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
+   dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr,
sg_pci_blk[i].dma_addr);
}
-   if (raid_dev->sg_pool_handle)
-   pci_pool_destroy(raid_dev->sg_pool_handle);
+   dma_pool_destroy(raid_dev->sg_pool_handle);
 
 
epthru_pci_blk = raid_dev->epthru_pool;
for (i = 0; i < MBOX_MAX_SCSI_CMDS && epthru_pci_blk[i].vaddr; i++) {
-   pci_pool_free(raid_dev->epthru_pool_handle,
+   dma_pool_free(raid_dev->epthru_pool_handle,
epthru_pci_blk[i].vaddr, epthru_pci_blk[i].dma_addr);
}
-   if (raid_dev->epthru_pool_handle)
-   pci_pool_destroy(raid_dev->epthru_pool_handle);

[PATCH v4 19/19] PCI: Remove PCI pool macro functions

2017-03-01 Thread Romain Perier
Now that all the drivers use dma pool API, we can remove the macro
functions for PCI pool.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 include/linux/pci.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 282ed32..d206ba4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1281,15 +1281,6 @@ int pci_set_vga_state(struct pci_dev *pdev, bool decode,
 #include 
 #include 
 
-#definepci_pool dma_pool
-#define pci_pool_create(name, pdev, size, align, allocation) \
-   dma_pool_create(name, >dev, size, align, allocation)
-#definepci_pool_destroy(pool) dma_pool_destroy(pool)
-#definepci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, 
handle)
-#definepci_pool_zalloc(pool, flags, handle) \
-   dma_pool_zalloc(pool, flags, handle)
-#definepci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, 
addr)
-
 struct msix_entry {
u32 vector; /* kernel uses to write allocated vector */
u16 entry;  /* driver uses to specify entry, OS writes */
-- 
2.9.3

--
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 v4 14/19] scsi: pmcraid: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/scsi/pmcraid.c | 10 +-
 drivers/scsi/pmcraid.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 49e70a3..0f893c4 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4699,13 +4699,13 @@ pmcraid_release_control_blocks(
return;
 
for (i = 0; i < max_index; i++) {
-   pci_pool_free(pinstance->control_pool,
+   dma_pool_free(pinstance->control_pool,
  pinstance->cmd_list[i]->ioa_cb,
  pinstance->cmd_list[i]->ioa_cb_bus_addr);
pinstance->cmd_list[i]->ioa_cb = NULL;
pinstance->cmd_list[i]->ioa_cb_bus_addr = 0;
}
-   pci_pool_destroy(pinstance->control_pool);
+   dma_pool_destroy(pinstance->control_pool);
pinstance->control_pool = NULL;
 }
 
@@ -4762,8 +4762,8 @@ static int pmcraid_allocate_control_blocks(struct 
pmcraid_instance *pinstance)
pinstance->host->unique_id);
 
pinstance->control_pool =
-   pci_pool_create(pinstance->ctl_pool_name,
-   pinstance->pdev,
+   dma_pool_create(pinstance->ctl_pool_name,
+   >pdev->dev,
sizeof(struct pmcraid_control_block),
PMCRAID_IOARCB_ALIGNMENT, 0);
 
@@ -4772,7 +4772,7 @@ static int pmcraid_allocate_control_blocks(struct 
pmcraid_instance *pinstance)
 
for (i = 0; i < PMCRAID_MAX_CMD; i++) {
pinstance->cmd_list[i]->ioa_cb =
-   pci_pool_alloc(
+   dma_pool_alloc(
pinstance->control_pool,
GFP_KERNEL,
&(pinstance->cmd_list[i]->ioa_cb_bus_addr));
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
index 568b18a..acf5a7b 100644
--- a/drivers/scsi/pmcraid.h
+++ b/drivers/scsi/pmcraid.h
@@ -755,7 +755,7 @@ struct pmcraid_instance {
 
/* structures related to command blocks */
struct kmem_cache *cmd_cachep;  /* cache for cmd blocks */
-   struct pci_pool *control_pool;  /* pool for control blocks */
+   struct dma_pool *control_pool;  /* pool for control blocks */
char   cmd_pool_name[64];   /* name of cmd cache */
char   ctl_pool_name[64];   /* name of control cache */
 
-- 
2.9.3

--
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 v4 07/19] wireless: ipw2200: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c 
b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index 5ef3c5c..93dfe47 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -3211,7 +3211,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * 
data, size_t len)
struct fw_chunk *chunk;
int total_nr = 0;
int i;
-   struct pci_pool *pool;
+   struct dma_pool *pool;
void **virts;
dma_addr_t *phys;
 
@@ -3228,9 +3228,10 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * 
data, size_t len)
kfree(virts);
return -ENOMEM;
}
-   pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
+   pool = dma_pool_create("ipw2200", >pci_dev->dev, CB_MAX_LENGTH, 0,
+  0);
if (!pool) {
-   IPW_ERROR("pci_pool_create failed\n");
+   IPW_ERROR("dma_pool_create failed\n");
kfree(phys);
kfree(virts);
return -ENOMEM;
@@ -3255,7 +3256,7 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * 
data, size_t len)
 
nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH;
for (i = 0; i < nr; i++) {
-   virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL,
+   virts[total_nr] = dma_pool_alloc(pool, GFP_KERNEL,
 [total_nr]);
if (!virts[total_nr]) {
ret = -ENOMEM;
@@ -3299,9 +3300,9 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * 
data, size_t len)
}
  out:
for (i = 0; i < total_nr; i++)
-   pci_pool_free(pool, virts[i], phys[i]);
+   dma_pool_free(pool, virts[i], phys[i]);
 
-   pci_pool_destroy(pool);
+   dma_pool_destroy(pool);
kfree(phys);
kfree(virts);
 
-- 
2.9.3

--
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 v4 18/19] usb: host: Remove remaining pci_pool in comments

2017-03-01 Thread Romain Perier
This replaces remaining occurences of pci_pool by dma_pool, as
this is the new API that could be used for that purpose.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/usb/host/ehci-hcd.c | 2 +-
 drivers/usb/host/fotg210-hcd.c  | 2 +-
 drivers/usb/host/oxu210hp-hcd.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index ac2c4ea..6e834b83 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -597,7 +597,7 @@ static int ehci_run (struct usb_hcd *hcd)
/*
 * hcc_params controls whether ehci->regs->segment must (!!!)
 * be used; it constrains QH/ITD/SITD and QTD locations.
-* pci_pool consistent memory always uses segment zero.
+* dma_pool consistent memory always uses segment zero.
 * streaming mappings for I/O buffers, like pci_map_single(),
 * can return segments above 4GB, if the device allows.
 *
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 1c5b34b..ced08dc 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -5047,7 +5047,7 @@ static int fotg210_run(struct usb_hcd *hcd)
/*
 * hcc_params controls whether fotg210->regs->segment must (!!!)
 * be used; it constrains QH/ITD/SITD and QTD locations.
-* pci_pool consistent memory always uses segment zero.
+* dma_pool consistent memory always uses segment zero.
 * streaming mappings for I/O buffers, like pci_map_single(),
 * can return segments above 4GB, if the device allows.
 *
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index bcf531c..ed20fb3 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -2708,7 +2708,7 @@ static int oxu_run(struct usb_hcd *hcd)
 
/* hcc_params controls whether oxu->regs->segment must (!!!)
 * be used; it constrains QH/ITD/SITD and QTD locations.
-* pci_pool consistent memory always uses segment zero.
+* dma_pool consistent memory always uses segment zero.
 * streaming mappings for I/O buffers, like pci_map_single(),
 * can return segments above 4GB, if the device allows.
 *
-- 
2.9.3

--
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 v4 09/19] scsi: csiostor: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API. It also updates
the name of some variables and the content of comments, accordingly.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/scsi/csiostor/csio_hw.h   |  2 +-
 drivers/scsi/csiostor/csio_init.c | 11 ++-
 drivers/scsi/csiostor/csio_scsi.c |  6 +++---
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
index 029bef8..55b04fc 100644
--- a/drivers/scsi/csiostor/csio_hw.h
+++ b/drivers/scsi/csiostor/csio_hw.h
@@ -465,7 +465,7 @@ struct csio_hw {
struct csio_pport   pport[CSIO_MAX_PPORTS]; /* Ports (XGMACs) */
struct csio_hw_params   params; /* Hw parameters */
 
-   struct pci_pool *scsi_pci_pool; /* PCI pool for SCSI */
+   struct dma_pool *scsi_dma_pool; /* DMA pool for SCSI */
mempool_t   *mb_mempool;/* Mailbox memory pool*/
mempool_t   *rnode_mempool; /* rnode memory pool */
 
diff --git a/drivers/scsi/csiostor/csio_init.c 
b/drivers/scsi/csiostor/csio_init.c
index dbe416f..292964c 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -485,9 +485,10 @@ csio_resource_alloc(struct csio_hw *hw)
if (!hw->rnode_mempool)
goto err_free_mb_mempool;
 
-   hw->scsi_pci_pool = pci_pool_create("csio_scsi_pci_pool", hw->pdev,
-   CSIO_SCSI_RSP_LEN, 8, 0);
-   if (!hw->scsi_pci_pool)
+   hw->scsi_dma_pool = dma_pool_create("csio_scsi_dma_pool",
+   >pdev->dev, CSIO_SCSI_RSP_LEN,
+   8, 0);
+   if (!hw->scsi_dma_pool)
goto err_free_rn_pool;
 
return 0;
@@ -505,8 +506,8 @@ csio_resource_alloc(struct csio_hw *hw)
 static void
 csio_resource_free(struct csio_hw *hw)
 {
-   pci_pool_destroy(hw->scsi_pci_pool);
-   hw->scsi_pci_pool = NULL;
+   dma_pool_destroy(hw->scsi_dma_pool);
+   hw->scsi_dma_pool = NULL;
mempool_destroy(hw->rnode_mempool);
hw->rnode_mempool = NULL;
mempool_destroy(hw->mb_mempool);
diff --git a/drivers/scsi/csiostor/csio_scsi.c 
b/drivers/scsi/csiostor/csio_scsi.c
index a1ff75f..dab0d3f 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2445,7 +2445,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw 
*hw)
 
/* Allocate Dma buffers for Response Payload */
dma_buf = >dma_buf;
-   dma_buf->vaddr = pci_pool_alloc(hw->scsi_pci_pool, GFP_KERNEL,
+   dma_buf->vaddr = dma_pool_alloc(hw->scsi_dma_pool, GFP_KERNEL,
_buf->paddr);
if (!dma_buf->vaddr) {
csio_err(hw,
@@ -2485,7 +2485,7 @@ csio_scsim_init(struct csio_scsim *scm, struct csio_hw 
*hw)
ioreq = (struct csio_ioreq *)tmp;
 
dma_buf = >dma_buf;
-   pci_pool_free(hw->scsi_pci_pool, dma_buf->vaddr,
+   dma_pool_free(hw->scsi_dma_pool, dma_buf->vaddr,
  dma_buf->paddr);
 
kfree(ioreq);
@@ -2516,7 +2516,7 @@ csio_scsim_exit(struct csio_scsim *scm)
ioreq = (struct csio_ioreq *)tmp;
 
dma_buf = >dma_buf;
-   pci_pool_free(scm->hw->scsi_pci_pool, dma_buf->vaddr,
+   dma_pool_free(scm->hw->scsi_dma_pool, dma_buf->vaddr,
  dma_buf->paddr);
 
kfree(ioreq);
-- 
2.9.3

--
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 v4 15/19] usb: gadget: amd5536udc: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/usb/gadget/udc/amd5536udc.c | 8 
 drivers/usb/gadget/udc/amd5536udc.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/udc/amd5536udc.c 
b/drivers/usb/gadget/udc/amd5536udc.c
index ea03ca7..270876b 100644
--- a/drivers/usb/gadget/udc/amd5536udc.c
+++ b/drivers/usb/gadget/udc/amd5536udc.c
@@ -583,7 +583,7 @@ udc_alloc_request(struct usb_ep *usbep, gfp_t gfp)
 
if (ep->dma) {
/* ep0 in requests are allocated from data pool here */
-   dma_desc = pci_pool_alloc(ep->dev->data_requests, gfp,
+   dma_desc = dma_pool_alloc(ep->dev->data_requests, gfp,
>td_phys);
if (!dma_desc) {
kfree(req);
@@ -622,7 +622,7 @@ static int udc_free_dma_chain(struct udc *dev, struct 
udc_request *req)
td = phys_to_virt(td_last->next);
 
for (i = 1; i < req->chain_len; i++) {
-   pci_pool_free(dev->data_requests, td,
+   dma_pool_free(dev->data_requests, td,
  (dma_addr_t)td_last->next);
td_last = td;
td = phys_to_virt(td_last->next);
@@ -652,7 +652,7 @@ udc_free_request(struct usb_ep *usbep, struct usb_request 
*usbreq)
if (req->chain_len > 1)
udc_free_dma_chain(ep->dev, req);
 
-   pci_pool_free(ep->dev->data_requests, req->td_data,
+   dma_pool_free(ep->dev->data_requests, req->td_data,
req->td_phys);
}
kfree(req);
@@ -847,7 +847,7 @@ static int udc_create_dma_chain(
for (i = buf_len; i < bytes; i += buf_len) {
/* create or determine next desc. */
if (create_new_chain) {
-   td = pci_pool_alloc(ep->dev->data_requests,
+   td = dma_pool_alloc(ep->dev->data_requests,
gfp_flags, _addr);
if (!td)
return -ENOMEM;
diff --git a/drivers/usb/gadget/udc/amd5536udc.h 
b/drivers/usb/gadget/udc/amd5536udc.h
index 4638d70..85d5aa5 100644
--- a/drivers/usb/gadget/udc/amd5536udc.h
+++ b/drivers/usb/gadget/udc/amd5536udc.h
@@ -545,8 +545,8 @@ struct udc {
u32 __iomem *txfifo;
 
/* DMA desc pools */
-   struct pci_pool *data_requests;
-   struct pci_pool *stp_requests;
+   struct dma_pool *data_requests;
+   struct dma_pool *stp_requests;
 
/* device data */
unsigned long   phys_addr;
-- 
2.9.3

--
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 v4 00/19] Replace PCI pool by DMA pool API

2017-03-01 Thread Romain Perier
The current PCI pool API are simple macro functions direct expanded to
the appropriated dma pool functions. The prototypes are almost the same
and semantically, they are very similar. I propose to use the DMA pool
API directly and get rid of the old API.

This set of patches, replaces the old API by the dma pool API, adds
support to warn about this old API in checkpath.pl and remove the
defines.

Changes in v4:
- Rebased series onto next-20170301
- Removed patch 20/20: checks done by checkpath.pl, no longer required.
  Thanks to Peter and Joe for their feedbacks.
- Added Reviewed-by tags

Changes in v3:
- Rebased series onto next-20170224
- Fix checkpath.pl reports for patch 11/20 and patch 12/20
- Remove prefix RFC
Changes in v2:
- Introduced patch 18/20
- Fixed cosmetic changes: spaces before brace, live over 80 characters
- Removed some of the check for NULL pointers before calling dma_pool_destroy
- Improved the regexp in checkpatch for pci_pool, thanks to Joe Perches
- Added Tested-by and Acked-by tags

Romain Perier (19):
  block: DAC960: Replace PCI pool old API
  dmaengine: pch_dma: Replace PCI pool old API
  IB/mthca: Replace PCI pool old API
  net: e100: Replace PCI pool old API
  mlx4: Replace PCI pool old API
  mlx5: Replace PCI pool old API
  wireless: ipw2200: Replace PCI pool old API
  scsi: be2iscsi: Replace PCI pool old API
  scsi: csiostor: Replace PCI pool old API
  scsi: lpfc: Replace PCI pool old API
  scsi: megaraid: Replace PCI pool old API
  scsi: mpt3sas: Replace PCI pool old API
  scsi: mvsas: Replace PCI pool old API
  scsi: pmcraid: Replace PCI pool old API
  usb: gadget: amd5536udc: Replace PCI pool old API
  usb: gadget: net2280: Replace PCI pool old API
  usb: gadget: pch_udc: Replace PCI pool old API
  usb: host: Remove remaining pci_pool in comments
  PCI: Remove PCI pool macro functions

 drivers/block/DAC960.c|  36 -
 drivers/block/DAC960.h|   4 +-
 drivers/dma/pch_dma.c |  12 +--
 drivers/infiniband/hw/mthca/mthca_av.c|  10 +--
 drivers/infiniband/hw/mthca/mthca_cmd.c   |   8 +-
 drivers/infiniband/hw/mthca/mthca_dev.h   |   4 +-
 drivers/net/ethernet/intel/e100.c |  12 +--
 drivers/net/ethernet/mellanox/mlx4/cmd.c  |  10 +--
 drivers/net/ethernet/mellanox/mlx4/mlx4.h |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c |  11 +--
 drivers/net/wireless/intel/ipw2x00/ipw2200.c  |  13 ++--
 drivers/scsi/be2iscsi/be_iscsi.c  |   6 +-
 drivers/scsi/be2iscsi/be_main.c   |   6 +-
 drivers/scsi/be2iscsi/be_main.h   |   2 +-
 drivers/scsi/csiostor/csio_hw.h   |   2 +-
 drivers/scsi/csiostor/csio_init.c |  11 +--
 drivers/scsi/csiostor/csio_scsi.c |   6 +-
 drivers/scsi/lpfc/lpfc.h  |  12 +--
 drivers/scsi/lpfc/lpfc_init.c |  16 ++--
 drivers/scsi/lpfc/lpfc_mem.c  | 105 +-
 drivers/scsi/lpfc/lpfc_nvme.c |   6 +-
 drivers/scsi/lpfc/lpfc_nvmet.c|   4 +-
 drivers/scsi/lpfc/lpfc_scsi.c |  12 +--
 drivers/scsi/megaraid/megaraid_mbox.c |  33 
 drivers/scsi/megaraid/megaraid_mm.c   |  32 
 drivers/scsi/megaraid/megaraid_sas_base.c |  29 +++
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  66 
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  73 +-
 drivers/scsi/mvsas/mv_init.c  |   6 +-
 drivers/scsi/mvsas/mv_sas.c   |   6 +-
 drivers/scsi/pmcraid.c|  10 +--
 drivers/scsi/pmcraid.h|   2 +-
 drivers/usb/gadget/udc/amd5536udc.c   |   8 +-
 drivers/usb/gadget/udc/amd5536udc.h   |   4 +-
 drivers/usb/gadget/udc/net2280.c  |  12 +--
 drivers/usb/gadget/udc/net2280.h  |   2 +-
 drivers/usb/gadget/udc/pch_udc.c  |  31 
 drivers/usb/host/ehci-hcd.c   |   2 +-
 drivers/usb/host/fotg210-hcd.c|   2 +-
 drivers/usb/host/oxu210hp-hcd.c   |   2 +-
 include/linux/mlx5/driver.h   |   2 +-
 include/linux/pci.h   |   9 ---
 42 files changed, 310 insertions(+), 331 deletions(-)

-- 
2.9.3

--
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 v4 04/19] net: e100: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/intel/e100.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/e100.c 
b/drivers/net/ethernet/intel/e100.c
index 2b7323d..d1002c2 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -607,7 +607,7 @@ struct nic {
struct mem *mem;
dma_addr_t dma_addr;
 
-   struct pci_pool *cbs_pool;
+   struct dma_pool *cbs_pool;
dma_addr_t cbs_dma_addr;
u8 adaptive_ifs;
u8 tx_threshold;
@@ -1892,7 +1892,7 @@ static void e100_clean_cbs(struct nic *nic)
nic->cb_to_clean = nic->cb_to_clean->next;
nic->cbs_avail++;
}
-   pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
+   dma_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
nic->cbs = NULL;
nic->cbs_avail = 0;
}
@@ -1910,7 +1910,7 @@ static int e100_alloc_cbs(struct nic *nic)
nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL;
nic->cbs_avail = 0;
 
-   nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL,
+   nic->cbs = dma_pool_alloc(nic->cbs_pool, GFP_KERNEL,
  >cbs_dma_addr);
if (!nic->cbs)
return -ENOMEM;
@@ -2958,8 +2958,8 @@ static int e100_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
netif_err(nic, probe, nic->netdev, "Cannot register net device, 
aborting\n");
goto err_out_free;
}
-   nic->cbs_pool = pci_pool_create(netdev->name,
-  nic->pdev,
+   nic->cbs_pool = dma_pool_create(netdev->name,
+  >pdev->dev,
   nic->params.cbs.max * sizeof(struct cb),
   sizeof(u32),
   0);
@@ -2999,7 +2999,7 @@ static void e100_remove(struct pci_dev *pdev)
unregister_netdev(netdev);
e100_free(nic);
pci_iounmap(pdev, nic->csr);
-   pci_pool_destroy(nic->cbs_pool);
+   dma_pool_destroy(nic->cbs_pool);
free_netdev(netdev);
pci_release_regions(pdev);
pci_disable_device(pdev);
-- 
2.9.3

--
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 v4 05/19] mlx4: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c  | 10 +-
 drivers/net/ethernet/mellanox/mlx4/mlx4.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c 
b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index e8c1051..fb69604 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2516,8 +2516,8 @@ int mlx4_cmd_init(struct mlx4_dev *dev)
}
 
if (!priv->cmd.pool) {
-   priv->cmd.pool = pci_pool_create("mlx4_cmd",
-dev->persist->pdev,
+   priv->cmd.pool = dma_pool_create("mlx4_cmd",
+>persist->pdev->dev,
 MLX4_MAILBOX_SIZE,
 MLX4_MAILBOX_SIZE, 0);
if (!priv->cmd.pool)
@@ -2588,7 +2588,7 @@ void mlx4_cmd_cleanup(struct mlx4_dev *dev, int 
cleanup_mask)
struct mlx4_priv *priv = mlx4_priv(dev);
 
if (priv->cmd.pool && (cleanup_mask & MLX4_CMD_CLEANUP_POOL)) {
-   pci_pool_destroy(priv->cmd.pool);
+   dma_pool_destroy(priv->cmd.pool);
priv->cmd.pool = NULL;
}
 
@@ -2680,7 +2680,7 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct 
mlx4_dev *dev)
if (!mailbox)
return ERR_PTR(-ENOMEM);
 
-   mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+   mailbox->buf = dma_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
   >dma);
if (!mailbox->buf) {
kfree(mailbox);
@@ -2697,7 +2697,7 @@ void mlx4_free_cmd_mailbox(struct mlx4_dev *dev,
if (!mailbox)
return;
 
-   pci_pool_free(mlx4_priv(dev)->cmd.pool, mailbox->buf, mailbox->dma);
+   dma_pool_free(mlx4_priv(dev)->cmd.pool, mailbox->buf, mailbox->dma);
kfree(mailbox);
 }
 EXPORT_SYMBOL_GPL(mlx4_free_cmd_mailbox);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h 
b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index b4f1bc5..69c8764 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -628,7 +628,7 @@ struct mlx4_mgm {
 };
 
 struct mlx4_cmd {
-   struct pci_pool*pool;
+   struct dma_pool*pool;
void __iomem   *hcr;
struct mutexslave_cmd_mutex;
struct semaphorepoll_sem;
-- 
2.9.3

--
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 v4 06/19] mlx5: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 11 ++-
 include/linux/mlx5/driver.h   |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c 
b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index caa837e..6eef344 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1061,7 +1061,7 @@ static struct mlx5_cmd_mailbox *alloc_cmd_box(struct 
mlx5_core_dev *dev,
if (!mailbox)
return ERR_PTR(-ENOMEM);
 
-   mailbox->buf = pci_pool_zalloc(dev->cmd.pool, flags,
+   mailbox->buf = dma_pool_zalloc(dev->cmd.pool, flags,
   >dma);
if (!mailbox->buf) {
mlx5_core_dbg(dev, "failed allocation\n");
@@ -1076,7 +1076,7 @@ static struct mlx5_cmd_mailbox *alloc_cmd_box(struct 
mlx5_core_dev *dev,
 static void free_cmd_box(struct mlx5_core_dev *dev,
 struct mlx5_cmd_mailbox *mailbox)
 {
-   pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
+   dma_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
kfree(mailbox);
 }
 
@@ -1696,7 +1696,8 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
return -EINVAL;
}
 
-   cmd->pool = pci_pool_create("mlx5_cmd", dev->pdev, size, align, 0);
+   cmd->pool = dma_pool_create("mlx5_cmd", >pdev->dev, size, align,
+   0);
if (!cmd->pool)
return -ENOMEM;
 
@@ -1786,7 +1787,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
free_cmd_page(dev, cmd);
 
 err_free_pool:
-   pci_pool_destroy(cmd->pool);
+   dma_pool_destroy(cmd->pool);
 
return err;
 }
@@ -1800,6 +1801,6 @@ void mlx5_cmd_cleanup(struct mlx5_core_dev *dev)
destroy_workqueue(cmd->wq);
destroy_msg_cache(dev);
free_cmd_page(dev, cmd);
-   pci_pool_destroy(cmd->pool);
+   dma_pool_destroy(cmd->pool);
 }
 EXPORT_SYMBOL(mlx5_cmd_cleanup);
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 2fcff6b..13a267c 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -284,7 +284,7 @@ struct mlx5_cmd {
struct semaphore pages_sem;
int mode;
struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
-   struct pci_pool *pool;
+   struct dma_pool *pool;
struct mlx5_cmd_debug dbg;
struct cmd_msg_cache cache[MLX5_NUM_COMMAND_CACHES];
int checksum_disabled;
-- 
2.9.3

--
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 v4 17/19] usb: gadget: pch_udc: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Reviewed-by: Peter Senna Tschudin 
---
 drivers/usb/gadget/udc/pch_udc.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index a97da64..84dcbcd 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -355,8 +355,8 @@ struct pch_udc_dev {
vbus_session:1,
set_cfg_not_acked:1,
waiting_zlp_ack:1;
-   struct pci_pool *data_requests;
-   struct pci_pool *stp_requests;
+   struct dma_pool *data_requests;
+   struct dma_pool *stp_requests;
dma_addr_t  dma_addr;
struct usb_ctrlrequest  setup_data;
void __iomem*base_addr;
@@ -1522,7 +1522,7 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev 
*dev,
/* do not free first desc., will be done by free for request */
td = phys_to_virt(addr);
addr2 = (dma_addr_t)td->next;
-   pci_pool_free(dev->data_requests, td, addr);
+   dma_pool_free(dev->data_requests, td, addr);
td->next = 0x00;
addr = addr2;
}
@@ -1539,7 +1539,7 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev 
*dev,
  *
  * Return codes:
  * 0:  success,
- * -ENOMEM:pci_pool_alloc invocation fails
+ * -ENOMEM:dma_pool_alloc invocation fails
  */
 static int pch_udc_create_dma_chain(struct pch_udc_ep *ep,
struct pch_udc_request *req,
@@ -1565,7 +1565,7 @@ static int pch_udc_create_dma_chain(struct pch_udc_ep *ep,
if (bytes <= buf_len)
break;
last = td;
-   td = pci_pool_alloc(ep->dev->data_requests, gfp_flags,
+   td = dma_pool_alloc(ep->dev->data_requests, gfp_flags,
_addr);
if (!td)
goto nomem;
@@ -1770,7 +1770,7 @@ static struct usb_request *pch_udc_alloc_request(struct 
usb_ep *usbep,
if (!ep->dev->dma_addr)
return >req;
/* ep0 in requests are allocated from data pool here */
-   dma_desc = pci_pool_alloc(ep->dev->data_requests, gfp,
+   dma_desc = dma_pool_alloc(ep->dev->data_requests, gfp,
  >td_data_phys);
if (NULL == dma_desc) {
kfree(req);
@@ -1809,7 +1809,7 @@ static void pch_udc_free_request(struct usb_ep *usbep,
if (req->td_data != NULL) {
if (req->chain_len > 1)
pch_udc_free_dma_chain(ep->dev, req);
-   pci_pool_free(ep->dev->data_requests, req->td_data,
+   dma_pool_free(ep->dev->data_requests, req->td_data,
  req->td_data_phys);
}
kfree(req);
@@ -2914,7 +2914,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
void*ep0out_buf;
 
/* DMA setup */
-   dev->data_requests = pci_pool_create("data_requests", dev->pdev,
+   dev->data_requests = dma_pool_create("data_requests", >pdev->dev,
sizeof(struct pch_udc_data_dma_desc), 0, 0);
if (!dev->data_requests) {
dev_err(>pdev->dev, "%s: can't get request data pool\n",
@@ -2923,7 +2923,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
}
 
/* dma desc for setup data */
-   dev->stp_requests = pci_pool_create("setup requests", dev->pdev,
+   dev->stp_requests = dma_pool_create("setup requests", >pdev->dev,
sizeof(struct pch_udc_stp_dma_desc), 0, 0);
if (!dev->stp_requests) {
dev_err(>pdev->dev, "%s: can't get setup request pool\n",
@@ -2931,7 +2931,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
return -ENOMEM;
}
/* setup */
-   td_stp = pci_pool_alloc(dev->stp_requests, GFP_KERNEL,
+   td_stp = dma_pool_alloc(dev->stp_requests, GFP_KERNEL,
>ep[UDC_EP0OUT_IDX].td_stp_phys);
if (!td_stp) {
dev_err(>pdev->dev,
@@ -2941,7 +2941,7 @@ static int init_dma_pools(struct pch_udc_dev *dev)
dev->ep[UDC_EP0OUT_IDX].td_stp = td_stp;
 
/* data: 0 packets !? */
-   td_data = pci_pool_alloc(dev->data_requests, GFP_KERNEL,
+   td_data = dma_pool_alloc(dev->data_requests, GFP_KERNEL,
>ep[UDC_EP0OUT_IDX].td_data_phys);
if (!td_data) {
dev_err(>pdev->dev,
@@ -3021,22 +3021,21 @@ static void pch_udc_remove(struct pci_dev *pdev)
   

[PATCH v4 03/19] IB/mthca: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/infiniband/hw/mthca/mthca_av.c  | 10 +-
 drivers/infiniband/hw/mthca/mthca_cmd.c |  8 
 drivers/infiniband/hw/mthca/mthca_dev.h |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/mthca/mthca_av.c 
b/drivers/infiniband/hw/mthca/mthca_av.c
index c9f0f36..9d041b6 100644
--- a/drivers/infiniband/hw/mthca/mthca_av.c
+++ b/drivers/infiniband/hw/mthca/mthca_av.c
@@ -186,7 +186,7 @@ int mthca_create_ah(struct mthca_dev *dev,
 
 on_hca_fail:
if (ah->type == MTHCA_AH_PCI_POOL) {
-   ah->av = pci_pool_zalloc(dev->av_table.pool,
+   ah->av = dma_pool_zalloc(dev->av_table.pool,
 GFP_ATOMIC, >avdma);
if (!ah->av)
return -ENOMEM;
@@ -245,7 +245,7 @@ int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah 
*ah)
break;
 
case MTHCA_AH_PCI_POOL:
-   pci_pool_free(dev->av_table.pool, ah->av, ah->avdma);
+   dma_pool_free(dev->av_table.pool, ah->av, ah->avdma);
break;
 
case MTHCA_AH_KMALLOC:
@@ -333,7 +333,7 @@ int mthca_init_av_table(struct mthca_dev *dev)
if (err)
return err;
 
-   dev->av_table.pool = pci_pool_create("mthca_av", dev->pdev,
+   dev->av_table.pool = dma_pool_create("mthca_av", >pdev->dev,
 MTHCA_AV_SIZE,
 MTHCA_AV_SIZE, 0);
if (!dev->av_table.pool)
@@ -353,7 +353,7 @@ int mthca_init_av_table(struct mthca_dev *dev)
return 0;
 
  out_free_pool:
-   pci_pool_destroy(dev->av_table.pool);
+   dma_pool_destroy(dev->av_table.pool);
 
  out_free_alloc:
mthca_alloc_cleanup(>av_table.alloc);
@@ -367,6 +367,6 @@ void mthca_cleanup_av_table(struct mthca_dev *dev)
 
if (dev->av_table.av_map)
iounmap(dev->av_table.av_map);
-   pci_pool_destroy(dev->av_table.pool);
+   dma_pool_destroy(dev->av_table.pool);
mthca_alloc_cleanup(>av_table.alloc);
 }
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c 
b/drivers/infiniband/hw/mthca/mthca_cmd.c
index c7f49bb..7f219c8 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -530,7 +530,7 @@ int mthca_cmd_init(struct mthca_dev *dev)
return -ENOMEM;
}
 
-   dev->cmd.pool = pci_pool_create("mthca_cmd", dev->pdev,
+   dev->cmd.pool = dma_pool_create("mthca_cmd", >pdev->dev,
MTHCA_MAILBOX_SIZE,
MTHCA_MAILBOX_SIZE, 0);
if (!dev->cmd.pool) {
@@ -543,7 +543,7 @@ int mthca_cmd_init(struct mthca_dev *dev)
 
 void mthca_cmd_cleanup(struct mthca_dev *dev)
 {
-   pci_pool_destroy(dev->cmd.pool);
+   dma_pool_destroy(dev->cmd.pool);
iounmap(dev->hcr);
if (dev->cmd.flags & MTHCA_CMD_POST_DOORBELLS)
iounmap(dev->cmd.dbell_map);
@@ -613,7 +613,7 @@ struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev 
*dev,
if (!mailbox)
return ERR_PTR(-ENOMEM);
 
-   mailbox->buf = pci_pool_alloc(dev->cmd.pool, gfp_mask, >dma);
+   mailbox->buf = dma_pool_alloc(dev->cmd.pool, gfp_mask, >dma);
if (!mailbox->buf) {
kfree(mailbox);
return ERR_PTR(-ENOMEM);
@@ -627,7 +627,7 @@ void mthca_free_mailbox(struct mthca_dev *dev, struct 
mthca_mailbox *mailbox)
if (!mailbox)
return;
 
-   pci_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
+   dma_pool_free(dev->cmd.pool, mailbox->buf, mailbox->dma);
kfree(mailbox);
 }
 
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h 
b/drivers/infiniband/hw/mthca/mthca_dev.h
index 4393a02..8c3f6ed 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -118,7 +118,7 @@ enum {
 };
 
 struct mthca_cmd {
-   struct pci_pool  *pool;
+   struct dma_pool  *pool;
struct mutex  hcr_mutex;
struct semaphore  poll_sem;
struct semaphore  event_sem;
@@ -263,7 +263,7 @@ struct mthca_qp_table {
 };
 
 struct mthca_av_table {
-   struct pci_pool   *pool;
+   struct dma_pool   *pool;
intnum_ddr_avs;
u64ddr_av_base;
void __iomem  *av_map;
-- 
2.9.3

--
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 v4 02/19] dmaengine: pch_dma: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/dma/pch_dma.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index f9028e9..afd8f27 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -123,7 +123,7 @@ struct pch_dma_chan {
 struct pch_dma {
struct dma_device   dma;
void __iomem *membase;
-   struct pci_pool *pool;
+   struct dma_pool *pool;
struct pch_dma_regs regs;
struct pch_dma_desc_regs ch_regs[MAX_CHAN_NR];
struct pch_dma_chan channels[MAX_CHAN_NR];
@@ -437,7 +437,7 @@ static struct pch_dma_desc *pdc_alloc_desc(struct dma_chan 
*chan, gfp_t flags)
struct pch_dma *pd = to_pd(chan->device);
dma_addr_t addr;
 
-   desc = pci_pool_zalloc(pd->pool, flags, );
+   desc = dma_pool_zalloc(pd->pool, flags, );
if (desc) {
INIT_LIST_HEAD(>tx_list);
dma_async_tx_descriptor_init(>txd, chan);
@@ -549,7 +549,7 @@ static void pd_free_chan_resources(struct dma_chan *chan)
spin_unlock_irq(_chan->lock);
 
list_for_each_entry_safe(desc, _d, _list, desc_node)
-   pci_pool_free(pd->pool, desc, desc->txd.phys);
+   dma_pool_free(pd->pool, desc, desc->txd.phys);
 
pdc_enable_irq(chan, 0);
 }
@@ -880,7 +880,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
goto err_iounmap;
}
 
-   pd->pool = pci_pool_create("pch_dma_desc_pool", pdev,
+   pd->pool = dma_pool_create("pch_dma_desc_pool", >dev,
   sizeof(struct pch_dma_desc), 4, 0);
if (!pd->pool) {
dev_err(>dev, "Failed to alloc DMA descriptors\n");
@@ -931,7 +931,7 @@ static int pch_dma_probe(struct pci_dev *pdev,
return 0;
 
 err_free_pool:
-   pci_pool_destroy(pd->pool);
+   dma_pool_destroy(pd->pool);
 err_free_irq:
free_irq(pdev->irq, pd);
 err_iounmap:
@@ -963,7 +963,7 @@ static void pch_dma_remove(struct pci_dev *pdev)
tasklet_kill(_chan->tasklet);
}
 
-   pci_pool_destroy(pd->pool);
+   dma_pool_destroy(pd->pool);
pci_iounmap(pdev, pd->membase);
pci_release_regions(pdev);
pci_disable_device(pdev);
-- 
2.9.3

--
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 v4 01/19] block: DAC960: Replace PCI pool old API

2017-03-01 Thread Romain Perier
The PCI pool API is deprecated. This commits replaces the PCI pool old
API by the appropriated function with the DMA pool API.

Signed-off-by: Romain Perier 
Acked-by: Peter Senna Tschudin 
Tested-by: Peter Senna Tschudin 
---
 drivers/block/DAC960.c | 36 ++--
 drivers/block/DAC960.h |  4 ++--
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 26a51be..2b221cc 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -268,17 +268,17 @@ static bool 
DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
   void *AllocationPointer = NULL;
   void *ScatterGatherCPU = NULL;
   dma_addr_t ScatterGatherDMA;
-  struct pci_pool *ScatterGatherPool;
+  struct dma_pool *ScatterGatherPool;
   void *RequestSenseCPU = NULL;
   dma_addr_t RequestSenseDMA;
-  struct pci_pool *RequestSensePool = NULL;
+  struct dma_pool *RequestSensePool = NULL;
 
   if (Controller->FirmwareType == DAC960_V1_Controller)
 {
   CommandAllocationLength = offsetof(DAC960_Command_T, V1.EndMarker);
   CommandAllocationGroupSize = DAC960_V1_CommandAllocationGroupSize;
-  ScatterGatherPool = pci_pool_create("DAC960_V1_ScatterGather",
-   Controller->PCIDevice,
+  ScatterGatherPool = dma_pool_create("DAC960_V1_ScatterGather",
+   >PCIDevice->dev,
DAC960_V1_ScatterGatherLimit * sizeof(DAC960_V1_ScatterGatherSegment_T),
sizeof(DAC960_V1_ScatterGatherSegment_T), 0);
   if (ScatterGatherPool == NULL)
@@ -290,18 +290,18 @@ static bool 
DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
 {
   CommandAllocationLength = offsetof(DAC960_Command_T, V2.EndMarker);
   CommandAllocationGroupSize = DAC960_V2_CommandAllocationGroupSize;
-  ScatterGatherPool = pci_pool_create("DAC960_V2_ScatterGather",
-   Controller->PCIDevice,
+  ScatterGatherPool = dma_pool_create("DAC960_V2_ScatterGather",
+   >PCIDevice->dev,
DAC960_V2_ScatterGatherLimit * sizeof(DAC960_V2_ScatterGatherSegment_T),
sizeof(DAC960_V2_ScatterGatherSegment_T), 0);
   if (ScatterGatherPool == NULL)
return DAC960_Failure(Controller,
"AUXILIARY STRUCTURE CREATION (SG)");
-  RequestSensePool = pci_pool_create("DAC960_V2_RequestSense",
-   Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
+  RequestSensePool = dma_pool_create("DAC960_V2_RequestSense",
+   >PCIDevice->dev, sizeof(DAC960_SCSI_RequestSense_T),
sizeof(int), 0);
   if (RequestSensePool == NULL) {
-   pci_pool_destroy(ScatterGatherPool);
+   dma_pool_destroy(ScatterGatherPool);
return DAC960_Failure(Controller,
"AUXILIARY STRUCTURE CREATION (SG)");
   }
@@ -335,16 +335,16 @@ static bool 
DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
   Command->Next = Controller->FreeCommands;
   Controller->FreeCommands = Command;
   Controller->Commands[CommandIdentifier-1] = Command;
-  ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
+  ScatterGatherCPU = dma_pool_alloc(ScatterGatherPool, GFP_ATOMIC,
);
   if (ScatterGatherCPU == NULL)
  return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION");
 
   if (RequestSensePool != NULL) {
- RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC,
+ RequestSenseCPU = dma_pool_alloc(RequestSensePool, GFP_ATOMIC,
);
  if (RequestSenseCPU == NULL) {
-pci_pool_free(ScatterGatherPool, ScatterGatherCPU,
+dma_pool_free(ScatterGatherPool, ScatterGatherCPU,
 ScatterGatherDMA);
return DAC960_Failure(Controller,
"AUXILIARY STRUCTURE CREATION");
@@ -379,8 +379,8 @@ static bool 
DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
 static void DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
 {
   int i;
-  struct pci_pool *ScatterGatherPool = Controller->ScatterGatherPool;
-  struct pci_pool *RequestSensePool = NULL;
+  struct dma_pool *ScatterGatherPool = Controller->ScatterGatherPool;
+  struct dma_pool *RequestSensePool = NULL;
   void *ScatterGatherCPU;
   dma_addr_t ScatterGatherDMA;
   void *RequestSenseCPU;
@@ -411,9 +411,9 @@ static void 
DAC960_DestroyAuxiliaryStructures(DAC960_Controller_T *Controller)
  RequestSenseDMA = Command->V2.RequestSenseDMA;
   }
   if (ScatterGatherCPU != NULL)
-  pci_pool_free(ScatterGatherPool, ScatterGatherCPU, ScatterGatherDMA);
+  dma_pool_free(ScatterGatherPool, ScatterGatherCPU, ScatterGatherDMA);
  

usb: dwc3: Bus Expiry on ISO transfers

2017-03-01 Thread Roger Quadros
Hi Felipe,

I'm running g_webcam with uvc-gadget [1] on the DUT on v4.10 with
commit 4fbac5206afd reverted.

The first time I plug the DUT to host and run luvcview I can see the
video test pattern so all OK.

If I close luvcview and restart it without disconnecting the DUT then
I don't see the test pattern on luvcview and dwc3 trace shows Bus Expiry.

It seems that we don't try to recover an ISO bus expiry in 
__dwc3_gadget_start_isoc()?
Is Bus Expiry non recoverable? As per the manual it says that if we hit
bus expiry we should send ENDTRANSFER command and wait for another XFERNOTREADY 
event
and send the STARTTRANSFER again with new future microframe time.

I'm pasting portions of good case vs bad case below. Full trace is
available at [2].

FYI this behaviour is the same in v4.4 as well. I haven't tried older kernels.

Any hints to resolve this appreciated. Thanks.

-- 
cheers,
-roger

[1] - git://git.ideasonboard.org/uvc-gadget.git
[2] - http://pastebin.ubuntu.com/24090440/

# tracer: nop
#
# entries-in-buffer/entries-written: 12814/12814   #P:2
#
#  _-=> irqs-off
# / _=> need-resched
#| / _---=> hardirq/softirq
#|| / _--=> preempt-depth
#||| / delay
#   TASK-PID   CPU#  TIMESTAMP  FUNCTION
#  | |   |      | |

#
#Good case: Line 545 in pastebin [2]
#

irq/456-dwc3-2104  [001] d...76.824531: dwc3_gadget_ep_cmd: ep2in: cmd 
'Set Endpoint Configuration' [1025] params 00042002 0a000600  --> 
status: Successful
irq/456-dwc3-2104  [001] d...76.824543: dwc3_gadget_ep_enable: ep2in: 
mps 1024/1024 streams 15 burst 0 ring 0/0 flags E:swbpm:e:<
irq/456-dwc3-2104  [001] d...76.824565: dwc3_event: event (20c2): 
ep0in: Transfer Not Ready (Not Active) [Status Phase]
  uvc-gadget-2107  [001] 76.832136: dwc3_alloc_request: ep2in: req 
ec807c00 length 0/0 zsI ==> 0
  uvc-gadget-2107  [001] 76.832144: dwc3_alloc_request: ep2in: req 
ec964900 length 0/0 zsI ==> 0
  uvc-gadget-2107  [001] 76.832176: dwc3_alloc_request: ep2in: req 
ed6c9800 length 0/0 zsI ==> 0
  uvc-gadget-2107  [001] 76.832180: dwc3_alloc_request: ep2in: req 
ed6c9600 length 0/0 zsI ==> 0
  uvc-gadget-2107  [001] d...76.832234: dwc3_ep_queue: ep2in: req 
ec807c00 length 0/1024 zsI ==> -115
  uvc-gadget-2107  [001] d...76.832246: dwc3_ep_queue: ep2in: req 
ec964900 length 0/1024 zsI ==> -115
  uvc-gadget-2107  [001] d...76.832254: dwc3_ep_queue: ep2in: req 
ed6c9800 length 0/1024 zsI ==> -115
  uvc-gadget-2107  [001] d...76.832261: dwc3_ep_queue: ep2in: req 
ed6c9600 length 0/1024 zsI ==> -115
  uvc-gadget-2107  [001] dn..76.832760: dwc3_prepare_trb: ep0in: 0/0 
trb f224f000 buf fd858000 size 0 ctrl 0c33 (HLcs:SC:status2)
  uvc-gadget-2107  [001] dn..76.832770: dwc3_gadget_ep_cmd: ep0in: cmd 
'Start Transfer' [1030] params  fd859000  --> status: Successful
irq/456-dwc3-2104  [001] d...76.832882: dwc3_event: event (c042): 
ep0in: Transfer Complete [Status Phase]
irq/456-dwc3-2104  [001] d...76.832886: dwc3_complete_trb: ep0out: 0/2 
trb f224f000 buf fd858000 size 0 ctrl 0c32 (hLcs:SC:status2)
irq/456-dwc3-2104  [001] d...76.832891: dwc3_gadget_giveback: ep0out: 
req ed516700 length 0/0 zsI ==> 0
irq/456-dwc3-2104  [001] d...76.832899: dwc3_prepare_trb: ep0out: 0/2 
trb f224f000 buf fd858000 size 8 ctrl 0c23 (HLcs:SC:setup)
irq/456-dwc3-2104  [001] d...76.832907: dwc3_gadget_ep_cmd: ep0out: cmd 
'Start Transfer' [1030] params  fd859000  --> status: Successful
  uvc-gadget-2107  [001] d...76.833015: dwc3_gadget_ep_cmd: ep0out: cmd 
'Set Stall' [1028] params    --> status: Successful
  uvc-gadget-2107  [001] d...76.833020: dwc3_prepare_trb: ep0out: 0/2 
trb f224f000 buf fd858000 size 8 ctrl 0c23 (HLcs:SC:setup)
  uvc-gadget-2107  [001] d...76.833026: dwc3_gadget_ep_cmd: ep0out: cmd 
'Start Transfer' [1030] params  fd859000  --> status: No 
Resource
irq/456-dwc3-2104  [001] d...77.101929: dwc3_event: event (c040): 
ep0out: Transfer Complete [Setup Phase]
irq/456-dwc3-2104  [001] d...77.101933: dwc3_ctrl_req: bRequestType 80 
bRequest 06 wValue 0306 wIndex 0409 wLength 255
irq/456-dwc3-2104  [001] d...77.101943: dwc3_prepare_trb: ep0in: 0/0 
trb f224f000 buf ac88c800 size 32 ctrl 0c53 (HLcs:SC:data)
irq/456-dwc3-2104  [001] d...77.101951: dwc3_gadget_ep_cmd: ep0in: cmd 
'Start Transfer' [1030] params  fd859000  --> status: Successful
irq/456-dwc3-2104  [001] d...77.101956: dwc3_event: event (10c2): 
ep0in: 

Re: FW: RE: Re: Subject: [PATCH v3] USB:Core: BugFix: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously

2017-03-01 Thread Alan Stern
On Wed, 1 Mar 2017, Ajay Kaher wrote:

> > On Mon, 22 Feb 2017, Ajay Kaher wrote:
> > 
> >> On Mon, 20 Feb 2017, Ajay Kaher wrote:
> >> 
> >>> Alan, as per my understanding I have shifted the lock from
> >>> release_usb_class() to destroy_usb_class() in patch v3. 
> >>> If it is not right, please explain in detail which race condition
> >>> I have missed and also share your suggestions.
> >>> 
> >> 
> >> Have you considered what would happen if destroy_usb_class() ran, but 
> >> some other CPU was still holding a reference to usb_class?  And what if 
> >> the last reference gets dropped later on, while init_usb_class() is 
> >> running?
> > 
> > Access of usb_class->kref is only from either init_usb_class()
> > or destroy_usb_class(), and both these functions are now protected
> > with Mutex Locking in patch v3, so there is no chance of race condition
> > as per above scenarios.
> > 
> >> Maybe that's not possible here, but it is possible in general for 
> >> refcounted objects.  So yes, this code is probably okay, but it isn't 
> >> good form.
> > 
> > As per my understanding, I found to be one of the best possible solution
> > for this problem and this solutiuon don't have any side effect.
> 
> Alan, I had shared modified Patch v3 as per your inputs to prevent
> the race condition during simultaneously calling of init_usb_class().
> If you think there is scope to improve the patch, please share your inputs.

Under the circumstances, your patch is acceptable.

If you really want to make the point crystal clear, you could replace 
usb_class->kref with an ordinary integer counter.  Then it would be 
obvious that there are no references other than the ones taken by 
init_usb_class() and released by destroy_usb_class().

Alan Stern

> thanks,
> ajay kaher
> 
> 
> Signed-off-by: Ajay Kaher
> 
> ---
> 
>  drivers/usb/core/file.c |6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
> index 822ced9..a12d184 100644
> --- a/drivers/usb/core/file.c
> +++ b/drivers/usb/core/file.c
> @@ -27,6 +27,7 @@
>  #define MAX_USB_MINORS 256
>  static const struct file_operations *usb_minors[MAX_USB_MINORS];
>  static DECLARE_RWSEM(minor_rwsem);
> +static DEFINE_MUTEX(init_usb_class_mutex);
> 
>  static int usb_open(struct inode *inode, struct file *file)
>  {
> @@ -109,8 +110,10 @@ static void release_usb_class(struct kref *kref)
> 
>  static void destroy_usb_class(void)
>  {
> +   mutex_lock(_usb_class_mutex);
> if (usb_class)
> kref_put(_class->kref, release_usb_class);
> +   mutex_unlock(_usb_class_mutex);
>  }
> 
>  int usb_major_init(void)
> @@ -171,7 +174,10 @@ int usb_register_dev(struct usb_interface *intf,
> if (intf->minor >= 0)
> return -EADDRINUSE;
> 
> +   mutex_lock(_usb_class_mutex);
> retval = init_usb_class();
> +   mutex_unlock(_usb_class_mutex);
> +
> if (retval)
> return retval;
> 
>  
> 

--
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 1/1] usb: gadget: dummy_hcd: clear usb_gadget region before registration

2017-03-01 Thread Alan Stern
On Wed, 1 Mar 2017, Peter Chen wrote:

> On Tue, Feb 28, 2017 at 11:07:08AM -0500, Alan Stern wrote:
> > On Tue, 28 Feb 2017, Peter Chen wrote:
> > 
> > > When the user does device unbind and rebind test, the kernel will
> > > show below dump due to usb_gadget memory region is dirty after unbind.
> > > Clear usb_gadget region for every new probe.

> > > diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
> > > b/drivers/usb/gadget/udc/dummy_hcd.c
> > > index c60abe3..8cabc59 100644
> > > --- a/drivers/usb/gadget/udc/dummy_hcd.c
> > > +++ b/drivers/usb/gadget/udc/dummy_hcd.c
> > > @@ -1031,6 +1031,8 @@ static int dummy_udc_probe(struct platform_device 
> > > *pdev)
> > >   int rc;
> > >  
> > >   dum = *((void **)dev_get_platdata(>dev));
> > > + /* Clear usb_gadget region for new registration to udc-core */
> > > + memzero_explicit(>gadget, sizeof(struct usb_gadget));
> > >   dum->gadget.name = gadget_name;
> > >   dum->gadget.ops = _ops;
> > >   dum->gadget.max_speed = USB_SPEED_SUPER;
> > 
> > Wouldn't it be better to clear the entire structure, not just
> > dum->gadget?  Then you could also change
> > 
> > dum[i] = kzalloc(sizeof(struct dummy), GFP_KERNEL);
> > 
> > to use kmalloc, since the structure will be initialized by the probe 
> > routine.
> > 
> 
> The memory region of dum is shared between dummy_hcd and dummy_udc.
> If clear entire dum, the entries for dummy_hcd will be cleared.

Ooh, yes, that's true.  Okay, you have my

Acked-by: Alan Stern 

for this patch.

Alan Stern

--
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


usb: gadget: webcam broken?

2017-03-01 Thread Roger Quadros
Hi,

I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at the 
end.
It looks like we're goofing up on the control endpoint.

If I revert the following commit everything works fine.
commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
Author: Petr Cvek 
Date:   Wed Aug 17 12:36:57 2016 +0200

usb: gadget: uvc: Add missing call for additional setup data

Am I missing something on uvc-gadget side or is the commit really bad?
>From what I understand, uvc-gadget is responsible for sending response to
UVC class specific requests on control endpoint in uvc_send_response()
in uvc_v4l2.c.

So the reported commit is sending a duplicate response with probably
improper data.

[1] - git://git.ideasonboard.org/uvc-gadget.git

-- 
cheers,
-roger

Logs:
-
#gadget side:

open succeeded, file descriptor = 3
device is dwc3-gadget on bus gadget
bRequestType a1 bRequest 87 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 87 [UVC_GET_DEF], cs 01)
uvc_events_process: event 0x804, response length 34
bRequestType 21 bRequest 01 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 01 [UVC_SET_CUR], cs 01)
uvc_events_process: event 0x804, response length 34
setting probe control, length = 26
bRequestType a1 bRequest 81 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 81 [UVC_GET_CUR], cs 01)
uvc_events_process: event 0x804, response length 34

#Host side
[27398.977099] usb 2-1.2: new high-speed USB device number 54 using ehci-pci
[27399.072799] usb 2-1.2: New USB device found, idVendor=1d6b, idProduct=0102
[27399.072809] usb 2-1.2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[27399.072814] usb 2-1.2: Product: Webcam gadget
[27399.072818] usb 2-1.2: Manufacturer: Linux Foundation
[27399.097437] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
[27399.109341] input: Webcam gadget as 
/devices/pci:00/:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/input/input69
[27409.542335] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: 
-110 (exp. 2).
[27409.842264] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: 
-110 (exp. 2).
[27409.846363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 
(exp. 2).
[27409.850602] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 
(exp. 2).
[27442.242779] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27442.326540] usb 2-1.2: device descriptor read/64, error -71
[27442.514512] usb 2-1.2: device descriptor read/64, error -71
[27442.690526] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27442.774509] usb 2-1.2: device descriptor read/64, error -71
[27442.962526] usb 2-1.2: device descriptor read/64, error -71
[27443.138490] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27443.554484] usb 2-1.2: device not accepting address 54, error -71
[27443.626516] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27444.042433] usb 2-1.2: device not accepting address 54, error -71
[27444.045025] usb 2-1.2: USB disconnect, device number 54
[27444.154454] usb 2-1.2: new high-speed USB device number 55 using ehci-pci
[27444.238442] usb 2-1.2: device descriptor read/64, error -71
[27444.426487] usb 2-1.2: device descriptor read/64, error -71
[27444.602429] usb 2-1.2: new high-speed USB device number 56 using ehci-pci
[27444.686421] usb 2-1.2: device descriptor read/64, error -71
[27444.874416] usb 2-1.2: device descriptor read/64, error -71
[27445.050419] usb 2-1.2: new high-speed USB device number 57 using ehci-pci
[27445.466363] usb 2-1.2: device not accepting address 57, error -71
[27445.538361] usb 2-1.2: new high-speed USB device number 58 using ehci-pci
[27445.954311] usb 2-1.2: device not accepting address 58, error -71
[27445.956294] usb 2-1-port2: unable to enumerate USB 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] usb: gadget: f_fs: simplify ffs_dev name handling

2017-03-01 Thread Michal Nazarewicz
Currently ffs_dev::name can be either allocated by the client of
the ffs_dev structure or by the f_fs.c core itself.  The former
is used by g_ffs while the latter happens with configfs.

Historically, g_ffs did not need to allocate separate buffer for
the name so what is now f_fs.c core never cared about freeing
that space.  With configfs the name needs to be copied since the
memory is not guaranteed to be availeble after ffs_set_inst_name
finishes.

The complication is therefore here to avoid allocations in the
g_ffs case but it complicates the code inproportinally to
benefits it provides.  In particular, g_ffs is considered
‘legacy’ so optimising for its sake is unlikely to be worth the
effort.

With that observation in mind, simplify the code by unifying the
code paths in g_ffs and configfs paths.  Furthermore, instead of
allocating a new buffer for the name, simply embed it in the
ffs_dev structure.  This further makes the memory management
less convoluted and error-prone.

The configfs interface for functionfs imposed a limit of 40
characters for the name so this results in a 41-byte buffer
added to the structure.  (For short names this may lead to
wasted memory but the actual amount is not immediately obvious
and depends on pointer size and which slab buckets the structure
and name would fall into).

Signed-off-by: Michal Nazarewicz 
---
 drivers/usb/gadget/function/f_fs.c | 79 --
 drivers/usb/gadget/function/u_fs.h | 11 +++---
 2 files changed, 22 insertions(+), 68 deletions(-)

diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
index f5d6bf527aac..6ed4da6e4474 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -245,7 +245,6 @@ EXPORT_SYMBOL_GPL(ffs_lock);
 
 static struct ffs_dev *_ffs_find_dev(const char *name);
 static struct ffs_dev *_ffs_alloc_dev(void);
-static int _ffs_name_dev(struct ffs_dev *dev, const char *name);
 static void _ffs_free_dev(struct ffs_dev *dev);
 static void *ffs_acquire_dev(const char *dev_name);
 static void ffs_release_dev(struct ffs_data *ffs_data);
@@ -3277,13 +3276,13 @@ static LIST_HEAD(ffs_devices);
 
 static struct ffs_dev *_ffs_do_find_dev(const char *name)
 {
-   struct ffs_dev *dev;
+   if (name) {
+   struct ffs_dev *dev;
 
-   list_for_each_entry(dev, _devices, entry) {
-   if (!dev->name || !name)
-   continue;
-   if (strcmp(dev->name, name) == 0)
-   return dev;
+   list_for_each_entry(dev, _devices, entry) {
+   if (strcmp(dev->name, name) == 0)
+   return dev;
+   }
}
 
return NULL;
@@ -3357,42 +3356,11 @@ static void ffs_free_inst(struct usb_function_instance 
*f)
kfree(opts);
 }
 
-#define MAX_INST_NAME_LEN  40
-
 static int ffs_set_inst_name(struct usb_function_instance *fi, const char 
*name)
 {
-   struct f_fs_opts *opts;
-   char *ptr;
-   const char *tmp;
-   int name_len, ret;
-
-   name_len = strlen(name) + 1;
-   if (name_len > MAX_INST_NAME_LEN)
+   if (strlen(name) >= FIELD_SIZEOF(struct ffs_dev, name))
return -ENAMETOOLONG;
-
-   ptr = kstrndup(name, name_len, GFP_KERNEL);
-   if (!ptr)
-   return -ENOMEM;
-
-   opts = to_f_fs_opts(fi);
-   tmp = NULL;
-
-   ffs_dev_lock();
-
-   tmp = opts->dev->name_allocated ? opts->dev->name : NULL;
-   ret = _ffs_name_dev(opts->dev, ptr);
-   if (ret) {
-   kfree(ptr);
-   ffs_dev_unlock();
-   return ret;
-   }
-   opts->dev->name_allocated = true;
-
-   ffs_dev_unlock();
-
-   kfree(tmp);
-
-   return 0;
+   return ffs_name_dev(to_f_fs_opts(fi)->dev, name);
 }
 
 static struct usb_function_instance *ffs_alloc_inst(void)
@@ -3522,32 +3490,19 @@ static struct ffs_dev *_ffs_alloc_dev(void)
return dev;
 }
 
-/*
- * ffs_lock must be taken by the caller of this function
- * The caller is responsible for "name" being available whenever f_fs needs it
- */
-static int _ffs_name_dev(struct ffs_dev *dev, const char *name)
+int ffs_name_dev(struct ffs_dev *dev, const char *name)
 {
struct ffs_dev *existing;
+   int ret = 0;
 
-   existing = _ffs_do_find_dev(name);
-   if (existing)
-   return -EBUSY;
-
-   dev->name = name;
-
-   return 0;
-}
+   ffs_dev_lock();
 
-/*
- * The caller is responsible for "name" being available whenever f_fs needs it
- */
-int ffs_name_dev(struct ffs_dev *dev, const char *name)
-{
-   int ret;
+   existing = _ffs_do_find_dev(name);
+   if (!existing)
+   strlcpy(dev->name, name, ARRAY_SIZE(dev->name));
+   else if (existing != dev)
+   ret = -EBUSY;
 
-   ffs_dev_lock();
-   ret = _ffs_name_dev(dev, name);

[PATCH] usb: gadget: mv_udc: clarify a switch with an implicit fall-through

2017-03-01 Thread Michal Nazarewicz
Rearrange statements in mv_ep_enable function so that it’s obvious
what the switch does and how zlt, ios and mult variables are
initialised.  Most notably, this gets rid of an implicit fall-through
so people don’t have to wonder whether it was intenional or not.

Addresses-Coverity-ID: 201385
Reported-by: Gustavo A. R. Silva 
Signed-off-by: Michal Nazarewicz 
---
 drivers/usb/gadget/udc/mv_udc_core.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c 
b/drivers/usb/gadget/udc/mv_udc_core.c
index 27ebb0d5449d..76f56c5762f9 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -445,7 +445,8 @@ static int mv_ep_enable(struct usb_ep *_ep,
struct mv_dqh *dqh;
u16 max = 0;
u32 bit_pos, epctrlx, direction;
-   unsigned char zlt = 0, ios = 0, mult = 0;
+   const unsigned char zlt = 1;
+   unsigned char ios, mult;
unsigned long flags;
 
ep = container_of(_ep, struct mv_ep, ep);
@@ -465,8 +466,6 @@ static int mv_ep_enable(struct usb_ep *_ep,
 * disable HW zero length termination select
 * driver handles zero length packet through req->req.zero
 */
-   zlt = 1;
-
bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);
 
/* Check if the Endpoint is Primed */
@@ -481,16 +480,16 @@ static int mv_ep_enable(struct usb_ep *_ep,
(unsigned)bit_pos);
goto en_done;
}
+
/* Set the max packet length, interrupt on Setup and Mult fields */
+   ios = 0;
+   mult = 0;
switch (desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
case USB_ENDPOINT_XFER_BULK:
-   zlt = 1;
-   mult = 0;
+   case USB_ENDPOINT_XFER_INT:
break;
case USB_ENDPOINT_XFER_CONTROL:
ios = 1;
-   case USB_ENDPOINT_XFER_INT:
-   mult = 0;
break;
case USB_ENDPOINT_XFER_ISOC:
/* Calculate transactions needed for high bandwidth iso */
-- 
2.12.0.rc1.440.g5b76565f74-goog

--
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


FW: RE: Re: Subject: [PATCH v3] USB:Core: BugFix: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously

2017-03-01 Thread Ajay Kaher

> On Mon, 22 Feb 2017, Ajay Kaher wrote:
> 
>> On Mon, 20 Feb 2017, Ajay Kaher wrote:
>> 
>>> Alan, as per my understanding I have shifted the lock from
>>> release_usb_class() to destroy_usb_class() in patch v3. 
>>> If it is not right, please explain in detail which race condition
>>> I have missed and also share your suggestions.
>>> 
>> 
>> Have you considered what would happen if destroy_usb_class() ran, but 
>> some other CPU was still holding a reference to usb_class?  And what if 
>> the last reference gets dropped later on, while init_usb_class() is 
>> running?
> 
> Access of usb_class->kref is only from either init_usb_class()
> or destroy_usb_class(), and both these functions are now protected
> with Mutex Locking in patch v3, so there is no chance of race condition
> as per above scenarios.
> 
>> Maybe that's not possible here, but it is possible in general for 
>> refcounted objects.  So yes, this code is probably okay, but it isn't 
>> good form.
> 
> As per my understanding, I found to be one of the best possible solution
> for this problem and this solutiuon don't have any side effect.

Alan, I had shared modified Patch v3 as per your inputs to prevent
the race condition during simultaneously calling of init_usb_class().
If you think there is scope to improve the patch, please share your inputs.

thanks,
ajay kaher


Signed-off-by: Ajay Kaher

---

 drivers/usb/core/file.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 822ced9..a12d184 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -27,6 +27,7 @@
 #define MAX_USB_MINORS 256
 static const struct file_operations *usb_minors[MAX_USB_MINORS];
 static DECLARE_RWSEM(minor_rwsem);
+static DEFINE_MUTEX(init_usb_class_mutex);

 static int usb_open(struct inode *inode, struct file *file)
 {
@@ -109,8 +110,10 @@ static void release_usb_class(struct kref *kref)

 static void destroy_usb_class(void)
 {
+   mutex_lock(_usb_class_mutex);
if (usb_class)
kref_put(_class->kref, release_usb_class);
+   mutex_unlock(_usb_class_mutex);
 }

 int usb_major_init(void)
@@ -171,7 +174,10 @@ int usb_register_dev(struct usb_interface *intf,
if (intf->minor >= 0)
return -EADDRINUSE;

+   mutex_lock(_usb_class_mutex);
retval = init_usb_class();
+   mutex_unlock(_usb_class_mutex);
+
if (retval)
return retval;

 


[RESEND PATCH 1/2] Documentation: bindings: add DT documentation for u2phy and u2phy grf

2017-03-01 Thread Meng Dongyang
Due to the u2phy registers are separated from general grf, we need to
add u2phy grf node and place u2phy node in it. And on some platform,
the 480m clock may need to assign clock parent in dts in stead of
clock driver. So this patch add u2phy grf node and property of
assigned-clocks and assigned-clock-parents to assign parent for 480m
clock.

Signed-off-by: Meng Dongyang 
---
 .../bindings/phy/phy-rockchip-inno-usb2.txt| 47 ++
 1 file changed, 47 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
index 3c29c77..dda9f22 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
 
 Required properties (phy (parent) node):
  - compatible : should be one of the listed compatibles:
+   * "rockchip,rk3328-usb2phy"
* "rockchip,rk3366-usb2phy"
* "rockchip,rk3399-usb2phy"
  - reg : the address offset of grf for usb-phy configuration.
@@ -11,6 +12,11 @@ Required properties (phy (parent) node):
 Optional properties:
  - clocks : phandle + phy specifier pair, for the input clock of phy.
  - clock-names : input clock name of phy, must be "phyclk".
+ - assigned-clocks : phandle of usb 480m clock.
+ - assigned-clock-parents : parent of usb 480m clock, select between
+usb-phy output 480m and xin24m.
+Refer to clk/clock-bindings.txt for generic clock
+consumer properties.
 
 Required nodes : a sub-node is required for each port the phy provides.
 The sub-node name is used to identify host or otg port,
@@ -62,3 +68,44 @@ grf: syscon@ff77 {
};
};
 };
+
+Required properties (usb2phy grf node):
+ - compatible : should be one of the listed compatibles:
+   "rockchip,rk3328-usb2phy-grf", "syscon", "simple-mfd";
+ - reg : the address offset of grf for usb-phy configuration.
+ - #address-cells : should be 1.
+ - #size-cells : should be 1.
+
+Required nodes : a sub-node is required for the phy provides.
+The sub-node name is used to identify each phy,
+and shall be the following entries:
+
+Example:
+
+usb2phy_grf: syscon@ff45 {
+   compatible = "rockchip,rk3328-usb2phy-grf", "syscon",
+"simple-mfd";
+   reg = <0x0 0xff45 0x0 0x1>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   u2phy: usb2-phy@100 {
+   compatible = "rockchip,rk3328-usb2phy";
+   reg = <0x100 0x10>;
+   clocks = <>;
+   clock-names = "phyclk";
+   #clock-cells = <0>;
+   assigned-clocks = < USB480M>;
+   assigned-clock-parents = <>;
+   clock-output-names = "usb480m_phy";
+   status = "disabled";
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "disabled";
+   };
+   };
+};
+
-- 
1.9.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


[RESEND PATCH 2/2] phy: rockchip-inno-usb2: add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
Add u2phy config information in the data of match table for
rk3328.

Signed-off-by: Meng Dongyang 
---
 drivers/phy/phy-rockchip-inno-usb2.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
index 4ea95c2..cf2729c 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -1141,6 +1141,26 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
+   {
+   .reg = 0x100,
+   .num_ports  = 2,
+   .phy_tuning = rk3328_usb2phy_tuning,
+   .clkout_ctl = { 0x108, 4, 4, 1, 0 },
+   .port_cfgs  = {
+   [USB2PHY_PORT_HOST] = {
+   .phy_sus= { 0x104, 15, 0, 0, 0x1d1 },
+   .ls_det_en  = { 0x110, 1, 1, 0, 1 },
+   .ls_det_st  = { 0x114, 1, 1, 0, 1 },
+   .ls_det_clr = { 0x118, 1, 1, 0, 1 },
+   .utmi_ls= { 0x120, 17, 16, 0, 1 },
+   .utmi_hstdet= { 0x120, 19, 19, 0, 1 }
+   }
+   },
+   },
+   { /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
{
.reg = 0x700,
@@ -1223,6 +1243,7 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
 };
 
 static const struct of_device_id rockchip_usb2phy_dt_match[] = {
+   { .compatible = "rockchip,rk3328-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3366-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3399-usb2phy", .data = _phy_cfgs },
{}
-- 
1.9.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


[RESEND PATCH 0/2] add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
Resend this series to involve maintainer of phy documentation

The config information of RK3328 about address and port property
is different from before platform. So add config information in the
data of match table and documentation of the device tree bindings
of u2phy.

Meng Dongyang (2):
  Documentation: bindings: add DT documentation for u2phy and u2phy grf
  phy: rockchip-inno-usb2: add support of u2phy for rk3328

 .../bindings/phy/phy-rockchip-inno-usb2.txt| 47 ++
 drivers/phy/phy-rockchip-inno-usb2.c   | 21 ++
 2 files changed, 68 insertions(+)

-- 
1.9.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


Re: usb/net/hso: WARNING: ungligned urb->setup_dma

2017-03-01 Thread Baruch Siach
Hi Stefan,

On Tue, Feb 28, 2017 at 07:32:09PM +0100, Stefan Wahren wrote: 
> > Baruch Siach  hat am 28. Februar 2017 um 19:07 
> > geschrieben:
> > On Tue, Feb 28, 2017 at 05:21:18PM +0100, Stefan Wahren wrote:
> > > Am 28.02.2017 um 13:01 schrieb Baruch Siach:
> > > > On Tue, Feb 28, 2017 at 10:28:10AM +0200, Baruch Siach wrote:
> > > > > I'm hitting this warning consistently on my Raspberry Pi 3 running 
> > > > > kernel
> > > > > v4.10.1 with some unrelated device tree changes, and a debug print 
> > > > > (below).
> > > > > The device identifies as "GlobeTrotter HSDPA Modem", VID: 0af0, PID: 
> > > > > 6971.
> > > > > The warning triggers consistently on first write access to 
> > > > > /dev/ttyHS0 that
> > > > > ModemManager attempts. The first line in the log is my debug print.
> > > > I tested the same hardware successfully on an i.MX6 CuBox-i (ARM32) 
> > > > using the
> > > > same kernel version (4.10.1), and on an x86_64 PC (4.9). So this seems 
> > > > to be
> > > > platform specific. I don't have any other ARM64 machine at the moment, 
> > > > though.
> > > 
> > > those platforms usually doesn't use the dwc2 USB host controller. So it
> > > should be tested with another dwc2 platform.
> > 
> > The code that initializes setup_dma is not under drivers/usb/dwc2/. Though 
> > the 
> > problem looks like memory corruption, so its cause might be anywhere.
> 
> only a suspicion, but could you please try this patch [1]?
> 
> [1] - https://patchwork.kernel.org/patch/9166771/

It doesn't change anything.

My guess is that source of the issue is memory corruption that just happens to 
corrupt also the setup_dma field of struct urb. In other words, it has nothing 
to do with DMA, IMO.

Thanks,
baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
--
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 1/2] Documentation: bindings: add DT documentation for u2phy and u2phy grf

2017-03-01 Thread Meng Dongyang
Due to the u2phy registers are separated from general grf, we need to
add u2phy grf node and place u2phy node in it. And on some platform,
the 480m clock may need to assign clock parent in dts in stead of
clock driver. So this patch add u2phy grf node and property of
assigned-clocks and assigned-clock-parents to assign parent for 480m
clock.

Signed-off-by: Meng Dongyang 
---
 .../bindings/phy/phy-rockchip-inno-usb2.txt| 47 ++
 1 file changed, 47 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
index 3c29c77..dda9f22 100644
--- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
 
 Required properties (phy (parent) node):
  - compatible : should be one of the listed compatibles:
+   * "rockchip,rk3328-usb2phy"
* "rockchip,rk3366-usb2phy"
* "rockchip,rk3399-usb2phy"
  - reg : the address offset of grf for usb-phy configuration.
@@ -11,6 +12,11 @@ Required properties (phy (parent) node):
 Optional properties:
  - clocks : phandle + phy specifier pair, for the input clock of phy.
  - clock-names : input clock name of phy, must be "phyclk".
+ - assigned-clocks : phandle of usb 480m clock.
+ - assigned-clock-parents : parent of usb 480m clock, select between
+usb-phy output 480m and xin24m.
+Refer to clk/clock-bindings.txt for generic clock
+consumer properties.
 
 Required nodes : a sub-node is required for each port the phy provides.
 The sub-node name is used to identify host or otg port,
@@ -62,3 +68,44 @@ grf: syscon@ff77 {
};
};
 };
+
+Required properties (usb2phy grf node):
+ - compatible : should be one of the listed compatibles:
+   "rockchip,rk3328-usb2phy-grf", "syscon", "simple-mfd";
+ - reg : the address offset of grf for usb-phy configuration.
+ - #address-cells : should be 1.
+ - #size-cells : should be 1.
+
+Required nodes : a sub-node is required for the phy provides.
+The sub-node name is used to identify each phy,
+and shall be the following entries:
+
+Example:
+
+usb2phy_grf: syscon@ff45 {
+   compatible = "rockchip,rk3328-usb2phy-grf", "syscon",
+"simple-mfd";
+   reg = <0x0 0xff45 0x0 0x1>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   u2phy: usb2-phy@100 {
+   compatible = "rockchip,rk3328-usb2phy";
+   reg = <0x100 0x10>;
+   clocks = <>;
+   clock-names = "phyclk";
+   #clock-cells = <0>;
+   assigned-clocks = < USB480M>;
+   assigned-clock-parents = <>;
+   clock-output-names = "usb480m_phy";
+   status = "disabled";
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "disabled";
+   };
+   };
+};
+
-- 
1.9.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


[PATCH 2/2] phy: rockchip-inno-usb2: add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
Add u2phy config information in the data of match table for
rk3328.

Signed-off-by: Meng Dongyang 
---
 drivers/phy/phy-rockchip-inno-usb2.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
index 4ea95c2..cf2729c 100644
--- a/drivers/phy/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -1141,6 +1141,26 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = {
+   {
+   .reg = 0x100,
+   .num_ports  = 2,
+   .phy_tuning = rk3328_usb2phy_tuning,
+   .clkout_ctl = { 0x108, 4, 4, 1, 0 },
+   .port_cfgs  = {
+   [USB2PHY_PORT_HOST] = {
+   .phy_sus= { 0x104, 15, 0, 0, 0x1d1 },
+   .ls_det_en  = { 0x110, 1, 1, 0, 1 },
+   .ls_det_st  = { 0x114, 1, 1, 0, 1 },
+   .ls_det_clr = { 0x118, 1, 1, 0, 1 },
+   .utmi_ls= { 0x120, 17, 16, 0, 1 },
+   .utmi_hstdet= { 0x120, 19, 19, 0, 1 }
+   }
+   },
+   },
+   { /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = {
{
.reg = 0x700,
@@ -1223,6 +1243,7 @@ static int rockchip_usb2phy_probe(struct platform_device 
*pdev)
 };
 
 static const struct of_device_id rockchip_usb2phy_dt_match[] = {
+   { .compatible = "rockchip,rk3328-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3366-usb2phy", .data = _phy_cfgs },
{ .compatible = "rockchip,rk3399-usb2phy", .data = _phy_cfgs },
{}
-- 
1.9.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


[PATCH 0/2] add support of u2phy for rk3328

2017-03-01 Thread Meng Dongyang
The config information of RK3328 about address and port property
is different from before platform. So add config information in the
data of match table and documentation of the device tree bindings
of u2phy.

Meng Dongyang (2):
  Documentation: bindings: add DT documentation for u2phy and u2phy grf
  phy: rockchip-inno-usb2: add support of u2phy for rk3328

 .../bindings/phy/phy-rockchip-inno-usb2.txt| 47 ++
 drivers/phy/phy-rockchip-inno-usb2.c   | 21 ++
 2 files changed, 68 insertions(+)

-- 
1.9.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


Re: [PATCH] usb: gadget: add RNDIS configfs option for Windows rndiscmp.inf compatibility

2017-03-01 Thread Krzysztof Opasiak



On 02/28/2017 10:58 PM, David Lechner wrote:

This adds a new configfs attribute named `use_ms_rndiscmp`. It is a
boolean value that is used to select the class/subclass/protocol used
by the RNDIS function interface association descriptor. By default,
this is 0x02 (Comm), 0x06 (Ethernet), 0xff (None). When the
use_ms_rndiscmp attribute is set to true, the values 0xef (Misc),
0x04 (RNDIS), 0x01 (Ethernet) will be used instead. This class/subclass/
protocol combination is recognized by the rndiscmp.inf file in Windows
Vista and newer and will cause Windows to load the correct RNDIS driver
without the need for a custom (signed) .inf file.



To be honest, I'm not very happy with this patch because it makes our 
ConfigFS interface inflexible.


Let's assume that any other combination of this attributes will be 
needed in a future and then what we are going to do with use_ms_rndiscmp 
attribute?


So instead of having single attribute which sets the whole triple of 
values to some hardcoded ones I would prefer to have one attribute per 
each of this values and allow user to set them to his own values from 
userspace.


Best regards,
--
Krzysztof Opasiak
Samsung R Institute Poland
Samsung Electronics
--
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