Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FPGA Configuration Space
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
FPGA Configuration Space
Commits
32b9b353
Commit
32b9b353
authored
Feb 21, 2020
by
A. Hahn
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/pcie_pci_kernelv4'
parents
380f57ba
f0e89e63
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
380 additions
and
218 deletions
+380
-218
.gitmodules
.gitmodules
+1
-1
legacy-vme64x-core
legacy-vme64x-core
+1
-1
Makefile
pcie-wb/Makefile
+1
-1
pcie_wb.c
pcie-wb/pcie_wb.c
+199
-88
pcie_wb.h
pcie-wb/pcie_wb.h
+31
-20
wishbone-serial.c
pcie-wb/wishbone-serial.c
+1
-1
wishbone.c
pcie-wb/wishbone.c
+141
-101
vme_wb_external.c
vme-wb/vme_wb_external.c
+5
-5
No files found.
.gitmodules
View file @
32b9b353
[submodule "legacy-vme64x-core"]
path = legacy-vme64x-core
url =
git://ohwr.org/hdl-core-lib/vme64x-core
/legacy-vme64x-core.git
url =
https://ohwr.org/project
/legacy-vme64x-core.git
legacy-vme64x-core
@
10a1d1d8
Subproject commit
64d9fb0c837b95723cd64a264505c242852ba831
Subproject commit
10a1d1d8eb5bff6da7a1defc9e450640b0f0d80c
pcie-wb/Makefile
View file @
32b9b353
...
...
@@ -3,7 +3,7 @@ ifneq ($(KERNELRELEASE),)
ccflags-y
+=
-DGIT_REVISION
=
"
$(
shell
git --git-dir=
$(src)
/../.git log -n1 --pretty='format:%h (%ci
)
'
)
"
obj-m
+=
pcie_wb.o wishbone.o
spec_wb.o
obj-m
+=
pcie_wb.o wishbone.o
# Only build wishbone-serial if it was missing
ifneq
($(CONFIG_USB_SERIAL_WISHBONE),m)
ifneq
($(CONFIG_USB_SERIAL_WISHBONE),y)
...
...
pcie-wb/pcie_wb.c
View file @
32b9b353
This diff is collapsed.
Click to expand it.
pcie-wb/pcie_wb.h
View file @
32b9b353
...
...
@@ -7,7 +7,8 @@
#define PCIE_WB_VERSION "0.1"
#define PCIE_WB_VENDOR_ID 0x10dc
#define PCIE_WB_DEVICE_ID 0x019a
#define PCIE_WB_DEVICE_ID 0x019a
/* PCIe FTRNs (PEXARIA, EXPLODER, AMC, SCU, ...) */
#define PMC_WB_DEVICE_ID 0xc570
/* PCI FTRN (PMC) */
#define CONTROL_REGISTER_HIGH 0
#define CONTROL_REGISTER_LOW 4
...
...
@@ -17,6 +18,7 @@
#define WINDOW_OFFSET_LOW 20
#define SDWB_ADDRESS_HIGH 24
#define SDWB_ADDRESS_LOW 28
#define PMC_IRQ_CONTROL 32
#define MASTER_CTL_HIGH 64
#define MASTER_CTL_LOW 68
...
...
@@ -28,6 +30,15 @@
#define WINDOW_HIGH 0xFFFF0000UL
#define WINDOW_LOW 0x0000FFFCUL
/* PCI core control and status registers in BAR0 */
#define PCI_STATUS_REG 0x04
#define PCI_CONF_IRQ 0x3C
#define WB_CONF_IRQ_STATUS_MASK 0x00000001
#define WB_CONF_INT_ACK_REG 0x1E8
/* PCI core WB interrupt Acknowledge register */
#define WB_CONF_ICR_REG 0x1EC
/* PCI core WB interrupt Control register */
#define WB_CONF_ISR_REG 0x1F0
/* PCI core WB interrupt Status register */
/* One per BAR */
struct
pcie_wb_resource
{
unsigned
long
start
;
/* start addr of BAR */
...
...
@@ -39,7 +50,7 @@ struct pcie_wb_resource {
/* One per physical card */
struct
pcie_wb_dev
{
struct
pci_dev
*
pci_dev
;
struct
pcie_wb_resource
pci_res
[
2
];
struct
pcie_wb_resource
pci_res
[
3
];
int
msi
;
struct
wishbone
wb
;
...
...
pcie-wb/wishbone-serial.c
View file @
32b9b353
...
...
@@ -43,7 +43,7 @@
#define API 8
#endif
#if API <=
7
#if API <=
8
static
const
struct
usb_device_id
id_table
[]
=
{
{
USB_DEVICE_AND_INTERFACE_INFO
(
0x1D50
,
0x6062
,
0xFF
,
0xFF
,
0xFF
)
},
...
...
pcie-wb/wishbone.c
View file @
32b9b353
...
...
@@ -28,7 +28,7 @@ static DEFINE_MUTEX(wishbone_mutex);
static
struct
class
*
wishbone_master_class
;
static
dev_t
wishbone_master_dev_first
;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,30)
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,30)
|| LINUX_VERSION_CODE > KERNEL_VERSION(3,1,19)
/* missing 'const' in 2.6.30. present in 2.6.31. */
static
int
compat_memcpy_fromiovecend
(
unsigned
char
*
kdata
,
const
struct
iovec
*
iov
,
...
...
@@ -56,6 +56,7 @@ static int compat_memcpy_fromiovecend(unsigned char *kdata, const struct iovec *
}
/* does not exist in 2.6.30. does in 2.6.31. */
static
int
compat_memcpy_toiovecend
(
const
struct
iovec
*
iov
,
unsigned
char
*
kdata
,
int
offset
,
int
len
)
...
...
@@ -524,6 +525,8 @@ static ssize_t char_master_aio_read(struct kiocb *iocb, const struct iovec *iov,
return
len
;
}
static
ssize_t
char_master_aio_write
(
struct
kiocb
*
iocb
,
const
struct
iovec
*
iov
,
unsigned
long
nr_segs
,
loff_t
pos
)
{
struct
file
*
filep
=
iocb
->
ki_filp
;
...
...
@@ -591,6 +594,23 @@ static int char_master_fasync(int fd, struct file *file, int on)
return
fasync_helper
(
fd
,
file
,
on
,
&
context
->
fasync
);
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(4,1,0)
static
ssize_t
char_master_aio_read_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
iter
)
{
return
char_master_aio_read
(
iocb
,
iter
->
iov
,
iter
->
nr_segs
,
iter
->
iov_offset
);
}
static
ssize_t
char_master_aio_write_iter
(
struct
kiocb
*
iocb
,
struct
iov_iter
*
iter
)
{
return
char_master_aio_write
(
iocb
,
iter
->
iov
,
iter
->
nr_segs
,
iter
->
iov_offset
);
}
#endif
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,1,0)
static
const
struct
file_operations
etherbone_master_fops
=
{
.
owner
=
THIS_MODULE
,
.
llseek
=
no_llseek
,
...
...
@@ -604,6 +624,26 @@ static const struct file_operations etherbone_master_fops = {
.
fasync
=
char_master_fasync
,
};
#else
static
const
struct
file_operations
etherbone_master_fops
=
{
.
owner
=
THIS_MODULE
,
.
llseek
=
no_llseek
,
//.read = new_sync_read,
.
read_iter
=
char_master_aio_read_iter
,
//.write = new_sync_write,
.
write_iter
=
char_master_aio_write_iter
,
.
open
=
char_master_open
,
.
poll
=
char_master_poll
,
.
release
=
char_master_release
,
.
fasync
=
char_master_fasync
,
};
#endif
//ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
//ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
int
wishbone_register
(
struct
wishbone
*
wb
)
{
struct
list_head
*
list_pos
;
...
...
vme-wb/vme_wb_external.c
View file @
32b9b353
...
...
@@ -342,7 +342,7 @@ void vme_setup_csr_fa0(void *base, u32 wb_vme, unsigned vector, unsigned level)
fa
[
0
]
=
(
wb_add
>>
24
)
&
0xFF
;
fa
[
1
]
=
(
wb_add
>>
16
)
&
0xFF
;
fa
[
2
]
=
(
wb_add
>>
8
)
&
0xFF
;
fa
[
3
]
=
(
VME_A32_USER_
MBL
T
&
0x3F
)
<<
2
;
/* or VME_A32_USER_DATA_SCT */
fa
[
3
]
=
(
VME_A32_USER_
DATA_SC
T
&
0x3F
)
<<
2
;
/* or VME_A32_USER_DATA_SCT */
vme_csr_write
(
fa
[
0
],
base
,
FUN0ADER
);
vme_csr_write
(
fa
[
1
],
base
,
FUN0ADER
+
4
);
...
...
@@ -353,7 +353,7 @@ void vme_setup_csr_fa0(void *base, u32 wb_vme, unsigned vector, unsigned level)
fa
[
0
]
=
(
wb_ctrl_add
>>
24
)
&
0xFF
;
fa
[
1
]
=
(
wb_ctrl_add
>>
16
)
&
0xFF
;
fa
[
2
]
=
(
wb_ctrl_add
>>
8
)
&
0xFF
;
fa
[
3
]
=
(
VME_A24_USER_
MBL
T
&
0x3F
)
<<
2
;
/* or VME_A24_USER_DATA_SCT */
fa
[
3
]
=
(
VME_A24_USER_
DATA_SC
T
&
0x3F
)
<<
2
;
/* or VME_A24_USER_DATA_SCT */
vme_csr_write
(
fa
[
0
],
base
,
FUN1ADER
);
vme_csr_write
(
fa
[
1
],
base
,
FUN1ADER
+
4
);
...
...
@@ -372,7 +372,7 @@ static int vme_remove(struct device *pdev, unsigned int ndev)
vme_unmap_window
(
dev
,
MAP_REG
);
vme_unmap_window
(
dev
,
MAP_CTRL
);
wishbone_unregister
(
&
dev
->
wb
);
vme_free_irq
(
vector_num
);
vme_free_irq
(
dev
->
vme_res
.
vector
);
kfree
(
dev
);
dev_info
(
pdev
,
"removed
\n
"
);
...
...
@@ -485,7 +485,7 @@ static int vme_probe(struct device *pdev, unsigned int ndev)
}
/* register interrupt handler */
if
(
vme_request_irq
(
vector_num
,
irq_handler
,
dev
,
"wb_irq"
)
!=
0
)
{
if
(
vme_request_irq
(
dev
->
vme_res
.
vector
,
irq_handler
,
dev
,
"wb_irq"
)
!=
0
)
{
printk
(
KERN_ALERT
VME_WB
": could not register interrupt handler
\n
"
);
goto
fail_irq
;
...
...
@@ -496,7 +496,7 @@ static int vme_probe(struct device *pdev, unsigned int ndev)
return
0
;
fail_irq:
{
vme_free_irq
(
vector_num
);
vme_free_irq
(
dev
->
vme_res
.
vector
);
vme_unmap_window
(
dev
,
MAP_REG
);
vme_unmap_window
(
dev
,
MAP_CR_CSR
);
}
...
...
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