Lines Matching refs:pdev
159 static bool renesas_check_rom(struct pci_dev *pdev) in renesas_check_rom() argument
165 retval = pci_read_config_word(pdev, RENESAS_ROM_STATUS, &rom_status); in renesas_check_rom()
171 dev_dbg(&pdev->dev, "External ROM exists\n"); in renesas_check_rom()
178 static int renesas_check_rom_state(struct pci_dev *pdev) in renesas_check_rom_state() argument
185 err = pci_read_config_dword(pdev, RENESAS_FW_VERSION, &version); in renesas_check_rom_state()
191 dev_dbg(&pdev->dev, "Found ROM version: %x\n", version); in renesas_check_rom_state()
196 err = pci_read_config_word(pdev, RENESAS_ROM_STATUS, &rom_state); in renesas_check_rom_state()
202 dev_dbg(&pdev->dev, "ROM exists\n"); in renesas_check_rom_state()
210 dev_dbg(&pdev->dev, "Unknown ROM status ...\n"); in renesas_check_rom_state()
215 dev_err(&pdev->dev, "Invalid ROM.."); in renesas_check_rom_state()
223 static int renesas_fw_check_running(struct pci_dev *pdev) in renesas_fw_check_running() argument
233 err = pci_read_config_byte(pdev, RENESAS_FW_STATUS, &fw_state); in renesas_fw_check_running()
243 dev_dbg(&pdev->dev, "FW Download Lock is engaged."); in renesas_fw_check_running()
248 dev_err(&pdev->dev, in renesas_fw_check_running()
259 dev_err(&pdev->dev, in renesas_fw_check_running()
267 dev_dbg(&pdev->dev, "FW is not ready/loaded yet."); in renesas_fw_check_running()
273 dev_dbg(&pdev->dev, "FW is ready."); in renesas_fw_check_running()
277 dev_err(&pdev->dev, in renesas_fw_check_running()
282 dev_err(&pdev->dev, in renesas_fw_check_running()
289 static int renesas_fw_download(struct pci_dev *pdev, in renesas_fw_download() argument
307 err = pci_write_config_byte(pdev, RENESAS_FW_STATUS, in renesas_fw_download()
314 err = renesas_fw_download_image(pdev, fw_data, i, false); in renesas_fw_download()
316 dev_err(&pdev->dev, in renesas_fw_download()
329 err = pci_read_config_byte(pdev, RENESAS_FW_STATUS_MSB, in renesas_fw_download()
339 dev_warn(&pdev->dev, "Final Firmware Download step timed out."); in renesas_fw_download()
345 err = pci_write_config_byte(pdev, RENESAS_FW_STATUS, 0); in renesas_fw_download()
351 err = pci_read_config_byte(pdev, RENESAS_FW_STATUS, &fw_status); in renesas_fw_download()
361 err = renesas_fw_check_running(pdev); in renesas_fw_download()
371 dev_err(&pdev->dev, "FW Load timedout"); in renesas_fw_download()
382 static void renesas_rom_erase(struct pci_dev *pdev) in renesas_rom_erase() argument
387 dev_dbg(&pdev->dev, "Performing ROM Erase...\n"); in renesas_rom_erase()
388 retval = pci_write_config_dword(pdev, RENESAS_DATA0, in renesas_rom_erase()
391 dev_err(&pdev->dev, "ROM erase, magic word write failed: %d\n", in renesas_rom_erase()
396 retval = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, &status); in renesas_rom_erase()
398 dev_err(&pdev->dev, "ROM status read failed: %d\n", in renesas_rom_erase()
403 retval = pci_write_config_byte(pdev, RENESAS_ROM_STATUS, status); in renesas_rom_erase()
405 dev_err(&pdev->dev, "ROM erase set word write failed\n"); in renesas_rom_erase()
413 retval = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, in renesas_rom_erase()
423 dev_dbg(&pdev->dev, "Chip erase timedout: %x\n", status); in renesas_rom_erase()
425 dev_dbg(&pdev->dev, "ROM Erase... Done success\n"); in renesas_rom_erase()
428 static bool renesas_setup_rom(struct pci_dev *pdev, const struct firmware *fw) in renesas_setup_rom() argument
435 err = pci_write_config_dword(pdev, RENESAS_DATA0, in renesas_setup_rom()
441 err = pci_write_config_byte(pdev, RENESAS_ROM_STATUS, in renesas_setup_rom()
447 err = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, &status); in renesas_setup_rom()
452 dev_err(&pdev->dev, in renesas_setup_rom()
459 err = renesas_fw_download_image(pdev, fw_data, i, true); in renesas_setup_rom()
461 dev_err(&pdev->dev, in renesas_setup_rom()
472 err = pci_read_config_byte(pdev, RENESAS_ROM_STATUS_MSB, in renesas_setup_rom()
482 dev_err(&pdev->dev, "Final Firmware ROM Download step timed out\n"); in renesas_setup_rom()
487 err = pci_write_config_byte(pdev, RENESAS_ROM_STATUS, 0); in renesas_setup_rom()
495 err = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, &status); in renesas_setup_rom()
497 dev_err(&pdev->dev, "Read ROM status failed:%d\n", in renesas_setup_rom()
503 dev_dbg(&pdev->dev, "Download ROM success\n"); in renesas_setup_rom()
509 dev_err(&pdev->dev, in renesas_setup_rom()
514 dev_dbg(&pdev->dev, "Download to external ROM succeeded\n"); in renesas_setup_rom()
517 err = pci_write_config_byte(pdev, RENESAS_ROM_STATUS, in renesas_setup_rom()
520 dev_err(&pdev->dev, "Set ROM execute failed: %d\n", in renesas_setup_rom()
529 err = pci_read_config_byte(pdev, RENESAS_ROM_STATUS, &status); in renesas_setup_rom()
538 dev_err(&pdev->dev, "ROM Exec timed out: %x\n", status); in renesas_setup_rom()
545 pci_write_config_byte(pdev, RENESAS_ROM_STATUS, 0); in renesas_setup_rom()
549 static int renesas_load_fw(struct pci_dev *pdev, const struct firmware *fw) in renesas_load_fw() argument
555 rom = renesas_check_rom(pdev); in renesas_load_fw()
558 renesas_rom_erase(pdev); in renesas_load_fw()
561 rom = renesas_setup_rom(pdev, fw); in renesas_load_fw()
563 dev_dbg(&pdev->dev, in renesas_load_fw()
566 dev_dbg(&pdev->dev, in renesas_load_fw()
572 err = renesas_fw_download(pdev, fw); in renesas_load_fw()
576 dev_err(&pdev->dev, "firmware failed to download (%d).", err); in renesas_load_fw()
580 int renesas_xhci_check_request_fw(struct pci_dev *pdev, in renesas_xhci_check_request_fw() argument
591 has_rom = renesas_check_rom(pdev); in renesas_xhci_check_request_fw()
593 err = renesas_check_rom_state(pdev); in renesas_xhci_check_request_fw()
600 err = renesas_fw_check_running(pdev); in renesas_xhci_check_request_fw()
609 pci_dev_get(pdev); in renesas_xhci_check_request_fw()
610 err = firmware_request_nowarn(&fw, fw_name, &pdev->dev); in renesas_xhci_check_request_fw()
611 pci_dev_put(pdev); in renesas_xhci_check_request_fw()
614 dev_info(&pdev->dev, "failed to load firmware %s, fallback to ROM\n", in renesas_xhci_check_request_fw()
618 dev_err(&pdev->dev, "failed to load firmware %s: %d\n", in renesas_xhci_check_request_fw()
627 err = renesas_load_fw(pdev, fw); in renesas_xhci_check_request_fw()