|
56 | 56 | #define PCIE_CTRL_OFF 0x1a00
|
57 | 57 | #define PCIE_CTRL_X1_MODE 0x0001
|
58 | 58 | #define PCIE_CTRL_RC_MODE BIT(1)
|
| 59 | +#define PCIE_CTRL_MASTER_HOT_RESET BIT(24) |
59 | 60 | #define PCIE_STAT_OFF 0x1a04
|
60 | 61 | #define PCIE_STAT_BUS 0xff00
|
61 | 62 | #define PCIE_STAT_DEV 0x1f0000
|
@@ -498,6 +499,22 @@ mvebu_pci_bridge_emul_base_conf_read(struct pci_bridge_emul *bridge,
|
498 | 499 | break;
|
499 | 500 | }
|
500 | 501 |
|
| 502 | + case PCI_INTERRUPT_LINE: { |
| 503 | + /* |
| 504 | + * From the whole 32bit register we support reading from HW only |
| 505 | + * one bit: PCI_BRIDGE_CTL_BUS_RESET. |
| 506 | + * Other bits are retrieved only from emulated config buffer. |
| 507 | + */ |
| 508 | + __le32 *cfgspace = (__le32 *)&bridge->conf; |
| 509 | + u32 val = le32_to_cpu(cfgspace[PCI_INTERRUPT_LINE / 4]); |
| 510 | + if (mvebu_readl(port, PCIE_CTRL_OFF) & PCIE_CTRL_MASTER_HOT_RESET) |
| 511 | + val |= PCI_BRIDGE_CTL_BUS_RESET << 16; |
| 512 | + else |
| 513 | + val &= ~(PCI_BRIDGE_CTL_BUS_RESET << 16); |
| 514 | + *value = val; |
| 515 | + break; |
| 516 | + } |
| 517 | + |
501 | 518 | default:
|
502 | 519 | return PCI_BRIDGE_EMUL_NOT_HANDLED;
|
503 | 520 | }
|
@@ -606,6 +623,17 @@ mvebu_pci_bridge_emul_base_conf_write(struct pci_bridge_emul *bridge,
|
606 | 623 | mvebu_pcie_set_local_bus_nr(port, conf->secondary_bus);
|
607 | 624 | break;
|
608 | 625 |
|
| 626 | + case PCI_INTERRUPT_LINE: |
| 627 | + if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) { |
| 628 | + u32 ctrl = mvebu_readl(port, PCIE_CTRL_OFF); |
| 629 | + if (new & (PCI_BRIDGE_CTL_BUS_RESET << 16)) |
| 630 | + ctrl |= PCIE_CTRL_MASTER_HOT_RESET; |
| 631 | + else |
| 632 | + ctrl &= ~PCIE_CTRL_MASTER_HOT_RESET; |
| 633 | + mvebu_writel(port, ctrl, PCIE_CTRL_OFF); |
| 634 | + } |
| 635 | + break; |
| 636 | + |
609 | 637 | default:
|
610 | 638 | break;
|
611 | 639 | }
|
|
0 commit comments