Commit b6990291 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Mauro Carvalho Chehab

[media] dvb-usb/it913x: multi firmware loader

Multi firmware loader
 This uses scatter write firmware headers
 The firmware must start with 03 XX 00
 and be the extract firmware length.

 I have tried all available firmwares with this loader.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c725ff69
...@@ -485,35 +485,40 @@ static int it913x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) ...@@ -485,35 +485,40 @@ static int it913x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
return ret; return ret;
} }
static int it913x_download_firmware(struct usb_device *udev, static int it913x_download_firmware(struct usb_device *udev,
const struct firmware *fw) const struct firmware *fw)
{ {
int ret = 0, i; int ret = 0, i = 0, pos = 0;
u8 packet_size, dlen; u8 packet_size;
u8 *fw_data; u8 *fw_data;
packet_size = 0x29;
ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_100); ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_100);
info("FRM Starting Firmware Download"); info("FRM Starting Firmware Download");
/* This uses scatter write firmware headers follow */
/* 03 XX 00 XX = chip number? */ /* Multi firmware loader */
/* This uses scatter write firmware headers */
for (i = 0; i < fw->size; i += packet_size) { /* The firmware must start with 03 XX 00 */
if (i > 0) /* and be the extact firmware length */
packet_size = 0x39;
fw_data = (u8 *)(fw->data + i); while (i <= fw->size) {
dlen = ((i + packet_size) > fw->size) if (((fw->data[i] == 0x3) && (fw->data[i + 2] == 0x0))
? (fw->size - i) : packet_size; || (i == fw->size)) {
ret |= it913x_io(udev, WRITE_DATA, DEV_0, packet_size = i - pos;
CMD_SCATTER_WRITE, 0, 0, fw_data, dlen); if ((packet_size > 0x19) || (i == fw->size)) {
udelay(1000); fw_data = (u8 *)(fw->data + pos);
pos += packet_size;
if (packet_size > 0)
ret |= it913x_io(udev, WRITE_DATA,
DEV_0, CMD_SCATTER_WRITE, 0,
0, fw_data, packet_size);
udelay(1000);
}
}
i++;
} }
ret |= it913x_io(udev, WRITE_CMD, DEV_0, ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0);
CMD_BOOT, 0, 0, NULL, 0);
msleep(100); msleep(100);
......
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