28
28
#define USB2_INT_ENABLE 0x000
29
29
#define USB2_AHB_BUS_CTR 0x008
30
30
#define USB2_USBCTR 0x00c
31
+ #define USB2_REGEN_CG_CTRL 0x104 /* RZ/V2H(P) only */
31
32
#define USB2_SPD_RSM_TIMSET 0x10c
32
33
#define USB2_OC_TIMSET 0x110
34
+ #define USB2_UTMI_CTRL 0x118 /* RZ/V2H(P) only */
33
35
#define USB2_COMMCTRL 0x600
34
36
#define USB2_OBINTSTA 0x604
35
37
#define USB2_OBINTEN 0x608
50
52
#define USB2_USBCTR_DIRPD BIT(2)
51
53
#define USB2_USBCTR_PLL_RST BIT(1)
52
54
55
+ /* REGEN_CG_CTRL*/
56
+ #define USB2_REGEN_CG_CTRL_UPHY_WEN BIT(0)
57
+
53
58
/* SPD_RSM_TIMSET */
54
59
#define USB2_SPD_RSM_TIMSET_INIT 0x014e029b
55
60
56
61
/* OC_TIMSET */
57
62
#define USB2_OC_TIMSET_INIT 0x000209ab
58
63
64
+ /* UTMI_CTRL */
65
+ #define USB2_UTMI_CTRL_INIT 0x8000018f
66
+
59
67
/* COMMCTRL */
60
68
#define USB2_COMMCTRL_OTG_PERI BIT(31) /* 1 = Peripheral mode */
61
69
@@ -127,12 +135,14 @@ struct rcar_gen3_chan {
127
135
bool is_otg_channel ;
128
136
bool uses_otg_pins ;
129
137
bool soc_no_adp_ctrl ;
138
+ bool utmi_ctrl ;
130
139
};
131
140
132
141
struct rcar_gen3_phy_drv_data {
133
142
const struct phy_ops * phy_usb2_ops ;
134
143
bool no_adp_ctrl ;
135
144
bool init_bus ;
145
+ bool utmi_ctrl ;
136
146
};
137
147
138
148
/*
@@ -472,6 +482,14 @@ static int rcar_gen3_phy_usb2_init(struct phy *p)
472
482
rphy -> otg_initialized = true;
473
483
}
474
484
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
+
475
493
rphy -> initialized = true;
476
494
477
495
return 0 ;
@@ -589,6 +607,12 @@ static const struct rcar_gen3_phy_drv_data rz_g3s_phy_usb2_data = {
589
607
.init_bus = true,
590
608
};
591
609
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
+
592
616
static const struct of_device_id rcar_gen3_phy_usb2_match_table [] = {
593
617
{
594
618
.compatible = "renesas,usb2-phy-r8a77470" ,
@@ -610,6 +634,10 @@ static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
610
634
.compatible = "renesas,usb2-phy-r9a08g045" ,
611
635
.data = & rz_g3s_phy_usb2_data ,
612
636
},
637
+ {
638
+ .compatible = "renesas,usb2-phy-r9a09g057" ,
639
+ .data = & rz_v2h_phy_usb2_data ,
640
+ },
613
641
{
614
642
.compatible = "renesas,rzg2l-usb2-phy" ,
615
643
.data = & rz_g2l_phy_usb2_data ,
@@ -763,6 +791,8 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
763
791
if (phy_data -> no_adp_ctrl )
764
792
channel -> obint_enable_bits = USB2_OBINT_IDCHG_EN ;
765
793
794
+ channel -> utmi_ctrl = phy_data -> utmi_ctrl ;
795
+
766
796
mutex_init (& channel -> lock );
767
797
for (i = 0 ; i < NUM_OF_PHYS ; i ++ ) {
768
798
channel -> rphys [i ].phy = devm_phy_create (dev , NULL ,
0 commit comments