Skip to contentSkip to conversation

CBUS patches

PATCH In review Felipe Balbi 1 participant 7 messages Oct 1, 2010

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

cover CBUS patches

Hi Tony,

removed a few unneeded includes and moved platform_device registration to board file.

ps: as usual, compile tested only :-p No working n810 available

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-omap2/board-n8x0.c |   96 ++++++++++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c              |    5 --
 drivers/cbus/retu.c              |   69 +---------------------------
 drivers/cbus/tahvo-usb.c         |   13 -----
 drivers/cbus/tahvo.c             |   65 +-------------------------
 5 files changed, 98 insertions(+), 150 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-omap2/board-n8x0.c |   45 ++++++++++++++++++++++++
 drivers/cbus/retu.c              |   69 +-------------------------------------
 2 files changed, 46 insertions(+), 68 deletions(-)
arch/arm/mach-omap2/board-n8x0.c +45 -0
index c14d398..82c9880 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,53 @@ 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		retu_irq_pin;
+	int		ret;
+
 	platform_device_register(&n8x0_cbus_device);
+
+	if (machine_is_nokia770()) {
+		retu_irq_pin = 62;
+	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
+			machine_is_nokia_n810_wimax()) {
+		retu_irq_pin = 108;
+	} else {
+		pr_err("retu: Unsupported board for retu\n");
+		return;
+	}
+
+	ret = gpio_request(retu_irq_pin, "RETU irq");
+	if (ret < 0) {
+		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(retu_irq_pin);
+	if (ret < 0) {
+		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(retu_irq_pin);
+		return;
+	}
+
+	set_irq_type(gpio_to_irq(retu_irq_pin), IRQ_TYPE_EDGE_RISING);
+	retu_resource[0].start = gpio_to_irq(retu_irq_pin);
+	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-omap2/board-n8x0.c |   45 ++++++++++++++++++++++++++
 drivers/cbus/tahvo.c             |   65 +-------------------------------------
 2 files changed, 46 insertions(+), 64 deletions(-)
arch/arm/mach-omap2/board-n8x0.c +45 -0
index 82c9880..f5ac666 100644
@@ -222,6 +222,20 @@ static struct platform_device n8x0_cbus_device = {
 	},
 };
 
+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 struct resource retu_resource[] = {
 	{
 		.start	= -EINVAL, /* set later */
@@ -238,30 +252,61 @@ static struct platform_device retu_device = {
 
 static void __init n8x0_cbus_init(void)
 {
+	int		tahvo_irq_pin;
 	int		retu_irq_pin;
 	int		ret;
 
 	platform_device_register(&n8x0_cbus_device);
 
 	if (machine_is_nokia770()) {
+		tahvo_irq_pin = 40;
+	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
+			machine_is_nokia_n810_wimax()) {
+		tahvo_irq_pin = 111;
+	} else {
+		pr_err("tahvo: Unsupported board for tahvo\n");
+		ret = -ENODEV;
+		return;
+	}
+
+	ret = gpio_request(tahvo_irq_pin, "TAHVO irq");
+	if (ret) {
+		pr_err("tahvo: Unable to reserve IRQ GPIO\n");
+		return;
+	}
+
+	ret = gpio_direction_input(tahvo_irq_pin);
+	if (ret) {
+		pr_err("tahvo: Unable to change direction\n");
+		gpio_free(tahvo_irq_pin);
+		return;
+	}
+
+	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
+	platform_device_register(&tahvo_device);
+
+	if (machine_is_nokia770()) {
 		retu_irq_pin = 62;
 	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
 			machine_is_nokia_n810_wimax()) {
 		retu_irq_pin = 108;
 	} else {
 		pr_err("retu: Unsupported board for retu\n");
+		gpio_free(tahvo_irq_pin);
 		return;
 	}
 
 	ret = gpio_request(retu_irq_pin, "RETU irq");
 	if (ret < 0) {
 		pr_err("retu: Unable to reserve IRQ GPIO\n");
+		gpio_free(tahvo_irq_pin);
 		return;
 	}
 
 	ret = gpio_direction_input(retu_irq_pin);
 	if (ret < 0) {
 		pr_err("retu: Unable to change gpio direction\n");
+		gpio_free(tahvo_irq_pin);
 		gpio_free(retu_irq_pin);
 		return;
 	}
drivers/cbus/tahvo.c +1 -64

90 lines not on this page · raw message

Signature · 1 line
1.7.3.rc0.35.g8ac8c
#4 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-omap2/board-n8x0.c |    6 ++++++
 drivers/cbus/tahvo-usb.c         |   13 -------------
 2 files changed, 6 insertions(+), 13 deletions(-)
arch/arm/mach-omap2/board-n8x0.c +6 -0
index f5ac666..a3b7b63 100644
@@ -236,6 +236,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 struct resource retu_resource[] = {
 	{
 		.start	= -EINVAL, /* set later */
@@ -284,6 +289,7 @@ static void __init n8x0_cbus_init(void)
 
 	tahvo_resource[0].start = gpio_to_irq(tahvo_irq_pin);
 	platform_device_register(&tahvo_device);
+	platform_device_register(&tahvo_usb_device);
 
 	if (machine_is_nokia770()) {
 		retu_irq_pin = 62;
drivers/cbus/tahvo-usb.c +0 -13
index 1cb81fd..3e3b85f 100644
@@ -742,27 +742,15 @@ 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;
 	}
@@ -774,7 +762,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
#5 lore raw
In reply to Felipe Balbi
Quoted 6 lines · Felipe

Hi Tony,

removed a few unneeded includes and moved platform_device registration to board file.

ps: as usual, compile tested only :-p No working n810 available

forgot to say, patches also available at:

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

Signature · 1 line
balbi
#6 lore raw
Quoted 11 lines · Felipe
Quoted 6 lines · Felipe

Hi Tony,

removed a few unneeded includes and moved platform_device registration to board file.

ps: as usual, compile tested only :-p No working n810 available

forgot to say, patches also available at:

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

Jarkko Nikula reminded me about 770. It also has cbus so it's now missing the platform_devices hehe. Sorry about that. Forget about these patches.

Signature · 1 line
balbi