Hi Chris-san, > From: Chris Brandt, Sent: Thursday, November 15, 2018 9:34 PM > > Hi Shimodaさん > > > From: Yoshihiro Shimoda > > Sent: Thursday, November 15, 2018 4:20 AM > > > > Host does NOT work: > > > //else > > > // /* No otg, so default to host mode */ > > > // writel(0x00000000, usb2_base + USB2_COMMCTRL); > > > > I got it. However, I have a concern how to set the mode to peripheral on > > RZ/A2 > > if we applied this code. If someone would like to use the USB as > > peripheral > > on his board, this code is not suitable. > > But USB peripheral is a different driver. So, this code will not run. So > USB2_COMMCTRL will keep the default value 0x80000000. > > Correct? Ah, this is you're correct. R-Car Gen3 code (drivers/usb/renesas_usbhs/rcar3.c) doesn't have phy control for now. > > So, I have an idea to set the default mode by using "dr_mode" property, > > instead of hardcoded. Since the driver already has such a function, > > we can reuse rcar_gen3_device_recognition() to set the default value. > > To achieve that, we need to modify the following though. > > - Don't enable "is_otg_channel". > > - Don't call rcar_gen3_enable_vbus_ctrl() to avoid ADPCTRL register > > because RZ/A2 doesn't have it. > > - Don't need to call rcar_gen3_set_linectrl to avoid LINECTRL1 register > > because RZ/A2 doesn't seem to need the setting on host mode. > > > > What do you think? > > If a board is designed for USB peripheral, why would they enable a EHCI > host driver for the same USB channel? > I am confused. I meant that USB peripheral of RZ/A2 need the phy driver, not a EHCI host driver. And I read Figure 32.1 of the RZ/A2 documentation and I wonder if we need to release USBCTR.PLL_RST even if we use USB peripheral mode. # Since the documentations doesn't mention the PHY area exactly, it's confusable for us though. # But, the phy driver assumed the driver handled "AHB Bridge", "Core" and "UCOM" registers. > > > > (In other words, if we use the port as peripheral with the reset value > > > > 0x80000000, does it work?) > > > > > > We have not been able to get USB peripheral working on RZ/A2 yet. > > > For peripheral, RZ/A2 has HS-USB. > > > After plugging into the PC, HS-USB goes to Suspended state (DVSQ = > > "0110"). > > > It should go to Configured state (DVSQ = "0011") > > > > I guess we need to modify ./drivers/usb/renesas_usbhs/rza.c for RZ/A2 > > because RZ/A2's HS-USB has SYSCFG.CNEN, but doesn't have SYSCFG.UPLLE? > > Today for RZ/A1, we tell people to use USB0 first in their board design, > then use USB1 if they need a second USB channel. USB pins are dedicated > (no other function) so there should be no design conflicts. > > If only USB1 is used, USB0 must also be enabled in DT as a dummy driver > (so SYSCFG.UPLLE can get set for USB1). Oh, I heard RZ/G1C also has such a hardware register [1]. [1] https://patchwork.kernel.org/patch/10655855/ RZ/G1C channel 0 only has UGCTRL register, but need to set for channel 1. Best regards, Yoshihiro Shimoda > > > According to the RZ/A2 Hardware Manual, COMMCTRL should be 0x80000000 > > when > > > using HS-USB. > > > > > > There are 2 channels of USB on RZ/A2 (host x 2, HS_USB x 2) > > > > I got it. So, I guess someone wants to use 1 host and 1 peripheral :) > > Yes. > > Chris