Commit bda63586 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

firmware: Sigma: Fix endianess issues

Currently the SigmaDSP firmware loader only works correctly on little-endian
systems. Fix this by using the proper endianess conversion functions.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
parent c56935bd
...@@ -133,7 +133,7 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) ...@@ -133,7 +133,7 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)
crc = crc32(0, fw->data + sizeof(*ssfw_head), crc = crc32(0, fw->data + sizeof(*ssfw_head),
fw->size - sizeof(*ssfw_head)); fw->size - sizeof(*ssfw_head));
pr_debug("%s: crc=%x\n", __func__, crc); pr_debug("%s: crc=%x\n", __func__, crc);
if (crc != ssfw_head->crc) if (crc != le32_to_cpu(ssfw_head->crc))
goto done; goto done;
ssfw.pos = sizeof(*ssfw_head); ssfw.pos = sizeof(*ssfw_head);
......
...@@ -24,7 +24,7 @@ struct sigma_firmware { ...@@ -24,7 +24,7 @@ struct sigma_firmware {
struct sigma_firmware_header { struct sigma_firmware_header {
unsigned char magic[7]; unsigned char magic[7];
u8 version; u8 version;
u32 crc; __le32 crc;
}; };
enum { enum {
...@@ -40,14 +40,14 @@ enum { ...@@ -40,14 +40,14 @@ enum {
struct sigma_action { struct sigma_action {
u8 instr; u8 instr;
u8 len_hi; u8 len_hi;
u16 len; __le16 len;
u16 addr; __be16 addr;
unsigned char payload[]; unsigned char payload[];
}; };
static inline u32 sigma_action_len(struct sigma_action *sa) static inline u32 sigma_action_len(struct sigma_action *sa)
{ {
return (sa->len_hi << 16) | sa->len; return (sa->len_hi << 16) | le16_to_cpu(sa->len);
} }
extern int process_sigma_firmware(struct i2c_client *client, const char *name); extern int process_sigma_firmware(struct i2c_client *client, const char *name);
......
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