Skip to content
Snippets Groups Projects
Commit 4e339b83 authored by Peter Tyser's avatar Peter Tyser Committed by Kumar Gala
Browse files

sbc8641d: Update PCI code


Update to use the recent, common FSL PCI initialization code.

Signed-off-by: default avatarPeter Tyser <ptyser@xes-inc.com>
CC: joe.hamman@embeddedspecialties.com
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 9a268e4b
No related branches found
No related tags found
No related merge requests found
...@@ -206,100 +206,45 @@ int first_free_busno = 0; ...@@ -206,100 +206,45 @@ int first_free_busno = 0;
void pci_init_board(void) void pci_init_board(void)
{ {
struct fsl_pci_info pci_info[2];
volatile immap_t *immap = (immap_t *) CONFIG_SYS_CCSRBAR; volatile immap_t *immap = (immap_t *) CONFIG_SYS_CCSRBAR;
volatile ccsr_gur_t *gur = &immap->im_gur; volatile ccsr_gur_t *gur = &immap->im_gur;
uint devdisr = gur->devdisr; uint devdisr = in_be32(&gur->devdisr);
uint io_sel = (gur->pordevsr & MPC8641_PORDEVSR_IO_SEL) uint io_sel = (gur->pordevsr & MPC8641_PORDEVSR_IO_SEL)
>> MPC8641_PORDEVSR_IO_SEL_SHIFT; >> MPC8641_PORDEVSR_IO_SEL_SHIFT;
int pcie_ep;
int num = 0;
#ifdef CONFIG_PCIE1 #ifdef CONFIG_PCIE1
{ int pcie_configured = is_fsl_pci_cfg(LAW_TRGT_IF_PCIE_1, io_sel);
volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE1_ADDR;
struct pci_controller *hose = &pcie1_hose; if (pcie_configured && !(devdisr & MPC86xx_DEVDISR_PCIEX1)) {
struct pci_region *r = hose->regions; SET_STD_PCIE_INFO(pci_info[num], 1);
#ifdef DEBUG pcie_ep = fsl_setup_hose(&pcie1_hose, pci_info[num].regs);
uint host1_agent = (gur->porbmsr & MPC8641_PORBMSR_HA) printf(" PCIE1 connected as %s (base addr %lx)\n",
>> MPC8641_PORBMSR_HA_SHIFT; pcie_ep ? "Endpoint" : "Root Complex",
uint pex1_agent = (host1_agent == 0) || (host1_agent == 1); pci_info[num].regs);
#endif first_free_busno = fsl_pci_init_port(&pci_info[num++],
if ((io_sel == 2 || io_sel == 3 || io_sel == 5 &pcie1_hose, first_free_busno);
|| io_sel == 6 || io_sel == 7 || io_sel == 0xF)
&& !(devdisr & MPC86xx_DEVDISR_PCIEX1)) {
debug("PCI-EXPRESS 1: %s \n", pex1_agent ? "Agent" : "Host");
debug("0x%08x=0x%08x ", &pci->pme_msg_det, pci->pme_msg_det);
if (pci->pme_msg_det) {
pci->pme_msg_det = 0xffffffff;
debug(" with errors. Clearing. Now 0x%08x",
pci->pme_msg_det);
}
debug("\n");
/* outbound memory */
pci_set_region(r++,
CONFIG_SYS_PCIE1_MEM_BUS,
CONFIG_SYS_PCIE1_MEM_PHYS,
CONFIG_SYS_PCIE1_MEM_SIZE,
PCI_REGION_MEM);
/* outbound io */
pci_set_region(r++,
CONFIG_SYS_PCIE1_IO_BUS,
CONFIG_SYS_PCIE1_IO_PHYS,
CONFIG_SYS_PCIE1_IO_SIZE,
PCI_REGION_IO);
hose->region_count = r - hose->regions;
hose->first_busno=first_free_busno;
fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
first_free_busno=hose->last_busno+1;
printf (" PCI-EXPRESS 1 on bus %02x - %02x\n",
hose->first_busno,hose->last_busno);
} else { } else {
puts("PCI-EXPRESS 1: Disabled\n"); puts(" PCIE1: disabled\n");
} }
}
#else #else
puts("PCI-EXPRESS1: Disabled\n"); puts(" PCIE1: disabled\n");
#endif /* CONFIG_PCIE1 */ #endif /* CONFIG_PCIE1 */
#ifdef CONFIG_PCIE2 #ifdef CONFIG_PCIE2
{
volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE2_ADDR;
struct pci_controller *hose = &pcie2_hose;
struct pci_region *r = hose->regions;
/* outbound memory */
pci_set_region(r++,
CONFIG_SYS_PCIE2_MEM_BUS,
CONFIG_SYS_PCIE2_MEM_PHYS,
CONFIG_SYS_PCIE2_MEM_SIZE,
PCI_REGION_MEM);
/* outbound io */
pci_set_region(r++,
CONFIG_SYS_PCIE2_IO_BUS,
CONFIG_SYS_PCIE2_IO_PHYS,
CONFIG_SYS_PCIE2_IO_SIZE,
PCI_REGION_IO);
hose->region_count = r - hose->regions;
hose->first_busno=first_free_busno; SET_STD_PCIE_INFO(pci_info[num], 2);
pcie_ep = fsl_setup_hose(&pcie2_hose, pci_info[num].regs);
fsl_pci_init(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data); printf(" PCIE2 connected as %s (base addr %lx)\n",
pcie_ep ? "Endpoint" : "Root Complex",
first_free_busno=hose->last_busno+1; pci_info[num].regs);
printf (" PCI-EXPRESS 2 on bus %02x - %02x\n", first_free_busno = fsl_pci_init_port(&pci_info[num++],
hose->first_busno,hose->last_busno); &pcie2_hose, first_free_busno);
}
#else #else
puts("PCI-EXPRESS 2: Disabled\n"); puts(" PCIE2: disabled\n");
#endif /* CONFIG_PCIE2 */ #endif /* CONFIG_PCIE2 */
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment