Commit 8bef31c9 authored by Federico Vaga's avatar Federico Vaga

Merge branch 'release/v3.0.2' into master

parents ad3211df a6c733f9
......@@ -6,6 +6,17 @@
Changelog
=========
3.0.2 - 2020-09-25
==================
Added
-----
- bld: cppcheck target for software
Fixed
-----
- sw: SVEC, load device driver instance only if the mezzanine is present.
3.0.1 - 2020-06-04
==================
......
......@@ -11,3 +11,4 @@ Makefile.specific
GTAGS
GPATH
GRTAGS
compile_commands.json
......@@ -28,3 +28,6 @@ modules_install: TARGET = modules_install
$(DIRS):
$(MAKE) -C $@ $(TARGET)
cppcheck:
for d in $(DIRS); do $(MAKE) -C $$d cppcheck || exit 1; done
......@@ -19,7 +19,7 @@
project = 'Fmc Fine-Delay Software'
copyright = '2020, Alessandro Rubini'
author = 'Alessandro Rubini <rubini@gnudd.com>, Tomasz Wlostowski <Tomasz.Wlostowski@cern.ch>'
author = 'Alessandro Rubini <rubini@gnudd.com>, Tomasz Wlostowski <Tomasz.Wlostowski@cern.ch>, Federico Vaga <federico.vaga@cern.ch>'
# -- General configuration ---------------------------------------------------
......@@ -60,3 +60,9 @@ breathe_projects = {
}
breathe_default_project = "fine-delay"
latex_documents = [
(master_doc, 'fmc-fine-delay.tex', project,
author.replace(', ', '\\and ').replace(' and ', '\\and and '),
'manual'),
]
......@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
#include <linux/fmc.h>
enum fd_svec_dev_offsets {
FD_SVEC_FDT1_MEM_START = 0x0000E000,
......@@ -21,7 +22,7 @@ enum svec_fpga_mfd_devs_enum {
FD_SVEC_MFD_FDT2,
};
static struct resource fd_svec_fdt1_res[] = {
static struct resource fd_svec_fdt_res1[] = {
{
.name = "fmc-fdelay-tdc-mem.1",
.flags = IORESOURCE_MEM,
......@@ -34,7 +35,7 @@ static struct resource fd_svec_fdt1_res[] = {
.end = 0,
},
};
static struct resource fd_svec_fdt2_res[] = {
static struct resource fd_svec_fdt_res2[] = {
{
.name = "fmc-fdelay-tdc-mem.2",
.flags = IORESOURCE_MEM,
......@@ -48,28 +49,39 @@ static struct resource fd_svec_fdt2_res[] = {
},
};
static const struct mfd_cell fd_svec_mfd_devs[] = {
[FD_SVEC_MFD_FDT1] = {
.name = "fmc-fdelay-tdc",
.platform_data = NULL,
.pdata_size = 0,
.num_resources = ARRAY_SIZE(fd_svec_fdt1_res),
.resources = fd_svec_fdt1_res,
},
[FD_SVEC_MFD_FDT2] = {
.name = "fmc-fdelay-tdc",
.platform_data = NULL,
.pdata_size = 0,
.num_resources = ARRAY_SIZE(fd_svec_fdt2_res),
.resources = fd_svec_fdt2_res,
},
#define MFD_DEL(_n) \
{ \
.name = "fmc-fdelay-tdc", \
.platform_data = NULL, \
.pdata_size = 0, \
.num_resources = ARRAY_SIZE(fd_svec_fdt_res##_n), \
.resources = fd_svec_fdt_res##_n, \
}
static const struct mfd_cell fd_svec_mfd_devs1[] = {
MFD_DEL(1),
};
static const struct mfd_cell fd_svec_mfd_devs2[] = {
MFD_DEL(2),
};
static const struct mfd_cell fd_svec_mfd_devs3[] = {
MFD_DEL(1),
MFD_DEL(2),
};
static const struct mfd_cell *fd_svec_mfd_devs[] = {
fd_svec_mfd_devs1,
fd_svec_mfd_devs2,
fd_svec_mfd_devs3,
};
static int fd_svec_probe(struct platform_device *pdev)
{
struct resource *rmem;
int idev = 0;
int ndev;
int irq;
int i;
rmem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!rmem) {
......@@ -83,15 +95,39 @@ static int fd_svec_probe(struct platform_device *pdev)
return -EINVAL;
}
for (i = 1; i <= 2; ++i) {
struct fmc_slot *slot = fmc_slot_get(pdev->dev.parent, i);
int present;
if (IS_ERR(slot)) {
dev_err(&pdev->dev,
"Can't find FMC slot %d err: %ld\n",
i, PTR_ERR(slot));
return PTR_ERR(slot);
}
present = fmc_slot_present(slot);
fmc_slot_put(slot);
dev_dbg(&pdev->dev, "FMC slot: %d, present: %d\n",
i, present);
if (present)
idev |= BIT(i - 1);
}
if (idev == 0)
return -ENODEV;
idev--;
/*
* We know that this design uses the HTVIC IRQ controller.
* This IRQ controller has a linear mapping, so it is enough
* to give the first one as input
*/
ndev = 1 + !!(idev & 0x2);
dev_dbg(&pdev->dev, "Found %d, point to mfd_cell %d\n", ndev, idev);
return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
fd_svec_mfd_devs,
ARRAY_SIZE(fd_svec_mfd_devs),
fd_svec_mfd_devs[idev], ndev,
rmem, irq, NULL);
}
......
......@@ -6,7 +6,8 @@
-include Makefile.specific
# include parent_common.mk for buildsystem's defines
REPO_PARENT=../..
IGNORE_CPU_SUFFIX := y
REPO_PARENT ?=
-include $(REPO_PARENT)/parent_common.mk
DESTDIR ?= /usr/local
......
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