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"
56 const u32 *fw, size_t step, bool rom) in renesas_fw_download_image() argument
70 * The hardware does alternate between two 32-bit pages. in renesas_fw_download_image()
75 data0_or_data1 = (step & 1) == 1; in renesas_fw_download_image()
77 /* step+1. Read "Set DATAX" and confirm it is cleared. */ in renesas_fw_download_image()
81 dev_err(&dev->dev, "Read Status failed: %d\n", in renesas_fw_download_image()
91 dev_err(&dev->dev, "Timeout for Set DATAX step: %zd\n", step); in renesas_fw_download_image()
92 return -ETIMEDOUT; in renesas_fw_download_image()
96 * step+2. Write FW data to "DATAX". in renesas_fw_download_image()
101 (__force u32)cpu_to_le32(fw[step])); in renesas_fw_download_image()
103 dev_err(&dev->dev, "Write to DATAX failed: %d\n", in renesas_fw_download_image()
110 /* step+3. Set "Set DATAX". */ in renesas_fw_download_image()
113 dev_err(&dev->dev, "Write config for DATAX failed: %d\n", in renesas_fw_download_image()
132 * The bootrom chips of the big brother have sizes up to 64k, let's in renesas_fw_verify()
136 pr_err("firmware is size %zd is not (4k - 64k).", in renesas_fw_verify()
138 return -EINVAL; in renesas_fw_verify()
144 return -EINVAL; in renesas_fw_verify()
151 return -EINVAL; in renesas_fw_verify()
169 dev_dbg(&pdev->dev, "External ROM exists\n"); in renesas_check_rom()
189 dev_dbg(&pdev->dev, "Found ROM version: %x\n", version); in renesas_check_rom_state()
200 dev_dbg(&pdev->dev, "ROM exists\n"); in renesas_check_rom_state()
208 dev_dbg(&pdev->dev, "Unknown ROM status ...\n"); in renesas_check_rom_state()
209 return -ENOENT; in renesas_check_rom_state()
213 dev_err(&pdev->dev, "Invalid ROM.."); in renesas_check_rom_state()
218 return -EIO; in renesas_check_rom_state()
238 * to give up. in renesas_fw_check_running()
241 dev_dbg(&pdev->dev, "FW Download Lock is engaged."); in renesas_fw_check_running()
246 dev_err(&pdev->dev, in renesas_fw_check_running()
247 "FW Download Lock is set and FW is not ready. Giving Up."); in renesas_fw_check_running()
248 return -EIO; in renesas_fw_check_running()
253 * with it and it can't be reset, we have to give up too... and in renesas_fw_check_running()
257 dev_err(&pdev->dev, in renesas_fw_check_running()
258 "FW Download Enable is stale. Giving Up (poweroff/reboot needed)."); in renesas_fw_check_running()
259 return -EIO; in renesas_fw_check_running()
265 dev_dbg(&pdev->dev, "FW is not ready/loaded yet."); in renesas_fw_check_running()
271 dev_dbg(&pdev->dev, "FW is ready."); in renesas_fw_check_running()
275 dev_err(&pdev->dev, in renesas_fw_check_running()
276 "hardware is in an error state. Giving up (poweroff/reboot needed)."); in renesas_fw_check_running()
277 return -ENODEV; in renesas_fw_check_running()
280 dev_err(&pdev->dev, in renesas_fw_check_running()
281 "hardware is in an invalid state %lx. Giving up (poweroff/reboot needed).", in renesas_fw_check_running()
283 return -EINVAL; in renesas_fw_check_running()
290 const u32 *fw_data = (const u32 *)fw->data; in renesas_fw_download()
310 /* 1 - 10 follow one step after the other. */ in renesas_fw_download()
311 for (i = 0; i < fw->size / 4; i++) { in renesas_fw_download()
314 dev_err(&pdev->dev, in renesas_fw_download()
315 "Firmware Download Step %zd failed at position %zd bytes with (%d).", in renesas_fw_download()
337 dev_warn(&pdev->dev, "Final Firmware Download step timed out."); in renesas_fw_download()
358 /* Timed out / Error - let's see if we can fix this */ in renesas_fw_download()
362 * we shouldn't end up here. in renesas_fw_download()
369 dev_err(&pdev->dev, "FW Load timedout"); in renesas_fw_download()
370 return -ETIMEDOUT; in renesas_fw_download()
385 dev_dbg(&pdev->dev, "Performing ROM Erase...\n"); in renesas_rom_erase()
389 dev_err(&pdev->dev, "ROM erase, magic word write failed: %d\n", in renesas_rom_erase()
396 dev_err(&pdev->dev, "ROM status read failed: %d\n", in renesas_rom_erase()
403 dev_err(&pdev->dev, "ROM erase set word write failed\n"); in renesas_rom_erase()
421 dev_dbg(&pdev->dev, "Chip erase timedout: %x\n", status); in renesas_rom_erase()
423 dev_dbg(&pdev->dev, "ROM Erase... Done success\n"); in renesas_rom_erase()
428 const u32 *fw_data = (const u32 *)fw->data; in renesas_setup_rom()
450 dev_err(&pdev->dev, in renesas_setup_rom()
456 for (i = 0; i < fw->size / 4; i++) { in renesas_setup_rom()
459 dev_err(&pdev->dev, in renesas_setup_rom()
460 "ROM Download Step %d failed at position %d bytes with (%d)\n", in renesas_setup_rom()
480 dev_err(&pdev->dev, "Final Firmware ROM Download step timed out\n"); in renesas_setup_rom()
495 dev_err(&pdev->dev, "Read ROM status failed:%d\n", in renesas_setup_rom()
501 dev_dbg(&pdev->dev, "Download ROM success\n"); in renesas_setup_rom()
507 dev_err(&pdev->dev, in renesas_setup_rom()
512 dev_dbg(&pdev->dev, "Download to external ROM succeeded\n"); in renesas_setup_rom()
514 /* Last step set Reload */ in renesas_setup_rom()
518 dev_err(&pdev->dev, "Set ROM execute failed: %d\n", in renesas_setup_rom()
536 dev_err(&pdev->dev, "ROM Exec timed out: %x\n", status); in renesas_setup_rom()
561 dev_dbg(&pdev->dev, in renesas_load_fw()
564 dev_dbg(&pdev->dev, in renesas_load_fw()
574 dev_err(&pdev->dev, "firmware failed to download (%d).", err); in renesas_load_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()
649 .name = "xhci-pci-renesas",