Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
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 VME FMC Carrier SVEC
Commits
585ec687
Commit
585ec687
authored
Oct 22, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/spi-flash' into develop
parents
d34e46df
09d2745e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
Kbuild
software/kernel/Kbuild
+2
-2
Makefile
software/kernel/Makefile
+2
-0
svec-core-fpga.c
software/kernel/svec-core-fpga.c
+19
-10
No files found.
software/kernel/Kbuild
View file @
585ec687
...
...
@@ -18,10 +18,10 @@ ccflags-y += -I$(FPGA_MGR_ABS)/include
ccflags-$(CONFIG_FPGA_MGR_BACKPORT) += -DCONFIG_FPGA_MGR_BACKPORT
ccflags-y += -I$(FMC_ABS)/include
ccflags-y += -I$(I2C_ABS)/include
ccflags-y += -I$(SPI_ABS)/include
# priority to I2C headers from our sources
LINUXINCLUDE := -I$(FMC_ABS)/include -I$(FMC_ABS)/include/linux -I$(I2C_ABS)/include -I$(I2C_ABS)/include/linux $(LINUXINCLUDE)
LINUXINCLUDE := -I$(FMC_ABS)/include -I$(FMC_ABS)/include/linux -I$(I2C_ABS)/include -I$(I2C_ABS)/include/linux
-I$(SPI_ABS)/include -I$(SPI_ABS)/include/linux
$(LINUXINCLUDE)
ifeq ($(CONFIG_FPGA_MGR_BACKPORT), y)
FPGA_MGR_BACKPORT_INCLUDE := -I$(FPGA_MGR_ABS)/include
...
...
software/kernel/Makefile
View file @
585ec687
...
...
@@ -11,6 +11,7 @@ VMEBRIDGE_ABS ?= $(abspath $(VMEBRIDGE))
FPGA_MGR_ABS
?=
$
(
abspath
$(FPGA_MGR)
)
FMC_ABS
?=
$
(
abspath
$(FMC)
)
I2C_ABS
?=
$
(
abspath
$(I2C)
)
SPI_ABS
?=
$
(
abspath
$(SPI)
)
VERSION
=
$(
shell
git describe
--dirty
--long
--tags
)
...
...
@@ -38,4 +39,5 @@ modules help coccicheck modules_install: svec-core-fpga.h
CONFIG_FPGA_MGR_BACKPORT
=
$(CONFIG_FPGA_MGR_BACKPORT)
\
FMC_ABS
=
$(FMC_ABS)
\
I2C_ABS
=
$(I2C_ABS)
\
SPI_ABS
=
$(SPI_ABS)
\
$@
software/kernel/svec-core-fpga.c
View file @
585ec687
...
...
@@ -9,6 +9,7 @@
#include <linux/fpga/fpga-mgr.h>
#include <linux/types.h>
#include <linux/platform_data/i2c-ocores.h>
#include <linux/platform_data/spi-ocores.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/delay.h>
...
...
@@ -288,15 +289,17 @@ static struct resource svec_fpga_fmc_i2c_res[] = {
},
};
#define SVEC_FPGA_WB_CLK_HZ 62500000
#define SVEC_FPGA_WB_CLK_KHZ (SVEC_FPGA_WB_CLK_HZ / 1000)
static
struct
ocores_i2c_platform_data
svec_fpga_fmc_i2c_pdata
=
{
.
reg_shift
=
2
,
/* 32bit aligned */
.
reg_io_width
=
4
,
.
clock_khz
=
62500
,
.
clock_khz
=
SVEC_FPGA_WB_CLK_KHZ
,
.
big_endian
=
1
,
.
num_devices
=
0
,
.
devices
=
NULL
,
};
#if 0
static
struct
resource
svec_fpga_spi_res
[]
=
{
{
.
name
=
"spi-ocores-mem"
,
...
...
@@ -316,26 +319,25 @@ struct flash_platform_data svec_flash_pdata = {
.
name
=
"svec-flash"
,
.
parts
=
NULL
,
.
nr_parts
=
0
,
.type = "m25p
32
",
.
type
=
"m25p
128
"
,
};
static
struct
spi_board_info
svec_fpga_spi_devices_info
[]
=
{
{
.modalias = "m25p
32
",
.max_speed_hz =
75000000
,
.
modalias
=
"m25p
128
"
,
.
max_speed_hz
=
SVEC_FPGA_WB_CLK_HZ
/
4
,
.
chip_select
=
0
,
.
platform_data
=
&
svec_flash_pdata
,
}
};
static
struct
spi_ocores_platform_data
svec_fpga_spi_pdata
=
{
.big_endian =
0
,
.clock_hz =
65200000
,
.
big_endian
=
1
,
.
clock_hz
=
SVEC_FPGA_WB_CLK_HZ
,
.
num_devices
=
ARRAY_SIZE
(
svec_fpga_spi_devices_info
),
.
devices
=
svec_fpga_spi_devices_info
,
};
#endif
static
const
struct
mfd_cell
svec_fpga_mfd_devs
[]
=
{
[
SVEC_FPGA_MFD_FMC_I2C
]
=
{
.
name
=
"i2c-ohwr"
,
...
...
@@ -344,7 +346,6 @@ static const struct mfd_cell svec_fpga_mfd_devs[] = {
.
num_resources
=
ARRAY_SIZE
(
svec_fpga_fmc_i2c_res
),
.
resources
=
svec_fpga_fmc_i2c_res
,
},
#if 0
[
SVEC_FPGA_MFD_SPI
]
=
{
.
name
=
"spi-ocores"
,
.
platform_data
=
&
svec_fpga_spi_pdata
,
...
...
@@ -352,7 +353,6 @@ static const struct mfd_cell svec_fpga_mfd_devs[] = {
.
num_resources
=
ARRAY_SIZE
(
svec_fpga_spi_res
),
.
resources
=
svec_fpga_spi_res
,
},
#endif
};
static
inline
size_t
__fpga_mfd_devs_size
(
void
)
...
...
@@ -368,6 +368,7 @@ static int svec_fpga_devices_init(struct svec_fpga *svec_fpga)
struct
irq_domain
*
vic_domain
;
unsigned
int
n_mfd
=
0
;
int
err
;
struct
svec_dev
*
svec_dev
=
dev_get_drvdata
(
svec_fpga
->
dev
.
parent
);
fpga_mfd_devs
=
devm_kzalloc
(
&
svec_fpga
->
dev
,
__fpga_mfd_devs_size
(),
...
...
@@ -378,7 +379,14 @@ static int svec_fpga_devices_init(struct svec_fpga *svec_fpga)
memcpy
(
&
fpga_mfd_devs
[
n_mfd
],
&
svec_fpga_mfd_devs
[
SVEC_FPGA_MFD_FMC_I2C
],
sizeof
(
fpga_mfd_devs
[
n_mfd
]));
n_mfd
++
;
if
(
svec_dev
->
meta
.
cap
&
SVEC_META_CAP_SPI
)
{
memcpy
(
&
fpga_mfd_devs
[
n_mfd
],
&
svec_fpga_mfd_devs
[
SVEC_FPGA_MFD_SPI
],
sizeof
(
fpga_mfd_devs
[
n_mfd
]));
n_mfd
++
;
}
vic_domain
=
svec_fpga_irq_find_host
((
void
*
)
&
svec_fpga
->
vic_pdev
->
dev
);
if
(
!
vic_domain
)
{
...
...
@@ -386,6 +394,7 @@ static int svec_fpga_devices_init(struct svec_fpga *svec_fpga)
fpga_mfd_devs
[
0
].
num_resources
=
1
;
/* FMC I2C */
fpga_mfd_devs
[
1
].
num_resources
=
1
;
/* SPI */
}
err
=
mfd_add_devices
(
&
svec_fpga
->
dev
,
PLATFORM_DEVID_AUTO
,
fpga_mfd_devs
,
n_mfd
,
&
vdev
->
resource
[
svec_fpga
->
function_nr
],
...
...
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