Re: Query regarding USB gadget driver

2014-12-18 Thread Sanchayan Maity
On 12/18/2014 11:39 AM, Peter Chen wrote:
 On Thu, Dec 18, 2014 at 12:25:41PM +0530, Sanchayan Maity wrote:
 On 12/18/2014 10:24 AM, Peter Chen wrote:
 On Wed, Dec 17, 2014 at 10:04:35AM +0530, Sanchayan Maity wrote:
 On 12/17/2014 05:46 AM, Peter Chen wrote:
 On Tue, Dec 16, 2014 at 04:15:08PM +0530, Sanchayan Maity wrote:
 On 12/16/2014 02:15 PM, Peter Chen wrote:
 On Tue, Dec 16, 2014 at 10:50:59AM +0530, Sanchayan Maity wrote:
 On 12/16/2014 06:16 AM, Peter Chen wrote:
 On Mon, Dec 15, 2014 at 02:59:31PM +0530, Sanchayan Maity wrote:
 Hello,

 On 12/15/2014 07:42 AM, Peter Chen wrote:
 On Fri, Dec 12, 2014 at 06:55:36PM +0530, Sanchayan Maity wrote:
 Hello,

 On 12/12/2014 07:21 AM, Peter Chen wrote:
 On Thu, Dec 11, 2014 at 08:34:45AM -0600, Felipe Balbi wrote:
 Hi,

 On Thu, Dec 11, 2014 at 04:08:43PM +0530, Sanchayan Maity wrote:
 Hello,

 I am working on a Freescale Cortex-A5 Vybrid Processor. The 
 chip core
 is clocked at 500MHz and the USB IP core for this is by 
 Chip-idea. I
 am running a 3.18-rc5 kernel on it and trying to use the USB 
 gadget
 functionality. To be more specific the CDC ECM class. 
 Currently, I
 cannot use this properly. If I use just ping to check, it 
 works
 fine, but, after running iperf, even one transaction doesn't 
 complete
 or completes rarely. Checking the CDC Ether interface with 
 Wireshark
 shows, TCP Dup Ack messages and checking the USB bus with 
 Wireshark,
 shows packets with USB Protocol Error -71 at one point and 
 after that
 packets with USB connection Reset -104 error. If it's of any
 significance, I have Arch Linux with the 3.18 kernel running on 
 my
 laptop with which the Vybrid connects. On the host side, the 
 only
 error dmesg shows is kevent 12 may have been dropped. I guess 
 this
 is connected to the TCP Previous Segment not captured and 
 TCP Dup
 ACK messages.

 My script for the gadget configuration is as below:

 /bin/mount none /mnt -t configfs
 /bin/mkdir /mnt/usb_gadget/g1
 cd /mnt/usb_gadget/g1
 /bin/mkdir configs/c.1
 /bin/mkdir functions/ecm.0
 /bin/mkdir strings/0x409
 /bin/mkdir configs/c.1/strings/0x409
 echo 0xa4a2  idProduct
 echo 0x0525  idVendor
 echo Freescale123  strings/0x409/serialnumber
 echo Freescale  strings/0x409/manufacturer
 echo USB Serial Gadget  strings/0x409/product
 echo Conf 1  configs/c.1/strings/0x409/configuration
 echo 200  configs/c.1/MaxPower
 ln -s functions/ecm.0 configs/c.1
 echo ci_hdrc.0  UDC
 /sbin/ifconfig usb0 up
 /sbin/ifconfig usb0 192.168.1.10

 I have debug prints in the udc.c and u_ether.c using pr_debug 
 and

 just a little hint, use any of the dev_*() macros next time, 
 they'll
 print the device name which helps figuring out which UDC you're 
 using.

 Based on ci_hdrc.0 above, I suppose it's chipidea and Peter Chen
 maintains that one, it really helps adding maintainers to Cc 
 list.

 enable them when required using dynamic debug. Without running 
 iperf,
 using ping gives me a sequence of prints as below:

 [  277.434409] In eth_start_xmit
 [  277.434517] In UDC irq
 [  277.434553] In usb_gadget_giveback_request
 [  277.434567] In tx_complete
 [  277.435443] In UDC irq
 [  277.435477] In usb_gadget_giveback_request
 [  277.435491] In rx_complete
 [  277.435517] In rx_submit
 [  277.435601] In eth_start_xmit
 [  277.436441] In UDC irq
 [  277.436465] In usb_gadget_giveback_request
 [  277.436478] In rx_complete
 [  277.436493] In rx_submit
 [  277.436520] In usb_gadget_giveback_request
 [  277.436533] In tx_complete
 [  278.434865] In eth_start_xmit
 [  278.434959] In UDC irq
 [  278.434993] In usb_gadget_giveback_request
 [  278.435006] In tx_complete
 [  278.435881] In UDC irq
 [  278.435910] In usb_gadget_giveback_request
 [  278.435923] In rx_complete
 [  278.435946] In rx_submit

 After running iperf without debug prints and then enabling 
 before
 using ping gives me a sequence of prints as below
 [   81.989827] In UDC irq
 [   81.989871] In usb_gadget_giveback_request
 [   81.989886] In rx_complete
 [   81.989905] In rx_submit
 [   82.989892] In UDC irq
 [   82.989951] In usb_gadget_giveback_request
 [   82.989967] In rx_complete
 [   82.989992] In rx_submit
 [   83.990064] In UDC irq
 [   83.990126] In usb_gadget_giveback_request
 [   83.990142] In rx_complete
 [   83.990167] In rx_submit
 [   84.990007] In UDC irq
 [   84.990049] In usb_gadget_giveback_request
 [   84.990064] In rx_complete
 [   84.990083] In rx_submit
 [   85.990085] In UDC irq
 [   85.990147] In usb_gadget_giveback_request
 [   85.990163] In rx_complete
 [   85.990188] In rx_submit

 If I force a full speed configuration for this USB client port, 
 I get
 a slightly more reliable operation where iperf can run for may 
 be half
 an hour or so or almost an hour before it falls through. 
 Putting in a
 delay of 100-150 microseconds in eth_start_xmit also improves 
 it like
 full speed, but, still not reliable. If I run iperf with debug 
 prints
 enable, this gives similar results to full speed config. After 
 

State of gadget driver gadgetfs and functionfs

2014-12-18 Thread Mario Schuknecht
Hi,

we use gadget driver gadgetfs and implement a high-level protocol over USB.
Our hardware provides an USB WCID device [1]. But the recent state of gadgetfs
is unclear. There are a couple of problems and gadgetfs does not support USB3
SuperSpeed. I guess the driver will be removed from kernel. Is this correct?

I digged around and found functionfs which has similar functions. And I found
notes [2] that it is not to hard to convert a program from gadgetfs to
functionfs.

I looked at tools/usb/ffs-test.c implementation and in file f_fs.c.
If I correctly understand the driver, then the functionfs driver gets USB
descriptors only at the begining.
But I do not understand how I can add WCID specific descriptors. E.g.

- OS String Descriptor [3]
- ID Feature Descriptor [4]
- Extended Properties Feature Descriptor [5]

Can someone show me an example or give me a hint how I can add this descriptors
to functionfs driver?
Or is there an other solution(gadget) for this problem?

Regards,

Mario

[1] https://github.com/pbatard/libwdi/wiki/WCID-Devices
[2] http://www.spinics.net/lists/linux-usb/msg69097.html
[3] 
https://github.com/pbatard/libwdi/wiki/WCID-Devices#Microsoft_OS_String_Descriptor
Table 1
[4] 
https://github.com/pbatard/libwdi/wiki/WCID-Devices#Microsoft_Compatible_ID_Feature_Descriptor
Table 2
[5] 
https://github.com/pbatard/libwdi/wiki/WCID-Devices#Microsoft_Compatible_ID_Feature_Descriptor
Table 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: phy: Restore deferred probing path

2014-12-18 Thread Thierry Reding
On Wed, Dec 17, 2014 at 09:34:48AM -0800, Greg Kroah-Hartman wrote:
 On Wed, Dec 17, 2014 at 09:30:03AM +0100, Thierry Reding wrote:
  On Thu, Dec 04, 2014 at 01:06:07PM +0100, Thierry Reding wrote:
   From: Thierry Reding tred...@nvidia.com
   
   Commit 1290a958d48e (usb: phy: propagate __of_usb_find_phy()'s error on
   failure) broke platforms that rely on deferred probing to order probing
   of PHY and host controller drivers. The reason is that the commit simply
   propagates errors from __of_usb_find_phy(), which returns -ENODEV if no
   PHY has been registered yet for a given device tree node. The only case
   in which -EPROBE_DEFER would now be returned is if try_module_get() did
   fail, which does not make sense.
   
   The correct thing to do is to return -EPROBE_DEFER if a PHY hasn't been
   registered yet. The only condition under which it makes sense to return
   -ENODEV is if the device tree node representing the PHY has been
   disabled (via the status property) because in that case the PHY will
   never be registered.
   
   This patch addresses the problem by making __of_usb_find_phy() return an
   appropriate error code while keeping in line with the above-mentioned
   commit to propagate error codes rather than overwriting them. At the
   same time the check for a valid PHY is decoupled from the check for the
   try_module_get() call and a separate error code is returned if the
   latter fails.
   
   Signed-off-by: Thierry Reding tred...@nvidia.com
   ---
drivers/usb/phy/phy.c | 14 ++
1 file changed, 10 insertions(+), 4 deletions(-)
  
  Ping?
 
 It's the middle of the merge window, we can't do anything until 3.19-rc1
 is out at the earliest.

This fixes a regression that was introduced in commit 1290a958d48e which
has been merged for v3.19-rc1, so this really should go in as soon as
possible. I brought this up around the time of v3.18-rc5 and it's a
shame it's been broken for so long.

Thierry


pgpEwHlaNHVax.pgp
Description: PGP signature


[PATCH v5] usb: gadget: f_fs: add no_disconnect mode

2014-12-18 Thread Robert Baldyga
Since we can compose gadgets from many functions, there is the problem
related to gadget breakage while FunctionFS daemon being closed. FFS
function is userspace code so there is no way to know when it will close
files (it doesn't matter what is the reason of this situation, it can
be daemon logic, program breakage, process kill or any other). So when
we have another function in gadget which, for example, sends some amount
of data, does some software update or implements some real-time functionality,
we may want to keep the gadget connected despite FFS function is no longer
functional.

We can't just remove one of functions from gadget since it has been
enumerated, so the only way to keep entire gadget working is to make
broken FFS function deactivated but still visible to host. For this
purpose this patch introduces no_disconnect mode. It can be enabled
by setting mount option no_disconnect=1, and results with defering
function disconnect to the moment of reopen ep0 file or filesystem
unmount. After closing all endpoint files, FunctionFS is set to state
FFS_DEACTIVATED.

When ffs-state == FFS_DEACTIVATED:
- function is still bound and visible to host,
- setup requests are automatically stalled,
- transfers on other endpoints are refused,
- epfiles, except ep0, are deleted from the filesystem,
- opening ep0 causes the function to be closed, and then FunctionFS
  is ready for descriptors and string write,
- altsetting change causes the function to be closed - we want to keep
  function alive until another functions are potentialy used, altsetting
  change means that another configuration is being selected or USB cable
  was unplugged, which indicates that we don't need to stay longer in
  FFS_DEACTIVATED state
- unmounting of the FunctionFS instance causes the function to be closed.

Signed-off-by: Robert Baldyga r.bald...@samsung.com

Changelog:

v5:
- close function on altsetting change

v4: https://lkml.org/lkml/2014/10/9/224
- use ffs_data_reset() instead of ffs_data_clear() to reset ffs data
  properly after ffs-ref refcount reach 0 (or under in no_disconnect
  mode) in ffs_data_put() function

v3: https://lkml.org/lkml/2014/10/9/170
- change option name to more descriptive and less scary,
- fix cleaning up on unmount (call ffs_data_closed() in ffs_fs_kill_sb(),
  and ffs_data_clear() in ffs_data_closed() if ffs-opened is negative).

v2: https://lkml.org/lkml/2014/10/7/109
- delete epfiles, excepting ep0, when FFS is in zombie mode,
- add description of FFS_ZOMBIE state,
- minor cleanups.

v1: https://lkml.org/lkml/2014/10/6/128

---
 drivers/usb/gadget/function/f_fs.c | 56 ++
 drivers/usb/gadget/function/u_fs.h | 24 
 2 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/function/f_fs.c 
b/drivers/usb/gadget/function/f_fs.c
index 63314ed..d49af15 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -606,6 +606,8 @@ static unsigned int ffs_ep0_poll(struct file *file, 
poll_table *wait)
}
case FFS_CLOSING:
break;
+   case FFS_DEACTIVATED:
+   break;
}
 
mutex_unlock(ffs-mutex);
@@ -1180,6 +1182,7 @@ struct ffs_sb_fill_data {
struct ffs_file_perms perms;
umode_t root_mode;
const char *dev_name;
+   bool no_disconnect;
struct ffs_data *ffs_data;
 };
 
@@ -1250,6 +1253,12 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data 
*data, char *opts)
 
/* Interpret option */
switch (eq - opts) {
+   case 13:
+   if (!memcmp(opts, no_disconnect, 13))
+   data-no_disconnect = !!value;
+   else
+   goto invalid;
+   break;
case 5:
if (!memcmp(opts, rmode, 5))
data-root_mode  = (value  0555) | S_IFDIR;
@@ -1314,6 +1323,7 @@ ffs_fs_mount(struct file_system_type *t, int flags,
.gid = GLOBAL_ROOT_GID,
},
.root_mode = S_IFDIR | 0500,
+   .no_disconnect = false,
};
struct dentry *rv;
int ret;
@@ -1330,6 +1340,7 @@ ffs_fs_mount(struct file_system_type *t, int flags,
if (unlikely(!ffs))
return ERR_PTR(-ENOMEM);
ffs-file_perms = data.perms;
+   ffs-no_disconnect = data.no_disconnect;
 
ffs-dev_name = kstrdup(dev_name, GFP_KERNEL);
if (unlikely(!ffs-dev_name)) {
@@ -1361,6 +1372,7 @@ ffs_fs_kill_sb(struct super_block *sb)
kill_litter_super(sb);
if (sb-s_fs_info) {
ffs_release_dev(sb-s_fs_info);
+   ffs_data_closed(sb-s_fs_info);
ffs_data_put(sb-s_fs_info);
}
 }
@@ -1417,7 +1429,11 @@ static void ffs_data_opened(struct ffs_data *ffs)
ENTER();
 

Re: State of gadget driver gadgetfs and functionfs

2014-12-18 Thread Andrzej Pietrasiewicz

W dniu 18.12.2014 o 09:16, Mario Schuknecht pisze:

Hi,

we use gadget driver gadgetfs and implement a high-level protocol over USB.
Our hardware provides an USB WCID device [1]. But the recent state of gadgetfs
is unclear. There are a couple of problems and gadgetfs does not support USB3
SuperSpeed. I guess the driver will be removed from kernel. Is this correct?

I digged around and found functionfs which has similar functions. And I found
notes [2] that it is not to hard to convert a program from gadgetfs to
functionfs.


I _think_ there are still some users of gadgetfs around, but I guess the
way to go is to use FunctionFS.



I looked at tools/usb/ffs-test.c implementation and in file f_fs.c.
If I correctly understand the driver, then the functionfs driver gets USB
descriptors only at the begining.
But I do not understand how I can add WCID specific descriptors. E.g.

- OS String Descriptor [3]
- ID Feature Descriptor [4]
- Extended Properties Feature Descriptor [5]

Can someone show me an example or give me a hint how I can add this descriptors
to functionfs driver?


This series:
http://www.spinics.net/lists/linux-usb/msg110324.html

adds support for OS descriptors (OS String, Extended Compatibility and
Extended Properties).

Use of OS descriptors is enabled for gadgets composed with configfs.
For general information about composing gadgets with configfs you
can for example look at:
http://events.linuxfoundation.org/sites/events/files/slides/LinuxConNA-Make-your-own-USB-gadget-Andrzej.Pietrasiewicz.pdf

In gadget's root directory there is os_desc subdirectory,
where OS string can be specified and enabled.
In each function's directory there are corresponding subdirectories,
where Extended Properties and Extended Compatibility can be
specified, but FunctionFS is special and does not follow this
rule: all descriptors are passed through the ep0 special file.

In order to pass Extended Properties/Extended Compatibility
descriptors with FunctionFS, you must use FUNCTIONFS_DESCRIPTORS_MAGIC_V2
in the header. You should do it anyway, because since 3.14
FUNCTIONFS_DESCRIPTORS_MAGIC is deprecated.

You can find the layout of the descriptors in
include/uapi/linux/usb/functionfs.h

AP
--
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] renesas_usbhs: fix platform init error message

2014-12-18 Thread Sergei Shtylyov

Hello.

On 12/18/2014 4:46 AM, yoshihiro shimoda wrote:

[...]


There is a typo (prove instead of probe) in the error message printed when
the platform initialization fails. Replace that word with more fitting init.



Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com



this actually goes through me, I'll take it in a bit.



Er, OK. Could you update MAINTAINERS?



there is no entry for renesas driver in MAINTAINERS.



Shimoda-san, care to send a patch adding yourself or Morimoto-san as
maintainers for Renesas driver and pointing to my tree in kernel.org ?



I would like to move the renesas_usbhs driver to drivers/usb/gadget/udc somehow.
Because the driver is almost used for a gadget driver.
The driver has a host driver support now. But, it is not used recently.



After that, this MAINTAINERS issue becomes clear, I think.
Felipe-san and Sergei-san, what do you think?


   I'm against such move.


Best regards,
Yoshihiro Shimoda


WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: USB 3.0 and xHCI Host-Controller

2014-12-18 Thread Gustavo Duarte
Mathias /Guys,

I got the debug log of the xhci_hcd module, during the communication
with the robot kit (Lego brick).

Attached are two files:

brick-boot.log:
The brick is connected to USB port, and press switch ON button.

upload.log:
The brick is already ON, and start the uploading of an application
code from PC - Brick, the uploading procedure never finished.

I don't know so much about usb communications, but seeing these file
logs, I didn't see any estrange message.

What do you think, can you see some clue there ?

Another things that i can do after that, is obtain the messages of the
communication with the brick on a PC where all work fine, and compare
both. I don't know if this would be useful because, the driver used is
ehci-pci.


Thanks in advance.

Gustavo.



On Tue, Dec 16, 2014 at 9:34 AM, Gustavo Duarte gus.dua...@gmail.com wrote:
 Ahh, good tip, I'll try it, and let you know the output.

 Thanks.

 On Tue, Dec 16, 2014 at 8:49 AM, Mathias Nyman
 mathias.ny...@linux.intel.com wrote:
 Hi

 On 16.12.2014 00:53, Gustavo Duarte wrote:
 Hi Guys,


 I'm  having troubles for communication  between a  NXT - Lego Brick
 device (http://www.lego.com/)  and a Notebook with USB 3.0.

 kernel version:

 $ uname -r
 3.13.0-36-generic
 $lspci -vvv

 00:14.0 USB controller: Intel Corporation ValleyView USB xHCI Host
 *
 Questions
 *

 1) Do you think this issue could be caused by kernel/xhci_hcd module ?


 It's possible Can you upgrade to a more recent kernel and see if it helps?
 There are a lot of xhci changes since 3.13.  Current is 3.18

 2) I know that without the brick device, replicate this tests for you
 isn't possible.

 So i would like to ask you, a guide to debug this problem, what kind
 of things I can do to try find out, the problem.


 what does dmesg say? any xhci related errors?

 You can enable more verbose xhci debugging with:
 echo -n 'module xhci_hcd =p'  /sys/kernel/debug/dynamic_debug/control

 then start communicating with your device, and show the output of dmesg.

 Requires dynamic debug support and debugfs mounted, I think many 
 distributions have them as default.

 -Mathias



brick-boot.log
Description: Binary data


upload.log
Description: Binary data


[DISCUSSION] USB device remote wakeup is not working for S3 case

2014-12-18 Thread Du, Changbin
When I am checking usb remote wakeup code, I found that usb remote wakeup will 
not work after system going to S3 sate and I confirmed with my PC.
During enumeration, usb device will be set as wakeup capable by 
usb_set_device_state if it supports. Whether usb driver send 
SET_FEATURE(REMOTE_WAKUP) usb request when suspending on S3  depend on 
do_remote_wakeup flag which is set by choose_wakeup(). It can be simply 
presented as below.
   do_remote_wakeup  = device_may_wakeup(udev-dev);
The return value is always false since usb device is not marked as wakeup 
enabled(that is no one call device_set_wakeup_enable() for usb device). As a 
result, usb device will not signal wakeup event to host.

Maybe we should not allow all remote wakeup supported device can wakeup system 
by default. But for usb keyboard/mouse, I think it is not reasonable to disable 
it by default.

A simple way to fix this is that replace the device_may_wakeup by 
device_can_wakeup in choose_wakeup() function, just like on auto suspend case 
(usb remote wakeup works for rpm). Another way is to make usb device wakeup 
able  by default. But both of them will make all usb devices can wakeup system. 
Have any better idea?
--
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: Query regarding USB gadget driver

2014-12-18 Thread Peter Chen
 
usb_gadget_unmap_request(hwep-ci-gadget, hwreq-req,
  hwep-dir);
 
hwreq-req.actual += actual;
 
 
  Applied and tested the patch. Still the same condition.
 
  How about change condition like:
 
  + if (!hw_read(ci, OP_ENDPTSTAT, BIT(n)))
  + reprime_dtd(ci, hwep, node);
 
 
 No, this doesn't work either :(.
 
  If you still meet issue, you may help me indicate your condition
  detail.
 
 Can you tell me the condition details you are looking for? Transfer descriptor
 list logs?
 

Ok, if your case is really the errata describes, the software has submitted the 
request,
and it is waiting the completion, but the controller does not see this request
has added, so, it will not trigger interrupt.  Let's check this first.

Peter


--
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 0/3] usb: chipidea: add one errata for revision 2.40a

2014-12-18 Thread Matthieu CASTET
Le Wed, 17 Dec 2014 20:40:29 +0800,
Peter Chen peter.c...@freescale.com a écrit :

 On Wed, Dec 17, 2014 at 05:31:40PM +0530, Sanchayan Maity wrote:
  On 12/17/2014 02:05 PM, Peter Chen wrote:
   Hi all,
   
   At the first two patches, I add identification registers APIs, we can get
   controller's revision by using this APIs. Since I don't have enough spec,
   if there are any errors, tell me.
   
   At the third patch, I implement an errata for revision 2.40a, hope it can 
   fix
   the problem Sanchayan Maity reported.
   
   http://www.spinics.net/lists/linux-usb/msg118544.html
   
   @Sanchayan, would you please have a test?
   
   Peter Chen (3):
 usb: chipidea: add identification registers access APIs
 usb: chipidea: add chipidea revision information
 usb: chipidea: udc: add errata for revision 2.40a
   
drivers/usb/chipidea/bits.h | 10 +
drivers/usb/chipidea/ci.h   | 53 
   +
drivers/usb/chipidea/core.c | 23 ++--
drivers/usb/chipidea/udc.c  | 18 ++-
4 files changed, 101 insertions(+), 3 deletions(-)
   
  
  Thanks for the patches.
  
  I tested the patches with iperf and tried a few times to be sure. The 
  condition is
  still the same.
  
 
 Oh, bad luck. Be sure the code I added for 2.40a is ran at your board.
 

For information we workarounded this errata with the attached patched.
It is based on a old version of the driver.
We never had time to clean and submit the patch, but it solve the
errata in our case.


Matthieu


diff
Description: Binary data


[PATCH] usb: dwc3: pci: add support for Intel Sunrise Point PCH

2014-12-18 Thread Heikki Krogerus
Add PCI IDs for Intel Sunrise Point PCH.

Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
---
 drivers/usb/dwc3/dwc3-pci.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 7c4faf7..b642a2f 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -33,6 +33,8 @@
 #define PCI_DEVICE_ID_INTEL_BYT0x0f37
 #define PCI_DEVICE_ID_INTEL_MRFLD  0x119e
 #define PCI_DEVICE_ID_INTEL_BSW0x22B7
+#define PCI_DEVICE_ID_INTEL_SPTLP  0x9d30
+#define PCI_DEVICE_ID_INTEL_SPTH   0xa130
 
 struct dwc3_pci {
struct device   *dev;
@@ -219,6 +221,8 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
+   { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), },
+   { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
{  }/* Terminating Entry */
 };
-- 
2.1.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


Re: usb2 and usb3 ports drop samples while recording from airspy to /dev/null

2014-12-18 Thread Alan Stern
On Thu, 18 Dec 2014, Udo van den Heuvel wrote:

 On 2014-12-17 18:25, Alan Stern wrote:
  On Sat, 13 Dec 2014, Udo van den Heuvel wrote:
  What are we supposed to see?  The lsusb output in the bug report lists 
  a bunch of devices, but it's not clear which one is the airspy.
 
 I did not program the tools. But the other devices are keyboard, webcam
 and some USB erupters.

Let me put it this way: Why did you bother to include the lsusb -t 
output in the bug report, with no explanation, if readers can't tell 
which device is the one causing your problem?

  The bug report says there should be 10 M samples per second.  How many
  bytes are in a sample?  2?
 
 I and Q samples are two bytes each.

What is an I sample?  What is a Q sample?  Are there any samples that 
aren't two bytes?

You need to keep in mind that the people reading this mailing list know
a lot about USB but don't know anything about Airspy devices.

  Now, maybe the transfer isn't just raw data.  Protocol overhead would 
  reduce the total throughput.  But since I don't know what the protocol 
  is, all I can tell you is the raw data rate.
 
 I'll ask some usbmon folks to comment.

One of them just did...  :-)

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: usb2 and usb3 ports drop samples while recording from airspy to /dev/null

2014-12-18 Thread Alan Stern
On Thu, 18 Dec 2014, Udo van den Heuvel wrote:

 On 2014-12-17 18:25, Alan Stern wrote:
  Please let me know what info I should add to help find the root cause.
  
  What are we supposed to see?  The lsusb output in the bug report lists 
  a bunch of devices, but it's not clear which one is the airspy.
 
 Perhaps bus 4, device 10?

In the lsusb -t output, there are no devices listed on bus 4.

The usbmon trace shows data for bus 10, device 10.  In the lsusb -t 
output there is no driver listed for that device.  Maybe that's the 
airspy.

What makes you think the problem here lies in the kernel rather than in 
the airspy_rx program?

Also, do you have any direct evidence that samples are getting dropped
(as opposed to the sample rate simply being reported incorrectly)?  
For example, does an audio stream get messed up?

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: usb2 and usb3 ports drop samples while recording from airspy to /dev/null

2014-12-18 Thread Alan Stern
On Thu, 18 Dec 2014, Udo van den Heuvel wrote:

 On 2014-12-18 16:23, Alan Stern wrote:
  The bug report says there should be 10 M samples per second.  How many
  bytes are in a sample?  2?
 
  I and Q samples are two bytes each.
  
  What is an I sample?  What is a Q sample?  
 
 I and Q samples describe the radio signal received by the airspy.
 
  Are there any samples that 
  aren't two bytes?
 
 No that I am aware.
 
  You need to keep in mind that the people reading this mailing list know
  a lot about USB but don't know anything about Airspy devices.
 
 In fact the airspy samples at 20 MSPS with 2 bytes per sample, but the
 host converts that to the I/Q pairs at 10 MSPS, with 2 bytes for each I
 and Q. (I was explained in #airspy)

I don't know what #airspy is.

If the airspy sends 20 million samples per second to the host and each
sample is 2 bytes, then the host would have to receive 40 MB/s of data
from the airspy.  As I mentioned before, the usbmon trace showed that 
the actual transfer rate was about 24 MB/s.

40 MB/s is a little beyond the limit of what most EHCI host controllers
are able to handle, although an xHCI host controller ought to be able
to do it.

In your lsusb -t listing, bus 10 is EHCI.  Maybe you should try
plugging the airspy into an xHCI port.  For example, you could use one 
of the ports currently occupied by the webcam or the video device.

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: usb2 and usb3 ports drop samples while recording from airspy to /dev/null

2014-12-18 Thread Udo van den Heuvel
On 2014-12-18 17:10, Alan Stern wrote:
 On Thu, 18 Dec 2014, Udo van den Heuvel wrote:
 In fact the airspy samples at 20 MSPS with 2 bytes per sample, but the
 host converts that to the I/Q pairs at 10 MSPS, with 2 bytes for each I
 and Q. (I was explained in #airspy)
 
 I don't know what #airspy is.

An IRC channel at freenode.

 If the airspy sends 20 million samples per second to the host and each
 sample is 2 bytes, then the host would have to receive 40 MB/s of data
 from the airspy.  As I mentioned before, the usbmon trace showed that 
 the actual transfer rate was about 24 MB/s.

That is weird or an issue or what?

 40 MB/s is a little beyond the limit of what most EHCI host controllers
 are able to handle, although an xHCI host controller ought to be able
 to do it.

The device is usb2.


I will try other ports and also recording to a plain harddisk. (not raid
or encrypted)

Udo
--
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/2] USB: gadget: udc: atmel: change setting for DMA

2014-12-18 Thread Nicolas Ferre
Le 17/12/2014 10:18, Bo Shen a écrit :
 According to the datasheet, when transfer using DMA, the control
 setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
 while for OUT packet, need more two bits END_TR_EN and END_TR_IE
 to be configured.
 
 Signed-off-by: Bo Shen voice.s...@atmel.com

Seems okay, even if I am not used to these aspects:
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com

I would also add a stable tag to these patches, something like this:

Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
Cc: sta...@vger.kernel.org # always been there...


Felipe,

Can you take both of these patches as fixes?

 ---
 
  drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
 b/drivers/usb/gadget/udc/atmel_usba_udc.c
 index ce88237..63e90f5 100644
 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
 +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
 @@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct 
 usba_ep *ep,
   req-using_dma = 1;
   req-ctrl = USBA_BF(DMA_BUF_LEN, req-req.length)
   | USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
 - | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
 + | USBA_DMA_END_BUF_EN;
  
 - if (ep-is_in)
 - req-ctrl |= USBA_DMA_END_BUF_EN;
 + if (!ep-is_in)
 + req-ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
  
   /*
* Add this request to the queue and submit for DMA if
 


-- 
Nicolas Ferre
--
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 2/2] USB: gadget: udc: atmel: fix possible IN hang issue

2014-12-18 Thread Nicolas Ferre
Le 17/12/2014 10:18, Bo Shen a écrit :
 When receive data, the RXRDY in status register set by hardware
 after a new packet has been stored in the endpoint FIFO. When it
 is copied from FIFO, this bit is cleared which make the FIFO can
 be accessed again.
 
 In the receive_data() function, this bit RXRDY has been cleared.
 So, after the receive_data() function return, this bit should
 not be cleared again, or else it may cause the accessing FIFO
 corrupt, which will make the data loss.
 
 Signed-off-by: Bo Shen voice.s...@atmel.com


Seems okay:
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com

Like the former one:

Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
Cc: sta...@vger.kernel.org # always been there...

 ---
 
  drivers/usb/gadget/udc/atmel_usba_udc.c | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
 b/drivers/usb/gadget/udc/atmel_usba_udc.c
 index 63e90f5..93328ea 100644
 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
 +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
 @@ -1563,7 +1563,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct 
 usba_ep *ep)
   if ((epstatus  epctrl)  USBA_RX_BK_RDY) {
   DBG(DBG_BUS, %s: RX data ready\n, ep-ep.name);
   receive_data(ep);
 - usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY);
   }
  }
  
 


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


Lockdep problem: v3.18+ (with yesterday's Linus tip - 6f51ee709e4c)

2014-12-18 Thread Russell King - ARM Linux
While unplugging a Logitek Keyboard/mouse micro-receiver, I got the
lockdep splat below.

However, I don't fully understand this splat - I see nothing in
flush_work() nor process_one_work() making use of intf-reset_ws -
which seems to be a USB thing.  I guess lockdep is being re-used to
validate work stuff, and lock is just plain misleading.

usb 2-1.1: USB disconnect, device number 3

=
[ INFO: possible recursive locking detected ]
3.18.0+ #1459 Not tainted
-
kworker/0:1/2758 is trying to acquire lock:
 ((intf-reset_ws)){+.+.+.}, at: [c003ba90] flush_work+0x0/0x264

but task is already holding lock:
 ((intf-reset_ws)){+.+.+.}, at: [c003ca40] process_one_work+0x130/0x4b4

other info that might help us debug this:
 Possible unsafe locking scenario:

   CPU0
   
  lock((intf-reset_ws));
  lock((intf-reset_ws));

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by kworker/0:1/2758:
 #0:  (events){.+.+.+}, at: [c003ca40] process_one_work+0x130/0x4b4
 #1:  ((intf-reset_ws)){+.+.+.}, at: [c003ca40] process_one_work+0x130/0x4b4
 #2:  (dev-mutex){..}, at: [c0438c70] 
usb_lock_device_for_reset+0x58/0xd0
 #3:  (dev-mutex){..}, at: [c038cc10] device_release_driver+0x20/0x34

stack backtrace:
CPU: 0 PID: 2758 Comm: kworker/0:1 Not tainted 3.18.0+ #1459
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events __usb_queue_reset_device
Backtrace:
[c0012228] (dump_backtrace) from [c00123c0] (show_stack+0x18/0x1c)
 r6:c140b5ac r5:c141ce9c r4: r3:e3b230c0
[c00123a8] (show_stack) from [c06d7f00] (dump_stack+0x7c/0x98)
[c06d7e84] (dump_stack) from [c00619a0] (__lock_acquire+0x13f4/0x1bb0)
 r4:c0bd9190 r3:e3b230c0
[c00605ac] (__lock_acquire) from [c00626c0] (lock_acquire+0xb0/0x124)
 r10: r9:c003ba90 r8: r7: r6: r5:ed810670
 r4:
[c0062610] (lock_acquire) from [c003bad4] (flush_work+0x44/0x264)
 r10:ffed r9:c0a43170 r8:ed810400 r7:ed810670 r6:0001 r5:ed810660
 r4:
[c003ba90] (flush_work) from [c003d8f0] (__cancel_work_timer+0x8c/0x124)
 r7:ffe0 r6: r5: r4:ed810660
[c003d864] (__cancel_work_timer) from [c003d9b4] 
(cancel_work_sync+0x14/0x18)
 r7:ed810420 r6:ed810420 r5:c0a43170 r4:ee357068
[c003d9a0] (cancel_work_sync) from [c04476dc] 
(usb_unbind_interface+0x90/0x280)
[c044764c] (usb_unbind_interface) from [c038cb9c] 
(__device_release_driver+078/0xcc)
 r10:ffed r9:000c r8:fff4 r7:ee357000 r6:ed810420 r5:c0a43170
 r4:ed810420
[c038cb24] (__device_release_driver) from [c038cc18] 
(device_release_driver+0x28/0x34)
 r5:ed810420 r4:ed810454
[c038cbf0] (device_release_driver) from [c044794c] 
(usb_driver_release_interface+0x80/0x84)
 r5:0001 r4:ed810400
[c04478cc] (usb_driver_release_interface) from [c0447970] 
(usb_forced_unbind_intf+0x20/0x30)
 r7:ee357000 r6:ed80c000 r5:ed80c054 r4:ed810400
[c0447950] (usb_forced_unbind_intf) from [c04479e4] 
(unbind_marked_interfaces+0x64/0x74)
 r4:0002 r3:0020
[c0447980] (unbind_marked_interfaces) from [c0447b58] 
(usb_unbind_and_rebind_marked_interfaces+0x14/0x20)
 r6:ed80c050 r5: r4:ee357000 r3:006b
[c0447b44] (usb_unbind_and_rebind_marked_interfaces) from [c043c470] 
(usb_reset_device+0x1dc/0x234)
 r4:ed81 r3:006b
[c043c294] (usb_reset_device) from [c0443f6c] 
(__usb_queue_reset_device+0x40/0x58)
 r10:eefb9b00 r9:c0a59178 r8: r7:dd505eb0 r6:ee357000 r5:ee357068
 r4:ed810260
[c0443f2c] (__usb_queue_reset_device) from [c003cad0] 
(process_one_work+0x1c0/0x4b4)
 r6:eefb6500 r5:dd6dde00 r4:ed810260 r3:c0443f2c
[c003c910] (process_one_work) from [c003ce34] (worker_thread+0x34/0x4b0)
 r10:eefb6500 r9:dd6dde00 r8:0008 r7:dd6dde18 r6:eefb6500 r5:0001
 r4:eefb6530
[c003ce00] (worker_thread) from [c0042228] (kthread+0xe0/0xfc)
 r10: r9: r8: r7:c003ce00 r6:dd6dde00 r5:
 r4:dd66e880
[c0042148] (kthread) from [c000ecc8] (ret_from_fork+0x14/0x2c)
 r7: r6: r5:c0042148 r4:dd66e880

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
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: usb2 and usb3 ports drop samples while recording from airspy to /dev/null

2014-12-18 Thread Alan Stern
On Thu, 18 Dec 2014, Udo van den Heuvel wrote:

  If the airspy sends 20 million samples per second to the host and each
  sample is 2 bytes, then the host would have to receive 40 MB/s of data
  from the airspy.  As I mentioned before, the usbmon trace showed that 
  the actual transfer rate was about 24 MB/s.
 
 That is weird or an issue or what?

It is an issue, because you wanted to get 40 MB/s but you only got 24 
MB/s.  To put it another way, you expected to receive 10 million 
samples per second but you only received about 6 million samples per 
second.

  40 MB/s is a little beyond the limit of what most EHCI host controllers
  are able to handle, although an xHCI host controller ought to be able
  to do it.

 The device is usb2.

In theory, USB-2 can transfer up to 52 MB/s (that is, 13312000 samples
per second).  In practice, most EHCI hardware can't do more than about
32 MB/s (that is, about 8 million samples per second).  xHCI hardware
can come closer to the 52 MB/s limit when connected to a USB-2 device.

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: USB 3.0 and xHCI Host-Controller

2014-12-18 Thread Gustavo Duarte
Thanks Mathis for these suggestions, i'm going to try it, and let you
know the results.

i hope you have a nice rest.

Gustavo.


On Thu, Dec 18, 2014 at 2:12 PM, Mathias Nyman
mathias.ny...@linux.intel.com wrote:
 Hi

 On 18.12.2014 13:49, Gustavo Duarte wrote:
 Mathias /Guys,

 I got the debug log of the xhci_hcd module, during the communication
 with the robot kit (Lego brick).

 Attached are two files:

 brick-boot.log:
 The brick is connected to USB port, and press switch ON button.

 upload.log:
 The brick is already ON, and start the uploading of an application
 code from PC - Brick, the uploading procedure never finished.

 I don't know so much about usb communications, but seeing these file
 logs, I didn't see any estrange message.

 What do you think, can you see some clue there ?

 Looks like it first finds a mismatch in max packet size after device is
 addressed, xhci tries to  re-configure the endpoint to match the new
 maxpacket size. It says it succeeds but immediately  after that halts the
 endpoint. After this we see most of the usb transfers cancelled.

 Things to try:

 - use old style enumeration, before pluging in your device do:
   'echo y  /sys/module/usbcore/parameters/old_scheme_first'

 - use 3.18 kernel, it has fixes for misbehaving halted control endpoints

 - hack the xhci code and remove setting the new maxpacket size, and see if
   it makes a difference.
   Do a codechange like this, (copy-pasted diff), and rebuild:

 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
 index 5be1bff..2778c37 100644
 --- a/drivers/usb/host/xhci.c
 +++ b/drivers/usb/host/xhci.c
 @@ -1370,7 +1370,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb 
 *urb, gfp_t mem_flags)
 /* Check to see if the max packet size for the default control
  * endpoint changed during FS device enumeration
  */
 -   if (urb-dev-speed == USB_SPEED_FULL) {
 +   if (urb-dev-speed == USB_SPEED_FULL  0) {
 ret = xhci_check_maxpacket(xhci, slot_id,
 ep_index, urb);
 if (ret  0) {

 I'll be away until 5. Jan on vacation, trying not to read emails


 -Mathias
--
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 01/29] usb: dwc2: gadget: register gadget handle to the phy

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 200168e..0b3c571 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3411,7 +3411,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
struct device *dev = hsotg-dev;
struct s3c_hsotg_plat *plat = dev-platform_data;
struct phy *phy;
-   struct usb_phy *uphy;
+   struct usb_phy *uphy = NULL;
struct s3c_hsotg_ep *eps;
int epnum;
int ret;
@@ -3555,12 +3555,20 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
if (ret)
goto err_ep_mem;
 
+   if (!IS_ERR_OR_NULL(uphy)) {
+   ret = otg_set_peripheral(uphy-otg, hsotg-gadget);
+   if (ret  ret != -ENOTSUPP)
+   goto err_set_peripheral;
+   }
+
s3c_hsotg_create_debug(hsotg);
 
s3c_hsotg_dump(hsotg);
 
return 0;
 
+err_set_peripheral:
+   usb_del_gadget_udc(hsotg-gadget);
 err_ep_mem:
kfree(eps);
 err_supplies:
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 02/29] usb: dwc2: gadget: mask fifo empty irq with dma

2014-12-18 Thread Mian Yousaf Kaukab
When using DMA keep fifo empty interrupt disabled. Otherwise
core is flooded by interrupts.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0b3c571..5d3af1d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2177,8 +2177,8 @@ void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg 
*hsotg)
 * interrupts.
 */
 
-   writel(((hsotg-dedicated_fifos) ? DIEPMSK_TXFIFOEMPTY |
-   DIEPMSK_INTKNTXFEMPMSK : 0) |
+   writel(((hsotg-dedicated_fifos  !using_dma(hsotg)) ?
+   DIEPMSK_TXFIFOEMPTY | DIEPMSK_INTKNTXFEMPMSK : 0) |
DIEPMSK_EPDISBLDMSK | DIEPMSK_XFERCOMPLMSK |
DIEPMSK_TIMEOUTMSK | DIEPMSK_AHBERRMSK |
DIEPMSK_INTKNEPMISMSK,
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 04/29] usb: dwc2: gadget: don't embedded ep0 buffers

2014-12-18 Thread Mian Yousaf Kaukab
When using DMA, data of the previous setup packet can be read back
from cache because ep0 and ctrl buffers are embedded in struct s3c_hsotg.
Allocate buffers instead of embeddeding them.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h   |  7 +--
 drivers/usb/dwc2/gadget.c | 20 ++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 7a70a13..e841a56 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -434,6 +434,9 @@ struct dwc2_hw_params {
u32 snpsid;
 };
 
+/* Size of control and EP0 buffers */
+#define DWC2_CTRL_BUFF_SIZE 8
+
 /**
  * struct dwc2_hsotg - Holds the state of the driver, including the 
non-periodic
  * and periodic schedules
@@ -684,8 +687,8 @@ struct dwc2_hsotg {
 
struct usb_request *ep0_reply;
struct usb_request *ctrl_req;
-   u8 ep0_buff[8];
-   u8 ctrl_buff[8];
+   void *ep0_buff;
+   void *ctrl_buff;
 
struct usb_gadget gadget;
unsigned int enabled:1;
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d89c341..5de3a3a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3485,7 +3485,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 
if (ret) {
dev_err(dev, failed to enable supplies: %d\n, ret);
-   goto err_supplies;
+   goto err_clk;
}
 
/* usb phy enable */
@@ -3495,6 +3495,22 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
s3c_hsotg_hw_cfg(hsotg);
s3c_hsotg_init(hsotg);
 
+   hsotg-ctrl_buff = devm_kzalloc(hsotg-dev,
+   DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
+   if (!hsotg-ctrl_buff) {
+   dev_err(dev, failed to allocate ctrl request buff\n);
+   ret = -ENOMEM;
+   goto err_supplies;
+   }
+
+   hsotg-ep0_buff = devm_kzalloc(hsotg-dev,
+   DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
+   if (!hsotg-ep0_buff) {
+   dev_err(dev, failed to allocate ctrl reply buff\n);
+   ret = -ENOMEM;
+   goto err_supplies;
+   }
+
ret = devm_request_irq(hsotg-dev, irq, s3c_hsotg_irq, IRQF_SHARED,
dev_name(hsotg-dev), hsotg);
if (ret  0) {
@@ -3503,7 +3519,7 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
regulator_bulk_disable(ARRAY_SIZE(hsotg-supplies),
   hsotg-supplies);
dev_err(dev, cannot claim IRQ for gadget\n);
-   goto err_clk;
+   goto err_supplies;
}
 
/* hsotg-num_of_eps holds number of EPs other than ep0 */
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 00/29] usb: updates for dwc2 gadget driver

2014-12-18 Thread Mian Yousaf Kaukab
Hi,
This patchset consists of various bug fixes and feature enhancements for the
dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with dedicated
fifos. Main focus of testing was with dma enabled. Although basic testing
without dma was also done.

It is based on linux-next tag next-20141218.

Thank you,

Best regards,
Yousaf

Gregory Herrero (13):
  usb: dwc2: gadget: register gadget handle to the phy
  usb: dwc2: gadget: write correct value in ahbcfg register
  usb: dwc2: gadget: don't erase gahbcfg register when enabling dma
  usb: dwc2: gadget: add device tree property to enable dma
  Documentation: dt-bindings: add dt binding info for dwc2 g_use_dma
  usb: dwc2: gadget: configure fifos from device tree
  Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing
  usb: dwc2: gadget: don't block after fifo flush timeout
  usb: dwc2: gadget: add vbus_session support
  usb: dwc2: gadget: reset fifo_map when initializing fifos
  usb: dwc2: gadget: fix pullup handling
  usb: dwc2: gadget: add vbus_draw support
  usb: dwc2: gadget: force gadget initialization in dev mode

Mian Yousaf Kaukab (16):
  usb: dwc2: gadget: mask fifo empty irq with dma
  usb: dwc2: gadget: process setup packet on transfer complete
  usb: dwc2: gadget: don't embedded ep0 buffers
  usb: dwc2: gadget: add bi-directional endpoint support
  usb: dwc2: gadget: check interrupts for all endpoints
  usb: dwc2: gadget: remove unused members from hsotg_req
  usb: dwc2: gadget: fix debug loop limits
  usb: dwc2: gadget: consider all tx fifos
  usb: dwc2: gadget: kill requests after disabling ep
  usb: dwc2: gadget: manage ep0 state in software
  usb: dwc2: gadget: fix zero length packet transfers
  usb: dwc2: gadget: dont warn if endpoint is not enabled
  usb: dwc2: gadget: rename sent_zlp to send_zlp
  usb: dwc2: gadget: pick smallest acceptable fifo
  usb: dwc2: gadget: fix fifo allocation leak
  usb: dwc2: gadget: report disconnection after reset

 Documentation/devicetree/bindings/usb/dwc2.txt |   4 +
 drivers/usb/dwc2/core.h|  46 +-
 drivers/usb/dwc2/gadget.c  | 874 -
 drivers/usb/dwc2/hw.h  |   1 +
 4 files changed, 602 insertions(+), 323 deletions(-)

-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 13/29] usb: dwc2: gadget: remove unused members from hsotg_req

2014-12-18 Thread Mian Yousaf Kaukab
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 7c0b995..b5e50e7 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -158,14 +158,10 @@ struct s3c_hsotg_ep {
  * struct s3c_hsotg_req - data transfer request
  * @req: The USB gadget request
  * @queue: The list of requests for the endpoint this is queued for.
- * @in_progress: Has already had size/packets written to core
- * @mapped: DMA buffer for this request has been mapped via dma_map_single().
  */
 struct s3c_hsotg_req {
struct usb_request  req;
struct list_headqueue;
-   unsigned char   in_progress;
-   unsigned char   mapped;
 };
 
 #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || 
IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 11/29] usb: dwc2: gadget: configure fifos from device tree

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

As fifo size can vary between SOCs, add possibility to configure
them from device tree. Fifo sizes used by the legacy driver will
be used If they are not provided by the device tree.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h   | 13 +++
 drivers/usb/dwc2/gadget.c | 88 ++-
 2 files changed, 77 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index fa5ee27..7c0b995 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -193,6 +193,13 @@ enum dwc2_lx_state {
DWC2_L3,/* Off state */
 };
 
+/*
+ * Gadget periodic tx fifo sizes as used by legacy driver
+ * EP0 is not included
+ */
+#define DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, \
+  768, 0, 0, 0, 0, 0, 0, 0}
+
 /**
  * struct dwc2_core_params - Parameters for configuring the core
  *
@@ -564,6 +571,9 @@ struct dwc2_hw_params {
  * @last_rst:   Time of last reset
  * @eps:The endpoints being supplied to the gadget framework
  * @g_using_dma:  Indicate if dma usage is enabled
+ * @g_rx_fifo_sz: Contains rx fifo size value
+ * @g_np_g_tx_fifo_sz:  Contains Non-Periodic tx fifo size value
+ * @g_tx_fifo_sz: Contains tx fifo size value per endpoints
  */
 struct dwc2_hsotg {
struct device *dev;
@@ -699,6 +709,9 @@ struct dwc2_hsotg {
struct s3c_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
struct s3c_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
u32 g_using_dma;
+   u32 g_rx_fifo_sz;
+   u32 g_np_g_tx_fifo_sz;
+   u32 g_tx_fifo_sz[MAX_EPS_CHANNELS];
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 };
 
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index ebc73ed..3706a9d 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -174,15 +174,14 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
 {
unsigned int ep;
unsigned int addr;
-   unsigned int size;
int timeout;
u32 val;
 
-   /* set FIFO sizes to 2048/1024 */
-
-   writel(2048, hsotg-regs + GRXFSIZ);
-   writel((2048  FIFOSIZE_STARTADDR_SHIFT) |
-   (1024  FIFOSIZE_DEPTH_SHIFT), hsotg-regs + GNPTXFSIZ);
+   /* set RX/NPTX FIFO sizes */
+   writel(hsotg-g_rx_fifo_sz, hsotg-regs + GRXFSIZ);
+   writel((hsotg-g_rx_fifo_sz  FIFOSIZE_STARTADDR_SHIFT) |
+   (hsotg-g_np_g_tx_fifo_sz  FIFOSIZE_DEPTH_SHIFT),
+   hsotg-regs + GNPTXFSIZ);
 
/*
 * arange all the rest of the TX FIFOs, as some versions of this
@@ -192,7 +191,7 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
 */
 
/* start at the end of the GNPTXFSIZ, rounded up */
-   addr = 2048 + 1024;
+   addr = hsotg-g_rx_fifo_sz + hsotg-g_np_g_tx_fifo_sz;
 
/*
 * Because we have not enough memory to have each TX FIFO of size at
@@ -202,25 +201,14 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
 * given endpoint.
 */
 
-   /* 256*4=1024 bytes FIFO length */
-   size = 256;
-   for (ep = 1; ep = 4; ep++) {
-   val = addr;
-   val |= size  FIFOSIZE_DEPTH_SHIFT;
-   WARN_ONCE(addr + size  hsotg-fifo_mem,
- insufficient fifo memory);
-   addr += size;
-
-   writel(val, hsotg-regs + DPTXFSIZN(ep));
-   }
-   /* 768*4=3072 bytes FIFO length */
-   size = 768;
-   for (ep = 5; ep = 8; ep++) {
+   for (ep = 1; ep  MAX_EPS_CHANNELS; ep++) {
+   if (!hsotg-g_tx_fifo_sz[ep])
+   continue;
val = addr;
-   val |= size  FIFOSIZE_DEPTH_SHIFT;
-   WARN_ONCE(addr + size  hsotg-fifo_mem,
+   val |= hsotg-g_tx_fifo_sz[ep]  FIFOSIZE_DEPTH_SHIFT;
+   WARN_ONCE(addr + hsotg-g_tx_fifo_sz[ep]  hsotg-fifo_mem,
  insufficient fifo memory);
-   addr += size;
+   addr += hsotg-g_tx_fifo_sz[ep];
 
writel(val, hsotg-regs + DPTXFSIZN(ep));
}
@@ -3495,11 +3483,44 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg 
*hsotg)
 static int s3c_hsotg_of_probe(struct dwc2_hsotg *hsotg)
 {
struct device_node *np = hsotg-dev-of_node;
+   int len = 0;
+   int i = 0;
 
/* Enable dma if requested in device tree */
if (of_find_property(np, g_use_dma, NULL))
hsotg-g_using_dma = true;
 
+   /*
+* Register TX periodic fifo size per endpoint.
+* EP0 is excluded since it has no fifo configuration.
+*/
+   if (!of_find_property(np, g_tx_fifo_size, len))
+   goto rx_fifo;
+
+  

[PATCH 03/29] usb: dwc2: gadget: process setup packet on transfer complete

2014-12-18 Thread Mian Yousaf Kaukab
DOEPINTn.SetUp also indicates an OUT token for the data stage, so
instead use DOEPINTn.StupPktRcvd. Moreover, check
DOEPINTn.StupPktRcvd on DOEPINTn.XferComp as described in programming
guide.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 83 ---
 drivers/usb/dwc2/hw.h |  1 +
 2 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 5d3af1d..d89c341 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1811,35 +1811,54 @@ static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, 
unsigned int idx,
__func__, idx, dir_in ? in : out, ints);
 
if (ints  DXEPINT_XFERCOMPL) {
-   if (hs_ep-isochronous  hs_ep-interval == 1) {
-   if (ctrl  DXEPCTL_EOFRNUM)
-   ctrl |= DXEPCTL_SETEVENFR;
-   else
-   ctrl |= DXEPCTL_SETODDFR;
-   writel(ctrl, hsotg-regs + epctl_reg);
-   }
+   if (ints  DXEPINT_SETUP_RCVD) {  /* Setup or Timeout */
+   dev_dbg(hsotg-dev, %s: Setup/Timeout\n,  __func__);
 
-   dev_dbg(hsotg-dev,
-   %s: XferCompl: DxEPCTL=0x%08x, DXEPTSIZ=%08x\n,
-   __func__, readl(hsotg-regs + epctl_reg),
-   readl(hsotg-regs + epsiz_reg));
+   if (using_dma(hsotg)  idx == 0) {
+   /*
+* this is the notification we've received a
+* setup packet. In non-DMA mode we'd get this
+* from the RXFIFO, instead we need to process
+* the setup here.
+*/
 
-   /*
-* we get OutDone from the FIFO, so we only need to look
-* at completing IN requests here
-*/
-   if (dir_in) {
-   s3c_hsotg_complete_in(hsotg, hs_ep);
+   if (dir_in)
+   WARN_ON_ONCE(1);
+   else
+   s3c_hsotg_handle_outdone(hsotg,
+   0, true);
+   }
+   } else {
+   if (hs_ep-isochronous  hs_ep-interval == 1) {
+   if (ctrl  DXEPCTL_EOFRNUM)
+   ctrl |= DXEPCTL_SETEVENFR;
+   else
+   ctrl |= DXEPCTL_SETODDFR;
+   writel(ctrl, hsotg-regs + epctl_reg);
+   }
+
+   dev_dbg(hsotg-dev,
+   %s: XferCompl:DxEPCTL=0x%08x,DXEPTSIZ=%08x\n,
+   __func__, readl(hsotg-regs + epctl_reg),
+   readl(hsotg-regs + epsiz_reg));
 
-   if (idx == 0  !hs_ep-req)
-   s3c_hsotg_enqueue_setup(hsotg);
-   } else if (using_dma(hsotg)) {
/*
-* We're using DMA, we need to fire an OutDone here
-* as we ignore the RXFIFO.
+* we get OutDone from the FIFO, so we only need to look
+* at completing IN requests here
 */
+   if (dir_in) {
+   s3c_hsotg_complete_in(hsotg, hs_ep);
 
-   s3c_hsotg_handle_outdone(hsotg, idx, false);
+   if (idx == 0  !hs_ep-req)
+   s3c_hsotg_enqueue_setup(hsotg);
+   } else if (using_dma(hsotg)) {
+   /*
+* We're using DMA, we need to fire an OutDone
+*  here as we ignore the RXFIFO.
+*/
+
+   s3c_hsotg_handle_outdone(hsotg, idx, false);
+   }
}
}
 
@@ -1864,24 +1883,6 @@ static void s3c_hsotg_epint(struct dwc2_hsotg *hsotg, 
unsigned int idx,
if (ints  DXEPINT_AHBERR)
dev_dbg(hsotg-dev, %s: AHBErr\n, __func__);
 
-   if (ints  DXEPINT_SETUP) {  /* Setup or Timeout */
-   dev_dbg(hsotg-dev, %s: Setup/Timeout\n,  __func__);
-
-   if (using_dma(hsotg)  idx == 0) {
-   /*
-* this is the notification we've received a
-* setup packet. In non-DMA mode we'd get this
-* from the RXFIFO, instead we need to process
-* the 

[PATCH 09/29] usb: dwc2: gadget: add bi-directional endpoint support

2014-12-18 Thread Mian Yousaf Kaukab
GHWCFG1 provides hardware configuration of each endpoint. Use
it to configure the endpoints instead of assuming all even
endpoint are OUT and all odd endpoints are IN.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h   |   3 +-
 drivers/usb/dwc2/gadget.c | 324 +-
 2 files changed, 209 insertions(+), 118 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 69acbce..fa5ee27 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -696,7 +696,8 @@ struct dwc2_hsotg {
unsigned int connected:1;
unsigned int setup:1;
unsigned long last_rst;
-   struct s3c_hsotg_ep *eps;
+   struct s3c_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
+   struct s3c_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
u32 g_using_dma;
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 };
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index eb58305..c5df746 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -65,6 +65,15 @@ static inline void __bic32(void __iomem *ptr, u32 val)
writel(readl(ptr)  ~val, ptr);
 }
 
+static inline struct s3c_hsotg_ep *index_to_ep(struct dwc2_hsotg *hsotg,
+   u32 ep_index, u32 dir_in)
+{
+   if (dir_in)
+   return hsotg-eps_in[ep_index];
+   else
+   return hsotg-eps_out[ep_index];
+}
+
 /* forward decleration of functions */
 static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
 
@@ -819,7 +828,7 @@ static void s3c_hsotg_complete_oursetup(struct usb_ep *ep,
 static struct s3c_hsotg_ep *ep_from_windex(struct dwc2_hsotg *hsotg,
   u32 windex)
 {
-   struct s3c_hsotg_ep *ep = hsotg-eps[windex  0x7F];
+   struct s3c_hsotg_ep *ep;
int dir = (windex  USB_DIR_IN) ? 1 : 0;
int idx = windex  0x7F;
 
@@ -829,6 +838,8 @@ static struct s3c_hsotg_ep *ep_from_windex(struct 
dwc2_hsotg *hsotg,
if (idx  hsotg-num_of_eps)
return NULL;
 
+   ep = index_to_ep(hsotg, idx, dir);
+
if (idx  ep-dir_in != dir)
return NULL;
 
@@ -889,7 +900,7 @@ static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
 static int s3c_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
struct usb_ctrlrequest *ctrl)
 {
-   struct s3c_hsotg_ep *ep0 = hsotg-eps[0];
+   struct s3c_hsotg_ep *ep0 = hsotg-eps_out[0];
struct s3c_hsotg_ep *ep;
__le16 reply;
int ret;
@@ -960,7 +971,7 @@ static struct s3c_hsotg_req *get_ep_head(struct 
s3c_hsotg_ep *hs_ep)
 static int s3c_hsotg_process_req_feature(struct dwc2_hsotg *hsotg,
 struct usb_ctrlrequest *ctrl)
 {
-   struct s3c_hsotg_ep *ep0 = hsotg-eps[0];
+   struct s3c_hsotg_ep *ep0 = hsotg-eps_out[0];
struct s3c_hsotg_req *hs_req;
bool restart;
bool set = (ctrl-bRequest == USB_REQ_SET_FEATURE);
@@ -1040,7 +1051,7 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg 
*hsotg);
  */
 static void s3c_hsotg_stall_ep0(struct dwc2_hsotg *hsotg)
 {
-   struct s3c_hsotg_ep *ep0 = hsotg-eps[0];
+   struct s3c_hsotg_ep *ep0 = hsotg-eps_out[0];
u32 reg;
u32 ctrl;
 
@@ -1080,7 +1091,7 @@ static void s3c_hsotg_stall_ep0(struct dwc2_hsotg *hsotg)
 static void s3c_hsotg_process_control(struct dwc2_hsotg *hsotg,
  struct usb_ctrlrequest *ctrl)
 {
-   struct s3c_hsotg_ep *ep0 = hsotg-eps[0];
+   struct s3c_hsotg_ep *ep0 = hsotg-eps_out[0];
int ret = 0;
u32 dcfg;
 
@@ -1201,9 +1212,9 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg 
*hsotg)
return;
}
 
-   hsotg-eps[0].dir_in = 0;
+   hsotg-eps_out[0]-dir_in = 0;
 
-   ret = s3c_hsotg_ep_queue(hsotg-eps[0].ep, req, GFP_ATOMIC);
+   ret = s3c_hsotg_ep_queue(hsotg-eps_out[0]-ep, req, GFP_ATOMIC);
if (ret  0) {
dev_err(hsotg-dev, %s: failed queue (%d)\n, __func__, ret);
/*
@@ -1293,7 +1304,7 @@ static void s3c_hsotg_complete_request(struct dwc2_hsotg 
*hsotg,
  */
 static void s3c_hsotg_rx_data(struct dwc2_hsotg *hsotg, int ep_idx, int size)
 {
-   struct s3c_hsotg_ep *hs_ep = hsotg-eps[ep_idx];
+   struct s3c_hsotg_ep *hs_ep = hsotg-eps_out[ep_idx];
struct s3c_hsotg_req *hs_req = hs_ep-req;
void __iomem *fifo = hsotg-regs + EPFIFO(ep_idx);
int to_read;
@@ -1367,13 +1378,14 @@ static void s3c_hsotg_send_zlp(struct dwc2_hsotg *hsotg,
}
 
if (req-req.length == 0) {
-   hsotg-eps[0].sent_zlp = 1;
+   hsotg-eps_out[0]-sent_zlp = 1;
s3c_hsotg_enqueue_setup(hsotg);
return;
}
 
-   hsotg-eps[0].dir_in = 1;
-   hsotg-eps[0].sent_zlp = 1;
+   /* 

[PATCH 07/29] usb: dwc2: gadget: add device tree property to enable dma

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

* Add an of specific function to parse device node properties.
* Enable dma usage only if device tree property 'g_use_dma' is present.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/core.h   |  2 ++
 drivers/usb/dwc2/gadget.c | 26 --
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index e841a56..69acbce 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -563,6 +563,7 @@ struct dwc2_hw_params {
  * @setup:  NAK management for EP0 SETUP
  * @last_rst:   Time of last reset
  * @eps:The endpoints being supplied to the gadget framework
+ * @g_using_dma:  Indicate if dma usage is enabled
  */
 struct dwc2_hsotg {
struct device *dev;
@@ -696,6 +697,7 @@ struct dwc2_hsotg {
unsigned int setup:1;
unsigned long last_rst;
struct s3c_hsotg_ep *eps;
+   u32 g_using_dma;
 #endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 };
 
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 58699c3..eb58305 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -85,11 +85,11 @@ static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg);
  * a core reset. This means we either need to fix the gadgets to take
  * account of DMA alignment, or add bounce buffers (yuerk).
  *
- * Until this issue is sorted out, we always return 'false'.
+ * g_using_dma is set depending on dts flag.
  */
 static inline bool using_dma(struct dwc2_hsotg *hsotg)
 {
-   return false;   /* support is not complete */
+   return hsotg-g_using_dma;
 }
 
 /**
@@ -3402,6 +3402,24 @@ static void s3c_hsotg_delete_debug(struct dwc2_hsotg 
*hsotg)
debugfs_remove(hsotg-debug_root);
 }
 
+#ifdef CONFIG_OF
+static int s3c_hsotg_of_probe(struct dwc2_hsotg *hsotg)
+{
+   struct device_node *np = hsotg-dev-of_node;
+
+   /* Enable dma if requested in device tree */
+   if (of_find_property(np, g_use_dma, NULL))
+   hsotg-g_using_dma = true;
+
+   return 0;
+}
+#else
+static int s3c_hsotg_of_probe(struct dwc2_hsotg *hsotg)
+{
+   return 0;
+}
+#endif
+
 /**
  * dwc2_gadget_init - init function for gadget
  * @dwc2: The data structure for the DWC2 driver.
@@ -3421,6 +3439,10 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* Set default UTMI width */
hsotg-phyif = GUSBCFG_PHYIF16;
 
+   ret = s3c_hsotg_of_probe(hsotg);
+   if (ret)
+   return ret;
+
/*
 * Attempt to find a generic PHY, then look for an old style
 * USB PHY, finally fall back to pdata
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 05/29] usb: dwc2: gadget: write correct value in ahbcfg register

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 5de3a3a..0b08d4a 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2164,7 +2164,7 @@ void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg 
*hsotg)
 
if (using_dma(hsotg))
writel(GAHBCFG_GLBL_INTR_EN | GAHBCFG_DMA_EN |
-  GAHBCFG_HBSTLEN_INCR4,
+  (GAHBCFG_HBSTLEN_INCR4  GAHBCFG_HBSTLEN_SHIFT),
   hsotg-regs + GAHBCFG);
else
writel(((hsotg-dedicated_fifos) ? (GAHBCFG_NP_TXF_EMP_LVL |
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 16/29] usb: dwc2: gadget: kill requests after disabling ep

2014-12-18 Thread Mian Yousaf Kaukab
kill_all_requests() can flush the fifo. Call it after disabling the
endpoint. Moreover, remove even the current IN request so that next
IN request after s3c_hsotg_ep_enable can be properly handled.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 28d830b..b5faca8 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2612,8 +2612,6 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index);
 
spin_lock_irqsave(hsotg-lock, flags);
-   /* terminate all requests with shutdown */
-   kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false);
 
hsotg-fifo_map = ~(1hs_ep-fifo_index);
hs_ep-fifo_index = 0;
@@ -2630,6 +2628,9 @@ static int s3c_hsotg_ep_disable(struct usb_ep *ep)
/* disable endpoint interrupts */
s3c_hsotg_ctrl_epint(hsotg, hs_ep-index, hs_ep-dir_in, 0);
 
+   /* terminate all requests with shutdown */
+   kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, true);
+
spin_unlock_irqrestore(hsotg-lock, flags);
return 0;
 }
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 17/29] usb: dwc2: gadget: manage ep0 state in software

2014-12-18 Thread Mian Yousaf Kaukab
Manage ep0 state in software to add handling of status OUT stage.
Just toggling hsotg-setup in s3c_hsotg_handle_outdone leaves it in
wrong state in 2-stage control transfers.
Moreover, there is no need to handle SetupDone as requests can be
complete on XferCmpl of status stage.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h   |  13 +++-
 drivers/usb/dwc2/gadget.c | 151 ++
 2 files changed, 83 insertions(+), 81 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index b5e50e7..1801785 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -196,6 +196,15 @@ enum dwc2_lx_state {
 #define DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, \
   768, 0, 0, 0, 0, 0, 0, 0}
 
+/* Gadget ep0 states */
+enum dwc2_ep0_state {
+   DWC2_EP0_SETUP,
+   DWC2_EP0_DATA_IN,
+   DWC2_EP0_DATA_OUT,
+   DWC2_EP0_STATUS_IN,
+   DWC2_EP0_STATUS_OUT,
+};
+
 /**
  * struct dwc2_core_params - Parameters for configuring the core
  *
@@ -563,7 +572,7 @@ struct dwc2_hw_params {
  * @ep0_buff:   Buffer for EP0 reply data, if needed.
  * @ctrl_buff:  Buffer for EP0 control requests.
  * @ctrl_req:   Request for EP0 control packets.
- * @setup:  NAK management for EP0 SETUP
+ * @ep0_state:  EP0 control transfers state
  * @last_rst:   Time of last reset
  * @eps:The endpoints being supplied to the gadget framework
  * @g_using_dma:  Indicate if dma usage is enabled
@@ -696,11 +705,11 @@ struct dwc2_hsotg {
struct usb_request *ctrl_req;
void *ep0_buff;
void *ctrl_buff;
+   enum dwc2_ep0_state ep0_state;
 
struct usb_gadget gadget;
unsigned int enabled:1;
unsigned int connected:1;
-   unsigned int setup:1;
unsigned long last_rst;
struct s3c_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
struct s3c_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index b5faca8..523e107 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -641,15 +641,12 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
ctrl |= DXEPCTL_EPENA;  /* ensure ep enabled */
ctrl |= DXEPCTL_USBACTEP;
 
-   dev_dbg(hsotg-dev, setup req:%d\n, hsotg-setup);
+   dev_dbg(hsotg-dev, ep0 state:%d\n, hsotg-ep0_state);
 
/* For Setup request do not clear NAK */
-   if (hsotg-setup  index == 0)
-   hsotg-setup = 0;
-   else
+   if (!(index == 0  hsotg-ep0_state == DWC2_EP0_SETUP))
ctrl |= DXEPCTL_CNAK;   /* clear NAK set by core */
 
-
dev_dbg(hsotg-dev, %s: DxEPCTL=0x%08x\n, __func__, ctrl);
writel(ctrl, hsotg-regs + epctrl_reg);
 
@@ -868,8 +865,6 @@ static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
 
if (length)
memcpy(req-buf, buff, length);
-   else
-   ep-sent_zlp = 1;
 
ret = s3c_hsotg_ep_queue(ep-ep, req, GFP_ATOMIC);
if (ret) {
@@ -1083,26 +1078,20 @@ static void s3c_hsotg_process_control(struct dwc2_hsotg 
*hsotg,
int ret = 0;
u32 dcfg;
 
-   ep0-sent_zlp = 0;
-
dev_dbg(hsotg-dev, ctrl Req=%02x, Type=%02x, V=%04x, L=%04x\n,
 ctrl-bRequest, ctrl-bRequestType,
 ctrl-wValue, ctrl-wLength);
 
-   /*
-* record the direction of the request, for later use when enquing
-* packets onto EP0.
-*/
-
-   ep0-dir_in = (ctrl-bRequestType  USB_DIR_IN) ? 1 : 0;
-   dev_dbg(hsotg-dev, ctrl: dir_in=%d\n, ep0-dir_in);
-
-   /*
-* if we've no data with this request, then the last part of the
-* transaction is going to implicitly be IN.
-*/
-   if (ctrl-wLength == 0)
+   if (ctrl-wLength == 0) {
ep0-dir_in = 1;
+   hsotg-ep0_state = DWC2_EP0_STATUS_IN;
+   } else if (ctrl-bRequestType  USB_DIR_IN) {
+   ep0-dir_in = 1;
+   hsotg-ep0_state = DWC2_EP0_DATA_IN;
+   } else {
+   ep0-dir_in = 0;
+   hsotg-ep0_state = DWC2_EP0_DATA_OUT;
+   }
 
if ((ctrl-bRequestType  USB_TYPE_MASK) == USB_TYPE_STANDARD) {
switch (ctrl-bRequest) {
@@ -1201,6 +1190,8 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg 
*hsotg)
}
 
hsotg-eps_out[0]-dir_in = 0;
+   hsotg-eps_out[0]-sent_zlp = 0;
+   hsotg-ep0_state = DWC2_EP0_SETUP;
 
ret = s3c_hsotg_ep_queue(hsotg-eps_out[0]-ep, req, GFP_ATOMIC);
if (ret  0) {
@@ -1212,6 +1203,27 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg 
*hsotg)
}
 }
 
+static void s3c_hsotg_program_zlp(struct dwc2_hsotg *hsotg,
+   struct s3c_hsotg_ep *hs_ep)
+{
+   u32 ctrl;
+   u8 index 

[PATCH 14/29] usb: dwc2: gadget: fix debug loop limits

2014-12-18 Thread Mian Yousaf Kaukab
 15 check doesn't show debug information for endpoint 15.
It is possible to have less than 15 endpoints so use limit
provided by hardware configuration.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 3706a9d..d6a0a6e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3159,14 +3159,14 @@ static void s3c_hsotg_dump(struct dwc2_hsotg *hsotg)
 
/* show periodic fifo settings */
 
-   for (idx = 1; idx = 15; idx++) {
+   for (idx = 1; idx  hsotg-num_of_eps; idx++) {
val = readl(regs + DPTXFSIZN(idx));
dev_info(dev, DPTx[%d] FSize=%d, StAddr=0x%08x\n, idx,
 val  FIFOSIZE_DEPTH_SHIFT,
 val  FIFOSIZE_STARTADDR_MASK);
}
 
-   for (idx = 0; idx  15; idx++) {
+   for (idx = 0; idx  hsotg-num_of_eps; idx++) {
dev_info(dev,
 ep%d-in: EPCTL=0x%08x, SIZ=0x%08x, DMA=0x%08x\n, idx,
 readl(regs + DIEPCTL(idx)),
@@ -3224,7 +3224,7 @@ static int state_show(struct seq_file *seq, void *v)
 
seq_puts(seq, \nEndpoint status:\n);
 
-   for (idx = 0; idx  15; idx++) {
+   for (idx = 0; idx  hsotg-num_of_eps; idx++) {
u32 in, out;
 
in = readl(regs + DIEPCTL(idx));
@@ -3283,7 +3283,7 @@ static int fifo_show(struct seq_file *seq, void *v)
 
seq_puts(seq, \nPeriodic TXFIFOs:\n);
 
-   for (idx = 1; idx = 15; idx++) {
+   for (idx = 1; idx  hsotg-num_of_eps; idx++) {
val = readl(regs + DPTXFSIZN(idx));
 
seq_printf(seq, \tDPTXFIFO%2d: Size %d, Start 0x%08x\n, idx,
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 28/29] usb: dwc2: gadget: force gadget initialization in dev mode

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

When booting with id pin grounded, dwc2 default to host mode.
Thus, force device mode prior initializing gadget part.
Else fifo init will fail since fifo values are not correct
in host mode.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8afac3c..8b6f5c5 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3693,6 +3693,19 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
/* usb phy enable */
s3c_hsotg_phy_enable(hsotg);
 
+   /*
+* Force Device mode before initialization.
+* This allows correctly configuring fifo for device mode.
+*/
+   __bic32(hsotg-regs + GUSBCFG, GUSBCFG_FORCEHOSTMODE);
+   __orr32(hsotg-regs + GUSBCFG, GUSBCFG_FORCEDEVMODE);
+
+   /*
+* According to Synopsys databook, this sleep is needed for the force
+* device mode to take effect.
+*/
+   msleep(25);
+
s3c_hsotg_corereset(hsotg);
ret = s3c_hsotg_hw_cfg(hsotg);
if (ret) {
@@ -3702,6 +3715,9 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 
s3c_hsotg_init(hsotg);
 
+   /* Switch back to default configuration */
+   __bic32(hsotg-regs + GUSBCFG, GUSBCFG_FORCEDEVMODE);
+
hsotg-ctrl_buff = devm_kzalloc(hsotg-dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
if (!hsotg-ctrl_buff) {
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 22/29] usb: dwc2: gadget: rename sent_zlp to send_zlp

2014-12-18 Thread Mian Yousaf Kaukab
This flag is set before sending the zlp. So use present tense instead
of the past tense.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/core.h   | 4 ++--
 drivers/usb/dwc2/gadget.c | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 1801785..c0ddc6c 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -108,7 +108,7 @@ struct s3c_hsotg_req;
  * @halted: Set if the endpoint has been halted.
  * @periodic: Set if this is a periodic ep, such as Interrupt
  * @isochronous: Set if this is a isochronous ep
- * @sent_zlp: Set if we've sent a zero-length packet.
+ * @send_zlp: Set if we need to send a zero-length packet.
  * @total_data: The total number of data bytes done.
  * @fifo_size: The size of the FIFO (for periodic IN endpoints)
  * @fifo_load: The amount of data loaded into the FIFO (periodic IN)
@@ -149,7 +149,7 @@ struct s3c_hsotg_ep {
unsigned inthalted:1;
unsigned intperiodic:1;
unsigned intisochronous:1;
-   unsigned intsent_zlp:1;
+   unsigned intsend_zlp:1;
 
charname[10];
 };
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6e68ad9..a7329b1 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -610,7 +610,7 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
/* Test if zlp is actually required. */
if ((ureq-length = hs_ep-ep.maxpacket) 
!(ureq-length % hs_ep-ep.maxpacket))
-   hs_ep-sent_zlp = 1;
+   hs_ep-send_zlp = 1;
}
 
epsize |= DXEPTSIZ_PKTCNT(packets);
@@ -1196,7 +1196,7 @@ static void s3c_hsotg_enqueue_setup(struct dwc2_hsotg 
*hsotg)
}
 
hsotg-eps_out[0]-dir_in = 0;
-   hsotg-eps_out[0]-sent_zlp = 0;
+   hsotg-eps_out[0]-send_zlp = 0;
hsotg-ep0_state = DWC2_EP0_SETUP;
 
ret = s3c_hsotg_ep_queue(hsotg-eps_out[0]-ep, req, GFP_ATOMIC);
@@ -1754,9 +1754,9 @@ static void s3c_hsotg_complete_in(struct dwc2_hsotg 
*hsotg,
}
 
/* Zlp for all endpoints, for ep0 only in DATA IN stage */
-   if (hs_ep-sent_zlp) {
+   if (hs_ep-send_zlp) {
s3c_hsotg_program_zlp(hsotg, hs_ep);
-   hs_ep-sent_zlp = 0;
+   hs_ep-send_zlp = 0;
/* transfer will be completed on next complete interrupt */
return;
}
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 18/29] usb: dwc2: gadget: fix zero length packet transfers

2014-12-18 Thread Mian Yousaf Kaukab
According to programming guide, zero length packet should be
programmed on its own and should not be counted in DIEPTSIZ.PktCnt
with other packets.

For ep0, this is the zlp for DATA IN stage (if required) and not for
the STATUS stage.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 51 ---
 1 file changed, 22 insertions(+), 29 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 523e107..d7bcdcd 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -601,14 +601,15 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
else
epsize = 0;
 
-   if (index != 0  ureq-zero) {
-   /*
-* test for the packets being exactly right for the
-* transfer
-*/
-
-   if (length == (packets * hs_ep-ep.maxpacket))
-   packets++;
+   /*
+* zero length packet should be programmed on its own and should not
+* be counted in DIEPTSIZ.PktCnt with other packets.
+*/
+   if (dir_in  ureq-zero  !continuing) {
+   /* Test if zlp is actually required. */
+   if ((ureq-length = hs_ep-ep.maxpacket) 
+   !(ureq-length % hs_ep-ep.maxpacket))
+   hs_ep-sent_zlp = 1;
}
 
epsize |= DXEPTSIZ_PKTCNT(packets);
@@ -860,7 +861,11 @@ static int s3c_hsotg_send_reply(struct dwc2_hsotg *hsotg,
 
req-buf = hsotg-ep0_buff;
req-length = length;
-   req-zero = 1; /* always do zero-length final transfer */
+   /*
+* zero flag is for sending zlp in DATA IN stage. It has no impact on
+* STATUS stage.
+*/
+   req-zero = 0;
req-complete = s3c_hsotg_complete_oursetup;
 
if (length)
@@ -1741,32 +1746,20 @@ static void s3c_hsotg_complete_in(struct dwc2_hsotg 
*hsotg,
dev_dbg(hsotg-dev, req-length:%d req-actual:%d req-zero:%d\n,
hs_req-req.length, hs_req-req.actual, hs_req-req.zero);
 
-   /*
-* Check if dealing with Maximum Packet Size(MPS) IN transfer at EP0
-* When sent data is a multiple MPS size (e.g. 64B ,128B ,192B
-* ,256B ... ), after last MPS sized packet send IN ZLP packet to
-* inform the host that no more data is available.
-* The state of req.zero member is checked to be sure that the value to
-* send is smaller than wValue expected from host.
-* Check req.length to NOT send another ZLP when the current one is
-* under completion (the one for which this completion has been called).
-*/
-   if (hs_req-req.length  hs_ep-index == 0  hs_req-req.zero 
-   hs_req-req.length == hs_req-req.actual 
-   !(hs_req-req.length % hs_ep-ep.maxpacket)) {
-
-   dev_dbg(hsotg-dev, ep0 zlp IN packet sent\n);
-   s3c_hsotg_program_zlp(hsotg, hs_ep);
-
-   return;
-   }
-
if (!size_left  hs_req-req.actual  hs_req-req.length) {
dev_dbg(hsotg-dev, %s trying more for req...\n, __func__);
s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true);
return;
}
 
+   /* Zlp for all endpoints, for ep0 only in DATA IN stage */
+   if (hs_ep-sent_zlp) {
+   s3c_hsotg_program_zlp(hsotg, hs_ep);
+   hs_ep-sent_zlp = 0;
+   /* transfer will be completed on next complete interrupt */
+   return;
+   }
+
if (hs_ep-index == 0  hsotg-ep0_state == DWC2_EP0_DATA_IN) {
/* Move to STATUS OUT */
s3c_hsotg_ep0_zlp(hsotg, false);
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 10/29] usb: dwc2: gadget: check interrupts for all endpoints

2014-12-18 Thread Mian Yousaf Kaukab
Current code does not check endpoint 15 interrupt. Use number
of endpoint configured in hardware instead of the hardcoded value.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index c5df746..ebc73ed 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2341,12 +2341,14 @@ irq_retry:
 
dev_dbg(hsotg-dev, %s: daint=%08x\n, __func__, daint);
 
-   for (ep = 0; ep  15  daint_out; ep++, daint_out = 1) {
+   for (ep = 0; ep  hsotg-num_of_eps  daint_out;
+   ep++, daint_out = 1) {
if (daint_out  1)
s3c_hsotg_epint(hsotg, ep, 0);
}
 
-   for (ep = 0; ep  15  daint_in; ep++, daint_in = 1) {
+   for (ep = 0; ep  hsotg-num_of_eps   daint_in;
+   ep++, daint_in = 1) {
if (daint_in  1)
s3c_hsotg_epint(hsotg, ep, 1);
}
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 27/29] usb: dwc2: gadget: add vbus_draw support

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

This callback informs the driver about the total amount of current it
is allowed to draw. Share this information with the phy so that
current limits can be set for charging for example.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index f8e928e..8afac3c 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3049,12 +3049,29 @@ static int s3c_hsotg_vbus_session(struct usb_gadget 
*gadget, int is_active)
return 0;
 }
 
+/**
+ * s3c_hsotg_vbus_draw - report bMaxPower field
+ * @gadget: The usb gadget state
+ * @mA: Amount of current
+ *
+ * Report how much power the device may consume to the phy.
+ */
+static int s3c_hsotg_vbus_draw(struct usb_gadget *gadget, unsigned mA)
+{
+   struct dwc2_hsotg *hsotg = to_hsotg(gadget);
+
+   if (IS_ERR_OR_NULL(hsotg-uphy))
+   return -ENOTSUPP;
+   return usb_phy_set_power(hsotg-uphy, mA);
+}
+
 static const struct usb_gadget_ops s3c_hsotg_gadget_ops = {
.get_frame  = s3c_hsotg_gadget_getframe,
.udc_start  = s3c_hsotg_udc_start,
.udc_stop   = s3c_hsotg_udc_stop,
.pullup = s3c_hsotg_pullup,
.vbus_session   = s3c_hsotg_vbus_session,
+   .vbus_draw  = s3c_hsotg_vbus_draw,
 };
 
 /**
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 20/29] usb: dwc2: gadget: don't block after fifo flush timeout

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Can't stay in the loop forever. Break it after timeout.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index bf1b209..0261d6b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -233,6 +233,7 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
dev_err(hsotg-dev,
%s: timeout flushing fifos (GRSTCTL=%08x)\n,
__func__, val);
+   break;
}
 
udelay(1);
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 12/29] Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
b/Documentation/devicetree/bindings/usb/dwc2.txt
index 5e9712f..6da4393 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -21,6 +21,9 @@ Refer to phy/phy-bindings.txt for generic phy consumer 
properties
 - dr_mode: shall be one of host, peripheral and otg
   Refer to usb/generic.txt
 - g_use_dma: enable dma usage in gadget driver.
+- g_rx_fifo_size: size of rx fifo size in gadget mode.
+- g_np_tx_fifo_size: size of non-periodic tx fifo size in gadget mode.
+- g_tx_fifo_size: size of periodic tx fifo per endpoint (except ep0) in gadget 
mode.
 
 Example:
 
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 29/29] usb: dwc2: gadget: report disconnection after reset

2014-12-18 Thread Mian Yousaf Kaukab
If usb bus is reset without a physical disconnection, all endpoints
will remain open. Call s3c_hsotg_disconnect() from reset handler to
report a disconnect to gadget framework. hsotg-connected is checked
in s3c_hsotg_disconnect() before processing disconnect.

In some cases, USBRst is seen before EnumDone and after it as well.
So move setting of hsotg-connected to set-address to avoid reporting
extra disconnection in this case.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8b6f5c5..f05eb95 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1106,6 +1106,7 @@ static void s3c_hsotg_process_control(struct dwc2_hsotg 
*hsotg,
if ((ctrl-bRequestType  USB_TYPE_MASK) == USB_TYPE_STANDARD) {
switch (ctrl-bRequest) {
case USB_REQ_SET_ADDRESS:
+   hsotg-connected = 1;
dcfg = readl(hsotg-regs + DCFG);
dcfg = ~DCFG_DEVADDR_MASK;
dcfg |= (le16_to_cpu(ctrl-wValue) 
@@ -2305,7 +2306,6 @@ irq_retry:
writel(GINTSTS_ENUMDONE, hsotg-regs + GINTSTS);
 
s3c_hsotg_irq_enumdone(hsotg);
-   hsotg-connected = 1;
}
 
if (gintsts  (GINTSTS_OEPINT | GINTSTS_IEPINT)) {
@@ -2343,6 +2343,9 @@ irq_retry:
 
writel(GINTSTS_USBRST, hsotg-regs + GINTSTS);
 
+   /* Report disconnection if it is not already done. */
+   s3c_hsotg_disconnect(hsotg);
+
if (usb_status  GOTGCTL_BSESVLD) {
if (time_after(jiffies, hsotg-last_rst +
   msecs_to_jiffies(200))) {
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 15/29] usb: dwc2: gadget: consider all tx fifos

2014-12-18 Thread Mian Yousaf Kaukab
When matching tx fifo to endpoint, consider all fifos instead of
hard limiting to 8
Moreover, print error in case no fifo could be found.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d6a0a6e..28d830b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2547,7 +2547,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 */
if (dir_in  hsotg-dedicated_fifos) {
size = hs_ep-ep.maxpacket*hs_ep-mc;
-   for (i = 1; i = 8; ++i) {
+   for (i = 1; i  hsotg-num_of_eps; ++i) {
if (hsotg-fifo_map  (1i))
continue;
val = readl(hsotg-regs + DPTXFSIZN(i));
@@ -2561,7 +2561,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
hs_ep-fifo_size = val;
break;
}
-   if (i == 8) {
+   if (i == hsotg-num_of_eps) {
+   dev_err(hsotg-dev,
+   %s: No suitable fifo found\n, __func__);
ret = -ENOMEM;
goto error;
}
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 06/29] usb: dwc2: gadget: don't erase gahbcfg register when enabling dma

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0b08d4a..58699c3 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2831,8 +2831,8 @@ static void s3c_hsotg_init(struct dwc2_hsotg *hsotg)
writel(GUSBCFG_PHYIF16 | GUSBCFG_TOUTCAL(7) | (0x5  10),
   hsotg-regs + GUSBCFG);
 
-   writel(using_dma(hsotg) ? GAHBCFG_DMA_EN : 0x0,
-  hsotg-regs + GAHBCFG);
+   if (using_dma(hsotg))
+   __orr32(hsotg-regs + GAHBCFG, GAHBCFG_DMA_EN);
 }
 
 /**
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 19/29] usb: dwc2: gadget: dont warn if endpoint is not enabled

2014-12-18 Thread Mian Yousaf Kaukab
The warning is probably good but it has false positives in both dma and non-dma
cases. So its not very helpful in either.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d7bcdcd..bf1b209 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -681,7 +681,7 @@ static void s3c_hsotg_start_req(struct dwc2_hsotg *hsotg,
 
/* check ep is enabled */
if (!(readl(hsotg-regs + epctrl_reg)  DXEPCTL_EPENA))
-   dev_warn(hsotg-dev,
+   dev_dbg(hsotg-dev,
 ep%d: failed to become enabled (DXEPCTL=0x%08x)?\n,
 index, readl(hsotg-regs + epctrl_reg));
 
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 21/29] usb: dwc2: gadget: add vbus_session support

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Enable phy driver to report vbus session. This allows us to remove
D+ pullup when vbus is not present.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0261d6b..6e68ad9 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3005,11 +3005,35 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, 
int is_on)
return 0;
 }
 
+static int s3c_hsotg_vbus_session(struct usb_gadget *gadget, int is_active)
+{
+   struct dwc2_hsotg *hsotg = to_hsotg(gadget);
+   unsigned long flags;
+
+   dev_dbg(hsotg-dev, %s: is_active: %d\n, __func__, is_active);
+   spin_lock_irqsave(hsotg-lock, flags);
+
+   if (is_active) {
+   /* Kill any ep0 requests as controller will be reinitialized */
+   kill_all_requests(hsotg, hsotg-eps_out[0], -ECONNRESET, true);
+   s3c_hsotg_core_init_disconnected(hsotg);
+   if (hsotg-enabled)
+   s3c_hsotg_core_connect(hsotg);
+   } else {
+   s3c_hsotg_core_disconnect(hsotg);
+   s3c_hsotg_disconnect(hsotg);
+   }
+
+   spin_unlock_irqrestore(hsotg-lock, flags);
+   return 0;
+}
+
 static const struct usb_gadget_ops s3c_hsotg_gadget_ops = {
.get_frame  = s3c_hsotg_gadget_getframe,
.udc_start  = s3c_hsotg_udc_start,
.udc_stop   = s3c_hsotg_udc_stop,
.pullup = s3c_hsotg_pullup,
+   .vbus_session   = s3c_hsotg_vbus_session,
 };
 
 /**
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 23/29] usb: dwc2: gadget: pick smallest acceptable fifo

2014-12-18 Thread Mian Yousaf Kaukab
Current algorithm picks the first fifo which is equal to or greater
than the required size. This can result in bigger fifos assigned to
endpoints with smaller maxps. Change the algorithm to pick the
smallest fifo which is greater than or equal to the required size.

Moreover, only use signed variables when required.

Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index a7329b1..e06cac0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2439,12 +2439,12 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct dwc2_hsotg *hsotg = hs_ep-parent;
unsigned long flags;
-   int index = hs_ep-index;
+   unsigned int index = hs_ep-index;
u32 epctrl_reg;
u32 epctrl;
u32 mps;
-   int dir_in;
-   int i, val, size;
+   unsigned int dir_in;
+   unsigned int i, val, size;
int ret = 0;
 
dev_dbg(hsotg-dev,
@@ -2533,6 +2533,8 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
 * a unique tx-fifo even if it is non-periodic.
 */
if (dir_in  hsotg-dedicated_fifos) {
+   u32 fifo_index = 0;
+   u32 fifo_size = UINT_MAX;
size = hs_ep-ep.maxpacket*hs_ep-mc;
for (i = 1; i  hsotg-num_of_eps; ++i) {
if (hsotg-fifo_map  (1i))
@@ -2541,19 +2543,22 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
val = (val  FIFOSIZE_DEPTH_SHIFT)*4;
if (val  size)
continue;
-   hsotg-fifo_map |= 1i;
-
-   epctrl |= DXEPCTL_TXFNUM(i);
-   hs_ep-fifo_index = i;
-   hs_ep-fifo_size = val;
-   break;
+   /* Search for smallest acceptable fifo */
+   if (val  fifo_size) {
+   fifo_size = val;
+   fifo_index = i;
+   }
}
-   if (i == hsotg-num_of_eps) {
+   if (!fifo_index) {
dev_err(hsotg-dev,
%s: No suitable fifo found\n, __func__);
ret = -ENOMEM;
goto error;
}
+   hsotg-fifo_map |= 1  fifo_index;
+   epctrl |= DXEPCTL_TXFNUM(fifo_index);
+   hs_ep-fifo_index = fifo_index;
+   hs_ep-fifo_size = fifo_size;
}
 
/* for non control endpoints, set PID to D0 */
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 08/29] Documentation: dt-bindings: add dt binding info for dwc2 g_use_dma

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Indicate if gadget driver must use dma for usb transfers.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 Documentation/devicetree/bindings/usb/dwc2.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt 
b/Documentation/devicetree/bindings/usb/dwc2.txt
index 482f815..5e9712f 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -20,6 +20,7 @@ Optional properties:
 Refer to phy/phy-bindings.txt for generic phy consumer properties
 - dr_mode: shall be one of host, peripheral and otg
   Refer to usb/generic.txt
+- g_use_dma: enable dma usage in gadget driver.
 
 Example:
 
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 26/29] usb: dwc2: gadget: fix pullup handling

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

Gadget must be informed about disconnection when pullup is
removed.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
---
 drivers/usb/dwc2/gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index a77fb3e..f8e928e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3014,6 +3014,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, 
int is_on)
s3c_hsotg_core_connect(hsotg);
} else {
s3c_hsotg_core_disconnect(hsotg);
+   s3c_hsotg_disconnect(hsotg);
hsotg-enabled = 0;
clk_disable(hsotg-clk);
}
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 25/29] usb: dwc2: gadget: reset fifo_map when initializing fifos

2014-12-18 Thread Mian Yousaf Kaukab
From: Gregory Herrero gregory.herr...@intel.com

After all endpoints are disabled, fifo_map should have reached 0.
Its a bug if if didn't, so warn about it and reset it to 0 so that
driver can continue using all the fifos.

Signed-off-by: Gregory Herrero gregory.herr...@intel.com
Signed-off-by: Mian Yousaf Kaukab yousaf.kau...@intel.com
---
 drivers/usb/dwc2/gadget.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d9d670b..a77fb3e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -177,6 +177,10 @@ static void s3c_hsotg_init_fifo(struct dwc2_hsotg *hsotg)
int timeout;
u32 val;
 
+   /* Reset fifo map if not correctly cleared during previous session */
+   WARN_ON(hsotg-fifo_map);
+   hsotg-fifo_map = 0;
+
/* set RX/NPTX FIFO sizes */
writel(hsotg-g_rx_fifo_sz, hsotg-regs + GRXFSIZ);
writel((hsotg-g_rx_fifo_sz  FIFOSIZE_STARTADDR_SHIFT) |
-- 
1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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 00/29] usb: updates for dwc2 gadget driver

2014-12-18 Thread Kaukab, Yousaf
Hi,
Apologies for the email footer. It is automatically being appended by the smtp 
server. I need to talk to IT folks here to get this fixed.

BR,
Yousaf

 -Original Message-
 From: Kaukab, Yousaf
 Sent: Thursday, December 18, 2014 7:53 PM
 To: linux-usb@vger.kernel.org; ba...@ti.com
 Cc: Herrero, Gregory; pa...@synopsys.com; Kaukab, Yousaf
 Subject: [PATCH 00/29] usb: updates for dwc2 gadget driver
 
 Hi,
 This patchset consists of various bug fixes and feature enhancements for the
 dwc2 gadget driver. All the patches are verified on dwc2 v3.0a with dedicated
 fifos. Main focus of testing was with dma enabled. Although basic testing
 without dma was also done.
 
 It is based on linux-next tag next-20141218.
 
 Thank you,
 
 Best regards,
 Yousaf
 
 Gregory Herrero (13):
   usb: dwc2: gadget: register gadget handle to the phy
   usb: dwc2: gadget: write correct value in ahbcfg register
   usb: dwc2: gadget: don't erase gahbcfg register when enabling dma
   usb: dwc2: gadget: add device tree property to enable dma
   Documentation: dt-bindings: add dt binding info for dwc2 g_use_dma
   usb: dwc2: gadget: configure fifos from device tree
   Documentation: dt-bindings: add dt binding info for dwc2 fifo resizing
   usb: dwc2: gadget: don't block after fifo flush timeout
   usb: dwc2: gadget: add vbus_session support
   usb: dwc2: gadget: reset fifo_map when initializing fifos
   usb: dwc2: gadget: fix pullup handling
   usb: dwc2: gadget: add vbus_draw support
   usb: dwc2: gadget: force gadget initialization in dev mode
 
 Mian Yousaf Kaukab (16):
   usb: dwc2: gadget: mask fifo empty irq with dma
   usb: dwc2: gadget: process setup packet on transfer complete
   usb: dwc2: gadget: don't embedded ep0 buffers
   usb: dwc2: gadget: add bi-directional endpoint support
   usb: dwc2: gadget: check interrupts for all endpoints
   usb: dwc2: gadget: remove unused members from hsotg_req
   usb: dwc2: gadget: fix debug loop limits
   usb: dwc2: gadget: consider all tx fifos
   usb: dwc2: gadget: kill requests after disabling ep
   usb: dwc2: gadget: manage ep0 state in software
   usb: dwc2: gadget: fix zero length packet transfers
   usb: dwc2: gadget: dont warn if endpoint is not enabled
   usb: dwc2: gadget: rename sent_zlp to send_zlp
   usb: dwc2: gadget: pick smallest acceptable fifo
   usb: dwc2: gadget: fix fifo allocation leak
   usb: dwc2: gadget: report disconnection after reset
 
  Documentation/devicetree/bindings/usb/dwc2.txt |   4 +
  drivers/usb/dwc2/core.h|  46 +-
  drivers/usb/dwc2/gadget.c  | 874 
 -
  drivers/usb/dwc2/hw.h  |   1 +
  4 files changed, 602 insertions(+), 323 deletions(-)
 
 --
 1.9.1

--
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
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: Lockdep problem: v3.18+ (with yesterday's Linus tip - 6f51ee709e4c)

2014-12-18 Thread Alan Stern
On Thu, 18 Dec 2014, Russell King - ARM Linux wrote:

 While unplugging a Logitek Keyboard/mouse micro-receiver, I got the
 lockdep splat below.
 
 However, I don't fully understand this splat - I see nothing in
 flush_work() nor process_one_work() making use of intf-reset_ws -
 which seems to be a USB thing.  I guess lockdep is being re-used to
 validate work stuff, and lock is just plain misleading.

That sounds right.  intf-reset_ws is a work_struct for a reset 
request.

 usb 2-1.1: USB disconnect, device number 3
 
 =
 [ INFO: possible recursive locking detected ]
 3.18.0+ #1459 Not tainted
 -
 kworker/0:1/2758 is trying to acquire lock:
  ((intf-reset_ws)){+.+.+.}, at: [c003ba90] flush_work+0x0/0x264
 
 but task is already holding lock:
  ((intf-reset_ws)){+.+.+.}, at: [c003ca40] process_one_work+0x130/0x4b4

I think what happened is that we called cancel_work_sync() for the 
reset_ws embedded in one intf structure while running in the workqueue 
routine for the reset_ws embedded in a different intf structure.

Assuming this interpretation is correct, I don't see how we can prevent 
lockdep from making this mistake.  Here's the problem:

An interface driver can queue a request for a reset.

A reset can cause interface drivers to be unbound from their
interfaces.

If an interface driver is unbound, any pending reset request 
that it queued has to be cancelled.  Otherwise the workqueue
would most likely end up carrying out the reset at a later time 
when nobody wants it.

(The code contains explicit protection for the case where the interface 
being unbound is the one whose reset request is currently in progress.)

Now perhaps we don't need that last step.  We could allow a queued
reset to take place even after the driver that requested it is gone.  
Most of the time these reset requests occur in response to I/O errors
when a USB device is unplugged -- as happened in this example -- in
which case it doesn't matter what we do.

So even though it's not entirely pleasant, my inclination is to solve
the problem by getting rid of usb_cancel_queued_reset() in
drivers/usb/core/driver.c.

Comments, anybody?

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: Lockdep problem: v3.18+ (with yesterday's Linus tip - 6f51ee709e4c)

2014-12-18 Thread Greg Kroah-Hartman
On Thu, Dec 18, 2014 at 02:40:48PM -0500, Alan Stern wrote:
 On Thu, 18 Dec 2014, Russell King - ARM Linux wrote:
 
  While unplugging a Logitek Keyboard/mouse micro-receiver, I got the
  lockdep splat below.
  
  However, I don't fully understand this splat - I see nothing in
  flush_work() nor process_one_work() making use of intf-reset_ws -
  which seems to be a USB thing.  I guess lockdep is being re-used to
  validate work stuff, and lock is just plain misleading.
 
 That sounds right.  intf-reset_ws is a work_struct for a reset 
 request.
 
  usb 2-1.1: USB disconnect, device number 3
  
  =
  [ INFO: possible recursive locking detected ]
  3.18.0+ #1459 Not tainted
  -
  kworker/0:1/2758 is trying to acquire lock:
   ((intf-reset_ws)){+.+.+.}, at: [c003ba90] flush_work+0x0/0x264
  
  but task is already holding lock:
   ((intf-reset_ws)){+.+.+.}, at: [c003ca40] process_one_work+0x130/0x4b4
 
 I think what happened is that we called cancel_work_sync() for the 
 reset_ws embedded in one intf structure while running in the workqueue 
 routine for the reset_ws embedded in a different intf structure.
 
 Assuming this interpretation is correct, I don't see how we can prevent 
 lockdep from making this mistake.  Here's the problem:
 
   An interface driver can queue a request for a reset.
 
   A reset can cause interface drivers to be unbound from their
   interfaces.
 
   If an interface driver is unbound, any pending reset request 
   that it queued has to be cancelled.  Otherwise the workqueue
   would most likely end up carrying out the reset at a later time 
   when nobody wants it.
 
 (The code contains explicit protection for the case where the interface 
 being unbound is the one whose reset request is currently in progress.)
 
 Now perhaps we don't need that last step.  We could allow a queued
 reset to take place even after the driver that requested it is gone.  
 Most of the time these reset requests occur in response to I/O errors
 when a USB device is unplugged -- as happened in this example -- in
 which case it doesn't matter what we do.
 
 So even though it's not entirely pleasant, my inclination is to solve
 the problem by getting rid of usb_cancel_queued_reset() in
 drivers/usb/core/driver.c.
 
 Comments, anybody?

That seems reasonable to me, unbinding when a reset is happening is
going to be a rare condition, but if we get rid of it, and we try to
queue a reset for a device that is gone, we will just fail the reset,
right?  If all should be fine, I have no objection to removing it.

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


RE: [PATCH v2] renesas_usbhs: fix platform init error message

2014-12-18 Thread yoshihiro shimoda
Hello,

 -Original Message-
 From: Sergei Shtylyov [mailto:sergei.shtyl...@cogentembedded.com]
 Sent: Thursday, December 18, 2014 8:32 PM
 
 Hello.
 
 On 12/18/2014 4:46 AM, yoshihiro shimoda wrote:
 
 [...]
 
  There is a typo (prove instead of probe) in the error message 
  printed when
  the platform initialization fails. Replace that word with more fitting 
  init.
 
  Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com
 
  this actually goes through me, I'll take it in a bit.
 
  Er, OK. Could you update MAINTAINERS?
 
  there is no entry for renesas driver in MAINTAINERS.
 
  Shimoda-san, care to send a patch adding yourself or Morimoto-san as
  maintainers for Renesas driver and pointing to my tree in kernel.org ?
 
  I would like to move the renesas_usbhs driver to drivers/usb/gadget/udc 
  somehow.
  Because the driver is almost used for a gadget driver.
  The driver has a host driver support now. But, it is not used recently.
 
  After that, this MAINTAINERS issue becomes clear, I think.
  Felipe-san and Sergei-san, what do you think?
 
 I'm against such move.

Thank you for the reply. But, I would like to know why you are against such 
move.

Best regards,
Yoshihiro Shimoda

  Best regards,
  Yoshihiro Shimoda
 
 WBR, Sergei

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] PM: Eliminate CONFIG_PM_RUNTIME

2014-12-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki rafael.j.wyso...@intel.com

Having switched over all of the users of CONFIG_PM_RUNTIME to use
CONFIG_PM directly, turn the latter into a user-selectable option
and drop the former entirely from the tree.

Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
---
 arch/arm/configs/ape6evm_defconfig |2 +-
 arch/arm/configs/armadillo800eva_defconfig |2 +-
 arch/arm/configs/bcm_defconfig |2 +-
 arch/arm/configs/bockw_defconfig   |2 +-
 arch/arm/configs/davinci_all_defconfig |2 +-
 arch/arm/configs/exynos_defconfig  |2 +-
 arch/arm/configs/ezx_defconfig |2 +-
 arch/arm/configs/hisi_defconfig|2 +-
 arch/arm/configs/imote2_defconfig  |2 +-
 arch/arm/configs/imx_v6_v7_defconfig   |2 +-
 arch/arm/configs/keystone_defconfig|2 +-
 arch/arm/configs/kzm9g_defconfig   |2 +-
 arch/arm/configs/lager_defconfig   |2 +-
 arch/arm/configs/mackerel_defconfig|2 +-
 arch/arm/configs/marzen_defconfig  |2 +-
 arch/arm/configs/omap1_defconfig   |2 +-
 arch/arm/configs/prima2_defconfig  |2 +-
 arch/arm/configs/sama5_defconfig   |2 +-
 arch/arm/configs/shmobile_defconfig|2 +-
 arch/arm/configs/sunxi_defconfig   |2 +-
 arch/arm/configs/tegra_defconfig   |2 +-
 arch/arm/configs/u8500_defconfig   |2 +-
 arch/arm/configs/vt8500_v6_v7_defconfig|2 +-
 arch/arm/mach-omap2/Kconfig|6 +++---
 arch/mips/configs/db1xxx_defconfig |2 +-
 arch/mips/configs/lemote2f_defconfig   |2 +-
 arch/mips/configs/loongson3_defconfig  |2 +-
 arch/mips/configs/nlm_xlp_defconfig|2 +-
 arch/mips/configs/nlm_xlr_defconfig|2 +-
 arch/powerpc/configs/ps3_defconfig |2 +-
 arch/sh/Kconfig|2 +-
 arch/sh/configs/apsh4ad0a_defconfig|2 +-
 arch/sh/configs/sdk7786_defconfig  |2 +-
 drivers/usb/host/isp1760-hcd.c |2 +-
 drivers/usb/host/oxu210hp-hcd.c|2 +-
 include/linux/devfreq.h|2 +-
 kernel/power/Kconfig   |   16 ++--
 37 files changed, 44 insertions(+), 48 deletions(-)

Index: linux-pm/arch/arm/configs/ape6evm_defconfig
===
--- linux-pm.orig/arch/arm/configs/ape6evm_defconfig
+++ linux-pm/arch/arm/configs/ape6evm_defconfig
@@ -33,7 +33,7 @@ CONFIG_ARM_APPENDED_DTB=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_BINFMT_MISC=y
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
Index: linux-pm/arch/arm/configs/armadillo800eva_defconfig
===
--- linux-pm.orig/arch/arm/configs/armadillo800eva_defconfig
+++ linux-pm/arch/arm/configs/armadillo800eva_defconfig
@@ -43,7 +43,7 @@ CONFIG_KEXEC=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
Index: linux-pm/arch/arm/configs/bcm_defconfig
===
--- linux-pm.orig/arch/arm/configs/bcm_defconfig
+++ linux-pm/arch/arm/configs/bcm_defconfig
@@ -39,7 +39,7 @@ CONFIG_CPU_IDLE=y
 CONFIG_VFP=y
 CONFIG_NEON=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_PACKET_DIAG=y
Index: linux-pm/arch/arm/configs/bockw_defconfig
===
--- linux-pm.orig/arch/arm/configs/bockw_defconfig
+++ linux-pm/arch/arm/configs/bockw_defconfig
@@ -29,7 +29,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_VFP=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
Index: linux-pm/arch/arm/configs/davinci_all_defconfig
===
--- linux-pm.orig/arch/arm/configs/davinci_all_defconfig
+++ linux-pm/arch/arm/configs/davinci_all_defconfig
@@ -49,7 +49,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_ONDEMAND=m
 CONFIG_CPU_IDLE=y
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
Index: linux-pm/arch/arm/configs/exynos_defconfig
===
--- linux-pm.orig/arch/arm/configs/exynos_defconfig
+++ linux-pm/arch/arm/configs/exynos_defconfig
@@ -27,7 +27,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_CMDLINE=root=/dev/ram0 rw ramdisk=8192 initrd=0x4100,8M 
console=ttySAC1,115200 init=/linuxrc mem=256M
 CONFIG_VFP=y
 CONFIG_NEON=y
-CONFIG_PM_RUNTIME=y
+CONFIG_PM=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
Index: 

Proper delay function in host driver

2014-12-18 Thread vichy
hi all:
For HW bug, we have to mdelay(100) in getting root hub port status.
But it suffer system performance.
(The place we need to add is like below)
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 388cfd8..9a6b841 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -760,6 +760,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16
typeReq, u16 wValue,
retval = -ENODEV;
break;
}
+   mdelay(100);
status = xhci_get_port_status(hcd, bus_state, port_array,
wIndex, temp, flags);
if (status == 0x)


Then I try to use msleep(100) but I found hub_port_status will first
mutex_lock(hub-status_mutex); then calling get_port_status.
That mean the deadlock may happen.
Is there any better way to do so?

appreciate your kind help in advance,
--
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 0/3] usb: chipidea: add one errata for revision 2.40a

2014-12-18 Thread Sanchayan Maity
On 12/18/2014 06:47 PM, Matthieu CASTET wrote:
 Le Wed, 17 Dec 2014 20:40:29 +0800,
 Peter Chen peter.c...@freescale.com a écrit :
 
 On Wed, Dec 17, 2014 at 05:31:40PM +0530, Sanchayan Maity wrote:
 On 12/17/2014 02:05 PM, Peter Chen wrote:
 Hi all,

 At the first two patches, I add identification registers APIs, we can get
 controller's revision by using this APIs. Since I don't have enough spec,
 if there are any errors, tell me.

 At the third patch, I implement an errata for revision 2.40a, hope it can 
 fix
 the problem Sanchayan Maity reported.

 http://www.spinics.net/lists/linux-usb/msg118544.html

 @Sanchayan, would you please have a test?

 Peter Chen (3):
   usb: chipidea: add identification registers access APIs
   usb: chipidea: add chipidea revision information
   usb: chipidea: udc: add errata for revision 2.40a

  drivers/usb/chipidea/bits.h | 10 +
  drivers/usb/chipidea/ci.h   | 53 
 +
  drivers/usb/chipidea/core.c | 23 ++--
  drivers/usb/chipidea/udc.c  | 18 ++-
  4 files changed, 101 insertions(+), 3 deletions(-)


 Thanks for the patches.

 I tested the patches with iperf and tried a few times to be sure. The 
 condition is
 still the same.


 Oh, bad luck. Be sure the code I added for 2.40a is ran at your board.

 
 For information we workarounded this errata with the attached patched.
 It is based on a old version of the driver.
 We never had time to clean and submit the patch, but it solve the
 errata in our case.
 
 
 Matthieu
 

I came in the morning and saw this patch. Immediately modified it and applied. 
Glad
to say that it works. I had iperf running for an hour with no problem and 
48.7GBytes
of transfer at 116MBits/sec :). Going to run a longer 3 hour iperf test now, 
but, I
guess it should be fine. I will spin a combination patch of what Peter and 
Matthieu
gave me and try sending it by today evening for me, before going on vacation.

Thanks a lot Matthieu, Peter and Felipe for the inputs and help.

-Cheers,
Sanchayan.

--
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 0/3] usb: chipidea: add one errata for revision 2.40a

2014-12-18 Thread Peter Chen
 
  On Wed, Dec 17, 2014 at 05:31:40PM +0530, Sanchayan Maity wrote:
  On 12/17/2014 02:05 PM, Peter Chen wrote:
  Hi all,
 
  At the first two patches, I add identification registers APIs, we
  can get controller's revision by using this APIs. Since I don't
  have enough spec, if there are any errors, tell me.
 
  At the third patch, I implement an errata for revision 2.40a, hope
  it can fix the problem Sanchayan Maity reported.
 
  http://www.spinics.net/lists/linux-usb/msg118544.html
 
  @Sanchayan, would you please have a test?
 
  Peter Chen (3):
usb: chipidea: add identification registers access APIs
usb: chipidea: add chipidea revision information
usb: chipidea: udc: add errata for revision 2.40a
 
   drivers/usb/chipidea/bits.h | 10 +
   drivers/usb/chipidea/ci.h   | 53
 +
   drivers/usb/chipidea/core.c | 23 ++--
  drivers/usb/chipidea/udc.c  | 18 ++-
   4 files changed, 101 insertions(+), 3 deletions(-)
 
 
  Thanks for the patches.
 
  I tested the patches with iperf and tried a few times to be sure.
  The condition is still the same.
 
 
  Oh, bad luck. Be sure the code I added for 2.40a is ran at your board.
 
 
  For information we workarounded this errata with the attached patched.
  It is based on a old version of the driver.
  We never had time to clean and submit the patch, but it solve the
  errata in our case.
 
 
  Matthieu
 
 
 I came in the morning and saw this patch. Immediately modified it and applied.
 Glad to say that it works. I had iperf running for an hour with no problem and
 48.7GBytes of transfer at 116MBits/sec :). Going to run a longer 3 hour iperf
 test now, but, I guess it should be fine. I will spin a combination patch of 
 what
 Peter and Matthieu gave me and try sending it by today evening for me,
 before going on vacation.
 

Great, please add revision code for 2.40a based on my first two patches.

Peter

 Thanks a lot Matthieu, Peter and Felipe for the inputs and help.
 
 -Cheers,
 Sanchayan.

--
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] r8152: drop the tx packet with invalid length

2014-12-18 Thread Hayes Wang
 From: David Miller [mailto:da...@davemloft.net] 
 Sent: Thursday, November 27, 2014 4:34 AM
[...]
   Looks like a candidate for ndo_gso_check(), so that we do not drop, but
   instead segment from netif_needs_gso()/validate_xmit_skb()
  
  You mean have the bridge implement the ndo_gso_check() method right?
  
  No, I meant this particular driver.
  
  Note that netif_skb_features() does only this check :
  
  if (gso_segs  dev-gso_max_segs || gso_segs  dev-gso_min_segs)
features = ~NETIF_F_GSO_MASK;
  
  Ie not testing gso_max_size
  
  It looks like all these particular tests should be moved on
  ndo_gso_check(), to remove code from netif_skb_features()
 
 A check against gso_max_size is generic enough that it ought to be put
 right into netif_needs_gso() rather then duplicating it into every
 driver's ndo_gso_check() method don't you think?

Excuse me. I try to implement ndo_gso_check() with kernel 3.18.
However, I still get packets with gso and their skb lengths are more
than the acceptable one. Do I miss something?

+static bool rtl8152_gso_check(struct sk_buff *skb, struct net_device *dev)
+{
+   if ((skb-len + sizeof(struct tx_desc))  agg_buf_sz)
+   return false;
+
+   return true;
+}
 
@@ -5861,6 +5876,9 @@ static const struct net_device_ops rtl8152_netdev_ops = {
.ndo_set_mac_address= rtl8152_set_mac_address,
.ndo_change_mtu = rtl8152_change_mtu,
.ndo_validate_addr  = eth_validate_addr,
+   .ndo_gso_check  = rtl8152_gso_check,
 };

Best Regards,
Hayes
--
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 0/3] usb: chipidea: add one errata for revision 2.40a

2014-12-18 Thread Peter Chen
 
 On 12/18/2014 06:47 PM, Matthieu CASTET wrote:
  Le Wed, 17 Dec 2014 20:40:29 +0800,
  Peter Chen peter.c...@freescale.com a écrit :
 
  On Wed, Dec 17, 2014 at 05:31:40PM +0530, Sanchayan Maity wrote:
  On 12/17/2014 02:05 PM, Peter Chen wrote:
  Hi all,
 
  At the first two patches, I add identification registers APIs, we
  can get controller's revision by using this APIs. Since I don't
  have enough spec, if there are any errors, tell me.
 
  At the third patch, I implement an errata for revision 2.40a, hope
  it can fix the problem Sanchayan Maity reported.
 
  http://www.spinics.net/lists/linux-usb/msg118544.html
 
  @Sanchayan, would you please have a test?
 
  Peter Chen (3):
usb: chipidea: add identification registers access APIs
usb: chipidea: add chipidea revision information
usb: chipidea: udc: add errata for revision 2.40a
 
   drivers/usb/chipidea/bits.h | 10 +
   drivers/usb/chipidea/ci.h   | 53
 +
   drivers/usb/chipidea/core.c | 23 ++--
  drivers/usb/chipidea/udc.c  | 18 ++-
   4 files changed, 101 insertions(+), 3 deletions(-)
 
 
  Thanks for the patches.
 
  I tested the patches with iperf and tried a few times to be sure.
  The condition is still the same.
 
 
  Oh, bad luck. Be sure the code I added for 2.40a is ran at your board.
 
 
  For information we workarounded this errata with the attached patched.
  It is based on a old version of the driver.
  We never had time to clean and submit the patch, but it solve the
  errata in our case.
 
 
  Matthieu
 
 
 I came in the morning and saw this patch. Immediately modified it and applied.
 Glad to say that it works. I had iperf running for an hour with no problem and
 48.7GBytes of transfer at 116MBits/sec :). Going to run a longer 3 hour iperf
 test now, but, I guess it should be fine. I will spin a combination patch of 
 what
 Peter and Matthieu gave me and try sending it by today evening for me,
 before going on vacation.
 

Please try to see  mEp-qh.ptr-cap |=  QH_ZLT; in Matthieu's patch is needed 
or not,
since the QH cap is initialized when the ep is enabled, and it should not be 
changed.

Peter

 Thanks a lot Matthieu, Peter and Felipe for the inputs and help.
 
 -Cheers,
 Sanchayan.

--
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: [DISCUSSION] USB device remote wakeup is not working for S3 case

2014-12-18 Thread Du, Changbin
 There's a simple solution: Call device_set_wakeup_enable() for the device!
 You can do this from the command line by:
 
   echo auto /sys/bus/usb/devices/.../power/control
 
 where the ... is the pathname for your device.
 
Yes, this can enable auto-suspend for usb device like a mouse. And remote wakeup
does work for RPM because rpm suspend refers to the needs_remote_wakeup flag.
But this doesn't impact system level suspend. The correct thing is:

echo enabled /sys/bus/usb/devices/.../power/wakeup

This will call device_set_wakeup_enable() for the device and should work. But 
unfortunately it seems didn't work even the wakeup file shows enabled which 
means the device is wakeup enabled(Tried on 3.16  3.18 kernel). This is a 
different
issue, I will check.

   if (interface-desc.bInterfaceSubClass ==
 USB_INTERFACE_SUBCLASS_BOOT 
   interface-desc.bInterfaceProtocol ==
   USB_INTERFACE_PROTOCOL_KEYBOARD) {
   usbhid_set_leds(hid);
   device_set_wakeup_enable(dev-dev, 1);
   }
 
 How about leaving everything the way it is now?  If you want to enable
 wakeup for something like a USB mouse, you can write a udev script to do it
 as shown above.
 
 Alan Stern

Could we also enable wakeup for usb mouse? Or is there any concern to enable it?
Per my opinion, most people may expect clicking mouse can awake system.

Regards,
Du, Changbin
--
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/4] usb: dwc3: Fixes and code cleanup

2014-12-18 Thread Amit Virdi
The first two patches are bug fixes in TRB preparation when scatter gather is
used. The next two patches are basically trivial and part of code cleanup.

The patches are rebased on Balbi's testing/next branch.

Amit Virdi (4):
  usb: dwc3: gadget: Fix TRB preparation during SG
  usb: dwc3: gadget: Stop TRB preparation after limit is reached
  usb: dwc3: gadget: Remove redundant check
  usb: dwc3: Remove current_trb as it is unused

 drivers/usb/dwc3/core.h   | 3 ---
 drivers/usb/dwc3/gadget.c | 9 -
 2 files changed, 4 insertions(+), 8 deletions(-)

-- 
1.8.0

--
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/4] usb: dwc3: gadget: Fix TRB preparation during SG

2014-12-18 Thread Amit Virdi
When scatter gather is used, multiple TRBs are prepared from one DWC3 request.
Hence, we must set the 'last' flag when the SG is last as well as the TRB is
last. The current implementation uses list_is_last to check if the dwc3_request
is the last request in the request_list.

This doesn't work when SG is used. This is because, when it is the last request,
the first TRB preparation (in dwc3_prepare_one_trb) modifies the dwc3_request
list's next and prev pointers while moving the URB to req_queued.

Hence, list_is_last always return false no matter what. The correct way is not
to access the modified pointers of dwc3_request but to use list_empty macro
instead.

Fixes: e5ba5ec833aa4a76980b512d6a6779643516b850 (usb: dwc3: gadget: fix scatter
gather implementation

Signed-off-by: Amit Virdi amit.vi...@st.com
---
 drivers/usb/dwc3/gadget.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f03b136ecfce..0eec2e917994 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -882,8 +882,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
 
if (i == (request-num_mapped_sgs - 1) ||
sg_is_last(s)) {
-   if (list_is_last(req-list,
-   dep-request_list))
+   if (list_empty(dep-request_list))
last_one = true;
chain = false;
}
-- 
1.8.0

--
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 4/4] usb: dwc3: Remove current_trb as it is unused

2014-12-18 Thread Amit Virdi
This field was introduced but never used. So, remove it.

Signed-off-by: Amit Virdi amit.vi...@st.com
---
 drivers/usb/dwc3/core.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 4bb9aa696ede..0842aa80976f 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -431,7 +431,6 @@ struct dwc3_event_buffer {
  * @dwc: pointer to DWC controller
  * @saved_state: ep state saved during hibernation
  * @flags: endpoint flags (wedged, stalled, ...)
- * @current_trb: index of current used trb
  * @number: endpoint number (1 - 15)
  * @type: set to bmAttributes  USB_ENDPOINT_XFERTYPE_MASK
  * @resource_index: Resource transfer index
@@ -464,8 +463,6 @@ struct dwc3_ep {
/* This last one is specific to EP0 */
 #define DWC3_EP0_DIR_IN(1  31)
 
-   unsignedcurrent_trb;
-
u8  number;
u8  type;
u8  resource_index;
-- 
1.8.0

--
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 3/4] usb: dwc3: gadget: Remove redundant check

2014-12-18 Thread Amit Virdi
dwc3_gadget_init_hw_endpoints calls dwc3_alloc_trb_pool only if epnum is not
equal to 0 or 1. Hence, rechecking it in the called function is redundant.

Signed-off-by: Amit Virdi amit.vi...@st.com
---
 drivers/usb/dwc3/gadget.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8f65ab3a3b92..8c2e2fbe6f39 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -352,9 +352,6 @@ static int dwc3_alloc_trb_pool(struct dwc3_ep *dep)
if (dep-trb_pool)
return 0;
 
-   if (dep-number == 0 || dep-number == 1)
-   return 0;
-
dep-trb_pool = dma_alloc_coherent(dwc-dev,
sizeof(struct dwc3_trb) * DWC3_TRB_NUM,
dep-trb_pool_dma, GFP_KERNEL);
-- 
1.8.0

--
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/4] usb: dwc3: gadget: Stop TRB preparation after limit is reached

2014-12-18 Thread Amit Virdi
When SG is used, there are two loops iterating to prepare TRBs:
 - Outer loop over the request_list
 - Inner loop over the SG list

The driver must stop preparing TRBs when the max TRBs have been prepared. The
code was missing break to get out of the outer loop.

Signed-off-by: Amit Virdi amit.vi...@st.com
---
 drivers/usb/dwc3/gadget.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 0eec2e917994..8f65ab3a3b92 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -900,6 +900,9 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool 
starting)
if (last_one)
break;
}
+
+   if (last_one)
+   break;
} else {
dma = req-request.dma;
length = req-request.length;
-- 
1.8.0

--
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 4/4] PM: Eliminate CONFIG_PM_RUNTIME

2014-12-18 Thread Ulf Hansson
On 19 December 2014 at 03:03, Rafael J. Wysocki r...@rjwysocki.net wrote:
 From: Rafael J. Wysocki rafael.j.wyso...@intel.com

 Having switched over all of the users of CONFIG_PM_RUNTIME to use
 CONFIG_PM directly, turn the latter into a user-selectable option
 and drop the former entirely from the tree.

 Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com

I am impressed , in this short period of time we managed to remove all
*PM_RUNTIME configurations! Great work!

Reviewed-by: Ulf Hansson ulf.hans...@linaro.org

 ---
  arch/arm/configs/ape6evm_defconfig |2 +-
  arch/arm/configs/armadillo800eva_defconfig |2 +-
  arch/arm/configs/bcm_defconfig |2 +-
  arch/arm/configs/bockw_defconfig   |2 +-
  arch/arm/configs/davinci_all_defconfig |2 +-
  arch/arm/configs/exynos_defconfig  |2 +-
  arch/arm/configs/ezx_defconfig |2 +-
  arch/arm/configs/hisi_defconfig|2 +-
  arch/arm/configs/imote2_defconfig  |2 +-
  arch/arm/configs/imx_v6_v7_defconfig   |2 +-
  arch/arm/configs/keystone_defconfig|2 +-
  arch/arm/configs/kzm9g_defconfig   |2 +-
  arch/arm/configs/lager_defconfig   |2 +-
  arch/arm/configs/mackerel_defconfig|2 +-
  arch/arm/configs/marzen_defconfig  |2 +-
  arch/arm/configs/omap1_defconfig   |2 +-
  arch/arm/configs/prima2_defconfig  |2 +-
  arch/arm/configs/sama5_defconfig   |2 +-
  arch/arm/configs/shmobile_defconfig|2 +-
  arch/arm/configs/sunxi_defconfig   |2 +-
  arch/arm/configs/tegra_defconfig   |2 +-
  arch/arm/configs/u8500_defconfig   |2 +-
  arch/arm/configs/vt8500_v6_v7_defconfig|2 +-
  arch/arm/mach-omap2/Kconfig|6 +++---
  arch/mips/configs/db1xxx_defconfig |2 +-
  arch/mips/configs/lemote2f_defconfig   |2 +-
  arch/mips/configs/loongson3_defconfig  |2 +-
  arch/mips/configs/nlm_xlp_defconfig|2 +-
  arch/mips/configs/nlm_xlr_defconfig|2 +-
  arch/powerpc/configs/ps3_defconfig |2 +-
  arch/sh/Kconfig|2 +-
  arch/sh/configs/apsh4ad0a_defconfig|2 +-
  arch/sh/configs/sdk7786_defconfig  |2 +-
  drivers/usb/host/isp1760-hcd.c |2 +-
  drivers/usb/host/oxu210hp-hcd.c|2 +-
  include/linux/devfreq.h|2 +-
  kernel/power/Kconfig   |   16 ++--
  37 files changed, 44 insertions(+), 48 deletions(-)

 Index: linux-pm/arch/arm/configs/ape6evm_defconfig
 ===
 --- linux-pm.orig/arch/arm/configs/ape6evm_defconfig
 +++ linux-pm/arch/arm/configs/ape6evm_defconfig
 @@ -33,7 +33,7 @@ CONFIG_ARM_APPENDED_DTB=y
  CONFIG_VFP=y
  CONFIG_NEON=y
  CONFIG_BINFMT_MISC=y
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
  CONFIG_NET=y
  CONFIG_PACKET=y
  CONFIG_UNIX=y
 Index: linux-pm/arch/arm/configs/armadillo800eva_defconfig
 ===
 --- linux-pm.orig/arch/arm/configs/armadillo800eva_defconfig
 +++ linux-pm/arch/arm/configs/armadillo800eva_defconfig
 @@ -43,7 +43,7 @@ CONFIG_KEXEC=y
  CONFIG_VFP=y
  CONFIG_NEON=y
  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
  CONFIG_NET=y
  CONFIG_PACKET=y
  CONFIG_UNIX=y
 Index: linux-pm/arch/arm/configs/bcm_defconfig
 ===
 --- linux-pm.orig/arch/arm/configs/bcm_defconfig
 +++ linux-pm/arch/arm/configs/bcm_defconfig
 @@ -39,7 +39,7 @@ CONFIG_CPU_IDLE=y
  CONFIG_VFP=y
  CONFIG_NEON=y
  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
  CONFIG_NET=y
  CONFIG_PACKET=y
  CONFIG_PACKET_DIAG=y
 Index: linux-pm/arch/arm/configs/bockw_defconfig
 ===
 --- linux-pm.orig/arch/arm/configs/bockw_defconfig
 +++ linux-pm/arch/arm/configs/bockw_defconfig
 @@ -29,7 +29,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
  CONFIG_ARM_APPENDED_DTB=y
  CONFIG_VFP=y
  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
  CONFIG_NET=y
  CONFIG_PACKET=y
  CONFIG_UNIX=y
 Index: linux-pm/arch/arm/configs/davinci_all_defconfig
 ===
 --- linux-pm.orig/arch/arm/configs/davinci_all_defconfig
 +++ linux-pm/arch/arm/configs/davinci_all_defconfig
 @@ -49,7 +49,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
  CONFIG_CPU_FREQ_GOV_ONDEMAND=m
  CONFIG_CPU_IDLE=y
 -CONFIG_PM_RUNTIME=y
 +CONFIG_PM=y
  CONFIG_NET=y
  CONFIG_PACKET=y
  CONFIG_UNIX=y
 Index: linux-pm/arch/arm/configs/exynos_defconfig
 ===
 ---