Skip to contentSkip to conversation

OMAP3: Fix handling of McBSP registers XCCR and RCCR for OMAP2430/34xx

PATCH In review [email protected] 3 participants 4 messages Nov 21, 2008

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

PATCH 1/1 OMAP3: Fix handling of McBSP registers XCCR and RCCR for OMAP2430/34xx

From: Misael Lopez Cruz <[email protected]>

This patch fixes handling of XCCR and RCCR registers of McBSP for OMAP2430 and 34xx platforms. It also fixes OMAP McBSP DAI driver which was setting those registers to 0, as they were not initialized.

---
 arch/arm/plat-omap/include/mach/mcbsp.h |    7 +++++++
 arch/arm/plat-omap/mcbsp.c              |    1 +
 sound/soc/omap/omap-mcbsp.c             |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/mach/mcbsp.h +7 -0
index 3e38575..faa9164 100644
@@ -245,11 +245,16 @@
 #define XPBBLK(value)		((value)<<7)	/* Bits 7:8 */
 
 /*********************** McBSP XCCR bit definitions *************************/
+#define EXTCLKGATE		0x8000
+#define PPCONNECT		0x4000
+#define DXENDLY(value)		((value)<<12)	/* Bits 12:13 */
+#define XFULL_CYCLE		0x0800
 #define DILB			0x0020
 #define XDMAEN			0x0008
 #define XDISABLE		0x0001
 
 /********************** McBSP RCCR bit definitions *************************/
+#define RFULL_CYCLE		0x0800
 #define RDMAEN			0x0008
 #define RDISABLE		0x0001
 
@@ -403,8 +408,10 @@ struct omap_mcbsp_reg_cfg {
 	u16 rcerh;
 	u16 xcerg;
 	u16 xcerh;
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
 	u16 xccr;
 	u16 rccr;
+#endif
 };
 
 typedef enum {
arch/arm/plat-omap/mcbsp.c +1 -0
index 906e8e3..2b29033 100644
@@ -174,6 +174,7 @@ void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg *config)
 	OMAP_MCBSP_WRITE(io_base, MCR2, config->mcr2);
 	OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1);
 	OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0);
+	/* Write to xccr and rccr only for omap2430/34xx */
 	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 		if (mcbsp->pdata->ops->config)
 			mcbsp->pdata->ops->config(id, config);
sound/soc/omap/omap-mcbsp.c +4 -0
index 3a4cc4b..51a9313 100644
@@ -285,6 +285,10 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	regs->spcr1	|= RINTM(3);
 	regs->rcr2	|= RFIG;
 	regs->xcr2	|= XFIG;
+	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+		regs->xccr = DXENDLY(1) | XDMAEN;
+		regs->rccr = RFULL_CYCLE | RDMAEN;
+	}
 
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: [email protected] On Behalf Of [email protected]

From: Misael Lopez Cruz <[email protected]>

This patch fixes handling of XCCR and RCCR registers of McBSP for OMAP2430 and 34xx platforms. It also fixes OMAP McBSP DAI driver which was setting those registers to 0, as they were not initialized.

---
 arch/arm/plat-omap/include/mach/mcbsp.h |    7 +++++++
 arch/arm/plat-omap/mcbsp.c              |    1 +
 sound/soc/omap/omap-mcbsp.c             |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/mach/mcbsp.h +5 -0
index 3e38575..faa9164 100644
@@ -245,11 +245,16 @@
 #define XPBBLK(value)		((value)<<7)	/* Bits 7:8 */
 
 /*********************** McBSP XCCR bit definitions *************************/
+#define EXTCLKGATE		0x8000
+#define PPCONNECT		0x4000
+#define DXENDLY(value)		((value)<<12)	/* Bits 12:13 */
+#define XFULL_CYCLE		0x0800
 #define DILB			0x0020
 #define XDMAEN			0x0008
 #define XDISABLE		0x0001
 
 /********************** McBSP RCCR bit definitions *************************/
+#define RFULL_CYCLE		0x0800
 #define RDMAEN			0x0008
 #define RDISABLE		0x0001
 

arch/arm/plat-omap/include/mach/mcbsp.h struct omap_mcbsp_reg_cfg { · line 415

Quoted 8 lines
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
@@ -403,8 +408,10 @@ struct omap_mcbsp_reg_cfg {
 	u16 rcerh;
 	u16 xcerg;
 	u16 xcerh;
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
 	u16 xccr;
 	u16 rccr;
+#endif
 };

Won't this cause a compilation break on non-2430/34xx platforms because you refer to these variables below?

Quoted 31 lines
arch/arm/plat-omap/include/mach/mcbsp.h +0 -0
 typedef enum {
arch/arm/plat-omap/mcbsp.c +1 -0
index 906e8e3..2b29033 100644
@@ -174,6 +174,7 @@ void omap_mcbsp_config(unsigned int id, 
 const struct omap_mcbsp_reg_cfg *config)
 	OMAP_MCBSP_WRITE(io_base, MCR2, config->mcr2);
 	OMAP_MCBSP_WRITE(io_base, MCR1, config->mcr1);
 	OMAP_MCBSP_WRITE(io_base, PCR0, config->pcr0);
+	/* Write to xccr and rccr only for omap2430/34xx */
 	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
 		if (mcbsp->pdata->ops->config)
arch/arm/plat-omap/mcbsp.c +0 -0
 			mcbsp->pdata->ops->config(id, config);
sound/soc/omap/omap-mcbsp.c +4 -0
index 3a4cc4b..51a9313 100644
@@ -285,6 +285,10 @@ static int 
 omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	regs->spcr1	|= RINTM(3);
 	regs->rcr2	|= RFIG;
 	regs->xcr2	|= XFIG;
+	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
+		regs->xccr = DXENDLY(1) | XDMAEN;
+		regs->rccr = RFULL_CYCLE | RDMAEN;
+	}
 
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {

case SND_SOC_DAIFMT_I2S:

#2 lore raw
Quoted 4 lines
Quoted 4 lines
arch/arm/plat-omap/include/mach/mcbsp.h +0 -0
@@ -403,8 +408,10 @@ struct omap_mcbsp_reg_cfg {
 	u16 rcerh;
 	u16 xcerg;
 	u16 xcerh;
Quoted 8 lines

arch/arm/plat-omap/include/mach/mcbsp.h struct omap_mcbsp_reg_cfg { · line 415

Quoted 5 lines
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
 	u16 xccr;
 	u16 rccr;
+#endif
 };

Won't this cause a compilation break on non-2430/34xx platforms because you refer to these variables below?

True... I didn't consider that. Then for non-2430/34xx platforms, having those registers in the structure but avoiding to write to them is enough, correct? or any other alternative?

#3 lore raw

----- Original Message ----- From: "Misael Lopez" <[email protected]>
To: "Gadiyar, Anand" <[email protected]>
Cc: <[email protected]>; "Pandita, Vikram" <[email protected]>
Sent: Friday, November 21, 2008 11:55 AM
Subject: Re: [PATCH][OMAPZOOM] OMAP3: Fix handling of McBSP registers XCCR and RCCR for OMAP2430/34xx

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/plat-omap/include/mach/mcbsp.h +0 -0
@@ -403,8 +408,10 @@ struct omap_mcbsp_reg_cfg {
 u16 rcerh;
 u16 xcerg;
 u16 xcerh;
Quoted 8 lines

arch/arm/plat-omap/include/mach/mcbsp.h struct omap_mcbsp_reg_cfg { · line 415

Quoted 5 lines
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
+#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX)
 u16 xccr;
 u16 rccr;
+#endif
 };

Won't this cause a compilation break on non-2430/34xx platforms because you refer to these variables below?

Quoted 3 lines

True... I didn't consider that. Then for non-2430/34xx platforms, having those registers in the structure but avoiding to write to them is enough, correct? or any other alternative?

Since you write those registers conditionally for 2430/34xx, i guess removing ifdef should do..

Quoted 5 lines

--
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