[PATCH 4/10] Add arch/powerpc driver for UIC, PPC4xx interrupt controller
Josh Boyer
jwboyer at linux.vnet.ibm.com
Fri Mar 23 23:20:47 EST 2007
On Thu, 2007-03-22 at 20:22 +1100, David Gibson wrote:
>
> Index: working-2.6/arch/powerpc/sysdev/uic.c
> ===================================================================
<snip>
> +static struct uic * __init uic_init_one(struct device_node *node)
> +{
> + struct uic *uic;
> + const u32 *indexp, *dcrreg;
> + int len;
> +
> + BUG_ON(! device_is_compatible(node, "ibm,uic"));
> +
> + uic = alloc_bootmem(sizeof(*uic));
> + if (! uic)
> + return NULL; /* FIXME: panic? */
> +
> + memset(uic, 0, sizeof(*uic));
> + uic->of_node = of_node_get(node);
> + indexp = get_property(node, "cell-index", &len);
> + if (!indexp || (len != sizeof(u32))) {
> + printk(KERN_ERR "uic: Device node %s has missing or invalid "
> + "cell-index property\n", node->full_name);
> + return NULL;
> + }
> + uic->index = *indexp;
> +
> + dcrreg = get_property(node, "dcr-reg", &len);
> + if (!dcrreg || (len != 2*sizeof(u32))) {
> + printk(KERN_ERR "uic: Device node %s has missing or invalid "
> + "dcr-reg property\n", node->full_name);
> + return NULL;
> + }
> + uic->dcrbase = *dcrreg;
> +
> + uic->irqhost = irq_alloc_host(IRQ_HOST_MAP_LINEAR, NR_UIC_INTS,
> + &uic_host_ops, -1);
> + if (! uic->irqhost) {
> + of_node_put(node);
> + return NULL; /* FIXME: panic? */
> + }
> +
> + uic->irqhost->host_data = uic;
> +
> + /* Start with all interrupts disable and non-critical */
> + mtdcr(uic->dcrbase + UIC_ER, 0);
> + mtdcr(uic->dcrbase + UIC_CR, 0);
I think at this point we should also clear the interrupts in the SR
register as well. When playing with the Bamboo port, I found that the
firmware leaves pending interrupts, which can lead to some not nice
results when the cascade bits are enabled.
josh
More information about the Linuxppc-dev
mailing list