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
f264c172
Commit
f264c172
authored
Jul 09, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: add debugfs for SPEC CSR registers
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
757864fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+56
-0
spec-core.c
software/kernel/spec-core.c
+2
-2
spec.h
software/kernel/spec.h
+5
-0
No files found.
software/kernel/spec-core-fpga.c
View file @
f264c172
...
...
@@ -64,6 +64,33 @@ enum spec_fpga_therm_offsets {
SPEC_FPGA_THERM_TEMP
=
SPEC_FPGA_MEM_THERM_START
+
0x8
,
};
static
const
struct
debugfs_reg32
spec_fpga_debugfs_reg32
[]
=
{
{
.
name
=
"Application offset"
,
.
offset
=
SPEC_FPGA_CSR_APP_OFF
,
},
{
.
name
=
"Resets"
,
.
offset
=
SPEC_FPGA_CSR_RESETS
,
},
{
.
name
=
"FMC present"
,
.
offset
=
SPEC_FPGA_CSR_FMC_PRESENT
,
},
{
.
name
=
"GN4124 Status"
,
.
offset
=
SPEC_FPGA_CSR_GN4124_STATUS
,
},
{
.
name
=
"DDR Status"
,
.
offset
=
SPEC_FPGA_CSR_DDR_STATUS
,
},
{
.
name
=
"PCB revision"
,
.
offset
=
SPEC_FPGA_CSR_PCB_REV
,
},
};
static
struct
resource
spec_fpga_vic_res
[]
=
{
{
...
...
@@ -592,8 +619,36 @@ int spec_fpga_init(struct spec_dev *spec)
if
(
err
)
goto
err_app
;
spec
->
dbg_dir_fpga
=
debugfs_create_dir
(
dev_name
(
&
spec
->
dev
),
spec
->
dbg_dir
);
if
(
IS_ERR_OR_NULL
(
spec
->
dbg_dir_fpga
))
{
err
=
PTR_ERR
(
spec
->
dbg_dir_fpga
);
dev_err
(
&
spec
->
dev
,
"Cannot create debugfs directory
\"
%s
\"
(%d)
\n
"
,
dev_name
(
&
spec
->
dev
),
err
);
goto
err_dbg_dir
;
}
spec
->
dbg_csr_reg
.
regs
=
spec_fpga_debugfs_reg32
;
spec
->
dbg_csr_reg
.
nregs
=
ARRAY_SIZE
(
spec_fpga_debugfs_reg32
);
spec
->
dbg_csr_reg
.
base
=
spec
->
fpga
;
spec
->
dbg_csr
=
debugfs_create_regset32
(
SPEC_DBG_CSR_NAME
,
0200
,
spec
->
dbg_dir_fpga
,
&
spec
->
dbg_csr_reg
);
if
(
IS_ERR_OR_NULL
(
spec
->
dbg_csr
))
{
err
=
PTR_ERR
(
spec
->
dbg_csr
);
dev_warn
(
&
spec
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_CSR_NAME
,
err
);
goto
err_dbg_csr
;
}
return
0
;
err_dbg_csr:
debugfs_remove_recursive
(
spec
->
dbg_dir_fpga
);
err_dbg_dir:
spec_fpga_app_exit
(
spec
);
err_app:
spec_fmc_exit
(
spec
);
err_fmc:
...
...
@@ -611,6 +666,7 @@ err_name:
int
spec_fpga_exit
(
struct
spec_dev
*
spec
)
{
debugfs_remove_recursive
(
spec
->
dbg_dir_fpga
);
spec_fpga_app_exit
(
spec
);
spec_fmc_exit
(
spec
);
spec_fpga_devices_exit
(
spec
);
...
...
software/kernel/spec-core.c
View file @
f264c172
...
...
@@ -288,6 +288,8 @@ static int spec_probe(struct pci_dev *pdev,
if
(
err
)
goto
err_sysfs
;
spec_dbg_init
(
spec
);
mutex_lock
(
&
spec
->
mtx
);
err
=
spec_fpga_init
(
spec
);
if
(
err
)
...
...
@@ -295,8 +297,6 @@ static int spec_probe(struct pci_dev *pdev,
"FPGA incorrectly programmed or empty (%d)
\n
"
,
err
);
mutex_unlock
(
&
spec
->
mtx
);
spec_dbg_init
(
spec
);
return
0
;
err_sysfs:
...
...
software/kernel/spec.h
View file @
f264c172
...
...
@@ -133,6 +133,11 @@ struct spec_dev {
#define SPEC_DBG_META_NAME "fpga_device_metadata"
struct
dentry
*
dbg_meta
;
struct
dentry
*
dbg_dir_fpga
;
#define SPEC_DBG_CSR_NAME "csr_regs"
struct
dentry
*
dbg_csr
;
struct
debugfs_regset32
dbg_csr_reg
;
struct
gpiod_lookup_table
*
gpiod_table
;
struct
gpio_desc
*
gpiod
[
GN4124_GPIO_MAX
];
};
...
...
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