upgrade link to high speed

This commit is contained in:
bunnie 2025-09-08 09:52:20 +08:00
parent 9ec18eb045
commit 00db7d108d

View file

@ -1167,6 +1167,20 @@ impl CorigineUsb {
println!("USB reset done: {:x}", dummy);
}
pub fn se0_test(&mut self, value: bool) {
crate::println!("cmd state: {:x}", self.csr.r(USBCMD));
crate::println!("link state bef: {:x}", (self.csr.r(PORTSC) >> 5) & 0xf);
let base = self.csr.r(U2PORTPMSC);
if value {
self.csr.wo(U2PORTPMSC, (base & 0x0FFF_FFFF) | (3 << 28));
crate::println!("U2PORTPMSC: {:x}", self.csr.r(U2PORTPMSC));
} else {
self.csr.wo(U2PORTPMSC, (base & 0x0FFF_FFFF) | (0 << 28));
crate::println!("U2PORTPMSC: {:x}", self.csr.r(U2PORTPMSC));
}
crate::println!("link state aft: {:x}", (self.csr.r(PORTSC) >> 5) & 0xf);
}
pub fn init(&mut self) {
self.csr.rmwf(USBCMD_INT_ENABLE, 0);
self.csr.rmwf(USBCMD_RUN_STOP, 0);
@ -1177,8 +1191,7 @@ impl CorigineUsb {
// wait for reset to finish
}
// TODO: ugprade this to HS
self.csr.wo(DEVCONFIG, 0x80 | CRG_UDC_CFG0_MAXSPEED_FS);
self.csr.wo(DEVCONFIG, 0x80 | CRG_UDC_CFG0_MAXSPEED_FS | CRG_UDC_CFG0_MAXSPEED_HS);
self.csr.wo(
EVENTCONFIG,