lkml.org 
[lkml]   [2020]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] MIPS: Loongson64: Add dma iocoherency detection support
Date
Set hw_iocoherency according to parameter passed from firmware.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/Kconfig | 1 +
arch/mips/include/asm/mach-loongson64/boot_param.h | 5 +++--
arch/mips/loongson64/env.c | 4 ++++
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d0b727daddb3..8b0cd692a43f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -474,6 +474,7 @@ config MACH_LOONGSON64
select CSRC_R4K
select CEVT_R4K
select CPU_HAS_WB
+ select DMA_MAYBE_COHERENT
select FORCE_PCI
select ISA
select I8259
diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index 8c286bedff3e..2da2be40ad81 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -115,7 +115,8 @@ struct irq_source_routing_table {
u64 pci_io_start_addr;
u64 pci_io_end_addr;
u64 pci_config_addr;
- u32 dma_mask_bits;
+ u16 dma_mask_bits;
+ u16 dma_noncoherent;
} __packed;

struct interface_info {
@@ -206,7 +207,7 @@ struct loongson_system_configuration {
u64 poweroff_addr;
u64 suspend_addr;
u64 vgabios_addr;
- u32 dma_mask_bits;
+ u16 dma_mask_bits;
char ecname[32];
u32 nr_uarts;
struct uart_device uarts[MAX_UARTS];
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 0daeb7bcf023..61e3d4874fe9 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -15,6 +15,7 @@
*/
#include <linux/export.h>
#include <asm/bootinfo.h>
+#include <asm/dma-coherence.h>
#include <loongson.h>
#include <boot_param.h>
#include <workarounds.h>
@@ -128,6 +129,9 @@ void __init prom_init_env(void)
loongson_sysconf.dma_mask_bits > 64)
loongson_sysconf.dma_mask_bits = 32;

+ hw_coherentio = !eirq_source->dma_noncoherent;
+ pr_info("Firmware I/O coherency: %s\n", hw_coherentio?"ON":"OFF");
+
loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm;
loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;
loongson_sysconf.suspend_addr = boot_p->reset_system.DoSuspend;
--
2.24.1
\
 
 \ /
  Last update: 2020-01-13 15:08    [W:0.031 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site