1111#include <linux/platform_device.h>
1212#include <linux/of.h>
1313#include <linux/usb/phy.h>
14+ #include <linux/reset.h>
1415
1516#include "xhci.h"
1617#include "xhci-plat.h"
1718#include "xhci-rcar-regs.h"
19+ #include "xhci-rzg3e-regs.h"
1820#include "xhci-rzv2m.h"
1921
2022#define XHCI_RCAR_FIRMWARE_NAME_V1 "r8a779x_usb3_v1.dlmem"
@@ -67,6 +69,48 @@ static void xhci_rcar_start(struct usb_hcd *hcd)
6769 }
6870}
6971
72+ static void xhci_rzg3e_start (struct usb_hcd * hcd )
73+ {
74+ u32 int_en ;
75+
76+ if (hcd -> regs ) {
77+ /* Update the controller initial setting */
78+ writel (0x03130200 , hcd -> regs + RZG3E_USB3_HOST_U3P0PIPESC (0 ));
79+ writel (0x00160200 , hcd -> regs + RZG3E_USB3_HOST_U3P0PIPESC (1 ));
80+ writel (0x03150000 , hcd -> regs + RZG3E_USB3_HOST_U3P0PIPESC (2 ));
81+ writel (0x03130200 , hcd -> regs + RZG3E_USB3_HOST_U3P0PIPESC (3 ));
82+ writel (0x00180000 , hcd -> regs + RZG3E_USB3_HOST_U3P0PIPESC (4 ));
83+
84+ /* Interrupt Enable */
85+ int_en = readl (hcd -> regs + RZG3E_USB3_HOST_INTEN );
86+ int_en |= RZG3E_USB3_HOST_INTEN_ENA ;
87+ writel (int_en , hcd -> regs + RZG3E_USB3_HOST_INTEN );
88+ }
89+ }
90+
91+ static int xhci_rzg3e_resume (struct usb_hcd * hcd )
92+ {
93+ struct xhci_hcd * xhci = hcd_to_xhci (hcd );
94+
95+ return reset_control_deassert (xhci -> reset );
96+ }
97+
98+ static int xhci_rzg3e_post_resume (struct usb_hcd * hcd )
99+ {
100+ xhci_rzg3e_start (hcd );
101+
102+ return 0 ;
103+ }
104+
105+ static int xhci_rzg3e_suspend (struct usb_hcd * hcd )
106+ {
107+ struct xhci_hcd * xhci = hcd_to_xhci (hcd );
108+
109+ reset_control_assert (xhci -> reset );
110+
111+ return 0 ;
112+ }
113+
70114static int xhci_rcar_download_firmware (struct usb_hcd * hcd )
71115{
72116 struct device * dev = hcd -> self .controller ;
@@ -190,6 +234,14 @@ static const struct xhci_plat_priv xhci_plat_renesas_rzv2m = {
190234 .plat_start = xhci_rzv2m_start ,
191235};
192236
237+ static const struct xhci_plat_priv xhci_plat_renesas_rzg3e = {
238+ .quirks = XHCI_NO_64BIT_SUPPORT | XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS ,
239+ .plat_start = xhci_rzg3e_start ,
240+ .suspend_quirk = xhci_rzg3e_suspend ,
241+ .resume_quirk = xhci_rzg3e_resume ,
242+ .post_resume_quirk = xhci_rzg3e_post_resume ,
243+ };
244+
193245static const struct of_device_id usb_xhci_of_match [] = {
194246 {
195247 .compatible = "renesas,xhci-r8a7790" ,
@@ -206,6 +258,9 @@ static const struct of_device_id usb_xhci_of_match[] = {
206258 }, {
207259 .compatible = "renesas,xhci-r8a7796" ,
208260 .data = & xhci_plat_renesas_rcar_gen3 ,
261+ }, {
262+ .compatible = "renesas,r9a09g047-xhci" ,
263+ .data = & xhci_plat_renesas_rzg3e ,
209264 }, {
210265 .compatible = "renesas,rcar-gen2-xhci" ,
211266 .data = & xhci_plat_renesas_rcar_gen2 ,
0 commit comments