lkml.org 
[lkml]   [2021]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/dma/ppc4xx/adma.c:4094:14: sparse: sparse: incorrect type in assignment (different address spaces)
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0da0a8a0a0e1845f495431c3d8d733d2bbf9e9e5
commit: 68f35add4ba4c850a33878633e10c02d7ba32d84 dmaengine: ppc4xx: make ppc440spe_adma_chan_list static
date: 3 months ago
config: powerpc-randconfig-s031-20210117 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-208-g46a52ca4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=68f35add4ba4c850a33878633e10c02d7ba32d84
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 68f35add4ba4c850a33878633e10c02d7ba32d84
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
drivers/dma/ppc4xx/adma.c:1159:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1159:38: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1159:38: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:911:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct dma_regs *dma_reg @@ got struct dma_regs [noderef] __iomem *dma_reg @@
drivers/dma/ppc4xx/adma.c:911:25: sparse: expected struct dma_regs *dma_reg
drivers/dma/ppc4xx/adma.c:911:25: sparse: got struct dma_regs [noderef] __iomem *dma_reg
drivers/dma/ppc4xx/adma.c:912:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:912:40: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:912:40: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:929:37: sparse: sparse: cast to restricted __le32
drivers/dma/ppc4xx/adma.c:974:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:974:32: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:974:32: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:979:40: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:979:40: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:979:40: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:984:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct xor_regs *xor_reg @@ got struct xor_regs [noderef] __iomem *xor_reg @@
drivers/dma/ppc4xx/adma.c:984:25: sparse: expected struct xor_regs *xor_reg
drivers/dma/ppc4xx/adma.c:984:25: sparse: got struct xor_regs [noderef] __iomem *xor_reg
drivers/dma/ppc4xx/adma.c:985:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:985:34: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:985:34: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:986:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:986:34: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:986:34: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:993:55: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:993:55: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:993:55: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:995:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:995:51: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:995:51: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:997:51: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:997:51: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:997:51: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:999:46: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:999:46: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:999:46: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1008:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1008:35: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1008:35: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1027:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct dma_regs *dma_reg @@ got struct dma_regs [noderef] __iomem *dma_reg @@
drivers/dma/ppc4xx/adma.c:1027:25: sparse: expected struct dma_regs *dma_reg
drivers/dma/ppc4xx/adma.c:1027:25: sparse: got struct dma_regs [noderef] __iomem *dma_reg
drivers/dma/ppc4xx/adma.c:1031:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned short * @@
drivers/dma/ppc4xx/adma.c:1031:31: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1031:31: sparse: got unsigned short *
drivers/dma/ppc4xx/adma.c:1031:60: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned short * @@
drivers/dma/ppc4xx/adma.c:1031:60: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1031:60: sparse: got unsigned short *
drivers/dma/ppc4xx/adma.c:1032:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned short * @@
drivers/dma/ppc4xx/adma.c:1032:31: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1032:31: sparse: got unsigned short *
drivers/dma/ppc4xx/adma.c:1032:60: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned short * @@
drivers/dma/ppc4xx/adma.c:1032:60: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1032:60: sparse: got unsigned short *
drivers/dma/ppc4xx/adma.c:1038:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct xor_regs *xor_reg @@ got struct xor_regs [noderef] __iomem *xor_reg @@
drivers/dma/ppc4xx/adma.c:1038:25: sparse: expected struct xor_regs *xor_reg
drivers/dma/ppc4xx/adma.c:1038:25: sparse: got struct xor_regs [noderef] __iomem *xor_reg
drivers/dma/ppc4xx/adma.c:1039:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1039:37: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1039:37: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1053:48: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct xor_regs *xor_reg @@ got struct xor_regs [noderef] __iomem *xor_reg @@
drivers/dma/ppc4xx/adma.c:1053:48: sparse: expected struct xor_regs *xor_reg
drivers/dma/ppc4xx/adma.c:1053:48: sparse: got struct xor_regs [noderef] __iomem *xor_reg
drivers/dma/ppc4xx/adma.c:1055:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1055:25: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1055:25: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1062:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1062:41: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1062:41: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1064:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1064:39: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1064:39: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1065:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1065:25: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1065:25: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1066:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1066:33: sparse: expected void const [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1066:33: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1067:22: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1067:22: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1067:22: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1080:48: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct dma_regs *dma_reg @@ got struct dma_regs [noderef] __iomem *dma_reg @@
drivers/dma/ppc4xx/adma.c:1080:48: sparse: expected struct dma_regs *dma_reg
drivers/dma/ppc4xx/adma.c:1080:48: sparse: got struct dma_regs [noderef] __iomem *dma_reg
drivers/dma/ppc4xx/adma.c:1090:26: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1090:26: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1090:26: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:1210:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct xor_regs *xor_reg @@ got struct xor_regs [noderef] __iomem *xor_reg @@
drivers/dma/ppc4xx/adma.c:1210:25: sparse: expected struct xor_regs *xor_reg
drivers/dma/ppc4xx/adma.c:1210:25: sparse: got struct xor_regs [noderef] __iomem *xor_reg
drivers/dma/ppc4xx/adma.c:1214:30: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __iomem * @@ got unsigned int * @@
drivers/dma/ppc4xx/adma.c:1214:30: sparse: expected void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:1214:30: sparse: got unsigned int *
drivers/dma/ppc4xx/adma.c:2777:62: sparse: sparse: Using plain integer as NULL pointer
>> drivers/dma/ppc4xx/adma.c:4094:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *regs @@ got void [noderef] __iomem * @@
drivers/dma/ppc4xx/adma.c:4094:14: sparse: expected void *regs
drivers/dma/ppc4xx/adma.c:4094:14: sparse: got void [noderef] __iomem *
drivers/dma/ppc4xx/adma.c:4102:31: sparse: sparse: too many warnings

vim +4094 drivers/dma/ppc4xx/adma.c

12458ea06efd7b Anatolij Gustschin 2009-12-11 4003
12458ea06efd7b Anatolij Gustschin 2009-12-11 4004 /**
12458ea06efd7b Anatolij Gustschin 2009-12-11 4005 * ppc440spe_adma_probe - probe the asynch device
12458ea06efd7b Anatolij Gustschin 2009-12-11 4006 */
463a1f8b3ceebe Bill Pemberton 2012-11-19 4007 static int ppc440spe_adma_probe(struct platform_device *ofdev)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4008 {
05c02542c20aa0 Anatolij Gustschin 2010-06-03 4009 struct device_node *np = ofdev->dev.of_node;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4010 struct resource res;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4011 struct ppc440spe_adma_device *adev;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4012 struct ppc440spe_adma_chan *chan;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4013 struct ppc_dma_chan_ref *ref, *_ref;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4014 int ret = 0, initcode = PPC_ADMA_INIT_OK;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4015 const u32 *idx;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4016 int len;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4017 void *regs;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4018 u32 id, pool_size;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4019
12458ea06efd7b Anatolij Gustschin 2009-12-11 4020 if (of_device_is_compatible(np, "amcc,xor-accelerator")) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4021 id = PPC440SPE_XOR_ID;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4022 /* As far as the XOR engine is concerned, it does not
12458ea06efd7b Anatolij Gustschin 2009-12-11 4023 * use FIFOs but uses linked list. So there is no dependency
12458ea06efd7b Anatolij Gustschin 2009-12-11 4024 * between pool size to allocate and the engine configuration.
12458ea06efd7b Anatolij Gustschin 2009-12-11 4025 */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4026 pool_size = PAGE_SIZE << 1;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4027 } else {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4028 /* it is DMA0 or DMA1 */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4029 idx = of_get_property(np, "cell-index", &len);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4030 if (!idx || (len != sizeof(u32))) {
c6c93048baff25 Rob Herring 2017-07-18 4031 dev_err(&ofdev->dev, "Device node %pOF has missing "
12458ea06efd7b Anatolij Gustschin 2009-12-11 4032 "or invalid cell-index property\n",
c6c93048baff25 Rob Herring 2017-07-18 4033 np);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4034 return -EINVAL;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4035 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4036 id = *idx;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4037 /* DMA0,1 engines use FIFO to maintain CDBs, so we
12458ea06efd7b Anatolij Gustschin 2009-12-11 4038 * should allocate the pool accordingly to size of this
12458ea06efd7b Anatolij Gustschin 2009-12-11 4039 * FIFO. Thus, the pool size depends on the FIFO depth:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4040 * how much CDBs pointers the FIFO may contain then so
12458ea06efd7b Anatolij Gustschin 2009-12-11 4041 * much CDBs we should provide in the pool.
12458ea06efd7b Anatolij Gustschin 2009-12-11 4042 * That is
12458ea06efd7b Anatolij Gustschin 2009-12-11 4043 * CDB size = 32B;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4044 * CDBs number = (DMA0_FIFO_SIZE >> 3);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4045 * Pool size = CDBs number * CDB size =
12458ea06efd7b Anatolij Gustschin 2009-12-11 4046 * = (DMA0_FIFO_SIZE >> 3) << 5 = DMA0_FIFO_SIZE << 2.
12458ea06efd7b Anatolij Gustschin 2009-12-11 4047 */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4048 pool_size = (id == PPC440SPE_DMA0_ID) ?
12458ea06efd7b Anatolij Gustschin 2009-12-11 4049 DMA0_FIFO_SIZE : DMA1_FIFO_SIZE;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4050 pool_size <<= 2;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4051 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4052
12458ea06efd7b Anatolij Gustschin 2009-12-11 4053 if (of_address_to_resource(np, 0, &res)) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4054 dev_err(&ofdev->dev, "failed to get memory resource\n");
12458ea06efd7b Anatolij Gustschin 2009-12-11 4055 initcode = PPC_ADMA_INIT_MEMRES;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4056 ret = -ENODEV;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4057 goto out;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4058 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4059
12458ea06efd7b Anatolij Gustschin 2009-12-11 4060 if (!request_mem_region(res.start, resource_size(&res),
12458ea06efd7b Anatolij Gustschin 2009-12-11 4061 dev_driver_string(&ofdev->dev))) {
a584bff5efae8c Joe Perches 2010-11-12 4062 dev_err(&ofdev->dev, "failed to request memory region %pR\n",
a584bff5efae8c Joe Perches 2010-11-12 4063 &res);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4064 initcode = PPC_ADMA_INIT_MEMREG;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4065 ret = -EBUSY;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4066 goto out;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4067 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4068
12458ea06efd7b Anatolij Gustschin 2009-12-11 4069 /* create a device */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4070 adev = kzalloc(sizeof(*adev), GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4071 if (!adev) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4072 initcode = PPC_ADMA_INIT_ALLOC;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4073 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4074 goto err_adev_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4075 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4076
12458ea06efd7b Anatolij Gustschin 2009-12-11 4077 adev->id = id;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4078 adev->pool_size = pool_size;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4079 /* allocate coherent memory for hardware descriptors */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4080 adev->dma_desc_pool_virt = dma_alloc_coherent(&ofdev->dev,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4081 adev->pool_size, &adev->dma_desc_pool,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4082 GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4083 if (adev->dma_desc_pool_virt == NULL) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4084 dev_err(&ofdev->dev, "failed to allocate %d bytes of coherent "
12458ea06efd7b Anatolij Gustschin 2009-12-11 4085 "memory for hardware descriptors\n",
12458ea06efd7b Anatolij Gustschin 2009-12-11 4086 adev->pool_size);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4087 initcode = PPC_ADMA_INIT_COHERENT;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4088 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4089 goto err_dma_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4090 }
d73111c6d43f08 Masanari Iida 2012-08-04 4091 dev_dbg(&ofdev->dev, "allocated descriptor pool virt 0x%p phys 0x%llx\n",
12458ea06efd7b Anatolij Gustschin 2009-12-11 4092 adev->dma_desc_pool_virt, (u64)adev->dma_desc_pool);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4093
12458ea06efd7b Anatolij Gustschin 2009-12-11 @4094 regs = ioremap(res.start, resource_size(&res));
12458ea06efd7b Anatolij Gustschin 2009-12-11 4095 if (!regs) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4096 dev_err(&ofdev->dev, "failed to ioremap regs!\n");
f3b77727e82722 Julia Lawall 2013-12-29 4097 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4098 goto err_regs_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4099 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4100
12458ea06efd7b Anatolij Gustschin 2009-12-11 4101 if (adev->id == PPC440SPE_XOR_ID) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4102 adev->xor_reg = regs;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4103 /* Reset XOR */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4104 iowrite32be(XOR_CRSR_XASR_BIT, &adev->xor_reg->crsr);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4105 iowrite32be(XOR_CRSR_64BA_BIT, &adev->xor_reg->crrr);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4106 } else {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4107 size_t fifo_size = (adev->id == PPC440SPE_DMA0_ID) ?
12458ea06efd7b Anatolij Gustschin 2009-12-11 4108 DMA0_FIFO_SIZE : DMA1_FIFO_SIZE;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4109 adev->dma_reg = regs;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4110 /* DMAx_FIFO_SIZE is defined in bytes,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4111 * <fsiz> - is defined in number of CDB pointers (8byte).
12458ea06efd7b Anatolij Gustschin 2009-12-11 4112 * DMA FIFO Length = CSlength + CPlength, where
12458ea06efd7b Anatolij Gustschin 2009-12-11 4113 * CSlength = CPlength = (fsiz + 1) * 8.
12458ea06efd7b Anatolij Gustschin 2009-12-11 4114 */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4115 iowrite32(DMA_FIFO_ENABLE | ((fifo_size >> 3) - 2),
12458ea06efd7b Anatolij Gustschin 2009-12-11 4116 &adev->dma_reg->fsiz);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4117 /* Configure DMA engine */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4118 iowrite32(DMA_CFG_DXEPR_HP | DMA_CFG_DFMPP_HP | DMA_CFG_FALGN,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4119 &adev->dma_reg->cfg);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4120 /* Clear Status */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4121 iowrite32(~0, &adev->dma_reg->dsts);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4122 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4123
12458ea06efd7b Anatolij Gustschin 2009-12-11 4124 adev->dev = &ofdev->dev;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4125 adev->common.dev = &ofdev->dev;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4126 INIT_LIST_HEAD(&adev->common.channels);
dd3daca162f741 Jingoo Han 2013-05-24 4127 platform_set_drvdata(ofdev, adev);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4128
12458ea06efd7b Anatolij Gustschin 2009-12-11 4129 /* create a channel */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4130 chan = kzalloc(sizeof(*chan), GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4131 if (!chan) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4132 initcode = PPC_ADMA_INIT_CHANNEL;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4133 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4134 goto err_chan_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4135 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4136
12458ea06efd7b Anatolij Gustschin 2009-12-11 4137 spin_lock_init(&chan->lock);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4138 INIT_LIST_HEAD(&chan->chain);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4139 INIT_LIST_HEAD(&chan->all_slots);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4140 chan->device = adev;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4141 chan->common.device = &adev->common;
8ac695463f37af Russell King - ARM Linux 2012-03-06 4142 dma_cookie_init(&chan->common);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4143 list_add_tail(&chan->common.device_node, &adev->common.channels);
7f8281765f9949 Allen Pais 2020-08-31 4144 tasklet_setup(&chan->irq_tasklet, ppc440spe_adma_tasklet);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4145
12458ea06efd7b Anatolij Gustschin 2009-12-11 4146 /* allocate and map helper pages for async validation or
12458ea06efd7b Anatolij Gustschin 2009-12-11 4147 * async_mult/async_sum_product operations on DMA0/1.
12458ea06efd7b Anatolij Gustschin 2009-12-11 4148 */
12458ea06efd7b Anatolij Gustschin 2009-12-11 4149 if (adev->id != PPC440SPE_XOR_ID) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4150 chan->pdest_page = alloc_page(GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4151 chan->qdest_page = alloc_page(GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4152 if (!chan->pdest_page ||
12458ea06efd7b Anatolij Gustschin 2009-12-11 4153 !chan->qdest_page) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4154 if (chan->pdest_page)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4155 __free_page(chan->pdest_page);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4156 if (chan->qdest_page)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4157 __free_page(chan->qdest_page);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4158 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4159 goto err_page_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4160 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4161 chan->pdest = dma_map_page(&ofdev->dev, chan->pdest_page, 0,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4162 PAGE_SIZE, DMA_BIDIRECTIONAL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4163 chan->qdest = dma_map_page(&ofdev->dev, chan->qdest_page, 0,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4164 PAGE_SIZE, DMA_BIDIRECTIONAL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4165 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4166
12458ea06efd7b Anatolij Gustschin 2009-12-11 4167 ref = kmalloc(sizeof(*ref), GFP_KERNEL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4168 if (ref) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4169 ref->chan = &chan->common;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4170 INIT_LIST_HEAD(&ref->node);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4171 list_add_tail(&ref->node, &ppc440spe_adma_chan_list);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4172 } else {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4173 dev_err(&ofdev->dev, "failed to allocate channel reference!\n");
12458ea06efd7b Anatolij Gustschin 2009-12-11 4174 ret = -ENOMEM;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4175 goto err_ref_alloc;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4176 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4177
12458ea06efd7b Anatolij Gustschin 2009-12-11 4178 ret = ppc440spe_adma_setup_irqs(adev, chan, &initcode);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4179 if (ret)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4180 goto err_irq;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4181
12458ea06efd7b Anatolij Gustschin 2009-12-11 4182 ppc440spe_adma_init_capabilities(adev);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4183
12458ea06efd7b Anatolij Gustschin 2009-12-11 4184 ret = dma_async_device_register(&adev->common);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4185 if (ret) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4186 initcode = PPC_ADMA_INIT_REGISTER;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4187 dev_err(&ofdev->dev, "failed to register dma device\n");
12458ea06efd7b Anatolij Gustschin 2009-12-11 4188 goto err_dev_reg;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4189 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4190
12458ea06efd7b Anatolij Gustschin 2009-12-11 4191 goto out;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4192
12458ea06efd7b Anatolij Gustschin 2009-12-11 4193 err_dev_reg:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4194 ppc440spe_adma_release_irqs(adev, chan);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4195 err_irq:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4196 list_for_each_entry_safe(ref, _ref, &ppc440spe_adma_chan_list, node) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4197 if (chan == to_ppc440spe_adma_chan(ref->chan)) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4198 list_del(&ref->node);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4199 kfree(ref);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4200 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4201 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4202 err_ref_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4203 if (adev->id != PPC440SPE_XOR_ID) {
12458ea06efd7b Anatolij Gustschin 2009-12-11 4204 dma_unmap_page(&ofdev->dev, chan->pdest,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4205 PAGE_SIZE, DMA_BIDIRECTIONAL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4206 dma_unmap_page(&ofdev->dev, chan->qdest,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4207 PAGE_SIZE, DMA_BIDIRECTIONAL);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4208 __free_page(chan->pdest_page);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4209 __free_page(chan->qdest_page);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4210 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4211 err_page_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4212 kfree(chan);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4213 err_chan_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4214 if (adev->id == PPC440SPE_XOR_ID)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4215 iounmap(adev->xor_reg);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4216 else
12458ea06efd7b Anatolij Gustschin 2009-12-11 4217 iounmap(adev->dma_reg);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4218 err_regs_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4219 dma_free_coherent(adev->dev, adev->pool_size,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4220 adev->dma_desc_pool_virt,
12458ea06efd7b Anatolij Gustschin 2009-12-11 4221 adev->dma_desc_pool);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4222 err_dma_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4223 kfree(adev);
12458ea06efd7b Anatolij Gustschin 2009-12-11 4224 err_adev_alloc:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4225 release_mem_region(res.start, resource_size(&res));
12458ea06efd7b Anatolij Gustschin 2009-12-11 4226 out:
12458ea06efd7b Anatolij Gustschin 2009-12-11 4227 if (id < PPC440SPE_ADMA_ENGINES_NUM)
12458ea06efd7b Anatolij Gustschin 2009-12-11 4228 ppc440spe_adma_devices[id] = initcode;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4229
12458ea06efd7b Anatolij Gustschin 2009-12-11 4230 return ret;
12458ea06efd7b Anatolij Gustschin 2009-12-11 4231 }
12458ea06efd7b Anatolij Gustschin 2009-12-11 4232

:::::: The code at line 4094 was first introduced by commit
:::::: 12458ea06efd7b44281e68fe59c950ec7d59c649 ppc440spe-adma: adds updated ppc440spe adma driver

:::::: TO: Anatolij Gustschin <agust@denx.de>
:::::: CC: Dan Williams <dan.j.williams@intel.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-01-17 00:38    [W:0.033 / U:2.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site