Skip to contentSkip to conversation

omap24xx IrDA update

PATCH New Komal Shah 1 participant 1 message Dec 20, 2005

Subsystems (5)
lore
Share & tools
lore

Komal Shah

author
#0 lore raw

PATCH 1/1 omap24xx IrDA update

Tony/Manjunath,

I have attached the updated IrDA patch with 24xx support. This time I have tested discovery with 2 Nokia mobiles (6230 and 6600).

Test Procedure:
On H4 Menelaus board, put
S1-7 OFF
S1-8 OFF
S1-4/5 ON ON positions.

#ifconfig irda0 up
#echo "1" > /proc/sys/net/irda/discovery
#cat /proc/net/irda/discovery
IrLMP Log:
nickname: Nokia 6230i, hint: 0xb125, saddr: 0x023f25ac, daddr:
0x0000f5bf

I wasn't able to cross-compile irdadump successfully, if somone gives me the binary then it will be useful for further testing.

While testing discovery procedure continously, it suddenly gave me following crash. I feel that it is because I have removed workqueue stuff, and used local_irq_save/restore...any suggestions?

------
<3>scheduling while atomic: swapper/0x00010000/0
scheduling while atomic: swapper/0x00010000/0
<3>bad: scheduling from the idle thread!
bad: scheduling from the idle thread!
<1>Unable to handle kernel NULL pointer dereference at virtual address 00000000

Unable to handle kernel NULL pointer dereference at virtual address

00000000
<1>pgd = c0004000
pgd = c0004000
<1>[00000000] *pgd=00000000[00000000] *pgd=00000000

Internal error: Oops: 17 [#1]
Internal error: Oops: 17 [#1]
Modules linked in:Modules linked in:

CPU: 0
CPU: 0
PC is at dequeue_task+0xc/0x78
PC is at dequeue_task+0xc/0x78
LR is at deactivate_task+0x24/0x30
LR is at deactivate_task+0x24/0x30
pc : [<c0039430>]    lr : [<c0039738>]    Not tainted
sp : c026dd24  ip : c026dd34  fp : c026dd30
pc : [<c0039430>]    lr : [<c0039738>]    Not tainted

sp : c026dd24 ip : c026dd34 fp : c026dd30
r10: c02cde48 r9 : 0000001f r8 : 90017200
r10: c02cde48 r9 : 0000001f r8 : 90017200
r7 : c026edf8 r6 : 00000064 r5 : c026c000 r4 : c026edf8 r7 : c026edf8 r6 : 00000064 r5 : c026c000 r4 : c026edf8 r3 : ffffffff r2 : 00000000 r1 : 00000000 r0 : c026edf8 r3 : ffffffff r2 : 00000000 r1 : 00000000 r0 : c026edf8
Flags: NzcvFlags: Nzcv IRQs off FIQs on Mode SVC_32 Segment kernel

  IRQs off  FIQs on  Mode SVC_32  Segment kernel
Control: C5387F  Table: 80760000  DAC: 00000017
Control: C5387F  Table: 80760000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc026c194)
Process swapper (pid: 0, stack limit = 0xc026c194)
Stack: (0xc026dd24 to 0xc026e000)
Stack: (0xc026dd24 to 0xc026e000)
dd20: dd20:                   c026dd44 c026dd44 c026dd34 c026dd34

c0039738 c0039
738 c0039430 c0039430 0000001f 0000001f c026dd84 c026dd84 c026dd48 c026dd48

dd40: dd40: c0224a40 c0224a40 c0039720 c0039720 c026ee2c c026ee2c 07270e00 07270
e00 c026ef20 c026ef20 00000000 00000000 c026dd84 c026dd84 00003558 00003558

dd60: dd60: c026c000 c026c000 00000064 00000064 c026dd88 c026dd88 c0274a8c c0274
a8c 00000001 00000001 00000064 00000064 c026ddc0 c026ddc0 c026dd88 c026dd88

dd80: dd80: c0225798 c0225798 c02248ac c02248ac c02d361c c02d361c c02d361c c02d3
61c 00003558 00003558 c0046410 c0046410 c026edf8 c026edf8 c02d3354 c02d3354

dda0: dda0: c047b01c c047b01c c047b000 c047b000 c026dde8 c026dde8 c026de4c c026d
e4c c026c000 c026c000 c026de2c c026de2c c026ddc4 c026ddc4 c0175110 c0175110

ddc0: ddc0: c0225718 c0225718 00000001 00000001 00000000 00000000 00000000 00000
000 c047b070 c047b070 00000000 00000000 c026edf8 c026edf8 c0051480 c0051480

dde0: dde0: c026ddf4 c026ddf4 c026ddf4 c026ddf4 00000000 00000000 c026edf8 c026e
df8 c0051480 c0051480 c047b01c c047b01c c047b01c c047b01c 0003d950 0003d950

de00: de00: 00000000 00000000 c047b02c c047b02c c047b048 c047b048 c0603e60 c0603
e60 0001c200 0001c200 c0603c00 c0603c00 4107b362 4107b362 c02c8044 c02c8044

de20: de20: c026de44 c026de44 c026de30 c026de30 c017401c c017401c c0174efc c0174
efc 00000020 00000020 c026de73 c026de73 c026de6c c026de6c c026de48 c026de48

de40: de40: c017598c c017598c c0173fd4 c0173fd4 c0603e60 c0603e60 00010020 00010
020 c0600002 c0600002 c026de4b c026de4b c063a9c0 c063a9c0 00000002 00000002

de60: de60: c026de88 c026de88 c026de70 c026de70 c002eba0 c002eba0 c0175944 c0175
944 c026de8c c026de8c c063a9c0 c063a9c0 60000113 60000113 c026dea8 c026dea8

de80: de80: c026de8c c026de8c c01722fc c01722fc c002eb8c c002eb8c c063a9c0 c063a
9c0 00000000 00000000 c0603e60 c0603e60 00000020 00000020 c026dee0 c026dee0

dea0: dea0: c026deac c026deac c01724ec c01724ec c01722b8 c01722b8 c0045d0c c0045
d0c c02d3310 c02d3310 00000001 00000001 c063a9c0 c063a9c0 00000000 00000000

dec0: dec0: 00000000 00000000 0000004a 0000004a c026df54 c026df54 4107b362 4107b
362 c02c8044 c02c8044 c026df04 c026df04 c026dee4 c026dee4 c0024994 c0024994

dee0: dee0: c0172484 c0172484 c02c8f4c c02c8f4c 0000004a 0000004a c026df54 c026d
f54 c02e9b58 c02e9b58 c026df54 c026df54 c026df20 c026df20 c026df08 c026df08

df00: df00: c0024bcc c0024bcc c002495c c002495c c026c000 c026c000 d80fe000 d80fe
000 c02d58e4 c02d58e4 c026df50 c026df50 c026df24 c026df24 c0024c74 c0024c74

df20: df20: c0024b70 c0024b70 c026df60 c026df60 c026df34 c026df34 ffffffff fffff
fff d80fe000 d80fe000 c02d58e4 c02d58e4 c02e9b58 c02e9b58 8001e340 8001e340

df40: df40: 8001e2d8 8001e2d8 c026dfa8 c026dfa8 c026df54 c026df54 c00239a4 c0023
9a4 c0024c2c c0024c2c c001cae0 c001cae0 00000002 00000002 00000000 00000000

df60: df60: 00000000 00000000 c0025498 c0025498 c026c000 c026c000 c02d58e4 c02d5
8e4 c02e9b58 c02e9b58 8001e340 8001e340 4107b362 4107b362 8001e2d8 8001e2d8

df80: df80: c026dfa8 c026dfa8 c026dfac c026dfac c026df9c c026df9c c00254d0 c0025
4d0 c00254d4 c00254d4 60000013 60000013 ffffffff ffffffff c026dfc0 c026dfc0

dfa0: dfa0: c026dfac c026dfac c002551c c002551c c00254a4 c00254a4 00c5387d 00c53
87d c02c7bfc c02c7bfc c026dfd0 c026dfd0 c026dfc4 c026dfc4 c0023024 c0023024

dfc0: dfc0: c00254e8 c00254e8 c026dff4 c026dff4 c026dfd4 c026dfd4 c0008960 c0008
960 c002300c c002300c c0008464 c0008464 c02ccc08 c02ccc08 00c5387d 00c5387d

dfe0: dfe0: c02ccb84 c02ccb84 c026fcd0 c026fcd0 00000000 00000000 c026dff8 c026d
ff8 80008094 80008094 c0008804 c0008804 00000000 00000000 00000000 00000000

Backtrace: Backtrace:

[<c0039424>] [<c0039424>] (dequeue_task+0x0/0x78) (dequeue_task+0x0/0x78) from [
<c0039738>] from [<c0039738>] (deactivate_task+0x24/0x30) (deactivate_task+0x24/0x30)
[<c0039714>] [<c0039714>] (deactivate_task+0x0/0x30) (deactivate_task+0x0/0x30)
from [<c0224a40>] from [<c0224a40>] (schedule+0x1a0/0x580) (schedule+0x1a0/0x580)
r4 = 0000001F r4 = 0000001F

[<c02248a0>] [<c02248a0>] (schedule+0x0/0x580) (schedule+0x0/0x580) from [<c0225
798>] from [<c0225798>] (schedule_timeout+0x8c/0xbc) (schedule_timeout+0x8c/0xbc)
[<c022570c>] [<c022570c>] (schedule_timeout+0x0/0xbc) (schedule_timeout+0x0/0xbc
) from [<c0175110>] from [<c0175110>] (omap_i2c_xfer+0x220/0x324) (omap_i2c_xfer+0x220/0x324)
r8 = C026C000 r8 = C026C000 r7 = C026DE4C r7 = C026DE4C r6 =
C026DDE8 r6 =
C026DDE8 r5 = C047B000
r5 = C047B000
r4 = C047B01C r4 = C047B01C

[<c0174ef0>] [<c0174ef0>] (omap_i2c_xfer+0x0/0x324) (omap_i2c_xfer+0x0/0x324) fr
om [<c017401c>] from [<c017401c>] (i2c_transfer+0x54/0x78) (i2c_transfer+0x54/0x78)
[<c0173fc8>] [<c0173fc8>] (i2c_transfer+0x0/0x78) (i2c_transfer+0x0/0x78) from [
<c017598c>] from [<c017598c>] (read_gpio_expa+0x54/0x74) (read_gpio_expa+0x54/0x74)
r5 = C026DE73 r5 = C026DE73 r4 = 00000020 r4 = 00000020

[<c0175938>] [<c0175938>] (read_gpio_expa+0x0/0x74) (read_gpio_expa+0x0/0x74) fr
om [<c002eba0>] from [<c002eba0>] (h4_transceiver_mode+0x20/0x78) (h4_transceiver_mode+0x20/0x78)
r5 = 00000002 r5 = 00000002 r4 = C063A9C0 r4 = C063A9C0

[<c002eb80>] [<c002eb80>] (h4_transceiver_mode+0x0/0x78) (h4_transceiver_mode+0x
0/0x78) from [<c01722fc>] from [<c01722fc>] (omap_irda_set_speed+0x50/0x1cc) (omap_irda_set_speed+0x50/0x1cc)
r5 = 60000113 r5 = 60000113 r4 = C063A9C0 r4 = C063A9C0

[<c01722ac>] [<c01722ac>] (omap_irda_set_speed+0x0/0x1cc) (omap_irda_set_speed+0
x0/0x1cc) from [<c01724ec>] from [<c01724ec>] (omap_irda_irq+0x74/0x2e4)
(omap_irda_irq+0x74/0x2e4)
r7 = 00000020 r7 = 00000020 r6 = C0603E60 r6 = C0603E60 r5 =
00000000 r5 =
00000000 r4 = C063A9C0
r4 = C063A9C0
[<c0172478>] [<c0172478>] (omap_irda_irq+0x0/0x2e4) (omap_irda_irq+0x0/0x2e4) fr
om [<c0024994>] from [<c0024994>] (__do_irq+0x44/0x78) (__do_irq+0x44/0x78)
[<c0024950>] [<c0024950>] (__do_irq+0x0/0x78) (__do_irq+0x0/0x78) from [<c0024bc
c>] from [<c0024bcc>] (do_level_IRQ+0x68/0xbc) (do_level_IRQ+0x68/0xbc)
r8 = C026DF54 r8 = C026DF54 r7 = C02E9B58 r7 = C02E9B58 r6 =
C026DF54 r6 =
C026DF54 r5 = 0000004A
r5 = 0000004A
r4 = C02C8F4C r4 = C02C8F4C

[<c0024b64>] [<c0024b64>] (do_level_IRQ+0x0/0xbc) (do_level_IRQ+0x0/0xbc) from [
<c0024c74>] from [<c0024c74>] (asm_do_IRQ+0x54/0x130) (asm_do_IRQ+0x54/0x130)
r6 = C02D58E4 r6 = C02D58E4 r5 = D80FE000 r5 = D80FE000 r4 =
C026C000 r4 =
C026C000

[<c0024c20>] [<c0024c20>] (asm_do_IRQ+0x0/0x130) (asm_do_IRQ+0x0/0x130) from [<c
00239a4>] from [<c00239a4>] (__irq_svc+0x24/0x80) (__irq_svc+0x24/0x80)
[<c0025498>] [<c0025498>] (default_idle+0x0/0x44) (default_idle+0x0/0x44) from [
<c002551c>] from [<c002551c>] (cpu_idle+0x40/0x5c) (cpu_idle+0x40/0x5c)
[<c00254dc>] [<c00254dc>] (cpu_idle+0x0/0x5c) (cpu_idle+0x0/0x5c) from [<c002302
4>] from [<c0023024>] (__init_end+0x24/0x2c) (__init_end+0x24/0x2c)
r5 = C02C7BFC r5 = C02C7BFC r4 = 00C5387D r4 = 00C5387D

[<c0023000>] [<c0023000>] (__init_end+0x0/0x2c) (__init_end+0x0/0x2c) from [<c00
08960>] from [<c0008960>] (start_kernel+0x168/0x1b0) (start_kernel+0x168/0x1b0)
[<c00087f8>] [<c00087f8>] (start_kernel+0x0/0x1b0) (start_kernel+0x0/0x1b0) from
[<80008094>] from [<80008094>] (0x80008094)
(0x80008094)

Code: Code: e89da800 e89da800 e1a0c00d e1a0c00d e92dd800 e92dd800

e24cb004 e24cb
004 (e5913000) (e5913000)

<0>Kernel panic - not syncing: Aiee, killing interrupt handler!
<0>Kernel panic - not syncing: Aiee, killing interrupt handler!
---------

---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 +44 -0
index 0fc2e0f..6da84a6 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,10 +172,44 @@ 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,
 	&h2_smc91x_device,
+	&h2_irda_device,
 };
 
 static void __init h2_init_smc91x(void)
@@ -266,6 +301,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 +78 -0

98 lines not on this page · raw message

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

104 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 +1009 -0

1,009 lines not on this page · raw message

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

997 lines not on this page · raw message

drivers/net/irda/sa1100_ir.c +0 -0
include/asm-arm/arch-omap/irda.h new file +26 -0
new file mode 100644
index 0000000..361ed9a
@@ -0,0 +1,26 @@
+/*
+ *  linux/include/asm-arm/arch-omap/irda.h
+ *
+ *  Copyright (C) 2005 Komal Shah <[email protected]>
+ *
+ * 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.
+ */
+#ifndef ASMARM_ARCH_IRDA_H
+#define ASMARM_ARCH_IRDA_H
+
+/* board specific transceiver capabilities */
+
+#define IR_SEL		1	/* Selects IrDA */
+#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 (*select_irda)(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