aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb-synopsys-otg
diff options
context:
space:
mode:
authorKevin <[email protected]>2024-09-15 20:09:42 +0200
committerKevin <[email protected]>2024-09-22 00:23:07 +0200
commit6d9af8304cf88dbfa3713acfef4d89ba3a95c2d8 (patch)
tree92aa105670259bfd9aa9b60209c62eb2f3cdaa23 /embassy-usb-synopsys-otg
parent2f60d78ea318f51ff59868c348b77cf880012198 (diff)
Add USBPHYC clock configuration for H7RS series
Diffstat (limited to 'embassy-usb-synopsys-otg')
-rw-r--r--embassy-usb-synopsys-otg/src/lib.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs
index 3ff965149..f90403936 100644
--- a/embassy-usb-synopsys-otg/src/lib.rs
+++ b/embassy-usb-synopsys-otg/src/lib.rs
@@ -584,20 +584,27 @@ impl<'d, const MAX_EP_COUNT: usize> Bus<'d, MAX_EP_COUNT> {
584 }); 584 });
585 } 585 }
586 586
587 /// Applies configuration specific to
588 /// Core ID 0x0000_5000
587 pub fn config_v5(&mut self) { 589 pub fn config_v5(&mut self) {
588 let r = self.instance.regs; 590 let r = self.instance.regs;
591 let phy_type = self.instance.phy_type;
589 592
590 r.gccfg_v3().modify(|w| { 593 if phy_type == PhyType::InternalHighSpeed {
591 w.set_vbvaloven(true); 594 r.gccfg_v3().modify(|w| {
592 w.set_vbvaloval(true); 595 w.set_vbvaloven(!self.config.vbus_detection);
593 w.set_vbden(self.config.vbus_detection); 596 w.set_vbvaloval(!self.config.vbus_detection);
594 }); 597 w.set_vbden(self.config.vbus_detection);
595 598 });
596 // Force B-peripheral session 599 } else {
597 r.gotgctl().modify(|w| { 600 r.gotgctl().modify(|w| {
598 w.set_vbvaloen(!self.config.vbus_detection); 601 w.set_bvaloen(!self.config.vbus_detection);
599 w.set_bvaloval(true); 602 w.set_bvaloval(!self.config.vbus_detection);
600 }); 603 });
604 r.gccfg_v3().modify(|w| {
605 w.set_vbden(self.config.vbus_detection);
606 });
607 }
601 } 608 }
602 609
603 fn init(&mut self) { 610 fn init(&mut self) {