Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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 PCIe FMC carrier SPEC - Software
Commits
83d3fa57
Commit
83d3fa57
authored
Feb 08, 2016
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: load a different golden bitstream according to SPEC type
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
3afdfcba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
spec-pci.c
kernel/spec-pci.c
+26
-2
No files found.
kernel/spec-pci.c
View file @
83d3fa57
...
...
@@ -27,12 +27,30 @@
#include "spec.h"
#include "loader-ll.h"
char
*
spec_fw_name
=
"fmc/spec-init.bin"
;
static
char
*
spec_fw_name_45t
=
"fmc/spec-init.bin"
;
static
char
*
spec_fw_name_100t
=
"fmc/spec-init-100T.bin"
;
char
*
spec_fw_name
=
""
;
module_param_named
(
fw_name
,
spec_fw_name
,
charp
,
0444
);
int
spec_use_msi
=
0
;
module_param_named
(
use_msi
,
spec_use_msi
,
int
,
0444
);
/**
* According to the PCI device ID, load different golden
*/
static
char
*
spec_golden_name_get
(
unsigned
int
device_id
)
{
if
(
strlen
(
spec_fw_name
)
>
0
)
return
spec_fw_name
;
switch
(
device_id
)
{
case
PCI_DEVICE_ID_SPEC_45T
:
return
spec_fw_name_45t
;
case
PCI_DEVICE_ID_SPEC_100T
:
return
spec_fw_name_100t
;
}
return
NULL
;
}
/* Load the FPGA. This bases on loader-ll.c, a kernel/user space thing */
int
spec_load_fpga
(
struct
spec_dev
*
spec
,
const
void
*
data
,
int
size
)
{
...
...
@@ -76,6 +94,11 @@ int spec_load_fpga_file(struct spec_dev *spec, char *name)
const
struct
firmware
*
fw
;
int
err
=
0
;
if
(
!
name
)
{
dev_err
(
dev
,
"You must provide a golden binary
\n
"
);
return
-
EINVAL
;
}
err
=
request_firmware
(
&
fw
,
name
,
dev
);
if
(
err
<
0
)
{
dev_err
(
dev
,
"request firmware
\"
%s
\"
: error %i
\n
"
,
name
,
err
);
...
...
@@ -97,7 +120,8 @@ static int spec_reconfigure(struct spec_dev *spec, struct fmc_gateware *gw)
spec_fmc_destroy
(
spec
);
/* Load the golden FPGA binary to read the eeprom */
ret
=
spec_load_fpga_file
(
spec
,
spec_fw_name
);
ret
=
spec_load_fpga_file
(
spec
,
spec_golden_name_get
(
spec
->
pdev
->
device
));
if
(
ret
)
return
ret
;
...
...
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