Message ID | 20250407-b4-k1-usb3-v3-2-v1-0-bf0bcc41c9ba@whut.edu.cn |
---|---|
Headers | show |
Series | Add USB3.0 PHY and host controller support for SpacemiT K1 SoC | expand |
On 4/7/25 9:18 PM, Krzysztof Kozlowski wrote: > On 07/04/2025 14:38, Ze Huang wrote: >> + >> +properties: >> + compatible: >> + const: spacemit,k1-usb2-phy >> + >> + reg: >> + maxItems: 1 >> + >> + clocks: >> + maxItems: 1 >> + >> + "#phy-cells": >> + const: 0 >> + > No supplies? No resets? Are you sure hardware does not use them? No resets are used for the USB 2.0 PHY, but there is a VBUS supply, which I included in the DWC3 glue nodes. > > Best regards, > Krzysztof > >
On 4/7/25 9:22 PM, Krzysztof Kozlowski wrote: > On 07/04/2025 14:38, Ze Huang wrote: >> Add support for SpacemiT DWC3 glue driver, which manages interrupt, >> reset and clock resource. >> >> Signed-off-by: Ze Huang <huangze@whut.edu.cn> >> --- >> .../devicetree/bindings/usb/spacemit,k1-dwc3.yaml | 78 ++++++++++++++++++++++ >> 1 file changed, 78 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.yaml b/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.yaml > Combining 3 subsystems into one patchset is a poor idea. Acknowledged, will split into two sets in next version 1. usb2 phy and combo phy 2. dwc3 glue driver and dts > >> new file mode 100644 >> index 0000000000000000000000000000000000000000..40ce3fd1330d5f371ec69155c237e10a65a9d8f4 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.yaml >> @@ -0,0 +1,78 @@ >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/usb/spacemit,k1-dwc3.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: SpacemiT K1 SuperSpeed DWC3 USB SoC Controller Glue >> + >> +maintainers: >> + - Ze Huang <huangze@whut.edu.cn> >> + >> +properties: >> + compatible: >> + const: spacemit,k1-dwc3 >> + >> + ranges: >> + maxItems: 1 >> + >> + clocks: >> + maxItems: 1 >> + >> + resets: >> + maxItems: 1 >> + >> + interrupts: >> + maxItems: 1 >> + >> + interconnects: > Missing maxItems Will fix > >> + description: >> + On SpacemiT K1, USB performs DMA through bus other than parent DT node. >> + The 'interconnects' property explicitly describes this path, ensuring >> + correct address translation. >> + >> + interconnect-names: >> + const: dma-mem >> + >> + # optional > Drop, Don't repeat constraints in free form text. Will do > >> + vbus-supply: >> + description: A phandle to the regulator supplying the VBUS voltage. >> + >> +patternProperties: >> + '^usb@': >> + $ref: snps,dwc3.yaml# > No, rather fold child into the parent. I’m not entirely sure I understand your suggestion. Could you please provide an example? Thanks! > >> + >> +additionalProperties: false > This goes after required:, always. OK > >> + >> +required: >> + - compatible >> + - ranges >> + - clocks >> + - resets >> + - interrupts >> + - interconnects >> + - interconnect-names >> + >> +examples: >> + - | >> + usb@c0a00000 { >> + compatible = "spacemit,k1-dwc3"; >> + clocks = <&syscon_apmu 16>; >> + interrupts = <149>; >> + interconnects = <&dram_range0>; >> + interconnect-names = "dma-mem"; >> + ranges = <0x0 0xc0a00000 0x10000>; >> + resets = <&syscon_apmu 8>; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + status = "disabled"; > Nope, drop. Will drop 'status' > > > > Best regards, > Krzysztof > >
On 4/7/25 9:51 PM, Rob Herring (Arm) wrote: > On Mon, 07 Apr 2025 20:38:48 +0800, Ze Huang wrote: >> Add support for SpacemiT DWC3 glue driver, which manages interrupt, >> reset and clock resource. >> >> Signed-off-by: Ze Huang <huangze@whut.edu.cn> >> --- >> .../devicetree/bindings/usb/spacemit,k1-dwc3.yaml | 78 ++++++++++++++++++++++ >> 1 file changed, 78 insertions(+) >> > My bot found errors running 'make dt_binding_check' on your patch: > > yamllint warnings/errors: > > dtschema/dtc warnings/errors: > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.example.dtb: usb@c0a00000 (spacemit,k1-dwc3): '#address-cells', '#size-cells' do not match any of the regexes: '^usb@', 'pinctrl-[0-9]+' > from schema $id: http://devicetree.org/schemas/usb/spacemit,k1-dwc3.yaml# > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.example.dtb: usb@c0a00000 (spacemit,k1-dwc3): usb@0:reg: [[0, 0], [0, 65536]] is too long > from schema $id: http://devicetree.org/schemas/usb/spacemit,k1-dwc3.yaml# > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.example.dtb: usb@0 (snps,dwc3): reg: [[0, 0], [0, 65536]] is too long > from schema $id: http://devicetree.org/schemas/usb/snps,dwc3.yaml# Thanks for the report! I’ll add '#address-cells' and '#size-cells' under properties to resolve the error. because if I drop them from the example, I get warnings like: Warning (avoid_default_addr_size): /example-0/usb@c0a00000/usb@0: Relying on default #address-cells value > > doc reference errors (make refcheckdocs): > > See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250407-b4-k1-usb3-v3-2-v1-3-bf0bcc41c9ba@whut.edu.cn > > The base for the series is generally the latest rc1. A different dependency > should be noted in *this* patch. > > If you already ran 'make dt_binding_check' and didn't see the above > error(s), then make sure 'yamllint' is installed and dt-schema is up to > date: > > pip3 install dtschema --upgrade > > Please check and re-submit after running the above command yourself. Note > that DT_SCHEMA_FILES can be set to your schema file to speed up checking > your schema. However, it must be unset to test all examples with your schema. > > >
On 4/7/25 9:28 PM, Krzysztof Kozlowski wrote: > On 07/04/2025 14:38, Ze Huang wrote: >> Add support for USB 3.0 mode on the K1 PCIe/USB3 combo PHY. Currently, >> only USB mode is supported; PCIe support is not included in this change. >> >> Signed-off-by: Ze Huang <huangze@whut.edu.cn> >> --- >> drivers/phy/spacemit/Kconfig | 8 ++ >> drivers/phy/spacemit/Makefile | 1 + >> drivers/phy/spacemit/phy-k1-combphy.c | 229 ++++++++++++++++++++++++++++++++++ >> 3 files changed, 238 insertions(+) >> >> diff --git a/drivers/phy/spacemit/Kconfig b/drivers/phy/spacemit/Kconfig >> index f0c2a33f53cc810e71c6140ae957aa68a2b6ff0c..12749aba756329cf64fb9199055ba484fe05f3ab 100644 >> --- a/drivers/phy/spacemit/Kconfig >> +++ b/drivers/phy/spacemit/Kconfig >> @@ -10,3 +10,11 @@ config PHY_SPACEMIT_K1_USB2 >> help >> Enable this to support K1 USB 2.0 PHY driver. This driver takes care of >> enabling and clock setup and will be used by K1 udc/ehci/otg driver. >> + >> +config PHY_SPACEMIT_K1_COMBPHY >> + tristate "SpacemiT K1 PCIe/USB3 combo PHY support" >> + depends on OF >> + select GENERIC_PHY >> + default ARCH_SPACEMIT && USB_DWC3_SPACEMIT >> + help >> + USB3/PCIe Combo PHY Support for SpacemiT K1 SoC > Missing depends on ARCH_SPACEMIT || COMPILE_TEST Will fix, thanks! > > ... > > >> + priv->phy = devm_phy_create(dev, NULL, &spacemit_combphy_ops); >> + if (IS_ERR(priv->phy)) >> + return dev_err_probe(dev, PTR_ERR(priv->phy), >> + "failed to create combphy\n"); >> + >> + dev_set_drvdata(dev, priv); >> + phy_set_drvdata(priv->phy, priv); > Both make no sense. Look what this function does. It does seem redundant at first glance, but pdev->dev is the parent of phy->dev. pdev->dev->driver_data will be used in spacemit_combphy_xlate() phy->dev->driver_data will be used in phy_ops functions I've checked some other drivers that did the same: - phy-zynqmp.c at lines 990 and 1026 - phy-rockchip-samsung-hdptx.c at lines 1989 and 2000 > > Best regards, > Krzysztof > >
On 09/04/2025 10:16, Ze Huang wrote: >> >>> + vbus-supply: >>> + description: A phandle to the regulator supplying the VBUS voltage. >>> + >>> +patternProperties: >>> + '^usb@': >>> + $ref: snps,dwc3.yaml# >> No, rather fold child into the parent. > > I’m not entirely sure I understand your suggestion. Could you please provide > an example? Thanks! Do not create glue node, but only one node for entire DWC. All new DWC USB bindings are supposed to follow this new approach. There are some examples in the tree and some on the lists. Best regards, Krzysztof
On 09/04/2025 11:43, Ze Huang wrote: >>> + priv->phy = devm_phy_create(dev, NULL, &spacemit_combphy_ops); >>> + if (IS_ERR(priv->phy)) >>> + return dev_err_probe(dev, PTR_ERR(priv->phy), >>> + "failed to create combphy\n"); >>> + >>> + dev_set_drvdata(dev, priv); >>> + phy_set_drvdata(priv->phy, priv); >> Both make no sense. Look what this function does. > > It does seem redundant at first glance, but pdev->dev is the parent of > phy->dev. > pdev->dev->driver_data will be used in spacemit_combphy_xlate() > phy->dev->driver_data will be used in phy_ops functions > > I've checked some other drivers that did the same: > - phy-zynqmp.c at lines 990 and 1026 > - phy-rockchip-samsung-hdptx.c at lines 1989 and 2000 Indeed, right. It's fine. Best regards, Krzysztof
Hi Ze,
> +static int spacemit_combphy_init_usb(struct spacemit_combphy_priv *priv)
The USB3 phy driver is updated in the vendor's tree.
https://gitee.com/bianbu-linux/linux-6.6/commit/1c0b3b4b9c77d22ca886c8a4c44e62b5891f8abc
You can submit v2 together with the change of lfps_thres (writes 0x58 register)
without adding new properties for dt node.
B.R.
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not an intended recipient of this message, please delete it and any attachment from your system and notify the sender immediately by reply e-mail. Unintended recipients should not use, copy, disclose or take any action based on this message or any information contained in this message. Emails cannot be guaranteed to be secure or error free as they can be intercepted, amended, lost or destroyed, and you should take full responsibility for security checking.
本邮件及其任何附件具有保密性质,并可能受其他保护或不允许被披露给第三方。如阁下误收到本邮件,敬请立即以回复电子邮件的方式通知发件人,并将本邮件及其任何附件从阁下系统中予以删除。如阁下并非本邮件写明之收件人,敬请切勿使用、复制、披露本邮件或其任何内容,亦请切勿依本邮件或其任何内容而采取任何行动。电子邮件无法保证是一种安全和不会出现任何差错的通信方式,可能会被拦截、修改、丢失或损坏,收件人需自行负责做好安全检查。
On 4/9/25 7:38 PM, Pan Junzhong wrote: > Hi Ze, > >> +static int spacemit_combphy_init_usb(struct spacemit_combphy_priv *priv) > The USB3 phy driver is updated in the vendor's tree. > https://gitee.com/bianbu-linux/linux-6.6/commit/1c0b3b4b9c77d22ca886c8a4c44e62b5891f8abc > > You can submit v2 together with the change of lfps_thres (writes 0x58 register) > without adding new properties for dt node. OK, thanks! > B.R. > > > This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not an intended recipient of this message, please delete it and any attachment from your system and notify the sender immediately by reply e-mail. Unintended recipients should not use, copy, disclose or take any action based on this message or any information contained in this message. Emails cannot be guaranteed to be secure or error free as they can be intercepted, amended, lost or destroyed, and you should take full responsibility for security checking. > > 本邮件及其任何附件具有保密性质,并可能受其他保护或不允许被披露给第三方。如阁下误收到本邮件,敬请立即以回复电子邮件的方式通知发件人,并将本邮件及其任何附件从阁下系统中予以删除。如阁下并非本邮件写明之收件人,敬请切勿使用、复制、披露本邮件或其任何内容,亦请切勿依本邮件或其任何内容而采取任何行动。电子邮件无法保证是一种安全和不会出现任何差错的通信方式,可能会被拦截、修改、丢失或损坏,收件人需自行负责做好安全检查。
On Mon, 07 Apr 2025 20:38:46 +0800, Ze Huang wrote: > Add support for USB2 PHY found on SpacemiT K1 SoC. > > Signed-off-by: Ze Huang <huangze@whut.edu.cn> > --- > .../devicetree/bindings/phy/spacemit,usb2-phy.yaml | 40 ++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > Reviewed-by: Rob Herring (Arm) <robh@kernel.org>