[PATCH 09/10] avr32: Add system device for the internal interrupt controller (intc)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Haavard Skinnemoen
Date: Thursday, March 13, 2008 - 7:39 am

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>
---
 arch/avr32/mach-at32ap/intc.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index 097cf4e..644a3fb 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -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
@@ -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;
@@ -136,6 +138,26 @@ fail:
 	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);
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/10] avr32: Power Management support, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 01/10] mtd: maps/physmap: fix oops in suspend/resum ..., Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 02/10] atmel_serial: Fix build on avr32 with CONFIG ..., Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 03/10] avr32: Move setup_platform() into chip-speci ..., Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 04/10] avr32: Rename at32ap.c -&gt; pdc.c, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 05/10] avr32: Enable SDRAMC clock at startup, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 06/10] avr32: Add simple SRAM allocator, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 07/10] macb: Basic suspend/resume support, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 08/10] avr32: Define TIF_FREEZE, Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
[PATCH 09/10] avr32: Add system device for the internal in ..., Haavard Skinnemoen, (Thu Mar 13, 7:39 am)
Re: [PATCH 07/10] macb: Basic suspend/resume support, David Brownell, (Thu Mar 13, 1:18 pm)
Re: [PATCH 07/10] macb: Basic suspend/resume support, Haavard Skinnemoen, (Thu Mar 13, 1:28 pm)
Re: [PATCH 02/10] atmel_serial: Fix build on avr32 with CO ..., Haavard Skinnemoen, (Thu Mar 13, 1:54 pm)