162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * H/W layer of ISHTP provider device (ISH)
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2014-2016, Intel Corporation.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _ISHTP_HW_ISH_H_
962306a36Sopenharmony_ci#define _ISHTP_HW_ISH_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/pci.h>
1262306a36Sopenharmony_ci#include <linux/interrupt.h>
1362306a36Sopenharmony_ci#include "hw-ish-regs.h"
1462306a36Sopenharmony_ci#include "ishtp-dev.h"
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define CHV_DEVICE_ID		0x22D8
1762306a36Sopenharmony_ci#define BXT_Ax_DEVICE_ID	0x0AA2
1862306a36Sopenharmony_ci#define BXT_Bx_DEVICE_ID	0x1AA2
1962306a36Sopenharmony_ci#define APL_Ax_DEVICE_ID	0x5AA2
2062306a36Sopenharmony_ci#define SPT_Ax_DEVICE_ID	0x9D35
2162306a36Sopenharmony_ci#define CNL_Ax_DEVICE_ID	0x9DFC
2262306a36Sopenharmony_ci#define GLK_Ax_DEVICE_ID	0x31A2
2362306a36Sopenharmony_ci#define CNL_H_DEVICE_ID		0xA37C
2462306a36Sopenharmony_ci#define ICL_MOBILE_DEVICE_ID	0x34FC
2562306a36Sopenharmony_ci#define SPT_H_DEVICE_ID		0xA135
2662306a36Sopenharmony_ci#define CML_LP_DEVICE_ID	0x02FC
2762306a36Sopenharmony_ci#define CMP_H_DEVICE_ID		0x06FC
2862306a36Sopenharmony_ci#define EHL_Ax_DEVICE_ID	0x4BB3
2962306a36Sopenharmony_ci#define TGL_LP_DEVICE_ID	0xA0FC
3062306a36Sopenharmony_ci#define TGL_H_DEVICE_ID		0x43FC
3162306a36Sopenharmony_ci#define ADL_S_DEVICE_ID		0x7AF8
3262306a36Sopenharmony_ci#define ADL_P_DEVICE_ID		0x51FC
3362306a36Sopenharmony_ci#define ADL_N_DEVICE_ID		0x54FC
3462306a36Sopenharmony_ci#define RPL_S_DEVICE_ID		0x7A78
3562306a36Sopenharmony_ci#define MTL_P_DEVICE_ID		0x7E45
3662306a36Sopenharmony_ci#define ARL_H_DEVICE_ID		0x7745
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define	REVISION_ID_CHT_A0	0x6
3962306a36Sopenharmony_ci#define	REVISION_ID_CHT_Ax_SI	0x0
4062306a36Sopenharmony_ci#define	REVISION_ID_CHT_Bx_SI	0x10
4162306a36Sopenharmony_ci#define	REVISION_ID_CHT_Kx_SI	0x20
4262306a36Sopenharmony_ci#define	REVISION_ID_CHT_Dx_SI	0x30
4362306a36Sopenharmony_ci#define	REVISION_ID_CHT_B0	0xB0
4462306a36Sopenharmony_ci#define	REVISION_ID_SI_MASK	0x70
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_cistruct ipc_rst_payload_type {
4762306a36Sopenharmony_ci	uint16_t	reset_id;
4862306a36Sopenharmony_ci	uint16_t	reserved;
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cistruct time_sync_format {
5262306a36Sopenharmony_ci	uint8_t ts1_source;
5362306a36Sopenharmony_ci	uint8_t ts2_source;
5462306a36Sopenharmony_ci	uint16_t reserved;
5562306a36Sopenharmony_ci} __packed;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistruct ipc_time_update_msg {
5862306a36Sopenharmony_ci	uint64_t primary_host_time;
5962306a36Sopenharmony_ci	struct time_sync_format sync_info;
6062306a36Sopenharmony_ci	uint64_t secondary_host_time;
6162306a36Sopenharmony_ci} __packed;
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_cienum {
6462306a36Sopenharmony_ci	HOST_UTC_TIME_USEC = 0,
6562306a36Sopenharmony_ci	HOST_SYSTEM_TIME_USEC = 1
6662306a36Sopenharmony_ci};
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_cistruct ish_hw {
6962306a36Sopenharmony_ci	void __iomem *mem_addr;
7062306a36Sopenharmony_ci};
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci/*
7362306a36Sopenharmony_ci * ISH FW status type
7462306a36Sopenharmony_ci */
7562306a36Sopenharmony_cienum {
7662306a36Sopenharmony_ci	FWSTS_AFTER_RESET		= 0,
7762306a36Sopenharmony_ci	FWSTS_WAIT_FOR_HOST		= 4,
7862306a36Sopenharmony_ci	FWSTS_START_KERNEL_DMA		= 5,
7962306a36Sopenharmony_ci	FWSTS_FW_IS_RUNNING		= 7,
8062306a36Sopenharmony_ci	FWSTS_SENSOR_APP_LOADED		= 8,
8162306a36Sopenharmony_ci	FWSTS_SENSOR_APP_RUNNING	= 15
8262306a36Sopenharmony_ci};
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define to_ish_hw(dev) (struct ish_hw *)((dev)->hw)
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciirqreturn_t ish_irq_handler(int irq, void *dev_id);
8762306a36Sopenharmony_cistruct ishtp_device *ish_dev_init(struct pci_dev *pdev);
8862306a36Sopenharmony_ciint ish_hw_start(struct ishtp_device *dev);
8962306a36Sopenharmony_civoid ish_device_disable(struct ishtp_device *dev);
9062306a36Sopenharmony_ciint ish_disable_dma(struct ishtp_device *dev);
9162306a36Sopenharmony_civoid ish_set_host_ready(struct ishtp_device *dev);
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#endif /* _ISHTP_HW_ISH_H_ */
94