Linux Serial subsystem development
 help / color / mirror / Atom feed
* [RFC v2 08/11] arm64: dts: sdm845: Add ufs opps and power-domains
From: Rajendra Nayak @ 2019-03-20  9:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: ulf.hansson, Rajendra Nayak, linux-scsi, linux-pm, linux-arm-msm,
	rafael, dianders, dri-devel, linux-spi, linux-serial,
	viresh.kumar, swboyd
In-Reply-To: <20190320094918.20234-1-rnayak@codeaurora.org>

Add the additional power domain and the OPP table for ufs on sdm845
so the driver can set the appropriate performance state of the
power domain while setting the clock rate.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 027ffe6e93e8..a3af4a1757b4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -1140,6 +1140,21 @@
 			};
 		};
 
+		ufs_opp_table: ufs-opp-table {
+			compatible = "operating-points-v2";
+
+			opp-50000000 {
+				opp-hz = /bits/ 64 <50000000>;
+				required-opps = <&rpmhpd_opp_min_svs>;
+			};
+
+			opp-200000000 {
+				opp-hz = /bits/ 64 <200000000>;
+				required-opps = <&rpmhpd_opp_nom>;
+
+			};
+		};
+
 		ufs_mem_hc: ufshc@1d84000 {
 			compatible = "qcom,sdm845-ufshc", "qcom,ufshc",
 				     "jedec,ufs-2.0";
@@ -1148,7 +1163,7 @@
 			phys = <&ufs_mem_phy_lanes>;
 			phy-names = "ufsphy";
 			lanes-per-direction = <2>;
-			power-domains = <&gcc UFS_PHY_GDSC>;
+			power-domains = <&gcc UFS_PHY_GDSC>, <&rpmhpd SDM845_CX>;
 
 			iommus = <&apps_smmu 0x100 0xf>;
 
@@ -1170,6 +1185,9 @@
 				<&gcc GCC_UFS_PHY_TX_SYMBOL_0_CLK>,
 				<&gcc GCC_UFS_PHY_RX_SYMBOL_0_CLK>,
 				<&gcc GCC_UFS_PHY_RX_SYMBOL_1_CLK>;
+
+			operating-points-v2 = <&ufs_opp_table>;
+
 			freq-table-hz =
 				<50000000 200000000>,
 				<0 0>,
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related

* [RFC v2 09/11] drm/msm/dpu: Use OPP API to set clk/perf state
From: Rajendra Nayak @ 2019-03-20  9:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: ulf.hansson, Rajendra Nayak, linux-scsi, linux-pm, linux-arm-msm,
	rafael, dianders, dri-devel, linux-spi, linux-serial,
	viresh.kumar, swboyd
In-Reply-To: <20190320094918.20234-1-rnayak@codeaurora.org>

On some qualcomm platforms DPU needs to express a perforamnce state
requirement on a power domain depennding on the clock rates.
Use OPP table from DT to register with OPP framework and use
dev_pm_opp_set_rate() to set the clk/perf state.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 7 ++++++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       | 9 +++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
index 9f20f397f77d..db21a86b242b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c
@@ -15,6 +15,7 @@
 #include <linux/debugfs.h>
 #include <linux/errno.h>
 #include <linux/mutex.h>
+#include <linux/pm_opp.h>
 #include <linux/sort.h>
 #include <linux/clk.h>
 #include <linux/bitmap.h>
@@ -298,7 +299,11 @@ static int _dpu_core_perf_set_core_clk_rate(struct dpu_kms *kms, u64 rate)
 		rate = core_clk->max_rate;
 
 	core_clk->rate = rate;
-	return msm_dss_clk_set_rate(core_clk, 1);
+
+	if (dev_pm_opp_get_opp_table(&kms->pdev->dev))
+		return dev_pm_opp_set_rate(&kms->pdev->dev, core_clk->rate);
+	else
+		return msm_dss_clk_set_rate(core_clk, 1);
 }
 
 static u64 _dpu_core_perf_get_core_clk_rate(struct dpu_kms *kms)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 885bf88afa3e..684bd6982aaf 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -22,6 +22,7 @@
 #include <linux/debugfs.h>
 #include <linux/of_irq.h>
 #include <linux/dma-buf.h>
+#include <linux/pm_opp.h>
 
 #include "msm_drv.h"
 #include "msm_mmu.h"
@@ -1014,6 +1015,12 @@ static int dpu_bind(struct device *dev, struct device *master, void *data)
 	if (!dpu_kms)
 		return -ENOMEM;
 
+	dev_pm_opp_set_clkname(dev, "core");
+
+	ret = dev_pm_opp_of_add_table(dev);
+	if (ret)
+		dev_err(dev, "failed to init OPP table: %d\n", ret);
+
 	mp = &dpu_kms->mp;
 	ret = msm_dss_parse_clock(pdev, mp);
 	if (ret) {
@@ -1040,6 +1047,7 @@ static void dpu_unbind(struct device *dev, struct device *master, void *data)
 	struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
 	struct dss_module_power *mp = &dpu_kms->mp;
 
+	dev_pm_opp_of_remove_table(dev);
 	msm_dss_put_clk(mp->clk_config, mp->num_clk);
 	devm_kfree(&pdev->dev, mp->clk_config);
 	mp->num_clk = 0;
@@ -1078,6 +1086,7 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 		return rc;
 	}
 
+	dev_pm_opp_set_rate(dev, 0);
 	rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
 	if (rc)
 		DPU_ERROR("clock disable failed rc:%d\n", rc);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related

* [RFC v2 10/11] drm/msm: dsi: Use OPP API to set clk/perf state
From: Rajendra Nayak @ 2019-03-20  9:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: ulf.hansson, Rajendra Nayak, linux-scsi, linux-pm, linux-arm-msm,
	rafael, dianders, dri-devel, linux-spi, linux-serial,
	viresh.kumar, swboyd
In-Reply-To: <20190320094918.20234-1-rnayak@codeaurora.org>

On SDM845 DSI needs to express a perforamnce state
requirement on a power domain depending on the clock rates.
Use OPP table from DT to register with OPP framework and use
dev_pm_opp_set_rate() to set the clk/perf state.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi.h      |  2 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c  |  4 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c | 88 +++++++++++++++++++++++++++---
 3 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 9c6b31c2d79f..b4398a798370 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -188,8 +188,10 @@ int msm_dsi_runtime_suspend(struct device *dev);
 int msm_dsi_runtime_resume(struct device *dev);
 int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host);
 int dsi_link_clk_enable_v2(struct msm_dsi_host *msm_host);
+int dsi_link_clk_enable_6g_v2(struct msm_dsi_host *msm_host);
 void dsi_link_clk_disable_6g(struct msm_dsi_host *msm_host);
 void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host);
+void dsi_link_clk_disable_6g_v2(struct msm_dsi_host *msm_host);
 int dsi_tx_buf_alloc_6g(struct msm_dsi_host *msm_host, int size);
 int dsi_tx_buf_alloc_v2(struct msm_dsi_host *msm_host, int size);
 void *dsi_tx_buf_get_6g(struct msm_dsi_host *msm_host);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index dcdfb1bb54f9..c18532f92e4a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -159,8 +159,8 @@ const static struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
 };
 
 const static struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
-	.link_clk_enable = dsi_link_clk_enable_6g,
-	.link_clk_disable = dsi_link_clk_disable_6g,
+	.link_clk_enable = dsi_link_clk_enable_6g_v2,
+	.link_clk_disable = dsi_link_clk_disable_6g_v2,
 	.clk_init_ver = dsi_clk_init_6g_v2,
 	.tx_buf_alloc = dsi_tx_buf_alloc_6g,
 	.tx_buf_get = dsi_tx_buf_get_6g,
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 610183db1daf..6ed9e6a0520c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -21,6 +21,7 @@
 #include <linux/of_gpio.h>
 #include <linux/of_irq.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pm_opp.h>
 #include <linux/of_graph.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spinlock.h>
@@ -511,7 +512,7 @@ int msm_dsi_runtime_resume(struct device *dev)
 	return dsi_bus_clk_enable(msm_host);
 }
 
-int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
+static int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)
 {
 	int ret;
 
@@ -521,29 +522,65 @@ int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
 	ret = clk_set_rate(msm_host->byte_clk, msm_host->byte_clk_rate);
 	if (ret) {
 		pr_err("%s: Failed to set rate byte clk, %d\n", __func__, ret);
-		goto error;
+		return ret;
 	}
 
 	ret = clk_set_rate(msm_host->pixel_clk, msm_host->pixel_clk_rate);
 	if (ret) {
 		pr_err("%s: Failed to set rate pixel clk, %d\n", __func__, ret);
-		goto error;
+		return ret;
 	}
 
 	if (msm_host->byte_intf_clk) {
 		ret = clk_set_rate(msm_host->byte_intf_clk,
 				   msm_host->byte_clk_rate / 2);
-		if (ret) {
+		if (ret)
+			pr_err("%s: Failed to set rate byte intf clk, %d\n",
+			       __func__, ret);
+	}
+
+	return ret;
+}
+
+static int dsi_link_clk_set_rate_6g_v2(struct msm_dsi_host *msm_host)
+{
+	int ret;
+	struct device *dev = &msm_host->pdev->dev;
+
+	DBG("Set clk rates: pclk=%d, byteclk=%d",
+		msm_host->mode->clock, msm_host->byte_clk_rate);
+
+	ret = dev_pm_opp_set_rate(dev, msm_host->byte_clk_rate);
+	if (ret) {
+		pr_err("%s: dev_pm_opp_set_rate failed %d\n", __func__, ret);
+		return ret;
+	}
+
+	ret = clk_set_rate(msm_host->pixel_clk, msm_host->pixel_clk_rate);
+	if (ret) {
+		pr_err("%s: Failed to set rate pixel clk, %d\n", __func__, ret);
+		return ret;
+	}
+
+	if (msm_host->byte_intf_clk) {
+		ret = clk_set_rate(msm_host->byte_intf_clk,
+				msm_host->byte_clk_rate / 2);
+		if (ret)
 			pr_err("%s: Failed to set rate byte intf clk, %d\n",
 			       __func__, ret);
-			goto error;
-		}
 	}
 
+	return ret;
+}
+
+static int dsi_link_clk_prepare_enable_6g(struct msm_dsi_host *msm_host)
+{
+	int ret;
+
 	ret = clk_prepare_enable(msm_host->esc_clk);
 	if (ret) {
 		pr_err("%s: Failed to enable dsi esc clk\n", __func__);
-		goto error;
+		return ret;
 	}
 
 	ret = clk_prepare_enable(msm_host->byte_clk);
@@ -575,10 +612,31 @@ int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
 	clk_disable_unprepare(msm_host->byte_clk);
 byte_clk_err:
 	clk_disable_unprepare(msm_host->esc_clk);
-error:
 	return ret;
 }
 
+int dsi_link_clk_enable_6g(struct msm_dsi_host *msm_host)
+{
+	int ret;
+
+	ret = dsi_link_clk_set_rate_6g(msm_host);
+	if (ret)
+		return ret;
+
+	return dsi_link_clk_prepare_enable_6g(msm_host);
+}
+
+int dsi_link_clk_enable_6g_v2(struct msm_dsi_host *msm_host)
+{
+	int ret;
+
+	ret = dsi_link_clk_set_rate_6g_v2(msm_host);
+	if (ret)
+		return ret;
+
+	return dsi_link_clk_prepare_enable_6g(msm_host);
+}
+
 int dsi_link_clk_enable_v2(struct msm_dsi_host *msm_host)
 {
 	int ret;
@@ -656,6 +714,13 @@ void dsi_link_clk_disable_6g(struct msm_dsi_host *msm_host)
 	clk_disable_unprepare(msm_host->byte_clk);
 }
 
+void dsi_link_clk_disable_6g_v2(struct msm_dsi_host *msm_host)
+{
+	/* Drop the performance state vote */
+	dev_pm_opp_set_rate(&msm_host->pdev->dev, 0);
+	dsi_link_clk_disable_6g(msm_host);
+}
+
 void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)
 {
 	clk_disable_unprepare(msm_host->pixel_clk);
@@ -1864,6 +1929,12 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
 		goto fail;
 	}
 
+	dev_pm_opp_set_clkname(&pdev->dev, "byte");
+
+	ret = dev_pm_opp_of_add_table(&pdev->dev);
+	if (ret < 0)
+		dev_err(&pdev->dev, "failed to init OPP table: %d\n", ret);
+
 	msm_host->rx_buf = devm_kzalloc(&pdev->dev, SZ_4K, GFP_KERNEL);
 	if (!msm_host->rx_buf) {
 		ret = -ENOMEM;
@@ -1896,6 +1967,7 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host)
 	struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
 
 	DBG("");
+	dev_pm_opp_of_remove_table(&msm_host->pdev->dev);
 	dsi_tx_buf_free(msm_host);
 	if (msm_host->workqueue) {
 		flush_workqueue(msm_host->workqueue);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related

* [RFC v2 11/11] arm64: dts: sdm845: Add DSI and MDP OPP tables and power-domains
From: Rajendra Nayak @ 2019-03-20  9:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: ulf.hansson, Rajendra Nayak, linux-scsi, linux-pm, linux-arm-msm,
	rafael, dianders, dri-devel, linux-spi, linux-serial,
	viresh.kumar, swboyd
In-Reply-To: <20190320094918.20234-1-rnayak@codeaurora.org>

Add the OPP tables for DSI and MDP based on the perf state/clk
requirements, and add the power-domains property to specify the
scalable power domain.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 59 ++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index a3af4a1757b4..675954fde391 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -1857,6 +1857,59 @@
 			#reset-cells = <1>;
 		};
 
+		mdp_opp_table: mdp-opp-table {
+			compatible = "operating-points-v2";
+
+			opp-19200000 {
+				opp-hz = /bits/ 64 <19200000>;
+				required-opps = <&rpmhpd_opp_min_svs>;
+			};
+
+			opp-171428571 {
+				opp-hz = /bits/ 64 <171428571>;
+				required-opps = <&rpmhpd_opp_low_svs>;
+			};
+
+			opp-344000000 {
+				opp-hz = /bits/ 64 <344000000>;
+				required-opps = <&rpmhpd_opp_svs_l1>;
+			};
+
+			opp-430000000 {
+				opp-hz = /bits/ 64 <430000000>;
+				required-opps = <&rpmhpd_opp_nom>;
+			};
+		};
+
+		dsi_opp_table: dsi-opp-table {
+			compatible = "operating-points-v2";
+
+			opp-19200000 {
+				opp-hz = /bits/ 64 <19200000>;
+				required-opps = <&rpmhpd_opp_min_svs>;
+			};
+
+			opp-180000000 {
+				opp-hz = /bits/ 64 <180000000>;
+				required-opps = <&rpmhpd_opp_low_svs>;
+			};
+
+			opp-275000000 {
+				opp-hz = /bits/ 64 <275000000>;
+				required-opps = <&rpmhpd_opp_svs>;
+			};
+
+			opp-328580000 {
+				opp-hz = /bits/ 64 <328580000>;
+				required-opps = <&rpmhpd_opp_svs_l1>;
+			};
+
+			opp-358000000 {
+				opp-hz = /bits/ 64 <358000000>;
+				required-opps = <&rpmhpd_opp_nom>;
+			};
+		};
+
 		mdss: mdss@ae00000 {
 			compatible = "qcom,sdm845-mdss";
 			reg = <0 0x0ae00000 0 0x1000>;
@@ -1901,6 +1954,8 @@
 						  <&dispcc DISP_CC_MDSS_VSYNC_CLK>;
 				assigned-clock-rates = <300000000>,
 						       <19200000>;
+				operating-points-v2 = <&mdp_opp_table>;
+				power-domains = <&rpmhpd SDM845_CX>;
 
 				interrupt-parent = <&mdss>;
 				interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
@@ -1947,6 +2002,8 @@
 					      "core",
 					      "iface",
 					      "bus";
+				operating-points-v2 = <&dsi_opp_table>;
+				power-domains = <&rpmhpd SDM845_CX>;
 
 				phys = <&dsi0_phy>;
 				phy-names = "dsi";
@@ -2013,6 +2070,8 @@
 					      "core",
 					      "iface",
 					      "bus";
+				operating-points-v2 = <&dsi_opp_table>;
+				power-domains = <&rpmhpd SDM845_CX>;
 
 				phys = <&dsi1_phy>;
 				phy-names = "dsi";
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related

* [PATCH] Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc
From: 王 文涛 @ 2019-03-20 15:30 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: kgdb-bugreport@lists.sourceforge.net, daniel.thompson@linaro.org,
	jslaby@suse.com, linux-serial@vger.kernel.org,
	jason.wessel@windriver.com
In-Reply-To: <20190319142306.GA13458@kroah.com>

From: Wentao Wang <witallwang@gmail.com>

Echo "" to /sys/module/kgdboc/parameters/kgdboc will fail with "No such device” error.

This is caused by function "configure_kgdboc" who init err to ENODEV when the config
is empty (legal input) the code go out with ENODEV returned.

Fixes: 2dd453168643d ("kgdboc: Fix restrict error")

Signed-off-by: Wentao Wang <witallwang@gmail.com>
---
 drivers/tty/serial/kgdboc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index 6fb312e..bfe5e9e 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -148,8 +148,10 @@ static int configure_kgdboc(void)
 	char *cptr = config;
 	struct console *cons;
 
-	if (!strlen(config) || isspace(config[0]))
+	if (!strlen(config) || isspace(config[0])) {
+		err = 0;
 		goto noconfig;
+	}
 
 	kgdboc_io_ops.is_console = 0;
 	kgdb_tty_driver = NULL;
-- 
2.7.4


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

^ permalink raw reply related

* Re: [PATCH 1/4] printk: Introduce per-console loglevel setting
From: Petr Mladek @ 2019-03-20 15:37 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: Calvin Owens, Sergey Senozhatsky, Steven Rostedt,
	Greg Kroah-Hartman, Jonathan Corbet, linux-kernel, linux-serial
In-Reply-To: <c7a9c83c-524d-c0da-a355-6cd4b7ec690c@I-love.SAKURA.ne.jp>

On Thu 2019-03-14 23:12:49, Tetsuo Handa wrote:
> Petr Mladek wrote:
> > It might be even more straightforward when the per-console value
> > defines the effective console level. I mean the following semantic:
> > 
> >    + "console_loglevel" would define the default loglevel used
> >      by consoles at runtime.
> > 
> >    + the per-console loglevel could override the default
> >      console_loglevel.
> > 
> >    + We would need a custom handler for the sysctl "console_loglevel".
> >      It would write the given value to the global console_loglevel
> >      variable and for all already registered consoles (con->loglevel).
> 
> But some functions change console_loglevel without sysctl (e.g.
> console_verbose() when reporting hung tasks and panic()). Should
> con->loglevel be changed (which might result in too much messages to
> slow consoles) when console_loglevel changes?

It is about the semantic. We either want to set a hard limit
for each console or we want to set per-console loglevel that
will get used in normal situations.

I prefer the 2nd semantic. IMHO, console_verbose() should be
used only in situations when people really want to see all
lines, for example, panic, sysrq output when the machine
looks deadlocked, ignore_loglevel is set. I believe that they
want to see them even on the slow consoles that are
there exactly for debugging these critical situations.

Best Regards,
Petr

^ permalink raw reply

* [PATCH] tty: serial_core: Spelling correction
From: hariprasadk @ 2019-03-21  3:59 UTC (permalink / raw)
  To: gregkh, jslaby, linux-serial, linux-kernel

fix warning reported by checkpatch tool

Signed-off-by: hariprasadk <hari1219@gmail.com>
---
 drivers/tty/serial/serial_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 351843f..69f4871 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
 	}
 
 	uart_change_speed(tty, state, old_termios);
-	/* reload cflag from termios; port driver may have overriden flags */
+	/* reload cflag from termios; port driver may have overridden flags */
 	cflag = tty->termios.c_cflag;
 
 	/* Handle transition to B0 status */
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH] tty: serial_core: Spelling correction
From: Jiri Slaby @ 2019-03-21  5:20 UTC (permalink / raw)
  To: hariprasadk, gregkh, linux-kernel, linux-serial
In-Reply-To: <20190321035901.GA12851@hari-Inspiron-1545>

On 21. 03. 19, 4:59, hariprasadk wrote:
> fix warning reported by checkpatch tool
> 
> Signed-off-by: hariprasadk <hari1219@gmail.com>

Please use your real name as per
Documentation/process/submitting-patches.rst.

> ---
>  drivers/tty/serial/serial_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 351843f..69f4871 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
>  	}
>  
>  	uart_change_speed(tty, state, old_termios);
> -	/* reload cflag from termios; port driver may have overriden flags */
> +	/* reload cflag from termios; port driver may have overridden flags */
>  	cflag = tty->termios.c_cflag;
>  
>  	/* Handle transition to B0 status */
> 

Otherwose looks good to me.

thanks,
-- 
js
suse labs

^ permalink raw reply

* Re: [PATCH] Disable kgdboc failed by echo space to /sys/module/kgdboc/parameters/kgdboc
From: Daniel Thompson @ 2019-03-21 10:33 UTC (permalink / raw)
  To: 王 文涛
  Cc: kgdb-bugreport@lists.sourceforge.net, gregkh@linuxfoundation.org,
	jslaby@suse.com, linux-serial@vger.kernel.org,
	jason.wessel@windriver.com
In-Reply-To: <KU1PR03MB2824C0511DA1CD5025CC47DECB410@KU1PR03MB2824.apcprd03.prod.outlook.com>

On Wed, Mar 20, 2019 at 03:30:39PM +0000, 王 文涛 wrote:
> From: Wentao Wang <witallwang@gmail.com>
> 
> Echo "" to /sys/module/kgdboc/parameters/kgdboc will fail with "No such device” error.
> 
> This is caused by function "configure_kgdboc" who init err to ENODEV when the config
> is empty (legal input) the code go out with ENODEV returned.
> 
> Fixes: 2dd453168643d ("kgdboc: Fix restrict error")
> 
> Signed-off-by: Wentao Wang <witallwang@gmail.com>

Acked-by: Daniel Thompson <daniel.thompson@linaro.org>


Thanks!

Daniel.

> ---
>  drivers/tty/serial/kgdboc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
> index 6fb312e..bfe5e9e 100644
> --- a/drivers/tty/serial/kgdboc.c
> +++ b/drivers/tty/serial/kgdboc.c
> @@ -148,8 +148,10 @@ static int configure_kgdboc(void)
>  	char *cptr = config;
>  	struct console *cons;
>  
> -	if (!strlen(config) || isspace(config[0]))
> +	if (!strlen(config) || isspace(config[0])) {
> +		err = 0;
>  		goto noconfig;
> +	}
>  
>  	kgdboc_io_ops.is_console = 0;
>  	kgdb_tty_driver = NULL;
> -- 
> 2.7.4
> 


_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

^ permalink raw reply

* Re: [PATCH v1] dmaengine: idma64: Use actual device for DMA transfers
From: Vinod Koul @ 2019-03-21 14:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: dmaengine, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	linux-arm-kernel, Mark Brown, linux-spi, Greg Kroah-Hartman,
	linux-serial, linux-kernel
In-Reply-To: <20190318153930.25641-1-andriy.shevchenko@linux.intel.com>

On 18-03-19, 18:39, Andy Shevchenko wrote:
> Intel IOMMU, when enabled, tries to find the domain of the device,
> assuming it's a PCI one, during DMA operations, such as mapping or
> unmapping. Since we are splitting the actual PCI device to couple of
> children via MFD framework (see drivers/mfd/intel-lpss.c for details),
> the DMA device appears to be a platform one, and thus not an actual one
> that performs DMA. In a such situation IOMMU can't find or allocate
> a proper domain for its operations. As a result, all DMA operations are
> failed.
> 
> In order to fix this, supply parent of the platform device
> to the DMA engine framework and fix filter functions accordingly.
> 
> We may rely on the fact that parent is a real PCI device, because no
> other configuration is present in the wild.

Applied, thanks

-- 
~Vinod

^ permalink raw reply

* [PATCH] tty: serial_core: Spelling correction
From: Hariprasad Kelam @ 2019-03-22  0:38 UTC (permalink / raw)
  To: gregkh, jslaby, linux-serial, linux-kernel

fix warning reported by checkpatch tool

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/tty/serial/serial_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 351843f..69f4871 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
 	}
 
 	uart_change_speed(tty, state, old_termios);
-	/* reload cflag from termios; port driver may have overriden flags */
+	/* reload cflag from termios; port driver may have overridden flags */
 	cflag = tty->termios.c_cflag;
 
 	/* Handle transition to B0 status */
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH] tty: serial_core: Spelling correction
From: Gustavo A. R. Silva @ 2019-03-22  0:56 UTC (permalink / raw)
  To: Hariprasad Kelam, gregkh, jslaby, linux-serial, linux-kernel
In-Reply-To: <20190322003827.GA30643@hari-Inspiron-1545>



On 3/21/19 7:38 PM, Hariprasad Kelam wrote:
> fix warning reported by checkpatch tool
> 

It is much better if you explicitly mention what exactly you are fixing,
e.g. fix spelling mistake "overriden" -> "overridden"

It makes it easier for people to review your changes and give you
feedback.

Cultivate this practice and people will appreciate it. :)

Thanks
--
Gustavo

> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  drivers/tty/serial/serial_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 351843f..69f4871 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
>  	}
>  
>  	uart_change_speed(tty, state, old_termios);
> -	/* reload cflag from termios; port driver may have overriden flags */
> +	/* reload cflag from termios; port driver may have overridden flags */
>  	cflag = tty->termios.c_cflag;
>  
>  	/* Handle transition to B0 status */
> 

^ permalink raw reply

* [PATCH] tty: serial_core: Spelling correction
From: Hariprasad Kelam @ 2019-03-22  3:01 UTC (permalink / raw)
  To: gregkh, jslaby, linux-serial, linux-kernel

fix spelling mistake "overriden" -> "overridden"
This fix resolves warning reported by checkpatch tool

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/tty/serial/serial_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 351843f..69f4871 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
 	}
 
 	uart_change_speed(tty, state, old_termios);
-	/* reload cflag from termios; port driver may have overriden flags */
+	/* reload cflag from termios; port driver may have overridden flags */
 	cflag = tty->termios.c_cflag;
 
 	/* Handle transition to B0 status */
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH] tty: serial_core: Spelling correction
From: Gustavo A. R. Silva @ 2019-03-22  3:28 UTC (permalink / raw)
  To: Hariprasad Kelam, gregkh, jslaby, linux-serial, linux-kernel
In-Reply-To: <20190322030159.GA6551@hari-Inspiron-1545>



On 3/21/19 10:01 PM, Hariprasad Kelam wrote:
> fix spelling mistake "overriden" -> "overridden"
> This fix resolves warning reported by checkpatch tool
> 

Whenever you receive feedback on a patch, you need to version
the patches that you re-send. Also, you should mention what has
changed, so people know what to review.

I encourage you take a look at this:

https://kernelnewbies.org/Outreachyfirstpatch

Thanks
--
Gustavo

"If you receive feedback on a patch, and were asked to update the patch,
you need to version the patches that you re-send. A new version number
lets reviewers know you made changes to the patch, and they should review
it again."

> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  drivers/tty/serial/serial_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 351843f..69f4871 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1514,7 +1514,7 @@ static void uart_set_termios(struct tty_struct *tty,
>  	}
>  
>  	uart_change_speed(tty, state, old_termios);
> -	/* reload cflag from termios; port driver may have overriden flags */
> +	/* reload cflag from termios; port driver may have overridden flags */
>  	cflag = tty->termios.c_cflag;
>  
>  	/* Handle transition to B0 status */
> 

^ permalink raw reply

* Re: [PATCH] tty: serial: qcom_geni_serial: Initialize baud in qcom_geni_console_setup
From: Arnd Bergmann @ 2019-03-22 14:20 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Andy Gross, David Brown, Greg Kroah-Hartman, linux-arm-msm,
	linux-serial, Linux Kernel Mailing List, Nick Desaulniers,
	clang-built-linux
In-Reply-To: <20190308183743.11145-1-natechancellor@gmail.com>

On Fri, Mar 8, 2019 at 7:38 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> When building with -Wsometimes-uninitialized, Clang warns:
>
> drivers/tty/serial/qcom_geni_serial.c:1079:6: warning: variable 'baud'
> is used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> It's not wrong; when options is NULL, baud has no default value. Use
> 9600 as that is a sane default.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/395
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 3bcec1c20219..35e5f9c5d5be 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1050,7 +1050,7 @@ static int __init qcom_geni_console_setup(struct console *co, char *options)
>  {
>         struct uart_port *uport;
>         struct qcom_geni_serial_port *port;
> -       int baud;
> +       int baud = 9600;
>         int bits = 8;
>         int parity = 'n';
>         int flow = 'n';

I made a similar patch here, but after looking at the driver concluded
that the bitrate had to be 115200, since that is used as the default
value otherwise.

        Arnd

^ permalink raw reply

* [BACKPORT 4.4.y 00/25] candidates from spreadtrum 4.4 product kernel
From: Arnd Bergmann @ 2019-03-22 15:43 UTC (permalink / raw)
  To: stable
  Cc: alsa-devel, Arnd Bergmann, dccp, netdev, linux-usb, linux-mmc,
	linux-kernel, linux-mm, linux-serial, linux-fsdevel,
	linux-arm-kernel

I took a scripted approach to look at some product kernels for patches
backported into vendor kernels. This is a set of (mostly) bugfixes I found
in Spreadtrum's linux-4.4 kernel that are missing in 4.4.176:

ffedbd2210f2 mmc: pwrseq: constify mmc_pwrseq_ops structures
c10368897e10 ALSA: compress: add support for 32bit calls in a 64bit kernel
64a67d4762ce mmc: pwrseq_simple: Make reset-gpios optional to match doc
4ec0ef3a8212 USB: iowarrior: fix oops with malicious USB descriptors
e5905ff1281f mmc: debugfs: Add a restriction to mmc debugfs clock setting
4ec96b4cbde8 mmc: make MAN_BKOPS_EN message a debug
ed9feec72fc1 mmc: sanitize 'bus width' in debug output
10a16a01d8f7 mmc: core: shut up "voltage-ranges unspecified" pr_info()
9772b47a4c29 usb: dwc3: gadget: Fix suspend/resume during device mode
6afedcd23cfd arm64: mm: Add trace_irqflags annotations to do_debug_exception()
437db4c6e798 mmc: mmc: Attempt to flush cache before reset
e51534c80660 mmc: core: fix using wrong io voltage if mmc_select_hs200 fails
e4c5800a3991 mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON
04c080080855 extcon: usb-gpio: Don't miss event during suspend/resume
78283edf2c01 kbuild: setlocalversion: print error to STDERR
c526c62d565e usb: gadget: composite: fix dereference after null check coverify warning
511a36d2f357 usb: gadget: Add the gserial port checking in gs_start_tx()
1712c9373f98 mmc: core: don't try to switch block size for dual rate mode
5ea8ea2cb7f1 tcp/dccp: drop SYN packets if accept queue is full
e1dc9b08051a serial: sprd: adjust TIMEOUT to a big value
81be24d263db Hang/soft lockup in d_invalidate with simultaneous calls
6f44a0bacb79 arm64: traps: disable irq in die()
b7d44c36a6f6 usb: renesas_usbhs: gadget: fix unused-but-set-variable warning
4350782570b9 serial: sprd: clear timeout interrupt only rather than all interrupts
3f3295709ede lib/int_sqrt: optimize small argument
32fd87b3bbf5 USB: core: only clean up what we allocated

Al Viro (1):
  Hang/soft lockup in d_invalidate with simultaneous calls

Andrey Konovalov (1):
  USB: core: only clean up what we allocated

Baolin Wang (1):
  usb: gadget: Add the gserial port checking in gs_start_tx()

Chuanxiao Dong (1):
  mmc: debugfs: Add a restriction to mmc debugfs clock setting

Dong Aisheng (1):
  mmc: core: fix using wrong io voltage if mmc_select_hs200 fails

Eric Dumazet (1):
  tcp/dccp: drop SYN packets if accept queue is full

James Morse (1):
  arm64: mm: Add trace_irqflags annotations to do_debug_exception()

Josh Boyer (1):
  USB: iowarrior: fix oops with malicious USB descriptors

Julia Lawall (1):
  mmc: pwrseq: constify mmc_pwrseq_ops structures

Konstantin Khlebnikov (1):
  mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON

Lanqing Liu (1):
  serial: sprd: clear timeout interrupt only rather than all interrupts

Martin Fuzzey (1):
  mmc: pwrseq_simple: Make reset-gpios optional to match doc

Peter Chen (1):
  usb: gadget: composite: fix dereference after null check coverify
    warning

Peter Zijlstra (1):
  lib/int_sqrt: optimize small argument

Qiao Zhou (1):
  arm64: traps: disable irq in die()

Ravindra Lokhande (1):
  ALSA: compress: add support for 32bit calls in a 64bit kernel

Roger Quadros (2):
  usb: dwc3: gadget: Fix suspend/resume during device mode
  extcon: usb-gpio: Don't miss event during suspend/resume

Russell King (1):
  mmc: core: shut up "voltage-ranges unspecified" pr_info()

Wei Qiao (1):
  serial: sprd: adjust TIMEOUT to a big value

Wolfram Sang (3):
  mmc: make MAN_BKOPS_EN message a debug
  mmc: sanitize 'bus width' in debug output
  kbuild: setlocalversion: print error to STDERR

Yoshihiro Shimoda (1):
  usb: renesas_usbhs: gadget: fix unused-but-set-variable warning

Ziyuan Xu (1):
  mmc: core: don't try to switch block size for dual rate mode

 arch/arm64/kernel/traps.c              |  8 +++++--
 arch/arm64/mm/fault.c                  | 33 ++++++++++++++++++--------
 drivers/extcon/extcon-usb-gpio.c       |  3 +++
 drivers/mmc/core/core.c                | 13 ++++++----
 drivers/mmc/core/debugfs.c             |  2 +-
 drivers/mmc/core/mmc.c                 | 16 +++++++++----
 drivers/mmc/core/pwrseq.h              |  2 +-
 drivers/mmc/core/pwrseq_emmc.c         |  2 +-
 drivers/mmc/core/pwrseq_simple.c       | 24 ++++++++++++-------
 drivers/tty/serial/sprd_serial.c       |  6 +++--
 drivers/usb/core/config.c              |  9 ++++---
 drivers/usb/dwc3/gadget.c              |  6 +++++
 drivers/usb/gadget/composite.c         |  2 ++
 drivers/usb/gadget/function/u_serial.c |  7 +++++-
 drivers/usb/misc/iowarrior.c           |  6 +++++
 drivers/usb/renesas_usbhs/mod_gadget.c |  5 +---
 fs/dcache.c                            | 10 ++++----
 include/net/inet_connection_sock.h     |  5 ----
 lib/int_sqrt.c                         |  3 +++
 mm/rmap.c                              |  2 +-
 net/dccp/ipv4.c                        |  8 +------
 net/dccp/ipv6.c                        |  2 +-
 net/ipv4/tcp_input.c                   |  8 +------
 scripts/setlocalversion                |  2 +-
 sound/core/compress_offload.c          | 13 ++++++++++
 25 files changed, 126 insertions(+), 71 deletions(-)

-- 
2.20.0

This is the full list of patches that were backported and are not in
4.4.y, but as usual most of them did not appear to make sense for stable
kernels.

 100   33 da5ce874f8ca f2fs: release locks before return in f2fs_ioc_gc_range()
 100  100 1dc0f8991d4d f2fs: fix to avoid race in between atomic write and background GC
 100   27 b27bc8091ccf f2fs: do gc in greedy mode for whole range if gc_urgent mode is set
 100  100 782911f491e7 f2fs: set readdir_ra by default
  33   33 81286d3e31b7 staging: android: ion: Remove check of idev->debug_root
 100   80 ae6650163c66 loop: fix concurrent lo_open/lo_release
 100  100 466a2b42d676 cpufreq: schedutil: Use idle_calls counter of the remote CPU
 100  100 32fd87b3bbf5 USB: core: only clean up what we allocated
 100  100 3f3295709ede lib/int_sqrt: optimize small argument
  50   30 e22cdc3fc599 sched/isolcpus: Fix "isolcpus=" boot parameter handling when !CONFIG_CPUMASK_OFFSTACK
 100   85 0abd8e70d24b f2fs: clear radix tree dirty tag of pages whose dirty flag is cleared
 100  100 84a23fbe96b4 f2fs: clear FI_HOT_DATA correctly
  91   91 12ac1d0f6c3e genirq: Make sparse_irq_lock protect what it should protect
 100   55 c49cbc19b31e cpufreq: schedutil: Always process remote callback with slow switching
 100  100 e2cabe48c20e cpufreq: schedutil: Don't restrict kthread to related_cpus unnecessarily
  78   78 99d14d0e16fa cpufreq: Process remote callbacks from any CPU if the platform permits
  31   61 674e75411fc2 sched: cpufreq: Allow remote cpufreq callbacks
  50  100 4350782570b9 serial: sprd: clear timeout interrupt only rather than all interrupts
 100  100 b7d44c36a6f6 usb: renesas_usbhs: gadget: fix unused-but-set-variable warning
 100  100 6f44a0bacb79 arm64: traps: disable irq in die()
 100   33 04dfc23006a2 f2fs: show more info if fail to issue discard
  71   28 e41e6d75e501 f2fs: split wio_mutex
 100  100 773a9ef85f02 mmc: pwrseq: Add reset callback to the struct mmc_pwrseq_ops
 100  100 81be24d263db Hang/soft lockup in d_invalidate with simultaneous calls
 100  100 e9256e142f59 mmc: pwrseq_simple: Parse DTS for the power-off-delay-us property
 100  100 e1dc9b08051a serial: sprd: adjust TIMEOUT to a big value
 100  100 6c3acd97572b f2fs: allocate hot_data for atomic writes
  75  100 bdd154436077 USB: serial: spcp8x5: simplify endpoint check
  45  100 590298b22325 USB: serial: pl2303: simplify endpoint check
  68  100 32814c87f446 USB: serial: oti6858: simplify endpoint check
  85  100 8ee1592d125a USB: serial: omninet: simplify endpoint check
  42  100 206ff831bebb USB: serial: mos7720: simplify endpoint check
  84  100 35194572b4ed USB: serial: kobil_sct: simplify endpoint check
  75  100 b714d5dc0631 USB: serial: keyspan_pda: simplify endpoint check
  69  100 fb527736ebcc USB: serial: iuu_phoenix: simplify endpoint check
  65  100 e7d6507e5ba7 USB: serial: digi_acceleport: simplify endpoint check
  81  100 d183b9b43390 USB: serial: cyberjack: simplify endpoint check
  60  100 fe190ed0d602 xhci: Do not halt the host until both HCD have disconnected their devices.
 100  100 f759741d9d91 block: Fix oops in locked_inode_to_wb_and_lock_list()
 100  100 773dc118756b mmc: core: Fix access to HS400-ES devices
  64   64 e93b9865251a f2fs: add ovp valid_blocks check for bg gc victim to fg_gc
  30   49 942fd3192f83 f2fs: check last page index in cached bio to decide submission
  71  100 bcb7440e76a9 extcon: usb-gpio: Add pinctrl operation during system PM
  66  100 5278204c9818 xhci: use the trb_to_noop() helper for command trbs
 100  100 bc88c10d7e69 locking/spinlock/debug: Remove spinlock lockup detection code
 100  100 d40a43af0a57 f2fs: fix an infinite loop when flush nodes in cp
  89   86 541332a13b1d extcon: usb-gpio: Add VBUS detection support
 100   50 65aca3205046 usb: dwc3: gadget: clear events in top-half handler
  77  100 ebbb2d59398f usb: dwc3: gadget: use evt->cache for processing events
  66  100 d9fa4c63f766 usb: dwc3: core: add a event buffer cache
 100  100 9ad587710a2f usb: gadget: composite: remove unnecessary & operation
 100   76 ef3d232245ab mmc: mmc: Relax checking for switch errors after HS200 switch
 100  100 e173f8911f09 mmc: core: Update CMD13 polling policy when switch to HS DDR mode
  68   63 aa33ce3c411a mmc: core: Enable __mmc_switch() to change bus speed timing for the host
 100   33 5ec32f84111a mmc: core: Check SWITCH_ERROR bit from each CMD13 response when polling
  50   50 625228fa3e01 mmc: core: Rename ignore_crc to retry_crc_err to reflect its purpose
 100  100 89e57aedda33 mmc: core: Remove redundant __mmc_send_status()
  33   33 437590a123b6 mmc: core: Retry instead of ignore at CRC errors when polling for busy
 100  100 c2c24819b280 mmc: core: Don't power off the card when starting the host
  55   50 716bdb8953c7 mmc: core: Factor out code related to polling in __mmc_switch()
  23   89 cb26ce069ffa mmc: core: Clarify code which deals with polling in __mmc_switch()
 100  100 5ea8ea2cb7f1 tcp/dccp: drop SYN packets if accept queue is full
  72  100 8e5bfa8c1f84 sched/autogroup: Do not use autogroup->tg in zombie threads
 100  100 8fdd136f2200 cfg80211: add bitrate for 20MHz MCS 9
  75  100 fd9afd3cbe40 usb: gadget: u_ether: remove interrupt throttling
 100  100 fe1b5700c70f mmc: mmc: Use 500ms as the default generic CMD6 timeout
 100  100 1720d3545b77 mmc: core: switch to 1V8 or 1V2 for hs400es mode
 100  100 e932835377f9 f2fs: check return value of write_checkpoint during fstrim
 100  100 1712c9373f98 mmc: core: don't try to switch block size for dual rate mode
  63   81 721e0497172f mmc: pwrseq-simple: Add an optional post-power-on-delay
 100  100 00af62330c39 usb: dwc3: core: Move the mode setting to the right place
 100   75 b1149ad917b7 coresight: always use stashed trace id value in etm4_trace_id
  80   80 a399d233078e sched/core: Fix incorrect utilization accounting when switching to fair class
 100   60 9d7aba7786b6 Revert "usb: dwc3: gadget: always decrement by 1"
 100  100 511a36d2f357 usb: gadget: Add the gserial port checking in gs_start_tx()
 100  100 c526c62d565e usb: gadget: composite: fix dereference after null check coverify warning
 100  100 78283edf2c01 kbuild: setlocalversion: print error to STDERR
 100  100 bb4eecf23be2 mmc: Change the max discard sectors and erase response when HW busy detect
 100  100 6ae3e537eab9 mmc: core: expose MMC_CAP2_NO_* to dt
 100  100 5f1d1434b7a0 Documentation: mmc: add description for new no-sd* and no-mmc
 100  100 a0c3b68c72a3 mmc: core: Allow hosts to specify non-support for MMC commands
 100  100 1b8d79c54944 mmc: core: Allow hosts to specify non-support for SD commands
 100  100 649c6059d237 mmc: mmc: Fix HS switch failure in mmc_select_hs400()
  61  100 08573eaf1a70 mmc: mmc: do not use CMD13 to get status after speed mode switch
  33  100 bc26235bbd79 mmc: debugfs: add HS400 enhanced strobe description
  74  100 81ac2af65793 mmc: core: implement enhanced strobe support
 100  100 ef29c0e273b8 mmc: core: add mmc-hs400-enhanced-strobe support
 100  100 a60119ce9434 Documentation: mmc: add mmc-hs400-enhanced-strobe
  99   78 48b4800a1c6a zsmalloc: page migration support
  88   79 bfd093f5e7f0 zsmalloc: use freeobj for index
  48   62 4aa409cab7c3 zsmalloc: separate free_zspage from putback_zspage
  66   66 3783689a1aa8 zsmalloc: introduce zspage structure
  62   86 bdb0af7ca8f0 zsmalloc: factor page chain functionality out
 100  100 1b8320b620d6 zsmalloc: use bit_spin_lock
  50   68 1fc6e27d7b86 zsmalloc: keep max_object in size_class
 100   85 b1123ea6d3b3 mm: balloon: use general non-lru movable page feature
  88   93 bda807d44454 mm: migrate: support non-lru movable page migration
  90   90 c6c919eb90e0 mm: use put_page() to free page instead of putback_lru_page()
  92  100 72704f876f50 dwc3: gadget: Implement the suspend entry event handler
 100  100 da1410be21bf usb: dwc3: gadget: Add the suspend state checking when stopping gadget
  33  100 13fa2e69b1dd usb: dwc3: gadget: disable XFER_NOT_READY
  92   35 361572b5f7a9 usb: dwc3: gadget: Handle TRB index 0 when full or empty
 100  100 7d0a038b130c usb: dwc3: gadget: Account for link TRB in TRBs left
 100  100 89bc856e5a74 usb: dwc3: gadget: Don't prepare TRBs if no space
  75  100 0d25744ad107 usb: dwc3: gadget: Initialize the TRB ring
  79   86 fc8bb91bc83e usb: dwc3: implement runtime PM
  77  100 4cb4221764ef usb: dwc3: gadget: fix for possible endpoint disable race
  45   29 51f5d49ad6f0 usb: dwc3: core: simplify suspend/resume operations
  79   91 c499ff71ff2a usb: dwc3: core: re-factor init and exit paths
  55  100 bcdb3272e889 usb: dwc3: core: move fladj to dwc3 structure
  68   80 c4233573f6ee usb: dwc3: gadget: prepare TRBs on update transfers too
 100  100 7f370ed0cfe9 usb: dwc3: core: get rid of DWC3_PM_OPS macro
  73   91 9f8a67b65a49 usb: dwc3: gadget: fix gadget suspend/resume
  68   93 d7be295243bb usb: dwc3: gadget: re-factor ->udc_start and ->udc_stop
 100  100 058b6659e98f extcon: usb-gpio: add device binding for platform device
 100  100 04c080080855 extcon: usb-gpio: Don't miss event during suspend/resume
 100  100 5fc363232ae7 uas: remove can_queue set in host template
 100  100 975756c41332 f2fs: avoid ENOSPC fault in the recovery process
  80   40 c41f3cc3ae34 f2fs: inject page allocation failures
  43   26 da011cc0da8c f2fs: move node pages only in victim section during GC
 100  100 1ee4716585ed zsmalloc: remove unused pool param in obj_free
  33   66 830e4bc5baa9 zsmalloc: clean up many BUG_ON
  67   71 36b68aae8e39 usb: dwc3: gadget: use link TRB for all endpoint types
  62   62 c28f82595dde usb: dwc3: switch trb enqueue/dequeue and first_trb_index to u8
 100  100 e4c5800a3991 mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON
 100  100 e51534c80660 mmc: core: fix using wrong io voltage if mmc_select_hs200 fails
 100  100 437db4c6e798 mmc: mmc: Attempt to flush cache before reset
 100  100 87e88659afd1 mmc: core: drop unnecessary bit checking
  97   96 d97a1e5d7cd2 mmc: pwrseq: convert to proper platform device
  75  100 f01b72d0fd53 mmc: pwrseq_emmc: add to_pwrseq_emmc() macro
  85  100 5b96fea730ab mmc: pwrseq_simple: add to_pwrseq_simple() macro
 100  100 4e6c71788d6b mmc: core: Do regular power cycle when lacking eMMC HW reset support
 100  100 6afedcd23cfd arm64: mm: Add trace_irqflags annotations to do_debug_exception()
  33  100 9772b47a4c29 usb: dwc3: gadget: Fix suspend/resume during device mode
 100  100 a0747eb81c1d mmc: core: remove redundant memset of sdio_read_cccr
 100  100 0076c71e37cc mmc: core: remove redundant memset of mmc_decode_cid
 100  100 07d97d872359 mmc: core: report tuning command execution failure reason
 100   77 cf925747d20b mmc: core: improve mmc_of_parse_voltage() to return better status
  75  100 10a16a01d8f7 mmc: core: shut up "voltage-ranges unspecified" pr_info()
 100  100 ed9feec72fc1 mmc: sanitize 'bus width' in debug output
 100   77 6067bafe44d7 mmc: core: use the defined function to check whether card is removable
 100  100 4ec96b4cbde8 mmc: make MAN_BKOPS_EN message a debug
 100  100 e5905ff1281f mmc: debugfs: Add a restriction to mmc debugfs clock setting
 100  100 0899e7419387 mmc: remove unnecessary assignment statements before return
 100  100 62c03ca3ffa1 mmc: core: pwrseq_simple: remove unused header file
  33   33 85ead8185a76 f2fs: delete unnecessary wait for page writeback
 100  100 4ec0ef3a8212 USB: iowarrior: fix oops with malicious USB descriptors
 100  100 5821a33b9bbd Staging: Android: align code with open parenthesis in ion_carveout_heap.c
 100  100 9f93a8a0ba91 crypto: api - Introduce crypto_queue_len() helper function
 100   92 06b241f32c71 mm: __delete_from_page_cache show Bad page if mapped
 100  100 c0992d0f5484 USB: serial: option: add support for Quectel UC20
  71   42 3158a8d416f4 USB: option: add support for SIM7100E
  87   50 ff4e2494dc17 USB: serial: option: Adding support for Telit LE922
  90  100 64a67d4762ce mmc: pwrseq_simple: Make reset-gpios optional to match doc
 100  100 c10368897e10 ALSA: compress: add support for 32bit calls in a 64bit kernel
  99  100 a5beaaf39455 usb: gadget: Add the console support for usb-to-serial port
 100  100 100a606d54a0 mmc: core: Introduce MMC_CAP2_NO_SDIO cap
  66  100 ffedbd2210f2 mmc: pwrseq: constify mmc_pwrseq_ops structures
  66  100 1ff2575bcf42 mmc: core: Check for non-removable cards earlier in the error path
 100  100 c29536e85b5f mmc: core: Make runtime resume default behavior for MMC/SD
 100  100 d234d2123fa7 mmc: core: Keep host claimed in mmc_rescan() while calling host ops
 100  100 86236813ff23 mmc: core: Invoke ->card_event() callback only when needed

Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mmc@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: dccp@vger.kernel.org
Cc: alsa-devel@alsa-project.org

^ permalink raw reply

* [BACKPORT 4.4.y 19/25] serial: sprd: adjust TIMEOUT to a big value
From: Arnd Bergmann @ 2019-03-22 15:44 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Jiri Slaby, Orson Zhai, Baolin Wang,
	Chunyan Zhang
  Cc: Wei Qiao, Chunyan Zhang, Arnd Bergmann, Lanqing Liu, linux-serial,
	linux-kernel
In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de>

From: Wei Qiao <wei.qiao@spreadtrum.com>

SPRD_TIMEOUT was 256, which is too small to wait until the status
switched to workable in a while loop, so that the earlycon could
not work correctly.

Signed-off-by: Wei Qiao <wei.qiao@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e1dc9b08051a2c2e694edf48d1e704f07c7c143c)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/sprd_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 1e302caaa450..176f0a2bf9d9 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -36,7 +36,7 @@
 #define SPRD_FIFO_SIZE		128
 #define SPRD_DEF_RATE		26000000
 #define SPRD_BAUD_IO_LIMIT	3000000
-#define SPRD_TIMEOUT		256
+#define SPRD_TIMEOUT		256000
 
 /* the offset of serial registers and BITs for them */
 /* data registers */
-- 
2.20.0

^ permalink raw reply related

* [BACKPORT 4.4.y 23/25] serial: sprd: clear timeout interrupt only rather than all interrupts
From: Arnd Bergmann @ 2019-03-22 15:44 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Jiri Slaby, Orson Zhai, Baolin Wang,
	Chunyan Zhang
  Cc: Lanqing Liu, Chunyan Zhang, Arnd Bergmann, Lanqing Liu,
	linux-serial, linux-kernel
In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de>

From: Lanqing Liu <lanqing.liu@spreadtrum.com>

On Spreadtrum's serial device, nearly all of interrupts would be cleared
by hardware except timeout interrupt.  This patch removed the operation
of clearing all interrupt in irq handler, instead added an if statement
to check if the timeout interrupt is supposed to be cleared.

Wrongly clearing timeout interrupt would lead to uart data stay in rx
fifo, that means the driver cannot read them out anymore.

Signed-off-by: Lanqing Liu <lanqing.liu@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4350782570b919f254c1e083261a21c19fcaee90)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/sprd_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 176f0a2bf9d9..c894eca57e73 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -63,6 +63,7 @@
 
 /* interrupt clear register */
 #define SPRD_ICLR		0x0014
+#define SPRD_ICLR_TIMEOUT	BIT(13)
 
 /* line control register */
 #define SPRD_LCR		0x0018
@@ -298,7 +299,8 @@ static irqreturn_t sprd_handle_irq(int irq, void *dev_id)
 		return IRQ_NONE;
 	}
 
-	serial_out(port, SPRD_ICLR, ~0);
+	if (ims & SPRD_IMSR_TIMEOUT)
+		serial_out(port, SPRD_ICLR, SPRD_ICLR_TIMEOUT);
 
 	if (ims & (SPRD_IMSR_RX_FIFO_FULL |
 		SPRD_IMSR_BREAK_DETECT | SPRD_IMSR_TIMEOUT))
-- 
2.20.0

^ permalink raw reply related

* Re: [PATCH] tty: serial: qcom_geni_serial: Initialize baud in qcom_geni_console_setup
From: Nick Desaulniers @ 2019-03-22 18:04 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Nathan Chancellor, Andy Gross, David Brown, Greg Kroah-Hartman,
	linux-arm-msm, linux-serial, Linux Kernel Mailing List,
	clang-built-linux
In-Reply-To: <CAK8P3a38rvqVhgVGx36Rii0BaBskAnxsfHYye=8pi9n_hKNrbg@mail.gmail.com>

On Fri, Mar 22, 2019 at 7:20 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Fri, Mar 8, 2019 at 7:38 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > When building with -Wsometimes-uninitialized, Clang warns:
> >
> > drivers/tty/serial/qcom_geni_serial.c:1079:6: warning: variable 'baud'
> > is used uninitialized whenever 'if' condition is false
> > [-Wsometimes-uninitialized]
> >
> > It's not wrong; when options is NULL, baud has no default value. Use
> > 9600 as that is a sane default.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/395
> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/tty/serial/qcom_geni_serial.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> > index 3bcec1c20219..35e5f9c5d5be 100644
> > --- a/drivers/tty/serial/qcom_geni_serial.c
> > +++ b/drivers/tty/serial/qcom_geni_serial.c
> > @@ -1050,7 +1050,7 @@ static int __init qcom_geni_console_setup(struct console *co, char *options)
> >  {
> >         struct uart_port *uport;
> >         struct qcom_geni_serial_port *port;
> > -       int baud;
> > +       int baud = 9600;
> >         int bits = 8;
> >         int parity = 'n';
> >         int flow = 'n';
>
> I made a similar patch here, but after looking at the driver concluded
> that the bitrate had to be 115200, since that is used as the default
> value otherwise.

Good point, we use this driver for Pixel, and I usually connect with a
baud rate of 115200.

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply

* [PATCH 00/24] arm64: mediatek: add support for Pumpkin MT8516 board
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg, robh+dt, mark.rutland
  Cc: linux-arm-kernel, devicetree, ryder.lee, linux-watchdog,
	jjian.zhou, wenzhen.yu, stephane.leprovost, sean.wang, linux-mmc,
	linux-kernel, yong.mao, linux-spi, linux-gpio, linux-mediatek,
	hsin-hsiung.wang, linux-serial, Fabien Parent, linux-clk,
	chaotian.jing, linux-i2c

The pumpkin board is designed by Gossamer Engineering and is
using a MediaTek SoC. The board currently comes in two available
version: MT8516 SoC and MT8167 SoC.

The board provides the following IOs: eMMC, NAND, SD card, USB 2 type-A,
Ethernet, Wi-Fi, Bluetooth, Audio (jack out, 2 PDM port, 1 analog in),
serial over USB, and an expansion header.

This patch series adds the basic board support to be able to boot
on the eMMC of the MT8516 based Pumpkin board.

The board is using a MT6392 PMIC.

Fabien Parent (24):
  dt-bindings: regulator: add support for MT6392
  regulator: mt6392: Add support for MT6392 regulator
  dt-bindings: pwrap: mediatek: add pwrap support for MT8516
  soc: mediatek: pwrap: add missing check on rstc
  soc: mediatek: pwrap: add support for MT8516 pwrap
  mfd: mt6397: Add support for MT6397 pmic
  arm64: dts: mt6392: Add PMIC mt6392 dtsi
  dt-bindings: mmc: mtk-sd: add mtk-sd support for MT8516
  mmc: mtk-sd: check for valid optional memory resource
  mmc: mtk-sd: add support for MT8516
  dt-bindings: mediatek: topckgen: add support for MT8516
  dt-bindings: mediatek: infracfg: add support for MT8516
  dt-bindings: mediatek: apmixedsys: add support for MT8516
  clk: mediatek: add clock driver for MT8516
  dt-bindings: pinctrl: pinctrl-mt65xx: add support for MT8516
  pinctrl: mediatek: Add MT8516 Pinctrl driver
  dt-bindings: wdog: mtk-wdt: add support for MT851
  dt-bindings: timer: mtk-timer: add support for MT8516
  dt-bindings: spi: spi-mt65xx: add support for MT8516
  dt-bindings: serial: mtk-uart: add support for MT8516
  dt-bindings: irq: mtk,sysirq: add support for MT8516
  dt-bindings: i2c: i2c-mtk: add support for MT8516
  arm64: dts: mediatek: add dtsi for MT8516
  arm64: dts: mediatek: add pumpkin board dts

 .../arm/mediatek/mediatek,apmixedsys.txt      |    1 +
 .../arm/mediatek/mediatek,infracfg.txt        |    1 +
 .../arm/mediatek/mediatek,topckgen.txt        |    1 +
 .../devicetree/bindings/i2c/i2c-mtk.txt       |    1 +
 .../interrupt-controller/mediatek,sysirq.txt  |    3 +-
 .../devicetree/bindings/mmc/mtk-sd.txt        |    1 +
 .../bindings/pinctrl/pinctrl-mt65xx.txt       |    1 +
 .../bindings/regulator/mt6392-regulator.txt   |  220 +++
 .../devicetree/bindings/serial/mtk-uart.txt   |    1 +
 .../bindings/soc/mediatek/pwrap.txt           |    1 +
 .../devicetree/bindings/spi/spi-mt65xx.txt    |    1 +
 .../bindings/timer/mediatek,mtk-timer.txt     |    1 +
 .../devicetree/bindings/watchdog/mtk-wdt.txt  |    1 +
 arch/arm64/boot/dts/mediatek/Makefile         |    1 +
 arch/arm64/boot/dts/mediatek/mt6392.dtsi      |  208 +++
 arch/arm64/boot/dts/mediatek/mt8516-pinfunc.h |  663 +++++++++
 .../boot/dts/mediatek/mt8516-pumpkin.dts      |   19 +
 arch/arm64/boot/dts/mediatek/mt8516.dtsi      |  409 ++++++
 .../boot/dts/mediatek/pumpkin-common.dtsi     |  210 +++
 .../dts/mediatek/pumpkin-emmc-common.dtsi     |   75 ++
 drivers/clk/mediatek/Kconfig                  |    9 +
 drivers/clk/mediatek/Makefile                 |    1 +
 drivers/clk/mediatek/clk-mt8516.c             |  815 ++++++++++++
 drivers/mfd/mt6397-core.c                     |   96 ++
 drivers/mmc/host/mtk-sd.c                     |   19 +-
 drivers/pinctrl/mediatek/Kconfig              |    7 +
 drivers/pinctrl/mediatek/Makefile             |    1 +
 drivers/pinctrl/mediatek/pinctrl-mt8516.c     |  384 ++++++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h | 1182 +++++++++++++++++
 drivers/regulator/Kconfig                     |    9 +
 drivers/regulator/Makefile                    |    1 +
 drivers/regulator/mt6392-regulator.c          |  490 +++++++
 drivers/soc/mediatek/mtk-pmic-wrap.c          |  109 +-
 include/dt-bindings/clock/mt8516-clk.h        |  211 +++
 include/linux/mfd/mt6392/core.h               |   42 +
 include/linux/mfd/mt6392/registers.h          |  487 +++++++
 include/linux/regulator/mt6392-regulator.h    |   40 +
 37 files changed, 5717 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6392-regulator.txt
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6392.dtsi
 create mode 100644 arch/arm64/boot/dts/mediatek/mt8516-pinfunc.h
 create mode 100644 arch/arm64/boot/dts/mediatek/mt8516-pumpkin.dts
 create mode 100644 arch/arm64/boot/dts/mediatek/mt8516.dtsi
 create mode 100644 arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi
 create mode 100644 arch/arm64/boot/dts/mediatek/pumpkin-emmc-common.dtsi
 create mode 100644 drivers/clk/mediatek/clk-mt8516.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8516.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h
 create mode 100644 drivers/regulator/mt6392-regulator.c
 create mode 100644 include/dt-bindings/clock/mt8516-clk.h
 create mode 100644 include/linux/mfd/mt6392/core.h
 create mode 100644 include/linux/mfd/mt6392/registers.h
 create mode 100644 include/linux/regulator/mt6392-regulator.h

-- 
2.20.1

^ permalink raw reply

* [PATCH 01/24] dt-bindings: regulator: add support for MT6392
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg, robh+dt, mark.rutland
  Cc: sean.wang, ryder.lee, hsin-hsiung.wang, wenzhen.yu, chaotian.jing,
	yong.mao, jjian.zhou, devicetree, linux-kernel, linux-i2c,
	linux-arm-kernel, linux-mediatek, linux-mmc, linux-gpio,
	linux-serial, linux-spi, linux-watchdog, linux-clk,
	stephane.leprovost, Fabien Parent
In-Reply-To: <20190323211612.860-1-fparent@baylibre.com>

Add binding documentation of the regulator for MT6392 SoCs.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 .../bindings/regulator/mt6392-regulator.txt   | 220 ++++++++++++++++++
 1 file changed, 220 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6392-regulator.txt

diff --git a/Documentation/devicetree/bindings/regulator/mt6392-regulator.txt b/Documentation/devicetree/bindings/regulator/mt6392-regulator.txt
new file mode 100644
index 000000000000..edf207c838dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/mt6392-regulator.txt
@@ -0,0 +1,220 @@
+Mediatek MT6392 Regulator
+
+Required properties:
+- compatible: "mediatek,mt6392-regulator"
+- mt6392regulator: List of regulators provided by this controller. It is named
+  according to its regulator type, buck_<name> and ldo_<name>.
+  The definition for each of these nodes is defined using the standard binding
+  for regulators at Documentation/devicetree/bindings/regulator/regulator.txt.
+
+The valid names for regulators are::
+BUCK:
+  buck_vproc, buck_vsys, buck_vcore
+LDO:
+  ldo_vxo22, ldo_vaud22, ldo_vcama, ldo_vaud28, ldo_vadc18, ldo_vcn35,
+  ldo_vio28. ldo_vusb, ldo_vmc, ldo_vmch, ldo_vemc3v3, ldo_vgp1, ldo_vgp2,
+  ldo_vcn18, ldo_vcamaf, ldo_vm, ldo_vio18, ldo_vcamd, ldo_vcamio, ldo_vm25,
+  ldo_vefuse
+
+Example:
+	pmic: mt6392 {
+		compatible = "mediatek,mt6392", "mediatek,mt6323";
+		mediatek,system-power-controller;
+
+		mt6392_regulator: mt6392_regulator {
+			compatible = "mediatek,mt6392-regulator";
+
+			mt6392_vproc_reg: buck_vproc {
+				regulator-name = "buck_vproc";
+				regulator-min-microvolt = < 700000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <12500>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vsys_reg: buck_vsys {
+				regulator-name = "buck_vsys";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <2987500>;
+				regulator-ramp-delay = <25000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcore_reg: buck_vcore {
+				regulator-name = "buck_vcore";
+				regulator-min-microvolt = < 700000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <12500>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vxo22_reg: ldo_vxo22 {
+				regulator-name = "ldo_vxo22";
+				regulator-min-microvolt = <2200000>;
+				regulator-max-microvolt = <2200000>;
+				regulator-enable-ramp-delay = <110>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vaud22_reg: ldo_vaud22 {
+				regulator-name = "ldo_vaud22";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2200000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcama_reg: ldo_vcama {
+				regulator-name = "ldo_vcama";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vaud28_reg: ldo_vaud28 {
+				regulator-name = "ldo_vaud28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vadc18_reg: ldo_vadc18 {
+				regulator-name = "ldo_vadc18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcn35_reg: ldo_vcn35 {
+				regulator-name = "ldo_vcn35";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3600000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vio28_reg: ldo_vio28 {
+				regulator-name = "ldo_vio28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vusb_reg: ldo_vusb {
+				regulator-name = "ldo_vusb";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vmc_reg: ldo_vmc {
+				regulator-name = "ldo_vmc";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vmch_reg: ldo_vmch {
+				regulator-name = "ldo_vmch";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vemc3v3_reg: ldo_vemc3v3 {
+				regulator-name = "ldo_vemc3v3";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vgp1_reg: ldo_vgp1 {
+				regulator-name = "ldo_vgp1";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vgp2_reg: ldo_vgp2 {
+				regulator-name = "ldo_vgp2";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcn18_reg: ldo_vcn18 {
+				regulator-name = "ldo_vcn18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcamaf_reg: ldo_vcamaf {
+				regulator-name = "ldo_vcamaf";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vm_reg: ldo_vm {
+				regulator-name = "ldo_vm";
+				regulator-min-microvolt = <1240000>;
+				regulator-max-microvolt = <1390000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vio18_reg: ldo_vio18 {
+				regulator-name = "ldo_vio18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcamd_reg: ldo_vcamd {
+				regulator-name = "ldo_vcamd";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcamio_reg: ldo_vcamio {
+				regulator-name = "ldo_vcamio";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vm25_reg: ldo_vm25 {
+				regulator-name = "ldo_vm25";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vefuse_reg: ldo_vefuse {
+				regulator-name = "ldo_vefuse";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2000000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+		};
+	};
-- 
2.20.1

^ permalink raw reply related

* [PATCH 02/24] regulator: mt6392: Add support for MT6392 regulator
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg, robh+dt, mark.rutland
  Cc: sean.wang, ryder.lee, hsin-hsiung.wang, wenzhen.yu, chaotian.jing,
	yong.mao, jjian.zhou, devicetree, linux-kernel, linux-i2c,
	linux-arm-kernel, linux-mediatek, linux-mmc, linux-gpio,
	linux-serial, linux-spi, linux-watchdog, linux-clk,
	stephane.leprovost, Fabien Parent
In-Reply-To: <20190323211612.860-1-fparent@baylibre.com>

The MT6392 is a regulator found on boards based on the MediaTek
MT8167, MT8516, and probably other SoCs. It is a so called PMIC and
connectcts as a slave to a SoC using SPI, wrapped inside PWRAP.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 drivers/regulator/Kconfig                  |   9 +
 drivers/regulator/Makefile                 |   1 +
 drivers/regulator/mt6392-regulator.c       | 490 +++++++++++++++++++++
 include/linux/regulator/mt6392-regulator.h |  40 ++
 4 files changed, 540 insertions(+)
 create mode 100644 drivers/regulator/mt6392-regulator.c
 create mode 100644 include/linux/regulator/mt6392-regulator.h

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index b7f249ee5e68..c0109005128c 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -624,6 +624,15 @@ config REGULATOR_MT6380
 	  This driver supports the control of different power rails of device
 	  through regulator interface.
 
+config REGULATOR_MT6392
+	tristate "MediaTek MT6392 PMIC"
+	depends on MFD_MT6397
+	help
+	  Say y here to select this option to enable the power regulator of
+	  MediaTek MT6392 PMIC.
+	  This driver supports the control of different power rails of device
+	  through regulator interface.
+
 config REGULATOR_MT6397
 	tristate "MediaTek MT6397 PMIC"
 	depends on MFD_MT6397
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 1169f8a27d91..5b8da206412e 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_REGULATOR_MCP16502) += mcp16502.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
+obj-$(CONFIG_REGULATOR_MT6392)	+= mt6392-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o
diff --git a/drivers/regulator/mt6392-regulator.c b/drivers/regulator/mt6392-regulator.c
new file mode 100644
index 000000000000..d3c0e94d4cd0
--- /dev/null
+++ b/drivers/regulator/mt6392-regulator.c
@@ -0,0 +1,490 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Chen Zhong <chen.zhong@mediatek.com>
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/mt6397/core.h>
+#include <linux/mfd/mt6392/registers.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/machine.h>
+#include <linux/regulator/mt6392-regulator.h>
+#include <linux/regulator/of_regulator.h>
+
+#define MT6392_BUCK_MODE_AUTO	0
+#define MT6392_BUCK_MODE_FORCE_PWM	1
+#define MT6392_LDO_MODE_NORMAL	0
+#define MT6392_LDO_MODE_LP	1
+
+/*
+ * MT6392 regulators' information
+ *
+ * @desc: standard fields of regulator description.
+ * @qi: Mask for query enable signal status of regulators
+ * @vselon_reg: Register sections for hardware control mode of bucks
+ * @vselctrl_reg: Register for controlling the buck control mode.
+ * @vselctrl_mask: Mask for query buck's voltage control mode.
+ */
+struct mt6392_regulator_info {
+	struct regulator_desc desc;
+	u32 qi;
+	u32 vselon_reg;
+	u32 vselctrl_reg;
+	u32 vselctrl_mask;
+	u32 modeset_reg;
+	u32 modeset_mask;
+};
+
+#define MT6392_BUCK(match, vreg, min, max, step, volt_ranges, enreg,	\
+		vosel, vosel_mask, voselon, vosel_ctrl,			\
+		_modeset_reg, _modeset_mask)				\
+[MT6392_ID_##vreg] = {							\
+	.desc = {							\
+		.name = #vreg,						\
+		.of_match = of_match_ptr(match),			\
+		.ops = &mt6392_volt_range_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.id = MT6392_ID_##vreg,					\
+		.owner = THIS_MODULE,					\
+		.n_voltages = (max - min)/step + 1,			\
+		.linear_ranges = volt_ranges,				\
+		.n_linear_ranges = ARRAY_SIZE(volt_ranges),		\
+		.vsel_reg = vosel,					\
+		.vsel_mask = vosel_mask,				\
+		.enable_reg = enreg,					\
+		.enable_mask = BIT(0),					\
+	},								\
+	.qi = BIT(13),							\
+	.vselon_reg = voselon,						\
+	.vselctrl_reg = vosel_ctrl,					\
+	.vselctrl_mask = BIT(1),					\
+	.modeset_reg = _modeset_reg,					\
+	.modeset_mask = _modeset_mask,					\
+}
+
+#define MT6392_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel,	\
+		vosel_mask, _modeset_reg, _modeset_mask)		\
+[MT6392_ID_##vreg] = {							\
+	.desc = {							\
+		.name = #vreg,						\
+		.of_match = of_match_ptr(match),			\
+		.ops = &mt6392_volt_table_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.id = MT6392_ID_##vreg,					\
+		.owner = THIS_MODULE,					\
+		.n_voltages = ARRAY_SIZE(ldo_volt_table),		\
+		.volt_table = ldo_volt_table,				\
+		.vsel_reg = vosel,					\
+		.vsel_mask = vosel_mask,				\
+		.enable_reg = enreg,					\
+		.enable_mask = BIT(enbit),				\
+	},								\
+	.qi = BIT(15),							\
+	.modeset_reg = _modeset_reg,					\
+	.modeset_mask = _modeset_mask,					\
+}
+
+#define MT6392_REG_FIXED(match, vreg, enreg, enbit, volt,		\
+		_modeset_reg, _modeset_mask)				\
+[MT6392_ID_##vreg] = {							\
+	.desc = {							\
+		.name = #vreg,						\
+		.of_match = of_match_ptr(match),			\
+		.ops = &mt6392_volt_fixed_ops,				\
+		.type = REGULATOR_VOLTAGE,				\
+		.id = MT6392_ID_##vreg,					\
+		.owner = THIS_MODULE,					\
+		.n_voltages = 1,					\
+		.enable_reg = enreg,					\
+		.enable_mask = BIT(enbit),				\
+		.min_uV = volt,						\
+	},								\
+	.qi = BIT(15),							\
+	.modeset_reg = _modeset_reg,					\
+	.modeset_mask = _modeset_mask,					\
+}
+
+static const struct regulator_linear_range buck_volt_range1[] = {
+	REGULATOR_LINEAR_RANGE(700000, 0, 0x7f, 6250),
+};
+
+static const struct regulator_linear_range buck_volt_range2[] = {
+	REGULATOR_LINEAR_RANGE(1400000, 0, 0x7f, 12500),
+};
+
+static const u32 ldo_volt_table1[] = {
+	1800000, 1900000, 2000000, 2200000,
+};
+
+static const u32 ldo_volt_table2[] = {
+	3300000, 3400000, 3500000, 3600000,
+};
+
+static const u32 ldo_volt_table3[] = {
+	1800000, 3300000,
+};
+
+static const u32 ldo_volt_table4[] = {
+	3000000, 3300000,
+};
+
+static const u32 ldo_volt_table5[] = {
+	1200000, 1300000, 1500000, 1800000, 2000000, 2800000, 3000000, 3300000,
+};
+
+static const u32 ldo_volt_table6[] = {
+	1240000, 1390000,
+};
+
+static const u32 ldo_volt_table7[] = {
+	1200000, 1300000, 1500000, 1800000,
+};
+
+static const u32 ldo_volt_table8[] = {
+	1800000, 2000000,
+};
+
+static int mt6392_get_status(struct regulator_dev *rdev)
+{
+	int ret;
+	u32 regval;
+	struct mt6392_regulator_info *info = rdev_get_drvdata(rdev);
+
+	ret = regmap_read(rdev->regmap, info->desc.enable_reg, &regval);
+	if (ret != 0) {
+		dev_err(&rdev->dev, "Failed to get enable reg: %d\n", ret);
+		return ret;
+	}
+
+	return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF;
+}
+
+static int mt6392_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+	int ret, val = 0;
+	struct mt6392_regulator_info *info = rdev_get_drvdata(rdev);
+	u32 reg_value;
+
+	if (!info->modeset_mask) {
+		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
+			info->desc.name);
+		return -EINVAL;
+	}
+
+	switch (mode) {
+	case REGULATOR_MODE_FAST:
+		val = MT6392_BUCK_MODE_FORCE_PWM;
+		break;
+	case REGULATOR_MODE_NORMAL:
+		val = MT6392_BUCK_MODE_AUTO;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	val <<= ffs(info->modeset_mask) - 1;
+
+	ret = regmap_update_bits(rdev->regmap, info->modeset_reg,
+				  info->modeset_mask, val);
+
+	if (regmap_read(rdev->regmap, info->modeset_reg, &reg_value) < 0) {
+		dev_err(&rdev->dev, "Failed to read register value\n");
+		return -EIO;
+	}
+
+	return ret;
+}
+
+static unsigned int mt6392_buck_get_mode(struct regulator_dev *rdev)
+{
+	unsigned int val;
+	unsigned int mode;
+	int ret;
+	struct mt6392_regulator_info *info = rdev_get_drvdata(rdev);
+
+	if (!info->modeset_mask) {
+		dev_err(&rdev->dev, "regulator %s doesn't support get_mode\n",
+			info->desc.name);
+		return -EINVAL;
+	}
+
+	ret = regmap_read(rdev->regmap, info->modeset_reg, &val);
+	if (ret < 0)
+		return ret;
+
+	val &= info->modeset_mask;
+	val >>= ffs(info->modeset_mask) - 1;
+
+	if (val & 0x1)
+		mode = REGULATOR_MODE_FAST;
+	else
+		mode = REGULATOR_MODE_NORMAL;
+
+	return mode;
+}
+
+static int mt6392_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+	int ret, val = 0;
+	struct mt6392_regulator_info *info = rdev_get_drvdata(rdev);
+
+	if (!info->modeset_mask) {
+		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
+			info->desc.name);
+		return -EINVAL;
+	}
+
+	switch (mode) {
+	case REGULATOR_MODE_STANDBY:
+		val = MT6392_LDO_MODE_LP;
+		break;
+	case REGULATOR_MODE_NORMAL:
+		val = MT6392_LDO_MODE_NORMAL;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	val <<= ffs(info->modeset_mask) - 1;
+
+	ret = regmap_update_bits(rdev->regmap, info->modeset_reg,
+				  info->modeset_mask, val);
+
+	return ret;
+}
+
+static unsigned int mt6392_ldo_get_mode(struct regulator_dev *rdev)
+{
+	unsigned int val;
+	unsigned int mode;
+	int ret;
+	struct mt6392_regulator_info *info = rdev_get_drvdata(rdev);
+
+	if (!info->modeset_mask) {
+		dev_err(&rdev->dev, "regulator %s doesn't support get_mode\n",
+			info->desc.name);
+		return -EINVAL;
+	}
+
+	ret = regmap_read(rdev->regmap, info->modeset_reg, &val);
+	if (ret < 0)
+		return ret;
+
+	val &= info->modeset_mask;
+	val >>= ffs(info->modeset_mask) - 1;
+
+	if (val & 0x1)
+		mode = REGULATOR_MODE_STANDBY;
+	else
+		mode = REGULATOR_MODE_NORMAL;
+
+	return mode;
+}
+
+static const struct regulator_ops mt6392_volt_range_ops = {
+	.list_voltage = regulator_list_voltage_linear_range,
+	.map_voltage = regulator_map_voltage_linear_range,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_time_sel = regulator_set_voltage_time_sel,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.get_status = mt6392_get_status,
+	.set_mode = mt6392_buck_set_mode,
+	.get_mode = mt6392_buck_get_mode,
+};
+
+static const struct regulator_ops mt6392_volt_table_ops = {
+	.list_voltage = regulator_list_voltage_table,
+	.map_voltage = regulator_map_voltage_iterate,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_time_sel = regulator_set_voltage_time_sel,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.get_status = mt6392_get_status,
+	.set_mode = mt6392_ldo_set_mode,
+	.get_mode = mt6392_ldo_get_mode,
+};
+
+static const struct regulator_ops mt6392_volt_fixed_ops = {
+	.list_voltage = regulator_list_voltage_linear,
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.get_status = mt6392_get_status,
+	.set_mode = mt6392_ldo_set_mode,
+	.get_mode = mt6392_ldo_get_mode,
+};
+
+/* The array is indexed by id(MT6392_ID_XXX) */
+static struct mt6392_regulator_info mt6392_regulators[] = {
+	MT6392_BUCK("buck_vproc", VPROC, 700000, 1493750, 6250,
+		buck_volt_range1, MT6392_VPROC_CON7, MT6392_VPROC_CON9, 0x7f,
+		MT6392_VPROC_CON10, MT6392_VPROC_CON5, MT6392_VPROC_CON2,
+		0x100),
+	MT6392_BUCK("buck_vsys", VSYS, 1400000, 2987500, 12500,
+		buck_volt_range2, MT6392_VSYS_CON7, MT6392_VSYS_CON9, 0x7f,
+		MT6392_VSYS_CON10, MT6392_VSYS_CON5, MT6392_VSYS_CON2, 0x100),
+	MT6392_BUCK("buck_vcore", VCORE, 700000, 1493750, 6250,
+		buck_volt_range1, MT6392_VCORE_CON7, MT6392_VCORE_CON9, 0x7f,
+		MT6392_VCORE_CON10, MT6392_VCORE_CON5, MT6392_VCORE_CON2,
+		0x100),
+	MT6392_REG_FIXED("ldo_vxo22", VXO22, MT6392_ANALDO_CON1, 10, 2200000,
+		MT6392_ANALDO_CON1, 0x2),
+	MT6392_LDO("ldo_vaud22", VAUD22, ldo_volt_table1,
+		MT6392_ANALDO_CON2, 14, MT6392_ANALDO_CON8, 0x60,
+		MT6392_ANALDO_CON2, 0x2),
+	MT6392_REG_FIXED("ldo_vcama", VCAMA, MT6392_ANALDO_CON4, 15, 2800000,
+		-1, 0),
+	MT6392_REG_FIXED("ldo_vaud28", VAUD28, MT6392_ANALDO_CON23, 14, 2800000,
+		MT6392_ANALDO_CON23, 0x2),
+	MT6392_REG_FIXED("ldo_vadc18", VADC18, MT6392_ANALDO_CON25, 14, 1800000,
+		MT6392_ANALDO_CON25, 0x2),
+	MT6392_LDO("ldo_vcn35", VCN35, ldo_volt_table2,
+		MT6392_ANALDO_CON21, 12, MT6392_ANALDO_CON16, 0xC,
+		MT6392_ANALDO_CON21, 0x2),
+	MT6392_REG_FIXED("ldo_vio28", VIO28, MT6392_DIGLDO_CON0, 14, 2800000,
+		MT6392_DIGLDO_CON0, 0x2),
+	MT6392_REG_FIXED("ldo_vusb", VUSB, MT6392_DIGLDO_CON2, 14, 3300000,
+		MT6392_DIGLDO_CON2, 0x2),
+	MT6392_LDO("ldo_vmc", VMC, ldo_volt_table3,
+		MT6392_DIGLDO_CON3, 12, MT6392_DIGLDO_CON24, 0x10,
+		MT6392_DIGLDO_CON3, 0x2),
+	MT6392_LDO("ldo_vmch", VMCH, ldo_volt_table4,
+		MT6392_DIGLDO_CON5, 14, MT6392_DIGLDO_CON26, 0x80,
+		MT6392_DIGLDO_CON5, 0x2),
+	MT6392_LDO("ldo_vemc3v3", VEMC3V3, ldo_volt_table4,
+		MT6392_DIGLDO_CON6, 14, MT6392_DIGLDO_CON27, 0x80,
+		MT6392_DIGLDO_CON6, 0x2),
+	MT6392_LDO("ldo_vgp1", VGP1, ldo_volt_table5,
+		MT6392_DIGLDO_CON7, 15, MT6392_DIGLDO_CON28, 0xE0,
+		MT6392_DIGLDO_CON7, 0x2),
+	MT6392_LDO("ldo_vgp2", VGP2, ldo_volt_table5,
+		MT6392_DIGLDO_CON8, 15, MT6392_DIGLDO_CON29, 0xE0,
+		MT6392_DIGLDO_CON8, 0x2),
+	MT6392_REG_FIXED("ldo_vcn18", VCN18, MT6392_DIGLDO_CON11, 14, 1800000,
+		MT6392_DIGLDO_CON11, 0x2),
+	MT6392_LDO("ldo_vcamaf", VCAMAF, ldo_volt_table5,
+		MT6392_DIGLDO_CON31, 15, MT6392_DIGLDO_CON32, 0xE0,
+		MT6392_DIGLDO_CON31, 0x2),
+	MT6392_LDO("ldo_vm", VM, ldo_volt_table6,
+		MT6392_DIGLDO_CON47, 14, MT6392_DIGLDO_CON48, 0x30,
+		MT6392_DIGLDO_CON47, 0x2),
+	MT6392_REG_FIXED("ldo_vio18", VIO18, MT6392_DIGLDO_CON49, 14, 1800000,
+		MT6392_DIGLDO_CON49, 0x2),
+	MT6392_LDO("ldo_vcamd", VCAMD, ldo_volt_table7,
+		MT6392_DIGLDO_CON51, 14, MT6392_DIGLDO_CON52, 0x60,
+		MT6392_DIGLDO_CON51, 0x2),
+	MT6392_REG_FIXED("ldo_vcamio", VCAMIO, MT6392_DIGLDO_CON53, 14, 1800000,
+		MT6392_DIGLDO_CON53, 0x2),
+	MT6392_REG_FIXED("ldo_vm25", VM25, MT6392_DIGLDO_CON55, 14, 2500000,
+		MT6392_DIGLDO_CON55, 0x2),
+	MT6392_LDO("ldo_vefuse", VEFUSE, ldo_volt_table8,
+		MT6392_DIGLDO_CON57, 14, MT6392_DIGLDO_CON58, 0x10,
+		MT6392_DIGLDO_CON57, 0x2),
+};
+
+static int mt6392_set_buck_vosel_reg(struct platform_device *pdev)
+{
+	struct mt6397_chip *mt6392 = dev_get_drvdata(pdev->dev.parent);
+	int i;
+	u32 regval;
+
+	for (i = 0; i < MT6392_MAX_REGULATOR; i++) {
+		if (mt6392_regulators[i].vselctrl_reg) {
+			if (regmap_read(mt6392->regmap,
+				mt6392_regulators[i].vselctrl_reg,
+				&regval) < 0) {
+				dev_err(&pdev->dev,
+					"Failed to read buck ctrl\n");
+				return -EIO;
+			}
+
+			if (regval & mt6392_regulators[i].vselctrl_mask) {
+				mt6392_regulators[i].desc.vsel_reg =
+				mt6392_regulators[i].vselon_reg;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int mt6392_regulator_probe(struct platform_device *pdev)
+{
+	struct mt6397_chip *mt6392 = dev_get_drvdata(pdev->dev.parent);
+	struct regulator_config config = {};
+	struct regulator_dev *rdev;
+	struct regulation_constraints *c;
+	int i;
+	u32 reg_value;
+
+	/* Query buck controller to select activated voltage register part */
+	if (mt6392_set_buck_vosel_reg(pdev))
+		return -EIO;
+
+	/* Read PMIC chip revision to update constraints and voltage table */
+	if (regmap_read(mt6392->regmap, MT6392_CID, &reg_value) < 0) {
+		dev_err(&pdev->dev, "Failed to read Chip ID\n");
+		return -EIO;
+	}
+
+	dev_info(&pdev->dev, "Chip ID = 0x%x\n", reg_value);
+
+	for (i = 0; i < MT6392_MAX_REGULATOR; i++) {
+		config.dev = &pdev->dev;
+		config.driver_data = &mt6392_regulators[i];
+		config.regmap = mt6392->regmap;
+		rdev = devm_regulator_register(&pdev->dev,
+				&mt6392_regulators[i].desc, &config);
+		if (IS_ERR(rdev)) {
+			dev_err(&pdev->dev, "failed to register %s\n",
+				mt6392_regulators[i].desc.name);
+			return PTR_ERR(rdev);
+		}
+
+		/* Constrain board-specific capabilities according to what
+		 * this driver and the chip itself can actually do.
+		 */
+		c = rdev->constraints;
+		c->valid_modes_mask |= REGULATOR_MODE_NORMAL|
+			REGULATOR_MODE_STANDBY | REGULATOR_MODE_FAST;
+		c->valid_ops_mask |= REGULATOR_CHANGE_MODE;
+
+	}
+	return 0;
+}
+
+static const struct platform_device_id mt6392_platform_ids[] = {
+	{"mt6392-regulator", 0},
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(platform, mt6392_platform_ids);
+
+static const struct of_device_id mt6392_of_match[] = {
+	{ .compatible = "mediatek,mt6392-regulator", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, mt6392_of_match);
+
+static struct platform_driver mt6392_regulator_driver = {
+	.driver = {
+		.name = "mt6392-regulator",
+		.of_match_table = of_match_ptr(mt6392_of_match),
+	},
+	.probe = mt6392_regulator_probe,
+	.id_table = mt6392_platform_ids,
+};
+
+module_platform_driver(mt6392_regulator_driver);
+
+MODULE_AUTHOR("Chen Zhong <chen.zhong@mediatek.com>");
+MODULE_DESCRIPTION("Regulator Driver for MediaTek MT6392 PMIC");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/regulator/mt6392-regulator.h b/include/linux/regulator/mt6392-regulator.h
new file mode 100644
index 000000000000..dfcbcacb5ad4
--- /dev/null
+++ b/include/linux/regulator/mt6392-regulator.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Chen Zhong <chen.zhong@mediatek.com>
+ */
+
+#ifndef __LINUX_REGULATOR_MT6392_H
+#define __LINUX_REGULATOR_MT6392_H
+
+enum {
+	MT6392_ID_VPROC = 0,
+	MT6392_ID_VSYS,
+	MT6392_ID_VCORE,
+	MT6392_ID_VXO22,
+	MT6392_ID_VAUD22,
+	MT6392_ID_VCAMA,
+	MT6392_ID_VAUD28,
+	MT6392_ID_VADC18,
+	MT6392_ID_VCN35,
+	MT6392_ID_VIO28,
+	MT6392_ID_VUSB = 10,
+	MT6392_ID_VMC,
+	MT6392_ID_VMCH,
+	MT6392_ID_VEMC3V3,
+	MT6392_ID_VGP1,
+	MT6392_ID_VGP2,
+	MT6392_ID_VCN18,
+	MT6392_ID_VCAMAF,
+	MT6392_ID_VM,
+	MT6392_ID_VIO18,
+	MT6392_ID_VCAMD,
+	MT6392_ID_VCAMIO,
+	MT6392_ID_VM25,
+	MT6392_ID_VEFUSE,
+	MT6392_ID_RG_MAX,
+};
+
+#define MT6392_MAX_REGULATOR	MT6392_ID_RG_MAX
+
+#endif /* __LINUX_REGULATOR_MT6392_H */
-- 
2.20.1

^ permalink raw reply related

* [PATCH 03/24] dt-bindings: pwrap: mediatek: add pwrap support for MT8516
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	ryder.lee-NuS5LvNUpcJWk0Htik3J/w,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	jjian.zhou-NuS5LvNUpcJWk0Htik3J/w,
	wenzhen.yu-NuS5LvNUpcJWk0Htik3J/w,
	stephane.leprovost-NuS5LvNUpcJWk0Htik3J/w,
	sean.wang-DgEjT+Ai2ygdnm+yROfE0A,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	yong.mao-NuS5LvNUpcJWk0Htik3J/w, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hsin-hsiung.wang-NuS5LvNUpcJWk0Htik3J/w,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Fabien Parent,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	chaotian.jing-NuS5LvNUpcJWk0Htik3J/w,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20190323211612.860-1-fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>

Add binding documentation of pwrap for MT8516 SoCs.

Signed-off-by: Fabien Parent <fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
---
 Documentation/devicetree/bindings/soc/mediatek/pwrap.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
index 5a2ef1726e2a..7a32404c6114 100644
--- a/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
+++ b/Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
@@ -25,6 +25,7 @@ Required properties in pwrap device node.
 	"mediatek,mt8135-pwrap" for MT8135 SoCs
 	"mediatek,mt8173-pwrap" for MT8173 SoCs
 	"mediatek,mt8183-pwrap" for MT8183 SoCs
+	"mediatek,mt8516-pwrap" for MT8516 SoCs
 - interrupts: IRQ for pwrap in SOC
 - reg-names: Must include the following entries:
   "pwrap": Main registers base
-- 
2.20.1

^ permalink raw reply related

* [PATCH 04/24] soc: mediatek: pwrap: add missing check on rstc
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	ryder.lee-NuS5LvNUpcJWk0Htik3J/w,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	jjian.zhou-NuS5LvNUpcJWk0Htik3J/w,
	wenzhen.yu-NuS5LvNUpcJWk0Htik3J/w,
	stephane.leprovost-NuS5LvNUpcJWk0Htik3J/w,
	sean.wang-DgEjT+Ai2ygdnm+yROfE0A,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	yong.mao-NuS5LvNUpcJWk0Htik3J/w, linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	hsin-hsiung.wang-NuS5LvNUpcJWk0Htik3J/w,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Fabien Parent,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	chaotian.jing-NuS5LvNUpcJWk0Htik3J/w,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20190323211612.860-1-fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>

The variable rstc is set only when the SoC PWRAP have the
PWRAP_CAP_RESET capability. Check whether rstc is set before
using it to avoid errors.

Signed-off-by: Fabien Parent <fparent-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index 8236a6c87e19..b3ba2301f569 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -1478,7 +1478,8 @@ static int pwrap_init(struct pmic_wrapper *wrp)
 {
 	int ret;
 
-	reset_control_reset(wrp->rstc);
+	if (wrp->rstc)
+		reset_control_reset(wrp->rstc);
 	if (wrp->rstc_bridge)
 		reset_control_reset(wrp->rstc_bridge);
 
-- 
2.20.1

^ permalink raw reply related

* [PATCH 05/24] soc: mediatek: pwrap: add support for MT8516 pwrap
From: Fabien Parent @ 2019-03-23 21:15 UTC (permalink / raw)
  To: matthias.bgg, robh+dt, mark.rutland
  Cc: linux-arm-kernel, devicetree, ryder.lee, linux-watchdog,
	jjian.zhou, wenzhen.yu, stephane.leprovost, sean.wang, linux-mmc,
	linux-kernel, yong.mao, linux-spi, linux-gpio, linux-mediatek,
	hsin-hsiung.wang, linux-serial, Fabien Parent, linux-clk,
	chaotian.jing, linux-i2c
In-Reply-To: <20190323211612.860-1-fparent@baylibre.com>

Add the code to support the pwrap IP on the MediaTek MT8516 SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 106 +++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
index b3ba2301f569..73f0be0567bd 100644
--- a/drivers/soc/mediatek/mtk-pmic-wrap.c
+++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
@@ -381,6 +381,10 @@ enum pwrap_regs {
 	PWRAP_EXT_GPS_AUXADC_RDATA_ADDR,
 	PWRAP_GPSINF_0_STA,
 	PWRAP_GPSINF_1_STA,
+
+	/* MT8516 only regs */
+	PWRAP_OP_TYPE,
+	PWRAP_MSB_FIRST,
 };
 
 static int mt2701_regs[] = {
@@ -852,6 +856,91 @@ static int mt8183_regs[] = {
 	[PWRAP_WACS2_VLDCLR] =			0xC28,
 };
 
+static int mt8516_regs[] = {
+	[PWRAP_MUX_SEL] =		0x0,
+	[PWRAP_WRAP_EN] =		0x4,
+	[PWRAP_DIO_EN] =		0x8,
+	[PWRAP_SIDLY] =			0xc,
+	[PWRAP_RDDMY] =			0x10,
+	[PWRAP_SI_CK_CON] =		0x14,
+	[PWRAP_CSHEXT_WRITE] =		0x18,
+	[PWRAP_CSHEXT_READ] =		0x1c,
+	[PWRAP_CSLEXT_START] =		0x20,
+	[PWRAP_CSLEXT_END] =		0x24,
+	[PWRAP_STAUPD_PRD] =		0x28,
+	[PWRAP_STAUPD_GRPEN] =		0x2c,
+	[PWRAP_STAUPD_MAN_TRIG] =	0x40,
+	[PWRAP_STAUPD_STA] =		0x44,
+	[PWRAP_WRAP_STA] =		0x48,
+	[PWRAP_HARB_INIT] =		0x4c,
+	[PWRAP_HARB_HPRIO] =		0x50,
+	[PWRAP_HIPRIO_ARB_EN] =		0x54,
+	[PWRAP_HARB_STA0] =		0x58,
+	[PWRAP_HARB_STA1] =		0x5c,
+	[PWRAP_MAN_EN] =		0x60,
+	[PWRAP_MAN_CMD] =		0x64,
+	[PWRAP_MAN_RDATA] =		0x68,
+	[PWRAP_MAN_VLDCLR] =		0x6c,
+	[PWRAP_WACS0_EN] =		0x70,
+	[PWRAP_INIT_DONE0] =		0x74,
+	[PWRAP_WACS0_CMD] =		0x78,
+	[PWRAP_WACS0_RDATA] =		0x7c,
+	[PWRAP_WACS0_VLDCLR] =		0x80,
+	[PWRAP_WACS1_EN] =		0x84,
+	[PWRAP_INIT_DONE1] =		0x88,
+	[PWRAP_WACS1_CMD] =		0x8c,
+	[PWRAP_WACS1_RDATA] =		0x90,
+	[PWRAP_WACS1_VLDCLR] =		0x94,
+	[PWRAP_WACS2_EN] =		0x98,
+	[PWRAP_INIT_DONE2] =		0x9c,
+	[PWRAP_WACS2_CMD] =		0xa0,
+	[PWRAP_WACS2_RDATA] =		0xa4,
+	[PWRAP_WACS2_VLDCLR] =		0xa8,
+	[PWRAP_INT_EN] =		0xac,
+	[PWRAP_INT_FLG_RAW] =		0xb0,
+	[PWRAP_INT_FLG] =		0xb4,
+	[PWRAP_INT_CLR] =		0xb8,
+	[PWRAP_SIG_ADR] =		0xbc,
+	[PWRAP_SIG_MODE] =		0xc0,
+	[PWRAP_SIG_VALUE] =		0xc4,
+	[PWRAP_SIG_ERRVAL] =		0xc8,
+	[PWRAP_CRC_EN] =		0xcc,
+	[PWRAP_TIMER_EN] =		0xd0,
+	[PWRAP_TIMER_STA] =		0xd4,
+	[PWRAP_WDT_UNIT] =		0xd8,
+	[PWRAP_WDT_SRC_EN] =		0xdc,
+	[PWRAP_WDT_FLG] =		0xe0,
+	[PWRAP_DEBUG_INT_SEL] =		0xe4,
+	[PWRAP_DVFS_ADR0] =		0xe8,
+	[PWRAP_DVFS_WDATA0] =		0xec,
+	[PWRAP_DVFS_ADR1] =		0xf0,
+	[PWRAP_DVFS_WDATA1] =		0xf4,
+	[PWRAP_DVFS_ADR2] =		0xf8,
+	[PWRAP_DVFS_WDATA2] =		0xfc,
+	[PWRAP_DVFS_ADR3] =		0x100,
+	[PWRAP_DVFS_WDATA3] =		0x104,
+	[PWRAP_DVFS_ADR4] =		0x108,
+	[PWRAP_DVFS_WDATA4] =		0x10c,
+	[PWRAP_DVFS_ADR5] =		0x110,
+	[PWRAP_DVFS_WDATA5] =		0x114,
+	[PWRAP_DVFS_ADR6] =		0x118,
+	[PWRAP_DVFS_WDATA6] =		0x11c,
+	[PWRAP_DVFS_ADR7] =		0x120,
+	[PWRAP_DVFS_WDATA7] =		0x124,
+	[PWRAP_SPMINF_STA] =		0x128,
+	[PWRAP_CIPHER_KEY_SEL] =	0x12c,
+	[PWRAP_CIPHER_IV_SEL] =		0x130,
+	[PWRAP_CIPHER_EN] =		0x134,
+	[PWRAP_CIPHER_RDY] =		0x138,
+	[PWRAP_CIPHER_MODE] =		0x13c,
+	[PWRAP_CIPHER_SWRST] =		0x140,
+	[PWRAP_DCM_EN] =		0x144,
+	[PWRAP_DCM_DBC_PRD] =		0x148,
+	[PWRAP_SW_RST] =		0x168,
+	[PWRAP_OP_TYPE] =		0x16c,
+	[PWRAP_MSB_FIRST] =		0x170,
+};
+
 enum pmic_type {
 	PMIC_MT6323,
 	PMIC_MT6351,
@@ -869,6 +958,7 @@ enum pwrap_type {
 	PWRAP_MT8135,
 	PWRAP_MT8173,
 	PWRAP_MT8183,
+	PWRAP_MT8516,
 };
 
 struct pmic_wrapper;
@@ -1297,6 +1387,7 @@ static int pwrap_init_cipher(struct pmic_wrapper *wrp)
 	case PWRAP_MT6765:
 	case PWRAP_MT6797:
 	case PWRAP_MT8173:
+	case PWRAP_MT8516:
 		pwrap_writel(wrp, 1, PWRAP_CIPHER_EN);
 		break;
 	case PWRAP_MT7622:
@@ -1765,6 +1856,18 @@ static const struct pmic_wrapper_type pwrap_mt8183 = {
 	.init_soc_specific = pwrap_mt8183_init_soc_specific,
 };
 
+static struct pmic_wrapper_type pwrap_mt8516 = {
+	.regs = mt8516_regs,
+	.type = PWRAP_MT8516,
+	.arb_en_all = 0xff,
+	.int_en_all = ~(u32)(BIT(31) | BIT(2)),
+	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
+	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
+	.caps = PWRAP_CAP_DCM,
+	.init_reg_clock = pwrap_mt2701_init_reg_clock,
+	.init_soc_specific = NULL,
+};
+
 static const struct of_device_id of_pwrap_match_tbl[] = {
 	{
 		.compatible = "mediatek,mt2701-pwrap",
@@ -1787,6 +1890,9 @@ static const struct of_device_id of_pwrap_match_tbl[] = {
 	}, {
 		.compatible = "mediatek,mt8183-pwrap",
 		.data = &pwrap_mt8183,
+	}, {
+		.compatible = "mediatek,mt8516-pwrap",
+		.data = &pwrap_mt8516,
 	}, {
 		/* sentinel */
 	}
-- 
2.20.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox