aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-12-04 10:09:04 -0500
committerRich Felker <dalias@libc.org>2018-04-12 19:47:56 -0400
commitd62e9bf5dd4c0298465dd70b78b5532ea6708d63 (patch)
tree288382a18f7a41df93da129f576b673e29aa696d
parent7dd7f69809b4e3bed5c28dd8600a3a8b20f6441c (diff)
arch/sh: pcie-sh7786: exclude unusable PCI MEM areas
Depending on the physical memory layout, some PCI MEM areas are not usable. According to the SH7786 datasheet, the PCI MEM area from 1000_0000 to 13FF_FFFF is only usable if the physical memory layout (in MMSELR) is 1, 2, 5 or 6. In all other configurations, this PCI MEM area is not usable (because it overlaps with DRAM). Therefore, this commit adjusts the PCI SH7786 initialization to mark the relevant PCI resource as IORESOURCE_DISABLED if we can't use it. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Rich Felker <dalias@libc.org>
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index e713c398a6b9..72a1d794a7ba 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -19,6 +19,7 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/sh_clk.h> 20#include <linux/sh_clk.h>
21#include <linux/sh_intc.h> 21#include <linux/sh_intc.h>
22#include <cpu/sh7786.h>
22#include "pcie-sh7786.h" 23#include "pcie-sh7786.h"
23#include <asm/sizes.h> 24#include <asm/sizes.h>
24 25
@@ -530,6 +531,7 @@ static struct sh7786_pcie_hwops sh7786_65nm_pcie_hwops __initdata = {
530static int __init sh7786_pcie_init(void) 531static int __init sh7786_pcie_init(void)
531{ 532{
532 struct clk *platclk; 533 struct clk *platclk;
534 u32 mm_sel;
533 int i; 535 int i;
534 536
535 printk(KERN_NOTICE "PCI: Starting initialization.\n"); 537 printk(KERN_NOTICE "PCI: Starting initialization.\n");
@@ -563,6 +565,16 @@ static int __init sh7786_pcie_init(void)
563 565
564 clk_enable(platclk); 566 clk_enable(platclk);
565 567
568 mm_sel = sh7786_mm_sel();
569
570 /*
571 * Depending on the MMSELR register value, the PCIe0 MEM 1
572 * area may not be available. See Table 13.11 of the SH7786
573 * datasheet.
574 */
575 if (mm_sel != 1 && mm_sel != 2 && mm_sel != 5 && mm_sel != 6)
576 sh7786_pci0_resources[2].flags |= IORESOURCE_DISABLED;
577
566 printk(KERN_NOTICE "PCI: probing %d ports.\n", nr_ports); 578 printk(KERN_NOTICE "PCI: probing %d ports.\n", nr_ports);
567 579
568 for (i = 0; i < nr_ports; i++) { 580 for (i = 0; i < nr_ports; i++) {