Hi Michael,

    I have send a similar patch to fix this issue weeks ago, and ready to merge.


Thanks,

- Kever

On 2019/11/14 上午12:07, Michael Trimarchi wrote:
rk3288 needs phy registration in order to work or the board
just hang

Signed-off-by: Michael Trimarchi <[email protected]>
---
  arch/arm/mach-rockchip/board.c         | 12 ++++++++
  arch/arm/mach-rockchip/rk3288/rk3288.c | 39 ++++++++++++++++++++++++++
  2 files changed, 51 insertions(+)

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 8ca3463731..37ae37ff34 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -59,6 +59,12 @@ static struct dwc2_plat_otg_data otg_data = {
        .tx_fifo_sz     = 128,
  };
+
+__weak int board_usb_phy_init(int node, struct dwc2_plat_otg_data *otg_data)
+{
+       return 0;
+}
+
  int board_usb_init(int index, enum usb_init_type init)
  {
        int node;
@@ -84,6 +90,12 @@ int board_usb_init(int index, enum usb_init_type init)
        }
        otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
+ node = board_usb_phy_init(node, &otg_data);
+       if (node < 0) {
+               debug("Not found usb_otg phy\n");
+               return -ENODEV;
+       }
+
        return dwc2_udc_probe(&otg_data);
  }
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index 002d1508e5..6d93214e7c 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -184,6 +184,45 @@ static void rk3288_detect_reset_reason(void)
        rk_clrreg(&cru->cru_glb_rst_st, GLB_RST_ST_MASK);
  }
+#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
+#include <usb.h>
+#include <usb/dwc2_udc.h>
+
+int board_usb_phy_init(int node, struct dwc2_plat_otg_data *otg_data)
+{
+       int phy_node;
+       const void *blob = gd->fdt_blob;
+       u32 grf_phy_offset;
+
+       node = fdtdec_lookup_phandle(blob, node, "phys");
+       if (node <= 0) {
+               debug("Not found usb phy device\n");
+               return -ENODEV;
+       }
+
+       phy_node = fdt_parent_offset(blob, node);
+       if (phy_node <= 0) {
+               debug("Not found usb phy device\n");
+               return -ENODEV;
+       }
+
+       otg_data->phy_of_node = phy_node;
+       grf_phy_offset = fdtdec_get_addr(blob, node, "reg");
+
+       /* find the grf node */
+       node = fdt_node_offset_by_compatible(blob, -1, "rockchip,rk3288-grf");
+       if (node <= 0) {
+               debug("Not found grf device\n");
+               return -ENODEV;
+       }
+       otg_data->regs_phy = grf_phy_offset +
+                               fdtdec_get_addr(blob, node, "reg");
+
+       return 0;
+}
+
+#endif
+
  __weak int rk3288_board_late_init(void)
  {
        return 0;


_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to