Skip to contentSkip to conversation

Horray, more CBUS patches

PATCH In review Felipe Balbi 3 participants 8 messages Oct 19, 2010 – Nov 5, 2010

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

cover Horray, more CBUS patches

I believe now everything is fine. Still, it's only compile tested with n770_defconfig and omap2plus_defconfig.

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     |   73 ++++++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c                  |    5 --
 drivers/cbus/retu.c                  |   69 +-------------------------------
 drivers/cbus/tahvo-usb.c             |   15 +------
 drivers/cbus/tahvo.c                 |   65 +-----------------------------
 6 files changed, 149 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-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 b9e9de4..3969f2d 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 67aaaef..938742d 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     |   33 +++++++++++++++++
 drivers/cbus/tahvo.c                 |   65 +---------------------------------
 3 files changed, 66 insertions(+), 64 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +32 -0
index 3969f2d..fabc154 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 +33 -0
index 938742d..1823f01 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;
@@ -258,6 +272,25 @@ static void __init n8x0_cbus_init(void)
 	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 -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-omap1/board-nokia770.c |    6 ++++++
 arch/arm/mach-omap2/board-n8x0.c     |    6 ++++++
 drivers/cbus/tahvo-usb.c             |   15 ++-------------
 3 files changed, 14 insertions(+), 13 deletions(-)
arch/arm/mach-omap1/board-nokia770.c +6 -0
index fabc154..51bd52c 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 -0
index 1823f01..ebd460e 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;
@@ -291,6 +296,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
#5 lore raw
In reply to Felipe Balbi
Quoted 9 lines · On Tue, 19 Oct 2010 10:29:14 +0300 Felipe Balbi <[email protected]> wrote:

I believe now everything is fine. Still, it's only compile tested with n770_defconfig and omap2plus_defconfig.

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

omap2plus_defconfig doesn't include CONFIG_CBUS(_x) so you must enable them manually.

Signature · 1 line
Jarkko
#6 lore raw
Quoted 6 lines · Jarkko Nikula
Quoted 3 lines · On Tue, 19 Oct 2010 10:29:14 +0300 Felipe Balbi <[email protected]> wrote:

I believe now everything is fine. Still, it's only compile tested with n770_defconfig and omap2plus_defconfig.

Quoted 8 lines
Quoted 6 lines

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

omap2plus_defconfig doesn't include CONFIG_CBUS(_x) so you must enable them manually.

I did that, don't worry

Signature · 1 line
balbi
maintainer
#7 lore raw
Quoted 13 lines · Felipe Balbi
Quoted 12 lines · Jarkko Nikula
Quoted 9 lines · On Tue, 19 Oct 2010 10:29:14 +0300 Felipe Balbi <[email protected]> wrote:

I believe now everything is fine. Still, it's only compile tested with n770_defconfig and omap2plus_defconfig.

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

Quoted 4 lines
Quoted 2 lines

omap2plus_defconfig doesn't include CONFIG_CBUS(_x) so you must enable them manually.

I did that, don't worry

Adding these patches to the cbus branch.

Tony