linux/include/linux/pxa2xx_ssp.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2003 Russell King, All Rights Reserved.
 *
 * This driver supports the following PXA CPU/SSP ports:-
 *
 *       PXA250     SSP
 *       PXA255     SSP, NSSP
 *       PXA26x     SSP, NSSP, ASSP
 *       PXA27x     SSP1, SSP2, SSP3
 *       PXA3xx     SSP1, SSP2, SSP3, SSP4
 */

#ifndef __LINUX_PXA2XX_SSP_H
#define __LINUX_PXA2XX_SSP_H

#include <linux/bits.h>
#include <linux/compiler_types.h>
#include <linux/io.h>
#include <linux/kconfig.h>
#include <linux/list.h>
#include <linux/types.h>

struct clk;
struct device;
struct device_node;

/*
 * SSP Serial Port Registers
 * PXA250, PXA255, PXA26x and PXA27x SSP controllers are all slightly different.
 * PXA255, PXA26x and PXA27x have extra ports, registers and bits.
 */

#define SSCR0
#define SSCR1
#define SSSR
#define SSITR
#define SSDR

#define SSTO
#define SSPSP
#define SSTSA
#define SSRSA
#define SSTSS
#define SSACD
#define SSACDD

/* Common PXA2xx bits first */
#define SSCR0_DSS
#define SSCR0_DataSize(x)
#define SSCR0_FRF
#define SSCR0_Motorola
#define SSCR0_TI
#define SSCR0_National
#define SSCR0_ECS
#define SSCR0_SSE
#define SSCR0_SCR(x)

/* PXA27x, PXA3xx */
#define SSCR0_EDSS
#define SSCR0_NCS
#define SSCR0_RIM
#define SSCR0_TUM
#define SSCR0_FRDC
#define SSCR0_SlotsPerFrm(x)
#define SSCR0_FPCKE
#define SSCR0_ACS
#define SSCR0_MOD

#define SSCR1_RIE
#define SSCR1_TIE
#define SSCR1_LBM
#define SSCR1_SPO
#define SSCR1_SPH
#define SSCR1_MWDS

#define SSSR_ALT_FRM_MASK
#define SSSR_TNF
#define SSSR_RNE
#define SSSR_BSY
#define SSSR_TFS
#define SSSR_RFS
#define SSSR_ROR

#define RX_THRESH_DFLT
#define TX_THRESH_DFLT

#define SSSR_TFL_MASK
#define SSSR_RFL_MASK

#define SSCR1_TFT
#define SSCR1_TxTresh(x)
#define SSCR1_RFT
#define SSCR1_RxTresh(x)

#define RX_THRESH_CE4100_DFLT
#define TX_THRESH_CE4100_DFLT

#define CE4100_SSSR_TFL_MASK
#define CE4100_SSSR_RFL_MASK

#define CE4100_SSCR1_TFT
#define CE4100_SSCR1_TxTresh(x)
#define CE4100_SSCR1_RFT
#define CE4100_SSCR1_RxTresh(x)

/* Intel Quark X1000 */
#define DDS_RATE

/* QUARK_X1000 SSCR0 bit definition */
#define QUARK_X1000_SSCR0_DSS
#define QUARK_X1000_SSCR0_DataSize(x)
#define QUARK_X1000_SSCR0_FRF
#define QUARK_X1000_SSCR0_Motorola

#define RX_THRESH_QUARK_X1000_DFLT
#define TX_THRESH_QUARK_X1000_DFLT

#define QUARK_X1000_SSSR_TFL_MASK
#define QUARK_X1000_SSSR_RFL_MASK

#define QUARK_X1000_SSCR1_TFT
#define QUARK_X1000_SSCR1_TxTresh(x)
#define QUARK_X1000_SSCR1_RFT
#define QUARK_X1000_SSCR1_RxTresh(x)
#define QUARK_X1000_SSCR1_EFWR
#define QUARK_X1000_SSCR1_STRF

/* Extra bits in PXA255, PXA26x and PXA27x SSP ports */
#define SSCR0_TISSP
#define SSCR0_PSP

#define SSCR1_EFWR
#define SSCR1_STRF
#define SSCR1_IFS
#define SSCR1_PINTE
#define SSCR1_TINTE
#define SSCR1_RSRE
#define SSCR1_TSRE
#define SSCR1_TRAIL
#define SSCR1_RWOT
#define SSCR1_SFRMDIR
#define SSCR1_SCLKDIR
#define SSCR1_ECRB
#define SSCR1_ECRA
#define SSCR1_SCFR
#define SSCR1_EBCEI
#define SSCR1_TTE
#define SSCR1_TTELP

#define SSSR_PINT
#define SSSR_TINT
#define SSSR_EOC
#define SSSR_TUR
#define SSSR_CSS
#define SSSR_BCE

#define SSPSP_SCMODE(x)
#define SSPSP_SFRMP
#define SSPSP_ETDS
#define SSPSP_STRTDLY(x)
#define SSPSP_DMYSTRT(x)
#define SSPSP_SFRMDLY(x)
#define SSPSP_SFRMWDTH(x)
#define SSPSP_DMYSTOP(x)
#define SSPSP_FSRT

/* PXA3xx */
#define SSPSP_EDMYSTRT(x)
#define SSPSP_EDMYSTOP(x)
#define SSPSP_TIMING_MASK

#define SSACD_ACDS(x)
#define SSACD_ACDS_1
#define SSACD_ACDS_2
#define SSACD_ACDS_4
#define SSACD_ACDS_8
#define SSACD_ACDS_16
#define SSACD_ACDS_32
#define SSACD_SCDB
#define SSACD_SCDB_4X
#define SSACD_SCDB_1X
#define SSACD_ACPS(x)
#define SSACD_SCDX8

/* Intel Merrifield SSP */
#define SFIFOL
#define SFIFOTT

#define RX_THRESH_MRFLD_DFLT
#define TX_THRESH_MRFLD_DFLT

#define SFIFOL_TFL_MASK
#define SFIFOL_RFL_MASK

#define SFIFOTT_TFT
#define SFIFOTT_TxThresh(x)
#define SFIFOTT_RFT
#define SFIFOTT_RxThresh(x)

/* LPSS SSP */
#define SSITF
#define SSITF_TxHiThresh(x)
#define SSITF_TxLoThresh(x)

#define SSIRF
#define SSIRF_RxThresh(x)

/* LPT/WPT SSP */
#define SSCR2
#define SSPSP2

enum pxa_ssp_type {};

struct ssp_device {};

/**
 * pxa_ssp_write_reg - Write to a SSP register
 *
 * @dev: SSP device to access
 * @reg: Register to write to
 * @val: Value to be written.
 */
static inline void pxa_ssp_write_reg(struct ssp_device *dev, u32 reg, u32 val)
{}

/**
 * pxa_ssp_read_reg - Read from a SSP register
 *
 * @dev: SSP device to access
 * @reg: Register to read from
 */
static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
{}

static inline void pxa_ssp_enable(struct ssp_device *ssp)
{}

static inline void pxa_ssp_disable(struct ssp_device *ssp)
{}

#if IS_ENABLED(CONFIG_PXA_SSP)
struct ssp_device *pxa_ssp_request(int port, const char *label);
void pxa_ssp_free(struct ssp_device *);
struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
				      const char *label);
#else
static inline struct ssp_device *pxa_ssp_request(int port, const char *label)
{}
static inline struct ssp_device *pxa_ssp_request_of(const struct device_node *n,
						    const char *name)
{}
static inline void pxa_ssp_free(struct ssp_device *ssp) {}
#endif

#endif	/* __LINUX_PXA2XX_SSP_H */