1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Texas Instruments' BIST (Built-In Self-Test) driver
4  *
5  * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
6  *      Neha Malcom Francis <n-francis@ti.com>
7  *
8  */
9 
10 #ifndef _INCLUDE_BIST_H_
11 #define _INCLUDE_BIST_H_
12 
13 #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT	0x00000001
14 #define PROC_ID_MCU_R5FSS2_CORE0		0x0A
15 #define PROC_ID_MCU_R5FSS2_CORE1		0x0B
16 #define PROC_BOOT_CTRL_FLAG_R5_LPSC		0x00000002
17 
18 #define TISCI_DEV_PBIST14 237
19 #define TISCI_DEV_R5FSS2_CORE0 343
20 #define TISCI_DEV_R5FSS2_CORE1 344
21 
22 #define TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF 0
23 #define TISCI_MSG_VALUE_DEVICE_SW_STATE_RETENTION 1
24 #define TISCI_MSG_VALUE_DEVICE_SW_STATE_ON 2
25 
26 #define TISCI_BIT(n)  ((1) << (n))
27 
28 struct bist_ops {
29 	int (*run_lbist)(void);
30 	int (*run_lbist_post)(void);
31 	int (*run_pbist_post)(void);
32 	int (*run_pbist_neg)(void);
33 	int (*run_pbist_rom)(void);
34 	int (*run_pbist)(void);
35 };
36 
37 void lbist_enable_isolation(void);
38 void lbist_disable_isolation(void);
39 int prepare_pbist(struct ti_sci_handle *handle);
40 int deprepare_pbist(struct ti_sci_handle *handle);
41 int prepare_lbist(struct ti_sci_handle *handle);
42 int deprepare_lbist(struct ti_sci_handle *handle);
43 
44 #endif /* _INCLUDE_BIST_H_ */
45