Lines Matching +full:firmware +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
2 /* dvb-usb-firmware.c is part of the DVB USB library.
4 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@posteo.de)
5 * see dvb-usb-init.c for copyright information.
7 * This file contains functions for downloading the firmware to Cypress FX 1 and 2 based devices.
9 * FIXME: This part does actually not belong to dvb-usb, but to the usb-subsystem.
11 #include "dvb-usb-common.h"
17 const char *name; /* name of the usb controller */ member
18 u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */
22 { .id = DEVICE_SPECIFIC, .name = "Device specific", .cpu_cs_register = 0 },
23 { .id = CYPRESS_AN2135, .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 },
24 { .id = CYPRESS_AN2235, .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 },
25 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 },
29 * load a firmware packet to the device
37 int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) in usb_cypress_load_firmware()
46 return -ENOMEM; in usb_cypress_load_firmware()
55 deb_fw("writing to address 0x%04x (buffer: 0x%02x %02x)\n", hx->addr, hx->len, hx->chk); in usb_cypress_load_firmware()
56 ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len); in usb_cypress_load_firmware()
58 if (ret != hx->len) { in usb_cypress_load_firmware()
59 err("error while transferring firmware (transferred size: %d, block size: %d)", in usb_cypress_load_firmware()
60 ret, hx->len); in usb_cypress_load_firmware()
61 ret = -EINVAL; in usb_cypress_load_firmware()
66 err("firmware download failed at %d with %d",pos,ret); in usb_cypress_load_firmware()
76 ret = -EINVAL; in usb_cypress_load_firmware()
79 ret = -EIO; in usb_cypress_load_firmware()
91 const struct firmware *fw = NULL; in dvb_usb_download_firmware()
93 if ((ret = request_firmware(&fw, props->firmware, &udev->dev)) != 0) { in dvb_usb_download_firmware()
94 …err("did not find the firmware file '%s' (status %d). You can use <kernel_dir>/scripts/get_dvb_fir… in dvb_usb_download_firmware()
95 props->firmware,ret); in dvb_usb_download_firmware()
99 info("downloading firmware from file '%s'",props->firmware); in dvb_usb_download_firmware()
101 switch (props->usb_ctrl) { in dvb_usb_download_firmware()
105 ret = usb_cypress_load_firmware(udev, fw, props->usb_ctrl); in dvb_usb_download_firmware()
108 if (props->download_firmware) in dvb_usb_download_firmware()
109 ret = props->download_firmware(udev,fw); in dvb_usb_download_firmware()
111 …err("BUG: driver didn't specified a download_firmware-callback, although it claims to have a DEVIC… in dvb_usb_download_firmware()
112 ret = -EINVAL; in dvb_usb_download_firmware()
116 ret = -EINVAL; in dvb_usb_download_firmware()
124 int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, in dvb_usb_get_hexline()
127 u8 *b = (u8 *) &fw->data[*pos]; in dvb_usb_get_hexline()
129 if (*pos >= fw->size) in dvb_usb_get_hexline()
134 hx->len = b[0]; in dvb_usb_get_hexline()
136 if ((*pos + hx->len + 4) >= fw->size) in dvb_usb_get_hexline()
137 return -EINVAL; in dvb_usb_get_hexline()
139 hx->addr = b[1] | (b[2] << 8); in dvb_usb_get_hexline()
140 hx->type = b[3]; in dvb_usb_get_hexline()
142 if (hx->type == 0x04) { in dvb_usb_get_hexline()
144 hx->addr |= (b[4] << 24) | (b[5] << 16); in dvb_usb_get_hexline()
145 /* hx->len -= 2; in dvb_usb_get_hexline()
148 memcpy(hx->data,&b[data_offs],hx->len); in dvb_usb_get_hexline()
149 hx->chk = b[hx->len + data_offs]; in dvb_usb_get_hexline()
151 *pos += hx->len + 5; in dvb_usb_get_hexline()