Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/legacy-vme64x-core
1 result
Show changes
Commits on Source (3)
......@@ -3,3 +3,11 @@ parent project VME64X core. I don't want to
have replicate documentation so please
visit:
http://www.ohwr.org/projects/vme64x-core/wiki
This branch adds a so called direct access mode.
By writing to a special register (direct access control register, DACTL) in the A24 address space (with address modifier AM=0x39), the bridge can be switched into the wishbone direct access mode. In the direct access mode, the normal bridge operation will not work anymore. Consequently no wishbone access via etherbone is possible in direct access mode.
The address of the DACTL is 0x400*slot+0x4. The value of slot is the VME slot number for which the bridge was configured. The default value (in normal bridge mode) in the DACTL register is 0xffffffff. the bridge can be switched back from direct access mode into normal bridge mode by writing the value 0xffffffff into the DACTL register. Writing any other value into the DACTL register will immediately switch the bridge into direct access mode. The value written into DACTL (lets call this value WB_base_address) will be used as wishbone base address. In direct access mode any VME read/write access with address modifier AM=0x09 in the VME A32-address range [0x10000000*slot,0x01ffffff*slot] will be mapped into one single wishbone read/write access: WB_address = VME_address - 0x10000000*slot + WB_base_address.
The use case for this mode is low-latency access to wishbone devices in VME systems, such as data acquisition systems for experiments.
......@@ -262,7 +262,11 @@ static int vme_release(struct inode *inode, struct file *file)
static ssize_t vme_read(struct file *file, char *buf, size_t count,
loff_t *ppos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,99,99)
unsigned int minor = iminor(file->f_dentry->d_inode);
#else
unsigned int minor = iminor(file->f_path.dentry->d_inode);
#endif
struct file_operations *f_op = NULL;
/*
......@@ -290,7 +294,11 @@ static ssize_t vme_read(struct file *file, char *buf, size_t count,
static ssize_t vme_write(struct file *file, const char *buf, size_t count,
loff_t *ppos)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,99,99)
unsigned int minor = iminor(file->f_dentry->d_inode);
#else
unsigned int minor = iminor(file->f_path.dentry->d_inode);
#endif
struct file_operations *f_op = NULL;
/*
......@@ -317,7 +325,11 @@ static ssize_t vme_write(struct file *file, const char *buf, size_t count,
long vme_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
unsigned int minor = iminor(file->f_dentry->d_inode);
#else
unsigned int minor = iminor(file->f_path.dentry->d_inode);
#endif
struct file_operations *f_op = NULL;
switch(minor) {
......@@ -340,7 +352,11 @@ long vme_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static int vme_mmap(struct file *file, struct vm_area_struct *vma)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
unsigned int minor = iminor(file->f_dentry->d_inode);
#else
unsigned int minor = iminor(file->f_path.dentry->d_inode);
#endif
struct file_operations *f_op = NULL;
switch(minor) {
......@@ -1097,4 +1113,3 @@ MODULE_DESCRIPTION("Tundra TSI148 PCI-VME Bridge driver");
MODULE_VERSION(DRV_MODULE_VERSION);
MODULE_VERSION(GIT_VERSION);
MODULE_DEVICE_TABLE(pci, tsi148_ids);
......@@ -73,8 +73,12 @@ static int sgl_fill_user_pages(struct page **pages, unsigned long uaddr,
/* Get user pages for the DMA transfer */
down_read(&current->mm->mmap_sem);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
ret = get_user_pages(current, current->mm, uaddr, nr_pages, rw, 0,
pages, NULL);
pages, NULL);
#else
ret = get_user_pages(uaddr, nr_pages, FOLL_WRITE, pages, NULL);
#endif
up_read(&current->mm->mmap_sem);
return ret;
......@@ -131,7 +135,11 @@ static int sgl_map_user_pages(struct scatterlist *sgl,
if (rc >= 0 && rc < nr_pages) {
/* Some pages were pinned, release these */
for (i = 0; i < rc; i++)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
page_cache_release(pages[i]);
#else
put_page(pages[i]);
#endif
rc = -ENOMEM;
goto out_free;
}
......@@ -192,8 +200,11 @@ static void sgl_unmap_user_pages(struct scatterlist *sgl,
if (dirty && !PageReserved(page))
SetPageDirty(page);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
page_cache_release (page);
#else
put_page(page);
#endif
}
}
......