Code: Select all
int addr,data,temp;
char bus,dev,func,reg;
unsigned int timeout = EHCI_RESET_DELAY;
reg = 0x10;
sprintf(us,"init usb");
putfonts8_asc(binfo->vram, binfo->scrnx, 0, 32, COL8_FFFFFF, us);
addr = PCI_BUS_CONFIG(0,4,0,reg);
//write the new value of the base address I/O field back to its offset in the configuration space
io_out32(0xCF8,addr);
io_out32(0xCFC,usbaddr);
// Write 0x00000000 to dword 0x34 and dword 0x38 of the configuration space
reg = 0x34;
addr = PCI_BUS_CONFIG(0,4,0,reg);
io_out32(0xCF8,addr);
io_out32(0xCFC,0x00000000);
reg = 0x38;
addr = PCI_BUS_CONFIG(0,4,0,reg);
io_out32(0xCF8,addr);
io_out32(0xCFC,0x00000000);
//set irq field
reg = 0x3C;
addr = PCI_BUS_CONFIG(0,4,0,reg);
io_out32(0xCF8,addr);
io_out8(0xCFC,0x09);
//write 0x02 if you were using memory mapped I/O
reg = 0x04;
addr = PCI_BUS_CONFIG(0,4,0,reg);
io_out32(0xCF8,addr);
io_out16(0xCFC,0x0002);
mdelay(1000);
temp = (*(usbaddr+0x00));
sprintf(us,"ehci %x",temp);
putfonts8_asc(binfo->vram, binfo->scrnx, 0, 48, COL8_FFFFFF, us);
I used ehci because my host is ehci,and set new address for mmio to 0x10 in pci config,set 0x02 to command to enable the mmio(in the book of fysos usb is 0x06 that i think it has problems),
but even i used 0x06 that is also failed.
why i read the CAPLENGTH as a value of 0?
Is there any lack of steps to enable the mmio?I really don't know.