All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-25 16:16 ` Alexandre TORGUE
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre TORGUE @ 2016-10-25 16:16 UTC (permalink / raw)
  To: Maxime Coquelin, arnd, robh+dt, mark.rutland, linux,
	peter.griffin, lee.jones
  Cc: devicetree, linux-arm-kernel

stm32f469-disco and stm32f429-eval boards use SDRAM start address remapping
(to @0) to boost performances. A DMA translation through "dma-ranges"
property was needed for other masters than the M4 CPU.
stm32f429-disco doesn't use remapping so doesn't need this DMA translation.
This patches moves this DMA translation definition from stm32f429 soc file
to board files.

Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>

diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
index 13c7cd2..a763c15 100644
--- a/arch/arm/boot/dts/stm32429i-eval.dts
+++ b/arch/arm/boot/dts/stm32429i-eval.dts
@@ -82,6 +82,10 @@
 		};
 	};
 
+	soc {
+		dma-ranges = <0xc0000000 0x0 0x10000000>;
+	};
+
 	usbotg_hs_phy: usbphy {
 		#phy-cells = <0>;
 		compatible = "usb-nop-xceiv";
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 0596d60..3a1cfdd 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -59,8 +59,6 @@
 	};
 
 	soc {
-		dma-ranges = <0xc0000000 0x0 0x10000000>;
-
 		timer2: timer@40000000 {
 			compatible = "st,stm32-timer";
 			reg = <0x40000000 0x400>;
diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
index 9e73656..c2213c0 100644
--- a/arch/arm/boot/dts/stm32f469-disco.dts
+++ b/arch/arm/boot/dts/stm32f469-disco.dts
@@ -64,6 +64,10 @@
 	aliases {
 		serial0 = &usart3;
 	};
+
+	soc {
+		dma-ranges = <0xc0000000 0x0 0x10000000>;
+	};
 };
 
 &clk_hse {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-25 16:16 ` Alexandre TORGUE
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre TORGUE @ 2016-10-25 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

stm32f469-disco and stm32f429-eval boards use SDRAM start address remapping
(to @0) to boost performances. A DMA translation through "dma-ranges"
property was needed for other masters than the M4 CPU.
stm32f429-disco doesn't use remapping so doesn't need this DMA translation.
This patches moves this DMA translation definition from stm32f429 soc file
to board files.

Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>

diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
index 13c7cd2..a763c15 100644
--- a/arch/arm/boot/dts/stm32429i-eval.dts
+++ b/arch/arm/boot/dts/stm32429i-eval.dts
@@ -82,6 +82,10 @@
 		};
 	};
 
+	soc {
+		dma-ranges = <0xc0000000 0x0 0x10000000>;
+	};
+
 	usbotg_hs_phy: usbphy {
 		#phy-cells = <0>;
 		compatible = "usb-nop-xceiv";
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 0596d60..3a1cfdd 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -59,8 +59,6 @@
 	};
 
 	soc {
-		dma-ranges = <0xc0000000 0x0 0x10000000>;
-
 		timer2: timer at 40000000 {
 			compatible = "st,stm32-timer";
 			reg = <0x40000000 0x400>;
diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
index 9e73656..c2213c0 100644
--- a/arch/arm/boot/dts/stm32f469-disco.dts
+++ b/arch/arm/boot/dts/stm32f469-disco.dts
@@ -64,6 +64,10 @@
 	aliases {
 		serial0 = &usart3;
 	};
+
+	soc {
+		dma-ranges = <0xc0000000 0x0 0x10000000>;
+	};
 };
 
 &clk_hse {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 18:23                                       ` Bruno Herrera
@ 2016-11-03  8:40                                         ` Alexandre Torgue
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-03  8:40 UTC (permalink / raw)
  To: Bruno Herrera, Radosław Pietrzyk
  Cc: mark.rutland, devicetree, Arnd Bergmann, andrea.merello, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

Hi Bruno,

On 11/02/2016 07:23 PM, Bruno Herrera wrote:
> On Wed, Nov 2, 2016 at 4:05 PM, Radosław Pietrzyk
> <radoslaw.pietrzyk@gmail.com> wrote:
>> Have you tried with
>>
>> sdio {
>> ...
>> compatible = "arm,primecell";
>> arm,primecell-periphid = <id_to_define>;
>> ...
>> }
>>
>> This should register proper amba device and give it an ID you wish.
>
> I'm using this:
>
> sdio: sdio@40012c00 {
> compatible = "arm,pl18x", "arm,primecell";
> arm,primecell-periphid = <0x00480181>;
> reg = <0x40012c00 0x400>;
> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> dma-names = "rx", "tx";
> clocks = <&rcc 0 171>;
> clock-names = "apb_pclk";
> interrupts = <49>;
> status = "disabled";
> };
>
> And on the driver side I added this:
>
> /* STM32 variants */
>
> {
>
>         .id     = 0x00480181,
>
>         .mask   = 0xf0ffffff,
>
>         .data   = &variant_stm32f4x9,
>
> },
>
> My .id field is the .id from variant_ux500 plus one (and what I
> believe is not valid).
> And I cannot read the ID from STM32 IP because it always return zero.
> Maybe someone from ST(@Alex) can get the real ID. ;)

I will have a look on it soon.

regards
alex


>
>
>>
>> 2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
>>>
>>> Hi
>>>
>>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>>> <alexandre.torgue@st.com> wrote:
>>>> Hi
>>>>
>>>> On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
>>>>>
>>>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>>>> node needs it.
>>>>
>>>>
>>>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>>>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>>>> kept in future sdio subnode.
>>>
>>> Now it is clear.
>>>
>>>>
>>>> Bruno,
>>>> Do you plan to push sdio support ?
>>>
>>> Yes I do, but I'm not sure how long it will take. The I had to
>>> change(and hack) the mmci code because I could not get the ID from
>>> STM32 SDIO IP.
>>> My current WIP is at @
>>>
>>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>>> I know Andrea Merello is also working on that (and he probably has a
>>> more complete patch).
>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>>> <mailto:bruherrera@gmail.com>>:
>>>>>
>>>>>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>>>>>     <radoslaw.pietrzyk@gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>>>>>     wrote:
>>>>>     > This is weird because dma ddresses are recalculated using
>>>>> parent's
>>>>>     > dma-ranges property and soc already has it so there should be
>>>>> absolutely no
>>>>>     > problem.
>>>>>
>>>>>     These are my DTS and DTSI file.
>>>>>     >
>>>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>:
>>>>>     >>
>>>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>>>>>     >> <radoslaw.pietrzyk@gmail.com
>>>>>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>>>>>     >> > Have you defined your sdio node within soc node ?
>>>>>     >>
>>>>>     >> It is in the SOC node of the DSTI file.
>>>>>     >>
>>>>>     >> >
>>>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>:
>>>>>     >> >>
>>>>>     >> >> Hi Alex,
>>>>>     >> >>
>>>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>>>     >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.com>>
>>>>> wrote:
>>>>>     >> >> > Hi Bruno,
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>>>     >> >> >>
>>>>>     >> >> >> Hi Alex,
>>>>>     >> >> >>
>>>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>>>     >> >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.com>>
>>>>>     wrote:
>>>>>     >> >> >>>
>>>>>     >> >> >>> Hi Bruno,
>>>>>     >> >> >>>
>>>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Hi Alexandre,
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>>>     start address
>>>>>     >> >> >>>>> remapping
>>>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation
>>>>> through
>>>>>     >> >> >>>>> "dma-ranges"
>>>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>>>     this DMA
>>>>>     >> >> >>>>> translation.
>>>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>>>     stm32f429
>>>>>     >> >> >>>>> soc
>>>>>     >> >> >>>>> file
>>>>>     >> >> >>>>> to board files.
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE
>>>>> <alexandre.torgue@st.com
>>>>>     <mailto:alexandre.torgue@st.com>>
>>>>>
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>>>     >> >> >>>>>                 };
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> +       soc {
>>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> +       };
>>>>>     >> >> >>>>> +
>>>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move
>>>>> to
>>>>>     board
>>>>>     >> >> >>>> specific
>>>>>     >> >> >>>> too?
>>>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>>>     submit:
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>>>     ysterday on
>>>>>     >> >> >>> IIRC,
>>>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>>>>> by
>>>>>     >> >> >>> removing
>>>>>     >> >> >>> dma-ranges in usb node please ?
>>>>>     >> >> >>
>>>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>>>     environment on
>>>>>     >> >> >> the STM32F4-EVAL board.
>>>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>>>     That was the
>>>>>     >> >> >> main reason I did not submit the patch right away.
>>>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>>>     tests with
>>>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>>>     >> >> >>
>>>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>>>     gave me
>>>>>     >> >> >> the
>>>>>     >> >> >> hint.
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>
>>>>>
>>>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>>>
>>>>>
>>>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>>>     >> >> >>
>>>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests
>>>>> are
>>>>>     ok in
>>>>>     >> >> >>> your
>>>>>     >> >> >>> side.
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >> From my understating/conclusion is: when empty
>>>>>     property(dma-ranges)
>>>>>     >> >> >> is
>>>>>     >> >> >> the device node, the mapping will be taken in
>>>>> consideration
>>>>>     when
>>>>>     >> >> >> using
>>>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>>>     question
>>>>>     >> >> >> so
>>>>>     >> >> >> I suppose it can work without the property.
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> > For sure translation has to be done but I'm not sure that
>>>>> an
>>>>>     empty
>>>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>>>     Ethernet
>>>>>     >> >> > empty
>>>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>>>     >> >>
>>>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>>>     working SDIO
>>>>>     >> >> node:
>>>>>     >> >>
>>>>>     >> >> sdio: sdio@40012c00 {
>>>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>>>     >> >> reg = <0x40012c00 0x400>;
>>>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>>>     >> >> dma-names = "rx", "tx";
>>>>>     >> >> clocks = <&rcc 0 171>;
>>>>>     >> >> clock-names = "apb_pclk";
>>>>>     >> >> interrupts = <49>;
>>>>>     >> >> status = "disabled";
>>>>>     >> >> };
>>>>>     >> >>
>>>>>     >> >> &sdio {
>>>>>     >> >> status = "okay";
>>>>>     >> >> vmmc-supply = <&wlan_en>;
>>>>>     >> >> bus-width = <4>;
>>>>>     >> >> max-frequency = <24000000>;
>>>>>     >> >> pinctrl-names = "default";
>>>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>>>     >> >> ti,non-removable;
>>>>>     >> >> ti,needs-special-hs-handling;
>>>>>     >> >> dma-ranges;
>>>>>     >> >> cap-power-off-card;
>>>>>     >> >> keep-power-in-suspend;
>>>>>     >> >>
>>>>>     >> >> #address-cells = <1>;
>>>>>     >> >> #size-cells = <0>;
>>>>>     >> >> wlcore: wlcore@0 {
>>>>>     >> >> compatible = "ti,wl1835";
>>>>>     >> >> reg = <2>;
>>>>>     >> >> interrupt-parent = <&gpioa>;
>>>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>>>     >> >> };
>>>>>     >> >> };
>>>>>     >> >>
>>>>>     >> >> >
>>>>>     >> >> > alex
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> >>
>>>>>     >> >> >>>
>>>>>     >> >> >>> Thanks in advance
>>>>>     >> >> >>> Alex
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>
>>>>>
>>>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board
>>>>> not
>>>>>     at dtsi
>>>>>     >> >> >>>> file
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>>>>> board";
>>>>>     >> >> >>>>         compatible = "st,stm32429i-eval",
>>>>> "st,stm32f429";
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> +       soc {
>>>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>> +       };
>>>>>     >> >> >>>> +
>>>>>     >> >> >>>>         chosen {
>>>>>     >> >> >>>>                 bootargs = "root=/dev/ram
>>>>> rdinit=/linuxrc";
>>>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>  &ethernet0 {
>>>>>     >> >> >>>>         status = "okay";
>>>>>     >> >> >>>> +       dma-ranges;
>>>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>>     >> >> >>>>         pinctrl-names   = "default";
>>>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>>>     >> >> >>>>  };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>  &usbotg_hs {
>>>>>     >> >> >>>> +       dma-ranges;
>>>>>     >> >> >>>>         dr_mode = "host";
>>>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>>>     >> >> >>>>         };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>         soc {
>>>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>                 timer2: timer@40000000 {
>>>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>>>     >> >> >>>>                         snps,pbl = <8>;
>>>>>     >> >> >>>>                         snps,mixed-burst;
>>>>>     >> >> >>>> -                       dma-ranges;
>>>>>     >> >> >>>>                         status = "disabled";
>>>>>     >> >> >>>>                 };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>>>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>>>     >> >> >>>> -                       dma-ranges;
>>>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>>>     >> >> >>>>                         interrupts = <77>;
>>>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>>         soc {
>>>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> -
>>>>>     >> >> >>>>>                 timer2: timer@40000000 {
>>>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>>>     >> >> >>>>>         aliases {
>>>>>     >> >> >>>>>                 serial0 = &usart3;
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>> +
>>>>>     >> >> >>>>> +       soc {
>>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> +       };
>>>>>     >> >> >>>>>  };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>>  &clk_hse {
>>>>>     >> >> >>>>> --
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Br.,
>>>>>     >> >> >>>> Bruno
>>>>>     >> >> >>>>
>>>>>     >> >> >>>
>>>>>     >> >> >
>>>>>     >> >>
>>>>>     >> >> _______________________________________________
>>>>>     >> >> linux-arm-kernel mailing list
>>>>>     >> >> linux-arm-kernel@lists.infradead.org
>>>>>     <mailto:linux-arm-kernel@lists.infradead.org>
>>>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>>>     >> >
>>>>>     >> >
>>>>>     >
>>>>>     >
>>>>>
>>>>>
>>>>
>>
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-03  8:40                                         ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-03  8:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bruno,

On 11/02/2016 07:23 PM, Bruno Herrera wrote:
> On Wed, Nov 2, 2016 at 4:05 PM, Rados?aw Pietrzyk
> <radoslaw.pietrzyk@gmail.com> wrote:
>> Have you tried with
>>
>> sdio {
>> ...
>> compatible = "arm,primecell";
>> arm,primecell-periphid = <id_to_define>;
>> ...
>> }
>>
>> This should register proper amba device and give it an ID you wish.
>
> I'm using this:
>
> sdio: sdio at 40012c00 {
> compatible = "arm,pl18x", "arm,primecell";
> arm,primecell-periphid = <0x00480181>;
> reg = <0x40012c00 0x400>;
> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> dma-names = "rx", "tx";
> clocks = <&rcc 0 171>;
> clock-names = "apb_pclk";
> interrupts = <49>;
> status = "disabled";
> };
>
> And on the driver side I added this:
>
> /* STM32 variants */
>
> {
>
>         .id     = 0x00480181,
>
>         .mask   = 0xf0ffffff,
>
>         .data   = &variant_stm32f4x9,
>
> },
>
> My .id field is the .id from variant_ux500 plus one (and what I
> believe is not valid).
> And I cannot read the ID from STM32 IP because it always return zero.
> Maybe someone from ST(@Alex) can get the real ID. ;)

I will have a look on it soon.

regards
alex


>
>
>>
>> 2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
>>>
>>> Hi
>>>
>>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>>> <alexandre.torgue@st.com> wrote:
>>>> Hi
>>>>
>>>> On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
>>>>>
>>>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>>>> node needs it.
>>>>
>>>>
>>>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>>>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>>>> kept in future sdio subnode.
>>>
>>> Now it is clear.
>>>
>>>>
>>>> Bruno,
>>>> Do you plan to push sdio support ?
>>>
>>> Yes I do, but I'm not sure how long it will take. The I had to
>>> change(and hack) the mmci code because I could not get the ID from
>>> STM32 SDIO IP.
>>> My current WIP is at @
>>>
>>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>>> I know Andrea Merello is also working on that (and he probably has a
>>> more complete patch).
>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>>> <mailto:bruherrera@gmail.com>>:
>>>>>
>>>>>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>>>>>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>>>>>     wrote:
>>>>>     > This is weird because dma ddresses are recalculated using
>>>>> parent's
>>>>>     > dma-ranges property and soc already has it so there should be
>>>>> absolutely no
>>>>>     > problem.
>>>>>
>>>>>     These are my DTS and DTSI file.
>>>>>     >
>>>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>:
>>>>>     >>
>>>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>>>>>     >> <radoslaw.pietrzyk@gmail.com
>>>>>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>>>>>     >> > Have you defined your sdio node within soc node ?
>>>>>     >>
>>>>>     >> It is in the SOC node of the DSTI file.
>>>>>     >>
>>>>>     >> >
>>>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>:
>>>>>     >> >>
>>>>>     >> >> Hi Alex,
>>>>>     >> >>
>>>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>>>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>>>> wrote:
>>>>>     >> >> > Hi Bruno,
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>>>     >> >> >>
>>>>>     >> >> >> Hi Alex,
>>>>>     >> >> >>
>>>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>>>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>>>>     wrote:
>>>>>     >> >> >>>
>>>>>     >> >> >>> Hi Bruno,
>>>>>     >> >> >>>
>>>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Hi Alexandre,
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>>>     start address
>>>>>     >> >> >>>>> remapping
>>>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation
>>>>> through
>>>>>     >> >> >>>>> "dma-ranges"
>>>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>>>     this DMA
>>>>>     >> >> >>>>> translation.
>>>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>>>     stm32f429
>>>>>     >> >> >>>>> soc
>>>>>     >> >> >>>>> file
>>>>>     >> >> >>>>> to board files.
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE
>>>>> <alexandre.torgue@st.com
>>>>>     <mailto:alexandre.torgue@st.com>>
>>>>>
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>>>     >> >> >>>>>                 };
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>> +       soc {
>>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> +       };
>>>>>     >> >> >>>>> +
>>>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move
>>>>> to
>>>>>     board
>>>>>     >> >> >>>> specific
>>>>>     >> >> >>>> too?
>>>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>>>     submit:
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>>>     ysterday on
>>>>>     >> >> >>> IIRC,
>>>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>>>>> by
>>>>>     >> >> >>> removing
>>>>>     >> >> >>> dma-ranges in usb node please ?
>>>>>     >> >> >>
>>>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>>>     environment on
>>>>>     >> >> >> the STM32F4-EVAL board.
>>>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>>>     That was the
>>>>>     >> >> >> main reason I did not submit the patch right away.
>>>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>>>     tests with
>>>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>>>     >> >> >>
>>>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>>>     gave me
>>>>>     >> >> >> the
>>>>>     >> >> >> hint.
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>
>>>>>
>>>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>>>
>>>>>
>>>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>>>     >> >> >>
>>>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests
>>>>> are
>>>>>     ok in
>>>>>     >> >> >>> your
>>>>>     >> >> >>> side.
>>>>>     >> >> >>
>>>>>     >> >> >>
>>>>>     >> >> >> From my understating/conclusion is: when empty
>>>>>     property(dma-ranges)
>>>>>     >> >> >> is
>>>>>     >> >> >> the device node, the mapping will be taken in
>>>>> consideration
>>>>>     when
>>>>>     >> >> >> using
>>>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>>>     question
>>>>>     >> >> >> so
>>>>>     >> >> >> I suppose it can work without the property.
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> > For sure translation has to be done but I'm not sure that
>>>>> an
>>>>>     empty
>>>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>>>     Ethernet
>>>>>     >> >> > empty
>>>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>>>     >> >>
>>>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>>>     working SDIO
>>>>>     >> >> node:
>>>>>     >> >>
>>>>>     >> >> sdio: sdio at 40012c00 {
>>>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>>>     >> >> reg = <0x40012c00 0x400>;
>>>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>>>     >> >> dma-names = "rx", "tx";
>>>>>     >> >> clocks = <&rcc 0 171>;
>>>>>     >> >> clock-names = "apb_pclk";
>>>>>     >> >> interrupts = <49>;
>>>>>     >> >> status = "disabled";
>>>>>     >> >> };
>>>>>     >> >>
>>>>>     >> >> &sdio {
>>>>>     >> >> status = "okay";
>>>>>     >> >> vmmc-supply = <&wlan_en>;
>>>>>     >> >> bus-width = <4>;
>>>>>     >> >> max-frequency = <24000000>;
>>>>>     >> >> pinctrl-names = "default";
>>>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>>>     >> >> ti,non-removable;
>>>>>     >> >> ti,needs-special-hs-handling;
>>>>>     >> >> dma-ranges;
>>>>>     >> >> cap-power-off-card;
>>>>>     >> >> keep-power-in-suspend;
>>>>>     >> >>
>>>>>     >> >> #address-cells = <1>;
>>>>>     >> >> #size-cells = <0>;
>>>>>     >> >> wlcore: wlcore at 0 {
>>>>>     >> >> compatible = "ti,wl1835";
>>>>>     >> >> reg = <2>;
>>>>>     >> >> interrupt-parent = <&gpioa>;
>>>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>>>     >> >> };
>>>>>     >> >> };
>>>>>     >> >>
>>>>>     >> >> >
>>>>>     >> >> > alex
>>>>>     >> >> >
>>>>>     >> >> >
>>>>>     >> >> >>
>>>>>     >> >> >>>
>>>>>     >> >> >>> Thanks in advance
>>>>>     >> >> >>> Alex
>>>>>     >> >> >>>
>>>>>     >> >> >>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>>>>>     <mailto:bruherrera@gmail.com>>
>>>>>
>>>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board
>>>>> not
>>>>>     at dtsi
>>>>>     >> >> >>>> file
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>>>>> board";
>>>>>     >> >> >>>>         compatible = "st,stm32429i-eval",
>>>>> "st,stm32f429";
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> +       soc {
>>>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>> +       };
>>>>>     >> >> >>>> +
>>>>>     >> >> >>>>         chosen {
>>>>>     >> >> >>>>                 bootargs = "root=/dev/ram
>>>>> rdinit=/linuxrc";
>>>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>  &ethernet0 {
>>>>>     >> >> >>>>         status = "okay";
>>>>>     >> >> >>>> +       dma-ranges;
>>>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>>     >> >> >>>>         pinctrl-names   = "default";
>>>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>>>     >> >> >>>>  };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>  &usbotg_hs {
>>>>>     >> >> >>>> +       dma-ranges;
>>>>>     >> >> >>>>         dr_mode = "host";
>>>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>>>     >> >> >>>>         };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>         soc {
>>>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>                 timer2: timer at 40000000 {
>>>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>>>     >> >> >>>>                         snps,pbl = <8>;
>>>>>     >> >> >>>>                         snps,mixed-burst;
>>>>>     >> >> >>>> -                       dma-ranges;
>>>>>     >> >> >>>>                         status = "disabled";
>>>>>     >> >> >>>>                 };
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>>>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>>>     >> >> >>>> -                       dma-ranges;
>>>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>>>     >> >> >>>>                         interrupts = <77>;
>>>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>>         soc {
>>>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> -
>>>>>     >> >> >>>>>                 timer2: timer at 40000000 {
>>>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>>>     >> >> >>>>>         aliases {
>>>>>     >> >> >>>>>                 serial0 = &usart3;
>>>>>     >> >> >>>>>         };
>>>>>     >> >> >>>>> +
>>>>>     >> >> >>>>> +       soc {
>>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>>> 0x10000000>;
>>>>>     >> >> >>>>> +       };
>>>>>     >> >> >>>>>  };
>>>>>     >> >> >>>>>
>>>>>     >> >> >>>>>  &clk_hse {
>>>>>     >> >> >>>>> --
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>>
>>>>>     >> >> >>>> Br.,
>>>>>     >> >> >>>> Bruno
>>>>>     >> >> >>>>
>>>>>     >> >> >>>
>>>>>     >> >> >
>>>>>     >> >>
>>>>>     >> >> _______________________________________________
>>>>>     >> >> linux-arm-kernel mailing list
>>>>>     >> >> linux-arm-kernel at lists.infradead.org
>>>>>     <mailto:linux-arm-kernel@lists.infradead.org>
>>>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>>>     >> >
>>>>>     >> >
>>>>>     >
>>>>>     >
>>>>>
>>>>>
>>>>
>>
>>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 18:23                                       ` Bruno Herrera
  (?)
@ 2016-11-03  7:43                                       ` Radosław Pietrzyk
  -1 siblings, 0 replies; 32+ messages in thread
From: Radosław Pietrzyk @ 2016-11-03  7:43 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Alexandre Torgue, mark.rutland, devicetree, Arnd Bergmann, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel, andrea.merello

[-- Attachment #1: Type: text/plain, Size: 17755 bytes --]

Ok now I get it. Than definitelly STM is the right target unless it really
needs a special variant.

2016-11-02 19:23 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:

> On Wed, Nov 2, 2016 at 4:05 PM, Radosław Pietrzyk
> <radoslaw.pietrzyk@gmail.com> wrote:
> > Have you tried with
> >
> > sdio {
> > ...
> > compatible = "arm,primecell";
> > arm,primecell-periphid = <id_to_define>;
> > ...
> > }
> >
> > This should register proper amba device and give it an ID you wish.
>
> I'm using this:
>
> sdio: sdio@40012c00 {
> compatible = "arm,pl18x", "arm,primecell";
> arm,primecell-periphid = <0x00480181>;
> reg = <0x40012c00 0x400>;
> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> dma-names = "rx", "tx";
> clocks = <&rcc 0 171>;
> clock-names = "apb_pclk";
> interrupts = <49>;
> status = "disabled";
> };
>
> And on the driver side I added this:
>
> /* STM32 variants */
>
> {
>
>         .id     = 0x00480181,
>
>         .mask   = 0xf0ffffff,
>
>         .data   = &variant_stm32f4x9,
>
> },
>
> My .id field is the .id from variant_ux500 plus one (and what I
> believe is not valid).
> And I cannot read the ID from STM32 IP because it always return zero.
> Maybe someone from ST(@Alex) can get the real ID. ;)
>
>
> >
> > 2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
> >>
> >> Hi
> >>
> >> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
> >> <alexandre.torgue@st.com> wrote:
> >> > Hi
> >> >
> >> > On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
> >> >>
> >> >> I think wlcore driver searches dma-ranges in its parent that's why
> sdio
> >> >> node needs it.
> >> >
> >> >
> >> > Yes I agree. In this case it is needed as you have subnode in sdio
> node.
> >> > So IMO empty dma-ranges could be removed from ethernet and usb node,
> but
> >> > kept in future sdio subnode.
> >>
> >> Now it is clear.
> >>
> >> >
> >> > Bruno,
> >> > Do you plan to push sdio support ?
> >>
> >> Yes I do, but I'm not sure how long it will take. The I had to
> >> change(and hack) the mmci code because I could not get the ID from
> >> STM32 SDIO IP.
> >> My current WIP is at @
> >>
> >> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#
> issuecomment-247571615
> >> I know Andrea Merello is also working on that (and he probably has a
> >> more complete patch).
> >>
> >> >
> >> >
> >> >
> >> >>
> >> >> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
> >> >> <mailto:bruherrera@gmail.com>>:
> >> >>
> >> >>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
> >> >>     <radoslaw.pietrzyk@gmail.com <mailto:radoslaw.pietrzyk@gmail.com
> >>
> >> >>     wrote:
> >> >>     > This is weird because dma ddresses are recalculated using
> >> >> parent's
> >> >>     > dma-ranges property and soc already has it so there should be
> >> >> absolutely no
> >> >>     > problem.
> >> >>
> >> >>     These are my DTS and DTSI file.
> >> >>     >
> >> >>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
> >> >>     <mailto:bruherrera@gmail.com>>:
> >> >>     >>
> >> >>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
> >> >>     >> <radoslaw.pietrzyk@gmail.com
> >> >>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
> >> >>     >> > Have you defined your sdio node within soc node ?
> >> >>     >>
> >> >>     >> It is in the SOC node of the DSTI file.
> >> >>     >>
> >> >>     >> >
> >> >>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <
> bruherrera@gmail.com
> >> >>     <mailto:bruherrera@gmail.com>>:
> >> >>     >> >>
> >> >>     >> >> Hi Alex,
> >> >>     >> >>
> >> >>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
> >> >>     >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.com>>
> >> >> wrote:
> >> >>     >> >> > Hi Bruno,
> >> >>     >> >> >
> >> >>     >> >> >
> >> >>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> >> >>     >> >> >>
> >> >>     >> >> >> Hi Alex,
> >> >>     >> >> >>
> >> >>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> >> >>     >> >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.
> com>>
> >> >>     wrote:
> >> >>     >> >> >>>
> >> >>     >> >> >>> Hi Bruno,
> >> >>     >> >> >>>
> >> >>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> Hi Alexandre,
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
> >> >>     start address
> >> >>     >> >> >>>>> remapping
> >> >>     >> >> >>>>> (to @0) to boost performances. A DMA translation
> >> >> through
> >> >>     >> >> >>>>> "dma-ranges"
> >> >>     >> >> >>>>> property was needed for other masters than the M4
> CPU.
> >> >>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
> >> >>     this DMA
> >> >>     >> >> >>>>> translation.
> >> >>     >> >> >>>>> This patches moves this DMA translation definition
> from
> >> >>     stm32f429
> >> >>     >> >> >>>>> soc
> >> >>     >> >> >>>>> file
> >> >>     >> >> >>>>> to board files.
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>> Signed-off-by: Alexandre TORGUE
> >> >> <alexandre.torgue@st.com
> >> >>     <mailto:alexandre.torgue@st.com>>
> >> >>
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>>> index 13c7cd2..a763c15 100644
> >> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>>> @@ -82,6 +82,10 @@
> >> >>     >> >> >>>>>                 };
> >> >>     >> >> >>>>>         };
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>> +       soc {
> >> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
> >> >> 0x10000000>;
> >> >>     >> >> >>>>> +       };
> >> >>     >> >> >>>>> +
> >> >>     >> >> >>>>>         usbotg_hs_phy: usbphy {
> >> >>     >> >> >>>>>                 #phy-cells = <0>;
> >> >>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move
> >> >> to
> >> >>     board
> >> >>     >> >> >>>> specific
> >> >>     >> >> >>>> too?
> >> >>     >> >> >>>> I  had this patch for while but I didn't had the time
> to
> >> >>     submit:
> >> >>     >> >> >>>
> >> >>     >> >> >>>
> >> >>     >> >> >>>
> >> >>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
> >> >>     ysterday on
> >> >>     >> >> >>> IIRC,
> >> >>     >> >> >>> empty dma-ranges is not needed. Can you test on your
> side
> >> >> by
> >> >>     >> >> >>> removing
> >> >>     >> >> >>> dma-ranges in usb node please ?
> >> >>     >> >> >>
> >> >>     >> >> >> Unfortunately will take a time for me to set up this
> >> >>     environment on
> >> >>     >> >> >> the STM32F4-EVAL board.
> >> >>     >> >> >> And on the discovery boards we dont have this scenario.
> >> >>     That was the
> >> >>     >> >> >> main reason I did not submit the patch right away.
> >> >>     >> >> >> My conclusion and I might be wrong but is based on the
> my
> >> >>     tests with
> >> >>     >> >> >> SDIO device at STM32F469I-DISCO board.
> >> >>     >> >> >>
> >> >>     >> >> >> I started this issue as discussion at ST Forum but
> Maxime
> >> >>     gave me
> >> >>     >> >> >> the
> >> >>     >> >> >> hint.
> >> >>     >> >> >>
> >> >>     >> >> >>
> >> >>     >> >> >>
> >> >>     >> >> >>
> >> >>     >> >> >>
> >> >>
> >> >>
> >> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44
> >> >>
> >> >>
> >> >> <https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44>
> >> >>     >> >> >>
> >> >>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests
> >> >> are
> >> >>     ok in
> >> >>     >> >> >>> your
> >> >>     >> >> >>> side.
> >> >>     >> >> >>
> >> >>     >> >> >>
> >> >>     >> >> >> From my understating/conclusion is: when empty
> >> >>     property(dma-ranges)
> >> >>     >> >> >> is
> >> >>     >> >> >> the device node, the mapping will be taken in
> >> >> consideration
> >> >>     when
> >> >>     >> >> >> using
> >> >>     >> >> >> DMA otherwise the mapping is ignored.
> >> >>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM)
> and
> >> >>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices
> in
> >> >>     question
> >> >>     >> >> >> so
> >> >>     >> >> >> I suppose it can work without the property.
> >> >>     >> >> >
> >> >>     >> >> >
> >> >>     >> >> > For sure translation has to be done but I'm not sure that
> >> >> an
> >> >>     empty
> >> >>     >> >> > "dma-ranges" is needed in device node to activate it. For
> >> >>     Ethernet
> >> >>     >> >> > empty
> >> >>     >> >> > "dma-ranges" is not needed. I will try with usb.
> >> >>     >> >>
> >> >>     >> >> In the case of SDIO it is needed. As example this is my
> >> >>     working SDIO
> >> >>     >> >> node:
> >> >>     >> >>
> >> >>     >> >> sdio: sdio@40012c00 {
> >> >>     >> >> compatible = "arm,pl18x", "arm,primecell";
> >> >>     >> >> arm,primecell-periphid = <0x00480181>;
> >> >>     >> >> reg = <0x40012c00 0x400>;
> >> >>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> >> >>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> >> >>     >> >> dma-names = "rx", "tx";
> >> >>     >> >> clocks = <&rcc 0 171>;
> >> >>     >> >> clock-names = "apb_pclk";
> >> >>     >> >> interrupts = <49>;
> >> >>     >> >> status = "disabled";
> >> >>     >> >> };
> >> >>     >> >>
> >> >>     >> >> &sdio {
> >> >>     >> >> status = "okay";
> >> >>     >> >> vmmc-supply = <&wlan_en>;
> >> >>     >> >> bus-width = <4>;
> >> >>     >> >> max-frequency = <24000000>;
> >> >>     >> >> pinctrl-names = "default";
> >> >>     >> >> pinctrl-0 = <&sdio_pins>;
> >> >>     >> >> ti,non-removable;
> >> >>     >> >> ti,needs-special-hs-handling;
> >> >>     >> >> dma-ranges;
> >> >>     >> >> cap-power-off-card;
> >> >>     >> >> keep-power-in-suspend;
> >> >>     >> >>
> >> >>     >> >> #address-cells = <1>;
> >> >>     >> >> #size-cells = <0>;
> >> >>     >> >> wlcore: wlcore@0 {
> >> >>     >> >> compatible = "ti,wl1835";
> >> >>     >> >> reg = <2>;
> >> >>     >> >> interrupt-parent = <&gpioa>;
> >> >>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
> >> >>     >> >> };
> >> >>     >> >> };
> >> >>     >> >>
> >> >>     >> >> >
> >> >>     >> >> > alex
> >> >>     >> >> >
> >> >>     >> >> >
> >> >>     >> >> >>
> >> >>     >> >> >>>
> >> >>     >> >> >>> Thanks in advance
> >> >>     >> >> >>> Alex
> >> >>     >> >> >>>
> >> >>     >> >> >>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
> >> >>     <mailto:bruherrera@gmail.com>>
> >> >>
> >> >>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board
> >> >> not
> >> >>     at dtsi
> >> >>     >> >> >>>> file
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>> index 6bfc595..2a22a82 100644
> >> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>     >> >> >>>> @@ -52,6 +52,10 @@
> >> >>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
> >> >> board";
> >> >>     >> >> >>>>         compatible = "st,stm32429i-eval",
> >> >> "st,stm32f429";
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> +       soc {
> >> >>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0
> >> >> 0x10000000>;
> >> >>     >> >> >>>> +       };
> >> >>     >> >> >>>> +
> >> >>     >> >> >>>>         chosen {
> >> >>     >> >> >>>>                 bootargs = "root=/dev/ram
> >> >> rdinit=/linuxrc";
> >> >>     >> >> >>>>                 stdout-path = "serial0:115200n8";
> >> >>     >> >> >>>> @@ -96,6 +100,7 @@
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>  &ethernet0 {
> >> >>     >> >> >>>>         status = "okay";
> >> >>     >> >> >>>> +       dma-ranges;
> >> >>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
> >> >>     >> >> >>>>         pinctrl-names   = "default";
> >> >>     >> >> >>>>         phy-mode        = "mii-id";
> >> >>     >> >> >>>> @@ -116,6 +121,7 @@
> >> >>     >> >> >>>>  };
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>  &usbotg_hs {
> >> >>     >> >> >>>> +       dma-ranges;
> >> >>     >> >> >>>>         dr_mode = "host";
> >> >>     >> >> >>>>         phys = <&usbotg_hs_phy>;
> >> >>     >> >> >>>>         phy-names = "usb2-phy";
> >> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>> index 7d624a2..697a133 100644
> >> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>> @@ -59,7 +59,6 @@
> >> >>     >> >> >>>>         };
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>         soc {
> >> >>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0
> >> >> 0x10000000>;
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>                 timer2: timer@40000000 {
> >> >>     >> >> >>>>                         compatible = "st,stm32-timer";
> >> >>     >> >> >>>> @@ -472,13 +471,11 @@
> >> >>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
> >> >>     >> >> >>>>                         snps,pbl = <8>;
> >> >>     >> >> >>>>                         snps,mixed-burst;
> >> >>     >> >> >>>> -                       dma-ranges;
> >> >>     >> >> >>>>                         status = "disabled";
> >> >>     >> >> >>>>                 };
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>                 usbotg_hs: usb@40040000 {
> >> >>     >> >> >>>>                         compatible = "snps,dwc2";
> >> >>     >> >> >>>> -                       dma-ranges;
> >> >>     >> >> >>>>                         reg = <0x40040000 0x40000>;
> >> >>     >> >> >>>>                         interrupts = <77>;
> >> >>     >> >> >>>>                         clocks = <&rcc 0 29>;
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>>> index 0596d60..3a1cfdd 100644
> >> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>     >> >> >>>>> @@ -59,8 +59,6 @@
> >> >>     >> >> >>>>>         };
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>>         soc {
> >> >>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
> >> >> 0x10000000>;
> >> >>     >> >> >>>>> -
> >> >>     >> >> >>>>>                 timer2: timer@40000000 {
> >> >>     >> >> >>>>>                         compatible =
> "st,stm32-timer";
> >> >>     >> >> >>>>>                         reg = <0x40000000 0x400>;
> >> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>     >> >> >>>>> index 9e73656..c2213c0 100644
> >> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>     >> >> >>>>> @@ -64,6 +64,10 @@
> >> >>     >> >> >>>>>         aliases {
> >> >>     >> >> >>>>>                 serial0 = &usart3;
> >> >>     >> >> >>>>>         };
> >> >>     >> >> >>>>> +
> >> >>     >> >> >>>>> +       soc {
> >> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
> >> >> 0x10000000>;
> >> >>     >> >> >>>>> +       };
> >> >>     >> >> >>>>>  };
> >> >>     >> >> >>>>>
> >> >>     >> >> >>>>>  &clk_hse {
> >> >>     >> >> >>>>> --
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>>
> >> >>     >> >> >>>> Br.,
> >> >>     >> >> >>>> Bruno
> >> >>     >> >> >>>>
> >> >>     >> >> >>>
> >> >>     >> >> >
> >> >>     >> >>
> >> >>     >> >> _______________________________________________
> >> >>     >> >> linux-arm-kernel mailing list
> >> >>     >> >> linux-arm-kernel@lists.infradead.org
> >> >>     <mailto:linux-arm-kernel@lists.infradead.org>
> >> >>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-
> kernel
> >> >>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
> >> >>     >> >
> >> >>     >> >
> >> >>     >
> >> >>     >
> >> >>
> >> >>
> >> >
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 33868 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 16:14                                     ` Alexandre Torgue
@ 2016-11-02 18:24                                         ` Bruno Herrera
  -1 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 18:24 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: Radosław Pietrzyk, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Andrea Merello

On Wed, Nov 2, 2016 at 2:14 PM, Alexandre Torgue
<alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>
>
> On 11/02/2016 05:07 PM, Bruno Herrera wrote:
>>
>> Hi
>>
>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>>>
>>> Hi
>>>
>>> On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
>>>>
>>>>
>>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>>> node needs it.
>>>
>>>
>>>
>>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>>> kept in future sdio subnode.
>>
>>
>> Now it is clear.
>
> Nice. Can I add your tested-by ?
>
Sure

>>
>>>
>>> Bruno,
>>> Do you plan to push sdio support ?
>>
>>
>> Yes I do, but I'm not sure how long it will take. The I had to
>> change(and hack) the mmci code because I could not get the ID from
>> STM32 SDIO IP.
>> My current WIP is at @
>>
>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>> I know Andrea Merello is also working on that (and he probably has a
>> more complete patch).
>>
>>>
>>>
>>>
>>>>
>>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>> <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>>
>>>>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>>>>     <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>>>     wrote:
>>>>     > This is weird because dma ddresses are recalculated using parent's
>>>>     > dma-ranges property and soc already has it so there should be
>>>> absolutely no
>>>>     > problem.
>>>>
>>>>     These are my DTS and DTSI file.
>>>>     >
>>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>>     >>
>>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>>>>     >> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>>     <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>>>>     >> > Have you defined your sdio node within soc node ?
>>>>     >>
>>>>     >> It is in the SOC node of the DSTI file.
>>>>     >>
>>>>     >> >
>>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8@public.gmane.orgm
>>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>>     >> >>
>>>>     >> >> Hi Alex,
>>>>     >> >>
>>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>>     >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>>> wrote:
>>>>     >> >> > Hi Bruno,
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>>     >> >> >>
>>>>     >> >> >> Hi Alex,
>>>>     >> >> >>
>>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>>     >> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>>>     wrote:
>>>>     >> >> >>>
>>>>     >> >> >>> Hi Bruno,
>>>>     >> >> >>>
>>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Hi Alexandre,
>>>>     >> >> >>>>
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>>     start address
>>>>     >> >> >>>>> remapping
>>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>>>     >> >> >>>>> "dma-ranges"
>>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>>     this DMA
>>>>     >> >> >>>>> translation.
>>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>>     stm32f429
>>>>     >> >> >>>>> soc
>>>>     >> >> >>>>> file
>>>>     >> >> >>>>> to board files.
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com
>>>>     <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>>>
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>>     >> >> >>>>>                 };
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> +       soc {
>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> +       };
>>>>     >> >> >>>>> +
>>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>>>     board
>>>>     >> >> >>>> specific
>>>>     >> >> >>>> too?
>>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>>     submit:
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>>     ysterday on
>>>>     >> >> >>> IIRC,
>>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>>>> by
>>>>     >> >> >>> removing
>>>>     >> >> >>> dma-ranges in usb node please ?
>>>>     >> >> >>
>>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>>     environment on
>>>>     >> >> >> the STM32F4-EVAL board.
>>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>>     That was the
>>>>     >> >> >> main reason I did not submit the patch right away.
>>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>>     tests with
>>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>>     >> >> >>
>>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>>     gave me
>>>>     >> >> >> the
>>>>     >> >> >> hint.
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>
>>>>
>>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>>
>>>>
>>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>>     >> >> >>
>>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>>>     ok in
>>>>     >> >> >>> your
>>>>     >> >> >>> side.
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >> From my understating/conclusion is: when empty
>>>>     property(dma-ranges)
>>>>     >> >> >> is
>>>>     >> >> >> the device node, the mapping will be taken in consideration
>>>>     when
>>>>     >> >> >> using
>>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>>     question
>>>>     >> >> >> so
>>>>     >> >> >> I suppose it can work without the property.
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> > For sure translation has to be done but I'm not sure that an
>>>>     empty
>>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>>     Ethernet
>>>>     >> >> > empty
>>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>>     >> >>
>>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>>     working SDIO
>>>>     >> >> node:
>>>>     >> >>
>>>>     >> >> sdio: sdio@40012c00 {
>>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>>     >> >> reg = <0x40012c00 0x400>;
>>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>>     >> >> dma-names = "rx", "tx";
>>>>     >> >> clocks = <&rcc 0 171>;
>>>>     >> >> clock-names = "apb_pclk";
>>>>     >> >> interrupts = <49>;
>>>>     >> >> status = "disabled";
>>>>     >> >> };
>>>>     >> >>
>>>>     >> >> &sdio {
>>>>     >> >> status = "okay";
>>>>     >> >> vmmc-supply = <&wlan_en>;
>>>>     >> >> bus-width = <4>;
>>>>     >> >> max-frequency = <24000000>;
>>>>     >> >> pinctrl-names = "default";
>>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>>     >> >> ti,non-removable;
>>>>     >> >> ti,needs-special-hs-handling;
>>>>     >> >> dma-ranges;
>>>>     >> >> cap-power-off-card;
>>>>     >> >> keep-power-in-suspend;
>>>>     >> >>
>>>>     >> >> #address-cells = <1>;
>>>>     >> >> #size-cells = <0>;
>>>>     >> >> wlcore: wlcore@0 {
>>>>     >> >> compatible = "ti,wl1835";
>>>>     >> >> reg = <2>;
>>>>     >> >> interrupt-parent = <&gpioa>;
>>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>>     >> >> };
>>>>     >> >> };
>>>>     >> >>
>>>>     >> >> >
>>>>     >> >> > alex
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> >>
>>>>     >> >> >>>
>>>>     >> >> >>> Thanks in advance
>>>>     >> >> >>> Alex
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>>>
>>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>     >> >> >>>>
>>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>>>     at dtsi
>>>>     >> >> >>>> file
>>>>     >> >> >>>>
>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>>>> board";
>>>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>>     >> >> >>>>
>>>>     >> >> >>>> +       soc {
>>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>>     >> >> >>>> +       };
>>>>     >> >> >>>> +
>>>>     >> >> >>>>         chosen {
>>>>     >> >> >>>>                 bootargs = "root=/dev/ram
>>>> rdinit=/linuxrc";
>>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>>     >> >> >>>>
>>>>     >> >> >>>>  &ethernet0 {
>>>>     >> >> >>>>         status = "okay";
>>>>     >> >> >>>> +       dma-ranges;
>>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>     >> >> >>>>         pinctrl-names   = "default";
>>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>>     >> >> >>>>  };
>>>>     >> >> >>>>
>>>>     >> >> >>>>  &usbotg_hs {
>>>>     >> >> >>>> +       dma-ranges;
>>>>     >> >> >>>>         dr_mode = "host";
>>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>>     >> >> >>>>         };
>>>>     >> >> >>>>
>>>>     >> >> >>>>         soc {
>>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>     >> >> >>>>
>>>>     >> >> >>>>                 timer2: timer@40000000 {
>>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>>     >> >> >>>>                         snps,pbl = <8>;
>>>>     >> >> >>>>                         snps,mixed-burst;
>>>>     >> >> >>>> -                       dma-ranges;
>>>>     >> >> >>>>                         status = "disabled";
>>>>     >> >> >>>>                 };
>>>>     >> >> >>>>
>>>>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>>     >> >> >>>> -                       dma-ranges;
>>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>>     >> >> >>>>                         interrupts = <77>;
>>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>>         soc {
>>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> -
>>>>     >> >> >>>>>                 timer2: timer@40000000 {
>>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>>     >> >> >>>>>         aliases {
>>>>     >> >> >>>>>                 serial0 = &usart3;
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>> +
>>>>     >> >> >>>>> +       soc {
>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> +       };
>>>>     >> >> >>>>>  };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>>  &clk_hse {
>>>>     >> >> >>>>> --
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Br.,
>>>>     >> >> >>>> Bruno
>>>>     >> >> >>>>
>>>>     >> >> >>>
>>>>     >> >> >
>>>>     >> >>
>>>>     >> >> _______________________________________________
>>>>     >> >> linux-arm-kernel mailing list
>>>>     >> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>>>     <mailto:linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
>>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>>     >> >
>>>>     >> >
>>>>     >
>>>>     >
>>>>
>>>>
>>>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-02 18:24                                         ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 2, 2016 at 2:14 PM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
>
>
> On 11/02/2016 05:07 PM, Bruno Herrera wrote:
>>
>> Hi
>>
>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>> <alexandre.torgue@st.com> wrote:
>>>
>>> Hi
>>>
>>> On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
>>>>
>>>>
>>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>>> node needs it.
>>>
>>>
>>>
>>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>>> kept in future sdio subnode.
>>
>>
>> Now it is clear.
>
> Nice. Can I add your tested-by ?
>
Sure

>>
>>>
>>> Bruno,
>>> Do you plan to push sdio support ?
>>
>>
>> Yes I do, but I'm not sure how long it will take. The I had to
>> change(and hack) the mmci code because I could not get the ID from
>> STM32 SDIO IP.
>> My current WIP is at @
>>
>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>> I know Andrea Merello is also working on that (and he probably has a
>> more complete patch).
>>
>>>
>>>
>>>
>>>>
>>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>> <mailto:bruherrera@gmail.com>>:
>>>>
>>>>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>>>>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>>>>     wrote:
>>>>     > This is weird because dma ddresses are recalculated using parent's
>>>>     > dma-ranges property and soc already has it so there should be
>>>> absolutely no
>>>>     > problem.
>>>>
>>>>     These are my DTS and DTSI file.
>>>>     >
>>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>>     <mailto:bruherrera@gmail.com>>:
>>>>     >>
>>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>>>>     >> <radoslaw.pietrzyk@gmail.com
>>>>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>>>>     >> > Have you defined your sdio node within soc node ?
>>>>     >>
>>>>     >> It is in the SOC node of the DSTI file.
>>>>     >>
>>>>     >> >
>>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>>>>     <mailto:bruherrera@gmail.com>>:
>>>>     >> >>
>>>>     >> >> Hi Alex,
>>>>     >> >>
>>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>>> wrote:
>>>>     >> >> > Hi Bruno,
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>>     >> >> >>
>>>>     >> >> >> Hi Alex,
>>>>     >> >> >>
>>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>>>     wrote:
>>>>     >> >> >>>
>>>>     >> >> >>> Hi Bruno,
>>>>     >> >> >>>
>>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Hi Alexandre,
>>>>     >> >> >>>>
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>>     start address
>>>>     >> >> >>>>> remapping
>>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>>>     >> >> >>>>> "dma-ranges"
>>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>>     this DMA
>>>>     >> >> >>>>> translation.
>>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>>     stm32f429
>>>>     >> >> >>>>> soc
>>>>     >> >> >>>>> file
>>>>     >> >> >>>>> to board files.
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com
>>>>     <mailto:alexandre.torgue@st.com>>
>>>>
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>>     >> >> >>>>>                 };
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>> +       soc {
>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> +       };
>>>>     >> >> >>>>> +
>>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>>>     board
>>>>     >> >> >>>> specific
>>>>     >> >> >>>> too?
>>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>>     submit:
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>>     ysterday on
>>>>     >> >> >>> IIRC,
>>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>>>> by
>>>>     >> >> >>> removing
>>>>     >> >> >>> dma-ranges in usb node please ?
>>>>     >> >> >>
>>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>>     environment on
>>>>     >> >> >> the STM32F4-EVAL board.
>>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>>     That was the
>>>>     >> >> >> main reason I did not submit the patch right away.
>>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>>     tests with
>>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>>     >> >> >>
>>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>>     gave me
>>>>     >> >> >> the
>>>>     >> >> >> hint.
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >>
>>>>
>>>>
>>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>>
>>>>
>>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>>     >> >> >>
>>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>>>     ok in
>>>>     >> >> >>> your
>>>>     >> >> >>> side.
>>>>     >> >> >>
>>>>     >> >> >>
>>>>     >> >> >> From my understating/conclusion is: when empty
>>>>     property(dma-ranges)
>>>>     >> >> >> is
>>>>     >> >> >> the device node, the mapping will be taken in consideration
>>>>     when
>>>>     >> >> >> using
>>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>>     question
>>>>     >> >> >> so
>>>>     >> >> >> I suppose it can work without the property.
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> > For sure translation has to be done but I'm not sure that an
>>>>     empty
>>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>>     Ethernet
>>>>     >> >> > empty
>>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>>     >> >>
>>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>>     working SDIO
>>>>     >> >> node:
>>>>     >> >>
>>>>     >> >> sdio: sdio at 40012c00 {
>>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>>     >> >> reg = <0x40012c00 0x400>;
>>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>>     >> >> dma-names = "rx", "tx";
>>>>     >> >> clocks = <&rcc 0 171>;
>>>>     >> >> clock-names = "apb_pclk";
>>>>     >> >> interrupts = <49>;
>>>>     >> >> status = "disabled";
>>>>     >> >> };
>>>>     >> >>
>>>>     >> >> &sdio {
>>>>     >> >> status = "okay";
>>>>     >> >> vmmc-supply = <&wlan_en>;
>>>>     >> >> bus-width = <4>;
>>>>     >> >> max-frequency = <24000000>;
>>>>     >> >> pinctrl-names = "default";
>>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>>     >> >> ti,non-removable;
>>>>     >> >> ti,needs-special-hs-handling;
>>>>     >> >> dma-ranges;
>>>>     >> >> cap-power-off-card;
>>>>     >> >> keep-power-in-suspend;
>>>>     >> >>
>>>>     >> >> #address-cells = <1>;
>>>>     >> >> #size-cells = <0>;
>>>>     >> >> wlcore: wlcore at 0 {
>>>>     >> >> compatible = "ti,wl1835";
>>>>     >> >> reg = <2>;
>>>>     >> >> interrupt-parent = <&gpioa>;
>>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>>     >> >> };
>>>>     >> >> };
>>>>     >> >>
>>>>     >> >> >
>>>>     >> >> > alex
>>>>     >> >> >
>>>>     >> >> >
>>>>     >> >> >>
>>>>     >> >> >>>
>>>>     >> >> >>> Thanks in advance
>>>>     >> >> >>> Alex
>>>>     >> >> >>>
>>>>     >> >> >>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>>>>     <mailto:bruherrera@gmail.com>>
>>>>
>>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>     >> >> >>>>
>>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>>>     at dtsi
>>>>     >> >> >>>> file
>>>>     >> >> >>>>
>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>>>> board";
>>>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>>     >> >> >>>>
>>>>     >> >> >>>> +       soc {
>>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>>     >> >> >>>> +       };
>>>>     >> >> >>>> +
>>>>     >> >> >>>>         chosen {
>>>>     >> >> >>>>                 bootargs = "root=/dev/ram
>>>> rdinit=/linuxrc";
>>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>>     >> >> >>>>
>>>>     >> >> >>>>  &ethernet0 {
>>>>     >> >> >>>>         status = "okay";
>>>>     >> >> >>>> +       dma-ranges;
>>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>     >> >> >>>>         pinctrl-names   = "default";
>>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>>     >> >> >>>>  };
>>>>     >> >> >>>>
>>>>     >> >> >>>>  &usbotg_hs {
>>>>     >> >> >>>> +       dma-ranges;
>>>>     >> >> >>>>         dr_mode = "host";
>>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>>     >> >> >>>>         };
>>>>     >> >> >>>>
>>>>     >> >> >>>>         soc {
>>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>     >> >> >>>>
>>>>     >> >> >>>>                 timer2: timer at 40000000 {
>>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>>     >> >> >>>>                         snps,pbl = <8>;
>>>>     >> >> >>>>                         snps,mixed-burst;
>>>>     >> >> >>>> -                       dma-ranges;
>>>>     >> >> >>>>                         status = "disabled";
>>>>     >> >> >>>>                 };
>>>>     >> >> >>>>
>>>>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>>     >> >> >>>> -                       dma-ranges;
>>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>>     >> >> >>>>                         interrupts = <77>;
>>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>>         soc {
>>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> -
>>>>     >> >> >>>>>                 timer2: timer at 40000000 {
>>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>>     >> >> >>>>>         aliases {
>>>>     >> >> >>>>>                 serial0 = &usart3;
>>>>     >> >> >>>>>         };
>>>>     >> >> >>>>> +
>>>>     >> >> >>>>> +       soc {
>>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>>>> 0x10000000>;
>>>>     >> >> >>>>> +       };
>>>>     >> >> >>>>>  };
>>>>     >> >> >>>>>
>>>>     >> >> >>>>>  &clk_hse {
>>>>     >> >> >>>>> --
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>>
>>>>     >> >> >>>> Br.,
>>>>     >> >> >>>> Bruno
>>>>     >> >> >>>>
>>>>     >> >> >>>
>>>>     >> >> >
>>>>     >> >>
>>>>     >> >> _______________________________________________
>>>>     >> >> linux-arm-kernel mailing list
>>>>     >> >> linux-arm-kernel at lists.infradead.org
>>>>     <mailto:linux-arm-kernel@lists.infradead.org>
>>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>>     >> >
>>>>     >> >
>>>>     >
>>>>     >
>>>>
>>>>
>>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 18:05                                 ` Radosław Pietrzyk
@ 2016-11-02 18:23                                       ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 18:23 UTC (permalink / raw)
  To: Radosław Pietrzyk
  Cc: Alexandre Torgue, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	andrea.merello-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Nov 2, 2016 at 4:05 PM, Radosław Pietrzyk
<radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Have you tried with
>
> sdio {
> ...
> compatible = "arm,primecell";
> arm,primecell-periphid = <id_to_define>;
> ...
> }
>
> This should register proper amba device and give it an ID you wish.

I'm using this:

sdio: sdio@40012c00 {
compatible = "arm,pl18x", "arm,primecell";
arm,primecell-periphid = <0x00480181>;
reg = <0x40012c00 0x400>;
dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
<&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
dma-names = "rx", "tx";
clocks = <&rcc 0 171>;
clock-names = "apb_pclk";
interrupts = <49>;
status = "disabled";
};

And on the driver side I added this:

/* STM32 variants */

{

        .id     = 0x00480181,

        .mask   = 0xf0ffffff,

        .data   = &variant_stm32f4x9,

},

My .id field is the .id from variant_ux500 plus one (and what I
believe is not valid).
And I cannot read the ID from STM32 IP because it always return zero.
Maybe someone from ST(@Alex) can get the real ID. ;)


>
> 2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>>
>> Hi
>>
>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> > Hi
>> >
>> > On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
>> >>
>> >> I think wlcore driver searches dma-ranges in its parent that's why sdio
>> >> node needs it.
>> >
>> >
>> > Yes I agree. In this case it is needed as you have subnode in sdio node.
>> > So IMO empty dma-ranges could be removed from ethernet and usb node, but
>> > kept in future sdio subnode.
>>
>> Now it is clear.
>>
>> >
>> > Bruno,
>> > Do you plan to push sdio support ?
>>
>> Yes I do, but I'm not sure how long it will take. The I had to
>> change(and hack) the mmci code because I could not get the ID from
>> STM32 SDIO IP.
>> My current WIP is at @
>>
>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>> I know Andrea Merello is also working on that (and he probably has a
>> more complete patch).
>>
>> >
>> >
>> >
>> >>
>> >> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> >> <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>> >>
>> >>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>> >>     <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>> >>     wrote:
>> >>     > This is weird because dma ddresses are recalculated using
>> >> parent's
>> >>     > dma-ranges property and soc already has it so there should be
>> >> absolutely no
>> >>     > problem.
>> >>
>> >>     These are my DTS and DTSI file.
>> >>     >
>> >>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> >>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>> >>     >>
>> >>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>> >>     >> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> >>     <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>> >>     >> > Have you defined your sdio node within soc node ?
>> >>     >>
>> >>     >> It is in the SOC node of the DSTI file.
>> >>     >>
>> >>     >> >
>> >>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>> >>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>> >>     >> >>
>> >>     >> >> Hi Alex,
>> >>     >> >>
>> >>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> >>     >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>> >> wrote:
>> >>     >> >> > Hi Bruno,
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >>     >> >> >>
>> >>     >> >> >> Hi Alex,
>> >>     >> >> >>
>> >>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >>     >> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>> >>     wrote:
>> >>     >> >> >>>
>> >>     >> >> >>> Hi Bruno,
>> >>     >> >> >>>
>> >>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Hi Alexandre,
>> >>     >> >> >>>>
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>> >>     start address
>> >>     >> >> >>>>> remapping
>> >>     >> >> >>>>> (to @0) to boost performances. A DMA translation
>> >> through
>> >>     >> >> >>>>> "dma-ranges"
>> >>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>> >>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>> >>     this DMA
>> >>     >> >> >>>>> translation.
>> >>     >> >> >>>>> This patches moves this DMA translation definition from
>> >>     stm32f429
>> >>     >> >> >>>>> soc
>> >>     >> >> >>>>> file
>> >>     >> >> >>>>> to board files.
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> Signed-off-by: Alexandre TORGUE
>> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org
>> >>     <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>> >>
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> index 13c7cd2..a763c15 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> @@ -82,6 +82,10 @@
>> >>     >> >> >>>>>                 };
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> +       soc {
>> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> +       };
>> >>     >> >> >>>>> +
>> >>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>> >>     >> >> >>>>>                 #phy-cells = <0>;
>> >>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move
>> >> to
>> >>     board
>> >>     >> >> >>>> specific
>> >>     >> >> >>>> too?
>> >>     >> >> >>>> I  had this patch for while but I didn't had the time to
>> >>     submit:
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>> >>     ysterday on
>> >>     >> >> >>> IIRC,
>> >>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>> >> by
>> >>     >> >> >>> removing
>> >>     >> >> >>> dma-ranges in usb node please ?
>> >>     >> >> >>
>> >>     >> >> >> Unfortunately will take a time for me to set up this
>> >>     environment on
>> >>     >> >> >> the STM32F4-EVAL board.
>> >>     >> >> >> And on the discovery boards we dont have this scenario.
>> >>     That was the
>> >>     >> >> >> main reason I did not submit the patch right away.
>> >>     >> >> >> My conclusion and I might be wrong but is based on the my
>> >>     tests with
>> >>     >> >> >> SDIO device at STM32F469I-DISCO board.
>> >>     >> >> >>
>> >>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>> >>     gave me
>> >>     >> >> >> the
>> >>     >> >> >> hint.
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>
>> >>
>> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >>
>> >>
>> >> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>> >>     >> >> >>
>> >>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests
>> >> are
>> >>     ok in
>> >>     >> >> >>> your
>> >>     >> >> >>> side.
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >> From my understating/conclusion is: when empty
>> >>     property(dma-ranges)
>> >>     >> >> >> is
>> >>     >> >> >> the device node, the mapping will be taken in
>> >> consideration
>> >>     when
>> >>     >> >> >> using
>> >>     >> >> >> DMA otherwise the mapping is ignored.
>> >>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>> >>     question
>> >>     >> >> >> so
>> >>     >> >> >> I suppose it can work without the property.
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> > For sure translation has to be done but I'm not sure that
>> >> an
>> >>     empty
>> >>     >> >> > "dma-ranges" is needed in device node to activate it. For
>> >>     Ethernet
>> >>     >> >> > empty
>> >>     >> >> > "dma-ranges" is not needed. I will try with usb.
>> >>     >> >>
>> >>     >> >> In the case of SDIO it is needed. As example this is my
>> >>     working SDIO
>> >>     >> >> node:
>> >>     >> >>
>> >>     >> >> sdio: sdio@40012c00 {
>> >>     >> >> compatible = "arm,pl18x", "arm,primecell";
>> >>     >> >> arm,primecell-periphid = <0x00480181>;
>> >>     >> >> reg = <0x40012c00 0x400>;
>> >>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> >>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> >>     >> >> dma-names = "rx", "tx";
>> >>     >> >> clocks = <&rcc 0 171>;
>> >>     >> >> clock-names = "apb_pclk";
>> >>     >> >> interrupts = <49>;
>> >>     >> >> status = "disabled";
>> >>     >> >> };
>> >>     >> >>
>> >>     >> >> &sdio {
>> >>     >> >> status = "okay";
>> >>     >> >> vmmc-supply = <&wlan_en>;
>> >>     >> >> bus-width = <4>;
>> >>     >> >> max-frequency = <24000000>;
>> >>     >> >> pinctrl-names = "default";
>> >>     >> >> pinctrl-0 = <&sdio_pins>;
>> >>     >> >> ti,non-removable;
>> >>     >> >> ti,needs-special-hs-handling;
>> >>     >> >> dma-ranges;
>> >>     >> >> cap-power-off-card;
>> >>     >> >> keep-power-in-suspend;
>> >>     >> >>
>> >>     >> >> #address-cells = <1>;
>> >>     >> >> #size-cells = <0>;
>> >>     >> >> wlcore: wlcore@0 {
>> >>     >> >> compatible = "ti,wl1835";
>> >>     >> >> reg = <2>;
>> >>     >> >> interrupt-parent = <&gpioa>;
>> >>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> >>     >> >> };
>> >>     >> >> };
>> >>     >> >>
>> >>     >> >> >
>> >>     >> >> > alex
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> >>
>> >>     >> >> >>>
>> >>     >> >> >>> Thanks in advance
>> >>     >> >> >>> Alex
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> >>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>> >>
>> >>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >>     >> >> >>>>
>> >>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board
>> >> not
>> >>     at dtsi
>> >>     >> >> >>>> file
>> >>     >> >> >>>>
>> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> index 6bfc595..2a22a82 100644
>> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> @@ -52,6 +52,10 @@
>> >>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>> >> board";
>> >>     >> >> >>>>         compatible = "st,stm32429i-eval",
>> >> "st,stm32f429";
>> >>     >> >> >>>>
>> >>     >> >> >>>> +       soc {
>> >>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>> +       };
>> >>     >> >> >>>> +
>> >>     >> >> >>>>         chosen {
>> >>     >> >> >>>>                 bootargs = "root=/dev/ram
>> >> rdinit=/linuxrc";
>> >>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>> >>     >> >> >>>> @@ -96,6 +100,7 @@
>> >>     >> >> >>>>
>> >>     >> >> >>>>  &ethernet0 {
>> >>     >> >> >>>>         status = "okay";
>> >>     >> >> >>>> +       dma-ranges;
>> >>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >>     >> >> >>>>         pinctrl-names   = "default";
>> >>     >> >> >>>>         phy-mode        = "mii-id";
>> >>     >> >> >>>> @@ -116,6 +121,7 @@
>> >>     >> >> >>>>  };
>> >>     >> >> >>>>
>> >>     >> >> >>>>  &usbotg_hs {
>> >>     >> >> >>>> +       dma-ranges;
>> >>     >> >> >>>>         dr_mode = "host";
>> >>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>> >>     >> >> >>>>         phy-names = "usb2-phy";
>> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> index 7d624a2..697a133 100644
>> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> @@ -59,7 +59,6 @@
>> >>     >> >> >>>>         };
>> >>     >> >> >>>>
>> >>     >> >> >>>>         soc {
>> >>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>
>> >>     >> >> >>>>                 timer2: timer@40000000 {
>> >>     >> >> >>>>                         compatible = "st,stm32-timer";
>> >>     >> >> >>>> @@ -472,13 +471,11 @@
>> >>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>> >>     >> >> >>>>                         snps,pbl = <8>;
>> >>     >> >> >>>>                         snps,mixed-burst;
>> >>     >> >> >>>> -                       dma-ranges;
>> >>     >> >> >>>>                         status = "disabled";
>> >>     >> >> >>>>                 };
>> >>     >> >> >>>>
>> >>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>> >>     >> >> >>>>                         compatible = "snps,dwc2";
>> >>     >> >> >>>> -                       dma-ranges;
>> >>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>> >>     >> >> >>>>                         interrupts = <77>;
>> >>     >> >> >>>>                         clocks = <&rcc 0 29>;
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> @@ -59,8 +59,6 @@
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>>         soc {
>> >>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> -
>> >>     >> >> >>>>>                 timer2: timer@40000000 {
>> >>     >> >> >>>>>                         compatible = "st,stm32-timer";
>> >>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> index 9e73656..c2213c0 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> @@ -64,6 +64,10 @@
>> >>     >> >> >>>>>         aliases {
>> >>     >> >> >>>>>                 serial0 = &usart3;
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>> +
>> >>     >> >> >>>>> +       soc {
>> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> +       };
>> >>     >> >> >>>>>  };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>>  &clk_hse {
>> >>     >> >> >>>>> --
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Br.,
>> >>     >> >> >>>> Bruno
>> >>     >> >> >>>>
>> >>     >> >> >>>
>> >>     >> >> >
>> >>     >> >>
>> >>     >> >> _______________________________________________
>> >>     >> >> linux-arm-kernel mailing list
>> >>     >> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>> >>     <mailto:linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
>> >>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>> >>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>> >>     >> >
>> >>     >> >
>> >>     >
>> >>     >
>> >>
>> >>
>> >
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-02 18:23                                       ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 2, 2016 at 4:05 PM, Rados?aw Pietrzyk
<radoslaw.pietrzyk@gmail.com> wrote:
> Have you tried with
>
> sdio {
> ...
> compatible = "arm,primecell";
> arm,primecell-periphid = <id_to_define>;
> ...
> }
>
> This should register proper amba device and give it an ID you wish.

I'm using this:

sdio: sdio at 40012c00 {
compatible = "arm,pl18x", "arm,primecell";
arm,primecell-periphid = <0x00480181>;
reg = <0x40012c00 0x400>;
dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
<&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
dma-names = "rx", "tx";
clocks = <&rcc 0 171>;
clock-names = "apb_pclk";
interrupts = <49>;
status = "disabled";
};

And on the driver side I added this:

/* STM32 variants */

{

        .id     = 0x00480181,

        .mask   = 0xf0ffffff,

        .data   = &variant_stm32f4x9,

},

My .id field is the .id from variant_ux500 plus one (and what I
believe is not valid).
And I cannot read the ID from STM32 IP because it always return zero.
Maybe someone from ST(@Alex) can get the real ID. ;)


>
> 2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
>>
>> Hi
>>
>> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
>> <alexandre.torgue@st.com> wrote:
>> > Hi
>> >
>> > On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
>> >>
>> >> I think wlcore driver searches dma-ranges in its parent that's why sdio
>> >> node needs it.
>> >
>> >
>> > Yes I agree. In this case it is needed as you have subnode in sdio node.
>> > So IMO empty dma-ranges could be removed from ethernet and usb node, but
>> > kept in future sdio subnode.
>>
>> Now it is clear.
>>
>> >
>> > Bruno,
>> > Do you plan to push sdio support ?
>>
>> Yes I do, but I'm not sure how long it will take. The I had to
>> change(and hack) the mmci code because I could not get the ID from
>> STM32 SDIO IP.
>> My current WIP is at @
>>
>> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
>> I know Andrea Merello is also working on that (and he probably has a
>> more complete patch).
>>
>> >
>> >
>> >
>> >>
>> >> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>> >> <mailto:bruherrera@gmail.com>>:
>> >>
>> >>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>> >>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>> >>     wrote:
>> >>     > This is weird because dma ddresses are recalculated using
>> >> parent's
>> >>     > dma-ranges property and soc already has it so there should be
>> >> absolutely no
>> >>     > problem.
>> >>
>> >>     These are my DTS and DTSI file.
>> >>     >
>> >>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>> >>     <mailto:bruherrera@gmail.com>>:
>> >>     >>
>> >>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>> >>     >> <radoslaw.pietrzyk@gmail.com
>> >>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>> >>     >> > Have you defined your sdio node within soc node ?
>> >>     >>
>> >>     >> It is in the SOC node of the DSTI file.
>> >>     >>
>> >>     >> >
>> >>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>> >>     <mailto:bruherrera@gmail.com>>:
>> >>     >> >>
>> >>     >> >> Hi Alex,
>> >>     >> >>
>> >>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> >>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>> >> wrote:
>> >>     >> >> > Hi Bruno,
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >>     >> >> >>
>> >>     >> >> >> Hi Alex,
>> >>     >> >> >>
>> >>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>> >>     wrote:
>> >>     >> >> >>>
>> >>     >> >> >>> Hi Bruno,
>> >>     >> >> >>>
>> >>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Hi Alexandre,
>> >>     >> >> >>>>
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>> >>     start address
>> >>     >> >> >>>>> remapping
>> >>     >> >> >>>>> (to @0) to boost performances. A DMA translation
>> >> through
>> >>     >> >> >>>>> "dma-ranges"
>> >>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>> >>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>> >>     this DMA
>> >>     >> >> >>>>> translation.
>> >>     >> >> >>>>> This patches moves this DMA translation definition from
>> >>     stm32f429
>> >>     >> >> >>>>> soc
>> >>     >> >> >>>>> file
>> >>     >> >> >>>>> to board files.
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> Signed-off-by: Alexandre TORGUE
>> >> <alexandre.torgue@st.com
>> >>     <mailto:alexandre.torgue@st.com>>
>> >>
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> index 13c7cd2..a763c15 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>>> @@ -82,6 +82,10 @@
>> >>     >> >> >>>>>                 };
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>> +       soc {
>> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> +       };
>> >>     >> >> >>>>> +
>> >>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>> >>     >> >> >>>>>                 #phy-cells = <0>;
>> >>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move
>> >> to
>> >>     board
>> >>     >> >> >>>> specific
>> >>     >> >> >>>> too?
>> >>     >> >> >>>> I  had this patch for while but I didn't had the time to
>> >>     submit:
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>> >>     ysterday on
>> >>     >> >> >>> IIRC,
>> >>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
>> >> by
>> >>     >> >> >>> removing
>> >>     >> >> >>> dma-ranges in usb node please ?
>> >>     >> >> >>
>> >>     >> >> >> Unfortunately will take a time for me to set up this
>> >>     environment on
>> >>     >> >> >> the STM32F4-EVAL board.
>> >>     >> >> >> And on the discovery boards we dont have this scenario.
>> >>     That was the
>> >>     >> >> >> main reason I did not submit the patch right away.
>> >>     >> >> >> My conclusion and I might be wrong but is based on the my
>> >>     tests with
>> >>     >> >> >> SDIO device at STM32F469I-DISCO board.
>> >>     >> >> >>
>> >>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>> >>     gave me
>> >>     >> >> >> the
>> >>     >> >> >> hint.
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >>
>> >>
>> >>
>> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >>
>> >>
>> >> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>> >>     >> >> >>
>> >>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests
>> >> are
>> >>     ok in
>> >>     >> >> >>> your
>> >>     >> >> >>> side.
>> >>     >> >> >>
>> >>     >> >> >>
>> >>     >> >> >> From my understating/conclusion is: when empty
>> >>     property(dma-ranges)
>> >>     >> >> >> is
>> >>     >> >> >> the device node, the mapping will be taken in
>> >> consideration
>> >>     when
>> >>     >> >> >> using
>> >>     >> >> >> DMA otherwise the mapping is ignored.
>> >>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>> >>     question
>> >>     >> >> >> so
>> >>     >> >> >> I suppose it can work without the property.
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> > For sure translation has to be done but I'm not sure that
>> >> an
>> >>     empty
>> >>     >> >> > "dma-ranges" is needed in device node to activate it. For
>> >>     Ethernet
>> >>     >> >> > empty
>> >>     >> >> > "dma-ranges" is not needed. I will try with usb.
>> >>     >> >>
>> >>     >> >> In the case of SDIO it is needed. As example this is my
>> >>     working SDIO
>> >>     >> >> node:
>> >>     >> >>
>> >>     >> >> sdio: sdio at 40012c00 {
>> >>     >> >> compatible = "arm,pl18x", "arm,primecell";
>> >>     >> >> arm,primecell-periphid = <0x00480181>;
>> >>     >> >> reg = <0x40012c00 0x400>;
>> >>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> >>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> >>     >> >> dma-names = "rx", "tx";
>> >>     >> >> clocks = <&rcc 0 171>;
>> >>     >> >> clock-names = "apb_pclk";
>> >>     >> >> interrupts = <49>;
>> >>     >> >> status = "disabled";
>> >>     >> >> };
>> >>     >> >>
>> >>     >> >> &sdio {
>> >>     >> >> status = "okay";
>> >>     >> >> vmmc-supply = <&wlan_en>;
>> >>     >> >> bus-width = <4>;
>> >>     >> >> max-frequency = <24000000>;
>> >>     >> >> pinctrl-names = "default";
>> >>     >> >> pinctrl-0 = <&sdio_pins>;
>> >>     >> >> ti,non-removable;
>> >>     >> >> ti,needs-special-hs-handling;
>> >>     >> >> dma-ranges;
>> >>     >> >> cap-power-off-card;
>> >>     >> >> keep-power-in-suspend;
>> >>     >> >>
>> >>     >> >> #address-cells = <1>;
>> >>     >> >> #size-cells = <0>;
>> >>     >> >> wlcore: wlcore at 0 {
>> >>     >> >> compatible = "ti,wl1835";
>> >>     >> >> reg = <2>;
>> >>     >> >> interrupt-parent = <&gpioa>;
>> >>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> >>     >> >> };
>> >>     >> >> };
>> >>     >> >>
>> >>     >> >> >
>> >>     >> >> > alex
>> >>     >> >> >
>> >>     >> >> >
>> >>     >> >> >>
>> >>     >> >> >>>
>> >>     >> >> >>> Thanks in advance
>> >>     >> >> >>> Alex
>> >>     >> >> >>>
>> >>     >> >> >>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>> >>     <mailto:bruherrera@gmail.com>>
>> >>
>> >>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >>     >> >> >>>>
>> >>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board
>> >> not
>> >>     at dtsi
>> >>     >> >> >>>> file
>> >>     >> >> >>>>
>> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> index 6bfc595..2a22a82 100644
>> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>     >> >> >>>> @@ -52,6 +52,10 @@
>> >>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
>> >> board";
>> >>     >> >> >>>>         compatible = "st,stm32429i-eval",
>> >> "st,stm32f429";
>> >>     >> >> >>>>
>> >>     >> >> >>>> +       soc {
>> >>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>> +       };
>> >>     >> >> >>>> +
>> >>     >> >> >>>>         chosen {
>> >>     >> >> >>>>                 bootargs = "root=/dev/ram
>> >> rdinit=/linuxrc";
>> >>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>> >>     >> >> >>>> @@ -96,6 +100,7 @@
>> >>     >> >> >>>>
>> >>     >> >> >>>>  &ethernet0 {
>> >>     >> >> >>>>         status = "okay";
>> >>     >> >> >>>> +       dma-ranges;
>> >>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >>     >> >> >>>>         pinctrl-names   = "default";
>> >>     >> >> >>>>         phy-mode        = "mii-id";
>> >>     >> >> >>>> @@ -116,6 +121,7 @@
>> >>     >> >> >>>>  };
>> >>     >> >> >>>>
>> >>     >> >> >>>>  &usbotg_hs {
>> >>     >> >> >>>> +       dma-ranges;
>> >>     >> >> >>>>         dr_mode = "host";
>> >>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>> >>     >> >> >>>>         phy-names = "usb2-phy";
>> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> index 7d624a2..697a133 100644
>> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>> @@ -59,7 +59,6 @@
>> >>     >> >> >>>>         };
>> >>     >> >> >>>>
>> >>     >> >> >>>>         soc {
>> >>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>
>> >>     >> >> >>>>                 timer2: timer at 40000000 {
>> >>     >> >> >>>>                         compatible = "st,stm32-timer";
>> >>     >> >> >>>> @@ -472,13 +471,11 @@
>> >>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>> >>     >> >> >>>>                         snps,pbl = <8>;
>> >>     >> >> >>>>                         snps,mixed-burst;
>> >>     >> >> >>>> -                       dma-ranges;
>> >>     >> >> >>>>                         status = "disabled";
>> >>     >> >> >>>>                 };
>> >>     >> >> >>>>
>> >>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>> >>     >> >> >>>>                         compatible = "snps,dwc2";
>> >>     >> >> >>>> -                       dma-ranges;
>> >>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>> >>     >> >> >>>>                         interrupts = <77>;
>> >>     >> >> >>>>                         clocks = <&rcc 0 29>;
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>     >> >> >>>>> @@ -59,8 +59,6 @@
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>>         soc {
>> >>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> -
>> >>     >> >> >>>>>                 timer2: timer at 40000000 {
>> >>     >> >> >>>>>                         compatible = "st,stm32-timer";
>> >>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> index 9e73656..c2213c0 100644
>> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>     >> >> >>>>> @@ -64,6 +64,10 @@
>> >>     >> >> >>>>>         aliases {
>> >>     >> >> >>>>>                 serial0 = &usart3;
>> >>     >> >> >>>>>         };
>> >>     >> >> >>>>> +
>> >>     >> >> >>>>> +       soc {
>> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
>> >> 0x10000000>;
>> >>     >> >> >>>>> +       };
>> >>     >> >> >>>>>  };
>> >>     >> >> >>>>>
>> >>     >> >> >>>>>  &clk_hse {
>> >>     >> >> >>>>> --
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>>
>> >>     >> >> >>>> Br.,
>> >>     >> >> >>>> Bruno
>> >>     >> >> >>>>
>> >>     >> >> >>>
>> >>     >> >> >
>> >>     >> >>
>> >>     >> >> _______________________________________________
>> >>     >> >> linux-arm-kernel mailing list
>> >>     >> >> linux-arm-kernel at lists.infradead.org
>> >>     <mailto:linux-arm-kernel@lists.infradead.org>
>> >>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>> >>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>> >>     >> >
>> >>     >> >
>> >>     >
>> >>     >
>> >>
>> >>
>> >
>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 16:07                                 ` Bruno Herrera
  (?)
  (?)
@ 2016-11-02 18:05                                 ` Radosław Pietrzyk
       [not found]                                   ` <CAFvLkMSViXggGr0Set0qnQan_+bXUNzJx5WtZHP-Jyje=ZzDVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  -1 siblings, 1 reply; 32+ messages in thread
From: Radosław Pietrzyk @ 2016-11-02 18:05 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Alexandre Torgue, mark.rutland, devicetree, Arnd Bergmann, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel, andrea.merello

[-- Attachment #1: Type: text/plain, Size: 15279 bytes --]

Have you tried with

sdio {
...
compatible = "arm,primecell";
arm,primecell-periphid = <id_to_define>;
...
}

This should register proper amba device and give it an ID you wish.

2016-11-02 17:07 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:

> Hi
>
> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
> > Hi
> >
> > On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
> >>
> >> I think wlcore driver searches dma-ranges in its parent that's why sdio
> >> node needs it.
> >
> >
> > Yes I agree. In this case it is needed as you have subnode in sdio node.
> > So IMO empty dma-ranges could be removed from ethernet and usb node, but
> > kept in future sdio subnode.
>
> Now it is clear.
>
> >
> > Bruno,
> > Do you plan to push sdio support ?
>
> Yes I do, but I'm not sure how long it will take. The I had to
> change(and hack) the mmci code because I could not get the ID from
> STM32 SDIO IP.
> My current WIP is at @
> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#
> issuecomment-247571615
> I know Andrea Merello is also working on that (and he probably has a
> more complete patch).
>
> >
> >
> >
> >>
> >> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
> >> <mailto:bruherrera@gmail.com>>:
> >>
> >>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
> >>     <radoslaw.pietrzyk@gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
> >>     wrote:
> >>     > This is weird because dma ddresses are recalculated using parent's
> >>     > dma-ranges property and soc already has it so there should be
> >> absolutely no
> >>     > problem.
> >>
> >>     These are my DTS and DTSI file.
> >>     >
> >>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
> >>     <mailto:bruherrera@gmail.com>>:
> >>     >>
> >>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
> >>     >> <radoslaw.pietrzyk@gmail.com
> >>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
> >>     >> > Have you defined your sdio node within soc node ?
> >>     >>
> >>     >> It is in the SOC node of the DSTI file.
> >>     >>
> >>     >> >
> >>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
> >>     <mailto:bruherrera@gmail.com>>:
> >>     >> >>
> >>     >> >> Hi Alex,
> >>     >> >>
> >>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
> >>     >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.com>>
> >> wrote:
> >>     >> >> > Hi Bruno,
> >>     >> >> >
> >>     >> >> >
> >>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> >>     >> >> >>
> >>     >> >> >> Hi Alex,
> >>     >> >> >>
> >>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> >>     >> >> >> <alexandre.torgue@st.com <mailto:alexandre.torgue@st.com>>
> >>     wrote:
> >>     >> >> >>>
> >>     >> >> >>> Hi Bruno,
> >>     >> >> >>>
> >>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>> Hi Alexandre,
> >>     >> >> >>>>
> >>     >> >> >>>>>
> >>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
> >>     start address
> >>     >> >> >>>>> remapping
> >>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
> >>     >> >> >>>>> "dma-ranges"
> >>     >> >> >>>>> property was needed for other masters than the M4 CPU.
> >>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
> >>     this DMA
> >>     >> >> >>>>> translation.
> >>     >> >> >>>>> This patches moves this DMA translation definition from
> >>     stm32f429
> >>     >> >> >>>>> soc
> >>     >> >> >>>>> file
> >>     >> >> >>>>> to board files.
> >>     >> >> >>>>>
> >>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <
> alexandre.torgue@st.com
> >>     <mailto:alexandre.torgue@st.com>>
> >>
> >>     >> >> >>>>>
> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>>> index 13c7cd2..a763c15 100644
> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>>> @@ -82,6 +82,10 @@
> >>     >> >> >>>>>                 };
> >>     >> >> >>>>>         };
> >>     >> >> >>>>>
> >>     >> >> >>>>> +       soc {
> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
> 0x10000000>;
> >>     >> >> >>>>> +       };
> >>     >> >> >>>>> +
> >>     >> >> >>>>>         usbotg_hs_phy: usbphy {
> >>     >> >> >>>>>                 #phy-cells = <0>;
> >>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
> >>     board
> >>     >> >> >>>> specific
> >>     >> >> >>>> too?
> >>     >> >> >>>> I  had this patch for while but I didn't had the time to
> >>     submit:
> >>     >> >> >>>
> >>     >> >> >>>
> >>     >> >> >>>
> >>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
> >>     ysterday on
> >>     >> >> >>> IIRC,
> >>     >> >> >>> empty dma-ranges is not needed. Can you test on your side
> by
> >>     >> >> >>> removing
> >>     >> >> >>> dma-ranges in usb node please ?
> >>     >> >> >>
> >>     >> >> >> Unfortunately will take a time for me to set up this
> >>     environment on
> >>     >> >> >> the STM32F4-EVAL board.
> >>     >> >> >> And on the discovery boards we dont have this scenario.
> >>     That was the
> >>     >> >> >> main reason I did not submit the patch right away.
> >>     >> >> >> My conclusion and I might be wrong but is based on the my
> >>     tests with
> >>     >> >> >> SDIO device at STM32F469I-DISCO board.
> >>     >> >> >>
> >>     >> >> >> I started this issue as discussion at ST Forum but Maxime
> >>     gave me
> >>     >> >> >> the
> >>     >> >> >> hint.
> >>     >> >> >>
> >>     >> >> >>
> >>     >> >> >>
> >>     >> >> >>
> >>     >> >> >>
> >>
> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44
> >>
> >> <https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44>
> >>     >> >> >>
> >>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
> >>     ok in
> >>     >> >> >>> your
> >>     >> >> >>> side.
> >>     >> >> >>
> >>     >> >> >>
> >>     >> >> >> From my understating/conclusion is: when empty
> >>     property(dma-ranges)
> >>     >> >> >> is
> >>     >> >> >> the device node, the mapping will be taken in consideration
> >>     when
> >>     >> >> >> using
> >>     >> >> >> DMA otherwise the mapping is ignored.
> >>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> >>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
> >>     question
> >>     >> >> >> so
> >>     >> >> >> I suppose it can work without the property.
> >>     >> >> >
> >>     >> >> >
> >>     >> >> > For sure translation has to be done but I'm not sure that an
> >>     empty
> >>     >> >> > "dma-ranges" is needed in device node to activate it. For
> >>     Ethernet
> >>     >> >> > empty
> >>     >> >> > "dma-ranges" is not needed. I will try with usb.
> >>     >> >>
> >>     >> >> In the case of SDIO it is needed. As example this is my
> >>     working SDIO
> >>     >> >> node:
> >>     >> >>
> >>     >> >> sdio: sdio@40012c00 {
> >>     >> >> compatible = "arm,pl18x", "arm,primecell";
> >>     >> >> arm,primecell-periphid = <0x00480181>;
> >>     >> >> reg = <0x40012c00 0x400>;
> >>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> >>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> >>     >> >> dma-names = "rx", "tx";
> >>     >> >> clocks = <&rcc 0 171>;
> >>     >> >> clock-names = "apb_pclk";
> >>     >> >> interrupts = <49>;
> >>     >> >> status = "disabled";
> >>     >> >> };
> >>     >> >>
> >>     >> >> &sdio {
> >>     >> >> status = "okay";
> >>     >> >> vmmc-supply = <&wlan_en>;
> >>     >> >> bus-width = <4>;
> >>     >> >> max-frequency = <24000000>;
> >>     >> >> pinctrl-names = "default";
> >>     >> >> pinctrl-0 = <&sdio_pins>;
> >>     >> >> ti,non-removable;
> >>     >> >> ti,needs-special-hs-handling;
> >>     >> >> dma-ranges;
> >>     >> >> cap-power-off-card;
> >>     >> >> keep-power-in-suspend;
> >>     >> >>
> >>     >> >> #address-cells = <1>;
> >>     >> >> #size-cells = <0>;
> >>     >> >> wlcore: wlcore@0 {
> >>     >> >> compatible = "ti,wl1835";
> >>     >> >> reg = <2>;
> >>     >> >> interrupt-parent = <&gpioa>;
> >>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
> >>     >> >> };
> >>     >> >> };
> >>     >> >>
> >>     >> >> >
> >>     >> >> > alex
> >>     >> >> >
> >>     >> >> >
> >>     >> >> >>
> >>     >> >> >>>
> >>     >> >> >>> Thanks in advance
> >>     >> >> >>> Alex
> >>     >> >> >>>
> >>     >> >> >>>
> >>     >> >> >>>>
> >>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
> >>     <mailto:bruherrera@gmail.com>>
> >>
> >>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
> >>     >> >> >>>>
> >>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
> >>     at dtsi
> >>     >> >> >>>> file
> >>     >> >> >>>>
> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>> index 6bfc595..2a22a82 100644
> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >>     >> >> >>>> @@ -52,6 +52,10 @@
> >>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL
> board";
> >>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
> >>     >> >> >>>>
> >>     >> >> >>>> +       soc {
> >>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> >>     >> >> >>>> +       };
> >>     >> >> >>>> +
> >>     >> >> >>>>         chosen {
> >>     >> >> >>>>                 bootargs = "root=/dev/ram
> rdinit=/linuxrc";
> >>     >> >> >>>>                 stdout-path = "serial0:115200n8";
> >>     >> >> >>>> @@ -96,6 +100,7 @@
> >>     >> >> >>>>
> >>     >> >> >>>>  &ethernet0 {
> >>     >> >> >>>>         status = "okay";
> >>     >> >> >>>> +       dma-ranges;
> >>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
> >>     >> >> >>>>         pinctrl-names   = "default";
> >>     >> >> >>>>         phy-mode        = "mii-id";
> >>     >> >> >>>> @@ -116,6 +121,7 @@
> >>     >> >> >>>>  };
> >>     >> >> >>>>
> >>     >> >> >>>>  &usbotg_hs {
> >>     >> >> >>>> +       dma-ranges;
> >>     >> >> >>>>         dr_mode = "host";
> >>     >> >> >>>>         phys = <&usbotg_hs_phy>;
> >>     >> >> >>>>         phy-names = "usb2-phy";
> >>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>> index 7d624a2..697a133 100644
> >>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>> @@ -59,7 +59,6 @@
> >>     >> >> >>>>         };
> >>     >> >> >>>>
> >>     >> >> >>>>         soc {
> >>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >>     >> >> >>>>
> >>     >> >> >>>>                 timer2: timer@40000000 {
> >>     >> >> >>>>                         compatible = "st,stm32-timer";
> >>     >> >> >>>> @@ -472,13 +471,11 @@
> >>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
> >>     >> >> >>>>                         snps,pbl = <8>;
> >>     >> >> >>>>                         snps,mixed-burst;
> >>     >> >> >>>> -                       dma-ranges;
> >>     >> >> >>>>                         status = "disabled";
> >>     >> >> >>>>                 };
> >>     >> >> >>>>
> >>     >> >> >>>>                 usbotg_hs: usb@40040000 {
> >>     >> >> >>>>                         compatible = "snps,dwc2";
> >>     >> >> >>>> -                       dma-ranges;
> >>     >> >> >>>>                         reg = <0x40040000 0x40000>;
> >>     >> >> >>>>                         interrupts = <77>;
> >>     >> >> >>>>                         clocks = <&rcc 0 29>;
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>>> index 0596d60..3a1cfdd 100644
> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >>     >> >> >>>>> @@ -59,8 +59,6 @@
> >>     >> >> >>>>>         };
> >>     >> >> >>>>>
> >>     >> >> >>>>>         soc {
> >>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0
> 0x10000000>;
> >>     >> >> >>>>> -
> >>     >> >> >>>>>                 timer2: timer@40000000 {
> >>     >> >> >>>>>                         compatible = "st,stm32-timer";
> >>     >> >> >>>>>                         reg = <0x40000000 0x400>;
> >>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
> >>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
> >>     >> >> >>>>> index 9e73656..c2213c0 100644
> >>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> >>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> >>     >> >> >>>>> @@ -64,6 +64,10 @@
> >>     >> >> >>>>>         aliases {
> >>     >> >> >>>>>                 serial0 = &usart3;
> >>     >> >> >>>>>         };
> >>     >> >> >>>>> +
> >>     >> >> >>>>> +       soc {
> >>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0
> 0x10000000>;
> >>     >> >> >>>>> +       };
> >>     >> >> >>>>>  };
> >>     >> >> >>>>>
> >>     >> >> >>>>>  &clk_hse {
> >>     >> >> >>>>> --
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>>
> >>     >> >> >>>> Br.,
> >>     >> >> >>>> Bruno
> >>     >> >> >>>>
> >>     >> >> >>>
> >>     >> >> >
> >>     >> >>
> >>     >> >> _______________________________________________
> >>     >> >> linux-arm-kernel mailing list
> >>     >> >> linux-arm-kernel@lists.infradead.org
> >>     <mailto:linux-arm-kernel@lists.infradead.org>
> >>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> >>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
> >>     >> >
> >>     >> >
> >>     >
> >>     >
> >>
> >>
> >
>

[-- Attachment #2: Type: text/html, Size: 28650 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 16:07                                 ` Bruno Herrera
@ 2016-11-02 16:14                                     ` Alexandre Torgue
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-02 16:14 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Radosław Pietrzyk, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	andrea.merello-Re5JQEeQqe8AvxtiuMwx3w



On 11/02/2016 05:07 PM, Bruno Herrera wrote:
> Hi
>
> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> Hi
>>
>> On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
>>>
>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>> node needs it.
>>
>>
>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>> kept in future sdio subnode.
>
> Now it is clear.
Nice. Can I add your tested-by ?
>
>>
>> Bruno,
>> Do you plan to push sdio support ?
>
> Yes I do, but I'm not sure how long it will take. The I had to
> change(and hack) the mmci code because I could not get the ID from
> STM32 SDIO IP.
> My current WIP is at @
> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
> I know Andrea Merello is also working on that (and he probably has a
> more complete patch).
>
>>
>>
>>
>>>
>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>> <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>
>>>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>>>     <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>>     wrote:
>>>     > This is weird because dma ddresses are recalculated using parent's
>>>     > dma-ranges property and soc already has it so there should be
>>> absolutely no
>>>     > problem.
>>>
>>>     These are my DTS and DTSI file.
>>>     >
>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>     >>
>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>>>     >> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>     <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>>>     >> > Have you defined your sdio node within soc node ?
>>>     >>
>>>     >> It is in the SOC node of the DSTI file.
>>>     >>
>>>     >> >
>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>>     >> >>
>>>     >> >> Hi Alex,
>>>     >> >>
>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>     >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>> wrote:
>>>     >> >> > Hi Bruno,
>>>     >> >> >
>>>     >> >> >
>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>     >> >> >>
>>>     >> >> >> Hi Alex,
>>>     >> >> >>
>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>     >> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>>     wrote:
>>>     >> >> >>>
>>>     >> >> >>> Hi Bruno,
>>>     >> >> >>>
>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Hi Alexandre,
>>>     >> >> >>>>
>>>     >> >> >>>>>
>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>     start address
>>>     >> >> >>>>> remapping
>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>>     >> >> >>>>> "dma-ranges"
>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>     this DMA
>>>     >> >> >>>>> translation.
>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>     stm32f429
>>>     >> >> >>>>> soc
>>>     >> >> >>>>> file
>>>     >> >> >>>>> to board files.
>>>     >> >> >>>>>
>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org
>>>     <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>>
>>>     >> >> >>>>>
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>     >> >> >>>>>                 };
>>>     >> >> >>>>>         };
>>>     >> >> >>>>>
>>>     >> >> >>>>> +       soc {
>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> +       };
>>>     >> >> >>>>> +
>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>>     board
>>>     >> >> >>>> specific
>>>     >> >> >>>> too?
>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>     submit:
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>     ysterday on
>>>     >> >> >>> IIRC,
>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>>>     >> >> >>> removing
>>>     >> >> >>> dma-ranges in usb node please ?
>>>     >> >> >>
>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>     environment on
>>>     >> >> >> the STM32F4-EVAL board.
>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>     That was the
>>>     >> >> >> main reason I did not submit the patch right away.
>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>     tests with
>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>     >> >> >>
>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>     gave me
>>>     >> >> >> the
>>>     >> >> >> hint.
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>
>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>
>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>     >> >> >>
>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>>     ok in
>>>     >> >> >>> your
>>>     >> >> >>> side.
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >> From my understating/conclusion is: when empty
>>>     property(dma-ranges)
>>>     >> >> >> is
>>>     >> >> >> the device node, the mapping will be taken in consideration
>>>     when
>>>     >> >> >> using
>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>     question
>>>     >> >> >> so
>>>     >> >> >> I suppose it can work without the property.
>>>     >> >> >
>>>     >> >> >
>>>     >> >> > For sure translation has to be done but I'm not sure that an
>>>     empty
>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>     Ethernet
>>>     >> >> > empty
>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>     >> >>
>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>     working SDIO
>>>     >> >> node:
>>>     >> >>
>>>     >> >> sdio: sdio@40012c00 {
>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>     >> >> reg = <0x40012c00 0x400>;
>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>     >> >> dma-names = "rx", "tx";
>>>     >> >> clocks = <&rcc 0 171>;
>>>     >> >> clock-names = "apb_pclk";
>>>     >> >> interrupts = <49>;
>>>     >> >> status = "disabled";
>>>     >> >> };
>>>     >> >>
>>>     >> >> &sdio {
>>>     >> >> status = "okay";
>>>     >> >> vmmc-supply = <&wlan_en>;
>>>     >> >> bus-width = <4>;
>>>     >> >> max-frequency = <24000000>;
>>>     >> >> pinctrl-names = "default";
>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>     >> >> ti,non-removable;
>>>     >> >> ti,needs-special-hs-handling;
>>>     >> >> dma-ranges;
>>>     >> >> cap-power-off-card;
>>>     >> >> keep-power-in-suspend;
>>>     >> >>
>>>     >> >> #address-cells = <1>;
>>>     >> >> #size-cells = <0>;
>>>     >> >> wlcore: wlcore@0 {
>>>     >> >> compatible = "ti,wl1835";
>>>     >> >> reg = <2>;
>>>     >> >> interrupt-parent = <&gpioa>;
>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>     >> >> };
>>>     >> >> };
>>>     >> >>
>>>     >> >> >
>>>     >> >> > alex
>>>     >> >> >
>>>     >> >> >
>>>     >> >> >>
>>>     >> >> >>>
>>>     >> >> >>> Thanks in advance
>>>     >> >> >>> Alex
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>>>
>>>     >> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>>
>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>     >> >> >>>>
>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>>     at dtsi
>>>     >> >> >>>> file
>>>     >> >> >>>>
>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>     >> >> >>>>
>>>     >> >> >>>> +       soc {
>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>     >> >> >>>> +       };
>>>     >> >> >>>> +
>>>     >> >> >>>>         chosen {
>>>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>     >> >> >>>>
>>>     >> >> >>>>  &ethernet0 {
>>>     >> >> >>>>         status = "okay";
>>>     >> >> >>>> +       dma-ranges;
>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>     >> >> >>>>         pinctrl-names   = "default";
>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>     >> >> >>>>  };
>>>     >> >> >>>>
>>>     >> >> >>>>  &usbotg_hs {
>>>     >> >> >>>> +       dma-ranges;
>>>     >> >> >>>>         dr_mode = "host";
>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>     >> >> >>>>         };
>>>     >> >> >>>>
>>>     >> >> >>>>         soc {
>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>
>>>     >> >> >>>>                 timer2: timer@40000000 {
>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>     >> >> >>>>                         snps,pbl = <8>;
>>>     >> >> >>>>                         snps,mixed-burst;
>>>     >> >> >>>> -                       dma-ranges;
>>>     >> >> >>>>                         status = "disabled";
>>>     >> >> >>>>                 };
>>>     >> >> >>>>
>>>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>     >> >> >>>> -                       dma-ranges;
>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>     >> >> >>>>                         interrupts = <77>;
>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>     >> >> >>>>>         };
>>>     >> >> >>>>>
>>>     >> >> >>>>>         soc {
>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> -
>>>     >> >> >>>>>                 timer2: timer@40000000 {
>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>     >> >> >>>>>         aliases {
>>>     >> >> >>>>>                 serial0 = &usart3;
>>>     >> >> >>>>>         };
>>>     >> >> >>>>> +
>>>     >> >> >>>>> +       soc {
>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> +       };
>>>     >> >> >>>>>  };
>>>     >> >> >>>>>
>>>     >> >> >>>>>  &clk_hse {
>>>     >> >> >>>>> --
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Br.,
>>>     >> >> >>>> Bruno
>>>     >> >> >>>>
>>>     >> >> >>>
>>>     >> >> >
>>>     >> >>
>>>     >> >> _______________________________________________
>>>     >> >> linux-arm-kernel mailing list
>>>     >> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>>     <mailto:linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>     >> >
>>>     >> >
>>>     >
>>>     >
>>>
>>>
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-02 16:14                                     ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-02 16:14 UTC (permalink / raw)
  To: linux-arm-kernel



On 11/02/2016 05:07 PM, Bruno Herrera wrote:
> Hi
>
> On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi
>>
>> On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
>>>
>>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>>> node needs it.
>>
>>
>> Yes I agree. In this case it is needed as you have subnode in sdio node.
>> So IMO empty dma-ranges could be removed from ethernet and usb node, but
>> kept in future sdio subnode.
>
> Now it is clear.
Nice. Can I add your tested-by ?
>
>>
>> Bruno,
>> Do you plan to push sdio support ?
>
> Yes I do, but I'm not sure how long it will take. The I had to
> change(and hack) the mmci code because I could not get the ID from
> STM32 SDIO IP.
> My current WIP is at @
> https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
> I know Andrea Merello is also working on that (and he probably has a
> more complete patch).
>
>>
>>
>>
>>>
>>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>> <mailto:bruherrera@gmail.com>>:
>>>
>>>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>>>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>>>     wrote:
>>>     > This is weird because dma ddresses are recalculated using parent's
>>>     > dma-ranges property and soc already has it so there should be
>>> absolutely no
>>>     > problem.
>>>
>>>     These are my DTS and DTSI file.
>>>     >
>>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>>     <mailto:bruherrera@gmail.com>>:
>>>     >>
>>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>>>     >> <radoslaw.pietrzyk@gmail.com
>>>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>>>     >> > Have you defined your sdio node within soc node ?
>>>     >>
>>>     >> It is in the SOC node of the DSTI file.
>>>     >>
>>>     >> >
>>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>>>     <mailto:bruherrera@gmail.com>>:
>>>     >> >>
>>>     >> >> Hi Alex,
>>>     >> >>
>>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>> wrote:
>>>     >> >> > Hi Bruno,
>>>     >> >> >
>>>     >> >> >
>>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>>     >> >> >>
>>>     >> >> >> Hi Alex,
>>>     >> >> >>
>>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>>     wrote:
>>>     >> >> >>>
>>>     >> >> >>> Hi Bruno,
>>>     >> >> >>>
>>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Hi Alexandre,
>>>     >> >> >>>>
>>>     >> >> >>>>>
>>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>>     start address
>>>     >> >> >>>>> remapping
>>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>>     >> >> >>>>> "dma-ranges"
>>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>>     this DMA
>>>     >> >> >>>>> translation.
>>>     >> >> >>>>> This patches moves this DMA translation definition from
>>>     stm32f429
>>>     >> >> >>>>> soc
>>>     >> >> >>>>> file
>>>     >> >> >>>>> to board files.
>>>     >> >> >>>>>
>>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com
>>>     <mailto:alexandre.torgue@st.com>>
>>>
>>>     >> >> >>>>>
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>>     >> >> >>>>>                 };
>>>     >> >> >>>>>         };
>>>     >> >> >>>>>
>>>     >> >> >>>>> +       soc {
>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> +       };
>>>     >> >> >>>>> +
>>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>>     >> >> >>>>>                 #phy-cells = <0>;
>>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>>     board
>>>     >> >> >>>> specific
>>>     >> >> >>>> too?
>>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>>     submit:
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>>     ysterday on
>>>     >> >> >>> IIRC,
>>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>>>     >> >> >>> removing
>>>     >> >> >>> dma-ranges in usb node please ?
>>>     >> >> >>
>>>     >> >> >> Unfortunately will take a time for me to set up this
>>>     environment on
>>>     >> >> >> the STM32F4-EVAL board.
>>>     >> >> >> And on the discovery boards we dont have this scenario.
>>>     That was the
>>>     >> >> >> main reason I did not submit the patch right away.
>>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>>     tests with
>>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>>     >> >> >>
>>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>>     gave me
>>>     >> >> >> the
>>>     >> >> >> hint.
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >>
>>>
>>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>>
>>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>>     >> >> >>
>>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>>     ok in
>>>     >> >> >>> your
>>>     >> >> >>> side.
>>>     >> >> >>
>>>     >> >> >>
>>>     >> >> >> From my understating/conclusion is: when empty
>>>     property(dma-ranges)
>>>     >> >> >> is
>>>     >> >> >> the device node, the mapping will be taken in consideration
>>>     when
>>>     >> >> >> using
>>>     >> >> >> DMA otherwise the mapping is ignored.
>>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>>     question
>>>     >> >> >> so
>>>     >> >> >> I suppose it can work without the property.
>>>     >> >> >
>>>     >> >> >
>>>     >> >> > For sure translation has to be done but I'm not sure that an
>>>     empty
>>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>>     Ethernet
>>>     >> >> > empty
>>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>>     >> >>
>>>     >> >> In the case of SDIO it is needed. As example this is my
>>>     working SDIO
>>>     >> >> node:
>>>     >> >>
>>>     >> >> sdio: sdio at 40012c00 {
>>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>>     >> >> arm,primecell-periphid = <0x00480181>;
>>>     >> >> reg = <0x40012c00 0x400>;
>>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>>     >> >> dma-names = "rx", "tx";
>>>     >> >> clocks = <&rcc 0 171>;
>>>     >> >> clock-names = "apb_pclk";
>>>     >> >> interrupts = <49>;
>>>     >> >> status = "disabled";
>>>     >> >> };
>>>     >> >>
>>>     >> >> &sdio {
>>>     >> >> status = "okay";
>>>     >> >> vmmc-supply = <&wlan_en>;
>>>     >> >> bus-width = <4>;
>>>     >> >> max-frequency = <24000000>;
>>>     >> >> pinctrl-names = "default";
>>>     >> >> pinctrl-0 = <&sdio_pins>;
>>>     >> >> ti,non-removable;
>>>     >> >> ti,needs-special-hs-handling;
>>>     >> >> dma-ranges;
>>>     >> >> cap-power-off-card;
>>>     >> >> keep-power-in-suspend;
>>>     >> >>
>>>     >> >> #address-cells = <1>;
>>>     >> >> #size-cells = <0>;
>>>     >> >> wlcore: wlcore at 0 {
>>>     >> >> compatible = "ti,wl1835";
>>>     >> >> reg = <2>;
>>>     >> >> interrupt-parent = <&gpioa>;
>>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>>     >> >> };
>>>     >> >> };
>>>     >> >>
>>>     >> >> >
>>>     >> >> > alex
>>>     >> >> >
>>>     >> >> >
>>>     >> >> >>
>>>     >> >> >>>
>>>     >> >> >>> Thanks in advance
>>>     >> >> >>> Alex
>>>     >> >> >>>
>>>     >> >> >>>
>>>     >> >> >>>>
>>>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>>>     <mailto:bruherrera@gmail.com>>
>>>
>>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>     >> >> >>>>
>>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>>     at dtsi
>>>     >> >> >>>> file
>>>     >> >> >>>>
>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>     >> >> >>>> @@ -52,6 +52,10 @@
>>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>     >> >> >>>>
>>>     >> >> >>>> +       soc {
>>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>     >> >> >>>> +       };
>>>     >> >> >>>> +
>>>     >> >> >>>>         chosen {
>>>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>>     >> >> >>>> @@ -96,6 +100,7 @@
>>>     >> >> >>>>
>>>     >> >> >>>>  &ethernet0 {
>>>     >> >> >>>>         status = "okay";
>>>     >> >> >>>> +       dma-ranges;
>>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>>     >> >> >>>>         pinctrl-names   = "default";
>>>     >> >> >>>>         phy-mode        = "mii-id";
>>>     >> >> >>>> @@ -116,6 +121,7 @@
>>>     >> >> >>>>  };
>>>     >> >> >>>>
>>>     >> >> >>>>  &usbotg_hs {
>>>     >> >> >>>> +       dma-ranges;
>>>     >> >> >>>>         dr_mode = "host";
>>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>>     >> >> >>>>         phy-names = "usb2-phy";
>>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> index 7d624a2..697a133 100644
>>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>> @@ -59,7 +59,6 @@
>>>     >> >> >>>>         };
>>>     >> >> >>>>
>>>     >> >> >>>>         soc {
>>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>
>>>     >> >> >>>>                 timer2: timer at 40000000 {
>>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>>     >> >> >>>> @@ -472,13 +471,11 @@
>>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>>     >> >> >>>>                         snps,pbl = <8>;
>>>     >> >> >>>>                         snps,mixed-burst;
>>>     >> >> >>>> -                       dma-ranges;
>>>     >> >> >>>>                         status = "disabled";
>>>     >> >> >>>>                 };
>>>     >> >> >>>>
>>>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>>>     >> >> >>>>                         compatible = "snps,dwc2";
>>>     >> >> >>>> -                       dma-ranges;
>>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>>     >> >> >>>>                         interrupts = <77>;
>>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>>     >> >> >>>>>         };
>>>     >> >> >>>>>
>>>     >> >> >>>>>         soc {
>>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> -
>>>     >> >> >>>>>                 timer2: timer at 40000000 {
>>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>>     >> >> >>>>>         aliases {
>>>     >> >> >>>>>                 serial0 = &usart3;
>>>     >> >> >>>>>         };
>>>     >> >> >>>>> +
>>>     >> >> >>>>> +       soc {
>>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>     >> >> >>>>> +       };
>>>     >> >> >>>>>  };
>>>     >> >> >>>>>
>>>     >> >> >>>>>  &clk_hse {
>>>     >> >> >>>>> --
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>>
>>>     >> >> >>>> Br.,
>>>     >> >> >>>> Bruno
>>>     >> >> >>>>
>>>     >> >> >>>
>>>     >> >> >
>>>     >> >>
>>>     >> >> _______________________________________________
>>>     >> >> linux-arm-kernel mailing list
>>>     >> >> linux-arm-kernel at lists.infradead.org
>>>     <mailto:linux-arm-kernel@lists.infradead.org>
>>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>>     >> >
>>>     >> >
>>>     >
>>>     >
>>>
>>>
>>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-11-02 14:32                             ` Alexandre Torgue
@ 2016-11-02 16:07                                 ` Bruno Herrera
  -1 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 16:07 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: Radosław Pietrzyk, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	andrea.merello-Re5JQEeQqe8AvxtiuMwx3w

Hi

On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
<alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
> Hi
>
> On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
>>
>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>> node needs it.
>
>
> Yes I agree. In this case it is needed as you have subnode in sdio node.
> So IMO empty dma-ranges could be removed from ethernet and usb node, but
> kept in future sdio subnode.

Now it is clear.

>
> Bruno,
> Do you plan to push sdio support ?

Yes I do, but I'm not sure how long it will take. The I had to
change(and hack) the mmci code because I could not get the ID from
STM32 SDIO IP.
My current WIP is at @
https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
I know Andrea Merello is also working on that (and he probably has a
more complete patch).

>
>
>
>>
>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>> <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>
>>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>>     <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>     wrote:
>>     > This is weird because dma ddresses are recalculated using parent's
>>     > dma-ranges property and soc already has it so there should be
>> absolutely no
>>     > problem.
>>
>>     These are my DTS and DTSI file.
>>     >
>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>     >>
>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>>     >> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>     <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>>     >> > Have you defined your sdio node within soc node ?
>>     >>
>>     >> It is in the SOC node of the DSTI file.
>>     >>
>>     >> >
>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>>     >> >>
>>     >> >> Hi Alex,
>>     >> >>
>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>     >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>> wrote:
>>     >> >> > Hi Bruno,
>>     >> >> >
>>     >> >> >
>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>     >> >> >>
>>     >> >> >> Hi Alex,
>>     >> >> >>
>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>     >> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>     wrote:
>>     >> >> >>>
>>     >> >> >>> Hi Bruno,
>>     >> >> >>>
>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Hi Alexandre,
>>     >> >> >>>>
>>     >> >> >>>>>
>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>     start address
>>     >> >> >>>>> remapping
>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>     >> >> >>>>> "dma-ranges"
>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>     this DMA
>>     >> >> >>>>> translation.
>>     >> >> >>>>> This patches moves this DMA translation definition from
>>     stm32f429
>>     >> >> >>>>> soc
>>     >> >> >>>>> file
>>     >> >> >>>>> to board files.
>>     >> >> >>>>>
>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org
>>     <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>>
>>     >> >> >>>>>
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>     >> >> >>>>>                 };
>>     >> >> >>>>>         };
>>     >> >> >>>>>
>>     >> >> >>>>> +       soc {
>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> +       };
>>     >> >> >>>>> +
>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>     >> >> >>>>>                 #phy-cells = <0>;
>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>     board
>>     >> >> >>>> specific
>>     >> >> >>>> too?
>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>     submit:
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>     ysterday on
>>     >> >> >>> IIRC,
>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>>     >> >> >>> removing
>>     >> >> >>> dma-ranges in usb node please ?
>>     >> >> >>
>>     >> >> >> Unfortunately will take a time for me to set up this
>>     environment on
>>     >> >> >> the STM32F4-EVAL board.
>>     >> >> >> And on the discovery boards we dont have this scenario.
>>     That was the
>>     >> >> >> main reason I did not submit the patch right away.
>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>     tests with
>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>     >> >> >>
>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>     gave me
>>     >> >> >> the
>>     >> >> >> hint.
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>
>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>
>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>     >> >> >>
>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>     ok in
>>     >> >> >>> your
>>     >> >> >>> side.
>>     >> >> >>
>>     >> >> >>
>>     >> >> >> From my understating/conclusion is: when empty
>>     property(dma-ranges)
>>     >> >> >> is
>>     >> >> >> the device node, the mapping will be taken in consideration
>>     when
>>     >> >> >> using
>>     >> >> >> DMA otherwise the mapping is ignored.
>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>     question
>>     >> >> >> so
>>     >> >> >> I suppose it can work without the property.
>>     >> >> >
>>     >> >> >
>>     >> >> > For sure translation has to be done but I'm not sure that an
>>     empty
>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>     Ethernet
>>     >> >> > empty
>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>     >> >>
>>     >> >> In the case of SDIO it is needed. As example this is my
>>     working SDIO
>>     >> >> node:
>>     >> >>
>>     >> >> sdio: sdio@40012c00 {
>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>     >> >> arm,primecell-periphid = <0x00480181>;
>>     >> >> reg = <0x40012c00 0x400>;
>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>     >> >> dma-names = "rx", "tx";
>>     >> >> clocks = <&rcc 0 171>;
>>     >> >> clock-names = "apb_pclk";
>>     >> >> interrupts = <49>;
>>     >> >> status = "disabled";
>>     >> >> };
>>     >> >>
>>     >> >> &sdio {
>>     >> >> status = "okay";
>>     >> >> vmmc-supply = <&wlan_en>;
>>     >> >> bus-width = <4>;
>>     >> >> max-frequency = <24000000>;
>>     >> >> pinctrl-names = "default";
>>     >> >> pinctrl-0 = <&sdio_pins>;
>>     >> >> ti,non-removable;
>>     >> >> ti,needs-special-hs-handling;
>>     >> >> dma-ranges;
>>     >> >> cap-power-off-card;
>>     >> >> keep-power-in-suspend;
>>     >> >>
>>     >> >> #address-cells = <1>;
>>     >> >> #size-cells = <0>;
>>     >> >> wlcore: wlcore@0 {
>>     >> >> compatible = "ti,wl1835";
>>     >> >> reg = <2>;
>>     >> >> interrupt-parent = <&gpioa>;
>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>     >> >> };
>>     >> >> };
>>     >> >>
>>     >> >> >
>>     >> >> > alex
>>     >> >> >
>>     >> >> >
>>     >> >> >>
>>     >> >> >>>
>>     >> >> >>> Thanks in advance
>>     >> >> >>> Alex
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>>>
>>     >> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>>
>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>     >> >> >>>>
>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>     at dtsi
>>     >> >> >>>> file
>>     >> >> >>>>
>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> @@ -52,6 +52,10 @@
>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>     >> >> >>>>
>>     >> >> >>>> +       soc {
>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>     >> >> >>>> +       };
>>     >> >> >>>> +
>>     >> >> >>>>         chosen {
>>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>     >> >> >>>> @@ -96,6 +100,7 @@
>>     >> >> >>>>
>>     >> >> >>>>  &ethernet0 {
>>     >> >> >>>>         status = "okay";
>>     >> >> >>>> +       dma-ranges;
>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>     >> >> >>>>         pinctrl-names   = "default";
>>     >> >> >>>>         phy-mode        = "mii-id";
>>     >> >> >>>> @@ -116,6 +121,7 @@
>>     >> >> >>>>  };
>>     >> >> >>>>
>>     >> >> >>>>  &usbotg_hs {
>>     >> >> >>>> +       dma-ranges;
>>     >> >> >>>>         dr_mode = "host";
>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>     >> >> >>>>         phy-names = "usb2-phy";
>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> index 7d624a2..697a133 100644
>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> @@ -59,7 +59,6 @@
>>     >> >> >>>>         };
>>     >> >> >>>>
>>     >> >> >>>>         soc {
>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>
>>     >> >> >>>>                 timer2: timer@40000000 {
>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>     >> >> >>>> @@ -472,13 +471,11 @@
>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>     >> >> >>>>                         snps,pbl = <8>;
>>     >> >> >>>>                         snps,mixed-burst;
>>     >> >> >>>> -                       dma-ranges;
>>     >> >> >>>>                         status = "disabled";
>>     >> >> >>>>                 };
>>     >> >> >>>>
>>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>>     >> >> >>>>                         compatible = "snps,dwc2";
>>     >> >> >>>> -                       dma-ranges;
>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>     >> >> >>>>                         interrupts = <77>;
>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>     >> >> >>>>>         };
>>     >> >> >>>>>
>>     >> >> >>>>>         soc {
>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> -
>>     >> >> >>>>>                 timer2: timer@40000000 {
>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>     >> >> >>>>>         aliases {
>>     >> >> >>>>>                 serial0 = &usart3;
>>     >> >> >>>>>         };
>>     >> >> >>>>> +
>>     >> >> >>>>> +       soc {
>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> +       };
>>     >> >> >>>>>  };
>>     >> >> >>>>>
>>     >> >> >>>>>  &clk_hse {
>>     >> >> >>>>> --
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Br.,
>>     >> >> >>>> Bruno
>>     >> >> >>>>
>>     >> >> >>>
>>     >> >> >
>>     >> >>
>>     >> >> _______________________________________________
>>     >> >> linux-arm-kernel mailing list
>>     >> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>>     <mailto:linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>     >> >
>>     >> >
>>     >
>>     >
>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-02 16:07                                 ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-11-02 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi

On Wed, Nov 2, 2016 at 12:32 PM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi
>
> On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
>>
>> I think wlcore driver searches dma-ranges in its parent that's why sdio
>> node needs it.
>
>
> Yes I agree. In this case it is needed as you have subnode in sdio node.
> So IMO empty dma-ranges could be removed from ethernet and usb node, but
> kept in future sdio subnode.

Now it is clear.

>
> Bruno,
> Do you plan to push sdio support ?

Yes I do, but I'm not sure how long it will take. The I had to
change(and hack) the mmci code because I could not get the ID from
STM32 SDIO IP.
My current WIP is at @
https://github.com/mcoquelin-stm32/afboot-stm32/pull/4#issuecomment-247571615
I know Andrea Merello is also working on that (and he probably has a
more complete patch).

>
>
>
>>
>> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>> <mailto:bruherrera@gmail.com>>:
>>
>>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>>     wrote:
>>     > This is weird because dma ddresses are recalculated using parent's
>>     > dma-ranges property and soc already has it so there should be
>> absolutely no
>>     > problem.
>>
>>     These are my DTS and DTSI file.
>>     >
>>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>>     <mailto:bruherrera@gmail.com>>:
>>     >>
>>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>>     >> <radoslaw.pietrzyk@gmail.com
>>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>>     >> > Have you defined your sdio node within soc node ?
>>     >>
>>     >> It is in the SOC node of the DSTI file.
>>     >>
>>     >> >
>>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>>     <mailto:bruherrera@gmail.com>>:
>>     >> >>
>>     >> >> Hi Alex,
>>     >> >>
>>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>> wrote:
>>     >> >> > Hi Bruno,
>>     >> >> >
>>     >> >> >
>>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>     >> >> >>
>>     >> >> >> Hi Alex,
>>     >> >> >>
>>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>>     wrote:
>>     >> >> >>>
>>     >> >> >>> Hi Bruno,
>>     >> >> >>>
>>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Hi Alexandre,
>>     >> >> >>>>
>>     >> >> >>>>>
>>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>>     start address
>>     >> >> >>>>> remapping
>>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>>     >> >> >>>>> "dma-ranges"
>>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>>     this DMA
>>     >> >> >>>>> translation.
>>     >> >> >>>>> This patches moves this DMA translation definition from
>>     stm32f429
>>     >> >> >>>>> soc
>>     >> >> >>>>> file
>>     >> >> >>>>> to board files.
>>     >> >> >>>>>
>>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com
>>     <mailto:alexandre.torgue@st.com>>
>>
>>     >> >> >>>>>
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> index 13c7cd2..a763c15 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>>> @@ -82,6 +82,10 @@
>>     >> >> >>>>>                 };
>>     >> >> >>>>>         };
>>     >> >> >>>>>
>>     >> >> >>>>> +       soc {
>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> +       };
>>     >> >> >>>>> +
>>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>>     >> >> >>>>>                 #phy-cells = <0>;
>>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>>     board
>>     >> >> >>>> specific
>>     >> >> >>>> too?
>>     >> >> >>>> I  had this patch for while but I didn't had the time to
>>     submit:
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>>     ysterday on
>>     >> >> >>> IIRC,
>>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>>     >> >> >>> removing
>>     >> >> >>> dma-ranges in usb node please ?
>>     >> >> >>
>>     >> >> >> Unfortunately will take a time for me to set up this
>>     environment on
>>     >> >> >> the STM32F4-EVAL board.
>>     >> >> >> And on the discovery boards we dont have this scenario.
>>     That was the
>>     >> >> >> main reason I did not submit the patch right away.
>>     >> >> >> My conclusion and I might be wrong but is based on the my
>>     tests with
>>     >> >> >> SDIO device at STM32F469I-DISCO board.
>>     >> >> >>
>>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>>     gave me
>>     >> >> >> the
>>     >> >> >> hint.
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>     >> >> >>
>>
>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>
>> <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>>     >> >> >>
>>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>>     ok in
>>     >> >> >>> your
>>     >> >> >>> side.
>>     >> >> >>
>>     >> >> >>
>>     >> >> >> From my understating/conclusion is: when empty
>>     property(dma-ranges)
>>     >> >> >> is
>>     >> >> >> the device node, the mapping will be taken in consideration
>>     when
>>     >> >> >> using
>>     >> >> >> DMA otherwise the mapping is ignored.
>>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>>     question
>>     >> >> >> so
>>     >> >> >> I suppose it can work without the property.
>>     >> >> >
>>     >> >> >
>>     >> >> > For sure translation has to be done but I'm not sure that an
>>     empty
>>     >> >> > "dma-ranges" is needed in device node to activate it. For
>>     Ethernet
>>     >> >> > empty
>>     >> >> > "dma-ranges" is not needed. I will try with usb.
>>     >> >>
>>     >> >> In the case of SDIO it is needed. As example this is my
>>     working SDIO
>>     >> >> node:
>>     >> >>
>>     >> >> sdio: sdio at 40012c00 {
>>     >> >> compatible = "arm,pl18x", "arm,primecell";
>>     >> >> arm,primecell-periphid = <0x00480181>;
>>     >> >> reg = <0x40012c00 0x400>;
>>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>>     >> >> dma-names = "rx", "tx";
>>     >> >> clocks = <&rcc 0 171>;
>>     >> >> clock-names = "apb_pclk";
>>     >> >> interrupts = <49>;
>>     >> >> status = "disabled";
>>     >> >> };
>>     >> >>
>>     >> >> &sdio {
>>     >> >> status = "okay";
>>     >> >> vmmc-supply = <&wlan_en>;
>>     >> >> bus-width = <4>;
>>     >> >> max-frequency = <24000000>;
>>     >> >> pinctrl-names = "default";
>>     >> >> pinctrl-0 = <&sdio_pins>;
>>     >> >> ti,non-removable;
>>     >> >> ti,needs-special-hs-handling;
>>     >> >> dma-ranges;
>>     >> >> cap-power-off-card;
>>     >> >> keep-power-in-suspend;
>>     >> >>
>>     >> >> #address-cells = <1>;
>>     >> >> #size-cells = <0>;
>>     >> >> wlcore: wlcore at 0 {
>>     >> >> compatible = "ti,wl1835";
>>     >> >> reg = <2>;
>>     >> >> interrupt-parent = <&gpioa>;
>>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>>     >> >> };
>>     >> >> };
>>     >> >>
>>     >> >> >
>>     >> >> > alex
>>     >> >> >
>>     >> >> >
>>     >> >> >>
>>     >> >> >>>
>>     >> >> >>> Thanks in advance
>>     >> >> >>> Alex
>>     >> >> >>>
>>     >> >> >>>
>>     >> >> >>>>
>>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>>     <mailto:bruherrera@gmail.com>>
>>
>>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>     >> >> >>>>
>>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>>     at dtsi
>>     >> >> >>>> file
>>     >> >> >>>>
>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> index 6bfc595..2a22a82 100644
>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>     >> >> >>>> @@ -52,6 +52,10 @@
>>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>     >> >> >>>>
>>     >> >> >>>> +       soc {
>>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>     >> >> >>>> +       };
>>     >> >> >>>> +
>>     >> >> >>>>         chosen {
>>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>>     >> >> >>>> @@ -96,6 +100,7 @@
>>     >> >> >>>>
>>     >> >> >>>>  &ethernet0 {
>>     >> >> >>>>         status = "okay";
>>     >> >> >>>> +       dma-ranges;
>>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>>     >> >> >>>>         pinctrl-names   = "default";
>>     >> >> >>>>         phy-mode        = "mii-id";
>>     >> >> >>>> @@ -116,6 +121,7 @@
>>     >> >> >>>>  };
>>     >> >> >>>>
>>     >> >> >>>>  &usbotg_hs {
>>     >> >> >>>> +       dma-ranges;
>>     >> >> >>>>         dr_mode = "host";
>>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>>     >> >> >>>>         phy-names = "usb2-phy";
>>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> index 7d624a2..697a133 100644
>>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>> @@ -59,7 +59,6 @@
>>     >> >> >>>>         };
>>     >> >> >>>>
>>     >> >> >>>>         soc {
>>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>
>>     >> >> >>>>                 timer2: timer at 40000000 {
>>     >> >> >>>>                         compatible = "st,stm32-timer";
>>     >> >> >>>> @@ -472,13 +471,11 @@
>>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>>     >> >> >>>>                         snps,pbl = <8>;
>>     >> >> >>>>                         snps,mixed-burst;
>>     >> >> >>>> -                       dma-ranges;
>>     >> >> >>>>                         status = "disabled";
>>     >> >> >>>>                 };
>>     >> >> >>>>
>>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>>     >> >> >>>>                         compatible = "snps,dwc2";
>>     >> >> >>>> -                       dma-ranges;
>>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>>     >> >> >>>>                         interrupts = <77>;
>>     >> >> >>>>                         clocks = <&rcc 0 29>;
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>     >> >> >>>>> @@ -59,8 +59,6 @@
>>     >> >> >>>>>         };
>>     >> >> >>>>>
>>     >> >> >>>>>         soc {
>>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> -
>>     >> >> >>>>>                 timer2: timer at 40000000 {
>>     >> >> >>>>>                         compatible = "st,stm32-timer";
>>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> index 9e73656..c2213c0 100644
>>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>     >> >> >>>>> @@ -64,6 +64,10 @@
>>     >> >> >>>>>         aliases {
>>     >> >> >>>>>                 serial0 = &usart3;
>>     >> >> >>>>>         };
>>     >> >> >>>>> +
>>     >> >> >>>>> +       soc {
>>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>     >> >> >>>>> +       };
>>     >> >> >>>>>  };
>>     >> >> >>>>>
>>     >> >> >>>>>  &clk_hse {
>>     >> >> >>>>> --
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>>
>>     >> >> >>>> Br.,
>>     >> >> >>>> Bruno
>>     >> >> >>>>
>>     >> >> >>>
>>     >> >> >
>>     >> >>
>>     >> >> _______________________________________________
>>     >> >> linux-arm-kernel mailing list
>>     >> >> linux-arm-kernel at lists.infradead.org
>>     <mailto:linux-arm-kernel@lists.infradead.org>
>>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>>     >> >
>>     >> >
>>     >
>>     >
>>
>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-31 18:58                       ` Radosław Pietrzyk
@ 2016-11-02 14:32                             ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-02 14:32 UTC (permalink / raw)
  To: Radosław Pietrzyk, Bruno Herrera
  Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Arnd Bergmann, linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi

On 10/31/2016 07:58 PM, Radosław Pietrzyk wrote:
> I think wlcore driver searches dma-ranges in its parent that's why sdio
> node needs it.

Yes I agree. In this case it is needed as you have subnode in sdio node.
So IMO empty dma-ranges could be removed from ethernet and usb node, but 
kept in future sdio subnode.

Bruno,
Do you plan to push sdio support ?



>
> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>
>     On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
>     <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>     wrote:
>     > This is weird because dma ddresses are recalculated using parent's
>     > dma-ranges property and soc already has it so there should be absolutely no
>     > problem.
>
>     These are my DTS and DTSI file.
>     >
>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>     >>
>     >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>     >> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>     <mailto:radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> wrote:
>     >> > Have you defined your sdio node within soc node ?
>     >>
>     >> It is in the SOC node of the DSTI file.
>     >>
>     >> >
>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>:
>     >> >>
>     >> >> Hi Alex,
>     >> >>
>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>     >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>> wrote:
>     >> >> > Hi Bruno,
>     >> >> >
>     >> >> >
>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>     >> >> >>
>     >> >> >> Hi Alex,
>     >> >> >>
>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>     >> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>     wrote:
>     >> >> >>>
>     >> >> >>> Hi Bruno,
>     >> >> >>>
>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Hi Alexandre,
>     >> >> >>>>
>     >> >> >>>>>
>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>     start address
>     >> >> >>>>> remapping
>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>     >> >> >>>>> "dma-ranges"
>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>     this DMA
>     >> >> >>>>> translation.
>     >> >> >>>>> This patches moves this DMA translation definition from
>     stm32f429
>     >> >> >>>>> soc
>     >> >> >>>>> file
>     >> >> >>>>> to board files.
>     >> >> >>>>>
>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org
>     <mailto:alexandre.torgue-qxv4g6HH51o@public.gmane.org>>
>     >> >> >>>>>
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> index 13c7cd2..a763c15 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> @@ -82,6 +82,10 @@
>     >> >> >>>>>                 };
>     >> >> >>>>>         };
>     >> >> >>>>>
>     >> >> >>>>> +       soc {
>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> +       };
>     >> >> >>>>> +
>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>     >> >> >>>>>                 #phy-cells = <0>;
>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>     board
>     >> >> >>>> specific
>     >> >> >>>> too?
>     >> >> >>>> I  had this patch for while but I didn't had the time to
>     submit:
>     >> >> >>>
>     >> >> >>>
>     >> >> >>>
>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>     ysterday on
>     >> >> >>> IIRC,
>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>     >> >> >>> removing
>     >> >> >>> dma-ranges in usb node please ?
>     >> >> >>
>     >> >> >> Unfortunately will take a time for me to set up this
>     environment on
>     >> >> >> the STM32F4-EVAL board.
>     >> >> >> And on the discovery boards we dont have this scenario.
>     That was the
>     >> >> >> main reason I did not submit the patch right away.
>     >> >> >> My conclusion and I might be wrong but is based on the my
>     tests with
>     >> >> >> SDIO device at STM32F469I-DISCO board.
>     >> >> >>
>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>     gave me
>     >> >> >> the
>     >> >> >> hint.
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>     <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>     >> >> >>
>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>     ok in
>     >> >> >>> your
>     >> >> >>> side.
>     >> >> >>
>     >> >> >>
>     >> >> >> From my understating/conclusion is: when empty
>     property(dma-ranges)
>     >> >> >> is
>     >> >> >> the device node, the mapping will be taken in consideration
>     when
>     >> >> >> using
>     >> >> >> DMA otherwise the mapping is ignored.
>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>     question
>     >> >> >> so
>     >> >> >> I suppose it can work without the property.
>     >> >> >
>     >> >> >
>     >> >> > For sure translation has to be done but I'm not sure that an
>     empty
>     >> >> > "dma-ranges" is needed in device node to activate it. For
>     Ethernet
>     >> >> > empty
>     >> >> > "dma-ranges" is not needed. I will try with usb.
>     >> >>
>     >> >> In the case of SDIO it is needed. As example this is my
>     working SDIO
>     >> >> node:
>     >> >>
>     >> >> sdio: sdio@40012c00 {
>     >> >> compatible = "arm,pl18x", "arm,primecell";
>     >> >> arm,primecell-periphid = <0x00480181>;
>     >> >> reg = <0x40012c00 0x400>;
>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>     >> >> dma-names = "rx", "tx";
>     >> >> clocks = <&rcc 0 171>;
>     >> >> clock-names = "apb_pclk";
>     >> >> interrupts = <49>;
>     >> >> status = "disabled";
>     >> >> };
>     >> >>
>     >> >> &sdio {
>     >> >> status = "okay";
>     >> >> vmmc-supply = <&wlan_en>;
>     >> >> bus-width = <4>;
>     >> >> max-frequency = <24000000>;
>     >> >> pinctrl-names = "default";
>     >> >> pinctrl-0 = <&sdio_pins>;
>     >> >> ti,non-removable;
>     >> >> ti,needs-special-hs-handling;
>     >> >> dma-ranges;
>     >> >> cap-power-off-card;
>     >> >> keep-power-in-suspend;
>     >> >>
>     >> >> #address-cells = <1>;
>     >> >> #size-cells = <0>;
>     >> >> wlcore: wlcore@0 {
>     >> >> compatible = "ti,wl1835";
>     >> >> reg = <2>;
>     >> >> interrupt-parent = <&gpioa>;
>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>     >> >> };
>     >> >> };
>     >> >>
>     >> >> >
>     >> >> > alex
>     >> >> >
>     >> >> >
>     >> >> >>
>     >> >> >>>
>     >> >> >>> Thanks in advance
>     >> >> >>> Alex
>     >> >> >>>
>     >> >> >>>
>     >> >> >>>>
>     >> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>     <mailto:bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>>
>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>     >> >> >>>>
>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>     at dtsi
>     >> >> >>>> file
>     >> >> >>>>
>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> index 6bfc595..2a22a82 100644
>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> @@ -52,6 +52,10 @@
>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>     >> >> >>>>
>     >> >> >>>> +       soc {
>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>     >> >> >>>> +       };
>     >> >> >>>> +
>     >> >> >>>>         chosen {
>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>     >> >> >>>> @@ -96,6 +100,7 @@
>     >> >> >>>>
>     >> >> >>>>  &ethernet0 {
>     >> >> >>>>         status = "okay";
>     >> >> >>>> +       dma-ranges;
>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>     >> >> >>>>         pinctrl-names   = "default";
>     >> >> >>>>         phy-mode        = "mii-id";
>     >> >> >>>> @@ -116,6 +121,7 @@
>     >> >> >>>>  };
>     >> >> >>>>
>     >> >> >>>>  &usbotg_hs {
>     >> >> >>>> +       dma-ranges;
>     >> >> >>>>         dr_mode = "host";
>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>     >> >> >>>>         phy-names = "usb2-phy";
>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> index 7d624a2..697a133 100644
>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> @@ -59,7 +59,6 @@
>     >> >> >>>>         };
>     >> >> >>>>
>     >> >> >>>>         soc {
>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>
>     >> >> >>>>                 timer2: timer@40000000 {
>     >> >> >>>>                         compatible = "st,stm32-timer";
>     >> >> >>>> @@ -472,13 +471,11 @@
>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>     >> >> >>>>                         snps,pbl = <8>;
>     >> >> >>>>                         snps,mixed-burst;
>     >> >> >>>> -                       dma-ranges;
>     >> >> >>>>                         status = "disabled";
>     >> >> >>>>                 };
>     >> >> >>>>
>     >> >> >>>>                 usbotg_hs: usb@40040000 {
>     >> >> >>>>                         compatible = "snps,dwc2";
>     >> >> >>>> -                       dma-ranges;
>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>     >> >> >>>>                         interrupts = <77>;
>     >> >> >>>>                         clocks = <&rcc 0 29>;
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> @@ -59,8 +59,6 @@
>     >> >> >>>>>         };
>     >> >> >>>>>
>     >> >> >>>>>         soc {
>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> -
>     >> >> >>>>>                 timer2: timer@40000000 {
>     >> >> >>>>>                         compatible = "st,stm32-timer";
>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> index 9e73656..c2213c0 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> @@ -64,6 +64,10 @@
>     >> >> >>>>>         aliases {
>     >> >> >>>>>                 serial0 = &usart3;
>     >> >> >>>>>         };
>     >> >> >>>>> +
>     >> >> >>>>> +       soc {
>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> +       };
>     >> >> >>>>>  };
>     >> >> >>>>>
>     >> >> >>>>>  &clk_hse {
>     >> >> >>>>> --
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Br.,
>     >> >> >>>> Bruno
>     >> >> >>>>
>     >> >> >>>
>     >> >> >
>     >> >>
>     >> >> _______________________________________________
>     >> >> linux-arm-kernel mailing list
>     >> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>     <mailto:linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>     >> >
>     >> >
>     >
>     >
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-11-02 14:32                             ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-11-02 14:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi

On 10/31/2016 07:58 PM, Rados?aw Pietrzyk wrote:
> I think wlcore driver searches dma-ranges in its parent that's why sdio
> node needs it.

Yes I agree. In this case it is needed as you have subnode in sdio node.
So IMO empty dma-ranges could be removed from ethernet and usb node, but 
kept in future sdio subnode.

Bruno,
Do you plan to push sdio support ?



>
> 2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
> <mailto:bruherrera@gmail.com>>:
>
>     On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
>     <radoslaw.pietrzyk at gmail.com <mailto:radoslaw.pietrzyk@gmail.com>>
>     wrote:
>     > This is weird because dma ddresses are recalculated using parent's
>     > dma-ranges property and soc already has it so there should be absolutely no
>     > problem.
>
>     These are my DTS and DTSI file.
>     >
>     > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com
>     <mailto:bruherrera@gmail.com>>:
>     >>
>     >> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>     >> <radoslaw.pietrzyk@gmail.com
>     <mailto:radoslaw.pietrzyk@gmail.com>> wrote:
>     >> > Have you defined your sdio node within soc node ?
>     >>
>     >> It is in the SOC node of the DSTI file.
>     >>
>     >> >
>     >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com
>     <mailto:bruherrera@gmail.com>>:
>     >> >>
>     >> >> Hi Alex,
>     >> >>
>     >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>     >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>> wrote:
>     >> >> > Hi Bruno,
>     >> >> >
>     >> >> >
>     >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>     >> >> >>
>     >> >> >> Hi Alex,
>     >> >> >>
>     >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>     >> >> >> <alexandre.torgue at st.com <mailto:alexandre.torgue@st.com>>
>     wrote:
>     >> >> >>>
>     >> >> >>> Hi Bruno,
>     >> >> >>>
>     >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Hi Alexandre,
>     >> >> >>>>
>     >> >> >>>>>
>     >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM
>     start address
>     >> >> >>>>> remapping
>     >> >> >>>>> (to @0) to boost performances. A DMA translation through
>     >> >> >>>>> "dma-ranges"
>     >> >> >>>>> property was needed for other masters than the M4 CPU.
>     >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need
>     this DMA
>     >> >> >>>>> translation.
>     >> >> >>>>> This patches moves this DMA translation definition from
>     stm32f429
>     >> >> >>>>> soc
>     >> >> >>>>> file
>     >> >> >>>>> to board files.
>     >> >> >>>>>
>     >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com
>     <mailto:alexandre.torgue@st.com>>
>     >> >> >>>>>
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> index 13c7cd2..a763c15 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>>> @@ -82,6 +82,10 @@
>     >> >> >>>>>                 };
>     >> >> >>>>>         };
>     >> >> >>>>>
>     >> >> >>>>> +       soc {
>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> +       };
>     >> >> >>>>> +
>     >> >> >>>>>         usbotg_hs_phy: usbphy {
>     >> >> >>>>>                 #phy-cells = <0>;
>     >> >> >>>>>                 compatible = "usb-nop-xceiv";
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Shouldn't also the peripheral dma-ranges property move to
>     board
>     >> >> >>>> specific
>     >> >> >>>> too?
>     >> >> >>>> I  had this patch for while but I didn't had the time to
>     submit:
>     >> >> >>>
>     >> >> >>>
>     >> >> >>>
>     >> >> >>> Well spot I forgot it. Actually, discussing with Arnd
>     ysterday on
>     >> >> >>> IIRC,
>     >> >> >>> empty dma-ranges is not needed. Can you test on your side by
>     >> >> >>> removing
>     >> >> >>> dma-ranges in usb node please ?
>     >> >> >>
>     >> >> >> Unfortunately will take a time for me to set up this
>     environment on
>     >> >> >> the STM32F4-EVAL board.
>     >> >> >> And on the discovery boards we dont have this scenario.
>     That was the
>     >> >> >> main reason I did not submit the patch right away.
>     >> >> >> My conclusion and I might be wrong but is based on the my
>     tests with
>     >> >> >> SDIO device at STM32F469I-DISCO board.
>     >> >> >>
>     >> >> >> I started this issue as discussion at ST Forum but Maxime
>     gave me
>     >> >> >> the
>     >> >> >> hint.
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     >> >> >>
>     https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>     <https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44>
>     >> >> >>
>     >> >> >>> I will push a v2 by removing empty dma-ranges if tests are
>     ok in
>     >> >> >>> your
>     >> >> >>> side.
>     >> >> >>
>     >> >> >>
>     >> >> >> From my understating/conclusion is: when empty
>     property(dma-ranges)
>     >> >> >> is
>     >> >> >> the device node, the mapping will be taken in consideration
>     when
>     >> >> >> using
>     >> >> >> DMA otherwise the mapping is ignored.
>     >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>     >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in
>     question
>     >> >> >> so
>     >> >> >> I suppose it can work without the property.
>     >> >> >
>     >> >> >
>     >> >> > For sure translation has to be done but I'm not sure that an
>     empty
>     >> >> > "dma-ranges" is needed in device node to activate it. For
>     Ethernet
>     >> >> > empty
>     >> >> > "dma-ranges" is not needed. I will try with usb.
>     >> >>
>     >> >> In the case of SDIO it is needed. As example this is my
>     working SDIO
>     >> >> node:
>     >> >>
>     >> >> sdio: sdio at 40012c00 {
>     >> >> compatible = "arm,pl18x", "arm,primecell";
>     >> >> arm,primecell-periphid = <0x00480181>;
>     >> >> reg = <0x40012c00 0x400>;
>     >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>     >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>     >> >> dma-names = "rx", "tx";
>     >> >> clocks = <&rcc 0 171>;
>     >> >> clock-names = "apb_pclk";
>     >> >> interrupts = <49>;
>     >> >> status = "disabled";
>     >> >> };
>     >> >>
>     >> >> &sdio {
>     >> >> status = "okay";
>     >> >> vmmc-supply = <&wlan_en>;
>     >> >> bus-width = <4>;
>     >> >> max-frequency = <24000000>;
>     >> >> pinctrl-names = "default";
>     >> >> pinctrl-0 = <&sdio_pins>;
>     >> >> ti,non-removable;
>     >> >> ti,needs-special-hs-handling;
>     >> >> dma-ranges;
>     >> >> cap-power-off-card;
>     >> >> keep-power-in-suspend;
>     >> >>
>     >> >> #address-cells = <1>;
>     >> >> #size-cells = <0>;
>     >> >> wlcore: wlcore at 0 {
>     >> >> compatible = "ti,wl1835";
>     >> >> reg = <2>;
>     >> >> interrupt-parent = <&gpioa>;
>     >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>     >> >> };
>     >> >> };
>     >> >>
>     >> >> >
>     >> >> > alex
>     >> >> >
>     >> >> >
>     >> >> >>
>     >> >> >>>
>     >> >> >>> Thanks in advance
>     >> >> >>> Alex
>     >> >> >>>
>     >> >> >>>
>     >> >> >>>>
>     >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com
>     <mailto:bruherrera@gmail.com>>
>     >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>     >> >> >>>>
>     >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not
>     at dtsi
>     >> >> >>>> file
>     >> >> >>>>
>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> index 6bfc595..2a22a82 100644
>     >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>     >> >> >>>> @@ -52,6 +52,10 @@
>     >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>     >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>     >> >> >>>>
>     >> >> >>>> +       soc {
>     >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>     >> >> >>>> +       };
>     >> >> >>>> +
>     >> >> >>>>         chosen {
>     >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>     >> >> >>>>                 stdout-path = "serial0:115200n8";
>     >> >> >>>> @@ -96,6 +100,7 @@
>     >> >> >>>>
>     >> >> >>>>  &ethernet0 {
>     >> >> >>>>         status = "okay";
>     >> >> >>>> +       dma-ranges;
>     >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>     >> >> >>>>         pinctrl-names   = "default";
>     >> >> >>>>         phy-mode        = "mii-id";
>     >> >> >>>> @@ -116,6 +121,7 @@
>     >> >> >>>>  };
>     >> >> >>>>
>     >> >> >>>>  &usbotg_hs {
>     >> >> >>>> +       dma-ranges;
>     >> >> >>>>         dr_mode = "host";
>     >> >> >>>>         phys = <&usbotg_hs_phy>;
>     >> >> >>>>         phy-names = "usb2-phy";
>     >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> index 7d624a2..697a133 100644
>     >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>> @@ -59,7 +59,6 @@
>     >> >> >>>>         };
>     >> >> >>>>
>     >> >> >>>>         soc {
>     >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>
>     >> >> >>>>                 timer2: timer at 40000000 {
>     >> >> >>>>                         compatible = "st,stm32-timer";
>     >> >> >>>> @@ -472,13 +471,11 @@
>     >> >> >>>>                         st,syscon = <&syscfg 0x4>;
>     >> >> >>>>                         snps,pbl = <8>;
>     >> >> >>>>                         snps,mixed-burst;
>     >> >> >>>> -                       dma-ranges;
>     >> >> >>>>                         status = "disabled";
>     >> >> >>>>                 };
>     >> >> >>>>
>     >> >> >>>>                 usbotg_hs: usb at 40040000 {
>     >> >> >>>>                         compatible = "snps,dwc2";
>     >> >> >>>> -                       dma-ranges;
>     >> >> >>>>                         reg = <0x40040000 0x40000>;
>     >> >> >>>>                         interrupts = <77>;
>     >> >> >>>>                         clocks = <&rcc 0 29>;
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> index 0596d60..3a1cfdd 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>     >> >> >>>>> @@ -59,8 +59,6 @@
>     >> >> >>>>>         };
>     >> >> >>>>>
>     >> >> >>>>>         soc {
>     >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> -
>     >> >> >>>>>                 timer2: timer at 40000000 {
>     >> >> >>>>>                         compatible = "st,stm32-timer";
>     >> >> >>>>>                         reg = <0x40000000 0x400>;
>     >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> index 9e73656..c2213c0 100644
>     >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>     >> >> >>>>> @@ -64,6 +64,10 @@
>     >> >> >>>>>         aliases {
>     >> >> >>>>>                 serial0 = &usart3;
>     >> >> >>>>>         };
>     >> >> >>>>> +
>     >> >> >>>>> +       soc {
>     >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>     >> >> >>>>> +       };
>     >> >> >>>>>  };
>     >> >> >>>>>
>     >> >> >>>>>  &clk_hse {
>     >> >> >>>>> --
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>>
>     >> >> >>>> Br.,
>     >> >> >>>> Bruno
>     >> >> >>>>
>     >> >> >>>
>     >> >> >
>     >> >>
>     >> >> _______________________________________________
>     >> >> linux-arm-kernel mailing list
>     >> >> linux-arm-kernel at lists.infradead.org
>     <mailto:linux-arm-kernel@lists.infradead.org>
>     >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>     <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>
>     >> >
>     >> >
>     >
>     >
>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-31 16:41                       ` Bruno Herrera
  (?)
@ 2016-10-31 18:58                       ` Radosław Pietrzyk
       [not found]                         ` <CAFvLkMTCkRcwbRc8GVNBoJFAvKWHYDjOPabueQPjTseZrucadA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  -1 siblings, 1 reply; 32+ messages in thread
From: Radosław Pietrzyk @ 2016-10-31 18:58 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Alexandre Torgue, mark.rutland, devicetree, Arnd Bergmann, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 11046 bytes --]

I think wlcore driver searches dma-ranges in its parent that's why sdio
node needs it.

2016-10-31 17:41 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:

> On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
> <radoslaw.pietrzyk@gmail.com> wrote:
> > This is weird because dma ddresses are recalculated using parent's
> > dma-ranges property and soc already has it so there should be absolutely
> no
> > problem.
>
> These are my DTS and DTSI file.
> >
> > 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
> >>
> >> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
> >> <radoslaw.pietrzyk@gmail.com> wrote:
> >> > Have you defined your sdio node within soc node ?
> >>
> >> It is in the SOC node of the DSTI file.
> >>
> >> >
> >> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com>:
> >> >>
> >> >> Hi Alex,
> >> >>
> >> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
> >> >> <alexandre.torgue@st.com> wrote:
> >> >> > Hi Bruno,
> >> >> >
> >> >> >
> >> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> >> >> >>
> >> >> >> Hi Alex,
> >> >> >>
> >> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> >> >> >> <alexandre.torgue@st.com> wrote:
> >> >> >>>
> >> >> >>> Hi Bruno,
> >> >> >>>
> >> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> Hi Alexandre,
> >> >> >>>>
> >> >> >>>>>
> >> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start
> address
> >> >> >>>>> remapping
> >> >> >>>>> (to @0) to boost performances. A DMA translation through
> >> >> >>>>> "dma-ranges"
> >> >> >>>>> property was needed for other masters than the M4 CPU.
> >> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
> >> >> >>>>> translation.
> >> >> >>>>> This patches moves this DMA translation definition from
> stm32f429
> >> >> >>>>> soc
> >> >> >>>>> file
> >> >> >>>>> to board files.
> >> >> >>>>>
> >> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
> >> >> >>>>>
> >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>>> index 13c7cd2..a763c15 100644
> >> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>>> @@ -82,6 +82,10 @@
> >> >> >>>>>                 };
> >> >> >>>>>         };
> >> >> >>>>>
> >> >> >>>>> +       soc {
> >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >> >>>>> +       };
> >> >> >>>>> +
> >> >> >>>>>         usbotg_hs_phy: usbphy {
> >> >> >>>>>                 #phy-cells = <0>;
> >> >> >>>>>                 compatible = "usb-nop-xceiv";
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> Shouldn't also the peripheral dma-ranges property move to board
> >> >> >>>> specific
> >> >> >>>> too?
> >> >> >>>> I  had this patch for while but I didn't had the time to submit:
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
> >> >> >>> IIRC,
> >> >> >>> empty dma-ranges is not needed. Can you test on your side by
> >> >> >>> removing
> >> >> >>> dma-ranges in usb node please ?
> >> >> >>
> >> >> >> Unfortunately will take a time for me to set up this environment
> on
> >> >> >> the STM32F4-EVAL board.
> >> >> >> And on the discovery boards we dont have this scenario. That was
> the
> >> >> >> main reason I did not submit the patch right away.
> >> >> >> My conclusion and I might be wrong but is based on the my tests
> with
> >> >> >> SDIO device at STM32F469I-DISCO board.
> >> >> >>
> >> >> >> I started this issue as discussion at ST Forum but Maxime gave me
> >> >> >> the
> >> >> >> hint.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44
> >> >> >>
> >> >> >>> I will push a v2 by removing empty dma-ranges if tests are ok in
> >> >> >>> your
> >> >> >>> side.
> >> >> >>
> >> >> >>
> >> >> >> From my understating/conclusion is: when empty
> property(dma-ranges)
> >> >> >> is
> >> >> >> the device node, the mapping will be taken in consideration when
> >> >> >> using
> >> >> >> DMA otherwise the mapping is ignored.
> >> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> >> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question
> >> >> >> so
> >> >> >> I suppose it can work without the property.
> >> >> >
> >> >> >
> >> >> > For sure translation has to be done but I'm not sure that an empty
> >> >> > "dma-ranges" is needed in device node to activate it. For Ethernet
> >> >> > empty
> >> >> > "dma-ranges" is not needed. I will try with usb.
> >> >>
> >> >> In the case of SDIO it is needed. As example this is my working SDIO
> >> >> node:
> >> >>
> >> >> sdio: sdio@40012c00 {
> >> >> compatible = "arm,pl18x", "arm,primecell";
> >> >> arm,primecell-periphid = <0x00480181>;
> >> >> reg = <0x40012c00 0x400>;
> >> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> >> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> >> >> dma-names = "rx", "tx";
> >> >> clocks = <&rcc 0 171>;
> >> >> clock-names = "apb_pclk";
> >> >> interrupts = <49>;
> >> >> status = "disabled";
> >> >> };
> >> >>
> >> >> &sdio {
> >> >> status = "okay";
> >> >> vmmc-supply = <&wlan_en>;
> >> >> bus-width = <4>;
> >> >> max-frequency = <24000000>;
> >> >> pinctrl-names = "default";
> >> >> pinctrl-0 = <&sdio_pins>;
> >> >> ti,non-removable;
> >> >> ti,needs-special-hs-handling;
> >> >> dma-ranges;
> >> >> cap-power-off-card;
> >> >> keep-power-in-suspend;
> >> >>
> >> >> #address-cells = <1>;
> >> >> #size-cells = <0>;
> >> >> wlcore: wlcore@0 {
> >> >> compatible = "ti,wl1835";
> >> >> reg = <2>;
> >> >> interrupt-parent = <&gpioa>;
> >> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
> >> >> };
> >> >> };
> >> >>
> >> >> >
> >> >> > alex
> >> >> >
> >> >> >
> >> >> >>
> >> >> >>>
> >> >> >>> Thanks in advance
> >> >> >>> Alex
> >> >> >>>
> >> >> >>>
> >> >> >>>>
> >> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com>
> >> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
> >> >> >>>>
> >> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at
> dtsi
> >> >> >>>> file
> >> >> >>>>
> >> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>> index 6bfc595..2a22a82 100644
> >> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >> >>>> @@ -52,6 +52,10 @@
> >> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
> >> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
> >> >> >>>>
> >> >> >>>> +       soc {
> >> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> >> >> >>>> +       };
> >> >> >>>> +
> >> >> >>>>         chosen {
> >> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
> >> >> >>>>                 stdout-path = "serial0:115200n8";
> >> >> >>>> @@ -96,6 +100,7 @@
> >> >> >>>>
> >> >> >>>>  &ethernet0 {
> >> >> >>>>         status = "okay";
> >> >> >>>> +       dma-ranges;
> >> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
> >> >> >>>>         pinctrl-names   = "default";
> >> >> >>>>         phy-mode        = "mii-id";
> >> >> >>>> @@ -116,6 +121,7 @@
> >> >> >>>>  };
> >> >> >>>>
> >> >> >>>>  &usbotg_hs {
> >> >> >>>> +       dma-ranges;
> >> >> >>>>         dr_mode = "host";
> >> >> >>>>         phys = <&usbotg_hs_phy>;
> >> >> >>>>         phy-names = "usb2-phy";
> >> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>> index 7d624a2..697a133 100644
> >> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>> @@ -59,7 +59,6 @@
> >> >> >>>>         };
> >> >> >>>>
> >> >> >>>>         soc {
> >> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >> >>>>
> >> >> >>>>                 timer2: timer@40000000 {
> >> >> >>>>                         compatible = "st,stm32-timer";
> >> >> >>>> @@ -472,13 +471,11 @@
> >> >> >>>>                         st,syscon = <&syscfg 0x4>;
> >> >> >>>>                         snps,pbl = <8>;
> >> >> >>>>                         snps,mixed-burst;
> >> >> >>>> -                       dma-ranges;
> >> >> >>>>                         status = "disabled";
> >> >> >>>>                 };
> >> >> >>>>
> >> >> >>>>                 usbotg_hs: usb@40040000 {
> >> >> >>>>                         compatible = "snps,dwc2";
> >> >> >>>> -                       dma-ranges;
> >> >> >>>>                         reg = <0x40040000 0x40000>;
> >> >> >>>>                         interrupts = <77>;
> >> >> >>>>                         clocks = <&rcc 0 29>;
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>>> index 0596d60..3a1cfdd 100644
> >> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >> >>>>> @@ -59,8 +59,6 @@
> >> >> >>>>>         };
> >> >> >>>>>
> >> >> >>>>>         soc {
> >> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >> >>>>> -
> >> >> >>>>>                 timer2: timer@40000000 {
> >> >> >>>>>                         compatible = "st,stm32-timer";
> >> >> >>>>>                         reg = <0x40000000 0x400>;
> >> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >> >>>>> index 9e73656..c2213c0 100644
> >> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >> >>>>> @@ -64,6 +64,10 @@
> >> >> >>>>>         aliases {
> >> >> >>>>>                 serial0 = &usart3;
> >> >> >>>>>         };
> >> >> >>>>> +
> >> >> >>>>> +       soc {
> >> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >> >>>>> +       };
> >> >> >>>>>  };
> >> >> >>>>>
> >> >> >>>>>  &clk_hse {
> >> >> >>>>> --
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> Br.,
> >> >> >>>> Bruno
> >> >> >>>>
> >> >> >>>
> >> >> >
> >> >>
> >> >> _______________________________________________
> >> >> linux-arm-kernel mailing list
> >> >> linux-arm-kernel@lists.infradead.org
> >> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> >> >
> >> >
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 19849 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-31 14:14                 ` Radosław Pietrzyk
@ 2016-10-31 16:41                       ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-31 16:41 UTC (permalink / raw)
  To: Radosław Pietrzyk
  Cc: Alexandre Torgue, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

[-- Attachment #1: Type: text/plain, Size: 10507 bytes --]

On Mon, Oct 31, 2016 at 12:14 PM, Radosław Pietrzyk
<radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> This is weird because dma ddresses are recalculated using parent's
> dma-ranges property and soc already has it so there should be absolutely no
> problem.

These are my DTS and DTSI file.
>
> 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>>
>> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
>> <radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > Have you defined your sdio node within soc node ?
>>
>> It is in the SOC node of the DSTI file.
>>
>> >
>> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>> >>
>> >> Hi Alex,
>> >>
>> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> >> > Hi Bruno,
>> >> >
>> >> >
>> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >> >>
>> >> >> Hi Alex,
>> >> >>
>> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> >> >>>
>> >> >>> Hi Bruno,
>> >> >>>
>> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >> >>>>
>> >> >>>>
>> >> >>>> Hi Alexandre,
>> >> >>>>
>> >> >>>>>
>> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>> >> >>>>> remapping
>> >> >>>>> (to @0) to boost performances. A DMA translation through
>> >> >>>>> "dma-ranges"
>> >> >>>>> property was needed for other masters than the M4 CPU.
>> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>> >> >>>>> translation.
>> >> >>>>> This patches moves this DMA translation definition from stm32f429
>> >> >>>>> soc
>> >> >>>>> file
>> >> >>>>> to board files.
>> >> >>>>>
>> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>
>> >> >>>>>
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> index 13c7cd2..a763c15 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> @@ -82,6 +82,10 @@
>> >> >>>>>                 };
>> >> >>>>>         };
>> >> >>>>>
>> >> >>>>> +       soc {
>> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> +       };
>> >> >>>>> +
>> >> >>>>>         usbotg_hs_phy: usbphy {
>> >> >>>>>                 #phy-cells = <0>;
>> >> >>>>>                 compatible = "usb-nop-xceiv";
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> Shouldn't also the peripheral dma-ranges property move to board
>> >> >>>> specific
>> >> >>>> too?
>> >> >>>> I  had this patch for while but I didn't had the time to submit:
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
>> >> >>> IIRC,
>> >> >>> empty dma-ranges is not needed. Can you test on your side by
>> >> >>> removing
>> >> >>> dma-ranges in usb node please ?
>> >> >>
>> >> >> Unfortunately will take a time for me to set up this environment on
>> >> >> the STM32F4-EVAL board.
>> >> >> And on the discovery boards we dont have this scenario. That was the
>> >> >> main reason I did not submit the patch right away.
>> >> >> My conclusion and I might be wrong but is based on the my tests with
>> >> >> SDIO device at STM32F469I-DISCO board.
>> >> >>
>> >> >> I started this issue as discussion at ST Forum but Maxime gave me
>> >> >> the
>> >> >> hint.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >> >>
>> >> >>> I will push a v2 by removing empty dma-ranges if tests are ok in
>> >> >>> your
>> >> >>> side.
>> >> >>
>> >> >>
>> >> >> From my understating/conclusion is: when empty property(dma-ranges)
>> >> >> is
>> >> >> the device node, the mapping will be taken in consideration when
>> >> >> using
>> >> >> DMA otherwise the mapping is ignored.
>> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question
>> >> >> so
>> >> >> I suppose it can work without the property.
>> >> >
>> >> >
>> >> > For sure translation has to be done but I'm not sure that an empty
>> >> > "dma-ranges" is needed in device node to activate it. For Ethernet
>> >> > empty
>> >> > "dma-ranges" is not needed. I will try with usb.
>> >>
>> >> In the case of SDIO it is needed. As example this is my working SDIO
>> >> node:
>> >>
>> >> sdio: sdio@40012c00 {
>> >> compatible = "arm,pl18x", "arm,primecell";
>> >> arm,primecell-periphid = <0x00480181>;
>> >> reg = <0x40012c00 0x400>;
>> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> >> dma-names = "rx", "tx";
>> >> clocks = <&rcc 0 171>;
>> >> clock-names = "apb_pclk";
>> >> interrupts = <49>;
>> >> status = "disabled";
>> >> };
>> >>
>> >> &sdio {
>> >> status = "okay";
>> >> vmmc-supply = <&wlan_en>;
>> >> bus-width = <4>;
>> >> max-frequency = <24000000>;
>> >> pinctrl-names = "default";
>> >> pinctrl-0 = <&sdio_pins>;
>> >> ti,non-removable;
>> >> ti,needs-special-hs-handling;
>> >> dma-ranges;
>> >> cap-power-off-card;
>> >> keep-power-in-suspend;
>> >>
>> >> #address-cells = <1>;
>> >> #size-cells = <0>;
>> >> wlcore: wlcore@0 {
>> >> compatible = "ti,wl1835";
>> >> reg = <2>;
>> >> interrupt-parent = <&gpioa>;
>> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> >> };
>> >> };
>> >>
>> >> >
>> >> > alex
>> >> >
>> >> >
>> >> >>
>> >> >>>
>> >> >>> Thanks in advance
>> >> >>> Alex
>> >> >>>
>> >> >>>
>> >> >>>>
>> >> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >> >>>>
>> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi
>> >> >>>> file
>> >> >>>>
>> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> index 6bfc595..2a22a82 100644
>> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> @@ -52,6 +52,10 @@
>> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>> >> >>>>
>> >> >>>> +       soc {
>> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> >> >>>> +       };
>> >> >>>> +
>> >> >>>>         chosen {
>> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>> >> >>>>                 stdout-path = "serial0:115200n8";
>> >> >>>> @@ -96,6 +100,7 @@
>> >> >>>>
>> >> >>>>  &ethernet0 {
>> >> >>>>         status = "okay";
>> >> >>>> +       dma-ranges;
>> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >> >>>>         pinctrl-names   = "default";
>> >> >>>>         phy-mode        = "mii-id";
>> >> >>>> @@ -116,6 +121,7 @@
>> >> >>>>  };
>> >> >>>>
>> >> >>>>  &usbotg_hs {
>> >> >>>> +       dma-ranges;
>> >> >>>>         dr_mode = "host";
>> >> >>>>         phys = <&usbotg_hs_phy>;
>> >> >>>>         phy-names = "usb2-phy";
>> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> index 7d624a2..697a133 100644
>> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> @@ -59,7 +59,6 @@
>> >> >>>>         };
>> >> >>>>
>> >> >>>>         soc {
>> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>
>> >> >>>>                 timer2: timer@40000000 {
>> >> >>>>                         compatible = "st,stm32-timer";
>> >> >>>> @@ -472,13 +471,11 @@
>> >> >>>>                         st,syscon = <&syscfg 0x4>;
>> >> >>>>                         snps,pbl = <8>;
>> >> >>>>                         snps,mixed-burst;
>> >> >>>> -                       dma-ranges;
>> >> >>>>                         status = "disabled";
>> >> >>>>                 };
>> >> >>>>
>> >> >>>>                 usbotg_hs: usb@40040000 {
>> >> >>>>                         compatible = "snps,dwc2";
>> >> >>>> -                       dma-ranges;
>> >> >>>>                         reg = <0x40040000 0x40000>;
>> >> >>>>                         interrupts = <77>;
>> >> >>>>                         clocks = <&rcc 0 29>;
>> >> >>>>
>> >> >>>>
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> index 0596d60..3a1cfdd 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> @@ -59,8 +59,6 @@
>> >> >>>>>         };
>> >> >>>>>
>> >> >>>>>         soc {
>> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> -
>> >> >>>>>                 timer2: timer@40000000 {
>> >> >>>>>                         compatible = "st,stm32-timer";
>> >> >>>>>                         reg = <0x40000000 0x400>;
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> index 9e73656..c2213c0 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> @@ -64,6 +64,10 @@
>> >> >>>>>         aliases {
>> >> >>>>>                 serial0 = &usart3;
>> >> >>>>>         };
>> >> >>>>> +
>> >> >>>>> +       soc {
>> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> +       };
>> >> >>>>>  };
>> >> >>>>>
>> >> >>>>>  &clk_hse {
>> >> >>>>> --
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> Br.,
>> >> >>>> Bruno
>> >> >>>>
>> >> >>>
>> >> >
>> >>
>> >> _______________________________________________
>> >> linux-arm-kernel mailing list
>> >> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>> >
>> >
>
>

[-- Attachment #2: stm32f469-disco.dts --]
[-- Type: application/octet-stream, Size: 3330 bytes --]

/*
 * Copyright 2016 - Lee Jones <lee.jones@linaro.org>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public
 *     License along with this file; if not, write to the Free
 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 *     MA 02110-1301 USA
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

/dts-v1/;
#include "stm32f429.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
	model = "STMicroelectronics STM32F469i-DISCO board";
	compatible = "st,stm32f469i-disco", "st,stm32f469";

	soc {
		dma-ranges = <0xC0000000 0x0 0x10000000>;
	};

	chosen {
		bootargs = "root=/dev/sda1 rootfstype=ext4 ro rootwait clk_ignore_unused user_debug=31";
		stdout-path = "serial0:115200n8";
	};

	memory {
		reg = <0x00000000 0x1000000>;
	};

	aliases {
		serial0 = &usart3;
	};

};

&clk_hse {
	clock-frequency = <8000000>;
};

&usart3 {
	pinctrl-0 = <&usart3_pins_a>;
	pinctrl-names = "default";
	status = "okay";
};

&sdio {
	status = "okay";
	bus-width = <4>;
	max-frequency = <24000000>;
	pinctrl-names = "default";
	pinctrl-0 = <&sdio_pins>;
	ti,non-removable;
	ti,needs-special-hs-handling;
	dma-ranges;
	cap-power-off-card;
	keep-power-in-suspend;

	#address-cells = <1>;
	#size-cells = <0>;
	wlcore: wlcore@0 {
		compatible = "ti,wl1835";
		reg = <2>;
		interrupt-parent = <&gpioa>;
		interrupts = <8 IRQ_TYPE_EDGE_RISING>;
	};
};

[-- Attachment #3: stm32f429.dtsi --]
[-- Type: application/octet-stream, Size: 12741 bytes --]

/*
 * Copyright 2015 - Maxime Coquelin <mcoquelin.stm32@gmail.com>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public
 *     License along with this file; if not, write to the Free
 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 *     MA 02110-1301 USA
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

#include "skeleton.dtsi"
#include "armv7-m.dtsi"
#include <dt-bindings/pinctrl/stm32f429-pinfunc.h>

/ {
	clocks {
		clk_hse: clk-hse {
			#clock-cells = <0>;
			compatible = "fixed-clock";
			clock-frequency = <0>;
		};
	};

	soc {

		timer2: timer@40000000 {
			compatible = "st,stm32-timer";
			reg = <0x40000000 0x400>;
			interrupts = <28>;
			clocks = <&rcc 0 128>;
			status = "disabled";
		};

		timer3: timer@40000400 {
			compatible = "st,stm32-timer";
			reg = <0x40000400 0x400>;
			interrupts = <29>;
			clocks = <&rcc 0 129>;
			status = "disabled";
		};

		timer4: timer@40000800 {
			compatible = "st,stm32-timer";
			reg = <0x40000800 0x400>;
			interrupts = <30>;
			clocks = <&rcc 0 130>;
			status = "disabled";
		};

		timer5: timer@40000c00 {
			compatible = "st,stm32-timer";
			reg = <0x40000c00 0x400>;
			interrupts = <50>;
			clocks = <&rcc 0 131>;
		};

		timer6: timer@40001000 {
			compatible = "st,stm32-timer";
			reg = <0x40001000 0x400>;
			interrupts = <54>;
			clocks = <&rcc 0 132>;
			status = "disabled";
		};

		timer7: timer@40001400 {
			compatible = "st,stm32-timer";
			reg = <0x40001400 0x400>;
			interrupts = <55>;
			clocks = <&rcc 0 133>;
			status = "disabled";
		};

		usart2: serial@40004400 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40004400 0x400>;
			interrupts = <38>;
			clocks =  <&rcc 0 145>;
			status = "disabled";
		};

		usart3: serial@40004800 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40004800 0x400>;
			interrupts = <39>;
			clocks = <&rcc 0 146>;
			status = "disabled";
			/*dmas = <&dma1 1 4 0x400 0x0>,
			       <&dma1 3 4 0x400 0x0>;
			dma-names = "rx", "tx";*/
		};

		usart4: serial@40004c00 {
			compatible = "st,stm32-uart";
			reg = <0x40004c00 0x400>;
			interrupts = <52>;
			clocks = <&rcc 0 147>;
			status = "disabled";
		};

		usart5: serial@40005000 {
			compatible = "st,stm32-uart";
			reg = <0x40005000 0x400>;
			interrupts = <53>;
			clocks = <&rcc 0 148>;
			status = "disabled";
		};

		usart7: serial@40007800 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40007800 0x400>;
			interrupts = <82>;
			clocks = <&rcc 0 158>;
			status = "disabled";
		};

		usart8: serial@40007c00 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40007c00 0x400>;
			interrupts = <83>;
			clocks = <&rcc 0 159>;
			status = "disabled";
		};

		usart1: serial@40011000 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40011000 0x400>;
			interrupts = <37>;
			clocks = <&rcc 0 164>;
			status = "disabled";
			/*dmas = <&dma2 2 4 0x400 0x0>,
			       <&dma2 7 4 0x400 0x0>;
			dma-names = "rx", "tx";*/
		};

		usart6: serial@40011400 {
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40011400 0x400>;
			interrupts = <71>;
			clocks = <&rcc 0 165>;
			status = "disabled";
			dmas = <&dma2 2 5 0x400 0x0>,
			       <&dma2 7 5 0x400 0x0>;
			dma-names = "rx", "tx";
		};

		sdio: sdio@40012c00 {
			compatible = "arm,pl18x", "arm,primecell";
			arm,primecell-periphid = <0x00480181>;
			reg = <0x40012c00 0x400>;
			dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
				<&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
			dma-names = "rx", "tx";
			clocks = <&rcc 0 171>;
			clock-names = "apb_pclk";
			interrupts = <49>;
			status = "disabled";
		};

		syscfg: system-config@40013800 {
			compatible = "syscon";
			reg = <0x40013800 0x400>;
		};

		exti: interrupt-controller@40013c00 {
			compatible = "st,stm32-exti";
			interrupt-controller;
			#interrupt-cells = <2>;
			reg = <0x40013C00 0x400>;
			interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, <23>, <40>, <41>, <42>, <62>, <76>;
		};

		pinctrl: pin-controller {
			#address-cells = <1>;
			#size-cells = <1>;
			compatible = "st,stm32f429-pinctrl";
			ranges = <0 0x40020000 0x3000>;
			interrupt-parent = <&exti>;
			st,syscfg = <&syscfg 0x8>;
			pins-are-numbered;

			gpioa: gpio@40020000 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x0 0x400>;
				clocks = <&rcc 0 0>;
				st,bank-name = "GPIOA";
			};

			gpiob: gpio@40020400 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x400 0x400>;
				clocks = <&rcc 0 1>;
				st,bank-name = "GPIOB";
			};

			gpioc: gpio@40020800 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x800 0x400>;
				clocks = <&rcc 0 2>;
				st,bank-name = "GPIOC";
			};

			gpiod: gpio@40020c00 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0xc00 0x400>;
				clocks = <&rcc 0 3>;
				st,bank-name = "GPIOD";
			};

			gpioe: gpio@40021000 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x1000 0x400>;
				clocks = <&rcc 0 4>;
				st,bank-name = "GPIOE";
			};

			gpiof: gpio@40021400 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x1400 0x400>;
				clocks = <&rcc 0 5>;
				st,bank-name = "GPIOF";
			};

			gpiog: gpio@40021800 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x1800 0x400>;
				clocks = <&rcc 0 6>;
				st,bank-name = "GPIOG";
			};

			gpioh: gpio@40021c00 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x1c00 0x400>;
				clocks = <&rcc 0 7>;
				st,bank-name = "GPIOH";
			};

			gpioi: gpio@40022000 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x2000 0x400>;
				clocks = <&rcc 0 8>;
				st,bank-name = "GPIOI";
			};

			gpioj: gpio@40022400 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x2400 0x400>;
				clocks = <&rcc 0 9>;
				st,bank-name = "GPIOJ";
			};

			gpiok: gpio@40022800 {
				gpio-controller;
				#gpio-cells = <2>;
				reg = <0x2800 0x400>;
				clocks = <&rcc 0 10>;
				st,bank-name = "GPIOK";
			};

			usart1_pins_a: usart1@0 {
				pins1 {
					pinmux = <STM32F429_PA9_FUNC_USART1_TX>;
					bias-disable;
					drive-push-pull;
					slew-rate = <0>;
				};
				pins2 {
					pinmux = <STM32F429_PA10_FUNC_USART1_RX>;
					bias-disable;
				};
			};

			usart6_pins_a: usart6@0 {
				pins1 {
					pinmux = <STM32F429_PG14_FUNC_USART6_TX>,
						 <STM32F429_PG12_FUNC_USART6_RTS>;
					bias-disable;
					drive-push-pull;
					slew-rate = <2>;
				};
				pins2 {
					pinmux = <STM32F429_PG9_FUNC_USART6_RX>,
						 <STM32F429_PG13_FUNC_USART6_CTS>;
					bias-disable;
				};
			};

			usbotg_fs_pins_a: usbotg_fs@0 {
				pins {
					pinmux = <STM32F429_PA10_FUNC_OTG_FS_ID>,
						 <STM32F429_PA11_FUNC_OTG_FS_DM>,
						 <STM32F429_PA12_FUNC_OTG_FS_DP>;
					bias-disable;
					drive-push-pull;
					slew-rate = <2>;
				};
			};

			usbotg_fs_pins_b: usbotg_fs@1 {
				pins {
					pinmux = <STM32F429_PB12_FUNC_OTG_HS_ID>,
						 <STM32F429_PB14_FUNC_OTG_HS_DM>,
						 <STM32F429_PB15_FUNC_OTG_HS_DP>;
					bias-disable;
					drive-push-pull;
					slew-rate = <2>;
				};
			};

			usart3_pins_a: usart3@0 {
				pins1 {
					pinmux = <STM32F429_PB10_FUNC_USART3_TX>;
					bias-disable;
					drive-push-pull;
					slew-rate = <0>;
				};
				pins2 {
					pinmux = <STM32F429_PB11_FUNC_USART3_RX>;
					bias-disable;
				};
			};

			usbotg_hs_pins_a: usbotg_hs@0 {
				pins {
					pinmux = <STM32F429_PH4_FUNC_OTG_HS_ULPI_NXT>,
						 <STM32F429_PI11_FUNC_OTG_HS_ULPI_DIR>,
						 <STM32F429_PC0_FUNC_OTG_HS_ULPI_STP>,
						 <STM32F429_PA5_FUNC_OTG_HS_ULPI_CK>,
						 <STM32F429_PA3_FUNC_OTG_HS_ULPI_D0>,
						 <STM32F429_PB0_FUNC_OTG_HS_ULPI_D1>,
						 <STM32F429_PB1_FUNC_OTG_HS_ULPI_D2>,
						 <STM32F429_PB10_FUNC_OTG_HS_ULPI_D3>,
						 <STM32F429_PB11_FUNC_OTG_HS_ULPI_D4>,
						 <STM32F429_PB12_FUNC_OTG_HS_ULPI_D5>,
						 <STM32F429_PB13_FUNC_OTG_HS_ULPI_D6>,
						 <STM32F429_PB5_FUNC_OTG_HS_ULPI_D7>;
					bias-disable;
					drive-push-pull;
					slew-rate = <2>;
				};
			};

			ethernet0_mii: mii@0 {
				pins {
					pinmux = <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
						 <STM32F429_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
						 <STM32F429_PC2_FUNC_ETH_MII_TXD2>,
						 <STM32F429_PB8_FUNC_ETH_MII_TXD3>,
						 <STM32F429_PC3_FUNC_ETH_MII_TX_CLK>,
						 <STM32F429_PG11_FUNC_ETH_MII_TX_EN_ETH_RMII_TX_EN>,
						 <STM32F429_PA2_FUNC_ETH_MDIO>,
						 <STM32F429_PC1_FUNC_ETH_MDC>,
						 <STM32F429_PA1_FUNC_ETH_MII_RX_CLK_ETH_RMII_REF_CLK>,
						 <STM32F429_PA7_FUNC_ETH_MII_RX_DV_ETH_RMII_CRS_DV>,
						 <STM32F429_PC4_FUNC_ETH_MII_RXD0_ETH_RMII_RXD0>,
						 <STM32F429_PC5_FUNC_ETH_MII_RXD1_ETH_RMII_RXD1>,
						 <STM32F429_PH6_FUNC_ETH_MII_RXD2>,
						 <STM32F429_PH7_FUNC_ETH_MII_RXD3>;
					slew-rate = <2>;
				};
			};

			sdio_pins: sdio@0 {
				pins {
					pinmux = <STM32F429_PC8_FUNC_SDIO_D0>,
						 <STM32F429_PC9_FUNC_SDIO_D1>,
						 <STM32F429_PC10_FUNC_SDIO_D2>,
						 <STM32F429_PC11_FUNC_SDIO_D3>,
						 <STM32F429_PC12_FUNC_SDIO_CK>,
						 <STM32F429_PD2_FUNC_SDIO_CMD>;
					bias-disable;
					drive-push-pull;
					slew-rate = <2>;
				};
			};
		};

		rcc: rcc@40023810 {
			#reset-cells = <1>;
			#clock-cells = <2>;
			compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
			reg = <0x40023800 0x400>;
			clocks = <&clk_hse>;
		};

		dma1: dma-controller@40026000 {
			compatible = "st,stm32-dma";
			reg = <0x40026000 0x400>;
			interrupts = <11>,
				     <12>,
				     <13>,
				     <14>,
				     <15>,
				     <16>,
				     <17>,
				     <47>;
			clocks = <&rcc 0 21>;
			#dma-cells = <4>;
		};

		dma2: dma-controller@40026400 {
			compatible = "st,stm32-dma";
			reg = <0x40026400 0x400>;
			interrupts = <56>,
				     <57>,
				     <58>,
				     <59>,
				     <60>,
				     <68>,
				     <69>,
				     <70>;
			clocks = <&rcc 0 22>;
			#dma-cells = <4>;
			st,mem2mem;
		};

		ethernet0: dwmac@40028000 {
			compatible = "st,stm32-dwmac", "snps,dwmac-3.50a";
			reg = <0x40028000 0x8000>;
			reg-names = "stmmaceth";
			interrupts = <61>, <62>;
			interrupt-names = "macirq", "eth_wake_irq";
			clock-names = "stmmaceth", "tx-clk", "rx-clk";
			clocks = <&rcc 0 25>, <&rcc 0 26>, <&rcc 0 27>;
			st,syscon = <&syscfg 0x4>;
			snps,pbl = <8>;
			snps,mixed-burst;
			status = "disabled";
		};

		usbotg_hs: usb@40040000 {
			compatible = "snps,dwc2";
			reg = <0x40040000 0x40000>;
			interrupts = <77>;
			clocks = <&rcc 0 29>;
			clock-names = "otg";
			status = "disabled";
		};

		usbotg_fs: usb@50000000 {
			compatible = "st,stm32-fsotg", "snps,dwc2";
			reg = <0x50000000 0x40000>;
			interrupts = <67>;
			clocks = <&rcc 0 39>;
			clock-names = "otg";
			status = "disabled";
		};

		rng: rng@50060800 {
			compatible = "st,stm32-rng";
			reg = <0x50060800 0x400>;
			interrupts = <80>;
			clocks = <&rcc 0 38>;
		};
	};
};

&systick {
	clocks = <&rcc 1 0>;
	status = "okay";
};

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-31 16:41                       ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-31 16:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2016 at 12:14 PM, Rados?aw Pietrzyk
<radoslaw.pietrzyk@gmail.com> wrote:
> This is weird because dma ddresses are recalculated using parent's
> dma-ranges property and soc already has it so there should be absolutely no
> problem.

These are my DTS and DTSI file.
>
> 2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:
>>
>> On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
>> <radoslaw.pietrzyk@gmail.com> wrote:
>> > Have you defined your sdio node within soc node ?
>>
>> It is in the SOC node of the DSTI file.
>>
>> >
>> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com>:
>> >>
>> >> Hi Alex,
>> >>
>> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> >> <alexandre.torgue@st.com> wrote:
>> >> > Hi Bruno,
>> >> >
>> >> >
>> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >> >>
>> >> >> Hi Alex,
>> >> >>
>> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >> >> <alexandre.torgue@st.com> wrote:
>> >> >>>
>> >> >>> Hi Bruno,
>> >> >>>
>> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >> >>>>
>> >> >>>>
>> >> >>>> Hi Alexandre,
>> >> >>>>
>> >> >>>>>
>> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>> >> >>>>> remapping
>> >> >>>>> (to @0) to boost performances. A DMA translation through
>> >> >>>>> "dma-ranges"
>> >> >>>>> property was needed for other masters than the M4 CPU.
>> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>> >> >>>>> translation.
>> >> >>>>> This patches moves this DMA translation definition from stm32f429
>> >> >>>>> soc
>> >> >>>>> file
>> >> >>>>> to board files.
>> >> >>>>>
>> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>> >> >>>>>
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> index 13c7cd2..a763c15 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>>> @@ -82,6 +82,10 @@
>> >> >>>>>                 };
>> >> >>>>>         };
>> >> >>>>>
>> >> >>>>> +       soc {
>> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> +       };
>> >> >>>>> +
>> >> >>>>>         usbotg_hs_phy: usbphy {
>> >> >>>>>                 #phy-cells = <0>;
>> >> >>>>>                 compatible = "usb-nop-xceiv";
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> Shouldn't also the peripheral dma-ranges property move to board
>> >> >>>> specific
>> >> >>>> too?
>> >> >>>> I  had this patch for while but I didn't had the time to submit:
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
>> >> >>> IIRC,
>> >> >>> empty dma-ranges is not needed. Can you test on your side by
>> >> >>> removing
>> >> >>> dma-ranges in usb node please ?
>> >> >>
>> >> >> Unfortunately will take a time for me to set up this environment on
>> >> >> the STM32F4-EVAL board.
>> >> >> And on the discovery boards we dont have this scenario. That was the
>> >> >> main reason I did not submit the patch right away.
>> >> >> My conclusion and I might be wrong but is based on the my tests with
>> >> >> SDIO device at STM32F469I-DISCO board.
>> >> >>
>> >> >> I started this issue as discussion at ST Forum but Maxime gave me
>> >> >> the
>> >> >> hint.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >> >>
>> >> >>> I will push a v2 by removing empty dma-ranges if tests are ok in
>> >> >>> your
>> >> >>> side.
>> >> >>
>> >> >>
>> >> >> From my understating/conclusion is: when empty property(dma-ranges)
>> >> >> is
>> >> >> the device node, the mapping will be taken in consideration when
>> >> >> using
>> >> >> DMA otherwise the mapping is ignored.
>> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question
>> >> >> so
>> >> >> I suppose it can work without the property.
>> >> >
>> >> >
>> >> > For sure translation has to be done but I'm not sure that an empty
>> >> > "dma-ranges" is needed in device node to activate it. For Ethernet
>> >> > empty
>> >> > "dma-ranges" is not needed. I will try with usb.
>> >>
>> >> In the case of SDIO it is needed. As example this is my working SDIO
>> >> node:
>> >>
>> >> sdio: sdio at 40012c00 {
>> >> compatible = "arm,pl18x", "arm,primecell";
>> >> arm,primecell-periphid = <0x00480181>;
>> >> reg = <0x40012c00 0x400>;
>> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> >> dma-names = "rx", "tx";
>> >> clocks = <&rcc 0 171>;
>> >> clock-names = "apb_pclk";
>> >> interrupts = <49>;
>> >> status = "disabled";
>> >> };
>> >>
>> >> &sdio {
>> >> status = "okay";
>> >> vmmc-supply = <&wlan_en>;
>> >> bus-width = <4>;
>> >> max-frequency = <24000000>;
>> >> pinctrl-names = "default";
>> >> pinctrl-0 = <&sdio_pins>;
>> >> ti,non-removable;
>> >> ti,needs-special-hs-handling;
>> >> dma-ranges;
>> >> cap-power-off-card;
>> >> keep-power-in-suspend;
>> >>
>> >> #address-cells = <1>;
>> >> #size-cells = <0>;
>> >> wlcore: wlcore at 0 {
>> >> compatible = "ti,wl1835";
>> >> reg = <2>;
>> >> interrupt-parent = <&gpioa>;
>> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> >> };
>> >> };
>> >>
>> >> >
>> >> > alex
>> >> >
>> >> >
>> >> >>
>> >> >>>
>> >> >>> Thanks in advance
>> >> >>> Alex
>> >> >>>
>> >> >>>
>> >> >>>>
>> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com>
>> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >> >>>>
>> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi
>> >> >>>> file
>> >> >>>>
>> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> index 6bfc595..2a22a82 100644
>> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >> >>>> @@ -52,6 +52,10 @@
>> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>> >> >>>>
>> >> >>>> +       soc {
>> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> >> >>>> +       };
>> >> >>>> +
>> >> >>>>         chosen {
>> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>> >> >>>>                 stdout-path = "serial0:115200n8";
>> >> >>>> @@ -96,6 +100,7 @@
>> >> >>>>
>> >> >>>>  &ethernet0 {
>> >> >>>>         status = "okay";
>> >> >>>> +       dma-ranges;
>> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >> >>>>         pinctrl-names   = "default";
>> >> >>>>         phy-mode        = "mii-id";
>> >> >>>> @@ -116,6 +121,7 @@
>> >> >>>>  };
>> >> >>>>
>> >> >>>>  &usbotg_hs {
>> >> >>>> +       dma-ranges;
>> >> >>>>         dr_mode = "host";
>> >> >>>>         phys = <&usbotg_hs_phy>;
>> >> >>>>         phy-names = "usb2-phy";
>> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> index 7d624a2..697a133 100644
>> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>> @@ -59,7 +59,6 @@
>> >> >>>>         };
>> >> >>>>
>> >> >>>>         soc {
>> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>
>> >> >>>>                 timer2: timer at 40000000 {
>> >> >>>>                         compatible = "st,stm32-timer";
>> >> >>>> @@ -472,13 +471,11 @@
>> >> >>>>                         st,syscon = <&syscfg 0x4>;
>> >> >>>>                         snps,pbl = <8>;
>> >> >>>>                         snps,mixed-burst;
>> >> >>>> -                       dma-ranges;
>> >> >>>>                         status = "disabled";
>> >> >>>>                 };
>> >> >>>>
>> >> >>>>                 usbotg_hs: usb at 40040000 {
>> >> >>>>                         compatible = "snps,dwc2";
>> >> >>>> -                       dma-ranges;
>> >> >>>>                         reg = <0x40040000 0x40000>;
>> >> >>>>                         interrupts = <77>;
>> >> >>>>                         clocks = <&rcc 0 29>;
>> >> >>>>
>> >> >>>>
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> index 0596d60..3a1cfdd 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >> >>>>> @@ -59,8 +59,6 @@
>> >> >>>>>         };
>> >> >>>>>
>> >> >>>>>         soc {
>> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> -
>> >> >>>>>                 timer2: timer at 40000000 {
>> >> >>>>>                         compatible = "st,stm32-timer";
>> >> >>>>>                         reg = <0x40000000 0x400>;
>> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> index 9e73656..c2213c0 100644
>> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >> >>>>> @@ -64,6 +64,10 @@
>> >> >>>>>         aliases {
>> >> >>>>>                 serial0 = &usart3;
>> >> >>>>>         };
>> >> >>>>> +
>> >> >>>>> +       soc {
>> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >> >>>>> +       };
>> >> >>>>>  };
>> >> >>>>>
>> >> >>>>>  &clk_hse {
>> >> >>>>> --
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> Br.,
>> >> >>>> Bruno
>> >> >>>>
>> >> >>>
>> >> >
>> >>
>> >> _______________________________________________
>> >> linux-arm-kernel mailing list
>> >> linux-arm-kernel at lists.infradead.org
>> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>> >
>> >
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stm32f469-disco.dts
Type: application/octet-stream
Size: 3330 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161031/f28cc5d8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stm32f429.dtsi
Type: application/octet-stream
Size: 12741 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161031/f28cc5d8/attachment-0003.obj>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-31 10:27                 ` Bruno Herrera
  (?)
@ 2016-10-31 14:14                 ` Radosław Pietrzyk
       [not found]                   ` <CAFvLkMQ6YMg4sf2Ug8x4-YshwnjbLz3aVzm+JpKP6zG9r-WU4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  -1 siblings, 1 reply; 32+ messages in thread
From: Radosław Pietrzyk @ 2016-10-31 14:14 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Alexandre Torgue, mark.rutland, devicetree, Arnd Bergmann, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 9801 bytes --]

This is weird because dma ddresses are recalculated using parent's
dma-ranges property and soc already has it so there should be absolutely no
problem.

2016-10-31 11:27 GMT+01:00 Bruno Herrera <bruherrera@gmail.com>:

> On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
> <radoslaw.pietrzyk@gmail.com> wrote:
> > Have you defined your sdio node within soc node ?
>
> It is in the SOC node of the DSTI file.
>
> >
> > 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com>:
> >>
> >> Hi Alex,
> >>
> >> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
> >> <alexandre.torgue@st.com> wrote:
> >> > Hi Bruno,
> >> >
> >> >
> >> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> >> >>
> >> >> Hi Alex,
> >> >>
> >> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> >> >> <alexandre.torgue@st.com> wrote:
> >> >>>
> >> >>> Hi Bruno,
> >> >>>
> >> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> >> >>>>
> >> >>>>
> >> >>>> Hi Alexandre,
> >> >>>>
> >> >>>>>
> >> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
> >> >>>>> remapping
> >> >>>>> (to @0) to boost performances. A DMA translation through
> >> >>>>> "dma-ranges"
> >> >>>>> property was needed for other masters than the M4 CPU.
> >> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
> >> >>>>> translation.
> >> >>>>> This patches moves this DMA translation definition from stm32f429
> >> >>>>> soc
> >> >>>>> file
> >> >>>>> to board files.
> >> >>>>>
> >> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
> >> >>>>>
> >> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>>> index 13c7cd2..a763c15 100644
> >> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>>> @@ -82,6 +82,10 @@
> >> >>>>>                 };
> >> >>>>>         };
> >> >>>>>
> >> >>>>> +       soc {
> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >>>>> +       };
> >> >>>>> +
> >> >>>>>         usbotg_hs_phy: usbphy {
> >> >>>>>                 #phy-cells = <0>;
> >> >>>>>                 compatible = "usb-nop-xceiv";
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> Shouldn't also the peripheral dma-ranges property move to board
> >> >>>> specific
> >> >>>> too?
> >> >>>> I  had this patch for while but I didn't had the time to submit:
> >> >>>
> >> >>>
> >> >>>
> >> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
> >> >>> IIRC,
> >> >>> empty dma-ranges is not needed. Can you test on your side by
> removing
> >> >>> dma-ranges in usb node please ?
> >> >>
> >> >> Unfortunately will take a time for me to set up this environment on
> >> >> the STM32F4-EVAL board.
> >> >> And on the discovery boards we dont have this scenario. That was the
> >> >> main reason I did not submit the patch right away.
> >> >> My conclusion and I might be wrong but is based on the my tests with
> >> >> SDIO device at STM32F469I-DISCO board.
> >> >>
> >> >> I started this issue as discussion at ST Forum but Maxime gave me the
> >> >> hint.
> >> >>
> >> >>
> >> >>
> >> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44
> >> >>
> >> >>> I will push a v2 by removing empty dma-ranges if tests are ok in
> your
> >> >>> side.
> >> >>
> >> >>
> >> >> From my understating/conclusion is: when empty property(dma-ranges)
> is
> >> >> the device node, the mapping will be taken in consideration when
> using
> >> >> DMA otherwise the mapping is ignored.
> >> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> >> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
> >> >> I suppose it can work without the property.
> >> >
> >> >
> >> > For sure translation has to be done but I'm not sure that an empty
> >> > "dma-ranges" is needed in device node to activate it. For Ethernet
> empty
> >> > "dma-ranges" is not needed. I will try with usb.
> >>
> >> In the case of SDIO it is needed. As example this is my working SDIO
> node:
> >>
> >> sdio: sdio@40012c00 {
> >> compatible = "arm,pl18x", "arm,primecell";
> >> arm,primecell-periphid = <0x00480181>;
> >> reg = <0x40012c00 0x400>;
> >> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> >> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> >> dma-names = "rx", "tx";
> >> clocks = <&rcc 0 171>;
> >> clock-names = "apb_pclk";
> >> interrupts = <49>;
> >> status = "disabled";
> >> };
> >>
> >> &sdio {
> >> status = "okay";
> >> vmmc-supply = <&wlan_en>;
> >> bus-width = <4>;
> >> max-frequency = <24000000>;
> >> pinctrl-names = "default";
> >> pinctrl-0 = <&sdio_pins>;
> >> ti,non-removable;
> >> ti,needs-special-hs-handling;
> >> dma-ranges;
> >> cap-power-off-card;
> >> keep-power-in-suspend;
> >>
> >> #address-cells = <1>;
> >> #size-cells = <0>;
> >> wlcore: wlcore@0 {
> >> compatible = "ti,wl1835";
> >> reg = <2>;
> >> interrupt-parent = <&gpioa>;
> >> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
> >> };
> >> };
> >>
> >> >
> >> > alex
> >> >
> >> >
> >> >>
> >> >>>
> >> >>> Thanks in advance
> >> >>> Alex
> >> >>>
> >> >>>
> >> >>>>
> >> >>>> Author: Bruno Herrera <bruherrera@gmail.com>
> >> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
> >> >>>>
> >> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi
> >> >>>> file
> >> >>>>
> >> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>> index 6bfc595..2a22a82 100644
> >> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >> >>>> @@ -52,6 +52,10 @@
> >> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
> >> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
> >> >>>>
> >> >>>> +       soc {
> >> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> >> >>>> +       };
> >> >>>> +
> >> >>>>         chosen {
> >> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
> >> >>>>                 stdout-path = "serial0:115200n8";
> >> >>>> @@ -96,6 +100,7 @@
> >> >>>>
> >> >>>>  &ethernet0 {
> >> >>>>         status = "okay";
> >> >>>> +       dma-ranges;
> >> >>>>         pinctrl-0       = <&ethernet0_mii>;
> >> >>>>         pinctrl-names   = "default";
> >> >>>>         phy-mode        = "mii-id";
> >> >>>> @@ -116,6 +121,7 @@
> >> >>>>  };
> >> >>>>
> >> >>>>  &usbotg_hs {
> >> >>>> +       dma-ranges;
> >> >>>>         dr_mode = "host";
> >> >>>>         phys = <&usbotg_hs_phy>;
> >> >>>>         phy-names = "usb2-phy";
> >> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>> index 7d624a2..697a133 100644
> >> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>> @@ -59,7 +59,6 @@
> >> >>>>         };
> >> >>>>
> >> >>>>         soc {
> >> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >>>>
> >> >>>>                 timer2: timer@40000000 {
> >> >>>>                         compatible = "st,stm32-timer";
> >> >>>> @@ -472,13 +471,11 @@
> >> >>>>                         st,syscon = <&syscfg 0x4>;
> >> >>>>                         snps,pbl = <8>;
> >> >>>>                         snps,mixed-burst;
> >> >>>> -                       dma-ranges;
> >> >>>>                         status = "disabled";
> >> >>>>                 };
> >> >>>>
> >> >>>>                 usbotg_hs: usb@40040000 {
> >> >>>>                         compatible = "snps,dwc2";
> >> >>>> -                       dma-ranges;
> >> >>>>                         reg = <0x40040000 0x40000>;
> >> >>>>                         interrupts = <77>;
> >> >>>>                         clocks = <&rcc 0 29>;
> >> >>>>
> >> >>>>
> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>>> index 0596d60..3a1cfdd 100644
> >> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >> >>>>> @@ -59,8 +59,6 @@
> >> >>>>>         };
> >> >>>>>
> >> >>>>>         soc {
> >> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >>>>> -
> >> >>>>>                 timer2: timer@40000000 {
> >> >>>>>                         compatible = "st,stm32-timer";
> >> >>>>>                         reg = <0x40000000 0x400>;
> >> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>>>> index 9e73656..c2213c0 100644
> >> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> >> >>>>> @@ -64,6 +64,10 @@
> >> >>>>>         aliases {
> >> >>>>>                 serial0 = &usart3;
> >> >>>>>         };
> >> >>>>> +
> >> >>>>> +       soc {
> >> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >> >>>>> +       };
> >> >>>>>  };
> >> >>>>>
> >> >>>>>  &clk_hse {
> >> >>>>> --
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> Br.,
> >> >>>> Bruno
> >> >>>>
> >> >>>
> >> >
> >>
> >> _______________________________________________
> >> linux-arm-kernel mailing list
> >> linux-arm-kernel@lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 16590 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-28  7:09           ` Radosław Pietrzyk
@ 2016-10-31 10:27                 ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-31 10:27 UTC (permalink / raw)
  To: Radosław Pietrzyk
  Cc: Alexandre Torgue, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, >, >,
	Maxime Coquelin, Lee Jones,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Oct 28, 2016 at 5:09 AM, Radosław Pietrzyk
<radoslaw.pietrzyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Have you defined your sdio node within soc node ?

It is in the SOC node of the DSTI file.

>
> 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>>
>> Hi Alex,
>>
>> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> > Hi Bruno,
>> >
>> >
>> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >>
>> >> Hi Alex,
>> >>
>> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >> <alexandre.torgue-qxv4g6HH51o@public.gmane.org> wrote:
>> >>>
>> >>> Hi Bruno,
>> >>>
>> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >>>>
>> >>>>
>> >>>> Hi Alexandre,
>> >>>>
>> >>>>>
>> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>> >>>>> remapping
>> >>>>> (to @0) to boost performances. A DMA translation through
>> >>>>> "dma-ranges"
>> >>>>> property was needed for other masters than the M4 CPU.
>> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>> >>>>> translation.
>> >>>>> This patches moves this DMA translation definition from stm32f429
>> >>>>> soc
>> >>>>> file
>> >>>>> to board files.
>> >>>>>
>> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>
>> >>>>>
>> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> index 13c7cd2..a763c15 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> @@ -82,6 +82,10 @@
>> >>>>>                 };
>> >>>>>         };
>> >>>>>
>> >>>>> +       soc {
>> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> +       };
>> >>>>> +
>> >>>>>         usbotg_hs_phy: usbphy {
>> >>>>>                 #phy-cells = <0>;
>> >>>>>                 compatible = "usb-nop-xceiv";
>> >>>>
>> >>>>
>> >>>>
>> >>>> Shouldn't also the peripheral dma-ranges property move to board
>> >>>> specific
>> >>>> too?
>> >>>> I  had this patch for while but I didn't had the time to submit:
>> >>>
>> >>>
>> >>>
>> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
>> >>> IIRC,
>> >>> empty dma-ranges is not needed. Can you test on your side by removing
>> >>> dma-ranges in usb node please ?
>> >>
>> >> Unfortunately will take a time for me to set up this environment on
>> >> the STM32F4-EVAL board.
>> >> And on the discovery boards we dont have this scenario. That was the
>> >> main reason I did not submit the patch right away.
>> >> My conclusion and I might be wrong but is based on the my tests with
>> >> SDIO device at STM32F469I-DISCO board.
>> >>
>> >> I started this issue as discussion at ST Forum but Maxime gave me the
>> >> hint.
>> >>
>> >>
>> >>
>> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >>
>> >>> I will push a v2 by removing empty dma-ranges if tests are ok in your
>> >>> side.
>> >>
>> >>
>> >> From my understating/conclusion is: when empty property(dma-ranges) is
>> >> the device node, the mapping will be taken in consideration when using
>> >> DMA otherwise the mapping is ignored.
>> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
>> >> I suppose it can work without the property.
>> >
>> >
>> > For sure translation has to be done but I'm not sure that an empty
>> > "dma-ranges" is needed in device node to activate it. For Ethernet empty
>> > "dma-ranges" is not needed. I will try with usb.
>>
>> In the case of SDIO it is needed. As example this is my working SDIO node:
>>
>> sdio: sdio@40012c00 {
>> compatible = "arm,pl18x", "arm,primecell";
>> arm,primecell-periphid = <0x00480181>;
>> reg = <0x40012c00 0x400>;
>> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> dma-names = "rx", "tx";
>> clocks = <&rcc 0 171>;
>> clock-names = "apb_pclk";
>> interrupts = <49>;
>> status = "disabled";
>> };
>>
>> &sdio {
>> status = "okay";
>> vmmc-supply = <&wlan_en>;
>> bus-width = <4>;
>> max-frequency = <24000000>;
>> pinctrl-names = "default";
>> pinctrl-0 = <&sdio_pins>;
>> ti,non-removable;
>> ti,needs-special-hs-handling;
>> dma-ranges;
>> cap-power-off-card;
>> keep-power-in-suspend;
>>
>> #address-cells = <1>;
>> #size-cells = <0>;
>> wlcore: wlcore@0 {
>> compatible = "ti,wl1835";
>> reg = <2>;
>> interrupt-parent = <&gpioa>;
>> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> };
>> };
>>
>> >
>> > alex
>> >
>> >
>> >>
>> >>>
>> >>> Thanks in advance
>> >>> Alex
>> >>>
>> >>>
>> >>>>
>> >>>> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >>>>
>> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi
>> >>>> file
>> >>>>
>> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> index 6bfc595..2a22a82 100644
>> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> @@ -52,6 +52,10 @@
>> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>> >>>>
>> >>>> +       soc {
>> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> >>>> +       };
>> >>>> +
>> >>>>         chosen {
>> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>> >>>>                 stdout-path = "serial0:115200n8";
>> >>>> @@ -96,6 +100,7 @@
>> >>>>
>> >>>>  &ethernet0 {
>> >>>>         status = "okay";
>> >>>> +       dma-ranges;
>> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >>>>         pinctrl-names   = "default";
>> >>>>         phy-mode        = "mii-id";
>> >>>> @@ -116,6 +121,7 @@
>> >>>>  };
>> >>>>
>> >>>>  &usbotg_hs {
>> >>>> +       dma-ranges;
>> >>>>         dr_mode = "host";
>> >>>>         phys = <&usbotg_hs_phy>;
>> >>>>         phy-names = "usb2-phy";
>> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> index 7d624a2..697a133 100644
>> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> @@ -59,7 +59,6 @@
>> >>>>         };
>> >>>>
>> >>>>         soc {
>> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>
>> >>>>                 timer2: timer@40000000 {
>> >>>>                         compatible = "st,stm32-timer";
>> >>>> @@ -472,13 +471,11 @@
>> >>>>                         st,syscon = <&syscfg 0x4>;
>> >>>>                         snps,pbl = <8>;
>> >>>>                         snps,mixed-burst;
>> >>>> -                       dma-ranges;
>> >>>>                         status = "disabled";
>> >>>>                 };
>> >>>>
>> >>>>                 usbotg_hs: usb@40040000 {
>> >>>>                         compatible = "snps,dwc2";
>> >>>> -                       dma-ranges;
>> >>>>                         reg = <0x40040000 0x40000>;
>> >>>>                         interrupts = <77>;
>> >>>>                         clocks = <&rcc 0 29>;
>> >>>>
>> >>>>
>> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> index 0596d60..3a1cfdd 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> @@ -59,8 +59,6 @@
>> >>>>>         };
>> >>>>>
>> >>>>>         soc {
>> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> -
>> >>>>>                 timer2: timer@40000000 {
>> >>>>>                         compatible = "st,stm32-timer";
>> >>>>>                         reg = <0x40000000 0x400>;
>> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> index 9e73656..c2213c0 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> @@ -64,6 +64,10 @@
>> >>>>>         aliases {
>> >>>>>                 serial0 = &usart3;
>> >>>>>         };
>> >>>>> +
>> >>>>> +       soc {
>> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> +       };
>> >>>>>  };
>> >>>>>
>> >>>>>  &clk_hse {
>> >>>>> --
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> Br.,
>> >>>> Bruno
>> >>>>
>> >>>
>> >
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-31 10:27                 ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-31 10:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 28, 2016 at 5:09 AM, Rados?aw Pietrzyk
<radoslaw.pietrzyk@gmail.com> wrote:
> Have you defined your sdio node within soc node ?

It is in the SOC node of the DSTI file.

>
> 2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com>:
>>
>> Hi Alex,
>>
>> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
>> <alexandre.torgue@st.com> wrote:
>> > Hi Bruno,
>> >
>> >
>> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>> >>
>> >> Hi Alex,
>> >>
>> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> >> <alexandre.torgue@st.com> wrote:
>> >>>
>> >>> Hi Bruno,
>> >>>
>> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>> >>>>
>> >>>>
>> >>>> Hi Alexandre,
>> >>>>
>> >>>>>
>> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>> >>>>> remapping
>> >>>>> (to @0) to boost performances. A DMA translation through
>> >>>>> "dma-ranges"
>> >>>>> property was needed for other masters than the M4 CPU.
>> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>> >>>>> translation.
>> >>>>> This patches moves this DMA translation definition from stm32f429
>> >>>>> soc
>> >>>>> file
>> >>>>> to board files.
>> >>>>>
>> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>> >>>>>
>> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> index 13c7cd2..a763c15 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>>> @@ -82,6 +82,10 @@
>> >>>>>                 };
>> >>>>>         };
>> >>>>>
>> >>>>> +       soc {
>> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> +       };
>> >>>>> +
>> >>>>>         usbotg_hs_phy: usbphy {
>> >>>>>                 #phy-cells = <0>;
>> >>>>>                 compatible = "usb-nop-xceiv";
>> >>>>
>> >>>>
>> >>>>
>> >>>> Shouldn't also the peripheral dma-ranges property move to board
>> >>>> specific
>> >>>> too?
>> >>>> I  had this patch for while but I didn't had the time to submit:
>> >>>
>> >>>
>> >>>
>> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on
>> >>> IIRC,
>> >>> empty dma-ranges is not needed. Can you test on your side by removing
>> >>> dma-ranges in usb node please ?
>> >>
>> >> Unfortunately will take a time for me to set up this environment on
>> >> the STM32F4-EVAL board.
>> >> And on the discovery boards we dont have this scenario. That was the
>> >> main reason I did not submit the patch right away.
>> >> My conclusion and I might be wrong but is based on the my tests with
>> >> SDIO device at STM32F469I-DISCO board.
>> >>
>> >> I started this issue as discussion at ST Forum but Maxime gave me the
>> >> hint.
>> >>
>> >>
>> >>
>> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>> >>
>> >>> I will push a v2 by removing empty dma-ranges if tests are ok in your
>> >>> side.
>> >>
>> >>
>> >> From my understating/conclusion is: when empty property(dma-ranges) is
>> >> the device node, the mapping will be taken in consideration when using
>> >> DMA otherwise the mapping is ignored.
>> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
>> >> I suppose it can work without the property.
>> >
>> >
>> > For sure translation has to be done but I'm not sure that an empty
>> > "dma-ranges" is needed in device node to activate it. For Ethernet empty
>> > "dma-ranges" is not needed. I will try with usb.
>>
>> In the case of SDIO it is needed. As example this is my working SDIO node:
>>
>> sdio: sdio at 40012c00 {
>> compatible = "arm,pl18x", "arm,primecell";
>> arm,primecell-periphid = <0x00480181>;
>> reg = <0x40012c00 0x400>;
>> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
>> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
>> dma-names = "rx", "tx";
>> clocks = <&rcc 0 171>;
>> clock-names = "apb_pclk";
>> interrupts = <49>;
>> status = "disabled";
>> };
>>
>> &sdio {
>> status = "okay";
>> vmmc-supply = <&wlan_en>;
>> bus-width = <4>;
>> max-frequency = <24000000>;
>> pinctrl-names = "default";
>> pinctrl-0 = <&sdio_pins>;
>> ti,non-removable;
>> ti,needs-special-hs-handling;
>> dma-ranges;
>> cap-power-off-card;
>> keep-power-in-suspend;
>>
>> #address-cells = <1>;
>> #size-cells = <0>;
>> wlcore: wlcore at 0 {
>> compatible = "ti,wl1835";
>> reg = <2>;
>> interrupt-parent = <&gpioa>;
>> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
>> };
>> };
>>
>> >
>> > alex
>> >
>> >
>> >>
>> >>>
>> >>> Thanks in advance
>> >>> Alex
>> >>>
>> >>>
>> >>>>
>> >>>> Author: Bruno Herrera <bruherrera@gmail.com>
>> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>> >>>>
>> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi
>> >>>> file
>> >>>>
>> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> index 6bfc595..2a22a82 100644
>> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> >>>> @@ -52,6 +52,10 @@
>> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
>> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>> >>>>
>> >>>> +       soc {
>> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> >>>> +       };
>> >>>> +
>> >>>>         chosen {
>> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>> >>>>                 stdout-path = "serial0:115200n8";
>> >>>> @@ -96,6 +100,7 @@
>> >>>>
>> >>>>  &ethernet0 {
>> >>>>         status = "okay";
>> >>>> +       dma-ranges;
>> >>>>         pinctrl-0       = <&ethernet0_mii>;
>> >>>>         pinctrl-names   = "default";
>> >>>>         phy-mode        = "mii-id";
>> >>>> @@ -116,6 +121,7 @@
>> >>>>  };
>> >>>>
>> >>>>  &usbotg_hs {
>> >>>> +       dma-ranges;
>> >>>>         dr_mode = "host";
>> >>>>         phys = <&usbotg_hs_phy>;
>> >>>>         phy-names = "usb2-phy";
>> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> index 7d624a2..697a133 100644
>> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>> @@ -59,7 +59,6 @@
>> >>>>         };
>> >>>>
>> >>>>         soc {
>> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>
>> >>>>                 timer2: timer at 40000000 {
>> >>>>                         compatible = "st,stm32-timer";
>> >>>> @@ -472,13 +471,11 @@
>> >>>>                         st,syscon = <&syscfg 0x4>;
>> >>>>                         snps,pbl = <8>;
>> >>>>                         snps,mixed-burst;
>> >>>> -                       dma-ranges;
>> >>>>                         status = "disabled";
>> >>>>                 };
>> >>>>
>> >>>>                 usbotg_hs: usb at 40040000 {
>> >>>>                         compatible = "snps,dwc2";
>> >>>> -                       dma-ranges;
>> >>>>                         reg = <0x40040000 0x40000>;
>> >>>>                         interrupts = <77>;
>> >>>>                         clocks = <&rcc 0 29>;
>> >>>>
>> >>>>
>> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> index 0596d60..3a1cfdd 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> >>>>> @@ -59,8 +59,6 @@
>> >>>>>         };
>> >>>>>
>> >>>>>         soc {
>> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> -
>> >>>>>                 timer2: timer at 40000000 {
>> >>>>>                         compatible = "st,stm32-timer";
>> >>>>>                         reg = <0x40000000 0x400>;
>> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> index 9e73656..c2213c0 100644
>> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> >>>>> @@ -64,6 +64,10 @@
>> >>>>>         aliases {
>> >>>>>                 serial0 = &usart3;
>> >>>>>         };
>> >>>>> +
>> >>>>> +       soc {
>> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> >>>>> +       };
>> >>>>>  };
>> >>>>>
>> >>>>>  &clk_hse {
>> >>>>> --
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> Br.,
>> >>>> Bruno
>> >>>>
>> >>>
>> >
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-27 12:57           ` Bruno Herrera
  (?)
@ 2016-10-28  7:09           ` Radosław Pietrzyk
       [not found]             ` <CAFvLkMQGVygLb9SQ8o+2Q=bg7vvRjpHypmSyjRyLkdcHypoFHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  -1 siblings, 1 reply; 32+ messages in thread
From: Radosław Pietrzyk @ 2016-10-28  7:09 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Alexandre Torgue, mark.rutland, devicetree, Arnd Bergmann, linux,
	>, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 8308 bytes --]

Have you defined your sdio node within soc node ?

2016-10-27 14:57 GMT+02:00 Bruno Herrera <bruherrera@gmail.com>:

> Hi Alex,
>
> On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
> > Hi Bruno,
> >
> >
> > On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> >>
> >> Hi Alex,
> >>
> >> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> >> <alexandre.torgue@st.com> wrote:
> >>>
> >>> Hi Bruno,
> >>>
> >>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> >>>>
> >>>>
> >>>> Hi Alexandre,
> >>>>
> >>>>>
> >>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
> >>>>> remapping
> >>>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
> >>>>> property was needed for other masters than the M4 CPU.
> >>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
> >>>>> translation.
> >>>>> This patches moves this DMA translation definition from stm32f429 soc
> >>>>> file
> >>>>> to board files.
> >>>>>
> >>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
> >>>>>
> >>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >>>>> index 13c7cd2..a763c15 100644
> >>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >>>>> @@ -82,6 +82,10 @@
> >>>>>                 };
> >>>>>         };
> >>>>>
> >>>>> +       soc {
> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >>>>> +       };
> >>>>> +
> >>>>>         usbotg_hs_phy: usbphy {
> >>>>>                 #phy-cells = <0>;
> >>>>>                 compatible = "usb-nop-xceiv";
> >>>>
> >>>>
> >>>>
> >>>> Shouldn't also the peripheral dma-ranges property move to board
> specific
> >>>> too?
> >>>> I  had this patch for while but I didn't had the time to submit:
> >>>
> >>>
> >>>
> >>> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
> >>> empty dma-ranges is not needed. Can you test on your side by removing
> >>> dma-ranges in usb node please ?
> >>
> >> Unfortunately will take a time for me to set up this environment on
> >> the STM32F4-EVAL board.
> >> And on the discovery boards we dont have this scenario. That was the
> >> main reason I did not submit the patch right away.
> >> My conclusion and I might be wrong but is based on the my tests with
> >> SDIO device at STM32F469I-DISCO board.
> >>
> >> I started this issue as discussion at ST Forum but Maxime gave me the
> >> hint.
> >>
> >>
> >> https://my.st.com/public/STe2ecommunities/mcu/Lists/
> cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%
> 2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%
> 2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=
> 0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46
> A77F0FFD06506F5B&currentviews=44
> >>
> >>> I will push a v2 by removing empty dma-ranges if tests are ok in your
> >>> side.
> >>
> >>
> >> From my understating/conclusion is: when empty property(dma-ranges) is
> >> the device node, the mapping will be taken in consideration when using
> >> DMA otherwise the mapping is ignored.
> >> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> >> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
> >> I suppose it can work without the property.
> >
> >
> > For sure translation has to be done but I'm not sure that an empty
> > "dma-ranges" is needed in device node to activate it. For Ethernet empty
> > "dma-ranges" is not needed. I will try with usb.
>
> In the case of SDIO it is needed. As example this is my working SDIO node:
>
> sdio: sdio@40012c00 {
> compatible = "arm,pl18x", "arm,primecell";
> arm,primecell-periphid = <0x00480181>;
> reg = <0x40012c00 0x400>;
> dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
> <&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
> dma-names = "rx", "tx";
> clocks = <&rcc 0 171>;
> clock-names = "apb_pclk";
> interrupts = <49>;
> status = "disabled";
> };
>
> &sdio {
> status = "okay";
> vmmc-supply = <&wlan_en>;
> bus-width = <4>;
> max-frequency = <24000000>;
> pinctrl-names = "default";
> pinctrl-0 = <&sdio_pins>;
> ti,non-removable;
> ti,needs-special-hs-handling;
> dma-ranges;
> cap-power-off-card;
> keep-power-in-suspend;
>
> #address-cells = <1>;
> #size-cells = <0>;
> wlcore: wlcore@0 {
> compatible = "ti,wl1835";
> reg = <2>;
> interrupt-parent = <&gpioa>;
> interrupts = <8 IRQ_TYPE_EDGE_RISING>;
> };
> };
>
> >
> > alex
> >
> >
> >>
> >>>
> >>> Thanks in advance
> >>> Alex
> >>>
> >>>
> >>>>
> >>>> Author: Bruno Herrera <bruherrera@gmail.com>
> >>>> Date:   Sun Oct 16 14:50:00 2016 -0200
> >>>>
> >>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
> >>>>
> >>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> >>>> b/arch/arm/boot/dts/stm32429i-eval.dts
> >>>> index 6bfc595..2a22a82 100644
> >>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> >>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> >>>> @@ -52,6 +52,10 @@
> >>>>         model = "STMicroelectronics STM32429i-EVAL board";
> >>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
> >>>>
> >>>> +       soc {
> >>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> >>>> +       };
> >>>> +
> >>>>         chosen {
> >>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
> >>>>                 stdout-path = "serial0:115200n8";
> >>>> @@ -96,6 +100,7 @@
> >>>>
> >>>>  &ethernet0 {
> >>>>         status = "okay";
> >>>> +       dma-ranges;
> >>>>         pinctrl-0       = <&ethernet0_mii>;
> >>>>         pinctrl-names   = "default";
> >>>>         phy-mode        = "mii-id";
> >>>> @@ -116,6 +121,7 @@
> >>>>  };
> >>>>
> >>>>  &usbotg_hs {
> >>>> +       dma-ranges;
> >>>>         dr_mode = "host";
> >>>>         phys = <&usbotg_hs_phy>;
> >>>>         phy-names = "usb2-phy";
> >>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >>>> index 7d624a2..697a133 100644
> >>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >>>> @@ -59,7 +59,6 @@
> >>>>         };
> >>>>
> >>>>         soc {
> >>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >>>>
> >>>>                 timer2: timer@40000000 {
> >>>>                         compatible = "st,stm32-timer";
> >>>> @@ -472,13 +471,11 @@
> >>>>                         st,syscon = <&syscfg 0x4>;
> >>>>                         snps,pbl = <8>;
> >>>>                         snps,mixed-burst;
> >>>> -                       dma-ranges;
> >>>>                         status = "disabled";
> >>>>                 };
> >>>>
> >>>>                 usbotg_hs: usb@40040000 {
> >>>>                         compatible = "snps,dwc2";
> >>>> -                       dma-ranges;
> >>>>                         reg = <0x40040000 0x40000>;
> >>>>                         interrupts = <77>;
> >>>>                         clocks = <&rcc 0 29>;
> >>>>
> >>>>
> >>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
> >>>>> b/arch/arm/boot/dts/stm32f429.dtsi
> >>>>> index 0596d60..3a1cfdd 100644
> >>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
> >>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> >>>>> @@ -59,8 +59,6 @@
> >>>>>         };
> >>>>>
> >>>>>         soc {
> >>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >>>>> -
> >>>>>                 timer2: timer@40000000 {
> >>>>>                         compatible = "st,stm32-timer";
> >>>>>                         reg = <0x40000000 0x400>;
> >>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
> >>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
> >>>>> index 9e73656..c2213c0 100644
> >>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> >>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> >>>>> @@ -64,6 +64,10 @@
> >>>>>         aliases {
> >>>>>                 serial0 = &usart3;
> >>>>>         };
> >>>>> +
> >>>>> +       soc {
> >>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> >>>>> +       };
> >>>>>  };
> >>>>>
> >>>>>  &clk_hse {
> >>>>> --
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Br.,
> >>>> Bruno
> >>>>
> >>>
> >
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

[-- Attachment #2: Type: text/html, Size: 13616 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-27 12:21         ` Alexandre Torgue
@ 2016-10-27 12:57           ` Bruno Herrera
  -1 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-27 12:57 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: mark.rutland, devicetree, Arnd Bergmann, linux, >, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

Hi Alex,

On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Bruno,
>
>
> On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>
>> Hi Alex,
>>
>> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> <alexandre.torgue@st.com> wrote:
>>>
>>> Hi Bruno,
>>>
>>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>
>>>>
>>>> Hi Alexandre,
>>>>
>>>>>
>>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>>>> remapping
>>>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>>>> property was needed for other masters than the M4 CPU.
>>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>>>> translation.
>>>>> This patches moves this DMA translation definition from stm32f429 soc
>>>>> file
>>>>> to board files.
>>>>>
>>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> index 13c7cd2..a763c15 100644
>>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> @@ -82,6 +82,10 @@
>>>>>                 };
>>>>>         };
>>>>>
>>>>> +       soc {
>>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> +       };
>>>>> +
>>>>>         usbotg_hs_phy: usbphy {
>>>>>                 #phy-cells = <0>;
>>>>>                 compatible = "usb-nop-xceiv";
>>>>
>>>>
>>>>
>>>> Shouldn't also the peripheral dma-ranges property move to board specific
>>>> too?
>>>> I  had this patch for while but I didn't had the time to submit:
>>>
>>>
>>>
>>> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
>>> empty dma-ranges is not needed. Can you test on your side by removing
>>> dma-ranges in usb node please ?
>>
>> Unfortunately will take a time for me to set up this environment on
>> the STM32F4-EVAL board.
>> And on the discovery boards we dont have this scenario. That was the
>> main reason I did not submit the patch right away.
>> My conclusion and I might be wrong but is based on the my tests with
>> SDIO device at STM32F469I-DISCO board.
>>
>> I started this issue as discussion at ST Forum but Maxime gave me the
>> hint.
>>
>>
>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>
>>> I will push a v2 by removing empty dma-ranges if tests are ok in your
>>> side.
>>
>>
>> From my understating/conclusion is: when empty property(dma-ranges) is
>> the device node, the mapping will be taken in consideration when using
>> DMA otherwise the mapping is ignored.
>> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
>> I suppose it can work without the property.
>
>
> For sure translation has to be done but I'm not sure that an empty
> "dma-ranges" is needed in device node to activate it. For Ethernet empty
> "dma-ranges" is not needed. I will try with usb.

In the case of SDIO it is needed. As example this is my working SDIO node:

sdio: sdio@40012c00 {
compatible = "arm,pl18x", "arm,primecell";
arm,primecell-periphid = <0x00480181>;
reg = <0x40012c00 0x400>;
dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
<&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
dma-names = "rx", "tx";
clocks = <&rcc 0 171>;
clock-names = "apb_pclk";
interrupts = <49>;
status = "disabled";
};

&sdio {
status = "okay";
vmmc-supply = <&wlan_en>;
bus-width = <4>;
max-frequency = <24000000>;
pinctrl-names = "default";
pinctrl-0 = <&sdio_pins>;
ti,non-removable;
ti,needs-special-hs-handling;
dma-ranges;
cap-power-off-card;
keep-power-in-suspend;

#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore@0 {
compatible = "ti,wl1835";
reg = <2>;
interrupt-parent = <&gpioa>;
interrupts = <8 IRQ_TYPE_EDGE_RISING>;
};
};

>
> alex
>
>
>>
>>>
>>> Thanks in advance
>>> Alex
>>>
>>>
>>>>
>>>> Author: Bruno Herrera <bruherrera@gmail.com>
>>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>
>>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>>>
>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> index 6bfc595..2a22a82 100644
>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> @@ -52,6 +52,10 @@
>>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>>
>>>> +       soc {
>>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>> +       };
>>>> +
>>>>         chosen {
>>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>>                 stdout-path = "serial0:115200n8";
>>>> @@ -96,6 +100,7 @@
>>>>
>>>>  &ethernet0 {
>>>>         status = "okay";
>>>> +       dma-ranges;
>>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>         pinctrl-names   = "default";
>>>>         phy-mode        = "mii-id";
>>>> @@ -116,6 +121,7 @@
>>>>  };
>>>>
>>>>  &usbotg_hs {
>>>> +       dma-ranges;
>>>>         dr_mode = "host";
>>>>         phys = <&usbotg_hs_phy>;
>>>>         phy-names = "usb2-phy";
>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>> index 7d624a2..697a133 100644
>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>> @@ -59,7 +59,6 @@
>>>>         };
>>>>
>>>>         soc {
>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>
>>>>                 timer2: timer@40000000 {
>>>>                         compatible = "st,stm32-timer";
>>>> @@ -472,13 +471,11 @@
>>>>                         st,syscon = <&syscfg 0x4>;
>>>>                         snps,pbl = <8>;
>>>>                         snps,mixed-burst;
>>>> -                       dma-ranges;
>>>>                         status = "disabled";
>>>>                 };
>>>>
>>>>                 usbotg_hs: usb@40040000 {
>>>>                         compatible = "snps,dwc2";
>>>> -                       dma-ranges;
>>>>                         reg = <0x40040000 0x40000>;
>>>>                         interrupts = <77>;
>>>>                         clocks = <&rcc 0 29>;
>>>>
>>>>
>>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>> index 0596d60..3a1cfdd 100644
>>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>> @@ -59,8 +59,6 @@
>>>>>         };
>>>>>
>>>>>         soc {
>>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> -
>>>>>                 timer2: timer@40000000 {
>>>>>                         compatible = "st,stm32-timer";
>>>>>                         reg = <0x40000000 0x400>;
>>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> index 9e73656..c2213c0 100644
>>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> @@ -64,6 +64,10 @@
>>>>>         aliases {
>>>>>                 serial0 = &usart3;
>>>>>         };
>>>>> +
>>>>> +       soc {
>>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> +       };
>>>>>  };
>>>>>
>>>>>  &clk_hse {
>>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> Br.,
>>>> Bruno
>>>>
>>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-27 12:57           ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-27 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alex,

On Thu, Oct 27, 2016 at 10:21 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Bruno,
>
>
> On 10/27/2016 12:43 PM, Bruno Herrera wrote:
>>
>> Hi Alex,
>>
>> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
>> <alexandre.torgue@st.com> wrote:
>>>
>>> Hi Bruno,
>>>
>>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>>
>>>>
>>>> Hi Alexandre,
>>>>
>>>>>
>>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>>>> remapping
>>>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>>>> property was needed for other masters than the M4 CPU.
>>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>>>> translation.
>>>>> This patches moves this DMA translation definition from stm32f429 soc
>>>>> file
>>>>> to board files.
>>>>>
>>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> index 13c7cd2..a763c15 100644
>>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>>> @@ -82,6 +82,10 @@
>>>>>                 };
>>>>>         };
>>>>>
>>>>> +       soc {
>>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> +       };
>>>>> +
>>>>>         usbotg_hs_phy: usbphy {
>>>>>                 #phy-cells = <0>;
>>>>>                 compatible = "usb-nop-xceiv";
>>>>
>>>>
>>>>
>>>> Shouldn't also the peripheral dma-ranges property move to board specific
>>>> too?
>>>> I  had this patch for while but I didn't had the time to submit:
>>>
>>>
>>>
>>> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
>>> empty dma-ranges is not needed. Can you test on your side by removing
>>> dma-ranges in usb node please ?
>>
>> Unfortunately will take a time for me to set up this environment on
>> the STM32F4-EVAL board.
>> And on the discovery boards we dont have this scenario. That was the
>> main reason I did not submit the patch right away.
>> My conclusion and I might be wrong but is based on the my tests with
>> SDIO device at STM32F469I-DISCO board.
>>
>> I started this issue as discussion at ST Forum but Maxime gave me the
>> hint.
>>
>>
>> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>>
>>> I will push a v2 by removing empty dma-ranges if tests are ok in your
>>> side.
>>
>>
>> From my understating/conclusion is: when empty property(dma-ranges) is
>> the device node, the mapping will be taken in consideration when using
>> DMA otherwise the mapping is ignored.
>> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
>> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
>> I suppose it can work without the property.
>
>
> For sure translation has to be done but I'm not sure that an empty
> "dma-ranges" is needed in device node to activate it. For Ethernet empty
> "dma-ranges" is not needed. I will try with usb.

In the case of SDIO it is needed. As example this is my working SDIO node:

sdio: sdio at 40012c00 {
compatible = "arm,pl18x", "arm,primecell";
arm,primecell-periphid = <0x00480181>;
reg = <0x40012c00 0x400>;
dmas =  <&dma2 6 4 0x10400 0x3>, /* Logical - DevToMem */
<&dma2 3 4 0x10400 0x3>; /* Logical - MemToDev */
dma-names = "rx", "tx";
clocks = <&rcc 0 171>;
clock-names = "apb_pclk";
interrupts = <49>;
status = "disabled";
};

&sdio {
status = "okay";
vmmc-supply = <&wlan_en>;
bus-width = <4>;
max-frequency = <24000000>;
pinctrl-names = "default";
pinctrl-0 = <&sdio_pins>;
ti,non-removable;
ti,needs-special-hs-handling;
dma-ranges;
cap-power-off-card;
keep-power-in-suspend;

#address-cells = <1>;
#size-cells = <0>;
wlcore: wlcore at 0 {
compatible = "ti,wl1835";
reg = <2>;
interrupt-parent = <&gpioa>;
interrupts = <8 IRQ_TYPE_EDGE_RISING>;
};
};

>
> alex
>
>
>>
>>>
>>> Thanks in advance
>>> Alex
>>>
>>>
>>>>
>>>> Author: Bruno Herrera <bruherrera@gmail.com>
>>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>>
>>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>>>
>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> index 6bfc595..2a22a82 100644
>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> @@ -52,6 +52,10 @@
>>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>>
>>>> +       soc {
>>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>>> +       };
>>>> +
>>>>         chosen {
>>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>>                 stdout-path = "serial0:115200n8";
>>>> @@ -96,6 +100,7 @@
>>>>
>>>>  &ethernet0 {
>>>>         status = "okay";
>>>> +       dma-ranges;
>>>>         pinctrl-0       = <&ethernet0_mii>;
>>>>         pinctrl-names   = "default";
>>>>         phy-mode        = "mii-id";
>>>> @@ -116,6 +121,7 @@
>>>>  };
>>>>
>>>>  &usbotg_hs {
>>>> +       dma-ranges;
>>>>         dr_mode = "host";
>>>>         phys = <&usbotg_hs_phy>;
>>>>         phy-names = "usb2-phy";
>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>> index 7d624a2..697a133 100644
>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>> @@ -59,7 +59,6 @@
>>>>         };
>>>>
>>>>         soc {
>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>
>>>>                 timer2: timer at 40000000 {
>>>>                         compatible = "st,stm32-timer";
>>>> @@ -472,13 +471,11 @@
>>>>                         st,syscon = <&syscfg 0x4>;
>>>>                         snps,pbl = <8>;
>>>>                         snps,mixed-burst;
>>>> -                       dma-ranges;
>>>>                         status = "disabled";
>>>>                 };
>>>>
>>>>                 usbotg_hs: usb at 40040000 {
>>>>                         compatible = "snps,dwc2";
>>>> -                       dma-ranges;
>>>>                         reg = <0x40040000 0x40000>;
>>>>                         interrupts = <77>;
>>>>                         clocks = <&rcc 0 29>;
>>>>
>>>>
>>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>>> index 0596d60..3a1cfdd 100644
>>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>>> @@ -59,8 +59,6 @@
>>>>>         };
>>>>>
>>>>>         soc {
>>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> -
>>>>>                 timer2: timer at 40000000 {
>>>>>                         compatible = "st,stm32-timer";
>>>>>                         reg = <0x40000000 0x400>;
>>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> index 9e73656..c2213c0 100644
>>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>>> @@ -64,6 +64,10 @@
>>>>>         aliases {
>>>>>                 serial0 = &usart3;
>>>>>         };
>>>>> +
>>>>> +       soc {
>>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>>> +       };
>>>>>  };
>>>>>
>>>>>  &clk_hse {
>>>>> --
>>>>
>>>>
>>>>
>>>>
>>>> Br.,
>>>> Bruno
>>>>
>>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-27 10:43       ` Bruno Herrera
@ 2016-10-27 12:21         ` Alexandre Torgue
  -1 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-10-27 12:21 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: mark.rutland, devicetree, Arnd Bergmann, linux, >, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

Hi Bruno,

On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> Hi Alex,
>
> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi Bruno,
>>
>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>
>>> Hi Alexandre,
>>>
>>>>
>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>>> remapping
>>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>>> property was needed for other masters than the M4 CPU.
>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>>> translation.
>>>> This patches moves this DMA translation definition from stm32f429 soc
>>>> file
>>>> to board files.
>>>>
>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>>
>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> index 13c7cd2..a763c15 100644
>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> @@ -82,6 +82,10 @@
>>>>                 };
>>>>         };
>>>>
>>>> +       soc {
>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> +       };
>>>> +
>>>>         usbotg_hs_phy: usbphy {
>>>>                 #phy-cells = <0>;
>>>>                 compatible = "usb-nop-xceiv";
>>>
>>>
>>> Shouldn't also the peripheral dma-ranges property move to board specific
>>> too?
>>> I  had this patch for while but I didn't had the time to submit:
>>
>>
>> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
>> empty dma-ranges is not needed. Can you test on your side by removing
>> dma-ranges in usb node please ?
> Unfortunately will take a time for me to set up this environment on
> the STM32F4-EVAL board.
> And on the discovery boards we dont have this scenario. That was the
> main reason I did not submit the patch right away.
> My conclusion and I might be wrong but is based on the my tests with
> SDIO device at STM32F469I-DISCO board.
>
> I started this issue as discussion at ST Forum but Maxime gave me the hint.
>
> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>
>> I will push a v2 by removing empty dma-ranges if tests are ok in your side.
>
> From my understating/conclusion is: when empty property(dma-ranges) is
> the device node, the mapping will be taken in consideration when using
> DMA otherwise the mapping is ignored.
> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
> I suppose it can work without the property.

For sure translation has to be done but I'm not sure that an empty 
"dma-ranges" is needed in device node to activate it. For Ethernet empty 
"dma-ranges" is not needed. I will try with usb.

alex

>
>>
>> Thanks in advance
>> Alex
>>
>>
>>>
>>> Author: Bruno Herrera <bruherrera@gmail.com>
>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>
>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>>
>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>> index 6bfc595..2a22a82 100644
>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>> @@ -52,6 +52,10 @@
>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>
>>> +       soc {
>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>> +       };
>>> +
>>>         chosen {
>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>                 stdout-path = "serial0:115200n8";
>>> @@ -96,6 +100,7 @@
>>>
>>>  &ethernet0 {
>>>         status = "okay";
>>> +       dma-ranges;
>>>         pinctrl-0       = <&ethernet0_mii>;
>>>         pinctrl-names   = "default";
>>>         phy-mode        = "mii-id";
>>> @@ -116,6 +121,7 @@
>>>  };
>>>
>>>  &usbotg_hs {
>>> +       dma-ranges;
>>>         dr_mode = "host";
>>>         phys = <&usbotg_hs_phy>;
>>>         phy-names = "usb2-phy";
>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>> index 7d624a2..697a133 100644
>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>> @@ -59,7 +59,6 @@
>>>         };
>>>
>>>         soc {
>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>
>>>                 timer2: timer@40000000 {
>>>                         compatible = "st,stm32-timer";
>>> @@ -472,13 +471,11 @@
>>>                         st,syscon = <&syscfg 0x4>;
>>>                         snps,pbl = <8>;
>>>                         snps,mixed-burst;
>>> -                       dma-ranges;
>>>                         status = "disabled";
>>>                 };
>>>
>>>                 usbotg_hs: usb@40040000 {
>>>                         compatible = "snps,dwc2";
>>> -                       dma-ranges;
>>>                         reg = <0x40040000 0x40000>;
>>>                         interrupts = <77>;
>>>                         clocks = <&rcc 0 29>;
>>>
>>>
>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>> index 0596d60..3a1cfdd 100644
>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>> @@ -59,8 +59,6 @@
>>>>         };
>>>>
>>>>         soc {
>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> -
>>>>                 timer2: timer@40000000 {
>>>>                         compatible = "st,stm32-timer";
>>>>                         reg = <0x40000000 0x400>;
>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>> index 9e73656..c2213c0 100644
>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>> @@ -64,6 +64,10 @@
>>>>         aliases {
>>>>                 serial0 = &usart3;
>>>>         };
>>>> +
>>>> +       soc {
>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> +       };
>>>>  };
>>>>
>>>>  &clk_hse {
>>>> --
>>>
>>>
>>>
>>> Br.,
>>> Bruno
>>>
>>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-27 12:21         ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-10-27 12:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bruno,

On 10/27/2016 12:43 PM, Bruno Herrera wrote:
> Hi Alex,
>
> On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
> <alexandre.torgue@st.com> wrote:
>> Hi Bruno,
>>
>> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>>
>>> Hi Alexandre,
>>>
>>>>
>>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>>> remapping
>>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>>> property was needed for other masters than the M4 CPU.
>>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>>> translation.
>>>> This patches moves this DMA translation definition from stm32f429 soc
>>>> file
>>>> to board files.
>>>>
>>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>>
>>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> index 13c7cd2..a763c15 100644
>>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>>> @@ -82,6 +82,10 @@
>>>>                 };
>>>>         };
>>>>
>>>> +       soc {
>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> +       };
>>>> +
>>>>         usbotg_hs_phy: usbphy {
>>>>                 #phy-cells = <0>;
>>>>                 compatible = "usb-nop-xceiv";
>>>
>>>
>>> Shouldn't also the peripheral dma-ranges property move to board specific
>>> too?
>>> I  had this patch for while but I didn't had the time to submit:
>>
>>
>> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
>> empty dma-ranges is not needed. Can you test on your side by removing
>> dma-ranges in usb node please ?
> Unfortunately will take a time for me to set up this environment on
> the STM32F4-EVAL board.
> And on the discovery boards we dont have this scenario. That was the
> main reason I did not submit the patch right away.
> My conclusion and I might be wrong but is based on the my tests with
> SDIO device at STM32F469I-DISCO board.
>
> I started this issue as discussion at ST Forum but Maxime gave me the hint.
>
> https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44
>
>> I will push a v2 by removing empty dma-ranges if tests are ok in your side.
>
> From my understating/conclusion is: when empty property(dma-ranges) is
> the device node, the mapping will be taken in consideration when using
> DMA otherwise the mapping is ignored.
> And in the SDIO case it is needed for DEV->MEM(SDRAM) and
> MEM(SDRAM)->DEV. If it is not the case for the devices in question so
> I suppose it can work without the property.

For sure translation has to be done but I'm not sure that an empty 
"dma-ranges" is needed in device node to activate it. For Ethernet empty 
"dma-ranges" is not needed. I will try with usb.

alex

>
>>
>> Thanks in advance
>> Alex
>>
>>
>>>
>>> Author: Bruno Herrera <bruherrera@gmail.com>
>>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>>
>>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>>
>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>> index 6bfc595..2a22a82 100644
>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>> @@ -52,6 +52,10 @@
>>>         model = "STMicroelectronics STM32429i-EVAL board";
>>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>>
>>> +       soc {
>>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>>> +       };
>>> +
>>>         chosen {
>>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>>                 stdout-path = "serial0:115200n8";
>>> @@ -96,6 +100,7 @@
>>>
>>>  &ethernet0 {
>>>         status = "okay";
>>> +       dma-ranges;
>>>         pinctrl-0       = <&ethernet0_mii>;
>>>         pinctrl-names   = "default";
>>>         phy-mode        = "mii-id";
>>> @@ -116,6 +121,7 @@
>>>  };
>>>
>>>  &usbotg_hs {
>>> +       dma-ranges;
>>>         dr_mode = "host";
>>>         phys = <&usbotg_hs_phy>;
>>>         phy-names = "usb2-phy";
>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>> index 7d624a2..697a133 100644
>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>> @@ -59,7 +59,6 @@
>>>         };
>>>
>>>         soc {
>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>
>>>                 timer2: timer at 40000000 {
>>>                         compatible = "st,stm32-timer";
>>> @@ -472,13 +471,11 @@
>>>                         st,syscon = <&syscfg 0x4>;
>>>                         snps,pbl = <8>;
>>>                         snps,mixed-burst;
>>> -                       dma-ranges;
>>>                         status = "disabled";
>>>                 };
>>>
>>>                 usbotg_hs: usb at 40040000 {
>>>                         compatible = "snps,dwc2";
>>> -                       dma-ranges;
>>>                         reg = <0x40040000 0x40000>;
>>>                         interrupts = <77>;
>>>                         clocks = <&rcc 0 29>;
>>>
>>>
>>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>>> index 0596d60..3a1cfdd 100644
>>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>>> @@ -59,8 +59,6 @@
>>>>         };
>>>>
>>>>         soc {
>>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> -
>>>>                 timer2: timer at 40000000 {
>>>>                         compatible = "st,stm32-timer";
>>>>                         reg = <0x40000000 0x400>;
>>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>>> index 9e73656..c2213c0 100644
>>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>>> @@ -64,6 +64,10 @@
>>>>         aliases {
>>>>                 serial0 = &usart3;
>>>>         };
>>>> +
>>>> +       soc {
>>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>>> +       };
>>>>  };
>>>>
>>>>  &clk_hse {
>>>> --
>>>
>>>
>>>
>>> Br.,
>>> Bruno
>>>
>>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-26  9:09     ` Alexandre Torgue
@ 2016-10-27 10:43       ` Bruno Herrera
  -1 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-27 10:43 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: mark.rutland, devicetree, Arnd Bergmann, linux, >, >,
	Maxime Coquelin, Lee Jones, linux-arm-kernel

Hi Alex,

On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Bruno,
>
> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>
>> Hi Alexandre,
>>
>>>
>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>> remapping
>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>> property was needed for other masters than the M4 CPU.
>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>> translation.
>>> This patches moves this DMA translation definition from stm32f429 soc
>>> file
>>> to board files.
>>>
>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>
>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>> index 13c7cd2..a763c15 100644
>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>> @@ -82,6 +82,10 @@
>>>                 };
>>>         };
>>>
>>> +       soc {
>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> +       };
>>> +
>>>         usbotg_hs_phy: usbphy {
>>>                 #phy-cells = <0>;
>>>                 compatible = "usb-nop-xceiv";
>>
>>
>> Shouldn't also the peripheral dma-ranges property move to board specific
>> too?
>> I  had this patch for while but I didn't had the time to submit:
>
>
> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
> empty dma-ranges is not needed. Can you test on your side by removing
> dma-ranges in usb node please ?
Unfortunately will take a time for me to set up this environment on
the STM32F4-EVAL board.
And on the discovery boards we dont have this scenario. That was the
main reason I did not submit the patch right away.
My conclusion and I might be wrong but is based on the my tests with
SDIO device at STM32F469I-DISCO board.

I started this issue as discussion at ST Forum but Maxime gave me the hint.

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44

> I will push a v2 by removing empty dma-ranges if tests are ok in your side.

>From my understating/conclusion is: when empty property(dma-ranges) is
the device node, the mapping will be taken in consideration when using
DMA otherwise the mapping is ignored.
And in the SDIO case it is needed for DEV->MEM(SDRAM) and
MEM(SDRAM)->DEV. If it is not the case for the devices in question so
I suppose it can work without the property.

>
> Thanks in advance
> Alex
>
>
>>
>> Author: Bruno Herrera <bruherrera@gmail.com>
>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>
>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>
>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> index 6bfc595..2a22a82 100644
>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> @@ -52,6 +52,10 @@
>>         model = "STMicroelectronics STM32429i-EVAL board";
>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>
>> +       soc {
>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> +       };
>> +
>>         chosen {
>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>                 stdout-path = "serial0:115200n8";
>> @@ -96,6 +100,7 @@
>>
>>  &ethernet0 {
>>         status = "okay";
>> +       dma-ranges;
>>         pinctrl-0       = <&ethernet0_mii>;
>>         pinctrl-names   = "default";
>>         phy-mode        = "mii-id";
>> @@ -116,6 +121,7 @@
>>  };
>>
>>  &usbotg_hs {
>> +       dma-ranges;
>>         dr_mode = "host";
>>         phys = <&usbotg_hs_phy>;
>>         phy-names = "usb2-phy";
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> b/arch/arm/boot/dts/stm32f429.dtsi
>> index 7d624a2..697a133 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -59,7 +59,6 @@
>>         };
>>
>>         soc {
>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>
>>                 timer2: timer@40000000 {
>>                         compatible = "st,stm32-timer";
>> @@ -472,13 +471,11 @@
>>                         st,syscon = <&syscfg 0x4>;
>>                         snps,pbl = <8>;
>>                         snps,mixed-burst;
>> -                       dma-ranges;
>>                         status = "disabled";
>>                 };
>>
>>                 usbotg_hs: usb@40040000 {
>>                         compatible = "snps,dwc2";
>> -                       dma-ranges;
>>                         reg = <0x40040000 0x40000>;
>>                         interrupts = <77>;
>>                         clocks = <&rcc 0 29>;
>>
>>
>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>> index 0596d60..3a1cfdd 100644
>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>> @@ -59,8 +59,6 @@
>>>         };
>>>
>>>         soc {
>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> -
>>>                 timer2: timer@40000000 {
>>>                         compatible = "st,stm32-timer";
>>>                         reg = <0x40000000 0x400>;
>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>> index 9e73656..c2213c0 100644
>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>> @@ -64,6 +64,10 @@
>>>         aliases {
>>>                 serial0 = &usart3;
>>>         };
>>> +
>>> +       soc {
>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> +       };
>>>  };
>>>
>>>  &clk_hse {
>>> --
>>
>>
>>
>> Br.,
>> Bruno
>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-27 10:43       ` Bruno Herrera
  0 siblings, 0 replies; 32+ messages in thread
From: Bruno Herrera @ 2016-10-27 10:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alex,

On Wed, Oct 26, 2016 at 7:09 AM, Alexandre Torgue
<alexandre.torgue@st.com> wrote:
> Hi Bruno,
>
> On 10/25/2016 11:06 PM, Bruno Herrera wrote:
>>
>> Hi Alexandre,
>>
>>>
>>> stm32f469-disco and stm32f429-eval boards use SDRAM start address
>>> remapping
>>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>>> property was needed for other masters than the M4 CPU.
>>> stm32f429-disco doesn't use remapping so doesn't need this DMA
>>> translation.
>>> This patches moves this DMA translation definition from stm32f429 soc
>>> file
>>> to board files.
>>>
>>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>>
>>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>>> b/arch/arm/boot/dts/stm32429i-eval.dts
>>> index 13c7cd2..a763c15 100644
>>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>>> @@ -82,6 +82,10 @@
>>>                 };
>>>         };
>>>
>>> +       soc {
>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> +       };
>>> +
>>>         usbotg_hs_phy: usbphy {
>>>                 #phy-cells = <0>;
>>>                 compatible = "usb-nop-xceiv";
>>
>>
>> Shouldn't also the peripheral dma-ranges property move to board specific
>> too?
>> I  had this patch for while but I didn't had the time to submit:
>
>
> Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC,
> empty dma-ranges is not needed. Can you test on your side by removing
> dma-ranges in usb node please ?
Unfortunately will take a time for me to set up this environment on
the STM32F4-EVAL board.
And on the discovery boards we dont have this scenario. That was the
main reason I did not submit the patch right away.
My conclusion and I might be wrong but is based on the my tests with
SDIO device at STM32F469I-DISCO board.

I started this issue as discussion at ST Forum but Maxime gave me the hint.

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA2%20and%20SYSCFG_MEMRMP%20relationship&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=44

> I will push a v2 by removing empty dma-ranges if tests are ok in your side.

>From my understating/conclusion is: when empty property(dma-ranges) is
the device node, the mapping will be taken in consideration when using
DMA otherwise the mapping is ignored.
And in the SDIO case it is needed for DEV->MEM(SDRAM) and
MEM(SDRAM)->DEV. If it is not the case for the devices in question so
I suppose it can work without the property.

>
> Thanks in advance
> Alex
>
>
>>
>> Author: Bruno Herrera <bruherrera@gmail.com>
>> Date:   Sun Oct 16 14:50:00 2016 -0200
>>
>>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>>
>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
>> b/arch/arm/boot/dts/stm32429i-eval.dts
>> index 6bfc595..2a22a82 100644
>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> @@ -52,6 +52,10 @@
>>         model = "STMicroelectronics STM32429i-EVAL board";
>>         compatible = "st,stm32429i-eval", "st,stm32f429";
>>
>> +       soc {
>> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
>> +       };
>> +
>>         chosen {
>>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>>                 stdout-path = "serial0:115200n8";
>> @@ -96,6 +100,7 @@
>>
>>  &ethernet0 {
>>         status = "okay";
>> +       dma-ranges;
>>         pinctrl-0       = <&ethernet0_mii>;
>>         pinctrl-names   = "default";
>>         phy-mode        = "mii-id";
>> @@ -116,6 +121,7 @@
>>  };
>>
>>  &usbotg_hs {
>> +       dma-ranges;
>>         dr_mode = "host";
>>         phys = <&usbotg_hs_phy>;
>>         phy-names = "usb2-phy";
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>> b/arch/arm/boot/dts/stm32f429.dtsi
>> index 7d624a2..697a133 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -59,7 +59,6 @@
>>         };
>>
>>         soc {
>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>
>>                 timer2: timer at 40000000 {
>>                         compatible = "st,stm32-timer";
>> @@ -472,13 +471,11 @@
>>                         st,syscon = <&syscfg 0x4>;
>>                         snps,pbl = <8>;
>>                         snps,mixed-burst;
>> -                       dma-ranges;
>>                         status = "disabled";
>>                 };
>>
>>                 usbotg_hs: usb at 40040000 {
>>                         compatible = "snps,dwc2";
>> -                       dma-ranges;
>>                         reg = <0x40040000 0x40000>;
>>                         interrupts = <77>;
>>                         clocks = <&rcc 0 29>;
>>
>>
>>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi
>>> b/arch/arm/boot/dts/stm32f429.dtsi
>>> index 0596d60..3a1cfdd 100644
>>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>>> @@ -59,8 +59,6 @@
>>>         };
>>>
>>>         soc {
>>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> -
>>>                 timer2: timer at 40000000 {
>>>                         compatible = "st,stm32-timer";
>>>                         reg = <0x40000000 0x400>;
>>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts
>>> b/arch/arm/boot/dts/stm32f469-disco.dts
>>> index 9e73656..c2213c0 100644
>>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>>> @@ -64,6 +64,10 @@
>>>         aliases {
>>>                 serial0 = &usart3;
>>>         };
>>> +
>>> +       soc {
>>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>>> +       };
>>>  };
>>>
>>>  &clk_hse {
>>> --
>>
>>
>>
>> Br.,
>> Bruno
>>
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
  2016-10-25 21:06 Bruno Herrera
@ 2016-10-26  9:09     ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-10-26  9:09 UTC (permalink / raw)
  To: Bruno Herrera
  Cc: Maxime Coquelin, arnd-r2nGTMty4D4, >,
	mark.rutland-5wv7dgnIgG8, linux-I+IVW8TIWO2tmTQ+vhA3Yw, >,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Bruno,

On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> Hi Alexandre,
>
>>
>> stm32f469-disco and stm32f429-eval boards use SDRAM start address remapping
>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>> property was needed for other masters than the M4 CPU.
>> stm32f429-disco doesn't use remapping so doesn't need this DMA translation.
>> This patches moves this DMA translation definition from stm32f429 soc file
>> to board files.
>>
>> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>
>>
>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
>> index 13c7cd2..a763c15 100644
>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> @@ -82,6 +82,10 @@
>>                 };
>>         };
>>
>> +       soc {
>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> +       };
>> +
>>         usbotg_hs_phy: usbphy {
>>                 #phy-cells = <0>;
>>                 compatible = "usb-nop-xceiv";
>
> Shouldn't also the peripheral dma-ranges property move to board specific too?
> I  had this patch for while but I didn't had the time to submit:

Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC, 
empty dma-ranges is not needed. Can you test on your side by removing 
dma-ranges in usb node please ?
I will push a v2 by removing empty dma-ranges if tests are ok in your side.

Thanks in advance
Alex

>
> Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date:   Sun Oct 16 14:50:00 2016 -0200
>
>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>
> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> b/arch/arm/boot/dts/stm32429i-eval.dts
> index 6bfc595..2a22a82 100644
> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> @@ -52,6 +52,10 @@
>         model = "STMicroelectronics STM32429i-EVAL board";
>         compatible = "st,stm32429i-eval", "st,stm32f429";
>
> +       soc {
> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> +       };
> +
>         chosen {
>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>                 stdout-path = "serial0:115200n8";
> @@ -96,6 +100,7 @@
>
>  &ethernet0 {
>         status = "okay";
> +       dma-ranges;
>         pinctrl-0       = <&ethernet0_mii>;
>         pinctrl-names   = "default";
>         phy-mode        = "mii-id";
> @@ -116,6 +121,7 @@
>  };
>
>  &usbotg_hs {
> +       dma-ranges;
>         dr_mode = "host";
>         phys = <&usbotg_hs_phy>;
>         phy-names = "usb2-phy";
> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index 7d624a2..697a133 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -59,7 +59,6 @@
>         };
>
>         soc {
> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>
>                 timer2: timer@40000000 {
>                         compatible = "st,stm32-timer";
> @@ -472,13 +471,11 @@
>                         st,syscon = <&syscfg 0x4>;
>                         snps,pbl = <8>;
>                         snps,mixed-burst;
> -                       dma-ranges;
>                         status = "disabled";
>                 };
>
>                 usbotg_hs: usb@40040000 {
>                         compatible = "snps,dwc2";
> -                       dma-ranges;
>                         reg = <0x40040000 0x40000>;
>                         interrupts = <77>;
>                         clocks = <&rcc 0 29>;
>
>
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
>> index 0596d60..3a1cfdd 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -59,8 +59,6 @@
>>         };
>>
>>         soc {
>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> -
>>                 timer2: timer@40000000 {
>>                         compatible = "st,stm32-timer";
>>                         reg = <0x40000000 0x400>;
>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
>> index 9e73656..c2213c0 100644
>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> @@ -64,6 +64,10 @@
>>         aliases {
>>                 serial0 = &usart3;
>>         };
>> +
>> +       soc {
>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> +       };
>>  };
>>
>>  &clk_hse {
>> --
>
>
> Br.,
> Bruno
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-26  9:09     ` Alexandre Torgue
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Torgue @ 2016-10-26  9:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bruno,

On 10/25/2016 11:06 PM, Bruno Herrera wrote:
> Hi Alexandre,
>
>>
>> stm32f469-disco and stm32f429-eval boards use SDRAM start address remapping
>> (to @0) to boost performances. A DMA translation through "dma-ranges"
>> property was needed for other masters than the M4 CPU.
>> stm32f429-disco doesn't use remapping so doesn't need this DMA translation.
>> This patches moves this DMA translation definition from stm32f429 soc file
>> to board files.
>>
>> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com>
>>
>> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
>> index 13c7cd2..a763c15 100644
>> --- a/arch/arm/boot/dts/stm32429i-eval.dts
>> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
>> @@ -82,6 +82,10 @@
>>                 };
>>         };
>>
>> +       soc {
>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> +       };
>> +
>>         usbotg_hs_phy: usbphy {
>>                 #phy-cells = <0>;
>>                 compatible = "usb-nop-xceiv";
>
> Shouldn't also the peripheral dma-ranges property move to board specific too?
> I  had this patch for while but I didn't had the time to submit:

Well spot I forgot it. Actually, discussing with Arnd ysterday on IIRC, 
empty dma-ranges is not needed. Can you test on your side by removing 
dma-ranges in usb node please ?
I will push a v2 by removing empty dma-ranges if tests are ok in your side.

Thanks in advance
Alex

>
> Author: Bruno Herrera <bruherrera@gmail.com>
> Date:   Sun Oct 16 14:50:00 2016 -0200
>
>     ARM: DT: STM32: Use dma-ranges property per board not at dtsi file
>
> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
> b/arch/arm/boot/dts/stm32429i-eval.dts
> index 6bfc595..2a22a82 100644
> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> @@ -52,6 +52,10 @@
>         model = "STMicroelectronics STM32429i-EVAL board";
>         compatible = "st,stm32429i-eval", "st,stm32f429";
>
> +       soc {
> +               dma-ranges = <0xC0000000 0x0 0x10000000>;
> +       };
> +
>         chosen {
>                 bootargs = "root=/dev/ram rdinit=/linuxrc";
>                 stdout-path = "serial0:115200n8";
> @@ -96,6 +100,7 @@
>
>  &ethernet0 {
>         status = "okay";
> +       dma-ranges;
>         pinctrl-0       = <&ethernet0_mii>;
>         pinctrl-names   = "default";
>         phy-mode        = "mii-id";
> @@ -116,6 +121,7 @@
>  };
>
>  &usbotg_hs {
> +       dma-ranges;
>         dr_mode = "host";
>         phys = <&usbotg_hs_phy>;
>         phy-names = "usb2-phy";
> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index 7d624a2..697a133 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -59,7 +59,6 @@
>         };
>
>         soc {
> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>
>                 timer2: timer at 40000000 {
>                         compatible = "st,stm32-timer";
> @@ -472,13 +471,11 @@
>                         st,syscon = <&syscfg 0x4>;
>                         snps,pbl = <8>;
>                         snps,mixed-burst;
> -                       dma-ranges;
>                         status = "disabled";
>                 };
>
>                 usbotg_hs: usb at 40040000 {
>                         compatible = "snps,dwc2";
> -                       dma-ranges;
>                         reg = <0x40040000 0x40000>;
>                         interrupts = <77>;
>                         clocks = <&rcc 0 29>;
>
>
>> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
>> index 0596d60..3a1cfdd 100644
>> --- a/arch/arm/boot/dts/stm32f429.dtsi
>> +++ b/arch/arm/boot/dts/stm32f429.dtsi
>> @@ -59,8 +59,6 @@
>>         };
>>
>>         soc {
>> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> -
>>                 timer2: timer at 40000000 {
>>                         compatible = "st,stm32-timer";
>>                         reg = <0x40000000 0x400>;
>> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
>> index 9e73656..c2213c0 100644
>> --- a/arch/arm/boot/dts/stm32f469-disco.dts
>> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
>> @@ -64,6 +64,10 @@
>>         aliases {
>>                 serial0 = &usart3;
>>         };
>> +
>> +       soc {
>> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
>> +       };
>>  };
>>
>>  &clk_hse {
>> --
>
>
> Br.,
> Bruno
>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH] ARM: DT: stm32: move dma translation to board files
@ 2016-10-25 21:06 Bruno Herrera
       [not found] ` <CAF3+Tqd2MGmz+8XhLXhaZiEc78QOwHSpVrQA65-p1AcfT+_xgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 32+ messages in thread
From: Bruno Herrera @ 2016-10-25 21:06 UTC (permalink / raw)
  To: alexandre.torgue-qxv4g6HH51o
  Cc: Maxime Coquelin, arnd-r2nGTMty4D4, >,
	mark.rutland-5wv7dgnIgG8, linux-I+IVW8TIWO2tmTQ+vhA3Yw, >,
	lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Alexandre,

>
> stm32f469-disco and stm32f429-eval boards use SDRAM start address remapping
> (to @0) to boost performances. A DMA translation through "dma-ranges"
> property was needed for other masters than the M4 CPU.
> stm32f429-disco doesn't use remapping so doesn't need this DMA translation.
> This patches moves this DMA translation definition from stm32f429 soc file
> to board files.
>
> Signed-off-by: Alexandre TORGUE <alexandre.torgue-qxv4g6HH51o@public.gmane.org>
>
> diff --git a/arch/arm/boot/dts/stm32429i-eval.dts b/arch/arm/boot/dts/stm32429i-eval.dts
> index 13c7cd2..a763c15 100644
> --- a/arch/arm/boot/dts/stm32429i-eval.dts
> +++ b/arch/arm/boot/dts/stm32429i-eval.dts
> @@ -82,6 +82,10 @@
>                 };
>         };
>
> +       soc {
> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> +       };
> +
>         usbotg_hs_phy: usbphy {
>                 #phy-cells = <0>;
>                 compatible = "usb-nop-xceiv";

Shouldn't also the peripheral dma-ranges property move to board specific too?
I  had this patch for while but I didn't had the time to submit:

Author: Bruno Herrera <bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date:   Sun Oct 16 14:50:00 2016 -0200

    ARM: DT: STM32: Use dma-ranges property per board not at dtsi file

diff --git a/arch/arm/boot/dts/stm32429i-eval.dts
b/arch/arm/boot/dts/stm32429i-eval.dts
index 6bfc595..2a22a82 100644
--- a/arch/arm/boot/dts/stm32429i-eval.dts
+++ b/arch/arm/boot/dts/stm32429i-eval.dts
@@ -52,6 +52,10 @@
        model = "STMicroelectronics STM32429i-EVAL board";
        compatible = "st,stm32429i-eval", "st,stm32f429";

+       soc {
+               dma-ranges = <0xC0000000 0x0 0x10000000>;
+       };
+
        chosen {
                bootargs = "root=/dev/ram rdinit=/linuxrc";
                stdout-path = "serial0:115200n8";
@@ -96,6 +100,7 @@

 &ethernet0 {
        status = "okay";
+       dma-ranges;
        pinctrl-0       = <&ethernet0_mii>;
        pinctrl-names   = "default";
        phy-mode        = "mii-id";
@@ -116,6 +121,7 @@
 };

 &usbotg_hs {
+       dma-ranges;
        dr_mode = "host";
        phys = <&usbotg_hs_phy>;
        phy-names = "usb2-phy";
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 7d624a2..697a133 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -59,7 +59,6 @@
        };

        soc {
-               dma-ranges = <0xc0000000 0x0 0x10000000>;

                timer2: timer@40000000 {
                        compatible = "st,stm32-timer";
@@ -472,13 +471,11 @@
                        st,syscon = <&syscfg 0x4>;
                        snps,pbl = <8>;
                        snps,mixed-burst;
-                       dma-ranges;
                        status = "disabled";
                };

                usbotg_hs: usb@40040000 {
                        compatible = "snps,dwc2";
-                       dma-ranges;
                        reg = <0x40040000 0x40000>;
                        interrupts = <77>;
                        clocks = <&rcc 0 29>;


> diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
> index 0596d60..3a1cfdd 100644
> --- a/arch/arm/boot/dts/stm32f429.dtsi
> +++ b/arch/arm/boot/dts/stm32f429.dtsi
> @@ -59,8 +59,6 @@
>         };
>
>         soc {
> -               dma-ranges = <0xc0000000 0x0 0x10000000>;
> -
>                 timer2: timer@40000000 {
>                         compatible = "st,stm32-timer";
>                         reg = <0x40000000 0x400>;
> diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts
> index 9e73656..c2213c0 100644
> --- a/arch/arm/boot/dts/stm32f469-disco.dts
> +++ b/arch/arm/boot/dts/stm32f469-disco.dts
> @@ -64,6 +64,10 @@
>         aliases {
>                 serial0 = &usart3;
>         };
> +
> +       soc {
> +               dma-ranges = <0xc0000000 0x0 0x10000000>;
> +       };
>  };
>
>  &clk_hse {
> --


Br.,
Bruno
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2016-11-03  8:40 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 16:16 [PATCH] ARM: DT: stm32: move dma translation to board files Alexandre TORGUE
2016-10-25 16:16 ` Alexandre TORGUE
2016-10-25 21:06 Bruno Herrera
     [not found] ` <CAF3+Tqd2MGmz+8XhLXhaZiEc78QOwHSpVrQA65-p1AcfT+_xgg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-26  9:09   ` Alexandre Torgue
2016-10-26  9:09     ` Alexandre Torgue
2016-10-27 10:43     ` Bruno Herrera
2016-10-27 10:43       ` Bruno Herrera
2016-10-27 12:21       ` Alexandre Torgue
2016-10-27 12:21         ` Alexandre Torgue
2016-10-27 12:57         ` Bruno Herrera
2016-10-27 12:57           ` Bruno Herrera
2016-10-28  7:09           ` Radosław Pietrzyk
     [not found]             ` <CAFvLkMQGVygLb9SQ8o+2Q=bg7vvRjpHypmSyjRyLkdcHypoFHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-31 10:27               ` Bruno Herrera
2016-10-31 10:27                 ` Bruno Herrera
2016-10-31 14:14                 ` Radosław Pietrzyk
     [not found]                   ` <CAFvLkMQ6YMg4sf2Ug8x4-YshwnjbLz3aVzm+JpKP6zG9r-WU4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-31 16:41                     ` Bruno Herrera
2016-10-31 16:41                       ` Bruno Herrera
2016-10-31 18:58                       ` Radosław Pietrzyk
     [not found]                         ` <CAFvLkMTCkRcwbRc8GVNBoJFAvKWHYDjOPabueQPjTseZrucadA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-02 14:32                           ` Alexandre Torgue
2016-11-02 14:32                             ` Alexandre Torgue
     [not found]                             ` <3e854414-f51d-3e59-6cee-142106cef40f-qxv4g6HH51o@public.gmane.org>
2016-11-02 16:07                               ` Bruno Herrera
2016-11-02 16:07                                 ` Bruno Herrera
     [not found]                                 ` <CAF3+TqeiPjtG7Fs1-cpbcHGxxtSS1UOGD=S=sggpaZahFLJhEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-02 16:14                                   ` Alexandre Torgue
2016-11-02 16:14                                     ` Alexandre Torgue
     [not found]                                     ` <edf05ad5-924d-87d8-fd8d-57e8e0a72052-qxv4g6HH51o@public.gmane.org>
2016-11-02 18:24                                       ` Bruno Herrera
2016-11-02 18:24                                         ` Bruno Herrera
2016-11-02 18:05                                 ` Radosław Pietrzyk
     [not found]                                   ` <CAFvLkMSViXggGr0Set0qnQan_+bXUNzJx5WtZHP-Jyje=ZzDVw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-02 18:23                                     ` Bruno Herrera
2016-11-02 18:23                                       ` Bruno Herrera
2016-11-03  7:43                                       ` Radosław Pietrzyk
2016-11-03  8:40                                       ` Alexandre Torgue
2016-11-03  8:40                                         ` Alexandre Torgue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.