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

路辉 luhux76 at gmail.com
Fri Jun 9 16:11:07 CEST 2023


>From 09a85536f92cfd22f2a6feba8ea91fae4bc41ed8 Mon Sep 17 00:00:00 2001
From: Lu Hui <luhux76 at gmail.com>
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 <jagan at amarulasolutions.com>
  * Copyright (C) 2015 Hans de Goede <hdegoede at redhat.com>
  * Copyright (C) 2014 Roman Byshko <rbyshko at gmail.com>
+ * Copyright (C) 2023 Lu Hui <luhux76 at gmail.com>
  *
  * 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)&sun20i_d1_cfg },
     { .compatible = "allwinner,sun50i-a64-usb-phy", .data =
(ulong)&sun50i_a64_cfg},
     { .compatible = "allwinner,sun50i-h6-usb-phy", .data =
(ulong)&sun50i_h6_cfg},
+    { .compatible = "allwinner,suniv-f1c100s-usb-phy", .data =
(ulong)&suniv_f1c100s_cfg},
     { }
 };

-- 
2.40.1


More information about the U-Boot mailing list