Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
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
Simple VME FMC Carrier SVEC
Commits
a720464c
Commit
a720464c
authored
Sep 29, 2017
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: make the SVEC driver a VME driver
Signed-off-by:
Federico Vaga
<
federico.vaga@vaga.pv.it
>
parent
be16e264
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
2 deletions
+85
-2
Kbuild
kernel/Kbuild
+1
-0
svec-core.c
kernel/svec-core.c
+84
-2
No files found.
kernel/Kbuild
View file @
a720464c
...
@@ -9,6 +9,7 @@ endif
...
@@ -9,6 +9,7 @@ endif
ccflags-y += -DADDITIONAL_VERSIONS="$(SUBMODULE_VERSIONS)"
ccflags-y += -DADDITIONAL_VERSIONS="$(SUBMODULE_VERSIONS)"
ccflags-y += -DGIT_VERSION=\"$(GIT_VERSION)\"
ccflags-y += -DGIT_VERSION=\"$(GIT_VERSION)\"
ccflags-y += -I$(VMEBUS)/include
KBUILD_EXTRA_SYMBOLS += $(obj)/Module.symvers.vmebus
KBUILD_EXTRA_SYMBOLS += $(obj)/Module.symvers.vmebus
...
...
kernel/svec-core.c
View file @
a720464c
...
@@ -12,17 +12,99 @@
...
@@ -12,17 +12,99 @@
* Driver for SVEC (Simple VME FMC carrier) board.
* Driver for SVEC (Simple VME FMC carrier) board.
*/
*/
#include <linux/device.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <vmebus.h>
static
int
__init
svec_init
(
void
)
/**
* struct svec_dev - SVEC instance
* @vdev VME device instance
*/
struct
svec_dev
{
struct
device
dev
;
};
/**
* It initialize a new SVEC instance
* @pdev correspondend Linux device instance
* @ndev (Deprecated) device number
* Return: 0 on success, otherwise a negative number correspondent to an errno
*/
static
int
svec_probe
(
struct
device
*
dev
,
unsigned
int
ndev
)
{
{
struct
vme_dev
*
vdev
=
to_vme_dev
(
dev
);
struct
svec_dev
*
svec
;
int
err
;
svec
=
kzalloc
(
sizeof
(
struct
svec_dev
),
GFP_KERNEL
);
if
(
!
svec
)
{
dev_err
(
dev
,
"Cannot allocate memory for svec card struct
\n
"
);
return
-
ENOMEM
;
}
dev_set_name
(
&
svec
->
dev
,
"svec.%d"
,
vdev
->
slot
);
svec
->
dev
.
parent
=
&
vdev
->
dev
;
dev_set_drvdata
(
&
vdev
->
dev
,
svec
);
err
=
device_register
(
&
svec
->
dev
);
if
(
err
)
goto
err_dev_reg
;
return
0
;
return
0
;
err_dev_reg:
kfree
(
svec
);
return
err
;
}
}
static
void
__exit
svec_exit
(
void
)
static
int
svec_remove
(
struct
device
*
pdev
,
unsigned
int
ndev
)
{
{
struct
svec_dev
*
svec
=
dev_get_drvdata
(
pdev
);
device_unregister
(
&
svec
->
dev
);
kfree
(
svec
);
return
0
;
}
/**
* List of supported SVEC instances.
* Note that the CR space is part of the FPGA, so different FPGAs may have
* different IDs but they can be SVEC compatible. For example, and FMC-TDC
* bitstream for SVEC it is compatible even if it is a bitstream that drivers
* the FMC mezzanines as well.
* For the time being this case is not considered.
*/
static
const
struct
vme_device_id
svec_id_table
[]
=
{
{
"fmc-svec-a24"
,
0x00080030
,
0x00000198
,
0x00000001
},
{
"fmc-svec-a32"
,
0x00080030
,
0x00000198
,
0x00000001
},
{
"
\0
"
,
0
,
0
,
0
},
};
static
struct
vme_driver
svec_driver
=
{
.
probe
=
svec_probe
,
.
remove
=
svec_remove
,
.
driver
=
{
.
name
=
KBUILD_MODNAME
,
},
.
id_table
=
svec_id_table
,
};
static
int
__init
svec_init
(
void
)
{
return
vme_register_driver
(
&
svec_driver
,
0
);
}
static
void
__exit
svec_exit
(
void
)
{
vme_unregister_driver
(
&
svec_driver
);
}
}
module_init
(
svec_init
);
module_init
(
svec_init
);
...
...
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