From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752736AbdHBJTw (ORCPT ); Wed, 2 Aug 2017 05:19:52 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:17010 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323AbdHBJTu (ORCPT ); Wed, 2 Aug 2017 05:19:50 -0400 Subject: Re: [PATCH v3 2/5] dmaengine: Add STM32 DMAMUX driver To: Vinod Koul , Pierre Yves MORDRET References: <1499343623-5964-1-git-send-email-pierre-yves.mordret@st.com> <1499343623-5964-3-git-send-email-pierre-yves.mordret@st.com> <20170722065133.GT3053@localhost> <2b916330-9b65-f4d5-817f-79b66cc236b3@st.com> <20170726052930.GF3053@localhost> <20170731123157.GJ3053@localhost> <20170802045522.GU3053@localhost> CC: Rob Herring , Mark Rutland , Maxime Coquelin , Alexandre TORGUE , Russell King , Dan Williams , "M'boumba Cedric Madianga" , Fabrice GASNIER , Herbert Xu , Fabien DESSENNE , Amelie DELAUNAY , "dmaengine@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" From: Peter Ujfalusi Message-ID: <7d2091fe-a2e5-78bb-b63d-9cb66bdb7e84@ti.com> Date: Wed, 2 Aug 2017 12:19:06 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170802045522.GU3053@localhost> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-08-02 07:55, Vinod Koul wrote: > On Tue, Aug 01, 2017 at 09:32:50AM +0000, Pierre Yves MORDRET wrote: >> >> >> On 07/31/2017 02:31 PM, Vinod Koul wrote: >>> 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? >>> >> >> I would have liked to answer there is a callback within engine but unfortunately >> I didn't figure out one when I did my router's development. I've looked once >> more but again I can't find how to map chanID and request line without custom API. > > Yes there is no callback for routers but we can add a generic callback > here to be used. I added Peter for his comments, isn't that something they > need too? The event router via of_dma_router_register() should be capable of handling different type of muxers, like the ti-dma-crossbar.c is doing for two different type of event crossbars. Basically with the of_dma_route_allocate you craft a dma_spec which can be understood by the dma-master pointed form the router's node. You do the configuration of the mux in this function, craft the dma_spec and that's it. In DT the peripherals are using the router's node for DMA binding and everything is transparent for them. Note: The use of am335x xbar in the ti-dma-crossbar is optional and only needed when we need to have different event than the default for a specific dma request line. If you normally use the DMA like this: dmas = <&edma 129 1>, <&ddma_xbar 128 1>; dma-names = "tx", "rx"; If you have DMA event router/mux, then depending on how it works you might have different number of parameters. In my case the DRA7 crossbar does not need extra parameter, so to get it in use: dmas = <&edma_xbar 129 1>, <&edma_xbar 128 1>; dma-names = "tx", "rx"; The router driver will rewrite the dma_spec and replace the 129/128 and pass something different to the dma-master (dynamic event mapping). On am335x we have different xbar type so there: dmas = <&edma_xbar 12 0 1>, <&edma_xbar 13 0 2>; Out from this the router driver will create a spec equivalent to dmas = <&edma_xbar 12 0>, <&edma_xbar 13 0>; But it will change the xbar that DMA request 12/13 will not have the default event routed to. I believe that the dma_router infra we have in dmaengine can cover most if not all use cases... - Péter