aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/dts/mt8518.dtsi13
-rw-r--r--arch/arm/include/asm/dma-mapping.h23
-rw-r--r--arch/arm/include/asm/handoff.h21
-rw-r--r--arch/nds32/include/asm/dma-mapping.h23
-rw-r--r--arch/riscv/include/asm/dma-mapping.h23
-rw-r--r--arch/x86/include/asm/dma-mapping.h23
6 files changed, 118 insertions, 8 deletions
diff --git a/arch/arm/dts/mt8518.dtsi b/arch/arm/dts/mt8518.dtsi
index c2d17fda4a9..56da91a9fea 100644
--- a/arch/arm/dts/mt8518.dtsi
+++ b/arch/arm/dts/mt8518.dtsi
@@ -74,6 +74,19 @@
};
};
+ usb0: usb@11100000 {
+ compatible = "mediatek,mt8518-musb";
+ reg = <0x11100000 0x1000>;
+ reg-names = "control";
+ clocks = <&topckgen CLK_TOP_USB20_48M>,
+ <&topckgen CLK_TOP_USBIF>,
+ <&topckgen CLK_TOP_USB>;
+ clock-names = "usbpll", "usbmcu", "usb";
+ interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "mc";
+ status = "okay";
+ };
+
mmc0: mmc@11120000 {
compatible = "mediatek,mt8516-mmc";
reg = <0x11120000 0x1000>;
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index fc5b8f634d5..d20703739fa 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -7,7 +7,11 @@
#ifndef __ASM_ARM_DMA_MAPPING_H
#define __ASM_ARM_DMA_MAPPING_H
+#include <common.h>
+#include <asm/cache.h>
+#include <cpu_func.h>
#include <linux/dma-direction.h>
+#include <malloc.h>
#define dma_mapping_error(x, y) 0
@@ -25,12 +29,27 @@ static inline void dma_free_coherent(void *addr)
static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
enum dma_data_direction dir)
{
- return (unsigned long)vaddr;
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir == DMA_FROM_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
+ else
+ flush_dcache_range(addr, addr + len);
+
+ return addr;
}
static inline void dma_unmap_single(volatile void *vaddr, size_t len,
- unsigned long paddr)
+ enum dma_data_direction dir)
{
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir != DMA_TO_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
}
#endif /* __ASM_ARM_DMA_MAPPING_H */
diff --git a/arch/arm/include/asm/handoff.h b/arch/arm/include/asm/handoff.h
new file mode 100644
index 00000000000..0790d2ab1e2
--- /dev/null
+++ b/arch/arm/include/asm/handoff.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Architecture-specific SPL handoff information for ARM
+ *
+ * Copyright 2019 Amarula Solutions, BV
+ * Written by Michael Trimarchi <michael@amarulasolutions.com>
+ */
+
+#ifndef __asm_handoff_h
+#define __asm_handoff_h
+
+/**
+ * struct arch_spl_handoff - architecture-specific handoff info
+ *
+ * @usable_ram_top: Value returned by board_get_usable_ram_top() in SPL
+ */
+struct arch_spl_handoff {
+ ulong usable_ram_top;
+};
+
+#endif
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
index e6808dc8408..c8876ceadda 100644
--- a/arch/nds32/include/asm/dma-mapping.h
+++ b/arch/nds32/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@
#ifndef __ASM_NDS_DMA_MAPPING_H
#define __ASM_NDS_DMA_MAPPING_H
+#include <common.h>
+#include <asm/cache.h>
+#include <cpu_func.h>
#include <linux/dma-direction.h>
+#include <malloc.h>
static void *dma_alloc_coherent(size_t len, unsigned long *handle)
{
@@ -17,12 +21,27 @@ static void *dma_alloc_coherent(size_t len, unsigned long *handle)
static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
enum dma_data_direction dir)
{
- return (unsigned long)vaddr;
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir == DMA_FROM_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
+ else
+ flush_dcache_range(addr, addr + len);
+
+ return addr;
}
static inline void dma_unmap_single(volatile void *vaddr, size_t len,
- unsigned long paddr)
+ enum dma_data_direction dir)
{
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir != DMA_TO_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
}
#endif /* __ASM_NDS_DMA_MAPPING_H */
diff --git a/arch/riscv/include/asm/dma-mapping.h b/arch/riscv/include/asm/dma-mapping.h
index 3d930c90ece..6cc39469590 100644
--- a/arch/riscv/include/asm/dma-mapping.h
+++ b/arch/riscv/include/asm/dma-mapping.h
@@ -9,7 +9,11 @@
#ifndef __ASM_RISCV_DMA_MAPPING_H
#define __ASM_RISCV_DMA_MAPPING_H
+#include <common.h>
+#include <asm/cache.h>
+#include <cpu_func.h>
#include <linux/dma-direction.h>
+#include <malloc.h>
#define dma_mapping_error(x, y) 0
@@ -27,12 +31,27 @@ static inline void dma_free_coherent(void *addr)
static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
enum dma_data_direction dir)
{
- return (unsigned long)vaddr;
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir == DMA_FROM_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
+ else
+ flush_dcache_range(addr, addr + len);
+
+ return addr;
}
static inline void dma_unmap_single(volatile void *vaddr, size_t len,
- unsigned long paddr)
+ enum dma_data_direction dir)
{
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir != DMA_TO_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
}
#endif /* __ASM_RISCV_DMA_MAPPING_H */
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index b353ff0bef5..900b99b8a69 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -7,7 +7,11 @@
#ifndef __ASM_X86_DMA_MAPPING_H
#define __ASM_X86_DMA_MAPPING_H
+#include <common.h>
+#include <asm/cache.h>
+#include <cpu_func.h>
#include <linux/dma-direction.h>
+#include <malloc.h>
#define dma_mapping_error(x, y) 0
@@ -25,12 +29,27 @@ static inline void dma_free_coherent(void *addr)
static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
enum dma_data_direction dir)
{
- return (unsigned long)vaddr;
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir == DMA_FROM_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
+ else
+ flush_dcache_range(addr, addr + len);
+
+ return addr;
}
static inline void dma_unmap_single(volatile void *vaddr, size_t len,
- unsigned long paddr)
+ enum dma_data_direction dir)
{
+ unsigned long addr = (unsigned long)vaddr;
+
+ len = ALIGN(len, ARCH_DMA_MINALIGN);
+
+ if (dir != DMA_TO_DEVICE)
+ invalidate_dcache_range(addr, addr + len);
}
#endif /* __ASM_X86_DMA_MAPPING_H */