From nobody Thu Apr 9 11:17:55 2026 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2E093803FF for ; Mon, 9 Mar 2026 10:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.64.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773050952; cv=none; b=QPkNsceqXB0lcf5ICJOv+SGNO9132/cF4p5aYnEDYFntQzx9EUVnaP/GPtaxd/kSb5aqMGlDVGO6PvSDPBB/oZx7tT17Hmy6VfTamCadUCrqqcY9U6t6d9bTmG7TmLsXKmdSyx78u6MvZ7JmHAMVkeobjiETfslRwBsSmwAkO78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773050952; c=relaxed/simple; bh=qi0On55lC0cVCddAXfvPm+qFc/hMgVO6VhgDVu9eXTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kM0K6krhc5yGEYHulUImGvWdrJXLdPF5293Djyd3H7S6EtAmuerOTL23HFRKUK74pUhuMU4N39WqSETIJTly3mlxWyqByhYC3jfdiuBFIMQZx0ikElVXe7Z3Pv78lTYzY90/ZZJKxCfzSx4TzqC8x6upUhRPVPeQAk/hsQ1WIC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b=U8Icu+/Q; arc=none smtp.client-ip=185.136.64.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="U8Icu+/Q" Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 2026030910085861f7bc558a000207dd for ; Mon, 09 Mar 2026 11:08:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=iDk3y7kpS2VdUf8xuIK/B77qzlAoXAb+CIJ/uBVDXFw=; b=U8Icu+/QHOmg/jikK5z/4pYUjTMTs6tH2HJLQIqG4wnaeMwMKVnlts+XFJr090CzX33IQW ueGYUS7esEDvvBoXKT2GMi//o9tPgx6YO+VWTPyNBoJcPC/63FNBaYnIM0XNt/pjlvAs/wt3 Ip1ic2/kGawfyA58hCkdDxmWc8vieo+9dMo1m/d4v3spHyAic09mZoE4fHRVV7kEP9l7nl4T nUOWxETyTRVpklwREgvj/2S7q83H2NlfzhVBFHIMZfrxCSvD8BFSDQIv5zUdj83w1OXZLMER KYbpfm95h7tdpFD3ABuHbWR5c6UyIQqTJ9M70rEid+fe2R9d3ZcFoRlg==; From: "A. Sverdlin" To: linux-arm-kernel@lists.infradead.org Cc: Alexander Sverdlin , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Santosh Shilimkar , Andrew Davis , Jayesh Choudhary , Siddharth Vadapalli , Abraham I , Roger Quadros , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: soc/reset: ti: add binding for k3 platforms reset module Date: Mon, 9 Mar 2026 11:07:53 +0100 Message-ID: <20260309100800.1134701-2-alexander.sverdlin@siemens.com> In-Reply-To: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> References: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer Content-Type: text/plain; charset="utf-8" From: Alexander Sverdlin Add DT binding for Texas Instruments K3 Multicore SoC platforms reset module present on AM64x and newer members of the K3 family and consists of the RST_CTRL, RST_STAT, RST_SRC and RST_MAGIC_WORD registers. The planned usage is to provide reset reason information. Signed-off-by: Alexander Sverdlin --- .../bindings/reset/ti,am64-rst.yaml | 39 +++++++++++++++++++ .../soc/ti/ti,j721e-system-controller.yaml | 11 ++++++ 2 files changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/ti,am64-rst.yaml diff --git a/Documentation/devicetree/bindings/reset/ti,am64-rst.yaml b/Doc= umentation/devicetree/bindings/reset/ti,am64-rst.yaml new file mode 100644 index 0000000000000..5a17cee9c6528 --- /dev/null +++ b/Documentation/devicetree/bindings/reset/ti,am64-rst.yaml @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/ti,am64-rst.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments K3 Multicore SoC platforms reset module + +maintainers: + - Alexander Sverdlin + +description: | + Texas Instruments (ARM64) K3 Multicore SoC platforms reset module is pre= sent + on AM64x and newer members of the K3 family and consists of the RST_CTRL, + RST_STAT, RST_SRC and RST_MAGIC_WORD registers. + +properties: + $nodename: + pattern: "^rst@[0-9a-f]+$" + + compatible: + items: + - const: ti,am64-rst + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + rst@43018170 { + compatible =3D "ti,am64-rst"; + reg =3D <0x43018170 0x10>; + }; diff --git a/Documentation/devicetree/bindings/soc/ti/ti,j721e-system-contr= oller.yaml b/Documentation/devicetree/bindings/soc/ti/ti,j721e-system-contr= oller.yaml index f3bd0be3b279f..a2071a1668f96 100644 --- a/Documentation/devicetree/bindings/soc/ti/ti,j721e-system-controller.y= aml +++ b/Documentation/devicetree/bindings/soc/ti/ti,j721e-system-controller.y= aml @@ -86,6 +86,12 @@ patternProperties: description: This is the DSS OLDI CTRL region. =20 + "^rst@[0-9a-f]+$": + type: object + $ref: /schemas/reset/ti,am64-rst.yaml# + description: + The node corresponding to SoC reset module. + required: - compatible - reg @@ -133,5 +139,10 @@ examples: compatible =3D "ti,j784s4-pcie-ctrl", "syscon"; reg =3D <0x4070 0x4>; }; + + rst@18170 { + compatible =3D "ti,am64-rst"; + reg =3D <0x18170 0x10>; + }; }; ... --=20 2.52.0 From nobody Thu Apr 9 11:17:56 2026 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1854338E5D4 for ; Mon, 9 Mar 2026 10:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.65.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773051551; cv=none; b=tuGd9LO9E94p7GXN7mqL+6n2mdce+8vgld8ULwK3dY4CctpbOELCu+xdQLm+b3FMVeACG8p9NBL8Us+8/B95BB/t+HNsqEBEzbjGRwVU6sbxT6Pw58V9KmqjGS1d5z0wJ8JRtb5WVIcf0X5krpUh3i5ieL4QkCFGOzbQGvRICGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773051551; c=relaxed/simple; bh=Bz3uHxPJsi+GfYB8PIagDJtRb3B+tZGSqBgMCcloEwE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jKbDcUFsMh5k4gw/yipolpWt3lNMFzblAtV3oR8U1FOU5xsuwXfqwlgmzzphDfMRktlk5CQlvpthi++Pce8PRx++E1xRIczxSAMzAHwFnjLkCYwFn1iKLX5otg6P1zyhBpGuMfH0lnzk3NSpJchy4vBGeChU0fAmpW7Iv8lPlYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b=gE2T+R5H; arc=none smtp.client-ip=185.136.65.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="gE2T+R5H" Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2026030910085874482c0fa100020725 for ; Mon, 09 Mar 2026 11:08:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=iwcbSGp09t7fYDLIc6ZTHBDejH8ml8Uwme+4NuDlzy4=; b=gE2T+R5HEGKddmuIw9d1finp+OO0LMtJFyHANmtCWX1Ro0EYP75YZ4b6I/X4JhV7l6XAJR pynHSjdVAcHXyW4KeKa5/Lr3vVHZi4ff3uXbC4uEmJl25lZkzesqhC0rEvZynnqkKuROtYBK mvD9LnA0AKnFQ7IX8xK2XtHiKREyqBS6Ptin2Wz52PrRAkEg7UL7vYZ8iGrj/HZxuOxac6Se BnTOhca+tBHRkEciDLaBH+/O/wiCLf5cZqXku6+6TaGtTsh9mumCr77BdhxObolW/TxMnr4V CE/l4cW+PC6FoC5XiiD+n/552AqSZBNJW+TW/lwbvXXInMOfwkh5Qk4w==; From: "A. Sverdlin" To: linux-arm-kernel@lists.infradead.org Cc: Alexander Sverdlin , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Santosh Shilimkar , Andrew Davis , Jayesh Choudhary , Siddharth Vadapalli , Abraham I , Roger Quadros , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] arm64: dts: ti: k3-*: Add am64x and newer reset module Date: Mon, 9 Mar 2026 11:07:54 +0100 Message-ID: <20260309100800.1134701-3-alexander.sverdlin@siemens.com> In-Reply-To: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> References: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer Content-Type: text/plain; charset="utf-8" From: Alexander Sverdlin Add the reset module present on AM64x and newer SoCs carrying reset cause information. Signed-off-by: Alexander Sverdlin --- arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi | 5 +++++ arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi | 5 +++++ arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi b/arch/arm64/boot/d= ts/ti/k3-am62-wakeup.dtsi index 75aed3a88284d..954130e8f37ba 100644 --- a/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi @@ -41,6 +41,11 @@ usb1_phy_ctrl: syscon@4018 { compatible =3D "ti,am62-usb-phy-ctrl", "syscon"; reg =3D <0x4018 0x4>; }; + + rst@18170 { + compatible =3D "ti,am64-rst"; + reg =3D <0x18170 0x10>; + }; }; =20 target-module@2b300050 { diff --git a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi b/arch/arm64/boot/= dts/ti/k3-am62a-wakeup.dtsi index 23877dadc98dc..7c94e6e16c069 100644 --- a/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi @@ -39,6 +39,11 @@ usb1_phy_ctrl: syscon@4018 { compatible =3D "ti,am62-usb-phy-ctrl", "syscon"; reg =3D <0x4018 0x4>; }; + + rst@18170 { + compatible =3D "ti,am64-rst"; + reg =3D <0x18170 0x10>; + }; }; =20 target-module@2b300050 { diff --git a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi b/arch/arm64/boot/dts= /ti/k3-am64-main.dtsi index 1b1d3970888b8..acbc7243cb16a 100644 --- a/arch/arm64/boot/dts/ti/k3-am64-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-am64-main.dtsi @@ -74,6 +74,11 @@ epwm_tbclk: clock-controller@4130 { reg =3D <0x4130 0x4>; #clock-cells =3D <1>; }; + + rst@18170 { + compatible =3D "ti,am64-rst"; + reg =3D <0x18170 0x10>; + }; }; =20 gic500: interrupt-controller@1800000 { --=20 2.52.0 From nobody Thu Apr 9 11:17:56 2026 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCD503803C1 for ; Mon, 9 Mar 2026 10:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.64.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773050951; cv=none; b=ZUkaw99am0vLHG6qqqOidwc7XllUNn3+udfwjFg1treNGFZjKGtUW3lGIel5oXZMM8y5TxEjlnT3C2FlS2y0XG00hYJ5FuzH+fxZAI7QfOKcQqzPk6Da7tYQnGSsYIFY1cJm8F+ouWZVki/Bm9DZ4AOQ1ucYqDPuzJSocLGXDQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773050951; c=relaxed/simple; bh=Eagp5Ejb5uSVhOilX6Bp+PTFyYqeR/ZTFOzn3ekyRUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HUOCBovBGGsyiV5HLRDrb4dgcMzRHqmafF3tX3q6BrdB00i42w5W1KLc+qtRY1SpH9qfKsFPAkSydA00M102zM55gV+lQf6tE6fqo/olKCDNbMwmSRl75U4pPdCByP153PFFejZ0KRgqgtj4OShBRPMdejX7LhzxUpjEAxYIIQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b=Hne3b6DA; arc=none smtp.client-ip=185.136.64.227 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="Hne3b6DA" Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 2026030910085929eed5eccc000207b8 for ; Mon, 09 Mar 2026 11:08:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=RZC0oGY8rRbgVELeb0RF2I7S6lvyMsAod6S1xdxvL7A=; b=Hne3b6DAZ3NK7o4qoULldXDLZAioGXj00TLOCqWII02dWiqBeW9ksPi0pSmxSD2Y8cqUUM jEFdseMXYtuDX00HoVtHOUsEOLNoAxjIIETNjcPPRuvBOXCdeFdtEZ6Ls9uGwwZDOrOOeAst 4l0I2FqgW2J/Xc4EMQvPyopa+8IWLLnLvgkvsn8pwOplo666b9/cDTdBD9zrZ07k0lVa9AFE Kk02DYKSt9W8zWRLgFbp7GcSjg4nOpLRPQ3oJx79is4Dal2nOibKA0bdoBKcVVEtVb/t5QOn 7nqOIqncK0YiodNYDcST5ujYKsOYfZhVCJd8E5Ke2V8E00diV4FE2Clw==; From: "A. Sverdlin" To: linux-arm-kernel@lists.infradead.org Cc: Alexander Sverdlin , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Santosh Shilimkar , Andrew Davis , Jayesh Choudhary , Siddharth Vadapalli , Abraham I , Roger Quadros , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] soc: ti: k3-socinfo: Provide reset reason information Date: Mon, 9 Mar 2026 11:07:55 +0100 Message-ID: <20260309100800.1134701-4-alexander.sverdlin@siemens.com> In-Reply-To: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> References: <20260309100800.1134701-1-alexander.sverdlin@siemens.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer Content-Type: text/plain; charset="utf-8" From: Alexander Sverdlin Add reset_reason attribute decoging the RST_SRC register present in AM64x and later SoCs of K3 family. Textual representation of the bits was taken from the AM62x Processors Technical Reference Manual, except the POR, which is not signalled explicitly by the reset module. Signed-off-by: Alexander Sverdlin --- drivers/soc/ti/k3-socinfo.c | 88 +++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/drivers/soc/ti/k3-socinfo.c b/drivers/soc/ti/k3-socinfo.c index 676041879eca3..3736c982fd0c8 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -45,6 +45,8 @@ #define JTAG_ID_PARTNO_J722S 0xBBA0 #define JTAG_ID_PARTNO_AM62LX 0xBBA7 =20 +#define CTRL_MMR_RST_SRC 8 + static const struct k3_soc_id { unsigned int id; const char *family_name; @@ -123,6 +125,90 @@ static const struct regmap_config k3_chipinfo_regmap_c= fg =3D { .reg_stride =3D 4, }; =20 +static u32 k3_reset_source; +static const char *const k3_reset_sources[] =3D { + [0] =3D "Reset Caused by MCU Reset Pin", + [1] =3D "Power On Reset", /* Reserved in HW */ + [2] =3D "Main Reset Pin", + [4] =3D "Thermal Reset", + [8] =3D "Debug Subsystem Initiated Reset", + [12] =3D "SMS Cold Reset", + [13] =3D "SMS Warm Reset", + [16] =3D "Software Warm Reset", + [20] =3D "Software Main Warm Reset From MCU CTRL MMR", + [21] =3D "Software Main Warm Reset from MAIN CTRL MMR", + [22] =3D "Watchdog Initiated Reset", + [24] =3D "Software Main Power On Reset From MCU CTRL MMR", + [25] =3D "Software Main Power On Reset From MAIN CTRL MMR", + [30] =3D "Reset Caused by Main ESM Error", + [31] =3D "Reset Caused by MCU ESM Error", +}; + +static ssize_t reset_reason_show(struct device *dev, struct device_attribu= te *attr, char *buf) +{ + int ret, i; + int total =3D 0; + + for (i =3D ARRAY_SIZE(k3_reset_sources); i >=3D 0; i--) { + if (!k3_reset_sources[i] || !(k3_reset_source & BIT(i))) + continue; + + ret =3D sprintf(buf + total, "%s\n", k3_reset_sources[i]); + if (ret < 0) + return ret; + total +=3D ret; + /* Note that several reset sources may be active simultaneously */ + } + + return total; +} + +static DEVICE_ATTR_RO(reset_reason); + +static struct attribute *k3_soc_attrs[] =3D { + &dev_attr_reset_reason.attr, + NULL +}; + +ATTRIBUTE_GROUPS(k3_soc); + +static const struct of_device_id k3_rst_id_table[] =3D { + { + .compatible =3D "ti,am64-rst", + }, + {} +}; + +static void k3_reset_reason_read(struct soc_device_attribute *soc_dev_attr) +{ + struct device_node *node =3D of_find_matching_node(NULL, k3_rst_id_table); + struct regmap *regmap; + + /* AM65x/J721E do not have similar registers */ + if (!node) + return; + + regmap =3D device_node_to_regmap(node); + of_node_put(node); + if (IS_ERR(regmap)) { + pr_err("Cannot obtain %s regmap\n", k3_rst_id_table[0].compatible); + return; + } + + regmap_read(regmap, CTRL_MMR_RST_SRC, &k3_reset_source); + /* + * The register is only being cleared on POR, so we have to clear reset + * source of the current boot manually + */ + regmap_write(regmap, CTRL_MMR_RST_SRC, k3_reset_source); + + /* Simplify the code a bit and use HW-reserved bit for POR indication */ + if (!k3_reset_source) + k3_reset_source |=3D BIT(1); + + soc_dev_attr->custom_attr_group =3D k3_soc_groups[0]; +} + static int k3_chipinfo_probe(struct platform_device *pdev) { struct device_node *node =3D pdev->dev.of_node; @@ -183,6 +269,8 @@ static int k3_chipinfo_probe(struct platform_device *pd= ev) of_property_read_string(node, "model", &soc_dev_attr->machine); of_node_put(node); =20 + k3_reset_reason_read(soc_dev_attr); + soc_dev =3D soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) { ret =3D PTR_ERR(soc_dev); --=20 2.52.0