aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-12-17 09:26:35 +0000
committerJohn Crispin <blogic@openwrt.org>2015-12-17 09:26:35 +0000
commitb312384f7b7d7db9a0b2d2cb16232e7c6be4a89c (patch)
treea13b14c6d6ee08e0eeec27f2f32440cdb6727888 /target/linux
parent473ff842f255b909effaf11b4798e092ab84ccf9 (diff)
downloadmaster-187ad058-b312384f7b7d7db9a0b2d2cb16232e7c6be4a89c.tar.gz
master-187ad058-b312384f7b7d7db9a0b2d2cb16232e7c6be4a89c.tar.bz2
master-187ad058-b312384f7b7d7db9a0b2d2cb16232e7c6be4a89c.zip
ramips: mt7621: setup memory region for pcie controller memory
Only compile tested since I do not have any hardware with devices on pcie bus. Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@47904 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ramips/patches-4.3/0061-mt7621-set-up-pci-memory-region.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-4.3/0061-mt7621-set-up-pci-memory-region.patch b/target/linux/ramips/patches-4.3/0061-mt7621-set-up-pci-memory-region.patch
new file mode 100644
index 0000000000..e6338a9478
--- /dev/null
+++ b/target/linux/ramips/patches-4.3/0061-mt7621-set-up-pci-memory-region.patch
@@ -0,0 +1,42 @@
+--- a/arch/mips/pci/pci-mt7621.c
++++ b/arch/mips/pci/pci-mt7621.c
+@@ -46,6 +46,7 @@
+ #include <linux/version.h>
+ #include <asm/pci.h>
+ #include <asm/io.h>
++#include <asm/mips-cm.h>
+ #include <linux/init.h>
+ #include <linux/module.h>
+ #include <linux/delay.h>
+@@ -553,6 +554,23 @@ set_phy_for_ssc(void)
+ #endif
+ }
+
++void setup_cm_memory_region(struct resource *mem_resource)
++{
++ resource_size_t mask;
++ if (mips_cm_numiocu()) {
++ /* FIXME: hardware doesn't accept mask values with 1s after
++ 0s (e.g. 0xffef), so it would be great to warn if that's
++ about to happen */
++ mask = ~(mem_resource->end - mem_resource->start);
++
++ write_gcr_reg1_base(mem_resource->start);
++ write_gcr_reg1_mask(mask | CM_GCR_REGn_MASK_CMTGT_IOCU0);
++ printk("PCI coherence region base: 0x%08lx, mask/settings: 0x%08lx\n",
++ read_gcr_reg1_base(),
++ read_gcr_reg1_mask());
++ }
++}
++
+ static int mt7621_pci_probe(struct platform_device *pdev)
+ {
+ unsigned long val = 0;
+@@ -780,6 +798,7 @@ pcie(2/1/0) link status pcie2_num pcie1_
+ }
+
+ pci_load_of_ranges(&mt7621_controller, pdev->dev.of_node);
++ setup_cm_memory_region(mt7621_controller.mem_resource);
+ register_pci_controller(&mt7621_controller);
+ return 0;
+