Hi Phil-san, > From: Phil Edworthy, Sent: Friday, August 5, 2022 10:10 PM > > Hi Geert, Yoshihiro, > > I'm a bit stuck with the usb3 drivers for RZ/V2M. > > The RZ/V2M USB3 is very similar to R-Car Gen3, the main difference being > where the DRD registers are located and additional clocks, interrupts > and resets exposed. The DRD registers are still part of the USBP address > space, though they have been moved above the other USBP regs. > > There is however, one big difference. On RZ/V2M, you can only access the > corresponding registers for whatever DRD mode has been set in the > DRD_CON register, PERI_CON bit. That is to say, when PERI_CON=1 (periph > mode), reading from a USBH register will cause an abort, and when > PERI_CON=0 (host mode), reading from a USBP register will cause an > abort. Thank you for asking me about this topic. I have a question: Can the DRD register be accessed from both PERI_CON=1 and 0? > This makes role switching rather difficult in Linux as the usb host hub > code does some work in a delayed work queue, after role switch. > > I am therefore advocating that users can only enable host or peripheral > in DT, and role switching is not allowed. Is that reasonable? > How can I ensure only one driver is enabled? > > This unfortunately opens up another problem... So that the USBH driver > can set the DRD mode, it needs access to the USBP address space. Could > that be just be additional reg entry in DT for this? > > I'm not sure how to go about this, any advice appreciated! If the DRD register can be accessed from both PERI_CON=1 and 0, I have an idea how to handle this. # However, I'm not sure whether this is a correct way or not though... My idea: - Make a new role switch driver on drivers/usb/roles/ or drivers/mfd/. - No describe any xHCI and USB3 UDC nodes in DT. - Describe whole USB3 registers for the role device in DT. (Or add sub nodes of xHCI and USB3 UDC into the role device.) - The role switch driver handles the DRD register at first. And then, the driver adds xHCI or USB3 UDC device somehow. Best regards, Yoshihiro Shimoda > Thanks > Phil