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
e4994beb
Commit
e4994beb
authored
Aug 28, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv:fcl: dump FCL registers on debugfs
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
a673c06a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
+72
-0
gn412x-fcl.c
software/kernel/gn412x-fcl.c
+72
-0
No files found.
software/kernel/gn412x-fcl.c
View file @
e4994beb
...
...
@@ -122,8 +122,75 @@ struct gn412x_fcl_dev {
void
__iomem
*
mem
;
struct
fpga_manager
*
mgr
;
struct
dentry
*
dbg_dir
;
#define GN412X_DBG_REG_NAME "regs"
struct
dentry
*
dbg_reg
;
struct
debugfs_regset32
dbg_reg32
;
};
#define REG32(_name, _offset) {.name = _name, .offset = _offset}
static
const
struct
debugfs_reg32
gn412x_debugfs_reg32
[]
=
{
REG32
(
"FCL_CTRL"
,
FCL_CTRL
),
REG32
(
"FCL_STATUS"
,
FCL_STATUS
),
REG32
(
"FCL_IODATA_IN"
,
FCL_IODATA_IN
),
REG32
(
"FCL_IODATA_OUT"
,
FCL_IODATA_OUT
),
REG32
(
"FCL_EN"
,
FCL_EN
),
REG32
(
"FCL_TIMER0"
,
FCL_TIMER_0
),
REG32
(
"FCL_TIMER1"
,
FCL_TIMER_1
),
REG32
(
"FCL_CLK_DIV"
,
FCL_CLK_DIV
),
REG32
(
"FCL_IRQ"
,
FCL_IRQ
),
REG32
(
"FCL_TIMER_CTRL"
,
FCL_TIMER_CTRL
),
REG32
(
"FCL_IM"
,
FCL_IM
),
REG32
(
"FCL_TIMER2_0"
,
FCL_TIMER2_0
),
REG32
(
"FCL_TIMER2_1"
,
FCL_TIMER2_1
),
REG32
(
"FCL_DBG_STS"
,
FCL_DBG_STS
),
};
static
int
gn4124_dbg_init
(
struct
platform_device
*
pdev
)
{
struct
gn412x_fcl_dev
*
gn412x
=
platform_get_drvdata
(
pdev
);
struct
dentry
*
dir
,
*
file
;
int
err
;
dir
=
debugfs_create_dir
(
dev_name
(
&
pdev
->
dev
),
NULL
);
if
(
IS_ERR_OR_NULL
(
dir
))
{
err
=
PTR_ERR
(
dir
);
dev_warn
(
&
pdev
->
dev
,
"Cannot create debugfs directory
\"
%s
\"
(%d)
\n
"
,
dev_name
(
&
pdev
->
dev
),
err
);
goto
err_dir
;
}
gn412x
->
dbg_reg32
.
regs
=
gn412x_debugfs_reg32
;
gn412x
->
dbg_reg32
.
nregs
=
ARRAY_SIZE
(
gn412x_debugfs_reg32
);
gn412x
->
dbg_reg32
.
base
=
gn412x
->
mem
;
file
=
debugfs_create_regset32
(
GN412X_DBG_REG_NAME
,
0200
,
dir
,
&
gn412x
->
dbg_reg32
);
if
(
IS_ERR_OR_NULL
(
file
))
{
err
=
PTR_ERR
(
file
);
dev_warn
(
&
pdev
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
GN412X_DBG_REG_NAME
,
err
);
goto
err_reg32
;
}
gn412x
->
dbg_dir
=
dir
;
gn412x
->
dbg_reg
=
file
;
return
0
;
err_reg32:
debugfs_remove_recursive
(
dir
);
err_dir:
return
err
;
}
static
void
gn4124_dbg_exit
(
struct
platform_device
*
pdev
)
{
struct
gn412x_fcl_dev
*
gn412x
=
platform_get_drvdata
(
pdev
);
debugfs_remove_recursive
(
gn412x
->
dbg_dir
);
}
static
uint32_t
gn412x_ioread32
(
struct
gn412x_fcl_dev
*
gn412x
,
int
reg
)
{
...
...
@@ -430,6 +497,8 @@ static int gn412x_fcl_probe(struct platform_device *pdev)
gn4124_fcl_reset
(
gn412x
);
gn4124_dbg_init
(
pdev
);
gn412x
->
mgr
=
compat_fpga_mgr_create
(
&
pdev
->
dev
,
dev_name
(
&
pdev
->
dev
),
&
gn412x_fcl_ops
,
gn412x
);
...
...
@@ -447,6 +516,7 @@ static int gn412x_fcl_probe(struct platform_device *pdev)
err_fpga_reg:
compat_fpga_mgr_free
(
gn412x
->
mgr
);
err_fpga_create:
gn4124_dbg_exit
(
pdev
);
devm_iounmap
(
&
pdev
->
dev
,
gn412x
->
mem
);
err_map:
err_res_mem:
...
...
@@ -458,6 +528,8 @@ static int gn412x_fcl_remove(struct platform_device *pdev)
{
struct
gn412x_fcl_dev
*
gn412x
=
platform_get_drvdata
(
pdev
);
gn4124_dbg_exit
(
pdev
);
if
(
!
gn412x
->
mgr
)
return
-
ENODEV
;
...
...
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