Add DWC3 codes

This commit is contained in:
xj 2024-09-12 04:02:59 -07:00
parent b51c911252
commit 637408e192
2 changed files with 31 additions and 4 deletions

View File

@ -93,6 +93,16 @@ int dwc3_core_init(struct dwc3 *dwc){
int dwc3_alloc_scratch_buffers(struct dwc3 *dwc){
uint32_t length;
if (!dwc->has_hibernation)
return 0;
if (!dwc->nr_scratch)
return 0;
return 0;
}
@ -104,12 +114,11 @@ int dwc3_setup_scratch_buffers(struct dwc3 *dwc){
int dwc3_event_buffers_alloc(struct dwc3 *dwc){
int dwc3_alloc_event_buffers(struct dwc3 *dwc, uint32_t length){
return 0;
}
int dwc3_event_buffers_setup(struct dwc3 *dwc){
return 0;
}
@ -135,5 +144,25 @@ int dwc3_init(struct dwc3 *dwc){
int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, uint32_t param){
uint32_t timeout = 500;
uint32_t reg;
dwc3_writel(dwc->regs_vir, DWC3_DGCMDPAR, param);
dwc3_writel(dwc->regs_vir, DWC3_DGCMD, cmd | DWC3_DGCMD_CMDACT);
do {
reg = dwc3_readl(dwc->regs_vir, DWC3_DGCMD);
if(!(reg & DWC3_DGCMD_CMDACT)){
return 0;
}
timeout--;
usb_osal_msleep(1);
if(!timeout)
return -1;
}while(1);
return 0;
}

View File

@ -894,8 +894,6 @@ int dwc3_setup_scratch_buffers(struct dwc3 *dwc);
int dwc3_alloc_event_buffers(struct dwc3 *dwc, uint32_t length);
int dwc3_event_buffers_alloc(struct dwc3 *dwc);
int dwc3_event_buffers_setup(struct dwc3 *dwc);
int dwc3_core_init_mode(struct dwc3 *dwc);