Lines Matching +full:step +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2019-2020 Linaro Limited */
12 #include "xhci-trace.h"
13 #include "xhci-pci.h"
54 const u32 *fw, size_t step, bool rom) in renesas_fw_download_image() argument
68 * The hardware does alternate between two 32-bit pages. in renesas_fw_download_image()
73 data0_or_data1 = (step & 1) == 1; in renesas_fw_download_image()
75 /* step+1. Read "Set DATAX" and confirm it is cleared. */ in renesas_fw_download_image()
79 dev_err(&dev->dev, "Read Status failed: %d\n", in renesas_fw_download_image()
89 dev_err(&dev->dev, "Timeout for Set DATAX step: %zd\n", step); in renesas_fw_download_image()
90 return -ETIMEDOUT; in renesas_fw_download_image()
94 * step+2. Write FW data to "DATAX". in renesas_fw_download_image()
99 (__force u32)cpu_to_le32(fw[step])); in renesas_fw_download_image()
101 dev_err(&dev->dev, "Write to DATAX failed: %d\n", in renesas_fw_download_image()
108 /* step+3. Set "Set DATAX". */ in renesas_fw_download_image()
111 dev_err(&dev->dev, "Write config for DATAX failed: %d\n", in renesas_fw_download_image()
130 * The bootrom chips of the big brother have sizes up to 64k, let's in renesas_fw_verify()
134 pr_err("firmware is size %zd is not (4k - 64k).", in renesas_fw_verify()
136 return -EINVAL; in renesas_fw_verify()
142 return -EINVAL; in renesas_fw_verify()
149 return -EINVAL; in renesas_fw_verify()
167 dev_dbg(&pdev->dev, "External ROM exists\n"); in renesas_check_rom()
187 dev_dbg(&pdev->dev, "Found ROM version: %x\n", version); in renesas_check_rom_state()
198 dev_dbg(&pdev->dev, "ROM exists\n"); in renesas_check_rom_state()
206 dev_dbg(&pdev->dev, "Unknown ROM status ...\n"); in renesas_check_rom_state()
207 return -ENOENT; in renesas_check_rom_state()
211 dev_err(&pdev->dev, "Invalid ROM.."); in renesas_check_rom_state()
216 return -EIO; in renesas_check_rom_state()
236 * to give up. in renesas_fw_check_running()
239 dev_dbg(&pdev->dev, "FW Download Lock is engaged."); in renesas_fw_check_running()
244 dev_err(&pdev->dev, in renesas_fw_check_running()
245 "FW Download Lock is set and FW is not ready. Giving Up."); in renesas_fw_check_running()
246 return -EIO; in renesas_fw_check_running()
251 * with it and it can't be reset, we have to give up too... and in renesas_fw_check_running()
255 dev_err(&pdev->dev, in renesas_fw_check_running()
256 "FW Download Enable is stale. Giving Up (poweroff/reboot needed)."); in renesas_fw_check_running()
257 return -EIO; in renesas_fw_check_running()
263 dev_dbg(&pdev->dev, "FW is not ready/loaded yet."); in renesas_fw_check_running()
269 dev_dbg(&pdev->dev, "FW is ready."); in renesas_fw_check_running()
273 dev_err(&pdev->dev, in renesas_fw_check_running()
274 "hardware is in an error state. Giving up (poweroff/reboot needed)."); in renesas_fw_check_running()
275 return -ENODEV; in renesas_fw_check_running()
278 dev_err(&pdev->dev, in renesas_fw_check_running()
279 "hardware is in an invalid state %lx. Giving up (poweroff/reboot needed).", in renesas_fw_check_running()
281 return -EINVAL; in renesas_fw_check_running()
288 const u32 *fw_data = (const u32 *)fw->data; in renesas_fw_download()
308 /* 1 - 10 follow one step after the other. */ in renesas_fw_download()
309 for (i = 0; i < fw->size / 4; i++) { in renesas_fw_download()
312 dev_err(&pdev->dev, in renesas_fw_download()
313 "Firmware Download Step %zd failed at position %zd bytes with (%d).", in renesas_fw_download()
335 dev_warn(&pdev->dev, "Final Firmware Download step timed out."); in renesas_fw_download()
356 /* Timed out / Error - let's see if we can fix this */ in renesas_fw_download()
360 * we shouldn't end up here. in renesas_fw_download()
367 dev_err(&pdev->dev, "FW Load timedout"); in renesas_fw_download()
368 return -ETIMEDOUT; in renesas_fw_download()
383 dev_dbg(&pdev->dev, "Performing ROM Erase...\n"); in renesas_rom_erase()
387 dev_err(&pdev->dev, "ROM erase, magic word write failed: %d\n", in renesas_rom_erase()
394 dev_err(&pdev->dev, "ROM status read failed: %d\n", in renesas_rom_erase()
401 dev_err(&pdev->dev, "ROM erase set word write failed\n"); in renesas_rom_erase()
419 dev_dbg(&pdev->dev, "Chip erase timedout: %x\n", status); in renesas_rom_erase()
421 dev_dbg(&pdev->dev, "ROM Erase... Done success\n"); in renesas_rom_erase()
426 const u32 *fw_data = (const u32 *)fw->data; in renesas_setup_rom()
448 dev_err(&pdev->dev, in renesas_setup_rom()
454 for (i = 0; i < fw->size / 4; i++) { in renesas_setup_rom()
457 dev_err(&pdev->dev, in renesas_setup_rom()
458 "ROM Download Step %d failed at position %d bytes with (%d)\n", in renesas_setup_rom()
478 dev_err(&pdev->dev, "Final Firmware ROM Download step timed out\n"); in renesas_setup_rom()
493 dev_err(&pdev->dev, "Read ROM status failed:%d\n", in renesas_setup_rom()
499 dev_dbg(&pdev->dev, "Download ROM success\n"); in renesas_setup_rom()
505 dev_err(&pdev->dev, in renesas_setup_rom()
510 dev_dbg(&pdev->dev, "Download to external ROM succeeded\n"); in renesas_setup_rom()
512 /* Last step set Reload */ in renesas_setup_rom()
516 dev_err(&pdev->dev, "Set ROM execute failed: %d\n", in renesas_setup_rom()
534 dev_err(&pdev->dev, "ROM Exec timed out: %x\n", status); in renesas_setup_rom()
559 dev_dbg(&pdev->dev, in renesas_load_fw()
562 dev_dbg(&pdev->dev, in renesas_load_fw()
572 dev_err(&pdev->dev, "firmware failed to download (%d).", err); in renesas_load_fw()
580 (struct xhci_driver_data *)id->driver_data; in renesas_xhci_check_request_fw()
581 const char *fw_name = driver_data->firmware; in renesas_xhci_check_request_fw()
592 else if (err != -ENOENT) in renesas_xhci_check_request_fw()
606 err = firmware_request_nowarn(&fw, fw_name, &pdev->dev); in renesas_xhci_check_request_fw()
610 dev_info(&pdev->dev, "failed to load firmware %s, fallback to ROM\n", in renesas_xhci_check_request_fw()
614 dev_err(&pdev->dev, "failed to load firmware %s: %d\n", in renesas_xhci_check_request_fw()
619 err = renesas_fw_verify(fw->data, fw->size); in renesas_xhci_check_request_fw()