Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322251
b: refs/heads/master
c: a1dca31
h: refs/heads/master
i:
  322249: d4ee001
  322247: 6f39879
v: v3
  • Loading branch information
Gabor Juhos authored and Ralf Baechle committed Aug 23, 2012
1 parent 6b412a1 commit 32d43d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 16cc2cf642eb73978a3ebde66dc94d24d46b4798
refs/heads/master: a1dca315ce3f78347bca8ce8befe3cc71ae63b7e
22 changes: 22 additions & 0 deletions trunk/arch/mips/pci/pci-ar724x.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
#define AR724X_PCI_MEM_BASE 0x10000000
#define AR724X_PCI_MEM_SIZE 0x08000000

#define AR724X_PCI_REG_RESET 0x18
#define AR724X_PCI_REG_INT_STATUS 0x4c
#define AR724X_PCI_REG_INT_MASK 0x50

#define AR724X_PCI_RESET_LINK_UP BIT(0)

#define AR724X_PCI_INT_DEV0 BIT(14)

#define AR724X_PCI_IRQ_COUNT 1
Expand All @@ -38,6 +41,15 @@ static void __iomem *ar724x_pci_ctrl_base;

static u32 ar724x_pci_bar0_value;
static bool ar724x_pci_bar0_is_cached;
static bool ar724x_pci_link_up;

static inline bool ar724x_pci_check_link(void)
{
u32 reset;

reset = __raw_readl(ar724x_pci_ctrl_base + AR724X_PCI_REG_RESET);
return reset & AR724X_PCI_RESET_LINK_UP;
}

static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
int size, uint32_t *value)
Expand All @@ -46,6 +58,9 @@ static int ar724x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
void __iomem *base;
u32 data;

if (!ar724x_pci_link_up)
return PCIBIOS_DEVICE_NOT_FOUND;

if (devfn)
return PCIBIOS_DEVICE_NOT_FOUND;

Expand Down Expand Up @@ -96,6 +111,9 @@ static int ar724x_pci_write(struct pci_bus *bus, unsigned int devfn, int where,
u32 data;
int s;

if (!ar724x_pci_link_up)
return PCIBIOS_DEVICE_NOT_FOUND;

if (devfn)
return PCIBIOS_DEVICE_NOT_FOUND;

Expand Down Expand Up @@ -280,6 +298,10 @@ int __init ar724x_pcibios_init(int irq)
if (ar724x_pci_ctrl_base == NULL)
goto err_unmap_devcfg;

ar724x_pci_link_up = ar724x_pci_check_link();
if (!ar724x_pci_link_up)
pr_warn("ar724x: PCIe link is down\n");

ar724x_pci_irq_init(irq);
register_pci_controller(&ar724x_pci_controller);

Expand Down

0 comments on commit 32d43d6

Please sign in to comment.