Re: PCIE

From: Manu Abraham
Date: Wed May 23 2007 - 18:11:55 EST


Roland Dreier wrote:
>>> Uncompressing Linux .. Ok, booting the kernel.
>>> BIOS bug, no explicit IRQ entries, using default mptable. (tell your hw vendor)
>>> PCI: Failed to allocate mem resource #6:20000@30000000 for 0000:01:00.0
>
> This message is about device 01:00.0 as it says (your nvidia video
> card based on later lspci output).
>
> > The device is a new DTV bridge from NXP (SAA7162E) with a PCIe interface.
> >
> > 06:00.0 Multimedia controller: Philips Semiconductors Unknown device
> > 7162 (rev 01)
> > Subsystem: Twinhan Technology Co. Ltd Unknown device 0027
>
> This is device 06:00.0, so it's not related to that earlier message at
> all. You didn't say what problem you're having with your driver for
> this device...


If i uncomment the saa716x_read or write, what i get is a solid freeze
on module load. If i leave it commented out, the module loads fine.

static irqreturn_t saa716x_pcie_irq(int irq, void *dev_id)
{
struct saa716x *saa716x;
u32 stat, mask;

if (unlikely((saa716x = (struct saa716x *) dev_id) == NULL)) {
printk(KERN_ERR "%s: Aeie NULL ptr\n", __func__);
return IRQ_NONE;
}
// stat = saa716x_read(0x500);
dprintk(verbose, SAA716x_DEBUG, 0, "=== Interrupts[%04x] [", stat);

dprintk(verbose, SAA716x_DEBUG, 0, "] ==\n");

return IRQ_HANDLED;
}

int saa716x_pcie_init(struct saa716x *saa716x)
{
struct pci_dev *pdev = saa716x->pdev;
int err = 0;
u8 latency, revision;

printk(KERN_INFO "%s: found a %s device\n", __func__,
saa716x->hwconfig->model_name);
pci_set_drvdata(pdev, saa716x);

if ((err = pci_enable_device(pdev)) != 0) {
printk(KERN_ERR "%s ERROR: pci enable failed (%i)\n", __func__, err);
goto fail0;
}
if (request_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0), DRIVER_NAME) == NULL) {

printk(KERN_ERR "%s ERROR: mem region request failed\n", __func__);
err = -ENOMEM;
goto fail1;
}

saa716x->mmio = ioremap(pci_resource_start(pdev, 0), 0x1000); // FIXME:
check this size

if ((err = request_irq(pdev->irq, saa716x_pcie_irq, IRQF_SHARED |
IRQF_DISABLED,
DRIVER_NAME, (void *) saa716x)) != 0) {
printk(KERN_ERR "%s ERROR: irq request failed (%i)\n", err, __func__);
goto fail2;
}
pci_set_master(pdev);
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);

dprintk(verbose, SAA716x_ERROR, 0, " SAA7160/1/2 Rev %d [%04x:%04x], ",
revision,
saa716x->pdev->subsystem_vendor, saa716x->pdev->subsystem_device);

dprintk(verbose, SAA716x_ERROR, 0,
"irq: %d, latency: %d\n memory: 0x%04x, mmio: 0x%p\n",
saa716x->pdev->irq, latency, pci_resource_start(pdev, 0), saa716x->mmio);

saa716x->verbose = verbose;
// init_waitqueue_head(&saa716x->i2c_queue);
/* Disable all interrupts here */
// saa716x_write(0, 0x500);
return 0;

fail2:
iounmap(saa716x->mmio);
release_mem_region(pci_resource_start(saa716x->pdev, 0),
pci_resource_len(saa716x->pdev, 0));
fail1:
pci_disable_device(pdev);
fail0:
pci_set_drvdata(pdev, NULL);
return err;
}
EXPORT_SYMBOL_GPL(saa716x_pcie_init);



> but all standard PCI stuff should work fine for PCIe
> devices -- the normal PCI driver stuff is all you should need for
> everything but exotic cases.

That part is then fine. Does MSI require any special tinkering ?


Thanks,
Manu
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/