27e13c2baf67b56eec16fd2fa7ed028c5bf99b6b
[openwrt/openwrt.git] / target / linux / etrax / patches-2.6.30 / 610-create-the-gpio-devices.patch
1 --- a/arch/cris/arch-v10/drivers/gpio.c
2 +++ b/arch/cris/arch-v10/drivers/gpio.c
3 @@ -21,6 +21,7 @@
4 #include <linux/poll.h>
5 #include <linux/init.h>
6 #include <linux/interrupt.h>
7 +#include <linux/device.h>
8
9 #include <asm/etraxgpio.h>
10 #include <arch/svinto.h>
11 @@ -771,6 +772,8 @@ static void ioif_watcher(const unsigned
12
13 /* main driver initialization routine, called from mem.c */
14
15 +static struct class *gp_class;
16 +
17 static int __init gpio_init(void)
18 {
19 int res;
20 @@ -784,6 +787,8 @@ static int __init gpio_init(void)
21 return res;
22 }
23
24 + gp_class = class_create(THIS_MODULE, "gpio_etrax");
25 +
26 /* Clear all leds */
27 #if defined (CONFIG_ETRAX_CSP0_LEDS) || defined (CONFIG_ETRAX_PA_LEDS) || defined (CONFIG_ETRAX_PB_LEDS)
28 CRIS_LED_NETWORK_SET(0);
29 @@ -796,6 +801,8 @@ static int __init gpio_init(void)
30 CRIS_LED_BIT_SET(i);
31 #endif
32
33 + device_create(gp_class, NULL,
34 + MKDEV(GPIO_MAJOR, 2), NULL, "leds");
35 #endif
36 /* The I/O interface allocation watcher will be called when
37 * registering it. */
38 @@ -822,6 +829,12 @@ static int __init gpio_init(void)
39 if (res)
40 printk(KERN_CRIT "err: PA irq for gpio\n");
41
42 + device_create(gp_class, NULL,
43 + MKDEV(GPIO_MAJOR, 0), NULL, "gpioa");
44 + device_create(gp_class, NULL,
45 + MKDEV(GPIO_MAJOR, 1), NULL, "gpiob");
46 + device_create(gp_class, NULL,
47 + MKDEV(GPIO_MAJOR, 3), NULL, "gpiog");
48 return res;
49 }
50