aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch')
-rw-r--r--target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch114
1 files changed, 87 insertions, 27 deletions
diff --git a/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch b/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
index 3a2e9c64bc..1eca91a893 100644
--- a/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
+++ b/target/linux/layerscape/patches-4.9/301-arch-support-layerscape.patch
@@ -1,4 +1,4 @@
-From 7edaf7ed8fbd5fb50950a4fc8067a9c14557d010 Mon Sep 17 00:00:00 2001
+From 739029f49bd9181b821298f9d27b29ce2d292967 Mon Sep 17 00:00:00 2001
From: Yangbo Lu <yangbo.lu@nxp.com>
Date: Mon, 25 Sep 2017 10:03:52 +0800
Subject: [PATCH] arch: support layerscape
@@ -34,9 +34,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
arch/arm64/include/asm/pgtable-prot.h | 1 +
arch/arm64/include/asm/pgtable.h | 5 +++
arch/arm64/kernel/pci.c | 62 +++++++++++++++++++++++++++++++++++
- arch/arm64/mm/dma-mapping.c | 6 ++++
- 15 files changed, 197 insertions(+), 3 deletions(-)
+ arch/arm64/mm/dma-mapping.c | 23 ++++++++++---
+ 15 files changed, 209 insertions(+), 8 deletions(-)
+diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
+index b1ce037e..1445b0ca 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -57,6 +57,22 @@ extern void __bad_udelay(void);
@@ -62,9 +64,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/* Loop-based definitions for assembly code. */
extern void __loop_delay(unsigned long loops);
extern void __loop_udelay(unsigned long usecs);
+diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
+index 021692c6..172a4f2e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
-@@ -129,6 +129,7 @@ static inline u32 __raw_readl(const vola
+@@ -129,6 +129,7 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
#define MT_DEVICE_NONSHARED 1
#define MT_DEVICE_CACHED 2
#define MT_DEVICE_WC 3
@@ -72,7 +76,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/*
* types 4 onwards can be found in asm/mach/map.h and are undefined
* for ioremap
-@@ -220,6 +221,34 @@ extern int pci_ioremap_io(unsigned int o
+@@ -220,6 +221,34 @@ extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
#endif
#endif
@@ -107,7 +111,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/*
* IO port access primitives
* -------------------------
-@@ -408,6 +437,8 @@ void __iomem *ioremap_wc(resource_size_t
+@@ -408,6 +437,8 @@ void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size);
#define ioremap_wc ioremap_wc
#define ioremap_wt ioremap_wc
@@ -116,6 +120,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
void iounmap(volatile void __iomem *iomem_cookie);
#define iounmap iounmap
+diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
+index 9b7c328f..27f3df7d 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -21,9 +21,9 @@ struct map_desc {
@@ -130,6 +136,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
MT_CACHECLEAN,
MT_MINICLEAN,
MT_LOW_VECTORS,
+diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
+index a8d656d9..4ab57b37 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -118,6 +118,13 @@ extern pgprot_t pgprot_s2_device;
@@ -146,6 +154,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define pgprot_writecombine(prot) \
__pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE)
+diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
+index 2f0e0773..d2f4869a 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -11,6 +11,8 @@
@@ -157,10 +167,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#include <asm/mach-types.h>
#include <asm/mach/map.h>
-@@ -64,6 +66,47 @@ void pcibios_report_status(u_int status_
+@@ -63,6 +65,47 @@ void pcibios_report_status(u_int status_mask, int warn)
+ pcibios_bus_report_status(bus, status_mask, warn);
}
- /*
++/*
+ * Check device tree if the service interrupts are there
+ */
+int pcibios_check_service_irqs(struct pci_dev *dev, int *irqs, int mask)
@@ -201,13 +212,14 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
+ return count;
+}
+
-+/*
+ /*
* We don't use this to fix the device, but initialisation of it.
* It's not the correct use for this, but it works.
- * Note that the arbiter/ISA bridge appears to be buggy, specifically in
+diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
+index ab771000..9b5f4465 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
-@@ -2392,6 +2392,7 @@ void arch_setup_dma_ops(struct device *d
+@@ -2392,6 +2392,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
set_dma_ops(dev, dma_ops);
}
@@ -215,9 +227,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
void arch_teardown_dma_ops(struct device *dev)
{
+diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
+index ff0eed23..2f2f4269 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
-@@ -398,6 +398,13 @@ void __iomem *ioremap_wc(resource_size_t
+@@ -398,6 +398,13 @@ void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size)
}
EXPORT_SYMBOL(ioremap_wc);
@@ -231,9 +245,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/*
* Remap an arbitrary physical address space into the kernel virtual
* address space as memory. Needed when the kernel wants to execute
+diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
+index f7c74135..4a2fb704 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
-@@ -313,6 +313,13 @@ static struct mem_type mem_types[] __ro_
+@@ -313,6 +313,13 @@ static struct mem_type mem_types[] __ro_after_init = {
.prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
.domain = DOMAIN_KERNEL,
},
@@ -247,7 +263,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
[MT_ROM] = {
.prot_sect = PMD_TYPE_SECT,
.domain = DOMAIN_KERNEL,
-@@ -644,6 +651,7 @@ static void __init build_mem_type_table(
+@@ -644,6 +651,7 @@ static void __init build_mem_type_table(void)
}
kern_pgprot |= PTE_EXT_AF;
vecs_pgprot |= PTE_EXT_AF;
@@ -255,7 +271,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
/*
* Set PXN for user mappings
-@@ -672,6 +680,7 @@ static void __init build_mem_type_table(
+@@ -672,6 +680,7 @@ static void __init build_mem_type_table(void)
mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd;
mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot;
@@ -263,6 +279,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
mem_types[MT_ROM].prot_sect |= cp->pmd;
+diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
+index 5082b30b..bde44993 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -18,7 +18,7 @@
@@ -274,9 +292,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
+diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
+index 0bba427b..36c1fbf3 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
-@@ -171,6 +171,8 @@ extern void __iomem *ioremap_cache(phys_
+@@ -171,6 +171,8 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
#define ioremap_wt(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
@@ -285,9 +305,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define iounmap __iounmap
/*
+diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
+index b9a7ba9c..8a189159 100644
--- a/arch/arm64/include/asm/pci.h
+++ b/arch/arm64/include/asm/pci.h
-@@ -31,6 +31,10 @@ static inline int pci_get_legacy_ide_irq
+@@ -31,6 +31,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
return -ENODEV;
}
@@ -298,6 +320,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
static inline int pci_proc_domain(struct pci_bus *bus)
{
return 1;
+diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
+index 2142c772..cdf8b25d 100644
--- a/arch/arm64/include/asm/pgtable-prot.h
+++ b/arch/arm64/include/asm/pgtable-prot.h
@@ -42,6 +42,7 @@
@@ -308,9 +332,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
+index 61e21401..b8c876fb 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
-@@ -356,6 +356,11 @@ static inline int pmd_protnone(pmd_t pmd
+@@ -356,6 +356,11 @@ static inline int pmd_protnone(pmd_t pmd)
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)
#define pgprot_writecombine(prot) \
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
@@ -322,6 +348,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#define pgprot_device(prot) \
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
#define __HAVE_PHYS_MEM_ACCESS_PROT
+diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
+index 409abc45..0568ec3a 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -17,6 +17,8 @@
@@ -333,11 +361,10 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/pci-ecam.h>
-@@ -53,6 +55,66 @@ int pcibios_alloc_irq(struct pci_dev *de
-
+@@ -54,6 +56,66 @@ int pcibios_alloc_irq(struct pci_dev *dev)
return 0;
}
-+
+
+/*
+ * Check device tree if the service interrupts are there
+ */
@@ -397,9 +424,12 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
+
+ return 0;
+}
-
++
/*
* raw_pci_read/write - Platform-specific PCI config space access.
+ */
+diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
+index b5bf46ce..5a010bcc 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -30,6 +30,7 @@
@@ -410,19 +440,49 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
static int swiotlb __ro_after_init;
-@@ -918,6 +919,10 @@ static int __init __iommu_dma_init(void)
+@@ -836,14 +837,21 @@ static bool do_iommu_attach(struct device *dev, const struct iommu_ops *ops,
+ * then the IOMMU core will have already configured a group for this
+ * device, and allocated the default domain for that group.
+ */
+- if (!domain || iommu_dma_init_domain(domain, dma_base, size, dev)) {
+- pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
+- dev_name(dev));
+- return false;
++ if (!domain)
++ goto out_err;
++
++ if (domain->type == IOMMU_DOMAIN_DMA) {
++ if (iommu_dma_init_domain(domain, dma_base, size, dev))
++ goto out_err;
++
++ dev->archdata.dma_ops = &iommu_dma_ops;
+ }
+
+- dev->archdata.dma_ops = &iommu_dma_ops;
+ return true;
++out_err:
++ pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n",
++ dev_name(dev));
++ return false;
+ }
+
+ static void queue_iommu_attach(struct device *dev, const struct iommu_ops *ops,
+@@ -917,6 +925,10 @@ static int __init __iommu_dma_init(void)
+ #ifdef CONFIG_PCI
if (!ret)
ret = register_iommu_dma_ops_notifier(&pci_bus_type);
- #endif
++#endif
+#ifdef CONFIG_FSL_MC_BUS
+ if (!ret)
+ ret = register_iommu_dma_ops_notifier(&fsl_mc_bus_type);
-+#endif
+ #endif
return ret;
}
- arch_initcall(__iommu_dma_init);
-@@ -971,3 +976,4 @@ void arch_setup_dma_ops(struct device *d
+@@ -971,3 +983,4 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
dev->archdata.dma_coherent = coherent;
__iommu_setup_dma_ops(dev, dma_base, size, iommu);
}
+EXPORT_SYMBOL(arch_setup_dma_ops);
+--
+2.14.1
+