Hi everybody, I've started writing (yet another) driver for the isp1160, this time using the kernel 2.6 API (hcd.h with usb_hcd_pci_[probe/remove/...] etc.) I'm really in the beginning and I don't have any other experience in this field so excuse my silly questions, but there are some things that I don't fully understand.
First of all, I'm using the PCI evaluation kit (that ships with a DOS(!) driver). As you propably know, the isp1160 defines 2 IO ports, the command and the data port. Below is the output of lspci: 0000:00:0a.0 Bridge: PLX Technology, Inc.: Unknown device 5406 (rev 0b) Subsystem: PLX Technology, Inc.: Unknown device 9054 Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- Latency: 32, Cache Line Size: 0x08 (32 bytes) Interrupt: pin A routed to IRQ 11 Region 0: Memory at df101000 (32-bit, non-prefetchable) Region 1: I/O ports at b000 [size=256] Region 2: I/O ports at b400 [size=256] Region 3: Memory at df000000 (32-bit, non-prefetchable) [size=1M] Capabilities: [40] Power Management version 1 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D0 PME-Enable- DSel=0 DScale=0 PME- Capabilities: [48] #06 [0000] Capabilities: [4c] Vital Product Data As you can see there exist 4 IO regions. Regions 1 and 2 are detected as IO ports. But apart from that, I don't have a clue as to the whereabouts of the command and data ports... Can anybody help in this? The manual of the development board doesn't state anything about this. And what is the purpose of region 0 and 3? The DOS driver that ships with the board defines a base address that uses PCI_BASE_ADDR_2 and then says that: data_port=base command_port=base+2 I've sent a mail to Philips Semiconductors about this but they have not responded yet... Anyway, in my implementation of the HCD, I have a module_init function that calls pci_module_init() on a struct pci_driver that includes: - a .name - an .id_table with the vendror and product id of the board - .probe = usb_hcd_pci_probe - .remove etc. as for the ".probe" case then there is a struct hc_driver with functions for reset, start etc. Until now, i've implemented the .hcd_alloc and .hcd_free and i'm playing with .start where i'm trying various combinations of commands to communicate with the board (notably write and then read the HcScratch register and HcChipID, while guessing for the IO ports) By looking at the implementation of usb_hcd_pci_probe(), I understand that if the HCD_MEMORY flag is not set (my case) then the driver tries to allocate all the IO regions that are marked as IORESOURSE_IO. Correct? Then I try to insmod my driver and I get: Jun 10 16:31:47 naousa kernel: PCI: Found IRQ 11 for device 0000:00:0a.0 Jun 10 16:31:47 naousa kernel: PCI: Sharing IRQ 11 with 0000:00:0e.0 Jun 10 16:31:47 naousa kernel: isp1160_hcd 0000:00:0a.0: PCI device 10b5:5406 (PLX Technology, Inc.) Jun 10 16:31:47 naousa kernel: isp1160_hcd 0000:00:0a.0: irq 11, io base 0000b000 Jun 10 16:31:47 naousa kernel: isp1160_hcd 0000:00:0a.0: new USB bus registered, assigned bus number 3 and then rmmod: Jun 10 16:31:51 naousa kernel: isp1160_hcd 0000:00:0a.0: remove, state 0 Jun 10 16:31:51 naousa kernel: isp1160_hcd 0000:00:0a.0: roothub graceful disconnect Jun 10 16:31:51 naousa kernel: usb_disconnect nodev Jun 10 16:31:51 naousa kernel: isp1160_hcd 0000:00:0a.0: USB bus 3 deregistered I noted that only region 1 (0xb000) has been allocated for use. Why is that? I mean if there are 2 IO port regions, b000 and b400, shouldn't the probe function request both of them? Am I missing something? Do I have to implement another one of the struct hc_driver functions, in order to be able to use my device for basic IO (like outw, inw etc.)? And btw, do I need to wait after writing to the command_port, and before reading/writing the data_port? My approach until now is that b000 IS the base address so data_port=b000 and command_port=b002 but this does not work. And I don't know if I get the port numbers wrong, or if it is something wrong with the initialisation of the driver... Anyway, if anybody can help, i'd appreciate it very much. Thanx, Dimitris Lampridis PS: philips claims that the isp1160 is USB2 compliant, so I guess I should add to the hc_driver.flags the HCD_USB2. Right?
signature.asc
Description: This is a digitally signed message part