platform/kernel/linux-rpi.git
6 years agoxhci: change xhci_set_link_state() to work with port structures
Mathias Nyman [Mon, 21 May 2018 13:39:59 +0000 (16:39 +0300)]
xhci: change xhci_set_link_state() to work with port structures

Remove old iomem port array and index as parameters, just
send a ponter to a port strucure instread

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: rename faked_port_index to hcd_portnum
Mathias Nyman [Mon, 21 May 2018 13:39:58 +0000 (16:39 +0300)]
xhci: rename faked_port_index to hcd_portnum

hcd_portnum is a better desctiption than faked_port_index, and
is in line with the name the port structure uses.

No functional changes

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-ring: use port structures for port event handler
Mathias Nyman [Mon, 21 May 2018 13:39:57 +0000 (16:39 +0300)]
xhci: xhci-ring: use port structures for port event handler

use port structures in the port event handler.
Getting the right hcd and hcd portnumber from the hardware port number
is a lot easier with port structures, and allows us to remove a lot
of the previous code, including the find_faked_portnum_from_hw_index()
function

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-hub: use new port structures for cas and wake mask functions.
Mathias Nyman [Mon, 21 May 2018 13:39:56 +0000 (16:39 +0300)]
xhci: xhci-hub: use new port structures for cas and wake mask functions.

Use port structures instead of mmio port arrays for
xhci_port_missing_cas_quirk() and xhci_set_remote_wake_mask() in
xhci-hub.c

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: xhci-hub: use new port structures to get port address instead of port array
Mathias Nyman [Mon, 21 May 2018 13:39:55 +0000 (16:39 +0300)]
xhci: xhci-hub: use new port structures to get port address instead of port array

Use the new port structures for functions in xhci-hub.c to get
port mmio address of portsc register instead of the port array

xhci_get_port_io_addr() is no longer needeed and is removed.
Plan is to get rid of the mmio port array completely.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: Add helper to get xhci roothub from hcd
Mathias Nyman [Mon, 21 May 2018 13:39:54 +0000 (16:39 +0300)]
xhci: Add helper to get xhci roothub from hcd

quick way to get the xhci roothub and thus all the ports
belonging to a certain hcd

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: set hcd pointers for xhci usb2 and usb3 roothub structures
Mathias Nyman [Mon, 21 May 2018 13:39:53 +0000 (16:39 +0300)]
xhci: set hcd pointers for xhci usb2 and usb3 roothub structures

Allows us to know the correct hcd a xhci roothub and its ports
belong to.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: Create new structures to store xhci port information
Mathias Nyman [Mon, 21 May 2018 13:39:52 +0000 (16:39 +0300)]
xhci: Create new structures to store xhci port information

Current way of having one array telling only the port speed,
and then two separate arrays with mmio addresses for usb2 and usb3 ports
requeres helper functions to transate  hw to hcd, and hcd to hw port
numbers, and is hard to expand.

Instead create a structure describing a port, including the mmio address,
the port hardware index, hcd port index, and a pointer to the roothub
it belongs to.

Create one array containing all port structures in the same order the
hardware controller sees them. Then add an array of port pointers to
each xhci hub structure pointing to the ports that belonging to the
roothub.

This way we can easily convert hw indexed port events to usb core
hcd port numbers, and vice versa usb core hub hcd port numbers
to hw index and mmio address.

Other benefit is that we can easily find the parent hcd and xhci
structure of a port structure. This is useful in debugfs where
we can give one port structure pointer as parameter and get both
the correct mmio address and xhci lock needed to set some port
parameter.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoxhci: hisilicon: support HiSilicon STB xHCI host controller
Jianguo Sun [Mon, 21 May 2018 13:39:51 +0000 (16:39 +0300)]
xhci: hisilicon: support HiSilicon STB xHCI host controller

This commit adds support for HiSilicon STB xHCI host controller.
There are two xHCI host controllers on HiSilicon STB SoCs. Each
one requires additional configuration before exposing interface
compliant with xHCI.

Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Jianguo Sun <sunjianguo1@huawei.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agodt-bindings: usb: add bindings doc for HiSilicon STB xHCI host controller
Jianguo Sun [Mon, 21 May 2018 13:39:50 +0000 (16:39 +0300)]
dt-bindings: usb: add bindings doc for HiSilicon STB xHCI host controller

This commit adds bindings doc for HiSilicon STB xHCI host controller.

Signed-off-by: Jianguo Sun <sunjianguo1@huawei.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: xhci: dbc: Add SPDX identifiers to dbc files
Lu Baolu [Mon, 21 May 2018 13:39:49 +0000 (16:39 +0300)]
usb: xhci: dbc: Add SPDX identifiers to dbc files

Update the xhci dbc files with the correct SPDX license identifiers.

Fixes: dfba2174dc42 ("usb: xhci: Add DbC support in xHCI driver")
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Philippe Ombredanne <pombredanne@nexB.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMerge tag 'usb-for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
Greg Kroah-Hartman [Thu, 24 May 2018 15:46:53 +0000 (17:46 +0200)]
Merge tag 'usb-for-v4.18' of git://git./linux/kernel/git/balbi/usb into usb-next

usb: changes for v4.18 merge window

A total of 98 non-merge commits, the biggest part being in dwc3 this
time around with a large refactoring of dwc3's transfer handling code.

We also have a new driver for Aspeed virtual hub controller.

Apart from that, just a list of miscellaneous fixes all over the place.

6 years agousb: musb: gadget: fix to_musb_ep() to not return NULL
Bin Liu [Mon, 21 May 2018 13:42:22 +0000 (08:42 -0500)]
usb: musb: gadget: fix to_musb_ep() to not return NULL

UDC core ensures the usb_ep parameter passed in is not NULL, so
checking if (ep != NULL) is pointless.

Convert to_musb_ep() to a simple macro to not directly return NULL to
avoid warnings from code static analysis tools.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: gadget: fix to_musb_request() to not return NULL
Bin Liu [Mon, 21 May 2018 13:42:21 +0000 (08:42 -0500)]
usb: musb: gadget: fix to_musb_request() to not return NULL

The gadget function drivers should ensure the usb_request parameter
passed in is not NULL. UDC core doesn't check if it is NULL, so MUSB
driver shouldn't have to check it either.

Convert to_musb_request() to a simple macro to not directly return NULL
to avoid warnings from code static analysis tools.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoUSB: musb: dsps: propagate device-tree node
Johan Hovold [Mon, 21 May 2018 13:42:20 +0000 (08:42 -0500)]
USB: musb: dsps: propagate device-tree node

To be able to use DSPS-based controllers with device-tree descriptions
of the USB topology, we need to associate the glue device's device-tree
node with the child controller device.

Note that this can also be used to eventually let USB core manage
generic phys.

Also note that the other glue drivers will require similar changes to be
able to describe their buses in DT.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: disable otg protocol support
Bin Liu [Mon, 21 May 2018 13:42:19 +0000 (08:42 -0500)]
usb: musb: disable otg protocol support

As decided in the discussion [1] we are deleting the otg protocol
support from the musb drivers.

First this patch disables the flags for enabling the otg protocols. We
will later gradually delete the otg protocol code from the musb drivers.

[1] https://www.spinics.net/lists/linux-usb/msg167003.html

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove references to default_a of struct usb_otg
Bin Liu [Mon, 21 May 2018 13:42:18 +0000 (08:42 -0500)]
usb: musb: remove references to default_a of struct usb_otg

musb drivers do not use the otg fsm framework, so referencing to
otg->default_a doesn't have any effect, so remove the references.

But tusb6010 glue driver uses it locally to control the vbus power, so
keep the references in tusb6010 only.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: break the huge isr musb_stage0_irq() into small functions
Bin Liu [Mon, 21 May 2018 13:42:17 +0000 (08:42 -0500)]
usb: musb: break the huge isr musb_stage0_irq() into small functions

musb_stage0_irq() is 400+ lines long. Break its interrupt events
handling into each individual functions to make it easy to read.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove unused members in struct musb_hdrc_config
Bin Liu [Mon, 21 May 2018 13:42:16 +0000 (08:42 -0500)]
usb: musb: remove unused members in struct musb_hdrc_config

The following members in struct musb_hdrc_config are not used,
so remove them.

soft_con
utm_16
big_endian
mult_bulk_tx
mult_bulk_rx
high_iso_tx
high_iso_rx
dma
dma_channels
dyn_fifo_size
vendor_ctrl
vendor_stat
vendor_req
dma_req_chan
musb_hdrc_eps_bits

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove duplicated port mode enum
Bin Liu [Mon, 21 May 2018 13:42:15 +0000 (08:42 -0500)]
usb: musb: remove duplicated port mode enum

include/linux/usb/musb.h already defines enum for musb port mode, so
remove the duplicate in musb_core.h and use the definition in musb.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: dsps: remove duplicated get_musb_port_mode()
Bin Liu [Mon, 21 May 2018 13:42:14 +0000 (08:42 -0500)]
usb: musb: dsps: remove duplicated get_musb_port_mode()

musb_core already has musb_get_mode(), so remove the duplicate from
musb_dsps.c.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove duplicated quirks flag
Bin Liu [Mon, 21 May 2018 13:42:13 +0000 (08:42 -0500)]
usb: musb: remove duplicated quirks flag

Both musb_io and musb_platform_ops in struct musb define a quirks flag
for the same purpose.  Let's remove the one in struct musb_io, and use
that in struct musb_platform_ops instead.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove some register access wrapper functions
Bin Liu [Mon, 21 May 2018 13:42:12 +0000 (08:42 -0500)]
usb: musb: remove some register access wrapper functions

The following wrappers were defined because of Blackfin support. Now
Blackfin support is removed, these wrappers are no longer needed, so
remove them.

musb_write_txfifosz
musb_write_txfifoadd
musb_write_rxfifosz
musb_write_rxfifoadd
musb_write_ulpi_buscontrol
musb_read_txfifosz
musb_read_txfifoadd
musb_read_rxfifosz
musb_read_rxfifoadd
musb_read_ulpi_buscontrol
musb_read_hwvers

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove adjust_channel_params() callback from musb_platform_ops
Bin Liu [Mon, 21 May 2018 13:42:11 +0000 (08:42 -0500)]
usb: musb: remove adjust_channel_params() callback from musb_platform_ops

Now Blackfin support is removed, nobody uses adjust_channel_params() any
more, so remove it from struct musb_platform_ops.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: remove readl/writel from struct musb_platform_ops
Bin Liu [Mon, 21 May 2018 13:42:10 +0000 (08:42 -0500)]
usb: musb: remove readl/writel from struct musb_platform_ops

Now Blackfin support is removed, we no longer need function pointers for
musb_readl() and musb_writel().

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: musb: merge musbhsdma.h into musbhsdma.c
Bin Liu [Mon, 21 May 2018 13:42:09 +0000 (08:42 -0500)]
usb: musb: merge musbhsdma.h into musbhsdma.c

Now Blackfin support is removed, header musbhsdma.h is only included in
musbhsdma.c. So let's merge the content in musbhsdma.h to musbhsdma.c
and delete musbhsdma.h.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agousb: dwc2: gadget: Fix coverity issue
Grigor Tovmasyan [Tue, 3 Apr 2018 11:22:25 +0000 (15:22 +0400)]
usb: dwc2: gadget: Fix coverity issue

When _param is unsigned and the minimum value of range is 0, it gives
the following warning:
COVERITY NO_EFFECT: This less-than-zero comparison of an unsigned value
is never true.

Converting ._param to int to avoid this warning.

Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: fix double phy_put()
Yoshihiro Shimoda [Mon, 2 Apr 2018 12:21:31 +0000 (21:21 +0900)]
usb: gadget: udc: renesas_usb3: fix double phy_put()

This patch fixes an issue that this driver cause double phy_put()
calling. This driver must not call phy_put() in the remove because
the driver calls devm_phy_get() in the probe.

Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy")
Cc: <stable@vger.kernel.org> # v4.15+
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting
Yoshihiro Shimoda [Tue, 10 Apr 2018 05:38:54 +0000 (14:38 +0900)]
usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting

This patch fixes an issue that reconnection is possible to fail
because unexpected state handling happens by the irqs. To fix the issue,
the driver disables the controller's irqs when disconnected.

Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Cc: <stable@vger.kernel.org> # v4.5+
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error
Yoshihiro Shimoda [Tue, 10 Apr 2018 05:38:53 +0000 (14:38 +0900)]
usb: gadget: udc: renesas_usb3: should fail if devm_phy_get() returns error

This patch fixes an issue that this driver ignores errors other than
the non-existence of the device, f.e. a memory allocation failure
in devm_phy_get(). So, this patch replaces devm_phy_get() with
devm_phy_optional_get().

Reported-by: Simon Horman <horms+renesas@verge.net.au>
Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy")
Cc: <stable@vger.kernel.org> # v4.15+
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: should call devm_phy_get() before add udc
Yoshihiro Shimoda [Tue, 10 Apr 2018 05:38:52 +0000 (14:38 +0900)]
usb: gadget: udc: renesas_usb3: should call devm_phy_get() before add udc

This patch fixes an issue that this driver cannot call phy_init()
if a gadget driver is alreadly loaded because usb_add_gadget_udc()
might call renesas_usb3_start() via .udc_start.
This patch also revises the typo (s/an optional/optional/).

Fixes: 279d4bc64060 ("usb: gadget: udc: renesas_usb3: add support for generic phy")
Cc: <stable@vger.kernel.org> # v4.15+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udc
Yoshihiro Shimoda [Tue, 10 Apr 2018 05:38:51 +0000 (14:38 +0900)]
usb: gadget: udc: renesas_usb3: should call pm_runtime_enable() before add udc

This patch fixes an issue that this driver causes panic if a gadget
driver is already loaded because usb_add_gadget_udc() might call
renesas_usb3_start() via .udc_start, and then pm_runtime_get_sync()
in renesas_usb3_start() doesn't work correctly.
Note that the usb3_to_dev() macro should not be called at this timing
because the macro uses the gadget structure.

Fixes: cf06df3fae28 ("usb: gadget: udc: renesas_usb3: move pm_runtime_{en,dis}able()")
Cc: <stable@vger.kernel.org> # v4.15+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: udc: renesas_usb3: should remove debugfs
Yoshihiro Shimoda [Tue, 10 Apr 2018 05:38:50 +0000 (14:38 +0900)]
usb: gadget: udc: renesas_usb3: should remove debugfs

This patch fixes an issue that this driver doesn't remove its debugfs.

Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode")
Cc: <stable@vger.kernel.org> # v4.14+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: composite Allow for larger configuration descriptors
Joel Pepper [Thu, 26 Apr 2018 18:26:08 +0000 (20:26 +0200)]
usb: gadget: composite Allow for larger configuration descriptors

The composite framework allows us to create gadgets composed from many
different functions, which need to fit into a single configuration
descriptor.

Some functions (like uvc) can produce configuration descriptors upwards
of 2500 bytes on their own.

This patch increases the limit from 1024 bytes to 4096.

Signed-off-by: Joel Pepper <joel.pepper@rwth-aachen.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue
Mayank Rana [Fri, 23 Mar 2018 17:05:33 +0000 (10:05 -0700)]
usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue

dwc3_ep_dequeue() waits for completion of End Transfer command using
wait_event_lock_irq(), which will release the dwc3->lock while waiting
and reacquire after completion. This allows a potential race condition
with ep_disable() which also removes all requests from started_list
and pending_list.

The check for NULL r->trb should catch this but currently it exits to
the wrong 'out1' label which calls dwc3_gadget_giveback(). Since its
list entry was already removed, if CONFIG_DEBUG_LIST is enabled a
'list_del corruption' bug is thrown since its next/prev pointers are
already LIST_POISON1/2. If r->trb is NULL it should simply exit to
'out0'.

Fixes: cf3113d893d4 ("usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue")
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: dwc3_gadget_del_and_unmap_request() can be static
Wei Yongjun [Thu, 29 Mar 2018 02:20:10 +0000 (02:20 +0000)]
usb: dwc3: gadget: dwc3_gadget_del_and_unmap_request() can be static

Fixes the following sparse warning:

drivers/usb/dwc3/gadget.c:169:6: warning:
 symbol 'dwc3_gadget_del_and_unmap_request' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc2: pci: Fix error return code in dwc2_pci_probe()
Wei Yongjun [Wed, 28 Mar 2018 13:41:13 +0000 (13:41 +0000)]
usb: dwc2: pci: Fix error return code in dwc2_pci_probe()

Fix to return error code -ENOMEM from the alloc fail error handling
case instead of 0, as done elsewhere in this function.

Fixes: ecd29dabb2ba ("usb: dwc2: pci: Handle error cleanup in probe")
Reviewed-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc2: WA for Full speed ISOC IN in DDMA mode.
Artur Petrosyan [Mon, 16 Apr 2018 12:45:31 +0000 (08:45 -0400)]
usb: dwc2: WA for Full speed ISOC IN in DDMA mode.

By clearing NAK status of EP, core will send ZLP
to IN token and assert NAK interrupt relying
on TxFIFO status only.

The WA applies only to core versions from 2.72a
to 4.00a (including both). Also for FS_IOT_1.00a
and HS_IOT_1.00a.

Signed-off-by: Artur Petrosyan <arturp@synopsys.com>
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc2: dwc2_vbus_supply_init: fix error check
Tomeu Vizoso [Mon, 26 Mar 2018 09:00:01 +0000 (11:00 +0200)]
usb: dwc2: dwc2_vbus_supply_init: fix error check

devm_regulator_get_optional returns -ENODEV if the regulator isn't
there, so if that's the case we have to make sure not to leave -ENODEV
in the regulator pointer.

Also, make sure we return 0 in that case, but correctly propagate any
other errors. Also propagate the error from _dwc2_hcd_start.

Fixes: 531ef5ebea96 ("usb: dwc2: add support for host mode external vbus supply")
Cc: Amelie Delaunay <amelie.delaunay@st.com>
Reviewed-by: Amelie Delaunay <amelie.delaunay@st.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: f_phonet: fix pn_net_xmit()'s return type
Luc Van Oostenryck [Tue, 24 Apr 2018 13:18:41 +0000 (15:18 +0200)]
usb: gadget: f_phonet: fix pn_net_xmit()'s return type

The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, but the implementation in this
driver returns an 'int'.

Fix this by returning 'netdev_tx_t' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc2: Fix HiKey regression caused by power_down feature
John Stultz [Sat, 19 May 2018 00:49:03 +0000 (17:49 -0700)]
usb: dwc2: Fix HiKey regression caused by power_down feature

In 4.17-rc, commit 03ea6d6e9e1f ("usb: dwc2: Enable power down")
caused the HiKey board to not correctly handle switching between
usb-gadget and usb-host mode.

Unplugging the OTG port would result in:
[   42.240973] dwc2 f72c0000.usb: dwc2_restore_host_registers: no host registers to restore
[   42.249066] dwc2 f72c0000.usb: dwc2_host_exit_hibernation: failed to restore host registers

And the USB-host ports would not function.

And plugging in the OTG port, we would see:
[   46.046557] WARNING: CPU: 3 PID: 6 at drivers/usb/dwc2/gadget.c:260 dwc2_hsotg_init_fifo+0x194/0x1a0
[   46.055761] CPU: 3 PID: 6 Comm: kworker/u16:0 Not tainted 4.17.0-rc5-00030-ge67da8c #231
[   46.055767] Hardware name: HiKey Development Board (DT)
[   46.055784] Workqueue: dwc2 dwc2_conn_id_status_change
...

Thus, this patch sets the hisi params to disable the power_down
flag by default, and gets thing working again.

Cc: John Youn <johnyoun@synopsys.com>
Cc: Vardan Mikayelyan <mvardan@synopsys.com>
Cc: Artur Petrosyan <arturp@synopsys.com>
Cc: Grigor Tovmasyan <tovmasya@synopsys.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc2: Fix kernel doc's warnings.
Grigor Tovmasyan [Wed, 16 May 2018 08:04:24 +0000 (12:04 +0400)]
usb: dwc2: Fix kernel doc's warnings.

Added descriptions for all not described parameters.
Fix all kernel doc's warnings.

Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: gadget: fsl: Introduce FSL_USB2_PHY_UTMI_DUAL for usb gadget
Nikhil Badola [Thu, 17 May 2018 21:28:37 +0000 (18:28 -0300)]
usb: gadget: fsl: Introduce FSL_USB2_PHY_UTMI_DUAL for usb gadget

Introduce FSL_USB2_PHY_UTMI_DUAL in gadget driver for setting
phy in SOCs with utmi dual phy

Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Tested-by: Tiago Brusamarello <tbrusa@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: dwc3_get_extcon() can be static
kbuild test robot [Thu, 17 May 2018 16:06:41 +0000 (00:06 +0800)]
usb: dwc3: dwc3_get_extcon() can be static

Fix sparse warning

Fixes: 5f0b74e54890 ("USB: dwc3: get extcon device by OF graph bindings")
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: init req->{direction,epnum} from alloc_request()
Felipe Balbi [Mon, 7 May 2018 12:19:31 +0000 (15:19 +0300)]
usb: dwc3: gadget: init req->{direction,epnum} from alloc_request()

We dont' need to touch req->direction or req->epnum from
ep_queue(). It's enough that we initialize both fields from
alloc_request() and just keep them for the entire lifetime of the
request.

No functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: initialize transfer index from send_gadget_ep_cmd()
Felipe Balbi [Wed, 11 Apr 2018 09:58:46 +0000 (12:58 +0300)]
usb: dwc3: gadget: initialize transfer index from send_gadget_ep_cmd()

Instead of *always* calling dwc3_gadget_ep_get_transfer_index() after
sending a Start Transfer command, we can call it once from
dwc3_send_gadget_ep_cmd() itself.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: assign resource_index inside get_transfer_index()
Felipe Balbi [Wed, 11 Apr 2018 09:56:24 +0000 (12:56 +0300)]
usb: dwc3: gadget: assign resource_index inside get_transfer_index()

Instead of returning resource index number just to assign it to a
field inside 'dep' which was passed as argument, we can assing
dep->resource_index from inside dwc3_gadget_ep_get_transfer_index()
itself.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: always start isochronous aligned to dep->interval
Felipe Balbi [Wed, 11 Apr 2018 07:34:34 +0000 (10:34 +0300)]
usb: dwc3: gadget: always start isochronous aligned to dep->interval

We will *always* start transfer to the next uFrame number aligned to
dep->interval.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: don't issue End Transfer if we have started reqs
Felipe Balbi [Wed, 11 Apr 2018 07:32:52 +0000 (10:32 +0300)]
usb: dwc3: gadget: don't issue End Transfer if we have started reqs

In case we have many started requests and one of them in the middle is
completed with Missed Isoc, let's not End Transfer as that would
result in us loosing (possibly) many more intervals.

Instead, let's allow the controller to go through its list of started
requests.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: debug: decode uFrame from event too
Felipe Balbi [Wed, 11 Apr 2018 07:31:53 +0000 (10:31 +0300)]
usb: dwc3: debug: decode uFrame from event too

XferNotReady and XferInProgress give us the uFrame number we're
currently in. Printing that out on tracepoints may help us find bugs
in transfer scheduling.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: move dwc3_calc_trbs_left() in place of prototype
Felipe Balbi [Mon, 9 Apr 2018 10:01:43 +0000 (13:01 +0300)]
usb: dwc3: gadget: move dwc3_calc_trbs_left() in place of prototype

Avoid a prototype when the function can be defined earlier. No
functional changes, cleanup only.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: move set_xfer_resource() in place of prototype
Felipe Balbi [Mon, 9 Apr 2018 09:49:02 +0000 (12:49 +0300)]
usb: dwc3: gadget: move set_xfer_resource() in place of prototype

Instead of having a prototype for a function that's defined a few
lines down, let's just move definition to the place where prototype
was.

No functional changes, cleanup only.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove a few more dwc arguments
Felipe Balbi [Mon, 9 Apr 2018 09:46:47 +0000 (12:46 +0300)]
usb: dwc3: gadget: remove a few more dwc arguments

In a few places, the argument is completely unnecessary. On places
where it's needed, we can get it from dep->dwc.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: combine modify & restore into single argument
Felipe Balbi [Mon, 9 Apr 2018 09:40:48 +0000 (12:40 +0300)]
usb: dwc3: gadget: combine modify & restore into single argument

Those two arguments refer to a single bitfield in the register. In
order to simplify the code, we can combine them into a single argument
and expect caller to pass the correct action argument at all times.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: refactor dwc3_gadget_init_endpoints()
Felipe Balbi [Mon, 9 Apr 2018 08:06:09 +0000 (11:06 +0300)]
usb: dwc3: gadget: refactor dwc3_gadget_init_endpoints()

This just makes it slightly easier to read. No functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: split dwc3_gadget_ep_cleanup_completed_requests()
Felipe Balbi [Fri, 6 Apr 2018 12:56:35 +0000 (15:56 +0300)]
usb: dwc3: gadget: split dwc3_gadget_ep_cleanup_completed_requests()

No functional changes, it just makes the code slightly easier to read.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: get rid of the length variable
Felipe Balbi [Fri, 6 Apr 2018 12:51:49 +0000 (15:51 +0300)]
usb: dwc3: gadget: get rid of the length variable

Code is just as readable without it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: reduce scope of ret variable
Felipe Balbi [Fri, 6 Apr 2018 12:50:29 +0000 (15:50 +0300)]
usb: dwc3: gadget: reduce scope of ret variable

We can declare it inside list_for_each_entry_safe() loop and reduce
its scope.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: one declaration per line
Felipe Balbi [Fri, 6 Apr 2018 12:49:49 +0000 (15:49 +0300)]
usb: dwc3: gadget: one declaration per line

Misc cleanup. No functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: simplify IOC handling
Felipe Balbi [Fri, 6 Apr 2018 12:37:30 +0000 (15:37 +0300)]
usb: dwc3: gadget: simplify IOC handling

We will only have event status of IOC when IOC bit is set in
TRB. There's no need to check both bits.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: simplify short packet event
Felipe Balbi [Fri, 6 Apr 2018 08:04:21 +0000 (11:04 +0300)]
usb: dwc3: gadget: simplify short packet event

We know that only OUT endpoints can trigger SHORT. We also know that
count MUST be > 0 whenever SHORT triggers.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: trace: print out event status too
Felipe Balbi [Fri, 6 Apr 2018 08:03:19 +0000 (11:03 +0300)]
usb: dwc3: trace: print out event status too

This will make it easier to figure out the reason for the event. That
information really helps debugging certain problems.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: simplify unaligned and zlp handling
Felipe Balbi [Thu, 29 Mar 2018 12:30:44 +0000 (15:30 +0300)]
usb: dwc3: gadget: simplify unaligned and zlp handling

We can just call reclaim_trb_linear instead of reimplementing it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove unnecessary 'chain' variable
Felipe Balbi [Thu, 29 Mar 2018 11:49:36 +0000 (14:49 +0300)]
usb: dwc3: gadget: remove unnecessary 'chain' variable

Minor cleanup, no functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove PENDING handling from cleanup_completed
Felipe Balbi [Thu, 29 Mar 2018 11:02:41 +0000 (14:02 +0300)]
usb: dwc3: gadget: remove PENDING handling from cleanup_completed

We are trying to kick transfers on Isochronous endpoints in a more
controlled manner now. And this ended up rendering this piece of code
unnecessary.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: split scatterlist and linear handlers
Felipe Balbi [Thu, 29 Mar 2018 10:32:10 +0000 (13:32 +0300)]
usb: dwc3: gadget: split scatterlist and linear handlers

instead of having one big loop, let's split it down into two smaller
handlers: one for linear buffers and one for scatterlist.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: simplify isoc case on cleanup_completed_requests
Felipe Balbi [Thu, 29 Mar 2018 10:25:40 +0000 (13:25 +0300)]
usb: dwc3: gadget: simplify isoc case on cleanup_completed_requests

Just a minor simplification, no functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: simplify queueing of isoc transfers
Felipe Balbi [Thu, 29 Mar 2018 10:23:53 +0000 (13:23 +0300)]
usb: dwc3: gadget: simplify queueing of isoc transfers

After all the previous changes, it's now a lot clearer how isoc
transfers should be managed. We don't need to try to End Transfers
from ep_queue since that's already done by cleanup_requests.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove duplicated missed isoc handling
Felipe Balbi [Thu, 29 Mar 2018 10:07:16 +0000 (13:07 +0300)]
usb: dwc3: gadget: remove duplicated missed isoc handling

Now, this part of the code is duplicated and brings no extra value to
the driver. Let's remove it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: check for Missed Isoc from event status
Felipe Balbi [Thu, 29 Mar 2018 09:49:28 +0000 (12:49 +0300)]
usb: dwc3: gadget: check for Missed Isoc from event status

In case we get an event with status set to Missed Isoc, this means we
have missed an isochronous interval and should issue End Transfer
command and wait for the following XferNotReady.

Let's do that early, rather than late.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove unnecessary 'ioc' variable
Felipe Balbi [Thu, 29 Mar 2018 09:10:31 +0000 (12:10 +0300)]
usb: dwc3: gadget: remove unnecessary 'ioc' variable

It's only written to, never read. We can remove it now.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: make cleanup_completed_requests() return nothing
Felipe Balbi [Thu, 29 Mar 2018 08:53:40 +0000 (11:53 +0300)]
usb: dwc3: gadget: make cleanup_completed_requests() return nothing

We don't need to return a value anymore here. Let's remove it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove DWC3_EP_BUSY flag
Felipe Balbi [Thu, 29 Mar 2018 08:10:45 +0000 (11:10 +0300)]
usb: dwc3: gadget: remove DWC3_EP_BUSY flag

It has no use anymore.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: start removing BUSY flag
Felipe Balbi [Thu, 29 Mar 2018 08:08:46 +0000 (11:08 +0300)]
usb: dwc3: gadget: start removing BUSY flag

By now, it has the same semantics as DWC3_EP_TRANSFER_STARTED, but
that has a much more descriptive name.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: update dep->frame_number from XferInprogress too
Felipe Balbi [Tue, 27 Mar 2018 08:26:53 +0000 (11:26 +0300)]
usb: dwc3: gadget: update dep->frame_number from XferInprogress too

We will need an up-to-date frame_number from XferInProgress too when
future patches improve our handling of Isoc endpoints.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: always use frame number from XferNotReady
Felipe Balbi [Tue, 27 Mar 2018 08:14:31 +0000 (11:14 +0300)]
usb: dwc3: gadget: always use frame number from XferNotReady

The core requires the extra two bits of information for properly
scheduling Isochronous transfers. This means that we can't rely on
__dwc3_gadget_get_frame(). Let's always cache uFrame number from
XferNotReady instead.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove unnecessary 'dwc' parameter
Felipe Balbi [Tue, 27 Mar 2018 07:53:29 +0000 (10:53 +0300)]
usb: dwc3: gadget: remove unnecessary 'dwc' parameter

Endpoint handlers need to know about endpoints, not dwc. If they
really need access to dwc (e.g. for printing error messages) we have a
reference to it tucked inside the endpoint.

This patch has no functional changes, it's simply moving things around.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: move handler closer to calling site
Felipe Balbi [Tue, 27 Mar 2018 07:47:48 +0000 (10:47 +0300)]
usb: dwc3: gadget: move handler closer to calling site

Cleanup only, no functional changes. Just making code easier to
follow.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: rename dwc3_gadget_start_isoc()
Felipe Balbi [Tue, 27 Mar 2018 07:42:59 +0000 (10:42 +0300)]
usb: dwc3: gadget: rename dwc3_gadget_start_isoc()

Cleanup only, no functional changes. This just matches the event name
with its handler.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove some pointless checks
Felipe Balbi [Tue, 27 Mar 2018 07:41:39 +0000 (10:41 +0300)]
usb: dwc3: gadget: remove some pointless checks

We *KNOW* which events we enable for which endpoint types and
we *KNOW* when they'll trigger. The endpoint type checks are
pointless.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: remove allocated/queued request tracking
Felipe Balbi [Mon, 26 Mar 2018 13:09:00 +0000 (16:09 +0300)]
usb: dwc3: gadget: remove allocated/queued request tracking

That has never proven useful in any way. Just remove it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: rename done_trbs and done_reqs
Felipe Balbi [Mon, 26 Mar 2018 12:48:22 +0000 (15:48 +0300)]
usb: dwc3: gadget: rename done_trbs and done_reqs

This patch simply renames two functions to more descriptive names so
that it's easier to understand what they're doing.

Cleanup only, no functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: don't kick transfer all the time
Felipe Balbi [Mon, 26 Mar 2018 10:32:47 +0000 (13:32 +0300)]
usb: dwc3: gadget: don't kick transfer all the time

Instead of constantly calling kick transfer everything some event
shows up, let's just rely on the fact that we send Update Transfer
every time a new request is queued.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: rename dwc3_endpoint_transfer_complete()
Felipe Balbi [Mon, 26 Mar 2018 10:29:17 +0000 (13:29 +0300)]
usb: dwc3: gadget: rename dwc3_endpoint_transfer_complete()

Now that we're making sure we don't have XferComplete events, we can
rename this function to what it actually handles:
dwc3_gadget_endpoint_transfer_in_progress()

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: XferComplete only for EP0
Felipe Balbi [Mon, 26 Mar 2018 10:26:56 +0000 (13:26 +0300)]
usb: dwc3: gadget: XferComplete only for EP0

XferComplete is enabled only for the default control pipe, let's make
that clear in the code.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: XferNotReady is Isoc-only
Felipe Balbi [Mon, 26 Mar 2018 10:26:00 +0000 (13:26 +0300)]
usb: dwc3: gadget: XferNotReady is Isoc-only

We don't use XferNotReady for anything other than Default Control
Pipe, which is handled in ep0.c, and Isochronous endpoints. Let's make
that clear in the code.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: pre-issue Start Transfer for Interrupt EPs too
Felipe Balbi [Mon, 26 Mar 2018 10:19:43 +0000 (13:19 +0300)]
usb: dwc3: gadget: pre-issue Start Transfer for Interrupt EPs too

Interrupt endpoints behave much like Bulk endpoints with the exception
that they are periodic. We can pre-issue Start Transfer exactly as we
do for Bulk endpoints.

While at that, remove one trailing blank line which is unnecessary.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: Correct the logic for queuing sgs
Anurag Kumar Vulisha [Tue, 27 Mar 2018 11:05:21 +0000 (16:35 +0530)]
usb: dwc3: gadget: Correct the logic for queuing sgs

The present code correctly fetches the req which were previously not
queued from the started_list but fails to continue queuing from the sg
where it previously stopped queuing (because of the unavailable TRB's).
This patch correct's the code to continue queuing from the correct sg
present in the sglist.

For example, consider 5 sgs in req. Because of limited TRB's among the
5 sgs only 3 got queued. This patch corrects the code to start queuing
from correct sg i.e 4th sg when the TRBs are available.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agousb: dwc3: gadget: Correct handling of scattergather lists
Anurag Kumar Vulisha [Tue, 27 Mar 2018 11:05:20 +0000 (16:35 +0530)]
usb: dwc3: gadget: Correct handling of scattergather lists

The code logic in dwc3_prepare_one_trb() incorrectly uses the address
and length fields present in req packet for mapping TRB's instead of
using the address and length fields of scattergather lists. This patch
correct's the code to use sg->address and sg->length when scattergather
lists are present.

Signed-off-by: Anurag Kumar Vulisha <anuragku@xilinx.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
6 years agoMerge 4.17-rc6 into usb-next
Greg Kroah-Hartman [Mon, 21 May 2018 06:27:15 +0000 (08:27 +0200)]
Merge 4.17-rc6 into usb-next

We want the bug fixes and this resolves the merge issues with the usbip
driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoLinux 4.17-rc6
Linus Torvalds [Sun, 20 May 2018 22:31:38 +0000 (15:31 -0700)]
Linux 4.17-rc6

6 years agoMerge branch 'parisc-4.17-5' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 20 May 2018 19:44:07 +0000 (12:44 -0700)]
Merge branch 'parisc-4.17-5' of git://git./linux/kernel/git/deller/parisc-linux

Pull parisc fixlets from Helge Deller:
 "Three small section mismatch fixes, one of them was found by 0-day
  test infrastructure"

* 'parisc-4.17-5' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Move ccio_cujo20_fixup() into init section
  parisc: Move setup_profiling_timer() out of init section
  parisc: Move find_pa_parent_type() out of init section

6 years agoMerge tag 'for-4.17-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
Linus Torvalds [Sun, 20 May 2018 19:04:27 +0000 (12:04 -0700)]
Merge tag 'for-4.17-rc5-tag' of git://git./linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
 "We've accumulated some fixes during the last week, some of them were
  in the works for a longer time but there are some newer ones too.

  Most of the fixes have a reproducer and fix user visible problems,
  also candidates for stable kernels. They IMHO qualify for a late rc,
  though I did not expect that many"

* tag 'for-4.17-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: fix crash when trying to resume balance without the resume flag
  btrfs: Fix delalloc inodes invalidation during transaction abort
  btrfs: Split btrfs_del_delalloc_inode into 2 functions
  btrfs: fix reading stale metadata blocks after degraded raid1 mounts
  btrfs: property: Set incompat flag if lzo/zstd compression is set
  Btrfs: fix duplicate extents after fsync of file with prealloc extents
  Btrfs: fix xattr loss after power failure
  Btrfs: send, fix invalid access to commit roots due to concurrent snapshotting

6 years agoMerge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 20 May 2018 18:50:27 +0000 (11:50 -0700)]
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

 - Ćukasz Stelmach spotted a couple of issues with the decompressor.

 - a couple of kdump fixes found while testing kdump

 - replace some perl with shell code

 - resolve SIGFPE breakage

 - kprobes fixes

* 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: fix kill( ,SIGFPE) breakage
  ARM: 8772/1: kprobes: Prohibit kprobes on get_user functions
  ARM: 8771/1: kprobes: Prohibit kprobes on do_undefinstr
  ARM: 8770/1: kprobes: Prohibit probing on optimized_callback
  ARM: 8769/1: kprobes: Fix to use get_kprobe_ctlblk after irq-disabed
  ARM: replace unnecessary perl with sed and the shell $(( )) operator
  ARM: kexec: record parent context registers for non-crash CPUs
  ARM: kexec: fix kdump register saving on panic()
  ARM: 8758/1: decompressor: restore r1 and r2 just before jumping to the kernel
  ARM: 8753/1: decompressor: add a missing parameter to the addruart macro

6 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 18:28:32 +0000 (11:28 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "An unfortunately larger set of fixes, but a large portion is
  selftests:

   - Fix the missing clusterid initializaiton for x2apic cluster
     management which caused boot failures due to IPIs being sent to the
     wrong cluster

   - Drop TX_COMPAT when a 64bit executable is exec()'ed from a compat
     task

   - Wrap access to __supported_pte_mask in __startup_64() where clang
     compile fails due to a non PC relative access being generated.

   - Two fixes for 5 level paging fallout in the decompressor:

      - Handle GOT correctly for paging_prepare() and
        cleanup_trampoline()

      - Fix the page table handling in cleanup_trampoline() to avoid
        page table corruption.

   - Stop special casing protection key 0 as this is inconsistent with
     the manpage and also inconsistent with the allocation map handling.

   - Override the protection key wen moving away from PROT_EXEC to
     prevent inaccessible memory.

   - Fix and update the protection key selftests to address breakage and
     to cover the above issue

   - Add a MOV SS self test"

[ Part of the x86 fixes were in the earlier core pull due to dependencies ]

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
  x86/mm: Drop TS_COMPAT on 64-bit exec() syscall
  x86/apic/x2apic: Initialize cluster ID properly
  x86/boot/compressed/64: Fix moving page table out of trampoline memory
  x86/boot/compressed/64: Set up GOT for paging_prepare() and cleanup_trampoline()
  x86/pkeys: Do not special case protection key 0
  x86/pkeys/selftests: Add a test for pkey 0
  x86/pkeys/selftests: Save off 'prot' for allocations
  x86/pkeys/selftests: Fix pointer math
  x86/pkeys: Override pkey when moving away from PROT_EXEC
  x86/pkeys/selftests: Fix pkey exhaustion test off-by-one
  x86/pkeys/selftests: Add PROT_EXEC test
  x86/pkeys/selftests: Factor out "instruction page"
  x86/pkeys/selftests: Allow faults on unknown keys
  x86/pkeys/selftests: Avoid printf-in-signal deadlocks
  x86/pkeys/selftests: Remove dead debugging code, fix dprint_in_signal
  x86/pkeys/selftests: Stop using assert()
  x86/pkeys/selftests: Give better unexpected fault error messages
  x86/selftests: Add mov_to_ss test
  x86/mpx/selftests: Adjust the self-test to fresh distros that export the MPX ABI
  x86/pkeys/selftests: Adjust the self-test to fresh distros that export the pkeys ABI
  ...

6 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 18:25:54 +0000 (11:25 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull UP timer fix from Thomas Gleixner:
 "Work around the for_each_cpu() oddity on UP kernels in the tick
  broadcast code which causes boot failures because the CPU0 bit is
  always reported as set independent of the cpumask content"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick/broadcast: Use for_each_cpu() specially on UP kernels

6 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 18:23:34 +0000 (11:23 -0700)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixlets from Thomas Gleixner:
 "Three trivial fixlets for the scheduler:

   - move print_rt_rq() and print_dl_rq() declarations to the right
     place

   - make grub_reclaim() static

   - fix the bogus documentation reference in Kconfig"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Fix documentation file path
  sched/deadline: Make the grub_reclaim() function static
  sched/debug: Move the print_rt_rq() and print_dl_rq() declarations to kernel/sched/sched.h

6 years agoMerge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 18:20:40 +0000 (11:20 -0700)]
Merge branch 'ras-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull RAS fix from Thomas Gleixner:
 "Fix a regression in the new AMD SMCA code which issues an SMP function
  call from the early interrupt disabled region of CPU hotplug. To avoid
  that, use cached block addresses which can be used directly"

* 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/MCE/AMD: Cache SMCA MISC block addresses

6 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 18:18:42 +0000 (11:18 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf tooling fixes from Thomas Gleixner:

 - fix segfault when processing unknown threads in cs-etm

 - fix "perf test inet_pton" on s390 failing due to missing inline

 - display all available events on 'perf annotate --stdio'

 - add missing newline when parsing an empty BPF program

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Add missing newline when parsing empty BPF proggie
  perf cs-etm: Remove redundant space
  perf cs-etm: Support unknown_thread in cs_etm_auxtrace
  perf annotate: Display all available events on --stdio
  perf test: "probe libc's inet_pton" fails on s390 due to missing inline

6 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 20 May 2018 17:43:27 +0000 (10:43 -0700)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Thomas Gleixner:
 "Two fixes to address shortcomings of the rwsem/percpu-rwsem lock
  debugging code which emits false positive warnings when the rwsem is
  anonymously locked and unlocked"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/percpu-rwsem: Annotate rwsem ownership transfer by setting RWSEM_OWNER_UNKNOWN
  locking/rwsem: Add a new RWSEM_ANONYMOUSLY_OWNED flag