Lines Matching +full:firmware +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0
3 * Emagic EMI 2|6 usb audio interface firmware loader.
13 #include <linux/firmware.h>
16 /* include firmware (variables)*/
28 #define EMI62_VENDOR_ID 0x086a /* Emagic Soft-und Hardware GmBH */
29 #define EMI62_PRODUCT_ID 0x0110 /* EMI 6|2m without firmware */
32 #define ANCHOR_LOAD_EXTERNAL 0xA3 /* This command is not implemented in the core. Requires firmware…
33 #define ANCHOR_LOAD_FPGA 0xA5 /* This command is not implemented in the core. Requires firmware. Em…
35 #define CPUCS_REG 0x7F92 /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */
55 dev_err(&dev->dev, "kmalloc(%d) failed.\n", length); in emi62_writememory()
56 return -ENOMEM; in emi62_writememory()
69 dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit); in emi62_set_reset()
73 dev_err(&dev->dev, "set_reset (%d) failed\n", reset_bit); in emi62_set_reset()
81 const struct firmware *loader_fw = NULL; in emi62_load_firmware()
82 const struct firmware *bitstream_fw = NULL; in emi62_load_firmware()
83 const struct firmware *firmware_fw = NULL; in emi62_load_firmware()
85 int err = -ENOMEM; in emi62_load_firmware()
90 dev_dbg(&dev->dev, "load_firmware\n"); in emi62_load_firmware()
95 err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev); in emi62_load_firmware()
100 &dev->dev); in emi62_load_firmware()
104 err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev); in emi62_load_firmware()
110 /* Assert reset (stop the CPU in the EMI) */ in emi62_load_firmware()
115 rec = (const struct ihex_binrec *)loader_fw->data; in emi62_load_firmware()
117 /* 1. We need to put the loader for the FPGA into the EZ-USB */ in emi62_load_firmware()
119 err = emi62_writememory(dev, be32_to_cpu(rec->addr), in emi62_load_firmware()
120 rec->data, be16_to_cpu(rec->len), in emi62_load_firmware()
127 /* De-assert reset (let the CPU run) */ in emi62_load_firmware()
133 /* 2. We upload the FPGA firmware into the EMI in emi62_load_firmware()
136 rec = (const struct ihex_binrec *)bitstream_fw->data; in emi62_load_firmware()
139 addr = be32_to_cpu(rec->addr); in emi62_load_firmware()
142 while (rec && (i + be16_to_cpu(rec->len) < FW_LOAD_SIZE)) { in emi62_load_firmware()
143 memcpy(buf + i, rec->data, be16_to_cpu(rec->len)); in emi62_load_firmware()
144 i += be16_to_cpu(rec->len); in emi62_load_firmware()
152 /* Assert reset (stop the CPU in the EMI) */ in emi62_load_firmware()
157 /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ in emi62_load_firmware()
158 for (rec = (const struct ihex_binrec *)loader_fw->data; in emi62_load_firmware()
160 err = emi62_writememory(dev, be32_to_cpu(rec->addr), in emi62_load_firmware()
161 rec->data, be16_to_cpu(rec->len), in emi62_load_firmware()
167 /* De-assert reset (let the CPU run) */ in emi62_load_firmware()
173 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ in emi62_load_firmware()
175 for (rec = (const struct ihex_binrec *)firmware_fw->data; in emi62_load_firmware()
177 if (!INTERNAL_RAM(be32_to_cpu(rec->addr))) { in emi62_load_firmware()
178 err = emi62_writememory(dev, be32_to_cpu(rec->addr), in emi62_load_firmware()
179 rec->data, be16_to_cpu(rec->len), in emi62_load_firmware()
186 /* Assert reset (stop the CPU in the EMI) */ in emi62_load_firmware()
191 for (rec = (const struct ihex_binrec *)firmware_fw->data; in emi62_load_firmware()
193 if (INTERNAL_RAM(be32_to_cpu(rec->addr))) { in emi62_load_firmware()
194 err = emi62_writememory(dev, be32_to_cpu(rec->addr), in emi62_load_firmware()
195 rec->data, be16_to_cpu(rec->len), in emi62_load_firmware()
202 /* De-assert reset (let the CPU run) */ in emi62_load_firmware()
220 dev_err(&dev->dev,"%s - error loading firmware: error = %d\n", in emi62_load_firmware()
227 dev_err(&dev->dev, "Error\n"); in emi62_load_firmware()
241 dev_dbg(&intf->dev, "emi62_probe\n"); in emi62_probe()
243 dev_info(&intf->dev, "%s start\n", __func__); in emi62_probe()
248 return -EIO; in emi62_probe()
256 .name = "emi62 - firmware loader",
265 MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader.");