History log of /linux-master/drivers/usb/cdns3/cdns3-imx.c
Revision Date Author Comments
# db3c4e36 23-May-2023 Shenwei Wang <shenwei.wang@nxp.com>

usb: cdns3: imx: Rework system PM to avoid duplicated operations

The current implementation uses the same callbacks for system PM and
runtime PM suspend/resume without any state checking. This can cause the
clocks to be prepared/unprepared twice, leading to kernel warning issues.

This patch resolves the double prepare/unprepare issues by separating the
runtime PM and system PM handling.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
Link: https://lore.kernel.org/r/20230523184412.204582-1-shenwei.wang@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7a053bf2 17-May-2023 Frank Li <Frank.Li@nxp.com>

usb: cdns3: imx: simplify clock name usage

Simplifies the clock names in imx_cdns3_core_clks[]. Such as, renaming
"usb3_lpm_clk" to "lpm". The "usb3" prefix and "clk" suffix were
redundant.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230517152545.3404508-1-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cfab1b8b 17-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

usb: cdns3-imx: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart from
emitting a warning) and this typically results in resource leaks. To improve
here there is a quest to make the remove callback return void. In the first
step of this quest all drivers are converted to .remove_new() which already
returns void. Eventually after all drivers are converted, .remove_new() is
renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230517230239.187727-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c23e55e6 26-May-2021 Lee Jones <lee.jones@linaro.org>

usb: cdns3: cdns3-imx: File headers are not good candidates for kernel-doc

Fixes the following W=1 kernel build warning(s):

drivers/usb/cdns3/cdns3-imx.c:21: warning: expecting prototype for cdns3(). Prototype was for USB3_CORE_CTRL1() instead

Cc: Peter Chen <peter.chen@kernel.org>
Cc: Pawel Laszczak <pawell@cadence.com>
Cc: Roger Quadros <rogerq@kernel.org>
Cc: Aswath Govindraju <a-govindraju@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-usb@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210526130037.856068-11-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ef32e051 10-Mar-2021 Wei Yongjun <weiyongjun1@huawei.com>

usb: cdns3: imx: mark cdns_imx_system_resume as __maybe_unused

The function cdns_imx_system_resume() may have no callers depending
on configuration, so it must be marked __maybe_unused to avoid
harmless warning:

drivers/usb/cdns3/cdns3-imx.c:378:12: warning:
'cdns_imx_system_resume' defined but not used [-Wunused-function]
378 | static int cdns_imx_system_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~

Fixes: 67982dfa59de ("usb: cdns3: imx: add power lost support for system resume")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>


# 2fd69eca 18-Feb-2021 Frank Li <frank.li@nxp.com>

usb: cdns3: imx: add power lost support for system resume

imx need special handle when controller lost power

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Frank Li <frank.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@kernel.org>


# 0b490046 07-Dec-2020 Pawel Laszczak <pawell@cadence.com>

usb: cdns3: Refactoring names in reusable code

Patch change the functions and objects names in reusable code.
The reusable code includes core.c, core.h, drd.c and drd.h files.
It also changes the names of all references to these functions and
objects in other cdns3 files. There are a lot of changes, but all
changes are very trivial.
The reason of this patch is to avoid of mixing prefix cdns3 and cdnsp in
in cdnsp driver what could introduce some confusion in understanding
of cdnsp driver.
This patch assumes to use three different prefixes in Cadence
USB drivers:
cdns: for common reusable code
cdnsp: for names related only with cdnsp driver
cdns3: for names related only with cdns3 driver

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# d1357119 10-Dec-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: imx: improve driver .remove API

Keep the runtime active during the remove operation, and disable
related clocks.

Signed-off-by: Peter Chen <peter.chen@nxp.com>


# 2ef02b84 10-Dec-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: imx: fix can't create core device the second time issue

The cdns3 core device is populated by calling of_platform_populate,
the flag OF_POPULATED is set for core device node, if this flag
is not cleared, when calling of_platform_populate the second time
after loading parent module again, the OF code will not try to create
platform device for core device.

To fix it, it uses of_platform_depopulate to depopulate the core
device which the parent created, and the flag OF_POPULATED for
core device node will be cleared accordingly.

Cc: <stable@vger.kernel.org>
Fixes: 1e056efab993 ("usb: cdns3: add NXP imx8qm glue layer")
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# 92cbdb92 10-Dec-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: imx: fix writing read-only memory issue

The memory for struct clk_bulk_data should not be static which will be written
during the clk_bulk_get. It fixed below oops when loading cdns3-imx as module.

[ 17.272605] Unable to handle kernel write to read-only memory at virtual address ffff8000092a5398
[ 17.299730] Mem abort info:
[ 17.313542] unregister ISI channel: mxc_isi.4
[ 17.324076] ESR = 0x9600004f
[ 17.344658] EC = 0x25: DABT (current EL), IL = 32 bits
[ 17.402055] SET = 0, FnV = 0
[ 17.404321] mxs_phy 5b100000.usbphy: supply phy-3p0 not found, using dummy regulator
[ 17.405121] EA = 0, S1PTW = 0
[ 17.405133] Data abort info:
[ 17.496231] ISV = 0, ISS = 0x0000004f
[ 17.510871] CM = 0, WnR = 1
[ 17.533542] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000081ea5000
[ 17.545709] [ffff8000092a5398] pgd=00000008bffff003, p4d=00000008bffff003, pud=00000008bfffe003, pmd=0000000885041003, pte=006000088513b783
[ 17.573521] Internal error: Oops: 9600004f [#1] PREEMPT SMP
[ 17.579113] Modules linked in: usbmisc_imx phy_mxs_usb phy_cadence_salvo cdns3_imx(+) tcpci imx8_media_dev(C) caam error
[ 17.590044] CPU: 2 PID: 253 Comm: systemd-udevd Tainted: G C 5.10.0-rc4-04445-g11f3c3a29d0-dirty #19
[ 17.600488] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 17.605633] pstate: 20000005 (nzCv daif -PAN -UAO -TCO BTYPE=--)
[ 17.611662] pc : __clk_bulk_get+0x48/0x130
[ 17.615786] lr : clk_bulk_get+0x18/0x20
[ 17.619634] sp : ffff80001369b880
[ 17.622953] x29: ffff80001369b880 x28: 0000000000000013
[ 17.628277] x27: 0000000000000100 x26: ffff00080553b100
[ 17.633602] x25: ffff80001229b4d8 x24: 0000000000000000
[ 17.638928] x23: ffff000800665410 x22: 0000000000000005
[ 17.644275] x21: ffff8000092a5390 x20: ffff000800665400
[ 17.649605] x19: ffff000804e6f980 x18: 000000005b110000
[ 17.654946] x17: 0000000000000000 x16: 0000000000000000
[ 17.660274] x15: ffff800011989100 x14: 0000000000000000
[ 17.665599] x13: ffff800013ce1000 x12: ffff800013ca1000
[ 17.670924] x11: 000000005b110000 x10: 0000000000000000
[ 17.676249] x9 : ffff8000106c5a30 x8 : ffff000804e6fa00
[ 17.681575] x7 : 0000000000000000 x6 : 000000000000003f
[ 17.686901] x5 : 0000000000000040 x4 : ffff80001369b8b0
[ 17.692228] x3 : ffff8000092a5398 x2 : ffff8000092a5390
[ 17.697574] x1 : ffff8000092a53e8 x0 : 0000000000000004
[ 17.702905] Call trace:
[ 17.705366] __clk_bulk_get+0x48/0x130
[ 17.709125] clk_bulk_get+0x18/0x20
[ 17.712620] devm_clk_bulk_get+0x58/0xb8
[ 17.716563] cdns_imx_probe+0x84/0x1f0 [cdns3_imx]
[ 17.721363] platform_drv_probe+0x58/0xa8
[ 17.725381] really_probe+0xec/0x4c8
[ 17.728967] driver_probe_device+0xf4/0x160
[ 17.733160] device_driver_attach+0x74/0x80
[ 17.737355] __driver_attach+0xa4/0x170
[ 17.741202] bus_for_each_dev+0x74/0xc8
[ 17.745043] driver_attach+0x28/0x30
[ 17.748620] bus_add_driver+0x144/0x228
[ 17.752462] driver_register+0x68/0x118
[ 17.756308] __platform_driver_register+0x4c/0x58
[ 17.761022] cdns_imx_driver_init+0x24/0x1000 [cdns3_imx]
[ 17.766434] do_one_initcall+0x48/0x2c0
[ 17.770280] do_init_module+0x5c/0x220
[ 17.774029] load_module+0x210c/0x2858
[ 17.777784] __do_sys_finit_module+0xb8/0x120
[ 17.782148] __arm64_sys_finit_module+0x24/0x30
[ 17.786691] el0_svc_common.constprop.0+0x70/0x168
[ 17.791497] do_el0_svc+0x28/0x88
[ 17.794822] el0_sync_handler+0x158/0x160
[ 17.798833] el0_sync+0x140/0x180
[ 17.802158] Code: aa0203f5 91002043 8b205021 a90153f3 (f801047f)

Cc: <stable@vger.kernel.org>
Fixes: 1e056efab993 ("usb: cdns3: add NXP imx8qm glue layer")
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# 40062390 28-Sep-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: imx: enable runtime pm by default

Enable runtime pm by default

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>


# ff6d6e6c 02-Sep-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: imx: add glue layer runtime pm implementation

Add imx glue layer runtime pm implementation, and the runtime
pm is default off.

Reviewed-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>


# 1e056efa 09-Jan-2020 Peter Chen <peter.chen@nxp.com>

usb: cdns3: add NXP imx8qm glue layer

There is a Cadence USB3 core for imx8qm and imx8qxp SoCs, the cdns
core is the child for this glue layer device.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>