Implement sysfs interface for some specific cris driver
authorClaudio Mignanti <c.mignanti@gmail.com>
Thu, 1 Oct 2009 15:44:28 +0000 (15:44 +0000)
committerClaudio Mignanti <c.mignanti@gmail.com>
Thu, 1 Oct 2009 15:44:28 +0000 (15:44 +0000)
SVN-Revision: 17805

target/linux/etrax/patches-2.6.30/600-create-device-serial.patch [new file with mode: 0644]
target/linux/etrax/patches-2.6.30/610-create-the-gpio-devices.patch [new file with mode: 0644]
target/linux/etrax/patches-2.6.30/620-create-the-i2c-devices.patch [new file with mode: 0644]

diff --git a/target/linux/etrax/patches-2.6.30/600-create-device-serial.patch b/target/linux/etrax/patches-2.6.30/600-create-device-serial.patch
new file mode 100644 (file)
index 0000000..516b984
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/drivers/serial/crisv10.c
++++ b/drivers/serial/crisv10.c
+@@ -31,6 +31,7 @@ static char *serial_version = "$Revision
+ #include <linux/module.h>
+ #include <linux/uaccess.h>
+ #include <linux/io.h>
++#include <linux/device.h>
+ #include <asm/irq.h>
+ #include <asm/dma.h>
+@@ -4414,6 +4415,8 @@ static const struct tty_operations rs_op
+ #endif
+ };
++static struct class *rs_class;
++
+ static int __init rs_init(void)
+ {
+       int i;
+@@ -4547,6 +4550,24 @@ static int __init rs_init(void)
+ #endif
+ #endif /* CONFIG_SVINTO_SIM */
++      rs_class = class_create(THIS_MODULE, "rs_tty");
++#ifdef CONFIG_ETRAX_SERIAL_PORT0 
++      device_create(rs_class, NULL,
++              MKDEV(TTY_MAJOR, 64), NULL, "ttyS0");
++#endif
++#ifdef CONFIG_ETRAX_SERIAL_PORT1 
++      device_create(rs_class, NULL,
++              MKDEV(TTY_MAJOR, 65), NULL, "ttyS1");
++#endif
++#ifdef CONFIG_ETRAX_SERIAL_PORT2 
++      device_create(rs_class, NULL,
++              MKDEV(TTY_MAJOR, 66), NULL, "ttyS2");
++#endif
++#ifdef CONFIG_ETRAX_SERIAL_PORT3 
++      device_create(rs_class, NULL,
++              MKDEV(TTY_MAJOR, 67), NULL, "ttyS3");
++#endif
++
+       return 0;
+ }
diff --git a/target/linux/etrax/patches-2.6.30/610-create-the-gpio-devices.patch b/target/linux/etrax/patches-2.6.30/610-create-the-gpio-devices.patch
new file mode 100644 (file)
index 0000000..27e13c2
--- /dev/null
@@ -0,0 +1,50 @@
+--- a/arch/cris/arch-v10/drivers/gpio.c
++++ b/arch/cris/arch-v10/drivers/gpio.c
+@@ -21,6 +21,7 @@
+ #include <linux/poll.h>
+ #include <linux/init.h>
+ #include <linux/interrupt.h>
++#include <linux/device.h>
+ #include <asm/etraxgpio.h>
+ #include <arch/svinto.h>
+@@ -771,6 +772,8 @@ static void ioif_watcher(const unsigned 
+ /* main driver initialization routine, called from mem.c */
++static struct class *gp_class;
++
+ static int __init gpio_init(void)
+ {
+       int res;
+@@ -784,6 +787,8 @@ static int __init gpio_init(void)
+               return res;
+       }
++      gp_class = class_create(THIS_MODULE, "gpio_etrax");
++
+       /* Clear all leds */
+ #if defined (CONFIG_ETRAX_CSP0_LEDS) ||  defined (CONFIG_ETRAX_PA_LEDS) || defined (CONFIG_ETRAX_PB_LEDS)
+       CRIS_LED_NETWORK_SET(0);
+@@ -796,6 +801,8 @@ static int __init gpio_init(void)
+               CRIS_LED_BIT_SET(i);
+ #endif
++      device_create(gp_class, NULL,
++              MKDEV(GPIO_MAJOR, 2), NULL, "leds");
+ #endif
+       /* The I/O interface allocation watcher will be called when
+        * registering it. */
+@@ -822,6 +829,12 @@ static int __init gpio_init(void)
+       if (res)
+               printk(KERN_CRIT "err: PA irq for gpio\n");
++      device_create(gp_class, NULL,
++              MKDEV(GPIO_MAJOR, 0), NULL, "gpioa");
++      device_create(gp_class, NULL,
++              MKDEV(GPIO_MAJOR, 1), NULL, "gpiob");
++      device_create(gp_class, NULL,
++              MKDEV(GPIO_MAJOR, 3), NULL, "gpiog");
+       return res;
+ }
diff --git a/target/linux/etrax/patches-2.6.30/620-create-the-i2c-devices.patch b/target/linux/etrax/patches-2.6.30/620-create-the-i2c-devices.patch
new file mode 100644 (file)
index 0000000..9c2e37a
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/arch/cris/arch-v10/drivers/i2c.c
++++ b/arch/cris/arch-v10/drivers/i2c.c
+@@ -21,6 +21,7 @@
+ #include <linux/fs.h>
+ #include <linux/string.h>
+ #include <linux/init.h>
++#include <linux/device.h>
+ #include <asm/etraxi2c.h>
+@@ -678,6 +679,8 @@ i2c_init(void)
+       return res;
+ }
++static struct class *i2c_class;
++
+ static int __init
+ i2c_register(void)
+ {
+@@ -693,7 +696,11 @@ i2c_register(void)
+       }
+       printk(KERN_INFO "I2C driver v2.2, (c) 1999-2004 Axis Communications AB\n");
+-      
++
++      i2c_class = class_create(THIS_MODULE, "i2c_etrax");
++      device_create(i2c_class, NULL,
++              MKDEV(I2C_MAJOR, 0), NULL, "i2c");
++
+       return 0;
+ }