openwrt/target/linux/d1/patches-6.1/0010-riscv-mm-Use-IOMMU-for-DMA-when-available.patch
Zoltan HERPAI 99545b4bb1 d1: add new target
This target adds support for the Allwinner D1 RISC-V based SoCs.

 - RISC-V single-core T-Head C906 (RV64GCV)
 - Tensilica HiFi4 DSP
 - DDR2/DDR3 support
 - 10/100/1000M ethernet
 - usual peripherals like USB2, SPI, I2C, PWM, etc.

Four boards are supported:
 - Dongshan Nezha STU
    - 512Mb RAM
    - ethernet

 - LicheePi RV Dock
    - 512Mb RAM
    - wireless-only (RTL8723DS)

 - MangoPi MQ-Pro
    - 512Mb RAM
    - there are pads available for an SPI flash
    - wireless-only (RTL8723DS)

 - Nezha D1
    - 512Mb/1Gb/2Gb RAM
    - 256Mb NAND flash
    - ethernet, wireless

Installation:
Standard SD-card installation via dd-ing the generated image to
an SD-card of at least 256Mb.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
2024-02-29 16:50:22 +01:00

31 lines
850 B
Diff

From 02a412de18479449c87ed7a332e3fe33d2eff3a4 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Wed, 27 Apr 2022 18:47:53 -0500
Subject: [PATCH 010/117] riscv: mm: Use IOMMU for DMA when available
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
arch/riscv/mm/dma-noncoherent.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/arch/riscv/mm/dma-noncoherent.c
+++ b/arch/riscv/mm/dma-noncoherent.c
@@ -7,6 +7,7 @@
#include <linux/dma-direct.h>
#include <linux/dma-map-ops.h>
+#include <linux/iommu.h>
#include <linux/mm.h>
#include <asm/cacheflush.h>
@@ -70,6 +71,9 @@ void arch_setup_dma_ops(struct device *d
dev_driver_string(dev), dev_name(dev));
dev->dma_coherent = coherent;
+
+ if (iommu)
+ iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1);
}
void riscv_noncoherent_supported(void)