Skip to content

Commit

Permalink
avr32: Add system device for the internal interrupt controller (intc)
Browse files Browse the repository at this point in the history
This makes the intc show up in sysfs (probably not very useful), and
allows us to easily add suspend/resume support later.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
  • Loading branch information
Haavard Skinnemoen authored and Haavard Skinnemoen committed Jul 2, 2008
1 parent b83d6ee commit aa8e87c
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions arch/avr32/mach-at32ap/intc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006 Atmel Corporation
* Copyright (C) 2006, 2008 Atmel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
Expand All @@ -12,14 +12,16 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>

#include <asm/io.h>

#include "intc.h"

struct intc {
void __iomem *regs;
struct irq_chip chip;
void __iomem *regs;
struct irq_chip chip;
struct sys_device sysdev;
};

extern struct platform_device at32_intc0_device;
Expand Down Expand Up @@ -136,6 +138,26 @@ void __init init_IRQ(void)
panic("Interrupt controller initialization failed!\n");
}

static struct sysdev_class intc_class = {
.name = "intc",
};

static int __init intc_init_sysdev(void)
{
int ret;

ret = sysdev_class_register(&intc_class);
if (ret)
return ret;

intc0.sysdev.id = 0;
intc0.sysdev.cls = &intc_class;
ret = sysdev_register(&intc0.sysdev);

return ret;
}
device_initcall(intc_init_sysdev);

unsigned long intc_get_pending(unsigned int group)
{
return intc_readl(&intc0, INTREQ0 + 4 * group);
Expand Down

0 comments on commit aa8e87c

Please sign in to comment.