Skip to contentSkip to conversation

Additional IPQ4019 platform support

PATCH Applied Matthew McClintock 8 participants 50 messages Mar 23, 2016 – Mar 22, 2017

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

cover Additional IPQ4019 platform support

This series adds the following:

- Bugfixes for pinctrl for ipq4019
- Bugfixes for clk for ipq4019
- Watchdog chagnes for alternate register layouts
- Reset, SPI, I2C added to device trees
- cpufreq driver for ipq4019 and required device tree changes
- device tree changes for crypto
- device tree changes for using DMA with serial

Matthew McClintock (17):
pinctrl: qcom: ipq4019: set ngpios to correct value
pinctrl: qcom: ipq4019: fix the function enum for gpio mode
pinctrl: qcom: ipq4019: fix register offsets
clk: qcom: ipq4019: switch remaining defines to enums
clk: qcom: ipq4019: add some fixed clocks for ddrppl and fepll
watchdog: qcom: update device tree bindings
watchdog: qcom: add option for standalone watchdog not in timer block
watchdog: qcom: configure BARK time in addition to BITE time
watchdog: qcom: add kpss-standalone to device tree binding
qcom: ipq4019: add watchdog node to ipq4019 SoC and DK01 device tree
qcom: ipq4019: add support for reset via qcom,ps-hold
qcom: ipq4019: add spi node to ipq4019 SoC and DK01 device tree
qcom: ipq4019: add i2c node to ipq4019 SoC and DK01 device tree
cpufreq: ipq4019: add cpufreq driver
qcom: ipq4019: add cpu operating points for cpufreq support
qcom: ipq4019: add crypto nodes to ipq4019 SoC and DK01 device tree
qcom: ipq4019: add DMA nodes to ipq4019 SoC and DK01 device tree

 .../devicetree/bindings/watchdog/qcom-wdt.txt      |  6 +-
 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi      | 53 +++++++++++++
 arch/arm/boot/dts/qcom-ipq4019.dtsi                | 92 ++++++++++++++++++++++
 drivers/clk/qcom/gcc-ipq4019.c                     | 70 ++++++++--------
 drivers/cpufreq/Kconfig.arm                        |  9 +++
 drivers/cpufreq/Makefile                           |  1 +
 drivers/cpufreq/ipq4019-cpufreq.c                  | 35 ++++++++
 drivers/pinctrl/qcom/pinctrl-ipq4019.c             | 14 ++--
 drivers/watchdog/qcom-wdt.c                        | 74 ++++++++++++-----
 9 files changed, 289 insertions(+), 65 deletions(-)
 create mode 100644 drivers/cpufreq/ipq4019-cpufreq.c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 1/17 pinctrl: qcom: ipq4019: set ngpios to correct value

This should have been bumped to 100 when the extra pins were added in the original pinctrl patch

---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +1 -1
index b5d81ce..cb5f0a8 100644
@@ -414,7 +414,7 @@ static const struct msm_pinctrl_soc_data ipq4019_pinctrl = {
 	.nfunctions = ARRAY_SIZE(ipq4019_functions),
 	.groups = ipq4019_groups,
 	.ngroups = ARRAY_SIZE(ipq4019_groups),
-	.ngpios = 70,
+	.ngpios = 100,
 };
 
 static int ipq4019_pinctrl_probe(struct platform_device *pdev)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on v1 1/17
#2 lore raw

Re: [PATCH 01/17] pinctrl: qcom: ipq4019: set ngpios to correct value

Quoted 4 lines · Matthew McClintock

This should have been bumped to 100 when the extra pins were added in the original pinctrl patch

Sorry for missing this in the initial review of this driver.

Regards,
Bjorn

Quoted 22 lines
---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +1 -1
index b5d81ce..cb5f0a8 100644
@@ -414,7 +414,7 @@ static const struct msm_pinctrl_soc_data ipq4019_pinctrl = {
 	.nfunctions = ARRAY_SIZE(ipq4019_functions),
 	.groups = ipq4019_groups,
 	.ngroups = ARRAY_SIZE(ipq4019_groups),
-	.ngpios = 70,
+	.ngpios = 100,
 };
 
 static int ipq4019_pinctrl_probe(struct platform_device *pdev)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

Re: [PATCH 01/17] pinctrl: qcom: ipq4019: set ngpios to correct value

In reply to Matthew McClintock
Quoted 6 lines · Matthew McClintock

This should have been bumped to 100 when the extra pins were added in the original pinctrl patch

Patch applied for fixes with Björn's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 2/17 pinctrl: qcom: ipq4019: fix the function enum for gpio mode

In reply to Matthew McClintock

Without this, we would fail to set the mode to gpio if trying to configure for that mode

---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +1 -1
index cb5f0a8..cb9f16a 100644
@@ -237,7 +237,7 @@ DECLARE_QCA_GPIO_PINS(99);
 		.pins = gpio##id##_pins,		\
 		.npins = (unsigned)ARRAY_SIZE(gpio##id##_pins),	\
 		.funcs = (int[]){			\
-			qca_mux_NA, /* gpio mode */	\
+			qca_mux_gpio, /* gpio mode */	\
 			qca_mux_##f1,			\
 			qca_mux_##f2,			\
 			qca_mux_##f3,			\
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on v1 2/17
#5 lore raw

Re: [PATCH 02/17] pinctrl: qcom: ipq4019: fix the function enum for gpio mode

Quoted 4 lines · Matthew McClintock

Without this, we would fail to set the mode to gpio if trying to configure for that mode

Linus is the maintainer of the pinctrl subsystem, as such you should have him as recipient of these patches - so that he doesn't miss them while being only Cc.

Regards,
Bjorn

Quoted 22 lines
---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +1 -1
index cb5f0a8..cb9f16a 100644
@@ -237,7 +237,7 @@ DECLARE_QCA_GPIO_PINS(99);
 		.pins = gpio##id##_pins,		\
 		.npins = (unsigned)ARRAY_SIZE(gpio##id##_pins),	\
 		.funcs = (int[]){			\
-			qca_mux_NA, /* gpio mode */	\
+			qca_mux_gpio, /* gpio mode */	\
 			qca_mux_##f1,			\
 			qca_mux_##f2,			\
 			qca_mux_##f3,			\
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#6 lore raw

Re: [PATCH 02/17] pinctrl: qcom: ipq4019: fix the function enum for gpio mode

In reply to Matthew McClintock
Quoted 6 lines · Matthew McClintock

Without this, we would fail to set the mode to gpio if trying to configure for that mode

Patch applied for fixes with Björn's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

PATCH 3/17 pinctrl: qcom: ipq4019: fix register offsets

In reply to Matthew McClintock

For this SoC the register offsets changed from previous versions to be separated by a larger amount.

---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +5 -5
index cb9f16a..b68ae42 100644
@@ -254,11 +254,11 @@ DECLARE_QCA_GPIO_PINS(99);
 			qca_mux_##f14			\
 		},				        \
 		.nfuncs = 15,				\
-		.ctl_reg = 0x1000 + 0x10 * id,		\
-		.io_reg = 0x1004 + 0x10 * id,		\
-		.intr_cfg_reg = 0x1008 + 0x10 * id,	\
-		.intr_status_reg = 0x100c + 0x10 * id,	\
-		.intr_target_reg = 0x400 + 0x4 * id,	\
+		.ctl_reg = 0x0 + 0x1000 * id,		\
+		.io_reg = 0x4 + 0x1000 * id,		\
+		.intr_cfg_reg = 0x8 + 0x1000 * id,	\
+		.intr_status_reg = 0xc + 0x1000 * id,	\
+		.intr_target_reg = 0x8 + 0x1000 * id,	\
 		.mux_bit = 2,			\
 		.pull_bit = 0,			\
 		.drv_bit = 6,			\
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on v1 3/17
#8 lore raw

Re: [PATCH 03/17] pinctrl: qcom: ipq4019: fix register offsets

Quoted 4 lines · Matthew McClintock

For this SoC the register offsets changed from previous versions to be separated by a larger amount.

So the HW guys changed the register layout of the TLMM block? Matches the layout of contemporary MSMs, so I see no problems with this.

Regards,
Bjorn

Quoted 30 lines
---
 drivers/pinctrl/qcom/pinctrl-ipq4019.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pinctrl/qcom/pinctrl-ipq4019.c +5 -5
index cb9f16a..b68ae42 100644
@@ -254,11 +254,11 @@ DECLARE_QCA_GPIO_PINS(99);
 			qca_mux_##f14			\
 		},				        \
 		.nfuncs = 15,				\
-		.ctl_reg = 0x1000 + 0x10 * id,		\
-		.io_reg = 0x1004 + 0x10 * id,		\
-		.intr_cfg_reg = 0x1008 + 0x10 * id,	\
-		.intr_status_reg = 0x100c + 0x10 * id,	\
-		.intr_target_reg = 0x400 + 0x4 * id,	\
+		.ctl_reg = 0x0 + 0x1000 * id,		\
+		.io_reg = 0x4 + 0x1000 * id,		\
+		.intr_cfg_reg = 0x8 + 0x1000 * id,	\
+		.intr_status_reg = 0xc + 0x1000 * id,	\
+		.intr_target_reg = 0x8 + 0x1000 * id,	\
 		.mux_bit = 2,			\
 		.pull_bit = 0,			\
 		.drv_bit = 6,			\
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#10 lore raw

PATCH 4/17 clk: qcom: ipq4019: switch remaining defines to enums

In reply to Matthew McClintock

When this was added not all the remaining defines were switched over to use enums, so let's complete that process here

---
 drivers/clk/qcom/gcc-ipq4019.c | 60 ++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 35 deletions(-)
drivers/clk/qcom/gcc-ipq4019.c +25 -35
index 21def7f..38ada8d 100644
@@ -129,20 +129,10 @@ static const char * const gcc_xo_ddr_500_200[] = {
 };
 
 #define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
-#define P_XO 0
-#define FE_PLL_200 1
-#define FE_PLL_500 2
-#define DDRC_PLL_666  3
-
-#define DDRC_PLL_666_SDCC  1
-#define FE_PLL_125_DLY 1
-
-#define FE_PLL_WCSS2G 1
-#define FE_PLL_WCSS5G 1
 
 static const struct freq_tbl ftbl_gcc_audio_pwm_clk[] = {
 	F(48000000, P_XO, 1, 0, 0),
-	F(200000000, FE_PLL_200, 1, 0, 0),
+	F(200000000, P_FEPLL200, 1, 0, 0),
 	{ }
 };
 
@@ -334,15 +324,15 @@ static struct clk_branch gcc_blsp1_qup2_spi_apps_clk = {
 };
 
 static const struct freq_tbl ftbl_gcc_blsp1_uart1_2_apps_clk[] = {
-	F(1843200, FE_PLL_200, 1, 144, 15625),
-	F(3686400, FE_PLL_200, 1, 288, 15625),
-	F(7372800, FE_PLL_200, 1, 576, 15625),
-	F(14745600, FE_PLL_200, 1, 1152, 15625),
-	F(16000000, FE_PLL_200, 1, 2, 25),
+	F(1843200, P_FEPLL200, 1, 144, 15625),
+	F(3686400, P_FEPLL200, 1, 288, 15625),
+	F(7372800, P_FEPLL200, 1, 576, 15625),
+	F(14745600, P_FEPLL200, 1, 1152, 15625),
+	F(16000000, P_FEPLL200, 1, 2, 25),
 	F(24000000, P_XO, 1, 1, 2),
-	F(32000000, FE_PLL_200, 1, 4, 25),
-	F(40000000, FE_PLL_200, 1, 1, 5),
-	F(46400000, FE_PLL_200, 1, 29, 125),
+	F(32000000, P_FEPLL200, 1, 4, 25),
+	F(40000000, P_FEPLL200, 1, 1, 5),
+	F(46400000, P_FEPLL200, 1, 29, 125),
 	F(48000000, P_XO, 1, 0, 0),
 	{ }
 };
@@ -410,9 +400,9 @@ static struct clk_branch gcc_blsp1_uart2_apps_clk = {
 };
 
 static const struct freq_tbl ftbl_gcc_gp_clk[] = {
-	F(1250000,  FE_PLL_200, 1, 16, 0),
-	F(2500000,  FE_PLL_200, 1,  8, 0),
-	F(5000000,  FE_PLL_200, 1,  4, 0),
+	F(1250000,  P_FEPLL200, 1, 16, 0),
+	F(2500000,  P_FEPLL200, 1,  8, 0),
+	F(5000000,  P_FEPLL200, 1,  4, 0),
 	{ }
 };
 
@@ -512,11 +502,11 @@ static struct clk_branch gcc_gp3_clk = {
 static const struct freq_tbl ftbl_gcc_sdcc1_apps_clk[] = {
 	F(144000,    P_XO,			1,  3, 240),
 	F(400000,    P_XO,			1,  1, 0),
-	F(20000000,  FE_PLL_500,		1,  1, 25),
-	F(25000000,  FE_PLL_500,		1,  1, 20),
-	F(50000000,  FE_PLL_500,		1,  1, 10),
-	F(100000000, FE_PLL_500,		1,  1, 5),
-	F(193000000, DDRC_PLL_666_SDCC,		1,  0, 0),
+	F(20000000,  P_FEPLL500,		1,  1, 25),
+	F(25000000,  P_FEPLL500,		1,  1, 20),
+	F(50000000,  P_FEPLL500,		1,  1, 10),
+	F(100000000, P_FEPLL500,		1,  1, 5),
+	F(193000000, P_DDRPLL,		1,  0, 0),
 	{ }
 };
 
@@ -536,9 +526,9 @@ static struct clk_rcg2  sdcc1_apps_clk_src = {
 
 static const struct freq_tbl ftbl_gcc_apps_clk[] = {
 	F(48000000, P_XO,	   1, 0, 0),
-	F(200000000, FE_PLL_200,   1, 0, 0),
-	F(500000000, FE_PLL_500,   1, 0, 0),
-	F(626000000, DDRC_PLL_666, 1, 0, 0),
+	F(200000000, P_FEPLL200,   1, 0, 0),
+	F(500000000, P_FEPLL500,   1, 0, 0),
+	F(626000000, P_DDRPLLAPSS, 1, 0, 0),
 	{ }
 };
 
@@ -557,7 +547,7 @@ static struct clk_rcg2 apps_clk_src = {
 
 static const struct freq_tbl ftbl_gcc_apps_ahb_clk[] = {
 	F(48000000, P_XO,	   1, 0, 0),
-	F(100000000, FE_PLL_200,   2, 0, 0),
+	F(100000000, P_FEPLL200,   2, 0, 0),
 	{ }
 };
 
@@ -941,7 +931,7 @@ static struct clk_branch gcc_usb2_mock_utmi_clk = {
 };
 
 static const struct freq_tbl ftbl_gcc_usb30_mock_utmi_clk[] = {
-	F(2000000, FE_PLL_200, 10, 0, 0),
+	F(2000000, P_FEPLL200, 10, 0, 0),
 	{ }
 };
 
@@ -1008,7 +998,7 @@ static struct clk_branch gcc_usb3_mock_utmi_clk = {
 };
 
 static const struct freq_tbl ftbl_gcc_fephy_dly_clk[] = {
-	F(125000000, FE_PLL_125_DLY, 1, 0, 0),
+	F(125000000, P_FEPLL125DLY, 1, 0, 0),
 	{ }
 };
 
@@ -1028,7 +1018,7 @@ static struct clk_rcg2 fephy_125m_dly_clk_src = {
 
 static const struct freq_tbl ftbl_gcc_wcss2g_clk[] = {
 	F(48000000, P_XO, 1, 0, 0),
-	F(250000000, FE_PLL_WCSS2G, 1, 0, 0),
+	F(250000000, P_FEPLLWCSS2G, 1, 0, 0),
 	{ }
 };
 
@@ -1098,7 +1088,7 @@ static struct clk_branch gcc_wcss2g_rtc_clk = {
 
 static const struct freq_tbl ftbl_gcc_wcss5g_clk[] = {
 	F(48000000, P_XO, 1, 0, 0),
-	F(250000000, FE_PLL_WCSS5G, 1, 0, 0),
+	F(250000000, P_FEPLLWCSS5G, 1, 0, 0),
 	{ }
 };
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Applied
#11 lore raw

Re: [PATCH 04/17] clk: qcom: ipq4019: switch remaining defines to enums

Quoted 6 lines · Matthew McClintock

When this was added not all the remaining defines were switched over to use enums, so let's complete that process here

---

Applied to clk-fixes

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#12 lore raw

PATCH 5/17 clk: qcom: ipq4019: add some fixed clocks for ddrppl and fepll

In reply to Matthew McClintock

Drivers for these don't exist yet so we will add them as fixed clocks so we don't BUG() if we change clocks that reference these clocks.

---
 drivers/clk/qcom/gcc-ipq4019.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/clk/qcom/gcc-ipq4019.c +10 -0
index 38ada8d..f0b0a5a 100644
@@ -1316,6 +1316,16 @@ MODULE_DEVICE_TABLE(of, gcc_ipq4019_match_table);
 
 static int gcc_ipq4019_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
+
+	clk_register_fixed_rate(dev, "fepll125", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "fepll125dly", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "fepllwcss2g", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "fepllwcss5g", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "fepll200", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "fepll500", "xo", 0, 200000000);
+	clk_register_fixed_rate(dev, "ddrpllapss", "xo", 0, 666000000);
+
 	return qcom_cc_probe(pdev, &gcc_ipq4019_desc);
 }
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Applied
#13 lore raw

Re: [PATCH 05/17] clk: qcom: ipq4019: add some fixed clocks for ddrppl and fepll

Quoted 5 lines · Matthew McClintock

Drivers for these don't exist yet so we will add them as fixed clocks so we don't BUG() if we change clocks that reference these clocks.

---

Applied to clk-fixes

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#14 lore raw

PATCH 6/17 watchdog: qcom: update device tree bindings

In reply to Matthew McClintock

Update the compatible string to align with driver

---
 Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +2 -3
index 4726924..60bb2f98 100644
@@ -4,9 +4,8 @@ Qualcomm Krait Processor Sub-system (KPSS) Watchdog
 Required properties :
 - compatible : shall contain only one of the following:
 
-			"qcom,kpss-wdt-msm8960"
-			"qcom,kpss-wdt-apq8064"
-			"qcom,kpss-wdt-ipq8064"
+			"qcom,kpss-timer"
+			"qcom,scss-timer"
 
 - reg : shall contain base register location and length
 - clocks : shall contain the input clock
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#15 lore raw

Re: [PATCH 06/17] watchdog: qcom: update device tree bindings

Quoted 4 lines · Matthew McClintock

Update the compatible string to align with driver

I had a patch similar to this before
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-February/325235.html

Quoted 10 lines
---
 Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 4726924..60bb2f98 100644
@@ -4,9 +4,8 @@ Qualcomm Krait Processor Sub-system (KPSS) Watchdog
 Required properties :

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Qualcomm Krait Processor Sub-system (KPSS) Watchdog · line 11

Quoted 10 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +2 -3
 - compatible : shall contain only one of the following:
 
-			"qcom,kpss-wdt-msm8960"
-			"qcom,kpss-wdt-apq8064"
-			"qcom,kpss-wdt-ipq8064"
+			"qcom,kpss-timer"
+			"qcom,scss-timer"
 
 - reg : shall contain base register location and length
 - clocks : shall contain the input clock

No example update?

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#17 lore raw

Re: [PATCH 06/17] watchdog: qcom: update device tree bindings

In reply to Matthew McClintock
Quoted 13 lines · Matthew McClintock

Update the compatible string to align with driver

---
 Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 4726924..60bb2f98 100644

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Qualcomm Krait Processor Sub-system (KPSS) Watchdog · line 8

Quoted 8 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +2 -3
@@ -4,9 +4,8 @@ Qualcomm Krait Processor Sub-system (KPSS) Watchdog
 Required properties :
 - compatible : shall contain only one of the following:
 
-			"qcom,kpss-wdt-msm8960"
-			"qcom,kpss-wdt-apq8064"
-			"qcom,kpss-wdt-ipq8064"
+			"qcom,kpss-timer"
+			"qcom,scss-timer"

Keep the SoC specific ones even if they are not used. The DTS should have both strings.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#18 lore raw

PATCH 7/17 watchdog: qcom: add option for standalone watchdog not in timer block

In reply to Matthew McClintock

Commit 0dfd582e026a ("watchdog: qcom: use timer devicetree binding") moved to use the watchdog as a subset timer register block. Some devices have the watchdog completely standalone with slightly different register offsets as well so let's account for the differences here.

---
 drivers/watchdog/qcom-wdt.c | 69 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 20 deletions(-)
drivers/watchdog/qcom-wdt.c +49 -20
index 20563cc..e46f18d 100644
@@ -19,17 +19,37 @@
 #include <linux/platform_device.h>
 #include <linux/watchdog.h>
 
-#define WDT_RST		0x38
-#define WDT_EN		0x40
-#define WDT_BITE_TIME	0x5C
+enum wdt_reg {
+	WDT_RST,
+	WDT_EN,
+	WDT_BITE_TIME,
+};
+
+static const u32 reg_offset_data_apcs_tmr[] = {
+	[WDT_RST] = 0x38,
+	[WDT_EN] = 0x40,
+	[WDT_BITE_TIME] = 0x5C,
+};
+
+static const u32 reg_offset_data_kpss[] = {
+	[WDT_RST] = 0x4,
+	[WDT_EN] = 0x8,
+	[WDT_BITE_TIME] = 0x14,
+};
 
 struct qcom_wdt {
 	struct watchdog_device	wdd;
 	struct clk		*clk;
 	unsigned long		rate;
 	void __iomem		*base;
+	const u32		*layout;
 };
 
+static void __iomem *wdt_addr(struct qcom_wdt *wdt, enum wdt_reg reg)
+{
+	return wdt->base + wdt->layout[reg];
+}
+
 static inline
 struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd)
 {
@@ -40,10 +60,10 @@ static int qcom_wdt_start(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(0, wdt->base + WDT_EN);
-	writel(1, wdt->base + WDT_RST);
-	writel(wdd->timeout * wdt->rate, wdt->base + WDT_BITE_TIME);
-	writel(1, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
+	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME));
+	writel(1, wdt_addr(wdt, WDT_EN));
 	return 0;
 }
 
@@ -51,7 +71,7 @@ static int qcom_wdt_stop(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(0, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
 	return 0;
 }
 
@@ -59,7 +79,7 @@ static int qcom_wdt_ping(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(1, wdt->base + WDT_RST);
+	writel(1, wdt_addr(wdt, WDT_RST));
 	return 0;
 }
 
@@ -82,10 +102,10 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
 	 */
 	timeout = 128 * wdt->rate / 1000;
 
-	writel(0, wdt->base + WDT_EN);
-	writel(1, wdt->base + WDT_RST);
-	writel(timeout, wdt->base + WDT_BITE_TIME);
-	writel(1, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
+	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(timeout, wdt_addr(wdt, WDT_BITE_TIME));
+	writel(1, wdt_addr(wdt, WDT_EN));
 
 	/*
 	 * Actually make sure the above sequence hits hardware before sleeping.
@@ -112,14 +132,29 @@ static const struct watchdog_info qcom_wdt_info = {
 	.identity	= KBUILD_MODNAME,
 };
 
+static const struct of_device_id qcom_wdt_of_table[] = {
+	{ .compatible = "qcom,kpss-timer", .data = reg_offset_data_apcs_tmr },
+	{ .compatible = "qcom,scss-timer", .data = reg_offset_data_apcs_tmr },
+	{ .compatible = "qcom,kpss-standalone", .data = &reg_offset_data_kpss},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
+
 static int qcom_wdt_probe(struct platform_device *pdev)
 {
 	struct qcom_wdt *wdt;
 	struct resource *res;
 	struct device_node *np = pdev->dev.of_node;
+	const struct of_device_id *match;
 	u32 percpu_offset;
 	int ret;
 
+	match = of_match_node(qcom_wdt_of_table, np);
+	if (!match) {
+		dev_err(&pdev->dev, "Unsupported QCOM WDT module\n");
+		return -ENODEV;
+	}
+
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
 	if (!wdt)
 		return -ENOMEM;
@@ -170,6 +205,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
 	wdt->wdd.parent = &pdev->dev;
+	wdt->layout = match->data;
 
 	/*
 	 * If 'timeout-sec' unspecified in devicetree, assume a 30 second
@@ -202,13 +238,6 @@ static int qcom_wdt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id qcom_wdt_of_table[] = {
-	{ .compatible = "qcom,kpss-timer" },
-	{ .compatible = "qcom,scss-timer" },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
-
 static struct platform_driver qcom_watchdog_driver = {
 	.probe	= qcom_wdt_probe,
 	.remove	= qcom_wdt_remove,
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#19 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

drivers/watchdog/qcom-wdt.c static int qcom_wdt_remove(struct platform_device *pdev) · line 211

Quoted 11 lines · Matthew McClintock
drivers/watchdog/qcom-wdt.c +0 -7
@@ -202,13 +238,6 @@ static int qcom_wdt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id qcom_wdt_of_table[] = {
-	{ .compatible = "qcom,kpss-timer" },
-	{ .compatible = "qcom,scss-timer" },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
-

Leave this here and use of_device_get_match_data() in probe instead.

Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#20 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

In reply to Matthew McClintock
Quoted 26 lines · Matthew McClintock

Commit 0dfd582e026a ("watchdog: qcom: use timer devicetree binding") moved to use the watchdog as a subset timer register block. Some devices have the watchdog completely standalone with slightly different register offsets as well so let's account for the differences here.

---
 drivers/watchdog/qcom-wdt.c | 69 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 49 insertions(+), 20 deletions(-)
drivers/watchdog/qcom-wdt.c +5 -3
index 20563cc..e46f18d 100644
@@ -19,17 +19,37 @@
 #include <linux/platform_device.h>
 #include <linux/watchdog.h>
 
-#define WDT_RST		0x38
-#define WDT_EN		0x40
-#define WDT_BITE_TIME	0x5C
+enum wdt_reg {
+	WDT_RST,
+	WDT_EN,
+	WDT_BITE_TIME,
+};

drivers/watchdog/qcom-wdt.c line 36

Quoted 10 lines
drivers/watchdog/qcom-wdt.c +10 -0
+
+static const u32 reg_offset_data_apcs_tmr[] = {
+	[WDT_RST] = 0x38,
+	[WDT_EN] = 0x40,
+	[WDT_BITE_TIME] = 0x5C,
+};
+
+static const u32 reg_offset_data_kpss[] = {
+	[WDT_RST] = 0x4,
+	[WDT_EN] = 0x8,

Does this work ? In the datasheet I have in front of me (APQ8064), the watchdog at this address uses different bits. At address 0x40 (eg GSS_A5_APCS_WDT0_EN), bit 0 is the enable bit, and bit 1 enables interrupts. At address 0x08 (eg LPASS_QDSP6SS_WDOG_UNMASKED_INT_EN), bit 0 enables interrupts and bit 1 is undefined. Or does "qcom,kpss-standalone" refer to some other watchdog ?

Thanks,
Guenter

Quoted 123 lines
drivers/watchdog/qcom-wdt.c +34 -17
+	[WDT_BITE_TIME] = 0x14,
+};
 
 struct qcom_wdt {
 	struct watchdog_device	wdd;
 	struct clk		*clk;
 	unsigned long		rate;
 	void __iomem		*base;
+	const u32		*layout;
 };
 
+static void __iomem *wdt_addr(struct qcom_wdt *wdt, enum wdt_reg reg)
+{
+	return wdt->base + wdt->layout[reg];
+}
+
 static inline
 struct qcom_wdt *to_qcom_wdt(struct watchdog_device *wdd)
 {
@@ -40,10 +60,10 @@ static int qcom_wdt_start(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(0, wdt->base + WDT_EN);
-	writel(1, wdt->base + WDT_RST);
-	writel(wdd->timeout * wdt->rate, wdt->base + WDT_BITE_TIME);
-	writel(1, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
+	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME));
+	writel(1, wdt_addr(wdt, WDT_EN));
 	return 0;
 }
 
@@ -51,7 +71,7 @@ static int qcom_wdt_stop(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(0, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
 	return 0;
 }
 
@@ -59,7 +79,7 @@ static int qcom_wdt_ping(struct watchdog_device *wdd)
 {
 	struct qcom_wdt *wdt = to_qcom_wdt(wdd);
 
-	writel(1, wdt->base + WDT_RST);
+	writel(1, wdt_addr(wdt, WDT_RST));
 	return 0;
 }
 
@@ -82,10 +102,10 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
 	 */
 	timeout = 128 * wdt->rate / 1000;
 
-	writel(0, wdt->base + WDT_EN);
-	writel(1, wdt->base + WDT_RST);
-	writel(timeout, wdt->base + WDT_BITE_TIME);
-	writel(1, wdt->base + WDT_EN);
+	writel(0, wdt_addr(wdt, WDT_EN));
+	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(timeout, wdt_addr(wdt, WDT_BITE_TIME));
+	writel(1, wdt_addr(wdt, WDT_EN));
 
 	/*
 	 * Actually make sure the above sequence hits hardware before sleeping.
@@ -112,14 +132,29 @@ static const struct watchdog_info qcom_wdt_info = {
 	.identity	= KBUILD_MODNAME,
 };
 
+static const struct of_device_id qcom_wdt_of_table[] = {
+	{ .compatible = "qcom,kpss-timer", .data = reg_offset_data_apcs_tmr },
+	{ .compatible = "qcom,scss-timer", .data = reg_offset_data_apcs_tmr },
+	{ .compatible = "qcom,kpss-standalone", .data = &reg_offset_data_kpss},
+	{ },
+};
+MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
+
 static int qcom_wdt_probe(struct platform_device *pdev)
 {
 	struct qcom_wdt *wdt;
 	struct resource *res;
 	struct device_node *np = pdev->dev.of_node;
+	const struct of_device_id *match;
 	u32 percpu_offset;
 	int ret;
 
+	match = of_match_node(qcom_wdt_of_table, np);
+	if (!match) {
+		dev_err(&pdev->dev, "Unsupported QCOM WDT module\n");
+		return -ENODEV;
+	}
+
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
 	if (!wdt)
 		return -ENOMEM;
@@ -170,6 +205,7 @@ static int qcom_wdt_probe(struct platform_device *pdev)
 	wdt->wdd.min_timeout = 1;
 	wdt->wdd.max_timeout = 0x10000000U / wdt->rate;
 	wdt->wdd.parent = &pdev->dev;
+	wdt->layout = match->data;
 
 	/*
 	 * If 'timeout-sec' unspecified in devicetree, assume a 30 second
@@ -202,13 +238,6 @@ static int qcom_wdt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id qcom_wdt_of_table[] = {
-	{ .compatible = "qcom,kpss-timer" },
-	{ .compatible = "qcom,scss-timer" },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, qcom_wdt_of_table);
-
 static struct platform_driver qcom_watchdog_driver = {
 	.probe	= qcom_wdt_probe,
 	.remove	= qcom_wdt_remove,
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

Quoted 16 lines · Guenter Roeck
Quoted 14 lines
drivers/watchdog/qcom-wdt.c +10 -3
-#define WDT_RST		0x38
-#define WDT_EN		0x40
-#define WDT_BITE_TIME	0x5C
+enum wdt_reg {
+	WDT_RST,
+	WDT_EN,
+	WDT_BITE_TIME,
+};
+
+static const u32 reg_offset_data_apcs_tmr[] = {
+	[WDT_RST] = 0x38,
+	[WDT_EN] = 0x40,
+	[WDT_BITE_TIME] = 0x5C,
Quoted 8 lines

drivers/watchdog/qcom-wdt.c line 36

Quoted 5 lines
drivers/watchdog/qcom-wdt.c +5 -0
+};
+
+static const u32 reg_offset_data_kpss[] = {
+	[WDT_RST] = 0x4,
+	[WDT_EN] = 0x8,

Does this work ? In the datasheet I have in front of me (APQ8064), the watchdog at this address uses different bits. At address 0x40 (eg GSS_A5_APCS_WDT0_EN),

0x40 is acps_tmr, and looks fine.

Quoted 3 lines

bit 0 is the enable bit, and bit 1 enables interrupts. At address 0x08 (eg LPASS_QDSP6SS_WDOG_UNMASKED_INT_EN), bit 0 enables interrupts and bit 1 is undefined.

I honestly don’t see anything at 0x8 for either blocks that looks like this. For the new block bit 0 is enabling and bit 1 enabled interrupts.

Quoted 1 line

Or does "qcom,kpss-standalone" refer to some other watchdog ?

APQ8064 would be the apcs_tmr block variant which is unchanged. MSM8916 as well as IPQ4019 would use the new kpss variant.

I went with block names I found internally here, but I will be the first to admit I am terrible at names. The old block name for APQ was CPU0_ACPS_TMR (where really the watchdog is a subset of a timer block), and on the IPQ4019 it’s called APCS_KPSS_WDT and it’s really just a watchdog block.

I kept the same driver because the register’s currently in use were compatible. By the way, I tested this on an IPQ806x and IPQ4019 both new and old blocks.

Let me know if you need more details.

-M--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#22 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

Quoted 25 lines · Matthew McClintock
Quoted 16 lines · Guenter Roeck
Quoted 14 lines
drivers/watchdog/qcom-wdt.c +10 -3
-#define WDT_RST		0x38
-#define WDT_EN		0x40
-#define WDT_BITE_TIME	0x5C
+enum wdt_reg {
+	WDT_RST,
+	WDT_EN,
+	WDT_BITE_TIME,
+};
+
+static const u32 reg_offset_data_apcs_tmr[] = {
+	[WDT_RST] = 0x38,
+	[WDT_EN] = 0x40,
+	[WDT_BITE_TIME] = 0x5C,
Quoted 8 lines

drivers/watchdog/qcom-wdt.c line 36

Quoted 5 lines
drivers/watchdog/qcom-wdt.c +5 -0
+};
+
+static const u32 reg_offset_data_kpss[] = {
+	[WDT_RST] = 0x4,
+	[WDT_EN] = 0x8,

Does this work ? In the datasheet I have in front of me (APQ8064), the watchdog at this address uses different bits. At address 0x40 (eg GSS_A5_APCS_WDT0_EN),

Quoted 8 lines

0x40 is acps_tmr, and looks fine.

Quoted 3 lines

bit 0 is the enable bit, and bit 1 enables interrupts. At address 0x08 (eg LPASS_QDSP6SS_WDOG_UNMASKED_INT_EN), bit 0 enables interrupts and bit 1 is undefined.

I honestly don’t see anything at 0x8 for either blocks that looks like this. For the new block bit 0 is enabling and bit 1 enabled interrupts.

That is from the APQ8064 datasheet.

Quoted 4 lines
Quoted 1 line

Or does "qcom,kpss-standalone" refer to some other watchdog ?

APQ8064 would be the apcs_tmr block variant which is unchanged. MSM8916 as well as IPQ4019 would use the new kpss variant.

Unfortunately I don't have access to those datasheets.

Quoted 4 lines

I went with block names I found internally here, but I will be the first to admit I am terrible at names. The old block name for APQ was CPU0_ACPS_TMR (where really the watchdog is a subset of a timer block), and on the IPQ4019 it’s called APCS_KPSS_WDT and it’s really just a watchdog block.

I kept the same driver because the register’s currently in use were compatible. By the way, I tested this on an IPQ806x and IPQ4019 both new and old blocks.

The property name should probably be something like 'qcom,kpss-wdt' (or 'qcom,kpss-watchdog' ?), possibly in addition to 'qcom,kpss-ipq4019-wdt' and 'qcom,kpss-msm8916-wdt'.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

Quoted 8 lines · Guenter Roeck
Quoted 7 lines
Quoted 4 lines

bit 0 is the enable bit, and bit 1 enables interrupts. At address 0x08 (eg LPASS_QDSP6SS_WDOG_UNMASKED_INT_EN), bit 0 enables interrupts and bit 1 is undefined.

I honestly don’t see anything at 0x8 for either blocks that looks like this. For the new block bit 0 is enabling and bit 1 enabled interrupts.

That is from the APQ8064 datasheet.

So taken from the timer offset 0x0208A000 I just have a generic counter register CPU0_APCS_GPT0_CNT at 0x8

What doc are you looking at?

-M

maintainer
#24 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

Quoted 6 lines · Matthew McClintock
Quoted 5 lines · Guenter Roeck
Quoted 5 lines
Quoted 4 lines

bit 0 is the enable bit, and bit 1 enables interrupts. At address 0x08 (eg LPASS_QDSP6SS_WDOG_UNMASKED_INT_EN), bit 0 enables interrupts and bit 1 is undefined.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

I honestly don’t see anything at 0x8 for either blocks that looks like this. For the new block bit 0 is enabling and bit 1 enabled interrupts.

That is from the APQ8064 datasheet.

So taken from the timer offset 0x0208A000 I just have a generic counter register CPU0_APCS_GPT0_CNT at 0x8

What doc are you looking at?

"Qualcomm Snapdragon 600 Processor APQ8064 Hardware Register Description"

It is available for download from the Qualcomm web site.

See chapter 12.10.3, "Watchdog timer registers". The register block is at 0x28882000. Registers are almost the same, except for the offset and the definition of the bits in the enable register.

LPASS is "Low Power Audio Subsystem". Maybe it has its own watchdog.

Guenter

#25 lore raw

Re: [PATCH 07/17] watchdog: qcom: add option for standalone watchdog not in timer block

Quoted 7 lines · Guenter Roeck
Quoted 5 lines

So taken from the timer offset 0x0208A000 I just have a generic counter register CPU0_APCS_GPT0_CNT at 0x8

What doc are you looking at?

"Qualcomm Snapdragon 600 Processor APQ8064 Hardware Register Description"

Quoted 7 lines

It is available for download from the Qualcomm web site.

See chapter 12.10.3, "Watchdog timer registers". The register block is at 0x28882000. Registers are almost the same, except for the offset and the definition of the bits in the enable register.

LPASS is "Low Power Audio Subsystem". Maybe it has its own watchdog.

This block is here:

11.15 KPSS CPU0 Timer Registers (0x0208A000 CPU0_APCS_TMR_BASE)

-M--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#26 lore raw

PATCH 8/17 watchdog: qcom: configure BARK time in addition to BITE time

In reply to Matthew McClintock

For certain parts and some versions of TZ, TZ will reset the chip when a BARK is triggered even though it was not configured here. So by default let's configure this BARK time as well.

---
 drivers/watchdog/qcom-wdt.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/watchdog/qcom-wdt.c +5 -0
index e46f18d..53f57c3 100644
@@ -22,18 +22,21 @@
 enum wdt_reg {
 	WDT_RST,
 	WDT_EN,
+	WDT_BARK_TIME,
 	WDT_BITE_TIME,
 };
 
 static const u32 reg_offset_data_apcs_tmr[] = {
 	[WDT_RST] = 0x38,
 	[WDT_EN] = 0x40,
+	[WDT_BARK_TIME] = 0x4C,
 	[WDT_BITE_TIME] = 0x5C,
 };
 
 static const u32 reg_offset_data_kpss[] = {
 	[WDT_RST] = 0x4,
 	[WDT_EN] = 0x8,
+	[WDT_BARK_TIME] = 0x10,
 	[WDT_BITE_TIME] = 0x14,
 };
 
@@ -62,6 +65,7 @@ static int qcom_wdt_start(struct watchdog_device *wdd)
 
 	writel(0, wdt_addr(wdt, WDT_EN));
 	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME));
 	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME));
 	writel(1, wdt_addr(wdt, WDT_EN));
 	return 0;
@@ -104,6 +108,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
 
 	writel(0, wdt_addr(wdt, WDT_EN));
 	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(timeout, wdt_addr(wdt, WDT_BARK_TIME));
 	writel(timeout, wdt_addr(wdt, WDT_BITE_TIME));
 	writel(1, wdt_addr(wdt, WDT_EN));
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#27 lore raw

Re: [PATCH 08/17] watchdog: qcom: configure BARK time in addition to BITE time

Quoted 4 lines · Matthew McClintock

For certain parts and some versions of TZ, TZ will reset the chip when a BARK is triggered even though it was not configured here. So by default let's configure this BARK time as well.

Why isn't TZ configuring the bark time to what it wants? I'm lost why we have to do this for them.

Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#28 lore raw

Re: [PATCH 08/17] watchdog: qcom: configure BARK time in addition to BITE time

Quoted 9 lines · Stephen Boyd
Quoted 4 lines · Matthew McClintock

For certain parts and some versions of TZ, TZ will reset the chip when a BARK is triggered even though it was not configured here. So by default let's configure this BARK time as well.

Why isn't TZ configuring the bark time to what it wants? I'm lost why we have to do this for them.

So it was done like this to ensure we had a valid upgrade. The bootloader is using the watchdog to ensure the system is bootable and if not it will revert back to the working images.

Bottom line is, for some versions of TZ out there, if we enable watchdog coming out of boot the bark time is already configured by the boot loader and TZ is configured to intercept this interrupt and do some register saving (for crashdump) and we end up getting a watchdog reset during boot.

It’s even a little more complex, because in order for the TZ to save the registers you need to pad the BITE time a bit higher than the BARK time, but I was leaving that for another day.

-M

maintainer
#29 lore raw

Re: [PATCH 08/17] watchdog: qcom: configure BARK time in addition to BITE time

Quoted 8 lines · Matthew McClintock
Quoted 7 lines · Stephen Boyd
Quoted 4 lines · Matthew McClintock

For certain parts and some versions of TZ, TZ will reset the chip when a BARK is triggered even though it was not configured here. So by default let's configure this BARK time as well.

Quoted 9 lines
Quoted 2 lines

Why isn't TZ configuring the bark time to what it wants? I'm lost why we have to do this for them.

So it was done like this to ensure we had a valid upgrade. The bootloader is using the watchdog to ensure the system is bootable and if not it will revert back to the working images.

Bottom line is, for some versions of TZ out there, if we enable watchdog coming out of boot the bark time is already configured by the boot loader and TZ is configured to intercept this interrupt and do some register saving (for crashdump) and we end up getting a watchdog reset during boot.

It’s even a little more complex, because in order for the TZ to save the registers you need to pad the BITE time a bit higher than the BARK time, but I was leaving that for another day.

Sounds like an op[timal target for using pretimeout ?

Guenter

#30 lore raw

Re: [PATCH 08/17] watchdog: qcom: configure BARK time in addition to BITE time

Quoted 11 lines · Guenter Roeck
Quoted 10 lines
Quoted 3 lines

Why isn't TZ configuring the bark time to what it wants? I'm lost why we have to do this for them.

So it was done like this to ensure we had a valid upgrade. The bootloader is using the watchdog to ensure the system is bootable and if not it will revert back to the working images.

Bottom line is, for some versions of TZ out there, if we enable watchdog coming out of boot the bark time is already configured by the boot loader and TZ is configured to intercept this interrupt and do some register saving (for crashdump) and we end up getting a watchdog reset during boot.

It’s even a little more complex, because in order for the TZ to save the registers you need to pad the BITE time a bit higher than the BARK time, but I was leaving that for another day.

Sounds like an op[timal target for using pretimeout ?

So the bark is basically a pretimeout, sure I think that will work. We can configure it to be off by default.

Thanks for the heads up, I’ll take a look.

-M--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Reviewed-by on v1 8/17
#31 lore raw

Re: [PATCH 08/17] watchdog: qcom: configure BARK time in addition to BITE time

In reply to Matthew McClintock
Quoted 5 lines · Matthew McClintock

For certain parts and some versions of TZ, TZ will reset the chip when a BARK is triggered even though it was not configured here. So by default let's configure this BARK time as well.

Quoted 47 lines
---
  drivers/watchdog/qcom-wdt.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/watchdog/qcom-wdt.c +5 -0
index e46f18d..53f57c3 100644
@@ -22,18 +22,21 @@
  enum wdt_reg {
  	WDT_RST,
  	WDT_EN,
+	WDT_BARK_TIME,
  	WDT_BITE_TIME,
  };
 
  static const u32 reg_offset_data_apcs_tmr[] = {
  	[WDT_RST] = 0x38,
  	[WDT_EN] = 0x40,
+	[WDT_BARK_TIME] = 0x4C,
  	[WDT_BITE_TIME] = 0x5C,
  };
 
  static const u32 reg_offset_data_kpss[] = {
  	[WDT_RST] = 0x4,
  	[WDT_EN] = 0x8,
+	[WDT_BARK_TIME] = 0x10,
  	[WDT_BITE_TIME] = 0x14,
  };
 
@@ -62,6 +65,7 @@ static int qcom_wdt_start(struct watchdog_device *wdd)
 
  	writel(0, wdt_addr(wdt, WDT_EN));
  	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BARK_TIME));
  	writel(wdd->timeout * wdt->rate, wdt_addr(wdt, WDT_BITE_TIME));
  	writel(1, wdt_addr(wdt, WDT_EN));
  	return 0;
@@ -104,6 +108,7 @@ static int qcom_wdt_restart(struct watchdog_device *wdd, unsigned long action,
 
  	writel(0, wdt_addr(wdt, WDT_EN));
  	writel(1, wdt_addr(wdt, WDT_RST));
+	writel(timeout, wdt_addr(wdt, WDT_BARK_TIME));
  	writel(timeout, wdt_addr(wdt, WDT_BITE_TIME));
  	writel(1, wdt_addr(wdt, WDT_EN));
 
#32 lore raw

PATCH 9/17 watchdog: qcom: add kpss-standalone to device tree binding

In reply to Matthew McClintock

Update the compatible string to add new device tree binding

---
 Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +1 -0
index 60bb2f98..45b37cf 100644
@@ -6,6 +6,7 @@ Required properties :
 
 			"qcom,kpss-timer"
 			"qcom,scss-timer"
+			"qcom,kpss-standalone"
 
 - reg : shall contain base register location and length
 - clocks : shall contain the input clock
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#33 lore raw

Re: [PATCH 09/17] watchdog: qcom: add kpss-standalone to device tree binding

Quoted 13 lines · Matthew McClintock

Update the compatible string to add new device tree binding

---
 Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 60bb2f98..45b37cf 100644

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Required properties : · line 9

Quoted 4 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +1 -0
@@ -6,6 +6,7 @@ Required properties :
 
 			"qcom,kpss-timer"
 			"qcom,scss-timer"
+			"qcom,kpss-standalone"

What SoC(s) is this in. Use SoC specific compatible strings please.

Rob

#34 lore raw

Re: [PATCH 09/17] watchdog: qcom: add kpss-standalone to device tree binding

Quoted 16 lines · Rob Herring
Quoted 14 lines · Matthew McClintock

Update the compatible string to add new device tree binding

---
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 1 +

1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 60bb2f98..45b37cf 100644
@@ -6,6 +6,7 @@ Required properties :
 
Quoted 5 lines

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Required properties : · line 9

Quoted 3 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +1 -0
 			"qcom,kpss-timer"
 			"qcom,scss-timer"
+			"qcom,kpss-standalone"

What SoC(s) is this in. Use SoC specific compatible strings please.

So ipq4019 wins the race because we are the first to try to enable watchdog for this block?

qcom,kpss-ipq4019 ?

-M

maintainer
#35 lore raw

Re: [PATCH 09/17] watchdog: qcom: add kpss-standalone to device tree binding

Quoted 17 lines · Matthew McClintock
Quoted 16 lines · Rob Herring
Quoted 14 lines · Matthew McClintock

Update the compatible string to add new device tree binding

---
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 1 +

1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 60bb2f98..45b37cf 100644
@@ -6,6 +6,7 @@ Required properties :
 
Quoted 7 lines
Quoted 5 lines

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Required properties : · line 9

Quoted 3 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +1 -0
                     "qcom,kpss-timer"
                     "qcom,scss-timer"
+                    "qcom,kpss-standalone"

What SoC(s) is this in. Use SoC specific compatible strings please.

So ipq4019 wins the race because we are the first to try to enable watchdog for this block?

Yep, that's how it is supposed to work. Newer chips claim compatibility with older ones.

Quoted 1 line

qcom,kpss-ipq4019 ?

Yes, but generally <vendor>,<soc>-<block> is preferred order.

Rob

maintainer
#36 lore raw

Re: [PATCH 09/17] watchdog: qcom: add kpss-standalone to device tree binding

In reply to Matthew McClintock
Quoted 23 lines · Matthew McClintock
Quoted 16 lines · Rob Herring
Quoted 14 lines · Matthew McClintock

Update the compatible string to add new device tree binding

---
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt | 1 +

1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +0 -0
index 60bb2f98..45b37cf 100644
@@ -6,6 +6,7 @@ Required properties :
 
Quoted 5 lines

Documentation/devicetree/bindings/watchdog/qcom-wdt.txt Required properties : · line 9

Quoted 3 lines
Documentation/devicetree/bindings/watchdog/qcom-wdt.txt +1 -0
 			"qcom,kpss-timer"
 			"qcom,scss-timer"
+			"qcom,kpss-standalone"

What SoC(s) is this in. Use SoC specific compatible strings please.

Quoted 4 lines

So ipq4019 wins the race because we are the first to try to enable watchdog for this block?

qcom,kpss-ipq4019 ?

It is a dedicated watchdog block, isn't it ? "qcom,kpss-ipq4019" would not refer to a specific block. Devicetree maintainers may have a better idea, but it seems to me that there should be 'wdt' or 'watchdog' in the property name.

Guenter

#37 lore raw

Re: [PATCH 09/17] watchdog: qcom: add kpss-standalone to device tree binding

Quoted 11 lines · Guenter Roeck
Quoted 7 lines
Quoted 2 lines

What SoC(s) is this in. Use SoC specific compatible strings please.

So ipq4019 wins the race because we are the first to try to enable watchdog for this block?

qcom,kpss-ipq4019 ?

It is a dedicated watchdog block, isn't it ? "qcom,kpss-ipq4019" would not refer to a specific block. Devicetree maintainers may have a better idea, but it seems to me that there should be 'wdt' or 'watchdog' in the property name.

Sounds fine to me, if no one has any other comments I’ll use this one in the next spin of the patch.

-M--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#38 lore raw

PATCH 10/17 qcom: ipq4019: add watchdog node to ipq4019 SoC and DK01 device tree

In reply to Matthew McClintock

This will allow boards to enable watchdog support

---
 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi | 4 ++++
 arch/arm/boot/dts/qcom-ipq4019.dtsi           | 8 ++++++++
 2 files changed, 12 insertions(+)
arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi +4 -0
index fe78f3f..223da1a 100644
@@ -55,5 +55,9 @@
 			pinctrl-names = "default";
 			status = "ok";
 		};
+
+		watchdog at b017000 {
+			status = "ok";
+		};
 	};
 };
arch/arm/boot/dts/qcom-ipq4019.dtsi +8 -0
index e44f5b6..00a5e9e 100644
@@ -171,5 +171,13 @@
 				<&gcc GCC_BLSP1_AHB_CLK>;
 			clock-names = "core", "iface";
 		};
+
+		watchdog at b017000 {
+			compatible = "qcom,kpss-standalone";
+			reg = <0xb017000 0x40>;
+			clocks = <&sleep_clk>;
+			timeout-sec = <10>;
+			status = "disabled";
+		};
 	};
 };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#39 lore raw

PATCH 11/17 qcom: ipq4019: add support for reset via qcom,ps-hold

In reply to Matthew McClintock

This will allow these types of boards to be rebooted.

---
 arch/arm/boot/dts/qcom-ipq4019.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +5 -0
index 00a5e9e..acb851d 100644
@@ -179,5 +179,10 @@
 			timeout-sec = <10>;
 			status = "disabled";
 		};
+
+		restart at 4ab000 {
+			compatible = "qcom,pshold";
+			reg = <0x4ab000 0x4>;
+		};
 	};
 };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#40 lore raw

PATCH 12/17 qcom: ipq4019: add spi node to ipq4019 SoC and DK01 device tree

In reply to Matthew McClintock

This will allow boards to enable the SPI bus

---
 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi | 37 +++++++++++++++++++++++++++
 arch/arm/boot/dts/qcom-ipq4019.dtsi           | 18 +++++++++++++
 2 files changed, 55 insertions(+)
arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi +37 -0
index 223da1a..21032a8 100644
@@ -48,6 +48,43 @@
 					bias-disable;
 				};
 			};
+
+			spi_0_pins: spi_0_pinmux {
+				pinmux {
+					function = "blsp_spi0";
+					pins = "gpio55", "gpio56", "gpio57";
+				};
+				pinmux_cs {
+					function = "gpio";
+					pins = "gpio54";
+				};
+				pinconf {
+					pins = "gpio55", "gpio56", "gpio57";
+					drive-strength = <12>;
+					bias-disable;
+				};
+				pinconf_cs {
+					pins = "gpio54";
+					drive-strength = <2>;
+					bias-disable;
+					output-high;
+				};
+			};
+		};
+
+		spi_0: spi at 78b5000 {
+			pinctrl-0 = <&spi_0_pins>;
+			pinctrl-names = "default";
+			status = "ok";
+			cs-gpios = <&tlmm 54 0>;
+
+			mx25l25635e at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				reg = <0>;
+				compatible = "mx25l25635e";
+				spi-max-frequency = <24000000>;
+			};
 		};
 
 		serial at 78af000 {
arch/arm/boot/dts/qcom-ipq4019.dtsi +18 -0
index acb851d..99e64f4 100644
@@ -15,12 +15,18 @@
 
 #include "skeleton.dtsi"
 #include <dt-bindings/clock/qcom,gcc-ipq4019.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
 	model = "Qualcomm Technologies, Inc. IPQ4019";
 	compatible = "qcom,ipq4019";
 	interrupt-parent = <&intc>;
 
+	aliases {
+		spi0 = &spi_0;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -108,6 +114,18 @@
 			interrupts = <0 208 0>;
 		};
 
+		spi_0: spi at 78b5000 {
+			compatible = "qcom,spi-qup-v2.2.1";
+			reg = <0x78b5000 0x600>;
+			interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&gcc GCC_BLSP1_QUP1_SPI_APPS_CLK>,
+				 <&gcc GCC_BLSP1_AHB_CLK>;
+			clock-names = "core", "iface";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
                 acc0: clock-controller at b088000 {
                         compatible = "qcom,kpss-acc-v1";
                         reg = <0x0b088000 0x1000>, <0xb008000 0x1000>;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#41 lore raw

PATCH 13/17 qcom: ipq4019: add i2c node to ipq4019 SoC and DK01 device tree

In reply to Matthew McClintock

This will allow boards to enable the I2C bus

---
 arch/arm/boot/dts/qcom-ipq4019.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +13 -0
index 99e64f4..1937edf 100644
@@ -25,6 +25,7 @@
 
 	aliases {
 		spi0 = &spi_0;
+		i2c0 = &i2c_0;
 	};
 
 	cpus {
@@ -126,6 +127,18 @@
 			status = "disabled";
 		};
 
+		i2c_0: i2c at 78b7000 {
+			compatible = "qcom,i2c-qup-v2.2.1";
+			reg = <0x78b7000 0x6000>;
+			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+				 <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
+			clock-names = "iface", "core";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
                 acc0: clock-controller at b088000 {
                         compatible = "qcom,kpss-acc-v1";
                         reg = <0x0b088000 0x1000>, <0xb008000 0x1000>;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#42 lore raw

PATCH 14/17 cpufreq: ipq4019: add cpufreq driver

In reply to Matthew McClintock

Add cpufreq driver for ipq4019 SoC. This driver simply instantiates cpufreq-dt.

---
 drivers/cpufreq/Kconfig.arm       |  9 +++++++++
 drivers/cpufreq/Makefile          |  1 +
 drivers/cpufreq/ipq4019-cpufreq.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 drivers/cpufreq/ipq4019-cpufreq.c
drivers/cpufreq/Kconfig.arm +9 -0
index 14b1f93..187803d 100644
@@ -69,6 +69,15 @@ config ARM_IMX6Q_CPUFREQ
 
 	  If in doubt, say N.
 
+config ARM_IPQ4019_CPUFREQ
+        tristate "Qualcomm IPQ4019 cpufreq support"
+	depends on ARCH_QCOM && CPUFREQ_DT
+        select PM_OPP
+        help
+	  This adds cpufreq driver support for Qualcomm IPQ4019 series SoCs.
+
+          If in doubt, say N.
+
 config ARM_INTEGRATOR
 	tristate "CPUfreq driver for ARM Integrator CPUs"
 	depends on ARCH_INTEGRATOR
drivers/cpufreq/Makefile +1 -0
index 9e63fb1..8ed4cdb 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_ARM_EXYNOS5440_CPUFREQ)	+= exynos5440-cpufreq.o
 obj-$(CONFIG_ARM_HIGHBANK_CPUFREQ)	+= highbank-cpufreq.o
 obj-$(CONFIG_ARM_HISI_ACPU_CPUFREQ)	+= hisi-acpu-cpufreq.o
 obj-$(CONFIG_ARM_IMX6Q_CPUFREQ)		+= imx6q-cpufreq.o
+obj-$(CONFIG_ARM_IPQ4019_CPUFREQ)	+= ipq4019-cpufreq.o
 obj-$(CONFIG_ARM_INTEGRATOR)		+= integrator-cpufreq.o
 obj-$(CONFIG_ARM_KIRKWOOD_CPUFREQ)	+= kirkwood-cpufreq.o
 obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
drivers/cpufreq/ipq4019-cpufreq.c new file +35 -0
new file mode 100644
index 0000000..6f7bba3
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static int __init ipq4019_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+
+	if (!of_machine_is_compatible("qcom,ipq4019"))
+		return -ENODEV;
+
+	pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
+	return PTR_ERR_OR_ZERO(pdev);
+}
+module_init(ipq4019_cpufreq_driver_init);
+
+MODULE_AUTHOR("Matthew McClintock <[email protected]>");
+MODULE_DESCRIPTION("ipq4019 cpufreq driver");
+MODULE_LICENSE("GPL");
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#43 lore raw

Re: [PATCH 14/17] cpufreq: ipq4019: add cpufreq driver

Quoted 10 lines · Matthew McClintock

Add cpufreq driver for ipq4019 SoC. This driver simply instantiates cpufreq-dt.

---
 drivers/cpufreq/Kconfig.arm       |  9 +++++++++
 drivers/cpufreq/Makefile          |  1 +
 drivers/cpufreq/ipq4019-cpufreq.c | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 drivers/cpufreq/ipq4019-cpufreq.c

I have just sent a patchset and cc'd you:
"[PATCH 0/3] cpufreq: dt: Create platform device from generic code"

and so this patch may get replaced now.

Signature · 1 line
viresh
#44 lore raw

Re: [PATCH 14/17] cpufreq: ipq4019: add cpufreq driver

Quoted 13 lines · Viresh Kumar
Quoted 10 lines · Matthew McClintock

Add cpufreq driver for ipq4019 SoC. This driver simply instantiates cpufreq-dt.

---

drivers/cpufreq/Kconfig.arm       |  9 +++++++++
drivers/cpufreq/Makefile          |  1 +
drivers/cpufreq/ipq4019-cpufreq.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+)

create mode 100644 drivers/cpufreq/ipq4019-cpufreq.c

Quoted 4 lines

I have just sent a patchset and cc'd you:
"[PATCH 0/3] cpufreq: dt: Create platform device from generic code"

and so this patch may get replaced now.

Cool, thanks. I will look at re-spinning with your changes.

-M

#45 lore raw

PATCH 15/17 qcom: ipq4019: add cpu operating points for cpufreq support

In reply to Matthew McClintock

This adds some operating points for cpu frequeny scaling

---
 arch/arm/boot/dts/qcom-ipq4019.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/qcom-ipq4019.dtsi +8 -0
index 1937edf..db48fd3 100644
@@ -40,6 +40,14 @@
 			reg = <0x0>;
 			clocks = <&gcc GCC_APPS_CLK_SRC>;
 			clock-frequency = <0>;
+			operating-points = <
+				/* kHz	uV (fixed) */
+				48000	1100000
+				200000	1100000
+				500000	1100000
+				666000	1100000
+			>;
+			clock-latency = <256000>;
 		};
 
 		cpu at 1 {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#46 lore raw

Re: [PATCH 15/17] qcom: ipq4019: add cpu operating points for cpufreq support

Quoted 4 lines · Matthew McClintock

This adds some operating points for cpu frequeny scaling

---

Can you use the v2 OPP bindings instead? I imagine uV could be left out then because there isn't any regulator control?

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#47 lore raw

PATCH 15/17 qcom: ipq4019: add cpu operating points for cpufreq support

In reply to Matthew McClintock
Quoted 3 lines · On Mittwoch, 23. M?rz 2016 17:05:10 CET Matthew McClintock wrote:

This adds some operating points for cpu frequeny scaling

[...]

I saw that you've created a new version of the patch and it was added to different staging/testing [1] trees.

But I find it rather odd that Codeaurora uses different settings [3]. Here for easier comparison:

setting | QSDK 1.1.3 | proposed patch
---------------------------------------------

clk-latency |         100000 |    256000
opp0        |     48000(000) |  48000000
opp1        |    200000(000) | 200000000
opp2        |    500000(000) | 500000000
opp3        |    710000(000) | 666000000

It looks to me like clk-latency and the opp3 (maximum frequency) are different. Is the reason for this difference known?

I've just noticed it because I got an DTB from an ODM which had even 716000(000) set for opp3.

Kind regards,
Sven

[1] https://git.lede-project.org/?p=lede/blogic/staging.git;a=blob;f=target/linux/ipq806x/patches-4.9/0017-qcom-ipq4019-add-cpu-operating-points-for-cpufreq-su.patch;h=7cbd6a4551bfd968d013164f76897c603f4ae2ff;hb=627e9c2c36839634d987535658a287843a8a9fd6
[2] https://github.com/chunkeey/LEDE-IPQ40XX/blob/a04cf208fe317074502f7ea81dafa828c89b74bb/target/linux/ipq40xx/patches-4.9/120-qcom-ipq4019-add-cpu-operating-points-for-cpufreq-su.patch
[3] https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-msm/tree/arch/arm/boot/dts/qcom-ipq40xx.dtsi?h=release/date_r1&id=461894f071b168c963795ebfa15d3458b102730a#n768
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170322/9327cde0/attachment.sig>

#48 lore raw

PATCH 16/17 qcom: ipq4019: add crypto nodes to ipq4019 SoC and DK01 device tree

In reply to Matthew McClintock

This adds the crypto nodes to the ipq4019 device tree, it also adds the BAM node used by crypto as well which the driver currently requires to operate properly

The crypto driver itself depends on some other patches to qcom_bam_dma to function properly:

https://lkml.org/lkml/2015/12/1/113

---
 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi |  8 ++++++++
 arch/arm/boot/dts/qcom-ipq4019.dtsi           | 25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi +8 -0
index 21032a8..2c347ad 100644
@@ -93,6 +93,14 @@
 			status = "ok";
 		};
 
+		cryptobam: dma at 8e04000 {
+			status = "ok";
+		};
+
+		crypto at 8e3a000 {
+			status = "ok";
+		};
+
 		watchdog at b017000 {
 			status = "ok";
 		};
arch/arm/boot/dts/qcom-ipq4019.dtsi +25 -0
index db48fd3..3cd42c0 100644
@@ -147,6 +147,31 @@
 			status = "disabled";
 		};
 
+
+		cryptobam: dma at 8e04000 {
+			compatible = "qcom,bam-v1.7.0";
+			reg = <0x08e04000 0x20000>;
+			interrupts = <GIC_SPI 207 0>;
+			clocks = <&gcc GCC_CRYPTO_AHB_CLK>;
+			clock-names = "bam_clk";
+			#dma-cells = <1>;
+			qcom,ee = <1>;
+			qcom,controlled-remotely;
+			status = "disabled";
+		};
+
+		crypto at 8e3a000 {
+			compatible = "qcom,crypto-v5.1";
+			reg = <0x08e3a000 0x6000>;
+			clocks = <&gcc GCC_CRYPTO_AHB_CLK>,
+				 <&gcc GCC_CRYPTO_AXI_CLK>,
+				 <&gcc GCC_CRYPTO_CLK>;
+			clock-names = "iface", "bus", "core";
+			dmas = <&cryptobam 2>, <&cryptobam 3>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
                 acc0: clock-controller at b088000 {
                         compatible = "qcom,kpss-acc-v1";
                         reg = <0x0b088000 0x1000>, <0xb008000 0x1000>;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#49 lore raw

PATCH 17/17 qcom: ipq4019: add DMA nodes to ipq4019 SoC and DK01 device tree

In reply to Matthew McClintock

This adds the blsp_dma node to the device tree and the required properties for using DMA with serial

---
 arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi |  4 ++++
 arch/arm/boot/dts/qcom-ipq4019.dtsi           | 15 +++++++++++++++
 2 files changed, 19 insertions(+)
arch/arm/boot/dts/qcom-ipq4019-ap.dk01.1.dtsi +4 -0
index 2c347ad..b9457dd2 100644
@@ -72,6 +72,10 @@
 			};
 		};
 
+		blsp_dma: dma at 7884000 {
+			status = "ok";
+		};
+
 		spi_0: spi at 78b5000 {
 			pinctrl-0 = <&spi_0_pins>;
 			pinctrl-names = "default";
arch/arm/boot/dts/qcom-ipq4019.dtsi +15 -0
index 3cd42c0..5c08d19 100644
@@ -123,6 +123,17 @@
 			interrupts = <0 208 0>;
 		};
 
+		blsp_dma: dma at 7884000 {
+			compatible = "qcom,bam-v1.7.0";
+			reg = <0x07884000 0x23000>;
+			interrupts = <GIC_SPI 238 IRQ_TYPE_NONE>;
+			clocks = <&gcc GCC_BLSP1_AHB_CLK>;
+			clock-names = "bam_clk";
+			#dma-cells = <1>;
+			qcom,ee = <0>;
+			status = "disabled";
+		};
+
 		spi_0: spi at 78b5000 {
 			compatible = "qcom,spi-qup-v2.2.1";
 			reg = <0x78b5000 0x600>;
@@ -224,6 +235,8 @@
 			clocks = <&gcc GCC_BLSP1_UART1_APPS_CLK>,
 				<&gcc GCC_BLSP1_AHB_CLK>;
 			clock-names = "core", "iface";
+			dmas = <&blsp_dma 1>, <&blsp_dma 0>;
+			dma-names = "rx", "tx";
 		};
 
 		serial at 78b0000 {
@@ -234,6 +247,8 @@
 			clocks = <&gcc GCC_BLSP1_UART2_APPS_CLK>,
 				<&gcc GCC_BLSP1_AHB_CLK>;
 			clock-names = "core", "iface";
+			dmas = <&blsp_dma 3>, <&blsp_dma 2>;
+			dma-names = "rx", "tx";
 		};
 
 		watchdog at b017000 {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project