|
20 | 20 | #include <linux/acpi.h>
|
21 | 21 | #include <linux/gpio/consumer.h>
|
22 | 22 |
|
| 23 | +#define MAX_SUPP_MAC 64 |
| 24 | + |
23 | 25 | struct ufs_host {
|
24 | 26 | void (*late_init)(struct ufs_hba *hba);
|
25 | 27 | };
|
@@ -446,6 +448,49 @@ static int ufs_intel_mtl_init(struct ufs_hba *hba)
|
446 | 448 | return ufs_intel_common_init(hba);
|
447 | 449 | }
|
448 | 450 |
|
| 451 | +static int ufs_qemu_get_hba_mac(struct ufs_hba *hba) |
| 452 | +{ |
| 453 | + return MAX_SUPP_MAC; |
| 454 | +} |
| 455 | + |
| 456 | +static int ufs_qemu_mcq_config_resource(struct ufs_hba *hba) |
| 457 | +{ |
| 458 | + hba->mcq_base = hba->mmio_base + ufshcd_mcq_queue_cfg_addr(hba); |
| 459 | + |
| 460 | + return 0; |
| 461 | +} |
| 462 | + |
| 463 | +static int ufs_qemu_op_runtime_config(struct ufs_hba *hba) |
| 464 | +{ |
| 465 | + struct ufshcd_mcq_opr_info_t *opr; |
| 466 | + int i; |
| 467 | + |
| 468 | + u32 sqdao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_SQDAO, 0)); |
| 469 | + u32 sqisao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_SQISAO, 0)); |
| 470 | + u32 cqdao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_CQDAO, 0)); |
| 471 | + u32 cqisao = ufsmcq_readl(hba, ufshcd_mcq_cfg_offset(REG_CQISAO, 0)); |
| 472 | + |
| 473 | + hba->mcq_opr[OPR_SQD].offset = sqdao; |
| 474 | + hba->mcq_opr[OPR_SQIS].offset = sqisao; |
| 475 | + hba->mcq_opr[OPR_CQD].offset = cqdao; |
| 476 | + hba->mcq_opr[OPR_CQIS].offset = cqisao; |
| 477 | + |
| 478 | + for (i = 0; i < OPR_MAX; i++) { |
| 479 | + opr = &hba->mcq_opr[i]; |
| 480 | + opr->stride = 48; |
| 481 | + opr->base = hba->mmio_base + opr->offset; |
| 482 | + } |
| 483 | + |
| 484 | + return 0; |
| 485 | +} |
| 486 | + |
| 487 | +static struct ufs_hba_variant_ops ufs_qemu_hba_vops = { |
| 488 | + .name = "qemu-pci", |
| 489 | + .get_hba_mac = ufs_qemu_get_hba_mac, |
| 490 | + .mcq_config_resource = ufs_qemu_mcq_config_resource, |
| 491 | + .op_runtime_config = ufs_qemu_op_runtime_config, |
| 492 | +}; |
| 493 | + |
449 | 494 | static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = {
|
450 | 495 | .name = "intel-pci",
|
451 | 496 | .init = ufs_intel_common_init,
|
@@ -591,7 +636,8 @@ static const struct dev_pm_ops ufshcd_pci_pm_ops = {
|
591 | 636 | };
|
592 | 637 |
|
593 | 638 | static const struct pci_device_id ufshcd_pci_tbl[] = {
|
594 |
| - { PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
| 639 | + { PCI_VENDOR_ID_REDHAT, 0x0013, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
| 640 | + (kernel_ulong_t)&ufs_qemu_hba_vops }, |
595 | 641 | { PCI_VENDOR_ID_SAMSUNG, 0xC00C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
|
596 | 642 | { PCI_VDEVICE(INTEL, 0x9DFA), (kernel_ulong_t)&ufs_intel_cnl_hba_vops },
|
597 | 643 | { PCI_VDEVICE(INTEL, 0x4B41), (kernel_ulong_t)&ufs_intel_ehl_hba_vops },
|
|
0 commit comments