Implement sysfs interface for some specific cris driver

SVN-Revision: 17805
This commit is contained in:
Claudio Mignanti 2009-10-01 15:44:28 +00:00
parent 054c54512f
commit ef368dfc05
3 changed files with 126 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}