omap24xx: remove obsolete kernel 3.3 patches

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 46947
v19.07.3_mercusys_ac12_duma
Felix Fietkau 9 years ago
parent e2ffe8f1b9
commit f74116e599

@ -1,897 +0,0 @@
--- /dev/null
+++ b/arch/arm/plat-omap/bootreason.c
@@ -0,0 +1,79 @@
+/*
+ * linux/arch/arm/plat-omap/bootreason.c
+ *
+ * OMAP Bootreason passing
+ *
+ * Copyright (c) 2004 Nokia
+ *
+ * Written by David Weinehall <david.weinehall@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <linux/proc_fs.h>
+#include <linux/errno.h>
+#include <plat/board.h>
+
+static char boot_reason[16];
+
+static int omap_bootreason_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len = 0;
+
+ len += sprintf(page + len, "%s\n", boot_reason);
+
+ *start = page + off;
+
+ if (len > off)
+ len -= off;
+ else
+ len = 0;
+
+ return len < count ? len : count;
+}
+
+static int __init bootreason_init(void)
+{
+ const struct omap_boot_reason_config *cfg;
+ int reason_valid = 0;
+
+ cfg = omap_get_config(OMAP_TAG_BOOT_REASON, struct omap_boot_reason_config);
+ if (cfg != NULL) {
+ strncpy(boot_reason, cfg->reason_str, sizeof(cfg->reason_str));
+ boot_reason[sizeof(cfg->reason_str)] = 0;
+ reason_valid = 1;
+ } else {
+ /* Read the boot reason from the OMAP registers */
+ }
+
+ if (!reason_valid)
+ return -ENOENT;
+
+ printk(KERN_INFO "Bootup reason: %s\n", boot_reason);
+
+ if (!create_proc_read_entry("bootreason", S_IRUGO, NULL,
+ omap_bootreason_read_proc, NULL))
+ return -ENOMEM;
+
+ return 0;
+}
+
+late_initcall(bootreason_init);
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -24,18 +24,90 @@
#include <plat/omap-secure.h>
+#include <asm/setup.h>
+
#define NO_LENGTH_CHECK 0xffffffff
struct omap_board_config_kernel *omap_board_config __initdata;
int omap_board_config_size;
+unsigned char omap_bootloader_tag[1024];
+int omap_bootloader_tag_len;
+
+/* used by omap-smp.c and board-4430sdp.c */
+void __iomem *gic_cpu_base_addr;
+
+#ifdef CONFIG_OMAP_BOOT_TAG
+
+static int __init parse_tag_omap(const struct tag *tag)
+{
+ u32 size = tag->hdr.size - (sizeof(tag->hdr) >> 2);
+
+ size <<= 2;
+ if (size > sizeof(omap_bootloader_tag))
+ return -1;
+
+ memcpy(omap_bootloader_tag, tag->u.omap.data, size);
+ omap_bootloader_tag_len = size;
+
+ return 0;
+}
+
+__tagtable(ATAG_BOARD, parse_tag_omap);
+
+#endif
+
static const void *__init get_config(u16 tag, size_t len,
int skip, size_t *len_out)
{
struct omap_board_config_kernel *kinfo = NULL;
int i;
+#ifdef CONFIG_OMAP_BOOT_TAG
+ struct omap_board_config_entry *info = NULL;
+
+ if (omap_bootloader_tag_len > 4)
+ info = (struct omap_board_config_entry *) omap_bootloader_tag;
+ while (info != NULL) {
+ u8 *next;
+
+ if (info->tag == tag) {
+ if (skip == 0)
+ break;
+ skip--;
+ }
+
+ if ((info->len & 0x03) != 0) {
+ /* We bail out to avoid an alignment fault */
+ printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
+ info->len, info->tag);
+ return NULL;
+ }
+ next = (u8 *) info + sizeof(*info) + info->len;
+ if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
+ info = NULL;
+ else
+ info = (struct omap_board_config_entry *) next;
+ }
+ if (info != NULL) {
+ /* Check the length as a lame attempt to check for
+ * binary inconsistency. */
+ if (len != NO_LENGTH_CHECK) {
+ /* Word-align len */
+ if (len & 0x03)
+ len = (len + 3) & ~0x03;
+ if (info->len != len) {
+ printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
+ tag, len, info->len);
+ return NULL;
+ }
+ }
+ if (len_out != NULL)
+ *len_out = info->len;
+ return info->data;
+ }
+#endif
/* Try to find the config from the board-specific structures
* in the kernel. */
for (i = 0; i < omap_board_config_size; i++) {
--- /dev/null
+++ b/arch/arm/plat-omap/component-version.c
@@ -0,0 +1,64 @@
+/*
+ * linux/arch/arm/plat-omap/component-version.c
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/proc_fs.h>
+#include <plat/board.h>
+
+static int component_version_read_proc(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len, i;
+ const struct omap_version_config *ver;
+ char *p;
+
+ i = 0;
+ p = page;
+ while ((ver = omap_get_nr_config(OMAP_TAG_VERSION_STR,
+ struct omap_version_config, i)) != NULL) {
+ p += sprintf(p, "%-12s%s\n", ver->component, ver->version);
+ i++;
+ }
+
+ len = (p - page) - off;
+ if (len < 0)
+ len = 0;
+
+ *eof = (len <= count) ? 1 : 0;
+ *start = page + off;
+
+ return len;
+}
+
+static int __init component_version_init(void)
+{
+ if (omap_get_config(OMAP_TAG_VERSION_STR, struct omap_version_config) == NULL)
+ return -ENODEV;
+ if (!create_proc_read_entry("component_version", S_IRUGO, NULL,
+ component_version_read_proc, NULL))
+ return -ENOMEM;
+
+ return 0;
+}
+
+static void __exit component_version_exit(void)
+{
+ remove_proc_entry("component_version", NULL);
+}
+
+late_initcall(component_version_init);
+module_exit(component_version_exit);
+
+MODULE_AUTHOR("Juha Yrjölä <juha.yrjola@nokia.com>");
+MODULE_DESCRIPTION("Component version driver");
+MODULE_LICENSE("GPL");
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -84,6 +84,38 @@ config OMAP_RESET_CLOCKS
probably do not want this option enabled until your
device drivers work properly.
+config OMAP_BOOT_TAG
+ bool "OMAP bootloader information passing"
+ depends on ARCH_OMAP
+ default n
+ help
+ Say Y, if you have a bootloader which passes information
+ about your board and its peripheral configuration.
+
+config OMAP_BOOT_REASON
+ bool "Support for boot reason"
+ depends on OMAP_BOOT_TAG
+ default n
+ help
+ Say Y, if you want to have a procfs entry for reading the boot
+ reason in user-space.
+
+config OMAP_COMPONENT_VERSION
+ bool "Support for component version display"
+ depends on OMAP_BOOT_TAG && PROC_FS
+ default n
+ help
+ Say Y, if you want to have a procfs entry for reading component
+ versions (supplied by the bootloader) in user-space.
+
+config OMAP_GPIO_SWITCH
+ bool "GPIO switch support"
+ help
+ Say Y, if you want to have support for reporting of GPIO
+ switches (e.g. cover switches) via sysfs. Your bootloader has
+ to provide information about the switches to the kernel via the
+ ATAG_BOARD mechanism if they're not defined by the board config.
+
config OMAP_MUX
bool "OMAP multiplexing support"
depends on ARCH_OMAP
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -20,6 +20,9 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_device.
obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
+obj-$(CONFIG_OMAP_BOOT_REASON) += bootreason.o
+obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o
+obj-$(CONFIG_OMAP_GPIO_SWITCH) += gpio-switch.o
obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -136,6 +136,13 @@ struct tag_acorn {
__u8 adfsdrives;
};
+/* TI OMAP specific information */
+#define ATAG_BOARD 0x414f4d50
+
+struct tag_omap {
+ u8 data[0];
+};
+
/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
#define ATAG_MEMCLK 0x41000402
@@ -162,6 +169,11 @@ struct tag {
struct tag_acorn acorn;
/*
+ * OMAP specific
+ */
+ struct tag_omap omap;
+
+ /*
* DC21285 specific
*/
struct tag_memclk memclk;
--- /dev/null
+++ b/arch/arm/plat-omap/gpio-switch.c
@@ -0,0 +1,554 @@
+/*
+ * linux/arch/arm/plat-omap/gpio-switch.c
+ *
+ * Copyright (C) 2004-2006 Nokia Corporation
+ * Written by Juha Yrjölä <juha.yrjola@nokia.com>
+ * and Paul Mundt <paul.mundt@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/sched.h>
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/timer.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+#include <linux/gpio.h>
+#include <plat/hardware.h>
+#include <plat/irqs.h>
+#include <plat/mux.h>
+#include <plat/board.h>
+#include <plat/gpio-switch.h>
+
+struct gpio_switch {
+ char name[14];
+ u16 gpio;
+ unsigned flags:4;
+ unsigned type:4;
+ unsigned state:1;
+ unsigned both_edges:1;
+
+ u16 debounce_rising;
+ u16 debounce_falling;
+
+ void (* notify)(void *data, int state);
+ void *notify_data;
+
+ struct work_struct work;
+ struct timer_list timer;
+ struct platform_device pdev;
+
+ struct list_head node;
+};
+
+static LIST_HEAD(gpio_switches);
+static struct platform_device *gpio_sw_platform_dev;
+static struct platform_driver gpio_sw_driver;
+
+static const struct omap_gpio_switch *board_gpio_sw_table;
+static int board_gpio_sw_count;
+
+static const char *cover_str[2] = { "open", "closed" };
+static const char *connection_str[2] = { "disconnected", "connected" };
+static const char *activity_str[2] = { "inactive", "active" };
+
+/*
+ * GPIO switch state default debounce delay in ms
+ */
+#define OMAP_GPIO_SW_DEFAULT_DEBOUNCE 10
+
+static const char **get_sw_str(struct gpio_switch *sw)
+{
+ switch (sw->type) {
+ case OMAP_GPIO_SWITCH_TYPE_COVER:
+ return cover_str;
+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
+ return connection_str;
+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
+ return activity_str;
+ default:
+ BUG();
+ return NULL;
+ }
+}
+
+static const char *get_sw_type(struct gpio_switch *sw)
+{
+ switch (sw->type) {
+ case OMAP_GPIO_SWITCH_TYPE_COVER:
+ return "cover";
+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
+ return "connection";
+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
+ return "activity";
+ default:
+ BUG();
+ return NULL;
+ }
+}
+
+static void print_sw_state(struct gpio_switch *sw, int state)
+{
+ const char **str;
+
+ str = get_sw_str(sw);
+ if (str != NULL)
+ printk(KERN_INFO "%s (GPIO %d) is now %s\n", sw->name, sw->gpio, str[state]);
+}
+
+static int gpio_sw_get_state(struct gpio_switch *sw)
+{
+ int state;
+
+ state = gpio_get_value(sw->gpio);
+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
+ state = !state;
+
+ return state;
+}
+
+static ssize_t gpio_sw_state_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ struct gpio_switch *sw = dev_get_drvdata(dev);
+ const char **str;
+ char state[16];
+ int enable;
+
+ if (!(sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT))
+ return -EPERM;
+
+ if (sscanf(buf, "%15s", state) != 1)
+ return -EINVAL;
+
+ str = get_sw_str(sw);
+ if (strcmp(state, str[0]) == 0)
+ sw->state = enable = 0;
+ else if (strcmp(state, str[1]) == 0)
+ sw->state = enable = 1;
+ else
+ return -EINVAL;
+
+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
+ enable = !enable;
+ gpio_set_value(sw->gpio, enable);
+
+ return count;
+}
+
+static ssize_t gpio_sw_state_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct gpio_switch *sw = dev_get_drvdata(dev);
+ const char **str;
+
+ str = get_sw_str(sw);
+ return sprintf(buf, "%s\n", str[sw->state]);
+}
+
+static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, gpio_sw_state_show,
+ gpio_sw_state_store);
+
+static ssize_t gpio_sw_type_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct gpio_switch *sw = dev_get_drvdata(dev);
+
+ return sprintf(buf, "%s\n", get_sw_type(sw));
+}
+
+static DEVICE_ATTR(type, S_IRUGO, gpio_sw_type_show, NULL);
+
+static ssize_t gpio_sw_direction_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct gpio_switch *sw = dev_get_drvdata(dev);
+ int is_output;
+
+ is_output = sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT;
+ return sprintf(buf, "%s\n", is_output ? "output" : "input");
+}
+
+static DEVICE_ATTR(direction, S_IRUGO, gpio_sw_direction_show, NULL);
+
+
+static irqreturn_t gpio_sw_irq_handler(int irq, void *arg)
+{
+ struct gpio_switch *sw = arg;
+ unsigned long timeout;
+ int state;
+
+ if (!sw->both_edges) {
+ if (gpio_get_value(sw->gpio))
+ irq_set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQ_TYPE_EDGE_FALLING);
+ else
+ irq_set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQ_TYPE_EDGE_RISING);
+ }
+
+ state = gpio_sw_get_state(sw);
+ if (sw->state == state)
+ return IRQ_HANDLED;
+
+ if (state)
+ timeout = sw->debounce_rising;
+ else
+ timeout = sw->debounce_falling;
+ if (!timeout)
+ schedule_work(&sw->work);
+ else
+ mod_timer(&sw->timer, jiffies + msecs_to_jiffies(timeout));
+
+ return IRQ_HANDLED;
+}
+
+static void gpio_sw_timer(unsigned long arg)
+{
+ struct gpio_switch *sw = (struct gpio_switch *) arg;
+
+ schedule_work(&sw->work);
+}
+
+static void gpio_sw_handler(struct work_struct *work)
+{
+ struct gpio_switch *sw = container_of(work, struct gpio_switch, work);
+ int state;
+
+ state = gpio_sw_get_state(sw);
+ if (sw->state == state)
+ return;
+
+ sw->state = state;
+ if (sw->notify != NULL)
+ sw->notify(sw->notify_data, state);
+ sysfs_notify(&sw->pdev.dev.kobj, NULL, "state");
+ print_sw_state(sw, state);
+}
+
+static int __init can_do_both_edges(struct gpio_switch *sw)
+{
+ if (!cpu_class_is_omap1())
+ return 1;
+ if (OMAP_GPIO_IS_MPUIO(sw->gpio))
+ return 0;
+ else
+ return 1;
+}
+
+static void gpio_sw_release(struct device *dev)
+{
+}
+
+static int __init new_switch(struct gpio_switch *sw)
+{
+ int r, direction, trigger;
+
+ switch (sw->type) {
+ case OMAP_GPIO_SWITCH_TYPE_COVER:
+ case OMAP_GPIO_SWITCH_TYPE_CONNECTION:
+ case OMAP_GPIO_SWITCH_TYPE_ACTIVITY:
+ break;
+ default:
+ printk(KERN_ERR "invalid GPIO switch type: %d\n", sw->type);
+ return -EINVAL;
+ }
+
+ sw->pdev.name = sw->name;
+ sw->pdev.id = -1;
+
+ sw->pdev.dev.parent = &gpio_sw_platform_dev->dev;
+ sw->pdev.dev.driver = &gpio_sw_driver.driver;
+ sw->pdev.dev.release = gpio_sw_release;
+
+ r = platform_device_register(&sw->pdev);
+ if (r) {
+ printk(KERN_ERR "gpio-switch: platform device registration "
+ "failed for %s", sw->name);
+ return r;
+ }
+ dev_set_drvdata(&sw->pdev.dev, sw);
+
+ r = gpio_request(sw->gpio, "gpio-switch");
+ if (r < 0) {
+ platform_device_unregister(&sw->pdev);
+ return r;
+ }
+
+ /* input: 1, output: 0 */
+ direction = !(sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT);
+ if (direction)
+ gpio_direction_input(sw->gpio);
+ else
+ gpio_direction_output(sw->gpio, 0);
+
+ sw->state = gpio_sw_get_state(sw);
+
+ r = 0;
+ r |= device_create_file(&sw->pdev.dev, &dev_attr_state);
+ r |= device_create_file(&sw->pdev.dev, &dev_attr_type);
+ r |= device_create_file(&sw->pdev.dev, &dev_attr_direction);
+ if (r)
+ printk(KERN_ERR "gpio-switch: attribute file creation "
+ "failed for %s\n", sw->name);
+
+ if (!direction)
+ return 0;
+
+ if (can_do_both_edges(sw)) {
+ trigger = IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING;
+ sw->both_edges = 1;
+ } else {
+ if (gpio_get_value(sw->gpio))
+ trigger = IRQF_TRIGGER_FALLING;
+ else
+ trigger = IRQF_TRIGGER_RISING;
+ }
+ r = request_irq(OMAP_GPIO_IRQ(sw->gpio), gpio_sw_irq_handler,
+ IRQF_SHARED | trigger, sw->name, sw);
+ if (r < 0) {
+ printk(KERN_ERR "gpio-switch: request_irq() failed "
+ "for GPIO %d\n", sw->gpio);
+ platform_device_unregister(&sw->pdev);
+ gpio_free(sw->gpio);
+ return r;
+ }
+
+ INIT_WORK(&sw->work, gpio_sw_handler);
+ init_timer(&sw->timer);
+
+ sw->timer.function = gpio_sw_timer;
+ sw->timer.data = (unsigned long)sw;
+
+ list_add(&sw->node, &gpio_switches);
+
+ return 0;
+}
+
+static int __init add_atag_switches(void)
+{
+ const struct omap_gpio_switch_config *cfg;
+ struct gpio_switch *sw;
+ int i, r;
+
+ for (i = 0; ; i++) {
+ cfg = omap_get_nr_config(OMAP_TAG_GPIO_SWITCH,
+ struct omap_gpio_switch_config, i);
+ if (cfg == NULL)
+ break;
+ sw = kzalloc(sizeof(*sw), GFP_KERNEL);
+ if (sw == NULL) {
+ printk(KERN_ERR "gpio-switch: kmalloc failed\n");
+ return -ENOMEM;
+ }
+ strncpy(sw->name, cfg->name, sizeof(cfg->name));
+ sw->gpio = cfg->gpio;
+ sw->flags = cfg->flags;
+ sw->type = cfg->type;
+ sw->debounce_rising = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
+ sw->debounce_falling = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
+ if ((r = new_switch(sw)) < 0) {
+ kfree(sw);
+ return r;
+ }
+ }
+ return 0;
+}
+
+static struct gpio_switch * __init find_switch(int gpio, const char *name)
+{
+ struct gpio_switch *sw;
+
+ list_for_each_entry(sw, &gpio_switches, node) {
+ if ((gpio < 0 || sw->gpio != gpio) &&
+ (name == NULL || strcmp(sw->name, name) != 0))
+ continue;
+
+ if (gpio < 0 || name == NULL)
+ goto no_check;
+
+ if (strcmp(sw->name, name) != 0)
+ printk("gpio-switch: name mismatch for %d (%s, %s)\n",
+ gpio, name, sw->name);
+ else if (sw->gpio != gpio)
+ printk("gpio-switch: GPIO mismatch for %s (%d, %d)\n",
+ name, gpio, sw->gpio);
+no_check:
+ return sw;
+ }
+ return NULL;
+}
+
+static int __init add_board_switches(void)
+{
+ int i;
+
+ for (i = 0; i < board_gpio_sw_count; i++) {
+ const struct omap_gpio_switch *cfg;
+ struct gpio_switch *sw;
+ int r;
+
+ cfg = board_gpio_sw_table + i;
+ if (strlen(cfg->name) > sizeof(sw->name) - 1)
+ return -EINVAL;
+ /* Check whether we only update an existing switch
+ * or add a new switch. */
+ sw = find_switch(cfg->gpio, cfg->name);
+ if (sw != NULL) {
+ sw->debounce_rising = cfg->debounce_rising;
+ sw->debounce_falling = cfg->debounce_falling;
+ sw->notify = cfg->notify;
+ sw->notify_data = cfg->notify_data;
+ continue;
+ } else {
+ if (cfg->gpio < 0 || cfg->name == NULL) {
+ printk("gpio-switch: required switch not "
+ "found (%d, %s)\n", cfg->gpio,
+ cfg->name);
+ continue;
+ }
+ }
+ sw = kzalloc(sizeof(*sw), GFP_KERNEL);
+ if (sw == NULL) {
+ printk(KERN_ERR "gpio-switch: kmalloc failed\n");
+ return -ENOMEM;
+ }
+ strlcpy(sw->name, cfg->name, sizeof(sw->name));
+ sw->gpio = cfg->gpio;
+ sw->flags = cfg->flags;
+ sw->type = cfg->type;
+ sw->debounce_rising = cfg->debounce_rising;
+ sw->debounce_falling = cfg->debounce_falling;
+ sw->notify = cfg->notify;
+ sw->notify_data = cfg->notify_data;
+ if ((r = new_switch(sw)) < 0) {
+ kfree(sw);
+ return r;
+ }
+ }
+ return 0;
+}
+
+static void gpio_sw_cleanup(void)
+{
+ struct gpio_switch *sw = NULL, *old = NULL;
+
+ list_for_each_entry(sw, &gpio_switches, node) {
+ if (old != NULL)
+ kfree(old);
+ flush_scheduled_work();
+ del_timer_sync(&sw->timer);
+
+ free_irq(OMAP_GPIO_IRQ(sw->gpio), sw);
+
+ device_remove_file(&sw->pdev.dev, &dev_attr_state);
+ device_remove_file(&sw->pdev.dev, &dev_attr_type);
+ device_remove_file(&sw->pdev.dev, &dev_attr_direction);
+
+ platform_device_unregister(&sw->pdev);
+ gpio_free(sw->gpio);
+ old = sw;
+ }
+ kfree(old);
+}
+
+static void __init report_initial_state(void)
+{
+ struct gpio_switch *sw;
+
+ list_for_each_entry(sw, &gpio_switches, node) {
+ int state;
+
+ state = gpio_get_value(sw->gpio);
+ if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
+ state = !state;
+ if (sw->notify != NULL)
+ sw->notify(sw->notify_data, state);
+ print_sw_state(sw, state);
+ }
+}
+
+static int gpio_sw_remove(struct platform_device *dev)
+{
+ return 0;
+}
+
+static struct platform_driver gpio_sw_driver = {
+ .remove = gpio_sw_remove,
+ .driver = {
+ .name = "gpio-switch",
+ },
+};
+
+void __init omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
+ int count)
+{
+ BUG_ON(board_gpio_sw_table != NULL);
+
+ board_gpio_sw_table = tbl;
+ board_gpio_sw_count = count;
+}
+
+static int __init gpio_sw_init(void)
+{
+ int r;
+
+ printk(KERN_INFO "OMAP GPIO switch handler initializing\n");
+
+ r = platform_driver_register(&gpio_sw_driver);
+ if (r)
+ return r;
+
+ gpio_sw_platform_dev = platform_device_register_simple("gpio-switch",
+ -1, NULL, 0);
+ if (IS_ERR(gpio_sw_platform_dev)) {
+ r = PTR_ERR(gpio_sw_platform_dev);
+ goto err1;
+ }
+
+ r = add_atag_switches();
+ if (r < 0)
+ goto err2;
+
+ r = add_board_switches();
+ if (r < 0)
+ goto err2;
+
+ report_initial_state();
+
+ return 0;
+err2:
+ gpio_sw_cleanup();
+ platform_device_unregister(gpio_sw_platform_dev);
+err1:
+ platform_driver_unregister(&gpio_sw_driver);
+ return r;
+}
+
+static void __exit gpio_sw_exit(void)
+{
+ gpio_sw_cleanup();
+ platform_device_unregister(gpio_sw_platform_dev);
+ platform_driver_unregister(&gpio_sw_driver);
+}
+
+#ifndef MODULE
+late_initcall(gpio_sw_init);
+#else
+module_init(gpio_sw_init);
+#endif
+module_exit(gpio_sw_exit);
+
+MODULE_AUTHOR("Juha Yrjölä <juha.yrjola@nokia.com>, Paul Mundt <paul.mundt@nokia.com");
+MODULE_DESCRIPTION("GPIO switch driver");
+MODULE_LICENSE("GPL");
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -151,6 +151,14 @@ struct omap_board_config_kernel {
const void *data;
};
+struct omap_gpio_switch_config {
+ char name[12];
+ u16 gpio;
+ int flags:4;
+ int type:4;
+ int key_code:24; /* Linux key code */
+};
+
extern const void *__init __omap_get_config(u16 tag, size_t len, int nr);
#define omap_get_config(tag, type) \

File diff suppressed because it is too large Load Diff

@ -1,12 +0,0 @@
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -104,7 +104,9 @@ void tahvo_write_reg(struct device *chil
{
struct tahvo *tahvo = dev_get_drvdata(child->parent);
+ mutex_lock(&tahvo->mutex);
__tahvo_write_reg(tahvo, reg, val);
+ mutex_unlock(&tahvo->mutex);
}
EXPORT_SYMBOL(tahvo_write_reg);

@ -1,142 +0,0 @@
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -53,9 +53,6 @@ struct retu {
int irq;
- int ack;
- bool ack_pending;
-
int mask;
bool mask_pending;
@@ -191,9 +188,10 @@ static irqreturn_t retu_irq_handler(int
mutex_lock(&retu->mutex);
idr = __retu_read_reg(retu, RETU_REG_IDR);
imr = __retu_read_reg(retu, RETU_REG_IMR);
+ idr &= ~imr;
+ __retu_write_reg(retu, RETU_REG_IDR, idr);
mutex_unlock(&retu->mutex);
- idr &= ~imr;
if (!idr) {
dev_vdbg(retu->dev, "No IRQ, spurious?\n");
return IRQ_NONE;
@@ -232,15 +230,6 @@ static void retu_irq_unmask(struct irq_d
}
-static void retu_irq_ack(struct irq_data *data)
-{
- struct retu *retu = irq_data_get_irq_chip_data(data);
- int irq = data->irq;
-
- retu->ack |= (1 << (irq - retu->irq_base));
- retu->ack_pending = true;
-}
-
static void retu_bus_lock(struct irq_data *data)
{
struct retu *retu = irq_data_get_irq_chip_data(data);
@@ -257,11 +246,6 @@ static void retu_bus_sync_unlock(struct
retu->mask_pending = false;
}
- if (retu->ack_pending) {
- __retu_write_reg(retu, RETU_REG_IDR, retu->ack);
- retu->ack_pending = false;
- }
-
mutex_unlock(&retu->mutex);
}
@@ -271,7 +255,6 @@ static struct irq_chip retu_irq_chip = {
.irq_bus_sync_unlock = retu_bus_sync_unlock,
.irq_mask = retu_irq_mask,
.irq_unmask = retu_irq_unmask,
- .irq_ack = retu_irq_ack,
};
static inline void retu_irq_setup(int irq)
@@ -291,8 +274,7 @@ static void retu_irq_init(struct retu *r
for (irq = base; irq < end; irq++) {
irq_set_chip_data(irq, retu);
- irq_set_chip_and_handler(irq, &retu_irq_chip,
- handle_simple_irq);
+ irq_set_chip(irq, &retu_irq_chip);
irq_set_nested_thread(irq, 1);
retu_irq_setup(irq);
}
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -48,11 +48,9 @@ struct tahvo {
int irq_end;
int irq;
- int ack;
int mask;
unsigned int mask_pending:1;
- unsigned int ack_pending:1;
unsigned int is_betty:1;
};
@@ -138,9 +136,12 @@ static irqreturn_t tahvo_irq_handler(int
u16 id;
u16 im;
+ mutex_lock(&tahvo->mutex);
id = __tahvo_read_reg(tahvo, TAHVO_REG_IDR);
im = __tahvo_read_reg(tahvo, TAHVO_REG_IMR);
id &= ~im;
+ __tahvo_write_reg(tahvo, TAHVO_REG_IDR, id);
+ mutex_unlock(&tahvo->mutex);
if (!id) {
dev_vdbg(tahvo->dev, "No IRQ, spurious ?\n");
@@ -177,11 +178,6 @@ static void tahvo_irq_bus_sync_unlock(st
tahvo->mask_pending = false;
}
- if (tahvo->ack_pending) {
- __tahvo_write_reg(tahvo, TAHVO_REG_IDR, tahvo->ack);
- tahvo->ack_pending = false;
- }
-
mutex_unlock(&tahvo->mutex);
}
@@ -203,22 +199,12 @@ static void tahvo_irq_unmask(struct irq_
tahvo->mask_pending = true;
}
-static void tahvo_irq_ack(struct irq_data *data)
-{
- struct tahvo *tahvo = irq_data_get_irq_chip_data(data);
- int irq = data->irq;
-
- tahvo->ack |= (1 << (irq - tahvo->irq_base));
- tahvo->ack_pending = true;
-}
-
static struct irq_chip tahvo_irq_chip = {
.name = "tahvo",
.irq_bus_lock = tahvo_irq_bus_lock,
.irq_bus_sync_unlock = tahvo_irq_bus_sync_unlock,
.irq_mask = tahvo_irq_mask,
.irq_unmask = tahvo_irq_unmask,
- .irq_ack = tahvo_irq_ack,
};
static inline void tahvo_irq_setup(int irq)
@@ -238,8 +224,7 @@ static void tahvo_irq_init(struct tahvo
for (irq = base; irq < end; irq++) {
irq_set_chip_data(irq, tahvo);
- irq_set_chip_and_handler(irq, &tahvo_irq_chip,
- handle_simple_irq);
+ irq_set_chip(irq, &tahvo_irq_chip);
irq_set_nested_thread(irq, 1);
tahvo_irq_setup(irq);
}

@ -1,24 +0,0 @@
--- a/drivers/cbus/retu.c
+++ b/drivers/cbus/retu.c
@@ -451,7 +451,8 @@ static int __devinit retu_probe(struct p
(rev >> 4) & 0x07, rev & 0x0f);
/* Mask all RETU interrupts */
- __retu_write_reg(retu, RETU_REG_IMR, 0xffff);
+ retu->mask = 0xFFFF;
+ __retu_write_reg(retu, RETU_REG_IMR, retu->mask);
ret = request_threaded_irq(retu->irq, NULL, retu_irq_handler,
IRQF_ONESHOT, "retu", retu);
--- a/drivers/cbus/tahvo.c
+++ b/drivers/cbus/tahvo.c
@@ -346,7 +346,8 @@ static int __devinit tahvo_probe(struct
(rev >> 4) & 0x0f, rev & 0x0f);
/* Mask all TAHVO interrupts */
- __tahvo_write_reg(tahvo, TAHVO_REG_IMR, 0xffff);
+ tahvo->mask = 0xFFFF;
+ __tahvo_write_reg(tahvo, TAHVO_REG_IMR, tahvo->mask);
ret = request_threaded_irq(irq, NULL, tahvo_irq_handler,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,

@ -1,175 +0,0 @@
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -15,8 +15,11 @@
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/init.h>
+#include <linux/irq.h>
#include <linux/io.h>
#include <linux/stddef.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/cbus.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/usb/musb.h>
@@ -193,6 +196,110 @@ static struct omap_onenand_platform_data
};
#endif
+#if defined(CONFIG_CBUS) || defined(CONFIG_CBUS_MODULE)
+
+static struct cbus_host_platform_data n8x0_cbus_data = {
+ .clk_gpio = 66,
+ .dat_gpio = 65,
+ .sel_gpio = 64,
+};
+
+static struct platform_device n8x0_cbus_device = {
+ .name = "cbus",
+ .id = -1,
+ .dev = {
+ .platform_data = &n8x0_cbus_data,
+ },
+};
+
+static struct resource retu_resource[] = {
+ {
+ .start = -EINVAL, /* set later */
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct cbus_retu_platform_data n8x0_retu_data = {
+ .devid = CBUS_RETU_DEVICE_ID,
+};
+
+static struct platform_device retu_device = {
+ .name = "retu",
+ .id = -1,
+ .resource = retu_resource,
+ .num_resources = ARRAY_SIZE(retu_resource),
+ .dev = {
+ .platform_data = &n8x0_retu_data,
+ .parent = &n8x0_cbus_device.dev,
+ },
+};
+
+static struct resource tahvo_resource[] = {
+ {
+ .start = -EINVAL, /* set later */
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static struct platform_device tahvo_device = {
+ .name = "tahvo",
+ .id = -1,
+ .resource = tahvo_resource,
+ .num_resources = ARRAY_SIZE(tahvo_resource),
+ .dev = {
+ .parent = &n8x0_cbus_device.dev,
+ },
+};
+
+static void __init n8x0_cbus_init(void)
+{
+ int ret;
+
+ platform_device_register(&n8x0_cbus_device);
+
+ ret = gpio_request(108, "RETU irq");
+ if (ret < 0) {
+ pr_err("retu: Unable to reserve IRQ GPIO\n");
+ return;
+ }
+
+ ret = gpio_direction_input(108);
+ if (ret < 0) {
+ pr_err("retu: Unable to change gpio direction\n");
+ gpio_free(108);
+ return;
+ }
+
+ irq_set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
+ retu_resource[0].start = gpio_to_irq(108);
+ platform_device_register(&retu_device);
+
+ ret = gpio_request(111, "TAHVO irq");
+ if (ret) {
+ pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+ gpio_free(108);
+ return;
+ }
+
+ /* Set the pin as input */
+ ret = gpio_direction_input(111);
+ if (ret) {
+ pr_err("tahvo: Unable to change direction\n");
+ gpio_free(108);
+ gpio_free(111);
+ return;
+ }
+
+ tahvo_resource[0].start = gpio_to_irq(111);
+ platform_device_register(&tahvo_device);
+}
+
+#else
+static inline void __init n8x0_cbus_init(void)
+{
+}
+#endif
+
#if defined(CONFIG_MENELAUS) && \
(defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
@@ -671,6 +778,8 @@ static inline void board_serial_init(voi
static void __init n8x0_init_machine(void)
{
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
+ n8x0_cbus_init();
+
/* FIXME: add n810 spi devices */
spi_register_board_info(n800_spi_board_info,
ARRAY_SIZE(n800_spi_board_info));
--- /dev/null
+++ b/include/linux/platform_data/cbus.h
@@ -0,0 +1,38 @@
+/*
+ * cbus.h - CBUS platform_data definition
+ *
+ * Copyright (C) 2004 - 2009 Nokia Corporation
+ *
+ * Written by Felipe Balbi <felipe.balbi@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __INCLUDE_LINUX_CBUS_H
+#define __INCLUDE_LINUX_CBUS_H
+
+#define CBUS_RETU_DEVICE_ID 0x01
+#define CBUS_TAHVO_DEVICE_ID 0x02
+
+struct cbus_host_platform_data {
+ int dat_gpio;
+ int clk_gpio;
+ int sel_gpio;
+};
+
+struct cbus_retu_platform_data {
+ int devid;
+};
+
+#endif /* __INCLUDE_LINUX_CBUS_H */

@ -1,41 +0,0 @@
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -420,10 +420,10 @@ static void set_fb_fix(struct fb_info *f
fbi->screen_base = rg->vaddr;
if (!from_init) {
- mutex_lock(&fbi->mm_lock);
+ preempt_disable();
fix->smem_start = rg->paddr;
fix->smem_len = rg->size;
- mutex_unlock(&fbi->mm_lock);
+ preempt_enable();
} else {
fix->smem_start = rg->paddr;
fix->smem_len = rg->size;
@@ -933,10 +933,10 @@ static int omapfb_setup_mem(struct fb_in
* plane memory is dealloce'd, the other
* screen parameters in var / fix are invalid.
*/
- mutex_lock(&fbi->mm_lock);
+ preempt_disable();
fbi->fix.smem_start = 0;
fbi->fix.smem_len = 0;
- mutex_unlock(&fbi->mm_lock);
+ preempt_enable();
}
}
}
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1383,8 +1383,10 @@ fb_mmap(struct file *file, struct vm_are
}
/* frame buffer memory */
+ preempt_disable();
start = info->fix.smem_start;
len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
+ preempt_enable();
if (off >= len) {
/* memory mapped io */
off -= len;

@ -1,368 +0,0 @@
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -24,6 +24,7 @@
#include <linux/spi/spi.h>
#include <linux/usb/musb.h>
#include <sound/tlv320aic3x.h>
+#include <linux/spi/tsc2005.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -43,6 +44,66 @@ static int slot1_cover_open;
static int slot2_cover_open;
static struct device *mmc_device;
+#define RX51_TSC2005_RESET_GPIO 94
+#define RX51_TSC2005_IRQ_GPIO 106
+
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
+static struct tsc2005_platform_data tsc2005_config;
+static void rx51_tsc2005_set_reset(bool enable)
+{
+ gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
+}
+
+static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
+ .turbo_mode = 0,
+ .single_channel = 1,
+};
+#endif
+
+static void __init tsc2005_set_config(void)
+{
+ const struct omap_lcd_config *conf;
+
+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
+ if (conf != NULL) {
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
+ if (strcmp(conf->panel_name, "lph8923") == 0) {
+ tsc2005_config.ts_x_plate_ohm = 180;
+ tsc2005_config.ts_pressure_max = 2048;
+ tsc2005_config.ts_pressure_fudge = 2;
+ tsc2005_config.ts_x_max = 4096;
+ tsc2005_config.ts_x_fudge = 4;
+ tsc2005_config.ts_y_max = 4096;
+ tsc2005_config.ts_y_fudge = 7;
+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
+ tsc2005_config.ts_x_plate_ohm = 280;
+ tsc2005_config.ts_pressure_max = 2048;
+ tsc2005_config.ts_pressure_fudge = 2;
+ tsc2005_config.ts_x_max = 4096;
+ tsc2005_config.ts_x_fudge = 4;
+ tsc2005_config.ts_y_max = 4096;
+ tsc2005_config.ts_y_fudge = 7;
+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
+ } else {
+ printk(KERN_ERR "Unknown panel type, set default "
+ "touchscreen configuration\n");
+ tsc2005_config.ts_x_plate_ohm = 200;
+ }
+#endif
+ }
+}
+
+static struct omap2_mcspi_device_config mipid_mcspi_config = {
+ .turbo_mode = 0,
+ .single_channel = 1,
+};
+
+extern struct mipid_platform_data n8x0_mipid_platform_data;
+
+extern void n8x0_mipid_init(void);
+extern void n8x0_blizzard_init(void);
+
#define TUSB6010_ASYNC_CS 1
#define TUSB6010_SYNC_CS 4
#define TUSB6010_GPIO_INT 58
@@ -145,12 +206,29 @@ static struct omap2_mcspi_device_config
static struct spi_board_info n800_spi_board_info[] __initdata = {
{
+ .modalias = "lcd_mipid",
+ .bus_num = 1,
+ .chip_select = 1,
+ .max_speed_hz = 4000000,
+ .controller_data= &mipid_mcspi_config,
+ .platform_data = &n8x0_mipid_platform_data,
+ },
+ {
.modalias = "p54spi",
.bus_num = 2,
.chip_select = 0,
.max_speed_hz = 48000000,
.controller_data = &p54spi_mcspi_config,
},
+ {
+ .modalias = "tsc2005",
+ .bus_num = 1,
+ .chip_select = 0,
+ .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
+ .max_speed_hz = 6000000,
+ .controller_data = &tsc2005_mcspi_config,
+ .platform_data = &tsc2005_config,
+ },
};
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -781,6 +859,7 @@ static void __init n8x0_init_machine(voi
n8x0_cbus_init();
/* FIXME: add n810 spi devices */
+ tsc2005_set_config();
spi_register_board_info(n800_spi_board_info,
ARRAY_SIZE(n800_spi_board_info));
omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
@@ -790,6 +869,8 @@ static void __init n8x0_init_machine(voi
i2c_register_board_info(2, n810_i2c_board_info_2,
ARRAY_SIZE(n810_i2c_board_info_2));
board_serial_init();
+ n8x0_mipid_init();
+ n8x0_blizzard_init();
omap_sdrc_init(NULL, NULL);
gpmc_onenand_init(board_onenand_data);
n8x0_mmc_init();
--- /dev/null
+++ b/arch/arm/mach-omap2/board-n8x0-lcd.c
@@ -0,0 +1,231 @@
+/*
+ * linux/arch/arm/mach-omap2/board-n8x0.c
+ *
+ * Copyright (C) 2005-2009 Nokia Corporation
+ * Author: Juha Yrjola <juha.yrjola@nokia.com>
+ *
+ * Modified from mach-omap2/board-generic.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/omapfb.h>
+
+#include <plat/lcd_mipid.h>
+#include <plat/blizzard.h>
+
+#include "../../../drivers/cbus/tahvo.h"
+
+
+struct tahvo_pwm_device {
+ struct device *dev;
+ int tahvo_7bit_backlight;
+};
+
+static struct tahvo_pwm_device *tahvo_pwm;
+
+static unsigned int tahvo_pwm_get_backlight_level(struct tahvo_pwm_device *pd)
+{
+ unsigned int mask;
+
+ if (pd->tahvo_7bit_backlight)
+ mask = 0x7f;
+ else
+ mask = 0x0f;
+ return tahvo_read_reg(pd->dev, TAHVO_REG_LEDPWMR) & mask;
+}
+
+static unsigned int tahvo_pwm_get_max_backlight_level(struct tahvo_pwm_device *pd)
+{
+ if (pd->tahvo_7bit_backlight)
+ return 0x7f;
+ return 0x0f;
+}
+
+static void tahvo_pwm_set_backlight_level(struct tahvo_pwm_device *pd, unsigned int level)
+{
+ unsigned int max_level;
+
+ max_level = tahvo_pwm_get_max_backlight_level(pd);
+ if (level > max_level)
+ level = max_level;
+ tahvo_write_reg(pd->dev, TAHVO_REG_LEDPWMR, level);
+}
+
+static int __init n8x0_tahvo_pwm_probe(struct platform_device *pdev)
+{
+ struct tahvo_pwm_device *pd;
+ unsigned int rev, id;
+
+ pd = kzalloc(sizeof(*pd), GFP_KERNEL);
+ if (WARN_ON(!pd))
+ return -ENOMEM;
+ pd->dev = &pdev->dev;
+
+ rev = tahvo_read_reg(pd->dev, TAHVO_REG_ASICR);
+ id = (rev >> 8) & 0xff;
+ if (id == 0x03) {
+ if ((rev & 0xff) >= 0x50)
+ pd->tahvo_7bit_backlight = 1;
+ } else if (id == 0x0b)
+ pd->tahvo_7bit_backlight = 1;
+
+ dev_set_drvdata(pd->dev, pd);
+ tahvo_pwm = pd;
+
+ return 0;
+}
+
+static struct platform_driver n8x0_tahvo_pwm_driver = {
+ .driver = {
+ .name = "tahvo-pwm",
+ },
+};
+
+static int __init n8x0_tahvo_pwm_init(void)
+{
+ return platform_driver_probe(&n8x0_tahvo_pwm_driver, n8x0_tahvo_pwm_probe);
+}
+fs_initcall(n8x0_tahvo_pwm_init);
+
+static int n8x0_get_backlight_level(struct mipid_platform_data *pdata)
+{
+ return tahvo_pwm_get_backlight_level(tahvo_pwm);
+}
+
+static int n8x0_get_max_backlight_level(struct mipid_platform_data *pdata)
+{
+ return tahvo_pwm_get_max_backlight_level(tahvo_pwm);
+}
+
+static void n8x0_set_backlight_level(struct mipid_platform_data *pdata, int level)
+{
+ tahvo_pwm_set_backlight_level(tahvo_pwm, level);
+}
+
+#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
+
+// MIPID LCD Panel
+
+static void mipid_shutdown(struct mipid_platform_data *pdata)
+{
+ if (pdata->nreset_gpio != -1) {
+ pr_info("shutdown LCD\n");
+ gpio_set_value(pdata->nreset_gpio, 0);
+ msleep(120);
+ }
+}
+
+struct mipid_platform_data n8x0_mipid_platform_data = {
+ .shutdown = mipid_shutdown,
+ .get_bklight_level = n8x0_get_backlight_level,
+ .set_bklight_level = n8x0_set_backlight_level,
+ .get_bklight_max = n8x0_get_max_backlight_level,
+};
+
+void __init n8x0_mipid_init(void)
+{
+ const struct omap_lcd_config *conf;
+ int err;
+
+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
+ if (conf != NULL) {
+ n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
+ n8x0_mipid_platform_data.data_lines = conf->data_lines;
+ if (conf->nreset_gpio != -1) {
+ err = gpio_request(conf->nreset_gpio, "MIPID nreset");
+ if (err) {
+ printk(KERN_ERR "N8x0 MIPID failed to request nreset GPIO %d\n",
+ conf->nreset_gpio);
+ } else {
+ err = gpio_direction_output(conf->nreset_gpio, 1);
+ if (err) {
+ printk(KERN_ERR "N8x0 MIPID failed to set nreset GPIO %d\n",
+ conf->nreset_gpio);
+ }
+ }
+ }
+ printk(KERN_INFO "N8x0 MIPID config loaded");
+ }
+ else
+ printk(KERN_INFO "N8x0 MIPID config not provided");
+}
+
+
+// Epson Blizzard LCD Controller
+
+static struct {
+ struct clk *sys_ck;
+} blizzard;
+
+static int blizzard_get_clocks(void)
+{
+ blizzard.sys_ck = clk_get(0, "osc_ck");
+ if (IS_ERR(blizzard.sys_ck)) {
+ printk(KERN_ERR "can't get Blizzard clock\n");
+ return PTR_ERR(blizzard.sys_ck);
+ }
+ return 0;
+}
+
+static unsigned long blizzard_get_clock_rate(struct device *dev)
+{
+ return clk_get_rate(blizzard.sys_ck);
+}
+
+static void blizzard_enable_clocks(int enable)
+{
+ if (enable)
+ clk_enable(blizzard.sys_ck);
+ else
+ clk_disable(blizzard.sys_ck);
+}
+
+static void blizzard_power_up(struct device *dev)
+{
+ /* Vcore to 1.475V */
+ tahvo_set_clear_reg_bits(tahvo_pwm->dev, 0x07, 0, 0xf);
+ msleep(10);
+
+ blizzard_enable_clocks(1);
+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
+}
+
+static void blizzard_power_down(struct device *dev)
+{
+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
+ blizzard_enable_clocks(0);
+
+ /* Vcore to 1.005V */
+ tahvo_set_clear_reg_bits(tahvo_pwm->dev, 0x07, 0xf, 0);
+}
+
+static struct blizzard_platform_data n8x0_blizzard_data = {
+ .power_up = blizzard_power_up,
+ .power_down = blizzard_power_down,
+ .get_clock_rate = blizzard_get_clock_rate,
+ .te_connected = 1,
+};
+
+void __init n8x0_blizzard_init(void)
+{
+ int r;
+
+ r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
+ if (r < 0)
+ {
+ printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
+ return;
+ }
+ gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
+
+ blizzard_get_clocks();
+ omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
+
+ printk(KERN_INFO "N8x0 Blizzard initialized");
+}
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -205,6 +205,7 @@ obj-$(CONFIG_MACH_OMAP3EVM) += board-om
obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o
obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
+obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0-lcd.o
obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \
sdram-nokia.o
obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \

@ -1,30 +0,0 @@
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -923,14 +923,14 @@ static int get_dss_clocks(void)
return PTR_ERR(dispc.dss_ick);
}
- dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "fck");
+ dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
if (IS_ERR(dispc.dss1_fck)) {
dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
clk_put(dispc.dss_ick);
return PTR_ERR(dispc.dss1_fck);
}
- dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_clk");
+ dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss_54m_fck");
if (IS_ERR(dispc.dss_54m_fck)) {
dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
clk_put(dispc.dss_ick);
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -90,7 +90,7 @@ static int rfbi_get_clocks(void)
return PTR_ERR(rfbi.dss_ick);
}
- rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "fck");
+ rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck");
if (IS_ERR(rfbi.dss1_fck)) {
dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
clk_put(rfbi.dss_ick);

@ -1,28 +0,0 @@
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -146,6 +146,8 @@
#include <plat/omap_hwmod.h>
#include <plat/prcm.h>
+#include <asm/mach-types.h>
+
#include "cm2xxx_3xxx.h"
#include "cminst44xx.h"
#include "prm2xxx_3xxx.h"
@@ -1769,6 +1771,16 @@ static int _setup(struct omap_hwmod *oh,
oh->_state = _HWMOD_STATE_INITIALIZED;
+ if (machine_is_nokia770() ||
+ machine_is_nokia_n800() ||
+ machine_is_nokia_n810() ||
+ machine_is_nokia_n810_wimax()) {
+ /* Nokia N-series workaround: Don't reset any hwmod. Some drivers expect
+ * the NOLO bootloader initializations to be effective. */
+ oh->flags |= HWMOD_INIT_NO_RESET;
+ printk_once(KERN_INFO "Nokia N-series HWMOD_INIT_NO_RESET workaround enabled\n");
+ }
+
/*
* In the case of hwmod with hardreset that should not be
* de-assert at boot time, we have to keep the module

@ -1,194 +0,0 @@
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -25,6 +25,8 @@
#include <linux/usb/musb.h>
#include <sound/tlv320aic3x.h>
#include <linux/spi/tsc2005.h>
+#include <linux/input.h>
+#include <linux/i2c/lm8323.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -37,6 +39,7 @@
#include <plat/onenand.h>
#include <plat/mmc.h>
#include <plat/serial.h>
+#include <plat/gpio-switch.h>
#include "mux.h"
@@ -104,6 +107,152 @@ extern struct mipid_platform_data n8x0_m
extern void n8x0_mipid_init(void);
extern void n8x0_blizzard_init(void);
+/* We map the FN key as LALT to workaround an X keycode problem.
+ * The XKB map needs to be adjusted to support this. */
+#define MAP_FN_AS_LEFTALT
+
+static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
+ [0x01] = KEY_Q,
+ [0x02] = KEY_K,
+ [0x03] = KEY_O,
+ [0x04] = KEY_P,
+ [0x05] = KEY_BACKSPACE,
+ [0x06] = KEY_A,
+ [0x07] = KEY_S,
+ [0x08] = KEY_D,
+ [0x09] = KEY_F,
+ [0x0a] = KEY_G,
+ [0x0b] = KEY_H,
+ [0x0c] = KEY_J,
+
+ [0x11] = KEY_W,
+ [0x12] = KEY_F4,
+ [0x13] = KEY_L,
+ [0x14] = KEY_APOSTROPHE,
+ [0x16] = KEY_Z,
+ [0x17] = KEY_X,
+ [0x18] = KEY_C,
+ [0x19] = KEY_V,
+ [0x1a] = KEY_B,
+ [0x1b] = KEY_N,
+ [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
+ [0x1f] = KEY_F7,
+
+ [0x21] = KEY_E,
+ [0x22] = KEY_SEMICOLON,
+ [0x23] = KEY_MINUS,
+ [0x24] = KEY_EQUAL,
+#ifdef MAP_FN_AS_LEFTALT
+ [0x2b] = KEY_LEFTALT,
+#else
+ [0x2b] = KEY_FN,
+#endif
+ [0x2c] = KEY_M,
+ [0x2f] = KEY_F8,
+
+ [0x31] = KEY_R,
+ [0x32] = KEY_RIGHTCTRL,
+ [0x34] = KEY_SPACE,
+ [0x35] = KEY_COMMA,
+ [0x37] = KEY_UP,
+ [0x3c] = KEY_COMPOSE,
+ [0x3f] = KEY_F6,
+
+ [0x41] = KEY_T,
+ [0x44] = KEY_DOT,
+ [0x46] = KEY_RIGHT,
+ [0x4f] = KEY_F5,
+ [0x51] = KEY_Y,
+ [0x53] = KEY_DOWN,
+ [0x55] = KEY_ENTER,
+ [0x5f] = KEY_ESC,
+
+ [0x61] = KEY_U,
+ [0x64] = KEY_LEFT,
+
+ [0x71] = KEY_I,
+ [0x75] = KEY_KPENTER,
+};
+
+static struct lm8323_platform_data lm8323_pdata = {
+ .repeat = 0, /* Repeat is handled in userspace for now. */
+ .keymap = rx44_keymap,
+ .size_x = 8,
+ .size_y = 12,
+ .debounce_time = 12,
+ .active_time = 500,
+
+ .name = "Internal keyboard",
+ .pwm_names[0] = "n810::keyboard",
+ .pwm_names[1] = "n810::cover",
+};
+
+#define OMAP_TAG_NOKIA_BT 0x4e01
+
+struct omap_bluetooth_config {
+ u8 chip_type;
+ u8 bt_wakeup_gpio;
+ u8 host_wakeup_gpio;
+ u8 reset_gpio;
+ u8 bt_uart;
+ u8 bd_addr[6];
+ u8 bt_sysclk;
+};
+
+static struct platform_device n8x0_bt_device = {
+ .name = "hci_h4p",
+ .id = -1,
+ .num_resources = 0,
+};
+
+void __init n8x0_bt_init(void)
+{
+ const struct omap_bluetooth_config *bt_config;
+
+ bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
+ struct omap_bluetooth_config);
+ n8x0_bt_device.dev.platform_data = (void *) bt_config;
+ if (platform_device_register(&n8x0_bt_device) < 0)
+ BUG();
+}
+
+static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
+ {
+ .name = "headphone",
+ .gpio = -1,
+ .debounce_rising = 200,
+ .debounce_falling = 200,
+ }, {
+ .name = "cam_act",
+ .gpio = -1,
+ .debounce_rising = 200,
+ .debounce_falling = 200,
+ }, {
+ .name = "cam_turn",
+ .gpio = -1,
+ .debounce_rising = 100,
+ .debounce_falling = 100,
+ }, {
+ .name = "slide",
+ .gpio = -1,
+ .debounce_rising = 200,
+ .debounce_falling = 200,
+ }, {
+ .name = "kb_lock",
+ .gpio = -1,
+ .debounce_rising = 200,
+ .debounce_falling = 200,
+ },
+};
+
+static void __init n8x0_gpio_switches_init(void)
+{
+ /* The switches are actually registered through ATAG mechanism.
+ * This just updates the parameters (thus .gpio is -1) */
+ omap_register_gpio_switches(n8x0_gpio_switches,
+ ARRAY_SIZE(n8x0_gpio_switches));
+}
+
#define TUSB6010_ASYNC_CS 1
#define TUSB6010_SYNC_CS 4
#define TUSB6010_GPIO_INT 58
@@ -799,6 +948,11 @@ static struct aic3x_pdata n810_aic33_dat
};
static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
+ {
+ I2C_BOARD_INFO("lm8323", 0x45),
+ .irq = OMAP_GPIO_IRQ(109),
+ .platform_data = &lm8323_pdata,
+ },
{
I2C_BOARD_INFO("tlv320aic3x", 0x18),
.platform_data = &n810_aic33_data,
@@ -856,7 +1010,9 @@ static inline void board_serial_init(voi
static void __init n8x0_init_machine(void)
{
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
+ n8x0_gpio_switches_init();
n8x0_cbus_init();
+ n8x0_bt_init();
/* FIXME: add n810 spi devices */
tsc2005_set_config();

@ -1,212 +0,0 @@
From f0bb9e67f0f13021e5033fed3dfe8ef78fe6a538 Mon Sep 17 00:00:00 2001
From: Marat Radchenko <marat@slonopotamus.org>
Date: Tue, 18 Oct 2011 21:52:56 +0400
Subject: [PATCH 2/2] N800: add TSC2301 board info
This patch adds TSC2301 init logic to N800 board file
---
arch/arm/mach-omap2/board-n8x0.c | 141 ++++++++++++++++++++++++++++++++++++--
1 files changed, 135 insertions(+), 6 deletions(-)
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -27,6 +27,7 @@
#include <linux/spi/tsc2005.h>
#include <linux/input.h>
#include <linux/i2c/lm8323.h>
+#include <linux/spi/tsc2301.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -63,7 +64,75 @@ static struct omap2_mcspi_device_config
};
#endif
-static void __init tsc2005_set_config(void)
+#ifdef CONFIG_TOUCHSCREEN_TSC2301
+
+#define N800_KEYB_IRQ_GPIO 109
+
+static struct tsc2301_platform_data tsc2301_config = {
+ .reset_gpio = 118,
+ .keymap = {
+ -1, /* Event for bit 0 */
+ KEY_UP, /* Event for bit 1 (up) */
+ KEY_F5, /* Event for bit 2 (home) */
+ -1, /* Event for bit 3 */
+ KEY_LEFT, /* Event for bit 4 (left) */
+ KEY_ENTER, /* Event for bit 5 (enter) */
+ KEY_RIGHT, /* Event for bit 6 (right) */
+ -1, /* Event for bit 7 */
+ KEY_ESC, /* Event for bit 8 (cycle) */
+ KEY_DOWN, /* Event for bit 9 (down) */
+ KEY_F4, /* Event for bit 10 (menu) */
+ -1, /* Event for bit 11 */
+ KEY_F8, /* Event for bit 12 (Zoom-) */
+ KEY_F6, /* Event for bit 13 (FS) */
+ KEY_F7, /* Event for bit 14 (Zoom+) */
+ -1, /* Event for bit 15 */
+ },
+ .kp_rep = 0,
+ .keyb_name = "Internal keypad",
+};
+
+static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
+ .turbo_mode = 0,
+ .single_channel = 1,
+};
+
+/*
+ TODO(Marat Radchenko): better pass GPIO to tsc2301 driver and let it
+ allocate irq itself (as it is already done for touchscreen)
+ */
+static void tsc2301_dev_init(void)
+{
+ int r;
+ int gpio = N800_KEYB_IRQ_GPIO;
+
+ r = gpio_request(gpio, "tsc2301 KBD IRQ");
+ if (r >= 0) {
+ gpio_direction_input(gpio);
+ tsc2301_config.keyb_int = gpio_to_irq(gpio);
+ } else {
+ printk(KERN_ERR "unable to get KBD GPIO");
+ }
+
+ gpio = 103;
+ r = gpio_request(gpio, "tsc2301 DAV IRQ");
+ if (r >= 0) {
+ gpio_direction_input(gpio);
+ tsc2301_config.dav_int = gpio_to_irq(gpio);
+ } else {
+ printk(KERN_ERR "unable to get DAV GPIO");
+ }
+}
+
+#else
+
+static void __init tsc2301_dev_init(void)
+{
+}
+
+#endif
+
+static void __init n8x0_ts_set_config(void)
{
const struct omap_lcd_config *conf;
@@ -94,6 +163,37 @@ static void __init tsc2005_set_config(vo
tsc2005_config.ts_x_plate_ohm = 200;
}
#endif
+
+#ifdef CONFIG_TOUCHSCREEN_TSC2301
+ if (strcmp(conf->panel_name, "lph8923") == 0) {
+ tsc2301_config.ts_x_plate_ohm = 180;
+ tsc2301_config.ts_hw_avg = 8;
+ tsc2301_config.ts_max_pressure = 2048;
+ tsc2301_config.ts_touch_pressure = 400;
+ tsc2301_config.ts_stab_time = 100;
+ tsc2301_config.ts_pressure_fudge = 2;
+ tsc2301_config.ts_x_max = 4096;
+ tsc2301_config.ts_x_fudge = 4;
+ tsc2301_config.ts_y_max = 4096;
+ tsc2301_config.ts_y_fudge = 7;
+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
+ tsc2301_config.ts_x_plate_ohm = 280;
+ tsc2301_config.ts_hw_avg = 8;
+ tsc2301_config.ts_touch_pressure = 400;
+ tsc2301_config.ts_max_pressure = 2048;
+ tsc2301_config.ts_stab_time = 1000;
+ tsc2301_config.ts_pressure_fudge = 2;
+ tsc2301_config.ts_x_max = 4096;
+ tsc2301_config.ts_x_fudge = 4;
+ tsc2301_config.ts_y_max = 4096;
+ tsc2301_config.ts_y_fudge = 7;
+ } else {
+ printk(KERN_ERR "Unknown panel type, set default "
+ "touchscreen configuration\n");
+ tsc2301_config.ts_x_plate_ohm = 200;
+ tsc2301_config.ts_stab_time = 100;
+ }
+#endif
}
}
@@ -347,13 +447,12 @@ static void __init n8x0_usb_init(void) {
#endif /*CONFIG_USB_MUSB_TUSB6010 */
-
static struct omap2_mcspi_device_config p54spi_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
};
-static struct spi_board_info n800_spi_board_info[] __initdata = {
+static struct spi_board_info n8x0_common_spi_board_info[] __initdata = {
{
.modalias = "lcd_mipid",
.bus_num = 1,
@@ -369,6 +468,10 @@ static struct spi_board_info n800_spi_bo
.max_speed_hz = 48000000,
.controller_data = &p54spi_mcspi_config,
},
+};
+
+static struct spi_board_info n810_spi_board_info[] __initdata = {
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
{
.modalias = "tsc2005",
.bus_num = 1,
@@ -378,6 +481,20 @@ static struct spi_board_info n800_spi_bo
.controller_data = &tsc2005_mcspi_config,
.platform_data = &tsc2005_config,
},
+#endif
+};
+
+static struct spi_board_info n800_spi_board_info[] __initdata = {
+#if defined(CONFIG_TOUCHSCREEN_TSC2301)
+ {
+ .modalias = "tsc2301",
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 6000000,
+ .controller_data = &tsc2301_mcspi_config,
+ .platform_data = &tsc2301_config,
+ },
+#endif
};
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
@@ -1015,9 +1132,17 @@ static void __init n8x0_init_machine(voi
n8x0_bt_init();
/* FIXME: add n810 spi devices */
- tsc2005_set_config();
- spi_register_board_info(n800_spi_board_info,
- ARRAY_SIZE(n800_spi_board_info));
+ n8x0_ts_set_config();
+
+ spi_register_board_info(n8x0_common_spi_board_info,
+ ARRAY_SIZE(n8x0_common_spi_board_info));
+ if (machine_is_nokia_n800())
+ spi_register_board_info(n800_spi_board_info,
+ ARRAY_SIZE(n800_spi_board_info));
+ else
+ spi_register_board_info(n810_spi_board_info,
+ ARRAY_SIZE(n810_spi_board_info));
+
omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
ARRAY_SIZE(n8x0_i2c_board_info_1));
omap_register_i2c_bus(2, 400, NULL, 0);
@@ -1027,6 +1152,8 @@ static void __init n8x0_init_machine(voi
board_serial_init();
n8x0_mipid_init();
n8x0_blizzard_init();
+ if (machine_is_nokia_n800())
+ tsc2301_dev_init();
omap_sdrc_init(NULL, NULL);
gpmc_onenand_init(board_onenand_data);
n8x0_mmc_init();

@ -1,98 +0,0 @@
---
arch/arm/mach-omap2/board-n8x0.c | 73 +++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -316,6 +316,77 @@ void __init n8x0_bt_init(void)
BUG();
}
+struct gpio_switch_input_dev {
+ struct input_dev *idev;
+ unsigned int swcode;
+};
+
+static struct gpio_switch_input_dev *slide_input;
+static struct gpio_switch_input_dev *kblock_input;
+
+static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
+ int state)
+{
+ if (gdev) {
+ input_report_switch(gdev->idev, gdev->swcode, state);
+ input_sync(gdev->idev);
+ }
+}
+
+static void n8x0_slide_notify(void *data, int state)
+{
+ n8x0_gpio_switch_input_notify(slide_input, state);
+}
+
+static void n8x0_kb_lock_notify(void *data, int state)
+{
+ n8x0_gpio_switch_input_notify(kblock_input, state);
+}
+
+static struct gpio_switch_input_dev * __init gpioswitch_input_init(
+ const char *name,
+ unsigned int swcode)
+{
+ struct gpio_switch_input_dev *gdev;
+ int err;
+
+ gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
+ if (!gdev)
+ goto error;
+ gdev->swcode = swcode;
+
+ gdev->idev = input_allocate_device();
+ if (!gdev->idev)
+ goto err_free;
+
+ gdev->idev->evbit[0] = BIT_MASK(EV_SW);
+ gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
+ gdev->idev->name = name;
+
+ err = input_register_device(gdev->idev);
+ if (err)
+ goto err_free_idev;
+
+ return gdev;
+
+err_free_idev:
+ input_free_device(gdev->idev);
+err_free:
+ kfree(gdev);
+error:
+ return NULL;
+}
+
+static int __init n8x0_gpio_switches_input_init(void)
+{
+ slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
+ kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
+ if (WARN_ON(!slide_input || !kblock_input))
+ return -ENODEV;
+ return 0;
+}
+late_initcall(n8x0_gpio_switches_input_init);
+
static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
{
.name = "headphone",
@@ -337,11 +408,13 @@ static struct omap_gpio_switch n8x0_gpio
.gpio = -1,
.debounce_rising = 200,
.debounce_falling = 200,
+ .notify = n8x0_slide_notify,
}, {
.name = "kb_lock",
.gpio = -1,
.debounce_rising = 200,
.debounce_falling = 200,
+ .notify = n8x0_kb_lock_notify,
},
};

@ -1,46 +0,0 @@
--- a/drivers/bluetooth/hci_h4p/core.c
+++ b/drivers/bluetooth/hci_h4p/core.c
@@ -36,9 +36,9 @@
#include <linux/clk.h>
#include <linux/gpio.h>
-#include <mach/hardware.h>
-#include <mach/board.h>
-#include <mach/irqs.h>
+#include <plat/hardware.h>
+#include <plat/board.h>
+#include <plat/irqs.h>
#include <plat/serial.h>
#include <net/bluetooth/bluetooth.h>
--- a/drivers/bluetooth/hci_h4p/hci_h4p.h
+++ b/drivers/bluetooth/hci_h4p/hci_h4p.h
@@ -21,7 +21,7 @@
*
*/
-#include <mach/board.h>
+#include <plat/board.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
--- a/drivers/bluetooth/hci_h4p/sysfs.c
+++ b/drivers/bluetooth/hci_h4p/sysfs.c
@@ -48,15 +48,8 @@ static ssize_t hci_h4p_store_bdaddr(stru
return -EINVAL;
}
- //for (i = 0; i < 6; i++)
- //info->bdaddr[i] = bdaddr[i] & 0xff;
-
- info->bdaddr[0] = 0x00;
- info->bdaddr[1] = 0x1D;
- info->bdaddr[2] = 0x6E;
- info->bdaddr[3] = 0xD4;
- info->bdaddr[4] = 0xF0;
- info->bdaddr[5] = 0x37;
+ for (i = 0; i < 6; i++)
+ info->bdaddr[i] = bdaddr[i] & 0xff;
return count;
}

@ -1,36 +0,0 @@
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -235,7 +235,7 @@ struct omap_hwmod_irq_info omap2_timer11
};
struct omap_hwmod_irq_info omap2_uart1_mpu_irqs[] = {
- { .irq = INT_24XX_UART1_IRQ, },
+ { .irq = 0, },
{ .irq = -1 }
};
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -517,8 +517,10 @@ static int serial_omap_startup(struct ua
/*
* Allocate the IRQ
*/
- retval = request_irq(up->port.irq, serial_omap_irq, up->port.irqflags,
- up->name, up);
+ retval = 0;
+ if (up->port.irq)
+ retval = request_irq(up->port.irq, serial_omap_irq,
+ up->port.irqflags, up->name, up);
if (retval)
return retval;
@@ -629,7 +631,8 @@ static void serial_omap_shutdown(struct
}
pm_runtime_put(&up->pdev->dev);
- free_irq(up->port.irq, up);
+ if (up->port.irq)
+ free_irq(up->port.irq, up);
}
static inline void

@ -1,34 +0,0 @@
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -41,6 +41,7 @@
#include <plat/mmc.h>
#include <plat/serial.h>
#include <plat/gpio-switch.h>
+#include <plat/usb.h>
#include "mux.h"
@@ -486,6 +487,14 @@ static struct musb_hdrc_platform_data tu
.config = &musb_config,
};
+static struct omap_usb_config n8x0_omap_usb_config __initdata = {
+ .otg = 1,
+ .register_host = 1,
+ .register_dev = 1,
+ .hmc_mode = 16,
+ .pins[0] = 6,
+};
+
static void __init n8x0_usb_init(void)
{
int ret = 0;
@@ -507,6 +516,8 @@ static void __init n8x0_usb_init(void)
if (ret != 0)
goto err;
+ omap2_usbfs_init(&n8x0_omap_usb_config);
+
printk(announce);
return;

@ -1,31 +0,0 @@
---
drivers/input/evdev.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -92,7 +92,7 @@ static void evdev_event(struct input_han
unsigned int type, unsigned int code, int value)
{
struct evdev *evdev = handle->private;
- struct evdev_client *client;
+ struct evdev_client *client, *c;
struct input_event event;
do_gettimeofday(&event.time);
@@ -103,9 +103,13 @@ static void evdev_event(struct input_han
rcu_read_lock();
client = rcu_dereference(evdev->grab);
- if (client)
+ if (client) {
evdev_pass_event(client, &event);
- else
+ /* Also pass events to clients that did not grab the device. */
+ list_for_each_entry_rcu(c, &evdev->client_list, node)
+ if (c != client)
+ evdev_pass_event(c, &event);
+ } else
list_for_each_entry_rcu(client, &evdev->client_list, node)
evdev_pass_event(client, &event);

@ -1,50 +0,0 @@
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1456,6 +1456,7 @@ static int __init mmc_omap_probe(struct
host->dma_ch = -1;
host->irq = irq;
+ host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
host->phys_base = host->mem_res->start;
host->virt_base = ioremap(res->start, resource_size(res));
if (!host->virt_base)
@@ -1495,7 +1496,9 @@ static int __init mmc_omap_probe(struct
}
}
- host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
+ /* Make sure the detect workqueue was run at least once. */
+ printk(KERN_INFO "OMAP-mmc: waiting for cards...\n");
+ mmc_flush_scheduled_work();
return 0;
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -78,12 +78,13 @@ static int mmc_schedule_delayed_work(str
}
/*
- * Internal function. Flush all scheduled work from the MMC work queue.
+ * Flush all scheduled work from the MMC work queue.
*/
-static void mmc_flush_scheduled_work(void)
+void mmc_flush_scheduled_work(void)
{
flush_workqueue(workqueue);
}
+EXPORT_SYMBOL(mmc_flush_scheduled_work);
#ifdef CONFIG_FAIL_MMC_REQUEST
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -445,6 +445,8 @@ static inline int mmc_boot_partition_acc
return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
}
+void mmc_flush_scheduled_work(void);
+
#ifdef CONFIG_MMC_CLKGATE
void mmc_host_clk_hold(struct mmc_host *host);
void mmc_host_clk_release(struct mmc_host *host);

@ -1,23 +0,0 @@
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -258,6 +258,8 @@ char *cmdline_find_option(char *str)
return strstr(saved_command_line, str);
}
+static struct omap_uart_state statebuf[4];
+
static int __init omap_serial_early_init(void)
{
do {
@@ -272,9 +274,9 @@ static int __init omap_serial_early_init
if (!oh)
break;
- uart = kzalloc(sizeof(struct omap_uart_state), GFP_KERNEL);
- if (WARN_ON(!uart))
+ if (WARN_ON(num_uarts >= ARRAY_SIZE(statebuf)))
return -ENODEV;
+ uart = &statebuf[num_uarts];
uart->oh = oh;
uart->num = num_uarts++;

@ -1,135 +0,0 @@
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -221,6 +221,7 @@ void musb_write_fifo(struct musb_hw_ep *
if (len > 0)
tusb_fifo_write_unaligned(fifo, buf, len);
}
+EXPORT_SYMBOL(musb_write_fifo);
void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
{
@@ -268,6 +269,7 @@ void musb_read_fifo(struct musb_hw_ep *h
if (len > 0)
tusb_fifo_read_unaligned(fifo, buf, len);
}
+EXPORT_SYMBOL(musb_read_fifo);
static struct musb *the_musb;
@@ -1165,7 +1167,7 @@ static const struct musb_platform_ops tu
static u64 tusb_dmamask = DMA_BIT_MASK(32);
-static int __init tusb_probe(struct platform_device *pdev)
+static int tusb_probe(struct platform_device *pdev)
{
struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
struct platform_device *musb;
@@ -1245,18 +1247,18 @@ static struct platform_driver tusb_drive
},
};
-MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
-MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
-MODULE_LICENSE("GPL v2");
+//MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
+//MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
+//MODULE_LICENSE("GPL v2");
-static int __init tusb_init(void)
+int musb_hdrc_glue_init(void)
{
return platform_driver_probe(&tusb_driver, tusb_probe);
}
-subsys_initcall(tusb_init);
+EXPORT_SYMBOL(musb_hdrc_glue_init);
-static void __exit tusb_exit(void)
+void musb_hdrc_glue_exit(void)
{
platform_driver_unregister(&tusb_driver);
}
-module_exit(tusb_exit);
+EXPORT_SYMBOL(musb_hdrc_glue_exit);
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -207,7 +207,7 @@ static struct otg_io_access_ops musb_ulp
/*-------------------------------------------------------------------------*/
-#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_BLACKFIN)
+#if !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE) && !defined(CONFIG_USB_MUSB_BLACKFIN)
/*
* Load an endpoint's FIFO
@@ -250,7 +250,7 @@ void musb_write_fifo(struct musb_hw_ep *
}
}
-#if !defined(CONFIG_USB_MUSB_AM35X)
+#if !defined(CONFIG_USB_MUSB_AM35X) && !defined(CONFIG_USB_MUSB_TUSB6010) && !defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
/*
* Unload an endpoint's FIFO
*/
@@ -2370,8 +2370,13 @@ static struct platform_driver musb_drive
/*-------------------------------------------------------------------------*/
+extern int musb_hdrc_glue_init(void);
+extern void musb_hdrc_glue_exit(void);
+
static int __init musb_init(void)
{
+ int err;
+
if (usb_disabled())
return 0;
@@ -2380,7 +2385,17 @@ static int __init musb_init(void)
", "
"otg (peripheral+host)",
musb_driver_name);
- return platform_driver_probe(&musb_driver, musb_probe);
+
+ err = musb_hdrc_glue_init();
+ if (err)
+ return err;
+ err = platform_driver_probe(&musb_driver, musb_probe);
+ if (err) {
+ musb_hdrc_glue_exit();
+ return err;
+ }
+
+ return 0;
}
/* make us init after usbcore and i2c (transceivers, regulators, etc)
@@ -2391,5 +2406,6 @@ fs_initcall(musb_init);
static void __exit musb_cleanup(void)
{
platform_driver_unregister(&musb_driver);
+ musb_hdrc_glue_exit();
}
module_exit(musb_cleanup);
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -51,7 +51,7 @@ obj-$(CONFIG_EARLY_PRINTK_DBGP) += early
obj-$(CONFIG_USB_ATM) += atm/
obj-$(CONFIG_USB_SPEEDTOUCH) += atm/
-obj-$(CONFIG_USB_MUSB_HDRC) += musb/
+obj-y += musb/
obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/
obj-$(CONFIG_USB_GADGET) += gadget/
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -13,7 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS) += musb_d
# Hardware Glue Layer
obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o
obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o
-obj-$(CONFIG_USB_MUSB_TUSB6010) += tusb6010.o
+musb_hdrc-$(subst m,y,$(CONFIG_USB_MUSB_TUSB6010)) += tusb6010.o
obj-$(CONFIG_USB_MUSB_DAVINCI) += davinci.o
obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o

@ -1,116 +0,0 @@
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -619,7 +619,7 @@ static void omap_device_delete(struct om
* information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
* passes along the return value of omap_device_build_ss().
*/
-struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
+struct platform_device *__init omap_device_build(const char *pdev_name, int pdev_id,
struct omap_hwmod *oh, void *pdata,
int pdata_len,
struct omap_device_pm_latency *pm_lats,
@@ -652,7 +652,7 @@ struct platform_device *omap_device_buil
* platform_device record. Returns an ERR_PTR() on error, or passes
* along the return value of omap_device_register().
*/
-struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
+struct platform_device *__init omap_device_build_ss(const char *pdev_name, int pdev_id,
struct omap_hwmod **ohs, int oh_cnt,
void *pdata, int pdata_len,
struct omap_device_pm_latency *pm_lats,
@@ -717,7 +717,7 @@ odbs_exit:
* platform_early_add_device() on the underlying platform_device.
* Returns 0 by default.
*/
-static int omap_early_device_register(struct platform_device *pdev)
+static int __init omap_early_device_register(struct platform_device *pdev)
{
struct platform_device *devices[1];
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -29,7 +29,7 @@
#define NO_LENGTH_CHECK 0xffffffff
-struct omap_board_config_kernel *omap_board_config __initdata;
+struct omap_board_config_kernel *omap_board_config;
int omap_board_config_size;
unsigned char omap_bootloader_tag[1024];
@@ -58,7 +58,7 @@ __tagtable(ATAG_BOARD, parse_tag_omap);
#endif
-static const void *__init get_config(u16 tag, size_t len,
+static const void *get_config(u16 tag, size_t len,
int skip, size_t *len_out)
{
struct omap_board_config_kernel *kinfo = NULL;
@@ -125,12 +125,12 @@ static const void *__init get_config(u16
return kinfo->data;
}
-const void *__init __omap_get_config(u16 tag, size_t len, int nr)
+const void *__omap_get_config(u16 tag, size_t len, int nr)
{
return get_config(tag, len, nr, NULL);
}
-const void *__init omap_get_var_config(u16 tag, size_t *len)
+const void *omap_get_var_config(u16 tag, size_t *len)
{
return get_config(tag, NO_LENGTH_CHECK, 0, len);
}
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -380,7 +380,7 @@ static inline void omap_init_dmic(void)
#include <plat/mcspi.h>
-static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
+static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
{
struct platform_device *pdev;
char *name = "omap2_mcspi";
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -24,7 +24,7 @@
#include <plat/omap_hwmod.h>
#include <plat/omap_device.h>
-static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
+static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
{
struct platform_device *pdev;
struct omap_gpio_platform_data *pdata;
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -122,7 +122,7 @@ static int omap3_enable_st_clock(unsigne
return 0;
}
-static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
+static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
{
int id, count = 1;
char *name = "omap-mcbsp";
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -159,14 +159,14 @@ struct omap_gpio_switch_config {
int key_code:24; /* Linux key code */
};
-extern const void *__init __omap_get_config(u16 tag, size_t len, int nr);
+extern const void * __omap_get_config(u16 tag, size_t len, int nr);
#define omap_get_config(tag, type) \
((const type *) __omap_get_config((tag), sizeof(type), 0))
#define omap_get_nr_config(tag, type, nr) \
((const type *) __omap_get_config((tag), sizeof(type), (nr)))
-extern const void *__init omap_get_var_config(u16 tag, size_t *len);
+extern const void * omap_get_var_config(u16 tag, size_t *len);
extern struct omap_board_config_kernel *omap_board_config;
extern int omap_board_config_size;
Loading…
Cancel
Save