diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-18 21:08:55 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-18 21:08:55 (GMT) |
commit | fb4408c608480c14dfeae557b7e7e0e75bc0c0f4 (patch) | |
tree | 5ed0e003f6b15e1ce13121e06669f458f1df53df /drivers/uio | |
parent | 10667100a057af290ccfdf9c7178ba81867f80e7 (diff) | |
parent | b35a69559c46e066e6f24bb02d5a6090483786e3 (diff) | |
download | linux-fsl-qoriq-fb4408c608480c14dfeae557b7e7e0e75bc0c0f4.tar.xz |
Merge branch 'master-tmp' into sdk-v1.6.x
master-tmp is the master branch as of
8b60f5ea90c49344692a70f62cd4aa349de38b48
with the following commits reverted due to excessive conflicts:
commit b35a69559c46e066e6f24bb02d5a6090483786e3
Author: Scott Wood <scottwood@freescale.com>
Date: Fri Apr 18 15:27:52 2014 -0500
Revert "net: add sysfs helpers for netdev_adjacent logic"
This reverts commit 0be682ca768d671c91cfd1379759efcb3b29102a.
commit 1c0dc06e47e11bf758f3e84ea90c2178a31dbf0f
Author: Scott Wood <scottwood@freescale.com>
Date: Fri Apr 18 15:27:47 2014 -0500
Revert "net: rename sysfs symlinks on device name change"
This reverts commit 45ce45c69750b93b8262aa66792185bd49150293.
Conflicts:
drivers/iommu/fsl_pamu.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_sysfs.c
drivers/net/bonding/bonding.h
drivers/net/ethernet/freescale/gianfar.c
Signed-off-by: Scott Wood <scottwood@freescale.com>
Conflicts:
drivers/iommu/fsl_pamu.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_sysfs.c
drivers/net/bonding/bonding.h
drivers/net/ethernet/freescale/gianfar.c
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/fsl_dma_uio.c | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/drivers/uio/fsl_dma_uio.c b/drivers/uio/fsl_dma_uio.c index fca99bf..899523f 100644 --- a/drivers/uio/fsl_dma_uio.c +++ b/drivers/uio/fsl_dma_uio.c @@ -25,6 +25,7 @@ #include <linux/uio_driver.h> #include <linux/list.h> #include <linux/io.h> +#include <linux/mm.h> static const char dma_uio_version[] = "DMA UIO driver v1.0"; @@ -82,7 +83,33 @@ static irqreturn_t dma_uio_irq_handler(int irq, struct uio_info *dev_info) return IRQ_HANDLED; } -static int __init dma_chan_uio_setup(struct dma_chan *dma_ch) +static int dma_uio_mmap(struct uio_info *info, struct vm_area_struct *vma) +{ + int mi; + struct uio_mem *mem; + + if (vma->vm_pgoff < MAX_UIO_MAPS) { + if (info->mem[vma->vm_pgoff].size == 0) + return -EINVAL; + mi = (int)vma->vm_pgoff; + } else + return -EINVAL; + + mem = info->mem + mi; + + if (vma->vm_end - vma->vm_start > mem->size) + return -EINVAL; + + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + + return remap_pfn_range(vma, + vma->vm_start, + mem->addr >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, + vma->vm_page_prot); +} + +static int dma_chan_uio_setup(struct dma_chan *dma_ch) { int ret; struct dma_uio_info *info; @@ -112,8 +139,8 @@ static int __init dma_chan_uio_setup(struct dma_chan *dma_ch) info->uio.handler = dma_uio_irq_handler; info->uio.open = dma_uio_open; info->uio.release = dma_uio_release; + info->uio.mmap = dma_uio_mmap; info->uio.priv = dma_ch; - ret = uio_register_device(dma_ch->dev, &info->uio); if (ret) { dev_err(dma_ch->dev, "dma_uio: UIO registration failed\n"); @@ -124,13 +151,13 @@ static int __init dma_chan_uio_setup(struct dma_chan *dma_ch) } static int fsl_dma_chan_probe(struct fsldma_device *fdev, - struct device_node *node) + struct device_node *node, + u32 chanid) { struct resource regs; struct dma_chan *dma_ch; struct device_node *dma_node; int err; - u32 *cell; struct platform_device *dev = fdev->dev; dma_node = node; @@ -142,14 +169,9 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev, return -ENOMEM; } - cell = (u32 *)of_get_property(dma_node, "cell-index", NULL); - if (!cell) { - dev_err(&dev->dev, "Can't get property 'cell-index'\n"); - return -EFAULT; - } dma_ch->dma_id = fdev->dma_id; - dma_ch->ch_id = *cell; + dma_ch->ch_id = chanid; dma_ch->dev = &dev->dev; err = of_address_to_resource(dma_node, 0, ®s); @@ -201,13 +223,8 @@ static int fsl_dma_uio_probe(struct platform_device *dev) { struct device_node *child; struct fsldma_device *fdev; - u32 *cell; - - cell = (u32 *)of_get_property(dev->dev.of_node, "cell-index", NULL); - if (!cell) { - dev_err(&dev->dev, "Can't get property 'cell-index'\n"); - return -ENODEV; - } + static u32 dmaid; + u32 chanid = 0; fdev = devm_kzalloc(&dev->dev, sizeof(struct fsldma_device), GFP_KERNEL); @@ -216,15 +233,14 @@ static int fsl_dma_uio_probe(struct platform_device *dev) return -ENOMEM; } - fdev->dma_id = *cell; + fdev->dma_id = dmaid++; fdev->dev = dev; INIT_LIST_HEAD(&fdev->ch_list); dev_set_drvdata(&dev->dev, fdev); for_each_child_of_node(dev->dev.of_node, child) if (of_device_is_compatible(child, "fsl,eloplus-dma-channel")) - fsl_dma_chan_probe(fdev, child); - + fsl_dma_chan_probe(fdev, child, chanid++); return 0; } @@ -244,9 +260,8 @@ static int fsl_dma_uio_remove(struct platform_device *dev) static const struct of_device_id fsl_of_dma_match[] = { - { - .compatible = "fsl,eloplus-dma", - }, + { .compatible = "fsl,elo3-dma", }, + { .compatible = "fsl,eloplus-dma", }, {} }; |