Commit Graph

19 Commits

Author SHA1 Message Date
Desnes Nunes bb6daf7630 usb: mtu3: Add MT8195 MTU3 ip-sleep wakeup support
JIRA: https://issues.redhat.com/browse/RHEL-37673

commit 4158af057c7f84790d7b04f589d5b8a93fddf469
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Date: Mon, 22 Jan 2024 12:18:09 +0100

  Add support for the ip-sleep wakeup functionality on the three MTU3
  controllers found on the MT8195 SoC.

  Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
  Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
  Link: https://lore.kernel.org/r/20240122111809.148546-2-angelogioacchino.delregno@collabora.com
  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
2024-06-13 13:56:58 -03:00
Torez Smith 66bdd84947 usb: mtu3: fix random remote wakeup
Bugzilla: http://bugzilla.redhat.com/2061784
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45014530
Tested: HP ZBook 15 G5/80D5 Laptop
 TGL-U(QS) Laptop

commit d98a30ccdc839947c9233369744341d1fa54439c
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Aug 26 16:36:37 2021 +0800

    usb: mtu3: fix random remote wakeup

    Some platforms, e.g. 8183/8192, use low level latch way to keep
    wakeup signal, it may latch a wrong signal if debounce more time,
    and enable wakeup earlier.
                       ____________________
    ip_sleep      ____/                    \__________
                               ___________________
    wakeup_signal ____________/                   \______
                          _______________________________
    wakeup_en     _______/
                          ^     ^
                          |(1)  |(2)
    latch wakeup_signal mistakenly at (1), should latch it at (2);

    Workaround: delay about 100us to enable wakeup, meanwhile decrease
    debounce time.

    Fixes: b1a344589e ("usb: mtu3: support ip-sleep wakeup for MT8183")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/20210826083637.33237-2-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:29:21 -04:00
Torez Smith 188c0c7529 usb: mtu3: support suspend/resume for dual-role mode
Bugzilla: http://bugzilla.redhat.com/2061784
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45014530
Tested: HP ZBook 15 G5/80D5 Laptop
 TGL-U(QS) Laptop

commit 6b587394c65c23d5ba05a33e5899e2ed8dab3c97
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Jul 15 17:07:58 2021 +0800

    usb: mtu3: support suspend/resume for dual-role mode

    Support suspend/resume for dual-role mode including the single
    port and multi-ports supported by host controller, when the host
    supports mult-ports, only port0 (u2/u3) is used to support dual
    role mode.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1626340078-29111-14-git-send-email-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:29:02 -04:00
Torez Smith 8c22c087f4 usb: mtu3: add new helpers for host suspend/resume
Bugzilla: http://bugzilla.redhat.com/2061784
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45014530
Tested: HP ZBook 15 G5/80D5 Laptop
 TGL-U(QS) Laptop

commit 0609c1aa10de07b8828cac88bf26140ec1a56a51
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Jul 15 17:07:54 2021 +0800

    usb: mtu3: add new helpers for host suspend/resume

    Extract two helpers for host suspend and resume, will make it easy
    to support dual-role mode suspend/resume later.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1626340078-29111-10-git-send-email-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:29:01 -04:00
Torez Smith 6f58849346 usb: mtu3: support option to disable usb2 ports
Bugzilla: http://bugzilla.redhat.com/2061784
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45014530
Tested: HP ZBook 15 G5/80D5 Laptop
 TGL-U(QS) Laptop

commit d7e127242816e06981840880eead898197a3257b
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Jul 15 17:07:53 2021 +0800

    usb: mtu3: support option to disable usb2 ports

    Add support to disable specific usb2 host ports, it's useful when
    a usb2 port is disabled on some platforms, but enabled on others
    for the same SoC.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1626340078-29111-9-git-send-email-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:29:01 -04:00
Chunfeng Yun 13862176a3 usb: mtu3: use force mode for dual role switch
Force IDDIG status for all three ways of dual role switch, this
is needed when use Type-C to switch mode.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1623139069-8173-13-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-15 15:43:50 +02:00
Chunfeng Yun a099d36884 usb: mtu3: add support ip-sleep wakeup for MT8192
Add add support ip-sleep wakeup for MT8192, it's a specific
revision, not following IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1616482975-17841-11-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-26 14:46:39 +01:00
Chunfeng Yun b1a344589e usb: mtu3: support ip-sleep wakeup for MT8183
Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
and it's also a specific one, but not following IPM rule.
Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatibility, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for later
revision that follows the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1616482975-17841-10-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-26 14:46:14 +01:00
Colin Ian King 18106234c0 usb: mtu3: Fix spelling mistake "disabed" -> "disabled"
The variable u3_ports_disabed contains a spelling mistake,
rename it to u3_ports_disabled.

Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210311092529.4898-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-18 09:02:27 +01:00
Fengguang Wu b90c6d1050 usb: mtu3: fix semicolon.cocci warnings
drivers/usb/mtu3/mtu3_host.c:58:2-3: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: f0ede2c628 ("usb: mtu3: supports remote wakeup for mt2712 with two SSUSB IPs")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-16 10:01:01 +01:00
Chunfeng Yun f0ede2c628 usb: mtu3: supports remote wakeup for mt2712 with two SSUSB IPs
The old way of usb wakeup only supports platform with single SSUSB IP,
such as mt8173, but mt2712 has two SSUSB IPs, so rebuild its flow and
also supports the new glue layer of usb wakeup on mt2712 which is
different from mt8173.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-09 16:21:27 +01:00
Greg Kroah-Hartman 4c55a15774 USB: mtu3: 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.

Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.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
Chunfeng Yun c776f2c3e8 usb: mtu3: use FORCE/RG_IDDIG to implement manual DRD switch
In order to keep manual DRD switch independent on IDDIG interrupt,
make use of FORCE/RG_IDDIG instead of IDDIG EINT interrupt to
implement manual DRD switch function.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-10-19 10:38:11 +03:00
Chunfeng Yun d90223ac2a usb: mtu3: remove dummy wakeup debounce clocks
The wakeup debounce clocks for each ports in fact are not
needed, so remove them.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-10-19 10:38:11 +03:00
Chunfeng Yun 076f1a8903 usb: mtu3: support option to disable usb3 ports
Add support to disable specific usb3 ports, it's useful when
usb3 phy is shared with PCIe or SATA, because we should disable
the corresponding usb3 port if the phy is used by PCIe or SATA.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-10-19 10:38:10 +03:00
Rob Herring d9241ff2f2 usb: Convert to using %pOF instead of full_name
Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-22 15:56:53 +02:00
Chunfeng Yun d0ed062a8b usb: mtu3: dual-role mode support
support dual-role mode; there are two ways to switch between
host and device modes, one is by idpin, another is by debugfs
which depends on user input.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-27 17:02:41 +02:00
Chunfeng Yun b3f4e727c1 usb: mtu3: host only mode support
supports host only mode and the code is ported from
host/xhci-mtk.c
IPPC register shared between host and device is moved
into common glue layer.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-27 17:02:41 +02:00