Commit 0b31d708 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

coht-vic: Add specific coht-vic patches for White Rabbit Starting Kit.

NOTE: This change will be reverted when patches will be accepted in the coht-vic CERN repository.
parent 473f7e27
......@@ -19,7 +19,6 @@ MAKE_DIRS = spec-sw wr-nic fmc-dio wrpc-sw coht-vic #tools
#RUNME := $(shell test -d $(FMC_DRV) || git submodule update --init)
## Call the sub folder Makefiles
all clean install: init
@for d in $(MAKE_DIRS); do $(MAKE) -C $$d $@ || exit 1; done
......@@ -31,8 +30,12 @@ init: .INIT
.INIT:
git submodule init
@ $(MAKE) update
@ $(MAKE) patch
@touch .INIT; \
patch:
./scripts/wr-git-patch
## Force updating the submodules and fetch new gateware
update:
./scripts/wr-ssk-get -f
......@@ -48,4 +51,3 @@ update:
cd coht-vic
git submodule update
From 534e6009d557a99d74c5e0fdbc09c1d1140b8b04 Mon Sep 17 00:00:00 2001
From: Miguel Jimenez Lopez <miguel.jimenez@sevensols.com>
Date: Thu, 12 Sep 2019 09:39:55 +0200
Subject: [PATCH 1/4] Create irq_domain select() function for kernel >= 4.7.x.
---
drivers/htvic.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/htvic.c b/drivers/htvic.c
index 7095354..ea971dd 100644
--- a/drivers/htvic.c
+++ b/drivers/htvic.c
@@ -272,6 +272,24 @@ static struct irq_chip htvic_chip = {
.irq_set_type = htvic_irq_set_type,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+static int htvic_irq_domain_select(struct irq_domain *d, struct irq_fwspec *fwspec,
+ enum irq_domain_bus_token bus_token)
+{
+ struct htvic_device *htvic = d->host_data;
+ struct device *dev = &htvic->pdev->dev;
+ struct device *req_dev;
+
+ if(fwspec->param_count != 2)
+ return 0;
+
+ req_dev = (struct device *) ((((unsigned long) fwspec->param[0]) << 32) |
+ (((unsigned long) fwspec->param[1]) & 0xFFFFFFFF));
+
+ return (dev == req_dev);
+}
+#endif
+
/**
* Given the hardware IRQ and the Linux IRQ number (virtirq), configure the
* Linux IRQ number in order to handle properly the incoming interrupts
@@ -301,6 +319,9 @@ static int htvic_irq_domain_map(struct irq_domain *h,
static struct irq_domain_ops htvic_irq_domain_ops = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
+ .select = htvic_irq_domain_select,
+#endif
.map = htvic_irq_domain_map,
};
--
2.17.1
From 09c5f7f456ad06cbb911e2c435da92db6d17991d Mon Sep 17 00:00:00 2001
From: Miguel Jimenez Lopez <miguel.jimenez@sevensols.com>
Date: Thu, 12 Sep 2019 09:41:22 +0200
Subject: [PATCH 2/4] Add irq field to the htvic_device structure.
---
drivers/htvic.c | 8 ++++----
drivers/htvic.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/htvic.c b/drivers/htvic.c
index ea971dd..520d3aa 100644
--- a/drivers/htvic.c
+++ b/drivers/htvic.c
@@ -533,13 +533,13 @@ static int htvic_probe(struct platform_device *pdev)
* It depends on the platform and on the IRQ on which we are connecting
* but most likely our interrupt handler will be a thread
*/
- ret = request_any_context_irq(platform_get_irq(htvic->pdev, 0),
- htvic_handler, irq_flags,
+ htvic->irq = platform_get_irq(htvic->pdev, 0);
+ ret = request_any_context_irq(htvic->irq, htvic_handler, irq_flags,
dev_name(&pdev->dev),
htvic);
if (ret < 0) {
dev_err(&pdev->dev, "Can't request IRQ %d (%d)\n",
- platform_get_irq(htvic->pdev, 0), ret);
+ htvic->irq, ret);
goto out_req;
}
@@ -590,7 +590,7 @@ static int htvic_remove(struct platform_device *pdev)
}
- free_irq(platform_get_irq(htvic->pdev, 0), htvic);
+ free_irq(htvic->irq, htvic);
/*
* Clear the memory and restore flags when needed
diff --git a/drivers/htvic.h b/drivers/htvic.h
index 4b6a69f..3baccf2 100644
--- a/drivers/htvic.h
+++ b/drivers/htvic.h
@@ -42,6 +42,7 @@ struct htvic_device {
unsigned int hwid[VIC_MAX_VECTORS]; /**> original ID from FPGA */
struct htvic_data *data;
void __iomem *kernel_va;
+ int irq;
irq_flow_handler_t platform_handle_irq;
void *platform_handler_data;
--
2.17.1
From ffe6098f7d967579eae214b9a1a01149a4169ca6 Mon Sep 17 00:00:00 2001
From: Miguel Jimenez Lopez <miguel.jimenez@sevensols.com>
Date: Thu, 12 Sep 2019 09:43:35 +0200
Subject: [PATCH 3/4] Include pulse emulation mechanism for SPEC board.
---
drivers/htvic.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/htvic.c b/drivers/htvic.c
index 520d3aa..a62e505 100644
--- a/drivers/htvic.c
+++ b/drivers/htvic.c
@@ -518,6 +518,11 @@ static int htvic_probe(struct platform_device *pdev)
irq_flags |= IRQF_SHARED;
switch (pdev->id_entry->driver_data) {
case HTVIC_VER_SPEC:
+ ctl |= VIC_CTL_POL;
+ ctl |= VIC_CTL_EMU_EDGE;
+ ctl |= VIC_CTL_EMU_LEN_W(250);
+ irq_flags |= IRQF_TRIGGER_HIGH;
+ break;
case HTVIC_VER_SVEC:
ctl |= VIC_CTL_POL;
irq_flags |= IRQF_TRIGGER_HIGH;
--
2.17.1
From 670756fc4c7e62442b43b745239a8a5d7cc03e8e Mon Sep 17 00:00:00 2001
From: Miguel Jimenez Lopez <miguel.jimenez@sevensols.com>
Date: Thu, 12 Sep 2019 09:46:27 +0200
Subject: [PATCH 4/4] Makefile: Add an installation rule.
---
drivers/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/Makefile b/drivers/Makefile
index fbda688..8982385 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -9,6 +9,8 @@ VERSION = $(shell git describe --always --dirty --long --tags)
all: modules
modules:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) DRV_VERSION="$(VERSION)"
+install modules_install:
+ $(MAKE) -C $(LINUX) M=$(shell /bin/pwd) DRV_VERSION="$(VERSION)" modules_install
clean:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) clean
--
2.17.1
#!/bin/dash
## Script to apply git patches for submodules.
##
## Authors:
## - Miguel Jimenez Lopez (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#######################################################################################################
### Show help of the function
help ()
{
cat << EOF
Usage: $(basename $0) [Options]
Options:
-h|--help) Show this little help
EOF
exit 0
}
#################################################
### Main execution
GIT_REPOS="spec-sw wrpc-sw wr-nic fmc-dio coht-vic"
MAIN_DIR=".."
PATCHES_DIR="patches"
# setup script dir
sdir=$(dirname $0)
cd $sdir
sdir=$(pwd)
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
-h|--help) help;;
*) help;;
esac
shift # Check next set of parameters.
done
for i in $GIT_REPOS
do
if [ -e "$sdir/$MAIN_DIR/$PATCHES_DIR/$i" ] ; then
echo "Patching $i submodule"
cd "$sdir/$MAIN_DIR/$i"
git am $sdir/$MAIN_DIR/$PATCHES_DIR/$i/*.patch
cd "$sdir"
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment