Properly describe mt8167 watchdog and mmsys resets
cover Properly describe mt8167 watchdog and mmsys resets
Currently mt8167 inherits its watchdog from the included mt8516 dtsi, which in turn falls back on mt6589-wdt. However according to the data sheet mt8167 has 15 sw resets instead of 12, and the reset bits are different from mt6589.
In the first two patches we improve the description of the resets for mt6589 with values obtained from Android sources.
Then we introduce a dedicated mediatek,mt8167-wdt compatible for the watchdog driver that describes correctly this SoC's resets. Also while we're touching the bindings reset header, we add constants for the MMSYS resets.
In the 6th patch we add a node for the mt8167 watchdog referring to the new compatible in the SoC dtsi.
In the last patch, we define the mmsys reset table for the SoC. According to the datasheet, there are 28 mmsys reset bits divided across two adjacent registers.
Luca Leonardo Scorcia (7):
dt-bindings: reset: Add MT6589 toprgu reset IDs
watchdog: mediatek: Add wdt/toprgu resets for MT6589
dt-bindings: watchdog: Add compatible for MediaTek mt8167
dt-bindings: reset: Add reset controller constants for mt8167
watchdog: mediatek: Add support for mt8167 TOPRGU/WDT
arm64: dts: mt8167: Properly describe the SoC watchdog
soc: mediatek: mtk-mmsys: Add resets for mt8167
.../bindings/watchdog/mediatek,mtk-wdt.yaml | 1 + arch/arm64/boot/dts/mediatek/mt8167.dtsi | 7 +++ drivers/soc/mediatek/mt8167-mmsys.h | 40 ++++++++++++++ drivers/soc/mediatek/mtk-mmsys.c | 3 ++ drivers/watchdog/mtk_wdt.c | 13 ++++- .../reset/mediatek,mt6589-resets.h | 24 +++++++++ .../reset/mediatek,mt8167-resets.h | 53 +++++++++++++++++++ 7 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/reset/mediatek,mt6589-resets.h create mode 100644 include/dt-bindings/reset/mediatek,mt8167-resets.h
Signature · 1 line
2.43.0
PATCH 1/7 dt-bindings: reset: Add MT6589 toprgu reset IDs
Add reset constants for the 12 MT6589 toprgu resets.
--- .../reset/mediatek,mt6589-resets.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 include/dt-bindings/reset/mediatek,mt6589-resets.h
include/dt-bindings/reset/mediatek,mt6589-resets.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Author: Luca Leonardo Scorcia <[email protected]> +*/ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT6589 +#define _DT_BINDINGS_RESET_CONTROLLER_MT6589 + +/* TOPRGU resets */ +#define MT6589_TOPRGU_INFRA_SW_RST 0 +#define MT6589_TOPRGU_MM_SW_RST 1 +#define MT6589_TOPRGU_MFG_SW_RST 2 +#define MT6589_TOPRGU_VENC_SW_RST 3 +#define MT6589_TOPRGU_VDEC_SW_RST 4 +#define MT6589_TOPRGU_IMG_SW_RST 5 +#define MT6589_TOPRGU_DDRPHY_SW_RST 6 +#define MT6589_TOPRGU_MD_SW_RST 7 +#define MT6589_TOPRGU_INFRA_AO_SW_RST 8 +#define MT6589_TOPRGU_MD_LITE_SW_RST 9 +#define MT6589_TOPRGU_APMIXED_SW_RST 10 +#define MT6589_TOPRGU_PWRAP_SPI_CTL_RST 11 +#define MT6589_TOPRGU_SW_RST_NUM 12 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT6589 */
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 1/7] dt-bindings: reset: Add MT6589 toprgu reset IDs
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The watchdog binding schema is not updated to require `#reset-cells` for the MT6589 watchdog after…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The watchdog binding schema is not updated to require #reset-cells for the MT6589 watchdog after it gained reset provider capabilities. --
--- Patch [1]: [PATCH 1/7] dt-bindings: reset: Add MT6589 toprgu reset IDs --- commit 8e7eeaa8443a5e5f9043d85f10bedf8f05afe2b3
Author: Luca Leonardo Scorcia <[email protected]>
dt-bindings: reset: Add MT6589 toprgu reset IDs
This commit adds a new header file defining reset IDs for the 12 MT6589 toprgu resets.
include/dt-bindings/reset/mediatek,mt6589-resets.h line 7
Quoted 13 lines
include/dt-bindings/reset/mediatek,mt6589-resets.h new file +7
-0@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Author: Luca Leonardo Scorcia <[email protected]> +*/ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT6589 +#define _DT_BINDINGS_RESET_CONTROLLER_MT6589
[Severity: Low]
Does the MT6589 watchdog binding schema in Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml also need an update to require the #reset-cells property?
Since the MT6589 watchdog is gaining reset provider capabilities with these constants, device tree nodes omitting #reset-cells might incorrectly pass schema validation unless an if-then block is added to the watchdog schema to enforce it.
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/7] dt-bindings: reset: Add MT6589 toprgu reset IDs
In reply to Luca Leonardo ScorciaQuoted 42 lines · Luca Leonardo Scorcia
Add reset constants for the 12 MT6589 toprgu resets.
Signed-off-by Luca Leonardo Scorcia <[email protected]>--- .../reset/mediatek,mt6589-resets.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 include/dt-bindings/reset/mediatek,mt6589-resets.hinclude/dt-bindings/reset/mediatek,mt6589-resets.h new file +24
-0@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Author: Luca Leonardo Scorcia <[email protected]> +*/ + +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT6589 +#define _DT_BINDINGS_RESET_CONTROLLER_MT6589 + +/* TOPRGU resets */ +#define MT6589_TOPRGU_INFRA_SW_RST 0 +#define MT6589_TOPRGU_MM_SW_RST 1 +#define MT6589_TOPRGU_MFG_SW_RST 2 +#define MT6589_TOPRGU_VENC_SW_RST 3 +#define MT6589_TOPRGU_VDEC_SW_RST 4 +#define MT6589_TOPRGU_IMG_SW_RST 5 +#define MT6589_TOPRGU_DDRPHY_SW_RST 6 +#define MT6589_TOPRGU_MD_SW_RST 7 +#define MT6589_TOPRGU_INFRA_AO_SW_RST 8 +#define MT6589_TOPRGU_MD_LITE_SW_RST 9 +#define MT6589_TOPRGU_APMIXED_SW_RST 10 +#define MT6589_TOPRGU_PWRAP_SPI_CTL_RST 11 +#define MT6589_TOPRGU_SW_RST_NUM 12 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT6589 */ Signature · 1 line
2.43.0
Correctly compatible with MT6589.
PATCH 2/7 watchdog: mediatek: Add wdt/toprgu resets for MT6589
In reply to Luca Leonardo ScorciaAccording to Android sources, MT6589 has 12 reset bits in the WDT_SWSYSRST register. Populate toprgu_sw_rst_num to allow toprgu resets in device trees of the many compatible devices.
--- drivers/watchdog/mtk_wdt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/watchdog/mtk_wdt.c +6 -1
@@ -10,6 +10,7 @@*/ #include <dt-bindings/reset/mt2712-resets.h> +#include <dt-bindings/reset/mediatek,mt6589-resets.h> #include <dt-bindings/reset/mediatek,mt6735-wdt.h> #include <dt-bindings/reset/mediatek,mt6795-resets.h> #include <dt-bindings/reset/mt7986-resets.h>
@@ -88,6 +89,10 @@ static const struct mtk_wdt_data mt2712_data = { .toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM, }; +static const struct mtk_wdt_data mt6589_data = { + .toprgu_sw_rst_num =MT6589_TOPRGU_SW_RST_NUM , +}; +static const struct mtk_wdt_data mt6735_data = { .toprgu_sw_rst_num =MT6735_TOPRGU_RST_NUM , };
@@ -493,7 +498,7 @@ static int mtk_wdt_resume(struct device *dev)static const struct of_device_id mtk_wdt_dt_ids[] = { { .compatible ="mediatek,mt2712-wdt" , .data = &mt2712_data }, - { .compatible ="mediatek,mt6589-wdt" }, + { .compatible ="mediatek,mt6589-wdt" , .data = &mt6589_data }, { .compatible ="mediatek,mt6735-wdt" , .data = &mt6735_data }, { .compatible ="mediatek,mt6795-wdt" , .data = &mt6795_data }, { .compatible ="mediatek,mt7986-wdt" , .data = &mt7986_data },
Signature · 1 line
2.43.0
PATCH 3/7 dt-bindings: watchdog: Add compatible for MediaTek mt8167
In reply to Luca Leonardo ScorciaCurrently mt8167 inherits its watchdog from the included mt8516 dtsi, which in turn falls back on mt6589-wdt. However according to the data sheet mt8167 has 15 sw resets instead of 12, and their order is different from mt6589. Update the wdt binding to add a dedicated compatible for mt8167.
--- Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml +1 -0
@@ -26,6 +26,7 @@ properties: - mediatek,mt6795-wdt - mediatek,mt7986-wdt - mediatek,mt7988-wdt + - mediatek,mt8167-wdt - mediatek,mt8183-wdt - mediatek,mt8186-wdt - mediatek,mt8188-wdt
Signature · 1 line
2.43.0
PATCH 4/7 dt-bindings: reset: Add reset controller constants for mt8167
In reply to Luca Leonardo ScorciaAdd the various bits that identify watchdog and mmsys resets. IDs for mmsys resets restart from zero as they are used in a different device.
--- .../reset/mediatek,mt8167-resets.h | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 include/dt-bindings/reset/mediatek,mt8167-resets.h
include/dt-bindings/reset/mediatek,mt8167-resets.h new file +53 -0
@@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +#ifndef _DT_BINDINGS_RESET_CONTROLLER_MT8167 +#define _DT_BINDINGS_RESET_CONTROLLER_MT8167 + +/* TOPRGU resets, these are actual bits in the register */ +#define MT8167_TOPRGU_DDRPHY_FLASH_RST 0 +#define MT8167_TOPRGU_AUD_PAD_RST 1 +#define MT8167_TOPRGU_MM_RST 2 +#define MT8167_TOPRGU_MFG_RST 3 +#define MT8167_TOPRGU_MDSYS_RST 4 +#define MT8167_TOPRGU_CONN_RST 5 +#define MT8167_TOPRGU_PAD2CAM_DIG_MIPI_RX_RST 6 +#define MT8167_TOPRGU_DIG_MIPI_TX_RST 7 +#define MT8167_TOPRGU_SPI_PAD_MACRO_RST 8 +/* bit 9 is reserved, unused according to data sheet */ +#define MT8167_TOPRGU_APMIXED_RST 10 +#define MT8167_TOPRGU_VDEC_RST 11 +#define MT8167_TOPRGU_CONN_MCU_RST 12 +#define MT8167_TOPRGU_EFUSE_RST 13 +#define MT8167_TOPRGU_PWRAP_SPICTL_RST 14 +#define MT8167_TOPRGU_SW_RST_NUM 15 + +/* MMSYS resets, these are IDs */ +#define MT8167_MMSYS_SW0_RST_B_SMI_COMMON 0 +#define MT8167_MMSYS_SW0_RST_B_SMI_LARB0 1 +#define MT8167_MMSYS_SW0_RST_B_CAM_MDP 2 +#define MT8167_MMSYS_SW0_RST_B_MDP_RDMA0 3 +#define MT8167_MMSYS_SW0_RST_B_MDP_RSZ0 4 +#define MT8167_MMSYS_SW0_RST_B_MDP_RSZ1 5 +#define MT8167_MMSYS_SW0_RST_B_MDP_TDSHP0 6 +#define MT8167_MMSYS_SW0_RST_B_MDP_WDMA 7 +#define MT8167_MMSYS_SW0_RST_B_MDP_WROT0 8 +#define MT8167_MMSYS_SW0_RST_B_FAKE_ENG 9 +#define MT8167_MMSYS_SW0_RST_B_MUTEX 10 +#define MT8167_MMSYS_SW0_RST_B_DISP_OVL0 11 +#define MT8167_MMSYS_SW0_RST_B_DISP_RDMA0 12 +#define MT8167_MMSYS_SW0_RST_B_DISP_RDMA1 13 +#define MT8167_MMSYS_SW0_RST_B_DISP_WDMA0 14 +#define MT8167_MMSYS_SW0_RST_B_DISP_COLOR 15 +#define MT8167_MMSYS_SW0_RST_B_DISP_CCORR 16 +#define MT8167_MMSYS_SW0_RST_B_DISP_AAL 17 +#define MT8167_MMSYS_SW0_RST_B_DISP_GAMMA 18 +#define MT8167_MMSYS_SW0_RST_B_DISP_DITHER 19 +#define MT8167_MMSYS_SW0_RST_B_DISP_UFOE 20 +#define MT8167_MMSYS_SW0_RST_B_DISP_PWM 21 +#define MT8167_MMSYS_SW0_RST_B_DSI0 22 +#define MT8167_MMSYS_SW0_RST_B_DPI0 23 +#define MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG 24 +#define MT8167_MMSYS_SW1_RST_B_LVDS_ENCODER 25 +#define MT8167_MMSYS_SW1_RST_B_DPI1 26 +#define MT8167_MMSYS_SW1_RST_B_HDMI 27 + +#endif /* _DT_BINDINGS_RESET_CONTROLLER_MT8167 */
Signature · 1 line
2.43.0
PATCH 5/7 watchdog: mediatek: Add support for mt8167 TOPRGU/WDT
In reply to Luca Leonardo ScorciaAdd support for the Top Reset Generation Unit/Watchdog Timer found on mt8167.
--- drivers/watchdog/mtk_wdt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/watchdog/mtk_wdt.c +6 -0
@@ -13,6 +13,7 @@#include <dt-bindings/reset/mediatek,mt6589-resets.h> #include <dt-bindings/reset/mediatek,mt6735-wdt.h> #include <dt-bindings/reset/mediatek,mt6795-resets.h> +#include <dt-bindings/reset/mediatek,mt8167-resets.h> #include <dt-bindings/reset/mt7986-resets.h> #include <dt-bindings/reset/mt8183-resets.h> #include <dt-bindings/reset/mt8186-resets.h>
@@ -110,6 +111,10 @@ static const struct mtk_wdt_data mt7988_data = { .has_swsysrst_en = true, }; +static const struct mtk_wdt_data mt8167_data = { + .toprgu_sw_rst_num =MT8167_TOPRGU_SW_RST_NUM , +}; +static const struct mtk_wdt_data mt8183_data = { .toprgu_sw_rst_num =MT8183_TOPRGU_SW_RST_NUM , };
@@ -503,6 +508,7 @@ static const struct of_device_id mtk_wdt_dt_ids[] = { { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data }, { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data }, { .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data }, + { .compatible = "mediatek,mt8167-wdt", .data = &mt8167_data }, { .compatible = "mediatek,mt8183-wdt", .data = &mt8183_data }, { .compatible = "mediatek,mt8186-wdt", .data = &mt8186_data }, { .compatible = "mediatek,mt8188-wdt", .data = &mt8188_data },
Signature · 1 line
2.43.0
PATCH 6/7 arm64: dts: mt8167: Properly describe the SoC watchdog
In reply to Luca Leonardo ScorciaCurrently mt8167 inherits its watchdog from the included mt8516 dtsi, which in turn falls back on mt6589-wdt. However according to the data sheet mt8167 has 15 sw resets instead of 12, and the reset bits are different from mt6589.
Use the dedicated mediatek,mt8167-wdt compatible for the watchdog driver, as it correctly describes the SoC resets.
--- arch/arm64/boot/dts/mediatek/mt8167.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/mediatek/mt8167.dtsi +7 -0
@@ -95,6 +95,13 @@ power-domain@MT8167_POWER_DOMAIN_CONN { }; }; + watchdog: watchdog@10007000 { + compatible = "mediatek,mt8167-wdt"; + reg = <0 0x10007000 0 0x1000>; + interrupts = <GIC_SPI 198 IRQ_TYPE_LEVEL_LOW>; + #reset-cells = <1>; + }; + pio: pinctrl@1000b000 { compatible = "mediatek,mt8167-pinctrl"; reg = <0 0x1000b000 0 0x1000>;
Signature · 1 line
2.43.0
PATCH 7/7 soc: mediatek: mtk-mmsys: Add resets for mt8167
In reply to Luca Leonardo ScorciaThe mt8167 SoC has 64 MMSYS resets, split in two contiguous 32-bits registers, MMSYS_SW0_RST_B (0x140) and MMSYS_SW1_RST_B (0x144), as also stated in the downstream kernel for the Lenovo Smart Clock in the ddp_reg.h header.
--- drivers/soc/mediatek/mt8167-mmsys.h | 40 +++++++++++++++++++++++++++++ drivers/soc/mediatek/mtk-mmsys.c | 3 +++ 2 files changed, 43 insertions(+)
drivers/soc/mediatek/mt8167-mmsys.h +40 -0
@@ -3,6 +3,46 @@#ifndef __SOC_MEDIATEK_MT8167_MMSYS_H#define __SOC_MEDIATEK_MT8167_MMSYS_H +#include <linux/soc/mediatek/mtk-mmsys.h> +#include <dt-bindings/reset/mediatek,mt8167-resets.h> + +#define MT8167_MMSYS_SW0_RST_B 0x140 +#define MT8167_MMSYS_SW1_RST_B 0x144 + +/* MMSYS resets */ +static const u8 mmsys_mt8167_rst_tb[] = { + [MT8167_MMSYS_SW0_RST_B_SMI_COMMON ] =MMSYS_RST_NR (0 ,0 ), + [MT8167_MMSYS_SW0_RST_B_SMI_LARB0 ] =MMSYS_RST_NR (0 ,1 ), + [MT8167_MMSYS_SW0_RST_B_CAM_MDP ] =MMSYS_RST_NR (0 ,2 ), + [MT8167_MMSYS_SW0_RST_B_MDP_RDMA0 ] =MMSYS_RST_NR (0 ,3 ), + [MT8167_MMSYS_SW0_RST_B_MDP_RSZ0 ] =MMSYS_RST_NR (0 ,4 ), + [MT8167_MMSYS_SW0_RST_B_MDP_RSZ1 ] =MMSYS_RST_NR (0 ,5 ), + [MT8167_MMSYS_SW0_RST_B_MDP_TDSHP0 ] =MMSYS_RST_NR (0 ,6 ), + [MT8167_MMSYS_SW0_RST_B_MDP_WDMA ] =MMSYS_RST_NR (0 ,7 ), + [MT8167_MMSYS_SW0_RST_B_MDP_WROT0 ] =MMSYS_RST_NR (0 ,8 ), + [MT8167_MMSYS_SW0_RST_B_FAKE_ENG ] =MMSYS_RST_NR (0 ,9 ), + [MT8167_MMSYS_SW0_RST_B_MUTEX ] =MMSYS_RST_NR (0 ,10 ), + [MT8167_MMSYS_SW0_RST_B_DISP_OVL0 ] =MMSYS_RST_NR (0 ,11 ), + [MT8167_MMSYS_SW0_RST_B_DISP_RDMA0 ] =MMSYS_RST_NR (0 ,12 ), + [MT8167_MMSYS_SW0_RST_B_DISP_RDMA1 ] =MMSYS_RST_NR (0 ,13 ), + [MT8167_MMSYS_SW0_RST_B_DISP_WDMA0 ] =MMSYS_RST_NR (0 ,14 ), + [MT8167_MMSYS_SW0_RST_B_DISP_COLOR ] =MMSYS_RST_NR (0 ,15 ), + [MT8167_MMSYS_SW0_RST_B_DISP_CCORR ] =MMSYS_RST_NR (0 ,16 ), + [MT8167_MMSYS_SW0_RST_B_DISP_AAL ] =MMSYS_RST_NR (0 ,17 ), + [MT8167_MMSYS_SW0_RST_B_DISP_GAMMA ] =MMSYS_RST_NR (0 ,18 ), + [MT8167_MMSYS_SW0_RST_B_DISP_DITHER ] =MMSYS_RST_NR (0 ,19 ), + [MT8167_MMSYS_SW0_RST_B_DISP_UFOE ] =MMSYS_RST_NR (0 ,20 ), + [MT8167_MMSYS_SW0_RST_B_DISP_PWM ] =MMSYS_RST_NR (0 ,21 ), + [MT8167_MMSYS_SW0_RST_B_DSI0 ] =MMSYS_RST_NR (0 ,22 ), + [MT8167_MMSYS_SW0_RST_B_DPI0 ] =MMSYS_RST_NR (0 ,23 ), +/* bit 24 is SMI_COMMON again according to data sheet */ +/* bit 25 is SMI_LARB0 again according to data sheet */ +/* all other bits are not described in data sheet */ + [MT8167_MMSYS_SW1_RST_B_LVDS_ENCODER ] =MMSYS_RST_NR (1 ,2 ), + [MT8167_MMSYS_SW1_RST_B_DPI1 ] =MMSYS_RST_NR (1 ,3 ), + [MT8167_MMSYS_SW1_RST_B_HDMI ] =MMSYS_RST_NR (1 ,4 ), +}; +#define MT8167_DISP_REG_CONFIG_DISP_OVL0_MOUT_EN 0x030#define MT8167_DISP_REG_CONFIG_DISP_DITHER_MOUT_EN 0x038#define MT8167_DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x058
drivers/soc/mediatek/mtk-mmsys.c +3 -0
@@ -57,6 +57,9 @@ static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = { .clk_driver = "clk-mt8167-mm", .routes = mt8167_mmsys_routing_table, .num_routes = ARRAY_SIZE(mt8167_mmsys_routing_table), + .sw0_rst_offset = MT8167_MMSYS_SW0_RST_B, + .rst_tb = mmsys_mt8167_rst_tb, + .num_resets = ARRAY_SIZE(mmsys_mt8167_rst_tb), };static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = {
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 7/7] soc: mediatek: mtk-mmsys: Add resets for mt8167
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Missing array mapping for MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG (ID 24) causes it to default to 0…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing array mapping for MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG (ID 24) causes it to default to 0, unintentionally aliasing to and resetting the SMI_COMMON block. --
--- Patch [7]: [PATCH 7/7] soc: mediatek: mtk-mmsys: Add resets for mt8167 --- commit c0225a0e854c0cfee4ad1db37b9fac3a7690abdd
Author: Luca Leonardo Scorcia <[email protected]>
soc: mediatek: mtk-mmsys: Add resets for mt8167
This commit adds 64 MMSYS resets for the MT8167 SoC, spanning two contiguous 32-bit registers (SW0 and SW1).
Quoted 4 lines
drivers/soc/mediatek/mt8167-mmsys.h +0
-0
[ ... ]
Quoted 4 lines
drivers/soc/mediatek/mt8167-mmsys.h +4
-0+/* MMSYS resets */ +static const u8 mmsys_mt8167_rst_tb[] = { + [MT8167_MMSYS_SW0_RST_B_SMI_COMMON ] =MMSYS_RST_NR (0 ,0 ), + [MT8167_MMSYS_SW0_RST_B_SMI_LARB0 ] =MMSYS_RST_NR (0 ,1 ),
[ ... ]
drivers/soc/mediatek/mt8167-mmsys.h line 44
Quoted 9 lines
drivers/soc/mediatek/mt8167-mmsys.h +9
-0+ [MT8167_MMSYS_SW0_RST_B_DSI0] = MMSYS_RST_NR(0, 22), + [MT8167_MMSYS_SW0_RST_B_DPI0] = MMSYS_RST_NR(0, 23), +/* bit 24 is SMI_COMMON again according to data sheet */ +/* bit 25 is SMI_LARB0 again according to data sheet */ +/* all other bits are not described in data sheet */ + [MT8167_MMSYS_SW1_RST_B_LVDS_ENCODER] = MMSYS_RST_NR(1, 2), + [MT8167_MMSYS_SW1_RST_B_DPI1] = MMSYS_RST_NR(1, 3), + [MT8167_MMSYS_SW1_RST_B_HDMI] = MMSYS_RST_NR(1, 4), +};
[Severity: High]
Does this array omit the mapping for MT8167_MMSYS_SW0_RST_B_MIPI_TX_CONFIG (ID 24)?
Because index 24 is unmapped in this array, it will default to 0. When a driver requests a reset for the MIPI TX config ID, mtk_mmsys_reset_update() will look up index 24 and retrieve 0, which directly maps to MMSYS_RST_NR(0, 0) (the SMI_COMMON block).
Can this omission cause the SMI_COMMON block to be unintentionally reset instead, potentially disrupting the multimedia subsystem's memory transactions?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7