162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
462306a36Sopenharmony_ci * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
562306a36Sopenharmony_ci * Copyright (C) 2016 Intel Deutschland GmbH
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef	__iwl_prph_h__
862306a36Sopenharmony_ci#define __iwl_prph_h__
962306a36Sopenharmony_ci#include <linux/bitfield.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * Registers in this file are internal, not PCI bus memory mapped.
1362306a36Sopenharmony_ci * Driver accesses these via HBUS_TARG_PRPH_* registers.
1462306a36Sopenharmony_ci */
1562306a36Sopenharmony_ci#define PRPH_BASE	(0x00000)
1662306a36Sopenharmony_ci#define PRPH_END	(0xFFFFF)
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* APMG (power management) constants */
1962306a36Sopenharmony_ci#define APMG_BASE			(PRPH_BASE + 0x3000)
2062306a36Sopenharmony_ci#define APMG_CLK_CTRL_REG		(APMG_BASE + 0x0000)
2162306a36Sopenharmony_ci#define APMG_CLK_EN_REG			(APMG_BASE + 0x0004)
2262306a36Sopenharmony_ci#define APMG_CLK_DIS_REG		(APMG_BASE + 0x0008)
2362306a36Sopenharmony_ci#define APMG_PS_CTRL_REG		(APMG_BASE + 0x000c)
2462306a36Sopenharmony_ci#define APMG_PCIDEV_STT_REG		(APMG_BASE + 0x0010)
2562306a36Sopenharmony_ci#define APMG_RFKILL_REG			(APMG_BASE + 0x0014)
2662306a36Sopenharmony_ci#define APMG_RTC_INT_STT_REG		(APMG_BASE + 0x001c)
2762306a36Sopenharmony_ci#define APMG_RTC_INT_MSK_REG		(APMG_BASE + 0x0020)
2862306a36Sopenharmony_ci#define APMG_DIGITAL_SVR_REG		(APMG_BASE + 0x0058)
2962306a36Sopenharmony_ci#define APMG_ANALOG_SVR_REG		(APMG_BASE + 0x006C)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define APMS_CLK_VAL_MRB_FUNC_MODE	(0x00000001)
3262306a36Sopenharmony_ci#define APMG_CLK_VAL_DMA_CLK_RQT	(0x00000200)
3362306a36Sopenharmony_ci#define APMG_CLK_VAL_BSM_CLK_RQT	(0x00000800)
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS	(0x00400000)
3662306a36Sopenharmony_ci#define APMG_PS_CTRL_VAL_RESET_REQ		(0x04000000)
3762306a36Sopenharmony_ci#define APMG_PS_CTRL_MSK_PWR_SRC		(0x03000000)
3862306a36Sopenharmony_ci#define APMG_PS_CTRL_VAL_PWR_SRC_VMAIN		(0x00000000)
3962306a36Sopenharmony_ci#define APMG_PS_CTRL_VAL_PWR_SRC_VAUX		(0x02000000)
4062306a36Sopenharmony_ci#define APMG_SVR_VOLTAGE_CONFIG_BIT_MSK	(0x000001E0) /* bit 8:5 */
4162306a36Sopenharmony_ci#define APMG_SVR_DIGITAL_VOLTAGE_1_32		(0x00000060)
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define APMG_PCIDEV_STT_VAL_PERSIST_DIS	(0x00000200)
4462306a36Sopenharmony_ci#define APMG_PCIDEV_STT_VAL_L1_ACT_DIS	(0x00000800)
4562306a36Sopenharmony_ci#define APMG_PCIDEV_STT_VAL_WAKE_ME	(0x00004000)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define APMG_RTC_INT_STT_RFKILL		(0x10000000)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Device system time */
5062306a36Sopenharmony_ci#define DEVICE_SYSTEM_TIME_REG 0xA0206C
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* Device NMI register and value for 8000 family and lower hw's */
5362306a36Sopenharmony_ci#define DEVICE_SET_NMI_REG 0x00a01c30
5462306a36Sopenharmony_ci#define DEVICE_SET_NMI_VAL_DRV BIT(7)
5562306a36Sopenharmony_ci/* Device NMI register and value for 9000 family and above hw's */
5662306a36Sopenharmony_ci#define UREG_NIC_SET_NMI_DRIVER 0x00a05c10
5762306a36Sopenharmony_ci#define UREG_NIC_SET_NMI_DRIVER_NMI_FROM_DRIVER BIT(24)
5862306a36Sopenharmony_ci#define UREG_NIC_SET_NMI_DRIVER_RESET_HANDSHAKE (BIT(24) | BIT(25))
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci/* Shared registers (0x0..0x3ff, via target indirect or periphery */
6162306a36Sopenharmony_ci#define SHR_BASE	0x00a10000
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* Shared GP1 register */
6462306a36Sopenharmony_ci#define SHR_APMG_GP1_REG		0x01dc
6562306a36Sopenharmony_ci#define SHR_APMG_GP1_REG_PRPH		(SHR_BASE + SHR_APMG_GP1_REG)
6662306a36Sopenharmony_ci#define SHR_APMG_GP1_WF_XTAL_LP_EN	0x00000004
6762306a36Sopenharmony_ci#define SHR_APMG_GP1_CHICKEN_BIT_SELECT	0x80000000
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci/* Shared DL_CFG register */
7062306a36Sopenharmony_ci#define SHR_APMG_DL_CFG_REG			0x01c4
7162306a36Sopenharmony_ci#define SHR_APMG_DL_CFG_REG_PRPH		(SHR_BASE + SHR_APMG_DL_CFG_REG)
7262306a36Sopenharmony_ci#define SHR_APMG_DL_CFG_RTCS_CLK_SELECTOR_MSK	0x000000c0
7362306a36Sopenharmony_ci#define SHR_APMG_DL_CFG_RTCS_CLK_INTERNAL_XTAL	0x00000080
7462306a36Sopenharmony_ci#define SHR_APMG_DL_CFG_DL_CLOCK_POWER_UP	0x00000100
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/* Shared APMG_XTAL_CFG register */
7762306a36Sopenharmony_ci#define SHR_APMG_XTAL_CFG_REG		0x1c0
7862306a36Sopenharmony_ci#define SHR_APMG_XTAL_CFG_XTAL_ON_REQ	0x80000000
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/*
8162306a36Sopenharmony_ci * Device reset for family 8000
8262306a36Sopenharmony_ci * write to bit 24 in order to reset the CPU
8362306a36Sopenharmony_ci*/
8462306a36Sopenharmony_ci#define RELEASE_CPU_RESET		(0x300C)
8562306a36Sopenharmony_ci#define RELEASE_CPU_RESET_BIT		BIT(24)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/*****************************************************************************
8862306a36Sopenharmony_ci *                        7000/3000 series SHR DTS addresses                 *
8962306a36Sopenharmony_ci *****************************************************************************/
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define SHR_MISC_WFM_DTS_EN	(0x00a10024)
9262306a36Sopenharmony_ci#define DTSC_CFG_MODE		(0x00a10604)
9362306a36Sopenharmony_ci#define DTSC_VREF_AVG		(0x00a10648)
9462306a36Sopenharmony_ci#define DTSC_VREF5_AVG		(0x00a1064c)
9562306a36Sopenharmony_ci#define DTSC_CFG_MODE_PERIODIC	(0x2)
9662306a36Sopenharmony_ci#define DTSC_PTAT_AVG		(0x00a10650)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci/**
10062306a36Sopenharmony_ci * Tx Scheduler
10162306a36Sopenharmony_ci *
10262306a36Sopenharmony_ci * The Tx Scheduler selects the next frame to be transmitted, choosing TFDs
10362306a36Sopenharmony_ci * (Transmit Frame Descriptors) from up to 16 circular Tx queues resident in
10462306a36Sopenharmony_ci * host DRAM.  It steers each frame's Tx command (which contains the frame
10562306a36Sopenharmony_ci * data) into one of up to 7 prioritized Tx DMA FIFO channels within the
10662306a36Sopenharmony_ci * device.  A queue maps to only one (selectable by driver) Tx DMA channel,
10762306a36Sopenharmony_ci * but one DMA channel may take input from several queues.
10862306a36Sopenharmony_ci *
10962306a36Sopenharmony_ci * Tx DMA FIFOs have dedicated purposes.
11062306a36Sopenharmony_ci *
11162306a36Sopenharmony_ci * For 5000 series and up, they are used differently
11262306a36Sopenharmony_ci * (cf. iwl5000_default_queue_to_tx_fifo in iwl-5000.c):
11362306a36Sopenharmony_ci *
11462306a36Sopenharmony_ci * 0 -- EDCA BK (background) frames, lowest priority
11562306a36Sopenharmony_ci * 1 -- EDCA BE (best effort) frames, normal priority
11662306a36Sopenharmony_ci * 2 -- EDCA VI (video) frames, higher priority
11762306a36Sopenharmony_ci * 3 -- EDCA VO (voice) and management frames, highest priority
11862306a36Sopenharmony_ci * 4 -- unused
11962306a36Sopenharmony_ci * 5 -- unused
12062306a36Sopenharmony_ci * 6 -- unused
12162306a36Sopenharmony_ci * 7 -- Commands
12262306a36Sopenharmony_ci *
12362306a36Sopenharmony_ci * Driver should normally map queues 0-6 to Tx DMA/FIFO channels 0-6.
12462306a36Sopenharmony_ci * In addition, driver can map the remaining queues to Tx DMA/FIFO
12562306a36Sopenharmony_ci * channels 0-3 to support 11n aggregation via EDCA DMA channels.
12662306a36Sopenharmony_ci *
12762306a36Sopenharmony_ci * The driver sets up each queue to work in one of two modes:
12862306a36Sopenharmony_ci *
12962306a36Sopenharmony_ci * 1)  Scheduler-Ack, in which the scheduler automatically supports a
13062306a36Sopenharmony_ci *     block-ack (BA) window of up to 64 TFDs.  In this mode, each queue
13162306a36Sopenharmony_ci *     contains TFDs for a unique combination of Recipient Address (RA)
13262306a36Sopenharmony_ci *     and Traffic Identifier (TID), that is, traffic of a given
13362306a36Sopenharmony_ci *     Quality-Of-Service (QOS) priority, destined for a single station.
13462306a36Sopenharmony_ci *
13562306a36Sopenharmony_ci *     In scheduler-ack mode, the scheduler keeps track of the Tx status of
13662306a36Sopenharmony_ci *     each frame within the BA window, including whether it's been transmitted,
13762306a36Sopenharmony_ci *     and whether it's been acknowledged by the receiving station.  The device
13862306a36Sopenharmony_ci *     automatically processes block-acks received from the receiving STA,
13962306a36Sopenharmony_ci *     and reschedules un-acked frames to be retransmitted (successful
14062306a36Sopenharmony_ci *     Tx completion may end up being out-of-order).
14162306a36Sopenharmony_ci *
14262306a36Sopenharmony_ci *     The driver must maintain the queue's Byte Count table in host DRAM
14362306a36Sopenharmony_ci *     for this mode.
14462306a36Sopenharmony_ci *     This mode does not support fragmentation.
14562306a36Sopenharmony_ci *
14662306a36Sopenharmony_ci * 2)  FIFO (a.k.a. non-Scheduler-ACK), in which each TFD is processed in order.
14762306a36Sopenharmony_ci *     The device may automatically retry Tx, but will retry only one frame
14862306a36Sopenharmony_ci *     at a time, until receiving ACK from receiving station, or reaching
14962306a36Sopenharmony_ci *     retry limit and giving up.
15062306a36Sopenharmony_ci *
15162306a36Sopenharmony_ci *     The command queue (#4/#9) must use this mode!
15262306a36Sopenharmony_ci *     This mode does not require use of the Byte Count table in host DRAM.
15362306a36Sopenharmony_ci *
15462306a36Sopenharmony_ci * Driver controls scheduler operation via 3 means:
15562306a36Sopenharmony_ci * 1)  Scheduler registers
15662306a36Sopenharmony_ci * 2)  Shared scheduler data base in internal SRAM
15762306a36Sopenharmony_ci * 3)  Shared data in host DRAM
15862306a36Sopenharmony_ci *
15962306a36Sopenharmony_ci * Initialization:
16062306a36Sopenharmony_ci *
16162306a36Sopenharmony_ci * When loading, driver should allocate memory for:
16262306a36Sopenharmony_ci * 1)  16 TFD circular buffers, each with space for (typically) 256 TFDs.
16362306a36Sopenharmony_ci * 2)  16 Byte Count circular buffers in 16 KBytes contiguous memory
16462306a36Sopenharmony_ci *     (1024 bytes for each queue).
16562306a36Sopenharmony_ci *
16662306a36Sopenharmony_ci * After receiving "Alive" response from uCode, driver must initialize
16762306a36Sopenharmony_ci * the scheduler (especially for queue #4/#9, the command queue, otherwise
16862306a36Sopenharmony_ci * the driver can't issue commands!):
16962306a36Sopenharmony_ci */
17062306a36Sopenharmony_ci#define SCD_MEM_LOWER_BOUND		(0x0000)
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci/**
17362306a36Sopenharmony_ci * Max Tx window size is the max number of contiguous TFDs that the scheduler
17462306a36Sopenharmony_ci * can keep track of at one time when creating block-ack chains of frames.
17562306a36Sopenharmony_ci * Note that "64" matches the number of ack bits in a block-ack packet.
17662306a36Sopenharmony_ci */
17762306a36Sopenharmony_ci#define SCD_WIN_SIZE				64
17862306a36Sopenharmony_ci#define SCD_FRAME_LIMIT				64
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci#define SCD_TXFIFO_POS_TID			(0)
18162306a36Sopenharmony_ci#define SCD_TXFIFO_POS_RA			(4)
18262306a36Sopenharmony_ci#define SCD_QUEUE_RA_TID_MAP_RATID_MSK	(0x01FF)
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci/* agn SCD */
18562306a36Sopenharmony_ci#define SCD_QUEUE_STTS_REG_POS_TXF	(0)
18662306a36Sopenharmony_ci#define SCD_QUEUE_STTS_REG_POS_ACTIVE	(3)
18762306a36Sopenharmony_ci#define SCD_QUEUE_STTS_REG_POS_WSL	(4)
18862306a36Sopenharmony_ci#define SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19)
18962306a36Sopenharmony_ci#define SCD_QUEUE_STTS_REG_MSK		(0x017F0000)
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG1_CREDIT		(0x00FFFF00)
19262306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG1_SUPER_CREDIT		(0xFF000000)
19362306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG1_VAL(_n, _v)		FIELD_PREP(SCD_QUEUE_CTX_REG1_ ## _n, _v)
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG2_WIN_SIZE		(0x0000007F)
19662306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG2_FRAME_LIMIT		(0x007F0000)
19762306a36Sopenharmony_ci#define SCD_QUEUE_CTX_REG2_VAL(_n, _v)		FIELD_PREP(SCD_QUEUE_CTX_REG2_ ## _n, _v)
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci#define SCD_GP_CTRL_ENABLE_31_QUEUES		BIT(0)
20062306a36Sopenharmony_ci#define SCD_GP_CTRL_AUTO_ACTIVE_MODE		BIT(18)
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci/* Context Data */
20362306a36Sopenharmony_ci#define SCD_CONTEXT_MEM_LOWER_BOUND	(SCD_MEM_LOWER_BOUND + 0x600)
20462306a36Sopenharmony_ci#define SCD_CONTEXT_MEM_UPPER_BOUND	(SCD_MEM_LOWER_BOUND + 0x6A0)
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci/* Tx status */
20762306a36Sopenharmony_ci#define SCD_TX_STTS_MEM_LOWER_BOUND	(SCD_MEM_LOWER_BOUND + 0x6A0)
20862306a36Sopenharmony_ci#define SCD_TX_STTS_MEM_UPPER_BOUND	(SCD_MEM_LOWER_BOUND + 0x7E0)
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_ci/* Translation Data */
21162306a36Sopenharmony_ci#define SCD_TRANS_TBL_MEM_LOWER_BOUND	(SCD_MEM_LOWER_BOUND + 0x7E0)
21262306a36Sopenharmony_ci#define SCD_TRANS_TBL_MEM_UPPER_BOUND	(SCD_MEM_LOWER_BOUND + 0x808)
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci#define SCD_CONTEXT_QUEUE_OFFSET(x)\
21562306a36Sopenharmony_ci	(SCD_CONTEXT_MEM_LOWER_BOUND + ((x) * 8))
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci#define SCD_TX_STTS_QUEUE_OFFSET(x)\
21862306a36Sopenharmony_ci	(SCD_TX_STTS_MEM_LOWER_BOUND + ((x) * 16))
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#define SCD_TRANS_TBL_OFFSET_QUEUE(x) \
22162306a36Sopenharmony_ci	((SCD_TRANS_TBL_MEM_LOWER_BOUND + ((x) * 2)) & 0xfffc)
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci#define SCD_BASE			(PRPH_BASE + 0xa02c00)
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci#define SCD_SRAM_BASE_ADDR	(SCD_BASE + 0x0)
22662306a36Sopenharmony_ci#define SCD_DRAM_BASE_ADDR	(SCD_BASE + 0x8)
22762306a36Sopenharmony_ci#define SCD_AIT			(SCD_BASE + 0x0c)
22862306a36Sopenharmony_ci#define SCD_TXFACT		(SCD_BASE + 0x10)
22962306a36Sopenharmony_ci#define SCD_ACTIVE		(SCD_BASE + 0x14)
23062306a36Sopenharmony_ci#define SCD_QUEUECHAIN_SEL	(SCD_BASE + 0xe8)
23162306a36Sopenharmony_ci#define SCD_CHAINEXT_EN		(SCD_BASE + 0x244)
23262306a36Sopenharmony_ci#define SCD_AGGR_SEL		(SCD_BASE + 0x248)
23362306a36Sopenharmony_ci#define SCD_INTERRUPT_MASK	(SCD_BASE + 0x108)
23462306a36Sopenharmony_ci#define SCD_GP_CTRL		(SCD_BASE + 0x1a8)
23562306a36Sopenharmony_ci#define SCD_EN_CTRL		(SCD_BASE + 0x254)
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci/*********************** END TX SCHEDULER *************************************/
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci/* Oscillator clock */
24062306a36Sopenharmony_ci#define OSC_CLK				(0xa04068)
24162306a36Sopenharmony_ci#define OSC_CLK_FORCE_CONTROL		(0x8)
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci#define FH_UCODE_LOAD_STATUS		(0x1AF0)
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci/*
24662306a36Sopenharmony_ci * Replacing FH_UCODE_LOAD_STATUS
24762306a36Sopenharmony_ci * This register is writen by driver and is read by uCode during boot flow.
24862306a36Sopenharmony_ci * Note this address is cleared after MAC reset.
24962306a36Sopenharmony_ci */
25062306a36Sopenharmony_ci#define UREG_UCODE_LOAD_STATUS		(0xa05c40)
25162306a36Sopenharmony_ci#define UREG_CPU_INIT_RUN		(0xa05c44)
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci#define LMPM_SECURE_UCODE_LOAD_CPU1_HDR_ADDR	(0x1E78)
25462306a36Sopenharmony_ci#define LMPM_SECURE_UCODE_LOAD_CPU2_HDR_ADDR	(0x1E7C)
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci#define LMPM_SECURE_CPU1_HDR_MEM_SPACE		(0x420000)
25762306a36Sopenharmony_ci#define LMPM_SECURE_CPU2_HDR_MEM_SPACE		(0x420400)
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci#define LMAC2_PRPH_OFFSET		(0x100000)
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci/* Rx FIFO */
26262306a36Sopenharmony_ci#define RXF_SIZE_ADDR			(0xa00c88)
26362306a36Sopenharmony_ci#define RXF_RD_D_SPACE			(0xa00c40)
26462306a36Sopenharmony_ci#define RXF_RD_WR_PTR			(0xa00c50)
26562306a36Sopenharmony_ci#define RXF_RD_RD_PTR			(0xa00c54)
26662306a36Sopenharmony_ci#define RXF_RD_FENCE_PTR		(0xa00c4c)
26762306a36Sopenharmony_ci#define RXF_SET_FENCE_MODE		(0xa00c14)
26862306a36Sopenharmony_ci#define RXF_LD_WR2FENCE		(0xa00c1c)
26962306a36Sopenharmony_ci#define RXF_FIFO_RD_FENCE_INC		(0xa00c68)
27062306a36Sopenharmony_ci#define RXF_SIZE_BYTE_CND_POS		(7)
27162306a36Sopenharmony_ci#define RXF_SIZE_BYTE_CNT_MSK		(0x3ff << RXF_SIZE_BYTE_CND_POS)
27262306a36Sopenharmony_ci#define RXF_DIFF_FROM_PREV		(0x200)
27362306a36Sopenharmony_ci#define RXF2C_DIFF_FROM_PREV		(0x4e00)
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci#define RXF_LD_FENCE_OFFSET_ADDR	(0xa00c10)
27662306a36Sopenharmony_ci#define RXF_FIFO_RD_FENCE_ADDR		(0xa00c0c)
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci/* Tx FIFO */
27962306a36Sopenharmony_ci#define TXF_FIFO_ITEM_CNT		(0xa00438)
28062306a36Sopenharmony_ci#define TXF_WR_PTR			(0xa00414)
28162306a36Sopenharmony_ci#define TXF_RD_PTR			(0xa00410)
28262306a36Sopenharmony_ci#define TXF_FENCE_PTR			(0xa00418)
28362306a36Sopenharmony_ci#define TXF_LOCK_FENCE			(0xa00424)
28462306a36Sopenharmony_ci#define TXF_LARC_NUM			(0xa0043c)
28562306a36Sopenharmony_ci#define TXF_READ_MODIFY_DATA		(0xa00448)
28662306a36Sopenharmony_ci#define TXF_READ_MODIFY_ADDR		(0xa0044c)
28762306a36Sopenharmony_ci
28862306a36Sopenharmony_ci/* UMAC Internal Tx Fifo */
28962306a36Sopenharmony_ci#define TXF_CPU2_FIFO_ITEM_CNT		(0xA00538)
29062306a36Sopenharmony_ci#define TXF_CPU2_WR_PTR		(0xA00514)
29162306a36Sopenharmony_ci#define TXF_CPU2_RD_PTR		(0xA00510)
29262306a36Sopenharmony_ci#define TXF_CPU2_FENCE_PTR		(0xA00518)
29362306a36Sopenharmony_ci#define TXF_CPU2_LOCK_FENCE		(0xA00524)
29462306a36Sopenharmony_ci#define TXF_CPU2_NUM			(0xA0053C)
29562306a36Sopenharmony_ci#define TXF_CPU2_READ_MODIFY_DATA	(0xA00548)
29662306a36Sopenharmony_ci#define TXF_CPU2_READ_MODIFY_ADDR	(0xA0054C)
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci/* Radio registers access */
29962306a36Sopenharmony_ci#define RSP_RADIO_CMD			(0xa02804)
30062306a36Sopenharmony_ci#define RSP_RADIO_RDDAT			(0xa02814)
30162306a36Sopenharmony_ci#define RADIO_RSP_ADDR_POS		(6)
30262306a36Sopenharmony_ci#define RADIO_RSP_RD_CMD		(3)
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci/* LTR control (Qu only) */
30562306a36Sopenharmony_ci#define HPM_MAC_LTR_CSR			0xa0348c
30662306a36Sopenharmony_ci#define HPM_MAC_LRT_ENABLE_ALL		0xf
30762306a36Sopenharmony_ci/* also uses CSR_LTR_* for values */
30862306a36Sopenharmony_ci#define HPM_UMAC_LTR			0xa03480
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci/* FW monitor */
31162306a36Sopenharmony_ci#define MON_BUFF_SAMPLE_CTL		(0xa03c00)
31262306a36Sopenharmony_ci#define MON_BUFF_BASE_ADDR		(0xa03c1c)
31362306a36Sopenharmony_ci#define MON_BUFF_END_ADDR		(0xa03c40)
31462306a36Sopenharmony_ci#define MON_BUFF_WRPTR			(0xa03c44)
31562306a36Sopenharmony_ci#define MON_BUFF_CYCLE_CNT		(0xa03c48)
31662306a36Sopenharmony_ci/* FW monitor family 8000 and on */
31762306a36Sopenharmony_ci#define MON_BUFF_BASE_ADDR_VER2		(0xa03c1c)
31862306a36Sopenharmony_ci#define MON_BUFF_END_ADDR_VER2		(0xa03c20)
31962306a36Sopenharmony_ci#define MON_BUFF_WRPTR_VER2		(0xa03c24)
32062306a36Sopenharmony_ci#define MON_BUFF_CYCLE_CNT_VER2		(0xa03c28)
32162306a36Sopenharmony_ci#define MON_BUFF_SHIFT_VER2		(0x8)
32262306a36Sopenharmony_ci/* FW monitor familiy AX210 and on */
32362306a36Sopenharmony_ci#define DBGC_CUR_DBGBUF_BASE_ADDR_LSB		(0xd03c20)
32462306a36Sopenharmony_ci#define DBGC_CUR_DBGBUF_BASE_ADDR_MSB		(0xd03c24)
32562306a36Sopenharmony_ci#define DBGC_CUR_DBGBUF_STATUS			(0xd03c1c)
32662306a36Sopenharmony_ci#define DBGC_DBGBUF_WRAP_AROUND			(0xd03c2c)
32762306a36Sopenharmony_ci#define DBGC_CUR_DBGBUF_STATUS_OFFSET_MSK	(0x00ffffff)
32862306a36Sopenharmony_ci#define DBGC_CUR_DBGBUF_STATUS_IDX_MSK		(0x0f000000)
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_ci#define MON_DMARB_RD_CTL_ADDR		(0xa03c60)
33162306a36Sopenharmony_ci#define MON_DMARB_RD_DATA_ADDR		(0xa03c5c)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci#define DBGC_IN_SAMPLE			(0xa03c00)
33462306a36Sopenharmony_ci#define DBGC_OUT_CTRL			(0xa03c0c)
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci/* M2S registers */
33762306a36Sopenharmony_ci#define LDBG_M2S_BUF_WPTR			(0xa0476c)
33862306a36Sopenharmony_ci#define LDBG_M2S_BUF_WRAP_CNT			(0xa04774)
33962306a36Sopenharmony_ci#define LDBG_M2S_BUF_WPTR_VAL_MSK		(0x000fffff)
34062306a36Sopenharmony_ci#define LDBG_M2S_BUF_WRAP_CNT_VAL_MSK		(0x000fffff)
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci/* enable the ID buf for read */
34362306a36Sopenharmony_ci#define WFPM_PS_CTL_CLR			0xA0300C
34462306a36Sopenharmony_ci#define WFMP_MAC_ADDR_0			0xA03080
34562306a36Sopenharmony_ci#define WFMP_MAC_ADDR_1			0xA03084
34662306a36Sopenharmony_ci#define LMPM_PMG_EN			0xA01CEC
34762306a36Sopenharmony_ci#define RADIO_REG_SYS_MANUAL_DFT_0	0xAD4078
34862306a36Sopenharmony_ci#define RFIC_REG_RD			0xAD0470
34962306a36Sopenharmony_ci#define WFPM_CTRL_REG			0xA03030
35062306a36Sopenharmony_ci#define WFPM_OTP_CFG1_ADDR		0x00a03098
35162306a36Sopenharmony_ci#define WFPM_OTP_CFG1_IS_JACKET_BIT	BIT(5)
35262306a36Sopenharmony_ci#define WFPM_OTP_CFG1_IS_CDB_BIT	BIT(4)
35362306a36Sopenharmony_ci#define WFPM_OTP_BZ_BNJ_JACKET_BIT	5
35462306a36Sopenharmony_ci#define WFPM_OTP_BZ_BNJ_CDB_BIT		4
35562306a36Sopenharmony_ci#define WFPM_OTP_CFG1_IS_JACKET(_val)   (((_val) & 0x00000020) >> WFPM_OTP_BZ_BNJ_JACKET_BIT)
35662306a36Sopenharmony_ci#define WFPM_OTP_CFG1_IS_CDB(_val)      (((_val) & 0x00000010) >> WFPM_OTP_BZ_BNJ_CDB_BIT)
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci#define WFPM_GP2			0xA030B4
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci/* DBGI SRAM Register details */
36262306a36Sopenharmony_ci#define DBGI_SRAM_TARGET_ACCESS_RDATA_LSB		0x00A2E154
36362306a36Sopenharmony_ci#define DBGI_SRAM_TARGET_ACCESS_RDATA_MSB		0x00A2E158
36462306a36Sopenharmony_ci#define DBGI_SRAM_FIFO_POINTERS				0x00A2E148
36562306a36Sopenharmony_ci#define DBGI_SRAM_FIFO_POINTERS_WR_PTR_MSK		0x00000FFF
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_cienum {
36862306a36Sopenharmony_ci	ENABLE_WFPM = BIT(31),
36962306a36Sopenharmony_ci	WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK	= 0x80000000,
37062306a36Sopenharmony_ci};
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ci#define CNVI_AUX_MISC_CHIP				0xA200B0
37362306a36Sopenharmony_ci#define CNVR_AUX_MISC_CHIP				0xA2B800
37462306a36Sopenharmony_ci#define CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM		0xA29890
37562306a36Sopenharmony_ci#define CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR	0xA29938
37662306a36Sopenharmony_ci#define CNVI_SCU_SEQ_DATA_DW9				0xA27488
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ci#define PREG_AUX_BUS_WPROT_0		0xA04CC0
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci/* device family 9000 WPROT register */
38162306a36Sopenharmony_ci#define PREG_PRPH_WPROT_9000		0xA04CE0
38262306a36Sopenharmony_ci/* device family 22000 WPROT register */
38362306a36Sopenharmony_ci#define PREG_PRPH_WPROT_22000		0xA04D00
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci#define SB_MODIFY_CFG_FLAG		0xA03088
38662306a36Sopenharmony_ci#define SB_CFG_RESIDES_IN_OTP_MASK	0x10
38762306a36Sopenharmony_ci#define SB_CPU_1_STATUS			0xA01E30
38862306a36Sopenharmony_ci#define SB_CPU_2_STATUS			0xA01E34
38962306a36Sopenharmony_ci#define UMAG_SB_CPU_1_STATUS		0xA038C0
39062306a36Sopenharmony_ci#define UMAG_SB_CPU_2_STATUS		0xA038C4
39162306a36Sopenharmony_ci#define UMAG_GEN_HW_STATUS		0xA038C8
39262306a36Sopenharmony_ci#define UREG_UMAC_CURRENT_PC		0xa05c18
39362306a36Sopenharmony_ci#define UREG_LMAC1_CURRENT_PC		0xa05c1c
39462306a36Sopenharmony_ci#define UREG_LMAC2_CURRENT_PC		0xa05c20
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_ci#define WFPM_LMAC1_PD_NOTIFICATION      0xa0338c
39762306a36Sopenharmony_ci#define WFPM_ARC1_PD_NOTIFICATION       0xa03044
39862306a36Sopenharmony_ci#define HPM_SECONDARY_DEVICE_STATE      0xa03404
39962306a36Sopenharmony_ci#define WFPM_MAC_OTP_CFG7_ADDR		0xa03338
40062306a36Sopenharmony_ci#define WFPM_MAC_OTP_CFG7_DATA		0xa0333c
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci/* For UMAG_GEN_HW_STATUS reg check */
40462306a36Sopenharmony_cienum {
40562306a36Sopenharmony_ci	UMAG_GEN_HW_IS_FPGA = BIT(1),
40662306a36Sopenharmony_ci};
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci/* FW chicken bits */
40962306a36Sopenharmony_ci#define LMPM_CHICK			0xA01FF8
41062306a36Sopenharmony_cienum {
41162306a36Sopenharmony_ci	LMPM_CHICK_EXTENDED_ADDR_SPACE = BIT(0),
41262306a36Sopenharmony_ci};
41362306a36Sopenharmony_ci
41462306a36Sopenharmony_ci/* FW chicken bits */
41562306a36Sopenharmony_ci#define LMPM_PAGE_PASS_NOTIF			0xA03824
41662306a36Sopenharmony_cienum {
41762306a36Sopenharmony_ci	LMPM_PAGE_PASS_NOTIF_POS = BIT(20),
41862306a36Sopenharmony_ci};
41962306a36Sopenharmony_ci
42062306a36Sopenharmony_ci/*
42162306a36Sopenharmony_ci * CRF ID register
42262306a36Sopenharmony_ci *
42362306a36Sopenharmony_ci * type: bits 0-11
42462306a36Sopenharmony_ci * reserved: bits 12-18
42562306a36Sopenharmony_ci * slave_exist: bit 19
42662306a36Sopenharmony_ci * dash: bits 20-23
42762306a36Sopenharmony_ci * step: bits 24-26
42862306a36Sopenharmony_ci * flavor: bits 27-31
42962306a36Sopenharmony_ci */
43062306a36Sopenharmony_ci#define REG_CRF_ID_TYPE(val)		(((val) & 0x00000FFF) >> 0)
43162306a36Sopenharmony_ci#define REG_CRF_ID_SLAVE(val)		(((val) & 0x00080000) >> 19)
43262306a36Sopenharmony_ci#define REG_CRF_ID_DASH(val)		(((val) & 0x00F00000) >> 20)
43362306a36Sopenharmony_ci#define REG_CRF_ID_STEP(val)		(((val) & 0x07000000) >> 24)
43462306a36Sopenharmony_ci#define REG_CRF_ID_FLAVOR(val)		(((val) & 0xF8000000) >> 27)
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ci#define UREG_CHICK		(0xA05C00)
43762306a36Sopenharmony_ci#define UREG_CHICK_MSI_ENABLE	BIT(24)
43862306a36Sopenharmony_ci#define UREG_CHICK_MSIX_ENABLE	BIT(25)
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci#define SD_REG_VER		0xa29600
44162306a36Sopenharmony_ci#define SD_REG_VER_GEN2		0x00a2b800
44262306a36Sopenharmony_ci
44362306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_JF_1			0x201
44462306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_JF_2			0x202
44562306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_HR_CDB			0x503
44662306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_HR_NONE_CDB		0x504
44762306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_HR_NONE_CDB_1X1	0x501
44862306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_HR_NONE_CDB_CCP	0x532
44962306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_GF			0x410
45062306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_GF_TC			0xF08
45162306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_MR			0x810
45262306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_FM			0x910
45362306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_FMI			0x930
45462306a36Sopenharmony_ci#define REG_CRF_ID_TYPE_FMR			0x900
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_ci#define HPM_DEBUG			0xA03440
45762306a36Sopenharmony_ci#define PERSISTENCE_BIT			BIT(12)
45862306a36Sopenharmony_ci#define PREG_WFPM_ACCESS		BIT(12)
45962306a36Sopenharmony_ci
46062306a36Sopenharmony_ci#define HPM_HIPM_GEN_CFG			0xA03458
46162306a36Sopenharmony_ci#define HPM_HIPM_GEN_CFG_CR_PG_EN		BIT(0)
46262306a36Sopenharmony_ci#define HPM_HIPM_GEN_CFG_CR_SLP_EN		BIT(1)
46362306a36Sopenharmony_ci#define HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE	BIT(10)
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6		0xA05C04
46662306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_NMI_BIT	BIT(0)
46762306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_RESET_HANDSHAKE (BIT(0) | BIT(1))
46862306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_SUSPEND	BIT(18)
46962306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_RESUME	BIT(19)
47062306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_PNVM	BIT(20)
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci/*
47362306a36Sopenharmony_ci * From BZ family driver triggers this bit for suspend and resume
47462306a36Sopenharmony_ci * The driver should update CSR_IPC_SLEEP_CONTROL before triggering
47562306a36Sopenharmony_ci * this interrupt with suspend/resume value
47662306a36Sopenharmony_ci */
47762306a36Sopenharmony_ci#define UREG_DOORBELL_TO_ISR6_SLEEP_CTRL	BIT(31)
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ci#define CNVI_MBOX_C			0xA3400C
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci#define FSEQ_ERROR_CODE			0xA340C8
48262306a36Sopenharmony_ci#define FSEQ_TOP_INIT_VERSION		0xA34038
48362306a36Sopenharmony_ci#define FSEQ_CNVIO_INIT_VERSION		0xA3403C
48462306a36Sopenharmony_ci#define FSEQ_OTP_VERSION		0xA340FC
48562306a36Sopenharmony_ci#define FSEQ_TOP_CONTENT_VERSION	0xA340F4
48662306a36Sopenharmony_ci#define FSEQ_ALIVE_TOKEN		0xA340F0
48762306a36Sopenharmony_ci#define FSEQ_CNVI_ID			0xA3408C
48862306a36Sopenharmony_ci#define FSEQ_CNVR_ID			0xA34090
48962306a36Sopenharmony_ci#define FSEQ_PREV_CNVIO_INIT_VERSION	0xA34084
49062306a36Sopenharmony_ci#define FSEQ_WIFI_FSEQ_VERSION		0xA34040
49162306a36Sopenharmony_ci#define FSEQ_BT_FSEQ_VERSION		0xA34044
49262306a36Sopenharmony_ci#define FSEQ_CLASS_TP_VERSION		0xA34078
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci#define IWL_D3_SLEEP_STATUS_SUSPEND	0xD3
49562306a36Sopenharmony_ci#define IWL_D3_SLEEP_STATUS_RESUME	0xD0
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci#define WMAL_INDRCT_RD_CMD1_OPMOD_POS 28
49862306a36Sopenharmony_ci#define WMAL_INDRCT_RD_CMD1_BYTE_ADDRESS_MSK 0xFFFFF
49962306a36Sopenharmony_ci#define WMAL_CMD_READ_BURST_ACCESS 2
50062306a36Sopenharmony_ci#define WMAL_MRSPF_1 0xADFC20
50162306a36Sopenharmony_ci#define WMAL_INDRCT_RD_CMD1 0xADFD44
50262306a36Sopenharmony_ci#define WMAL_INDRCT_CMD1 0xADFC14
50362306a36Sopenharmony_ci#define WMAL_INDRCT_CMD(addr) \
50462306a36Sopenharmony_ci	((WMAL_CMD_READ_BURST_ACCESS << WMAL_INDRCT_RD_CMD1_OPMOD_POS) | \
50562306a36Sopenharmony_ci	 ((addr) & WMAL_INDRCT_RD_CMD1_BYTE_ADDRESS_MSK))
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci#define WFPM_LMAC1_PS_CTL_RW 0xA03380
50862306a36Sopenharmony_ci#define WFPM_LMAC2_PS_CTL_RW 0xA033C0
50962306a36Sopenharmony_ci#define WFPM_PS_CTL_RW_PHYRF_PD_FSM_CURSTATE_MSK 0x0000000F
51062306a36Sopenharmony_ci#define WFPM_PHYRF_STATE_ON 5
51162306a36Sopenharmony_ci#define HBUS_TIMEOUT 0xA5A5A5A1
51262306a36Sopenharmony_ci#define WFPM_DPHY_OFF 0xDF10FF
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci#define REG_OTP_MINOR 0xA0333C
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci#define WFPM_LMAC2_PD_NOTIFICATION 0xA033CC
51762306a36Sopenharmony_ci#define WFPM_LMAC2_PD_RE_READ BIT(31)
51862306a36Sopenharmony_ci
51962306a36Sopenharmony_ci#endif				/* __iwl_prph_h__ */
520