From patchwork Wed Jul 1 06:54:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Osmialowski X-Patchwork-Id: 489885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 823CE14027C for ; Wed, 1 Jul 2015 16:57:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752988AbbGAG5r (ORCPT ); Wed, 1 Jul 2015 02:57:47 -0400 Received: from fish.king.net.pl ([79.190.246.46]:57650 "EHLO king.net.pl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752114AbbGAG5n (ORCPT ); Wed, 1 Jul 2015 02:57:43 -0400 Received: from localhost.localdomain (fish [127.0.0.1]) by king.net.pl (8.14.9/8.14.0) with ESMTP id t616tHsK008320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 1 Jul 2015 08:55:17 +0200 Received: from localhost (newchief@localhost) by localhost.localdomain (8.14.9/8.14.9/Submit) with ESMTP id t616suo9008316; Wed, 1 Jul 2015 08:54:57 +0200 X-Authentication-Warning: localhost.localdomain: newchief owned process doing -bs Date: Wed, 1 Jul 2015 08:54:56 +0200 (CEST) From: Paul Osmialowski X-X-Sender: newchief@localhost.localdomain To: Arnd Bergmann cc: linux-arm-kernel@lists.infradead.org, Paul Osmialowski , Greg Kroah-Hartman , Ian Campbell , Jiri Slaby , Kumar Gala , Linus Walleij , Mark Rutland , Michael Turquette , Pawel Moll , Rob Herring , Russell King , Stephen Boyd , Vinod Koul , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, Nicolas Pitre , Sergei Poselenov , Paul Bolle , Jingchang Lu , Yuri Tikhonov , Rob Herring , Geert Uytterhoeven , Uwe Kleine-Koenig , Alexander Potashev , Frank Li , Thomas Gleixner , Anson Huang Subject: Re: [PATCH v2 7/9] arm: twr-k70f120m: use Freescale eDMA driver with Kinetis SoC In-Reply-To: <1650263.FfdEQKm1Bu@wuerfel> Message-ID: References: <1435667250-28299-1-git-send-email-pawelo@king.net.pl> <1435667250-28299-8-git-send-email-pawelo@king.net.pl> <1650263.FfdEQKm1Bu@wuerfel> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Hi Arnd, Thanks for pointing this - dma-ranges seem to work properly. This makes the patch much simpler. To be included to the next iteration. I also removed DMA_OF from Kconfig and CONFIG_DMA_OF from my defconfig and it was automatically added during preparation of .cofing for build. On Tue, 30 Jun 2015, Arnd Bergmann wrote: > On Tuesday 30 June 2015 14:27:28 Paul Osmialowski wrote: >> Note that is needed (which is denoted by >> CONFIG_NEED_MACH_MEMORY_H) as it provides macros required for proper >> operation of DMA allocation functions. > > You can't do this, it breaks compilation when multiple platforms > are enabled. > >> Signed-off-by: Paul Osmialowski >> --- >> arch/arm/Kconfig | 4 ++ >> arch/arm/boot/dts/kinetis.dtsi | 34 ++++++++++++++++ >> arch/arm/mach-kinetis/include/mach/memory.h | 61 +++++++++++++++++++++++++++++ >> 3 files changed, 99 insertions(+) >> create mode 100644 arch/arm/mach-kinetis/include/mach/memory.h >> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >> index b21592b..8ccffee 100644 >> --- a/arch/arm/Kconfig >> +++ b/arch/arm/Kconfig >> @@ -971,6 +971,10 @@ config ARCH_KINETIS >> select CLKSRC_KINETIS >> select PINCTRL >> select PINCTRL_KINETIS >> + select DMADEVICES >> + select FSL_EDMA >> + select DMA_OF >> + select NEED_MACH_MEMORY_H > > I think DMA_OF is implied by dmaengine support in combination with CONFIG_OF > >> + >> +#ifndef _MACH_KINETIS_MEMORY_H >> +#define _MACH_KINETIS_MEMORY_H >> + >> +#ifndef __ASSEMBLY__ >> + >> +/* >> + * On Kinetis K70, consistent DMA memory resides in a special >> + * DDRAM alias region (non-cacheable DDRAM at 0x80000000). >> + * >> + */ >> +#define KINETIS_PHYS_DMA_OFFSET UL(0x80000000) >> + >> +/* >> + * Mask of the field used to distinguish DDRAM aliases >> + */ >> +#define KINETIS_DRAM_ALIAS_MASK UL(0xf8000000) > > This should be expressed using the 'dma-ranges' properties in the > bus nodes above any DMA master, the normal DMA mapping code will > then do the right thing. > > Arnd > From e0b549151b3ee8d4419344a2b5ef461bad19b2af Mon Sep 17 00:00:00 2001 From: Paul Osmialowski Date: Mon, 29 Jun 2015 23:37:20 +0200 Subject: [PATCH 7/9] arm: twr-k70f120m: use Freescale eDMA driver with Kinetis SoC Signed-off-by: Paul Osmialowski --- arch/arm/Kconfig | 2 ++ arch/arm/boot/dts/kinetis.dtsi | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b21592b..81a6328 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -971,6 +971,8 @@ config ARCH_KINETIS select CLKSRC_KINETIS select PINCTRL select PINCTRL_KINETIS + select DMADEVICES + select FSL_EDMA help This enables support for the Freescale Kinetis MCUs diff --git a/arch/arm/boot/dts/kinetis.dtsi b/arch/arm/boot/dts/kinetis.dtsi index 5ff1d3b..75fc6d4 100644 --- a/arch/arm/boot/dts/kinetis.dtsi +++ b/arch/arm/boot/dts/kinetis.dtsi @@ -19,6 +19,42 @@ }; soc { + dma-ranges = <0x80000000 0x00000000 0x08000000>; + + edma: dma-controller@40008000 { + compatible = "fsl,kinetis-edma"; + reg = <0x40008000 0x2000>, /* DMAC */ + <0x40021000 0x1000>, /* DMAMUX0 */ + <0x40022000 0x1000>; /* DMAMUX1 */ + #dma-cells = <2>; + dma-channels = <32>; + interrupts = <0>, <1>, <2>, <3>, + <4>, <5>, <6>, <7>, + <8>, <9>, <10>, <11>, + <12>, <13>, <14>, <15>, + <16>; + interrupt-names = "edma-tx-0,16", + "edma-tx-1,17", + "edma-tx-2,18", + "edma-tx-3,19", + "edma-tx-4,20", + "edma-tx-5,21", + "edma-tx-6,22", + "edma-tx-7,23", + "edma-tx-8,24", + "edma-tx-9,25", + "edma-tx-10,26", + "edma-tx-11,27", + "edma-tx-12,28", + "edma-tx-13,29", + "edma-tx-14,30", + "edma-tx-15,31", + "edma-err"; + clocks = <&mcg_cclk_gate 6 1>, + <&mcg_pclk_gate 5 1>, <&mcg_pclk_gate 5 2>; + clock-names = "edma", "dmamux0", "dmamux1"; + }; + portA: pinmux@40049000 { compatible = "fsl,kinetis-padconf"; reg = <0x40049000 0x1000>; -- 2.3.6