/* PLX Control Registers -- PCI BAR4 is interrupt and other registers */
res->flags = IORESOURCE_MEM;
res->parent = &pci->resource[4];
res->start = pci->resource[4].start;
res->end = pci->resource[4].end;
res++;
/* * IRQ * * The start and end fields are used as an offset to the irq_base * parameter passed into the mfd_add_devices() function call. All * devices share the same IRQ.
*/
res->flags = IORESOURCE_IRQ;
res->parent = NULL;
res->start = 0;
res->end = 0;
res++;
return 0;
}
/* Probe each submodule using kernel parameters */ staticint cmodio_probe_submodules(struct cmodio_device *priv)
{ struct pci_dev *pdev = priv->pdev; unsignedint num_probed = 0; char *name; int i;
for (i = 0; i < num_modules; i++) {
name = modules[i]; if (!strcmp(name, "") || !strcmp(name, "empty")) continue;
dev_dbg(&priv->pdev->dev, "MODULbus %d: name %s\n", i, name);
cmodio_setup_subdevice(priv, name, num_probed, i);
num_probed++;
}
/* print an error message if no modules were probed */ if (num_probed == 0) {
dev_err(&priv->pdev->dev, "no MODULbus modules specified, " "please set the ``modules'' kernel " "parameter according to your " "hardware configuration\n"); return -ENODEV;
}
priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM;
pci_set_drvdata(dev, priv);
priv->pdev = dev;
/* Hardware Initialization */
ret = pci_enable_device(dev); if (ret) {
dev_err(&dev->dev, "unable to enable device\n"); return ret;
}
pci_set_master(dev);
ret = pci_request_regions(dev, DRV_NAME); if (ret) {
dev_err(&dev->dev, "unable to request regions\n"); goto out_pci_disable_device;
}
/* Onboard configuration registers */
priv->ctrl = pci_ioremap_bar(dev, 4); if (!priv->ctrl) {
dev_err(&dev->dev, "unable to remap onboard regs\n");
ret = -ENOMEM; goto out_pci_release_regions;
}
/* Read the hex switch on the carrier board */
priv->hex = ioread8(&priv->ctrl->int_enable);
/* Add the MODULbus number (hex switch value) to the device's sysfs */
ret = sysfs_create_group(&dev->dev.kobj, &cmodio_sysfs_attr_group); if (ret) {
dev_err(&dev->dev, "unable to create sysfs attributes\n"); goto out_unmap_ctrl;
}
/* * Disable all interrupt lines, each submodule will enable its * own interrupt line if needed
*/
iowrite8(0xf, &priv->ctrl->int_disable);
/* Register drivers for all submodules */
ret = cmodio_probe_submodules(priv); if (ret) {
dev_err(&dev->dev, "unable to probe submodules\n"); goto out_sysfs_remove_group;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.