Microchip mpfs/pic64gx pinctrl part 2
Subsystems (6)
Conor Dooley
maintainercover Microchip mpfs/pic64gx pinctrl part 2
From: Conor Dooley <[email protected]>
Hey Linus,
Got the other driver that I was talking about here for you... It's in RFC state because I'd like to get some feedback on the approach while I try to figure out a) what ibufmd is and b) how the bank voltage interacts with the schmitt trigger setting. Although, I am pretty sure for the latter that it is not forced on for low voltages and that the commented code should be deleted.
There's some specific @Linus questions in the driver, mostly where I was unsure about how config bits should be handled and looking around at other drivers wasn't sufficient because they did different things.
Finally, on the dt side, this was using the pinmux property before the other drivers were submitted, but I didn't really like it to begin with (shoving two things into entries of the same property gives me the ick). I moved to using pins + function which at least looks prettier in the devicetree. I had been hoping that I could move to some sort of generic dt_node_to_map function, but I couldn't figure out one that'd work without creating groups in the driver. If there is, I'd love to get rid of the custom dt_node_to_map stuff.
I want to avoid doing having set groups, because of the number of possible configurations in the MSS Configurator FPGA tool is fairly large, and I believe that MSS Configurator actually undersells the number of possible combinations for ease of use. I haven't tested that and the driver technically doesn't support it, but I feel like not trying to define groups statically and using pins instead would permit those combos in the future should that use case ever materialise.
Cheers,
Conor.
Conor Dooley (4):
dt-bindings: pinctrl: document polarfire soc mssio pin controller
pinctrl: add polarfire soc mssio pinctrl driver
MAINTAINERS: add Microchip mpfs mssio driver/bindings to entry
riscv: dts: microchip: add pinctrl nodes for mpfs/icicle kit
.../pinctrl/microchip,mpfs-pinctrl-mssio.yaml | 108 +++ .../microchip,mpfs-mss-top-sysreg.yaml | 4 + MAINTAINERS | 2 + .../dts/microchip/mpfs-icicle-kit-common.dtsi | 1 - .../dts/microchip/mpfs-icicle-kit-fabric.dtsi | 63 ++ .../boot/dts/microchip/mpfs-pinctrl.dtsi | 165 ++++ arch/riscv/boot/dts/microchip/mpfs.dtsi | 16 + drivers/pinctrl/Kconfig | 5 +- drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-mpfs-mssio.c | 798 ++++++++++++++++++ 10 files changed, 1161 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml create mode 100644 arch/riscv/boot/dts/microchip/mpfs-pinctrl.dtsi create mode 100644 drivers/pinctrl/pinctrl-mpfs-mssio.c
Signature · 1 line
2.51.0
Conor Dooley
maintainerRFC 1/4 dt-bindings: pinctrl: document polarfire soc mssio pin controller
From: Conor Dooley <[email protected]>
On Polarfire SoC, the Bank 2 and Bank 4 IOs connected to the Multiprocessor Subsystem (MSS) are controlled by IOMUX_CRs 1 through 6, which determine what function in routed to them, and MSSIO_BANK#_IO_CFG_CRs, which determine the configuration of each pin.
Document it, including several custom configuration options that stem from MSS Configurator options (the MSS Configurator is part of the FPGA tooling for this device). "ibufmd" unfortunately is not a 1:1 mapping with an MSS Configurator option, unlike clamp-diode or lockdown, and I do not know the effect of any bits in the field. I have no been able to find an explanation for these bits in documentation.
--- .../pinctrl/microchip,mpfs-pinctrl-mssio.yaml | 108 ++++++++++++++++++ .../microchip,mpfs-mss-top-sysreg.yaml | 4 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml
Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml new file +108 -0
@@ -0,0 +1,108 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/microchip,mpfs-pinctrl-mssio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip Polarfire SoC MSSIO pinctrl + +maintainers: + - Conor Dooley <[email protected]> + +properties: + compatible: + const: microchip,mpfs-pinctrl-mssio + + reg: + maxItems: 1 + + pinctrl-use-default: true + +patternProperties: + '-cfg$': + type: object + additionalProperties: false + + patternProperties: + '-pins$': + type: object + additionalProperties: false + + allOf: + - $ref: pincfg-node.yaml# + - $ref: pinmux-node.yaml# + + properties: + pins: + description: | + The list of IOs that properties in the pincfg node apply to. + + function: + description: + A string containing the name of the function to mux for these + pins. The "reserved" function tristates a pin. + enum: [ sd, emmc, qspi, spi, usb, uart, i2c, can, mdio, misc + reserved, gpio, fabric-test, tied-low, tied-high, tristate ] + + bias-bus-hold: true + bias-disable: true + bias-pull-down: true + bias-pull-up: true + input-schmitt-enable: true + low-power-enable: true + + drive-strength: + enum: [ 2, 4, 6, 8, 10, 12, 16, 20 ] + + microchip,clamp-diode: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Reflects the "Clamp Diode" setting in the MSS Configurator for + this pin. + + microchip,bank-lockdown: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Reflects the "Lock Down Bank{2,4} I/Os" setting in the MSS + Configurator for this pin. + + microchip,ibufmd: + $ref: /schemas/types.yaml#/definitions/uint32 + default: 0 + description: | + Reflects the "IBUFMD" bits in the MSS Configurator output files + for this pin. + + required: + - pins + - function + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pinctrl@204 { + compatible = "microchip,mpfs-pinctrl-mssio"; + reg = <0x204 0x7c>; + + irkd_sd_cfg: irkd-sd-cfg { + sd-10ma-pins { + pins = <0>, <1>, <2>, <3>, <4>, <5>, <8>, <9>, <10>, <11>, <12>, <13>; + function = "sd"; + bias-pull-up; + drive-strength = <10>; + }; + + sd-8ma-pins { + pins = <6>, <7>; + function = "sd"; + bias-pull-up; + drive-strength = <8>; + }; + }; + }; +...
Documentation/devicetree/bindings/soc/microchip/microchip,mpfs-mss-top-sysreg.yaml +4 -0
@@ -42,6 +42,10 @@ properties: type: object $ref: /schemas/pinctrl/microchip,mpfs-pinctrl-iomux0.yaml + pinctrl@204: + type: object + $ref: /schemas/pinctrl/microchip,mpfs-pinctrl-mssio.yaml + required: - compatible - reg
Signature · 1 line
2.51.0
Re: [RFC v1 1/4] dt-bindings: pinctrl: document polarfire soc mssio pin controller
Hi Conor,
Quoted 12 lines · Conor Dooley
Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml new file +12
-0+examples: + - | + pinctrl@204 { + compatible = "microchip,mpfs-pinctrl-mssio"; + reg = <0x204 0x7c>; + + irkd_sd_cfg: irkd-sd-cfg { + sd-10ma-pins { + pins = <0>, <1>, <2>, <3>, <4>, <5>, <8>, <9>, <10>, <11>, <12>, <13>; + function = "sd"; + bias-pull-up; + drive-strength = <10>;
Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml line 107
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml new file +10
-0+ }; + + sd-8ma-pins { + pins = <6>, <7>; + function = "sd"; + bias-pull-up; + drive-strength = <8>; + }; + }; + };
This looks good to me and you sure know how to do syntax so I don't even need to check that part.
These bindings are fine.
Yours,
Linus Walleij
Conor Dooley
maintainerRFC 2/4 pinctrl: add polarfire soc mssio pinctrl driver
In reply to Conor DooleyFrom: Conor Dooley <[email protected]>
On Polarfire SoC, the Bank 2 and Bank 4 IOs connected to the Multiprocessor Subsystem (MSS) are controlled by IOMUX_CRs 1 through 6, which determine what function in routed to them, and MSSIO_BANK#_IO_CFG_CRs, which determine the configuration of each pin.
Add a driver for this pin controller, including several custom properties that reflect aspects of the MSS's configuration.
Reuse the Kconfig option for iomux0, since controlling MSSIOs without iomux0 routing a function to the MSSIOs in question is pointless, and routing a function to the MSSIOs is equally unhelpful if none of them are configured to make use of that function.
--- drivers/pinctrl/Kconfig | 5 +- drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-mpfs-mssio.c | 798 +++++++++++++++++++++++++++ 3 files changed, 803 insertions(+), 1 deletion(-) create mode 100644 drivers/pinctrl/pinctrl-mpfs-mssio.c
drivers/pinctrl/Kconfig +4 -1
@@ -506,9 +506,12 @@ config PINCTRL_PISTACHIO This support pinctrl and GPIO driver for IMG Pistachio SoC. config PINCTRL_POLARFIRE_SOC - bool "Polarfire SoC pinctrl driver" + bool "Polarfire SoC pinctrl drivers" depends on ARCH_MICROCHIP || COMPILE_TEST + select PINMUX select GENERIC_PINCONF + select GENERIC_PINCTRL_GROUPS + select GENERIC_PINMUX_FUNCTIONS default y help This selects the pinctrl driver for Microchip Polarfire SoC.
drivers/pinctrl/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_PINCTRL_PEF2256) += pinctrl-pef2256.o obj-$(CONFIG_PINCTRL_PIC32) += pinctrl-pic32.o obj-$(CONFIG_PINCTRL_PIC64GX) += pinctrl-pic64gx-gpio2.o obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o +obj-$(CONFIG_PINCTRL_POLARFIRE_SOC) += pinctrl-mpfs-mssio.o obj-$(CONFIG_PINCTRL_POLARFIRE_SOC) += pinctrl-mpfs-iomux0.o obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +798 -0
798 lines not on this page · raw message
Signature · 1 line
2.51.0
Re: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Hi Conor,
took a quick look at this!
Quoted 1 line · Conor Dooley
+#include "
linux/dev_printk.h"
Weird but it's RFC so OK :)
drivers/pinctrl/pinctrl-mpfs-mssio.c line 50
Quoted 3 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +3
-0+#define MPFS_PINCTRL_LOCKDOWN (PIN_CONFIG_END + 1) +#define MPFS_PINCTRL_CLAMP_DIODE (PIN_CONFIG_END + 2) +#define MPFS_PINCTRL_IBUFMD (PIN_CONFIG_END + 3)
Yeah this should work for custom props.
Quoted 5 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +5
-0+struct mpfs_pinctrl_drive_strength { +u8 ma; +u8 val; +}; +
drivers/pinctrl/pinctrl-mpfs-mssio.c line 81
Quoted 10 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +10
-0+static struct mpfs_pinctrl_drive_strength mpfs_pinctrl_drive_strengths[8 ] = { + {2 ,2 }, + {4 ,3 }, + {6 ,4 }, + {8 ,5 }, + {10 ,6 }, + {12 ,7 }, + {16 ,10 }, + {20 ,12 }, +};
I would probably assign field explicitly with C99 syntax, but no hard requirement.
{ .ma = 2, .val = 2 }
BTW you can see clearly that each setting activates another driver stage in the silicon, each totempole giving 2 mA.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 117
Quoted 5 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +5
-0+static const struct pinconf_generic_params mpfs_pinctrl_custom_bindings[] = { + {"microchip,bank-lockdown" ,MPFS_PINCTRL_LOCKDOWN ,1 }, + {"microchip,clamp-diode" ,MPFS_PINCTRL_CLAMP_DIODE ,1 }, + {"microchip,ibufmd" ,MPFS_PINCTRL_IBUFMD ,0x0 }, +};
I take it these have proper documentation in the DT bindings, so users know exactly what they do.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 181
Quoted 9 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +9
-0+static int mpfs_pinctrl_pin_to_iocfg_reg (unsigned int pin) +{ +u32 reg =MPFS_PINCTRL_IOCFG01_REG ; + +if (pin >=MPFS_PINCTRL_BANK2_START ) + reg +=MPFS_PINCTRL_INTER_BANK_GAP ; + +// 2 pins per 32-bit register + reg += (pin /2 ) *0x4 ;
This is a nice comment, easy to follow the code with small helpful things like this.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 225
Quoted 2 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +2
-0+static int mpfs_pinctrl_dt_node_to_map (struct pinctrl_dev *pctrl_dev,struct device_node *np, +struct pinctrl_map **maps,unsigned int *num_maps)
I saw in the cover letter that you wanted this to use more generic helpers.
If you see room for improvement of the generic code, do not hesitate. Doing a new driver is the only time when you actually have all these details in your head and can create good helpers.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 473
Quoted 4 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +4
-0+//TODO @Linus, it correct to group these 3? There's no control over voltage. +case PIN_CONFIG_INPUT_SCHMITT : +case PIN_CONFIG_INPUT_SCHMITT_ENABLE : +case PIN_CONFIG_INPUT_SCHMITT_UV :
Consider not supporting some like PIN_CONFIG_INPUT_SCHMITT_UV in the bindings if they don't make any sense, and let it just return error if someone tries to do that.
Isn't PIN_CONFIG_INPUT_SCHMITT_ENABLE the only one that makes sense for this hardware?
Quoted 3 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +3
-0+static int mpfs_pinctrl_pinconf_generate_config (struct mpfs_pinctrl *pctrl,unsigned int pin, +unsigned long *configs,unsigned int num_configs, +u32 *value)
(...)
drivers/pinctrl/pinctrl-mpfs-mssio.c line 548
Quoted 7 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +7
-0+case PIN_CONFIG_BIAS_PULL_DOWN : +//TODO always start from val == 0, there's no reason to ever actually +// clear anything AFAICT. @Linus, does the driver need to check mutual +// exclusion on these, or can I drop the clearing? + val &= ~MPFS_PINCTRL_PULL_MASK ; + val |=MPFS_PINCTRL_WPD ; +break ;
I was about to say that the core checks that you don't enable pull up and pull down
at the same time, but apparently that was just a dream I had.
The gpiolib however contains this in gpiod_configure_flags():
if (((lflags & GPIO_PULL_UP) && (lflags & GPIO_PULL_DOWN)) ||
((lflags & GPIO_PULL_UP) && (lflags & GPIO_PULL_DISABLE)) ||
((lflags & GPIO_PULL_DOWN) && (lflags & GPIO_PULL_DISABLE))) {
gpiod_err(desc,
"multiple pull-up, pull-down or pull-disable
enabled, invalid configuration\n");
return -EINVAL;
}So there is a precedent for checking this.
So if you patch pinconf-generic.c to disallow this that'd be great, I think it makes most sense to do this in the core.
Quoted 7 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +7
-0+case PIN_CONFIG_INPUT_SCHMITT_ENABLE : +if (!arg) +break ; + fallthrough; +case PIN_CONFIG_INPUT_SCHMITT : +case PIN_CONFIG_INPUT_SCHMITT_UV : +//TODO Is it enabled regardless of register setting, or must it
drivers/pinctrl/pinctrl-mpfs-mssio.c line 579
Quoted 10 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +10
-0+// be set for lower voltage IO? Docs are missing, MSS Configurator +// is not clear. Leaning towards the latter. +//bank_voltage = mpfs_pinctrl_pin_to_bank_voltage(pctrl, pin); +//if (bank_voltage < MPFS_PINCTRL_LVCMOS25 && !arg) { +// dev_err(pctrl->dev, +// "schmitt always enabled for 1.2, 1.5 and 1.8 volt io\n"); +// return -EINVAL; +//} + val |=MPFS_PINCTRL_ENHYST ; +break ;
See above.
I hope this helps!
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 41 lines · Linus Walleij
Hi Conor,
took a quick look at this!
Quoted 1 line · Conor Dooley
+#include "
linux/dev_printk.h"Weird but it's RFC so OK :)
drivers/pinctrl/pinctrl-mpfs-mssio.c line 50
Quoted 3 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +3
-0+#define MPFS_PINCTRL_LOCKDOWN (PIN_CONFIG_END + 1) +#define MPFS_PINCTRL_CLAMP_DIODE (PIN_CONFIG_END + 2) +#define MPFS_PINCTRL_IBUFMD (PIN_CONFIG_END + 3)Yeah this should work for custom props.
Quoted 5 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +5
-0+struct mpfs_pinctrl_drive_strength { +u8 ma; +u8 val; +}; +drivers/pinctrl/pinctrl-mpfs-mssio.c line 81
Quoted 10 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +10
-0+static struct mpfs_pinctrl_drive_strength mpfs_pinctrl_drive_strengths[8 ] = { + {2 ,2 }, + {4 ,3 }, + {6 ,4 }, + {8 ,5 }, + {10 ,6 }, + {12 ,7 }, + {16 ,10 }, + {20 ,12 }, +};I would probably assign field explicitly with C99 syntax, but no hard requirement.
{ .ma = 2, .val = 2 }
BTW you can see clearly that each setting activates another driver stage in the silicon, each totempole giving 2 mA.
Quoted 8 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c line 117
Quoted 5 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +5
-0+static const struct pinconf_generic_params mpfs_pinctrl_custom_bindings[] = { + {"microchip,bank-lockdown" ,MPFS_PINCTRL_LOCKDOWN ,1 }, + {"microchip,clamp-diode" ,MPFS_PINCTRL_CLAMP_DIODE ,1 }, + {"microchip,ibufmd" ,MPFS_PINCTRL_IBUFMD ,0x0 }, +};I take it these have proper documentation in the DT bindings, so users know exactly what they do.
Honestly, even if users don't know what they do, they should just be making this stuff 1:1 match some MSS configurator output, where it's very clear if you select lockdown or turn on the clamp diode. The clamp diode is almost certainly input voltage clamping (although the documentation on the mssio stuff doesn't say anything about it) and the lockdwn thing is some security feature that doesn't actually do anything on its own, but will disable the bank in question if the tamper detection hardware gets upset.
I'm not really all that sure why this is a per-pin setting, because the documentation about this (and the MSS configurator) treat it as being bank wide. There's some other part of this in another register that is actually bank wide that I only discovered yesterday, and I dunno how they interact.
The binding doesn't really explain this stuff, other than saying what field in the configurator to get it from. I'll add something for !RFC.
ibufmd is a different story, the only source of it I could find was in the configurator output files. I suspect that it can be just computed from the other dt properties and the bank voltage, but I need to find the answer in the configurator source code I think.
Quoted 27 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c line 181
Quoted 9 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +9
-0+static int mpfs_pinctrl_pin_to_iocfg_reg (unsigned int pin) +{ +u32 reg =MPFS_PINCTRL_IOCFG01_REG ; + +if (pin >=MPFS_PINCTRL_BANK2_START ) + reg +=MPFS_PINCTRL_INTER_BANK_GAP ; + +// 2 pins per 32-bit register + reg += (pin /2 ) *0x4 ;This is a nice comment, easy to follow the code with small helpful things like this.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 225
Quoted 2 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +2
-0+static int mpfs_pinctrl_dt_node_to_map (struct pinctrl_dev *pctrl_dev,struct device_node *np, +struct pinctrl_map **maps,unsigned int *num_maps)I saw in the cover letter that you wanted this to use more generic helpers.
If you see room for improvement of the generic code, do not hesitate. Doing a new driver is the only time when you actually have all these details in your head and can create good helpers.
drivers/pinctrl/pinctrl-mpfs-mssio.c line 473
Quoted 4 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +4
-0+//TODO @Linus, it correct to group these 3? There's no control over voltage. +case PIN_CONFIG_INPUT_SCHMITT : +case PIN_CONFIG_INPUT_SCHMITT_ENABLE : +case PIN_CONFIG_INPUT_SCHMITT_UV :
Quoted 6 lines
Consider not supporting some like
PIN_CONFIG_INPUT_SCHMITT_UVin the bindings if they don't make any sense, and let it just return error if someone tries to do that.Isn't
PIN_CONFIG_INPUT_SCHMITT_ENABLEthe only one that makes sense for this hardware?
Yeah, I just didn't know if having the others was helpful, since they say things like:
* @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
* schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
* the threshold value is given on a custom format as argument when
* setting pins to this mode.
which implies they should be implemented for systen not permitting hysteresis adjustment.
Quoted 27 lines
Quoted 3 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +3
-0+static int mpfs_pinctrl_pinconf_generate_config (struct mpfs_pinctrl *pctrl,unsigned int pin, +unsigned long *configs,unsigned int num_configs, +u32 *value)(...)
drivers/pinctrl/pinctrl-mpfs-mssio.c line 548
Quoted 7 lines
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +7
-0+case PIN_CONFIG_BIAS_PULL_DOWN : +//TODO always start from val == 0, there's no reason to ever actually +// clear anything AFAICT. @Linus, does the driver need to check mutual +// exclusion on these, or can I drop the clearing? + val &= ~MPFS_PINCTRL_PULL_MASK ; + val |=MPFS_PINCTRL_WPD ; +break ;I was about to say that the core checks that you don't enable pull up and pull down
at the same time, but apparently that was just a dream I had.The gpiolib however contains this in
gpiod_configure_flags():if (((lflags & GPIO_PULL_UP) && (lflags & GPIO_PULL_DOWN)) || ((lflags & GPIO_PULL_UP) && (lflags & GPIO_PULL_DISABLE)) || ((lflags & GPIO_PULL_DOWN) && (lflags & GPIO_PULL_DISABLE))) { gpiod_err(desc, "multiple pull-up, pull-down or pull-disable enabled, invalid configuration\n"); return -EINVAL; }
Quoted 4 lines
So there is a precedent for checking this.
So if you patch
pinconf-generic.cto disallow this that'd be great, I think it makes most sense to do this in the core.
Yeah, seems better than doing it in my driver..
Re: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 15 lines · Conor Dooley
Quoted 7 lines · Linus Walleij
drivers/pinctrl/pinctrl-mpfs-mssio.c line 473
Quoted 4 lines · Conor Dooley
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +4
-0+//TODO @Linus, it correct to group these 3? There's no control over voltage. +case PIN_CONFIG_INPUT_SCHMITT : +case PIN_CONFIG_INPUT_SCHMITT_ENABLE : +case PIN_CONFIG_INPUT_SCHMITT_UV :Quoted 6 lines
Consider not supporting some like
PIN_CONFIG_INPUT_SCHMITT_UVin the bindings if they don't make any sense, and let it just return error if someone tries to do that.Isn't
PIN_CONFIG_INPUT_SCHMITT_ENABLEthe only one that makes sense for this hardware?
Quoted 8 lines
Yeah, I just didn't know if having the others was helpful, since they say things like:
* @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in* schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, * the threshold value is given on a custom format as argument when * setting pins to this mode.which implies they should be implemented for systen not permitting hysteresis adjustment.
I see.
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger mode
input-schmitt-disable:
type: boolean
description: disable schmitt-trigger mode
input-schmitt-microvolt:
description: threshold strength for schmitt-trigger
1. input-schmitt is missing! But it is right there in drivers/pinctrl/pinconf-generic.c ... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.
2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in pinconf-generic.h to make it clear that they are all mutually exclusive.
The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/
The real trick would be to also make the
schema in Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml make them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 60 lines · Linus Walleij
Quoted 15 lines · Conor Dooley
Quoted 7 lines · Linus Walleij
drivers/pinctrl/pinctrl-mpfs-mssio.c line 473
Quoted 4 lines · Conor Dooley
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +4
-0+//TODO @Linus, it correct to group these 3? There's no control over voltage. +case PIN_CONFIG_INPUT_SCHMITT : +case PIN_CONFIG_INPUT_SCHMITT_ENABLE : +case PIN_CONFIG_INPUT_SCHMITT_UV :Quoted 6 lines
Consider not supporting some like
PIN_CONFIG_INPUT_SCHMITT_UVin the bindings if they don't make any sense, and let it just return error if someone tries to do that.Isn't
PIN_CONFIG_INPUT_SCHMITT_ENABLEthe only one that makes sense for this hardware?Quoted 8 lines
Yeah, I just didn't know if having the others was helpful, since they say things like:
* @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in* schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis, * the threshold value is given on a custom format as argument when * setting pins to this mode.which implies they should be implemented for systen not permitting hysteresis adjustment.
I see.
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger modeinput-schmitt-disable:
type: boolean
description: disable schmitt-trigger modeinput-schmitt-microvolt:
description: threshold strength for schmitt-trigger1. input-schmitt is missing! But it is right there in
drivers/pinctrl/pinconf-generic.c... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in
pinconf-generic.hto make it clear that they are all mutually exclusive.The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/
Quoted 4 lines
The real trick would be to also make the
schema inDocumentation/devicetree/bindings/pinctrl/pincfg-node.yamlmake them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?
I think that this is probably what to do. Mutual exclusion isn't difficult to set up there and if there's no property for "input-schmitt" then deprecating it sounds pretty reasonable?
Re: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 36 lines · Conor Dooley
Quoted 34 lines · Linus Walleij
On Wed, Nov 19, 2025 at 7:23 PM Conor Dooley <[email protected]> wrote:
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger modeinput-schmitt-disable:
type: boolean
description: disable schmitt-trigger modeinput-schmitt-microvolt:
description: threshold strength for schmitt-trigger1. input-schmitt is missing! But it is right there in
drivers/pinctrl/pinconf-generic.c... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in
pinconf-generic.hto make it clear that they are all mutually exclusive.The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/
Quoted 8 lines
Quoted 4 lines
The real trick would be to also make the
schema inDocumentation/devicetree/bindings/pinctrl/pincfg-node.yamlmake them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?I think that this is probably what to do. Mutual exclusion isn't difficult to set up there and if there's no property for "input-schmitt" then deprecating it sounds pretty reasonable?
Yeah I agree.
Do you want to look into it?
Otherwise it becomes my problem now that I've noticed it :D
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 46 lines · Linus Walleij
Quoted 36 lines · Conor Dooley
Quoted 34 lines · Linus Walleij
On Wed, Nov 19, 2025 at 7:23 PM Conor Dooley <[email protected]> wrote:
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger modeinput-schmitt-disable:
type: boolean
description: disable schmitt-trigger modeinput-schmitt-microvolt:
description: threshold strength for schmitt-trigger1. input-schmitt is missing! But it is right there in
drivers/pinctrl/pinconf-generic.c... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in
pinconf-generic.hto make it clear that they are all mutually exclusive.The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/Quoted 8 lines
Quoted 4 lines
The real trick would be to also make the
schema inDocumentation/devicetree/bindings/pinctrl/pincfg-node.yamlmake them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?I think that this is probably what to do. Mutual exclusion isn't difficult to set up there and if there's no property for "input-schmitt" then deprecating it sounds pretty reasonable?
Quoted 5 lines
Yeah I agree.
Do you want to look into it?
Otherwise it becomes my problem now that I've noticed it :D
Yeah, it's just a binding patch here I think, so yeah I'll do it.
Quoted 3 lines
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Linus Walleij
Quoted 44 lines · Conor Dooley
Quoted 35 lines · Linus Walleij
On Wed, Nov 19, 2025 at 7:23 PM Conor Dooley <[email protected]> wrote:
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger modeinput-schmitt-disable:
type: boolean
description: disable schmitt-trigger modeinput-schmitt-microvolt:
description: threshold strength for schmitt-trigger1. input-schmitt is missing! But it is right there in
drivers/pinctrl/pinconf-generic.c... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in
pinconf-generic.hto make it clear that they are all mutually exclusive.The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/Quoted 4 lines
The real trick would be to also make the
schema inDocumentation/devicetree/bindings/pinctrl/pincfg-node.yamlmake them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?I think that this is probably what to do. Mutual exclusion isn't difficult to set up there and if there's no property for "input-schmitt" then deprecating it sounds pretty reasonable?
Quoted 7 lines
Quoted 5 lines
Yeah I agree.
Do you want to look into it?
Otherwise it becomes my problem now that I've noticed it :D
Yeah, it's just a binding patch here I think, so yeah I'll do it.
ngl, I forget if there's a shorthand for the bias part, so I just want to know if is this an accurate summary of what's exclusive?
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +62 -0
@@ -153,4 +153,66 @@ properties: pin. Typically indicates how many double-inverters are used to delay the signal. +allOf: + - if: + required: + - output-disable + then: + properties: + output-enable: false + output-impedance-ohms: false + - if: + required: + - output-low + then: + properties: + output-high: false + - if: + required: + - low-power-enable + then: + properties: + low-power-disable: false + - if: + required: + - input-schmitt-disable + then: + properties: + input-schmitt-enable: false + input-schmitt-microvolt: false + - if: + required: + - drive-open-source + then: + properties: + drive-open-drain: false + - if: + anyOf: + - required: + - bias-disable + - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + then: + oneOf: + - required: + - bias-disable + - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + additionalProperties: true
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 120 lines · Conor Dooley
Quoted 47 lines · Conor Dooley
Quoted 46 lines · Linus Walleij
Quoted 44 lines · Conor Dooley
Quoted 35 lines · Linus Walleij
On Wed, Nov 19, 2025 at 7:23 PM Conor Dooley <[email protected]> wrote:
I looked at the bindings that look like this and are not 1:1 to the in-kernel configs:
input-schmitt-enable:
type: boolean
description: enable schmitt-trigger modeinput-schmitt-disable:
type: boolean
description: disable schmitt-trigger modeinput-schmitt-microvolt:
description: threshold strength for schmitt-trigger1. input-schmitt is missing! But it is right there in
drivers/pinctrl/pinconf-generic.c... All DTS files appear to be using input-schmitt-enable/disable and -microvolt.2. input-schmitt-microvolt should probably be used separately to set the voltage threshold and can be used in conjunction with input-schmitt-enable in the same node. In your case you probably don't want to use it at all and disallow it.
They are all treated individually in the parser.
Maybe we could patch the docs in
pinconf-generic.hto make it clear that they are all mutually exclusive.The DT parser is a bit primitive for these.
For example right now it is fine with the schema
to set input-schmitt-enable and input-schmitt-disable at the same time, and the result will be enabled because of parse order :/Quoted 4 lines
The real trick would be to also make the
schema inDocumentation/devicetree/bindings/pinctrl/pincfg-node.yamlmake them at least mutually exclusive and deprecate the input-schmitt that noone is using, maybe that is simpler than I think?I think that this is probably what to do. Mutual exclusion isn't difficult to set up there and if there's no property for "input-schmitt" then deprecating it sounds pretty reasonable?
Quoted 7 lines
Quoted 5 lines
Yeah I agree.
Do you want to look into it?
Otherwise it becomes my problem now that I've noticed it :D
Yeah, it's just a binding patch here I think, so yeah I'll do it.
ngl, I forget if there's a shorthand for the bias part, so I just want to know if is this an accurate summary of what's exclusive?
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +53
-0@@ -153,4 +153,66 @@ properties: pin. Typically indicates how many double-inverters are used to delay the signal. +allOf: + - if: + required: + - output-disable + then: + properties: + output-enable: false + output-impedance-ohms: false + - if: + required: + - output-low + then: + properties: + output-high: false + - if: + required: + - low-power-enable + then: + properties: + low-power-disable: false + - if: + required: + - input-schmitt-disable + then: + properties: + input-schmitt-enable: false + input-schmitt-microvolt: false + - if: + required: + - drive-open-source + then: + properties: + drive-open-drain: false + - if: + anyOf: + - required: + - bias-disable + - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + then: + oneOf: + - required: + - bias-disable + - required: + - bias-high-impedance
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 218
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +9
-0+ - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + additionalProperties: true
I was looking at the kernel part of this today, trying to figure out where it would make sense to actually check this, but I'm not super keen on what has to be done. I think doing it in parse_dt_cfg() makes the most sense, setting flags if the property is one we care about during the loop and then checking mutual exclusion at the end based on the flags? The gpio example you gave has it easy, since they already appear to have these things stored in flag properties.
Is there somewhere else, in addition to creating the config from dt that this would have to be checked?
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 9 lines · Conor Dooley
I was looking at the kernel part of this today, trying to figure out where it would make sense to actually check this, but I'm not super keen on what has to be done. I think doing it in
parse_dt_cfg()makes the most sense, setting flags if the property is one we care about during the loop and then checking mutual exclusion at the end based on the flags? The gpio example you gave has it easy, since they already appear to have these things stored in flag properties.
Is there somewhere else, in addition to creating the config from dt that this would have to be checked?
We are right now parsing with an array of
struct pinconf_generic_params:
static const struct pinconf_generic_params dt_params[] = {
{ "input-disable", PIN_CONFIG_INPUT_ENABLE, 0 }, (...)
};
(Sorry for not using C99 .initializers on the above array)
Struct looks like so:
struct pinconf_generic_params {
const char * const property;
enum pin_config_param param;
u32 default_value;
const char * const *values;
size_t num_values;
};Can't we add a
const enum pin_config_param *conflicts;
size_t num_conflicts;And rewrite the parsing table to be more explicit:
static const char * const input_disable_conflicts[] = {
"input-enable",
};static const struct pinconf_generic_params dt_params[] = {
{
.property = "input-disable",
.param = PIN_CONFIG_INPUT_ENABLE,
.default_value = 0,
.conflicting_properties = input_disable_conflicts, .num_conflicting_properties = ARRAY_SIZE(input_disable_conflicts),
},
(...)
};
Then in the loop we can use of_property_present(np, ...) to check for conflicting properties when we encounter something.
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 54 lines · Linus Walleij
Quoted 9 lines · Conor Dooley
I was looking at the kernel part of this today, trying to figure out where it would make sense to actually check this, but I'm not super keen on what has to be done. I think doing it in
parse_dt_cfg()makes the most sense, setting flags if the property is one we care about during the loop and then checking mutual exclusion at the end based on the flags? The gpio example you gave has it easy, since they already appear to have these things stored in flag properties.
Is there somewhere else, in addition to creating the config from dt that this would have to be checked?We are right now parsing with an array of
structpinconf_generic_params:static const struct
pinconf_generic_paramsdt_params[] = {
{ "input-disable",PIN_CONFIG_INPUT_ENABLE, 0 }, (...)
};(Sorry for not using C99 .initializers on the above array)
Struct looks like so:
struct pinconf_generic_params { const char * const property; enum pin_config_param param; u32 default_value; const char * const *values; size_t num_values; };Can't we add a
const enum pin_config_param *conflicts; size_t num_conflicts;And rewrite the parsing table to be more explicit:
static const char * const input_disable_conflicts[] = { "input-enable", };static const struct
pinconf_generic_paramsdt_params[] = {
{
.property = "input-disable",
.param =PIN_CONFIG_INPUT_ENABLE,
.default_value = 0,
.conflicting_properties =input_disable_conflicts, .num_conflicting_properties =ARRAY_SIZE(input_disable_conflicts),
},
(...)
};
Quoted 2 lines
Then in the loop we can use
of_property_present(np, ...)to check for conflicting properties when we encounter something.
ngl, I didn't consider something along these lines cos I was trying not to disrupt how things work at the moment and slot in some non-invasive. That's probably a bad mindset.
I'm not sure how keen I would be on this of_property_present() idea though, feels like wasteful to search the dt for conflicting properties when we are already going through all possible properties and can do the check at the end, when we've got all the information? Could probably keep a temporay bitmap, using pin_config_param as the index, and use test_bit() using the known-incompatibles to check it somewhat neatly?
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 6 lines · Conor Dooley
I'm not sure how keen I would be on this
of_property_present()idea though, feels like wasteful to search the dt for conflicting properties when we are already going through all possible properties and can do the check at the end, when we've got all the information? Could probably keep a temporay bitmap, usingpin_config_paramas the index, and usetest_bit()using the known-incompatibles to check it somewhat neatly?
I think it could work, as all conflicts (I think?) are boolean (this OR that).
It's probably a bit ambitious, but I'm game :D
Yours,
Linus Walleij
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
In reply to Conor DooleyQuoted 9 lines · Conor Dooley
ngl, I forget if there's a shorthand for the bias part, so I just want to know if is this an accurate summary of what's exclusive?
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +0
-0@@ -153,4 +153,66 @@ properties: pin. Typically indicates how many double-inverters are
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 163
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +8
-0used to delay the signal. +allOf: + - if: + required: + - output-disable + then: + properties: + output-enable: false + output-impedance-ohms: false
Looks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 169
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - output-low + then: + properties: + output-high: false
Looks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 175
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - low-power-enable + then: + properties: + low-power-disable: false
Looks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 182
Quoted 7 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +7
-0+ - if: + required: + - input-schmitt-disable + then: + properties: + input-schmitt-enable: false + input-schmitt-microvolt: false
Looks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 188
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - drive-open-source + then: + properties: + drive-open-drain: false
drive-push-pull is mutually exclusive
with each of these as well.
Quoted 18 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +18
-0+ - if: + anyOf: + - required: + - bias-disable + - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + then: + oneOf: + - required: + - bias-disable
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 216
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +10
-0+ - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default
These is a bunch of "pull" infixes missing from the above.
After looking at it for a while I concluded this is right as well, if just the right names are added. I would add a comment like
# We can only ever allow exactly one of these,
# they are all mutually exclusive.
Additionally:
drive-strength and drive-strength-microamp are mutually exclusive.
input-enable and input-disable are mutually exclusive.
low-power-enable and low-power-disable are mutually exclusive.
input-schmitt need to be added as deprecated.
Can you cook a patch? Maybe test it on the existing device trees first to see that it doesn't wreac havoc.
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 91 lines · Linus Walleij
Quoted 9 lines · Conor Dooley
ngl, I forget if there's a shorthand for the bias part, so I just want to know if is this an accurate summary of what's exclusive?
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +0
-0@@ -153,4 +153,66 @@ properties: pin. Typically indicates how many double-inverters areDocumentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 163
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +8
-0used to delay the signal. +allOf: + - if: + required: + - output-disable + then: + properties: + output-enable: false + output-impedance-ohms: falseLooks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 169
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - output-low + then: + properties: + output-high: falseLooks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 175
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - low-power-enable + then: + properties: + low-power-disable: falseLooks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 182
Quoted 7 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +7
-0+ - if: + required: + - input-schmitt-disable + then: + properties: + input-schmitt-enable: false + input-schmitt-microvolt: falseLooks right.
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 188
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +6
-0+ - if: + required: + - drive-open-source + then: + properties: + drive-open-drain: falsedrive-push-pull is mutually exclusive
with each of these as well.Quoted 18 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +18
-0+ - if: + anyOf: + - required: + - bias-disable + - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default + then: + oneOf: + - required: + - bias-disableDocumentation/devicetree/bindings/pinctrl/pincfg-node.yaml properties: · line 216
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml +10
-0+ - required: + - bias-high-impedance + - required: + - bias-hold + - required: + - bias-up + - required: + - bias-down + - required: + - bias-pull-pin-default
Quoted 2 lines
These is a bunch of "pull" infixes missing from the above.
lol, that's silly to miss.
Quoted 11 lines
After looking at it for a while I concluded this is right as well, if just the right names are added. I would add a comment like
# We can only ever allow exactly one of these,
# they are all mutually exclusive.Additionally:
drive-strength and drive-strength-microamp are mutually exclusive.
Oh right yea, didn't notice that one.
Quoted 1 line
input-enable and input-disable are mutually exclusive.
And this one I meant to do and forgot.
Quoted 2 lines
low-power-enable and low-power-disable are mutually exclusive.
This I did do.
Quoted 1 line
input-schmitt need to be added as deprecated.
I figured the best way to deprecate it was not add it at all to the binding? Deprecated properties don't warn, undocumented ones do.
Quoted 2 lines
Can you cook a patch? Maybe test it on the existing device trees first to see that it doesn't wreac havoc.
Yeah, I'll send it along with whatever the code equivalent ends up being. I tested against riscv, which is a tiny sample. I'll probably do it on the arms before submitting and see.
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
In reply to Linus WalleijQuoted 10 lines · Linus Walleij
drivers/pinctrl/pinctrl-mpfs-mssio.c line 225
Quoted 2 lines · Conor Dooley
drivers/pinctrl/pinctrl-mpfs-mssio.c new file +2
-0+static int mpfs_pinctrl_dt_node_to_map (struct pinctrl_dev *pctrl_dev,struct device_node *np, +struct pinctrl_map **maps,unsigned int *num_maps)I saw in the cover letter that you wanted this to use more generic helpers.
If you see room for improvement of the generic code, do not hesitate. Doing a new driver is the only time when you actually have all these details in your head and can create good helpers.
Started looking at this today too, and I found one of my sources of confusion - the recently added helper which I think is confusingly named. pinconf_generic_dt_node_to_map_pinmux() works differently to pinconf_generic_dt_node_to_map(), because it only works if you have the following setup:
label: group {
pinmux = <asjhdasjhlajskd>;
config-item1;
};It does not work if you have:
label: cfg {
group1 {
pinmux = <dsjhlfka>;
config-item2;
};
group2 {
pinmux = <lsdjhaf>;
config-item1;
};
};Specifically, the label must point to a group. pinconf_generic_dt_node_to_map() does not work like this, it accepts both! I think the pinconf_generic_dt_node_to_map_pinmux() function should actually be called pinconf_generic_dt_subnode_to_map_pinmux(), because it operates at the same level as pinconf_generic_dt_subnode_to_map().
Probably there should be a "real" pinconf_generic_dt_node_to_map() that accepts both setups, since AFAICT it is pretty normal to have different pins in a group that get different pinconf settings. Obviously
label: cfg {
group1 {
pinmux = <dsjhlfka>;
config-item2;
};
group2 {
pinmux = <lsdjhaf>;
config-item1;
};
};peripheral {
pinctrl-0 = <&label>;
}isn't the only way to do things, and the amlogic user of the current setup could just go and do
cfg {
label1: group1 {
pinmux = <dsjhlfka>;
config-item2;
};
label2: group2 {
pinmux = <lsdjhaf>;
config-item1;
};
};peripheral {
pinctrl-0 = <&label1>, <&label2>;
}if it never needs more than one set of configs so this isn't a bug in the amlogic stuff, just something I found misleading while trying to make my own helper.
Even then though, I'm not really sure that this function does what I would have expected it to do, because it won't work as a replacement for the custom dt_node_to_map in the spacemit k1 driver, for example, even ignoring the requirement about how the labels are done in the dt. That's because it doesn't actually do anything with the pinmux property, despite that being in the name. It never actually interacts with the pinmux property at all AFAICT! It seems to depend on aml_pctl_parse_functions() being called during probe which creates the groups and functions.
There's a weird warning about expecting a function parent node that seems very amlogic specific too.
In my eyes, there should be some generic dt_node_to_map helpers that do it all for you on the "configuration entirely described in dt" platforms because that's what stuff like spacemit k1 driver that do this in their dt_node_to_map implementations.
I'm not gonna get in over my head, and just make a helper for doing the pins + function thing that I need for my driver, but would you be open to an equivalent for the pinmux scenario? I'm thinking of something that'd work for both the amlogic platform and for the spacemit k1.
Cheers,
Conor.
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 24 lines · Conor Dooley
Started looking at this today too, and I found one of my sources of confusion - the recently added helper which I think is confusingly named.
pinconf_generic_dt_node_to_map_pinmux()works differently topinconf_generic_dt_node_to_map(), because it only works if you have the following setup:label: group { pinmux = <asjhdasjhlajskd>; config-item1; };It does not work if you have:
label: cfg { group1 { pinmux = <dsjhlfka>; config-item2; }; group2 { pinmux = <lsdjhaf>; config-item1; }; };
Quoted 2 lines
Specifically, the label must point to a group.
pinconf_generic_dt_node_to_map()does not work like this, it accepts both!
My feeling is that this is a bug, it should certainly handle configs with subnodes.
Quoted 3 lines
I think the
pinconf_generic_dt_node_to_map_pinmux()function should actually be calledpinconf_generic_dt_subnode_to_map_pinmux(), because it operates at the same level aspinconf_generic_dt_subnode_to_map().
If it should be renamed, yes. But I think it should be fixed to parse subnodes, if present.
Quoted 3 lines
Probably there should be a "real"
pinconf_generic_dt_node_to_map()that accepts both setups, since AFAICT it is pretty normal to have different pins in a group that get different pinconf settings. Obviously
I think it should be fine to augment the existing function to handle both cases? (configs inside the current node or in subnodes alike) I don't see it causing any regressions.
Quoted 29 lines
label: cfg { group1 { pinmux = <dsjhlfka>; config-item2; }; group2 { pinmux = <lsdjhaf>; config-item1; }; };peripheral { pinctrl-0 = <&label>; }isn't the only way to do things, and the amlogic user of the current setup could just go and do
cfg { label1: group1 { pinmux = <dsjhlfka>; config-item2; }; label2: group2 { pinmux = <lsdjhaf>; config-item1; }; };
Quoted 3 lines
peripheral {
pinctrl-0 = <&label1>, <&label2>;
}That works too, because sometimes you want to pick a few different configs and collect them as one.
Quoted 7 lines
Even then though, I'm not really sure that this function does what I would have expected it to do, because it won't work as a replacement for the custom
dt_node_to_mapin the spacemit k1 driver, for example, even ignoring the requirement about how the labels are done in the dt. That's because it doesn't actually do anything with the pinmux property, despite that being in the name. It never actually interacts with the pinmux property at all AFAICT!
I think it's unfortunate naming, people sometimes use the word "pinmux" as a DT property, sometimes to describe the subsystem, sometimes a part of the subsystem, sometimes anything related to pins.
I know I should perhaps have shepherded this better :/
Quoted 9 lines
It seems to depend on
aml_pctl_parse_functions()being called during probe which creates the groups and functions.
There's a weird warning about expecting a function parent node that seems very amlogic specific too.In my eyes, there should be some generic
dt_node_to_maphelpers that do it all for you on the "configuration entirely described in dt" platforms because that's what stuff like spacemit k1 driver that do this in theirdt_node_to_mapimplementations.
I think you're right!
Quoted 3 lines
I'm not gonna get in over my head, and just make a helper for doing the pins + function thing that I need for my driver, but would you be open to an equivalent for the pinmux scenario?
Yes!
Quoted 2 lines
I'm thinking of something
that'd work for both the amlogic platform and for the spacemit k1.
That's a good start!
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 39 lines · Linus Walleij
Quoted 24 lines · Conor Dooley
Started looking at this today too, and I found one of my sources of confusion - the recently added helper which I think is confusingly named.
pinconf_generic_dt_node_to_map_pinmux()works differently topinconf_generic_dt_node_to_map(), because it only works if you have the following setup:label: group { pinmux = <asjhdasjhlajskd>; config-item1; };It does not work if you have:
label: cfg { group1 { pinmux = <dsjhlfka>; config-item2; }; group2 { pinmux = <lsdjhaf>; config-item1; }; };Quoted 2 lines
Specifically, the label must point to a group.
pinconf_generic_dt_node_to_map()does not work like this, it accepts both!My feeling is that this is a bug, it should certainly handle configs with subnodes.
Quoted 3 lines
I think the
pinconf_generic_dt_node_to_map_pinmux()function should actually be calledpinconf_generic_dt_subnode_to_map_pinmux(), because it operates at the same level aspinconf_generic_dt_subnode_to_map().If it should be renamed, yes. But I think it should be fixed to parse subnodes, if present.
Quoted 7 lines
Quoted 3 lines
Probably there should be a "real"
pinconf_generic_dt_node_to_map()that accepts both setups, since AFAICT it is pretty normal to have different pins in a group that get different pinconf settings. ObviouslyI think it should be fine to augment the existing function to handle both cases? (configs inside the current node or in subnodes alike) I don't see it causing any regressions.
I think the rename to add subnode actually makes sense, as it would match how the code is broken down for pinconf_generic_dt_node_to_map(), since the code in the current pinconf_generic_dt_node_to_map_pinmux() would have to be executed in two different places. That'd be invisible to the amlogic driver though, if done properly, since a pinconf_generic_dt_node_to_map_pinmux() would still exist.
Quoted 45 lines
Quoted 30 lines
label: cfg { group1 { pinmux = <dsjhlfka>; config-item2; }; group2 { pinmux = <lsdjhaf>; config-item1; }; };peripheral { pinctrl-0 = <&label>; }isn't the only way to do things, and the amlogic user of the current setup could just go and do
cfg { label1: group1 { pinmux = <dsjhlfka>; config-item2; }; label2: group2 { pinmux = <lsdjhaf>; config-item1; }; };Quoted 3 lines
peripheral { pinctrl-0 = <&label1>, <&label2>; }That works too, because sometimes you want to pick a few different configs and collect them as one.
Quoted 7 lines
Even then though, I'm not really sure that this function does what I would have expected it to do, because it won't work as a replacement for the custom
dt_node_to_mapin the spacemit k1 driver, for example, even ignoring the requirement about how the labels are done in the dt. That's because it doesn't actually do anything with the pinmux property, despite that being in the name. It never actually interacts with the pinmux property at all AFAICT!
Quoted 4 lines
I think it's unfortunate naming, people sometimes use the word "pinmux" as a DT property, sometimes to describe the subsystem, sometimes a part of the subsystem, sometimes anything related to pins.
I think I actually understand the naming now. It's called pinmux because the existing function pinconf_generic_dt_node_to_map() doesn't support pinmux, so this is the version you need for platforms that are using pinmux. But then nothing about it limits it actually to pinmuxes, other than arbitrary property checks, it could actually be used for my pins + functions use-case, if I added similar code to amlogics in my probe function that creates the functions and groups.
I still think the naming is poor though, and that it is not as generic as it purports to be, since it depends on having the exact dt configuration that amlogic has, and wouldn't work for spacemit that use the first multi-group example that I gave above. I'd be inclined to say that it should be shunted back to the amlogic driver, to avoid baiting people into trying to use it because of the label position problem, the fact that it requires parsing the dt twice (the first time in probe to generate the groups/functions), and because the code uses the parent of node as the pinmux function. IOW, it needs:
pinctrl@bla {
func-foo {
label: group-default {
pinmuxes = <lskdf>;
};
};
};and couldn't be used somewhere like:
pinctrl@bla {
label: group-default {
pinmuxes = <lskdf>;
};
};Probably there's very few places where this second example makes sense (cos it requires all pins in a group to always have the same config parameters, but I could definitely see that being possible.
So ye, proposing moving it back from whence it came, rather than actually making it work for both label positions.
Quoted 1 line
I know I should perhaps have shepherded this better :/
idk, I think this is the usual "creating something generic but with only one user" problem. Hard to know if it actually is generic at all.
Quoted 11 lines
Quoted 9 lines
It seems to depend on
aml_pctl_parse_functions()being called during probe which creates the groups and functions.
There's a weird warning about expecting a function parent node that seems very amlogic specific too.In my eyes, there should be some generic
dt_node_to_maphelpers that do it all for you on the "configuration entirely described in dt" platforms because that's what stuff like spacemit k1 driver that do this in theirdt_node_to_mapimplementations.I think you're right!
My dilemma now is what to call them and where to put them. pinconf_generic_dt_node_to_map<something>() feels weird for something that is also creating functions and groups, which I noticed because I was having to include pinmux.h in pinconf.c so that I could call pinmux_generic_add_function().
Quoted 14 lines
Quoted 4 lines
I'm not gonna get in over my head, and just make a helper for doing the pins + function thing that I need for my driver, but would you be open to an equivalent for the pinmux scenario?
Yes!
Quoted 2 lines
I'm thinking of something
that'd work for both the amlogic platform and for the spacemit k1.That's a good start!
Yours,
Linus Walleij
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 13 lines · Conor Dooley
Quoted 4 lines
I think it's unfortunate naming, people sometimes use the word "pinmux" as a DT property, sometimes to describe the subsystem, sometimes a part of the subsystem, sometimes anything related to pins.
I think I actually understand the naming now. It's called pinmux because the existing function
pinconf_generic_dt_node_to_map()doesn't support pinmux, so this is the version you need for platforms that are using pinmux. But then nothing about it limits it actually to pinmuxes, other than arbitrary property checks, it could actually be used for my pins + functions use-case, if I added similar code to amlogics in my probe function that creates the functions and groups.
Quoted 6 lines
I still think the naming is poor though, and that it is not as generic as it purports to be, since it depends on having the exact dt configuration that amlogic has, and wouldn't work for spacemit that use the first multi-group example that I gave above. I'd be inclined to say that it should be shunted back to the amlogic driver, to avoid baiting people into trying to use it because of the label position problem,
You're probably right. I see the problem here.
Quoted 4 lines
Quoted 1 line
I know I should perhaps have shepherded this better :/
idk, I think this is the usual "creating something generic but with only one user" problem. Hard to know if it actually is generic at all.
The problem is mostly too few people working on genericizing the pinctrl code I think, it makes me be happy about any such attempts. But I should pay more attention, clearly I just looked at it superficially.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
It seems to depend on
aml_pctl_parse_functions()being called during probe which creates the groups and functions.
There's a weird warning about expecting a function parent node that seems very amlogic specific too.In my eyes, there should be some generic
dt_node_to_maphelpers that do it all for you on the "configuration entirely described in dt" platforms because that's what stuff like spacemit k1 driver that do this in theirdt_node_to_mapimplementations.
Quoted 7 lines
Quoted 1 line
I think you're right!
My dilemma now is what to call them and where to put them. pinconf_generic_dt_node_to_map<something>() feels weird for something that is also creating functions and groups, which I noticed because I was having to include
pinmux.hinpinconf.cso that I could callpinmux_generic_add_function().
pinctrl_generic_dt_node_parse_config() or so? Is it vague enough?
Yours,
Linus Walleij
Conor Dooley
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 14 lines · Linus Walleij
Quoted 12 lines · Conor Dooley
Quoted 11 lines
Quoted 9 lines
It seems to depend on
aml_pctl_parse_functions()being called during probe which creates the groups and functions.
There's a weird warning about expecting a function parent node that seems very amlogic specific too.In my eyes, there should be some generic
dt_node_to_maphelpers that do it all for you on the "configuration entirely described in dt" platforms because that's what stuff like spacemit k1 driver that do this in theirdt_node_to_mapimplementations.I think you're right!
Quoted 7 lines
Quoted 5 lines
My dilemma now is what to call them and where to put them. pinconf_generic_dt_node_to_map<something>() feels weird for something that is also creating functions and groups, which I noticed because I was having to include
pinmux.hinpinconf.cso that I could callpinmux_generic_add_function().
pinctrl_generic_dt_node_parse_config()or so? Is it vague enough?
Probably too vague, since it's gonna be pins + functions specific, but I'll do something along these lines. Where should I put it? Leave it in pinconf-generic, but do some gating of it to only be exposed for configs with GENERIC_PINMUX_FUNCTIONS enabled?
Linus Walleij
maintainerRe: [RFC v1 2/4] pinctrl: add polarfire soc mssio pinctrl driver
Quoted 4 lines · Conor Dooley
Probably too vague, since it's gonna be pins + functions specific, but I'll do something along these lines. Where should I put it? Leave it in pinconf-generic, but do some gating of it to only be exposed for configs with
GENERIC_PINMUX_FUNCTIONSenabled?
Yeah just add something new and a whole new file like that, we will probably add more stuff there as time goes.
Yours,
Linus Walleij
Conor Dooley
maintainerRFC 3/4 MAINTAINERS: add Microchip mpfs mssio driver/bindings to entry
In reply to Conor DooleyFrom: Conor Dooley <[email protected]>
Add the new mssio driver and bindings to the existing entry for Microchip RISC-V devices.
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -22090,6 +22090,7 @@ F: Documentation/devicetree/bindings/i2c/microchip,corei2c.yaml F: Documentation/devicetree/bindings/mailbox/microchip,mpfs-mailbox.yaml F: Documentation/devicetree/bindings/net/can/microchip,mpfs-can.yaml F: Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-iomux0.yaml +F: Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml F: Documentation/devicetree/bindings/pinctrl/microchip,pic64gx-pinctrl-gpio2.yaml F: Documentation/devicetree/bindings/pwm/microchip,corepwm.yaml F: Documentation/devicetree/bindings/riscv/microchip.yaml
@@ -22105,6 +22106,7 @@ F: drivers/i2c/busses/i2c-microchip-corei2c.c F: drivers/mailbox/mailbox-mpfs.c F: drivers/pci/controller/plda/pcie-microchip-host.c F: drivers/pinctrl/pinctrl-mpfs-iomux0.c +F: drivers/pinctrl/pinctrl-mpfs-mssio.c F: drivers/pinctrl/pinctrl-pic64gx-gpio2.c F: drivers/pwm/pwm-microchip-core.c F: drivers/reset/reset-mpfs.c
Signature · 1 line
2.51.0
Conor Dooley
maintainerRFC 4/4 riscv: dts: microchip: add pinctrl nodes for mpfs/icicle kit
In reply to Conor DooleyFrom: Conor Dooley <[email protected]>
Add pinctrl nodes to PolarFire to demonstrate their use, matching the default configuration set by the HSS firmware for the Icicle kit's reference design, as a demonstration of use.
--- .../dts/microchip/mpfs-icicle-kit-common.dtsi | 1 - .../dts/microchip/mpfs-icicle-kit-fabric.dtsi | 63 +++++++ .../boot/dts/microchip/mpfs-pinctrl.dtsi | 165 ++++++++++++++++++ arch/riscv/boot/dts/microchip/mpfs.dtsi | 16 ++ 4 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/boot/dts/microchip/mpfs-pinctrl.dtsi
arch/riscv/boot/dts/microchip/mpfs-icicle-kit-common.dtsi +0 -1
@@ -3,7 +3,6 @@ /dts-v1/; -#include "mpfs.dtsi" #include "mpfs-icicle-kit-fabric.dtsi" #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/leds/common.h>
arch/riscv/boot/dts/microchip/mpfs-icicle-kit-fabric.dtsi +63 -0
78 lines not on this page · raw message
arch/riscv/boot/dts/microchip/mpfs-pinctrl.dtsi new file +165 -0
165 lines not on this page · raw message
arch/riscv/boot/dts/microchip/mpfs.dtsi +16 -0
@@ -254,7 +254,23 @@ pdma: dma-controller@3000000 { mss_top_sysreg: syscon@20002000 { compatible = "microchip,mpfs-mss-top-sysreg", "syscon", "simple-mfd"; reg = <0x0 0x20002000 0x0 0x1000>; + #address-cells = <1>; + #size-cells = <1>; #reset-cells = <1>; + + iomux0: pinctrl@200 { + compatible = "microchip,mpfs-pinctrl-iomux0"; + reg = <0x200 0x4>; + pinctrl-use-default; + + }; + + mssio: pinctrl@204 { + compatible = "microchip,mpfs-pinctrl-mssio"; + reg = <0x204 0x7c>; + /* on icicle ref design at least */ + pinctrl-use-default; + }; }; sysreg_scb: syscon@20003000 {
Signature · 1 line
2.51.0
Quoted 3 lines · Conor Dooley
Got the other driver that I was talking about here for you... It's in RFC state because I'd like to get some feedback on the approach while I try to figure out a) what ibufmd is
I was going to ask about that :D
Quoted 2 lines
and b) how the bank voltage
interacts with the schmitt trigger setting.
Please check if "bank voltage" is somewhat analogous to this generic config:
* @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
* supplies, the argument to this parameter (on a custom format) tells
* the driver which alternative power source to use.
Quoted 3 lines
There's some specific @Linus questions in the driver, mostly where I was unsure about how config bits should be handled and looking around at other drivers wasn't sufficient because they did different things.
I tried to answer as best I could.
Quoted 5 lines
Finally, on the dt side, this was using the pinmux property before the other drivers were submitted, but I didn't really like it to begin with (shoving two things into entries of the same property gives me the ick). I moved to using pins + function which at least looks prettier in the devicetree.
I think this looks way better than any pinmux properties.
Quoted 4 lines
I had been hoping that I could move to some sort of generic
dt_node_to_mapfunction, but I couldn't figure out one that'd work without creating groups in the driver. If there is, I'd love to get rid of the customdt_node_to_mapstuff.
It seems like something that could be added to the core (drivers/pinctrl/devicetree.c), if you feel like and have time for going the extra mile. Maybe it would be simple to move some drivers over to using it if done right.
Quoted 4 lines
I want to avoid doing having set groups, because of the number of possible configurations in the MSS Configurator FPGA tool is fairly large, and I believe that MSS Configurator actually undersells the number of possible combinations for ease of use.
FPGA:s often have this "phone exchange" property.
Quoted 4 lines
I haven't tested that
and the driver technically doesn't support it, but I feel like not trying to define groups statically and using pins instead would permit those combos in the future should that use case ever materialise.
It makes sense for a driver for this type of very flexible hardware.
Yours,
Linus Walleij
Conor Dooley
maintainerQuoted 11 lines · Linus Walleij
Quoted 3 lines · Conor Dooley
Got the other driver that I was talking about here for you... It's in RFC state because I'd like to get some feedback on the approach while I try to figure out a) what ibufmd is
I was going to ask about that :D
Quoted 2 lines
and b) how the bank voltage
interacts with the schmitt trigger setting.
Quoted 6 lines
Please check if "bank voltage" is somewhat analogous to this generic config:
* @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
* supplies, the argument to this parameter (on a custom format) tells
* the driver which alternative power source to use.
It's not pin based, the whole bank it is connected to has to be changed. I'm not entirely sure if I want the driver to be able to control this at all (at least not right now) because I don't know exactly what the ramifications of changing it away from what the configuration tool decided that it was are. Probably it could be done, but I don't know how safe it is to change, as I think most of these kinds of settings were never really seen as something "application" software would change (linux is an application from the perspective of the design folks), since it was all modifiable from the MSS configuration tool.
Quoted 5 lines
Quoted 3 lines
There's some specific @Linus questions in the driver, mostly where I was unsure about how config bits should be handled and looking around at other drivers wasn't sufficient because they did different things.
I tried to answer as best I could.
Cool, thanks.
Quoted 13 lines
Quoted 5 lines
Finally, on the dt side, this was using the pinmux property before the other drivers were submitted, but I didn't really like it to begin with (shoving two things into entries of the same property gives me the ick). I moved to using pins + function which at least looks prettier in the devicetree.
I think this looks way better than any pinmux properties.
Quoted 4 lines
I had been hoping that I could move to some sort of generic
dt_node_to_mapfunction, but I couldn't figure out one that'd work without creating groups in the driver. If there is, I'd love to get rid of the customdt_node_to_mapstuff.
Quoted 4 lines
It seems like something that could be added to the core (
drivers/pinctrl/devicetree.c), if you feel like and have time for going the extra mile. Maybe it would be simple to move some drivers over to using it if done right.
Yeah I might, especially if it pushes people away from these pinmux properties! Might also just submit this as-is and do it on top, depends on what stuff I have going on.
Quoted 6 lines
Quoted 5 lines
I want to avoid doing having set groups, because of the number of possible configurations in the MSS Configurator FPGA tool is fairly large, and I believe that MSS Configurator actually undersells the number of possible combinations for ease of use.
Quoted 8 lines
FPGA:s often have this "phone exchange" property.
Quoted 4 lines
I haven't tested that
and the driver technically doesn't support it, but I feel like not trying to define groups statically and using pins instead would permit those combos in the future should that use case ever materialise.It makes sense for a driver for this type of very flexible hardware.
Thanks for taking a look.
Quoted 6 lines · Conor Dooley
Quoted 5 lines · Linus Walleij
Quoted 2 lines · Conor Dooley
and b) how the bank voltage
interacts with the schmitt trigger setting.
Quoted 8 lines
Quoted 6 lines
Please check if "bank voltage" is somewhat analogous to this generic config:
* @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
* supplies, the argument to this parameter (on a custom format) tells
* the driver which alternative power source to use.It's not pin based, the whole bank it is connected to has to be changed.
So there *is* such a thing as a group pin config setting for a whole group of pins. Groups are not just for functions...
And I don't know what is meant by a bank here, but it seems to be exactly a group of pins.
From arch/arm/boot/dts/gemini/gemini-sq201.dts:
/* Set up drive strength on GMAC0 and GMAC1 to 16 mA */
conf9 {
groups = "gmii_gmac0_grp", "gmii_gmac1_grp";
drive-strength = <16>;
};If you look in driver/pinctrl/pinctrl-gemini.c you find:gemini_pinconf_group_set()
static const struct pinconf_ops gemini_pinconf_ops = {
.pin_config_get = gemini_pinconf_get, .pin_config_set = gemini_pinconf_set, .pin_config_group_set = gemini_pinconf_group_set, .is_generic = true,
};
OTOMH it's actually *fine* to *just* use groups for pin config like this and *not* use it for muxing, i.e. have this group correspond to a bank and not use that group for anything else than to set this or any other per-bank property. But have a look!
Yours,
Linus Walleij
Conor Dooley
maintainerQuoted 14 lines · Linus Walleij
Quoted 13 lines · Conor Dooley
Quoted 11 lines · Linus Walleij
Quoted 2 lines · Conor Dooley
and b) how the bank voltage
interacts with the schmitt trigger setting.Please check if "bank voltage" is somewhat analogous to this generic config:
* @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
* supplies, the argument to this parameter (on a custom format) tells
* the driver which alternative power source to use.
Quoted 7 lines
Quoted 1 line
It's not pin based, the whole bank it is connected to has to be changed.
So there *is* such a thing as a group pin config setting for a whole group of pins. Groups are not just for functions...
And I don't know what is meant by a bank here, but it seems to be exactly a group of pins.
Yeah, it's a whole group of pins. There's two banks that the IOs this driver controls are split between, they don't really neatly correspond to a particular function (although the configurator doesn't permit a function belong to two banks, but it is technically possible for them to).
Quoted 19 lines
From
arch/arm/boot/dts/gemini/gemini-sq201.dts:/* Set up drive strength on GMAC0 and GMAC1 to 16 mA */
conf9 { groups = "gmii_gmac0_grp", "gmii_gmac1_grp"; drive-strength = <16>; };If you look in
driver/pinctrl/pinctrl-gemini.cyou find:gemini_pinconf_group_set()static const struct
pinconf_opsgemini_pinconf_ops= {
.pin_config_get =gemini_pinconf_get, .pin_config_set =gemini_pinconf_set, .pin_config_group_set =gemini_pinconf_group_set, .is_generic = true,
};
Quoted 4 lines
OTOMH it's actually *fine* to *just* use groups for pin config like this and *not* use it for muxing, i.e. have this group correspond to a bank and not use that group for anything else than to set this or any other per-bank property. But have a look!
I could just put it in as a per-pin thing, even if the control isn't actually that granular. The bank lockdown has a per-pin bit, but is actually a bank wide toggle in the configurator, it wouldn't be too different.