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
eb1b49c3
Commit
eb1b49c3
authored
Aug 02, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmc-write-eeprom: use busid for multi-card environments
parent
7f442491
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
fmc-write-eeprom.c
kernel/fmc-write-eeprom.c
+28
-20
No files found.
kernel/fmc-write-eeprom.c
View file @
eb1b49c3
...
...
@@ -17,10 +17,17 @@
/*
* This module uses the firmware loader to program the whole or part
* of the FMC eeprom. The meat is in the _run functions. However, no
* default file name is provided, to avoid accidental mishaps.
* default file name is provided, to avoid accidental mishaps. Also,
* you must pass the busid argument
*/
static
char
*
fwe_file
;
module_param_named
(
file
,
fwe_file
,
charp
,
444
);
static
struct
fmc_driver
fwe_drv
;
FMC_PARAM_BUSID
(
fwe_drv
);
/* The "file=" is like the generic "gateware=" used elsewhere */
static
char
*
fwe_file
[
FMC_MAX_CARDS
];
static
int
fwe_file_n
;
module_param_array_named
(
file
,
fwe_file
,
charp
,
&
fwe_file_n
,
444
);
static
int
fwe_run_tlv
(
struct
fmc_device
*
fmc
,
const
struct
firmware
*
fw
,
int
write
)
...
...
@@ -72,9 +79,9 @@ static int fwe_run_bin(struct fmc_device *fmc, const struct firmware *fw)
return
0
;
}
static
int
fwe_run
(
struct
fmc_device
*
fmc
,
const
struct
firmware
*
fw
)
static
int
fwe_run
(
struct
fmc_device
*
fmc
,
const
struct
firmware
*
fw
,
char
*
s
)
{
char
*
last4
=
fwe_file
+
strlen
(
fwe_file
)
-
4
;
char
*
last4
=
s
+
strlen
(
s
)
-
4
;
int
err
;
if
(
!
strcmp
(
last4
,
".bin"
))
...
...
@@ -85,41 +92,42 @@ static int fwe_run(struct fmc_device *fmc, const struct firmware *fw)
err
=
fwe_run_tlv
(
fmc
,
fw
,
1
);
return
err
;
}
dev_err
(
fmc
->
hwdev
,
"invalid file name
\"
%s
\"\n
"
,
fwe_file
);
dev_err
(
fmc
->
hwdev
,
"invalid file name
\"
%s
\"\n
"
,
s
);
return
-
EINVAL
;
}
/*
* Programming is done at probe time. Morever, if more than one FMC
* Programming is done at probe time. Morever, only those listed with
* busid= are programmed.
* card is probed for, only one is programmed. Unfortunately, it's
* difficult to know in advance when probing the first card if others
* are there.
*/
int
fwe_probe
(
struct
fmc_device
*
fmc
)
{
int
err
;
static
int
done
;
int
err
,
index
;
const
struct
firmware
*
fw
;
struct
device
*
dev
=
fmc
->
hwdev
;
char
*
s
;
if
(
!
fwe_
file
)
{
dev_err
(
dev
,
"%s: no
filename given: not programming
\n
"
,
if
(
!
fwe_
drv
.
busid_n
)
{
dev_err
(
dev
,
"%s: no
busid passed, refusing all cards
\n
"
,
KBUILD_MODNAME
);
return
-
ENO
ENT
;
return
-
ENO
DEV
;
}
if
(
done
)
{
dev_err
(
dev
,
"%s: refusing to program another card
\n
"
,
index
=
fmc
->
op
->
validate
(
fmc
,
&
fwe_drv
);
s
=
fwe_file
[
index
];
if
(
!
s
)
{
dev_err
(
dev
,
"%s: no filename given: not programming
\n
"
,
KBUILD_MODNAME
);
return
-
E
AGAIN
;
return
-
E
NOENT
;
}
done
++
;
/* we are starting with this board, don't do any more */
err
=
request_firmware
(
&
fw
,
fwe_file
,
dev
);
err
=
request_firmware
(
&
fw
,
s
,
dev
);
if
(
err
<
0
)
{
dev_err
(
dev
,
"request firmware
\"
%s
\"
: error %i
\n
"
,
fwe_file
,
err
);
dev_err
(
dev
,
"request firmware
\"
%s
\"
: error %i
\n
"
,
s
,
err
);
return
err
;
}
fwe_run
(
fmc
,
fw
);
fwe_run
(
fmc
,
fw
,
s
);
release_firmware
(
fw
);
return
0
;
}
...
...
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