Add custom Ethernet module
This commit is contained in:
parent
6f12ec6372
commit
6239191835
21
ethernet-driver-build.patch
Normal file
21
ethernet-driver-build.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
diff --git a/drivers/xxvnet_carv.c b/drivers/xxvnet_carv.c
|
||||||
|
index d3f60f9..9fd4c21 100644
|
||||||
|
--- a/drivers/xxvnet_carv.c
|
||||||
|
+++ b/drivers/xxvnet_carv.c
|
||||||
|
@@ -36,6 +36,7 @@
|
||||||
|
#include <linux/iopoll.h>
|
||||||
|
#include <linux/random.h>
|
||||||
|
#include <linux/clk.h>
|
||||||
|
+#include <linux/platform_device.h>
|
||||||
|
|
||||||
|
#include "xxvnet_carv.h"
|
||||||
|
|
||||||
|
@@ -1511,7 +1512,7 @@ axienet_dma_probe(struct platform_device *pdev, struct net_device *ndev)
|
||||||
|
spin_lock_init(&q->tx_lock);
|
||||||
|
spin_lock_init(&q->rx_lock);
|
||||||
|
|
||||||
|
- netif_napi_add(ndev, &lp->napi, axienet_rx_poll, AXIENET_NAPI_WEIGHT);
|
||||||
|
+ netif_napi_add(ndev, &lp->napi, axienet_rx_poll);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
7
ethernet-driver-kbuild.patch
Normal file
7
ethernet-driver-kbuild.patch
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
diff --git a/drivers/Kbuild b/drivers/Kbuild
|
||||||
|
index 28d6c0f..7f02860 100644
|
||||||
|
--- a/drivers/Kbuild
|
||||||
|
+++ b/drivers/Kbuild
|
||||||
|
@@ -1,2 +1 @@
|
||||||
|
obj-m := xxvnet_carv.o
|
||||||
|
-obj-m := xilinx_dma.o
|
23
ethernet-driver-poll.patch
Normal file
23
ethernet-driver-poll.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
diff --git a/drivers/xxvnet_carv.c b/drivers/xxvnet_carv.c
|
||||||
|
index eb664bb..d3f60f9 100644
|
||||||
|
--- a/drivers/xxvnet_carv.c
|
||||||
|
+++ b/drivers/xxvnet_carv.c
|
||||||
|
@@ -1435,12 +1435,12 @@ static void axienet_poll_controller(struct net_device *ndev)
|
||||||
|
{
|
||||||
|
struct axienet_local *lp = netdev_priv(ndev);
|
||||||
|
|
||||||
|
- disable_irq(lp->tx_irq);
|
||||||
|
- disable_irq(lp->rx_irq);
|
||||||
|
- axienet_rx_irq(lp->tx_irq, ndev);
|
||||||
|
- axienet_tx_irq(lp->rx_irq, ndev);
|
||||||
|
- enable_irq(lp->tx_irq);
|
||||||
|
- enable_irq(lp->rx_irq);
|
||||||
|
+ disable_irq(lp->dq->tx_irq);
|
||||||
|
+ disable_irq(lp->dq->rx_irq);
|
||||||
|
+ axienet_rx_irq(lp->dq->tx_irq, ndev);
|
||||||
|
+ axienet_tx_irq(lp->dq->rx_irq, ndev);
|
||||||
|
+ enable_irq(lp->dq->tx_irq);
|
||||||
|
+ enable_irq(lp->dq->rx_irq);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -74,6 +74,14 @@
|
|||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
boot = {
|
boot = {
|
||||||
|
extraModulePackages = [
|
||||||
|
# Add the custom Ethernet module
|
||||||
|
pkgs.xilinx-axienet-carv
|
||||||
|
];
|
||||||
|
kernelModules = [
|
||||||
|
# Load the Ethernet module by default
|
||||||
|
"xilinx_axienet_carv"
|
||||||
|
];
|
||||||
kernelPatches = [
|
kernelPatches = [
|
||||||
{
|
{
|
||||||
name = assert false; "sbi-early-console";
|
name = assert false; "sbi-early-console";
|
||||||
@ -418,29 +426,38 @@
|
|||||||
#./ox-alveo-platform-plic.patch
|
#./ox-alveo-platform-plic.patch
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
# opensbi = prev.opensbi.overrideAttrs (old: {
|
|
||||||
# #NIX_DEBUG=5;
|
# Custom kernel driver for the Ethernet
|
||||||
# # Compile dts to dtb form
|
xilinx-axienet-carv = let
|
||||||
# #nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ prev.buildPackages.dtc ];
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
# #preBuild = ''
|
in prev.stdenv.mkDerivation rec {
|
||||||
# # dtc -O dtb -o ox.dtb ${./ox.dts}
|
pname = "xilinx-axienet-carv";
|
||||||
# #'';
|
version = src.shortRev;
|
||||||
# makeFlags = old.makeFlags ++ [
|
src = builtins.fetchGit {
|
||||||
# "PLATFORM=fpga/sargantana_alveo"
|
url = "git@gitlab-internal.bsc.es:meep/meep-os/lagarto-openpiton-sdk.git";
|
||||||
# #"PLATFORM_RISCV_ISA=rv64imafd" # No compressed instructions
|
rev = "d2ae2e788bf1cc60676599184a9ec1128cc81d81";
|
||||||
# "PLATFORM_RISCV_ISA=rv64g" # No compressed instructions
|
ref = "master";
|
||||||
# #"PLATFORM_RISCV_ABI=lp64d"
|
};
|
||||||
# "FW_PAYLOAD_PATH=${final.uboot}/u-boot-nodtb.bin"
|
patches = [
|
||||||
# #"FW_FDT_PATH=ox.dtb"
|
./ethernet-driver-poll.patch
|
||||||
# ];
|
./ethernet-driver-build.patch
|
||||||
# patches = [ ./alveo-uart-sbi-hack.patch ];
|
./ethernet-driver-kbuild.patch
|
||||||
# });
|
];
|
||||||
# opensbi = prev.opensbi.overrideAttrs (old: {
|
preConfigure = ''
|
||||||
# makeFlags = old.makeFlags ++ [
|
export sourceRoot=$PWD/drivers
|
||||||
# "PLATFORM=fpga/openpiton"
|
cd drivers
|
||||||
# "FW_PAYLOAD_PATH=${final.uboot}/u-boot-nodtb.bin"
|
#rm Makefile
|
||||||
# ];
|
'';
|
||||||
# patches = [ ./opensbi-lagarto-hun.patch ];
|
|
||||||
# });
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||||
|
makeFlags = kernel.makeFlags ++ [
|
||||||
|
"-C"
|
||||||
|
"${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||||
|
"M=$(PWD)"
|
||||||
|
];
|
||||||
|
buildFlags = [ "modules" ];
|
||||||
|
installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
|
||||||
|
installTargets = [ "modules_install" ];
|
||||||
|
};
|
||||||
}) ];
|
}) ];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user