linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller
@ 2021-07-14 10:11 Enric Balletbo i Serra
  2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Crystal Guo, Daniel Vetter,
	David Airlie, Fabien Parent, Guenter Roeck, Philipp Zabel,
	Rob Herring, Wim Van Sebroeck, devicetree, dri-devel,
	linux-arm-kernel, linux-watchdog

Dear all,

The following patchset is a reimplementation of the patch sent by Jitao
Shi [1] some time ago. As suggested by Chun-Kuang Hu, this time the
reset is done using the reset API, where the mmsys driver is the reset
controller and the mtk_dsi driver is the reset consumer.

Note that the first patch is kind of unrelated change, it's just a
cleanup but is needed if you want to apply all the following patches
cleanly.

This patchset is important in order to have the DSI panel working on some
kukui MT8183 Chromebooks (i.e Lenovo IdeaPad Duet). Without it, you just
get a black screen.

Best regards,
  Enric

[1] https://lore.kernel.org/linux-arm-kernel/20210420132614.150242-4-jitao.shi@mediatek.com/


Changes in v2:
- Fix build test ERROR Reported-by: kernel test robot <lkp@intel.com>
- Added a new patch to describe the dsi reset optional property.

Enric Balletbo i Serra (7):
  arm64: dts: mediatek: Move reset controller constants into common
    location
  dt-bindings: mediatek: Add #reset-cells to mmsys system controller
  dt-bindings: display: mediatek: add dsi reset optional property
  arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0
  arm64: dts: mt8183: Add the mmsys reset bit to reset the dsi0
  soc: mediatek: mmsys: Add reset controller support
  drm/mediatek: mtk_dsi: Reset the dsi0 hardware

 .../bindings/arm/mediatek/mediatek,mmsys.txt  |  2 +
 .../display/mediatek/mediatek,dsi.txt         |  6 ++
 arch/arm64/boot/dts/mediatek/mt8173.dtsi      |  2 +
 arch/arm64/boot/dts/mediatek/mt8183.dtsi      |  5 +-
 drivers/gpu/drm/mediatek/mtk_dsi.c            |  5 +-
 drivers/soc/mediatek/mtk-mmsys.c              | 69 +++++++++++++++++++
 drivers/soc/mediatek/mtk-mmsys.h              |  2 +
 drivers/watchdog/mtk_wdt.c                    |  6 +-
 .../mt2712-resets.h                           |  0
 include/dt-bindings/reset/mt8173-resets.h     |  2 +
 .../mt8183-resets.h                           |  3 +
 .../mt8192-resets.h                           |  0
 12 files changed, 96 insertions(+), 6 deletions(-)
 rename include/dt-bindings/{reset-controller => reset}/mt2712-resets.h (100%)
 rename include/dt-bindings/{reset-controller => reset}/mt8183-resets.h (98%)
 rename include/dt-bindings/{reset-controller => reset}/mt8192-resets.h (100%)

-- 
2.30.2


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

* [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-30  5:04   ` Guenter Roeck
  2021-08-06 15:43   ` Matthias Brugger
  2021-07-14 10:11 ` [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller Enric Balletbo i Serra
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Crystal Guo, Guenter Roeck,
	Philipp Zabel, Rob Herring, Wim Van Sebroeck, devicetree,
	linux-arm-kernel, linux-watchdog

The DT binding includes for reset controllers are located in
include/dt-bindings/reset/. Move the Mediatek reset constants in there.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

Changes in v2:
- Fix build test ERROR Reported-by: kernel test robot <lkp@intel.com>

 arch/arm64/boot/dts/mediatek/mt8183.dtsi                    | 2 +-
 drivers/watchdog/mtk_wdt.c                                  | 6 +++---
 .../dt-bindings/{reset-controller => reset}/mt2712-resets.h | 0
 .../dt-bindings/{reset-controller => reset}/mt8183-resets.h | 0
 .../dt-bindings/{reset-controller => reset}/mt8192-resets.h | 0
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename include/dt-bindings/{reset-controller => reset}/mt2712-resets.h (100%)
 rename include/dt-bindings/{reset-controller => reset}/mt8183-resets.h (100%)
 rename include/dt-bindings/{reset-controller => reset}/mt8192-resets.h (100%)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 96473d88f391..4ef0b5b23047 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -11,7 +11,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/memory/mt8183-larb-port.h>
 #include <dt-bindings/power/mt8183-power.h>
-#include <dt-bindings/reset-controller/mt8183-resets.h>
+#include <dt-bindings/reset/mt8183-resets.h>
 #include <dt-bindings/phy/phy.h>
 #include <dt-bindings/thermal/thermal.h>
 #include "mt8183-pinfunc.h"
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 16b6aff324a7..6986bc740465 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -9,9 +9,9 @@
  * Based on sunxi_wdt.c
  */
 
-#include <dt-bindings/reset-controller/mt2712-resets.h>
-#include <dt-bindings/reset-controller/mt8183-resets.h>
-#include <dt-bindings/reset-controller/mt8192-resets.h>
+#include <dt-bindings/reset/mt2712-resets.h>
+#include <dt-bindings/reset/mt8183-resets.h>
+#include <dt-bindings/reset/mt8192-resets.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/init.h>
diff --git a/include/dt-bindings/reset-controller/mt2712-resets.h b/include/dt-bindings/reset/mt2712-resets.h
similarity index 100%
rename from include/dt-bindings/reset-controller/mt2712-resets.h
rename to include/dt-bindings/reset/mt2712-resets.h
diff --git a/include/dt-bindings/reset-controller/mt8183-resets.h b/include/dt-bindings/reset/mt8183-resets.h
similarity index 100%
rename from include/dt-bindings/reset-controller/mt8183-resets.h
rename to include/dt-bindings/reset/mt8183-resets.h
diff --git a/include/dt-bindings/reset-controller/mt8192-resets.h b/include/dt-bindings/reset/mt8192-resets.h
similarity index 100%
rename from include/dt-bindings/reset-controller/mt8192-resets.h
rename to include/dt-bindings/reset/mt8192-resets.h
-- 
2.30.2


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

* [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
  2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-16 17:42   ` Rob Herring
  2021-07-14 10:11 ` [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property Enric Balletbo i Serra
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Fabien Parent, Rob Herring, devicetree,
	linux-arm-kernel

The mmsys system controller exposes a set of memory client resets and
needs to specify the #reset-cells property in order to advertise the
number of cells needed to describe each of the resets.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

(no changes since v1)

 .../devicetree/bindings/arm/mediatek/mediatek,mmsys.txt         | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
index 78c50733985c..ce958446558e 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt
@@ -17,6 +17,7 @@ Required Properties:
 	- "mediatek,mt8173-mmsys", "syscon"
 	- "mediatek,mt8183-mmsys", "syscon"
 - #clock-cells: Must be 1
+- #reset-cells: Must be 1
 
 For the clock control, the mmsys controller uses the common clk binding from
 Documentation/devicetree/bindings/clock/clock-bindings.txt
@@ -28,4 +29,5 @@ mmsys: syscon@14000000 {
 	compatible = "mediatek,mt8173-mmsys", "syscon";
 	reg = <0 0x14000000 0 0x1000>;
 	#clock-cells = <1>;
+	#reset-cells = <1>;
 };
-- 
2.30.2


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

* [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
  2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
  2021-07-14 10:11 ` [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-16 17:55   ` Rob Herring
  2021-07-14 10:11 ` [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0 Enric Balletbo i Serra
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Daniel Vetter, David Airlie,
	Philipp Zabel, Rob Herring, devicetree, dri-devel,
	linux-arm-kernel

Update device tree binding documentation for the dsi to add the optional
property to reset the dsi controller.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

Changes in v2:
- Added a new patch to describe the dsi reset optional property.

 .../devicetree/bindings/display/mediatek/mediatek,dsi.txt   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
index 8238a86686be..3209b700ded6 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dsi.txt
@@ -19,6 +19,11 @@ Required properties:
   Documentation/devicetree/bindings/graph.txt. This port should be connected
   to the input port of an attached DSI panel or DSI-to-eDP encoder chip.
 
+Optional properties:
+- resets: list of phandle + reset specifier pair, as described in [1].
+
+[1] Documentation/devicetree/bindings/reset/reset.txt
+
 MIPI TX Configuration Module
 ============================
 
@@ -45,6 +50,7 @@ dsi0: dsi@1401b000 {
 	clocks = <&mmsys MM_DSI0_ENGINE>, <&mmsys MM_DSI0_DIGITAL>,
 		 <&mipi_tx0>;
 	clock-names = "engine", "digital", "hs";
+	resets = <&mmsys MT8173_MMSYS_SW0_RST_B_DISP_DSI0>;
 	phys = <&mipi_tx0>;
 	phy-names = "dphy";
 
-- 
2.30.2


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

* [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
                   ` (2 preceding siblings ...)
  2021-07-14 10:11 ` [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-16 17:56   ` Rob Herring
  2021-07-14 10:11 ` [PATCH v2 5/7] arm64: dts: mt8183: " Enric Balletbo i Serra
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Philipp Zabel, Rob Herring, devicetree,
	linux-arm-kernel

Reset the DSI hardware is needed to prevent different settings between
the bootloader and the kernel.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

(no changes since v1)

 arch/arm64/boot/dts/mediatek/mt8173.dtsi  | 2 ++
 include/dt-bindings/reset/mt8173-resets.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index a3de6374d495..2ac77d47bf81 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -1036,6 +1036,7 @@ mmsys: syscon@14000000 {
 			assigned-clocks = <&topckgen CLK_TOP_MM_SEL>;
 			assigned-clock-rates = <400000000>;
 			#clock-cells = <1>;
+			#reset-cells = <1>;
 			mboxes = <&gce 0 CMDQ_THR_PRIO_HIGHEST>,
 				 <&gce 1 CMDQ_THR_PRIO_HIGHEST>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0 0x1000>;
@@ -1261,6 +1262,7 @@ dsi0: dsi@1401b000 {
 				 <&mmsys CLK_MM_DSI0_DIGITAL>,
 				 <&mipi_tx0>;
 			clock-names = "engine", "digital", "hs";
+			resets = <&mmsys MT8173_MMSYS_SW0_RST_B_DISP_DSI0>;
 			phys = <&mipi_tx0>;
 			phy-names = "dphy";
 			status = "disabled";
diff --git a/include/dt-bindings/reset/mt8173-resets.h b/include/dt-bindings/reset/mt8173-resets.h
index ba8636eda5ae..6a60c7cecc4c 100644
--- a/include/dt-bindings/reset/mt8173-resets.h
+++ b/include/dt-bindings/reset/mt8173-resets.h
@@ -27,6 +27,8 @@
 #define MT8173_INFRA_GCE_FAXI_RST       40
 #define MT8173_INFRA_MMIOMMURST         47
 
+/* MMSYS resets */
+#define MT8173_MMSYS_SW0_RST_B_DISP_DSI0	25
 
 /*  PERICFG resets */
 #define MT8173_PERI_UART0_SW_RST        0
-- 
2.30.2


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

* [PATCH v2 5/7] arm64: dts: mt8183: Add the mmsys reset bit to reset the dsi0
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
                   ` (3 preceding siblings ...)
  2021-07-14 10:11 ` [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0 Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-16 17:57   ` Rob Herring
  2021-07-14 10:11 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support Enric Balletbo i Serra
  2021-07-14 10:11 ` [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware Enric Balletbo i Serra
  6 siblings, 1 reply; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Philipp Zabel, Rob Herring, devicetree,
	linux-arm-kernel

Reset the DSI hardware is needed to prevent different settings between
the bootloader and the kernel.

While here, also remove the undocumented and also not used
'mediatek,syscon-dsi' property.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

(no changes since v1)

 arch/arm64/boot/dts/mediatek/mt8183.dtsi  | 3 ++-
 include/dt-bindings/reset/mt8183-resets.h | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 4ef0b5b23047..7ae108f8ba89 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -1251,6 +1251,7 @@ mmsys: syscon@14000000 {
 			compatible = "mediatek,mt8183-mmsys", "syscon";
 			reg = <0 0x14000000 0 0x1000>;
 			#clock-cells = <1>;
+			#reset-cells = <1>;
 			mboxes = <&gce 0 CMDQ_THR_PRIO_HIGHEST>,
 				 <&gce 1 CMDQ_THR_PRIO_HIGHEST>;
 			mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0 0x1000>;
@@ -1365,11 +1366,11 @@ dsi0: dsi@14014000 {
 			reg = <0 0x14014000 0 0x1000>;
 			interrupts = <GIC_SPI 236 IRQ_TYPE_LEVEL_LOW>;
 			power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
-			mediatek,syscon-dsi = <&mmsys 0x140>;
 			clocks = <&mmsys CLK_MM_DSI0_MM>,
 				 <&mmsys CLK_MM_DSI0_IF>,
 				 <&mipi_tx0>;
 			clock-names = "engine", "digital", "hs";
+			resets = <&mmsys MT8183_MMSYS_SW0_RST_B_DISP_DSI0>;
 			phys = <&mipi_tx0>;
 			phy-names = "dphy";
 		};
diff --git a/include/dt-bindings/reset/mt8183-resets.h b/include/dt-bindings/reset/mt8183-resets.h
index a1bbd41e0d12..48c5d2de0a38 100644
--- a/include/dt-bindings/reset/mt8183-resets.h
+++ b/include/dt-bindings/reset/mt8183-resets.h
@@ -80,6 +80,9 @@
 
 #define MT8183_INFRACFG_SW_RST_NUM				128
 
+/* MMSYS resets */
+#define MT8183_MMSYS_SW0_RST_B_DISP_DSI0			25
+
 #define MT8183_TOPRGU_MM_SW_RST					1
 #define MT8183_TOPRGU_MFG_SW_RST				2
 #define MT8183_TOPRGU_VENC_SW_RST				3
-- 
2.30.2


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

* [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
                   ` (4 preceding siblings ...)
  2021-07-14 10:11 ` [PATCH v2 5/7] arm64: dts: mt8183: " Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-07-20 10:52   ` Philipp Zabel
  2021-08-06 17:34   ` Matthias Brugger
  2021-07-14 10:11 ` [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware Enric Balletbo i Serra
  6 siblings, 2 replies; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Philipp Zabel, linux-arm-kernel

Among other features the mmsys driver should implement a reset
controller to be able to reset different bits from their space.

Cc: Jitao Shi <jitao.shi@mediatek.com>
Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

(no changes since v1)

 drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++
 drivers/soc/mediatek/mtk-mmsys.h |  2 +
 2 files changed, 71 insertions(+)

diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
index e681029fe804..6ac4deff0164 100644
--- a/drivers/soc/mediatek/mtk-mmsys.c
+++ b/drivers/soc/mediatek/mtk-mmsys.c
@@ -4,10 +4,12 @@
  * Author: James Liao <jamesjj.liao@mediatek.com>
  */
 
+#include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/io.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/reset-controller.h>
 #include <linux/soc/mediatek/mtk-mmsys.h>
 
 #include "mtk-mmsys.h"
@@ -55,6 +57,8 @@ static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
 struct mtk_mmsys {
 	void __iomem *regs;
 	const struct mtk_mmsys_driver_data *data;
+	spinlock_t lock; /* protects mmsys_sw_rst_b reg */
+	struct reset_controller_dev rcdev;
 };
 
 void mtk_mmsys_ddp_connect(struct device *dev,
@@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_disconnect);
 
+static int mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned long id,
+				  bool assert)
+{
+	struct mtk_mmsys *mmsys = container_of(rcdev, struct mtk_mmsys, rcdev);
+	unsigned long flags;
+	u32 reg;
+	int i;
+
+	spin_lock_irqsave(&mmsys->lock, flags);
+
+	reg = readl_relaxed(mmsys->regs + MMSYS_SW0_RST_B);
+
+	if (assert)
+		reg &= ~BIT(id);
+	else
+		reg |= BIT(id);
+
+	writel_relaxed(reg, mmsys->regs + MMSYS_SW0_RST_B);
+
+	spin_unlock_irqrestore(&mmsys->lock, flags);
+
+	return 0;
+}
+
+static int mtk_mmsys_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	return mtk_mmsys_reset_update(rcdev, id, true);
+}
+
+static int mtk_mmsys_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	return mtk_mmsys_reset_update(rcdev, id, false);
+}
+
+static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id)
+{
+	int ret;
+
+	ret = mtk_mmsys_reset_assert(rcdev, id);
+	if (ret)
+		return ret;
+
+	usleep_range(1000, 1100);
+
+	return mtk_mmsys_reset_deassert(rcdev, id);
+}
+
+static const struct reset_control_ops mtk_mmsys_reset_ops = {
+	.assert = mtk_mmsys_reset_assert,
+	.deassert = mtk_mmsys_reset_deassert,
+	.reset = mtk_mmsys_reset,
+};
+
 static int mtk_mmsys_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -111,6 +168,18 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	spin_lock_init(&mmsys->lock);
+
+	mmsys->rcdev.owner = THIS_MODULE;
+	mmsys->rcdev.nr_resets = 32;
+	mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
+	mmsys->rcdev.of_node = pdev->dev.of_node;
+	ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
+	if (ret) {
+		dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
+		return ret;
+	}
+
 	mmsys->data = of_device_get_match_data(&pdev->dev);
 	platform_set_drvdata(pdev, mmsys);
 
diff --git a/drivers/soc/mediatek/mtk-mmsys.h b/drivers/soc/mediatek/mtk-mmsys.h
index 11388961dded..f9f9e12ceab8 100644
--- a/drivers/soc/mediatek/mtk-mmsys.h
+++ b/drivers/soc/mediatek/mtk-mmsys.h
@@ -66,6 +66,8 @@
 #define DPI_SEL_IN_BLS				0x0
 #define DSI_SEL_IN_RDMA				0x1
 
+#define MMSYS_SW0_RST_B				0x140
+
 struct mtk_mmsys_routes {
 	u32 from_comp;
 	u32 to_comp;
-- 
2.30.2


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

* [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware
  2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
                   ` (5 preceding siblings ...)
  2021-07-14 10:11 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support Enric Balletbo i Serra
@ 2021-07-14 10:11 ` Enric Balletbo i Serra
  2021-08-02 23:21   ` Chun-Kuang Hu
  2021-08-06 17:33   ` Matthias Brugger
  6 siblings, 2 replies; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-14 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Daniel Vetter, David Airlie,
	Philipp Zabel, dri-devel, linux-arm-kernel

Reset dsi0 HW to default when power on. This prevents to have different
settingbetween the bootloader and the kernel.

As not all Mediatek boards have the reset consumer configured in their
board description, also is not needed on all of them, the reset is optional,
so the change is compatible with all boards.

Cc: Jitao Shi <jitao.shi@mediatek.com>
Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

(no changes since v1)

 drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index ae403c67cbd9..d8b81e2ab841 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -11,6 +11,7 @@
 #include <linux/of_platform.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 
 #include <video/mipi_display.h>
 #include <video/videomode.h>
@@ -980,8 +981,10 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
+	if (ret)
+		return ret;
 
-	return ret;
+	return device_reset_optional(dev);
 }
 
 static void mtk_dsi_unbind(struct device *dev, struct device *master,
-- 
2.30.2


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

* Re: [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller
  2021-07-14 10:11 ` [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller Enric Balletbo i Serra
@ 2021-07-16 17:42   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2021-07-16 17:42 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, chunkuang.hu, hsinyi, kernel, drinkcat, eizan,
	linux-mediatek, matthias.bgg, jitao.shi, Fabien Parent,
	devicetree, linux-arm-kernel

On Wed, Jul 14, 2021 at 12:11:36PM +0200, Enric Balletbo i Serra wrote:
> The mmsys system controller exposes a set of memory client resets and
> needs to specify the #reset-cells property in order to advertise the
> number of cells needed to describe each of the resets.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> (no changes since v1)
> 
>  .../devicetree/bindings/arm/mediatek/mediatek,mmsys.txt         | 2 ++
>  1 file changed, 2 insertions(+)

This will conflict. There's already multiple patches converting this to 
schema[1][2].

Rob

[1] https://lore.kernel.org/lkml/20210519161847.3747352-1-fparent@baylibre.com/
[2] https://lore.kernel.org/lkml/CAC=S1nhi0rLpQznvUP1FVNtEDzdffFG_aMO7j-w4fHBY8ceJnw@mail.gmail.com/

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

* Re: [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property
  2021-07-14 10:11 ` [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property Enric Balletbo i Serra
@ 2021-07-16 17:55   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2021-07-16 17:55 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: David Airlie, dri-devel, Daniel Vetter, linux-arm-kernel,
	linux-mediatek, chunkuang.hu, devicetree, kernel, drinkcat,
	matthias.bgg, jitao.shi, Rob Herring, hsinyi, linux-kernel,
	eizan, Philipp Zabel

On Wed, 14 Jul 2021 12:11:37 +0200, Enric Balletbo i Serra wrote:
> Update device tree binding documentation for the dsi to add the optional
> property to reset the dsi controller.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> Changes in v2:
> - Added a new patch to describe the dsi reset optional property.
> 
>  .../devicetree/bindings/display/mediatek/mediatek,dsi.txt   | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0
  2021-07-14 10:11 ` [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0 Enric Balletbo i Serra
@ 2021-07-16 17:56   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2021-07-16 17:56 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, Rob Herring, drinkcat, linux-arm-kernel,
	matthias.bgg, kernel, chunkuang.hu, Philipp Zabel, hsinyi,
	linux-mediatek, devicetree, eizan, jitao.shi

On Wed, 14 Jul 2021 12:11:38 +0200, Enric Balletbo i Serra wrote:
> Reset the DSI hardware is needed to prevent different settings between
> the bootloader and the kernel.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> (no changes since v1)
> 
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi  | 2 ++
>  include/dt-bindings/reset/mt8173-resets.h | 2 ++
>  2 files changed, 4 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 5/7] arm64: dts: mt8183: Add the mmsys reset bit to reset the dsi0
  2021-07-14 10:11 ` [PATCH v2 5/7] arm64: dts: mt8183: " Enric Balletbo i Serra
@ 2021-07-16 17:57   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2021-07-16 17:57 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: hsinyi, drinkcat, linux-kernel, Philipp Zabel, Rob Herring,
	eizan, linux-mediatek, jitao.shi, chunkuang.hu, devicetree,
	matthias.bgg, kernel, linux-arm-kernel

On Wed, 14 Jul 2021 12:11:39 +0200, Enric Balletbo i Serra wrote:
> Reset the DSI hardware is needed to prevent different settings between
> the bootloader and the kernel.
> 
> While here, also remove the undocumented and also not used
> 'mediatek,syscon-dsi' property.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> 
> (no changes since v1)
> 
>  arch/arm64/boot/dts/mediatek/mt8183.dtsi  | 3 ++-
>  include/dt-bindings/reset/mt8183-resets.h | 3 +++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
  2021-07-14 10:11 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support Enric Balletbo i Serra
@ 2021-07-20 10:52   ` Philipp Zabel
  2021-07-20 17:07     ` Enric Balletbo i Serra
  2021-08-06 17:34   ` Matthias Brugger
  1 sibling, 1 reply; 22+ messages in thread
From: Philipp Zabel @ 2021-07-20 10:52 UTC (permalink / raw)
  To: Enric Balletbo i Serra, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, linux-arm-kernel

Hi Enric,

On Wed, 2021-07-14 at 12:11 +0200, Enric Balletbo i Serra wrote:
> Among other features the mmsys driver should implement a reset
> controller to be able to reset different bits from their space.
> 
> Cc: Jitao Shi <jitao.shi@mediatek.com>
> Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

The reset controller driver looks fine, just two questions below.

> ---
> 
> (no changes since v1)
> 
>  drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++
>  drivers/soc/mediatek/mtk-mmsys.h |  2 +
>  2 files changed, 71 insertions(+)
> 
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index e681029fe804..6ac4deff0164 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
[...]
> @@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
[...]
> +static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id)
> +{
> +	int ret;
> +
> +	ret = mtk_mmsys_reset_assert(rcdev, id);
> +	if (ret)
> +		return ret;
> +
> +	usleep_range(1000, 1100);

Is this known to be enough for all IP cores that can be reset by this
controller?

> +	return mtk_mmsys_reset_deassert(rcdev, id);
> +}
> +
> +static const struct reset_control_ops mtk_mmsys_reset_ops = {
> +	.assert = mtk_mmsys_reset_assert,
> +	.deassert = mtk_mmsys_reset_deassert,
> +	.reset = mtk_mmsys_reset,
> +};
> +
>  static int mtk_mmsys_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -111,6 +168,18 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	spin_lock_init(&mmsys->lock);
> +
> +	mmsys->rcdev.owner = THIS_MODULE;
> +	mmsys->rcdev.nr_resets = 32;

Are all bits in the MMSYS_SW0_RST_B register individual reset controls?

regards
Philipp

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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
  2021-07-20 10:52   ` Philipp Zabel
@ 2021-07-20 17:07     ` Enric Balletbo i Serra
  2021-07-21  9:53       ` Philipp Zabel
  0 siblings, 1 reply; 22+ messages in thread
From: Enric Balletbo i Serra @ 2021-07-20 17:07 UTC (permalink / raw)
  To: Philipp Zabel, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, linux-arm-kernel

Hi Philipp,

Thank you to take a look

On 20/7/21 12:52, Philipp Zabel wrote:
> Hi Enric,
> 
> On Wed, 2021-07-14 at 12:11 +0200, Enric Balletbo i Serra wrote:
>> Among other features the mmsys driver should implement a reset
>> controller to be able to reset different bits from their space.
>>
>> Cc: Jitao Shi <jitao.shi@mediatek.com>
>> Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> 
> The reset controller driver looks fine, just two questions below.
> 
>> ---
>>
>> (no changes since v1)
>>
>>  drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++
>>  drivers/soc/mediatek/mtk-mmsys.h |  2 +
>>  2 files changed, 71 insertions(+)
>>
>> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
>> index e681029fe804..6ac4deff0164 100644
>> --- a/drivers/soc/mediatek/mtk-mmsys.c
>> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> [...]
>> @@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
> [...]
>> +static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id)
>> +{
>> +	int ret;
>> +
>> +	ret = mtk_mmsys_reset_assert(rcdev, id);
>> +	if (ret)
>> +		return ret;
>> +
>> +	usleep_range(1000, 1100);
> 
> Is this known to be enough for all IP cores that can be reset by this
> controller?
> 

This time is copied from the downstream kernel, so, tbh, I am not totally sure
is enough or needed. Let me try to reach the Mediatek people for if they can
answer this.


>> +	return mtk_mmsys_reset_deassert(rcdev, id);
>> +}
>> +
>> +static const struct reset_control_ops mtk_mmsys_reset_ops = {
>> +	.assert = mtk_mmsys_reset_assert,
>> +	.deassert = mtk_mmsys_reset_deassert,
>> +	.reset = mtk_mmsys_reset,
>> +};
>> +
>>  static int mtk_mmsys_probe(struct platform_device *pdev)
>>  {
>>  	struct device *dev = &pdev->dev;
>> @@ -111,6 +168,18 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>>  		return ret;
>>  	}
>>  
>> +	spin_lock_init(&mmsys->lock);
>> +
>> +	mmsys->rcdev.owner = THIS_MODULE;
>> +	mmsys->rcdev.nr_resets = 32;
> 
> Are all bits in the MMSYS_SW0_RST_B register individual reset controls?

Yes, all are individual reset controls, mostly related to display but not all
(i.e dsi, dpi ...)

Thanks,
  Enric

> 
> regards
> Philipp
> 

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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
  2021-07-20 17:07     ` Enric Balletbo i Serra
@ 2021-07-21  9:53       ` Philipp Zabel
  0 siblings, 0 replies; 22+ messages in thread
From: Philipp Zabel @ 2021-07-21  9:53 UTC (permalink / raw)
  To: Enric Balletbo i Serra, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, linux-arm-kernel

On Tue, 2021-07-20 at 19:07 +0200, Enric Balletbo i Serra wrote:
> Hi Philipp,
> 
> Thank you to take a look
> 
> On 20/7/21 12:52, Philipp Zabel wrote:
> > Hi Enric,
> > 
> > On Wed, 2021-07-14 at 12:11 +0200, Enric Balletbo i Serra wrote:
> > > Among other features the mmsys driver should implement a reset
> > > controller to be able to reset different bits from their space.
> > > 
> > > Cc: Jitao Shi <jitao.shi@mediatek.com>
> > > Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> > 
> > The reset controller driver looks fine, just two questions below.
> > 
> > > ---
> > > 
> > > (no changes since v1)
> > > 
> > >  drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++
> > >  drivers/soc/mediatek/mtk-mmsys.h |  2 +
> > >  2 files changed, 71 insertions(+)
> > > 
> > > diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> > > index e681029fe804..6ac4deff0164 100644
> > > --- a/drivers/soc/mediatek/mtk-mmsys.c
> > > +++ b/drivers/soc/mediatek/mtk-mmsys.c
> > [...]
> > > @@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
> > [...]
> > > +static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id)
> > > +{
> > > +	int ret;
> > > +
> > > +	ret = mtk_mmsys_reset_assert(rcdev, id);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	usleep_range(1000, 1100);
> > 
> > Is this known to be enough for all IP cores that can be reset by this
> > controller?
> > 
> 
> This time is copied from the downstream kernel, so, tbh, I am not totally sure
> is enough or needed. Let me try to reach the Mediatek people for if they can
> answer this.

That would be great. When this is resolved either way, feel free to add

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

* Re: [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location
  2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
@ 2021-07-30  5:04   ` Guenter Roeck
  2021-08-06 15:43   ` Matthias Brugger
  1 sibling, 0 replies; 22+ messages in thread
From: Guenter Roeck @ 2021-07-30  5:04 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, chunkuang.hu, hsinyi, kernel, drinkcat, eizan,
	linux-mediatek, matthias.bgg, jitao.shi, Crystal Guo,
	Philipp Zabel, Rob Herring, Wim Van Sebroeck, devicetree,
	linux-arm-kernel, linux-watchdog

On Wed, Jul 14, 2021 at 12:11:35PM +0200, Enric Balletbo i Serra wrote:
> The DT binding includes for reset controllers are located in
> include/dt-bindings/reset/. Move the Mediatek reset constants in there.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

For the watchdog part:

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

> ---
> 
> Changes in v2:
> - Fix build test ERROR Reported-by: kernel test robot <lkp@intel.com>
> 
>  arch/arm64/boot/dts/mediatek/mt8183.dtsi                    | 2 +-
>  drivers/watchdog/mtk_wdt.c                                  | 6 +++---
>  .../dt-bindings/{reset-controller => reset}/mt2712-resets.h | 0
>  .../dt-bindings/{reset-controller => reset}/mt8183-resets.h | 0
>  .../dt-bindings/{reset-controller => reset}/mt8192-resets.h | 0
>  5 files changed, 4 insertions(+), 4 deletions(-)
>  rename include/dt-bindings/{reset-controller => reset}/mt2712-resets.h (100%)
>  rename include/dt-bindings/{reset-controller => reset}/mt8183-resets.h (100%)
>  rename include/dt-bindings/{reset-controller => reset}/mt8192-resets.h (100%)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> index 96473d88f391..4ef0b5b23047 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> @@ -11,7 +11,7 @@
>  #include <dt-bindings/interrupt-controller/irq.h>
>  #include <dt-bindings/memory/mt8183-larb-port.h>
>  #include <dt-bindings/power/mt8183-power.h>
> -#include <dt-bindings/reset-controller/mt8183-resets.h>
> +#include <dt-bindings/reset/mt8183-resets.h>
>  #include <dt-bindings/phy/phy.h>
>  #include <dt-bindings/thermal/thermal.h>
>  #include "mt8183-pinfunc.h"
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index 16b6aff324a7..6986bc740465 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -9,9 +9,9 @@
>   * Based on sunxi_wdt.c
>   */
>  
> -#include <dt-bindings/reset-controller/mt2712-resets.h>
> -#include <dt-bindings/reset-controller/mt8183-resets.h>
> -#include <dt-bindings/reset-controller/mt8192-resets.h>
> +#include <dt-bindings/reset/mt2712-resets.h>
> +#include <dt-bindings/reset/mt8183-resets.h>
> +#include <dt-bindings/reset/mt8192-resets.h>
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/init.h>
> diff --git a/include/dt-bindings/reset-controller/mt2712-resets.h b/include/dt-bindings/reset/mt2712-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt2712-resets.h
> rename to include/dt-bindings/reset/mt2712-resets.h
> diff --git a/include/dt-bindings/reset-controller/mt8183-resets.h b/include/dt-bindings/reset/mt8183-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt8183-resets.h
> rename to include/dt-bindings/reset/mt8183-resets.h
> diff --git a/include/dt-bindings/reset-controller/mt8192-resets.h b/include/dt-bindings/reset/mt8192-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt8192-resets.h
> rename to include/dt-bindings/reset/mt8192-resets.h

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

* Re: [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware
  2021-07-14 10:11 ` [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware Enric Balletbo i Serra
@ 2021-08-02 23:21   ` Chun-Kuang Hu
  2021-08-06 17:33   ` Matthias Brugger
  1 sibling, 0 replies; 22+ messages in thread
From: Chun-Kuang Hu @ 2021-08-02 23:21 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: linux-kernel, Chun-Kuang Hu, Hsin-Yi Wang, Collabora Kernel ML,
	Nicolas Boichat, Eizan Miyamoto,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Jitao Shi, Daniel Vetter, David Airlie, Philipp Zabel,
	DRI Development, Linux ARM

Hi, Enric:

Enric Balletbo i Serra <enric.balletbo@collabora.com> 於 2021年7月14日 週三 下午6:12寫道:
>
> Reset dsi0 HW to default when power on. This prevents to have different
> settingbetween the bootloader and the kernel.
>
> As not all Mediatek boards have the reset consumer configured in their
> board description, also is not needed on all of them, the reset is optional,
> so the change is compatible with all boards.

Acked-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>

>
> Cc: Jitao Shi <jitao.shi@mediatek.com>
> Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
>
> (no changes since v1)
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index ae403c67cbd9..d8b81e2ab841 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -11,6 +11,7 @@
>  #include <linux/of_platform.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset.h>
>
>  #include <video/mipi_display.h>
>  #include <video/videomode.h>
> @@ -980,8 +981,10 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>         struct mtk_dsi *dsi = dev_get_drvdata(dev);
>
>         ret = mtk_dsi_encoder_init(drm, dsi);
> +       if (ret)
> +               return ret;
>
> -       return ret;
> +       return device_reset_optional(dev);
>  }
>
>  static void mtk_dsi_unbind(struct device *dev, struct device *master,
> --
> 2.30.2
>

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

* Re: [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location
  2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
  2021-07-30  5:04   ` Guenter Roeck
@ 2021-08-06 15:43   ` Matthias Brugger
  1 sibling, 0 replies; 22+ messages in thread
From: Matthias Brugger @ 2021-08-06 15:43 UTC (permalink / raw)
  To: Enric Balletbo i Serra, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	jitao.shi, Crystal Guo, Guenter Roeck, Philipp Zabel,
	Rob Herring, Wim Van Sebroeck, devicetree, linux-arm-kernel,
	linux-watchdog



On 14/07/2021 12:11, Enric Balletbo i Serra wrote:
> The DT binding includes for reset controllers are located in
> include/dt-bindings/reset/. Move the Mediatek reset constants in there.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> 
> Changes in v2:
> - Fix build test ERROR Reported-by: kernel test robot <lkp@intel.com>
> 
>  arch/arm64/boot/dts/mediatek/mt8183.dtsi                    | 2 +-
>  drivers/watchdog/mtk_wdt.c                                  | 6 +++---
>  .../dt-bindings/{reset-controller => reset}/mt2712-resets.h | 0
>  .../dt-bindings/{reset-controller => reset}/mt8183-resets.h | 0
>  .../dt-bindings/{reset-controller => reset}/mt8192-resets.h | 0
>  5 files changed, 4 insertions(+), 4 deletions(-)
>  rename include/dt-bindings/{reset-controller => reset}/mt2712-resets.h (100%)
>  rename include/dt-bindings/{reset-controller => reset}/mt8183-resets.h (100%)
>  rename include/dt-bindings/{reset-controller => reset}/mt8192-resets.h (100%)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> index 96473d88f391..4ef0b5b23047 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> @@ -11,7 +11,7 @@
>  #include <dt-bindings/interrupt-controller/irq.h>
>  #include <dt-bindings/memory/mt8183-larb-port.h>
>  #include <dt-bindings/power/mt8183-power.h>
> -#include <dt-bindings/reset-controller/mt8183-resets.h>
> +#include <dt-bindings/reset/mt8183-resets.h>
>  #include <dt-bindings/phy/phy.h>
>  #include <dt-bindings/thermal/thermal.h>
>  #include "mt8183-pinfunc.h"
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index 16b6aff324a7..6986bc740465 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -9,9 +9,9 @@
>   * Based on sunxi_wdt.c
>   */
>  
> -#include <dt-bindings/reset-controller/mt2712-resets.h>
> -#include <dt-bindings/reset-controller/mt8183-resets.h>
> -#include <dt-bindings/reset-controller/mt8192-resets.h>
> +#include <dt-bindings/reset/mt2712-resets.h>
> +#include <dt-bindings/reset/mt8183-resets.h>
> +#include <dt-bindings/reset/mt8192-resets.h>
>  #include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/init.h>
> diff --git a/include/dt-bindings/reset-controller/mt2712-resets.h b/include/dt-bindings/reset/mt2712-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt2712-resets.h
> rename to include/dt-bindings/reset/mt2712-resets.h
> diff --git a/include/dt-bindings/reset-controller/mt8183-resets.h b/include/dt-bindings/reset/mt8183-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt8183-resets.h
> rename to include/dt-bindings/reset/mt8183-resets.h
> diff --git a/include/dt-bindings/reset-controller/mt8192-resets.h b/include/dt-bindings/reset/mt8192-resets.h
> similarity index 100%
> rename from include/dt-bindings/reset-controller/mt8192-resets.h
> rename to include/dt-bindings/reset/mt8192-resets.h
> 

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

* Re: [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware
  2021-07-14 10:11 ` [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware Enric Balletbo i Serra
  2021-08-02 23:21   ` Chun-Kuang Hu
@ 2021-08-06 17:33   ` Matthias Brugger
  1 sibling, 0 replies; 22+ messages in thread
From: Matthias Brugger @ 2021-08-06 17:33 UTC (permalink / raw)
  To: Enric Balletbo i Serra, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	jitao.shi, Daniel Vetter, David Airlie, Philipp Zabel, dri-devel,
	linux-arm-kernel



On 14/07/2021 12:11, Enric Balletbo i Serra wrote:
> Reset dsi0 HW to default when power on. This prevents to have different
> settingbetween the bootloader and the kernel.

settings between the...

> 
> As not all Mediatek boards have the reset consumer configured in their
> board description, also is not needed on all of them, the reset is optional,
> so the change is compatible with all boards.
> 
> Cc: Jitao Shi <jitao.shi@mediatek.com>
> Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> 
> (no changes since v1)
> 
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index ae403c67cbd9..d8b81e2ab841 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -11,6 +11,7 @@
>  #include <linux/of_platform.h>
>  #include <linux/phy/phy.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset.h>
>  
>  #include <video/mipi_display.h>
>  #include <video/videomode.h>
> @@ -980,8 +981,10 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
>  
>  	ret = mtk_dsi_encoder_init(drm, dsi);
> +	if (ret)
> +		return ret;
>  
> -	return ret;
> +	return device_reset_optional(dev);
>  }
>  
>  static void mtk_dsi_unbind(struct device *dev, struct device *master,
> 

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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
  2021-07-14 10:11 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support Enric Balletbo i Serra
  2021-07-20 10:52   ` Philipp Zabel
@ 2021-08-06 17:34   ` Matthias Brugger
  1 sibling, 0 replies; 22+ messages in thread
From: Matthias Brugger @ 2021-08-06 17:34 UTC (permalink / raw)
  To: Enric Balletbo i Serra, linux-kernel
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	jitao.shi, Philipp Zabel, linux-arm-kernel



On 14/07/2021 12:11, Enric Balletbo i Serra wrote:
> Among other features the mmsys driver should implement a reset
> controller to be able to reset different bits from their space.
> 
> Cc: Jitao Shi <jitao.shi@mediatek.com>
> Suggested-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

I'm happy to take this, as soon as we have the updated binding description.

Regards,
Matthias

> ---
> 
> (no changes since v1)
> 
>  drivers/soc/mediatek/mtk-mmsys.c | 69 ++++++++++++++++++++++++++++++++
>  drivers/soc/mediatek/mtk-mmsys.h |  2 +
>  2 files changed, 71 insertions(+)
> 
> diff --git a/drivers/soc/mediatek/mtk-mmsys.c b/drivers/soc/mediatek/mtk-mmsys.c
> index e681029fe804..6ac4deff0164 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.c
> +++ b/drivers/soc/mediatek/mtk-mmsys.c
> @@ -4,10 +4,12 @@
>   * Author: James Liao <jamesjj.liao@mediatek.com>
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/device.h>
>  #include <linux/io.h>
>  #include <linux/of_device.h>
>  #include <linux/platform_device.h>
> +#include <linux/reset-controller.h>
>  #include <linux/soc/mediatek/mtk-mmsys.h>
>  
>  #include "mtk-mmsys.h"
> @@ -55,6 +57,8 @@ static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = {
>  struct mtk_mmsys {
>  	void __iomem *regs;
>  	const struct mtk_mmsys_driver_data *data;
> +	spinlock_t lock; /* protects mmsys_sw_rst_b reg */
> +	struct reset_controller_dev rcdev;
>  };
>  
>  void mtk_mmsys_ddp_connect(struct device *dev,
> @@ -91,6 +95,59 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
>  }
>  EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_disconnect);
>  
> +static int mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned long id,
> +				  bool assert)
> +{
> +	struct mtk_mmsys *mmsys = container_of(rcdev, struct mtk_mmsys, rcdev);
> +	unsigned long flags;
> +	u32 reg;
> +	int i;
> +
> +	spin_lock_irqsave(&mmsys->lock, flags);
> +
> +	reg = readl_relaxed(mmsys->regs + MMSYS_SW0_RST_B);
> +
> +	if (assert)
> +		reg &= ~BIT(id);
> +	else
> +		reg |= BIT(id);
> +
> +	writel_relaxed(reg, mmsys->regs + MMSYS_SW0_RST_B);
> +
> +	spin_unlock_irqrestore(&mmsys->lock, flags);
> +
> +	return 0;
> +}
> +
> +static int mtk_mmsys_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
> +{
> +	return mtk_mmsys_reset_update(rcdev, id, true);
> +}
> +
> +static int mtk_mmsys_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
> +{
> +	return mtk_mmsys_reset_update(rcdev, id, false);
> +}
> +
> +static int mtk_mmsys_reset(struct reset_controller_dev *rcdev, unsigned long id)
> +{
> +	int ret;
> +
> +	ret = mtk_mmsys_reset_assert(rcdev, id);
> +	if (ret)
> +		return ret;
> +
> +	usleep_range(1000, 1100);
> +
> +	return mtk_mmsys_reset_deassert(rcdev, id);
> +}
> +
> +static const struct reset_control_ops mtk_mmsys_reset_ops = {
> +	.assert = mtk_mmsys_reset_assert,
> +	.deassert = mtk_mmsys_reset_deassert,
> +	.reset = mtk_mmsys_reset,
> +};
> +
>  static int mtk_mmsys_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -111,6 +168,18 @@ static int mtk_mmsys_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> +	spin_lock_init(&mmsys->lock);
> +
> +	mmsys->rcdev.owner = THIS_MODULE;
> +	mmsys->rcdev.nr_resets = 32;
> +	mmsys->rcdev.ops = &mtk_mmsys_reset_ops;
> +	mmsys->rcdev.of_node = pdev->dev.of_node;
> +	ret = devm_reset_controller_register(&pdev->dev, &mmsys->rcdev);
> +	if (ret) {
> +		dev_err(&pdev->dev, "Couldn't register mmsys reset controller: %d\n", ret);
> +		return ret;
> +	}
> +
>  	mmsys->data = of_device_get_match_data(&pdev->dev);
>  	platform_set_drvdata(pdev, mmsys);
>  
> diff --git a/drivers/soc/mediatek/mtk-mmsys.h b/drivers/soc/mediatek/mtk-mmsys.h
> index 11388961dded..f9f9e12ceab8 100644
> --- a/drivers/soc/mediatek/mtk-mmsys.h
> +++ b/drivers/soc/mediatek/mtk-mmsys.h
> @@ -66,6 +66,8 @@
>  #define DPI_SEL_IN_BLS				0x0
>  #define DSI_SEL_IN_RDMA				0x1
>  
> +#define MMSYS_SW0_RST_B				0x140
> +
>  struct mtk_mmsys_routes {
>  	u32 from_comp;
>  	u32 to_comp;
> 

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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
       [not found] <202107150857.sniQJ86e-lkp@intel.com>
  2021-07-16  8:58 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support kernel test robot
@ 2021-07-16  9:01 ` kernel test robot
  1 sibling, 0 replies; 22+ messages in thread
From: kernel test robot @ 2021-07-16  9:01 UTC (permalink / raw)
  To: Enric Balletbo i Serra, LKML
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Philipp Zabel, kbuild-all


Hi Enric,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on pza/reset/next linux/master linus/master 
v5.14-rc1 next-20210714]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: 
https://github.com/0day-ci/linux/commits/Enric-Balletbo-i-Serra/Add-support-to-the-mmsys-driver-to-be-a-reset-controller/20210714-181318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
for-next
compiler: riscv64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/soc/mediatek/mtk-mmsys.c:104:6: warning: Unused variable: i [unusedVariable]
     int i;
         ^

vim +104 drivers/soc/mediatek/mtk-mmsys.c

2c758e301ed95a Enric Balletbo i Serra 2020-03-25   97  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14   98  static int 
mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned long id,
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14   99  				  bool assert)
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  100  {
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  101  	struct mtk_mmsys 
*mmsys = container_of(rcdev, struct mtk_mmsys, rcdev);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  102  	unsigned long flags;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  103  	u32 reg;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14 @104  	int i;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  105  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  106  	spin_lock_irqsave(&mmsys->lock, 
flags);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  107  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  108  	reg = readl_relaxed(mmsys->regs 
+ MMSYS_SW0_RST_B);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  109  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  110  	if (assert)
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  111  		reg &= ~BIT(id);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  112  	else
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  113  		reg |= BIT(id);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  114  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  115  	writel_relaxed(reg, mmsys->regs 
+ MMSYS_SW0_RST_B);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  116  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  117 
spin_unlock_irqrestore(&mmsys->lock, flags);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  118  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  119  	return 0;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  120  }
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  121
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

* Re: [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support
       [not found] <202107150857.sniQJ86e-lkp@intel.com>
@ 2021-07-16  8:58 ` kernel test robot
  2021-07-16  9:01 ` kernel test robot
  1 sibling, 0 replies; 22+ messages in thread
From: kernel test robot @ 2021-07-16  8:58 UTC (permalink / raw)
  To: Enric Balletbo i Serra, LKML
  Cc: chunkuang.hu, hsinyi, kernel, drinkcat, eizan, linux-mediatek,
	matthias.bgg, jitao.shi, Philipp Zabel, kbuild-all


Hi Enric,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on pza/reset/next linux/master linus/master 
v5.14-rc1 next-20210714]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: 
https://github.com/0day-ci/linux/commits/Enric-Balletbo-i-Serra/Add-support-to-the-mmsys-driver-to-be-a-reset-controller/20210714-181318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git 
for-next
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
compiler: riscv64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/soc/mediatek/mtk-mmsys.c:104:6: warning: Unused variable: i [unusedVariable]
     int i;
         ^

vim +104 drivers/soc/mediatek/mtk-mmsys.c

2c758e301ed95a Enric Balletbo i Serra 2020-03-25   97  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14   98  static int 
mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned long id,
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14   99  				  bool assert)
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  100  {
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  101  	struct mtk_mmsys 
*mmsys = container_of(rcdev, struct mtk_mmsys, rcdev);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  102  	unsigned long flags;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  103  	u32 reg;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14 @104  	int i;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  105  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  106  	spin_lock_irqsave(&mmsys->lock, 
flags);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  107  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  108  	reg = readl_relaxed(mmsys->regs 
+ MMSYS_SW0_RST_B);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  109  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  110  	if (assert)
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  111  		reg &= ~BIT(id);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  112  	else
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  113  		reg |= BIT(id);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  114  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  115  	writel_relaxed(reg, mmsys->regs 
+ MMSYS_SW0_RST_B);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  116  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  117 
spin_unlock_irqrestore(&mmsys->lock, flags);
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  118  08a3068f9490f0 
Enric Balletbo i Serra 2021-07-14  119  	return 0;
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  120  }
08a3068f9490f0 Enric Balletbo i Serra 2021-07-14  121
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

end of thread, other threads:[~2021-08-06 17:35 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 10:11 [PATCH v2 0/7] Add support to the mmsys driver to be a reset controller Enric Balletbo i Serra
2021-07-14 10:11 ` [PATCH v2 1/7] arm64: dts: mediatek: Move reset controller constants into common location Enric Balletbo i Serra
2021-07-30  5:04   ` Guenter Roeck
2021-08-06 15:43   ` Matthias Brugger
2021-07-14 10:11 ` [PATCH v2 2/7] dt-bindings: mediatek: Add #reset-cells to mmsys system controller Enric Balletbo i Serra
2021-07-16 17:42   ` Rob Herring
2021-07-14 10:11 ` [PATCH v2 3/7] dt-bindings: display: mediatek: add dsi reset optional property Enric Balletbo i Serra
2021-07-16 17:55   ` Rob Herring
2021-07-14 10:11 ` [PATCH v2 4/7] arm64: dts: mt8173: Add the mmsys reset bit to reset the dsi0 Enric Balletbo i Serra
2021-07-16 17:56   ` Rob Herring
2021-07-14 10:11 ` [PATCH v2 5/7] arm64: dts: mt8183: " Enric Balletbo i Serra
2021-07-16 17:57   ` Rob Herring
2021-07-14 10:11 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support Enric Balletbo i Serra
2021-07-20 10:52   ` Philipp Zabel
2021-07-20 17:07     ` Enric Balletbo i Serra
2021-07-21  9:53       ` Philipp Zabel
2021-08-06 17:34   ` Matthias Brugger
2021-07-14 10:11 ` [PATCH v2 7/7] drm/mediatek: mtk_dsi: Reset the dsi0 hardware Enric Balletbo i Serra
2021-08-02 23:21   ` Chun-Kuang Hu
2021-08-06 17:33   ` Matthias Brugger
     [not found] <202107150857.sniQJ86e-lkp@intel.com>
2021-07-16  8:58 ` [PATCH v2 6/7] soc: mediatek: mmsys: Add reset controller support kernel test robot
2021-07-16  9:01 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).