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
c4b7d330
Commit
c4b7d330
authored
Jul 30, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: add debug regset for GN412X-GPIO
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
0538ec60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
gn412x-gpio.c
software/kernel/gn412x-gpio.c
+78
-0
No files found.
software/kernel/gn412x-gpio.c
View file @
c4b7d330
...
...
@@ -5,6 +5,7 @@
*/
#include <linux/module.h>
#include <linux/gpio/driver.h>
#include <linux/debugfs.h>
#include "spec.h"
#include "gn412x.h"
...
...
@@ -21,6 +22,11 @@ struct gn412x_gpio_dev {
struct
completion
compl
;
struct
gn412x_platform_data
*
pdata
;
struct
dentry
*
dbg_dir
;
#define GN412X_DBG_REG_NAME "regs"
struct
dentry
*
dbg_reg
;
struct
debugfs_regset32
dbg_reg32
;
};
static
struct
gn412x_platform_data
gn412x_gpio_pdata_default
=
{
...
...
@@ -40,6 +46,74 @@ enum htvic_mem_resources {
GN412X_MEM_BASE
=
0
,
};
#define REG32(_name, _offset) {.name = _name, .offset = _offset}
static
const
struct
debugfs_reg32
gn412x_debugfs_reg32
[]
=
{
REG32
(
"INT_CTRL"
,
GNINT_CTRL
),
REG32
(
"INT_STAT"
,
GNINT_STAT
),
REG32
(
"INT_CFG0"
,
GNINT_CFG_0
),
REG32
(
"INT_CFG1"
,
GNINT_CFG_1
),
REG32
(
"INT_CFG2"
,
GNINT_CFG_2
),
REG32
(
"INT_CFG3"
,
GNINT_CFG_3
),
REG32
(
"INT_CFG4"
,
GNINT_CFG_4
),
REG32
(
"INT_CFG5"
,
GNINT_CFG_5
),
REG32
(
"INT_CFG6"
,
GNINT_CFG_6
),
REG32
(
"INT_CFG7"
,
GNINT_CFG_7
),
REG32
(
"GPIO_BYPASS_MODE"
,
GNGPIO_BYPASS_MODE
),
REG32
(
"GPIO_DIRECTION_MODE"
,
GNGPIO_DIRECTION_MODE
),
REG32
(
"GPIO_OUTPUT_ENABLE"
,
GNGPIO_OUTPUT_ENABLE
),
REG32
(
"GPIO_OUTPUT_VALUE"
,
GNGPIO_OUTPUT_VALUE
),
REG32
(
"GPIO_INPUT_VALUE"
,
GNGPIO_INPUT_VALUE
),
REG32
(
"GPIO_INT_MASK"
,
GNGPIO_INT_MASK
),
REG32
(
"GPIO_INT_MASK_CLR"
,
GNGPIO_INT_MASK_CLR
),
REG32
(
"GPIO_INT_MASK_SET"
,
GNGPIO_INT_MASK_SET
),
REG32
(
"GPIO_INT_STATUS"
,
GNGPIO_INT_STATUS
),
REG32
(
"GPIO_INT_TYPE"
,
GNGPIO_INT_TYPE
),
REG32
(
"GPIO_INT_VALUE"
,
GNGPIO_INT_VALUE
),
REG32
(
"GPIO_INT_ON_ANY"
,
GNGPIO_INT_ON_ANY
),
};
static
int
gn412x_dbg_init
(
struct
gn412x_gpio_dev
*
gn412x
)
{
struct
dentry
*
dir
,
*
file
;
int
err
;
dir
=
debugfs_create_dir
(
dev_name
(
gn412x
->
gpiochip
.
dev
),
NULL
);
if
(
IS_ERR_OR_NULL
(
dir
))
{
err
=
PTR_ERR
(
dir
);
dev_warn
(
gn412x
->
gpiochip
.
dev
,
"Cannot create debugfs directory
\"
%s
\"
(%d)
\n
"
,
dev_name
(
gn412x
->
gpiochip
.
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
(
gn412x
->
gpiochip
.
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
gn412x_dbg_exit
(
struct
gn412x_gpio_dev
*
gn412x
)
{
debugfs_remove_recursive
(
gn412x
->
dbg_dir
);
}
static
uint32_t
gn412x_ioread32
(
struct
gn412x_gpio_dev
*
gn412x
,
int
reg
)
{
...
...
@@ -468,6 +542,8 @@ static int gn412x_gpio_probe(struct platform_device *pdev)
gn412x_gpio_int_cfg_enable
(
gn412x
);
gn412x_dbg_init
(
gn412x
);
return
0
;
err_req:
...
...
@@ -486,6 +562,8 @@ static int gn412x_gpio_remove(struct platform_device *pdev)
{
struct
gn412x_gpio_dev
*
gn412x
=
platform_get_drvdata
(
pdev
);
gn412x_dbg_exit
(
gn412x
);
gn412x_gpio_int_cfg_disable
(
gn412x
);
free_irq
(
platform_get_irq
(
pdev
,
0
),
gn412x
);
...
...
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