Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Network Interface Card
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
White Rabbit Network Interface Card
Commits
eefe0cf5
Commit
eefe0cf5
authored
Sep 04, 2019
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update NIC driver for the new IRQ scheme.
parent
4fd98f04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
68 deletions
+6
-68
device.c
sw/kernel/device.c
+6
-68
No files found.
sw/kernel/device.c
View file @
eefe0cf5
...
...
@@ -23,33 +23,10 @@
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/irqdomain.h>
#include "wr-nic.h"
#include "nic-mem.h"
/**
* IRQ domain to be used. This is static here but in general it should be
* a module parameter or somehow configurable. For the time being we keep
* it hard-coded here.
*/
#define HTVIC_IRQDOMAIN_NAME "htvic-irq"
static
struct
irq_domain
*
irq_find_irqdomain
(
const
char
*
name
)
{
struct
irq_fwspec
fwspec
;
struct
irq_domain
*
d
=
NULL
;
memset
(
&
fwspec
,
0
,
sizeof
(
fwspec
));
fwspec
.
fwnode
=
(
struct
fwnode_handle
*
)
name
;
fwspec
.
param_count
=
1
;
d
=
irq_find_matching_fwspec
(
&
fwspec
,
DOMAIN_BUS_ANY
);
return
d
;
}
static
inline
struct
wrn_dev
*
wrn_from_pdev
(
struct
platform_device
*
pdev
)
{
#if WR_IS_SWITCH
...
...
@@ -64,25 +41,6 @@ static int wrn_remove(struct platform_device *pdev)
{
struct
wrn_dev
*
wrn
=
wrn_from_pdev
(
pdev
);
int
i
,
irq
;
struct
irq_domain
*
irqdomain
;
char
*
irqdomain_name
;
struct
resource
*
r
;
r
=
platform_get_resource
(
pdev
,
IORESOURCE_BUS
,
0
);
irqdomain_name
=
kasprintf
(
GFP_KERNEL
,
"%s-%d:%d"
,
HTVIC_IRQDOMAIN_NAME
,
(
unsigned
char
)
((
!
r
)
?
0
:
r
->
start
),
(
unsigned
int
)
((
!
r
)
?
0
:
r
->
end
));
irqdomain
=
irq_find_irqdomain
(
irqdomain_name
);
if
(
!
irqdomain
)
{
dev_err
(
&
pdev
->
dev
,
"The IRQ domain %s does not exist
\n
"
,
irqdomain_name
);
return
-
EINVAL
;
}
kfree
(
irqdomain_name
);
if
(
WR_IS_SWITCH
)
{
spin_lock
(
&
wrn
->
lock
);
...
...
@@ -113,8 +71,7 @@ static int wrn_remove(struct platform_device *pdev)
for
(
i
=
0
;
wrn
->
irq_registered
;
i
++
)
{
static
int
irqs
[]
=
WRN_IRQ_NUMBERS
;
if
(
wrn
->
irq_registered
&
(
1
<<
i
))
{
irq
=
irq_find_mapping
(
irqdomain
,
irqs
[
i
]);
free_irq
(
irq
,
wrn
);
free_irq
(
irqs
[
i
],
wrn
);
}
wrn
->
irq_registered
&=
~
(
1
<<
i
);
}
...
...
@@ -124,7 +81,7 @@ static int wrn_remove(struct platform_device *pdev)
res
=
platform_get_resource
(
pdev
,
IORESOURCE_IRQ
,
i
);
if
(
!
res
)
continue
;
irq
=
irq_find_mapping
(
irqdomain
,
res
->
start
)
;
irq
=
res
->
start
;
free_irq
(
irq
,
wrn
);
wrn
->
irq_registered
&=
~
(
1
<<
i
);
}
...
...
@@ -165,7 +122,7 @@ static int __wrn_map_resources(struct platform_device *pdev)
}
/* This helper is used by probe below */
static
int
__wrn_map_irq
(
struct
platform_device
*
pdev
,
struct
irq_domain
*
irqdomain
)
static
int
__wrn_map_irq
(
struct
platform_device
*
pdev
)
{
int
i
;
struct
resource
*
res
;
...
...
@@ -180,7 +137,7 @@ static int __wrn_map_irq(struct platform_device *pdev, struct irq_domain *irqdom
if
(
WR_IS_SWITCH
)
{
/* Register the interrupt handlers (not shared) */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
irq_names
);
i
++
)
{
irq
=
irq
_find_mapping
(
irqdomain
,
irqs
[
i
])
;
irq
=
irq
s
[
i
]
;
err
=
request_any_context_irq
(
irq
,
irq_handlers
[
i
],
IRQF_TRIGGER_LOW
,
irq_names
[
i
],
wrn
);
if
(
err
<
0
)
...
...
@@ -193,7 +150,7 @@ static int __wrn_map_irq(struct platform_device *pdev, struct irq_domain *irqdom
res
=
platform_get_resource
(
pdev
,
IORESOURCE_IRQ
,
i
);
if
(
!
res
)
continue
;
irq
=
irq_find_mapping
(
irqdomain
,
res
->
start
)
;
irq
=
res
->
start
;
err
=
request_any_context_irq
(
irq
,
irq_handlers
[
i
],
IRQF_TRIGGER_HIGH
,
res
->
name
,
wrn
);
...
...
@@ -214,25 +171,6 @@ static int wrn_probe(struct platform_device *pdev)
struct
wrn_ep
*
ep
;
struct
wrn_dev
*
wrn
=
wrn_from_pdev
(
pdev
);
int
i
,
err
=
0
;
struct
irq_domain
*
irqdomain
;
char
*
irqdomain_name
;
struct
resource
*
r
;
r
=
platform_get_resource
(
pdev
,
IORESOURCE_BUS
,
0
);
irqdomain_name
=
kasprintf
(
GFP_KERNEL
,
"%s-%d:%d"
,
HTVIC_IRQDOMAIN_NAME
,
(
unsigned
char
)
((
!
r
)
?
0
:
r
->
start
),
(
unsigned
int
)
((
!
r
)
?
0
:
r
->
end
));
irqdomain
=
irq_find_irqdomain
(
irqdomain_name
);
if
(
!
irqdomain
)
{
dev_err
(
&
pdev
->
dev
,
"The IRQ domain %s does not exist
\n
"
,
irqdomain_name
);
return
-
EINVAL
;
}
kfree
(
irqdomain_name
);
/* No need to lock_irq: we only protect count and continue unlocked */
if
(
WR_IS_SWITCH
)
{
...
...
@@ -258,7 +196,7 @@ static int wrn_probe(struct platform_device *pdev)
tasklet_init
(
&
wrn
->
rx_tlet
,
wrn_rx_interrupt
,
(
unsigned
long
)
wrn
);
;
/* Map our interrupts */
if
(
(
err
=
__wrn_map_irq
(
pdev
,
irqdomain
))
)
if
(
(
err
=
__wrn_map_irq
(
pdev
))
)
goto
out
;
/* Finally, register one interface per endpoint */
...
...
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