All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] support watchdog for exynosautov9
       [not found] <CGME20220520121722epcas2p371cb5e1300674a2aee017f857b60226c@epcas2p3.samsung.com>
@ 2022-05-20 12:17 ` Chanho Park
       [not found]   ` <CGME20220520121722epcas2p359f331c9276eeac5d027b0fe068296f1@epcas2p3.samsung.com>
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Chanho Park @ 2022-05-20 12:17 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree,
	Chanho Park

This adds to support watchdog and its device tree nodes for Exynos Auto
v9 SoC. Like exynos850, the SoC has two cpu watchdog devices but they
have different CPU configurations compared with exynos850. So, we need
to add separate configurations for Exynos Auto v9 SoC.

Chanho Park (4):
  dt-bindings: watchdog: add exynosautov9 compatible
  watchdog: s3c2410_wdt: support exynosautov9 watchdog
  arm64: dts: exynosautov9: add watchdog DT nodes
  arm64: dts: exynosautov9-sadk: enable watchdog devices

 .../bindings/watchdog/samsung-wdt.yaml        |  3 ++
 .../boot/dts/exynos/exynosautov9-sadk.dts     |  8 ++++
 arch/arm64/boot/dts/exynos/exynosautov9.dtsi  | 22 ++++++++++
 drivers/watchdog/s3c2410_wdt.c                | 41 +++++++++++++++++--
 4 files changed, 70 insertions(+), 4 deletions(-)

-- 
2.36.1


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

* [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible
       [not found]   ` <CGME20220520121722epcas2p359f331c9276eeac5d027b0fe068296f1@epcas2p3.samsung.com>
@ 2022-05-20 12:17     ` Chanho Park
  2022-05-20 12:52       ` Krzysztof Kozlowski
  2022-09-25 17:04       ` Guenter Roeck
  0 siblings, 2 replies; 11+ messages in thread
From: Chanho Park @ 2022-05-20 12:17 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree,
	Chanho Park

Adds "samsung,exynosautov9-wdt" to samsung-wdt compatible. This has two
cpu watchdogs like exynos850.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml b/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
index b08373336b16..8fb6656ba0c2 100644
--- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
@@ -23,6 +23,7 @@ properties:
       - samsung,exynos5420-wdt                # for Exynos5420
       - samsung,exynos7-wdt                   # for Exynos7
       - samsung,exynos850-wdt                 # for Exynos850
+      - samsung,exynosautov9-wdt              # for Exynosautov9
 
   reg:
     maxItems: 1
@@ -67,6 +68,7 @@ allOf:
               - samsung,exynos5420-wdt
               - samsung,exynos7-wdt
               - samsung,exynos850-wdt
+              - samsung,exynosautov9-wdt
     then:
       required:
         - samsung,syscon-phandle
@@ -76,6 +78,7 @@ allOf:
           contains:
             enum:
               - samsung,exynos850-wdt
+              - samsung,exynosautov9-wdt
     then:
       properties:
         clocks:
-- 
2.36.1


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

* [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog
       [not found]   ` <CGME20220520121722epcas2p25b1d7b12db6030b490f191c2ae3e9f9d@epcas2p2.samsung.com>
@ 2022-05-20 12:17     ` Chanho Park
  2022-05-20 13:01       ` Krzysztof Kozlowski
  2022-09-25 17:05       ` Guenter Roeck
  0 siblings, 2 replies; 11+ messages in thread
From: Chanho Park @ 2022-05-20 12:17 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree,
	Chanho Park

Like exynos850, exynosautov9 SoC also has two cpu watchdogs.
Unfortunately, some configurations are slightly different so we need to
add samsung,exynosautov9-wdt and separate drv data for those watchdogs.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 drivers/watchdog/s3c2410_wdt.c | 41 ++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 6db22f2e3a4f..0dbb3ec9c29c 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -60,9 +60,13 @@
 #define EXYNOS850_CLUSTER0_NONCPU_INT_EN	0x1244
 #define EXYNOS850_CLUSTER1_NONCPU_OUT		0x1620
 #define EXYNOS850_CLUSTER1_NONCPU_INT_EN	0x1644
+#define EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT	0x1520
+#define EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN	0x1544
 
 #define EXYNOS850_CLUSTER0_WDTRESET_BIT		24
 #define EXYNOS850_CLUSTER1_WDTRESET_BIT		23
+#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT	25
+#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT	24
 
 /**
  * DOC: Quirk flags for different Samsung watchdog IP-cores
@@ -236,6 +240,30 @@ static const struct s3c2410_wdt_variant drv_data_exynos850_cl1 = {
 		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
 };
 
+static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl0 = {
+	.mask_reset_reg = EXYNOS850_CLUSTER0_NONCPU_INT_EN,
+	.mask_bit = 2,
+	.mask_reset_inv = true,
+	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
+	.rst_stat_bit = EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT,
+	.cnt_en_reg = EXYNOS850_CLUSTER0_NONCPU_OUT,
+	.cnt_en_bit = 7,
+	.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
+		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
+};
+
+static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
+	.mask_reset_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN,
+	.mask_bit = 2,
+	.mask_reset_inv = true,
+	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
+	.rst_stat_bit = EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT,
+	.cnt_en_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT,
+	.cnt_en_bit = 7,
+	.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
+		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
+};
+
 static const struct of_device_id s3c2410_wdt_match[] = {
 	{ .compatible = "samsung,s3c2410-wdt",
 	  .data = &drv_data_s3c2410 },
@@ -249,6 +277,8 @@ static const struct of_device_id s3c2410_wdt_match[] = {
 	  .data = &drv_data_exynos7 },
 	{ .compatible = "samsung,exynos850-wdt",
 	  .data = &drv_data_exynos850_cl0 },
+	{ .compatible = "samsung,exynosautov9-wdt",
+	  .data = &drv_data_exynosautov9_cl0 },
 	{},
 };
 MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
@@ -630,8 +660,9 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
 	}
 
 #ifdef CONFIG_OF
-	/* Choose Exynos850 driver data w.r.t. cluster index */
-	if (variant == &drv_data_exynos850_cl0) {
+	/* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */
+	if (variant == &drv_data_exynos850_cl0 ||
+	    variant == &drv_data_exynosautov9_cl0) {
 		u32 index;
 		int err;
 
@@ -644,9 +675,11 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
 
 		switch (index) {
 		case 0:
-			return &drv_data_exynos850_cl0;
+			return variant;
 		case 1:
-			return &drv_data_exynos850_cl1;
+			return (variant == &drv_data_exynos850_cl0) ?
+				&drv_data_exynos850_cl1 :
+				&drv_data_exynosautov9_cl1;
 		default:
 			dev_err(dev, "wrong cluster index: %u\n", index);
 			return NULL;
-- 
2.36.1


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

* [PATCH 3/4] arm64: dts: exynosautov9: add watchdog DT nodes
       [not found]   ` <CGME20220520121722epcas2p169b2669f367e7461fa41663f3e90d303@epcas2p1.samsung.com>
@ 2022-05-20 12:17     ` Chanho Park
  2022-05-20 12:58       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 11+ messages in thread
From: Chanho Park @ 2022-05-20 12:17 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree,
	Chanho Park

Adds two cpu watchdog devices for ExynosAutov9 SoC.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
index 3e23db8f09d9..34be955dc2d5 100644
--- a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
@@ -400,6 +400,28 @@ ufs_0: ufs0@17e00000 {
 			samsung,sysreg = <&syscon_fsys2 0x710>;
 			status = "disabled";
 		};
+
+		watchdog_cl0: watchdog@10050000 {
+			compatible = "samsung,exynosautov9-wdt";
+			reg = <0x10050000 0x100>;
+			interrupts = <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cmu_peris CLK_GOUT_WDT_CLUSTER0>, <&xtcxo>;
+			clock-names = "watchdog", "watchdog_src";
+			samsung,syscon-phandle = <&pmu_system_controller>;
+			samsung,cluster-index = <0>;
+			status = "disabled";
+		};
+
+		watchdog_cl1: watchdog@10060000 {
+			compatible = "samsung,exynosautov9-wdt";
+			reg = <0x10060000 0x100>;
+			interrupts = <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cmu_peris CLK_GOUT_WDT_CLUSTER1>, <&xtcxo>;
+			clock-names = "watchdog", "watchdog_src";
+			samsung,syscon-phandle = <&pmu_system_controller>;
+			samsung,cluster-index = <1>;
+			status = "disabled";
+		};
 	};
 };
 
-- 
2.36.1


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

* [PATCH 4/4] arm64: dts: exynosautov9-sadk: enable watchdog devices
       [not found]   ` <CGME20220520121722epcas2p460fce9626fe2b4a857925704e2ea5ba1@epcas2p4.samsung.com>
@ 2022-05-20 12:17     ` Chanho Park
  0 siblings, 0 replies; 11+ messages in thread
From: Chanho Park @ 2022-05-20 12:17 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Krzysztof Kozlowski, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree,
	Chanho Park

Enables two watchdog devices for exynosautov9-sadk board.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts b/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts
index 17e568853eb6..ef0285262c84 100644
--- a/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts
+++ b/arch/arm64/boot/dts/exynos/exynosautov9-sadk.dts
@@ -62,3 +62,11 @@ &usi_0 {
 &xtcxo {
 	clock-frequency = <26000000>;
 };
+
+&watchdog_cl0 {
+	status = "okay";
+};
+
+&watchdog_cl1 {
+	status = "okay";
+};
-- 
2.36.1


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

* Re: [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible
  2022-05-20 12:17     ` [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible Chanho Park
@ 2022-05-20 12:52       ` Krzysztof Kozlowski
  2022-09-25 17:04       ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-20 12:52 UTC (permalink / raw)
  To: Chanho Park, Wim Van Sebroeck, Guenter Roeck, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree

On 20/05/2022 14:17, Chanho Park wrote:
> Adds "samsung,exynosautov9-wdt" to samsung-wdt compatible. This has two
> cpu watchdogs like exynos850.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* Re: [PATCH 3/4] arm64: dts: exynosautov9: add watchdog DT nodes
  2022-05-20 12:17     ` [PATCH 3/4] arm64: dts: exynosautov9: add watchdog DT nodes Chanho Park
@ 2022-05-20 12:58       ` Krzysztof Kozlowski
  2022-05-23 11:30         ` Chanho Park
  0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-20 12:58 UTC (permalink / raw)
  To: Chanho Park, Wim Van Sebroeck, Guenter Roeck, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree

On 20/05/2022 14:17, Chanho Park wrote:
> Adds two cpu watchdog devices for ExynosAutov9 SoC.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---
>  arch/arm64/boot/dts/exynos/exynosautov9.dtsi | 22 ++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> index 3e23db8f09d9..34be955dc2d5 100644
> --- a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> +++ b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> @@ -400,6 +400,28 @@ ufs_0: ufs0@17e00000 {
>  			samsung,sysreg = <&syscon_fsys2 0x710>;
>  			status = "disabled";
>  		};
> +
> +		watchdog_cl0: watchdog@10050000 {
> +			compatible = "samsung,exynosautov9-wdt";
> +			reg = <0x10050000 0x100>;
> +			interrupts = <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&cmu_peris CLK_GOUT_WDT_CLUSTER0>, <&xtcxo>;
> +			clock-names = "watchdog", "watchdog_src";
> +			samsung,syscon-phandle = <&pmu_system_controller>;
> +			samsung,cluster-index = <0>;
> +			status = "disabled";

Blocks which do not need board-level resources should be enabled by
default, so drop status and drop patch #4.

Best regards,
Krzysztof

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

* Re: [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog
  2022-05-20 12:17     ` [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog Chanho Park
@ 2022-05-20 13:01       ` Krzysztof Kozlowski
  2022-09-25 17:05       ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-20 13:01 UTC (permalink / raw)
  To: Chanho Park, Wim Van Sebroeck, Guenter Roeck, Rob Herring
  Cc: Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree

On 20/05/2022 14:17, Chanho Park wrote:

> @@ -644,9 +675,11 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
>  
>  		switch (index) {
>  		case 0:
> -			return &drv_data_exynos850_cl0;
> +			return variant;
>  		case 1:
> -			return &drv_data_exynos850_cl1;
> +			return (variant == &drv_data_exynos850_cl0) ?
> +				&drv_data_exynos850_cl1 :
> +				&drv_data_exynosautov9_cl1;

This stops scaling... it's fine now, but any next variant will require
some rework.


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* RE: [PATCH 3/4] arm64: dts: exynosautov9: add watchdog DT nodes
  2022-05-20 12:58       ` Krzysztof Kozlowski
@ 2022-05-23 11:30         ` Chanho Park
  0 siblings, 0 replies; 11+ messages in thread
From: Chanho Park @ 2022-05-23 11:30 UTC (permalink / raw)
  To: 'Krzysztof Kozlowski', 'Wim Van Sebroeck',
	'Guenter Roeck', 'Rob Herring'
  Cc: 'Sam Protsenko', linux-watchdog, linux-samsung-soc, devicetree

> > diff --git a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> > b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> > index 3e23db8f09d9..34be955dc2d5 100644
> > --- a/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> > +++ b/arch/arm64/boot/dts/exynos/exynosautov9.dtsi
> > @@ -400,6 +400,28 @@ ufs_0: ufs0@17e00000 {
> >  			samsung,sysreg = <&syscon_fsys2 0x710>;
> >  			status = "disabled";
> >  		};
> > +
> > +		watchdog_cl0: watchdog@10050000 {
> > +			compatible = "samsung,exynosautov9-wdt";
> > +			reg = <0x10050000 0x100>;
> > +			interrupts = <GIC_SPI 476 IRQ_TYPE_LEVEL_HIGH>;
> > +			clocks = <&cmu_peris CLK_GOUT_WDT_CLUSTER0>, <&xtcxo>;
> > +			clock-names = "watchdog", "watchdog_src";
> > +			samsung,syscon-phandle = <&pmu_system_controller>;
> > +			samsung,cluster-index = <0>;
> > +			status = "disabled";
> 
> Blocks which do not need board-level resources should be enabled by
> default, so drop status and drop patch #4.

Okay. They can be enabled as default. I'll drop the status and #4 patch as well.

Best Regards,
Chanho Park


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

* Re: [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible
  2022-05-20 12:17     ` [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible Chanho Park
  2022-05-20 12:52       ` Krzysztof Kozlowski
@ 2022-09-25 17:04       ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2022-09-25 17:04 UTC (permalink / raw)
  To: Chanho Park
  Cc: Wim Van Sebroeck, Krzysztof Kozlowski, Rob Herring,
	Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree

On Fri, May 20, 2022 at 09:17:47PM +0900, Chanho Park wrote:
> Adds "samsung,exynosautov9-wdt" to samsung-wdt compatible. This has two
> cpu watchdogs like exynos850.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml b/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
> index b08373336b16..8fb6656ba0c2 100644
> --- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
> @@ -23,6 +23,7 @@ properties:
>        - samsung,exynos5420-wdt                # for Exynos5420
>        - samsung,exynos7-wdt                   # for Exynos7
>        - samsung,exynos850-wdt                 # for Exynos850
> +      - samsung,exynosautov9-wdt              # for Exynosautov9
>  
>    reg:
>      maxItems: 1
> @@ -67,6 +68,7 @@ allOf:
>                - samsung,exynos5420-wdt
>                - samsung,exynos7-wdt
>                - samsung,exynos850-wdt
> +              - samsung,exynosautov9-wdt
>      then:
>        required:
>          - samsung,syscon-phandle
> @@ -76,6 +78,7 @@ allOf:
>            contains:
>              enum:
>                - samsung,exynos850-wdt
> +              - samsung,exynosautov9-wdt
>      then:
>        properties:
>          clocks:

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

* Re: [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog
  2022-05-20 12:17     ` [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog Chanho Park
  2022-05-20 13:01       ` Krzysztof Kozlowski
@ 2022-09-25 17:05       ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2022-09-25 17:05 UTC (permalink / raw)
  To: Chanho Park
  Cc: Wim Van Sebroeck, Krzysztof Kozlowski, Rob Herring,
	Sam Protsenko, linux-watchdog, linux-samsung-soc, devicetree

On Fri, May 20, 2022 at 09:17:48PM +0900, Chanho Park wrote:
> Like exynos850, exynosautov9 SoC also has two cpu watchdogs.
> Unfortunately, some configurations are slightly different so we need to
> add samsung,exynosautov9-wdt and separate drv data for those watchdogs.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/s3c2410_wdt.c | 41 ++++++++++++++++++++++++++++++----
>  1 file changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 6db22f2e3a4f..0dbb3ec9c29c 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -60,9 +60,13 @@
>  #define EXYNOS850_CLUSTER0_NONCPU_INT_EN	0x1244
>  #define EXYNOS850_CLUSTER1_NONCPU_OUT		0x1620
>  #define EXYNOS850_CLUSTER1_NONCPU_INT_EN	0x1644
> +#define EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT	0x1520
> +#define EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN	0x1544
>  
>  #define EXYNOS850_CLUSTER0_WDTRESET_BIT		24
>  #define EXYNOS850_CLUSTER1_WDTRESET_BIT		23
> +#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT	25
> +#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT	24
>  
>  /**
>   * DOC: Quirk flags for different Samsung watchdog IP-cores
> @@ -236,6 +240,30 @@ static const struct s3c2410_wdt_variant drv_data_exynos850_cl1 = {
>  		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
>  };
>  
> +static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl0 = {
> +	.mask_reset_reg = EXYNOS850_CLUSTER0_NONCPU_INT_EN,
> +	.mask_bit = 2,
> +	.mask_reset_inv = true,
> +	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
> +	.rst_stat_bit = EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT,
> +	.cnt_en_reg = EXYNOS850_CLUSTER0_NONCPU_OUT,
> +	.cnt_en_bit = 7,
> +	.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
> +		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
> +};
> +
> +static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
> +	.mask_reset_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN,
> +	.mask_bit = 2,
> +	.mask_reset_inv = true,
> +	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
> +	.rst_stat_bit = EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT,
> +	.cnt_en_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT,
> +	.cnt_en_bit = 7,
> +	.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
> +		  QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
> +};
> +
>  static const struct of_device_id s3c2410_wdt_match[] = {
>  	{ .compatible = "samsung,s3c2410-wdt",
>  	  .data = &drv_data_s3c2410 },
> @@ -249,6 +277,8 @@ static const struct of_device_id s3c2410_wdt_match[] = {
>  	  .data = &drv_data_exynos7 },
>  	{ .compatible = "samsung,exynos850-wdt",
>  	  .data = &drv_data_exynos850_cl0 },
> +	{ .compatible = "samsung,exynosautov9-wdt",
> +	  .data = &drv_data_exynosautov9_cl0 },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
> @@ -630,8 +660,9 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
>  	}
>  
>  #ifdef CONFIG_OF
> -	/* Choose Exynos850 driver data w.r.t. cluster index */
> -	if (variant == &drv_data_exynos850_cl0) {
> +	/* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */
> +	if (variant == &drv_data_exynos850_cl0 ||
> +	    variant == &drv_data_exynosautov9_cl0) {
>  		u32 index;
>  		int err;
>  
> @@ -644,9 +675,11 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
>  
>  		switch (index) {
>  		case 0:
> -			return &drv_data_exynos850_cl0;
> +			return variant;
>  		case 1:
> -			return &drv_data_exynos850_cl1;
> +			return (variant == &drv_data_exynos850_cl0) ?
> +				&drv_data_exynos850_cl1 :
> +				&drv_data_exynosautov9_cl1;
>  		default:
>  			dev_err(dev, "wrong cluster index: %u\n", index);
>  			return NULL;

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

end of thread, other threads:[~2022-09-25 17:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220520121722epcas2p371cb5e1300674a2aee017f857b60226c@epcas2p3.samsung.com>
2022-05-20 12:17 ` [PATCH 0/4] support watchdog for exynosautov9 Chanho Park
     [not found]   ` <CGME20220520121722epcas2p359f331c9276eeac5d027b0fe068296f1@epcas2p3.samsung.com>
2022-05-20 12:17     ` [PATCH 1/4] dt-bindings: watchdog: add exynosautov9 compatible Chanho Park
2022-05-20 12:52       ` Krzysztof Kozlowski
2022-09-25 17:04       ` Guenter Roeck
     [not found]   ` <CGME20220520121722epcas2p25b1d7b12db6030b490f191c2ae3e9f9d@epcas2p2.samsung.com>
2022-05-20 12:17     ` [PATCH 2/4] watchdog: s3c2410_wdt: support exynosautov9 watchdog Chanho Park
2022-05-20 13:01       ` Krzysztof Kozlowski
2022-09-25 17:05       ` Guenter Roeck
     [not found]   ` <CGME20220520121722epcas2p169b2669f367e7461fa41663f3e90d303@epcas2p1.samsung.com>
2022-05-20 12:17     ` [PATCH 3/4] arm64: dts: exynosautov9: add watchdog DT nodes Chanho Park
2022-05-20 12:58       ` Krzysztof Kozlowski
2022-05-23 11:30         ` Chanho Park
     [not found]   ` <CGME20220520121722epcas2p460fce9626fe2b4a857925704e2ea5ba1@epcas2p4.samsung.com>
2022-05-20 12:17     ` [PATCH 4/4] arm64: dts: exynosautov9-sadk: enable watchdog devices Chanho Park

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.