summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-firmware.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-26 13:07:03 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 23:13:57 +0200
commit42d0c3ad28837a4a475c18b69160053fdb562976 (patch)
tree3d0a7c59c36ca9c9772b2ee18d6260d923696bc1 /drivers/media/video/cx18/cx18-firmware.c
parent[media] ivtv: fix support for big-endian systems (diff)
downloadlinux-42d0c3ad28837a4a475c18b69160053fdb562976.tar.xz
linux-42d0c3ad28837a4a475c18b69160053fdb562976.zip
[media] cx18: support big-endian systems
base_addr has type resource_size_t, which may be 64 bits. Also fix a few endian issues related to mailboxes and firmware loading. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-firmware.c')
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index 1b3fb502e6be..b85c292a849a 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -164,8 +164,13 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32];
while (offset + sizeof(seghdr) < fw->size) {
- /* TODO: byteswapping */
- memcpy(&seghdr, src + offset / 4, sizeof(seghdr));
+ const u32 *shptr = src + offset / 4;
+
+ seghdr.sync1 = le32_to_cpu(shptr[0]);
+ seghdr.sync2 = le32_to_cpu(shptr[1]);
+ seghdr.addr = le32_to_cpu(shptr[2]);
+ seghdr.size = le32_to_cpu(shptr[3]);
+
offset += sizeof(seghdr);
if (seghdr.sync1 != APU_ROM_SYNC1 ||
seghdr.sync2 != APU_ROM_SYNC2) {