pinctrl: mediatek: mt8516-mt8167: Convert to Paris driver
Subsystems (5)
cover pinctrl: mediatek: mt8516-mt8167: Convert to Paris driver
The pinctrl registers of the mt8516 and mt8167 SoCs follow the layout of the Paris platform, but their pinctrl driver is currently modeled on the mt65xx legacy driver. As suggested in [1], it is possible to migrate them to the Paris driver.
In the process it is also possible to completely drop one of the two drivers as their register layout is identical, they only differ in some pin functions (mt8167 is basically mt8516 with added display blocks).
The Paris driver allows specifying two base registers, gpio and eint; this way it's no longer necessary to have a syscfg node in the device tree, referenced as a phandle in the pinctrl node. This also fixes the following long standing dtbs_check errors:
mt8167-pumpkin.dtb: syscfg-pctl@10005000 (syscon): compatible: ['syscon']
is too short
mt8516-pumpkin.dtb: syscfg-pctl@10005000 (syscon): compatible: ['syscon']
is too short
The new driver has been checked against the SoC data sheet and adds the capability to control pin driving strength and R1R0 pullup-pulldown resistors.
This series is sent as a RFC since the changes could theoretically impact existing devices. I am pretty sure that no device ever used upstream drivers though, not even the Pumpkin board that's present in Linux sources since this board lacks the associated mt6392 PMIC driver that is required for regulator management. If for compatibility reasons it is deemed better to keep both drivers in the kernel I would welcome any suggestion on how to name the new driver, and how to adjust the two bindings for coexistence.
These changes have been tested on the Xiaomi Mi Smart Clock X04G and on the Lenovo Smart Clock 2 CD-24502F.
[1] https://lore.kernel.org/linux-mediatek/[email protected]/
Luca Leonardo Scorcia (3):
dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to
mt6795
pinctrl: mediatek: mt8516/mt8167: Migrate driver to pinctrl-paris
platform
arm64: dts: mt8516/mt8167: Update pinctrl nodes for the new paris
driver
.../pinctrl/mediatek,mt65xx-pinctrl.yaml | 2 - .../pinctrl/mediatek,mt6795-pinctrl.yaml | 5 +- arch/arm64/boot/dts/mediatek/mt8167.dtsi | 15 +- arch/arm64/boot/dts/mediatek/mt8516.dtsi | 12 +- drivers/pinctrl/mediatek/Kconfig | 11 +- drivers/pinctrl/mediatek/Makefile | 1 - drivers/pinctrl/mediatek/pinctrl-mt8167.c | 345 -------- drivers/pinctrl/mediatek/pinctrl-mt8516.c | 770 +++++++++++------- drivers/pinctrl/mediatek/pinctrl-mtk-mt8167.h | 562 +++++++------ drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h | 512 ++++++------ 10 files changed, 1018 insertions(+), 1217 deletions(-) delete mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8167.c
base-commit: 4e5dfb7c84012007c3c7061126491bbc92d71bf1
Signature · 1 line
2.43.0
RFC PATCH 1/3 dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Pinctrl settings for MediaTek mt8516-mt8167 SoCs use two reg base addresses, one for GPIO and the other for EINT, as it is common in the "Paris" pinctrl platform that is described in the MediaTek mt6795 docs.
Move the binding compatible for these two SoCs from mt66xx to the mt6796 one as a prerequisite for migrating the pinctrl driver to the pinctrl-paris platform.
--- .../devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml | 2 -- .../devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml +0 -2
@@ -22,9 +22,7 @@ properties: - mediatek,mt7623-pinctrl - mediatek,mt8127-pinctrl - mediatek,mt8135-pinctrl - - mediatek,mt8167-pinctrl - mediatek,mt8173-pinctrl - - mediatek,mt8516-pinctrl reg: maxItems: 1
Documentation/devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml +4 -1
@@ -15,7 +15,10 @@ description: properties: compatible: - const: mediatek,mt6795-pinctrl + enum: + - mediatek,mt6795-pinctrl + - mediatek,mt8167-pinctrl + - mediatek,mt8516-pinctrl gpio-controller: true
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Critical] The patch series permanently breaks Device Tree backward compatibility (ABI breakage). By…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] The patch series permanently breaks Device Tree backward compatibility (ABI breakage). By moving the mt8167 and mt8516 SoCs to the mt6795 bindings and pinctrl-paris.c driver, the schema now unconditionally requires reg-names and gpio-ranges and forbids the legacy mediatek,pctl-regmap layout. Furthermore, the updated driver calls devm_platform_ioremap_resource_byname(pdev, "base") and fails with -EINVAL if reg-names is absent. Booting a new kernel with an older, previously valid device tree will fail to probe the pinctrl driver, breaking all GPIO-dependent devices. --
commit ae4fde26bd3f120a43beccf98009171f05144eee
Author: Luca Leonardo Scorcia <[email protected]>
dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Pinctrl settings for MediaTek mt8516-mt8167 SoCs use two reg base addresses, one for GPIO and the other for EINT, as it is common in the "Paris" pinctrl platform. This commit moves the mediatek,mt8516-pinctrl and mediatek,mt8167-pinctrl compatible strings to the mt6795-pinctrl binding.
[ ... ]
Documentation/devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml description: · line 21
Quoted 13 lines
Documentation/devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml +4
-1@@ -15,7 +15,10 @@ description: properties: compatible: - const: mediatek,mt6795-pinctrl + enum: + - mediatek,mt6795-pinctrl + - mediatek,mt8167-pinctrl + - mediatek,mt8516-pinctrl
[Severity: Critical]
Does moving these compatibles to this binding break Device Tree backward compatibility?
The schema now unconditionally requires properties like reg-names and gpio-ranges, and forbids the legacy mediatek,pctl-regmap layout without an
allOf: if-then conditional to accommodate older hardware descriptions.
Furthermore, the updated driver unconditionally requires the reg-names property:
drivers/pinctrl/mediatek/pinctrl-paris.c:mtk_paris_pinctrl_probe() {
...
hw->base[i] = devm_platform_ioremap_resource_byname(pdev,
hw->soc->base_names[i]);
...
}Because older device trees lack the reg-names property, this call returns -EINVAL and fails the probe.
Will booting a new kernel with an older device tree fail to probe the pinctrl driver, breaking all GPIO-dependent peripherals?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
In reply to Luca Leonardo ScorciaQuoted 7 lines · Luca Leonardo Scorcia
Pinctrl settings for MediaTek mt8516-mt8167 SoCs use two reg base addresses, one for GPIO and the other for EINT, as it is common in the "Paris" pinctrl platform that is described in the MediaTek mt6795 docs.
Move the binding compatible for these two SoCs from mt66xx to the mt6796 one as a prerequisite for migrating the pinctrl driver to the pinctrl-paris platform.
I've not done a very through analysis, but this seems like a massive ABI break.
The change you're trying to make here will mean that new kernels will not work with older devicetrees AFAICT.
Quoted 40 lines
Signed-off-by Luca Leonardo Scorcia <[email protected]>--- .../devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml | 2 -- .../devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/pinctrl/mediatek,mt65xx-pinctrl.yaml +0
-2@@ -22,9 +22,7 @@ properties: - mediatek,mt7623-pinctrl - mediatek,mt8127-pinctrl - mediatek,mt8135-pinctrl - - mediatek,mt8167-pinctrl - mediatek,mt8173-pinctrl - - mediatek,mt8516-pinctrl reg: maxItems: 1Documentation/devicetree/bindings/pinctrl/mediatek,mt6795-pinctrl.yaml +4
-1@@ -15,7 +15,10 @@ description: properties: compatible: - const: mediatek,mt6795-pinctrl + enum: + - mediatek,mt6795-pinctrl + - mediatek,mt8167-pinctrl + - mediatek,mt8516-pinctrl gpio-controller: trueSignature · 1 line
2.43.0
Re: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Hi,
Quoted 4 lines
I've not done a very through analysis, but this seems like a massive ABI break.
The change you're trying to make here will mean that new kernels will not work with older devicetrees AFAICT.
Correct, that's the reason I sent it as an RFC (I mentioned this in the cover letter). I am new to kernel work and I'm not sure how to deal with this change. On one hand I am almost certain now that the upstream driver has never been used in actual devices, since the older code was only partially merged and also, as Sashiko correctly pointed out in [1], it had serious errors when matched against the data sheet:
Sashiko:
Quoted 5 lines
Does this configuration cause a regression in pin multiplexing across the SoC? The legacy driver used a 4-bit shift per pin to pack 5 pins per 32-bit register. By passing 3 as the width here, the framework calculates mode offsets using 3 bits per pin. This causes pinmux writes to align with the wrong bits and can overwrite the configurations of adjacent pins.
Data sheet here clearly shows 3 bits per pin are used to choose the pin function.
On the other hand I know that breaking the ABI is a big no. But what would be an appropriate solution? Maybe duplicating the driver with a different name, something like mediatek,mt8167-pinctrl-v2? Is there another driver I could have a look at to learn how to approach this problem?
Sashiko also pointed out some other minor issues with the register maps I already fixed locally after confirming with the data sheet, but did not provide clues about how to solve the ABI breakage.
[1] https://sashiko.dev/#/message/20260625111629.6CD701F000E9%40smtp.kernel.org
Thank you for your time!
Signature · 2 lines
Luca Leonardo Scorcia [email protected]
Re: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Quoted 21 lines · Luca Leonardo Scorcia
Hi,
Quoted 4 lines
I've not done a very through analysis, but this seems like a massive ABI break.
The change you're trying to make here will mean that new kernels will not work with older devicetrees AFAICT.Correct, that's the reason I sent it as an RFC (I mentioned this in the cover letter). I am new to kernel work and I'm not sure how to deal with this change. On one hand I am almost certain now that the upstream driver has never been used in actual devices, since the older code was only partially merged and also, as Sashiko correctly pointed out in [1], it had serious errors when matched against the data sheet:
Sashiko:
Quoted 5 lines
Does this configuration cause a regression in pin multiplexing across the SoC? The legacy driver used a 4-bit shift per pin to pack 5 pins per 32-bit register. By passing 3 as the width here, the framework calculates mode offsets using 3 bits per pin. This causes pinmux writes to align with the wrong bits and can overwrite the configurations of adjacent pins.
Quoted 5 lines
Data sheet here clearly shows 3 bits per pin are used to choose the pin function.
On the other hand I know that breaking the ABI is a big no. But what would be an appropriate solution? Maybe duplicating the driver with a
If you can substantiate a claim that the current setup doesn't actually work for these devices (which seems plausible), you can justify changing the ABI on that basis.
Quoted 3 lines
different name, something like mediatek,mt8167-pinctrl-v2? Is there another driver I could have a look at to learn how to approach this problem?
Usually when making ABI changes because something was inaccurate (but not wrong to the point that it didn't work at all) it's possible to support both new and old ABIs at the same time because of new properties etc. This is a difficult one because it's using the same properties in different ways. A new compatible would definitely be required for a genuine fresh start while retaining kernel support for the old mechanism in this case.
But as I said, if what's in the kernel right now does not work at all, then you can probably just rework in place. Your commit messages will have to be very clear about why what you're doing is okay however. It'd probably be best to try to detect the old devicetrees (if that's even possible, will be tricky unless the devices you're moving are the ones that need mediatek,pctl-regmap) and reject probe.
Quoted 10 lines
Sashiko also pointed out some other minor issues with the register maps I already fixed locally after confirming with the data sheet, but did not provide clues about how to solve the ABI breakage.
[1] https://sashiko.dev/#/message/20260625111629.6CD701F000E9%40smtp.kernel.org
Thank you for your time!
Signature · 2 lines
Luca Leonardo Scorcia [email protected]
Re: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Quoted 7 lines
Usually when making ABI changes because something was inaccurate (but not wrong to the point that it didn't work at all) it's possible to support both new and old ABIs at the same time because of new properties etc. This is a difficult one because it's using the same properties in different ways. A new compatible would definitely be required for a genuine fresh start while retaining kernel support for the old mechanism in this case.
All things considered, the cleanest solution seems to be adding a new compatible, mark the old one as deprecated and also try to fix the old driver code. I'll try to do that before submitting again. Thank you for your help!
Signature · 2 lines
Luca Leonardo Scorcia [email protected]
AngeloGioacchino Del Regno
maintainerRe: [RFC PATCH 1/3] dt-bindings: pinctrl: mt8516/mt8167: Move compatibles from mt66xx to mt6795
Quoted 8 lines · Luca Leonardo Scorcia
Quoted 7 lines
Usually when making ABI changes because something was inaccurate (but not wrong to the point that it didn't work at all) it's possible to support both new and old ABIs at the same time because of new properties etc. This is a difficult one because it's using the same properties in different ways. A new compatible would definitely be required for a genuine fresh start while retaining kernel support for the old mechanism in this case.
Quoted 4 lines
All things considered, the cleanest solution seems to be adding a new compatible, mark the old one as deprecated and also try to fix the old driver code. I'll try to do that before submitting again. Thank you for your help!
You can skip the "fix the old driver code" part. The only users here are demo boards that aren't even used that much and besides, they're even hard to find.
Cheers,
Angelo
RFC PATCH 2/3 pinctrl: mediatek: mt8516/mt8167: Migrate driver to pinctrl-paris platform
In reply to Luca Leonardo ScorciaMigrate the mt8516/mt8167 pinctrl driver to the paris platform driver. This change lets us correctly describe the two base addresses (GPIO/EINT) used by the SoCs in their device tree. It also adds support for driving strength capability and R1R0 pullup-pulldown on pins.
Since the driver for mt8167 pinctrl is identical to the mt8516 one except for pin definitions there is no need for a separate driver, so drop it and add a compatible to the other one.
--- drivers/pinctrl/mediatek/Kconfig | 11 +- drivers/pinctrl/mediatek/Makefile | 1 - drivers/pinctrl/mediatek/pinctrl-mt8167.c | 345 -------- drivers/pinctrl/mediatek/pinctrl-mt8516.c | 770 +++++++++++------- drivers/pinctrl/mediatek/pinctrl-mtk-mt8167.h | 562 +++++++------ drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h | 512 ++++++------ 6 files changed, 1006 insertions(+), 1195 deletions(-) delete mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8167.c
drivers/pinctrl/mediatek/Kconfig +2 -9
@@ -214,13 +214,6 @@ config PINCTRL_MT7988 default ARM64 && ARCH_MEDIATEK select PINCTRL_MTK_MOORE -config PINCTRL_MT8167 - bool "MediaTek MT8167 pin control" - depends on OF - depends on ARM64 || COMPILE_TEST - default ARM64 && ARCH_MEDIATEK - select PINCTRL_MTK - config PINCTRL_MT8173 bool "MediaTek MT8173 pin control" depends on OF
@@ -300,11 +293,11 @@ config PINCTRL_MT8365 select PINCTRL_MTK config PINCTRL_MT8516 - bool "MediaTek MT8516 pin control" + bool "MediaTek MT8516/MT8167 pin control" depends on OF depends on ARM64 || COMPILE_TEST default ARM64 && ARCH_MEDIATEK - select PINCTRL_MTK + select PINCTRL_MTK_PARIS # For PMIC config PINCTRL_MT6397
drivers/pinctrl/mediatek/Makefile +0 -1
@@ -30,7 +30,6 @@ obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o -obj-$(CONFIG_PINCTRL_MT8167) += pinctrl-mt8167.o obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o obj-$(CONFIG_PINCTRL_MT8186) += pinctrl-mt8186.o
drivers/pinctrl/mediatek/pinctrl-mt8167.c deleted +0 -345
345 lines not on this page · raw message
drivers/pinctrl/mediatek/pinctrl-mt8516.c +471 -299
816 lines not on this page · raw message
drivers/pinctrl/mediatek/pinctrl-mtk-mt8167.h +279 -283
1,334 lines not on this page · raw message
drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h +254 -258
472 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
[email protected]
AI reviewRe: [RFC PATCH 2/3] pinctrl: mediatek: mt8516/mt8167: Migrate driver to pinctrl-paris platform
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [Critical] Pinmux mode field spacing is incorrectly changed from 4 bits to 3 bits per pin, corrupting all…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [Critical] Pinmux mode field spacing is incorrectly changed from 4 bits to 3 bits per pin, corrupting all pinmux configurations.
- [High] Incorrect register bit offsets and widths for Drive Strength (DRV) and Slew Rate (SR) corrupt hardware configuration.
- [High] SMT register bit mappings are swapped between pins 106 and 109.
- [High] SMT bit mappings for MT8516 pins 70-73 (MSDC2 DAT) are incorrectly assigned the MT8167 layout, breaking MT8516 SD/eMMC.
- [High] Driver drops support for mediatek,pctl-regmap without providing a fallback, breaking ABI backward compatibility with existing device trees. --
commit b99ee859c088809165f9a4794ca1471b372efd64
Author: Luca Leonardo Scorcia <[email protected]>
pinctrl: mediatek: mt8516/mt8167: Migrate driver to pinctrl-paris platform
Migrate the mt8516/mt8167 pinctrl driver to the paris platform driver. This change lets us correctly describe the two base addresses (GPIO/EINT) used by the SoCs in their device tree. It also adds support for driving strength capability and R1R0 pullup-pulldown on pins.
Quoted 3 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +0
-0
[ ... ]
drivers/pinctrl/mediatek/pinctrl-mt8516.c line 37
Quoted 3 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +3
-0+static const struct mtk_pin_field_calc mt8516_pin_mode_range[] = { +PIN_FIELD15 (0 ,124 ,0x300 ,0x10 ,0 ,3 ), +};
[Severity: Critical]
Does this configuration cause a regression in pin multiplexing across the SoC?
The legacy driver used a 4-bit shift per pin to pack 5 pins per 32-bit register. By passing 3 as the width here, the framework calculates mode offsets using 3 bits per pin. This causes pinmux writes to align with the wrong bits and can overwrite the configurations of adjacent pins.
[ ... ]
Quoted 1 line
+static const struct
mtk_pin_field_calcmt8516_pin_smt_range[] = {
[ ... ]
drivers/pinctrl/mediatek/pinctrl-mt8516.c line 123
Quoted 4 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +4
-0+PIN_FIELD16 (70 ,70 ,0xa30 ,0x10 ,3 ,1 ), +PIN_FIELD16 (71 ,71 ,0xa30 ,0x10 ,4 ,1 ), +PIN_FIELD16 (72 ,72 ,0xa30 ,0x10 ,5 ,1 ), + PIN_FIELD16(73, 73, 0xa30, 0x10, 6, 1),
[Severity: High]
Does this break the SMT configuration for the MT8516 MSDC2 interface?
The unified array assigns the MT8167 layout to pins 70-73 (bits 3, 4, 5, 6). The MT8516 requires bits 6, 5, 4, 3, as defined in its IES layout and the legacy driver.
[ ... ]
drivers/pinctrl/mediatek/pinctrl-mt8516.c line 130
Quoted 4 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +4
-0+PIN_FIELD16 (106 ,106 ,0xa20 ,0x10 ,13 ,1 ), +PIN_FIELD16 (107 ,107 ,0xa20 ,0x10 ,14 ,1 ), +PIN_FIELD16 (108 ,108 ,0xa20 ,0x10 ,15 ,1 ), + PIN_FIELD16(109, 109, 0xa30, 0x10, 0, 1),
[Severity: High]
Are the SMT bits for pins 106 and 109 swapped?
In the IES range, pin 106 maps to 0x930 bit 0 and pin 109 maps to 0x920 bit 13. SMT layouts typically mirror IES layouts offset by 0x100. The mappings here write to the wrong hardware bits for these pins.
[ ... ]
Quoted 2 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +2
-0+static const struct mtk_pin_field_calc mt8516_pin_drv_range[] = { +PINS_FIELD16 (0 ,4 ,0xd00 ,0x10 ,0 ,2 ),
[ ... ]
drivers/pinctrl/mediatek/pinctrl-mt8516.c line 321
Quoted 2 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +2
-0+static const struct mtk_pin_field_calc mt8516_pin_sr_range[] = { +PINS_FIELD16 (0 ,4 ,0xd00 ,0x10 ,3 ,1 ),
[Severity: High]
Can this corrupt the Slew Rate hardware configuration?
Setting the Slew Rate offset to 3, and using a 2-bit width starting at bit 0 for the Drive Strength of these pins, differs from the hardware requirements. Additionally, a 2-bit mask restricts DRV_GRP4 pins (such as MSDC) from supporting drive strengths greater than 8mA, causing the framework to reject higher values.
[ ... ]
drivers/pinctrl/mediatek/pinctrl-mt8516.c line 508
Quoted 10 lines
drivers/pinctrl/mediatek/pinctrl-mt8516.c +4
-2+static struct platform_driver mt8516_pinctrl_driver = { .driver = { .name ="mediatek-mt8516-pinctrl" , - .of_match_table = mt8516_pctrl_match, - .pm = pm_sleep_ptr(&mtk_eint_pm_ops), + .of_match_table = mt8516_pinctrl_of_match, + .pm =pm_sleep_ptr (&mtk_paris_pinctrl_pm_ops), }, + .probe = mtk_paris_pinctrl_probe, };
[Severity: High]
Will this migration cause probing to fail on older device trees?
The paris framework probe relies on devm_platform_ioremap_resource_byname which strictly requires a reg-names property. The legacy driver supported a mediatek,pctl-regmap fallback. Dropping this fallback might introduce a regression with existing device trees lacking the reg-names property.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
RFC PATCH 3/3 arm64: dts: mt8516/mt8167: Update pinctrl nodes for the new paris driver
In reply to Luca Leonardo ScorciaUpdate the MediaTek mt8516-mt8167 SoCs descriptions to respect the constraints of the Paris pinctrl driver.
In those SoCs the pinctrl has base address 0x10005000 for gpio settings while 0x1000b000 is used for eint configuration.
This change also drops the no longer required syscfg_pctl syscon node that was used before to access the gpio regmap, fixing the following dtbs_check errors:
mt8167-pumpkin.dtb: syscfg-pctl@10005000 (syscon): compatible: ['syscon']
is too short
mt8516-pumpkin.dtb: syscfg-pctl@10005000 (syscon): compatible: ['syscon']
is too short
--- arch/arm64/boot/dts/mediatek/mt8167.dtsi | 15 ++++----------- arch/arm64/boot/dts/mediatek/mt8516.dtsi | 12 ++++-------- 2 files changed, 8 insertions(+), 19 deletions(-)
arch/arm64/boot/dts/mediatek/mt8167.dtsi +4 -11
@@ -95,17 +95,6 @@ power-domain@MT8167_POWER_DOMAIN_CONN { }; }; - pio: pinctrl@1000b000 { - compatible = "mediatek,mt8167-pinctrl"; - reg = <0 0x1000b000 0 0x1000>; - mediatek,pctl-regmap = <&syscfg_pctl>; - gpio-controller; - #gpio-cells = <2>; - interrupt-controller; - #interrupt-cells = <2>; - interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>; - }; - apmixedsys: apmixedsys@10018000 { compatible = "mediatek,mt8167-apmixedsys", "syscon"; reg = <0 0x10018000 0 0x710>;
@@ -178,3 +167,7 @@ larb2: larb@16010000 { }; }; }; + +&pio { + compatible = "mediatek,mt8167-pinctrl"; +};
arch/arm64/boot/dts/mediatek/mt8516.dtsi +4 -8
@@ -231,17 +231,13 @@ keypad: keypad@10002000 { status = "disabled"; }; - syscfg_pctl: syscfg-pctl@10005000 { - compatible = "syscon"; - reg = <0 0x10005000 0 0x1000>; - }; - - pio: pinctrl@1000b000 { + pio: pinctrl@10005000 { compatible = "mediatek,mt8516-pinctrl"; - reg = <0 0x1000b000 0 0x1000>; - mediatek,pctl-regmap = <&syscfg_pctl>; + reg = <0 0x10005000 0 0x1000>, <0 0x1000b000 0 0x1000>; + reg-names = "base", "eint"; gpio-controller; #gpio-cells = <2>; + gpio-ranges = <&pio 0 0 124>; interrupt-controller; #interrupt-cells = <2>; interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [RFC PATCH 3/3] arm64: dts: mt8516/mt8167: Update pinctrl nodes for the new paris driver
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `gpio-ranges` property incorrectly specifies a count of 124, which excludes the final pin…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The gpio-ranges property incorrectly specifies a count of 124, which excludes the final pin (GPIO 124) from being mapped to the GPIO subsystem, as the drivers define exactly 125 pins. --
commit 36a8d0bd5d2cccdc70b499936029deb0499393de
Author: Luca Leonardo Scorcia <[email protected]>
arm64: dts: mt8516/mt8167: Update pinctrl nodes for the new paris driver
This patch updates the MediaTek mt8516 and mt8167 SoC descriptions to respect the constraints of the Paris pinctrl driver. It sets separate base and eint registers and removes the deprecated syscfg_pctl syscon node.
Quoted 4 lines
arch/arm64/boot/dts/mediatek/mt8516.dtsi +0
-0
[ ... ]
Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8516.dtsi +0
-5@@ -231,17 +231,13 @@ keypad: keypad@10002000 { status = "disabled"; }; - syscfg_pctl: syscfg-pctl@10005000 { - compatible = "syscon"; - reg = <0 0x10005000 0 0x1000>; - }; -
arch/arm64/boot/dts/mediatek/mt8516.dtsi keypad: keypad@10002000 { · line 240
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8516.dtsi +4
-3- pio: pinctrl@1000b000 { + pio: pinctrl@10005000 { compatible = "mediatek,mt8516-pinctrl"; - reg = <0 0x1000b000 0 0x1000>; - mediatek,pctl-regmap = <&syscfg_pctl>; + reg = <0 0x10005000 0 0x1000>, <0 0x1000b000 0 0x1000>; + reg-names = "base", "eint"; gpio-controller; #gpio-cells = <2>; + gpio-ranges = <&pio 0 0 124>;
[Severity: Medium]
Does this count parameter accidentally exclude the final pin (GPIO 124) from being mapped to the GPIO subsystem?
Looking at the driver definitions for the MT8516 and MT8167 platforms, there are exactly 125 pins defined. A count of 124 will prevent the mapping of the final pin, causing any driver or application attempting to request GPIO 124 to fail. Since mt8167.dtsi includes mt8516.dtsi, this affects both SoCs.
Should this count parameter be 125 instead?
Quoted 3 lines
arch/arm64/boot/dts/mediatek/mt8516.dtsi +0
-0interrupt-controller; #interrupt-cells = <2>; interrupts = <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3