示例#1
0
int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance)
{
	if(dev == NULL) {
		printk(KERN_ERR "VFC: Bogus pointer passed\n");
		return -ENOMEM;
	}
	printk("Initializing vfc%d\n",instance);
	dev->regs = NULL;
	dev->regs = (volatile struct vfc_regs __iomem *)
		sbus_ioremap(&sdev->resource[0], 0,
			     sizeof(struct vfc_regs), vfcstr);
	dev->which_io = sdev->reg_addrs[0].which_io;
	dev->phys_regs = (struct vfc_regs *) sdev->reg_addrs[0].phys_addr;
	if (dev->regs == NULL)
		return -EIO;

	printk("vfc%d: registers mapped at phys_addr: 0x%lx\n    virt_addr: 0x%lx\n",
	       instance,(unsigned long)sdev->reg_addrs[0].phys_addr,(unsigned long)dev->regs);

	if (init_vfc_devstruct(dev, instance))
		return -EINVAL;
	if (init_vfc_hw(dev))
		return -EIO;
	return 0;
}
示例#2
0
int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance)
{
	char devname[8];

	if(dev == NULL) {
		printk(KERN_ERR "VFC: Bogus pointer passed\n");
		return -ENOMEM;
	}
	printk("Initializing vfc%d\n",instance);
	dev->regs = NULL;
	dev->regs = (volatile struct vfc_regs *)
		sbus_ioremap(&sdev->resource[0], 0,
			     sizeof(struct vfc_regs), vfcstr);
	dev->which_io = sdev->reg_addrs[0].which_io;
	dev->phys_regs = (struct vfc_regs *) sdev->reg_addrs[0].phys_addr;
	if (dev->regs == NULL)
		return -EIO;

	printk("vfc%d: registers mapped at phys_addr: 0x%lx\n    virt_addr: 0x%lx\n",
	       instance,(unsigned long)sdev->reg_addrs[0].phys_addr,(unsigned long)dev->regs);

	if (init_vfc_devstruct(dev, instance))
		return -EINVAL;
	if (init_vfc_hw(dev))
		return -EIO;

	sprintf (devname, "%d", instance);
	dev->de = devfs_register (devfs_handle, devname, DEVFS_FL_DEFAULT,
				  VFC_MAJOR, instance,
				  S_IFCHR | S_IRUSR | S_IWUSR,
				  &vfc_fops, NULL);
	return 0;
}
示例#3
0
int init_vfc_device(struct linux_sbus_device *sdev,struct vfc_dev *dev,
		    int instance) {
	if(!dev) {
		printk(KERN_ERR "VFC: Bogus pointer passed\n");
		return -ENOMEM;
	}
	printk("Initializing vfc%d\n",instance);
	dev->regs=NULL;
	prom_apply_sbus_ranges(sdev->my_bus, &sdev->reg_addrs[0], sdev->num_registers, sdev);
	dev->regs=sparc_alloc_io(sdev->reg_addrs[0].phys_addr, 0,
				 sizeof(struct vfc_regs), vfcstr, 
				 sdev->reg_addrs[0].which_io, 0x0);
	dev->which_io=sdev->reg_addrs[0].which_io;
	dev->phys_regs=(struct vfc_regs *)sdev->reg_addrs[0].phys_addr;
	if(!dev->regs) return -EIO;

	printk("vfc%d: registers mapped at phys_addr: 0x%lx\n    virt_addr: 0x%lx\n",
	       instance,(unsigned long)sdev->reg_addrs[0].phys_addr,(unsigned long)dev->regs);

	if(init_vfc_devstruct(dev,instance)) return -EINVAL;
	if(init_vfc_hw(dev)) return -EIO;

	return 0;
}