Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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 - Software
Commits
8037b7d9
Commit
8037b7d9
authored
Jul 24, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup/clear gpio interrupts at irq request/free
parent
491f3df0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
spec-fmc.c
kernel/spec-fmc.c
+34
-1
spec.h
kernel/spec.h
+8
-1
No files found.
kernel/spec-fmc.c
View file @
8037b7d9
...
...
@@ -21,7 +21,34 @@ module_param_named(test_irq, spec_test_irq, int, 0444);
static
int
spec_irq_request
(
struct
fmc_device
*
fmc
,
irq_handler_t
handler
,
char
*
name
,
int
flags
)
{
return
request_irq
(
fmc
->
irq
,
handler
,
flags
,
name
,
fmc
);
struct
spec_dev
*
spec
=
fmc
->
carrier_data
;
int
ret
;
ret
=
request_irq
(
fmc
->
irq
,
handler
,
flags
,
name
,
fmc
);
if
(
ret
)
return
ret
;
/* Enable gpio interrupts:
* gpio6: tp8: output low
* gpio7: tp7: interrupt, raising edge
* gpio8: IRQ1 from FPGA: interrupt, raising edge
* gpio9: IRQ0 from FPGA: interrupt, raising edge
* gpio10: tp6: output low
* gpio11: tp5: interrupt, raising edge
*/
/* bypass = alternate function */
gennum_mask_val
(
spec
,
0xfc
,
0x00
,
GNGPIO_BYPASS_MODE
);
/* direction 0 = output */
gennum_mask_val
(
spec
,
0x44
,
0x00
,
GNGPIO_DIRECTION_MODE
);
gennum_mask_val
(
spec
,
0xb8
,
0xb8
,
GNGPIO_DIRECTION_MODE
);
gennum_mask_val
(
spec
,
0x44
,
0x44
,
GNGPIO_OUTPUT_ENABLE
);
gennum_mask_val
(
spec
,
0xb8
,
0x00
,
GNGPIO_INT_TYPE
);
/* 0 = edge */
gennum_mask_val
(
spec
,
0xb8
,
0xb8
,
GNGPIO_INT_VALUE
);
/* 1 = raising */
gennum_mask_val
(
spec
,
0xb8
,
0x00
,
GNGPIO_INT_ON_ANY
);
gennum_writel
(
spec
,
0xb8
,
GNGPIO_INT_MASK_CLR
);
/* enable */
return
0
;
}
static
void
spec_irq_ack
(
struct
fmc_device
*
fmc
)
...
...
@@ -38,6 +65,9 @@ static void spec_irq_ack(struct fmc_device *fmc)
static
int
spec_irq_free
(
struct
fmc_device
*
fmc
)
{
struct
spec_dev
*
spec
=
fmc
->
carrier_data
;
gennum_writel
(
spec
,
0xffff
,
GNGPIO_INT_MASK_SET
);
/* disable */
free_irq
(
fmc
->
irq
,
fmc
);
return
0
;
}
...
...
@@ -68,6 +98,9 @@ static irqreturn_t spec_test_handler(int irq, void *dev_id)
return
IRQ_HANDLED
;
}
/*
* Finally, the real init and exit
*/
static
int
spec_irq_init
(
struct
fmc_device
*
fmc
)
{
struct
spec_dev
*
spec
=
fmc
->
carrier_data
;
...
...
kernel/spec.h
View file @
8037b7d9
...
...
@@ -104,7 +104,14 @@ static inline void gennum_writel(struct spec_dev *spec, uint32_t val, int reg)
{
writel
(
val
,
spec
->
remap
[
2
]
+
reg
);
}
static
inline
void
gennum_mask_val
(
struct
spec_dev
*
spec
,
uint32_t
mask
,
uint32_t
val
,
int
reg
)
{
uint32_t
v
=
gennum_readl
(
spec
,
reg
);
v
&=
~
mask
;
v
|=
val
;
gennum_writel
(
spec
,
v
,
reg
);
}
/* Functions in spec-fmc.c, used by spec-pci.c */
...
...
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