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
66939603
Commit
66939603
authored
Apr 24, 2019
by
Miguel Jimenez Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Make changes for the WR node configuration.
Currently, only SPEC board is supported.
parent
8549bcd1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
15 deletions
+58
-15
device.c
sw/kernel/device.c
+51
-15
module.c
sw/kernel/module.c
+7
-0
No files found.
sw/kernel/device.c
View file @
66939603
...
...
@@ -30,7 +30,11 @@
* a module parameter or somehow configurable. For the time being we keep
* it hard-coded here.
*/
#if WR_IS_SWITCH
static
const
char
*
irqdomain_name
=
"htvic-wr-swi.0"
;
#else
static
const
char
*
irqdomain_name
=
"htvic-spec.0"
;
#endif
static
inline
struct
wrn_dev
*
wrn_from_pdev
(
struct
platform_device
*
pdev
)
{
...
...
@@ -117,17 +121,53 @@ static int __wrn_map_resources(struct platform_device *pdev)
return
0
;
}
static
int
wrn_probe
(
struct
platform_device
*
pdev
)
/* This helper is used by probe below */
static
int
__wrn_map_irq
(
struct
platform_device
*
pdev
,
struct
irq_domain
*
irqdomain
)
{
struct
net_device
*
netdev
;
struct
wrn_ep
*
ep
;
int
i
;
struct
resource
*
res
;
struct
wrn_dev
*
wrn
=
wrn_from_pdev
(
pdev
);
int
i
,
err
=
0
,
irq
;
int
err
=
0
,
irq
;
/* Lazily: irqs are not in the resource list */
static
int
irqs
[]
=
WRN_IRQ_NUMBERS
;
static
char
*
irq_names
[]
=
WRN_IRQ_NAMES
;
static
irq_handler_t
irq_handlers
[]
=
WRN_IRQ_HANDLERS
;
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
]);
err
=
request_irq
(
irq
,
irq_handlers
[
i
],
IRQF_TRIGGER_LOW
,
irq_names
[
i
],
wrn
);
if
(
err
)
break
;
wrn
->
irq_registered
|=
1
<<
i
;
}
}
else
{
/* Register the interrupt handlers (not shared) */
for
(
i
=
0
;
i
<
pdev
->
num_resources
;
i
++
)
{
res
=
platform_get_resource
(
pdev
,
IORESOURCE_IRQ
,
i
);
if
(
!
res
)
continue
;
irq
=
irq_find_mapping
(
irqdomain
,
res
->
start
);
err
=
request_irq
(
irq
,
irq_handlers
[
i
],
IRQF_TRIGGER_LOW
,
res
->
name
,
wrn
);
if
(
err
)
break
;
wrn
->
irq_registered
|=
1
<<
i
;
}
}
return
err
;
}
static
int
wrn_probe
(
struct
platform_device
*
pdev
)
{
struct
net_device
*
netdev
;
struct
wrn_ep
*
ep
;
struct
wrn_dev
*
wrn
=
wrn_from_pdev
(
pdev
);
int
i
,
err
=
0
;
struct
irq_domain
*
irqdomain
;
irqdomain
=
irq_find_host
((
struct
device_node
*
)
irqdomain_name
);
...
...
@@ -162,17 +202,9 @@ static int wrn_probe(struct platform_device *pdev)
printk
(
"regs %p, txd %p, rxd %p, buffer %p
\n
"
,
wrn
->
regs
,
wrn
->
txd
,
wrn
->
rxd
,
wrn
->
databuf
);
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
]);
err
=
request_irq
(
irq
,
irq_handlers
[
i
],
IRQF_TRIGGER_LOW
,
irq_names
[
i
],
wrn
);
if
(
err
)
goto
out
;
wrn
->
irq_registered
|=
1
<<
i
;
}
}
/* Map our interrupts */
if
(
(
err
=
__wrn_map_irq
(
pdev
,
irqdomain
))
)
goto
out
;
/* Finally, register one interface per endpoint */
memset
(
wrn
->
dev
,
0
,
sizeof
(
wrn
->
dev
));
...
...
@@ -254,7 +286,11 @@ struct platform_driver wrn_driver = {
.
remove
=
wrn_remove
,
/* not __exit_p as probe calls it */
/* No suspend or resume by now */
.
driver
=
{
#if WR_IS_SWITCH
.
name
=
KBUILD_MODNAME
,
#else
.
name
=
"spec-nic"
,
#endif
.
owner
=
THIS_MODULE
,
},
};
sw/kernel/module.c
View file @
66939603
...
...
@@ -19,9 +19,11 @@
#include "wr-nic.h"
/* Our platform data is actually the device itself, and we have 1 only */
static
struct
wrn_dev
wrn_dev
;
#if WR_IS_SWITCH
/* The WRN_RES_ names are defined in the header file. Each block 64kB */
#define __RES(name_) { \
.start = FPGA_BASE_ ## name_, \
...
...
@@ -55,6 +57,7 @@ static struct platform_device wrn_device = {
/* dma_mask not used, as we make no DMA */
},
};
#endif
/*
* Module init and exit stuff. Here we register the platform data
...
...
@@ -68,7 +71,9 @@ int __init wrn_init(void)
/* A few fields must be initialized at run time */
spin_lock_init
(
&
wrn_dev
.
lock
);
#if WR_IS_SWITCH
platform_device_register
(
&
wrn_device
);
#endif
platform_driver_register
(
&
wrn_driver
);
return
0
;
}
...
...
@@ -76,7 +81,9 @@ int __init wrn_init(void)
void
__exit
wrn_exit
(
void
)
{
platform_driver_unregister
(
&
wrn_driver
);
#if WR_IS_SWITCH
platform_device_unregister
(
&
wrn_device
);
#endif
return
;
}
...
...
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