2011-10-30 01:52:07 +03:00
|
|
|
Index: linux-3.1/arch/arm/mach-omap2/board-n8x0.c
|
2011-10-29 22:02:50 +03:00
|
|
|
===================================================================
|
2011-10-30 22:31:45 +02:00
|
|
|
--- linux-3.1.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 21:04:56.008818251 +0100
|
|
|
|
+++ linux-3.1/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 21:14:31.600257909 +0100
|
2011-10-30 20:46:45 +02:00
|
|
|
@@ -15,8 +15,11 @@
|
2011-10-29 22:02:50 +03:00
|
|
|
#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>
|
2011-10-30 20:46:45 +02:00
|
|
|
+#include <linux/platform_data/cbus.h>
|
2011-10-29 22:02:50 +03:00
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/usb/musb.h>
|
2011-10-30 20:46:45 +02:00
|
|
|
@@ -193,6 +196,110 @@ static struct omap_onenand_platform_data
|
2011-10-29 22:02:50 +03:00
|
|
|
};
|
|
|
|
#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,
|
2011-10-30 20:46:45 +02:00
|
|
|
+ .parent = &n8x0_cbus_device.dev,
|
2011-10-29 22:02:50 +03:00
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+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),
|
2011-10-30 20:46:45 +02:00
|
|
|
+ .dev = {
|
|
|
|
+ .parent = &n8x0_cbus_device.dev,
|
|
|
|
+ },
|
2011-10-29 22:02:50 +03:00
|
|
|
+};
|
|
|
|
+
|
|
|
|
+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))
|
|
|
|
|
2011-10-30 20:46:45 +02:00
|
|
|
@@ -679,6 +786,8 @@ static inline void board_serial_init(voi
|
2011-10-29 22:02:50 +03:00
|
|
|
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));
|
2011-10-30 20:46:45 +02:00
|
|
|
Index: linux-3.1/include/linux/platform_data/cbus.h
|
2011-10-29 22:02:50 +03:00
|
|
|
===================================================================
|
2011-10-30 20:46:45 +02:00
|
|
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
2011-10-30 22:31:45 +02:00
|
|
|
+++ linux-3.1/include/linux/platform_data/cbus.h 2011-10-30 21:05:07.540709042 +0100
|
2011-10-30 20:46:45 +02:00
|
|
|
@@ -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 */
|