Commit e6e095b3 authored by Adam Wujek's avatar Adam Wujek

sw/petalinux/diot-util: use magic values for reset and fw mode switch of monimod

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 66de1d15
......@@ -28,6 +28,8 @@
#include "util.h"
#define FANTRAY_FW_MAX_SIZE 0x3E000
#define UC_RESET_MAGIC 0x5A
#define BOOT_NEW_FW_MAGIC 0xAD
static int cmd_fantray_status(char *params);
static int cmd_fantray_reset(char *params);
......@@ -124,7 +126,8 @@ static int fantray_i2c_reset(void)
goto out;
}
ret = i2c_smbus_write_byte_data(i2c_file, FANTRAY_I2C_REG_RESET, 1);
ret = i2c_smbus_write_byte_data(i2c_file, FANTRAY_I2C_REG_RESET,
UC_RESET_MAGIC);
out:
close(i2c_file);
......@@ -583,7 +586,7 @@ static int cmd_fantray_load_fw(char *params)
/* Switch to boot loader */
ret = i2c_smbus_write_byte_data(i2c_file, FANTRAY_I2C_REG_BOOT_NEW_FW,
1);
BOOT_NEW_FW_MAGIC);
if (ret < 0) {
printf("Error: unable to set boot mode of the Fantray!\n");
goto close_i2c;
......@@ -616,7 +619,8 @@ static int cmd_fantray_load_fw(char *params)
printf("Switching Fantray to main firmware mode\n");
/* Switch to main firmware */
ret = i2c_smbus_write_byte_data(i2c_file, FANTRAY_I2C_REG_BOOT_NEW_FW, 1);
ret = i2c_smbus_write_byte_data(i2c_file, FANTRAY_I2C_REG_BOOT_NEW_FW,
BOOT_NEW_FW_MAGIC);
if (ret < 0) {
printf("Error: unable to set the boot mode of the Fantray!\n");
goto close_i2c;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment