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
8bb0be96
Commit
8bb0be96
authored
Jul 09, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: add sysfs attribute for SPEC CORE
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
0c6f191b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
19 deletions
+38
-19
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+38
-19
No files found.
software/kernel/spec-core-fpga.c
View file @
8bb0be96
...
...
@@ -91,6 +91,16 @@ static const struct debugfs_reg32 spec_fpga_debugfs_reg32[] = {
},
};
static
inline
uint32_t
spec_fpga_csr_app_offset
(
struct
spec_dev
*
spec
)
{
return
ioread32
(
spec
->
fpga
+
SPEC_FPGA_CSR_APP_OFF
);
}
static
inline
uint32_t
spec_fpga_csr_pcb_rev
(
struct
spec_dev
*
spec
)
{
return
ioread32
(
spec
->
fpga
+
SPEC_FPGA_CSR_PCB_REV
);
}
static
struct
resource
spec_fpga_vic_res
[]
=
{
{
...
...
@@ -332,30 +342,38 @@ static const struct attribute_group spec_fpga_therm_group = {
.
attrs
=
spec_fpga_therm_attrs
,
};
static
int
spec_fpga_therm_init
(
struct
spec_dev
*
spec
)
/* CSR attributes */
static
ssize_t
pcb_rev_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
int
err
;
clear_bit
(
SPEC_FLAG_THERM_BIT
,
spec
->
flags
);
if
(
!
(
spec
->
meta
->
cap
&
SPEC_META_CAP_THERM
))
return
0
;
err
=
sysfs_create_group
(
&
spec
->
dev
.
kobj
,
&
spec_fpga_therm_group
);
if
(
err
)
return
err
;
struct
spec_dev
*
spec
=
to_spec_dev
(
dev
);
set_bit
(
SPEC_FLAG_THERM_BIT
,
spec
->
flags
);
return
0
;
return
snprintf
(
buf
,
PAGE_SIZE
,
"0x%x
\n
"
,
spec_fpga_csr_pcb_rev
(
spec
))
;
}
static
DEVICE_ATTR_RO
(
pcb_rev
);
static
void
spec_fpga_therm_exit
(
struct
spec_dev
*
spec
)
static
ssize_t
application_offset_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
if
(
!
(
test_bit
(
SPEC_FLAG_THERM_BIT
,
spec
->
flags
)))
return
;
sysfs_remove_group
(
&
spec
->
dev
.
kobj
,
&
spec_fpga_therm_group
);
clear_bit
(
SPEC_FLAG_THERM_BIT
,
spec
->
flags
);
struct
spec_dev
*
spec
=
to_spec_dev
(
dev
);
return
snprintf
(
buf
,
PAGE_SIZE
,
"0x%x
\n
"
,
spec_fpga_csr_app_offset
(
spec
)
);
}
static
DEVICE_ATTR_RO
(
application_offset
);
static
struct
attribute
*
spec_fpga_csr_attrs
[]
=
{
&
dev_attr_pcb_rev
.
attr
,
&
dev_attr_application_offset
.
attr
,
NULL
,
};
static
const
struct
attribute_group
spec_fpga_csr_group
=
{
.
attrs
=
spec_fpga_csr_attrs
,
};
/* FMC */
#define SPEC_FMC_SLOTS 1
...
...
@@ -485,7 +503,7 @@ static int spec_fpga_app_init(struct spec_dev *spec)
char
app_name
[
SPEC_FPGA_APP_NAME_MAX
];
unsigned
long
app_offset
;
app_offset
=
ioread32
(
spec
->
fpga
+
SPEC_FPGA_CSR_APP_OFF
);
app_offset
=
spec_fpga_csr_app_offset
(
spec
);
if
(
!
app_offset
)
{
dev_warn
(
spec
->
dev
.
parent
,
"Application not found
\n
"
);
return
0
;
...
...
@@ -583,6 +601,7 @@ static int spec_uevent(struct device *dev, struct kobj_uevent_env *env)
static
const
struct
attribute_group
*
spec_groups
[]
=
{
&
spec_fpga_therm_group
,
&
spec_fpga_csr_group
,
NULL
};
...
...
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