Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
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
Commits
e4966784
Commit
e4966784
authored
Jun 26, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: find MFD by name and id
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
1063ce13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
15 deletions
+31
-15
spec-compat.c
software/kernel/spec-compat.c
+29
-12
spec-compat.h
software/kernel/spec-compat.h
+1
-2
spec-core.c
software/kernel/spec-core.c
+1
-1
No files found.
software/kernel/spec-compat.c
View file @
e4966784
...
...
@@ -90,33 +90,50 @@ static int __compat_spec_fw_load(struct fpga_manager *mgr, const char *name)
#endif
}
struct
mfd_find_data
{
const
char
*
name
;
int
id
;
};
static
int
mfd_find_device_match
(
struct
device
*
dev
,
void
*
data
)
{
struct
mfd_
cell
*
cell
=
data
;
struct
mfd_
find_data
*
d
=
data
;
struct
platform_device
*
pdev
=
to_platform_device
(
dev
);
return
(
strncmp
(
cell
->
name
,
mfd_get_cell
(
pdev
)
->
name
,
strnlen
(
cell
->
name
,
32
))
==
0
);
if
(
strncmp
(
d
->
name
,
mfd_get_cell
(
pdev
)
->
name
,
strnlen
(
d
->
name
,
32
))
!=
0
)
return
0
;
if
(
d
->
id
>=
0
&&
pdev
->
id
!=
d
->
id
)
return
0
;
return
1
;
}
static
struct
device
*
mfd_find_device
(
struct
device
*
parent
,
const
struct
mfd_cell
*
cell
)
static
struct
platform_device
*
mfd_find_device
(
struct
device
*
parent
,
const
char
*
name
,
int
id
)
{
return
device_find_child
(
parent
,
(
void
*
)
cell
,
mfd_find_device_match
);
struct
mfd_find_data
d
=
{
name
,
id
};
struct
device
*
dev
;
dev
=
device_find_child
(
parent
,
(
void
*
)
&
d
,
mfd_find_device_match
);
if
(
!
dev
)
return
NULL
;
return
to_platform_device
(
dev
);
}
int
compat_spec_fw_load
(
struct
spec_dev
*
spec
,
const
struct
mfd_cell
*
cell
,
const
char
*
name
)
int
compat_spec_fw_load
(
struct
spec_dev
*
spec
,
const
char
*
name
)
{
struct
fpga_manager
*
mgr
;
struct
device
*
fpga_
dev
;
struct
platform_device
*
fpga_p
dev
;
int
err
;
fpga_
dev
=
mfd_find_device
(
&
spec
->
dev
,
cell
);
if
(
!
fpga_dev
)
fpga_
pdev
=
mfd_find_device
(
&
spec
->
dev
,
"gn412x-fcl"
,
-
1
);
if
(
!
fpga_
p
dev
)
return
-
ENODEV
;
mgr
=
fpga_mgr_get
(
fpga_
dev
);
mgr
=
fpga_mgr_get
(
&
fpga_pdev
->
dev
);
if
(
IS_ERR
(
mgr
))
return
-
ENODEV
;
...
...
software/kernel/spec-compat.h
View file @
e4966784
...
...
@@ -49,8 +49,7 @@ int compat_spec_fpga_write_complete(struct fpga_manager *mgr,
#endif
int
compat_get_fpga_last_word_size
(
struct
fpga_image_info
*
info
,
size_t
count
);
int
compat_spec_fw_load
(
struct
spec_dev
*
spec
,
const
struct
mfd_cell
*
cell
,
const
char
*
name
);
int
compat_spec_fw_load
(
struct
spec_dev
*
spec
,
const
char
*
name
);
#if KERNEL_VERSION(3, 11, 0) > LINUX_VERSION_CODE
#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
...
...
software/kernel/spec-core.c
View file @
e4966784
...
...
@@ -129,7 +129,7 @@ int spec_fw_load(struct spec_dev *spec, const char *name)
spec_gpio_fpga_select
(
spec
,
SPEC_FPGA_SELECT_GN4124
);
err
=
compat_spec_fw_load
(
spec
,
&
spec_mfd_devs
[
SPEC_MFD_GN412X_FCL
],
name
);
err
=
compat_spec_fw_load
(
spec
,
name
);
if
(
err
)
goto
out
;
...
...
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