Re: Writing to a PCI card from the kernel

Gabriel Paubert (paubert@iram.es)
Fri, 17 Jul 1998 14:30:01 +0200 (METDST)


On Wed, 15 Jul 1998, Kurt Garloff wrote:

> The following applies to 2.1, 2.0 is basically similar, but the syntax
> differs somewhat.
>
> 1) check for PCI: pci_present ()
> 2) find your device: struct pci_dev* pdev = pci_find_device (VENDOR_ID, DEV_ID, pdev)
> Now you have access to the PCI config space of the device.
> Use the info provided in it, especially:
> 3) get IRQ, IOSpace and MemRegions from the PCI config space
> 3a) enable busmastering (DMA), if necessary: pci_set_master (pdev)
> 4) register iospace: check_region (addr, ln); request_region (addr, ln, "NAME")

You have forgotten one step for memory-mapped I/O; you have to use
ioremap() to get access to the device registers... Note that it was
called vremap in 2.0.xx. See Documentation/IO-mapping.txt for more
details.

Gabriel.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html