Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732283 > unrolled thread

Re: [v4 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations

Started byCatalin Marinas <catalin.marinas@arm.com>
First post2017-09-14 15:50 +0200
Last post2017-09-14 15:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [v4 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private  memory allocations Catalin Marinas <catalin.marinas@arm.com> - 2017-09-14 15:50 +0200

#1732283 — Re: [v4 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations

FromCatalin Marinas <catalin.marinas@arm.com>
Date2017-09-14 15:50 +0200
SubjectRe: [v4 01/11] soc/fsl/qbman: Use shared-dma-pool for BMan private memory allocations
Message-ID<upCGK-5GI-33@gated-at.bofh.it>
On Thu, Aug 24, 2017 at 04:37:45PM -0400, Roy Pledge wrote:
> --- a/drivers/soc/fsl/qbman/bman_ccsr.c
> +++ b/drivers/soc/fsl/qbman/bman_ccsr.c
[...]
> @@ -201,6 +202,38 @@ static int fsl_bman_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  	}
>  
> +	/*
> +	 * If FBPR memory wasn't defined using the qbman compatible string
> +	 * try using the of_reserved_mem_device method
> +	 */
> +	if (!fbpr_a) {
> +		ret = of_reserved_mem_device_init(dev);
> +		if (ret) {
> +			dev_err(dev, "of_reserved_mem_device_init() failed 0x%x\n",
> +				ret);
> +			return -ENODEV;
> +		}
> +		mem_node = of_parse_phandle(dev->of_node, "memory-region", 0);
> +		if (mem_node) {
> +			ret = of_property_read_u64(mem_node, "size", &size);
> +			if (ret) {
> +				dev_err(dev, "FBPR: of_address_to_resource fails 0x%x\n",
> +					ret);
> +				return -ENODEV;
> +			}
> +			fbpr_sz = size;
> +		} else {
> +			dev_err(dev, "No memory-region found for FBPR\n");
> +			return -ENODEV;
> +		}
> +		if (!dma_zalloc_coherent(dev, fbpr_sz, &fbpr_a, 0)) {
> +			dev_err(dev, "Alloc FBPR memory failed\n");
> +			return -ENODEV;
> +		}
> +	}

At a quick look, I think I spotted this pattern a couple of more times
in the subsequent patch. Could it be moved to a common function?

-- 
Catalin

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web