Skip to content

Commit bd792ae

Browse files
committed
sh: pci: Support ports with disabled links on SH7786 PCIe.
Presently we error out if a link is disabled and simply drop the port registration outright. This follows the PPC changes and simply reports on the link state on boot, leaving the port registered, in order to more easily deal with hotplug on future parts. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent beb54ad commit bd792ae

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎arch/sh/drivers/pci/pcie-sh7786.c‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,12 @@ static int pcie_init(struct sh7786_pcie_port *port)
341341
data |= PCIEMACCTLR_SCR_DIS | (0xff << 16);
342342
pci_write_reg(chan, data, SH4A_PCIEMACCTLR);
343343

344+
/*
345+
* This will timeout if we don't have a link, but we permit the
346+
* port to register anyways in order to support hotplug on future
347+
* hardware.
348+
*/
344349
ret = pci_wait_for_irq(chan, MASK_INT_TX_CTRL);
345-
if (unlikely(ret != 0))
346-
return -ENODEV;
347350

348351
data = pci_read_reg(chan, SH4A_PCIEPCICONF1);
349352
data &= ~(PCI_STATUS_DEVSEL_MASK << 16);
@@ -356,9 +359,13 @@ static int pcie_init(struct sh7786_pcie_port *port)
356359

357360
wmb();
358361

359-
data = pci_read_reg(chan, SH4A_PCIEMACSR);
360-
printk(KERN_NOTICE "PCI: PCIe#%d link width %d\n",
361-
port->index, (data >> 20) & 0x3f);
362+
if (ret == 0) {
363+
data = pci_read_reg(chan, SH4A_PCIEMACSR);
364+
printk(KERN_NOTICE "PCI: PCIe#%d x%d link detected\n",
365+
port->index, (data >> 20) & 0x3f);
366+
} else
367+
printk(KERN_NOTICE "PCI: PCIe#%d link down\n",
368+
port->index);
362369

363370
for (i = win = 0; i < chan->nr_resources; i++) {
364371
struct resource *res = chan->resources + i;

0 commit comments

Comments
 (0)