diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-06 17:58:22 -0800 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-06 17:58:22 -0800 | 
| commit | e4e88f31bcb5f05f24b9ae518d4ecb44e1a7774d (patch) | |
| tree | 9eef6998f5bbd1a2c999011d9e0151f00c6e7297 /arch/powerpc/sysdev/ppc4xx_pci.c | |
| parent | 9753dfe19a85e7e45a34a56f4cb2048bb4f50e27 (diff) | |
| parent | ef88e3911c0e0301e73fa3b3b2567aabdbe17cc4 (diff) | |
| download | olio-linux-3.10-e4e88f31bcb5f05f24b9ae518d4ecb44e1a7774d.tar.xz olio-linux-3.10-e4e88f31bcb5f05f24b9ae518d4ecb44e1a7774d.zip  | |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (185 commits)
  powerpc: fix compile error with 85xx/p1010rdb.c
  powerpc: fix compile error with 85xx/p1023_rds.c
  powerpc/fsl: add MSI support for the Freescale hypervisor
  arch/powerpc/sysdev/fsl_rmu.c: introduce missing kfree
  powerpc/fsl: Add support for Integrated Flash Controller
  powerpc/fsl: update compatiable on fsl 16550 uart nodes
  powerpc/85xx: fix PCI and localbus properties in p1022ds.dts
  powerpc/85xx: re-enable ePAPR byte channel driver in corenet32_smp_defconfig
  powerpc/fsl: Update defconfigs to enable some standard FSL HW features
  powerpc: Add TBI PHY node to first MDIO bus
  sbc834x: put full compat string in board match check
  powerpc/fsl-pci: Allow 64-bit PCIe devices to DMA to any memory address
  powerpc: Fix unpaired probe_hcall_entry and probe_hcall_exit
  offb: Fix setting of the pseudo-palette for >8bpp
  offb: Add palette hack for qemu "standard vga" framebuffer
  offb: Fix bug in calculating requested vram size
  powerpc/boot: Change the WARN to INFO for boot wrapper overlap message
  powerpc/44x: Fix build error on currituck platform
  powerpc/boot: Change the load address for the wrapper to fit the kernel
  powerpc/44x: Enable CRASH_DUMP for 440x
  ...
Fix up a trivial conflict in arch/powerpc/include/asm/cputime.h due to
the additional sparse-checking code for cputime_t.
Diffstat (limited to 'arch/powerpc/sysdev/ppc4xx_pci.c')
| -rw-r--r-- | arch/powerpc/sysdev/ppc4xx_pci.c | 85 | 
1 files changed, 77 insertions, 8 deletions
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index 862f11b3821..4f05f754234 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c @@ -185,9 +185,15 @@ static int __init ppc4xx_parse_dma_ranges(struct pci_controller *hose,   out:  	dma_offset_set = 1;  	pci_dram_offset = res->start; +	hose->dma_window_base_cur = res->start; +	hose->dma_window_size = resource_size(res);  	printk(KERN_INFO "4xx PCI DMA offset set to 0x%08lx\n",  	       pci_dram_offset); +	printk(KERN_INFO "4xx PCI DMA window base to 0x%016llx\n", +	       (unsigned long long)hose->dma_window_base_cur); +	printk(KERN_INFO "DMA window size 0x%016llx\n", +	       (unsigned long long)hose->dma_window_size);  	return 0;  } @@ -647,6 +653,7 @@ static unsigned int ppc4xx_pciex_port_count;  struct ppc4xx_pciex_hwops  { +	bool want_sdr;  	int (*core_init)(struct device_node *np);  	int (*port_init_hw)(struct ppc4xx_pciex_port *port);  	int (*setup_utl)(struct ppc4xx_pciex_port *port); @@ -916,6 +923,7 @@ static int ppc440speB_pciex_init_utl(struct ppc4xx_pciex_port *port)  static struct ppc4xx_pciex_hwops ppc440speA_pcie_hwops __initdata =  { +	.want_sdr	= true,  	.core_init	= ppc440spe_pciex_core_init,  	.port_init_hw	= ppc440speA_pciex_init_port_hw,  	.setup_utl	= ppc440speA_pciex_init_utl, @@ -924,6 +932,7 @@ static struct ppc4xx_pciex_hwops ppc440speA_pcie_hwops __initdata =  static struct ppc4xx_pciex_hwops ppc440speB_pcie_hwops __initdata =  { +	.want_sdr	= true,  	.core_init	= ppc440spe_pciex_core_init,  	.port_init_hw	= ppc440speB_pciex_init_port_hw,  	.setup_utl	= ppc440speB_pciex_init_utl, @@ -1034,6 +1043,7 @@ static int ppc460ex_pciex_init_utl(struct ppc4xx_pciex_port *port)  static struct ppc4xx_pciex_hwops ppc460ex_pcie_hwops __initdata =  { +	.want_sdr	= true,  	.core_init	= ppc460ex_pciex_core_init,  	.port_init_hw	= ppc460ex_pciex_init_port_hw,  	.setup_utl	= ppc460ex_pciex_init_utl, @@ -1181,6 +1191,7 @@ done:  }  static struct ppc4xx_pciex_hwops ppc460sx_pcie_hwops __initdata = { +	.want_sdr	= true,  	.core_init	= ppc460sx_pciex_core_init,  	.port_init_hw	= ppc460sx_pciex_init_port_hw,  	.setup_utl	= ppc460sx_pciex_init_utl, @@ -1276,6 +1287,7 @@ static int ppc405ex_pciex_init_utl(struct ppc4xx_pciex_port *port)  static struct ppc4xx_pciex_hwops ppc405ex_pcie_hwops __initdata =  { +	.want_sdr	= true,  	.core_init	= ppc405ex_pciex_core_init,  	.port_init_hw	= ppc405ex_pciex_init_port_hw,  	.setup_utl	= ppc405ex_pciex_init_utl, @@ -1284,6 +1296,52 @@ static struct ppc4xx_pciex_hwops ppc405ex_pcie_hwops __initdata =  #endif /* CONFIG_40x */ +#ifdef CONFIG_476FPE +static int __init ppc_476fpe_pciex_core_init(struct device_node *np) +{ +	return 4; +} + +static void __init ppc_476fpe_pciex_check_link(struct ppc4xx_pciex_port *port) +{ +	u32 timeout_ms = 20; +	u32 val = 0, mask = (PECFG_TLDLP_LNKUP|PECFG_TLDLP_PRESENT); +	void __iomem *mbase = ioremap(port->cfg_space.start + 0x10000000, +	                              0x1000); + +	printk(KERN_INFO "PCIE%d: Checking link...\n", port->index); + +	if (mbase == NULL) { +		printk(KERN_WARNING "PCIE%d: failed to get cfg space\n", +		                    port->index); +		return; +	} +		 +	while (timeout_ms--) { +		val = in_le32(mbase + PECFG_TLDLP); + +		if ((val & mask) == mask) +			break; +		msleep(10); +	} + +	if (val & PECFG_TLDLP_PRESENT) { +		printk(KERN_INFO "PCIE%d: link is up !\n", port->index); +		port->link = 1; +	} else +		printk(KERN_WARNING "PCIE%d: Link up failed\n", port->index); + +	iounmap(mbase); +	return; +} + +static struct ppc4xx_pciex_hwops ppc_476fpe_pcie_hwops __initdata = +{ +	.core_init	= ppc_476fpe_pciex_core_init, +	.check_link	= ppc_476fpe_pciex_check_link, +}; +#endif /* CONFIG_476FPE */ +  /* Check that the core has been initied and if not, do it */  static int __init ppc4xx_pciex_check_core_init(struct device_node *np)  { @@ -1309,6 +1367,10 @@ static int __init ppc4xx_pciex_check_core_init(struct device_node *np)  	if (of_device_is_compatible(np, "ibm,plb-pciex-405ex"))  		ppc4xx_pciex_hwops = &ppc405ex_pcie_hwops;  #endif +#ifdef CONFIG_476FPE +	if (of_device_is_compatible(np, "ibm,plb-pciex-476fpe")) +		ppc4xx_pciex_hwops = &ppc_476fpe_pcie_hwops; +#endif  	if (ppc4xx_pciex_hwops == NULL) {  		printk(KERN_WARNING "PCIE: unknown host type %s\n",  		       np->full_name); @@ -1617,6 +1679,10 @@ static int __init ppc4xx_setup_one_pciex_POM(struct ppc4xx_pciex_port	*port,  			dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKL,  				sa | DCRO_PEGPL_460SX_OMR1MSKL_UOT  					| DCRO_PEGPL_OMRxMSKL_VAL); +		else if (of_device_is_compatible(port->node, "ibm,plb-pciex-476fpe")) +			dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKL, +				sa | DCRO_PEGPL_476FPE_OMR1MSKL_UOT +					| DCRO_PEGPL_OMRxMSKL_VAL);  		else  			dcr_write(port->dcrs, DCRO_PEGPL_OMR1MSKL,  				sa | DCRO_PEGPL_OMR1MSKL_UOT @@ -1739,9 +1805,10 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port,  		/* Calculate window size */  		sa = (0xffffffffffffffffull << ilog2(size));  		if (res->flags & IORESOURCE_PREFETCH) -			sa |= 0x8; +			sa |= PCI_BASE_ADDRESS_MEM_PREFETCH; -		if (of_device_is_compatible(port->node, "ibm,plb-pciex-460sx")) +		if (of_device_is_compatible(port->node, "ibm,plb-pciex-460sx") || +		    of_device_is_compatible(port->node, "ibm,plb-pciex-476fpe"))  			sa |= PCI_BASE_ADDRESS_MEM_TYPE_64;  		out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); @@ -1972,13 +2039,15 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np)  	}  	port->node = of_node_get(np); -	pval = of_get_property(np, "sdr-base", NULL); -	if (pval == NULL) { -		printk(KERN_ERR "PCIE: missing sdr-base for %s\n", -		       np->full_name); -		return; +	if (ppc4xx_pciex_hwops->want_sdr) { +		pval = of_get_property(np, "sdr-base", NULL); +		if (pval == NULL) { +			printk(KERN_ERR "PCIE: missing sdr-base for %s\n", +			       np->full_name); +			return; +		} +		port->sdr_base = *pval;  	} -	port->sdr_base = *pval;  	/* Check if device_type property is set to "pci" or "pci-endpoint".  	 * Resulting from this setup this PCIe port will be configured  |