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


Groups > linux.kernel > #1694118 > unrolled thread

Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver

Started byVinod Koul <vinod.koul@intel.com>
First post2017-07-22 08:50 +0200
Last post2017-07-31 14:30 +0200
Articles 5 — 2 participants

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: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver Vinod Koul <vinod.koul@intel.com> - 2017-07-22 08:50 +0200
    Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-24 16:00 +0200
      Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver Vinod Koul <vinod.koul@intel.com> - 2017-07-26 07:30 +0200
        Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver Pierre Yves MORDRET <pierre-yves.mordret@st.com> - 2017-07-26 09:40 +0200
          Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver Vinod Koul <vinod.koul@intel.com> - 2017-07-31 14:30 +0200

#1694118 — Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver

FromVinod Koul <vinod.koul@intel.com>
Date2017-07-22 08:50 +0200
SubjectRe: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver
Message-ID<u5WoG-6X1-23@gated-at.bofh.it>
On Thu, Jul 06, 2017 at 02:20:20PM +0200, Pierre-Yves MORDRET wrote:
> +static int stm32_dmamux_probe(struct platform_device *pdev)
> +{
> +	struct device_node *node = pdev->dev.of_node;
> +	struct device_node *dma_node;
> +	struct stm32_dmamux_data *stm32_dmamux;
> +	struct resource *res;
> +	void __iomem *iomem;
> +	int i, ret;
> +
> +	if (!node)
> +		return -ENODEV;
> +
> +	stm32_dmamux = devm_kzalloc(&pdev->dev, sizeof(*stm32_dmamux),
> +				    GFP_KERNEL);
> +	if (!stm32_dmamux)
> +		return -ENOMEM;
> +
> +	dma_node = of_parse_phandle(node, "dma-masters", 0);
> +	if (!dma_node) {
> +		dev_err(&pdev->dev, "Can't get DMA master node\n");
> +		return -ENODEV;
> +	}
> +
> +	if (device_property_read_u32(&pdev->dev, "dma-channels",
> +				     &stm32_dmamux->dmamux_channels))
> +		stm32_dmamux->dmamux_channels = STM32_DMAMUX_MAX_CHANNELS;
> +
> +	if (device_property_read_u32(&pdev->dev, "dma-requests",
> +				     &stm32_dmamux->dmamux_requests))
> +		stm32_dmamux->dmamux_requests = STM32_DMAMUX_MAX_REQUESTS;

I think defaults should be warned here too

> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -ENODEV;
> +
> +	iomem = devm_ioremap_resource(&pdev->dev, res);
> +	if (!iomem)
> +		return -ENOMEM;
> +
> +	spin_lock_init(&stm32_dmamux->lock);
> +
> +	stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(stm32_dmamux->clk)) {
> +		dev_info(&pdev->dev, "Missing controller clock\n");

Can you check for EPROBE_DEFER and print only for if that is not the error
otherwise we end up sapmming with defered probe issues

> +
> +#ifndef __DMA_STM32_DMAMUX_H
> +#define __DMA_STM32_DMAMUX_H
> +
> +#if defined(CONFIG_STM32_DMAMUX)
> +int stm32_dmamux_set_config(struct device *dev, void *route_data, u32 chan_id);

Why do we need a custom API in this case?

-- 
~Vinod

[toc] | [next] | [standalone]


#1694738

FromPierre Yves MORDRET <pierre-yves.mordret@st.com>
Date2017-07-24 16:00 +0200
Message-ID<u6M3T-5Cy-1@gated-at.bofh.it>
In reply to#1694118

On 07/22/2017 08:51 AM, Vinod Koul wrote:
> On Thu, Jul 06, 2017 at 02:20:20PM +0200, Pierre-Yves MORDRET wrote:
>> +static int stm32_dmamux_probe(struct platform_device *pdev)
>> +{
>> +	struct device_node *node = pdev->dev.of_node;
>> +	struct device_node *dma_node;
>> +	struct stm32_dmamux_data *stm32_dmamux;
>> +	struct resource *res;
>> +	void __iomem *iomem;
>> +	int i, ret;
>> +
>> +	if (!node)
>> +		return -ENODEV;
>> +
>> +	stm32_dmamux = devm_kzalloc(&pdev->dev, sizeof(*stm32_dmamux),
>> +				    GFP_KERNEL);
>> +	if (!stm32_dmamux)
>> +		return -ENOMEM;
>> +
>> +	dma_node = of_parse_phandle(node, "dma-masters", 0);
>> +	if (!dma_node) {
>> +		dev_err(&pdev->dev, "Can't get DMA master node\n");
>> +		return -ENODEV;
>> +	}
>> +
>> +	if (device_property_read_u32(&pdev->dev, "dma-channels",
>> +				     &stm32_dmamux->dmamux_channels))
>> +		stm32_dmamux->dmamux_channels = STM32_DMAMUX_MAX_CHANNELS;
>> +
>> +	if (device_property_read_u32(&pdev->dev, "dma-requests",
>> +				     &stm32_dmamux->dmamux_requests))
>> +		stm32_dmamux->dmamux_requests = STM32_DMAMUX_MAX_REQUESTS;
> 
> I think defaults should be warned here too
> 

ok

>> +
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +	if (!res)
>> +		return -ENODEV;
>> +
>> +	iomem = devm_ioremap_resource(&pdev->dev, res);
>> +	if (!iomem)
>> +		return -ENOMEM;
>> +
>> +	spin_lock_init(&stm32_dmamux->lock);
>> +
>> +	stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL);
>> +	if (IS_ERR(stm32_dmamux->clk)) {
>> +		dev_info(&pdev->dev, "Missing controller clock\n");
> 
> Can you check for EPROBE_DEFER and print only for if that is not the error
> otherwise we end up sapmming with defered probe issues
> 

This is what you meant ?
	if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER) {
		dev_info(&pdev->dev, "Missing controller clock\n");
		return PTR_ERR(stm32_dmamux->clk);
	}

OR

	if (IS_ERR(stm32_dmamux->clk)) {
		if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER)
			dev_info(&pdev->dev, "Missing controller clock\n");
		return PTR_ERR(stm32_dmamux->clk);
	}

>> +
>> +#ifndef __DMA_STM32_DMAMUX_H
>> +#define __DMA_STM32_DMAMUX_H
>> +
>> +#if defined(CONFIG_STM32_DMAMUX)
>> +int stm32_dmamux_set_config(struct device *dev, void *route_data, u32 chan_id);
> 
> Why do we need a custom API in this case?
> 

This API is called by DMA when a slave is requested by client. DMA can work
without DMAMUX this API has been put in place to configure DMAMUX whether client
is requesting a DMAMUX Channel instead of a DMA one.

Thanks
Py

[toc] | [prev] | [next] | [standalone]


#1696782

FromVinod Koul <vinod.koul@intel.com>
Date2017-07-26 07:30 +0200
Message-ID<u7n3r-4zl-1@gated-at.bofh.it>
In reply to#1694738
On Mon, Jul 24, 2017 at 01:55:10PM +0000, Pierre Yves MORDRET wrote:

> >> +
> >> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >> +	if (!res)
> >> +		return -ENODEV;
> >> +
> >> +	iomem = devm_ioremap_resource(&pdev->dev, res);
> >> +	if (!iomem)
> >> +		return -ENOMEM;
> >> +
> >> +	spin_lock_init(&stm32_dmamux->lock);
> >> +
> >> +	stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL);
> >> +	if (IS_ERR(stm32_dmamux->clk)) {
> >> +		dev_info(&pdev->dev, "Missing controller clock\n");
> > 
> > Can you check for EPROBE_DEFER and print only for if that is not the error
> > otherwise we end up sapmming with defered probe issues
> > 
> 
> This is what you meant ?
> 	if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER) {
> 		dev_info(&pdev->dev, "Missing controller clock\n");
> 		return PTR_ERR(stm32_dmamux->clk);
> 	}
> 
> OR
> 
> 	if (IS_ERR(stm32_dmamux->clk)) {
> 		if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER)
> 			dev_info(&pdev->dev, "Missing controller clock\n");
> 		return PTR_ERR(stm32_dmamux->clk);
> 	}

This one please

> 
> >> +
> >> +#ifndef __DMA_STM32_DMAMUX_H
> >> +#define __DMA_STM32_DMAMUX_H
> >> +
> >> +#if defined(CONFIG_STM32_DMAMUX)
> >> +int stm32_dmamux_set_config(struct device *dev, void *route_data, u32 chan_id);
> > 
> > Why do we need a custom API in this case?
> > 
> 
> This API is called by DMA when a slave is requested by client. DMA can work
> without DMAMUX this API has been put in place to configure DMAMUX whether client
> is requesting a DMAMUX Channel instead of a DMA one.

You mean the dmaengine driver right?

-- 
~Vinod

[toc] | [prev] | [next] | [standalone]


#1696844

FromPierre Yves MORDRET <pierre-yves.mordret@st.com>
Date2017-07-26 09:40 +0200
Message-ID<u7p5f-5Ol-9@gated-at.bofh.it>
In reply to#1696782

On 07/26/2017 07:29 AM, Vinod Koul wrote:
> On Mon, Jul 24, 2017 at 01:55:10PM +0000, Pierre Yves MORDRET wrote:
> 
>>>> +
>>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>> +	if (!res)
>>>> +		return -ENODEV;
>>>> +
>>>> +	iomem = devm_ioremap_resource(&pdev->dev, res);
>>>> +	if (!iomem)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	spin_lock_init(&stm32_dmamux->lock);
>>>> +
>>>> +	stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL);
>>>> +	if (IS_ERR(stm32_dmamux->clk)) {
>>>> +		dev_info(&pdev->dev, "Missing controller clock\n");
>>>
>>> Can you check for EPROBE_DEFER and print only for if that is not the error
>>> otherwise we end up sapmming with defered probe issues
>>>
>>
>> This is what you meant ?
>> 	if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER) {
>> 		dev_info(&pdev->dev, "Missing controller clock\n");
>> 		return PTR_ERR(stm32_dmamux->clk);
>> 	}
>>
>> OR
>>
>> 	if (IS_ERR(stm32_dmamux->clk)) {
>> 		if (IS_ERR(stm32_dmamux->clk) != EPROBE_DEFER)
>> 			dev_info(&pdev->dev, "Missing controller clock\n");
>> 		return PTR_ERR(stm32_dmamux->clk);
>> 	}
> 
> This one please
> 

ok

>>
>>>> +
>>>> +#ifndef __DMA_STM32_DMAMUX_H
>>>> +#define __DMA_STM32_DMAMUX_H
>>>> +
>>>> +#if defined(CONFIG_STM32_DMAMUX)
>>>> +int stm32_dmamux_set_config(struct device *dev, void *route_data, u32 chan_id);
>>>
>>> Why do we need a custom API in this case?
>>>
>>
>> This API is called by DMA when a slave is requested by client. DMA can work
>> without DMAMUX this API has been put in place to configure DMAMUX whether client
>> is requesting a DMAMUX Channel instead of a DMA one.
> 
> You mean the dmaengine driver right?
> 

Yes. The API is mainly called by "device_config" through out STM32 DMA Driver
when a router is in place for client.
Please refer to Patch 4/5 on this set.

Thanks
Py

[toc] | [prev] | [next] | [standalone]


#1699993

FromVinod Koul <vinod.koul@intel.com>
Date2017-07-31 14:30 +0200
Message-ID<u9hZF-6eS-17@gated-at.bofh.it>
In reply to#1696844
On Wed, Jul 26, 2017 at 07:38:02AM +0000, Pierre Yves MORDRET wrote:
> >>>> +
> >>>> +#ifndef __DMA_STM32_DMAMUX_H
> >>>> +#define __DMA_STM32_DMAMUX_H
> >>>> +
> >>>> +#if defined(CONFIG_STM32_DMAMUX)
> >>>> +int stm32_dmamux_set_config(struct device *dev, void *route_data, u32 chan_id);
> >>>
> >>> Why do we need a custom API in this case?
> >>>
> >>
> >> This API is called by DMA when a slave is requested by client. DMA can work
> >> without DMAMUX this API has been put in place to configure DMAMUX whether client
> >> is requesting a DMAMUX Channel instead of a DMA one.
> > 
> > You mean the dmaengine driver right?
> > 
> 
> Yes. The API is mainly called by "device_config" through out STM32 DMA Driver
> when a router is in place for client.
> Please refer to Patch 4/5 on this set.

Okay am thinking on why this can't be generic..? An optional router config
callback?

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web