Add SCMI clk support for NXP S32G2
cover Add SCMI clk support for NXP S32G2
Hi folks,
Here I'd like to propose an upstream patchset to support clock management of NXP S32G2 platforms based on ARM-SCMI's clock protocol (0x14). The goal is to have simple clock settings for enabling limited functions, such as MMC and GMAC0. Most of codes are mainly refined/refactored/redistributed from NXP's downstream codebase on CodeAurora[1] under the original license announcements and all SCMI clock IDs still match the implementations of NXP's downstream TF-A[2].
For those downstream authors who implement the main/original ideas, please forgive me that I only leave my name as "Signed-off-by" because I'm not sure if you might agree with these changes. Please feel free to let me know if you don't mind to be added into the list.
I roughly verified this patchset with NXP downstream firmware blobs [major ver:
bsp30 & bsp31], such as TF-A[2] and U-Boot[3] (BL33) on CodeAurora.
Thanks for your patience.
Chester
[1]: https://source.codeaurora.org/external/autobsps32/linux/
[2]: https://source.codeaurora.org/external/autobsps32/arm-trusted-firmware/
[3]: https://source.codeaurora.org/external/autobsps32/u-boot/
Chester Lin (3):
dt-bindings: clock: Add s32g2 clock binding
arm64: dts: s32g2: add SCMI support
arm64: dts: s32g2: add USDHC support
arch/arm64/boot/dts/freescale/s32g2.dtsi | 40 +++++++++++++++++++ .../arm64/boot/dts/freescale/s32g274a-evb.dts | 4 ++ .../boot/dts/freescale/s32g274a-rdb2.dts | 4 ++ include/dt-bindings/clock/s32g2-clock.h | 28 +++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 include/dt-bindings/clock/s32g2-clock.h
Signature · 7 lines
2.33.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
RFC PATCH 1/3 dt-bindings: clock: Add s32g2 clock binding
Add clock binding for S32G based on SCMI Clock Management Protocol (0x14)
--- include/dt-bindings/clock/s32g2-clock.h | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/dt-bindings/clock/s32g2-clock.h
include/dt-bindings/clock/s32g2-clock.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* +* Copyright 2020-2022 NXP +*/ +#ifndef __DT_BINDINGS_SCMI_CLOCK_S32G2_H +#define __DT_BINDINGS_SCMI_CLOCK_S32G2_H + +#define S32G2_SCMI_CLK_BASE_ID 0U +#define S32G2_SCMI_CLK (N ) ((N) + S32G2_SCMI_CLK_BASE_ID) + +/* GMAC0 - SGMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_SGMII S32G2_SCMI_CLK(16) +#define S32G2_SCMI_CLK_GMAC0_TX_SGMII S32G2_SCMI_CLK(17) +/* GMAC0 - RGMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_RGMII S32G2_SCMI_CLK(19) +#define S32G2_SCMI_CLK_GMAC0_TX_RGMII S32G2_SCMI_CLK(20) +/* GMAC0 - RMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_RMII S32G2_SCMI_CLK(22) +#define S32G2_SCMI_CLK_GMAC0_TX_RMII S32G2_SCMI_CLK(23) +/* GMAC0 - MII */ +#define S32G2_SCMI_CLK_GMAC0_RX_MII S32G2_SCMI_CLK(25) +#define S32G2_SCMI_CLK_GMAC0_TX_MII S32G2_SCMI_CLK(26) +#define S32G2_SCMI_CLK_GMAC0_AXI S32G2_SCMI_CLK(28) +/* uSDHC */ +#define S32G2_SCMI_CLK_USDHC_AHB S32G2_SCMI_CLK(35) +#define S32G2_SCMI_CLK_USDHC_MODULE S32G2_SCMI_CLK(36) +#define S32G2_SCMI_CLK_USDHC_CORE S32G2_SCMI_CLK(37) +#endif
Signature · 7 lines
2.33.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Rob Herring
maintainerRe: [RFC PATCH 1/3] dt-bindings: clock: Add s32g2 clock binding
Quoted 14 lines · Chester Lin
Add clock binding for S32G based on SCMI Clock Management Protocol (
0x14)Signed-off-by Chester Lin <[email protected]>--- include/dt-bindings/clock/s32g2-clock.h | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 include/dt-bindings/clock/s32g2-clock.hinclude/dt-bindings/clock/s32g2-clock.h new file +0
-0
include/dt-bindings/clock/s32g2-clock.h line 1
Quoted 1 line
include/dt-bindings/clock/s32g2-clock.h new file +1
-0@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause */
Dual license please.
Quoted 31 lines
include/dt-bindings/clock/s32g2-clock.h new file +27
-0+/* +* Copyright 2020-2022 NXP +*/ +#ifndef __DT_BINDINGS_SCMI_CLOCK_S32G2_H +#define __DT_BINDINGS_SCMI_CLOCK_S32G2_H + +#define S32G2_SCMI_CLK_BASE_ID 0U +#define S32G2_SCMI_CLK (N ) ((N) + S32G2_SCMI_CLK_BASE_ID) + +/* GMAC0 - SGMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_SGMII S32G2_SCMI_CLK(16) +#define S32G2_SCMI_CLK_GMAC0_TX_SGMII S32G2_SCMI_CLK(17) +/* GMAC0 - RGMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_RGMII S32G2_SCMI_CLK(19) +#define S32G2_SCMI_CLK_GMAC0_TX_RGMII S32G2_SCMI_CLK(20) +/* GMAC0 - RMII */ +#define S32G2_SCMI_CLK_GMAC0_RX_RMII S32G2_SCMI_CLK(22) +#define S32G2_SCMI_CLK_GMAC0_TX_RMII S32G2_SCMI_CLK(23) +/* GMAC0 - MII */ +#define S32G2_SCMI_CLK_GMAC0_RX_MII S32G2_SCMI_CLK(25) +#define S32G2_SCMI_CLK_GMAC0_TX_MII S32G2_SCMI_CLK(26) +#define S32G2_SCMI_CLK_GMAC0_AXI S32G2_SCMI_CLK(28) +/* uSDHC */ +#define S32G2_SCMI_CLK_USDHC_AHB S32G2_SCMI_CLK(35) +#define S32G2_SCMI_CLK_USDHC_MODULE S32G2_SCMI_CLK(36) +#define S32G2_SCMI_CLK_USDHC_CORE S32G2_SCMI_CLK(37) +#endif Signature · 1 line
2.33.1
RFC PATCH 2/3 arm64: dts: s32g2: add SCMI support
In reply to Chester LinAdd a scmi node to support SCMI protocol 0x14 on NXP S32G2 platforms.
--- arch/arm64/boot/dts/freescale/s32g2.dtsi | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm64/boot/dts/freescale/s32g2.dtsi +26 -0
@@ -72,11 +72,37 @@ timer { <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + scmi_shmem: memory@d0000000 { + compatible = "arm,scmi-shmem"; + reg = <0 0xd0000000 0 0x400000>; /* 4 MiB */ + no-map; + }; + }; + firmware { psci { compatible = "arm,psci-1.0"; method = "smc"; }; + + scmi { + compatible = "arm,scmi-smc"; + #address-cells = <1>; + #size-cells = <0>; + shmem = <&scmi_shmem>; + arm,smc-id = <0xc20000fe>; + + scmi_clks: protocol@14 { + reg = <0x14>; + #clock-cells = <1>; + }; + }; + }; soc {
Signature · 7 lines
2.33.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
RFC PATCH 3/3 arm64: dts: s32g2: add USDHC support
In reply to Chester LinAdd a mmc node to support USDHC on NXP S32G2 platforms.
--- arch/arm64/boot/dts/freescale/s32g2.dtsi | 14 ++++++++++++++ arch/arm64/boot/dts/freescale/s32g274a-evb.dts | 4 ++++ arch/arm64/boot/dts/freescale/s32g274a-rdb2.dts | 4 ++++ 3 files changed, 22 insertions(+)
arch/arm64/boot/dts/freescale/s32g2.dtsi +14 -0
@@ -7,6 +7,7 @@ */ #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/clock/s32g2-clock.h> / { compatible = "nxp,s32g2";
@@ -135,6 +136,19 @@ uart2: serial@402bc000 { status = "disabled"; }; + usdhc0: mmc@402f0000 { + compatible = "nxp,s32g2-usdhc"; + reg = <0x402f0000 0x1000>; + interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; + bus-width = <8>; + clocks = <&scmi_clks S32G2_SCMI_CLK_USDHC_MODULE>, + <&scmi_clks S32G2_SCMI_CLK_USDHC_AHB>, + <&scmi_clks S32G2_SCMI_CLK_USDHC_CORE>; + clock-names = "ipg", "ahb", "per"; + no-1-8-v; + status = "disabled"; + }; + gic: interrupt-controller@50800000 { compatible = "arm,gic-v3"; reg = <0x50800000 0x10000>,
arch/arm64/boot/dts/freescale/s32g274a-evb.dts +4 -0
@@ -32,3 +32,7 @@ memory@80000000 { &uart0 { status = "okay"; }; + +&usdhc0 { + status = "okay"; +};
arch/arm64/boot/dts/freescale/s32g274a-rdb2.dts +4 -0
@@ -38,3 +38,7 @@ &uart0 { &uart1 { status = "okay"; }; + +&usdhc0 { + status = "okay"; +};
Signature · 7 lines
2.33.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel