Skip to contentSkip to conversation

CBUS patches (v2)

PATCH In review Felipe Balbi 2 participants 8 messages Oct 1, 2010 – Nov 5, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover CBUS patches (v2)

Tony,

Now CBUS patches changing also n770. Sorry about the previous version. I was too quick when thinking a non-functional change couldn't possibly be wrong hehe :-p

At least know, the patches look better. Below is pull request too if you prefer to pull into your cbus branch:

***** Note: compilation of nokia770 doesn't work, so I couldn't even compile ***** test these patches against that board :-(

The following changes since commit 2365f1f7e5544b531ccd3e07fd06bb12bf7a62a7:

Linux-omap rebuilt: Updated to v2.6.36-rc6, merged in few more patches (2010-09-29 11:19:10 -0700)

are available in the git repository at:

git://gitorious.org/usb/usb.git cbus

Felipe Balbi (4):
cbus: remove unneded includes
cbus: retu: move platform_device to board file
cbus: tahvo: move platform_device to board file
cbus: tahvo-usb: move platform_device to board file

 arch/arm/mach-omap1/board-nokia770.c |   72 ++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   68 ++++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c                  |    5 --
 drivers/cbus/retu.c                  |   69 +--------------------------------
 drivers/cbus/tahvo-usb.c             |   15 +------
 drivers/cbus/tahvo.c                 |   63 +-----------------------------
 6 files changed, 144 insertions(+), 148 deletions(-)
Signature · 1 line
1.7.3.rc0.35.g8ac8c
#1 lore raw

PATCH 1/4 cbus: remove unneded includes

we don't use anything from those headers,
thus removing them.

---
 drivers/cbus/cbus.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/cbus/cbus.c +0 -5
index 9e745bb..a8bbf42 100644
@@ -30,15 +30,10 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
 
-#include <asm/io.h>
-#include <asm/mach-types.h>
-
-#include <plat/board.h>
 #include <plat/cbus.h>
 
 #include "cbus.h"
Signature · 1 line
1.7.3.rc0.35.g8ac8c
#2 lore raw

PATCH 2/4 cbus: retu: move platform_device to board file

In reply to Felipe Balbi

No functional changes, just moving platform_device registration to the proper location.

---
 arch/arm/mach-omap1/board-nokia770.c |   34 +++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   34 +++++++++++++++++
 drivers/cbus/retu.c                  |   69 +---------------------------------
 3 files changed, 69 insertions(+), 68 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +34 -0
index d739dd1..ac708ba 100644
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/irq.h>
 #include <linux/input.h>
 #include <linux/clk.h>
 #include <linux/omapfb.h>
@@ -112,9 +113,42 @@ static struct platform_device nokia770_cbus_device = {
 	},
 };
 
+static struct resource retu_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device retu_device = {
+	.name		= "retu",
+	.id		= -1,
+	.resource	= retu_resource,
+	.num_resources	= ARRAY_SIZE(retu_resource),
+};
+
 static void __init nokia770_cbus_init(void)
 {
+	int		ret;
+
 	platform_device_register(&nokia770_cbus_device);
+
+	ret = gpio_request(62, "RETU irq");
+	if (ret < 0) {
+		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(62);
+	if (ret < 0) {
+		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(62);
+		return;
+	}
+
+	set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(62);
+	platform_device_register(&retu_device);
 }
 
 #else
arch/arm/mach-omap2/board-n8x0.c +34 -0
index c14d398..26f938e 100644
@@ -15,6 +15,7 @@
 #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>
@@ -221,9 +222,42 @@ static struct platform_device n8x0_cbus_device = {
 	},
 };
 
+static struct resource retu_resource[] = {
+	{
+		.start	= -EINVAL, /* set later */
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device retu_device = {
+	.name		= "retu",
+	.id		= -1,
+	.resource	= retu_resource,
+	.num_resources	= ARRAY_SIZE(retu_resource),
+};
+
 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;
+	}
+
+	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(108);
+	platform_device_register(&retu_device);
 }
 
 #else
drivers/cbus/retu.c +1 -68

94 lines not on this page · raw message

Signature · 1 line
1.7.3.rc0.35.g8ac8c
#3 lore raw

PATCH 3/4 cbus: tahvo: move platform_device to board file

In reply to Felipe Balbi

No functional changes, just moving platform_device registration to the proper location.

---
 arch/arm/mach-omap1/board-nokia770.c |   32 +++++++++++++++++
 arch/arm/mach-omap2/board-n8x0.c     |   35 +++++++++++++++++--
 drivers/cbus/tahvo.c                 |   63 +---------------------------------
 3 files changed, 65 insertions(+), 65 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +32 -0
index ac708ba..962363b 100644
@@ -127,6 +127,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+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),
+};
+
 static void __init nokia770_cbus_init(void)
 {
 	int		ret;
@@ -149,6 +163,24 @@ static void __init nokia770_cbus_init(void)
 	set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_RISING);
 	retu_resource[0].start = gpio_to_irq(62);
 	platform_device_register(&retu_device);
+
+	ret = gpio_request(40, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		gpio_free(62);
+		return;
+	}
+
+	ret = gpio_direction_input(40);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(62);
+		gpio_free(40);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(40);
+	platform_device_register(&tahvo_device);
 }
 
 #else
arch/arm/mach-omap2/board-n8x0.c +32 -3
index 26f938e..c840710 100644
@@ -236,6 +236,20 @@ static struct platform_device retu_device = {
 	.num_resources	= ARRAY_SIZE(retu_resource),
 };
 
+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),
+};
+
 static void __init n8x0_cbus_init(void)
 {
 	int		ret;
@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	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
drivers/cbus/tahvo.c +1 -62

81 lines not on this page · raw message

Signature · 1 line
1.7.3.rc0.35.g8ac8c
#4 lore raw

Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file

arch/arm/mach-omap2/board-n8x0.c static void __init n8x0_cbus_init(void) · line 260

Quoted 7 lines · Felipe
arch/arm/mach-omap2/board-n8x0.c +0 -3
@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
-	retu_resource[0].start = gpio_to_irq(108);
-	platform_device_register(&retu_device);

hmmm, these three deleted lines look suspicious :-(

Let these cook for a while, I'll get back to them in a day or two. CBUS is making me crazy :-p

Signature · 1 line
balbi
maintainer
#5 lore raw

Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file

Quoted 5 lines · Felipe Balbi
Quoted 4 lines · Felipe
(quoted diff) +0 -0
@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
Quoted 8 lines

arch/arm/mach-omap2/board-n8x0.c static void __init n8x0_cbus_init(void) · line 260

Quoted 3 lines
arch/arm/mach-omap2/board-n8x0.c +0 -3
-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
-	retu_resource[0].start = gpio_to_irq(108);
-	platform_device_register(&retu_device);

hmmm, these three deleted lines look suspicious :-(

Let these cook for a while, I'll get back to them in a day or two. CBUS is making me crazy :-p

Marking these as changes needed then in pw.k.o.

Tony

maintainer
#6 lore raw

Re: [PATCH 3/4] cbus: tahvo: move platform_device to board file

Quoted 12 lines · Tony Lindgren
Quoted 11 lines · Felipe Balbi

arch/arm/mach-omap2/board-n8x0.c static void __init n8x0_cbus_init(void) · line 260

Quoted 7 lines · Felipe
arch/arm/mach-omap2/board-n8x0.c +0 -3
@@ -255,9 +269,24 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
-	retu_resource[0].start = gpio_to_irq(108);
-	platform_device_register(&retu_device);

hmmm, these three deleted lines look suspicious :-(

Quoted 4 lines
Quoted 2 lines

Let these cook for a while, I'll get back to them in a day or two. CBUS is making me crazy :-p

Marking these as changes needed then in pw.k.o.

Ah already archived and looking at the later set now, never mind..

Tony

#7 lore raw

PATCH 4/4 cbus: tahvo-usb: move platform_device to board file

In reply to Felipe Balbi

No functional changes, just moving platform_device registration to the proper location.

---
 arch/arm/mach-omap1/board-nokia770.c |    6 ++++++
 arch/arm/mach-omap2/board-n8x0.c     |    7 ++++++-
 drivers/cbus/tahvo-usb.c             |   15 ++-------------
 3 files changed, 14 insertions(+), 14 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +6 -0
index 962363b..5dd21dc 100644
@@ -141,6 +141,11 @@ static struct platform_device tahvo_device = {
 	.num_resources	= ARRAY_SIZE(tahvo_resource),
 };
 
+static struct platform_device tahvo_usb_device = {
+	.name		= "tahvo-usb",
+	.id		= -1,
+};
+
 static void __init nokia770_cbus_init(void)
 {
 	int		ret;
@@ -181,6 +186,7 @@ static void __init nokia770_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(40);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 }
 
 #else
arch/arm/mach-omap2/board-n8x0.c +6 -1
index c840710..aaa40ae 100644
@@ -250,6 +250,11 @@ static struct platform_device tahvo_device = {
 	.num_resources	= ARRAY_SIZE(tahvo_resource),
 };
 
+static struct platform_device tahvo_usb_device = {
+	.name		= "tahvo-usb",
+	.id		= -1,
+};
+
 static void __init n8x0_cbus_init(void)
 {
 	int		ret;
@@ -276,7 +281,6 @@ static void __init n8x0_cbus_init(void)
 		return;
 	}
 
-	/* Set the pin as input */
 	ret = gpio_direction_input(111);
 	if (ret) {
 		pr_err("tahvo: Unable to change direction\n");
@@ -287,6 +291,7 @@ static void __init n8x0_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(111);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 }
 
 #else
drivers/cbus/tahvo-usb.c +2 -13
index 1cb81fd..3b83bab 100644
@@ -742,30 +742,20 @@ static struct platform_driver tahvo_usb_driver = {
 	.remove		= __exit_p(tahvo_usb_remove),
 };
 
-static struct platform_device tahvo_usb_device = {
-	.name		= "tahvo-usb",
-	.id		= -1,
-};
-
 static int __init tahvo_usb_init(void)
 {
 	int ret = 0;
 
-	printk(KERN_INFO "Tahvo USB transceiver driver initializing\n");
 	ret = platform_driver_probe(&tahvo_usb_driver, tahvo_usb_probe);
 	if (ret)
 		return ret;
-	ret = platform_device_register(&tahvo_usb_device);
-	if (ret < 0) {
-		platform_driver_unregister(&tahvo_usb_driver);
-		return ret;
-	}
+
 	ret = platform_driver_probe(&omap_otg_driver, omap_otg_probe);
 	if (ret) {
-		platform_device_unregister(&tahvo_usb_device);
 		platform_driver_unregister(&tahvo_usb_driver);
 		return ret;
 	}
+
 	return 0;
 }
 
@@ -774,7 +764,6 @@ subsys_initcall(tahvo_usb_init);
 static void __exit tahvo_usb_exit(void)
 {
 	platform_driver_unregister(&omap_otg_driver);
-	platform_device_unregister(&tahvo_usb_device);
 	platform_driver_unregister(&tahvo_usb_driver);
 }
 module_exit(tahvo_usb_exit);
Signature · 1 line
1.7.3.rc0.35.g8ac8c