diff mbox series

[v2,04/10] phy: sun4i-usb: add support for the USB PHY on F1C100s SoC

Message ID 20221012055602.1544944-5-uwu@icenowy.me (mailing list archive)
State Not Applicable
Headers show
Series SUNIV USB and PopStick support (and updating mailmap) | expand

Commit Message

Icenowy Zheng Oct. 12, 2022, 5:55 a.m. UTC
The F1C100s SoC has one USB OTG port connected to a MUSB controller.

Add support for its USB PHY.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
No changes since v1.

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

Comments

Jernej Škrabec Oct. 12, 2022, 9:21 p.m. UTC | #1
Hi Icenowy,

Dne sreda, 12. oktober 2022 ob 07:55:56 CEST je Icenowy Zheng napisal(a):
> The F1C100s SoC has one USB OTG port connected to a MUSB controller.
> 
> Add support for its USB PHY.
> 
> Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> ---
> No changes since v1.
> 
>  drivers/phy/allwinner/phy-sun4i-usb.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
> b/drivers/phy/allwinner/phy-sun4i-usb.c index 3a3831f6059a..2f94cb77637b
> 100644
> --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> @@ -109,6 +109,7 @@ enum sun4i_usb_phy_type {
>  	sun8i_v3s_phy,
>  	sun50i_a64_phy,
>  	sun50i_h6_phy,
> +	suniv_f1c100s_phy,
>  };
> 
>  struct sun4i_usb_phy_cfg {
> @@ -859,6 +860,14 @@ static int sun4i_usb_phy_probe(struct platform_device
> *pdev) return 0;
>  }
> 
> +static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
> +	.num_phys = 1,
> +	.type = suniv_f1c100s_phy,

I think you should just use sun4i_a10_phy. It has no special handling. I don't 
see a point adding new phy types if there is no special cases for it.

Best regards,
Jernej

> +	.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,
> @@ -988,6 +997,8 @@ static const struct of_device_id
> sun4i_usb_phy_of_match[] = { { .compatible =
> "allwinner,sun50i-a64-usb-phy",
>  	  .data = &sun50i_a64_cfg},
>  	{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = 
&sun50i_h6_cfg },
> +	{ .compatible = "allwinner,suniv-f1c100s-usb-phy",
> +	  .data = &suniv_f1c100s_cfg },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
> --
> 2.37.1
Icenowy Zheng Oct. 13, 2022, 8:49 a.m. UTC | #2
在 2022-10-12星期三的 23:21 +0200,Jernej Škrabec写道:
> Hi Icenowy,
> 
> Dne sreda, 12. oktober 2022 ob 07:55:56 CEST je Icenowy Zheng
> napisal(a):
> > The F1C100s SoC has one USB OTG port connected to a MUSB
> > controller.
> > 
> > Add support for its USB PHY.
> > 
> > Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> > ---
> > No changes since v1.
> > 
> >  drivers/phy/allwinner/phy-sun4i-usb.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
> > b/drivers/phy/allwinner/phy-sun4i-usb.c index
> > 3a3831f6059a..2f94cb77637b
> > 100644
> > --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> > @@ -109,6 +109,7 @@ enum sun4i_usb_phy_type {
> >         sun8i_v3s_phy,
> >         sun50i_a64_phy,
> >         sun50i_h6_phy,
> > +       suniv_f1c100s_phy,
> >  };
> > 
> >  struct sun4i_usb_phy_cfg {
> > @@ -859,6 +860,14 @@ static int sun4i_usb_phy_probe(struct
> > platform_device
> > *pdev) return 0;
> >  }
> > 
> > +static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
> > +       .num_phys = 1,
> > +       .type = suniv_f1c100s_phy,
> 
> I think you should just use sun4i_a10_phy. It has no special
> handling. I don't 
> see a point adding new phy types if there is no special cases for it.

Sounds reasonable, although I think we should finally drop .type and
use only describing items.

> 
> Best regards,
> Jernej
> 
> > +       .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,
> > @@ -988,6 +997,8 @@ static const struct of_device_id
> > sun4i_usb_phy_of_match[] = { { .compatible =
> > "allwinner,sun50i-a64-usb-phy",
> >           .data = &sun50i_a64_cfg},
> >         { .compatible = "allwinner,sun50i-h6-usb-phy", .data = 
> &sun50i_h6_cfg },
> > +       { .compatible = "allwinner,suniv-f1c100s-usb-phy",
> > +         .data = &suniv_f1c100s_cfg },
> >         { },
> >  };
> >  MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
> > --
> > 2.37.1
> 
> 
>
Jernej Škrabec Oct. 13, 2022, 6:25 p.m. UTC | #3
Dne četrtek, 13. oktober 2022 ob 10:49:51 CEST je Icenowy Zheng napisal(a):
> 在 2022-10-12星期三的 23:21 +0200,Jernej Škrabec写道:
> 
> > Hi Icenowy,
> > 
> > Dne sreda, 12. oktober 2022 ob 07:55:56 CEST je Icenowy Zheng
> > 
> > napisal(a):
> > > The F1C100s SoC has one USB OTG port connected to a MUSB
> > > controller.
> > > 
> > > Add support for its USB PHY.
> > > 
> > > Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> > > ---
> > > No changes since v1.
> > > 
> > >  drivers/phy/allwinner/phy-sun4i-usb.c | 11 +++++++++++
> > >  1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
> > > b/drivers/phy/allwinner/phy-sun4i-usb.c index
> > > 3a3831f6059a..2f94cb77637b
> > > 100644
> > > --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> > > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> > > @@ -109,6 +109,7 @@ enum sun4i_usb_phy_type {
> > >         sun8i_v3s_phy,
> > >         sun50i_a64_phy,
> > >         sun50i_h6_phy,
> > > +       suniv_f1c100s_phy,
> > >  };
> > > 
> > >  struct sun4i_usb_phy_cfg {
> > > @@ -859,6 +860,14 @@ static int sun4i_usb_phy_probe(struct
> > > platform_device
> > > *pdev) return 0;
> > >  }
> > > 
> > > +static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
> > > +       .num_phys = 1,
> > > +       .type = suniv_f1c100s_phy,
> > 
> > I think you should just use sun4i_a10_phy. It has no special
> > handling. I don't
> > see a point adding new phy types if there is no special cases for it.
> 
> Sounds reasonable, although I think we should finally drop .type and
> use only describing items.

That would be even better. Will you do it?

> 
> > Best regards,
> > Jernej
> > 
> > > +       .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,
> > > @@ -988,6 +997,8 @@ static const struct of_device_id
> > > sun4i_usb_phy_of_match[] = { { .compatible =
> > > "allwinner,sun50i-a64-usb-phy",
> > >           .data = &sun50i_a64_cfg},
> > >         { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
> > 
> > &sun50i_h6_cfg },
> > 
> > > +       { .compatible = "allwinner,suniv-f1c100s-usb-phy",
> > > +         .data = &suniv_f1c100s_cfg },
> > >         { },
> > >  };
> > >  MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
> > > --
> > > 2.37.1
Icenowy Zheng Oct. 14, 2022, 2:56 a.m. UTC | #4
在 2022-10-13星期四的 20:25 +0200,Jernej Škrabec写道:
> Dne četrtek, 13. oktober 2022 ob 10:49:51 CEST je Icenowy Zheng
> napisal(a):
> > 在 2022-10-12星期三的 23:21 +0200,Jernej Škrabec写道:
> > 
> > > Hi Icenowy,
> > > 
> > > Dne sreda, 12. oktober 2022 ob 07:55:56 CEST je Icenowy Zheng
> > > 
> > > napisal(a):
> > > > The F1C100s SoC has one USB OTG port connected to a MUSB
> > > > controller.
> > > > 
> > > > Add support for its USB PHY.
> > > > 
> > > > Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> > > > ---
> > > > No changes since v1.
> > > > 
> > > >  drivers/phy/allwinner/phy-sun4i-usb.c | 11 +++++++++++
> > > >  1 file changed, 11 insertions(+)
> > > > 
> > > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c
> > > > b/drivers/phy/allwinner/phy-sun4i-usb.c index
> > > > 3a3831f6059a..2f94cb77637b
> > > > 100644
> > > > --- a/drivers/phy/allwinner/phy-sun4i-usb.c
> > > > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c
> > > > @@ -109,6 +109,7 @@ enum sun4i_usb_phy_type {
> > > >         sun8i_v3s_phy,
> > > >         sun50i_a64_phy,
> > > >         sun50i_h6_phy,
> > > > +       suniv_f1c100s_phy,
> > > >  };
> > > > 
> > > >  struct sun4i_usb_phy_cfg {
> > > > @@ -859,6 +860,14 @@ static int sun4i_usb_phy_probe(struct
> > > > platform_device
> > > > *pdev) return 0;
> > > >  }
> > > > 
> > > > +static const struct sun4i_usb_phy_cfg suniv_f1c100s_cfg = {
> > > > +       .num_phys = 1,
> > > > +       .type = suniv_f1c100s_phy,
> > > 
> > > I think you should just use sun4i_a10_phy. It has no special
> > > handling. I don't
> > > see a point adding new phy types if there is no special cases for
> > > it.
> > 
> > Sounds reasonable, although I think we should finally drop .type
> > and
> > use only describing items.
> 
> That would be even better. Will you do it?

At least not now.

But I will at least drop suniv_f1c100s_phy in the next revision.

> 
> > 
> > > Best regards,
> > > Jernej
> > > 
> > > > +       .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,
> > > > @@ -988,6 +997,8 @@ static const struct of_device_id
> > > > sun4i_usb_phy_of_match[] = { { .compatible =
> > > > "allwinner,sun50i-a64-usb-phy",
> > > >           .data = &sun50i_a64_cfg},
> > > >         { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
> > > 
> > > &sun50i_h6_cfg },
> > > 
> > > > +       { .compatible = "allwinner,suniv-f1c100s-usb-phy",
> > > > +         .data = &suniv_f1c100s_cfg },
> > > >         { },
> > > >  };
> > > >  MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);
> > > > --
> > > > 2.37.1
> 
>
diff mbox series

Patch

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 3a3831f6059a..2f94cb77637b 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -109,6 +109,7 @@  enum sun4i_usb_phy_type {
 	sun8i_v3s_phy,
 	sun50i_a64_phy,
 	sun50i_h6_phy,
+	suniv_f1c100s_phy,
 };
 
 struct sun4i_usb_phy_cfg {
@@ -859,6 +860,14 @@  static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	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,
@@ -988,6 +997,8 @@  static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun50i-a64-usb-phy",
 	  .data = &sun50i_a64_cfg},
 	{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
+	{ .compatible = "allwinner,suniv-f1c100s-usb-phy",
+	  .data = &suniv_f1c100s_cfg },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match);