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

1 // SPDX-License-Identifier: GPL-2.0-or-later
29 const char *name; member
39 .name = "utility",
45 .name = "firmware1",
52 .name = "firmware2",
60 .name = "firmware3",
68 .name = "config0",
75 .name = "config1",
82 .name = "config2",
89 .name = "config3",
96 .name = "config4",
103 .name = "config5",
110 .name = "config6",
122 * zl3073x_fw_component_alloc - Alloc structure to hold firmware component
136 comp->size = size; in zl3073x_fw_component_alloc()
137 comp->data = kzalloc(size, GFP_KERNEL); in zl3073x_fw_component_alloc()
138 if (!comp->data) { in zl3073x_fw_component_alloc()
147 * zl3073x_fw_component_free - Free allocated component structure
154 kfree(comp->data); in zl3073x_fw_component_free()
160 * zl3073x_fw_component_id_get - Get ID for firmware component name
161 * @name: input firmware component name
164 * - ZL3073X_FW_COMPONENT_* ID for known component name
165 * - ZL3073X_FW_COMPONENT_INVALID if the given name is unknown
168 zl3073x_fw_component_id_get(const char *name) in zl3073x_fw_component_id_get() argument
173 if (!strcasecmp(name, component_info[id].name)) in zl3073x_fw_component_id_get()
180 * zl3073x_fw_component_load - Load component from firmware source
187 * The function allocates single firmware component and loads the data from
205 struct device *dev = zldev->dev; in zl3073x_fw_component_load()
207 char buf[32], name[16]; in zl3073x_fw_component_load() local
211 /* Fetch image name and size from input */ in zl3073x_fw_component_load()
213 rc = sscanf(buf, "%15s %u %n", name, &count, &pos); in zl3073x_fw_component_load()
219 return -EINVAL; in zl3073x_fw_component_load()
222 *psize -= pos; in zl3073x_fw_component_load()
224 dev_dbg(dev, "Firmware component '%s' found\n", name); in zl3073x_fw_component_load()
226 id = zl3073x_fw_component_id_get(name); in zl3073x_fw_component_load()
228 ZL3073X_FW_ERR_MSG(extack, "unknown component type '%s'", name); in zl3073x_fw_component_load()
229 return -EINVAL; in zl3073x_fw_component_load()
239 info->name, size); in zl3073x_fw_component_load()
240 return -EINVAL; in zl3073x_fw_component_load()
249 return -ENOMEM; in zl3073x_fw_component_load()
251 comp->id = id; in zl3073x_fw_component_load()
253 /* Load component data from firmware source */ in zl3073x_fw_component_load()
254 for (dest = comp->data; count; count--, dest++) { in zl3073x_fw_component_load()
261 *psize -= pos; in zl3073x_fw_component_load()
269 ZL3073X_FW_ERR_MSG(extack, "[%s] invalid or missing data", info->name); in zl3073x_fw_component_load()
273 return -ENODATA; in zl3073x_fw_component_load()
277 * zl3073x_fw_free - Free allocated firmware
278 * @fw: firmware pointer
280 * The function frees existing firmware allocated by @zl3073x_fw_load.
290 zl3073x_fw_component_free(fw->component[i]); in zl3073x_fw_free()
296 * zl3073x_fw_load - Load all components from source
302 * The functions allocate firmware structure and loads all components from
305 * Return: pointer to firmware on success, error pointer on error
315 /* Allocate firmware structure */ in zl3073x_fw_load()
318 return ERR_PTR(-ENOMEM); in zl3073x_fw_load()
328 id = comp->id; in zl3073x_fw_load()
333 if (fw->component[id]) { in zl3073x_fw_load()
336 component_info[id].name); in zl3073x_fw_load()
338 rc = -EINVAL; in zl3073x_fw_load()
342 fw->component[id] = comp; in zl3073x_fw_load()
346 /* Free allocated firmware in case of error */ in zl3073x_fw_load()
355 * zl3073x_flash_bundle_flash - Flash all components
370 info = &component_info[comp->id]; in zl3073x_fw_component_flash()
372 switch (info->flash_type) { in zl3073x_fw_component_flash()
374 /* Non-flashable component - used for utility */ in zl3073x_fw_component_flash()
377 rc = zl3073x_flash_sectors(zldev, info->name, info->dest_page, in zl3073x_fw_component_flash()
378 info->load_addr, comp->data, in zl3073x_fw_component_flash()
379 comp->size, extack); in zl3073x_fw_component_flash()
382 rc = zl3073x_flash_page(zldev, info->name, info->dest_page, in zl3073x_fw_component_flash()
383 info->load_addr, comp->data, comp->size, in zl3073x_fw_component_flash()
387 rc = zl3073x_flash_page(zldev, info->name, info->dest_page, in zl3073x_fw_component_flash()
388 info->load_addr, comp->data, comp->size, in zl3073x_fw_component_flash()
391 rc = zl3073x_flash_page_copy(zldev, info->name, in zl3073x_fw_component_flash()
392 info->dest_page, in zl3073x_fw_component_flash()
393 info->copy_page, extack); in zl3073x_fw_component_flash()
398 info->name); in zl3073x_fw_component_flash()
409 if (!zlfw->component[i]) in zl3073x_fw_flash()
412 rc = zl3073x_fw_component_flash(zldev, zlfw->component[i], in zl3073x_fw_flash()