Lines Matching +full:firmware +full:- +full:reset

1 // SPDX-License-Identifier: GPL-2.0
3 * Emagic EMI 2|6 usb audio interface firmware loader.
15 #include <linux/firmware.h>
18 #define EMI26_VENDOR_ID 0x086a /* Emagic Soft-und Hardware GmBH */
19 #define EMI26_PRODUCT_ID 0x0100 /* EMI 2|6 without firmware */
20 #define EMI26B_PRODUCT_ID 0x0102 /* EMI 2|6 without firmware */
23 #define ANCHOR_LOAD_EXTERNAL 0xA3 /* This command is not implemented in the core. Requires firmware
24 #define ANCHOR_LOAD_FPGA 0xA5 /* This command is not implemented in the core. Requires firmware. Em…
26 #define CPUCS_REG 0x7F92 /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */
46 dev_err(&dev->dev, "kmalloc(%d) failed.\n", length); in emi26_writememory()
47 return -ENOMEM; in emi26_writememory()
60 dev_info(&dev->dev, "%s - %d\n", __func__, reset_bit); in emi26_set_reset()
61 /* printk(KERN_DEBUG "%s - %d", __func__, reset_bit); */ in emi26_set_reset()
64 dev_err(&dev->dev, "set_reset (%d) failed\n", reset_bit); in emi26_set_reset()
73 const struct firmware *loader_fw = NULL; in emi26_load_firmware()
74 const struct firmware *bitstream_fw = NULL; in emi26_load_firmware()
75 const struct firmware *firmware_fw = NULL; in emi26_load_firmware()
77 int err = -ENOMEM; in emi26_load_firmware()
86 err = request_ihex_firmware(&loader_fw, "emi26/loader.fw", &dev->dev); in emi26_load_firmware()
91 &dev->dev); in emi26_load_firmware()
95 err = request_ihex_firmware(&firmware_fw, "emi26/firmware.fw", in emi26_load_firmware()
96 &dev->dev); in emi26_load_firmware()
99 dev_err(&dev->dev, "%s - request_firmware() failed\n", in emi26_load_firmware()
104 /* Assert reset (stop the CPU in the EMI) */ in emi26_load_firmware()
109 rec = (const struct ihex_binrec *)loader_fw->data; in emi26_load_firmware()
110 /* 1. We need to put the loader for the FPGA into the EZ-USB */ in emi26_load_firmware()
112 err = emi26_writememory(dev, be32_to_cpu(rec->addr), in emi26_load_firmware()
113 rec->data, be16_to_cpu(rec->len), in emi26_load_firmware()
120 /* De-assert reset (let the CPU run) */ in emi26_load_firmware()
126 /* 2. We upload the FPGA firmware into the EMI in emi26_load_firmware()
129 rec = (const struct ihex_binrec *)bitstream_fw->data; in emi26_load_firmware()
132 addr = be32_to_cpu(rec->addr); in emi26_load_firmware()
135 while (rec && (i + be16_to_cpu(rec->len) < FW_LOAD_SIZE)) { in emi26_load_firmware()
136 memcpy(buf + i, rec->data, be16_to_cpu(rec->len)); in emi26_load_firmware()
137 i += be16_to_cpu(rec->len); in emi26_load_firmware()
145 /* Assert reset (stop the CPU in the EMI) */ in emi26_load_firmware()
150 /* 3. We need to put the loader for the firmware into the EZ-USB (again...) */ in emi26_load_firmware()
151 for (rec = (const struct ihex_binrec *)loader_fw->data; in emi26_load_firmware()
153 err = emi26_writememory(dev, be32_to_cpu(rec->addr), in emi26_load_firmware()
154 rec->data, be16_to_cpu(rec->len), in emi26_load_firmware()
161 /* De-assert reset (let the CPU run) */ in emi26_load_firmware()
166 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ in emi26_load_firmware()
168 for (rec = (const struct ihex_binrec *)firmware_fw->data; in emi26_load_firmware()
170 if (!INTERNAL_RAM(be32_to_cpu(rec->addr))) { in emi26_load_firmware()
171 err = emi26_writememory(dev, be32_to_cpu(rec->addr), in emi26_load_firmware()
172 rec->data, be16_to_cpu(rec->len), in emi26_load_firmware()
179 /* Assert reset (stop the CPU in the EMI) */ in emi26_load_firmware()
184 for (rec = (const struct ihex_binrec *)firmware_fw->data; in emi26_load_firmware()
186 if (INTERNAL_RAM(be32_to_cpu(rec->addr))) { in emi26_load_firmware()
187 err = emi26_writememory(dev, be32_to_cpu(rec->addr), in emi26_load_firmware()
188 rec->data, be16_to_cpu(rec->len), in emi26_load_firmware()
195 /* De-assert reset (let the CPU run) */ in emi26_load_firmware()
207 dev_err(&dev->dev,"%s - error loading firmware: error = %d\n", in emi26_load_firmware()
230 dev_info(&intf->dev, "%s start\n", __func__); in emi26_probe()
235 return -EIO; in emi26_probe()
243 .name = "emi26 - firmware loader",
252 MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader.");
257 MODULE_FIRMWARE("emi26/firmware.fw");