18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * linux/sound/soc/pxa/mmp-sspa.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2011 Marvell International Ltd.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef _MMP_SSPA_H
88c2ecf20Sopenharmony_ci#define _MMP_SSPA_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * SSPA Registers
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#define SSPA_D			(0x00)
148c2ecf20Sopenharmony_ci#define SSPA_ID			(0x04)
158c2ecf20Sopenharmony_ci#define SSPA_CTL		(0x08)
168c2ecf20Sopenharmony_ci#define SSPA_SP			(0x0c)
178c2ecf20Sopenharmony_ci#define SSPA_FIFO_UL		(0x10)
188c2ecf20Sopenharmony_ci#define SSPA_INT_MASK		(0x14)
198c2ecf20Sopenharmony_ci#define SSPA_C			(0x18)
208c2ecf20Sopenharmony_ci#define SSPA_FIFO_NOFS		(0x1c)
218c2ecf20Sopenharmony_ci#define SSPA_FIFO_SIZE		(0x20)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* SSPA Control Register */
248c2ecf20Sopenharmony_ci#define	SSPA_CTL_XPH		(1 << 31)	/* Read Phase */
258c2ecf20Sopenharmony_ci#define	SSPA_CTL_XFIG		(1 << 15)	/* Transmit Zeros when FIFO Empty */
268c2ecf20Sopenharmony_ci#define	SSPA_CTL_JST		(1 << 3)	/* Audio Sample Justification */
278c2ecf20Sopenharmony_ci#define	SSPA_CTL_XFRLEN2_MASK	(7 << 24)
288c2ecf20Sopenharmony_ci#define	SSPA_CTL_XFRLEN2(x)	((x) << 24)	/* Transmit Frame Length in Phase 2 */
298c2ecf20Sopenharmony_ci#define	SSPA_CTL_XWDLEN2_MASK	(7 << 21)
308c2ecf20Sopenharmony_ci#define	SSPA_CTL_XWDLEN2(x)	((x) << 21)	/* Transmit Word Length in Phase 2 */
318c2ecf20Sopenharmony_ci#define	SSPA_CTL_XDATDLY(x)	((x) << 19)	/* Transmit Data Delay */
328c2ecf20Sopenharmony_ci#define	SSPA_CTL_XSSZ2_MASK	(7 << 16)
338c2ecf20Sopenharmony_ci#define	SSPA_CTL_XSSZ2(x)	((x) << 16)	/* Transmit Sample Audio Size */
348c2ecf20Sopenharmony_ci#define	SSPA_CTL_XFRLEN1_MASK	(7 << 8)
358c2ecf20Sopenharmony_ci#define	SSPA_CTL_XFRLEN1(x)	((x) << 8)	/* Transmit Frame Length in Phase 1 */
368c2ecf20Sopenharmony_ci#define	SSPA_CTL_XWDLEN1_MASK	(7 << 5)
378c2ecf20Sopenharmony_ci#define	SSPA_CTL_XWDLEN1(x)	((x) << 5)	/* Transmit Word Length in Phase 1 */
388c2ecf20Sopenharmony_ci#define	SSPA_CTL_XSSZ1_MASK	(7 << 0)
398c2ecf20Sopenharmony_ci#define	SSPA_CTL_XSSZ1(x)	((x) << 0)	/* XSSZ1 */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define SSPA_CTL_8_BITS		(0x0)		/* Sample Size */
428c2ecf20Sopenharmony_ci#define SSPA_CTL_12_BITS	(0x1)
438c2ecf20Sopenharmony_ci#define SSPA_CTL_16_BITS	(0x2)
448c2ecf20Sopenharmony_ci#define SSPA_CTL_20_BITS	(0x3)
458c2ecf20Sopenharmony_ci#define SSPA_CTL_24_BITS	(0x4)
468c2ecf20Sopenharmony_ci#define SSPA_CTL_32_BITS	(0x5)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* SSPA Serial Port Register */
498c2ecf20Sopenharmony_ci#define	SSPA_SP_WEN		(1 << 31)	/* Write Configuration Enable */
508c2ecf20Sopenharmony_ci#define	SSPA_SP_MSL		(1 << 18)	/* Master Slave Configuration */
518c2ecf20Sopenharmony_ci#define	SSPA_SP_CLKP		(1 << 17)	/* CLKP Polarity Clock Edge Select */
528c2ecf20Sopenharmony_ci#define	SSPA_SP_FSP		(1 << 16)	/* FSP Polarity Clock Edge Select */
538c2ecf20Sopenharmony_ci#define	SSPA_SP_FFLUSH		(1 << 2)	/* FIFO Flush */
548c2ecf20Sopenharmony_ci#define	SSPA_SP_S_RST		(1 << 1)	/* Active High Reset Signal */
558c2ecf20Sopenharmony_ci#define	SSPA_SP_S_EN		(1 << 0)	/* Serial Clock Domain Enable */
568c2ecf20Sopenharmony_ci#define	SSPA_SP_FWID_MASK	(0x3f << 20)
578c2ecf20Sopenharmony_ci#define	SSPA_SP_FWID(x)		((x) << 20)	/* Frame-Sync Width */
588c2ecf20Sopenharmony_ci#define	SSPA_TXSP_FPER_MASK	(0x3f << 4)
598c2ecf20Sopenharmony_ci#define	SSPA_TXSP_FPER(x)	((x) << 4)	/* Frame-Sync Active */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* sspa clock sources */
628c2ecf20Sopenharmony_ci#define MMP_SSPA_CLK_PLL	0
638c2ecf20Sopenharmony_ci#define MMP_SSPA_CLK_VCXO	1
648c2ecf20Sopenharmony_ci#define MMP_SSPA_CLK_AUDIO	3
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* sspa pll id */
678c2ecf20Sopenharmony_ci#define MMP_SYSCLK		0
688c2ecf20Sopenharmony_ci#define MMP_SSPA_CLK		1
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#endif /* _MMP_SSPA_H */
71