18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * H/W layer of ISHTP provider device (ISH)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2014-2016, Intel Corporation.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _ISHTP_HW_ISH_H_
98c2ecf20Sopenharmony_ci#define _ISHTP_HW_ISH_H_
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/pci.h>
128c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
138c2ecf20Sopenharmony_ci#include "hw-ish-regs.h"
148c2ecf20Sopenharmony_ci#include "ishtp-dev.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define CHV_DEVICE_ID		0x22D8
178c2ecf20Sopenharmony_ci#define BXT_Ax_DEVICE_ID	0x0AA2
188c2ecf20Sopenharmony_ci#define BXT_Bx_DEVICE_ID	0x1AA2
198c2ecf20Sopenharmony_ci#define APL_Ax_DEVICE_ID	0x5AA2
208c2ecf20Sopenharmony_ci#define SPT_Ax_DEVICE_ID	0x9D35
218c2ecf20Sopenharmony_ci#define CNL_Ax_DEVICE_ID	0x9DFC
228c2ecf20Sopenharmony_ci#define GLK_Ax_DEVICE_ID	0x31A2
238c2ecf20Sopenharmony_ci#define CNL_H_DEVICE_ID		0xA37C
248c2ecf20Sopenharmony_ci#define ICL_MOBILE_DEVICE_ID	0x34FC
258c2ecf20Sopenharmony_ci#define SPT_H_DEVICE_ID		0xA135
268c2ecf20Sopenharmony_ci#define CML_LP_DEVICE_ID	0x02FC
278c2ecf20Sopenharmony_ci#define CMP_H_DEVICE_ID		0x06FC
288c2ecf20Sopenharmony_ci#define EHL_Ax_DEVICE_ID	0x4BB3
298c2ecf20Sopenharmony_ci#define TGL_LP_DEVICE_ID	0xA0FC
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_A0	0x6
328c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_Ax_SI	0x0
338c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_Bx_SI	0x10
348c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_Kx_SI	0x20
358c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_Dx_SI	0x30
368c2ecf20Sopenharmony_ci#define	REVISION_ID_CHT_B0	0xB0
378c2ecf20Sopenharmony_ci#define	REVISION_ID_SI_MASK	0x70
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct ipc_rst_payload_type {
408c2ecf20Sopenharmony_ci	uint16_t	reset_id;
418c2ecf20Sopenharmony_ci	uint16_t	reserved;
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct time_sync_format {
458c2ecf20Sopenharmony_ci	uint8_t ts1_source;
468c2ecf20Sopenharmony_ci	uint8_t ts2_source;
478c2ecf20Sopenharmony_ci	uint16_t reserved;
488c2ecf20Sopenharmony_ci} __packed;
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistruct ipc_time_update_msg {
518c2ecf20Sopenharmony_ci	uint64_t primary_host_time;
528c2ecf20Sopenharmony_ci	struct time_sync_format sync_info;
538c2ecf20Sopenharmony_ci	uint64_t secondary_host_time;
548c2ecf20Sopenharmony_ci} __packed;
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cienum {
578c2ecf20Sopenharmony_ci	HOST_UTC_TIME_USEC = 0,
588c2ecf20Sopenharmony_ci	HOST_SYSTEM_TIME_USEC = 1
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct ish_hw {
628c2ecf20Sopenharmony_ci	void __iomem *mem_addr;
638c2ecf20Sopenharmony_ci};
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/*
668c2ecf20Sopenharmony_ci * ISH FW status type
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_cienum {
698c2ecf20Sopenharmony_ci	FWSTS_AFTER_RESET		= 0,
708c2ecf20Sopenharmony_ci	FWSTS_WAIT_FOR_HOST		= 4,
718c2ecf20Sopenharmony_ci	FWSTS_START_KERNEL_DMA		= 5,
728c2ecf20Sopenharmony_ci	FWSTS_FW_IS_RUNNING		= 7,
738c2ecf20Sopenharmony_ci	FWSTS_SENSOR_APP_LOADED		= 8,
748c2ecf20Sopenharmony_ci	FWSTS_SENSOR_APP_RUNNING	= 15
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define to_ish_hw(dev) (struct ish_hw *)((dev)->hw)
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciirqreturn_t ish_irq_handler(int irq, void *dev_id);
808c2ecf20Sopenharmony_cistruct ishtp_device *ish_dev_init(struct pci_dev *pdev);
818c2ecf20Sopenharmony_ciint ish_hw_start(struct ishtp_device *dev);
828c2ecf20Sopenharmony_civoid ish_device_disable(struct ishtp_device *dev);
838c2ecf20Sopenharmony_ciint ish_disable_dma(struct ishtp_device *dev);
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#endif /* _ISHTP_HW_ISH_H_ */
86