1 // SPDX-License-Identifier: GPL-2.0-or-later
3 /***************************************************************************
4 * Copyright (C) 2013 Andes technology. *
5 * Hsiangkai Wang <hkwang@andestech.com> *
6 ***************************************************************************/
11 #include <helper/log.h>
12 #include "nds32_aice.h"
14 int aice_read_reg_64(struct aice_port_s
*aice
, uint32_t num
, uint64_t *val
)
16 if (!aice
->port
->api
->read_reg_64
) {
17 LOG_WARNING("Not implemented: %s", __func__
);
21 return aice
->port
->api
->read_reg_64(aice
->coreid
, num
, val
);
24 int aice_write_reg_64(struct aice_port_s
*aice
, uint32_t num
, uint64_t val
)
26 if (!aice
->port
->api
->write_reg_64
) {
27 LOG_WARNING("Not implemented: %s", __func__
);
31 return aice
->port
->api
->write_reg_64(aice
->coreid
, num
, val
);
34 int aice_read_tlb(struct aice_port_s
*aice
, target_addr_t virtual_address
,
35 target_addr_t
*physical_address
)
37 if (!aice
->port
->api
->read_tlb
) {
38 LOG_WARNING("Not implemented: %s", __func__
);
42 return aice
->port
->api
->read_tlb(aice
->coreid
, virtual_address
, physical_address
);
45 int aice_cache_ctl(struct aice_port_s
*aice
, uint32_t subtype
, uint32_t address
)
47 if (!aice
->port
->api
->cache_ctl
) {
48 LOG_WARNING("Not implemented: %s", __func__
);
52 return aice
->port
->api
->cache_ctl(aice
->coreid
, subtype
, address
);
55 int aice_set_retry_times(struct aice_port_s
*aice
, uint32_t a_retry_times
)
57 if (!aice
->port
->api
->set_retry_times
) {
58 LOG_WARNING("Not implemented: %s", __func__
);
62 return aice
->port
->api
->set_retry_times(a_retry_times
);
65 int aice_program_edm(struct aice_port_s
*aice
, char *command_sequence
)
67 if (!aice
->port
->api
->program_edm
) {
68 LOG_WARNING("Not implemented: %s", __func__
);
72 return aice
->port
->api
->program_edm(aice
->coreid
, command_sequence
);
75 int aice_set_command_mode(struct aice_port_s
*aice
,
76 enum aice_command_mode command_mode
)
78 if (!aice
->port
->api
->set_command_mode
) {
79 LOG_WARNING("Not implemented: %s", __func__
);
83 return aice
->port
->api
->set_command_mode(command_mode
);
86 int aice_execute(struct aice_port_s
*aice
, uint32_t *instructions
,
87 uint32_t instruction_num
)
89 if (!aice
->port
->api
->execute
) {
90 LOG_WARNING("Not implemented: %s", __func__
);
94 return aice
->port
->api
->execute(aice
->coreid
, instructions
, instruction_num
);
97 int aice_set_custom_srst_script(struct aice_port_s
*aice
, const char *script
)
99 if (!aice
->port
->api
->set_custom_srst_script
) {
100 LOG_WARNING("Not implemented: %s", __func__
);
104 return aice
->port
->api
->set_custom_srst_script(script
);
107 int aice_set_custom_trst_script(struct aice_port_s
*aice
, const char *script
)
109 if (!aice
->port
->api
->set_custom_trst_script
) {
110 LOG_WARNING("Not implemented: %s", __func__
);
114 return aice
->port
->api
->set_custom_trst_script(script
);
117 int aice_set_custom_restart_script(struct aice_port_s
*aice
, const char *script
)
119 if (!aice
->port
->api
->set_custom_restart_script
) {
120 LOG_WARNING("Not implemented: %s", __func__
);
124 return aice
->port
->api
->set_custom_restart_script(script
);
127 int aice_set_count_to_check_dbger(struct aice_port_s
*aice
, uint32_t count_to_check
)
129 if (!aice
->port
->api
->set_count_to_check_dbger
) {
130 LOG_WARNING("Not implemented: %s", __func__
);
134 return aice
->port
->api
->set_count_to_check_dbger(count_to_check
);
137 int aice_profiling(struct aice_port_s
*aice
, uint32_t interval
, uint32_t iteration
,
138 uint32_t reg_no
, uint32_t *samples
, uint32_t *num_samples
)
140 if (!aice
->port
->api
->profiling
) {
141 LOG_WARNING("Not implemented: %s", __func__
);
145 return aice
->port
->api
->profiling(aice
->coreid
, interval
, iteration
,
146 reg_no
, samples
, num_samples
);