public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus
@ 2009-12-02 22:35 Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 01/10] arm: omap1: clock: fix section mismatch Felipe Balbi
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

on the following we have section mismatch fixes,
compile fix to board-nokia770.c, compile fix to sossi.c,
compile fix to hwa742.c, compile fix to tahvo-usb.c
and a few cleanups to cbus driver.

It's compile tested only as I don't have 770s or n8x0 with
the development jig available right now, so please, if you
have any of those boards dusting around, test the following
patches.

(looks like everything is compiling fine now)

Felipe Balbi (10):
  arm: omap1: clock: fix section mismatch
  arm: omap: n770: make it build again
  video: omap: sossi: make it build again
  video: omap: hwa742: make it build again
  cbus: tahvo-usb: make it build again
  cbus: switch to kzalloc
  cbus: move EXPORT_SYMBOL close to its exported symbols
  cbus: separate into several MODULE_AUTHOR entries
  cbus: move to platform_driver
  cbus: add platform_data to pass gpios

 arch/arm/mach-omap1/board-nokia770.c   |   18 +++++++-
 arch/arm/mach-omap1/clock.c            |    2 +-
 arch/arm/mach-omap2/board-n8x0.c       |   18 +++++++
 arch/arm/plat-omap/include/plat/cbus.h |   31 +++++++++++++
 drivers/cbus/cbus.c                    |   77 ++++++++++++++++++--------------
 drivers/cbus/tahvo-usb.c               |   12 +++---
 drivers/video/omap/hwa742.c            |    1 +
 drivers/video/omap/sossi.c             |    1 +
 8 files changed, 119 insertions(+), 41 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/cbus.h


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 01/10] arm: omap1: clock: fix section mismatch
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 02/10] arm: omap: n770: make it build again Felipe Balbi
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

omap1_clk_functions was only used by
omap1_clk_init() which sits in __init
section, so make omap1_clock_functions
be __initdata to avoid the section mismatch.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 arch/arm/mach-omap1/clock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 42cbe20..d28ace2 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -744,7 +744,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
 #define omap1_clk_disable_unused	NULL
 #endif
 
-static struct clk_functions omap1_clk_functions = {
+static struct clk_functions omap1_clk_functions __initdata = {
 	.clk_enable		= omap1_clk_enable,
 	.clk_disable		= omap1_clk_disable,
 	.clk_round_rate		= omap1_clk_round_rate,
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 02/10] arm: omap: n770: make it build again
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 01/10] arm: omap1: clock: fix section mismatch Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 03/10] video: omap: sossi: " Felipe Balbi
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

there's no <plat/omapfb.h> it's now under <linux/omapfb.h>

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 arch/arm/mach-omap1/board-nokia770.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index af4d719..db9a1de 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -20,6 +20,7 @@
 #include <linux/spi/ads7846.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
+#include <linux/omapfb.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -33,7 +34,6 @@
 #include <plat/keypad.h>
 #include <plat/common.h>
 #include <plat/dsp_common.h>
-#include <plat/omapfb.h>
 #include <plat/hwa742.h>
 #include <plat/lcd_mipid.h>
 #include <plat/mmc.h>
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 03/10] video: omap: sossi: make it build again
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 01/10] arm: omap1: clock: fix section mismatch Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 02/10] arm: omap: n770: make it build again Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 04/10] video: omap: hwa742: " Felipe Balbi
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

add missing <linux/interrupt.h>

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/video/omap/sossi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap/sossi.c b/drivers/video/omap/sossi.c
index 354cbbb..8fb7c70 100644
--- a/drivers/video/omap/sossi.c
+++ b/drivers/video/omap/sossi.c
@@ -23,6 +23,7 @@
 #include <linux/clk.h>
 #include <linux/irq.h>
 #include <linux/io.h>
+#include <linux/interrupt.h>
 
 #include <plat/dma.h>
 
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 04/10] video: omap: hwa742: make it build again
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (2 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 03/10] video: omap: sossi: " Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: " Felipe Balbi
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

add missing <linux/interrupt.h>

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/video/omap/hwa742.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index 170d171..0016f77 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -25,6 +25,7 @@
 #include <linux/fb.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
+#include <linux/interrupt.h>
 
 #include <plat/dma.h>
 #include <plat/hwa742.h>
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: make it build again
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (3 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 04/10] video: omap: hwa742: " Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-09  2:29   ` [APPLIED] " Tony Lindgren
  2009-12-02 22:35 ` [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc Felipe Balbi
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

plenty of legacy code sitting there. Make it build
again. Later patches will come to clean that up.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/tahvo-usb.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/cbus/tahvo-usb.c b/drivers/cbus/tahvo-usb.c
index c08f08d..9f8bbcc 100644
--- a/drivers/cbus/tahvo-usb.c
+++ b/drivers/cbus/tahvo-usb.c
@@ -114,8 +114,8 @@ static struct platform_device *tahvo_otg_dev;
 
 static irqreturn_t omap_otg_irq(int irq, void *arg)
 {
-	struct platform_device *otg_dev = (struct platform_device *) arg;
-	struct tahvo_usb *tu = (struct tahvo_usb *) otg_dev->dev.driver_data;
+	struct platform_device *otg_dev = arg;
+	struct tahvo_usb *tu = platform_get_drvdata(otg_dev);
 	u16 otg_irq;
 
 	otg_irq = omap_readw(OTG_IRQ_SRC);
@@ -227,7 +227,7 @@ struct device_driver omap_otg_driver = {
 static ssize_t vbus_state_show(struct device *device,
 			       struct device_attribute *attr, char *buf)
 {
-	struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
+	struct tahvo_usb *tu = dev_get_drvdata(device);
 	return sprintf(buf, "%d\n", tu->vbus_state);
 }
 static DEVICE_ATTR(vbus_state, 0444, vbus_state_show, NULL);
@@ -590,7 +590,7 @@ static void tahvo_usb_vbus_interrupt(unsigned long arg)
 static ssize_t otg_mode_show(struct device *device,
 			     struct device_attribute *attr, char *buf)
 {
-	struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
+	struct tahvo_usb *tu = dev_get_drvdata(device);
 	switch (tu->tahvo_mode) {
 	case TAHVO_MODE_HOST:
 		return sprintf(buf, "host\n");
@@ -604,7 +604,7 @@ static ssize_t otg_mode_store(struct device *device,
 			      struct device_attribute *attr,
 			      const char *buf, size_t count)
 {
-	struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
+	struct tahvo_usb *tu = dev_get_drvdata(device);
 	int r;
 
 	r = strlen(buf);
@@ -706,7 +706,7 @@ static int tahvo_usb_probe(struct device *dev)
 		return ret;
 	}
 
-	dev->driver_data = tu;
+	dev_set_drvdata(dev, tu);
 
 	/* Act upon current vbus state once at startup. A vbus state irq may or
 	 * may not be generated in addition to this. */
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (4 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: " Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-09  2:29   ` [APPLIED] " Tony Lindgren
  2009-12-02 22:35 ` [RFT/RFC/PATCH 07/10] cbus: move EXPORT_SYMBOL close to its exported symbols Felipe Balbi
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

change kmalloc() + memset() to kzalloc(), no functional
changes.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index c80cede..0bcc211 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -224,12 +224,10 @@ int __init cbus_bus_init(void)
 	struct cbus_host *chost;
 	int ret;
 
-	chost = kmalloc(sizeof (*chost), GFP_KERNEL);
+	chost = kzalloc(sizeof (*chost), GFP_KERNEL);
 	if (chost == NULL)
 		return -ENOMEM;
 
-	memset(chost, 0, sizeof (*chost));
-
 	spin_lock_init(&chost->lock);
 
 	/* REVISIT: Pass these from board-*.c files in platform_data */
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 07/10] cbus: move EXPORT_SYMBOL close to its exported symbols
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (5 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 08/10] cbus: separate into several MODULE_AUTHOR entries Felipe Balbi
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

while there, also add a missing static to cbus_bus_init().

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 0bcc211..d73d0c9 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -38,6 +38,7 @@
 #include "cbus.h"
 
 struct cbus_host *cbus_host = NULL;
+EXPORT_SYMBOL(cbus_host);
 
 #ifdef CONFIG_ARCH_OMAP1
 /* We use our own MPUIO functions to get closer to 1MHz bus speed */
@@ -210,6 +211,7 @@ int cbus_read_reg(struct cbus_host *host, int dev, int reg)
 {
 	return cbus_host ? cbus_transfer(host, dev, reg, -1) : -ENODEV;
 }
+EXPORT_SYMBOL(cbus_read_reg);
 
 /*
  * Write to a given register of the device
@@ -218,8 +220,9 @@ int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val)
 {
 	return cbus_host ? cbus_transfer(host, dev, reg, (int)val) : -ENODEV;
 }
+EXPORT_SYMBOL(cbus_write_reg);
 
-int __init cbus_bus_init(void)
+static int __init cbus_bus_init(void)
 {
 	struct cbus_host *chost;
 	int ret;
@@ -286,10 +289,6 @@ exit1:
 
 subsys_initcall(cbus_bus_init);
 
-EXPORT_SYMBOL(cbus_host);
-EXPORT_SYMBOL(cbus_read_reg);
-EXPORT_SYMBOL(cbus_write_reg);
-
 MODULE_DESCRIPTION("CBUS serial protocol");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Juha Yrjölä, David Weinehall, and Mikko Ylinen");
-- 
1.6.6.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 08/10] cbus: separate into several MODULE_AUTHOR entries
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (6 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 07/10] cbus: move EXPORT_SYMBOL close to its exported symbols Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 09/10] cbus: move to platform_driver Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios Felipe Balbi
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

will look cleaner on modinfo.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/cbus/cbus.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index d73d0c9..145e760 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -291,4 +291,6 @@ subsys_initcall(cbus_bus_init);
 
 MODULE_DESCRIPTION("CBUS serial protocol");
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Juha Yrjölä, David Weinehall, and Mikko Ylinen");
+MODULE_AUTHOR("Juha Yrjölä");
+MODULE_AUTHOR("David Weinehall");
+MODULE_AUTHOR("Mikko Ylinen");
-- 
1.6.6.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 09/10] cbus: move to platform_driver
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (7 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 08/10] cbus: separate into several MODULE_AUTHOR entries Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-02 22:35 ` [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios Felipe Balbi
  9 siblings, 0 replies; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

also add the platform_device to 770 and n8x0 board files.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 arch/arm/mach-omap1/board-nokia770.c |    6 ++++++
 arch/arm/mach-omap2/board-n8x0.c     |    8 ++++++++
 drivers/cbus/cbus.c                  |   34 +++++++++++++++++++++++++++++++++-
 3 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index db9a1de..a8debf3 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -97,8 +97,14 @@ static struct platform_device nokia770_kp_device = {
 	.resource	= nokia770_kp_resources,
 };
 
+static struct platform_device nokia770_cbus_device = {
+	.name		= "cbus",
+	.id		= -1,
+};
+
 static struct platform_device *nokia770_devices[] __initdata = {
 	&nokia770_kp_device,
+	&nokia770_cbus_device,
 };
 
 static void mipid_shutdown(struct mipid_platform_data *pdata)
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 764ab1e..068949a 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/stddef.h>
+#include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/usb/musb.h>
 
@@ -77,6 +78,11 @@ static struct mtd_partition onenand_partitions[] = {
 	},
 };
 
+static struct platform_device n8x0_cbus_device = {
+	.name		= "cbus",
+	.id		= -1,
+};
+
 static struct omap_onenand_platform_data board_onenand_data = {
 	.cs		= 0,
 	.gpio_irq	= 26,
@@ -111,6 +117,8 @@ static void __init n8x0_init_irq(void)
 
 static void __init n8x0_init_machine(void)
 {
+	platform_device_register(&n8x0_cbus_device);
+
 	/* FIXME: add n810 spi devices */
 	spi_register_board_info(n800_spi_board_info,
 				ARRAY_SIZE(n800_spi_board_info));
diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index 145e760..a35941e 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -29,6 +29,7 @@
 #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>
@@ -222,7 +223,7 @@ int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val)
 }
 EXPORT_SYMBOL(cbus_write_reg);
 
-static int __init cbus_bus_init(void)
+static int __init cbus_bus_probe(struct platform_device *pdev)
 {
 	struct cbus_host *chost;
 	int ret;
@@ -275,6 +276,8 @@ static int __init cbus_bus_init(void)
 	gpio_set_value(chost->clk_gpio, 1);
 	gpio_set_value(chost->clk_gpio, 0);
 
+	platform_set_drvdata(pdev, chost);
+
 	cbus_host = chost;
 
 	return 0;
@@ -284,13 +287,42 @@ exit2:
 	gpio_free(chost->clk_gpio);
 exit1:
 	kfree(chost);
+
 	return ret;
 }
 
+static void __exit cbus_bus_remove(struct platform_device *pdev)
+{
+	struct cbus_host	*chost = platform_get_drvdata(pdev);
+
+	gpio_free(chost->dat_gpio);
+	gpio_free(chost->clk_gpio);
+	kfree(chost);
+}
+
+static struct platform_driver cbus_driver = {
+	.remove		= __exit_p(cbus_bus_remove),
+	.driver		= {
+		.name	= "cbus",
+	},
+};
+
+static int __init cbus_bus_init(void)
+{
+	return platform_driver_probe(&cbus_driver, cbus_bus_probe);
+}
+
 subsys_initcall(cbus_bus_init);
 
+static void __exit cbus_bus_exit(void)
+{
+	platform_driver_unregister(&cbus_driver);
+}
+module_exit(cbus_bus_exit);
+
 MODULE_DESCRIPTION("CBUS serial protocol");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Juha Yrjölä");
 MODULE_AUTHOR("David Weinehall");
 MODULE_AUTHOR("Mikko Ylinen");
+
-- 
1.6.6.rc0

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios
  2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
                   ` (8 preceding siblings ...)
  2009-12-02 22:35 ` [RFT/RFC/PATCH 09/10] cbus: move to platform_driver Felipe Balbi
@ 2009-12-02 22:35 ` Felipe Balbi
  2009-12-09  2:40   ` [APPLIED] " Tony Lindgren
  9 siblings, 1 reply; 14+ messages in thread
From: Felipe Balbi @ 2009-12-02 22:35 UTC (permalink / raw)
  To: linux-omap; +Cc: Tony Lindgren, Felipe Balbi

also add the platform_data to the related
board files.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 arch/arm/mach-omap1/board-nokia770.c   |   10 ++++++++++
 arch/arm/mach-omap2/board-n8x0.c       |   10 ++++++++++
 arch/arm/plat-omap/include/plat/cbus.h |   31 +++++++++++++++++++++++++++++++
 drivers/cbus/cbus.c                    |   30 +++++-------------------------
 4 files changed, 56 insertions(+), 25 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/cbus.h

diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index a8debf3..95a3a82 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -38,6 +38,7 @@
 #include <plat/lcd_mipid.h>
 #include <plat/mmc.h>
 #include <plat/clock.h>
+#include <plat/cbus.h>
 
 #define ADS7846_PENDOWN_GPIO	15
 
@@ -97,9 +98,18 @@ static struct platform_device nokia770_kp_device = {
 	.resource	= nokia770_kp_resources,
 };
 
+static struct cbus_host_platform_data nokia770_cbus_data = {
+	.clk_gpio	= OMAP_MPUIO(11),
+	.dat_gpio	= OMAP_MPUIO(10),
+	.sel_gpio	= OMAP_MPUIO(9),
+};
+
 static struct platform_device nokia770_cbus_device = {
 	.name		= "cbus",
 	.id		= -1,
+	.dev		= {
+		.platform_data = &nokia770_cbus_data,
+	},
 };
 
 static struct platform_device *nokia770_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 068949a..84004bc 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -30,6 +30,7 @@
 #include <plat/mcspi.h>
 #include <plat/onenand.h>
 #include <plat/serial.h>
+#include <plat/cbus.h>
 
 static struct omap2_mcspi_device_config p54spi_mcspi_config = {
 	.turbo_mode	= 0,
@@ -78,9 +79,18 @@ static struct mtd_partition onenand_partitions[] = {
 	},
 };
 
+static struct cbus_host_platform_data n8x0_cbus_data = {
+	.clk_gpio	= 66,
+	.dat_gpio	= 65,
+	.sel_gpio	= 64,
+};
+
 static struct platform_device n8x0_cbus_device = {
 	.name		= "cbus",
 	.id		= -1,
+	.dev		= {
+		.platform_data = &n8x0_cbus_data,
+	},
 };
 
 static struct omap_onenand_platform_data board_onenand_data = {
diff --git a/arch/arm/plat-omap/include/plat/cbus.h b/arch/arm/plat-omap/include/plat/cbus.h
new file mode 100644
index 0000000..d938e23
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/cbus.h
@@ -0,0 +1,31 @@
+/*
+ * cbus.h - CBUS platform_data definition
+ *
+ * Copyright (C) 2004 - 2009 Nokia Corporation
+ *
+ * Written by Felipe Balbi <felipe.balbi@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file "COPYING" in the main directory of this
+ * archive for more details.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __PLAT_CBUS_H
+#define __PLAT_CBUS_H
+
+struct cbus_host_platform_data {
+	int	dat_gpio;
+	int	clk_gpio;
+	int	sel_gpio;
+};
+
+#endif /* __PLAT_CBUS_H */
diff --git a/drivers/cbus/cbus.c b/drivers/cbus/cbus.c
index a35941e..00c3c32 100644
--- a/drivers/cbus/cbus.c
+++ b/drivers/cbus/cbus.c
@@ -35,6 +35,7 @@
 #include <asm/mach-types.h>
 
 #include <plat/board.h>
+#include <plat/cbus.h>
 
 #include "cbus.h"
 
@@ -226,6 +227,7 @@ EXPORT_SYMBOL(cbus_write_reg);
 static int __init cbus_bus_probe(struct platform_device *pdev)
 {
 	struct cbus_host *chost;
+	struct cbus_host_platform_data *pdata = pdev->dev.platform_data;
 	int ret;
 
 	chost = kzalloc(sizeof (*chost), GFP_KERNEL);
@@ -234,31 +236,9 @@ static int __init cbus_bus_probe(struct platform_device *pdev)
 
 	spin_lock_init(&chost->lock);
 
-	/* REVISIT: Pass these from board-*.c files in platform_data */
-	if (machine_is_nokia770()) {
-		chost->clk_gpio = OMAP_MPUIO(11);
-		chost->dat_gpio = OMAP_MPUIO(10);
-		chost->sel_gpio = OMAP_MPUIO(9);
-	} else if (machine_is_nokia_n800() || machine_is_nokia_n810() ||
-			machine_is_nokia_n810_wimax()) {
-		chost->clk_gpio = 66;
-		chost->dat_gpio = 65;
-		chost->sel_gpio = 64;
-	} else {
-		printk(KERN_ERR "cbus: Unsupported board\n");
-		ret = -ENODEV;
-		goto exit1;
-	}
-
-#ifdef CONFIG_ARCH_OMAP1
-	if (!OMAP_GPIO_IS_MPUIO(chost->clk_gpio) ||
-	    !OMAP_GPIO_IS_MPUIO(chost->dat_gpio) ||
-	    !OMAP_GPIO_IS_MPUIO(chost->sel_gpio)) {
-		printk(KERN_ERR "cbus: Only MPUIO pins supported\n");
-		ret = -ENODEV;
-		goto exit1;
-	}
-#endif
+	chost->clk_gpio = pdata->clk_gpio;
+	chost->dat_gpio = pdata->dat_gpio;
+	chost->sel_gpio = pdata->sel_gpio;
 
 	if ((ret = gpio_request(chost->clk_gpio, "CBUS clk")) < 0)
 		goto exit1;
-- 
1.6.6.rc0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [APPLIED] [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: make it build again
  2009-12-02 22:35 ` [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: " Felipe Balbi
@ 2009-12-09  2:29   ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2009-12-09  2:29 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: cbus

Initial commit ID (Likely to change): ea51ab278e51ec3ef596862aae4ec2b63e3e82ad

PatchWorks
http://patchwork.kernel.org/patch/64371/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=ea51ab278e51ec3ef596862aae4ec2b63e3e82ad



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [APPLIED] [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc
  2009-12-02 22:35 ` [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc Felipe Balbi
@ 2009-12-09  2:29   ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2009-12-09  2:29 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: cbus

Initial commit ID (Likely to change): b57560b33964a00931ebde9deb6d99eb5172f1c2

PatchWorks
http://patchwork.kernel.org/patch/64369/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=b57560b33964a00931ebde9deb6d99eb5172f1c2



^ permalink raw reply	[flat|nested] 14+ messages in thread

* [APPLIED] [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios
  2009-12-02 22:35 ` [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios Felipe Balbi
@ 2009-12-09  2:40   ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2009-12-09  2:40 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: cbus

Initial commit ID (Likely to change): 54fb6e87c520616922a960aeb6d27a5c61976cdb

PatchWorks
http://patchwork.kernel.org/patch/64370/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=54fb6e87c520616922a960aeb6d27a5c61976cdb



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-12-09  2:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 22:35 [RFT/RFC/PATCH 00/10] cleanups, compile fix, cbus Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 01/10] arm: omap1: clock: fix section mismatch Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 02/10] arm: omap: n770: make it build again Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 03/10] video: omap: sossi: " Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 04/10] video: omap: hwa742: " Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 05/10] cbus: tahvo-usb: " Felipe Balbi
2009-12-09  2:29   ` [APPLIED] " Tony Lindgren
2009-12-02 22:35 ` [RFT/RFC/PATCH 06/10] cbus: switch to kzalloc Felipe Balbi
2009-12-09  2:29   ` [APPLIED] " Tony Lindgren
2009-12-02 22:35 ` [RFT/RFC/PATCH 07/10] cbus: move EXPORT_SYMBOL close to its exported symbols Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 08/10] cbus: separate into several MODULE_AUTHOR entries Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 09/10] cbus: move to platform_driver Felipe Balbi
2009-12-02 22:35 ` [RFT/RFC/PATCH 10/10] cbus: add platform_data to pass gpios Felipe Balbi
2009-12-09  2:40   ` [APPLIED] " Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox