Commit Graph

1073001 Commits

Author SHA1 Message Date
Ding Wei
fee9944154 ARM: dts: rockchip: rk3288 add clk-rates setting for vdpu and rkvdec
Change-Id: Ibd695ef470c40829a348c660dd94de3f6a2b320c
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2022-11-17 14:26:53 +08:00
Chen Jinsen
2e18f6fc32 ARM: dts: rockchip: vdpu support automatic frequency for rk3288
Signed-off-by: Chen Jinsen <kevin.chen@rock-chips.com>
Change-Id: I0378d57524d1b7146dbebec3d4fa9c125430b0d0
2022-11-17 14:26:53 +08:00
Ding Wei
a9175d765e video: rockchip: mpp: deal with the case for iommu share
In platform arm32, iommu is shared in different device,
it must attach to ensure hardware working in current device.

Change-Id: I854a362adf6145dcfd796885922683f8a6b7e131
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2022-11-17 14:26:53 +08:00
Su Yuefu
d55a25476c media: i2c: gc3003: pm_runtime_put device until stream_off for thunderboot
Signed-off-by: Su Yuefu <yuefu.su@rock-chips.com>
Change-Id: I041b9cdb4a3416951e5d3855e2d4400db84e3c94
2022-11-17 14:19:33 +08:00
Su Yuefu
927e0f59f7 media: i2c: sc200ai: pm_runtime_put device until stream_off for thunderboot
Signed-off-by: Su Yuefu <yuefu.su@rock-chips.com>
Change-Id: I5754491e2d5344efcfe41897a241435b21804593
2022-11-17 14:19:17 +08:00
Su Yuefu
660f1d040d media: i2c: sc230ai: pm_runtime_put device until stream_off for thunderboot
Signed-off-by: Su Yuefu <yuefu.su@rock-chips.com>
Change-Id: If328b3af33d14fdc5309c35d6e3a222abbcb47ec
2022-11-17 14:18:51 +08:00
Cai YiWei
797a0b4b11 media: rockchip: isp: fix stats buf update for multi sensor
Change-Id: Ic1a8b62ab73b0076a83033c350759be71df53793
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2022-11-17 14:16:41 +08:00
Jon Lin
b7cf98650b mtd: spi-nor: core: Support misc devices
Calling ioctl PCIE_DMA_GET_FLASH_INFO to get spi nor id.

Change-Id: I1ecfdd527f18c0c323fba9673546c167032d1726
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2022-11-17 12:06:59 +08:00
Shawn Lin
5083234249 mmc: dw_mmc: Remove useless SDMMC_INT_TXDR and SDMMC_INT_RXDR
These two interrupts are managed by data routine and not need to
enable it via runtime_resume each time.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Change-Id: I9ef2ae0acabefeba4a69ff6b4c7edc3c0318fdeb
2022-11-17 11:53:30 +08:00
Jon Lin
416f4a15a4 PCI: rockchip: dw: Add cache clean for dma read test
Add cache clean for coherent when DMA is running.

Change-Id: Ic5df0588009367de6716db9c6cc418b05e8a43f6
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2022-11-16 21:07:01 +08:00
Sugar Zhang
89764514b7 ASoC: rockchip: pdm: Shift rate back to 0 ppm when restart
Change-Id: Ibb867e8b1a9a553a3077a7c91d415eea82cc76ba
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: XiaoTan Luo <lxt@rock-chips.com>
2022-11-16 19:20:31 +08:00
Sugar Zhang
28567ec23e ASoC: rockchip: pdm: Add support for clk compensation
This patch introduces a method to handle clk drift and compensation.

e.g:

/# amixer contents
numid=1,iface=PCM,name='PCM Clk Compensation In PPM'
; type=INTEGER,access=rw------,values=1,min=-1000,max=1000,step=1
: values=0

/# arecord -D hw:0,0 --period-size=1024 --buffer-size=4096 -r
16000 -c 2 -f s16_le /dev/zero &

/# amixer -- cset numid=1 -10
numid=1,iface=PCM,name='PCM Clk Compensation In PPM'
; type=INTEGER,access=rw------,values=1,min=-1000,max=1000,step=1
: values=-10

/# amixer -- cset numid=1 10
numid=1,iface=PCM,name='PCM Clk Compensation In PPM'
; type=INTEGER,access=rw------,values=1,min=-1000,max=1000,step=1
: values=10

Change-Id: Ibc70ce8ccec6dddb082161fa544d066c706c37bc
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Signed-off-by: XiaoTan Luo <lxt@rock-chips.com>
2022-11-16 19:20:23 +08:00
Andy Yan
72fafe97a1 drm/rockchip: Add dynamic debug
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Change-Id: I441245ec77122dae766c9e175d182ee6d15e217f
2022-11-16 17:18:44 +08:00
Caesar Wang
fb22b123d6 arm64: dts: rockchip: use new type-c framework on rk3399pro evb boards
Amends to support the new type-c framework.

Change-Id: I060da4667e6a5da9477841f80995c459021ef345
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2022-11-16 16:46:48 +08:00
William Wu
a9a4f474d7 usb: dwc3: gadget: fix deadlock in kick transfer
If kick transfer command fail and the return value isn't
EAGAIN, the current code will issue end transfer command
to stop the active transfer, and only set dep->flags with
DWC3_EP_END_TRANSFER_PENDING if the end transfer command
is done successfully. If the DWC3_EP_END_TRANSFER_PENDING
isn't set, it cleanup the cancelled requests and give the
request back to the gadget layer immediately.

For uvc gadget, the uvc gadget driver hold spinlock and
then call usb_ep_queue() to submit uvc usb request to dwc3
controller. The dwc3 controller may kick transfer for the
request sequentially, if the kick transfer command and
the end transfer command all failed, the dwc3 will give
the request back to the uvc gadget driver via the request
complete function uvc_video_complete(), in this function,
it try to get the spinlock again that lead to deadlock.

This case always happens with the following warning log:

WARNING: CPU: 0 PID: 14450 at drivers/usb/dwc3/gadget.c:1839 __dwc3_gadget_kick_transfer+0x3a0/0x3b0
...
Workqueue: events uvcg_video_pump
...
Call trace:
 __dwc3_gadget_kick_transfer+0x3a0/0x3b0
 __dwc3_gadget_ep_queue+0x128/0x1f0
 dwc3_gadget_ep_queue+0x40/0x6c
 usb_ep_queue+0x44/0x100
 uvcg_video_pump+0xd0/0x1d4
 process_one_work+0x1f4/0x490
 worker_thread+0x278/0x4dc
 kthread+0x13c/0x344
 ret_from_fork+0x10/0x30

Fixes: 0ec00e864a ("UPSTREAM: usb: dwc3: gadget: move cmd_endtransfer to extra function")
Change-Id: I43d455a45d542efcaa9234de60e37277611b3c47
Signed-off-by: William Wu <william.wu@rock-chips.com>
2022-11-16 16:09:26 +08:00
Jianwei Fan
9086c42501 media: i2c: imx577: fix configuration of HDR2 30fps
Change-Id: Iea82c79fd52a30f06fcbd6d0782958ebead9ee96
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
2022-11-16 16:05:11 +08:00
Jianwei Fan
933af6b20c media: i2c: sensors: fix pm_runtime_put issue in HDR mode
Change-Id: I11189e30eeb5ac2b7073888329e819a9a7f6b074
Signed-off-by: Jianwei Fan <jianwei.fan@rock-chips.com>
2022-11-16 07:39:24 +00:00
Jon Lin
62d3af47b8 PCI: rockchip: dw: Fix error in calling dw_pcie_prog_inbound_atu function
drivers/pci/controller/dwc/pcie-dw-ep-rockchip.c:533:70: error: too few arguments to function call, expected 6, have 5
        ret = dw_pcie_prog_inbound_atu(pci, free_win, bar, cpu_addr, as_type);

Change-Id: Iaa3083f6cfe4edbba422fff5a245515f40c70db4
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2022-11-16 11:56:22 +08:00
Jacob Chen
4e8fc0099d MALI: utgard: fix mali_mmap failed
Validate vmf_insert_pfn return value with VM_FAULT_NOPAGE

Signed-off-by: Jacob Chen <cc@rock-chips.com>
Change-Id: I53b1eabd20ab76f08f5edf571ead1ffaccd19ec1
2022-11-16 10:48:04 +08:00
Jianqun Xu
b199fc40bf ARM: dts: rockchip: rk3288-evb hdmi use i2c-hdmi instead of i2c5
Fix the error from pinctrl
[    5.112827] rockchip-pinctrl pinctrl: could not request pin 235 (gpio7-19) from group i2c5-xfer  on device rockchip-pinctrl
[    5.123951] rk3x-i2c ff170000.i2c: Error applying setting, reverse things back
[    5.131207] rk3x-i2c: probe of ff170000.i2c failed with error -22

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I7bdf76832fb2805ced05f0a5bb52612f528d8ebf
2022-11-16 10:39:31 +08:00
Wyon Bi
672b2060ed drm/bridge: analogix_dp: Compatible for EXTCON_DISP_EDP cable
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Change-Id: I042d3f855fdb09f971d9d533951c267686a57245
2022-11-16 10:24:24 +08:00
William Wu
b37ab4ccd0 usb: gadget: uvc: wait for req complete before free req
when uvc calls uvcg_video_enable() to disable the video
stream, it dequeues all requests from the usb endpoint,
and it expects the usb controller to giveback the requests
immediately, and then it can free the requests safely.
But for usb dwc3 controller, it doesn't giveback the
started requests in dequeue ops. Instead, it issues the
end transfer command and  wait for the command completion
IRQ, then giveback the requests to uvc. If the uvc driver
free req before the command completion IRQ, it will led
to null pointer dereference problem. So need to wait
for the req complete before free it.

Example call stack on RK3588 platform:

Thread#1:
uvcg_video_enable()
 -> usb_ep_dequeue()
  -> dwc3_gadget_ep_dequeue()
   -> dwc3_stop_active_transfer()
      issue end transfer command
    -> dwc3_gadget_move_cancelled_request()
     ...
      -> uvc_video_free_requests()
       -> Thread#2 executes

Thread#2:
dwc3 end transfer command completion IRQ occurs
dwc3_gadget_endpoint_command_complete()
 -> dwc3_gadget_ep_cleanup_cancelled_requests()
  -> dwc3_gadget_giveback()
   -> usb_gadget_giveback_request()
    -> uvc_video_complete()

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I0bcb8d18e851448fc973f901d74afa19ab1e2406
2022-11-16 10:13:37 +08:00
Michael Wu
7e31422aa4 UPSTREAM: extcon: Add EXTCON_DISP_CVBS and EXTCON_DISP_EDP
Add EXTCON_DISP_CVBS for Composite Video Broadcast Signal.
Add EXTCON_DISP_EDP for Embedded Display Port

[1] https://en.wikipedia.org/wiki/Composite_video
[2] https://en.wikipedia.org/wiki/DisplayPort#eDP

Signed-off-by: Michael Wu <michael@allwinnertech.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
(cherry picked from commit 3a06ed8026)
Change-Id: I95d278eb158341ea3d08d16e7c300a775107c302
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2022-11-16 09:52:56 +08:00
Jianqun Xu
b983e5d5b5 ARM: dts: rockchip: rk3288-evb: fix edp panel node
Rockchip kernel uses the simple-panel driver.
Fixes: 8039c828a6 ("ARM: dts: rockchip: Kill off "simple-panel" compatibles")

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: Ic3398aba021cafaca2f092668d27c0c7ca2854a0
2022-11-16 09:51:07 +08:00
Jianqun Xu
af9e6b8f04 iommu/iova: fix cpu from 'unsigned long' to 'unsigned int' for for_each_online_cpu
Fixes: 4fe55239b3 ("iommu/iova: add iova procfs for each dma iommu")

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I2206cec92eaca795faaf18df6117b36108ea75b4
2022-11-15 17:54:20 +08:00
Yandong Lin
411f2d11ee arm64: dts: rockchip: px30: fix enc and dec run at the same issue
Due to the particularity of the px30 iommu, it is necessary to configure
the grf to switch iommu.
So need to configure rockchip,shootdown-entire to prevent a case from
happening: when one device is running, the task of another device
operates iommu when doing map.

This commit relies on the following commit:
commit 3b67ff56d6 ("video: rockchip: mpp: add iommu flush tlb before hw run for px30")

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Ifd94ab4b5d7f53f711320b608ff105539fd9b38d
2022-11-15 17:52:15 +08:00
Yandong Lin
3b67ff56d6 video: rockchip: mpp: add iommu flush tlb before hw run for px30
Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: I20ae76b0890a8f6bee158a5a5c4dddd4d660e74a
2022-11-15 17:50:41 +08:00
William Wu
886953b713 arm64: dts: rockchip: rk3568: add quirk-skip-phy-init for usb otg0
The rk3568 usb dwc3 controller has phy management at its
own driver to cover both device and host mode. And for
usb otg0, it enable device wakeup that make the usb hcd
core to keep the phy initialized so the device can wake
up the system. However, most of rk3568 platforms power
off the logic and cause phy grf lost power, thus we need
to add quirk-skip-phy-init to reinit phy grf upon system
resume.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: I14061e3b8bad05818e8496d4710695ef31deed9f
2022-11-15 17:38:32 +08:00
Finley Xiao
abb9ecec3d arm64: dts: rockchip: rk3399: Change low temperature to 10 degrees C
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I9f17e4f89a1552115b0d4a34f2290e785990c8bb
2022-11-15 14:50:24 +08:00
Jianqun Xu
6b444336b5 ARM: dts: rockchip: rk3288-linux use fiq as console
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I2c67d7e541425667cdb41d6133538acaba665e0d
2022-11-15 14:07:56 +08:00
Jianlong Wang
9b45bb6e86 ARM: configs: add fragment defconfig for rk312x
generate by:
    make ARCH=arm rockchip_linux_defconfig
    cp .config rockchip_linux.config

    make ARCH=arm rockchip_linux_defconfig rk3126_linux.config
    scripts/diffconfig -m rockchip_linux.config .config > \
        arch/arm/configs/rk3126_linux.config

    make ARCH=arm rockchip_linux_defconfig rk3126_linux_slc_nand.config
    scripts/diffconfig -m rockchip_linux.config .config > \
        arch/arm/configs/rk3126_linux_slc_nand.config

    make ARCH=arm rockchip_linux_defconfig rk3128_linux.config
    scripts/diffconfig -m rockchip_linux.config .config > \
        arch/arm/configs/rk3128_linux.config

Change-Id: I25fef40998b06ede079704fe7fc2f3b49d5b55c4
Signed-off-by: Jianlong Wang <jianlong.wang@rock-chips.com>
2022-11-15 10:49:18 +08:00
Jianqun Xu
6a7a7f513d ARM: dts: rockchip: rk3288 fix gpu node to match midgard driver
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Change-Id: I74cfa3309c76ca01df9b42ff39ce51c719189258
2022-11-15 10:39:50 +08:00
Damon Ding
69870f9db0 ARM: dts: rockchip: rk3288: fix display related nodes
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Change-Id: I0f1dda389fe89f06495661baeb3c21edbc18dfbe
2022-11-15 10:37:59 +08:00
Wyon Bi
1e6ad41b1d ARM: dts: rockchip: rk3288: Fix edp node
Change-Id: I01855dd3ef2ea3be1db063e35f9aebd815fd66ba
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2022-11-15 10:37:59 +08:00
Damon Ding
36f27e6905 ARM: dts: rockchip: rk3288: assign clock rate for ACLK_VIO0 and ACLK_VIO1
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Change-Id: I87fbbe3e043b040f8b9b9c79f21a8327b8e32bd0
2022-11-15 10:37:59 +08:00
Damon Ding
ff311139ed ARM: dts: rockchip: rk3288: remove PLL_CPLL assignment from cru node
PLL_CPLL is for VOP only, which does not need to be
initialized in CRU.

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Change-Id: Ic51b4e2ef377ee6f796e807131f1fe02d0db39cc
2022-11-15 10:37:59 +08:00
Yu Qiaowei
4bcdb727b2 video: rockchip: rga3: fix leak of release_fence_fd
When there is no acquire_fence, the allocated release_fence_fd must be
closed when the job submission fails, and it is unreasonable to require
user-space to close.

Update driver version to 1.2.22

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: Ie7c3006968dbb1ba22e21d6de65037183386112e
2022-11-14 19:40:19 +08:00
Algea Cao
36d1125cc4 drm/bridge: synopsys: dw-hdmi-qp: Fix hdmi phy power off in DVI mode
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I28d38dbc944f6760469c34b7b6a19675835daa41
2022-11-14 17:18:32 +08:00
Weixin Zhou
676fc5d2c5 arm64: dts: rockchip: rk3399: add gpio drive strength 10ma
Change-Id: Iff6303af2e87425b0509fd962b9e6b2fca8eb896
Signed-off-by: Weixin Zhou <zwx@rock-chips.com>
2022-11-14 15:36:27 +08:00
Lin Jinhan
e77294b62b crypto: rockchip: fix crush when skcipher fallback alloc failed
Change-Id: Ia48f7daac3de6f70896964c73fa87ed090aa2fa6
Signed-off-by: Lin Jinhan <troy.lin@rock-chips.com>
2022-11-14 09:27:39 +08:00
Thinh Nguyen
1179c4729a UPSTREAM: usb: dwc3: gadget: Don't delay End Transfer on delayed_status
The gadget driver may wait on the request completion when it sets the
USB_GADGET_DELAYED_STATUS. Make sure that the End Transfer command can
go through if the dwc->delayed_status is set so that the request can
complete. When the delayed_status is set, the Setup packet is already
processed, and the next phase should be either Data or Status. It's
unlikely that the host would cancel the control transfer and send a new
Setup packet during End Transfer command. But if that's the case, we can
try again when ep0state returns to EP0_SETUP_PHASE.

Change-Id: Ie99f8e9306e1212dd602a8d9345dd5fabb640b0d
Fixes: e1ee843488 ("usb: dwc3: gadget: Force sending delayed status during soft disconnect")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3f9f59e5d74efcbaee444cf4b30ef639cc7b124e.1666146954.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 4db0fbb601)
2022-11-11 20:03:32 +08:00
Wesley Cheng
313d6a04df UPSTREAM: usb: dwc3: gadget: Do not clear ep delayed stop flag during ep disable
DWC3_EP_DELAYED_STOP is utilized to defer issuing the end transfer command
until the subsequent SETUP stage, in order to avoid end transfer timeouts.
During cable disconnect scenarios, __dwc3_gadget_ep_disable() is
responsible for ensuring endpoints have no active transfers pending.  Since
dwc3_remove_request() can now exit early if the EP delayed stop is set,
avoid clearing all DEP flags, otherwise the transition back into the SETUP
stage won't issue an endxfer command.

Change-Id: Ifaaf6405e24868b1b52f23aa492ed8ed783d1e14
Fixes: 2b2da6574e ("usb: dwc3: Avoid unmapping USB requests if endxfer is not complete")
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220919231213.21364-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 76bff31c7f)
2022-11-11 20:03:32 +08:00
Wesley Cheng
cf0dba7ad6 UPSTREAM: usb: dwc3: gadget: Submit endxfer command if delayed during disconnect
During a cable disconnect sequence, if ep0state is not in the SETUP phase,
then nothing will trigger any pending end transfer commands.  Force
stopping of any pending SETUP transaction, and move back to the SETUP
phase.

Change-Id: Icae282b1a47872a262fea9b6bd4e8dea08c5455d
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-6-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 8422b769fa)
2022-11-11 20:03:32 +08:00
Wesley Cheng
d44087b472 UPSTREAM: usb: dwc3: gadget: Skip waiting for CMDACT cleared during endxfer
For endxfer commands that do not require an endpoint complete interrupt,
avoid having to wait for the command active bit to clear.  This allows for
EP0 events to continue to be handled, which allows for the controller to
complete it.  Otherwise, it is known that the endxfer command will fail if
there is a pending SETUP token that needs to be read.

Change-Id: Ib6c352ff25be3186454894da619323eabe75aa70
Suggested-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-5-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit b353eb6dc2)
2022-11-11 20:03:32 +08:00
Wesley Cheng
6f0af65133 UPSTREAM: usb: dwc3: Increase DWC3 controller halt timeout
Since EP0 transactions need to be completed before the controller halt
sequence is finished, this may take some time depending on the host and the
enabled functions.  Increase the controller halt timeout, so that we give
the controller sufficient time to handle EP0 transfers.

Change-Id: Id933051520104a7037756fe5a92220c1bd4f4939
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-4-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 461ee46750)
2022-11-11 20:03:32 +08:00
Wesley Cheng
00b2eeee67 UPSTREAM: usb: dwc3: Remove DWC3 locking during gadget suspend/resume
Remove the need for making dwc3_gadget_suspend() and dwc3_gadget_resume()
to be called in a spinlock, as dwc3_gadget_run_stop() could potentially
take some time to complete.

Change-Id: Iefb140c66f26029d9f2ba244b58092e3ea7099f4
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-3-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 5265397f94)
2022-11-11 20:03:32 +08:00
Wesley Cheng
f1d47b5138 UPSTREAM: usb: dwc3: Avoid unmapping USB requests if endxfer is not complete
If DWC3_EP_DELAYED_STOP is set during stop active transfers, then do not
continue attempting to unmap request buffers during dwc3_remove_requests().
This can lead to SMMU faults, as the controller has not stopped the
processing of the TRB.  Defer this sequence to the EP0 out start, which
ensures that there are no pending SETUP transactions before issuing the
endxfer.

Change-Id: I576922c1a9566507f8ac268a4fc2c4bfb4129aee
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-2-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 2b2da6574e)
2022-11-11 20:03:32 +08:00
Wesley Cheng
33be4d8a2c UPSTREAM: usb: dwc3: gadget: Continue handling EP0 xfercomplete events
During soft disconnect, EP0 events are expected to be handled in order to
allow the controller to successfully move into the halted state.  Since
__dwc3_gadget_stop() is executed before polling, EP0 has been disabled, and
events are being blocked.  Allow xfercomplete events to be handled, so that
cached SETUP packets can be read out from the internal controller memory.

Without doing so, it will lead to endxfer timeouts, which results to
controller halt failures.

Change-Id: Ie58a709ee48f8f8e869285414ee2fd93d4d56326
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220817182359.13550-5-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit dff981842a)
2022-11-11 20:03:32 +08:00
Wesley Cheng
bb1cb9817d UPSTREAM: usb: dwc3: gadget: Synchronize IRQ between soft connect/disconnect
Ensure that there are no pending events being handled in between soft
connect/disconnect transitions.  As we are keeping interrupts enabled,
and EP0 events are still being serviced, this avoids any stale events from
being serviced.

Change-Id: I4c9aa27b64281d10c3d5f9fc3359663fd92ca2be
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220817182359.13550-4-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 9711c67de7)
2022-11-11 20:03:32 +08:00
Wesley Cheng
17c0654fa2 UPSTREAM: usb: dwc3: gadget: Force sending delayed status during soft disconnect
If any function drivers request for a delayed status phase, this leads to a
SETUP transfer timeout error, since the function may take longer to process
the DATA stage.  This eventually results in end transfer timeouts, as there
is a pending SETUP transaction.

In addition, allow the DWC3_EP_DELAY_STOP to be set for if there is a
delayed status requested.  Ocasionally, a host may abort the current SETUP
transaction, by issuing a subsequent SETUP token.  In those situations, it
would result in an endxfer timeout as well.

Change-Id: I7decd682cf7f5714779364465383827efa22f2a1
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220817182359.13550-3-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit e1ee843488)
2022-11-11 20:03:32 +08:00