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
8dd2efb8
Commit
8dd2efb8
authored
Jul 17, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: create an app_reset function
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
96e9577d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+21
-9
No files found.
software/kernel/spec-core-fpga.c
View file @
8dd2efb8
...
...
@@ -13,6 +13,7 @@
#include <linux/spi/flash.h>
#include <linux/bitops.h>
#include <linux/fmc.h>
#include <linux/delay.h>
#include "spec.h"
#include "spec-compat.h"
...
...
@@ -471,6 +472,18 @@ enum spec_fpga_csr_resets {
SPEC_FPGA_CSR_RESETS_APP
=
BIT
(
1
),
};
static
void
spec_fpga_app_reset
(
struct
spec_fpga
*
spec_fpga
,
bool
val
)
{
uint32_t
resets
;
resets
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_CSR_RESETS
);
if
(
val
)
resets
|=
SPEC_FPGA_CSR_RESETS_APP
;
else
resets
&=
~
SPEC_FPGA_CSR_RESETS_APP
;
iowrite32
(
resets
,
spec_fpga
->
fpga
+
SPEC_FPGA_CSR_RESETS
);
}
static
ssize_t
reset_app_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
...
...
@@ -486,20 +499,14 @@ static ssize_t reset_app_store(struct device *dev,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
struct
spec_fpga
*
spec_fpga
=
to_spec_fpga
(
dev
);
uint32_t
resets
;
long
val
;
int
err
;
err
=
kstrtol
(
buf
,
10
,
&
val
);
err
=
kstrtol
(
buf
,
10
,
&
val
);
if
(
err
)
return
err
;
resets
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_CSR_RESETS
);
if
(
val
)
resets
|=
SPEC_FPGA_CSR_RESETS_APP
;
else
resets
&=
~
SPEC_FPGA_CSR_RESETS_APP
;
iowrite32
(
resets
,
spec_fpga
->
fpga
+
SPEC_FPGA_CSR_RESETS
);
spec_fpga_app_reset
(
to_spec_fpga
(
dev
),
val
);
return
count
;
}
...
...
@@ -684,6 +691,11 @@ static int spec_fpga_app_init(struct spec_fpga *spec_fpga)
if
(
err
)
return
err
;
spec_fpga_app_reset
(
spec_fpga
,
true
);
mdelay
(
1
);
spec_fpga_app_reset
(
spec_fpga
,
false
);
mdelay
(
1
);
pdev
=
platform_device_register_resndata
(
&
spec_fpga
->
dev
,
app_name
,
PLATFORM_DEVID_AUTO
,
res
,
res_n
,
...
...
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