Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
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
Commits
aa9df531
Commit
aa9df531
authored
May 18, 2021
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: check that FPGA is programmed before loading devices
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
f60a9aa2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+21
-0
No files found.
software/kernel/spec-core-fpga.c
View file @
aa9df531
...
...
@@ -1195,6 +1195,22 @@ static const struct device_type spec_fpga_type = {
.
groups
=
spec_groups
,
};
/**
* Checks if the FPGA has been programmed
*/
static
bool
spec_fpga_is_programmed
(
struct
spec_gn412x
*
spec_gn412x
)
{
struct
resource
*
r4
=
&
spec_gn412x
->
pdev
->
resource
[
4
];
void
*
mem
;
bool
done
;
mem
=
ioremap
(
r4
->
start
,
resource_size
(
r4
));
done
=
ioread32
(
mem
+
FCL_STATUS
)
&
FCL_SPRI_DONE
;
iounmap
(
mem
);
dev_err
(
&
spec_gn412x
->
pdev
->
dev
,
"SPRI_DONE %d
\n
"
,
done
);
return
done
;
}
/**
* Initialize carrier devices on FPGA
*/
...
...
@@ -1204,6 +1220,11 @@ int spec_fpga_init(struct spec_gn412x *spec_gn412x)
struct
resource
*
r0
=
&
spec_gn412x
->
pdev
->
resource
[
0
];
int
err
;
if
(
!
spec_fpga_is_programmed
(
spec_gn412x
))
{
dev_err
(
&
spec_gn412x
->
pdev
->
dev
,
"FPGA is not programmed
\n
"
);
return
-
ENODEV
;
}
spec_fpga
=
kzalloc
(
sizeof
(
*
spec_fpga
),
GFP_KERNEL
);
if
(
!
spec_fpga
)
return
-
ENOMEM
;
...
...
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