Commit Graph

42 Commits

Author SHA1 Message Date
Desnes Nunes 7faf9bad6c usb: Use (of|device)_property_present() for non-boolean properties
JIRA: https://issues.redhat.com/browse/RHEL-78828

commit 6ff78df5b3d0bbc640c5c0ee12800c26dc251c5c
Author: "Rob Herring (Arm)" <robh@kernel.org>
Date: Mon, 4 Nov 2024 13:08:18 -0600

  The use of (of|device)_property_read_bool() for non-boolean properties
  is deprecated in favor of of_property_present() when testing for
  property presence.

  Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
  Acked-by: Peter Chen <peter.chen@kernel.org>
  Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
  Link: https://lore.kernel.org/r/20241104190820.277702-1-robh@kernel.org
  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
2025-03-19 21:23:46 -03:00
Torez Smith f80579e8f1 usb: mtu3: check capability of usb3 dual role
Bugzilla: http://bugzilla.redhat.com/2113003
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=48723298
Tested: HP ZBook 15 G5/80D5 Laptop
  ThinkPad P1 Gen5  TB4
  HP zBook Fury

commit 683ff6e485f1d16fe3ad4f5fbd04af11ce917caf
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Fri Jul 8 15:19:02 2022 +0800

    usb: mtu3: check capability of usb3 dual role

    It is capable of supporting usb3 dual role if there is at least one
    usb3 port for device and xhci controller, we can check it from the
    controller's capability, so no need the property "mediatek,usb3-drd"
    anymore, but I find the property is not decribed in dt-binding.
    Meanwhile, also take into account if the u3 port is disabled when the
    u3 phy is shared with pcie.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/20220708071903.25752-4-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-11-01 22:28:45 -04:00
Torez Smith 68364a2403 usb: mtu3: add support controller reset
Bugzilla: http://bugzilla.redhat.com/2113003
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=48723298
Tested: HP ZBook 15 G5/80D5 Laptop
  ThinkPad P1 Gen5  TB4
  HP zBook Fury

commit e84e3e99256e2aedab5f45f8e02bc98c891b9188
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon May 23 17:04:49 2022 +0800

    usb: mtu3: add support controller reset

    Add support controller reset via a reset-controller usually in infracfg,
    it's different with the software reset by IPPC which only used to reset MAC,
    and it will also reset IPPC meanwhile.

    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/20220523090449.14430-4-chunfeng.yun@mediatek.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-11-01 22:28:28 -04:00
Torez Smith b50034c38f usb: mtu3: enable wake-up interrupt after runtime_suspend called
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 7ddae8c779dacc83918e7c6e0e2463bdd71005dd
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Mon Oct 25 15:01:55 2021 +0800

    usb: mtu3: enable wake-up interrupt after runtime_suspend called

    Use the new API dev_pm_set_dedicated_wake_irq_reverse() to request
    dedicated wake-up interrupt, due to we want to enable the wake IRQ
    after running ->runtime_suspend().

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:30:00 -04: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 df9e027860 usb: mtu3: return successful suspend status
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 50fdcb56c41904c3535687a0e1e1dbd9423a8f9a
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Aug 26 16:36:36 2021 +0800

    usb: mtu3: return successful suspend status

    Forgot 'return 0;' when suspend successfully, make the mistake
    when I split patches.

    Fixes: 6b587394c65c ("usb: mtu3: support suspend/resume for dual-role mode")
    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/20210826083637.33237-1-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:20 -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 d842304ddd usb: mtu3: support suspend/resume for device 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 427c66422e14b8468ee005aa6edf76ef0c2a8fc2
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Jul 15 17:07:57 2021 +0800

    usb: mtu3: support suspend/resume for device mode

    Support suspend/resume for device mode if the device is not
    connected with a host, otherwise reject to suspend.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1626340078-29111-13-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 3ce43b00a9 usb: mtu3: support runtime PM for host 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 fa6f59e28c6197150d9aa94f0d617b59090691e5
Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
Date:   Thu Jul 15 17:07:55 2021 +0800

    usb: mtu3: support runtime PM for host mode

    Use a dedicated wakeup irq for runtime suspend/resume, and interrupts
    names are provided if using wakeup irq, this patch only support host
    mode.

    Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
    Link: https://lore.kernel.org/r/1626340078-29111-11-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 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 cd59ea91ea usb: mtu3: use clock bulk to get clocks
Use clock bulk helpers to get/enable/disable clocks, meanwhile
make sys_ck optional, then will be easier to handle clocks.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1623139069-8173-24-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-15 15:46:45 +02:00
Chunfeng Yun 51c236d5e1 usb: mtu3: skip getting extcon when use manual drd switch
When use manual drd switch, extcon is not used in fact, so no
need get it even it exists, just skip it like using role switch.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1622182260-23767-5-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 13:53:04 +02:00
Chunfeng Yun f3ec606efc usb: mtu3: use dev_err_probe to print error log about extcon
Print an error log when the error number is not -EPROBE_DEFER

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1622182260-23767-4-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-03 13:53:04 +02:00
Chunfeng Yun 24327c478b usb: mtu3: drop CONFIG_OF
The driver can match only the devices created by the OF core
via the DT table, so the table should be always used.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1616482975-17841-12-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-26 14:47:19 +01:00
Chunfeng Yun 5ad91812ea usb: mtu3: convert to devm_platform_ioremap_resource_byname
Use devm_platform_ioremap_resource_byname() to simplify code

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1595404275-8449-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-29 16:49:37 +02:00
Chunfeng Yun 1ac91ac5d0 usb: mtu3: register a USB Role Switch for dual role mode
Because extcon is not allowed for new bindings, and the
dual role switch is supported by USB Role Switch,
especially for Type-C drivers, so register a USB Role
Switch to support the new way

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1567070558-29417-12-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-03 20:02:15 +02:00
Chunfeng Yun 1567d661b9 usb: mtu3: get optional clock by devm_clk_get_optional()
Use devm_clk_get_optional() to get optional clock instead of
optional_clk_get() which uses devm_clk_get() to get clock and
checks for -EPROBE_DEFER but not -ENOENT as devm_clk_get_optional()
does, in fact, only ignoring -ENOENT will cover more errors, so
the replacement doesn't change original purpose.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19 14:24:26 +02:00
Chunfeng Yun ae07809255 usb: mtu3: add debugfs interface files
This adds more debugfs consumers. The debugfs entries read some
important registers, fifo status, QMU ring, endpoint status, and
IPPC probe interface to get internal status.
With these entries, users can check the registers, endpoint and
GPD used during run time.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-26 16:40:14 +09:00
Chunfeng Yun 918f0f2361 usb: mtu3: rebuild the code of getting vbus regulator
Remove local variable @vbus and use @dev instead of @pdev->dev

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-26 16:40:13 +09:00
Chunfeng Yun c858b4f373 usb: mtu3: print useful information also for device and host modes
Print useful information not only dual-role mode but also
device mode and host mode.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-26 16:40:13 +09:00
Chunfeng Yun 03d8bfc130 usb: mtu3: check return value of devm_extcon_register_notifier()
Check the return value of devm_extcon_register_notifier() and
add error handling.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-26 16:40:12 +09:00
Hsin-Yi, Wang 1e3af5dfd0 usb/mtu3: power down device ip at setup
Originally, when dr_mode is USB_DR_MODE_HOST, it didn't power down device ip,
so host ip sleep will fail at ssusb_host_disable.

Power down device ip at ssusb_host_setup.

Signed-off-by: Hsin-Yi, Wang <hsinyi@chromium.org>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 10:13:39 +01:00
Wolfram Sang f86c6888dd usb: mtu3: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-22 16:00:57 +02: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
Chunfeng Yun 3849c29013 usb: mtu3: fix error code for getting extcon device
When failing to get extcon device, extcon_get_edev_by_phandle()
may return different error codes, but not only -EPROBE_DEFER,
so can't always return -EPROBE_DEFER, and fix it.

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 dd9d2f3aa3 usb: mtu3: set invalid dr_mode as dual-role mode
Treat dr_mode of USB_DR_MODE_UNKNOWN as USB_DR_MODE_OTG to
enhance functional robustness.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-10-19 10:38:12 +03:00
Chunfeng Yun 6638ec515f usb: mtu3: get optional vbus for host only mode
When dr_mode is set as USB_DR_MODE_HOST, it's better to try to
get optional vbus, this can increase flexibility, although we
can set vbus as always on for regulator or put it in host driver
to turn it on.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-10-19 10:38:12 +03: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 a316da82f8 usb: mtu3: add optional mcu and dma bus clocks
There are mcu_bus and dma_bus clocks needed to be turned on/off by
driver on some SoCs, so add them as optional ones

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
Chunfeng Yun dfcdcba9e3 usb: mtu3: add generic compatible string
The mtu3 driver is a generic driver for MediaTek usb3 DRD IP, add
a generic compatible to avoid confusion when support new SoCs but
use a compatible with specific SoC's name "mt8173".

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-08-15 12:46:04 +03:00
Arvind Yadav 0f4c3f9021 usb: mtu3: Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13 10:54:40 +02:00
Wei Yongjun b7ecfe7126 usb: mtu3: remove redundant dev_err call in get_ssusb_rscs()
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-09 13:34:18 +01:00
Chunfeng Yun ca12cb7cb0 usb: mtu3: make the reference clock optional
Make the reference clock optional for DTS backward compatibility
and ignore the error if it does not exist.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-08 07:44:52 +01:00
Chunfeng Yun 4d70d0c6c1 usb: mtu3: add reference clock
usually, the reference clock comes from 26M oscillator directly,
but some SoCs are not, add it for compatibility.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 10:37:16 +01:00
Chunfeng Yun 5cbf2d69f6 usb: mtu3: get resources that cause deferred probe earlier
Some resources such as regulator, clock usually cause deferred
probe, get them earlier to avoid more ineffective processing.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 10:37:16 +01: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
Chunfeng Yun df2069acb0 usb: Add MediaTek USB3 DRD driver
This patch adds support for the MediaTek USB3 controller
integrated into MT8173. It currently supports High-Speed
Peripheral Only mode.

Super-Speed Peripheral, Dual-Role Device and Host Only (xHCI)
modes will be added in the next patchs.

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