162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2020-2021 NXP
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _AMPHION_VPU_IMX8Q_H
762306a36Sopenharmony_ci#define _AMPHION_VPU_IMX8Q_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define SCB_XREG_SLV_BASE                               0x00000000
1062306a36Sopenharmony_ci#define SCB_SCB_BLK_CTRL                                0x00070000
1162306a36Sopenharmony_ci#define SCB_BLK_CTRL_XMEM_RESET_SET                     0x00000090
1262306a36Sopenharmony_ci#define SCB_BLK_CTRL_CACHE_RESET_SET                    0x000000A0
1362306a36Sopenharmony_ci#define SCB_BLK_CTRL_CACHE_RESET_CLR                    0x000000A4
1462306a36Sopenharmony_ci#define SCB_BLK_CTRL_SCB_CLK_ENABLE_SET                 0x00000100
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define XMEM_CONTROL                                    0x00041000
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define	MC_CACHE_0_BASE					0x00060000
1962306a36Sopenharmony_ci#define	MC_CACHE_1_BASE					0x00068000
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define DEC_MFD_XREG_SLV_BASE                           0x00180000
2262306a36Sopenharmony_ci#define ENC_MFD_XREG_SLV_0_BASE				0x00800000
2362306a36Sopenharmony_ci#define ENC_MFD_XREG_SLV_1_BASE				0x00A00000
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define MFD_HIF                                         0x0001C000
2662306a36Sopenharmony_ci#define MFD_HIF_MSD_REG_INTERRUPT_STATUS                0x00000018
2762306a36Sopenharmony_ci#define MFD_SIF                                         0x0001D000
2862306a36Sopenharmony_ci#define MFD_SIF_CTRL_STATUS                             0x000000F0
2962306a36Sopenharmony_ci#define MFD_SIF_INTR_STATUS                             0x000000F4
3062306a36Sopenharmony_ci#define MFD_MCX                                         0x00020800
3162306a36Sopenharmony_ci#define MFD_MCX_OFF                                     0x00000020
3262306a36Sopenharmony_ci#define MFD_PIX_IF					0x00020000
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define MFD_BLK_CTRL                                    0x00030000
3562306a36Sopenharmony_ci#define MFD_BLK_CTRL_MFD_SYS_RESET_SET                  0x00000000
3662306a36Sopenharmony_ci#define MFD_BLK_CTRL_MFD_SYS_RESET_CLR                  0x00000004
3762306a36Sopenharmony_ci#define MFD_BLK_CTRL_MFD_SYS_CLOCK_ENABLE_SET           0x00000100
3862306a36Sopenharmony_ci#define MFD_BLK_CTRL_MFD_SYS_CLOCK_ENABLE_CLR           0x00000104
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define VID_API_NUM_STREAMS				8
4162306a36Sopenharmony_ci#define VID_API_MAX_BUF_PER_STR				3
4262306a36Sopenharmony_ci#define VID_API_MAX_NUM_MVC_VIEWS			4
4362306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_MALONES				2
4462306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_MALONE_IRQ_PINS			2
4562306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_WINDSORS			1
4662306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_WINDSOR_IRQ_PINS		2
4762306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_CMD_IRQ_PINS			2
4862306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_MSG_IRQ_PINS			1
4962306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_TIMER_IRQ_PINS			4
5062306a36Sopenharmony_ci#define MEDIAIP_MAX_NUM_TIMER_IRQ_SLOTS			4
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define WINDSOR_PAL_IRQ_PIN_L				0x4
5362306a36Sopenharmony_ci#define WINDSOR_PAL_IRQ_PIN_H				0x5
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_cistruct vpu_rpc_system_config {
5662306a36Sopenharmony_ci	u32 cfg_cookie;
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci	u32 num_malones;
5962306a36Sopenharmony_ci	u32 malone_base_addr[MEDIAIP_MAX_NUM_MALONES];
6062306a36Sopenharmony_ci	u32 hif_offset[MEDIAIP_MAX_NUM_MALONES];
6162306a36Sopenharmony_ci	u32 malone_irq_pin[MEDIAIP_MAX_NUM_MALONES][MEDIAIP_MAX_NUM_MALONE_IRQ_PINS];
6262306a36Sopenharmony_ci	u32 malone_irq_target[MEDIAIP_MAX_NUM_MALONES][MEDIAIP_MAX_NUM_MALONE_IRQ_PINS];
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	u32 num_windsors;
6562306a36Sopenharmony_ci	u32 windsor_base_addr[MEDIAIP_MAX_NUM_WINDSORS];
6662306a36Sopenharmony_ci	u32 windsor_irq_pin[MEDIAIP_MAX_NUM_WINDSORS][MEDIAIP_MAX_NUM_WINDSOR_IRQ_PINS];
6762306a36Sopenharmony_ci	u32 windsor_irq_target[MEDIAIP_MAX_NUM_WINDSORS][MEDIAIP_MAX_NUM_WINDSOR_IRQ_PINS];
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	u32 cmd_irq_pin[MEDIAIP_MAX_NUM_CMD_IRQ_PINS];
7062306a36Sopenharmony_ci	u32 cmd_irq_target[MEDIAIP_MAX_NUM_CMD_IRQ_PINS];
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	u32 msg_irq_pin[MEDIAIP_MAX_NUM_MSG_IRQ_PINS];
7362306a36Sopenharmony_ci	u32 msg_irq_target[MEDIAIP_MAX_NUM_MSG_IRQ_PINS];
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci	u32 sys_clk_freq;
7662306a36Sopenharmony_ci	u32 num_timers;
7762306a36Sopenharmony_ci	u32 timer_base_addr;
7862306a36Sopenharmony_ci	u32 timer_irq_pin[MEDIAIP_MAX_NUM_TIMER_IRQ_PINS];
7962306a36Sopenharmony_ci	u32 timer_irq_target[MEDIAIP_MAX_NUM_TIMER_IRQ_PINS];
8062306a36Sopenharmony_ci	u32 timer_slots[MEDIAIP_MAX_NUM_TIMER_IRQ_SLOTS];
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	u32 gic_base_addr;
8362306a36Sopenharmony_ci	u32 uart_base_addr;
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	u32 dpv_base_addr;
8662306a36Sopenharmony_ci	u32 dpv_irq_pin;
8762306a36Sopenharmony_ci	u32 dpv_irq_target;
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	u32 pixif_base_addr;
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci	u32 pal_trace_level;
9262306a36Sopenharmony_ci	u32 pal_trace_destination;
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci	u32 pal_trace_level1;
9562306a36Sopenharmony_ci	u32 pal_trace_destination1;
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	u32 heap_base;
9862306a36Sopenharmony_ci	u32 heap_size;
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci	u32 cache_base_addr[2];
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciint vpu_imx8q_setup_dec(struct vpu_dev *vpu);
10462306a36Sopenharmony_ciint vpu_imx8q_setup_enc(struct vpu_dev *vpu);
10562306a36Sopenharmony_ciint vpu_imx8q_setup(struct vpu_dev *vpu);
10662306a36Sopenharmony_ciint vpu_imx8q_reset(struct vpu_dev *vpu);
10762306a36Sopenharmony_ciint vpu_imx8q_set_system_cfg_common(struct vpu_rpc_system_config *config, u32 regs, u32 core_id);
10862306a36Sopenharmony_ciint vpu_imx8q_boot_core(struct vpu_core *core);
10962306a36Sopenharmony_ciint vpu_imx8q_get_power_state(struct vpu_core *core);
11062306a36Sopenharmony_ciint vpu_imx8q_on_firmware_loaded(struct vpu_core *core);
11162306a36Sopenharmony_ciint vpu_imx8q_check_memory_region(dma_addr_t base, dma_addr_t addr, u32 size);
11262306a36Sopenharmony_cibool vpu_imx8q_check_codec(enum vpu_core_type type);
11362306a36Sopenharmony_cibool vpu_imx8q_check_fmt(enum vpu_core_type type, u32 pixelfmt);
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#endif
116