Exemplo n.º 1
0
static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match)
{
	struct device_node *dp = dev->dev.of_node;
	unsigned long size;

	if (!strcmp(dp->parent->name, "ebus")) {
		auxio_devtype = AUXIO_TYPE_EBUS;
		size = sizeof(u32);
	} else if (!strcmp(dp->parent->name, "sbus")) {
		auxio_devtype = AUXIO_TYPE_SBUS;
		size = 1;
	} else {
		printk("auxio: Unknown parent bus type [%s]\n",
		       dp->parent->name);
		return -ENODEV;
	}
	auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio");
	if (!auxio_register)
		return -ENODEV;

	printk(KERN_INFO "AUXIO: Found device at %s\n",
	       dp->full_name);

	if (auxio_devtype == AUXIO_TYPE_EBUS)
		auxio_set_led(AUXIO_LED_ON);

	return 0;
}
Exemplo n.º 2
0
void __init auxio_probe(void)
{
        struct sbus_bus *sbus;
        struct sbus_dev *sdev = NULL;

        for_each_sbus(sbus) {
                for_each_sbusdev(sdev, sbus) {
                        if(!strcmp(sdev->prom_name, "auxio"))
				goto found_sdev;
                }
        }

found_sdev:
	if (sdev) {
		auxio_devtype  = AUXIO_TYPE_SBUS;
		auxio_register = sbus_ioremap(&sdev->resource[0], 0,
					      sdev->reg_addrs[0].reg_size,
					      "auxiliaryIO");
	}
#ifdef CONFIG_PCI
	else {
		struct linux_ebus *ebus;
		struct linux_ebus_device *edev = NULL;

		for_each_ebus(ebus) {
			for_each_ebusdev(edev, ebus) {
				if (!strcmp(edev->prom_name, "auxio"))
					goto ebus_done;
			}
		}
	ebus_done:
		if (edev) {
			auxio_devtype  = AUXIO_TYPE_EBUS;
			auxio_register =
				ioremap(edev->resource[0].start, sizeof(u32));
		}
	}
	auxio_set_led(AUXIO_LED_ON);
#endif
}