162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/* Hardware definitions for SSI.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2010 Nokia Corporation. All rights reserved.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Contact: Carlos Chinea <carlos.chinea@nokia.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __OMAP_SSI_REGS_H__
1062306a36Sopenharmony_ci#define __OMAP_SSI_REGS_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * SSI SYS registers
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci#define SSI_REVISION_REG    0
1662306a36Sopenharmony_ci#  define SSI_REV_MAJOR    0xf0
1762306a36Sopenharmony_ci#  define SSI_REV_MINOR    0xf
1862306a36Sopenharmony_ci#define SSI_SYSCONFIG_REG    0x10
1962306a36Sopenharmony_ci#  define SSI_AUTOIDLE    (1 << 0)
2062306a36Sopenharmony_ci#  define SSI_SOFTRESET    (1 << 1)
2162306a36Sopenharmony_ci#  define SSI_SIDLEMODE_FORCE  0
2262306a36Sopenharmony_ci#  define SSI_SIDLEMODE_NO    (1 << 3)
2362306a36Sopenharmony_ci#  define SSI_SIDLEMODE_SMART  (1 << 4)
2462306a36Sopenharmony_ci#  define SSI_SIDLEMODE_MASK  0x18
2562306a36Sopenharmony_ci#  define SSI_MIDLEMODE_FORCE  0
2662306a36Sopenharmony_ci#  define SSI_MIDLEMODE_NO    (1 << 12)
2762306a36Sopenharmony_ci#  define SSI_MIDLEMODE_SMART  (1 << 13)
2862306a36Sopenharmony_ci#  define SSI_MIDLEMODE_MASK  0x3000
2962306a36Sopenharmony_ci#define SSI_SYSSTATUS_REG    0x14
3062306a36Sopenharmony_ci#  define SSI_RESETDONE    1
3162306a36Sopenharmony_ci#define SSI_MPU_STATUS_REG(port, irq)  (0x808 + ((port) * 0x10) + ((irq) * 2))
3262306a36Sopenharmony_ci#define SSI_MPU_ENABLE_REG(port, irq)  (0x80c + ((port) * 0x10) + ((irq) * 8))
3362306a36Sopenharmony_ci#  define SSI_DATAACCEPT(channel)    (1 << (channel))
3462306a36Sopenharmony_ci#  define SSI_DATAAVAILABLE(channel)  (1 << ((channel) + 8))
3562306a36Sopenharmony_ci#  define SSI_DATAOVERRUN(channel)    (1 << ((channel) + 16))
3662306a36Sopenharmony_ci#  define SSI_ERROROCCURED      (1 << 24)
3762306a36Sopenharmony_ci#  define SSI_BREAKDETECTED    (1 << 25)
3862306a36Sopenharmony_ci#define SSI_GDD_MPU_IRQ_STATUS_REG  0x0800
3962306a36Sopenharmony_ci#define SSI_GDD_MPU_IRQ_ENABLE_REG  0x0804
4062306a36Sopenharmony_ci#  define SSI_GDD_LCH(channel)  (1 << (channel))
4162306a36Sopenharmony_ci#define SSI_WAKE_REG(port)    (0xc00 + ((port) * 0x10))
4262306a36Sopenharmony_ci#define SSI_CLEAR_WAKE_REG(port)  (0xc04 + ((port) * 0x10))
4362306a36Sopenharmony_ci#define SSI_SET_WAKE_REG(port)    (0xc08 + ((port) * 0x10))
4462306a36Sopenharmony_ci#  define SSI_WAKE(channel)  (1 << (channel))
4562306a36Sopenharmony_ci#  define SSI_WAKE_MASK    0xff
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/*
4862306a36Sopenharmony_ci * SSI SST registers
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_ci#define SSI_SST_ID_REG      0
5162306a36Sopenharmony_ci#define SSI_SST_MODE_REG    4
5262306a36Sopenharmony_ci#  define SSI_MODE_VAL_MASK  3
5362306a36Sopenharmony_ci#  define SSI_MODE_SLEEP    0
5462306a36Sopenharmony_ci#  define SSI_MODE_STREAM    1
5562306a36Sopenharmony_ci#  define SSI_MODE_FRAME    2
5662306a36Sopenharmony_ci#  define SSI_MODE_MULTIPOINTS  3
5762306a36Sopenharmony_ci#define SSI_SST_FRAMESIZE_REG    8
5862306a36Sopenharmony_ci#  define SSI_FRAMESIZE_DEFAULT  31
5962306a36Sopenharmony_ci#define SSI_SST_TXSTATE_REG    0xc
6062306a36Sopenharmony_ci#  define  SSI_TXSTATE_IDLE  0
6162306a36Sopenharmony_ci#define SSI_SST_BUFSTATE_REG    0x10
6262306a36Sopenharmony_ci#  define  SSI_FULL(channel)  (1 << (channel))
6362306a36Sopenharmony_ci#define SSI_SST_DIVISOR_REG    0x18
6462306a36Sopenharmony_ci#  define SSI_MAX_DIVISOR    127
6562306a36Sopenharmony_ci#define SSI_SST_BREAK_REG    0x20
6662306a36Sopenharmony_ci#define SSI_SST_CHANNELS_REG    0x24
6762306a36Sopenharmony_ci#  define SSI_CHANNELS_DEFAULT  4
6862306a36Sopenharmony_ci#define SSI_SST_ARBMODE_REG    0x28
6962306a36Sopenharmony_ci#  define SSI_ARBMODE_ROUNDROBIN  0
7062306a36Sopenharmony_ci#  define SSI_ARBMODE_PRIORITY  1
7162306a36Sopenharmony_ci#define SSI_SST_BUFFER_CH_REG(channel)  (0x80 + ((channel) * 4))
7262306a36Sopenharmony_ci#define SSI_SST_SWAPBUF_CH_REG(channel)  (0xc0 + ((channel) * 4))
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/*
7562306a36Sopenharmony_ci * SSI SSR registers
7662306a36Sopenharmony_ci */
7762306a36Sopenharmony_ci#define SSI_SSR_ID_REG      0
7862306a36Sopenharmony_ci#define SSI_SSR_MODE_REG    4
7962306a36Sopenharmony_ci#define SSI_SSR_FRAMESIZE_REG    8
8062306a36Sopenharmony_ci#define SSI_SSR_RXSTATE_REG    0xc
8162306a36Sopenharmony_ci#define SSI_SSR_BUFSTATE_REG    0x10
8262306a36Sopenharmony_ci#  define SSI_NOTEMPTY(channel)  (1 << (channel))
8362306a36Sopenharmony_ci#define SSI_SSR_BREAK_REG    0x1c
8462306a36Sopenharmony_ci#define SSI_SSR_ERROR_REG    0x20
8562306a36Sopenharmony_ci#define SSI_SSR_ERRORACK_REG    0x24
8662306a36Sopenharmony_ci#define SSI_SSR_OVERRUN_REG    0x2c
8762306a36Sopenharmony_ci#define SSI_SSR_OVERRUNACK_REG    0x30
8862306a36Sopenharmony_ci#define SSI_SSR_TIMEOUT_REG    0x34
8962306a36Sopenharmony_ci#  define SSI_TIMEOUT_DEFAULT  0
9062306a36Sopenharmony_ci#define SSI_SSR_CHANNELS_REG    0x28
9162306a36Sopenharmony_ci#define SSI_SSR_BUFFER_CH_REG(channel)  (0x80 + ((channel) * 4))
9262306a36Sopenharmony_ci#define SSI_SSR_SWAPBUF_CH_REG(channel)  (0xc0 + ((channel) * 4))
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci/*
9562306a36Sopenharmony_ci * SSI GDD registers
9662306a36Sopenharmony_ci */
9762306a36Sopenharmony_ci#define SSI_GDD_HW_ID_REG    0
9862306a36Sopenharmony_ci#define SSI_GDD_PPORT_ID_REG    0x10
9962306a36Sopenharmony_ci#define SSI_GDD_MPORT_ID_REG    0x14
10062306a36Sopenharmony_ci#define SSI_GDD_PPORT_SR_REG    0x20
10162306a36Sopenharmony_ci#define SSI_GDD_MPORT_SR_REG    0x24
10262306a36Sopenharmony_ci#  define SSI_ACTIVE_LCH_NUM_MASK  0xff
10362306a36Sopenharmony_ci#define SSI_GDD_TEST_REG    0x40
10462306a36Sopenharmony_ci#  define SSI_TEST      1
10562306a36Sopenharmony_ci#define SSI_GDD_GCR_REG      0x100
10662306a36Sopenharmony_ci#  define  SSI_CLK_AUTOGATING_ON  (1 << 3)
10762306a36Sopenharmony_ci#  define  SSI_FREE    (1 << 2)
10862306a36Sopenharmony_ci#  define  SSI_SWITCH_OFF    (1 << 0)
10962306a36Sopenharmony_ci#define SSI_GDD_GRST_REG    0x200
11062306a36Sopenharmony_ci#  define SSI_SWRESET    1
11162306a36Sopenharmony_ci#define SSI_GDD_CSDP_REG(channel)  (0x800 + ((channel) * 0x40))
11262306a36Sopenharmony_ci#  define SSI_DST_BURST_EN_MASK  0xc000
11362306a36Sopenharmony_ci#  define SSI_DST_SINGLE_ACCESS0  0
11462306a36Sopenharmony_ci#  define SSI_DST_SINGLE_ACCESS  (1 << 14)
11562306a36Sopenharmony_ci#  define SSI_DST_BURST_4x32_BIT  (2 << 14)
11662306a36Sopenharmony_ci#  define SSI_DST_BURST_8x32_BIT  (3 << 14)
11762306a36Sopenharmony_ci#  define SSI_DST_MASK    0x1e00
11862306a36Sopenharmony_ci#  define SSI_DST_MEMORY_PORT  (8 << 9)
11962306a36Sopenharmony_ci#  define SSI_DST_PERIPHERAL_PORT  (9 << 9)
12062306a36Sopenharmony_ci#  define SSI_SRC_BURST_EN_MASK  0x180
12162306a36Sopenharmony_ci#  define SSI_SRC_SINGLE_ACCESS0  0
12262306a36Sopenharmony_ci#  define SSI_SRC_SINGLE_ACCESS  (1 << 7)
12362306a36Sopenharmony_ci#  define SSI_SRC_BURST_4x32_BIT  (2 << 7)
12462306a36Sopenharmony_ci#  define SSI_SRC_BURST_8x32_BIT  (3 << 7)
12562306a36Sopenharmony_ci#  define SSI_SRC_MASK    0x3c
12662306a36Sopenharmony_ci#  define SSI_SRC_MEMORY_PORT  (8 << 2)
12762306a36Sopenharmony_ci#  define SSI_SRC_PERIPHERAL_PORT  (9 << 2)
12862306a36Sopenharmony_ci#  define SSI_DATA_TYPE_MASK  3
12962306a36Sopenharmony_ci#  define SSI_DATA_TYPE_S32  2
13062306a36Sopenharmony_ci#define SSI_GDD_CCR_REG(channel)  (0x802 + ((channel) * 0x40))
13162306a36Sopenharmony_ci#  define SSI_DST_AMODE_MASK  (3 << 14)
13262306a36Sopenharmony_ci#  define SSI_DST_AMODE_CONST  0
13362306a36Sopenharmony_ci#  define SSI_DST_AMODE_POSTINC  (1 << 12)
13462306a36Sopenharmony_ci#  define SSI_SRC_AMODE_MASK  (3 << 12)
13562306a36Sopenharmony_ci#  define SSI_SRC_AMODE_CONST  0
13662306a36Sopenharmony_ci#  define SSI_SRC_AMODE_POSTINC  (1 << 12)
13762306a36Sopenharmony_ci#  define SSI_CCR_ENABLE    (1 << 7)
13862306a36Sopenharmony_ci#  define SSI_CCR_SYNC_MASK  0x1f
13962306a36Sopenharmony_ci#define SSI_GDD_CICR_REG(channel)  (0x804 + ((channel) * 0x40))
14062306a36Sopenharmony_ci#  define SSI_BLOCK_IE    (1 << 5)
14162306a36Sopenharmony_ci#  define SSI_HALF_IE    (1 << 2)
14262306a36Sopenharmony_ci#  define SSI_TOUT_IE    (1 << 0)
14362306a36Sopenharmony_ci#define SSI_GDD_CSR_REG(channel)  (0x806 + ((channel) * 0x40))
14462306a36Sopenharmony_ci#  define SSI_CSR_SYNC    (1 << 6)
14562306a36Sopenharmony_ci#  define SSI_CSR_BLOCK    (1 << 5)
14662306a36Sopenharmony_ci#  define SSI_CSR_HALF    (1 << 2)
14762306a36Sopenharmony_ci#  define SSI_CSR_TOUR    (1 << 0)
14862306a36Sopenharmony_ci#define SSI_GDD_CSSA_REG(channel)  (0x808 + ((channel) * 0x40))
14962306a36Sopenharmony_ci#define SSI_GDD_CDSA_REG(channel)  (0x80c + ((channel) * 0x40))
15062306a36Sopenharmony_ci#define SSI_GDD_CEN_REG(channel)  (0x810 + ((channel) * 0x40))
15162306a36Sopenharmony_ci#define SSI_GDD_CSAC_REG(channel)  (0x818 + ((channel) * 0x40))
15262306a36Sopenharmony_ci#define SSI_GDD_CDAC_REG(channel)  (0x81a + ((channel) * 0x40))
15362306a36Sopenharmony_ci#define SSI_GDD_CLNK_CTRL_REG(channel)  (0x828 + ((channel) * 0x40))
15462306a36Sopenharmony_ci#  define SSI_ENABLE_LNK    (1 << 15)
15562306a36Sopenharmony_ci#  define SSI_STOP_LNK    (1 << 14)
15662306a36Sopenharmony_ci#  define SSI_NEXT_CH_ID_MASK  0xf
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#endif /* __OMAP_SSI_REGS_H__ */
159