devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
To: Kaustabh Chakraborty <kauschluss@disroot.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Kees Cook <kees@kernel.org>, Tony Luck <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: Sergey Lisov <sleirsgoevy@gmail.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2 2/5] arm64: dts: exynos: add initial devicetree support for exynos7870
Date: Tue, 4 Feb 2025 20:22:09 +0200	[thread overview]
Message-ID: <00aa901b-5de9-4b72-a157-c54ad29df458@gmail.com> (raw)
In-Reply-To: <20250204-exynos7870-v2-2-56313165ef0c@disroot.org>

On 2/3/25 22:46, Kaustabh Chakraborty wrote:
> Exynos7870 is an arm64 SoC manufactured by Samsung and announced in
> 2016. It is present in multiple mid-range Samsung phones and tablets.
>
> Add basic devicetree support for the SoC, which includes CMUs, pin
> controllers, I2C, UART, DW-MMC, and USB-DRD.
>
> Co-developed-by: Sergey Lisov <sleirsgoevy@gmail.com>
> Signed-off-by: Sergey Lisov <sleirsgoevy@gmail.com>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
>  arch/arm64/boot/dts/exynos/exynos7870-pinctrl.dtsi | 1035 ++++++++++++++++++++
>  arch/arm64/boot/dts/exynos/exynos7870.dtsi         |  722 ++++++++++++++
>  2 files changed, 1757 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/exynos/exynos7870-pinctrl.dtsi b/arch/arm64/boot/dts/exynos/exynos7870-pinctrl.dtsi
> new file mode 100644
> index 0000000000000000000000000000000000000000..28ff409c4fdc5f766d92617ea2df7be2112c28d1
> --- /dev/null
> +++ b/arch/arm64/boot/dts/exynos/exynos7870-pinctrl.dtsi
> @@ -0,0 +1,1035 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Samsung Exynos7870 SoC pin-mux and pin-config device tree source
> + *
> + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
> + */
> +
> +#include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include "exynos-pinctrl.h"
> +
> +&pinctrl0 {

I haven't had enough time to look deeper, but these are my 2 cents:


Can you label them according to their block name rather than numbers?
For example, pinctrl_abox (make sure to keep them alphabetically sorted
as well).

> +	etc0: etc0-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +	};
> +
> +	etc1: etc1-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +	};
> +
> +	gpa0: gpa0-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		interrupt-parent = <&gic>;
> +		interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
> +	};
> +
> +	gpa1: gpa1-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +		interrupt-parent = <&gic>;
> +		interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
> +			     <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
> +	};
> +
> +	gpa2: gpa2-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +	};
> +
> +	gpq0: gpq0-gpio-bank {
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		interrupt-controller;
> +		#interrupt-cells = <2>;
> +	};
> +
> +	uart2_bus: uart2-bus-pins {
> +		samsung,pins = "gpa1-1", "gpa1-0";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +	};
> +
> +	uart2_sleep: uart2-sleep-pins {
> +		samsung,pins = "gpa1-1";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
> +	};
> +
> +	bt_btwake: bt-btwake-pins {
> +		samsung,pins = "gpa1-2";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
> +		samsung,pin-con-pdn = <EXYNOS_PIN_PDN_PREV>;
> +		samsung,pin-pud-pdn = <EXYNOS_PIN_PULL_NONE>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +	};
> +
> +	bt_hostwake: bt-hostwake-pins {

Sort these alphabetically, so you have:
all a-z-gpio-bank, after which all a-z-pin.

In this case bt_* can be first after all gpio bank nodes.

> +		samsung,pins = "gpa1-6";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
> +		samsung,pin-con-pdn = <EXYNOS_PIN_PDN_INPUT>;
> +		samsung,pin-pud-pdn = <EXYNOS_PIN_PULL_NONE>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +	};
> +
> +	gnss_sensor_irq: gnss-sensor-irq-pins {
> +		samsung,pins = "gpa2-3";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_6>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
> +	};
> +
> +	gnss_sensor_i2c: gnss-sensor-i2c-pins {
> +		samsung,pins = "gpa2-5", "gpa2-4";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_6>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +	};
> +
...
> +		#interrupt-cells = <2>;
> +	};
> +
> +	hs_i2c0_bus: hs-i2c0-bus-pins {

s/hs_i2c/hsi2c/g

> +		samsung,pins = "gpm0-1", "gpm0-0";
> +		samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
> +		samsung,pin-con-pdn = <EXYNOS_PIN_PDN_PREV>;
> +		samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
> +		samsung,pin-drv = <EXYNOS5433_PIN_DRV_FAST_SR1>;
> +	};
...
> diff --git a/arch/arm64/boot/dts/exynos/exynos7870.dtsi b/arch/arm64/boot/dts/exynos/exynos7870.dtsi
> new file mode 100644
> index 0000000000000000000000000000000000000000..11129e37fc86ebaee01684ed6841c932dd6cbc8a
> --- /dev/null
> +++ b/arch/arm64/boot/dts/exynos/exynos7870.dtsi
> @@ -0,0 +1,722 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Samsung Exynos7870 SoC device tree source
> + *
> + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
> + */
> +
> +#include <dt-bindings/clock/exynos7870.h>
> +#include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/soc/samsung,boot-mode.h>
> +
> +/ {
> +	compatible = "samsung,exynos7870";
> +	#address-cells = <2>;
> +	#size-cells = <1>;
> +
> +	/* Samsung's bootloader (S-BOOT) checks for these DT properties */
> +	model_info-hw_rev = <0>;
> +	model_info-hw_rev_end = <255>;
> +	model_info-chip = <7870>;

You could skip the properties with a shim bootloader like uniLoader. Up to
Krzysztof to decide if you should keep these.

> +

...

> +	};
> +
> +	oscclk: oscclk {
> +		compatible = "fixed-clock";
> +		#clock-cells = <0>;
> +
> +		clock-frequency = <26000000>;

Frequency must be defined in the board device tree.

> +	};
> +
> +	timer {

S is before T, so this goes after soc {}

> +		compatible = "arm,armv8-timer";
> +		/* Hypervisor Virtual Timer interrupt is not wired to GIC */
> +		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
> +			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
> +			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>,
> +			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
> +
> +		/* Samsung's bootloader (S-BOOT) doesn't set CNTFRQ_EL0 */
> +		clock-frequency = <26000000>;
> +	};
> +
> +	gic: interrupt-controller@104e0000 {
> +		compatible = "arm,cortex-a15-gic";
> +		reg = <0x0 0x104e1000 0x1000>,

So it should be @104e1000 and not @104e0000

> +		      <0x0 0x104e2000 0x1000>,
> +		      <0x0 0x104e4000 0x2000>,
> +		      <0x0 0x104e6000 0x2000>;
> +		interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
> +		interrupt-controller;
> +		#address-cells = <0>;
> +		#interrupt-cells = <3>;
> +	};
> +
> +	soc: soc@0 {
> +		compatible = "simple-bus";
> +		ranges = <0x0 0x0 0x0 0x20000000>;
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +
> +		chipid@10100000 {
> +			compatible = "samsung,exynos7870-chipid",
> +				     "samsung,exynos4210-chipid";
> +			reg = <0x10100000 0x100>;
> +		};
> +
> +		pmu_system_controller: system-controller@10480000 {
> +			compatible = "samsung,exynos7870-pmu",
> +				     "samsung,exynos7-pmu", "syscon";
> +			reg = <0x10480000 0x10000>;
> +			#clock-cells = <1>;
> +
> +			clock-names = "clkout8",
> +				      "clkout9",

Could fit more than one per line.

> +				      "clkout10",
> +				      "clkout11",
> +				      "clkout12";
> +			clocks = <&oscclk>,
> +				 <&oscclk>,
> +				 <&oscclk>,
> +				 <&oscclk>,
> +				 <&oscclk>;
> +
> +			reboot-mode {
> +				compatible = "syscon-reboot-mode";
> +				offset = <0x080c>;
> +				mode-bootloader = <EXYNOS7870_BOOT_BOOTLOADER>;
> +				mode-download = <EXYNOS7870_BOOT_DOWNLOAD>;
> +				mode-recovery = <EXYNOS7870_BOOT_RECOVERY>;
> +			};
> +		};
> +
> +		cmu_mif: clock-controller@10460000 {

Sort all of these by address.

> +			compatible = "samsung,exynos7870-cmu-mif";
> +			reg = <0x10460000 0x1000>;
> +			#clock-cells = <1>;
> +
> +			clock-names = "oscclk";
> +			clocks = <&oscclk>;
> +		};
> +
> +		cmu_dispaud: clock-controller@148d0000 {
> +			compatible = "samsung,exynos7870-cmu-dispaud";
> +			reg = <0x148d0000 0x1000>;
> +			#clock-cells = <1>;
> +
> +			clock-names = "oscclk",
> +				      "gout_mif_cmu_dispaud_bus",

bus

> +				      "gout_mif_cmu_dispaud_decon_eclk",

decon_eclk

> +				      "gout_mif_cmu_dispaud_decon_vclk";

decon_vclk

Clock names here shouldn't be long. You'll still describe them in the
clock YAML either way. Check other SoCs like 8895, autov920, 990.

> +			clocks = <&oscclk>,
> +				 <&cmu_mif CLK_GOUT_MIF_CMU_DISPAUD_BUS>,
> +				 <&cmu_mif CLK_GOUT_MIF_CMU_DISPAUD_DECON_ECLK>,
> +				 <&cmu_mif CLK_GOUT_MIF_CMU_DISPAUD_DECON_VCLK>;
> +		};
> +

...

> +
> +		i2c1: i2c@13880000 {
> +			compatible = "samsung,exynos7870-i2c",
> +				     "samsung,s3c2440-i2c";
> +			reg = <0x13880000 0x100>;
> +			interrupts = <GIC_SPI 429 IRQ_TYPE_LEVEL_HIGH>;
> +			status = "disabled";

Status always comes last. Make sure to sort all properties as per the DT
Coding Style [1].

[1] https://docs.kernel.org/devicetree/bindings/dts-coding-style.html

> +
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&i2c1_bus>;
> +
> +			clock-names = "i2c";
> +			clocks = <&cmu_peri CLK_GOUT_PERI_I2C1_PCLK>;
> +		};

...

> +		};
> +	};
> +};
> +
> +#include "exynos7870-pinctrl.dtsi"
> +#include "arm/samsung/exynos-syscon-restart.dtsi"

Didn't this already include a reboot node?

Best regards,
Ivaylo

>


  reply	other threads:[~2025-02-04 18:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 20:46 [PATCH v2 0/5] Add support for the Exynos7870 SoC, along with three devices Kaustabh Chakraborty
2025-02-03 20:46 ` [PATCH v2 1/5] dt-bindings: arm: samsung: add compatibles for exynos7870 devices Kaustabh Chakraborty
2025-02-03 20:46 ` [PATCH v2 2/5] arm64: dts: exynos: add initial devicetree support for exynos7870 Kaustabh Chakraborty
2025-02-04 18:22   ` Ivaylo Ivanov [this message]
2025-02-04 19:12     ` Kaustabh Chakraborty
2025-02-04 19:12     ` Krzysztof Kozlowski
2025-02-03 20:46 ` [PATCH v2 3/5] arm64: dts: exynos: add initial support for Samsung Galaxy J7 Prime Kaustabh Chakraborty
2025-02-03 20:46 ` [PATCH v2 4/5] arm64: dts: exynos: add initial support for Samsung Galaxy A2 Core Kaustabh Chakraborty
2025-02-03 20:46 ` [PATCH v2 5/5] arm64: dts: exynos: add initial support for Samsung Galaxy J6 Kaustabh Chakraborty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00aa901b-5de9-4b72-a157-c54ad29df458@gmail.com \
    --to=ivo.ivanov.ivanov1@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gpiccoli@igalia.com \
    --cc=kauschluss@disroot.org \
    --cc=kees@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sleirsgoevy@gmail.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).