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
d851f7a6
Commit
d851f7a6
authored
Sep 20, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: checkpatch fixes
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
b47e6edf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
47 deletions
+46
-47
spec-compat.c
software/kernel/spec-compat.c
+5
-2
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+30
-26
spec-core.c
software/kernel/spec-core.c
+1
-1
spec-gn412x-dma.c
software/kernel/spec-gn412x-dma.c
+9
-17
spec.h
software/kernel/spec.h
+1
-1
No files found.
software/kernel/spec-compat.c
View file @
d851f7a6
...
...
@@ -46,6 +46,7 @@ static int fpga_mgr_dev_match(struct device *dev, const void *data)
return
dev
->
parent
==
data
;
}
#define FPGA_CLASS "fpga_mgr_class"
/**
* fpga_mgr_get - get an exclusive reference to a fpga mgr
* @dev:parent device that fpga mgr was registered with
...
...
@@ -56,10 +57,12 @@ static int fpga_mgr_dev_match(struct device *dev, const void *data)
*/
struct
fpga_manager
*
fpga_mgr_get
(
struct
device
*
dev
)
{
struct
class
*
fpga_mgr_class
=
(
struct
class
*
)
kallsyms_lookup_name
(
"fpga_mgr_class"
)
;
struct
class
*
fpga_mgr_class
;
struct
device
*
mgr_dev
;
mgr_dev
=
class_find_device
(
fpga_mgr_class
,
NULL
,
dev
,
fpga_mgr_dev_match
);
fpga_mgr_class
=
(
struct
class
*
)
kallsyms_lookup_name
(
FPGA_CLASS
);
mgr_dev
=
class_find_device
(
fpga_mgr_class
,
NULL
,
dev
,
fpga_mgr_dev_match
);
if
(
!
mgr_dev
)
return
ERR_PTR
(
-
ENODEV
);
...
...
software/kernel/spec-core-fpga.c
View file @
d851f7a6
...
...
@@ -93,7 +93,7 @@ static int spec_fpga_dbg_bld_info(struct seq_file *s, void *offset)
}
for
(
off
=
SPEC_BASE_REGS_BUILDINFO
;
off
<
SPEC_BASE_REGS_BUILDINFO
+
SPEC_BASE_REGS_BUILDINFO_SIZE
-
1
;
off
<
SPEC_BASE_REGS_BUILDINFO
+
SPEC_BASE_REGS_BUILDINFO_SIZE
-
1
;
off
++
)
{
char
tmp
=
ioread8
(
spec_fpga
->
fpga
+
off
);
...
...
@@ -113,7 +113,7 @@ static int spec_fpga_dbg_bld_info_open(struct inode *inode,
return
single_open
(
file
,
spec_fpga_dbg_bld_info
,
spec
);
}
static
const
struct
file_operations
spec_fpga_dbg_bld_
info_
ops
=
{
static
const
struct
file_operations
spec_fpga_dbg_bld_ops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
spec_fpga_dbg_bld_info_open
,
.
read
=
seq_read
,
...
...
@@ -151,12 +151,13 @@ static int spec_fpga_dbg_init(struct spec_fpga *spec_fpga)
goto
err
;
}
spec_fpga
->
dbg_bld_info
=
debugfs_create_file
(
SPEC_DBG_BLD_INFO_NAME
,
0444
,
spec_fpga
->
dbg_dir_fpga
,
spec_fpga
,
&
spec_fpga_dbg_bld_info_ops
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_bld_info
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_bld_info
);
spec_fpga
->
dbg_bld
=
debugfs_create_file
(
SPEC_DBG_BLD_INFO_NAME
,
0444
,
spec_fpga
->
dbg_dir_fpga
,
spec_fpga
,
&
spec_fpga_dbg_bld_ops
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_bld
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_bld
);
dev_err
(
&
spec_fpga
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_BLD_INFO_NAME
,
err
);
...
...
@@ -190,7 +191,7 @@ static struct resource spec_fpga_vic_res[] = {
.
name
=
"htvic-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
SPEC_BASE_REGS_VIC
,
.
end
=
SPEC_BASE_REGS_VIC
+
SPEC_BASE_REGS_VIC_SIZE
-
1
,
.
end
=
SPEC_BASE_REGS_VIC
+
SPEC_BASE_REGS_VIC_SIZE
-
1
,
},
{
.
name
=
"htvic-irq"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
...
...
@@ -276,7 +277,7 @@ static int spec_fpga_dma_init(struct spec_fpga *spec_fpga)
vic_domain
=
irq_find_host
((
void
*
)
&
spec_fpga
->
vic_pdev
->
dev
);
if
(
!
vic_domain
)
{
dev_err
(
&
spec_fpga
->
dev
,
"Failed to load DMA engine:
missing can't find VIC.
\n
"
);
"Failed to load DMA engine:
can't find VIC
\n
"
);
return
-
ENODEV
;
}
...
...
@@ -314,7 +315,8 @@ static struct resource spec_fpga_fmc_i2c_res[] = {
.
name
=
"i2c-ocores-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
SPEC_BASE_REGS_FMC_I2C
,
.
end
=
SPEC_BASE_REGS_FMC_I2C
+
SPEC_BASE_REGS_FMC_I2C_SIZE
-
1
,
.
end
=
SPEC_BASE_REGS_FMC_I2C
+
SPEC_BASE_REGS_FMC_I2C_SIZE
-
1
,
},
{
.
name
=
"i2c-ocores-irq"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
...
...
@@ -339,7 +341,8 @@ static struct resource spec_fpga_spi_res[] = {
.
name
=
"spi-ocores-mem"
,
.
flags
=
IORESOURCE_MEM
,
.
start
=
SPEC_BASE_REGS_FLASH_SPI
,
.
end
=
SPEC_BASE_REGS_FLASH_SPI
+
SPEC_BASE_REGS_FLASH_SPI_SIZE
-
1
,
.
end
=
SPEC_BASE_REGS_FLASH_SPI
+
SPEC_BASE_REGS_FLASH_SPI_SIZE
-
1
,
},
{
.
name
=
"spi-ocores-irq"
,
.
flags
=
IORESOURCE_IRQ
|
IORESOURCE_IRQ_HIGHLEVEL
,
...
...
@@ -461,14 +464,14 @@ static ssize_t temperature_show(struct device *dev,
struct
spec_fpga
*
spec_fpga
=
to_spec_fpga
(
dev
);
if
(
spec_fpga
->
meta
->
cap
&
SPEC_META_CAP_THERM
)
{
uint32_t
temp
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_TEMP
);
uint32_t
temp
;
temp
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_TEMP
);
return
snprintf
(
buf
,
PAGE_SIZE
,
"%d.%d C
\n
"
,
temp
/
16
,
(
temp
&
0xF
)
*
1000
/
16
);
}
else
{
return
snprintf
(
buf
,
PAGE_SIZE
,
"-.- C
\n
"
);
}
return
snprintf
(
buf
,
PAGE_SIZE
,
"-.- C
\n
"
);
}
static
DEVICE_ATTR_RO
(
temperature
);
...
...
@@ -479,14 +482,14 @@ static ssize_t serial_number_show(struct device *dev,
struct
spec_fpga
*
spec_fpga
=
to_spec_fpga
(
dev
);
if
(
spec_fpga
->
meta
->
cap
&
SPEC_META_CAP_THERM
)
{
uint32_t
msb
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_SERID_MSB
);
uint32_t
lsb
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_SERID_LSB
);
uint32_t
msb
,
lsb
;
msb
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_SERID_MSB
);
lsb
=
ioread32
(
spec_fpga
->
fpga
+
SPEC_FPGA_THERM_SERID_LSB
);
return
snprintf
(
buf
,
PAGE_SIZE
,
"0x%08x%08x
\n
"
,
msb
,
lsb
);
}
else
{
return
snprintf
(
buf
,
PAGE_SIZE
,
"0x----------------
\n
"
);
}
return
snprintf
(
buf
,
PAGE_SIZE
,
"0x----------------
\n
"
);
}
static
DEVICE_ATTR_RO
(
serial_number
);
...
...
@@ -575,7 +578,7 @@ static ssize_t reset_app_store(struct device *dev,
return
count
;
}
static
DEVICE_ATTR
(
reset_app
,
0644
,
reset_app_show
,
reset_app_store
);
static
DEVICE_ATTR
_RW
(
reset_app
);
static
struct
attribute
*
spec_fpga_csr_attrs
[]
=
{
&
dev_attr_pcb_rev
.
attr
,
...
...
@@ -689,16 +692,17 @@ static int spec_fpga_app_id_build(struct spec_fpga *spec_fpga,
unsigned
long
app_off
,
char
*
id
,
unsigned
int
size
)
{
uint32_t
vendor
=
ioread32be
(
spec_fpga
->
fpga
+
app_off
+
FPGA_META_VENDOR
);
uint32_t
device
=
ioread32be
(
spec_fpga
->
fpga
+
app_off
+
FPGA_META_DEVICE
);
uint32_t
vendor
,
device
;
vendor
=
ioread32be
(
spec_fpga
->
fpga
+
app_off
+
FPGA_META_VENDOR
);
device
=
ioread32be
(
spec_fpga
->
fpga
+
app_off
+
FPGA_META_DEVICE
);
memset
(
id
,
0
,
size
);
if
(
vendor
==
0xFF000000
)
{
dev_warn
(
&
spec_fpga
->
dev
,
"Vendor UUID not supported yet
\n
"
);
return
-
ENODEV
;
}
else
{
snprintf
(
id
,
size
,
"id:%4phN%4phN"
,
&
vendor
,
&
device
);
}
snprintf
(
id
,
size
,
"id:%4phN%4phN"
,
&
vendor
,
&
device
);
return
0
;
}
...
...
software/kernel/spec-core.c
View file @
d851f7a6
...
...
@@ -625,7 +625,7 @@ static ssize_t bootselect_show(struct device *dev,
return
-
EINVAL
;
}
}
static
DEVICE_ATTR
(
bootselect
,
0644
,
bootselect_show
,
bootselect_store
);
static
DEVICE_ATTR
_RW
(
bootselect
);
/**
* Load golden bitstream on FGPA
...
...
software/kernel/spec-gn412x-dma.c
View file @
d851f7a6
// SPDX-License-Identifier: GPL-2.0-or-later
/**
* Copyright (C) 2017 CERN (www.cern.ch)
* Author: Federico Vaga <federico.vaga@vaga.pv.it>
...
...
@@ -20,17 +21,6 @@
#include <linux/debugfs.h>
#include <linux/dma-mapping.h>
/* Kernel functions not exported */
#if 0
/*
* Take it from the sources, like if this driver was part
* of that directory
*/
#include <../drivers/dma/dmaengine.h>
#else
/**
* dma_cookie_complete - complete a descriptor
* @tx: descriptor to complete
...
...
@@ -102,7 +92,6 @@ static inline enum dma_status dma_cookie_status(struct dma_chan *chan,
}
return
dma_async_is_complete
(
cookie
,
complete
,
used
);
}
#endif
enum
gn412x_dma_regs
{
...
...
@@ -514,12 +503,13 @@ static struct dma_async_tx_descriptor *gn412x_dma_prep_slave_sg(
tx_hw
->
attribute
);
}
dev_dbg
(
&
chan
->
dev
->
device
,
"%s prepared %p
\n
"
,
__func__
,
&
gn412x_dma_tx
->
tx
);
dev_dbg
(
&
chan
->
dev
->
device
,
"%s prepared %p
\n
"
,
__func__
,
&
gn412x_dma_tx
->
tx
);
return
&
gn412x_dma_tx
->
tx
;
err_alloc_pool:
while
(
--
i
>=
0
)
while
(
--
i
>=
0
)
dma_pool_free
(
gn412x_dma
->
pool
,
gn412x_dma_tx
->
sgl_hw
[
i
],
gn412x_dma_tx
->
tx
.
phys
);
...
...
@@ -551,9 +541,10 @@ static void gn412x_dma_issue_pending(struct dma_chan *chan)
static
void
gn412x_dma_start_task
(
unsigned
long
arg
)
{
struct
gn412x_dma_chan
*
chan
=
(
struct
gn412x_dma_chan
*
)
arg
;
struct
gn412x_dma_device
*
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
chan
.
device
)
;
struct
gn412x_dma_device
*
gn412x_dma
;
unsigned
long
flags
;
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
chan
.
device
);
if
(
unlikely
(
gn412x_dma_is_busy
(
gn412x_dma
)))
{
dev_err
(
&
gn412x_dma
->
pdev
->
dev
,
"Failed to start DMA transfer: channel busy
\n
"
);
...
...
@@ -600,8 +591,9 @@ static int gn412x_dma_slave_config(struct dma_chan *chan,
static
int
gn412x_dma_terminate_all
(
struct
dma_chan
*
chan
)
{
struct
gn412x_dma_device
*
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
device
)
;
struct
gn412x_dma_device
*
gn412x_dma
;
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
device
);
gn412x_dma_ctrl_abort
(
gn412x_dma
);
/* FIXME remove all pending */
if
(
!
gn412x_dma_is_abort
(
gn412x_dma
))
{
...
...
@@ -847,7 +839,7 @@ err_res_mem:
/**
* It removes an instance of the GN4124 DMA engine
* It removes an instance of the GN4124 DMA engine
* @pdev: platform device
*
* @return: 0 on success otherwise a negative error code
...
...
software/kernel/spec.h
View file @
d851f7a6
...
...
@@ -124,7 +124,7 @@ struct spec_fpga {
struct
dentry
*
dbg_csr
;
struct
debugfs_regset32
dbg_csr_reg
;
#define SPEC_DBG_BLD_INFO_NAME "build_info"
struct
dentry
*
dbg_bld
_info
;
struct
dentry
*
dbg_bld
;
};
/**
...
...
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