mbox series

[0/4] Add USB2 support for rk3568

Message ID 20210614154359.805555-1-benjamin.gaignard@collabora.com
Headers show
Series Add USB2 support for rk3568 | expand

Message

Benjamin Gaignard June 14, 2021, 3:43 p.m. UTC
The original pacth from Peter Geis is here:
https://gitlab.com/pine64-org/quartz-bsp/linux-next/-/commit/cda136f853628259198d6f70c3e14c9e5c8e097f

I have split the driver part of this patch in two:
 - one to update reg usage
 - one to add USB2 support for rk3568
I have added patches for the bindings:
 - some clean up
 - add compatible for rk3568

Benjamin

Benjamin Gaignard (4):
  dt-bindings: phy: rockchip: USB2: remove useless #phy-cells property
  dt-bindings: phy: rockchip: USB2: Add compatible for rk3568
  PHY: rockchip: USB2: Allow 64 bits reg property
  phy: rockchip: USB2: Add support for rk3568

 .../bindings/phy/phy-rockchip-inno-usb2.yaml  |  3 +-
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 85 +++++++++++++++++--
 2 files changed, 78 insertions(+), 10 deletions(-)

Comments

Robin Murphy June 14, 2021, 5:09 p.m. UTC | #1
On 2021-06-14 16:43, Benjamin Gaignard wrote:
> In rk356x device-tree "reg" property could be coded on 64 bits.
> Change reg type and of_property_read_ to make it works.

On platforms with #address-cells=1, this isn't going to do what you 
think. Worse, it's not even going to fail, because you *can* read a 
64-bit value from an address cell with a size cell after it...

Robin.

> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
> ---
>   drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 46ebdb1460a3d..45518f96d7217 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> @@ -1068,7 +1068,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
>   	struct rockchip_usb2phy *rphy;
>   	const struct rockchip_usb2phy_cfg *phy_cfgs;
>   	const struct of_device_id *match;
> -	unsigned int reg;
> +	u64 reg;
>   	int index, ret;
>   
>   	rphy = devm_kzalloc(dev, sizeof(*rphy), GFP_KERNEL);
> @@ -1098,7 +1098,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
>   		rphy->usbgrf = NULL;
>   	}
>   
> -	if (of_property_read_u32(np, "reg", &reg)) {
> +	if (of_property_read_u64(np, "reg", &reg)) {
>   		dev_err(dev, "the reg property is not assigned in %pOFn node\n",
>   			np);
>   		return -EINVAL;
>
Rob Herring (Arm) June 15, 2021, 2:04 p.m. UTC | #2
On Mon, 14 Jun 2021 17:43:56 +0200, Benjamin Gaignard wrote:
> '#phy-cells' property is needed in host-port and otg-port nodes but

> not in parent nodes. Remove it from the JSON schema.

> 

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>

> ---

>  .../devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml         | 2 --

>  1 file changed, 2 deletions(-)

> 


My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.example.dt.yaml: usb2-phy@e450: '#phy-cells' is a required property
	From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/phy/phy-provider.yaml
\ndoc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1491757

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
Rob Herring (Arm) June 15, 2021, 10:51 p.m. UTC | #3
On Mon, Jun 14, 2021 at 05:43:56PM +0200, Benjamin Gaignard wrote:
> '#phy-cells' property is needed in host-port and otg-port nodes but

> not in parent nodes. Remove it from the JSON schema.


Pretty sure there's already a fix for this.

> 

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>

> ---

>  .../devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml         | 2 --

>  1 file changed, 2 deletions(-)

> 

> diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml

> index fb29ad807b68f..b14387a48f6a3 100644

> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml

> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml

> @@ -119,7 +119,6 @@ required:

>    - reg

>    - clock-output-names

>    - "#clock-cells"

> -  - "#phy-cells"

>    - host-port

>    - otg-port

>  

> @@ -137,7 +136,6 @@ examples:

>        clock-names = "phyclk";

>        clock-output-names = "clk_usbphy0_480m";

>        #clock-cells = <0>;

> -      #phy-cells = <0>;

>  

>        u2phy0_host: host-port {

>          #phy-cells = <0>;

> -- 

> 2.25.1