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
276d0cb1
Commit
276d0cb1
authored
Feb 28, 2017
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: checkpatch cleanup
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
37f4f5df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
42 deletions
+46
-42
spec-fmc.c
kernel/spec-fmc.c
+21
-17
spec-i2c.c
kernel/spec-i2c.c
+11
-12
spec-pci.c
kernel/spec-pci.c
+5
-4
spec-vic.c
kernel/spec-vic.c
+9
-9
No files found.
kernel/spec-fmc.c
View file @
276d0cb1
...
@@ -97,7 +97,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
...
@@ -97,7 +97,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
}
}
ret
=
spec_reprogram_raw
(
fmc
,
drv
,
(
void
*
)
fw
->
data
,
fw
->
size
);
ret
=
spec_reprogram_raw
(
fmc
,
drv
,
(
void
*
)
fw
->
data
,
fw
->
size
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
dev
,
"write firmware
\"
%s
\"
: error %i
\n
"
,
gw
,
ret
);
dev_err
(
dev
,
"write firmware
\"
%s
\"
: error %i
\n
"
,
gw
,
ret
);
goto
out
;
goto
out
;
}
}
...
@@ -126,8 +126,9 @@ static int spec_shared_irq_request(struct fmc_device *fmc,
...
@@ -126,8 +126,9 @@ static int spec_shared_irq_request(struct fmc_device *fmc,
/* A check and a hack, but doesn't work on all computers */
/* A check and a hack, but doesn't work on all computers */
value
=
gennum_readl
(
spec
,
GNPPCI_MSI_CONTROL
);
value
=
gennum_readl
(
spec
,
GNPPCI_MSI_CONTROL
);
if
((
value
&
0x810000
)
!=
0x810000
)
if
((
value
&
0x810000
)
!=
0x810000
)
dev_err
(
&
spec
->
pdev
->
dev
,
"invalid msi control: "
dev_err
(
&
spec
->
pdev
->
dev
,
"0x%04x
\n
"
,
value
>>
16
);
"invalid msi control: 0x%04x
\n
"
,
value
>>
16
);
value
=
0xa50000
|
(
value
&
0xffff
);
value
=
0xa50000
|
(
value
&
0xffff
);
gennum_writel
(
spec
,
value
,
GNPPCI_MSI_CONTROL
);
gennum_writel
(
spec
,
value
,
GNPPCI_MSI_CONTROL
);
}
}
...
@@ -167,16 +168,16 @@ static irqreturn_t spec_vic_irq_handler(int id, void *data)
...
@@ -167,16 +168,16 @@ static irqreturn_t spec_vic_irq_handler(int id, void *data)
static
struct
fmc_gpio
spec_vic_gpio_cfg
[]
=
{
static
struct
fmc_gpio
spec_vic_gpio_cfg
[]
=
{
{
{
.
gpio
=
FMC_GPIO_IRQ
(
1
),
.
gpio
=
FMC_GPIO_IRQ
(
1
),
.
mode
=
GPIOF_DIR_IN
,
.
mode
=
GPIOF_DIR_IN
,
.
irqmode
=
IRQF_TRIGGER_RISING
,
.
irqmode
=
IRQF_TRIGGER_RISING
,
},
},
{
{
.
gpio
=
FMC_GPIO_IRQ
(
0
),
.
gpio
=
FMC_GPIO_IRQ
(
0
),
.
mode
=
GPIOF_DIR_IN
,
.
mode
=
GPIOF_DIR_IN
,
.
irqmode
=
IRQF_TRIGGER_RISING
,
.
irqmode
=
IRQF_TRIGGER_RISING
,
}
}
};
};
static
int
spec_irq_request
(
struct
fmc_device
*
fmc
,
irq_handler_t
handler
,
static
int
spec_irq_request
(
struct
fmc_device
*
fmc
,
irq_handler_t
handler
,
...
@@ -266,8 +267,8 @@ static int spec_irq_free(struct fmc_device *fmc)
...
@@ -266,8 +267,8 @@ static int spec_irq_free(struct fmc_device *fmc)
spec_vic_irq_free
(
spec
,
fmc
->
irq
);
spec_vic_irq_free
(
spec
,
fmc
->
irq
);
/*
/*
* If we were not using the VIC, or we released all the VIC handler,
then
* If we were not using the VIC, or we released all the VIC handler,
* release the PCI IRQ handler
*
then
release the PCI IRQ handler
*/
*/
if
(
!
spec
->
vic
)
if
(
!
spec
->
vic
)
spec_shared_irq_free
(
fmc
);
spec_shared_irq_free
(
fmc
);
...
@@ -450,8 +451,9 @@ static int spec_irq_init(struct fmc_device *fmc)
...
@@ -450,8 +451,9 @@ static int spec_irq_init(struct fmc_device *fmc)
*/
*/
value
=
gennum_readl
(
spec
,
GNPPCI_MSI_CONTROL
);
value
=
gennum_readl
(
spec
,
GNPPCI_MSI_CONTROL
);
if
((
value
&
0x810000
)
!=
0x810000
)
if
((
value
&
0x810000
)
!=
0x810000
)
dev_err
(
&
spec
->
pdev
->
dev
,
"invalid msi control: "
dev_err
(
&
spec
->
pdev
->
dev
,
"0x%04x
\n
"
,
value
>>
16
);
"invalid msi control: 0x%04x
\n
"
,
value
>>
16
);
value
=
0xa50000
|
(
value
&
0xffff
);
value
=
0xa50000
|
(
value
&
0xffff
);
gennum_writel
(
spec
,
value
,
GNPPCI_MSI_CONTROL
);
gennum_writel
(
spec
,
value
,
GNPPCI_MSI_CONTROL
);
}
}
...
@@ -466,7 +468,7 @@ static int spec_irq_init(struct fmc_device *fmc)
...
@@ -466,7 +468,7 @@ static int spec_irq_init(struct fmc_device *fmc)
if
(
spec_use_msi
)
if
(
spec_use_msi
)
gennum_writel
(
spec
,
0x800c
,
GNINT_CFG
(
value
&
0x03
));
gennum_writel
(
spec
,
0x800c
,
GNINT_CFG
(
value
&
0x03
));
else
else
gennum_writel
(
spec
,
0x800c
,
GNINT_CFG
(
0
/* first one */
));
gennum_writel
(
spec
,
0x800c
,
GNINT_CFG
(
0
/* first one */
));
/* Finally, ensure we are able to receive it -- if the user asked to */
/* Finally, ensure we are able to receive it -- if the user asked to */
if
(
spec_test_irq
==
0
)
if
(
spec_test_irq
==
0
)
...
@@ -511,7 +513,9 @@ static int check_golden(struct fmc_device *fmc)
...
@@ -511,7 +513,9 @@ static int check_golden(struct fmc_device *fmc)
dev_err
(
&
spec
->
pdev
->
dev
,
"Can't find SDB magic
\n
"
);
dev_err
(
&
spec
->
pdev
->
dev
,
"Can't find SDB magic
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
if
(
(
ret
=
fmc_scan_sdb_tree
(
fmc
,
0x100
))
<
0
)
ret
=
fmc_scan_sdb_tree
(
fmc
,
0x100
);
if
(
ret
<
0
)
return
-
ENODEV
;
return
-
ENODEV
;
if
(
fmc_readl
(
fmc
,
0x15c
)
!=
0x0000ce42
)
{
if
(
fmc_readl
(
fmc
,
0x15c
)
!=
0x0000ce42
)
{
...
...
kernel/spec-i2c.c
View file @
276d0cb1
...
@@ -35,14 +35,14 @@ static void dumpstruct(char *name, void *ptr, int size)
...
@@ -35,14 +35,14 @@ static void dumpstruct(char *name, void *ptr, int size)
int
i
;
int
i
;
unsigned
char
*
p
=
ptr
;
unsigned
char
*
p
=
ptr
;
pr
intk
(
"%s: (size 0x%x)
\n
"
,
name
,
size
);
pr
_info
(
"%s: (size 0x%x)
\n
"
,
name
,
size
);
for
(
i
=
0
;
i
<
size
;
)
{
for
(
i
=
0
;
i
<
size
;
)
{
pr
intk
(
"%02x"
,
p
[
i
]);
pr
_info
(
"%02x"
,
p
[
i
]);
i
++
;
i
++
;
pr
intk
(
i
&
3
?
" "
:
i
&
0xf
?
" "
:
"
\n
"
);
pr
_info
(
"%s"
,
(
i
&
3
)
?
" "
:
(
i
&
0xf
)
?
" "
:
"
\n
"
);
}
}
if
(
i
&
0xf
)
if
(
i
&
0xf
)
pr
intk
(
"
\n
"
);
pr
_info
(
"
\n
"
);
}
}
static
void
set_sda
(
struct
fmc_device
*
fmc
,
int
val
)
static
void
set_sda
(
struct
fmc_device
*
fmc
,
int
val
)
...
@@ -86,7 +86,7 @@ static int mi2c_put_byte(struct fmc_device *fmc, int data)
...
@@ -86,7 +86,7 @@ static int mi2c_put_byte(struct fmc_device *fmc, int data)
int
i
;
int
i
;
int
ack
;
int
ack
;
for
(
i
=
0
;
i
<
8
;
i
++
,
data
<<=
1
)
{
for
(
i
=
0
;
i
<
8
;
i
++
,
data
<<=
1
)
{
set_sda
(
fmc
,
data
&
0x80
);
set_sda
(
fmc
,
data
&
0x80
);
set_scl
(
fmc
,
1
);
set_scl
(
fmc
,
1
);
set_scl
(
fmc
,
0
);
set_scl
(
fmc
,
0
);
...
@@ -124,7 +124,7 @@ static int mi2c_get_byte(struct fmc_device *fmc, unsigned char *data, int ack)
...
@@ -124,7 +124,7 @@ static int mi2c_get_byte(struct fmc_device *fmc, unsigned char *data, int ack)
set_scl
(
fmc
,
0
);
set_scl
(
fmc
,
0
);
set_sda
(
fmc
,
0
);
set_sda
(
fmc
,
0
);
*
data
=
indata
;
*
data
=
indata
;
return
0
;
return
0
;
}
}
...
@@ -144,7 +144,7 @@ int mi2c_scan(struct fmc_device *fmc)
...
@@ -144,7 +144,7 @@ int mi2c_scan(struct fmc_device *fmc)
/* only look for our own device */
/* only look for our own device */
mi2c_start
(
fmc
);
mi2c_start
(
fmc
);
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
==
0
)
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
==
0
)
found
++
;
found
++
;
mi2c_stop
(
fmc
);
mi2c_stop
(
fmc
);
return
found
;
return
found
;
...
@@ -168,7 +168,7 @@ int spec_eeprom_read(struct fmc_device *fmc, uint32_t offset,
...
@@ -168,7 +168,7 @@ int spec_eeprom_read(struct fmc_device *fmc, uint32_t offset,
/* Read it all in a single loop: hardware allows it */
/* Read it all in a single loop: hardware allows it */
mi2c_start
(
fmc
);
mi2c_start
(
fmc
);
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
<
0
)
{
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
<
0
)
{
mi2c_stop
(
fmc
);
mi2c_stop
(
fmc
);
return
-
EIO
;
return
-
EIO
;
}
}
...
@@ -198,8 +198,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
...
@@ -198,8 +198,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
if
(
offset
+
size
>
SPEC_I2C_EEPROM_SIZE
)
if
(
offset
+
size
>
SPEC_I2C_EEPROM_SIZE
)
return
-
EINVAL
;
return
-
EINVAL
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
for
(
i
=
0
;
i
<
size
;
i
++
)
{
/* if (we are using a fake eeprom, don't access hw */
/* if (we are using a fake eeprom, don't access hw */
if
(
spec
->
flags
&
SPEC_FLAG_FAKE_EEPROM
)
{
if
(
spec
->
flags
&
SPEC_FLAG_FAKE_EEPROM
)
{
fmc
->
eeprom
[
offset
++
]
=
*
buf8
++
;
fmc
->
eeprom
[
offset
++
]
=
*
buf8
++
;
...
@@ -208,7 +207,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
...
@@ -208,7 +207,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
mi2c_start
((
fmc
));
mi2c_start
((
fmc
));
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
<
0
)
{
if
(
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
)
<
0
)
{
mi2c_stop
(
fmc
);
mi2c_stop
(
fmc
);
return
-
1
;
return
-
1
;
}
}
...
@@ -221,7 +220,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
...
@@ -221,7 +220,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
mi2c_start
(
fmc
);
mi2c_start
(
fmc
);
busy
=
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
);
busy
=
mi2c_put_byte
(
fmc
,
fmc
->
eeprom_addr
<<
1
);
mi2c_stop
(
fmc
);
mi2c_stop
(
fmc
);
}
while
(
busy
);
}
while
(
busy
);
fmc
->
eeprom
[
offset
++
]
=
*
buf8
++
;
fmc
->
eeprom
[
offset
++
]
=
*
buf8
++
;
}
}
return
size
;
return
size
;
...
...
kernel/spec-pci.c
View file @
276d0cb1
...
@@ -64,7 +64,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
...
@@ -64,7 +64,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
spec
->
remap
[
2
],
data
,
size
);
spec
->
remap
[
2
],
data
,
size
);
j
=
jiffies
+
2
*
HZ
;
j
=
jiffies
+
2
*
HZ
;
/* Wait for DONE interrupt */
/* Wait for DONE interrupt */
while
(
1
)
{
while
(
1
)
{
udelay
(
100
);
udelay
(
100
);
i
=
readl
(
spec
->
remap
[
2
]
+
FCL_IRQ
);
i
=
readl
(
spec
->
remap
[
2
]
+
FCL_IRQ
);
if
(
i
&
0x8
)
{
if
(
i
&
0x8
)
{
...
@@ -72,7 +72,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
...
@@ -72,7 +72,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
break
;
break
;
}
}
if
(
i
&
0x4
)
{
if
(
i
&
0x4
)
{
dev_err
(
dev
,
"FPGA program error after %i writes
\n
"
,
dev_err
(
dev
,
"FPGA program error after %i writes
\n
"
,
wrote
);
wrote
);
return
-
ETIMEDOUT
;
return
-
ETIMEDOUT
;
...
@@ -110,7 +110,7 @@ int spec_load_fpga_file(struct spec_dev *spec, char *name)
...
@@ -110,7 +110,7 @@ int spec_load_fpga_file(struct spec_dev *spec, char *name)
err
=
spec_load_fpga
(
spec
,
fw
->
data
,
fw
->
size
);
err
=
spec_load_fpga
(
spec
,
fw
->
data
,
fw
->
size
);
release_firmware
(
fw
);
release_firmware
(
fw
);
return
err
;
return
err
;
}
}
static
int
spec_reconfigure
(
struct
spec_dev
*
spec
,
struct
fmc_gateware
*
gw
)
static
int
spec_reconfigure
(
struct
spec_dev
*
spec
,
struct
fmc_gateware
*
gw
)
...
@@ -219,7 +219,7 @@ static int spec_probe(struct pci_dev *pdev,
...
@@ -219,7 +219,7 @@ static int spec_probe(struct pci_dev *pdev,
* This should be "4" but arch/x86/kernel/apic/io_apic.c
* This should be "4" but arch/x86/kernel/apic/io_apic.c
* says "x86 doesn't support multiple MSI yet".
* says "x86 doesn't support multiple MSI yet".
*/
*/
#if
LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#if
KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE
ret
=
pci_enable_msi_block
(
pdev
,
1
);
ret
=
pci_enable_msi_block
(
pdev
,
1
);
#else
#else
ret
=
pci_enable_msi_exact
(
pdev
,
1
);
ret
=
pci_enable_msi_exact
(
pdev
,
1
);
...
@@ -232,6 +232,7 @@ static int spec_probe(struct pci_dev *pdev,
...
@@ -232,6 +232,7 @@ static int spec_probe(struct pci_dev *pdev,
/* Remap our 3 bars */
/* Remap our 3 bars */
for
(
i
=
ret
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
ret
=
0
;
i
<
3
;
i
++
)
{
struct
resource
*
r
=
pdev
->
resource
+
(
2
*
i
);
struct
resource
*
r
=
pdev
->
resource
+
(
2
*
i
);
if
(
!
r
->
start
)
if
(
!
r
->
start
)
continue
;
continue
;
spec
->
area
[
i
]
=
r
;
spec
->
area
[
i
]
=
r
;
...
...
kernel/spec-vic.c
View file @
276d0cb1
/*
/*
*
* Copyright (C) 2013 CERN (www.cern.ch)
* Copyright (C) 2013 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
*
* Released according to the GNU GPL, version 2 or any later version
* Released according to the GNU GPL, version 2 or any later version
*
*
* Driver for SPEC (Simple PCI Express FMC carrier) board.
* Driver for SPEC (Simple PCI Express FMC carrier) board.
* VIC (Vectored Interrupt Controller) support code.
* VIC (Vectored Interrupt Controller) support code.
*/
*/
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/slab.h>
...
...
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