1 /***************************************************************************
2 * Copyright (C) 2013 Andes technology. *
3 * Hsiangkai Wang <hkwang@andestech.com> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
19 ***************************************************************************/
24 #include <helper/log.h>
25 #include "nds32_aice.h"
27 int aice_read_reg_64(struct aice_port_s
*aice
, uint32_t num
, uint64_t *val
)
29 if (aice
->port
->api
->read_reg_64
== NULL
) {
30 LOG_WARNING("Not implemented: %s", __func__
);
34 return aice
->port
->api
->read_reg_64(num
, val
);
37 int aice_write_reg_64(struct aice_port_s
*aice
, uint32_t num
, uint64_t val
)
39 if (aice
->port
->api
->write_reg_64
== NULL
) {
40 LOG_WARNING("Not implemented: %s", __func__
);
44 return aice
->port
->api
->write_reg_64(num
, val
);
47 int aice_select_target(struct aice_port_s
*aice
, uint32_t target_id
)
49 if (aice
->port
->api
->select_target
== NULL
) {
50 LOG_WARNING("Not implemented: %s", __func__
);
54 return aice
->port
->api
->select_target(target_id
);
57 int aice_read_tlb(struct aice_port_s
*aice
, uint32_t virtual_address
,
58 uint32_t *physical_address
)
60 if (aice
->port
->api
->read_tlb
== NULL
) {
61 LOG_WARNING("Not implemented: %s", __func__
);
65 return aice
->port
->api
->read_tlb(virtual_address
, physical_address
);
68 int aice_cache_ctl(struct aice_port_s
*aice
, uint32_t subtype
, uint32_t address
)
70 if (aice
->port
->api
->cache_ctl
== NULL
) {
71 LOG_WARNING("Not implemented: %s", __func__
);
75 return aice
->port
->api
->cache_ctl(subtype
, address
);
78 int aice_set_retry_times(struct aice_port_s
*aice
, uint32_t a_retry_times
)
80 if (aice
->port
->api
->set_retry_times
== NULL
) {
81 LOG_WARNING("Not implemented: %s", __func__
);
85 return aice
->port
->api
->set_retry_times(a_retry_times
);
88 int aice_program_edm(struct aice_port_s
*aice
, char *command_sequence
)
90 if (aice
->port
->api
->program_edm
== NULL
) {
91 LOG_WARNING("Not implemented: %s", __func__
);
95 return aice
->port
->api
->program_edm(command_sequence
);
98 int aice_pack_command(struct aice_port_s
*aice
, bool enable_pack_command
)
100 if (aice
->port
->api
->pack_command
== NULL
) {
101 LOG_WARNING("Not implemented: %s", __func__
);
105 return aice
->port
->api
->pack_command(enable_pack_command
);
108 int aice_execute(struct aice_port_s
*aice
, uint32_t *instructions
,
109 uint32_t instruction_num
)
111 if (aice
->port
->api
->execute
== NULL
) {
112 LOG_WARNING("Not implemented: %s", __func__
);
116 return aice
->port
->api
->execute(instructions
, instruction_num
);
119 int aice_set_custom_srst_script(struct aice_port_s
*aice
, const char *script
)
121 if (aice
->port
->api
->set_custom_srst_script
== NULL
) {
122 LOG_WARNING("Not implemented: %s", __func__
);
126 return aice
->port
->api
->set_custom_srst_script(script
);
129 int aice_set_custom_trst_script(struct aice_port_s
*aice
, const char *script
)
131 if (aice
->port
->api
->set_custom_trst_script
== NULL
) {
132 LOG_WARNING("Not implemented: %s", __func__
);
136 return aice
->port
->api
->set_custom_trst_script(script
);
139 int aice_set_custom_restart_script(struct aice_port_s
*aice
, const char *script
)
141 if (aice
->port
->api
->set_custom_restart_script
== NULL
) {
142 LOG_WARNING("Not implemented: %s", __func__
);
146 return aice
->port
->api
->set_custom_restart_script(script
);
149 int aice_set_count_to_check_dbger(struct aice_port_s
*aice
, uint32_t count_to_check
)
151 if (aice
->port
->api
->set_count_to_check_dbger
== NULL
) {
152 LOG_WARNING("Not implemented: %s", __func__
);
156 return aice
->port
->api
->set_count_to_check_dbger(count_to_check
);