Skip to contentSkip to conversation

Updates on mcbsp driver (take #4)

PATCH In review Eduardo Valentin 2 participants 7 messages May 29, 2008 – May 30, 2008

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

cover Updates on mcbsp driver (take #4)

From: Eduardo Valentin <[email protected]>

Hi Tony,

Here is the updated version of my previous patches. Now with modifications recommended by Anand and Andrew.

As on take #2, DMA and IRQ definitions were left as they are. Chandra is going to send his work on top of this series.

This series adds Tony's comments about clock usage on plat-omap/mcbsp.c. Now it is done only with usual clk_* functions calls. But a fake clock is created under mach-omap[1,2] to enable / disable correct clocks when necessary. I also included Tony's patch to fix clock definitions for 24xx.

This patch series updates mcbsp driver by transforming it into a platform driver. This is a very initial implementation. Basically it moves machine specific code to their correct place and creates the platform driver necessary structures.

It must be working for previous boards. For omap34xx it should work for mcbsp 1 and 2.

In order to do not break other places, I tryied to do not change previous API. But future improvements are needed.

Clock definitions for mcbsp 1 and 2 were also modified to add correct support for omap34xx.

Thanks for last comments. More comments are wellcome. :)

Cheers,

Eduardo Valentin (4):
PLAT-OMAP: MCBSP: Tranform into platform driver
MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1 Fix mcbsp clock definition on clock34xx.h
MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2

Tony Lindgren (1):
ARM: OMAP: Fix 24xx mcbsp clocks

 arch/arm/mach-omap1/Makefile      |    2 +
 arch/arm/mach-omap1/mcbsp.c       |  280 ++++++++++++++++
 arch/arm/mach-omap2/Makefile      |    2 +
 arch/arm/mach-omap2/clock24xx.h   |   30 ++-
 arch/arm/mach-omap2/clock34xx.h   |   30 ++-
 arch/arm/mach-omap2/mcbsp.c       |  208 ++++++++++++
 arch/arm/plat-omap/devices.c      |   45 +++
 arch/arm/plat-omap/mcbsp.c        |  662 ++++++++++++++-----------------------
 include/asm-arm/arch-omap/mcbsp.h |   62 ++++-
 9 files changed, 890 insertions(+), 431 deletions(-)
 create mode 100644 arch/arm/mach-omap1/mcbsp.c
 create mode 100644 arch/arm/mach-omap2/mcbsp.c
#1 lore raw

PATCH 1/5 PLAT-OMAP: MCBSP: Transform into platform driver

From: Eduardo Valentin <[email protected]>

This patch transform mcbsp code into a very initial implementation of a platform driver.

It also gets ride of ifdefs on mcbsp.c code.
To do it, a platform data structure was defined.

Platform devices are located in arch/arm/plat-omap/devices.c

---
 arch/arm/plat-omap/devices.c      |   45 +++
 arch/arm/plat-omap/mcbsp.c        |  662 ++++++++++++++-----------------------
 include/asm-arm/arch-omap/mcbsp.h |   62 ++++-
 3 files changed, 358 insertions(+), 411 deletions(-)
arch/arm/plat-omap/devices.c +45 -0
index 099182b..b3e0147 100644
@@ -27,6 +27,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/menelaus.h>
 #include <asm/arch/dsp_common.h>
+#include <asm/arch/mcbsp.h>
 
 #if	defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
 
@@ -150,6 +151,49 @@ static inline void omap_init_kp(void) {}
 #endif
 
 /*-------------------------------------------------------------------------*/
+#if defined(CONFIG_OMAP_MCBSP) || defined(CONFIG_OMAP_MCBSP_MODULE)
+
+static struct platform_device omap_mcbsp_devices[OMAP_MAX_MCBSP_COUNT];
+static int mcbsps_configured;
+
+void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
+					int size)
+{
+	int i;
+
+	if (size > OMAP_MAX_MCBSP_COUNT) {
+		printk(KERN_WARNING "Registered too many McBSPs platform_data."
+			" Using maximum (%d) available.\n",
+			OMAP_MAX_MCBSP_COUNT);
+		size = OMAP_MAX_MCBSP_COUNT;
+	}
+
+	for (i = 0; i < size; i++) {
+		struct platform_device *new_mcbsp = &omap_mcbsp_devices[i];
+		new_mcbsp->name = "omap-mcbsp";
+		new_mcbsp->id = i + 1;
+		new_mcbsp->dev.platform_data = &config[i];
+	}
+	mcbsps_configured = size;
+}
+
+static void __init omap_init_mcbsp(void)
+{
+	int i;
+
+	for (i = 0; i < mcbsps_configured; i++)
+		platform_device_register(&omap_mcbsp_devices[i]);
+}
+#else
+void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
+					int size)
+{  }
+
+static inline void __init omap_init_mcbsp(void)
+{  }
+#endif
+
+/*-------------------------------------------------------------------------*/
 
 #if	defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) \
 	|| defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
@@ -511,6 +555,7 @@ static int __init omap_init_devices(void)
 	 */
 	omap_init_dsp();
 	omap_init_kp();
+	omap_init_mcbsp();
 	omap_init_mmc();
 	omap_init_uwire();
 	omap_init_wdt();
arch/arm/plat-omap/mcbsp.c +253 -409

919 lines not on this page · raw message

include/asm-arm/arch-omap/mcbsp.h +60 -2

93 lines not on this page · raw message

Signature · 1 line
1.5.5.GIT
#2 lore raw

PATCH 2/5 MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1

From: Eduardo Valentin <[email protected]>

This patch adds support for mach-omap1 based on current mcbsp platform driver.

---
 arch/arm/mach-omap1/Makefile |    2 +
 arch/arm/mach-omap1/mcbsp.c  |  280 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 282 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap1/Makefile +2 -0
index c524511..d8b7e1c 100644
@@ -5,6 +5,8 @@
 # Common support
 obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o
 
+obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
+
 obj-$(CONFIG_OMAP_MPU_TIMER)	+= time.o
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
arch/arm/mach-omap1/mcbsp.c new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
1.5.5.GIT
#3 lore raw

PATCH 3/5 ARM: OMAP: Fix 24xx mcbsp clocks

From: Tony Lindgren <[email protected]>

Fix 24xx mcbsp clocks

---
 arch/arm/mach-omap2/clock24xx.h |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock24xx.h +20 -10
index ee39794..00ca071 100644
@@ -1820,7 +1820,8 @@ static struct clk gpt12_fck = {
 };
 
 static struct clk mcbsp1_ick = {
-	.name		= "mcbsp1_ick",
+	.name		= "mcbsp_ick",
+	.id		= 1,
 	.parent		= &l4_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1830,7 +1831,8 @@ static struct clk mcbsp1_ick = {
 };
 
 static struct clk mcbsp1_fck = {
-	.name		= "mcbsp1_fck",
+	.name		= "mcbsp_fck",
+	.id		= 1,
 	.parent		= &func_96m_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1840,7 +1842,8 @@ static struct clk mcbsp1_fck = {
 };
 
 static struct clk mcbsp2_ick = {
-	.name		= "mcbsp2_ick",
+	.name		= "mcbsp_ick",
+	.id		= 2,
 	.parent		= &l4_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1850,7 +1853,8 @@ static struct clk mcbsp2_ick = {
 };
 
 static struct clk mcbsp2_fck = {
-	.name		= "mcbsp2_fck",
+	.name		= "mcbsp_fck",
+	.id		= 2,
 	.parent		= &func_96m_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1860,7 +1864,8 @@ static struct clk mcbsp2_fck = {
 };
 
 static struct clk mcbsp3_ick = {
-	.name		= "mcbsp3_ick",
+	.name		= "mcbsp_ick",
+	.id		= 3,
 	.parent		= &l4_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1870,7 +1875,8 @@ static struct clk mcbsp3_ick = {
 };
 
 static struct clk mcbsp3_fck = {
-	.name		= "mcbsp3_fck",
+	.name		= "mcbsp_fck",
+	.id		= 3,
 	.parent		= &func_96m_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1880,7 +1886,8 @@ static struct clk mcbsp3_fck = {
 };
 
 static struct clk mcbsp4_ick = {
-	.name		= "mcbsp4_ick",
+	.name		= "mcbsp_ick",
+	.id		= 4,
 	.parent		= &l4_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1890,7 +1897,8 @@ static struct clk mcbsp4_ick = {
 };
 
 static struct clk mcbsp4_fck = {
-	.name		= "mcbsp4_fck",
+	.name		= "mcbsp_fck",
+	.id		= 4,
 	.parent		= &func_96m_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1900,7 +1908,8 @@ static struct clk mcbsp4_fck = {
 };
 
 static struct clk mcbsp5_ick = {
-	.name		= "mcbsp5_ick",
+	.name		= "mcbsp_ick",
+	.id		= 5,
 	.parent		= &l4_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
@@ -1910,7 +1919,8 @@ static struct clk mcbsp5_ick = {
 };
 
 static struct clk mcbsp5_fck = {
-	.name		= "mcbsp5_fck",
+	.name		= "mcbsp_fck",
+	.id		= 5,
 	.parent		= &func_96m_ck,
 	.flags		= CLOCK_IN_OMAP243X,
 	.clkdm_name	= "core_l4_clkdm",
Signature · 1 line
1.5.5.GIT
#4 lore raw

PATCH 4/5 Fix mcbsp clock definition on clock34xx.h

From: Eduardo Valentin <[email protected]>

This patch fix the clock definition for mcbsps on clock34xx.h. Device identification must be done using .id field, not only name field.

---
 arch/arm/mach-omap2/clock34xx.h |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clock34xx.h +20 -10
index 284c796..8f90b8c 100644
@@ -1480,7 +1480,8 @@ static const struct clksel mcbsp_15_clksel[] = {
 };
 
 static struct clk mcbsp5_fck = {
-	.name		= "mcbsp5_fck",
+	.name		= "mcbsp_fck",
+	.id		= 5,
 	.init		= &omap2_init_clksel_parent,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
 	.enable_bit	= OMAP3430_EN_MCBSP5_SHIFT,
@@ -1493,7 +1494,8 @@ static struct clk mcbsp5_fck = {
 };
 
 static struct clk mcbsp1_fck = {
-	.name		= "mcbsp1_fck",
+	.name		= "mcbsp_fck",
+	.id		= 1,
 	.init		= &omap2_init_clksel_parent,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
 	.enable_bit	= OMAP3430_EN_MCBSP1_SHIFT,
@@ -1941,7 +1943,8 @@ static struct clk gpt10_ick = {
 };
 
 static struct clk mcbsp5_ick = {
-	.name		= "mcbsp5_ick",
+	.name		= "mcbsp_ick",
+	.id		= 5,
 	.parent		= &core_l4_ick,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
 	.enable_bit	= OMAP3430_EN_MCBSP5_SHIFT,
@@ -1951,7 +1954,8 @@ static struct clk mcbsp5_ick = {
 };
 
 static struct clk mcbsp1_ick = {
-	.name		= "mcbsp1_ick",
+	.name		= "mcbsp_ick",
+	.id		= 1,
 	.parent		= &core_l4_ick,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
 	.enable_bit	= OMAP3430_EN_MCBSP1_SHIFT,
@@ -2754,7 +2758,8 @@ static struct clk gpt2_ick = {
 };
 
 static struct clk mcbsp2_ick = {
-	.name		= "mcbsp2_ick",
+	.name		= "mcbsp_ick",
+	.id		= 2,
 	.parent		= &per_l4_ick,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP2_SHIFT,
@@ -2764,7 +2769,8 @@ static struct clk mcbsp2_ick = {
 };
 
 static struct clk mcbsp3_ick = {
-	.name		= "mcbsp3_ick",
+	.name		= "mcbsp_ick",
+	.id		= 3,
 	.parent		= &per_l4_ick,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP3_SHIFT,
@@ -2774,7 +2780,8 @@ static struct clk mcbsp3_ick = {
 };
 
 static struct clk mcbsp4_ick = {
-	.name		= "mcbsp4_ick",
+	.name		= "mcbsp_ick",
+	.id		= 4,
 	.parent		= &per_l4_ick,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP4_SHIFT,
@@ -2790,7 +2797,8 @@ static const struct clksel mcbsp_234_clksel[] = {
 };
 
 static struct clk mcbsp2_fck = {
-	.name		= "mcbsp2_fck",
+	.name		= "mcbsp_fck",
+	.id		= 2,
 	.init		= &omap2_init_clksel_parent,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP2_SHIFT,
@@ -2803,7 +2811,8 @@ static struct clk mcbsp2_fck = {
 };
 
 static struct clk mcbsp3_fck = {
-	.name		= "mcbsp3_fck",
+	.name		= "mcbsp_fck",
+	.id		= 3,
 	.init		= &omap2_init_clksel_parent,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP3_SHIFT,
@@ -2816,7 +2825,8 @@ static struct clk mcbsp3_fck = {
 };
 
 static struct clk mcbsp4_fck = {
-	.name		= "mcbsp4_fck",
+	.name		= "mcbsp_fck",
+	.id		= 4,
 	.init		= &omap2_init_clksel_parent,
 	.enable_reg	= OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
 	.enable_bit	= OMAP3430_EN_MCBSP4_SHIFT,
Signature · 1 line
1.5.5.GIT
#5 lore raw

PATCH 5/5 MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2

From: Eduardo Valentin <[email protected]>

This patch adds support for mach-omap2 based on current mcbsp platform driver.

---
 arch/arm/mach-omap2/Makefile |    2 +
 arch/arm/mach-omap2/mcbsp.c  |  208 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 210 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/mcbsp.c
arch/arm/mach-omap2/Makefile +2 -0
index b617b66..28fa823 100644
@@ -7,6 +7,8 @@ obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \
 		devices.o serial.o gpmc.o timer-gp.o powerdomain.o \
 		clockdomain.o
 
+obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
+
 # Functions loaded to SRAM
 obj-$(CONFIG_ARCH_OMAP2)		+= sram24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= sram34xx.o
arch/arm/mach-omap2/mcbsp.c new file +208 -0

208 lines not on this page · raw message

Signature · 1 line
1.5.5.GIT
maintainer
#6 lore raw
In reply to Eduardo Valentin
Quoted 24 lines · Eduardo Valentin

From: Eduardo Valentin <[email protected]>

Hi Tony,

Here is the updated version of my previous patches. Now with modifications recommended by Anand and Andrew.

As on take #2, DMA and IRQ definitions were left as they are. Chandra is going to send his work on top of this series.

This series adds Tony's comments about clock usage on plat-omap/mcbsp.c. Now it is done only with usual clk_* functions calls. But a fake clock is created under mach-omap[1,2] to enable / disable correct clocks when necessary. I also included Tony's patch to fix clock definitions for 24xx.

This patch series updates mcbsp driver by transforming it into a platform driver. This is a very initial implementation. Basically it moves machine specific code to their correct place and creates the platform driver necessary structures.

It must be working for previous boards. For omap34xx it should work for mcbsp 1 and 2.

Quoted 7 lines

In order to do not break other places, I tryied to do not change previous API. But future improvements are needed.

Clock definitions for mcbsp 1 and 2 were also modified to add correct support for omap34xx.

Thanks for last comments. More comments are wellcome. :)

Pushing this series today.

Tony

Quoted 29 lines

Cheers,

Eduardo Valentin (4):
PLAT-OMAP: MCBSP: Tranform into platform driver
MACH-OMAP1: MCBSP: Add support for mcbsp on mach-omap1 Fix mcbsp clock definition on clock34xx.h
MACH-OMAP2: MCBSP: Add support for mcbsp on mach-omap2

Tony Lindgren (1):
ARM: OMAP: Fix 24xx mcbsp clocks

 arch/arm/mach-omap1/Makefile      |    2 +
 arch/arm/mach-omap1/mcbsp.c       |  280 ++++++++++++++++
 arch/arm/mach-omap2/Makefile      |    2 +
 arch/arm/mach-omap2/clock24xx.h   |   30 ++-
 arch/arm/mach-omap2/clock34xx.h   |   30 ++-
 arch/arm/mach-omap2/mcbsp.c       |  208 ++++++++++++
 arch/arm/plat-omap/devices.c      |   45 +++
 arch/arm/plat-omap/mcbsp.c        |  662 ++++++++++++++-----------------------
 include/asm-arm/arch-omap/mcbsp.h |   62 ++++-
 9 files changed, 890 insertions(+), 431 deletions(-)
 create mode 100644 arch/arm/mach-omap1/mcbsp.c
 create mode 100644 arch/arm/mach-omap2/mcbsp.c

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