Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spec-sw
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
fmc-projects
spec
spec-sw
Commits
8037b7d9
There was an error fetching the commit references. Please try again later.
Commit
8037b7d9
authored
12 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
setup/clear gpio interrupts at irq request/free
parent
491f3df0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/spec-fmc.c
+34
-1
34 additions, 1 deletion
kernel/spec-fmc.c
kernel/spec.h
+8
-1
8 additions, 1 deletion
kernel/spec.h
with
42 additions
and
2 deletions
kernel/spec-fmc.c
+
34
−
1
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
;
...
...
This diff is collapsed.
Click to expand it.
kernel/spec.h
+
8
−
1
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 */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment