Re: [PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

2023-06-09 Thread Andre Przywara
On Fri, 9 Jun 2023 14:11:07 +
路辉  wrote:

Hi,

> From 09a85536f92cfd22f2a6feba8ea91fae4bc41ed8 Mon Sep 17 00:00:00 2001
> From: Lu Hui 
> Date: Fri, 9 Jun 2023 22:04:56 +0800
> Subject: [PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

I sent a similar patch literally just a few hours ago:
https://lore.kernel.org/u-boot/20230609105621.1410483-1-andre.przyw...@arm.com/T/

Can you please check whether this works for you as well? My series
missed the final MUSB enablement (because I wanted to test host mode
first), but at least the PHY part should work. 

In the future, please add a commit message, describing your patch, and
also your Signed-off-by: line, otherwise the patch cannot be merged.

Cheers,
Andre


> 
> ---
>  drivers/phy/allwinner/phy-sun4i-usb.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
> b/drivers/phy/allwinner/phy-sun4i-usb.c
> index 6428163c18..8425a83c84 100644
> --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> @@ -4,6 +4,7 @@
>   * Copyright (C) 2017 Jagan Teki 
>   * Copyright (C) 2015 Hans de Goede 
>   * Copyright (C) 2014 Roman Byshko 
> + * Copyright (C) 2023 Lu Hui 
>   *
>   * Modelled arch/arm/mach-sunxi/usb_phy.c to compatible with generic-phy.
>   *
> @@ -83,6 +84,7 @@ enum sun4i_usb_phy_type {
>  sun8i_v3s_phy,
>  sun50i_a64_phy,
>  sun50i_h6_phy,
> +suniv_f1c100s_phy,
>  };
> 
>  struct sun4i_usb_phy_cfg {
> @@ -372,8 +374,9 @@ static int sun4i_usb_phy_xlate(struct phy *phy,
>  {
>  struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);
> 
> -if (args->args_count >= data->cfg->num_phys)
> +if (args->args_count > data->cfg->num_phys) {
>  return -EINVAL;
> +}
> 
>  if (data->cfg->missing_phys & BIT(args->args[0]))
>  return -ENODEV;
> @@ -531,6 +534,14 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
>  return 0;
>  }
> 
> +static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
> +.num_phys = 1,
> +.type = suniv_f1c100s_phy,
> +.disc_thresh = 3,
> +.phyctl_offset = REG_PHYCTL_A10,
> +.dedicated_clocks = true,
> +};
> +
>  static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
>  .num_phys = 3,
>  .type = sun4i_a10_phy,
> @@ -659,6 +670,7 @@ static const struct udevice_id sun4i_usb_phy_ids[] = {
>  { .compatible = "allwinner,sun20i-d1-usb-phy", .data =
> (ulong)_d1_cfg },
>  { .compatible = "allwinner,sun50i-a64-usb-phy", .data =
> (ulong)_a64_cfg},
>  { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
> (ulong)_h6_cfg},
> +{ .compatible = "allwinner,suniv-f1c100s-usb-phy", .data =
> (ulong)_f1c100s_cfg},
>  { }
>  };
> 



[PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

2023-06-09 Thread 路辉
>From 09a85536f92cfd22f2a6feba8ea91fae4bc41ed8 Mon Sep 17 00:00:00 2001
From: Lu Hui 
Date: Fri, 9 Jun 2023 22:04:56 +0800
Subject: [PATCH 1/3] phy: phy-sun4i-usb: add allwinner f1c100s configuration

---
 drivers/phy/allwinner/phy-sun4i-usb.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
b/drivers/phy/allwinner/phy-sun4i-usb.c
index 6428163c18..8425a83c84 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2017 Jagan Teki 
  * Copyright (C) 2015 Hans de Goede 
  * Copyright (C) 2014 Roman Byshko 
+ * Copyright (C) 2023 Lu Hui 
  *
  * Modelled arch/arm/mach-sunxi/usb_phy.c to compatible with generic-phy.
  *
@@ -83,6 +84,7 @@ enum sun4i_usb_phy_type {
 sun8i_v3s_phy,
 sun50i_a64_phy,
 sun50i_h6_phy,
+suniv_f1c100s_phy,
 };

 struct sun4i_usb_phy_cfg {
@@ -372,8 +374,9 @@ static int sun4i_usb_phy_xlate(struct phy *phy,
 {
 struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev);

-if (args->args_count >= data->cfg->num_phys)
+if (args->args_count > data->cfg->num_phys) {
 return -EINVAL;
+}

 if (data->cfg->missing_phys & BIT(args->args[0]))
 return -ENODEV;
@@ -531,6 +534,14 @@ static int sun4i_usb_phy_probe(struct udevice *dev)
 return 0;
 }

+static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
+.num_phys = 1,
+.type = suniv_f1c100s_phy,
+.disc_thresh = 3,
+.phyctl_offset = REG_PHYCTL_A10,
+.dedicated_clocks = true,
+};
+
 static const struct sun4i_usb_phy_cfg sun4i_a10_cfg = {
 .num_phys = 3,
 .type = sun4i_a10_phy,
@@ -659,6 +670,7 @@ static const struct udevice_id sun4i_usb_phy_ids[] = {
 { .compatible = "allwinner,sun20i-d1-usb-phy", .data =
(ulong)_d1_cfg },
 { .compatible = "allwinner,sun50i-a64-usb-phy", .data =
(ulong)_a64_cfg},
 { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
(ulong)_h6_cfg},
+{ .compatible = "allwinner,suniv-f1c100s-usb-phy", .data =
(ulong)_f1c100s_cfg},
 { }
 };

-- 
2.40.1