devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Felipe Balbi <balbi@kernel.org>,
	 Wesley Cheng <quic_wcheng@quicinc.com>,
	 Saravana Kannan <saravanak@google.com>,
	 Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	 Bjorn Andersson <andersson@kernel.org>,
	 Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 Bjorn Andersson <quic_bjorande@quicinc.com>
Subject: [PATCH v2 0/7] usb: dwc3: qcom: Flatten dwc3 structure
Date: Sun, 11 Aug 2024 20:11:57 -0700	[thread overview]
Message-ID: <20240811-dwc3-refactor-v2-0-91f370d61ad2@quicinc.com> (raw)

The USB IP-block found in most Qualcomm platforms is modelled in the
Linux kernel as 3 different independent device drivers, but as shown by
the already existing layering violations in the Qualcomm glue driver
they can not be operated independently.

With the current implementation, the glue driver registers the core and
has no way to know when this is done. As a result, e.g. the suspend
callbacks needs to guard against NULL pointer dereferences when trying
to peek into the struct dwc3 found in the drvdata of the child.

Missing from the upstream Qualcomm USB support is handling of role
switching, in which the glue needs to be notified upon DRD mode changes.
Several attempts has been made through the years to register callbacks
etc, but they always fall short when it comes to handling of the core's
probe deferral on resources etc.

Furhtermore, the DeviceTree binding is a direct representation of the
Linux driver model, and doesn't necessarily describe "the USB IP-block".

This series therefor attempts to flatten the driver split, and operate
the glue and core out of the same platform_device instance. And in order
to do this, the DeviceTree representation of the IP block is flattened.

---
Changes in v2:
- Rewrite after ACPI removal, multiport support and interrupt fixes
- Completely changed strategy for DeviceTree binding, as previous idea
  of using snps,dwc3 as a generic fallback required unreasonable changes
  to that binding.
- Abandoned idea of supporting both flattened and unflattened device
  model in the one driver. As Johan pointed out, it will leave the race
  condition holes and will make the code harder to understand.
  Furthermore, the role switching logic that we intend to introduce
  following this would have depended on the user updating their
  DeviceTree blobs.
- Per above, introduced the dynamic DeviceTree rewrite
- Link to v1: https://lore.kernel.org/all/20231016-dwc3-refactor-v1-0-ab4a84165470@quicinc.com/

---
Bjorn Andersson (7):
      dt-bindings: usb: snps,dwc3: Split core description
      dt-bindings: usb: Introduce qcom,snps-dwc3
      of: dynamic: Don't discard children upon node attach
      usb: dwc3: core: Expose core driver as library
      usb: dwc3: qcom: Don't reply on drvdata during probe
      usb: dwc3: qcom: Transition to flattened model
      arm64: dts: qcom: sc8280x: Flatten the USB nodes

 .../devicetree/bindings/usb/qcom,dwc3.yaml         |  13 +-
 .../devicetree/bindings/usb/qcom,snps-dwc3.yaml    | 608 +++++++++++++++++++++
 .../devicetree/bindings/usb/snps,dwc3-common.yaml  | 417 ++++++++++++++
 .../devicetree/bindings/usb/snps,dwc3.yaml         | 391 +------------
 arch/arm64/boot/dts/qcom/sa8295p-adp.dts           |  12 +-
 arch/arm64/boot/dts/qcom/sa8540p-ride.dts          |   5 +-
 arch/arm64/boot/dts/qcom/sc8280xp-crd.dts          |  12 +-
 .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts     |  11 +-
 arch/arm64/boot/dts/qcom/sc8280xp.dtsi             | 138 +++--
 drivers/of/dynamic.c                               |   1 -
 drivers/usb/dwc3/core.c                            | 169 ++++--
 drivers/usb/dwc3/core.h                            |   3 +
 drivers/usb/dwc3/dwc3-qcom.c                       | 323 ++++++++---
 13 files changed, 1483 insertions(+), 620 deletions(-)
---
base-commit: 864b1099d16fc7e332c3ad7823058c65f890486c
change-id: 20231016-dwc3-refactor-931e3b08a8b9

Best regards,
-- 
Bjorn Andersson <quic_bjorande@quicinc.com>


             reply	other threads:[~2024-08-12  3:07 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  3:11 Bjorn Andersson [this message]
2024-08-12  3:11 ` [PATCH v2 1/7] dt-bindings: usb: snps,dwc3: Split core description Bjorn Andersson
2024-08-18 14:33   ` Rob Herring
2024-08-12  3:11 ` [PATCH v2 2/7] dt-bindings: usb: Introduce qcom,snps-dwc3 Bjorn Andersson
2024-08-12  4:32   ` Rob Herring (Arm)
2024-08-12  3:12 ` [PATCH v2 3/7] of: dynamic: Don't discard children upon node attach Bjorn Andersson
2024-08-12 20:24   ` Rob Herring
2024-08-12 21:21     ` Bjorn Andersson
2024-08-12  3:12 ` [PATCH v2 4/7] usb: dwc3: core: Expose core driver as library Bjorn Andersson
2024-08-12 12:21   ` kernel test robot
2024-08-12 19:00     ` Bjorn Andersson
2024-08-12 12:21   ` kernel test robot
2024-08-13 18:15   ` Frank Li
2024-08-14  1:01     ` Thinh Nguyen
2024-08-19 21:35     ` Bjorn Andersson
2024-08-14  0:56   ` Thinh Nguyen
2024-08-19 21:14     ` Bjorn Andersson
2024-08-19 17:48   ` Krishna Kurapati
2024-08-19 21:36     ` Bjorn Andersson
2024-09-12 22:21   ` Masahiro Yamada
2024-09-13  2:34     ` Bjorn Andersson
2024-08-12  3:12 ` [PATCH v2 5/7] usb: dwc3: qcom: Don't reply on drvdata during probe Bjorn Andersson
2024-08-13 18:18   ` Frank Li
2024-08-19 21:17     ` Bjorn Andersson
2024-09-12 22:21   ` Masahiro Yamada
2024-08-12  3:12 ` [PATCH v2 6/7] usb: dwc3: qcom: Transition to flattened model Bjorn Andersson
2024-08-12 13:33   ` kernel test robot
2024-08-12 21:21   ` Rob Herring
2024-08-12 22:16     ` Bjorn Andersson
2024-08-13 15:06       ` Rob Herring
2024-08-13 18:33   ` Frank Li
2024-08-19 21:28     ` Bjorn Andersson
2024-08-12  3:12 ` [PATCH v2 7/7] arm64: dts: qcom: sc8280x: Flatten the USB nodes Bjorn Andersson
2024-08-13 18:07 ` [PATCH v2 0/7] usb: dwc3: qcom: Flatten dwc3 structure Frank Li
2024-10-08 20:09   ` Frank Li
2024-10-09  2:54     ` Bjorn Andersson
2025-01-10 16:55       ` Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240811-dwc3-refactor-v2-0-91f370d61ad2@quicinc.com \
    --to=andersson@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).