2828#define USB2_INT_ENABLE 0x000
2929#define USB2_AHB_BUS_CTR 0x008
3030#define USB2_USBCTR 0x00c
31+ #define USB2_REGEN_CG_CTRL 0x104 /* RZ/V2H(P) only */
3132#define USB2_SPD_RSM_TIMSET 0x10c
3233#define USB2_OC_TIMSET 0x110
34+ #define USB2_UTMI_CTRL 0x118 /* RZ/V2H(P) only */
3335#define USB2_COMMCTRL 0x600
3436#define USB2_OBINTSTA 0x604
3537#define USB2_OBINTEN 0x608
5052#define USB2_USBCTR_DIRPD BIT(2)
5153#define USB2_USBCTR_PLL_RST BIT(1)
5254
55+ /* REGEN_CG_CTRL*/
56+ #define USB2_REGEN_CG_CTRL_UPHY_WEN BIT(0)
57+
5358/* SPD_RSM_TIMSET */
5459#define USB2_SPD_RSM_TIMSET_INIT 0x014e029b
5560
5661/* OC_TIMSET */
5762#define USB2_OC_TIMSET_INIT 0x000209ab
5863
64+ /* UTMI_CTRL */
65+ #define USB2_UTMI_CTRL_INIT 0x8000018f
66+
5967/* COMMCTRL */
6068#define USB2_COMMCTRL_OTG_PERI BIT(31) /* 1 = Peripheral mode */
6169
@@ -127,12 +135,14 @@ struct rcar_gen3_chan {
127135 bool is_otg_channel ;
128136 bool uses_otg_pins ;
129137 bool soc_no_adp_ctrl ;
138+ bool utmi_ctrl ;
130139};
131140
132141struct rcar_gen3_phy_drv_data {
133142 const struct phy_ops * phy_usb2_ops ;
134143 bool no_adp_ctrl ;
135144 bool init_bus ;
145+ bool utmi_ctrl ;
136146};
137147
138148/*
@@ -472,6 +482,14 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
472482 rphy -> otg_initialized = true;
473483 }
474484
485+ if (channel -> utmi_ctrl ) {
486+ val = readl (usb2_base + USB2_REGEN_CG_CTRL ) | USB2_REGEN_CG_CTRL_UPHY_WEN ;
487+ writel (val , usb2_base + USB2_REGEN_CG_CTRL );
488+
489+ writel (USB2_UTMI_CTRL_INIT , usb2_base + USB2_UTMI_CTRL );
490+ writel (val & ~USB2_REGEN_CG_CTRL_UPHY_WEN , usb2_base + USB2_REGEN_CG_CTRL );
491+ }
492+
475493 rphy -> initialized = true;
476494
477495 return 0 ;
@@ -589,6 +607,12 @@ static const struct rcar_gen3_phy_drv_data rz_g3s_phy_usb2_data = {
589607 .init_bus = true,
590608};
591609
610+ static const struct rcar_gen3_phy_drv_data rz_v2h_phy_usb2_data = {
611+ .phy_usb2_ops = & rcar_gen3_phy_usb2_ops ,
612+ .no_adp_ctrl = true,
613+ .utmi_ctrl = true,
614+ };
615+
592616static const struct of_device_id rcar_gen3_phy_usb2_match_table [] = {
593617 {
594618 .compatible = "renesas,usb2-phy-r8a77470" ,
@@ -610,6 +634,10 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
610634 .compatible = "renesas,usb2-phy-r9a08g045" ,
611635 .data = & rz_g3s_phy_usb2_data ,
612636 },
637+ {
638+ .compatible = "renesas,usb2-phy-r9a09g057" ,
639+ .data = & rz_v2h_phy_usb2_data ,
640+ },
613641 {
614642 .compatible = "renesas,rzg2l-usb2-phy" ,
615643 .data = & rz_g2l_phy_usb2_data ,
@@ -763,6 +791,8 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
763791 if (phy_data -> no_adp_ctrl )
764792 channel -> obint_enable_bits = USB2_OBINT_IDCHG_EN ;
765793
794+ channel -> utmi_ctrl = phy_data -> utmi_ctrl ;
795+
766796 mutex_init (& channel -> lock );
767797 for (i = 0 ; i < NUM_OF_PHYS ; i ++ ) {
768798 channel -> rphys [i ].phy = devm_phy_create (dev , NULL ,
0 commit comments