Skip to contentSkip to conversation

omap24xx Irda support - Experimental

PATCH Komal Shah 1 participant 1 message Dec 14, 2005

Subsystems (5)
lore
Share & tools
lore

Komal Shah

author
#0 lore raw

Sorry, last patch was released in hurry, and forgot to do "git add omap-ir.c" :(. Attached patch is complete now..

Quoted 17 lines · --- Komal Shah

Tony/Jian,

I have attached the patch for omap24xx irda support. (Experimental).

- Moved board specific data to board-hx.c files for omap1/2.
- Still there are board specific info for dma. But its ok for a while.

I need to know, how you guys have tested Irda on 24xx with 2.6.9 kernel
available on ti.com? How about the switch settings on the board?

If anyone has pre-arm-compiled irdautils then please send it to me?

Please review this patch and let me know, any modifications are required?

Quoted 7 lines

TODO:
- Testing on H4 board. It just builds right now for h2/h3/h4.
- Need to use clk_* apis for h2/h3/h4. Right now it is assumed that necessary clock is enabled by bootloader in H4.
- hard_debug1/2 macros will be removed in the final release of irda patches.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

arch/arm/mach-omap1/board-h2.c +43 -0
index 0fc2e0f..6bf3460 100644
@@ -36,6 +36,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/tc.h>
+#include <asm/arch/irda.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/common.h>
 
@@ -171,6 +172,39 @@ static struct platform_device h2_smc91x_
 	.resource	= h2_smc91x_resources,
 };
 
+#define H2_IRDA_FIRSEL_GPIO_PIN	17
+
+static int h2_transceiver_mode(struct device *dev, int state)
+{
+	if (state & IR_SIRMODE)
+		omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 0);
+	else    /* MIR/FIR */
+		omap_set_gpio_dataout(H2_IRDA_FIRSEL_GPIO_PIN, 1);
+		
+	return 0;
+}
+
+static struct omap_irda_config h2_irda_data = {
+	.transceiver_cap	= IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
+};
+
+static struct resource h2_irda_resources[] = {
+	[0] = {
+		.start	= INT_UART3,
+		.end	= INT_UART3,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+static struct platform_device h2_irda_device = {
+	.name		= "omapirda",
+	.id		= 0,
+	.dev		= {
+		.platform_data	= &h2_irda_data,
+	},
+	.num_resources	= ARRAY_SIZE(h2_irda_resources),
+	.resource	= h2_irda_resources,
+};
+
 static struct platform_device *h2_devices[] __initdata = {
 	&h2_nor_device,
 	&h2_nand_device,
@@ -266,6 +300,15 @@ static void __init h2_init(void)
 	// omap_cfg_reg(U19_ARMIO1);		/* CD */
 	omap_cfg_reg(BALLOUT_V8_ARMIO3);	/* WP */
 
+	/* Irda */
+#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
+	omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A);
+	if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) {
+		omap_set_gpio_direction(H2_IRDA_FIRSEL_GPIO_PIN, 0);
+		h2_irda_data.transceiver_mode = h2_transceiver_mode;
+	}
+#endif
+
 	platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
 	omap_board_config = h2_config;
 	omap_board_config_size = ARRAY_SIZE(h2_config);
arch/arm/mach-omap1/board-h3.c +76 -0

96 lines not on this page · raw message

arch/arm/mach-omap2/board-h4.c +52 -0

75 lines not on this page · raw message

arch/arm/mach-omap2/mux.c +4 -0
index ea46548..9e6b79f 100644
@@ -54,6 +54,10 @@ MUX_CFG_24XX("W19_24XX_SYS_NIRQ",	0x12c,
 MUX_CFG_24XX("Y20_24XX_GPIO60",		0x12c,	3,	0,	0,	1)
 MUX_CFG_24XX("M15_24XX_GPIO92",		0x10a,	3,	0,	0,	1)
 
+/* UART3  */
+MUX_CFG_24XX("K15_24XX_UART3_TX",	0x118,	0,	0,	0,	1)
+MUX_CFG_24XX("K14_24XX_UART3_RX",	0x119,	0,	0,	0,	1)
+
 };
 
 int __init omap2_mux_init(void)
drivers/net/irda/Kconfig +5 -5
index b200c50..b4562c2 100644
@@ -341,12 +341,12 @@ config TOSHIBA_FIR
 	  To compile it as a module, choose M here: the module will be called
 	  donauboe.
 
-config OMAP1610_IR
-        tristate "OMAP1610 IrDA(SIR/MIR/FIR)"
-	depends on IRDA && ARCH_OMAP
-	select GPIOEXPANDER_OMAP if MACH_OMAP_H3
+config OMAP_IR
+        tristate "OMAP IrDA(SIR/MIR/FIR)"
+	depends on IRDA && (ARCH_OMAP1 || ARCH_OMAP2)
+	select GPIOEXPANDER_OMAP if (MACH_OMAP_H3 || MACH_OMAP_H4)
         help
-          Say Y here if you want to build support for the Omap1610 IR.
+          Say Y here if you want to build support for the OMAP IR.
 
 config AU1000_FIR
 	tristate "Alchemy Au1000 SIR/FIR"
drivers/net/irda/Makefile +1 -1
index 7db79a2..494b0f8 100644
@@ -43,7 +43,7 @@ obj-$(CONFIG_OLD_BELKIN_DONGLE)	+= old_b
 obj-$(CONFIG_MCP2120_DONGLE)	+= mcp2120-sir.o
 obj-$(CONFIG_ACT200L_DONGLE)	+= act200l-sir.o
 obj-$(CONFIG_MA600_DONGLE)	+= ma600-sir.o
-obj-$(CONFIG_OMAP1610_IR)       += omap1610-ir.o
+obj-$(CONFIG_OMAP_IR)		+= omap-ir.o
 
 
 # The SIR helper module
drivers/net/irda/omap-ir.c new file +1023 -0

1,023 lines not on this page · raw message

drivers/net/irda/omap1610-ir.c deleted +0 -997

997 lines not on this page · raw message

include/asm-arm/arch-omap/irda.h new file +17 -0
new file mode 100644
index 0000000..c827fd0
@@ -0,0 +1,17 @@
+#ifndef ASMARM_ARCH_IRDA_H
+#define ASMARM_ARCH_IRDA_H
+
+/* board specific transceiver capabilities */
+
+#define IR_OFF		1
+#define IR_SIRMODE	2
+#define IR_FIRMODE	4
+#define IR_MIRMODE	8
+
+struct omap_irda_config {
+	int transceiver_cap;
+	int (*transceiver_mode)(struct device *dev, int state);
+	int (*set_power)(struct device *dev, int state);
+};
+
+#endif
include/asm-arm/arch-omap/irqs.h +1 -0
index 4ffce1d..42bb4c2 100644
@@ -242,6 +242,7 @@
 #define INT_24XX_GPIO_BANK2	30
 #define INT_24XX_GPIO_BANK3	31
 #define INT_24XX_GPIO_BANK4	32
+#define INT_24XX_UART3_IRQ	74
 
 /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
  * 16 MPUIO lines */
include/asm-arm/arch-omap/mux.h +5 -0
index 8d1c62e..9776338 100644
@@ -410,6 +410,11 @@ enum omap24xx_index {
 	/* 24xx GPIO */
 	Y20_24XX_GPIO60,
 	M15_24XX_GPIO92,
+
+	/* UART3 */
+	K15_24XX_UART3_TX,
+	K14_24XX_UART3_RX,
+
 };
 
 #ifdef	CONFIG_OMAP_MUX