1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2010 - 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef __IA_CSS_SPCTRL_H__
17 #define __IA_CSS_SPCTRL_H__
18 
19 #include <system_global.h>
20 #include <ia_css_err.h>
21 #include "ia_css_spctrl_comm.h"
22 
23 typedef struct {
24 	u32        ddr_data_offset;       /**  posistion of data in DDR */
25 	u32        dmem_data_addr;        /** data segment address in dmem */
26 	u32        dmem_bss_addr;         /** bss segment address in dmem  */
27 	u32        data_size;             /** data segment size            */
28 	u32        bss_size;              /** bss segment size             */
29 	u32        spctrl_config_dmem_addr; /* <location of dmem_cfg  in SP dmem */
30 	u32        spctrl_state_dmem_addr;  /* < location of state  in SP dmem */
31 	unsigned int    sp_entry;                /* < entry function ptr on SP */
32 	const void      *code;                   /** location of firmware */
33 	u32         code_size;
34 	char      *program_name;    /** not used on hardware, only for simulation */
35 } ia_css_spctrl_cfg;
36 
37 /* Get the code addr in DDR of SP */
38 ia_css_ptr get_sp_code_addr(sp_ID_t  sp_id);
39 
40 /* ! Load firmware on to specfied SP
41 */
42 int ia_css_spctrl_load_fw(sp_ID_t sp_id,
43 				      ia_css_spctrl_cfg *spctrl_cfg);
44 
45 /* ISP2401 */
46 /*! Setup registers for reloading FW */
47 void sh_css_spctrl_reload_fw(sp_ID_t sp_id);
48 
49 /*!  Unload/release any memory allocated to hold the firmware
50 */
51 int ia_css_spctrl_unload_fw(sp_ID_t sp_id);
52 
53 /*! Intilaize dmem_cfg in SP dmem  and  start SP program
54 */
55 int ia_css_spctrl_start(sp_ID_t sp_id);
56 
57 /*! stop spctrl
58 */
59 int ia_css_spctrl_stop(sp_ID_t sp_id);
60 
61 /*! Query the state of SP
62 */
63 ia_css_spctrl_sp_sw_state ia_css_spctrl_get_state(sp_ID_t sp_id);
64 
65 /*! Check if SP is idle/ready
66 */
67 int ia_css_spctrl_is_idle(sp_ID_t sp_id);
68 
69 #endif /* __IA_CSS_SPCTRL_H__ */
70