~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/arm/plat-orion/pcie.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include <linux/mbus.h>
14
14
#include <asm/mach/pci.h>
15
15
#include <plat/pcie.h>
 
16
#include <linux/delay.h>
16
17
 
17
18
/*
18
19
 * PCIe unit register offsets.
46
47
#define  PCIE_STAT_BUS_OFFS             8
47
48
#define  PCIE_STAT_BUS_MASK             0xff
48
49
#define  PCIE_STAT_LINK_DOWN            1
 
50
#define PCIE_DEBUG_CTRL         0x1a60
 
51
#define  PCIE_DEBUG_SOFT_RESET          (1<<20)
49
52
 
50
53
 
51
54
u32 __init orion_pcie_dev_id(void __iomem *base)
85
88
        writel(stat, base + PCIE_STAT_OFF);
86
89
}
87
90
 
 
91
void __init orion_pcie_reset(void __iomem *base)
 
92
{
 
93
        u32 reg;
 
94
        int i;
 
95
 
 
96
        /*
 
97
         * MV-S104860-U0, Rev. C:
 
98
         * PCI Express Unit Soft Reset
 
99
         * When set, generates an internal reset in the PCI Express unit.
 
100
         * This bit should be cleared after the link is re-established.
 
101
         */
 
102
        reg = readl(base + PCIE_DEBUG_CTRL);
 
103
        reg |= PCIE_DEBUG_SOFT_RESET;
 
104
        writel(reg, base + PCIE_DEBUG_CTRL);
 
105
 
 
106
        for (i = 0; i < 20; i++) {
 
107
                mdelay(10);
 
108
 
 
109
                if (orion_pcie_link_up(base))
 
110
                        break;
 
111
        }
 
112
 
 
113
        reg &= ~(PCIE_DEBUG_SOFT_RESET);
 
114
        writel(reg, base + PCIE_DEBUG_CTRL);
 
115
}
 
116
 
88
117
/*
89
118
 * Setup PCIE BARs and Address Decode Wins:
90
119
 * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
133
162
        }
134
163
 
135
164
        /*
 
165
         * Round up 'size' to the nearest power of two.
 
166
         */
 
167
        if ((size & (size - 1)) != 0)
 
168
                size = 1 << fls(size);
 
169
 
 
170
        /*
136
171
         * Setup BAR[1] to all DRAM banks.
137
172
         */
138
173
        writel(dram->cs[0].base, base + PCIE_BAR_LO_OFF(1));