static void imx_3stack_init_dam(int ssi_port, int dai_port)
{
	unsigned int ssi_ptcr = 0;
	unsigned int dai_ptcr = 0;
	unsigned int ssi_pdcr = 0;
	unsigned int dai_pdcr = 0;
	/* WM8350 uses SSI1 or SSI2 via AUDMUX port dai_port for audio */

	/* reset port ssi_port & dai_port */
	__raw_writel(0, DAM_PTCR(ssi_port));
	__raw_writel(0, DAM_PTCR(dai_port));
	__raw_writel(0, DAM_PDCR(ssi_port));
	__raw_writel(0, DAM_PDCR(dai_port));

	/* set to synchronous */
	ssi_ptcr |= AUDMUX_PTCR_SYN;
	dai_ptcr |= AUDMUX_PTCR_SYN;

#if WM8350_SSI_MASTER
	/* set Rx sources ssi_port <--> dai_port */
	ssi_pdcr |= AUDMUX_PDCR_RXDSEL(dai_port);
	dai_pdcr |= AUDMUX_PDCR_RXDSEL(ssi_port);

	/* set Tx frame direction and source  dai_port--> ssi_port output */
	ssi_ptcr |= AUDMUX_PTCR_TFSDIR;
	ssi_ptcr |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, dai_port);

	/* set Tx Clock direction and source dai_port--> ssi_port output */
	ssi_ptcr |= AUDMUX_PTCR_TCLKDIR;
	ssi_ptcr |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, dai_port);
#else
	/* set Rx sources ssi_port <--> dai_port */
	ssi_pdcr |= AUDMUX_PDCR_RXDSEL(dai_port);
	dai_pdcr |= AUDMUX_PDCR_RXDSEL(ssi_port);

	/* set Tx frame direction and source  ssi_port --> dai_port output */
	dai_ptcr |= AUDMUX_PTCR_TFSDIR;
	dai_ptcr |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, ssi_port);

	/* set Tx Clock direction and source ssi_port--> dai_port output */
	dai_ptcr |= AUDMUX_PTCR_TCLKDIR;
	dai_ptcr |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, ssi_port);
#endif

	__raw_writel(ssi_ptcr, DAM_PTCR(ssi_port));
	__raw_writel(dai_ptcr, DAM_PTCR(dai_port));
	__raw_writel(ssi_pdcr, DAM_PDCR(ssi_port));
	__raw_writel(dai_pdcr, DAM_PDCR(dai_port));
}
Exemple #2
0
static void imx_3stack_init_dam(int ssi_port, int dai_port)
{
	/* SGTL5000 uses SSI1 or SSI2 via AUDMUX port dai_port for audio */

	/* reset port ssi_port & dai_port */
	DAM_PTCR(ssi_port) = 0;
	DAM_PDCR(ssi_port) = 0;
	DAM_PTCR(dai_port) = 0;
	DAM_PDCR(dai_port) = 0;

	/* set to synchronous */
	DAM_PTCR(ssi_port) |= AUDMUX_PTCR_SYN;
	DAM_PTCR(dai_port) |= AUDMUX_PTCR_SYN;

#if SGTL5000_SSI_MASTER
	/* set Rx sources ssi_port <--> dai_port */
	DAM_PDCR(ssi_port) |= AUDMUX_PDCR_RXDSEL(dai_port);
	DAM_PDCR(dai_port) |= AUDMUX_PDCR_RXDSEL(ssi_port);

	/* set Tx frame direction and source  dai_port--> ssi_port output */
	DAM_PTCR(ssi_port) |= AUDMUX_PTCR_TFSDIR;
	DAM_PTCR(ssi_port) |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, dai_port);

	/* set Tx Clock direction and source dai_port--> ssi_port output */
	DAM_PTCR(ssi_port) |= AUDMUX_PTCR_TCLKDIR;
	DAM_PTCR(ssi_port) |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, dai_port);
#else
	/* set Rx sources ssi_port <--> dai_port */
	DAM_PDCR(ssi_port) |= AUDMUX_PDCR_RXDSEL(dai_port);
	DAM_PDCR(dai_port) |= AUDMUX_PDCR_RXDSEL(ssi_port);

	/* set Tx frame direction and source  ssi_port --> dai_port output */
	DAM_PTCR(dai_port) |= AUDMUX_PTCR_TFSDIR;
	DAM_PTCR(dai_port) |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, ssi_port);

	/* set Tx Clock direction and source ssi_port--> dai_port output */
	DAM_PTCR(dai_port) |= AUDMUX_PTCR_TCLKDIR;
	DAM_PTCR(dai_port) |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, ssi_port);
#endif

}
/*-------------------------------------------------------------------------------*
 * DAI                                                                           *
 *-------------------------------------------------------------------------------*/
static void armadillo440_wm8978_dam_init(void)
{
	int p;

#if CODEC_IS_SSI_MASTER
	DAM_PTCR(AUDMUX_FROM) =
		AUDMUX_PTCR_TFSDIR_OUTPUT | AUDMUX_PTCR_TFSSEL_TFS | AUDMUX_PTCR_TFSSEL_PORT(AUDMUX_TO) |
		AUDMUX_PTCR_TCLKDIR_OUTPUT | AUDMUX_PTCR_TCSEL_TC | AUDMUX_PTCR_TCSEL_PORT(AUDMUX_TO) |
		AUDMUX_PTCR_RFSDIR_INPUT | AUDMUX_PTCR_RFSSEL_RFS | AUDMUX_PTCR_RFSSEL_PORT(1) |
		AUDMUX_PTCR_RCLKDIR_INPUT | AUDMUX_PTCR_RCSEL_RC | AUDMUX_PTCR_RCSEL_PORT(1) |
		AUDMUX_PTCR_SYN;
	DAM_PTCR(AUDMUX_TO) =
		AUDMUX_PTCR_TFSDIR_INPUT | AUDMUX_PTCR_TFSSEL_TFS | AUDMUX_PTCR_TFSSEL_PORT(1) |
		AUDMUX_PTCR_TCLKDIR_INPUT | AUDMUX_PTCR_TCSEL_TC | AUDMUX_PTCR_TCSEL_PORT(1) |
		AUDMUX_PTCR_RFSDIR_INPUT | AUDMUX_PTCR_RFSSEL_RFS | AUDMUX_PTCR_RFSSEL_PORT(1) |
		AUDMUX_PTCR_RCLKDIR_INPUT | AUDMUX_PTCR_RCSEL_RC | AUDMUX_PTCR_RCSEL_PORT(1) |
		AUDMUX_PTCR_SYN;
#else
	DAM_PTCR(AUDMUX_FROM) =
		AUDMUX_PTCR_TFSDIR_INPUT | AUDMUX_PTCR_TFSSEL_TFS | AUDMUX_PTCR_TFSSEL_PORT(1) |
		AUDMUX_PTCR_TCLKDIR_INPUT | AUDMUX_PTCR_TCSEL_TC | AUDMUX_PTCR_TCSEL_PORT(1) |
		AUDMUX_PTCR_RFSDIR_INPUT | AUDMUX_PTCR_RFSSEL_RFS | AUDMUX_PTCR_RFSSEL_PORT(1) |
		AUDMUX_PTCR_RCLKDIR_INPUT | AUDMUX_PTCR_RCSEL_RC | AUDMUX_PTCR_RCSEL_PORT(1) |
		AUDMUX_PTCR_ASYN;
	DAM_PTCR(AUDMUX_TO) =
		AUDMUX_PTCR_TFSDIR_OUTPUT | AUDMUX_PTCR_TFSSEL_TFS | AUDMUX_PTCR_TFSSEL_PORT(1) |
		AUDMUX_PTCR_TCLKDIR_OUTPUT | AUDMUX_PTCR_TCSEL_TC | AUDMUX_PTCR_TCSEL_PORT(1) |
		AUDMUX_PTCR_RFSDIR_OUTPUT | AUDMUX_PTCR_RFSSEL_RFS | AUDMUX_PTCR_RFSSEL_PORT(1) |
		AUDMUX_PTCR_RCLKDIR_OUTPUT | AUDMUX_PTCR_RCSEL_RC | AUDMUX_PTCR_RCSEL_PORT(1) |
		AUDMUX_PTCR_ASYN;
#endif /* CODEC_IS_SSI_MASTER */

	DAM_PTCR(AUDMUX_FROM_UNUSED) = 0xAD400800;
	DAM_PTCR(AUDMUX_TO_UNUSED)   = 0x00000800;
	DAM_PTCR(3) = 0x9CC00800;
	DAM_PTCR(4) = 0x00000800;
	DAM_PTCR(7) = 0x00000800;

	DAM_PDCR(AUDMUX_FROM)        = AUDMUX_PDCR_RXDSEL(AUDMUX_TO);
	DAM_PDCR(AUDMUX_FROM_UNUSED) = AUDMUX_PDCR_RXDSEL(AUDMUX_TO_UNUSED);
	DAM_PDCR(AUDMUX_TO_UNUSED)   = AUDMUX_PDCR_RXDSEL(AUDMUX_FROM_UNUSED);
	DAM_PDCR(AUDMUX_TO)          = AUDMUX_PDCR_RXDSEL(AUDMUX_FROM);
	DAM_PDCR(3) = AUDMUX_PDCR_RXDSEL(4);
	DAM_PDCR(4) = AUDMUX_PDCR_RXDSEL(3);
	DAM_PDCR(7) = AUDMUX_PDCR_RXDSEL(7);

	for (p = 1; p <= 7; p++) {
		debug("* DAM @ Port%d. PTCR(%p): 0x%08x, PDCR(%p): 0x%08x\n",
		      p,
		      &DAM_PTCR(p), DAM_PTCR(p),
		      &DAM_PDCR(p), DAM_PDCR(p));
	}
}