Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Trigger Distribution
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Trigger Distribution
Commits
105b23b6
Commit
105b23b6
authored
Sep 10, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: add top level driver for svec-tdc-fd
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
adfac442
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
0 deletions
+181
-0
Kbuild
software/drivers/Kbuild
+2
-0
wrtd-ref-svec-tdc-fd-core.c
software/drivers/wrtd-ref-svec-tdc-fd-core.c
+179
-0
No files found.
software/drivers/Kbuild
View file @
105b23b6
...
...
@@ -12,5 +12,7 @@ ccflags-y += -DDRV_VERSION=\"$(DRV_VERSION)\"
ccflags-y += -Wall -Werror
obj-m := wrtd-ref-spec150t-adc.o
obj-m += wrtd-ref-svec-tdc-fd.o
wrtd-ref-spec150t-adc-objs := wrtd-ref-spec150t-adc-core.o
wrtd-ref-svec-tdc-fd-objs := wrtd-ref-svec-tdc-fd-core.o
\ No newline at end of file
software/drivers/wrtd-ref-svec-tdc-fd-core.c
0 → 100644
View file @
105b23b6
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2019 CERN (www.cern.ch)
* Author: Federico Vaga <federico.vaga@cern.ch>
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
enum
wrtd_stf_dev_offsets
{
WRTD_STF_FDT_MEM_START
=
0x00006000
,
WRTD_STF_FDT_MEM_END
=
0x000061FF
,
WRTD_STF_TDC_MEM_START
=
0x0000E000
,
WRTD_STF_TDC_MEM_END
=
0x00001DFFF
,
WRTD_STF_TRTL_MEM_START
=
0x0001E000
,
WRTD_STF_TRTL_MEM_END
=
0x0003E000
,
};
/* MFD devices */
enum
spec_fpga_mfd_devs_enum
{
WRTD_STF_MFD_TRTL
=
0
,
WRTD_STF_MFD_FDT
,
WRTD_STF_MFD_TDC
,
};
static
struct
resource
wrtd_stf_fdt_res
[]
=
{
{
.
name
=
"fmc-fdelay-tdc-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
WRTD_STF_FDT_MEM_START
,
.
end
=
WRTD_STF_FDT_MEM_END
,
},
{
.
name
=
"fmc-fdelay-tdc-irq"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
1
,
.
end
=
1
,
},
};
static
struct
resource
wrtd_stf_tdc_res
[]
=
{
{
.
name
=
"fmc-tdc-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
WRTD_STF_TDC_MEM_START
,
.
end
=
WRTD_STF_TDC_MEM_END
,
},
{
.
name
=
"fmc-tdc-irq"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
0
,
.
end
=
0
,
},
};
static
struct
resource
wrtd_stf_trtl_res
[]
=
{
{
.
name
=
"mock-turtle-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
WRTD_STF_TRTL_MEM_START
,
.
end
=
WRTD_STF_TRTL_MEM_END
,
},
{
.
name
=
"mock-turtle-irq_in"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
2
,
},
{
.
name
=
"mock-turtle-irq_out"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
3
,
},
{
.
name
=
"mock-turtle-irq_con"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
4
,
},
{
.
name
=
"mock-turtle-irq_not"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
.
start
=
5
,
},
};
static
const
struct
mfd_cell
wrtd_stf_mfd_devs
[]
=
{
[
WRTD_STF_MFD_TRTL
]
=
{
.
name
=
"mock-turtle"
,
.
platform_data
=
NULL
,
.
pdata_size
=
0
,
.
num_resources
=
ARRAY_SIZE
(
wrtd_stf_trtl_res
),
.
resources
=
wrtd_stf_trtl_res
,
},
[
WRTD_STF_MFD_FDT
]
=
{
.
name
=
"fmc-fdelay-tdc"
,
.
platform_data
=
NULL
,
.
pdata_size
=
0
,
.
num_resources
=
ARRAY_SIZE
(
wrtd_stf_fdt_res
),
.
resources
=
wrtd_stf_fdt_res
,
},
[
WRTD_STF_MFD_TDC
]
=
{
.
name
=
"fmc-tdc"
,
.
platform_data
=
NULL
,
.
pdata_size
=
0
,
.
num_resources
=
ARRAY_SIZE
(
wrtd_stf_tdc_res
),
.
resources
=
wrtd_stf_tdc_res
,
},
};
static
int
wrtd_stf_probe
(
struct
platform_device
*
pdev
)
{
struct
resource
*
rmem
;
int
irq
;
rmem
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
if
(
!
rmem
)
{
dev_err
(
&
pdev
->
dev
,
"Missing memory resource
\n
"
);
return
-
EINVAL
;
}
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
irq
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"Missing IRQ number
\n
"
);
return
-
EINVAL
;
}
/*
* 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
*/
return
mfd_add_devices
(
&
pdev
->
dev
,
PLATFORM_DEVID_AUTO
,
wrtd_stf_mfd_devs
,
ARRAY_SIZE
(
wrtd_stf_mfd_devs
),
rmem
,
irq
,
NULL
);
}
static
int
wrtd_stf_remove
(
struct
platform_device
*
pdev
)
{
mfd_remove_devices
(
&
pdev
->
dev
);
return
0
;
}
/**
* List of supported platform
*/
enum
wrtd_stf_version
{
WRTD_STF_VER
=
0
,
};
static
const
struct
platform_device_id
wrtd_stf_id_table
[]
=
{
{
.
name
=
"wrtd-stf"
,
.
driver_data
=
WRTD_STF_VER
,
},
{
.
name
=
"id:000010DC574E0002"
,
.
driver_data
=
WRTD_STF_VER
,
},
{
.
name
=
"id:000010dc574e0002"
,
.
driver_data
=
WRTD_STF_VER
,
},
{},
};
static
struct
platform_driver
wrtd_stf_driver
=
{
.
driver
=
{
.
name
=
"wrtd-stf"
,
.
owner
=
THIS_MODULE
,
},
.
id_table
=
wrtd_stf_id_table
,
.
probe
=
wrtd_stf_probe
,
.
remove
=
wrtd_stf_remove
,
};
module_platform_driver
(
wrtd_stf_driver
);
MODULE_AUTHOR
(
"Federico Vaga <federico.vaga@cern.ch>"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_VERSION
(
DRV_VERSION
);
MODULE_DESCRIPTION
(
"Driver for the WRTD SVEC TDC Fine-Delay"
);
MODULE_DEVICE_TABLE
(
platform
,
wrtd_stf_id_table
);
MODULE_SOFTDEP
(
"pre: svec_fmc_carrier mockturtle fmc-fine-delay fmc-tdc"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment