Skip to contentSkip to conversation

how to use mcbsp for i2s?

DISCUSSION Ernesto Torres 3 participants 8 messages Apr 1, 2009 – Apr 4, 2009

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

I'm currently working in adding an external codec to the beagleboard, so far the i2c control part is functional, now i want to use mcbsp3 to provide i2s transfers

Is there any way to test the mcbsp to validate the connection?

Also, I've done little modifications to the omap3beagle.c to change from mcbsp2 to mcbsp3, can someone validate this is correct?

In:
static int __init omap3beagle_soc_init(void)

I changed to:
*(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 2; /* McBSP3 */

It was:
*(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */

Is this correct? Or it should be changed in other places too?

Thanks

#1 lore raw
Quoted 5 lines · Ernesto Torres

I'm currently working in adding an external codec to the beagleboard, so far the i2c control part is functional, now i want to use mcbsp3 to provide i2s transfers

Is there any way to test the mcbsp to validate the connection?

The easiest thing is often to use a scope to check that clocks and data are present on the relevant lines.

#2 lore raw
In reply to Ernesto Torres
Quoted 16 lines · Ernesto Torres

I'm currently working in adding an external codec to the beagleboard, so far
the i2c control part is functional, now i want to use mcbsp3 to provide i2s transfers

Is there any way to test the mcbsp to validate the connection?

Also, I've done little modifications to the omap3beagle.c to change from mcbsp2 to mcbsp3, can someone validate this is correct?

In:
static int __init omap3beagle_soc_init(void)

I changed to:
*(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 2; /* McBSP3 */

Quoted 6 lines

It was:
*(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */

Is this correct? Or it should be changed in other places too?

It is basically enough as well as setting correct DAI and clocking

configuration (if needed)
in omap3beagle_hw_params.

But by default McBSP1 and 3 which available in Beale pin header are muxed to GPIO
so you need to mux those pins for McBSP by the bootloader and with linux-omap
kernel multiplexing support.

I may have a hack patch somewhere... I'll try to find it and post it here for reference.

Jarkko

#3 lore raw
Quoted 11 lines · Jarkko Nikula

But by default McBSP1 and 3 which available in Beale pin header are muxed to GPIO
so you need to mux those pins for McBSP by the bootloader and with linux-omap
kernel multiplexing support.

I may have a hack patch somewhere... I'll try to find it and post it here for reference.

Grrr... cannot find the hack, I'm too keen to delete temporary hacks. I was

pretty sure I had
it somewhere.

Basically it was adding necessary pin multiplexing configuration into arch/arm/plat-omap/include/mach/mux.h and arch/arm/mach-omap2/mux.c and then using omap_cfg_reg(...) in omap3beagle.c to change pin configuration from
GPIOs to McBPS[1 | 3] pins.

Jarkko

#4 lore raw
Quoted 11 lines · On Thu, 2 Apr 2009 13:20:36 +0300 Jarkko Nikula <[email protected]> wrote:
Quoted 2 lines

Grrr... cannot find the hack, I'm too keen to delete temporary hacks. I was

pretty sure I had
it somewhere.

Basically it was adding necessary pin multiplexing configuration into arch/arm/plat-omap/include/mach/mux.h and arch/arm/mach-omap2/mux.c and then using omap_cfg_reg(...) in omap3beagle.c to change pin configuration from
GPIOs to McBPS[1 | 3] pins.

Yes, I found it. Hack attached :-)

Now I don't have here Beagle to test but hack still applies on top of linux-omap. Then you will need CONFIG_OMAP_MUX=y and following lines into omap3beagle.c or board-omap3beagle.c.

omap_cfg_reg(AF6_3430_MCBSP3_DX);
omap_cfg_reg(AE6_3430_MCBSP3_DR);
omap_cfg_reg(AF5_3430_MCBSP3_CLKX);
omap_cfg_reg(AE5_3430_MCBSP3_FSX);

Jarkko

Quoted 1 line

From 01d684991c9683383dd78df61328e67c6f593ad5 Mon Sep 17 00:00:00 2001

From: Jarkko Nikula <[email protected]>
Date: Thu, 9 Oct 2008 15:28:02 +0300
Subject: [PATCH] ARM: OMAP: Hack add some OMAP3 McBSP muxing

---
 arch/arm/mach-omap2/mux.c             |   52 +++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/mux.h |   29 ++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mux.c +52 -0
index dacb41f..1dff09e 100644
@@ -261,6 +261,58 @@ static struct pin_config __initdata_or_module omap34xx_pins[] = {
  *		mux-mode | [active-mode | off-mode]
  */
 
+/* Primary McBSP multiplexing */
+MUX_CFG_34XX("Y21_3430_MCBSP1_CLKR", 0x18c,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AA21_3430_MCBSP1_FSR", 0x18e,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("Y21_3430_MCBSP1_DX", 0x190,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("U21_3430_MCBSP1_DR", 0x192,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("T21_3430_MCBSP1_CLKS", 0x194,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("K26_3430_MCBSP1_FSX", 0x196,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("W21_3430_MCBSP1_CLKX", 0x198,
+		OMAP34XX_MUX_MODE0)
+
+MUX_CFG_34XX("P21_3430_MCBSP2_FSX", 0x13c,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("N21_3430_MCBSP2_CLKX", 0x13e,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("R21_3430_MCBSP2_DR", 0x140,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("M21_3430_MCBSP2_DX", 0x142,
+		OMAP34XX_MUX_MODE0)
+
+MUX_CFG_34XX("AF6_3430_MCBSP3_DX", 0x16c,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AE6_3430_MCBSP3_DR", 0x16e,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AF5_3430_MCBSP3_CLKX", 0x170,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AE5_3430_MCBSP3_FSX", 0x172,
+		OMAP34XX_MUX_MODE0)
+
+MUX_CFG_34XX("AE1_3430_MCBSP4_CLKX", 0x184,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AD1_3430_MCBSP4_DR", 0x186,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AD2_3430_MCBSP4_DX", 0x188,
+		OMAP34XX_MUX_MODE0)
+MUX_CFG_34XX("AC1_3430_MCBSP4_FSX", 0x18a,
+		OMAP34XX_MUX_MODE0)
+
+MUX_CFG_34XX("AF10_3430_MCBSP5_CLKX", 0x5d8,
+		OMAP34XX_MUX_MODE1)
+MUX_CFG_34XX("AE11_3430_MCBSP5_DR", 0x5e4,
+		OMAP34XX_MUX_MODE1)
+MUX_CFG_34XX("AH9_3430_MCBSP5_FSX", 0x5e6,
+		OMAP34XX_MUX_MODE1)
+MUX_CFG_34XX("AF13_3430_MCBSP5_DX", 0x5e8,
+		OMAP34XX_MUX_MODE1)
+
 /* 34xx I2C */
 MUX_CFG_34XX("K21_34XX_I2C1_SCL", 0x1ba,
 		OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
arch/arm/plat-omap/include/mach/mux.h +29 -0
index f4362b8..c0cfa73 100644
@@ -677,6 +677,35 @@ enum omap24xx_index {
 };
 
 enum omap34xx_index {
+	/* Primary McBSP multiplexing */
+	Y21_3430_MCBSP1_CLKR,
+	AA21_3430_MCBSP1_FSR,
+	Y21_3430_MCBSP1_DX,
+	U21_3430_MCBSP1_DR,
+	T21_3430_MCBSP1_CLKS,
+	K26_3430_MCBSP1_FSX,
+	W21_3430_MCBSP1_CLKX,
+
+	P21_3430_MCBSP2_FSX,
+	N21_3430_MCBSP2_CLKX,
+	R21_3430_MCBSP2_DR,
+	M21_3430_MCBSP2_DX,
+
+	AF6_3430_MCBSP3_DX,
+	AE6_3430_MCBSP3_DR,
+	AF5_3430_MCBSP3_CLKX,
+	AE5_3430_MCBSP3_FSX,
+
+	AE1_3430_MCBSP4_CLKX,
+	AD1_3430_MCBSP4_DR,
+	AD2_3430_MCBSP4_DX,
+	AC1_3430_MCBSP4_FSX,
+
+	AF10_3430_MCBSP5_CLKX,
+	AE11_3430_MCBSP5_DR,
+	AH9_3430_MCBSP5_FSX,
+	AF13_3430_MCBSP5_DX,
+
 	/* 34xx I2C */
 	K21_34XX_I2C1_SCL,
 	J21_34XX_I2C1_SDA,
Signature · 1 line
1.5.6.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

thank you, I'll try it and let you know how it went

Quoted 34 lines · Jarkko Nikula
Quoted 11 lines · On Thu, 2 Apr 2009 13:20:36 +0300 Jarkko Nikula <[email protected]> wrote:
Quoted 2 lines

Grrr... cannot find the hack, I'm too keen to delete temporary hacks. I was

pretty sure I had
it somewhere.

Basically it was adding necessary pin multiplexing configuration into arch/arm/plat-omap/include/mach/mux.h and arch/arm/mach-omap2/mux.c and then using omap_cfg_reg(...) in omap3beagle.c to change pin configuration from
GPIOs to McBPS[1 | 3] pins.

Yes, I found it. Hack attached :-)

Now I don't have here Beagle to test but hack still applies on top of linux-omap. Then you will need CONFIG_OMAP_MUX=y and following lines into omap3beagle.c or board-omap3beagle.c.

omap_cfg_reg(AF6_3430_MCBSP3_DX);
omap_cfg_reg(AE6_3430_MCBSP3_DR);
omap_cfg_reg(AF5_3430_MCBSP3_CLKX);
omap_cfg_reg(AE5_3430_MCBSP3_FSX);

Jarkko

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Signature · 2 lines
___________
EhTd
#6 lore raw

Im getting this output from muxing:

MUX: setup AF6_3430_MCBSP3_DX (0xd800216c): 0x0004 -> 0x0000
MUX: setup AE6_3430_MCBSP3_DR (0xd800216e): 0x0004 -> 0x0000
MUX: setup AF5_3430_MCBSP3_CLKX (0xd8002170): 0x0004 -> 0x0000
MUX: setup AE5_3430_MCBSP3_FSX (0xd8002172): 0x0004 -> 0x0000

Is this correct?

Quoted 45 lines · Ernesto Torres

thank you, I'll try it and let you know how it went

Quoted 26 lines · Jarkko Nikula
Quoted 11 lines · On Thu, 2 Apr 2009 13:20:36 +0300 Jarkko Nikula <[email protected]> wrote:
Quoted 2 lines

Grrr... cannot find the hack, I'm too keen to delete temporary hacks. I was

pretty sure I had
it somewhere.

Basically it was adding necessary pin multiplexing configuration into arch/arm/plat-omap/include/mach/mux.h and arch/arm/mach-omap2/mux.c and then using omap_cfg_reg(...) in omap3beagle.c to change pin configuration from
GPIOs to McBPS[1 | 3] pins.

Yes, I found it. Hack attached :-)

Now I don't have here Beagle to test but hack still applies on top of linux-omap. Then you will need CONFIG_OMAP_MUX=y and following lines into omap3beagle.c or board-omap3beagle.c.

omap_cfg_reg(AF6_3430_MCBSP3_DX);
omap_cfg_reg(AE6_3430_MCBSP3_DR);
omap_cfg_reg(AF5_3430_MCBSP3_CLKX);
omap_cfg_reg(AE5_3430_MCBSP3_FSX);

Quoted 8 lines

Jarkko

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

--
___________
EhTd

Signature · 2 lines
___________
EhTd
#7 lore raw
Quoted 10 lines · On Fri, 3 Apr 2009 10:14:45 -0600 Ernesto Torres <[email protected]> wrote:

Im getting this output from muxing:

MUX: setup AF6_3430_MCBSP3_DX (0xd800216c): 0x0004 -> 0x0000
MUX: setup AE6_3430_MCBSP3_DR (0xd800216e): 0x0004 -> 0x0000
MUX: setup AF5_3430_MCBSP3_CLKX (0xd8002170): 0x0004 -> 0x0000
MUX: setup AE5_3430_MCBSP3_FSX (0xd8002172): 0x0004 -> 0x0000

Quoted 2 lines

Is this correct?

It look likes since debug output says that the muxmode for those pins are changed from mode 4 (gpio in this case) to 0 (McBSP3 pins in this case).

Actually all of those pins are configured as outputs in muxing module point of view but IRCC actually McBSP HW will set the direction depending on its configuration. At least I didn't notice any difference what was the muxing direction when I was playing with them shortly some time ago.

Signature · 1 line
Jarkko