1
0
Fork 0
Commit Graph

160 Commits (redonkable)

Author SHA1 Message Date
Andrey Zhizhikin ee7b6ad15b This is the 5.4.67 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl9rJlYACgkQONu9yGCS
 aT6WbRAAga6QVKrO6R4NeKk0fPqKQQoQeTK+phBOFA7jAoX/rIRKyob2Si9BwhBA
 F77vZ6HIZ7+e/o35JJQYQbffbHYs0ANuS1oHGqe0vgbh+72Viaan6g7lFOhpx8qf
 y0YS7q+hw4WLZB0gGlBM7nkPXRiis32IrEVabQW+t8hmT2lWyutY8E2yFAU60tvI
 Tvjm2c2pvHEcHz9MrjEd/jIVxMFnIl42FBTx9bGsbDUCDzBwEvPArS4bNioP7EFJ
 O+rrGCNvwtiv0DuKzX1UIZzQ88IROmU3ZjsIlgOwla7xJWv4QDgmPfyAyRI48QhH
 PAZQmSntz+y+MP6B3z3ZBrxc2Fx0kCDtugn2P9+2RVUEpheANJ293vUgYTKN9Roy
 dHdWHFWNTO9IYpIN0cZjc25db4ULdjerWQrKcCr6ZO8+Ep/0mSzx3lkWjfuUP8Hr
 L2RD6rAm259OpPq8xhAcJpJvoQLwGxaBHyr4QYUmRgmNVURoqe9Q0MTZuiyGsXhm
 rtcNky9WvmyyI1lJgXi4A+vmsIThCHEstEMycgTejfJ4itIVA9e1ctJVVomWULCn
 9oNStBJpmHw0myDCohbKNjeO1UX/erdF9NaoGto5bnfIhcSae1YQEjRB8zKmzbg1
 DpgC1f7IZ7q53vfrDGsAjInOcuEwAn/Y5JMLJOL4mdA9j3XlX2o=
 =Ot99
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.67' into 5.4-2.2.x-imx

This is the 5.4.67 stable release

This updates the kernel present in the NXP release imx_5.4.47_2.2.0 to the
latest patchset available from stable korg.

Base stable kernel version present in the NXP BSP release is v5.4.47.

Following conflicts were recorded and resolved:
- arch/arm/mach-imx/pm-imx6.c
NXP version has a different PM vectoring scheme, where the IRAM bottom
half (8k) is used to store IRAM code and pm_info. Keep this version to
be compatible with NXP PM implementation.

- arch/arm64/boot/dts/freescale/imx8mm-evk.dts
- arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
NXP patches kept to provide proper LDO setup:
imx8mm-evk.dts: 975d8ab07267ded741c4c5d7500e524c85ab40d3
imx8mn-ddr4-evk.dts: e8e35fd0e759965809f3dca5979a908a09286198

- drivers/crypto/caam/caamalg.c
Keep NXP version, as it already covers the functionality for the
upstream patch [d6bbd4eea2]

- drivers/gpu/drm/imx/dw_hdmi-imx.c
- drivers/gpu/drm/imx/imx-ldb.c
- drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
Port changes from upstream commit [1a27987101], which extends
component lifetime by moving drm structures allocation/free from
bind() to probe().

- drivers/gpu/drm/imx/imx-ldb.c
Merge patch [1752ab50e8] from upstream to disable both LVDS channels
when Enoder is disabled

- drivers/mmc/host/sdhci-esdhc-imx.c
Fix merge fuzz produced by [6534c897fd].

- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Commit d1a00c9bb1 from upstream solves the issue with improper error
reporting when qdisc type support is absent. Upstream version is merged
into NXP implementation.

- drivers/net/ethernet/freescale/enetc/enetc.c
Commit [ce06fcb6a6] from upstream merged,
base NXP version kept

- drivers/net/ethernet/freescale/enetc/enetc_pf.c
Commit [e8b86b4d87] from upstream solves
the kernel panic in case if probing fails. NXP has a clean-up logic
implemented different, where the MDIO remove would be invoked in any
failure case. Keep the NXP logic in place.

- drivers/thermal/imx_thermal.c
Upstream patch [9025a5589c] adds missing
of_node_put call, NXP version has been adapted to accommodate this patch
into the code.

- drivers/usb/cdns3/ep0.c
Manual merge of commit [be8df02707] from
upstream to protect cdns3_check_new_setup

- drivers/xen/swiotlb-xen.c
Port upstream commit cca58a1669 to NXP tree, manual hunk was
resolved during merge.

- sound/soc/fsl/fsl_esai.c
Commit [53057bd4ac] upstream addresses the problem of endless isr in
case if exception interrupt is enabled and tasklet is scheduled. Since
NXP implementation has tasklet removed with commit [2bbe95fe6c],
upstream fix does not match the main implementation, hence we keep the
NXP version here.

- sound/soc/fsl/fsl_sai.c
Apply patch [b8ae2bf5cc] from upstream, which uses FIFO watermark
mask macro.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2020-09-26 20:54:42 +00:00
Li Jun 4da32c0295 MLK-15984 usb: chipidea: wait controller resume finished for wakeup irq
After the chipidea driver introduce extcon for id and vbus, it's able
to wakeup from another irq source, in case the system with extcon ID
cable, wakeup from usb ID cable and device removal, the usb device
disconnect irq may come firstly before the extcon notifier while system
resume, so we will get 2 "wakeup" irq, one for usb device disconnect;
and one for extcon ID cable change(real wakeup event), current driver
treat them as 2 successive wakeup irq so can't handle it correctly, then
finially the usb irq can't be enabled. This patch adds a check to bypass
further usb events before controller resume finished to fix it.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-09-10 10:33:42 +08:00
Peter Chen 01512075a3 usb: chipidea: core: add wakeup support for extcon
commit 876d4e1e82 upstream.

If wakeup event occurred by extcon event, it needs to call
ci_irq again since the first ci_irq calling at extcon notifier
only wakes up controller, but do noop for event handling,
it causes the extcon use case can't work well from low power mode.

Cc: <stable@vger.kernel.org>
Fixes: 3ecb3e09b0 ("usb: chipidea: Use extcon framework for VBUS and ID detect")
Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Tested-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20200707060601.31907-2-peter.chen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-22 09:33:10 +02:00
Peter Chen 3800732005
MLK-23349-6 usb: chipdea: don't return -EINVAL if request role is the same with current role
It should not return -EINVAL if the request role is the same with
current role, return non-error and without do anything instead.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-28 11:15:58 +08:00
Li Jun f7841e1734 LF-592 usb: chipidea: handle single role for usb role class
If usb port is configed to be single role, but usb role class
is trying to set unavailable role, don't try to do role change.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-25 08:55:01 +08:00
Jun Li e9ccde105e MLK-22025-1 usb: chipidea: phy enter low power mode when host suspend
On some imx host, if USB PHY is active when bus suspended, host may
have problem on taking over resume signal of remote wakeup from usb
device, resolve this by making PHY enter low power mode right after
bus suspended.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
Peter Chen cf4c986d39 MLK-20346 usb: chipidea: change power_lost workqueue as freezable
Like commit d144dfea8a ("usb: chipidea: otg: change workqueue
ci_otg as freezable"), the power_lost work item may try to remove
hcd if controller is powered off during the system suspend, and
the similar deadlock happens, see below dumps.

Meanwhile, with this change, we need to disable USB interrupt
during the work item runs (after driver resume has finished),
otherwise, USB transfer will be timeout (5s) due to USB interrupt
is disabled and IAA watchdog is still not ready at that time.

Workqueue: events ci_power_lost_work
Call trace:
[<ffff000008085c44>] __switch_to+0x8c/0xd0
[<ffff000008d7bbf4>] __schedule+0x19c/0x5d8
[<ffff000008d7c068>] schedule+0x38/0xa0
[<ffff000008d7f3b4>] schedule_timeout+0x19c/0x338
[<ffff000008d7cc10>] wait_for_common+0xa0/0x148
[<ffff000008d7cccc>] wait_for_completion+0x14/0x20
[<ffff0000080e6040>] flush_work+0xd8/0x1f0
[<ffff0000080e61f4>] flush_delayed_work+0x3c/0x48
[<ffff0000081ae1c8>] wb_shutdown+0x90/0xd0
[<ffff0000081ae688>] bdi_unregister+0x58/0x1c0
[<ffff000008413a60>] del_gendisk+0x218/0x228
[<ffff00000871683c>] sd_remove+0x64/0xc0
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff0000087049ec>] __scsi_remove_device+0xec/0x128
[<ffff000008702c70>] scsi_forget_host+0x70/0x78
[<ffff0000086f7ee8>] scsi_remove_host+0xa0/0x140
[<ffff0000088e0588>] usb_stor_disconnect+0x50/0xc0
[<ffff00000887eab8>] usb_unbind_interface+0x78/0x280
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff00000887c364>] usb_disable_device+0xa4/0x210
[<ffff000008872cfc>] usb_disconnect+0x7c/0x240
[<ffff000008872e40>] usb_disconnect+0x1c0/0x240
[<ffff000008878e10>] usb_remove_hcd+0xc0/0x1d8
[<ffff0000088e7bac>] host_stop+0x34/0x90
[<ffff0000088e4088>] ci_handle_id_switch+0x70/0x1d0
[<ffff0000088e3038>] ci_power_lost_work+0x90/0xa8
[<ffff0000080e7100>] process_one_work+0x1e0/0x340
[<ffff0000080e72b0>] worker_thread+0x50/0x458
[<ffff0000080ed32c>] kthread+0xfc/0x128
[<ffff000008084eb8>] ret_from_fork+0x10/0x18

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:56 +08:00
Peter Chen 1fbbc6bd15 MLK-16532 usb: chipidea: do not call WARN_ON if controller is going to suspend twice
At current PM framework, the dev->runtime_suspend may be called after
dev->system_suspend is called, and the dev->runtime_resume may be called
before dev->system_suspend is called. So, we need to delete WARN_ON to
avoid before dump:

[  466.712978] [<ffff200008c49cdc>] ci_hdrc_imx_runtime_suspend+0x2c/0xa8
[  466.719619] [<ffff2000088c29e8>] pm_generic_runtime_suspend+0x48/0x68
[  466.726168] [<ffff2000088d4f04>] genpd_runtime_suspend+0xcc/0x300
[  466.732372] [<ffff2000088c7068>] pm_runtime_force_suspend+0x48/0xa8
[  466.738748] [<ffff2000088d5330>] pm_genpd_suspend_noirq+0xa0/0x118
[  466.745032] [<ffff2000088c86ec>] dpm_run_callback+0x4c/0xc0
[  466.750709] [<ffff2000088c941c>] __device_suspend_noirq+0x194/0x3d0
[  466.757080] [<ffff2000088cb460>] dpm_suspend_noirq+0x188/0x328
[  466.763024] [<ffff200008143218>] suspend_devices_and_enter+0x230/0x650
[  466.769655] [<ffff200008143990>] pm_suspend+0x358/0x3d0
[  466.774984] [<ffff200008141f0c>] state_store+0x8c/0x100
[  466.780321] [<ffff20000857a83c>] kobj_attr_store+0x44/0x60
[  466.785915] [<ffff2000083436a8>] sysfs_kf_write+0x98/0xb0
[  466.791419] [<ffff200008342118>] kernfs_fop_write+0x120/0x288
[  466.797276] [<ffff20000828d518>] __vfs_write+0xc0/0x238
[  466.802604] [<ffff20000828e900>] vfs_write+0xc8/0x248
[  466.807764] [<ffff200008290678>] SyS_write+0xa0/0x110
[  466.812919] [<ffff20000808374c>] __sys_trace_return+0x0/0x4

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Cc: Anson Huang <anson.huang@nxp.com>
Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:52 +08:00
Peter Chen d6f08b0a29 MLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detection
Since the DP pullup can be finished at glue layer, we can delete
it at common code, but we still need to keep DP pulldown operation
since the DP may have already pulled up before.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:56:52 +08:00
Peter Chen cebd6f46dd MLK-14396 usb: chipidea: add mutex for concurrent running
The ci_handle_id_switch is called at two places, at very rare situations,
it may be running at the same time. Eg, when the system is back from
the resume, the id event is occurred from extcon driver, as well as
power_lost work item is called due to the controller is poweroff at
the suspend.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:51 +08:00
Li Jun 43e724eb4e MLK-12344-3 usb: chipidea: update power lost handling for gadget
After we put gadget disconnect and connect in id switch handling,
update power lost work accordingly.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit fd49596eceeb4e61267f35fb74bf0c04056f2ed7)
2019-11-25 15:56:47 +08:00
Peter Chen 9f629a4861 MLK-11340-37 usb: chipidea: add query_available_role interface
The glue layer may need to know current available role, add
ci_hdrc_query_available_role for that.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 5c340402131ca6eacaeb122deb1ee59bcea2778c)
2019-11-25 15:56:38 +08:00
Li Jun 214ed5edf0 MLK-9618-7 usb: chipidea: otg: delay turn on vbus when detecting data pulse
This patch adds a timer to delay turn on vbus after detecting data pulse
from B-device, this is required by OTG SRP timing.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit f02ee3e93715c41f5b1e11140f36e350c7ed4d6b)
2019-11-25 15:56:36 +08:00
Li Jun 837186db93 MLK-10102-8 usb: chipidea: support role change after power lost
This patch is to complete support usb resume from power lost in non-otg
fsm mode:
- Re-init usb phy.
- Support role changes during system sleep with power lost.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
2019-11-25 15:56:35 +08:00
Li Jun e48fb21081 MLK-10102-3 usb: chipidea: export hw_controller_reset API
Host needs to reset controller for recovery from power lost.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 136222e683d40890f11985e61b447f2481b8bff5)
(cherry picked from commit 606efc2e85b0e75b36e199e5d0ae113a945da128)
2019-11-25 15:56:31 +08:00
Li Jun 5aedb7d9a2 MLK-10102-2 usb: chipidea: add suspend and resume routine for role driver
We may need to do extra things for system suspend/resume per different
roles(e.g. power lost during system sleep), so define system suspend/resume
handler for roles.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit cac6f339b30102c63f8bb5c56e77d5c7a6c6b4b5)
(cherry picked from commit 11fe36e4b3277e0dab34d02b794b8b3cbde6a379)
2019-11-25 15:56:31 +08:00
Li Jun 5037438220 MLK-10085-5 usb: chipidea: Add usb charger detect notify
- Change .notify's return value from void to int, update msm notify_event
  return value accordingly.
- Add CI_HDRC_CONTROLLER_VBUS_EVENT and
  CI_HDRC_CONTROLLER_CHARGER_POST_EVENT to finish the USB charger
  detection flow.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 681ca18061e334beb8a907d05e4405014f47dc07)
2019-11-25 15:56:29 +08:00
Li Jun 05559f10ed
usb: chipidea: add role switch class support
USB role is fully controlled by usb role switch consumer(e.g. typec),
usb port can be at host mode(USB_ROLE_HOST), device mode connected to
host(USB_ROLE_DEVICE), or not connecting any partner(USB_ROLE_NONE).

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-08-28 10:39:53 +08:00
Greg Kroah-Hartman 524f3ac154 USB: chipidea: convert platform driver to use dev_groups
Platform drivers now have the option to have the platform core create
and remove any needed sysfs attribute files.  So take advantage of that
and do not register "by hand" any sysfs files.

Cc: Peter Chen <Peter.Chen@nxp.com>
Link: https://lore.kernel.org/r/20190805193636.25560-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-09 07:55:44 +02:00
Stephen Boyd b33f37064b usb: Remove dev_err() usage after platform_get_irq()
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20190730181557.90391-47-swboyd@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-30 20:29:18 +02:00
Fabio Estevam b8a4f526fa usb: chipidea: Use dev_err() instead of pr_err()
dev_err() is more appropriate for printing error messages inside
drivers, so switch to dev_err().

While at it also add the missing newlines.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-06-14 17:40:12 +08:00
Paul Kocialkowski a3a4754833 usb: chipidea: Refactor USB PHY selection and keep a single PHY
Refactor the code in charge of looking up the USB PHY when no platdata
is provided. Attempt to get a generic USB PHY first, then look for a
legacy USB PHY through device-tree and finally get any registered PHY
with the correct type.

This way, only a single USB PHY is obtained and the flow is easier to
understand and follow.

All error pointers (except for EPROBE_DEFER) are considered as PHY
not found.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-27 15:51:02 +01:00
Paul Kocialkowski 68ef236274 usb: chipidea: Grab the (legacy) USB PHY by phandle first
According to the chipidea driver bindings, the USB PHY is specified via
the "phys" phandle node. However, this only takes effect for USB PHYs
that use the common PHY framework. For legacy USB PHYs, a simple lookup
based on the USB PHY type is done instead.

This does not play out well when more than one USB PHY is registered,
since the first registered PHY matching the type will always be
returned regardless of what the driver was bound to.

Fix this by looking up the PHY based on the "phys" phandle node.
Although generic PHYs are rather matched by their "phys-name" and not
the "phys" phandle directly, there is no helper for similar lookup on
legacy PHYs and it's probably not worth the effort to add it.

When no legacy USB PHY is found by phandle, fallback to grabbing any
registered USB2 PHY. This ensures backward compatibility if some users
were actually relying on this mechanism.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-27 15:51:02 +01:00
Loic Poulain 16caf1fa37 usb: chipidea: Add dynamic pinctrl selection
Some hardware implementations require to configure pins differently
according to the USB role (host/device), this can be an update of the
pins routing or a simple GPIO value change.

This patch introduces new optional "host" and "device" pinctrls.
If these pinctrls are defined by the device, they are respectively
selected on host/device role start.

If a default pinctrl exist, it is restored on host/device role stop.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-09-20 17:04:21 +08:00
Greg Kroah-Hartman a61b75d108 USB: chipidea: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-31 12:54:22 +02:00
Greg Kroah-Hartman ed5bd7a47f USB: move many drivers to use DEVICE_ATTR_RW
Instead of "open coding" a DEVICE_ATTR() define, use the
DEVICE_ATTR_RW() macro instead, which does everything properly instead.

This does require a few static functions to be renamed to work properly,
but thanks to a script from Joe Perches, this was easily done.

Reported-by: Joe Perches <joe@perches.com>
Cc: Matthieu CASTET <castet.matthieu@free.fr>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Peter Chen <Peter.Chen@nxp.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-24 08:49:51 +01:00
Greg Kroah-Hartman 51b751f112 USB: chipidea: Remove redundant license text
Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner.  So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-07 15:45:01 +01:00
Greg Kroah-Hartman 5fd54ace47 USB: add SPDX identifiers to all remaining files in drivers/usb/
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04 11:48:02 +01:00
Greg Kroah-Hartman 17e15f6fbc Chipidea changes for v4.14-rc1
- Add chipidea support at Nvidia SoCs
 - Improvement for extcon support
 - Some code refines
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJZo43vAAoJEEhZKYFQ1nG74W0H/3NsolcVqIzxCnIkRj64AGil
 U9xAY0OHWO4cML65LJf7K0oBiRrEkww4TjNGvcm+2Ra9kNjCFsOXdvAkU2JRJ/Ut
 xUuBQNBe9diL1SQeJmiL0yTLcnGw0g6f7m0zr3CPiiv/D4iTmMe8v8qJbBYOS0za
 tf8DFRArxrOe/YZ4j/RjOqSlGFRErOImzY8QzU6/4TUY7ZTDGZsckHFJsMON2A60
 TIiVepBefQboGCZAoB8Lic9eBTJBsiR1H3SQkzZk5Q5wrJ0FitMAwMHXX2ozCe3U
 Ahcz0r5176oKAnbP0yKZYx9DzJCCEI30O0iDKEhamnGz3fjc9ydaaUzVamSh5ns=
 =0N59
 -----END PGP SIGNATURE-----

Merge tag 'usb-ci-v4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Peter writes:

Chipidea changes for v4.14-rc1
- Add chipidea support at Nvidia SoCs
- Improvement for extcon support
- Some code refines
2017-08-28 10:50:22 +02:00
Arvind Yadav a351a2bf9c usb: chipidea: constify attribute_group structures.
attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-10 11:31:28 -07:00
Peter Chen 7c3a8b8150 usb: chipidea: core: do not register extcon notifier if extcon device is not existed
This issue is detected when the system has another device driver
which registers USB connector extcon device, fix it by adding
extcon device check.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-07-25 15:22:44 +08:00
Greg Kroah-Hartman 6e5c7514e7 One patch to improve error handling at chipidea core
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJZSdzXAAoJEEhZKYFQ1nG7M1YH/0tSpERwjAaL8xmKjm1KDO9v
 EeeTC/P7nkv1iWRdMGZuun8cOivuTD4aC/IuXh6G40FkgUUMZI8qayt+JnS6eiv/
 fVbX1L6lP8UnP9C8HHQcANCVlOHysPlbG3hdfpAVjtz56sqdK7NGFakdhHqBerx9
 xcD40glwLUpt3jrZfcHPepF9WMn/3eA0GsTXyydHuL/D+jejCUu4kVPICdfOm7Vr
 k+E0oilsjfYSxA4NRaqjd5CDpAiPPKQ/g37DIfG13A9bBjvDSQbky4Y69ibVWLqv
 sGGCnLeFGx3L798GKeV6bDsKU8NEYF93pnFlQ5FBY5PjYU3mudEXAB/fpVBGagA=
 =KEw/
 -----END PGP SIGNATURE-----

Merge tag 'usb-ci-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Peter writes:

One patch to improve error handling at chipidea core
2017-06-27 17:35:31 +02:00
Michael Thalmeier cbb22ebcfb usb: chipidea: core: check before accessing ci_role in ci_role_show
ci_role BUGs when the role is >= CI_ROLE_END.
This is the case while the role is changing.

Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-05-23 08:36:54 +08:00
Jisheng Zhang c4a0bbbdb7 usb: chipidea: properly handle host or gadget initialization failure
If ci_hdrc_host_init() or ci_hdrc_gadget_init() returns error and the
error != -ENXIO, as Peter pointed out, "it stands for initialization
for host or gadget has failed", so we'd better return failure rather
continue.

And before destroying the otg, i.e ci_hdrc_otg_destroy(ci), we should
also check ci->roles[CI_ROLE_GADGET].

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-05-18 08:55:22 +08:00
Greg Kroah-Hartman ac9d947683 Two changes for this v4.12-rc1:
- Add sysfs entry for role switch
 - Update gadget state after gadget back from suspend
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJY9XecAAoJEEhZKYFQ1nG7PuQH+wR+qFiaswoJA3q+2sdqQDdD
 vN1FLT93o3ObgnmYwbZZDxdGeB6e+AJ/K8tQCOVqm8AnaNOzDwCYJoBTa5nPaS5k
 c+E4JlciG2NJG1s+eGVhZUPTQD3qS47vkgHymgtlTbQPDJDZy7k5nu7H1GSI7mvM
 7AH4uavzMIqsZcQTAln6BvIr2FQHh996LnUHDvYSZ6Y+8cws9IPMbSIiao3s3SiZ
 fULYJbVfDOd0LuxHOn7AdKrmlDJ/Gi2vmR4xQLlwvXEYk5/NUcSc1Yo5lVZcDUBR
 MzX4bLvhLi4SNLXLJhfqYjXcPXddXxawL/TRGDmT0B/1N8CCtBWJkNpIgx9q6dk=
 =opDd
 -----END PGP SIGNATURE-----

Merge tag 'usb-ci-v4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Peter writes:

Two changes for this v4.12-rc1:
- Add sysfs entry for role switch
- Update gadget state after gadget back from suspend
2017-04-18 16:52:20 +02:00
Peter Chen a932a8041f usb: chipidea: core: add sysfs group
Sometimes, the user needs to adjust some properties for controllers, eg
the role for controller, we add sysfs group for them.

The attribute 'role' is used to switch host/gadget role dynamically, the
uewr can read the current role, and write the other role compare to
current one to finish the switch.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-04-14 09:26:37 +08:00
Arnd Bergmann aeb78cda51 usb: chipidea: use bus->sysdev for DMA configuration
Set the dma for chipidea from sysdev. This is inherited from its
parent node. Also, do not set dma mask for child as it is not required
now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23 08:20:21 +01:00
Stephen Boyd 490b63e6de usb: chipidea: Configure phy for appropriate mode
When the qcom chipidea controller is used with an extcon, we need
to signal device mode or host mode to the phy so it can configure
itself for the correct mode. This should be done after the phy is
powered up, so that the register writes work correctly. Add in
the appropriate phy_set_mode() call here.

Cc: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-02-03 16:48:33 +08:00
Jisheng Zhang bec584a877 usb: chipidea: delete an useless header include
<linux/phy.h> is for net phy drivers, we don't need it.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-23 17:02:36 +08:00
Stephen Boyd 11893dae63 usb: chipidea: msm: Handle phy power states
The ULPI phy on qcom platforms needs to be initialized and
powered on after a USB reset and before we toggle the run/stop
bit. Otherwise, the phy locks up and doesn't work properly. Hook
the phy initialization into the RESET event and the phy power off
into the STOPPED event.

Acked-by: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 15:27:35 +08:00
Stephen Boyd 5cc4926899 usb: chipidea: Consolidate extcon notifiers
The two extcon notifiers are almost the same except for the
variable name for the cable structure and the id notifier inverts
the cable->state logic. Make it the same and replace two
functions with one to save some lines. This also makes it so that
the id cable state is true when the id pin is pulled low, so we
change the name of ->state to ->connected to properly reflect
that we're interested in the cable being connected.

Acked-by: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 15:13:49 +08:00
Stephen Boyd 7bb7e9b1a4 usb: chipidea: Add support for ULPI PHY bus
Some phys for the chipidea controller are controlled via the ULPI
viewport. Add support for the ULPI bus so that these sorts of
phys can be probed and read/written automatically without having
to duplicate the viewport logic in each phy driver.

Acked-by: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 11:25:14 +08:00
Stephen Boyd 8feb3680bd usb: chipidea: Add platform flag for wrapper phy management
The ULPI phy on qcom platforms needs to be initialized and
powered on after a USB reset and before we toggle the run/stop
bit. Otherwise, the phy locks up and doesn't work properly.
Therefore, add a flag to skip any phy power management in the
core layer, leaving it up to the glue driver to manage.

Acked-by: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 11:25:02 +08:00
Stephen Boyd f60f8ccd54 usb: chipidea: Only read/write OTGSC from one place
With the id and vbus detection done via extcon we need to make
sure we poll the status of OTGSC properly by considering what the
extcon is saying, and not just what the register is saying. Let's
move this hw_wait_reg() function to the only place it's used and
simplify it for polling the OTGSC register. Then we can make
certain we only use the hw_read_otgsc() API to read OTGSC, which
will make sure we properly handle extcon events.

Acked-by: Peter Chen <peter.chen@nxp.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Ivan T. Ivanov" <iivanov.xz@gmail.com>
Fixes: 3ecb3e09b0 ("usb: chipidea: Use extcon framework for VBUS and ID detect")
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 11:24:15 +08:00
Chanwoo Choi 3f991aa0b6 usb: chipdata: Replace the extcon API
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2017-01-20 11:14:07 +08:00
Peter Chen a5d906bb26 usb: chipidea: move the lock initialization to core file
This can fix below dump when the lock is accessed at host
mode due to it is not initialized.

[   46.119638] INFO: trying to register non-static key.
[   46.124643] the code is fine but needs lockdep annotation.
[   46.130144] turning off the locking correctness validator.
[   46.135659] CPU: 0 PID: 690 Comm: cat Not tainted 4.9.0-rc3-00079-g4b75f1d #1210
[   46.143075] Hardware name: Freescale i.MX6 SoloX (Device Tree)
[   46.148923] Backtrace:
[   46.151448] [<c010c460>] (dump_backtrace) from [<c010c658>] (show_stack+0x18/0x1c)
[   46.159038]  r7:edf52000
[   46.161412]  r6:60000193
[   46.163967]  r5:00000000
[   46.165035]  r4:c0e25c2c

[   46.169109] [<c010c640>] (show_stack) from [<c03f58a4>] (dump_stack+0xb4/0xe8)
[   46.176362] [<c03f57f0>] (dump_stack) from [<c016d690>] (register_lock_class+0x4fc/0x56c)
[   46.184554]  r10:c0e25d24
[   46.187014]  r9:edf53e70
[   46.189569]  r8:c1642444
[   46.190637]  r7:ee9da024
[   46.193191]  r6:00000000
[   46.194258]  r5:00000000
[   46.196812]  r4:00000000
[   46.199185]  r3:00000001

[   46.203259] [<c016d194>] (register_lock_class) from [<c0171294>] (__lock_acquire+0x80/0x10f0)
[   46.211797]  r10:c0e25d24
[   46.214257]  r9:edf53e70
[   46.216813]  r8:ee9da024
[   46.217880]  r7:c1642444
[   46.220435]  r6:edcd1800
[   46.221502]  r5:60000193
[   46.224057]  r4:00000000

[   46.227953] [<c0171214>] (__lock_acquire) from [<c01726c0>] (lock_acquire+0x74/0x94)
[   46.235710]  r10:00000001
[   46.238169]  r9:edf53e70
[   46.240723]  r8:edf53f80
[   46.241790]  r7:00000001
[   46.244344]  r6:00000001
[   46.245412]  r5:60000193
[   46.247966]  r4:00000000

[   46.251866] [<c017264c>] (lock_acquire) from [<c096c8fc>] (_raw_spin_lock_irqsave+0x40/0x54)
[   46.260319]  r7:ee1c6a00
[   46.262691]  r6:c062a570
[   46.265247]  r5:20000113
[   46.266314]  r4:ee9da014

[   46.270393] [<c096c8bc>] (_raw_spin_lock_irqsave) from [<c062a570>] (ci_port_test_show+0x2c/0x70)
[   46.279280]  r6:eebd2000
[   46.281652]  r5:ee9da010
[   46.284207]  r4:ee9da014

[   46.286810] [<c062a544>] (ci_port_test_show) from [<c0248d04>] (seq_read+0x1ac/0x4f8)
[   46.294655]  r9:edf53e70
[   46.297028]  r8:edf53f80
[   46.299583]  r7:ee1c6a00
[   46.300650]  r6:00000001
[   46.303205]  r5:00000000
[   46.304273]  r4:eebd2000
[   46.306850] [<c0248b58>] (seq_read) from [<c039e864>] (full_proxy_read+0x54/0x6c)
[   46.314348]  r10:00000000
[   46.316808]  r9:c0a6ad30
[   46.319363]  r8:edf53f80
[   46.320430]  r7:00020000
[   46.322986]  r6:b6de3000
[   46.324053]  r5:ee1c6a00
[   46.326607]  r4:c0248b58

[   46.330505] [<c039e810>] (full_proxy_read) from [<c021ec98>] (__vfs_read+0x34/0x118)
[   46.338262]  r9:edf52000
[   46.340635]  r8:c0107fc4
[   46.343190]  r7:00020000
[   46.344257]  r6:edf53f80
[   46.346812]  r5:c039e810
[   46.347879]  r4:ee1c6a00
[   46.350447] [<c021ec64>] (__vfs_read) from [<c021fbd0>] (vfs_read+0x8c/0x11c)
[   46.357597]  r9:edf52000
[   46.359969]  r8:c0107fc4
[   46.362524]  r7:edf53f80
[   46.363592]  r6:b6de3000
[   46.366147]  r5:ee1c6a00
[   46.367214]  r4:00020000
[   46.369782] [<c021fb44>] (vfs_read) from [<c0220a4c>] (SyS_read+0x4c/0xa8)
[   46.376672]  r8:c0107fc4
[   46.379045]  r7:00020000
[   46.381600]  r6:b6de3000
[   46.382667]  r5:ee1c6a00
[   46.385222]  r4:ee1c6a00

[   46.387817] [<c0220a00>] (SyS_read) from [<c0107e20>] (ret_fast_syscall+0x0/0x1c)
[   46.395314]  r7:00000003
[   46.397687]  r6:b6de3000
[   46.400243]  r5:00020000
[   46.401310]  r4:00020000

Cc: <stable@vger.kernel.org>
Fixes: 26c696c678 ("USB: Chipidea: rename struct
	       	ci13xxx variables from udc to ci")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 19:25:25 +01:00
Peter Chen aa7381876c usb: chipidea: add system interface for ttctrl.ttha
In chipidea IP RTL, there is a very limited design for siTD, the detail
like below:
There is no Max Packet Size at siTD, so it uses one constant for both
Max Packet Size for packet and the packet size for the last transaction
when considering schedule.
If the ttctrl.ttha does not match against Hub Address field in siTD,
this constant is 188 bytes, else this constant is 1023 bytes.

If the ttctrl.ttha is non-zero value, RTL will use 188 as this constant,
so it will lose the data if the packet size is larger than 188 bytes, eg,
if we playback a wav which format is 48khz, 16 bits, 2 channels, the
packet size will be 192bytes, but the controller will only send 188 bytes
for this packet, the noise will be heared using USB audio card.
The use case is single transaction, but higher frame rate.

If the ttctr.ttha is zero value, we can send 1023 bytes within one
transaction, but the controller will not accept the coming tranaction
if it considers the schedule time is less than 1023 bytes. So the
limitation is we can't schedule as many as transactions within frame.
If the total bytes is already 256 bytes for previous transactions within
frame, it can't accept another transaction. The use case is multiple
transactions, but less frame rate.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2016-02-29 13:37:51 +08:00
Saurabh Sengar 4b19b78aa6 usb: chipidea: removing of_find_property
call to of_find_property() before of_property_read_u32() is unnecessary.
of_property_read_u32() anyway calls to of_find_property() only.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-12-24 14:15:27 +08:00
Peter Chen 3a35d59a69 usb: chipidea: clean up CONFIG_USB_CHIPIDEA_DEBUG reference
Since this configuration option has deleted, cleans up all
its references.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
2015-12-24 14:15:27 +08:00
Peter Chen 9d8c850d02 usb: chipidea: support debugfs without CONFIG_USB_CHIPIDEA_DEBUG
Since we need to mount debugfs to show/store the things we
want to debug, it is duplicated to add another configuration
to enable it. Meanwhile, with CONFIG_USB_CHIPIDEA_DEBUG,
we can't support chipidea debugfs at runtime.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Cc: Jun Li <jun.li@freescale.com>
2015-12-24 14:15:26 +08:00