Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242094
b: refs/heads/master
c: 582e565
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent 3a343cb commit 5f9a41e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04599c2b1ff1eece19b7abaacd97266b8a6b79f2
refs/heads/master: 582e565caeaccf145e2256b84d4fde827fede72e
25 changes: 10 additions & 15 deletions trunk/drivers/media/dvb/dvb-usb/af9015.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,8 @@ static int af9015_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
static int af9015_download_firmware(struct usb_device *udev,
const struct firmware *fw)
{
int i, len, packets, remainder, ret;
int i, len, remaining, ret;
struct req_t req = {DOWNLOAD_FIRMWARE, 0, 0, 0, 0, 0, NULL};
u16 addr = 0x5100; /* firmware start address */
u16 checksum = 0;

deb_info("%s:\n", __func__);
Expand All @@ -679,24 +678,20 @@ static int af9015_download_firmware(struct usb_device *udev,
af9015_config.firmware_size = fw->size;
af9015_config.firmware_checksum = checksum;

#define FW_PACKET_MAX_DATA 55

packets = fw->size / FW_PACKET_MAX_DATA;
remainder = fw->size % FW_PACKET_MAX_DATA;
len = FW_PACKET_MAX_DATA;
for (i = 0; i <= packets; i++) {
if (i == packets) /* set size of the last packet */
len = remainder;
#define FW_ADDR 0x5100 /* firmware start address */
#define LEN_MAX 55 /* max packet size */
for (remaining = fw->size; remaining > 0; remaining -= LEN_MAX) {
len = remaining;
if (len > LEN_MAX)
len = LEN_MAX;

req.data_len = len;
req.data = (u8 *)(fw->data + i * FW_PACKET_MAX_DATA);
req.addr = addr;
addr += FW_PACKET_MAX_DATA;
req.data = (u8 *) &fw->data[fw->size - remaining];
req.addr = FW_ADDR + fw->size - remaining;

ret = af9015_rw_udev(udev, &req);
if (ret) {
err("firmware download failed at packet %d with " \
"code %d", i, ret);
err("firmware download failed:%d", ret);
goto error;
}
}
Expand Down

0 comments on commit 5f9a41e

Please sign in to comment.