void usb_init(void) { if (getenv("USB_DEBUG")) usb_set_debug(atoi(getenv("USB_DEBUG"))); usb_os_init(); }
int tiny_ehci_init(void) { int retval; ehci = &_ehci; //memset(ehci,0,sizeof(*ehci)); if(usb_os_init()<0) return 0; ehci->caps = (void*)0x0D040000; ehci->regs = (void*)(0x0D040000 + HC_LENGTH(ehci_readl(&ehci->caps->hc_capbase))); ehci->num_port = 4; /* cache this readonly data; minimize chip reads */ ehci->hcs_params = ehci_readl( &ehci->caps->hcs_params ); /* data structure init */ retval = ehci_init(); if (retval) return retval; ehci_release_ports(); //quickly release none usb2 port return 0; }
int tiny_ehci_init(void) { int i; ehci = &_ehci; if(usb_os_init()<0) return -1; if(1) { // From Hermes: ohci mem is readed from dev/mload: (ehci init is from here) /* int fd; fd = os_open("/dev/mload",1); if(fd<0) return -1; ehci= (struct ehci_hcd *) os_ioctlv(fd, MLOAD_GET_EHCI_DATA ,0,0,0); os_close(fd); */ ehci=swi_mload_EHCI_data(); // stops EHCI ehci_writel( 0x00010020 , &ehci->regs->command); do { if(!(ehci_readl( &ehci->regs->command) & 1))break; } while(1); ehci_dma_map_bidir(ehci,sizeof(struct ehci_hcd)); for (i = 0; i < DEFAULT_I_TDPS; i++) { ehci->periodic [i] = EHCI_LIST_END(); ehci_dma_map_bidir((void *) ehci->periodic [i],4); } reinit_ehci_headers(); ////////////////////////////////////////////////////////////////////////////////////////////// /* WARNING: This ignore the port 1 (external) and 2,3 (internals) for USB 2.0 operations */ /* from cIOS mload 1.6 port 1 is forced to USB 1.1. Only port 0 can work as USB 2.0 */ ehci->num_port=1; //ehci_writel( 0x00080021, &ehci->regs->command); //ehci_writel(0, &ehci->regs->frame_list); ehci_writel(ehci->async->qh_dma, &ehci->regs->async_next); ehci_writel (/*INTR_MASK*/STS_PCD, &ehci->regs->intr_enable); #define t125us (1) ehci_writel( (t125us<<16) | 0x0021 , &ehci->regs->command); ehci_readl( &ehci->regs->command); //swi_mload_led_on(); //swi_mload_call_func(hola,NULL,NULL); ///////////////////////////////////////////////////////////////////////////////////////////// } return 0; }