Author: wookey
Date: 2008-05-01 13:54:09 +0100 (Thu, 01 May 2008)
New Revision: 476
Modified:
balloon/trunk/kernel/2.6.22.2/balloon3-minipug.patch
balloon/trunk/kernel/2.6.22.2/balloon3-samosa.patch
Log:
Updated udev support from Nick, so Samosa is a class in /sys
Modified: balloon/trunk/kernel/2.6.22.2/balloon3-minipug.patch
===================================================================
--- balloon/trunk/kernel/2.6.22.2/balloon3-minipug.patch 2008-05-01 10:54:37 UTC (rev 475)
+++ balloon/trunk/kernel/2.6.22.2/balloon3-minipug.patch 2008-05-01 12:54:09 UTC (rev 476)
@@ -30,8 +30,8 @@
Index: linux-2.6.22.2/drivers/char/minipug.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22.2/drivers/char/minipug.c 2008-04-29 13:42:15.000000000 +0100
-@@ -0,0 +1,729 @@
++++ linux-2.6.22.2/drivers/char/minipug.c 2008-05-01 09:24:10.000000000 +0100
+@@ -0,0 +1,738 @@
+/*
+ * linux/drivers/char/minipug.c
+ *
@@ -66,7 +66,8 @@
+// This is needed at the moment for udev as
+// the add uevent seems to be missing the MAJOR
+// and MINOR fields if done via platform devices.
-+#define MINIPUG_CLASS
++//#define MINIPUG_CLASS
++#define SAMOSA_CLASS
+
+// uncomment for fixed node major numbering
+// #define MINIPUG_MAJOR 200
@@ -638,7 +639,7 @@
+static dev_t dev;
+#ifdef MINIPUG_CLASS
+static struct class *minipug_class;
-+#else
++#elif !defined(SAMOSA_CLASS)
+static struct platform_device *minipug_device[2];
+#endif
+
@@ -686,6 +687,10 @@
+ // create the actual devices
+ device_create(minipug_class, NULL, MKDEV(major, 0), "minipug0");
+ device_create(minipug_class, NULL, MKDEV(major, 1), "minipug1");
++#elif defined(SAMOSA_CLASS)
++ // create the actual devices
++ device_create(balloon_samosa_class, NULL, MKDEV(major, 0), "minipug0");
++ device_create(balloon_samosa_class, NULL, MKDEV(major, 1), "minipug1");
+#else
+#if 1
+ minipug_device[0] = platform_device_alloc("minipug", 0);
@@ -741,6 +746,10 @@
+ device_destroy(minipug_class, MKDEV(major, 1));
+ // remove class
+ class_destroy(minipug_class);
++#elif defined(SAMOSA_CLASS)
++ // remove devices
++ device_destroy(balloon_samosa_class, MKDEV(major, 0));
++ device_destroy(balloon_samosa_class, MKDEV(major, 1));
+#else
+ platform_device_unregister(minipug_device[0]);
+ kfree(minipug_device[0]);
Modified: balloon/trunk/kernel/2.6.22.2/balloon3-samosa.patch
===================================================================
--- balloon/trunk/kernel/2.6.22.2/balloon3-samosa.patch 2008-05-01 10:54:37 UTC (rev 475)
+++ balloon/trunk/kernel/2.6.22.2/balloon3-samosa.patch 2008-05-01 12:54:09 UTC (rev 476)
@@ -1,8 +1,8 @@
Index: linux-2.6.22.2/drivers/char/samosa.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22.2/drivers/char/samosa.h 2008-03-27 14:30:47.000000000 +0000
-@@ -0,0 +1,21 @@
++++ linux-2.6.22.2/drivers/char/samosa.h 2008-05-01 09:21:08.000000000 +0100
+@@ -0,0 +1,25 @@
+/*
+ * include/asm-arm/arch-sa1100/balloon2_samosa.h
+ *
@@ -14,6 +14,10 @@
+#ifndef _SAMOSA_H_
+#define _SAMOSA_H_
+
++#include "linux/device.h"
++
++extern struct class *balloon_samosa_class;
++
+/* samosa bus usage functions */
+int balloon_samosa_read8(unsigned char reg);
+void balloon_samosa_write8(unsigned char reg, unsigned char value);
@@ -26,8 +30,8 @@
+#endif
Index: linux-2.6.22.2/drivers/char/Makefile
===================================================================
---- linux-2.6.22.2.orig/drivers/char/Makefile 2008-03-27 14:30:42.000000000 +0000
-+++ linux-2.6.22.2/drivers/char/Makefile 2008-03-27 14:30:47.000000000 +0000
+--- linux-2.6.22.2.orig/drivers/char/Makefile 2008-04-29 09:52:26.000000000 +0100
++++ linux-2.6.22.2/drivers/char/Makefile 2008-05-01 09:24:59.000000000 +0100
@@ -104,6 +104,8 @@
obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
obj-$(CONFIG_TCG_TPM) += tpm/
@@ -39,8 +43,8 @@
Index: linux-2.6.22.2/drivers/char/Kconfig
===================================================================
---- linux-2.6.22.2.orig/drivers/char/Kconfig 2008-03-27 14:30:42.000000000 +0000
-+++ linux-2.6.22.2/drivers/char/Kconfig 2008-03-27 14:30:47.000000000 +0000
+--- linux-2.6.22.2.orig/drivers/char/Kconfig 2008-04-29 09:52:26.000000000 +0100
++++ linux-2.6.22.2/drivers/char/Kconfig 2008-05-01 09:24:59.000000000 +0100
@@ -1083,5 +1083,15 @@
source "drivers/s390/char/Kconfig"
@@ -60,8 +64,8 @@
Index: linux-2.6.22.2/drivers/char/samosa.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.22.2/drivers/char/samosa.c 2008-03-27 14:30:53.000000000 +0000
-@@ -0,0 +1,269 @@
++++ linux-2.6.22.2/drivers/char/samosa.c 2008-05-01 09:20:40.000000000 +0100
+@@ -0,0 +1,288 @@
+/*
+ * linux/arch/arm/mach-sa1100/balloon3_samosa.c
+ * Copyright (c) N C Bane
nick@cecomputing.co.uk
@@ -92,7 +96,6 @@
+
+#include "samosa.h"
+
-+
+#ifdef CONFIG_MACH_BALLOON3
+/* balloon3 version */
+
@@ -302,7 +305,25 @@
+
+#endif /* end of balloon2 version */
+
++// generic char device add/destroy
++//extern struct bus_type samosa_bus_type;
++struct class *balloon_samosa_class;
++EXPORT_SYMBOL(balloon_samosa_class);
+
++#if 0
++static dev_t dev;
++static int major;
++static int minor;
++
++dev_t balloon_samosa_device_create(const char *name) {
++}
++EXPORT_SYMBOL(balloon_samosa_device_create);
++
++dev_t balloon_samosa_device_destroy(dev_t dev) {
++}
++EXPORT_SYMBOL(balloon_samosa_device_destroy);
++#endif
++
+static int __init init_samosa(void)
+{
+ unsigned int ver;
@@ -312,11 +333,13 @@
+ printk(KERN_DEBUG "VHDL logic version (memread):%08X\n", ver);
+ //ver = (*(void __iomem *)(BALLOON3_FPGA_VIRT+0x00e0001c));
+ //printk(KERN_DEBUG "VHDL logic version (IOread) :%x\n", ver);
++ balloon_samosa_class = class_create(THIS_MODULE, "samosa");
+ return 0;
+}
+
+static void __exit cleanup_samosa(void)
+{
++ class_destroy(balloon_samosa_class);
+}
+
+module_init(init_samosa);