Skip to content

Add SUSPEND/RESUME handling for Renesas RX family.#949

Merged
hathach merged 2 commits into
hathach:masterfrom
kkitayam:add_suspend_and_resume_for_rx_family
Jul 5, 2021
Merged

Add SUSPEND/RESUME handling for Renesas RX family.#949
hathach merged 2 commits into
hathach:masterfrom
kkitayam:add_suspend_and_resume_for_rx_family

Conversation

@kkitayam
Copy link
Copy Markdown
Collaborator

@kkitayam kkitayam commented Jul 3, 2021

Describe the PR
Add SUSPEND/RESUME handling for Renesas RX family.

Additional context
I have confirmed suspend/resume works with hid_composite example on rx65n_target.
But, DCD_EVENT_UNPLUGGED is not issued like before. I have no idea why VBINT(it is the VBUS changing interruption) is not occurred when the USB cable is removed.

}
if (is0 & USB_IS0_SOFR) {
if (_dcd.suspended) {
dcd_event_bus_signal(rhport, DCD_EVENT_RESUME, true);
Copy link
Copy Markdown
Owner

@hathach hathach Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, this is a bit odd, SOF should be recognized by hardware as Resume signal. Do we really need to do it manually ?

Copy link
Copy Markdown
Collaborator Author

@kkitayam kkitayam Jul 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am agree your guessing. But unfortunately, RX65N does not signal resume interrupt caused by dcd_remote_wakeup() , in my experience. Of course, when the host resumes on its own, it occurs resume interrupt.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kkitayam I see, that is a bit odd for rx65n controller for not raising Resume interrupt in this case. Could you put an comment explaining why we need to manually send resume event here. Just in case when going back to this and/or we could figure out a better way to detect resume.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are added at 1ff3b76.

Comment thread src/portable/renesas/usba/dcd_usba.c Outdated
(void)rhport;
/* TODO */
USB0.DVSTCTR0.BIT.WKUP = 1;
while (USB0.DVSTCTR0.BIT.WKUP) ;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't really need to blocking wait here,which could take a few ms, just return. We will send resume event later on with SOF walkaround. The usbd has its own suspended status bit, and shouldn't do any transfer until RESUME event is reported by dcd.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will remove this statement.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement is removed at 1ff3b76.

add comments why resume event is sent manually.
Copy link
Copy Markdown
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect ! Thank you very much for the PR.

@hathach hathach merged commit 4468b14 into hathach:master Jul 5, 2021
@kkitayam kkitayam deleted the add_suspend_and_resume_for_rx_family branch July 5, 2021 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants