XCF (Xilinx platfrom flash) support.
[fw/openocd] / src / flash / nor / str9xpec.c
index e89ecf49f0838f86a5c5cfa7e00bef8a4adf77e7..eb391e8fbffbea9915ead0983a13176e9057d5d6 100644 (file)
@@ -16,9 +16,7 @@
  *   GNU General Public License for more details.                          *
  *                                                                         *
  *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -199,7 +197,6 @@ static int str9xpec_read_config(struct flash_bank *bank)
        field.out_value = NULL;
        field.in_value = str9xpec_info->options;
 
-
        jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
        jtag_execute_queue();
 
@@ -566,7 +563,7 @@ static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector)
        return ERROR_OK;
 }
 
-static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
+static int str9xpec_write(struct flash_bank *bank, const uint8_t *buffer,
                uint32_t offset, uint32_t count)
 {
        struct str9xpec_flash_controller *str9xpec_info = bank->driver_priv;
@@ -761,12 +758,6 @@ static int str9xpec_erase_check(struct flash_bank *bank)
        return str9xpec_blank_check(bank, 0, bank->num_sectors - 1);
 }
 
-static int get_str9xpec_info(struct flash_bank *bank, char *buf, int buf_size)
-{
-       snprintf(buf, buf_size, "str9xpec flash driver info");
-       return ERROR_OK;
-}
-
 COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
 {
        uint8_t status;
@@ -1050,20 +1041,24 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
 
        str9xpec_info = bank->driver_priv;
 
-       tap0 = str9xpec_info->tap;
-
        /* remove arm core from chain - enter turbo mode */
+       tap0 = str9xpec_info->tap;
+       if (tap0 == NULL) {
+               /* things are *WRONG* */
+               command_print(CMD_CTX, "**STR9FLASH** (tap0) invalid chain?");
+               return ERROR_FAIL;
+       }
        tap1 = tap0->next_tap;
        if (tap1 == NULL) {
                /* things are *WRONG* */
                command_print(CMD_CTX, "**STR9FLASH** (tap1) invalid chain?");
-               return ERROR_OK;
+               return ERROR_FAIL;
        }
        tap2 = tap1->next_tap;
        if (tap2 == NULL) {
                /* things are *WRONG* */
                command_print(CMD_CTX, "**STR9FLASH** (tap2) invalid chain?");
-               return ERROR_OK;
+               return ERROR_FAIL;
        }
 
        /* enable turbo mode - TURBO-PROG-ENABLE */
@@ -1212,5 +1207,4 @@ struct flash_driver str9xpec_flash = {
        .auto_probe = str9xpec_probe,
        .erase_check = str9xpec_erase_check,
        .protect_check = str9xpec_protect_check,
-       .info = get_str9xpec_info,
 };