01 Jul, 2020
1 commit
-
[ Upstream commit ea0efd687b01355cd799c8643d0c636ba4859ffc ]
This driver assumed that dmaengine_tx_status() could return
the residue even if the transfer was completed. However,
this was not correct usage [1] and this caused to break getting
the residue after the commit 24461d9792c2 ("dmaengine:
virt-dma: Fix access after free in vchan_complete()") actually.
So, this is possible to get wrong received size if the usb
controller gets a short packet. For example, g_zero driver
causes "bad OUT byte" errors.The usb-dmac driver will support the callback_result, so this
driver can use it to get residue correctly. Note that even if
the usb-dmac driver has not supported the callback_result yet,
this patch doesn't cause any side-effects.[1]
https://lore.kernel.org/dmaengine/20200616165550.GP2324254@vkoul-mobl/Reported-by: Hien Dang
Fixes: 24461d9792c2 ("dmaengine: virt-dma: Fix access after free in vchan_complete()")
Signed-off-by: Yoshihiro Shimoda
Link: https://lore.kernel.org/r/1592482277-19563-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
31 Dec, 2019
1 commit
-
[ Upstream commit 39abcc84846bbc0538f13c190b6a9c7e36890cd2 ]
When R-Car Gen3 USB 2.0 is in Gadget mode, if host is detached an interrupt
will be generated and Suspended state bit is set in interrupt status
register. Interrupt handler will call driver->suspend(composite_suspend)
if suspended state bit is set. composite_suspend will call
ffs_func_suspend which will post FUNCTIONFS_SUSPEND and will be consumed
by user space application via /dev/ep0.To be able to detect host detach, extend the DVSQ_MASK to cover the
Suspended bit of the DVSQ[2:0] bitfield from the Interrupt Status
Register 0 (INTSTS0) register and perform appropriate action in the
DVST interrupt handler (usbhsg_irq_dev_state).Without this commit, disconnection of the phone from R-Car-H3 ES2.0
Salvator-X CN9 port is not recognized and reverse role switch does
not happen. If phone is connected again it does not enumerate.With this commit, disconnection will be recognized and reverse role
switch will happen by a user space application. If phone is connected
again it will enumerate properly and will become visible in the output
of 'lsusb'.Signed-off-by: Veeraiyan Chidambaram
Signed-off-by: Eugeniu Rosca
Reviewed-by: Yoshihiro Shimoda
Tested-by: Yoshihiro Shimoda
Link: https://lore.kernel.org/r/1568207756-22325-3-git-send-email-external.veeraiyan.c@de.adit-jv.com
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
27 Oct, 2019
3 commits
-
Fix the type of buf in __usbhsg_recip_send_status to
be __le16 to avoid the following sparse warning:drivers/usb/renesas_usbhs/mod_gadget.c:335:14: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/mod_gadget.c:335:14: expected unsigned short
drivers/usb/renesas_usbhs/mod_gadget.c:335:14: got restricted __le16 [usertype]Reviewed-by: Yoshihiro Shimoda
Signed-off-by: Ben Dooks
Signed-off-by: Felipe Balbi -
This patch fixes the following sparse warnings by shifting 8-bits after
le16_to_cpu().drivers/usb/renesas_usbhs/mod_gadget.c:268:47: warning: restricted __le16 degrades to integer
drivers/usb/renesas_usbhs/mod_gadget.c:268:47: warning: cast to restricted __le16Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Felipe Balbi -
Fix the warnings generated by casting to/from __le16 without
using the correct functions.Fixes the following sparse warnings:
drivers/usb/renesas_usbhs/common.c:165:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:165:25: expected restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:165:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:166:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:166:25: expected restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:166:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:167:25: warning: incorrect type in assignment (different base types)
drivers/usb/renesas_usbhs/common.c:167:25: expected restricted __le16 [usertype] wLength
drivers/usb/renesas_usbhs/common.c:167:25: got unsigned short
drivers/usb/renesas_usbhs/common.c:173:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:173:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:173:39: got restricted __le16 [usertype] wValue
drivers/usb/renesas_usbhs/common.c:174:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:174:39: expected unsigned short [usertype] data
drivers/usb/renesas_usbhs/common.c:174:39: got restricted __le16 [usertype] wIndex
drivers/usb/renesas_usbhs/common.c:175:39: warning: incorrect type in argument 3 (different base types)
drivers/usb/renesas_usbhs/common.c:175:39: expected unsigned short [usertype] dataNote. I belive this to be correct, and should be a no-op on arm.
Reviewed-by: Geert Uytterhoeven
Reviewed-by: Yoshihiro Shimoda
Signed-off-by: Ben Dooks
Signed-off-by: Felipe Balbi
04 Oct, 2019
2 commits
-
According to usb_ep_set_halt()'s description,
__usbhsg_ep_set_halt_wedge() should return -EAGAIN if the IN endpoint
has any queue or data. Otherwise, this driver is possible to cause
just STALL without sending a short packet data on g_mass_storage driver,
and then a few resetting a device happens on a host side during
a usb enumaration.Fixes: 2f98382dcdfe ("usb: renesas_usbhs: Add Renesas USBHS Gadget")
Cc: # v3.0+
Signed-off-by: Yoshihiro Shimoda
Link: https://lore.kernel.org/r/1569924633-322-3-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman -
The commit 97664a207bc2 ("usb: renesas_usbhs: shrink spin lock area")
had added a usbhsg_pipe_disable() calling into
__usbhsg_ep_set_halt_wedge() accidentally. But, this driver should
not call the usbhsg_pipe_disable() because the function discards
all queues. So, this patch removes it.Fixes: 97664a207bc2 ("usb: renesas_usbhs: shrink spin lock area")
Cc: # v3.1+
Signed-off-by: Yoshihiro Shimoda
Link: https://lore.kernel.org/r/1569924633-322-2-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman
22 Aug, 2019
1 commit
-
The usb core is the only major place in the kernel that checks for
a non-NULL device dma_mask to see if a device is DMA capable. This
is generally a bad idea, as all major busses always set up a DMA mask,
even if the device is not DMA capable - in fact bus layers like PCI
can't even know if a device is DMA capable at enumeration time. This
leads to lots of workaround in HCD drivers, and also prevented us from
setting up a DMA mask for platform devices by default last time we
tried.Replace this guess with an explicit HCD_DMA that is set by drivers that
appear to have DMA support.Signed-off-by: Christoph Hellwig
Link: https://lore.kernel.org/r/20190816062435.881-4-hch@lst.de
Signed-off-by: Greg Kroah-Hartman
03 Jul, 2019
2 commits
-
…balbi/usb into usb-next
Felipe writes:
USB: more changes for v5.3 merge window
Turns out a few more important changes came about. We have the new
Cadence DRD Driver being added here and that's the biggest, most
important part.Together with that we have suport for new imx7ulp phy. Support for
TigerLake Devices on dwc3. Also a couple important fixes which weren't
completed in time for the -rc cycle.Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
* tag 'usb-for-v5.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
usb: renesas_usbhs: add a workaround for a race condition of workqueue
usb: gadget: udc: renesas_usb3: remove redundant assignment to ret
usb: dwc2: use a longer AHB idle timeout in dwc2_core_reset()
USB: gadget: function: fix issue Unneeded variable: "value"
usb: phy: phy-mxs-usb: add imx7ulp support
doc: dt-binding: mxs-usb-phy: add compatible for 7ulp
usb:cdns3 Fix for stuck packets in on-chip OUT buffer.
usb:cdns3 Add Cadence USB3 DRD Driver
usb:gadget Simplify usb_decode_get_set_descriptor function.
usb:gadget Patch simplify usb_decode_set_clear_feature function.
usb:gadget Separated decoding functions from dwc3 driver.
dt-bindings: add binding for USBSS-DRD controller.
usb: dwc3: pci: add support for TigerLake Devices -
The old commit 6e4b74e4690d ("usb: renesas: fix scheduling in atomic
context bug") fixed an atomic issue by using workqueue for the shdmac
dmaengine driver. However, this has a potential race condition issue
between the work pending and usbhsg_ep_free_request() in gadget mode.
When usbhsg_ep_free_request() is called while pending the queue,
since the work_struct will be freed and then the work handler is
called, kernel panic happens on process_one_work().To fix the issue, if we could call cancel_work_sync() at somewhere
before the free request, it could be easy. However,
the usbhsg_ep_free_request() is called on atomic (e.g. f_ncm driver
calls free request via gether_disconnect()).For now, almost all users are having "USB-DMAC" and the DMAengine
driver can be used on atomic. So, this patch adds a workaround for
a race condition to call the DMAengine APIs without the workqueue.This means we still have TODO on shdmac environment (SH7724), but
since it doesn't have SMP, the race condition might not happen.Fixes: ab330cf3888d ("usb: renesas_usbhs: add support for USB-DMAC")
Cc: # v4.1+
Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Felipe Balbi
26 Jun, 2019
13 commits
-
Now the driver fixes the issue of the commit 482982062f1b ("usb:
gadget: renesas_usbhs: bugfix: don't modify platform data") by
using usbhs_mod_info.get_vbus, this patches uses the pointer
instead of copied value to avoid redundancy. Note that struct
renesas_usbhs_driver_param has to use copied value because
the driver has to set some members (e.g. buswait_bwait).Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
In device tree environment, the previous code allocates
renesas_usbhs_platform_info by using devm_kzalloc() and then copies
usbhs_of_data to the allocated memory. This reason is some values
(e.g. .platform_callback.get_vbus) are overwritten by the driver,
but the of_device_id.data is "const". Now the driver doesn't have
such a code, so this patch uses renesas_usbhs_platform_info on
of_device_id.data.Note that the previous code set the pdev->dev.platform_data pointer
even if device tree environment, but the value is not used. So,
this patch also remove such a code.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
All platform related codes (rcar[23].c and rza{2}.c) has its own
.get_id function as "USBHS_GADGET". So, we can use a common
function for it.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
In the future, each struct renesas_usbhs_driver_param is stored on
the each platform related source code (e.g. rcar3.c) to remove
usbhs_parse_dt(). So, this patch moves device tree properties
parsing to usbhs_probe().Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
Since this can remove over 80 charactors in a line, this patch adds
struct device * declaration in usbhs_probe().Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
In the future, each struct renesas_usbhs_driver_param is stored on
the each platform related source code (e.g. rcar3.c). So, to simplify
the source code, this patch adds a new flag has_new_pipe_configs.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
This patch uses the dev_of_node macro instead of open coded
to be better.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
Now no one uses the type member so that this patch removes it.
Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
To remove the type of renesas_usbhs_driver_param in the future, this
patch uses a specific flag "multi_clks".Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
The very old commit 482982062f1b ("usb: gadget: renesas_usbhs:
bugfix: don't modify platform data") changed to use copied whole
structures values to fix the "hung-up" issue. However, we also
can fix the issue if the driver copies the get_vbus function
pointer to the driver's value.So, this patch adds get_vbus member into struct usbhs_mod_info and
use the pointer instead of struct renesas_usbhs_platform_callback.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
In the future, since other source code of this driver will use these
macros, this patch moves it to the header file.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
The notify_hotplug callback was supported in v3.10, but the last user
(armadillo800eva) was removed by the commit 1fa59bda21c7 ("ARM: shmobile:
Remove legacy board code for Armadillo-800 EVA"). So, this patch
removes it.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman -
Since the irq_vbus comments doesn't match with the current
implementation, this patch revises it. This patch also changes
new lines to reduce the source code lines.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman
20 Jun, 2019
1 commit
-
To avoid the error-proneness of calls to sizeof() in the memcpy,
this patch uses struct assignment instead of memcpy.Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman ---
This patch is based on Greg's linux-usb.git / usb-next branch.
Note that mod_host.c also has memcpy but we cannot use struct assignment
for it because the type of urb->setup_patcket is just "unsigned char *".drivers/usb/renesas_usbhs/common.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)Signed-off-by: Greg Kroah-Hartman
05 Jun, 2019
2 commits
-
Controlling PWMEN/EXTLP (named as "has_otg") was supported in v3.2,
but the last user (kzm9g) was removed by the commit 30f8925a57d8ad49
("ARM: shmobile: Remove legacy board code for KZM-A9-GT"). So, this
patch remove it.Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Geert Uytterhoeven
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
SUDMAC feature was supported in v3.10, but was never used by
any platform. So, this patch removes it.Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Geert Uytterhoeven
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman
21 May, 2019
6 commits
-
The RZ/A2 is similar to the R-Car Gen3 with some small differences.
Signed-off-by: Chris Brandt
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
Some SoC have a CFIFO register that is byte addressable. This means
when the CFIFO access is set to 32-bit, you can write 8-bit values to
addresses CFIFO+0, CFIFO+1, CFIFO+2, CFIFO+3.Signed-off-by: Chris Brandt
Reviewed-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
For some SoC, CNEN must be set for USB Device mode operation.
Signed-off-by: Chris Brandt
Reviewed-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
Move options from 'flags' field in private structure to param structure
where other options are already being kept.Signed-off-by: Chris Brandt
Reviewed-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
'default n' is the default value for any bool or tristate Kconfig
setting so there is no need to write it explicitly.Also since commit f467c5640c29 ("kconfig: only write '# CONFIG_FOO
is not set' for visible symbols") the Kconfig behavior is the same
regardless of 'default n' being present or not:...
One side effect of (and the main motivation for) this change is making
the following two definitions behave exactly the same:config FOO
boolconfig FOO
bool
default nWith this change, neither of these will generate a
'# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
That might make it clearer to people that a bare 'default n' is
redundant.
...Signed-off-by: Bartlomiej Zolnierkiewicz
Signed-off-by: Greg Kroah-Hartman -
This patch adds a specific struct "usbhs_of_data" to add a new SoC
data easily instead of code basis in the future.Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Geert Uytterhoeven
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman
19 Feb, 2019
1 commit
-
There is a spelling mistake in a dev_err message. Fix it.
Signed-off-by: Colin Ian King
Acked-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman
18 Jan, 2019
1 commit
-
According to Documentation/timers/timers-howto.txt, a driver should
use usleep_range() instead of udelay() on NON-ATOMIC CONTEXT if
"SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms)".Since the .hardware_init() and .power_ctrl() will run on NON-ATOMIC
CONTEXT, this patch replaces udelay() with usleep_range().Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman
17 Dec, 2018
1 commit
-
HS-USB found in RZ/G2E (a.k.a. r8a774c0) is very similar to the
one found in R-Car E3 (a.k.a. r8a77990), as it needs to release
the PLL reset by the UGCTRL register like R-Car E3, therefore add
r8a774c0 support in a similar fashion to what was done for the
r8a77990.Signed-off-by: Fabrizio Castro
Reviewed-by: Simon Horman
Acked-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman
12 Dec, 2018
1 commit
-
Without CONFIG_PM, we get a new build warning here:
drivers/usb/renesas_usbhs/common.c:860:12: error: 'usbhsc_resume' defined but not used [-Werror=unused-function]
static int usbhsc_resume(struct device *dev)
^~~~~~~~~~~~~
drivers/usb/renesas_usbhs/common.c:844:12: error: 'usbhsc_suspend' defined but not used [-Werror=unused-function]
static int usbhsc_suspend(struct device *dev)
^~~~~~~~~~~~~~Fixes: d54d334e75b9 ("usb: renesas_usbhs: Use SIMPLE_DEV_PM_OPS macro")
Signed-off-by: Arnd Bergmann
Reviewed-by: Yoshihiro Shimoda
Signed-off-by: Greg Kroah-Hartman
05 Dec, 2018
2 commits
-
This patch uses SIMPLE_DEV_PM_OPS macro instead of struct dev_pm_ops
directly.Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Felipe Balbi -
Platform drivers don't need dummy runtime PM callbacks that just return
success in order to have runtime PM happening. This has changed since
following commits:commit 05aa55dddb9e ("PM / Runtime: Lenient generic runtime pm callbacks")
commit 543f2503a956 ("PM / platform_bus: Allow runtime PM by default")
commit 8b313a38ecff ("PM / Platform: Use generic runtime PM callbacks directly")Signed-off-by: Jarkko Nikula
Reviewed-by: Yoshihiro Shimoda
Acked-by: Wolfram Sang
[shimoda: revise git commit description style]
Signed-off-by: Yoshihiro Shimoda
Signed-off-by: Felipe Balbi
28 Sep, 2018
2 commits
-
This patch adds support for R-Car E3. This SoC needs to release
the PLL reset by the UGCTRL register like R-Car D3. So, this patch
adds a usbhs_of_match entry for this SoC with
"USBHS_TYPE_RCAR_GEN3_WITH_PLL".Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman -
Since R-Car D3 can use OTG mode, this patch changes the UGCTRL2
value to UGCTRL2_USB0SEL_OTG and UGCTRL2_VBUSSEL like other R-Car
Gen3 SoCs.Signed-off-by: Yoshihiro Shimoda
Reviewed-by: Simon Horman
Signed-off-by: Greg Kroah-Hartman