mbox series

[v7,00/12] ARM/MIPS: DTS: add child nodes describing the PVRSGX GPU present in some OMAP SoC and JZ4780 (and many more)

Message ID cover.1587760454.git.hns@goldelico.com
Headers show
Series ARM/MIPS: DTS: add child nodes describing the PVRSGX GPU present in some OMAP SoC and JZ4780 (and many more) | expand

Message

H. Nikolaus Schaller April 24, 2020, 8:34 p.m. UTC
* changed commit message for the dt-bindings to better describe latest situation
* added properties for up to 4 clocks, reset, power-domains, sgx-supply - proposed by Maxime Ripard <maxime@cerno.tech>
* fixed jz4780 and s5pv210 to use "core" clock name
* simplified example
* update for arm: dts: s5pv210 - by Jonathan Bakker <xc-racer2@live.ca>
* removed a stray " from binding which had creeped in through copy&paste 
* fixed commit / tested-by messages and some not well formed commit messages - suggested by Krzysztof Kozlowski <krzk@kernel.org>
* added a $nodename: pattern: to enforce "gpu" nodenames - inspired by Neil Armstrong <narmstrong@baylibre.com>
* fixed node name for s5pv210 - suggested by Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

PATCH V6 2020-04-15 10:35:31:
* rebased to v5.7-rc1
* added DTS for for a31, a31s, a83t - by Philipp Rossak <embed3d@gmail.com>
* added DTS for "samsung,s5pv210-sgx540-120" - by Jonathan Bakker <xc-racer2@live.ca>
* bindings.yaml fixes:
  - added a31, a31
  - fixes for omap4470
  - jz4780 contains an sgx540-130 and not -120
  - a83t contains an sgx544-115 and not -116
  - removed "additionalProperties: false" because some SoC may need additional properties

PATCH V5 2020-03-29 19:38:32:
* reworked YAML bindings to pass dt_binding_check and be better grouped
* rename all nodes to "gpu: gpu@<address>"
* removed "img,sgx5" from example - suggested by Rob Herring <robh+dt@kernel.org>

PATCH V4 2019-12-17 19:02:11:
* MIPS: DTS: jz4780: removed "img,sgx5" from bindings
* YAML bindings: updated according to suggestions by Rob Herring
* MIPS: DTS: jz4780: insert-sorted gpu node by register address - suggested by Paul Cercueil

PATCH V3 2019-11-24 12:40:33:
* reworked YAML format with help by Rob Herring
* removed .txt binding document
* change compatible "ti,am335x-sgx" to "ti,am3352-sgx" - suggested by Tony Lindgren

PATCH V2 2019-11-07 12:06:17:
* tried to convert bindings to YAML format - suggested by Rob Herring
* added JZ4780 DTS node (proven to load the driver)
* removed timer and img,cores properties until we know we really need them - suggested by Rob Herring

PATCH V1 2019-10-18 20:46:35:

This patch series defines child nodes for the SGX5xx interface inside
different SoC so that a driver can be found and probed by the compatible
strings and can retrieve information about the SGX revision that is
included in a specific SoC. It also defines the interrupt number
to be used by the SGX driver, and optionally clocks, power, resets
depending on how the SoC integration is done.

There is currently no mainline driver for these GPUs, but a project [1]
is ongoing with the goal to get the open-source part as provided by TI/IMG
and others into drivers/gpu/drm/pvrsgx in the future. So this patch series
is the basis.

The kernel modules built from this project have successfully demonstrated
to work with the DTS definitions from this patch set on AM335x BeagleBone
Black, DM3730 and OMAP5 Pyra and Droid 4. They partially work on OMAP3530 and
PandaBoard ES but that is likely a problem in the kernel driver or the
(non-free) user-space libraries and binaries. The driver works on jz4780
but user-space could not yet be tested.

[1]: https://github.com/openpvrsgx-devgroup


H. Nikolaus Schaller (8):
  dt-bindings: add img,pvrsgx.yaml for Imagination GPUs
  ARM: DTS: am33xx: add sgx gpu child node
  ARM: DTS: am3517: add sgx gpu child node
  ARM: DTS: omap34xx: add sgx gpu child node
  ARM: DTS: omap36xx: add sgx gpu child node
  ARM: DTS: omap4: add sgx gpu child node
  ARM: DTS: omap5: add sgx gpu child node
  MIPS: DTS: jz4780: add sgx gpu node

Jonathan Bakker (1):
  arm: dts: s5pv210: Add node for SGX 540

Philipp Rossak (3):
  ARM: dts: sun6i: a31: add sgx gpu child node
  ARM: dts: sun6i: a31s: add sgx gpu child node
  ARM: dts: sun8i: a83t: add sgx gpu child node

 .../devicetree/bindings/gpu/img,pvrsgx.yaml   | 150 ++++++++++++++++++
 arch/arm/boot/dts/am33xx.dtsi                 |  11 +-
 arch/arm/boot/dts/am3517.dtsi                 |   9 +-
 arch/arm/boot/dts/omap34xx.dtsi               |  11 +-
 arch/arm/boot/dts/omap36xx.dtsi               |   9 +-
 arch/arm/boot/dts/omap4.dtsi                  |  11 +-
 arch/arm/boot/dts/omap4470.dts                |  15 ++
 arch/arm/boot/dts/omap5.dtsi                  |  11 +-
 arch/arm/boot/dts/s5pv210.dtsi                |  13 ++
 arch/arm/boot/dts/sun6i-a31.dtsi              |  11 ++
 arch/arm/boot/dts/sun6i-a31s.dtsi             |  10 ++
 arch/arm/boot/dts/sun8i-a83t.dtsi             |  11 ++
 arch/mips/boot/dts/ingenic/jz4780.dtsi        |  11 ++
 13 files changed, 255 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpu/img,pvrsgx.yaml
 create mode 100644 arch/arm/boot/dts/omap4470.dts

Comments

Paul Cercueil April 26, 2020, 12:50 p.m. UTC | #1
Hi Nikolaus,

Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> Add SGX GPU node with interrupt. Tested on PandaBoard ES.
> 
> Since omap4420/30/60 and omap4470 come with different SGX variants
> we need to introduce a new omap4470.dtsi. If an omap4470 board
> does not want to use SGX it is no problem to still include
> omap4460.dtsi.
> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  arch/arm/boot/dts/omap4.dtsi   | 11 ++++++-----
>  arch/arm/boot/dts/omap4470.dts | 15 +++++++++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
>  create mode 100644 arch/arm/boot/dts/omap4470.dts
> 
> diff --git a/arch/arm/boot/dts/omap4.dtsi 
> b/arch/arm/boot/dts/omap4.dtsi
> index 763bdea8c829..15ff3d7146af 100644
> --- a/arch/arm/boot/dts/omap4.dtsi
> +++ b/arch/arm/boot/dts/omap4.dtsi
> @@ -389,7 +389,7 @@ abb_iva: regulator-abb-iva {
>  			status = "disabled";
>  		};
> 
> -		target-module@56000000 {
> +		sgx_module: target-module@56000000 {
>  			compatible = "ti,sysc-omap4", "ti,sysc";
>  			reg = <0x5600fe00 0x4>,
>  			      <0x5600fe10 0x4>;
> @@ -408,10 +408,11 @@ target-module@56000000 {
>  			#size-cells = <1>;
>  			ranges = <0 0x56000000 0x2000000>;
> 
> -			/*
> -			 * Closed source PowerVR driver, no child device
> -			 * binding or driver in mainline
> -			 */
> +			gpu: gpu@0 {
> +				compatible = "ti,omap4-sgx540-120", "img,sgx540-120", 
> "img,sgx540";
> +				reg = <0x0 0x2000000>;	/* 32MB */
> +				interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
> +			};
>  		};
> 
>  		/*
> diff --git a/arch/arm/boot/dts/omap4470.dts 
> b/arch/arm/boot/dts/omap4470.dts
> new file mode 100644
> index 000000000000..f29c581300bf
> --- /dev/null
> +++ b/arch/arm/boot/dts/omap4470.dts
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Device Tree Source for OMAP4470 SoC
> + *
> + * Copyright (C) 2012 Texas Instruments Incorporated - 
> http://www.ti.com/
> + *
> + * This file is licensed under the terms of the GNU General Public 
> License
> + * version 2.  This program is licensed "as is" without any warranty 
> of any
> + * kind, whether express or implied.
> + */
> +#include "omap4460.dtsi"
> +
> +&sgx {

Does this even compile?

The node's handle is named sgx_module, not sgx.

-Paul

> +	compatible = "ti,omap4470-sgx544-112", "img,sgx544-112", 
> "img,sgx544";
> +};
> --
> 2.25.1
>
Paul Cercueil April 26, 2020, 12:53 p.m. UTC | #2
Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> From: Philipp Rossak <embed3d@gmail.com>
> 
> We are adding the devicetree binding for the PVR-SGX-544-115 gpu.
> 
> This driver is currently under development in the openpvrsgx-devgroup.
> Right now the full binding is not figured out, so we provide here a
> placeholder. It will be completed as soon as there is a demo 
> available.
> 
> The currently used binding that is used during development is more
> complete and was already verifyed by loading the kernelmodule 
> successful.
> 
> Signed-off-by: Philipp Rossak <embed3d@gmail.com>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  arch/arm/boot/dts/sun6i-a31.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi 
> b/arch/arm/boot/dts/sun6i-a31.dtsi
> index f3425a66fc0a..933a825bf460 100644
> --- a/arch/arm/boot/dts/sun6i-a31.dtsi
> +++ b/arch/arm/boot/dts/sun6i-a31.dtsi
> @@ -1417,5 +1417,16 @@ p2wi: i2c@1f03400 {
>  			#address-cells = <1>;
>  			#size-cells = <0>;
>  		};
> +
> +		gpu: gpu@1c400000 {
> +			compatible = "allwinner,sun8i-a31-sgx544-115",
> +				     "img,sgx544-115", "img,sgx544";
> +			reg = <0x01c40000 0x10000>;
> +			/*
> +			 * This node is currently a placeholder for the gpu.
> +			 * This will be completed when a full demonstration
> +			 * of the openpvrsgx driver is available for this board.
> +			 */

This node doesn't have clocks, so I don't see how it'd work.

Better delay the introduction of the GPU node for this board until you 
know it works.

-Paul

> +		};
>  	};
>  };
> --
> 2.25.1
>
Paul Cercueil April 26, 2020, 12:56 p.m. UTC | #3
Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> From: Jonathan Bakker <xc-racer2@live.ca>
> 
> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
> 
> There is no external regulator for it so it can be enabled by default.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/s5pv210.dtsi 
> b/arch/arm/boot/dts/s5pv210.dtsi
> index 2ad642f51fd9..abbdda205c1b 100644
> --- a/arch/arm/boot/dts/s5pv210.dtsi
> +++ b/arch/arm/boot/dts/s5pv210.dtsi
> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
>  			#interrupt-cells = <1>;
>  		};
> 
> +		gpu: gpu@f3000000 {
> +			compatible = "samsung,s5pv210-sgx540-120";
> +			reg = <0xf3000000 0x10000>;
> +			interrupt-parent = <&vic2>;
> +			interrupts = <10>;
> +			clock-names = "core";
> +			clocks = <&clocks CLK_G3D>;
> +
> +			assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
> +			assigned-clock-rates = <0>, <66700000>;
> +			assigned-clock-parents = <&clocks MOUT_MPLL>;

What are these clocks for, and why are they reparented / reclocked?

Shouldn't they be passed to 'clocks' as well?

-Paul

> +		};
> +
>  		fimd: fimd@f8000000 {
>  			compatible = "samsung,s5pv210-fimd";
>  			interrupt-parent = <&vic2>;
> --
> 2.25.1
>
Jonathan Bakker April 26, 2020, 2:57 p.m. UTC | #4
Hi Paul,

On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
> 
> 
> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> From: Jonathan Bakker <xc-racer2@live.ca>
>>
>> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
>>
>> There is no external regulator for it so it can be enabled by default.
>>
>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
>> index 2ad642f51fd9..abbdda205c1b 100644
>> --- a/arch/arm/boot/dts/s5pv210.dtsi
>> +++ b/arch/arm/boot/dts/s5pv210.dtsi
>> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
>>              #interrupt-cells = <1>;
>>          };
>>
>> +        gpu: gpu@f3000000 {
>> +            compatible = "samsung,s5pv210-sgx540-120";
>> +            reg = <0xf3000000 0x10000>;
>> +            interrupt-parent = <&vic2>;
>> +            interrupts = <10>;
>> +            clock-names = "core";
>> +            clocks = <&clocks CLK_G3D>;
>> +
>> +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
>> +            assigned-clock-rates = <0>, <66700000>;
>> +            assigned-clock-parents = <&clocks MOUT_MPLL>;
> 
> What are these clocks for, and why are they reparented / reclocked?
> 
> Shouldn't they be passed to 'clocks' as well?
> 
> -Paul
> 

The G3D clock system can have multiple parents, and for stable operation
it's recommended to use the MPLL clock as the parent (which in turn
is actually a mux as well).  MOUT_G3D is simply the mux for CLK_G3D
(SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could equally be CLK_G3D
(and probably should be, for readability) as CLK_G3D is simply the gate and
DOUT_G3D is the divider for it.

The SGX clock layout on S5PV210 looks something like this:

        MOUT_MPLL -----------> MOUT_G3D ---> DOUT_G3D  ---> CLK_G3D
(selectable parent clock)      (mux)    ---> (divider) ---> (gate)

This is fairly common for older Samsung SoCs, eg having a look at
arch/arm/boot/dts/exynos4210-universal_c210.dts you can see that
the FIMC clocks are parented to MPLL and have a rate set.

>> +        };
>> +
>>          fimd: fimd@f8000000 {
>>              compatible = "samsung,s5pv210-fimd";
>>              interrupt-parent = <&vic2>;
>> -- 
>> 2.25.1
>>
> 
> 

Thanks,
Jonathan
Philipp Rossak April 26, 2020, 7:31 p.m. UTC | #5
Hi Paul,

On 26.04.20 14:53, Paul Cercueil wrote:
> 
> 
> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> 
> a écrit :
>> From: Philipp Rossak <embed3d@gmail.com>
>>
>> We are adding the devicetree binding for the PVR-SGX-544-115 gpu.
>>
>> This driver is currently under development in the openpvrsgx-devgroup.
>> Right now the full binding is not figured out, so we provide here a
>> placeholder. It will be completed as soon as there is a demo available.
>>
>> The currently used binding that is used during development is more
>> complete and was already verifyed by loading the kernelmodule successful.
>>
>> Signed-off-by: Philipp Rossak <embed3d@gmail.com>
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>>  arch/arm/boot/dts/sun6i-a31.dtsi | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi 
>> b/arch/arm/boot/dts/sun6i-a31.dtsi
>> index f3425a66fc0a..933a825bf460 100644
>> --- a/arch/arm/boot/dts/sun6i-a31.dtsi
>> +++ b/arch/arm/boot/dts/sun6i-a31.dtsi
>> @@ -1417,5 +1417,16 @@ p2wi: i2c@1f03400 {
>>              #address-cells = <1>;
>>              #size-cells = <0>;
>>          };
>> +
>> +        gpu: gpu@1c400000 {
>> +            compatible = "allwinner,sun8i-a31-sgx544-115",

looks like a copy paste error from my side this should be 
allwinner,sun6i-a31-sgx544-115

>> +                     "img,sgx544-115", "img,sgx544";
>> +            reg = <0x01c40000 0x10000>;
>> +            /*
>> +             * This node is currently a placeholder for the gpu.
>> +             * This will be completed when a full demonstration
>> +             * of the openpvrsgx driver is available for this board.
>> +             */
> 
> This node doesn't have clocks, so I don't see how it'd work.
> 
> Better delay the introduction of the GPU node for this board until you 
> know it works.
> 
> -Paul
This was already discuss in an earlier version that series that this 
should be delayed.

I will send a follow up patch series, as soon as I mainlined an other 
driver that I'm working on, which is required to properly describe the gpu.

Cheers
Philipp
Krzysztof Kozlowski April 27, 2020, 3:46 p.m. UTC | #6
On Sun, Apr 26, 2020 at 07:57:12AM -0700, Jonathan Bakker wrote:
> Hi Paul,
> 
> On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
> > 
> > 
> > Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
> >> From: Jonathan Bakker <xc-racer2@live.ca>
> >>
> >> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
> >>
> >> There is no external regulator for it so it can be enabled by default.
> >>
> >> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> >> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> >> ---
> >>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
> >>  1 file changed, 13 insertions(+)
> >>
> >> diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
> >> index 2ad642f51fd9..abbdda205c1b 100644
> >> --- a/arch/arm/boot/dts/s5pv210.dtsi
> >> +++ b/arch/arm/boot/dts/s5pv210.dtsi
> >> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
> >>              #interrupt-cells = <1>;
> >>          };
> >>
> >> +        gpu: gpu@f3000000 {
> >> +            compatible = "samsung,s5pv210-sgx540-120";

This should not pass the bindings check because you missed last
compatibles.

> >> +            reg = <0xf3000000 0x10000>;
> >> +            interrupt-parent = <&vic2>;
> >> +            interrupts = <10>;
> >> +            clock-names = "core";
> >> +            clocks = <&clocks CLK_G3D>;
> >> +
> >> +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
> >> +            assigned-clock-rates = <0>, <66700000>;
> >> +            assigned-clock-parents = <&clocks MOUT_MPLL>;
> > 
> > What are these clocks for, and why are they reparented / reclocked?
> > 
> > Shouldn't they be passed to 'clocks' as well?
> > 
> > -Paul
> > 
> 
> The G3D clock system can have multiple parents, and for stable operation
> it's recommended to use the MPLL clock as the parent (which in turn
> is actually a mux as well).  MOUT_G3D is simply the mux for CLK_G3D
> (SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could equally be CLK_G3D
> (and probably should be, for readability) as CLK_G3D is simply the gate and
> DOUT_G3D is the divider for it.

Good point, it should be CLK_G3D instead of DOUT.  Can you fix this as
well?

Best regards,
Krzysztof
H. Nikolaus Schaller April 28, 2020, 7:59 a.m. UTC | #7
Hi Paul,

> Am 26.04.2020 um 14:50 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi Nikolaus,
> 
> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>> Add SGX GPU node with interrupt. Tested on PandaBoard ES.
>> Since omap4420/30/60 and omap4470 come with different SGX variants
>> we need to introduce a new omap4470.dtsi. If an omap4470 board
>> does not want to use SGX it is no problem to still include
>> omap4460.dtsi.
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>> ---
>> arch/arm/boot/dts/omap4.dtsi   | 11 ++++++-----
>> arch/arm/boot/dts/omap4470.dts | 15 +++++++++++++++
>> 2 files changed, 21 insertions(+), 5 deletions(-)
>> create mode 100644 arch/arm/boot/dts/omap4470.dts
>> diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
>> index 763bdea8c829..15ff3d7146af 100644
>> --- a/arch/arm/boot/dts/omap4.dtsi
>> +++ b/arch/arm/boot/dts/omap4.dtsi
>> @@ -389,7 +389,7 @@ abb_iva: regulator-abb-iva {
>> 			status = "disabled";
>> 		};
>> -		target-module@56000000 {
>> +		sgx_module: target-module@56000000 {
>> 			compatible = "ti,sysc-omap4", "ti,sysc";
>> 			reg = <0x5600fe00 0x4>,
>> 			      <0x5600fe10 0x4>;
>> @@ -408,10 +408,11 @@ target-module@56000000 {
>> 			#size-cells = <1>;
>> 			ranges = <0 0x56000000 0x2000000>;
>> -			/*
>> -			 * Closed source PowerVR driver, no child device
>> -			 * binding or driver in mainline
>> -			 */
>> +			gpu: gpu@0 {
>> +				compatible = "ti,omap4-sgx540-120", "img,sgx540-120", "img,sgx540";
>> +				reg = <0x0 0x2000000>;	/* 32MB */
>> +				interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
>> +			};
>> 		};
>> 		/*
>> diff --git a/arch/arm/boot/dts/omap4470.dts b/arch/arm/boot/dts/omap4470.dts
>> new file mode 100644
>> index 000000000000..f29c581300bf
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/omap4470.dts

^^^ there is also a missing "i" in the file name

>> @@ -0,0 +1,15 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Device Tree Source for OMAP4470 SoC
>> + *
>> + * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
>> + *
>> + * This file is licensed under the terms of the GNU General Public License
>> + * version 2.  This program is licensed "as is" without any warranty of any
>> + * kind, whether express or implied.
>> + */
>> +#include "omap4460.dtsi"
>> +
>> +&sgx {
> 
> Does this even compile?

Good question.

So far there is no well known eval board in mainline that #includes this .dtsi (because it is new) and therefore it passes any compile tests.

  DTC     arch/arm/boot/dts/omap4470-test.dtb - due to target missing
Error: arch/arm/boot/dts/omap4470.dtsi:13.1-5 Label or path sgx not found

I have now added a dummy board (not to be mainlined) for my own compile test...

> 
> The node's handle is named sgx_module, not sgx.

Indeed. A fix is queued for v8.

BR and thanks,
Nikolaus
Jonathan Bakker April 28, 2020, 9:39 p.m. UTC | #8
Hi Krzysztof,

On 2020-04-27 8:46 a.m., Krzysztof Kozlowski wrote:
> On Sun, Apr 26, 2020 at 07:57:12AM -0700, Jonathan Bakker wrote:
>> Hi Paul,
>>
>> On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
>>>
>>>
>>> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>>>> From: Jonathan Bakker <xc-racer2@live.ca>
>>>>
>>>> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
>>>>
>>>> There is no external regulator for it so it can be enabled by default.
>>>>
>>>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>>>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>>>> ---
>>>>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
>>>>  1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
>>>> index 2ad642f51fd9..abbdda205c1b 100644
>>>> --- a/arch/arm/boot/dts/s5pv210.dtsi
>>>> +++ b/arch/arm/boot/dts/s5pv210.dtsi
>>>> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
>>>>              #interrupt-cells = <1>;
>>>>          };
>>>>
>>>> +        gpu: gpu@f3000000 {
>>>> +            compatible = "samsung,s5pv210-sgx540-120";
> 
> This should not pass the bindings check because you missed last
> compatibles.
> 

Thanks for pointing that out, I'll add it and make sure it passes the bindings check.

>>>> +            reg = <0xf3000000 0x10000>;
>>>> +            interrupt-parent = <&vic2>;
>>>> +            interrupts = <10>;
>>>> +            clock-names = "core";
>>>> +            clocks = <&clocks CLK_G3D>;
>>>> +
>>>> +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
>>>> +            assigned-clock-rates = <0>, <66700000>;
>>>> +            assigned-clock-parents = <&clocks MOUT_MPLL>;
>>>
>>> What are these clocks for, and why are they reparented / reclocked?
>>>
>>> Shouldn't they be passed to 'clocks' as well?
>>>
>>> -Paul
>>>
>>
>> The G3D clock system can have multiple parents, and for stable operation
>> it's recommended to use the MPLL clock as the parent (which in turn
>> is actually a mux as well).  MOUT_G3D is simply the mux for CLK_G3D
>> (SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could equally be CLK_G3D
>> (and probably should be, for readability) as CLK_G3D is simply the gate and
>> DOUT_G3D is the divider for it.
> 
> Good point, it should be CLK_G3D instead of DOUT.  Can you fix this as
> well?

Yep, will do.  Nikolaus, I'll send you an updated patch to include.

> 
> Best regards,
> Krzysztof
> 

Thanks,
Jonathan
Jonathan Bakker April 28, 2020, 10:58 p.m. UTC | #9
Hi all,

On 2020-04-28 2:39 p.m., Jonathan Bakker wrote:
> Hi Krzysztof,
> 
> On 2020-04-27 8:46 a.m., Krzysztof Kozlowski wrote:
>> On Sun, Apr 26, 2020 at 07:57:12AM -0700, Jonathan Bakker wrote:
>>> Hi Paul,
>>>
>>> On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
>>>>
>>>>
>>>> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
>>>>> From: Jonathan Bakker <xc-racer2@live.ca>
>>>>>
>>>>> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
>>>>>
>>>>> There is no external regulator for it so it can be enabled by default.
>>>>>
>>>>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>>>>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>>>>> ---
>>>>>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
>>>>>  1 file changed, 13 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
>>>>> index 2ad642f51fd9..abbdda205c1b 100644
>>>>> --- a/arch/arm/boot/dts/s5pv210.dtsi
>>>>> +++ b/arch/arm/boot/dts/s5pv210.dtsi
>>>>> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
>>>>>              #interrupt-cells = <1>;
>>>>>          };
>>>>>
>>>>> +        gpu: gpu@f3000000 {
>>>>> +            compatible = "samsung,s5pv210-sgx540-120";
>>
>> This should not pass the bindings check because you missed last
>> compatibles.
>>
> 
> Thanks for pointing that out, I'll add it and make sure it passes the bindings check.
> 
>>>>> +            reg = <0xf3000000 0x10000>;
>>>>> +            interrupt-parent = <&vic2>;
>>>>> +            interrupts = <10>;
>>>>> +            clock-names = "core";
>>>>> +            clocks = <&clocks CLK_G3D>;
>>>>> +
>>>>> +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
>>>>> +            assigned-clock-rates = <0>, <66700000>;
>>>>> +            assigned-clock-parents = <&clocks MOUT_MPLL>;
>>>>
>>>> What are these clocks for, and why are they reparented / reclocked?
>>>>
>>>> Shouldn't they be passed to 'clocks' as well?
>>>>
>>>> -Paul
>>>>
>>>
>>> The G3D clock system can have multiple parents, and for stable operation
>>> it's recommended to use the MPLL clock as the parent (which in turn
>>> is actually a mux as well).  MOUT_G3D is simply the mux for CLK_G3D
>>> (SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could equally be CLK_G3D
>>> (and probably should be, for readability) as CLK_G3D is simply the gate and
>>> DOUT_G3D is the divider for it.
>>
>> Good point, it should be CLK_G3D instead of DOUT.  Can you fix this as
>> well?
> 
> Yep, will do.  Nikolaus, I'll send you an updated patch to include.
> 

How are assigned-clocks handled in the yaml DT schema?  When running make dtbs_check,
I end up with messages such as

arch/arm/boot/dts/s5pv210-aquila.dt.yaml: gpu@f3000000: 'assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' do not match any of the regexes: 'pinctrl-[0-9]+'

Do they need to explicitly be listed as valid entries?

Thanks,
Jonathan
Maxime Ripard April 29, 2020, 8:47 a.m. UTC | #10
Hi,

On Tue, Apr 28, 2020 at 03:58:03PM -0700, Jonathan Bakker wrote:
> On 2020-04-28 2:39 p.m., Jonathan Bakker wrote:
> > On 2020-04-27 8:46 a.m., Krzysztof Kozlowski wrote:
> >> On Sun, Apr 26, 2020 at 07:57:12AM -0700, Jonathan Bakker wrote:
> >>> Hi Paul,
> >>>
> >>> On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
> >>>>
> >>>>
> >>>> Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller <hns@goldelico.com> a écrit :
> >>>>> From: Jonathan Bakker <xc-racer2@live.ca>
> >>>>>
> >>>>> All s5pv210 devices have a PowerVR SGX 540 (revision 120) attached.
> >>>>>
> >>>>> There is no external regulator for it so it can be enabled by default.
> >>>>>
> >>>>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> >>>>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> >>>>> ---
> >>>>>  arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
> >>>>>  1 file changed, 13 insertions(+)
> >>>>>
> >>>>> diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
> >>>>> index 2ad642f51fd9..abbdda205c1b 100644
> >>>>> --- a/arch/arm/boot/dts/s5pv210.dtsi
> >>>>> +++ b/arch/arm/boot/dts/s5pv210.dtsi
> >>>>> @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
> >>>>>              #interrupt-cells = <1>;
> >>>>>          };
> >>>>>
> >>>>> +        gpu: gpu@f3000000 {
> >>>>> +            compatible = "samsung,s5pv210-sgx540-120";
> >>
> >> This should not pass the bindings check because you missed last
> >> compatibles.
> >>
> > 
> > Thanks for pointing that out, I'll add it and make sure it passes the bindings check.
> > 
> >>>>> +            reg = <0xf3000000 0x10000>;
> >>>>> +            interrupt-parent = <&vic2>;
> >>>>> +            interrupts = <10>;
> >>>>> +            clock-names = "core";
> >>>>> +            clocks = <&clocks CLK_G3D>;
> >>>>> +
> >>>>> +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks DOUT_G3D>;
> >>>>> +            assigned-clock-rates = <0>, <66700000>;
> >>>>> +            assigned-clock-parents = <&clocks MOUT_MPLL>;
> >>>>
> >>>> What are these clocks for, and why are they reparented / reclocked?
> >>>>
> >>>> Shouldn't they be passed to 'clocks' as well?
> >>>>
> >>>> -Paul
> >>>>
> >>>
> >>> The G3D clock system can have multiple parents, and for stable operation
> >>> it's recommended to use the MPLL clock as the parent (which in turn
> >>> is actually a mux as well).  MOUT_G3D is simply the mux for CLK_G3D
> >>> (SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could equally be CLK_G3D
> >>> (and probably should be, for readability) as CLK_G3D is simply the gate and
> >>> DOUT_G3D is the divider for it.
> >>
> >> Good point, it should be CLK_G3D instead of DOUT.  Can you fix this as
> >> well?
> > 
> > Yep, will do.  Nikolaus, I'll send you an updated patch to include.
> > 
> 
> How are assigned-clocks handled in the yaml DT schema?  When running make dtbs_check,
> I end up with messages such as
> 
> arch/arm/boot/dts/s5pv210-aquila.dt.yaml: gpu@f3000000: 'assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' do not match any of the regexes: 'pinctrl-[0-9]+'
> 
> Do they need to explicitly be listed as valid entries?

If you have additionalProperties set to false, yes. But you should really
consider not using them in the first place, since they provide no guarantee on
whether the setup you did in the DT will remain during the life of the system.

I'm not sure why it's needed on that SoC in particular, but this should be fixed
in the driver itself (either the clock or the GPU driver).

Maxime
Paul Cercueil April 29, 2020, 12:26 p.m. UTC | #11
Hi Jonathan,

Le mar. 28 avril 2020 à 15:58, Jonathan Bakker <xc-racer2@live.ca> a 
écrit :
> Hi all,
> 
> On 2020-04-28 2:39 p.m., Jonathan Bakker wrote:
>>  Hi Krzysztof,
>> 
>>  On 2020-04-27 8:46 a.m., Krzysztof Kozlowski wrote:
>>>  On Sun, Apr 26, 2020 at 07:57:12AM -0700, Jonathan Bakker wrote:
>>>>  Hi Paul,
>>>> 
>>>>  On 2020-04-26 5:56 a.m., Paul Cercueil wrote:
>>>>> 
>>>>> 
>>>>>  Le ven. 24 avril 2020 à 22:34, H. Nikolaus Schaller 
>>>>> <hns@goldelico.com> a écrit :
>>>>>>  From: Jonathan Bakker <xc-racer2@live.ca>
>>>>>> 
>>>>>>  All s5pv210 devices have a PowerVR SGX 540 (revision 120) 
>>>>>> attached.
>>>>>> 
>>>>>>  There is no external regulator for it so it can be enabled by 
>>>>>> default.
>>>>>> 
>>>>>>  Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>>>>>>  Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
>>>>>>  ---
>>>>>>   arch/arm/boot/dts/s5pv210.dtsi | 13 +++++++++++++
>>>>>>   1 file changed, 13 insertions(+)
>>>>>> 
>>>>>>  diff --git a/arch/arm/boot/dts/s5pv210.dtsi 
>>>>>> b/arch/arm/boot/dts/s5pv210.dtsi
>>>>>>  index 2ad642f51fd9..abbdda205c1b 100644
>>>>>>  --- a/arch/arm/boot/dts/s5pv210.dtsi
>>>>>>  +++ b/arch/arm/boot/dts/s5pv210.dtsi
>>>>>>  @@ -512,6 +512,19 @@ vic3: interrupt-controller@f2300000 {
>>>>>>               #interrupt-cells = <1>;
>>>>>>           };
>>>>>> 
>>>>>>  +        gpu: gpu@f3000000 {
>>>>>>  +            compatible = "samsung,s5pv210-sgx540-120";
>>> 
>>>  This should not pass the bindings check because you missed last
>>>  compatibles.
>>> 
>> 
>>  Thanks for pointing that out, I'll add it and make sure it passes 
>> the bindings check.
>> 
>>>>>>  +            reg = <0xf3000000 0x10000>;
>>>>>>  +            interrupt-parent = <&vic2>;
>>>>>>  +            interrupts = <10>;
>>>>>>  +            clock-names = "core";
>>>>>>  +            clocks = <&clocks CLK_G3D>;
>>>>>>  +
>>>>>>  +            assigned-clocks = <&clocks MOUT_G3D>, <&clocks 
>>>>>> DOUT_G3D>;
>>>>>>  +            assigned-clock-rates = <0>, <66700000>;
>>>>>>  +            assigned-clock-parents = <&clocks MOUT_MPLL>;
>>>>> 
>>>>>  What are these clocks for, and why are they reparented / 
>>>>> reclocked?
>>>>> 
>>>>>  Shouldn't they be passed to 'clocks' as well?
>>>>> 
>>>>>  -Paul
>>>>> 
>>>> 
>>>>  The G3D clock system can have multiple parents, and for stable 
>>>> operation
>>>>  it's recommended to use the MPLL clock as the parent (which in 
>>>> turn
>>>>  is actually a mux as well).  MOUT_G3D is simply the mux for 
>>>> CLK_G3D
>>>>  (SGX core clock), DOUT_G3D is the divider.  DOUT_G3D could 
>>>> equally be CLK_G3D
>>>>  (and probably should be, for readability) as CLK_G3D is simply 
>>>> the gate and
>>>>  DOUT_G3D is the divider for it.
>>> 
>>>  Good point, it should be CLK_G3D instead of DOUT.  Can you fix 
>>> this as
>>>  well?
>> 
>>  Yep, will do.  Nikolaus, I'll send you an updated patch to include.
>> 
> 
> How are assigned-clocks handled in the yaml DT schema?  When running 
> make dtbs_check,
> I end up with messages such as
> 
> arch/arm/boot/dts/s5pv210-aquila.dt.yaml: gpu@f3000000: 
> 'assigned-clock-parents', 'assigned-clock-rates', 'assigned-clocks' 
> do not match any of the regexes: 'pinctrl-[0-9]+'
> 
> Do they need to explicitly be listed as valid entries?

The assigned-* can also be moved inside the node of the clocks 
provider. I would say it makes more sense to have them there.

-Paul