18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * tegra30_ahub.h - Definitions for Tegra30 AHUB driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2011,2012, NVIDIA CORPORATION.  All rights reserved.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __TEGRA30_AHUB_H__
98c2ecf20Sopenharmony_ci#define __TEGRA30_AHUB_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Fields in *_CIF_RX/TX_CTRL; used by AHUB FIFOs, and all other audio modules */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT	28
148c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK_US	0xf
158c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK	(TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK_US << TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT	24
188c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK_US	0x3f
198c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK	(TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_MASK_US << TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Channel count minus 1 */
228c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT	24
238c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK_US	7
248c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK	(TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK_US << TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Channel count minus 1 */
278c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT	20
288c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK_US	0xf
298c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK	(TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK_US << TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT)
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Channel count minus 1 */
328c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT	16
338c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK_US	7
348c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK	(TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK_US << TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Channel count minus 1 */
378c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT	16
388c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK_US	0xf
398c2ecf20Sopenharmony_ci#define TEGRA124_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK	(TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK_US << TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_4				0
428c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_8				1
438c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_12			2
448c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_16			3
458c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_20			4
468c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_24			5
478c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_28			6
488c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_BITS_32			7
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT		12
518c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_MASK		(7                        << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
528c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_4		(TEGRA30_AUDIOCIF_BITS_4  << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
538c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_8		(TEGRA30_AUDIOCIF_BITS_8  << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
548c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_12		(TEGRA30_AUDIOCIF_BITS_12 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
558c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_16		(TEGRA30_AUDIOCIF_BITS_16 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
568c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_20		(TEGRA30_AUDIOCIF_BITS_20 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
578c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_24		(TEGRA30_AUDIOCIF_BITS_24 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
588c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_28		(TEGRA30_AUDIOCIF_BITS_28 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
598c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_32		(TEGRA30_AUDIOCIF_BITS_32 << TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT		8
628c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_MASK		(7                        << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
638c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_4		(TEGRA30_AUDIOCIF_BITS_4  << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
648c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_8		(TEGRA30_AUDIOCIF_BITS_8  << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
658c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_12		(TEGRA30_AUDIOCIF_BITS_12 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
668c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_16		(TEGRA30_AUDIOCIF_BITS_16 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
678c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_20		(TEGRA30_AUDIOCIF_BITS_20 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
688c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_24		(TEGRA30_AUDIOCIF_BITS_24 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
698c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_28		(TEGRA30_AUDIOCIF_BITS_28 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
708c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_32		(TEGRA30_AUDIOCIF_BITS_32 << TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_EXPAND_ZERO			0
738c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_EXPAND_ONE			1
748c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_EXPAND_LFSR			2
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT		6
778c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_EXPAND_MASK		(3                            << TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT)
788c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_EXPAND_ZERO		(TEGRA30_AUDIOCIF_EXPAND_ZERO << TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT)
798c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_EXPAND_ONE		(TEGRA30_AUDIOCIF_EXPAND_ONE  << TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT)
808c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_EXPAND_LFSR		(TEGRA30_AUDIOCIF_EXPAND_LFSR << TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_STEREO_CONV_CH0		0
838c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_STEREO_CONV_CH1		1
848c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_STEREO_CONV_AVG		2
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT		4
878c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_MASK		(3                                << TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT)
888c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_CH0		(TEGRA30_AUDIOCIF_STEREO_CONV_CH0 << TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT)
898c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_CH1		(TEGRA30_AUDIOCIF_STEREO_CONV_CH1 << TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT)
908c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_AVG		(TEGRA30_AUDIOCIF_STEREO_CONV_AVG << TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_REPLICATE_SHIFT		3
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_DIRECTION_TX			0
958c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_DIRECTION_RX			1
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT		2
988c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_DIRECTION_MASK		(1                             << TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT)
998c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX		(TEGRA30_AUDIOCIF_DIRECTION_TX << TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT)
1008c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_DIRECTION_RX		(TEGRA30_AUDIOCIF_DIRECTION_RX << TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_TRUNCATE_ROUND			0
1038c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_TRUNCATE_CHOP			1
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT		1
1068c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_TRUNCATE_MASK		(1                               << TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT)
1078c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_TRUNCATE_ROUND		(TEGRA30_AUDIOCIF_TRUNCATE_ROUND << TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT)
1088c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_TRUNCATE_CHOP		(TEGRA30_AUDIOCIF_TRUNCATE_CHOP  << TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_MONO_CONV_ZERO			0
1118c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_MONO_CONV_COPY			1
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT		0
1148c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_MONO_CONV_MASK		(1                               << TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT)
1158c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_MONO_CONV_ZERO		(TEGRA30_AUDIOCIF_MONO_CONV_ZERO << TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT)
1168c2ecf20Sopenharmony_ci#define TEGRA30_AUDIOCIF_CTRL_MONO_CONV_COPY		(TEGRA30_AUDIOCIF_MONO_CONV_COPY << TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/* Registers within TEGRA30_AUDIO_CLUSTER_BASE */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CHANNEL_CTRL */
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL			0x0
1238c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_STRIDE		0x20
1248c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_COUNT			4
1258c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_EN			(1 << 31)
1268c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_EN			(1 << 30)
1278c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_LOOPBACK		(1 << 29)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT	16
1308c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK_US	0xff
1318c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK	(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK_US << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT)
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT	8
1348c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK_US	0xff
1358c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK	(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK_US << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT)
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN		(1 << 6)
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci#define TEGRA30_PACK_8_4				2
1408c2ecf20Sopenharmony_ci#define TEGRA30_PACK_16					3
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_SHIFT		4
1438c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK_US	3
1448c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK		(TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK_US << TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_SHIFT)
1458c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_8_4		(TEGRA30_PACK_8_4                          << TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_SHIFT)
1468c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16		(TEGRA30_PACK_16                           << TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_SHIFT)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN		(1 << 2)
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_SHIFT		0
1518c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK_US	3
1528c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK		(TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK_US << TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_SHIFT)
1538c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_8_4		(TEGRA30_PACK_8_4                          << TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_SHIFT)
1548c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16		(TEGRA30_PACK_16                           << TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_SHIFT)
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CHANNEL_CLEAR */
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CLEAR			0x4
1598c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CLEAR_STRIDE		0x20
1608c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CLEAR_COUNT		4
1618c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CLEAR_TX_SOFT_RESET	(1 << 31)
1628c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_CLEAR_RX_SOFT_RESET	(1 << 30)
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CHANNEL_STATUS */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS			0x8
1678c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_STRIDE		0x20
1688c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_COUNT		4
1698c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_TX_FREE_SHIFT	24
1708c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_TX_FREE_MASK_US	0xff
1718c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_TX_FREE_MASK	(TEGRA30_AHUB_CHANNEL_STATUS_TX_FREE_MASK_US << TEGRA30_AHUB_CHANNEL_STATUS_TX_FREE_SHIFT)
1728c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_RX_FREE_SHIFT	16
1738c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_RX_FREE_MASK_US	0xff
1748c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_RX_FREE_MASK	(TEGRA30_AHUB_CHANNEL_STATUS_RX_FREE_MASK_US << TEGRA30_AHUB_CHANNEL_STATUS_RX_FREE_SHIFT)
1758c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_TX_TRIG		(1 << 1)
1768c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_STATUS_RX_TRIG		(1 << 0)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CHANNEL_TXFIFO */
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_TXFIFO			0xc
1818c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE		0x20
1828c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_TXFIFO_COUNT		4
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CHANNEL_RXFIFO */
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_RXFIFO			0x10
1878c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE		0x20
1888c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CHANNEL_RXFIFO_COUNT		4
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CIF_TX_CTRL */
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_TX_CTRL			0x14
1938c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_TX_CTRL_STRIDE			0x20
1948c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_TX_CTRL_COUNT			4
1958c2ecf20Sopenharmony_ci/* Uses field from TEGRA30_AUDIOCIF_CTRL_* */
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CIF_RX_CTRL */
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_RX_CTRL			0x18
2008c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_RX_CTRL_STRIDE			0x20
2018c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CIF_RX_CTRL_COUNT			4
2028c2ecf20Sopenharmony_ci/* Uses field from TEGRA30_AUDIOCIF_CTRL_* */
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_CONFIG_LINK_CTRL */
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL					0x80
2078c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_MASTER_FIFO_FULL_CNT_SHIFT	28
2088c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_MASTER_FIFO_FULL_CNT_MASK_US	0xf
2098c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_MASTER_FIFO_FULL_CNT_MASK		(TEGRA30_AHUB_CONFIG_LINK_CTRL_MASTER_FIFO_FULL_CNT_MASK_US << TEGRA30_AHUB_CONFIG_LINK_CTRL_MASTER_FIFO_FULL_CNT_SHIFT)
2108c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_TIMEOUT_CNT_SHIFT			16
2118c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_TIMEOUT_CNT_MASK_US		0xfff
2128c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_TIMEOUT_CNT_MASK			(TEGRA30_AHUB_CONFIG_LINK_CTRL_TIMEOUT_CNT_MASK_US << TEGRA30_AHUB_CONFIG_LINK_CTRL_TIMEOUT_CNT_SHIFT)
2138c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_IDLE_CNT_SHIFT			4
2148c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_IDLE_CNT_MASK_US			0xfff
2158c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_IDLE_CNT_MASK			(TEGRA30_AHUB_CONFIG_LINK_CTRL_IDLE_CNT_MASK_US << TEGRA30_AHUB_CONFIG_LINK_CTRL_IDLE_CNT_SHIFT)
2168c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_CG_EN				(1 << 2)
2178c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_CLEAR_TIMEOUT_CNTR		(1 << 1)
2188c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_CONFIG_LINK_CTRL_SOFT_RESET			(1 << 0)
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_MISC_CTRL */
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_MISC_CTRL				0x84
2238c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_MISC_CTRL_AUDIO_ACTIVE		(1 << 31)
2248c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_MISC_CTRL_AUDIO_CG_EN		(1 << 8)
2258c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_MISC_CTRL_AUDIO_OBS_SEL_SHIFT	0
2268c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_MISC_CTRL_AUDIO_OBS_SEL_MASK	(0x1f << TEGRA30_AHUB_MISC_CTRL_AUDIO_OBS_SEL_SHIFT)
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_APBDMA_LIVE_STATUS */
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS				0x88
2318c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_RX_CIF_FIFO_FULL	(1 << 31)
2328c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_TX_CIF_FIFO_FULL	(1 << 30)
2338c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_RX_CIF_FIFO_FULL	(1 << 29)
2348c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_TX_CIF_FIFO_FULL	(1 << 28)
2358c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_RX_CIF_FIFO_FULL	(1 << 27)
2368c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_TX_CIF_FIFO_FULL	(1 << 26)
2378c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_RX_CIF_FIFO_FULL	(1 << 25)
2388c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_TX_CIF_FIFO_FULL	(1 << 24)
2398c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_RX_CIF_FIFO_EMPTY	(1 << 23)
2408c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_TX_CIF_FIFO_EMPTY	(1 << 22)
2418c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_RX_CIF_FIFO_EMPTY	(1 << 21)
2428c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_TX_CIF_FIFO_EMPTY	(1 << 20)
2438c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_RX_CIF_FIFO_EMPTY	(1 << 19)
2448c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_TX_CIF_FIFO_EMPTY	(1 << 18)
2458c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_RX_CIF_FIFO_EMPTY	(1 << 17)
2468c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_TX_CIF_FIFO_EMPTY	(1 << 16)
2478c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_RX_DMA_FIFO_FULL	(1 << 15)
2488c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_TX_DMA_FIFO_FULL	(1 << 14)
2498c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_RX_DMA_FIFO_FULL	(1 << 13)
2508c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_TX_DMA_FIFO_FULL	(1 << 12)
2518c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_RX_DMA_FIFO_FULL	(1 << 11)
2528c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_TX_DMA_FIFO_FULL	(1 << 10)
2538c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_RX_DMA_FIFO_FULL	(1 << 9)
2548c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_TX_DMA_FIFO_FULL	(1 << 8)
2558c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_RX_DMA_FIFO_EMPTY	(1 << 7)
2568c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH3_TX_DMA_FIFO_EMPTY	(1 << 6)
2578c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_RX_DMA_FIFO_EMPTY	(1 << 5)
2588c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH2_TX_DMA_FIFO_EMPTY	(1 << 4)
2598c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_RX_DMA_FIFO_EMPTY	(1 << 3)
2608c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH1_TX_DMA_FIFO_EMPTY	(1 << 2)
2618c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_RX_DMA_FIFO_EMPTY	(1 << 1)
2628c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBDMA_LIVE_STATUS_CH0_TX_DMA_FIFO_EMPTY	(1 << 0)
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_I2S_LIVE_STATUS */
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS				0x8c
2678c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_RX_FIFO_FULL		(1 << 29)
2688c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_TX_FIFO_FULL		(1 << 28)
2698c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_RX_FIFO_FULL		(1 << 27)
2708c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_TX_FIFO_FULL		(1 << 26)
2718c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_RX_FIFO_FULL		(1 << 25)
2728c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_TX_FIFO_FULL		(1 << 24)
2738c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_RX_FIFO_FULL		(1 << 23)
2748c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_TX_FIFO_FULL		(1 << 22)
2758c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_RX_FIFO_FULL		(1 << 21)
2768c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_TX_FIFO_FULL		(1 << 20)
2778c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_RX_FIFO_ENABLED	(1 << 19)
2788c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_TX_FIFO_ENABLED	(1 << 18)
2798c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_RX_FIFO_ENABLED	(1 << 17)
2808c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_TX_FIFO_ENABLED	(1 << 16)
2818c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_RX_FIFO_ENABLED	(1 << 15)
2828c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_TX_FIFO_ENABLED	(1 << 14)
2838c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_RX_FIFO_ENABLED	(1 << 13)
2848c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_TX_FIFO_ENABLED	(1 << 12)
2858c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_RX_FIFO_ENABLED	(1 << 11)
2868c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_TX_FIFO_ENABLED	(1 << 10)
2878c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_RX_FIFO_EMPTY		(1 << 9)
2888c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S4_TX_FIFO_EMPTY		(1 << 8)
2898c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_RX_FIFO_EMPTY		(1 << 7)
2908c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S3_TX_FIFO_EMPTY		(1 << 6)
2918c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_RX_FIFO_EMPTY		(1 << 5)
2928c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S2_TX_FIFO_EMPTY		(1 << 4)
2938c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_RX_FIFO_EMPTY		(1 << 3)
2948c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S1_TX_FIFO_EMPTY		(1 << 2)
2958c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_RX_FIFO_EMPTY		(1 << 1)
2968c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_LIVE_STATUS_I2S0_TX_FIFO_EMPTY		(1 << 0)
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_DAM0_LIVE_STATUS */
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS				0x90
3018c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_STRIDE			0x8
3028c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_COUNT			3
3038c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_TX_ENABLED			(1 << 26)
3048c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX1_ENABLED		(1 << 25)
3058c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX0_ENABLED		(1 << 24)
3068c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_TXFIFO_FULL		(1 << 15)
3078c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX1FIFO_FULL		(1 << 9)
3088c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX0FIFO_FULL		(1 << 8)
3098c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_TXFIFO_EMPTY		(1 << 7)
3108c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX1FIFO_EMPTY		(1 << 1)
3118c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_LIVE_STATUS_RX0FIFO_EMPTY		(1 << 0)
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_SPDIF_LIVE_STATUS */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS				0xa8
3168c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_TX_ENABLED		(1 << 11)
3178c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_RX_ENABLED		(1 << 10)
3188c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_TX_ENABLED		(1 << 9)
3198c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_RX_ENABLED		(1 << 8)
3208c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_TXFIFO_FULL		(1 << 7)
3218c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_RXFIFO_FULL		(1 << 6)
3228c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_TXFIFO_FULL		(1 << 5)
3238c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_RXFIFO_FULL		(1 << 4)
3248c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_TXFIFO_EMPTY	(1 << 3)
3258c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_USER_RXFIFO_EMPTY	(1 << 2)
3268c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_TXFIFO_EMPTY	(1 << 1)
3278c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_LIVE_STATUS_DATA_RXFIFO_EMPTY	(1 << 0)
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_I2S_INT_MASK */
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_INT_MASK				0xb0
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_DAM_INT_MASK */
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_INT_MASK				0xb4
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_SPDIF_INT_MASK */
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_INT_MASK				0xbc
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_APBIF_INT_MASK */
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBIF_INT_MASK				0xc0
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_I2S_INT_STATUS */
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_INT_STATUS				0xc8
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_DAM_INT_STATUS */
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_INT_STATUS				0xcc
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_SPDIF_INT_STATUS */
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_INT_STATUS				0xd4
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_APBIF_INT_STATUS */
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBIF_INT_STATUS				0xd8
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_I2S_INT_SOURCE */
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_INT_SOURCE				0xe0
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_DAM_INT_SOURCE */
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_INT_SOURCE				0xe4
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_SPDIF_INT_SOURCE */
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_INT_SOURCE				0xec
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_APBIF_INT_SOURCE */
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBIF_INT_SOURCE				0xf0
3768c2ecf20Sopenharmony_ci
3778c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_I2S_INT_SET */
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_I2S_INT_SET				0xf8
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_DAM_INT_SET */
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_DAM_INT_SET				0xfc
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_SPDIF_INT_SET */
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_SPDIF_INT_SET				0x100
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci/* TEGRA30_AHUB_APBIF_INT_SET */
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_APBIF_INT_SET				0x104
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci/* Registers within TEGRA30_AHUB_BASE */
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_AUDIO_RX					0x0
3968c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_AUDIO_RX_STRIDE				0x4
3978c2ecf20Sopenharmony_ci#define TEGRA30_AHUB_AUDIO_RX_COUNT				17
3988c2ecf20Sopenharmony_ci/* This register repeats once for each entry in enum tegra30_ahub_rxcif */
3998c2ecf20Sopenharmony_ci/* The fields in this register are 1 bit per entry in tegra30_ahub_txcif */
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/*
4028c2ecf20Sopenharmony_ci * Terminology:
4038c2ecf20Sopenharmony_ci * AHUB: Audio Hub; a cross-bar switch between the audio devices: DMA FIFOs,
4048c2ecf20Sopenharmony_ci *       I2S controllers, SPDIF controllers, and DAMs.
4058c2ecf20Sopenharmony_ci * XBAR: The core cross-bar component of the AHUB.
4068c2ecf20Sopenharmony_ci * CIF:  Client Interface; the HW module connecting an audio device to the
4078c2ecf20Sopenharmony_ci *       XBAR.
4088c2ecf20Sopenharmony_ci * DAM:  Digital Audio Mixer: A HW module that mixes multiple audio streams,
4098c2ecf20Sopenharmony_ci *       possibly including sample-rate conversion.
4108c2ecf20Sopenharmony_ci *
4118c2ecf20Sopenharmony_ci * Each TX CIF transmits data into the XBAR. Each RX CIF can receive audio
4128c2ecf20Sopenharmony_ci * transmitted by a particular TX CIF.
4138c2ecf20Sopenharmony_ci *
4148c2ecf20Sopenharmony_ci * This driver is currently very simplistic; many HW features are not
4158c2ecf20Sopenharmony_ci * exposed; DAMs are not supported, only 16-bit stereo audio is supported,
4168c2ecf20Sopenharmony_ci * etc.
4178c2ecf20Sopenharmony_ci */
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_cienum tegra30_ahub_txcif {
4208c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_APBIF_TX0,
4218c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_APBIF_TX1,
4228c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_APBIF_TX2,
4238c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_APBIF_TX3,
4248c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_I2S0_TX0,
4258c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_I2S1_TX0,
4268c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_I2S2_TX0,
4278c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_I2S3_TX0,
4288c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_I2S4_TX0,
4298c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_DAM0_TX0,
4308c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_DAM1_TX0,
4318c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_DAM2_TX0,
4328c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_SPDIF_TX0,
4338c2ecf20Sopenharmony_ci	TEGRA30_AHUB_TXCIF_SPDIF_TX1,
4348c2ecf20Sopenharmony_ci};
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_cienum tegra30_ahub_rxcif {
4378c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_APBIF_RX0,
4388c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_APBIF_RX1,
4398c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXcIF_APBIF_RX2,
4408c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_APBIF_RX3,
4418c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_I2S0_RX0,
4428c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_I2S1_RX0,
4438c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_I2S2_RX0,
4448c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_I2S3_RX0,
4458c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_I2S4_RX0,
4468c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM0_RX0,
4478c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM0_RX1,
4488c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM1_RX0,
4498c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM2_RX1,
4508c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM3_RX0,
4518c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_DAM3_RX1,
4528c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_SPDIF_RX0,
4538c2ecf20Sopenharmony_ci	TEGRA30_AHUB_RXCIF_SPDIF_RX1,
4548c2ecf20Sopenharmony_ci};
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ciextern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
4578c2ecf20Sopenharmony_ci					 char *dmachan, int dmachan_len,
4588c2ecf20Sopenharmony_ci					 dma_addr_t *fiforeg);
4598c2ecf20Sopenharmony_ciextern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
4608c2ecf20Sopenharmony_ciextern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
4618c2ecf20Sopenharmony_ciextern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ciextern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
4648c2ecf20Sopenharmony_ci					 char *dmachan, int dmachan_len,
4658c2ecf20Sopenharmony_ci					 dma_addr_t *fiforeg);
4668c2ecf20Sopenharmony_ciextern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
4678c2ecf20Sopenharmony_ciextern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
4688c2ecf20Sopenharmony_ciextern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ciextern int tegra30_ahub_set_rx_cif_source(enum tegra30_ahub_rxcif rxcif,
4718c2ecf20Sopenharmony_ci					  enum tegra30_ahub_txcif txcif);
4728c2ecf20Sopenharmony_ciextern int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif);
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_cistruct tegra30_ahub_cif_conf {
4758c2ecf20Sopenharmony_ci	unsigned int threshold;
4768c2ecf20Sopenharmony_ci	unsigned int audio_channels;
4778c2ecf20Sopenharmony_ci	unsigned int client_channels;
4788c2ecf20Sopenharmony_ci	unsigned int audio_bits;
4798c2ecf20Sopenharmony_ci	unsigned int client_bits;
4808c2ecf20Sopenharmony_ci	unsigned int expand;
4818c2ecf20Sopenharmony_ci	unsigned int stereo_conv;
4828c2ecf20Sopenharmony_ci	unsigned int replicate;
4838c2ecf20Sopenharmony_ci	unsigned int direction;
4848c2ecf20Sopenharmony_ci	unsigned int truncate;
4858c2ecf20Sopenharmony_ci	unsigned int mono_conv;
4868c2ecf20Sopenharmony_ci};
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_civoid tegra30_ahub_set_cif(struct regmap *regmap, unsigned int reg,
4898c2ecf20Sopenharmony_ci			  struct tegra30_ahub_cif_conf *conf);
4908c2ecf20Sopenharmony_civoid tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg,
4918c2ecf20Sopenharmony_ci			   struct tegra30_ahub_cif_conf *conf);
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_cistruct tegra30_ahub_soc_data {
4948c2ecf20Sopenharmony_ci	u32 mod_list_mask;
4958c2ecf20Sopenharmony_ci	void (*set_audio_cif)(struct regmap *regmap,
4968c2ecf20Sopenharmony_ci			      unsigned int reg,
4978c2ecf20Sopenharmony_ci			      struct tegra30_ahub_cif_conf *conf);
4988c2ecf20Sopenharmony_ci	/*
4998c2ecf20Sopenharmony_ci	 * FIXME: There are many more differences in HW, such as:
5008c2ecf20Sopenharmony_ci	 * - More APBIF channels.
5018c2ecf20Sopenharmony_ci	 * - Extra separate chunks of register address space to represent
5028c2ecf20Sopenharmony_ci	 *   the extra APBIF channels.
5038c2ecf20Sopenharmony_ci	 * - More units connected to the AHUB, so that tegra30_ahub_[rt]xcif
5048c2ecf20Sopenharmony_ci	 *   need expansion, coupled with there being more defined bits in
5058c2ecf20Sopenharmony_ci	 *   the AHUB routing registers.
5068c2ecf20Sopenharmony_ci	 * However, the driver doesn't support those new features yet, so we
5078c2ecf20Sopenharmony_ci	 * don't represent them here yet.
5088c2ecf20Sopenharmony_ci	 */
5098c2ecf20Sopenharmony_ci};
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_cistruct tegra30_ahub {
5128c2ecf20Sopenharmony_ci	const struct tegra30_ahub_soc_data *soc_data;
5138c2ecf20Sopenharmony_ci	struct device *dev;
5148c2ecf20Sopenharmony_ci	struct clk *clk_d_audio;
5158c2ecf20Sopenharmony_ci	struct clk *clk_apbif;
5168c2ecf20Sopenharmony_ci	resource_size_t apbif_addr;
5178c2ecf20Sopenharmony_ci	struct regmap *regmap_apbif;
5188c2ecf20Sopenharmony_ci	struct regmap *regmap_ahub;
5198c2ecf20Sopenharmony_ci	DECLARE_BITMAP(rx_usage, TEGRA30_AHUB_CHANNEL_CTRL_COUNT);
5208c2ecf20Sopenharmony_ci	DECLARE_BITMAP(tx_usage, TEGRA30_AHUB_CHANNEL_CTRL_COUNT);
5218c2ecf20Sopenharmony_ci};
5228c2ecf20Sopenharmony_ci
5238c2ecf20Sopenharmony_ci#endif
524