• Home
  • Raw
  • Download

Lines Matching +full:firmware +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
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
15 #include <linux/firmware.h>
20 const char *name; /* name of the usb controller */ member
22 * when the firmware has been downloaded */
26 { .id = CYPRESS_AN2135, .name = "Cypress AN2135", .cs_reg = 0x7f92 },
27 { .id = CYPRESS_AN2235, .name = "Cypress AN2235", .cs_reg = 0x7f92 },
28 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cs_reg = 0xe600 },
32 * load a firmware packet to the device
41 static int cypress_get_hexline(const struct firmware *fw, in cypress_get_hexline()
44 u8 *b = (u8 *) &fw->data[*pos]; in cypress_get_hexline()
47 if (*pos >= fw->size) in cypress_get_hexline()
51 hx->len = b[0]; in cypress_get_hexline()
53 if ((*pos + hx->len + 4) >= fw->size) in cypress_get_hexline()
54 return -EINVAL; in cypress_get_hexline()
56 hx->addr = b[1] | (b[2] << 8); in cypress_get_hexline()
57 hx->type = b[3]; in cypress_get_hexline()
59 if (hx->type == 0x04) { in cypress_get_hexline()
62 hx->addr |= (b[4] << 24) | (b[5] << 16); in cypress_get_hexline()
65 memcpy(hx->data, &b[data_offs], hx->len); in cypress_get_hexline()
66 hx->chk = b[hx->len + data_offs]; in cypress_get_hexline()
67 *pos += hx->len + 5; in cypress_get_hexline()
73 const struct firmware *fw, int type) in cypress_load_firmware()
80 return -ENOMEM; in cypress_load_firmware()
83 hx->data[0] = 1; in cypress_load_firmware()
84 ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1); in cypress_load_firmware()
86 dev_err(&udev->dev, "%s: CPU stop failed=%d\n", in cypress_load_firmware()
88 ret = -EIO; in cypress_load_firmware()
92 /* write firmware to memory */ in cypress_load_firmware()
100 ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len); in cypress_load_firmware()
103 } else if (ret != hx->len) { in cypress_load_firmware()
104 dev_err(&udev->dev, in cypress_load_firmware()
105 "%s: error while transferring firmware (transferred size=%d, block size=%d)\n", in cypress_load_firmware()
106 KBUILD_MODNAME, ret, hx->len); in cypress_load_firmware()
107 ret = -EIO; in cypress_load_firmware()
113 hx->data[0] = 0; in cypress_load_firmware()
114 ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1); in cypress_load_firmware()
116 dev_err(&udev->dev, "%s: CPU start failed=%d\n", in cypress_load_firmware()
118 ret = -EIO; in cypress_load_firmware()
130 MODULE_DESCRIPTION("Cypress firmware download");