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
a98296a1
Commit
a98296a1
authored
Jun 26, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: re-write get/set for bootselect
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
71d631a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
23 deletions
+35
-23
spec-core.c
software/kernel/spec-core.c
+2
-2
spec-gpio.c
software/kernel/spec-gpio.c
+20
-12
spec.h
software/kernel/spec.h
+13
-9
No files found.
software/kernel/spec-core.c
View file @
a98296a1
...
...
@@ -127,7 +127,7 @@ int spec_fw_load(struct spec_dev *spec, const char *name)
}
spec_gpio_fpga_select
(
spec
,
SPEC_FPGA_SELECT_GN4124
);
spec_gpio_fpga_select
_set
(
spec
,
SPEC_FPGA_SELECT_GN4124_FPGA
);
err
=
compat_spec_fw_load
(
spec
,
name
);
if
(
err
)
...
...
@@ -138,7 +138,7 @@ int spec_fw_load(struct spec_dev *spec, const char *name)
dev_warn
(
&
spec
->
dev
,
"FPGA incorrectly programmed
\n
"
);
out:
spec_gpio_fpga_select
(
spec
,
SPEC_FPGA_SELECT
_FLASH
);
spec_gpio_fpga_select
_set
(
spec
,
SPEC_FPGA_SELECT_FPGA
_FLASH
);
return
err
;
}
...
...
software/kernel/spec-gpio.c
View file @
a98296a1
...
...
@@ -8,26 +8,34 @@
#include "spec.h"
#include "spec-compat.h"
void
spec_gpio_fpga_select
(
struct
spec_dev
*
spec
,
enum
spec_fpga_select
sel
)
void
spec_gpio_fpga_select_set
(
struct
spec_dev
*
spec
,
enum
spec_fpga_select
sel
)
{
switch
(
sel
)
{
case
SPEC_FPGA_SELECT_FLASH
:
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL0
],
1
);
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL1
],
1
);
break
;
case
SPEC_FPGA_SELECT_GN4124
:
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL0
],
1
);
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL1
],
0
);
break
;
case
SPEC_FPGA_SELECT_SPI
:
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL0
],
0
);
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL1
],
0
);
case
SPEC_FPGA_SELECT_FPGA_FLASH
:
case
SPEC_FPGA_SELECT_GN4124_FPGA
:
case
SPEC_FPGA_SELECT_GN4124_FLASH
:
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL0
],
!!
(
sel
&
0x1
));
gpiod_set_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL1
],
!!
(
sel
&
0x2
));
break
;
default:
break
;
}
}
enum
spec_fpga_select
spec_gpio_fpga_select_get
(
struct
spec_dev
*
spec
)
{
enum
spec_fpga_select
sel
=
0
;
sel
|=
!!
gpiod_get_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL1
])
<<
1
;
sel
|=
!!
gpiod_get_value
(
spec
->
gpiod
[
GN4124_GPIO_BOOTSEL0
])
<<
0
;
return
sel
;
}
static
const
struct
gpiod_lookup_table
spec_gpiod_table
=
{
.
table
=
{
GPIO_LOOKUP_IDX
(
"gn412x-gpio"
,
GN4124_GPIO_BOOTSEL0
,
...
...
software/kernel/spec.h
View file @
a98296a1
...
...
@@ -45,15 +45,17 @@
#define GN4124_GPIO_SDA 4
/**
* @SPEC_FPGA_SELECT_FLASH: (default) the FPGA takes its configuration from
* flash
* @SPEC_FPGA_SELECT_GN4124: the FPGA takes its configuration from GN4124
* @SPEC_FPGA_SELECT_SPI: the SPI flash is accessible from GN4124
* @SPEC_FPGA_SELECT_FPGA_FLASH: (default) the FPGA is an SPI master that can
* access the flash (at boot it takes its
* configuration from flash)
* @SPEC_FPGA_SELECT_GN4124_FPGA: the GN4124 can configure the FPGA
* @SPEC_FPGA_SELECT_GN4124_FLASH: the GN4124 is an SPI master that can access
* the flash
*/
enum
spec_fpga_select
{
SPEC_FPGA_SELECT_F
LASH
=
0
,
SPEC_FPGA_SELECT_GN4124
,
SPEC_FPGA_SELECT_
SPI
,
SPEC_FPGA_SELECT_F
PGA_FLASH
=
0x3
,
SPEC_FPGA_SELECT_GN4124
_FPGA
=
0x1
,
SPEC_FPGA_SELECT_
GN4124_FLASH
=
0x0
,
};
...
...
@@ -188,8 +190,10 @@ extern void spec_dbg_exit(struct spec_dev *spec);
extern
int
spec_fmc_init
(
struct
spec_dev
*
spec
);
extern
int
spec_fmc_exit
(
struct
spec_dev
*
spec
);
extern
void
spec_gpio_fpga_select
(
struct
spec_dev
*
spec
,
enum
spec_fpga_select
sel
);
extern
void
spec_gpio_fpga_select_set
(
struct
spec_dev
*
spec
,
enum
spec_fpga_select
sel
);
extern
enum
spec_fpga_select
spec_gpio_fpga_select_get
(
struct
spec_dev
*
spec
);
extern
int
spec_gpio_init
(
struct
spec_dev
*
spec
);
extern
void
spec_gpio_exit
(
struct
spec_dev
*
spec
);
...
...
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