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
7f442491
Commit
7f442491
authored
12 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
reprogram is complete and cast in stone
parent
86c0d5f7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
kernel/fmc-trivial.c
+7
-6
7 additions, 6 deletions
kernel/fmc-trivial.c
kernel/include/linux/fmc.h
+5
-4
5 additions, 4 deletions
kernel/include/linux/fmc.h
kernel/spec-fmc.c
+11
-4
11 additions, 4 deletions
kernel/spec-fmc.c
kernel/wr-nic-core.c
+3
-1
3 additions, 1 deletion
kernel/wr-nic-core.c
with
26 additions
and
15 deletions
kernel/fmc-trivial.c
+
7
−
6
View file @
7f442491
...
...
@@ -5,9 +5,6 @@
#include
<linux/fmc.h>
#include
"spec.h"
static
char
*
t_filename
;
module_param_named
(
file
,
t_filename
,
charp
,
0444
);
static
struct
fmc_driver
t_drv
;
/* initialized later */
irqreturn_t
t_handler
(
int
irq
,
void
*
dev_id
)
...
...
@@ -32,8 +29,10 @@ int t_probe(struct fmc_device *fmc)
if
(
ret
<
0
)
return
ret
;
/* Reprogram, but only if specified in the arguments */
ret
=
fmc
->
op
->
reprogram
(
fmc
,
""
);
/* Reprogram, if asked to. ESRCH == no filename specified */
ret
=
fmc
->
op
->
reprogram
(
fmc
,
&
t_drv
,
""
);
if
(
ret
==
-
ESRCH
)
ret
=
0
;
if
(
ret
<
0
)
fmc
->
op
->
irq_free
(
fmc
);
...
...
@@ -54,7 +53,9 @@ static struct fmc_driver t_drv = {
/* no table, as the current match just matches everything */
};
FMC_MODULE_PARAMS
(
t_drv
);
/* We accept the generic parameters */
/* We accept the generic parameters */
FMC_PARAM_BUSID
(
t_drv
);
FMC_PARAM_GATEWARE
(
t_drv
);
static
int
t_init
(
void
)
{
...
...
This diff is collapsed.
Click to expand it.
kernel/include/linux/fmc.h
+
5
−
4
View file @
7f442491
...
...
@@ -40,16 +40,17 @@ struct fmc_driver {
#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
/* These are the generic parameters, that drivers may instantiate */
#define FMC_MODULE_PARAMS(_d) \
module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0400); \
module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0400)
#define FMC_PARAM_BUSID(_d) \
module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
#define FMC_PARAM_GATEWARE(_d) \
module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
/* To be carrier-independent, we need to abstract hardware access */
struct
fmc_operations
{
uint32_t
(
*
readl
)(
struct
fmc_device
*
fmc
,
int
offset
);
void
(
*
writel
)(
struct
fmc_device
*
fmc
,
uint32_t
value
,
int
offset
);
int
(
*
validate
)(
struct
fmc_device
*
fmc
,
struct
fmc_driver
*
drv
);
int
(
*
reprogram
)(
struct
fmc_device
*
f
mc
,
char
*
g
ateware
);
int
(
*
reprogram
)(
struct
fmc_device
*
f
,
struct
fmc_driver
*
d
,
char
*
g
w
);
int
(
*
irq_request
)(
struct
fmc_device
*
fmc
,
irq_handler_t
h
,
char
*
name
,
int
flags
);
void
(
*
irq_ack
)(
struct
fmc_device
*
fmc
);
...
...
This diff is collapsed.
Click to expand it.
kernel/spec-fmc.c
+
11
−
4
View file @
7f442491
...
...
@@ -34,7 +34,8 @@ static int spec_validate(struct fmc_device *fmc, struct fmc_driver *drv)
return
-
ENOENT
;
}
static
int
spec_reprogram
(
struct
fmc_device
*
fmc
,
char
*
gw
)
static
int
spec_reprogram
(
struct
fmc_device
*
fmc
,
struct
fmc_driver
*
drv
,
char
*
gw
)
{
const
struct
firmware
*
fw
;
struct
spec_dev
*
spec
=
fmc
->
carrier_data
;
...
...
@@ -44,11 +45,17 @@ static int spec_reprogram(struct fmc_device *fmc, char *gw)
if
(
!
gw
)
gw
=
spec_fw_name
;
if
(
!
strlen
(
gw
))
{
/* FIXME: use module parameters */
return
0
;
if
(
!
strlen
(
gw
))
{
/* use module parameters from the driver */
int
index
;
index
=
spec_validate
(
fmc
,
drv
);
gw
=
drv
->
gw_val
[
index
];
if
(
!
gw
)
return
-
ESRCH
;
/* the caller may accept this */
}
dev_info
(
fmc
->
hwdev
,
"reprogramming with %s
\n
"
,
gw
);
ret
=
request_firmware
(
&
fw
,
gw
,
dev
);
if
(
ret
<
0
)
{
dev_warn
(
dev
,
"request firmware
\"
%s
\"
: error %i
\n
"
,
gw
,
ret
);
...
...
This diff is collapsed.
Click to expand it.
kernel/wr-nic-core.c
+
3
−
1
View file @
7f442491
...
...
@@ -15,6 +15,8 @@
#include
"wr-nic.h"
#include
"spec.h"
static
struct
fmc_driver
wrn_drv
;
static
char
*
wrn_filename
=
WRN_GATEWARE_DEFAULT_NAME
;
module_param_named
(
file
,
wrn_filename
,
charp
,
0444
);
...
...
@@ -40,7 +42,7 @@ int wrn_probe(struct fmc_device *fmc)
fmc_set_drvdata
(
fmc
,
dd
);
/* We first write a new binary (and lm32) within the spec */
ret
=
fmc
->
op
->
reprogram
(
fmc
,
WRN_GATEWARE_DEFAULT_NAME
);
ret
=
fmc
->
op
->
reprogram
(
fmc
,
&
wrn_drv
,
WRN_GATEWARE_DEFAULT_NAME
);
if
(
ret
<
0
)
{
dev_err
(
dev
,
"write firmware
\"
%s
\"
: error %i
\n
"
,
wrn_filename
,
ret
);
...
...
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