Ejemplo n.º 1
0
static int
uctrl_open(struct inode *inode, struct file *file)
{
	uctrl_get_event_status();
	uctrl_get_external_status();
	return 0;
}
Ejemplo n.º 2
0
static int
uctrl_open(struct inode *inode, struct file *file)
{
	mutex_lock(&uctrl_mutex);
	uctrl_get_event_status(global_driver);
	uctrl_get_external_status(global_driver);
	mutex_unlock(&uctrl_mutex);
	return 0;
}
Ejemplo n.º 3
0
static int
uctrl_open(struct inode *inode, struct file *file)
{
	lock_kernel();
	uctrl_get_event_status(global_driver);
	uctrl_get_external_status(global_driver);
	unlock_kernel();
	return 0;
}
Ejemplo n.º 4
0
static int __devinit uctrl_probe(struct of_device *op,
				 const struct of_device_id *match)
{
	struct uctrl_driver *p;
	int err = -ENOMEM;

	p = kzalloc(sizeof(*p), GFP_KERNEL);
	if (!p) {
		printk(KERN_ERR "uctrl: Unable to allocate device struct.\n");
		goto out;
	}

	p->regs = of_ioremap(&op->resource[0], 0,
			     resource_size(&op->resource[0]),
			     "uctrl");
	if (!p->regs) {
		printk(KERN_ERR "uctrl: Unable to map registers.\n");
		goto out_free;
	}

	p->irq = op->irqs[0];
	err = request_irq(p->irq, uctrl_interrupt, 0, "uctrl", p);
	if (err) {
		printk(KERN_ERR "uctrl: Unable to register irq.\n");
		goto out_iounmap;
	}

	err = misc_register(&uctrl_dev);
	if (err) {
		printk(KERN_ERR "uctrl: Unable to register misc device.\n");
		goto out_free_irq;
	}

	sbus_writel(UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK, &p->regs->uctrl_intr);
	printk(KERN_INFO "%s: uctrl regs[0x%p] (irq %d)\n",
	       op->dev.of_node->full_name, p->regs, p->irq);
	uctrl_get_event_status(p);
	uctrl_get_external_status(p);

	dev_set_drvdata(&op->dev, p);
	global_driver = p;

out:
	return err;

out_free_irq:
	free_irq(p->irq, p);

out_iounmap:
	of_iounmap(&op->resource[0], p->regs, resource_size(&op->resource[0]));

out_free:
	kfree(p);
	goto out;
}
Ejemplo n.º 5
0
static int __init ts102_uctrl_init(void)
{
	struct uctrl_driver *driver = &drv;
	int len, i;
	struct linux_prom_irqs tmp_irq[2];
        unsigned int vaddr[2] = { 0, 0 };
	int tmpnode, uctrlnode = prom_getchild(prom_root_node);
	int err;

	tmpnode = prom_searchsiblings(uctrlnode, "obio");

	if (tmpnode)
	  uctrlnode = prom_getchild(tmpnode);

	uctrlnode = prom_searchsiblings(uctrlnode, "uctrl");

	if (!uctrlnode)
		return -ENODEV;

	/* the prom mapped it for us */
	len = prom_getproperty(uctrlnode, "address", (void *) vaddr,
			       sizeof(vaddr));
	driver->regs = (struct uctrl_regs *)vaddr[0];

	len = prom_getproperty(uctrlnode, "intr", (char *) tmp_irq,
			       sizeof(tmp_irq));

	/* Flush device */
	READUCTLDATA(len);

	if(!driver->irq) 
		driver->irq = tmp_irq[0].pri;

	err = request_irq(driver->irq, uctrl_interrupt, 0, "uctrl", driver);
	if (err) {
		printk("%s: unable to register irq %d\n",
		       __FUNCTION__, driver->irq);
		return err;
	}

	if (misc_register(&uctrl_dev)) {
		printk("%s: unable to get misc minor %d\n",
		       __FUNCTION__, uctrl_dev.minor);
		free_irq(driver->irq, driver);
		return -ENODEV;
	}

	driver->regs->uctrl_intr = UCTRL_INTR_RXNE_REQ|UCTRL_INTR_RXNE_MSK;
	printk("uctrl: 0x%p (irq %d)\n", driver->regs, driver->irq);
	uctrl_get_event_status();
	uctrl_get_external_status();
        return 0;
}