linux-2.6.31: use standard GPIO drivers for boc01
authorJeremy Lainé <jeremy.laine@m4x.org>
Wed, 28 Oct 2009 15:20:11 +0000 (16:20 +0100)
committerJeremy Lainé <jeremy.laine@m4x.org>
Wed, 28 Oct 2009 15:20:11 +0000 (16:20 +0100)
recipes/linux/linux-2.6.31/boc01/011-090115-gpio.patch [deleted file]
recipes/linux/linux-2.6.31/boc01/011-091028-gpio.patch [new file with mode: 0644]
recipes/linux/linux-2.6.31/boc01/boc01.dts
recipes/linux/linux-2.6.31/boc01/boc01.dts.v1
recipes/linux/linux-2.6.31/boc01/defconfig
recipes/linux/linux_2.6.31.bb

diff --git a/recipes/linux/linux-2.6.31/boc01/011-090115-gpio.patch b/recipes/linux/linux-2.6.31/boc01/011-090115-gpio.patch
deleted file mode 100644 (file)
index fd20dcc..0000000
+++ /dev/null
@@ -1,440 +0,0 @@
-Index: linux-2.6.29/drivers/char/Kconfig
-===================================================================
---- linux-2.6.29.orig/drivers/char/Kconfig     2009-03-24 00:12:14.000000000 +0100
-+++ linux-2.6.29/drivers/char/Kconfig  2009-04-01 17:37:55.000000000 +0200
-@@ -1020,6 +1020,24 @@
-       tristate "NEC VR4100 series General-purpose I/O Unit support"
-       depends on CPU_VR41XX
-+config GPIO_MPC8313
-+      tristate "mpc8313e gpio"
-+      depends on PPC_MPC831x
-+      select INPUT
-+      default y
-+      help
-+        Give userspace access to the GPIO pins on the MPC8313E devices.
-+
-+config EXIO_MPC8313
-+      tristate "mpc8313e exio"
-+      depends on PPC_MPC831x
-+      select INPUT
-+      select LEDS_CLASS
-+      default y
-+      help
-+        Give userspace access to the Extenrder IO pins on the CPE board.
-+
-+
- config RAW_DRIVER
-       tristate "RAW driver (/dev/raw/rawN)"
-       depends on BLOCK
-Index: linux-2.6.29/drivers/char/Makefile
-===================================================================
---- linux-2.6.29.orig/drivers/char/Makefile    2009-03-24 00:12:14.000000000 +0100
-+++ linux-2.6.29/drivers/char/Makefile 2009-04-01 17:37:55.000000000 +0200
-@@ -109,6 +109,8 @@
- obj-$(CONFIG_PS3_FLASH)               += ps3flash.o
- obj-$(CONFIG_JS_RTC)          += js-rtc.o
-+obj-$(CONFIG_GPIO_MPC8313)                    += mpc8313e_gpio.o
-+obj-$(CONFIG_EXIO_MPC8313)                    += mpc8313e_exio.o
- js-rtc-y = rtc.o
- # Files generated that shall be removed upon make clean
-Index: linux-2.6.29/drivers/char/mpc8313e_exio.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29/drivers/char/mpc8313e_exio.c  2009-04-01 17:37:55.000000000 +0200
-@@ -0,0 +1,240 @@
-+/*
-+* CPE Extender io driver
-+*
-+* Copyright (C) 2007, CenoSYS (www.cenosys.com).
-+*
-+* Alexandre Coffignal <alexandre.coffignal@cenosys.com>
-+* Sylvain Giroudon <sylvain.giroudon@goobie.fr>
-+*
-+* This software program is licensed subject to the GNU General Public License
-+* (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
-+*
-+* Allows a user space process to control the EXIO pins.
-+*
-+*/
-+
-+#include <linux/fs.h>
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <asm/uaccess.h>
-+#include <asm/io.h>
-+#include <linux/of_platform.h>
-+#include <sysdev/fsl_soc.h>
-+#include <linux/cdev.h>
-+#include <linux/leds.h>
-+
-+static char module_name[] = "exio";
-+
-+
-+#define NB_EXIO               8
-+#define DEFAULT_STATE 0x58
-+#define EXIO_BASE 0xfa000000
-+#define EXIO_SIZE 0x2
-+#define EXIO_LED_MASK 0x01
-+
-+static int major = 0;
-+static u8 exio_state = DEFAULT_STATE;
-+static void *exio_io = NULL;
-+static struct resource *exio_mem = NULL;
-+static struct class * exio_class = NULL;
-+
-+
-+static void
-+exio_led_set(struct led_classdev *led_cdev,
-+           enum led_brightness value)
-+{
-+      if ( value )
-+              exio_state &= ~EXIO_LED_MASK;
-+      else
-+              exio_state |= EXIO_LED_MASK;
-+
-+      iowrite8(exio_state, exio_io);
-+}
-+
-+static struct led_classdev exio_led = {
-+      .name = "boc:blue:status",
-+      .brightness_set = exio_led_set,
-+};
-+
-+static inline int
-+exio_led_init(void)
-+{
-+      return led_classdev_register(NULL, &exio_led);
-+}
-+
-+
-+static inline void
-+exio_led_exit(void)
-+{
-+      led_classdev_unregister(&exio_led);
-+}
-+
-+
-+static inline void
-+exio_led_suspend(void)
-+{
-+      led_classdev_suspend(&exio_led);
-+}
-+
-+
-+static inline void
-+exio_led_resume(void)
-+{
-+      led_classdev_resume(&exio_led);
-+}
-+
-+
-+static ssize_t exio_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
-+{
-+      unsigned m = iminor(file->f_path.dentry->d_inode);
-+      size_t i;
-+      char mask;
-+      int err = 0;
-+
-+      for (i = 0; i < len; ++i) {
-+              char c;
-+              if (get_user(c, data + i))
-+                      return -EFAULT;
-+
-+              mask=(1<<(7-m));
-+              switch (c) {
-+              case '0':
-+                      /*Clear exio level */
-+                      exio_state&=~mask;
-+                      iowrite8(exio_state, exio_io);
-+                      break;
-+              case '1':
-+                      /*Set exio level */
-+                      exio_state|=mask;
-+                      iowrite8(exio_state, exio_io);
-+                      break;
-+              default:
-+                      printk(KERN_DEBUG "exio%2d bad setting: chr<0x%2x>\n",
-+                              m, (int)c);
-+                      err++;
-+              }
-+      }
-+      if (err)
-+              return -EINVAL;
-+
-+      return len;
-+}
-+
-+
-+static ssize_t exio_read(struct file *file, char __user * buf,
-+              size_t len, loff_t * ppos)
-+{
-+      unsigned m = iminor(file->f_path.dentry->d_inode);
-+      int value;
-+      char mask;
-+      char state=ioread8(exio_io);
-+
-+      mask=(1<<(7-m));
-+      value=state&mask;
-+      if (put_user(value ? '1' : '0', buf))
-+              return -EFAULT;
-+      return 1;
-+
-+}
-+
-+static int exio_open(struct inode *inode, struct file *file)
-+{
-+    return 0;
-+}
-+
-+static int exio_close(struct inode *inode, struct file *file)
-+{
-+    printk(KERN_DEBUG "close()\n");
-+    return 0;
-+}
-+
-+struct file_operations exio_fops =
-+{
-+      .owner   = THIS_MODULE,
-+      .read    = exio_read,
-+      .write   = exio_write,
-+      .open    = exio_open,
-+      .release = exio_close  /* correspond a close */
-+};
-+
-+
-+static void exio_cleanup(void)
-+{
-+      if ( exio_mem )
-+              release_mem_region(EXIO_BASE, EXIO_SIZE);
-+      exio_mem = NULL;
-+      exio_io = NULL;
-+
-+      if ( exio_class )
-+              class_destroy(exio_class);
-+      exio_class = NULL;
-+
-+      unregister_chrdev(major, module_name);
-+}
-+
-+
-+static int __init exio_init(void)
-+{
-+      int rc, i;
-+
-+      rc = register_chrdev(major, module_name, &exio_fops);
-+      if ( rc < 0 )
-+              return rc;
-+
-+      if ( major == 0 ) {
-+              major = rc;  /* accept dynamic major number */
-+              printk(KERN_INFO "%s: successfully loaded with major %d\n",module_name, major);
-+      }
-+
-+      exio_class = class_create(THIS_MODULE, "exio");
-+      if ( exio_class == NULL )
-+              goto out_cleanup;
-+
-+      for (i = 0; i < NB_EXIO; i++) {
-+              device_create(exio_class, NULL, MKDEV(major, i) ,NULL, "exio%i", i);
-+      }
-+
-+      /* System I/O Configuration Register Low */
-+      exio_mem = request_mem_region(EXIO_BASE, EXIO_SIZE, "exio");
-+      if ( exio_mem == NULL )
-+              goto out_cleanup;
-+
-+      exio_io = ioremap(EXIO_BASE, EXIO_SIZE);
-+      if ( exio_io == NULL )
-+              goto out_cleanup;
-+
-+      /* Output default exio state */
-+      iowrite8(exio_state, exio_io);
-+
-+      /* Register led class entry for driving the Status led */
-+      exio_led_init();
-+
-+      return 0;
-+
-+out_cleanup:
-+      exio_cleanup();
-+      return -ENOMEM;
-+}
-+
-+static void __exit exio_exit(void)
-+{
-+      /* Unregister Status led */
-+      exio_led_exit();
-+
-+      /* Cleanup all other gears */
-+      exio_cleanup();
-+}
-+
-+
-+module_param(major, int, 0644);
-+MODULE_PARM_DESC(major, "Static major number (none = dynamic)");
-+MODULE_AUTHOR("Alexandre Coffignal <alexandre.coffignal@cenosys.com>");
-+MODULE_DESCRIPTION("boc01 exio management");
-+MODULE_LICENSE("GPL");
-+
-+module_init(exio_init);
-+module_exit(exio_exit);
-+
-+
-Index: linux-2.6.29/drivers/char/mpc8313e_gpio.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29/drivers/char/mpc8313e_gpio.c  2009-04-01 17:37:55.000000000 +0200
-@@ -0,0 +1,148 @@
-+/*
-+* mpc8313e gpio driver
-+*
-+*
-+* Copyright (C) 2007, CenoSYS (www.cenosys.com).
-+* Alexandre Coffignal
-+* alexandre.coffignal@cenosys.com
-+*
-+* This software program is licensed subject to the GNU General Public License
-+* (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
-+*
-+* Allows a user space process to control the GPIO pins.
-+*
-+*/
-+
-+#include <linux/fs.h>
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <asm/uaccess.h>
-+#include <asm/io.h>
-+#include <linux/of_platform.h>
-+#include <sysdev/fsl_soc.h>
-+
-+static char module_name[] = "gpio";
-+#define NB_GPIO       8
-+static int major = 0;
-+struct gpio {
-+      __be32 gpdir;
-+      __be32 gpodr;
-+      __be32 gpdat;
-+      __be32 gpier;
-+      __be32 gpimr;
-+      __be32 gpicr;
-+} __attribute__ ((packed));
-+static struct gpio *gpio_regs;
-+
-+static ssize_t mpc8313e_gpio_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
-+{
-+      unsigned m = iminor(file->f_path.dentry->d_inode);
-+      size_t i;
-+      int err = 0;
-+
-+      for (i = 0; i < len; ++i) {
-+              char c;
-+              if (get_user(c, data + i))
-+                      return -EFAULT;
-+              /* set GPIO as output */
-+              setbits32(&gpio_regs->gpdir, 1 << (31 - m));
-+              clrbits32(&gpio_regs->gpodr, 1 << (31 - m));
-+              switch (c) {
-+              case '0':
-+                      /*Set GPIO level */
-+                      clrbits32(&gpio_regs->gpdat, 1 << (31 - m));
-+                      break;
-+              case '1':
-+                      /*Set GPIO level */
-+                      setbits32(&gpio_regs->gpdat, 1 << (31 - m));
-+                      break;
-+              default:
-+                      printk(KERN_DEBUG "io%2d bad setting: chr<0x%2x>\n",
-+                              m, (int)c);
-+                      err++;
-+              }
-+      }
-+      if (err)
-+              return -EINVAL;
-+
-+      return len;
-+}
-+
-+static ssize_t mpc8313e_gpio_read(struct file *file, char __user * buf, size_t len, loff_t * ppos)
-+{
-+      unsigned m = iminor(file->f_path.dentry->d_inode);
-+      int value;
-+      value=in_be32(&gpio_regs->gpdat)&(1 << (31 - m));
-+      if (put_user(value ? '1' : '0', buf))
-+              return -EFAULT;
-+      return 1;
-+
-+
-+}
-+
-+
-+
-+static int mpc8313e_gpio_open(struct inode *inode, struct file *file)
-+{
-+    return 0;
-+}
-+
-+static int mpc8313e_gpio_close(struct inode *inode, struct file *file)
-+{
-+    return 0;
-+}
-+
-+struct file_operations mpc8313e_gpio_fops =
-+{
-+      .owner =        THIS_MODULE,
-+    .read = mpc8313e_gpio_read,
-+    .write = mpc8313e_gpio_write,
-+    .open = mpc8313e_gpio_open,
-+    .release = mpc8313e_gpio_close
-+};
-+static struct class * gpio_class;
-+static int __init mpc8313e_gpio_init(void)
-+{
-+      int rc,i;
-+
-+      rc = register_chrdev(major, module_name, &mpc8313e_gpio_fops);
-+      if (rc < 0) {
-+              return rc;
-+      }
-+
-+      if (major == 0) {
-+              major = rc;  /* accept dynamic major number */
-+              printk(KERN_INFO "%s: successfully loaded with major %d\n",module_name, major);
-+
-+      }
-+      gpio_class = class_create(THIS_MODULE, "gpio");
-+
-+      for (i = 0; i < NB_GPIO; i++)
-+      {
-+              device_create(gpio_class, NULL, MKDEV(major, i) ,NULL, "gpio%d",i);
-+
-+      }
-+
-+      /* System I/O Configuration Register Low */
-+      gpio_regs = ioremap(get_immrbase() + 0xc00, 0x20);
-+      if (!gpio_regs)
-+              return -ENOMEM;
-+    return 0;
-+}
-+
-+static void __exit mpc8313e_gpio_cleanup(void)
-+{
-+    unregister_chrdev(major, module_name);
-+}
-+module_param(major, int, 0644);
-+MODULE_PARM_DESC(major, "Static major number (none = dynamic)");
-+MODULE_AUTHOR("Alexandre Coffignal <alexandre.coffignal@cenosys.com>");
-+MODULE_DESCRIPTION("mpc8313e GPIO");
-+MODULE_LICENSE("GPL");
-+
-+module_init(mpc8313e_gpio_init);
-+module_exit(mpc8313e_gpio_cleanup);
-+
-+
diff --git a/recipes/linux/linux-2.6.31/boc01/011-091028-gpio.patch b/recipes/linux/linux-2.6.31/boc01/011-091028-gpio.patch
new file mode 100644 (file)
index 0000000..2e37e81
--- /dev/null
@@ -0,0 +1,22 @@
+Index: linux-2.6.31/arch/powerpc/platforms/83xx/mpc831x_rdb.c
+===================================================================
+--- linux-2.6.31.orig/arch/powerpc/platforms/83xx/mpc831x_rdb.c        2009-10-28 14:56:44.000000000 +0100
++++ linux-2.6.31/arch/powerpc/platforms/83xx/mpc831x_rdb.c     2009-10-28 15:44:23.000000000 +0100
+@@ -20,6 +20,7 @@
+ #include <asm/ipic.h>
+ #include <asm/udbg.h>
+ #include <sysdev/fsl_pci.h>
++#include <sysdev/simple_gpio.h>
+ #include "mpc83xx.h"
+@@ -79,6 +80,9 @@
+ static int __init declare_of_platform_devices(void)
+ {
++      /* memory-mapped IO extender */
++      simple_gpiochip_init("fsl,mpc8313-exio");
++
+       of_platform_bus_probe(NULL, of_bus_ids, NULL);
+       return 0;
+ }
index 73b6044..95b5b8e 100644 (file)
                        compatible = "fsl,mpc8313-fcm-nand",
                                     "fsl,elbc-fcm-nand";
                        reg = <0x1 0x0 0x2000>;
+               };
 
-                       kernel@0 {
-                               reg = <0x0 0x400000>;
-                               read-only;
-                       };
-
-                       fs@400000 {
-                               reg = <0x400000 0x4000000>;
-                       };
-
-                       appli@4400000 {
-                               reg = <0x4400000 0x3c00000>;
-                       };
+               exio: gpio-controller@3,0 {
+                       #gpio-cells = <2>;
+                       compatible = "fsl,mpc8313-exio";
+                       reg = <0x3 0x0 0x1>;
+                       interrupts = <75 0x8>;
+                       interrupt-parent = <&ipic>;
+                       gpio-controller;
                };
        };
 
                        reg = <0x200 0x100>;
                };
 
-               gpio0: gpio-controller@c00 {
+               gpio: gpio-controller@c00 {
                        #gpio-cells = <2>;
                        compatible = "fsl,mpc8313-gpio", "fsl,mpc8349-gpio";
                        reg = <0xc00 0x100>;
                        mode = "cpu";
 
                        /* gpio representing chip select */
-                       gpios = <&gpio0 14 0>;
+                       gpios = <&gpio 14 0>;
 
                        rfid@0 {
                                compatible = "nxp,spidev";
index bf499b1..eed1721 100644 (file)
                        compatible = "fsl,mpc8313-fcm-nand",
                                     "fsl,elbc-fcm-nand";
                        reg = <0x1 0x0 0x2000>;
+               };
 
-                       kernel@0 {
-                               reg = <0x0 0x400000>;
-                               read-only;
-                       };
-
-                       fs@400000 {
-                               reg = <0x400000 0x4000000>;
-                       };
-
-                       appli@4400000 {
-                               reg = <0x4400000 0x3c00000>;
-                       };
+               exio: gpio-controller@3,0 {
+                       #gpio-cells = <2>;
+                       compatible = "fsl,mpc8313-exio";
+                       reg = <0x3 0x0 0x1>;
+                       interrupts = <75 0x8>;
+                       interrupt-parent = <&ipic>;
+                       gpio-controller;
                };
        };
 
                        reg = <0x200 0x100>;
                };
 
-               gpio0: gpio-controller@c00 {
+               gpio: gpio-controller@c00 {
                        #gpio-cells = <2>;
                        compatible = "fsl,mpc8313-gpio", "fsl,mpc8349-gpio";
                        reg = <0xc00 0x100>;
                        mode = "cpu";
 
                        /* gpio representing chip select */
-                       gpios = <&gpio0 14 0>;
+                       gpios = <&gpio 14 0>;
 
                        rfid@0 {
                                compatible = "nxp,spidev";
index 3b84e43..ad7856c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.31.3
-# Tue Oct 20 14:52:00 2009
+# Wed Oct 28 11:48:05 2009
 #
 # CONFIG_PPC64 is not set
 
@@ -99,8 +99,7 @@ CONFIG_FAIR_GROUP_SCHED=y
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
 # CONFIG_CGROUPS is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_SYSFS_DEPRECATED_V2 is not set
 # CONFIG_RELAY is not set
 # CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
@@ -227,7 +226,7 @@ CONFIG_IPIC=y
 # CONFIG_QUICC_ENGINE is not set
 # CONFIG_FSL_ULI1575 is not set
 CONFIG_MPC8xxx_GPIO=y
-# CONFIG_SIMPLE_GPIO is not set
+CONFIG_SIMPLE_GPIO=y
 # CONFIG_MCU_MPC8349EMITX is not set
 
 #
@@ -1067,7 +1066,16 @@ CONFIG_INPUT_EVBUG=y
 #
 # Input Device Drivers
 #
-# CONFIG_INPUT_KEYBOARD is not set
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_LM8323 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TABLET is not set
@@ -1129,8 +1137,6 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_NVRAM is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-CONFIG_GPIO_MPC8313=y
-CONFIG_EXIO_MPC8313=y
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
@@ -1222,7 +1228,7 @@ CONFIG_SPI_SPIDEV=y
 CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_GPIOLIB=y
-# CONFIG_GPIO_SYSFS is not set
+CONFIG_GPIO_SYSFS=y
 
 #
 # Memory mapped GPIO expanders:
@@ -1671,7 +1677,9 @@ CONFIG_LEDS_CLASS=y
 # LED drivers
 #
 # CONFIG_LEDS_PCA9532 is not set
-# CONFIG_LEDS_GPIO is not set
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_GPIO_PLATFORM=y
+CONFIG_LEDS_GPIO_OF=y
 # CONFIG_LEDS_LP3944 is not set
 # CONFIG_LEDS_PCA955X is not set
 # CONFIG_LEDS_DAC124S085 is not set
@@ -1684,7 +1692,7 @@ CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_BACKLIGHT=y
-# CONFIG_LEDS_TRIGGER_GPIO is not set
+CONFIG_LEDS_TRIGGER_GPIO=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 
 #
index 70d55e9..1c45a58 100644 (file)
@@ -6,6 +6,7 @@ S = "${WORKDIR}/linux-${PV}"
 
 # Mark archs/machines that this kernel supports
 DEFAULT_PREFERENCE = "-1"
+DEFAULT_PREFERENCE_boc01 = "1"
 DEFAULT_PREFERENCE_db1200 = "1"
 DEFAULT_PREFERENCE_qemumips = "1"
 DEFAULT_PREFERENCE_qemux86 = "1"
@@ -21,7 +22,7 @@ SRC_URI_append_boc01 = "\
            file://004-081205-usb.patch;patch=1 \
            file://005-091008-isl12024.patch;patch=1 \
            file://007-091005-lm73.patch;patch=1 \
-           file://011-090115-gpio.patch;patch=1 \
+           file://011-091028-gpio.patch;patch=1 \
            file://012-091019-capsense.patch;patch=1 \
            file://013-091015-lcd.patch;patch=1 \
            "