Commit Graph

11 Commits

Author SHA1 Message Date
Martin McConnell 36d663a32d usb: cdns3: Use dev_err_probe
JIRA: https://issues.redhat.com/browse/RHEL-54566

commit 776630be36935be3a51e5ecfa7fc7614c4d4e46e
Author: Alexander Stein <alexander.stein@ew.tq-group.com>
Date:   Thu Dec 14 15:40:11 2023 +0100

    usb: cdns3: Use dev_err_probe

    Create an error message or upon deferral add a description for sysfs.

    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Link: https://lore.kernel.org/r/20231214144011.1987586-1-alexander.stein@ew.tq-group.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Martin McConnell <mmcconne@redhat.com>
2024-08-30 12:21:47 +01:00
Martin McConnell 2504d09ab5 usb: cdns3: Put the cdns set active part outside the spin lock
JIRA: https://issues.redhat.com/browse/RHEL-54566

commit 2319b9c87fe243327285f2fefd7374ffd75a65fc
Author: Xiaolei Wang <xiaolei.wang@windriver.com>
Date:   Fri Jun 16 10:19:51 2023 +0800

    usb: cdns3: Put the cdns set active part outside the spin lock

    The device may be scheduled during the resume process,
    so this cannot appear in atomic operations. Since
    pm_runtime_set_active will resume suppliers, put set
    active outside the spin lock, which is only used to
    protect the struct cdns data structure, otherwise the
    kernel will report the following warning:

      BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1163
      in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 651, name: sh
      preempt_count: 1, expected: 0
      RCU nest depth: 0, expected: 0
      CPU: 0 PID: 651 Comm: sh Tainted: G        WC         6.1.20 #1
      Hardware name: Freescale i.MX8QM MEK (DT)
      Call trace:
        dump_backtrace.part.0+0xe0/0xf0
        show_stack+0x18/0x30
        dump_stack_lvl+0x64/0x80
        dump_stack+0x1c/0x38
        __might_resched+0x1fc/0x240
        __might_sleep+0x68/0xc0
        __pm_runtime_resume+0x9c/0xe0
        rpm_get_suppliers+0x68/0x1b0
        __pm_runtime_set_status+0x298/0x560
        cdns_resume+0xb0/0x1c0
        cdns3_controller_resume.isra.0+0x1e0/0x250
        cdns3_plat_resume+0x28/0x40

    Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
    Acked-by: Peter Chen <peter.chen@kernel.org>
    Link: https://lore.kernel.org/r/20230616021952.1025854-1-xiaolei.wang@windriver.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Martin McConnell <mmcconne@redhat.com>
2024-08-30 12:21:41 +01:00
Martin McConnell a34e200104 usb: cdns3-plat: Convert to platform remove callback returning void
JIRA: https://issues.redhat.com/browse/RHEL-54566

commit 5411fa0ec65626180e3eddeb30633fc5e2313c01
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu May 18 01:01:05 2023 +0200

    usb: cdns3-plat: 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-4-u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Martin McConnell <mmcconne@redhat.com>
2024-08-30 12:20:41 +01:00
Martin McConnell d0eef6a938 usb: cdns3: remove dead code
JIRA: https://issues.redhat.com/browse/RHEL-54566

commit 29afbe5f5afc2f724b8aef2d11fbe6a7ee48997e
Author: Dongliang Mu <mudongliangabcd@gmail.com>
Date:   Mon Sep 26 21:59:21 2022 +0800

    usb: cdns3: remove dead code

    Smatch reports the following error:

    drivers/usb/cdns3/cdns3-plat.c:113 cdns3_plat_probe() warn:
    platform_get_irq() does not return zero

    From the document, platform_get_irq_byname_optional only returns
    non-zero value, and negative value on failure.

    Fix this by removing the zero value checking.

    Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
    Link: https://lore.kernel.org/r/20220926135922.24541-1-dzm91@hust.edu.cn
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Martin McConnell <mmcconne@redhat.com>
2024-08-30 12:20:32 +01:00
Desnes Nunes deb21c1cbc usb: Explicitly include correct DT includes
JIRA: https://issues.redhat.com/browse/RHEL-28809
Conflicts:
* Avoding unsupported changes at renesas_usbf.c, fhci-hcd,
  mtu3_host and jz4740

commit 484468fb0f7dbac88f050009a5145ed1ee744a7e
Author: Rob Herring <robh@kernel.org>
Date: Tue, 18 Jul 2023 08:30:23 -0600

  The DT of_device.h and of_platform.h date back to the separate
  of_platform_bus_type before it as merged into the regular platform bus.
  As part of that merge prepping Arm DT support 13 years ago, they
  "temporarily" include each other. They also include platform_device.h
  and of.h. As a result, there's a pretty much random mix of those include
  files used throughout the tree. In order to detangle these headers and
  replace the implicit includes with struct declarations, users need to
  explicitly include the correct includes.

  Acked-by: Herve Codina <herve.codina@bootlin.com>
  Signed-off-by: Rob Herring <robh@kernel.org>
  Link: https://lore.kernel.org/r/20230718143027.1064731-1-robh@kernel.org
  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
2024-03-18 15:42:26 -03:00
Torez Smith a1cffb6362 usb: cdns3: Use platform_get_irq_byname() to get the interrupt
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 78e17d69999521b52b9db9656e9b9b397f59f228
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Date:   Mon Dec 20 01:04:10 2021 +0000

    usb: cdns3: Use platform_get_irq_byname() to get the interrupt

    platform_get_resource_byname(pdev, IORESOURCE_IRQ, ..) relies on static
    allocation of IRQ resources in DT core code, this causes an issue
    when using hierarchical interrupt domains using "interrupts" property
    in the node as this bypasses the hierarchical setup and messes up the
    irq chaining.

    In preparation for removal of static setup of IRQ resource from DT core
    code use platform_get_irq_byname().

    Reviewed-by: Roger Quadros <rogerq@kernel.org>
    Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
    Link: https://lore.kernel.org/r/20211220010411.12075-6-prabhakar.mahadev-lad.rj@bp.renesas.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Torez Smith <torez@redhat.com>
2022-05-02 15:30:29 -04:00
Lee Jones 6dd1efeb18 usb: cdns3: cdns3-plat: Fix incorrect naming of function 'cdns3_plat_remove()'
Fixes the following W=1 kernel build warning(s):

 drivers/usb/cdns3/cdns3-plat.c:179: warning: expecting prototype for cdns3_remove(). Prototype was for cdns3_plat_remove() 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: linux-usb@vger.kernel.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-5-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27 09:43:44 +02:00
Frank Li 2cf2581cd2
usb: cdns3: add power lost support for system resume
If the controller lost its power during the system suspend, we need
to do all initialiation operations.

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>
2021-04-12 20:19:20 +08:00
Pawel Laszczak 0b490046d8
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>
2020-12-29 12:36:13 +08:00
Pawel Laszczak 394c3a144d
usb: cdns3: Moves reusable code to separate module
Patch moves common reusable code used by cdns3 and cdnsp driver
to cdns-usb-common library. This library include core.c, drd.c
and host.c files.

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>
2020-12-29 12:36:13 +08:00
Pawel Laszczak f738957277
usb: cdns3: Split core.c into cdns3-plat and core.c file
Patch splits file core.c into core.c containing the common reusable code
and cnd3-plat.c containing device platform specific code. These changes
are required to make possible reuse DRD part of CDNS3 driver in CDNSP
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>
2020-12-29 12:36:13 +08:00