linux/sound/soc/fsl/fsl_ssi.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * fsl_ssi.h - ALSA SSI interface for the Freescale MPC8610 and i.MX SoC
 *
 * Author: Timur Tabi <[email protected]>
 *
 * Copyright 2007-2008 Freescale Semiconductor, Inc.
 */

#ifndef _MPC8610_I2S_H
#define _MPC8610_I2S_H

/* -- SSI Register Map -- */

/* SSI Transmit Data Register 0 */
#define REG_SSI_STX0
/* SSI Transmit Data Register 1 */
#define REG_SSI_STX1
/* SSI Receive Data Register 0 */
#define REG_SSI_SRX0
/* SSI Receive Data Register 1 */
#define REG_SSI_SRX1
/* SSI Control Register */
#define REG_SSI_SCR
/* SSI Interrupt Status Register */
#define REG_SSI_SISR
/* SSI Interrupt Enable Register */
#define REG_SSI_SIER
/* SSI Transmit Configuration Register */
#define REG_SSI_STCR
/* SSI Receive Configuration Register */
#define REG_SSI_SRCR
#define REG_SSI_SxCR(tx)
/* SSI Transmit Clock Control Register */
#define REG_SSI_STCCR
/* SSI Receive Clock Control Register */
#define REG_SSI_SRCCR
#define REG_SSI_SxCCR(tx)
/* SSI FIFO Control/Status Register */
#define REG_SSI_SFCSR
/*
 * SSI Test Register (Intended for debugging purposes only)
 *
 * Note: STR is not documented in recent IMX datasheet, but
 * is described in IMX51 reference manual at section 56.3.3.14
 */
#define REG_SSI_STR
/*
 * SSI Option Register (Intended for internal use only)
 *
 * Note: SOR is not documented in recent IMX datasheet, but
 * is described in IMX51 reference manual at section 56.3.3.15
 */
#define REG_SSI_SOR
/* SSI AC97 Control Register */
#define REG_SSI_SACNT
/* SSI AC97 Command Address Register */
#define REG_SSI_SACADD
/* SSI AC97 Command Data Register */
#define REG_SSI_SACDAT
/* SSI AC97 Tag Register */
#define REG_SSI_SATAG
/* SSI Transmit Time Slot Mask Register */
#define REG_SSI_STMSK
/* SSI  Receive Time Slot Mask Register */
#define REG_SSI_SRMSK
#define REG_SSI_SxMSK(tx)
/*
 * SSI AC97 Channel Status Register
 *
 * The status could be changed by:
 * 1) Writing a '1' bit at some position in SACCEN sets relevant bit in SACCST
 * 2) Writing a '1' bit at some position in SACCDIS unsets the relevant bit
 * 3) Receivng a '1' in SLOTREQ bit from external CODEC via AC Link
 */
#define REG_SSI_SACCST
/* SSI AC97 Channel Enable Register -- Set bits in SACCST */
#define REG_SSI_SACCEN
/* SSI AC97 Channel Disable Register -- Clear bits in SACCST */
#define REG_SSI_SACCDIS

/* -- SSI Register Field Maps -- */

/* SSI Control Register -- REG_SSI_SCR 0x10 */
#define SSI_SCR_SYNC_TX_FS
#define SSI_SCR_RFR_CLK_DIS
#define SSI_SCR_TFR_CLK_DIS
#define SSI_SCR_TCH_EN
#define SSI_SCR_SYS_CLK_EN
#define SSI_SCR_I2S_MODE_MASK
#define SSI_SCR_I2S_MODE_NORMAL
#define SSI_SCR_I2S_MODE_MASTER
#define SSI_SCR_I2S_MODE_SLAVE
#define SSI_SCR_SYN
#define SSI_SCR_NET
#define SSI_SCR_I2S_NET_MASK
#define SSI_SCR_RE
#define SSI_SCR_TE
#define SSI_SCR_SSIEN

/* SSI Interrupt Status Register -- REG_SSI_SISR 0x14 */
#define SSI_SISR_RFRC
#define SSI_SISR_TFRC
#define SSI_SISR_CMDAU
#define SSI_SISR_CMDDU
#define SSI_SISR_RXT
#define SSI_SISR_RDR1
#define SSI_SISR_RDR0
#define SSI_SISR_TDE1
#define SSI_SISR_TDE0
#define SSI_SISR_ROE1
#define SSI_SISR_ROE0
#define SSI_SISR_TUE1
#define SSI_SISR_TUE0
#define SSI_SISR_TFS
#define SSI_SISR_RFS
#define SSI_SISR_TLS
#define SSI_SISR_RLS
#define SSI_SISR_RFF1
#define SSI_SISR_RFF0
#define SSI_SISR_TFE1
#define SSI_SISR_TFE0

/* SSI Interrupt Enable Register -- REG_SSI_SIER 0x18 */
#define SSI_SIER_RFRC_EN
#define SSI_SIER_TFRC_EN
#define SSI_SIER_RDMAE
#define SSI_SIER_RIE
#define SSI_SIER_TDMAE
#define SSI_SIER_TIE
#define SSI_SIER_CMDAU_EN
#define SSI_SIER_CMDDU_EN
#define SSI_SIER_RXT_EN
#define SSI_SIER_RDR1_EN
#define SSI_SIER_RDR0_EN
#define SSI_SIER_TDE1_EN
#define SSI_SIER_TDE0_EN
#define SSI_SIER_ROE1_EN
#define SSI_SIER_ROE0_EN
#define SSI_SIER_TUE1_EN
#define SSI_SIER_TUE0_EN
#define SSI_SIER_TFS_EN
#define SSI_SIER_RFS_EN
#define SSI_SIER_TLS_EN
#define SSI_SIER_RLS_EN
#define SSI_SIER_RFF1_EN
#define SSI_SIER_RFF0_EN
#define SSI_SIER_TFE1_EN
#define SSI_SIER_TFE0_EN

/* SSI Transmit Configuration Register -- REG_SSI_STCR 0x1C */
#define SSI_STCR_TXBIT0
#define SSI_STCR_TFEN1
#define SSI_STCR_TFEN0
#define SSI_STCR_TFDIR
#define SSI_STCR_TXDIR
#define SSI_STCR_TSHFD
#define SSI_STCR_TSCKP
#define SSI_STCR_TFSI
#define SSI_STCR_TFSL
#define SSI_STCR_TEFS

/* SSI Receive Configuration Register -- REG_SSI_SRCR 0x20 */
#define SSI_SRCR_RXEXT
#define SSI_SRCR_RXBIT0
#define SSI_SRCR_RFEN1
#define SSI_SRCR_RFEN0
#define SSI_SRCR_RFDIR
#define SSI_SRCR_RXDIR
#define SSI_SRCR_RSHFD
#define SSI_SRCR_RSCKP
#define SSI_SRCR_RFSI
#define SSI_SRCR_RFSL
#define SSI_SRCR_REFS

/*
 * SSI Transmit Clock Control Register -- REG_SSI_STCCR 0x24
 * SSI Receive Clock Control Register -- REG_SSI_SRCCR 0x28
 */
#define SSI_SxCCR_DIV2_SHIFT
#define SSI_SxCCR_DIV2
#define SSI_SxCCR_PSR_SHIFT
#define SSI_SxCCR_PSR
#define SSI_SxCCR_WL_SHIFT
#define SSI_SxCCR_WL_MASK
#define SSI_SxCCR_WL(x)
#define SSI_SxCCR_DC_SHIFT
#define SSI_SxCCR_DC_MASK
#define SSI_SxCCR_DC(x)
#define SSI_SxCCR_PM_SHIFT
#define SSI_SxCCR_PM_MASK
#define SSI_SxCCR_PM(x)

/*
 * SSI FIFO Control/Status Register -- REG_SSI_SFCSR 0x2c
 *
 * Tx or Rx FIFO Counter -- SSI_SFCSR_xFCNTy Read-Only
 * Tx or Rx FIFO Watermarks -- SSI_SFCSR_xFWMy Read/Write
 */
#define SSI_SFCSR_RFCNT1_SHIFT
#define SSI_SFCSR_RFCNT1_MASK
#define SSI_SFCSR_RFCNT1(x)
#define SSI_SFCSR_TFCNT1_SHIFT
#define SSI_SFCSR_TFCNT1_MASK
#define SSI_SFCSR_TFCNT1(x)
#define SSI_SFCSR_RFWM1_SHIFT
#define SSI_SFCSR_RFWM1_MASK
#define SSI_SFCSR_RFWM1(x)
#define SSI_SFCSR_TFWM1_SHIFT
#define SSI_SFCSR_TFWM1_MASK
#define SSI_SFCSR_TFWM1(x)
#define SSI_SFCSR_RFCNT0_SHIFT
#define SSI_SFCSR_RFCNT0_MASK
#define SSI_SFCSR_RFCNT0(x)
#define SSI_SFCSR_TFCNT0_SHIFT
#define SSI_SFCSR_TFCNT0_MASK
#define SSI_SFCSR_TFCNT0(x)
#define SSI_SFCSR_RFWM0_SHIFT
#define SSI_SFCSR_RFWM0_MASK
#define SSI_SFCSR_RFWM0(x)
#define SSI_SFCSR_TFWM0_SHIFT
#define SSI_SFCSR_TFWM0_MASK
#define SSI_SFCSR_TFWM0(x)

/* SSI Test Register -- REG_SSI_STR 0x30 */
#define SSI_STR_TEST
#define SSI_STR_RCK2TCK
#define SSI_STR_RFS2TFS
#define SSI_STR_RXSTATE(x)
#define SSI_STR_TXD2RXD
#define SSI_STR_TCK2RCK
#define SSI_STR_TFS2RFS
#define SSI_STR_TXSTATE(x)

/* SSI Option Register -- REG_SSI_SOR 0x34 */
#define SSI_SOR_CLKOFF
#define SSI_SOR_RX_CLR
#define SSI_SOR_TX_CLR
#define SSI_SOR_xX_CLR(tx)
#define SSI_SOR_INIT
#define SSI_SOR_WAIT_SHIFT
#define SSI_SOR_WAIT_MASK
#define SSI_SOR_WAIT(x)
#define SSI_SOR_SYNRST

/* SSI AC97 Control Register -- REG_SSI_SACNT 0x38 */
#define SSI_SACNT_FRDIV(x)
#define SSI_SACNT_WR
#define SSI_SACNT_RD
#define SSI_SACNT_RDWR_MASK
#define SSI_SACNT_TIF
#define SSI_SACNT_FV
#define SSI_SACNT_AC97EN


struct device;

#if IS_ENABLED(CONFIG_DEBUG_FS)

struct fsl_ssi_dbg {};

void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *ssi_dbg, u32 sisr);

void fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg, struct device *dev);

void fsl_ssi_debugfs_remove(struct fsl_ssi_dbg *ssi_dbg);

#else

struct fsl_ssi_dbg {
};

static inline void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *stats, u32 sisr)
{
}

static inline void fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg,
					  struct device *dev)
{
}

static inline void fsl_ssi_debugfs_remove(struct fsl_ssi_dbg *ssi_dbg)
{
}
#endif  /* ! IS_ENABLED(CONFIG_DEBUG_FS) */

#endif