Microchip mpfs/pic64gx pinctrl part 2
Subsystems (5)
Conor Dooley
maintainerv4 cover Microchip mpfs/pic64gx pinctrl part 2
From: Conor Dooley <[email protected]>
Hey Linus,
Rebased as requested, with the dts patch that snuck in dropped.
Cheers,
Conor.
changes in v4:
- rebase on devel
- drop dts patch
changes in v3:
- drop the todos
- rename the kconfig symbol
- move my drivers into a microchip dir
- use power-source instead of custom property
main changes in v2:
- bank voltage is now controllable from dt
- bank lockdown no longer controllable from dt
- dt_node_to_map callback is now a(n attempt at a) new generic function
- some schmitt properties now no longer supported
Conor Dooley (5):
pinctrl: move microchip riscv pinctrl drivers to a folder
pinctrl: add generic functions + pins mapper
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
.../pinctrl/microchip,mpfs-pinctrl-mssio.yaml | 109 +++
.../microchip,mpfs-mss-top-sysreg.yaml | 4 +
MAINTAINERS | 6 +-
drivers/pinctrl/Kconfig | 23 +-
drivers/pinctrl/Makefile | 4 +-
drivers/pinctrl/microchip/Kconfig | 17 +
drivers/pinctrl/microchip/Makefile | 5 +
.../{ => microchip}/pinctrl-mpfs-iomux0.c | 8 +-
.../pinctrl/microchip/pinctrl-mpfs-mssio.c | 737 ++++++++++++++++++
.../{ => microchip}/pinctrl-pic64gx-gpio2.c | 2 +-
drivers/pinctrl/pinconf.h | 16 +
drivers/pinctrl/pinctrl-generic.c | 189 +++++
12 files changed, 1095 insertions(+), 25 deletions(-)
create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml
create mode 100644 drivers/pinctrl/microchip/Kconfig
create mode 100644 drivers/pinctrl/microchip/Makefile
rename drivers/pinctrl/{ => microchip}/pinctrl-mpfs-iomux0.c (98%)
create mode 100644 drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
rename drivers/pinctrl/{ => microchip}/pinctrl-pic64gx-gpio2.c (99%)
create mode 100644 drivers/pinctrl/pinctrl-generic.cSignature · 1 line
2.51.0
Conor Dooley
maintainerPATCH v4 1/5 pinctrl: move microchip riscv pinctrl drivers to a folder
From: Conor Dooley <[email protected]>
There's three of these drivers now for the same platforms, move them together with other microchip drivers to follow.
---
MAINTAINERS | 4 ++--
drivers/pinctrl/Kconfig | 17 +----------------
drivers/pinctrl/Makefile | 3 +--
drivers/pinctrl/microchip/Kconfig | 17 +++++++++++++++++
drivers/pinctrl/microchip/Makefile | 4 ++++
.../{ => microchip}/pinctrl-mpfs-iomux0.c | 8 ++++----
.../{ => microchip}/pinctrl-pic64gx-gpio2.c | 2 +-
7 files changed, 30 insertions(+), 25 deletions(-)
create mode 100644 drivers/pinctrl/microchip/Kconfig
create mode 100644 drivers/pinctrl/microchip/Makefile
rename drivers/pinctrl/{ => microchip}/pinctrl-mpfs-iomux0.c (98%)
rename drivers/pinctrl/{ => microchip}/pinctrl-pic64gx-gpio2.c (99%)MAINTAINERS +2 -2
@@ -22472,8 +22472,8 @@ F: drivers/gpio/gpio-mpfs.c 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-pic64gx-gpio2.c +F: drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c +F: drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c F: drivers/pwm/pwm-microchip-core.c F: drivers/reset/reset-mpfs.c F: drivers/rtc/rtc-mpfs.c
drivers/pinctrl/Kconfig +1 -16
@@ -486,14 +486,6 @@ config PINCTRL_PIC32MZDA def_bool y if PIC32MZDA select PINCTRL_PIC32 -config PINCTRL_PIC64GX - bool "pic64gx gpio2 pinctrl driver" - depends on ARCH_MICROCHIP || COMPILE_TEST - depends on OF - select GENERIC_PINCONF - help - This selects the pinctrl driver for gpio2 on pic64gx. - config PINCTRL_PISTACHIO bool "IMG Pistachio SoC pinctrl driver" depends on OF && (MIPS || COMPILE_TEST)
@@ -505,14 +497,6 @@ config PINCTRL_PISTACHIO help This support pinctrl and GPIO driver for IMG Pistachio SoC. -config PINCTRL_POLARFIRE_SOC - bool "Polarfire SoC pinctrl driver" - depends on ARCH_MICROCHIP || COMPILE_TEST - depends on OF - select GENERIC_PINCONF - help - This selects the pinctrl driver for Microchip Polarfire SoC. - config PINCTRL_RK805 tristate "Pinctrl and GPIO driver for RK805 PMIC" depends on MFD_RK8XX
@@ -707,6 +691,7 @@ source "drivers/pinctrl/freescale/Kconfig" source "drivers/pinctrl/intel/Kconfig" source "drivers/pinctrl/mediatek/Kconfig" source "drivers/pinctrl/meson/Kconfig" +source "drivers/pinctrl/microchip/Kconfig" source "drivers/pinctrl/mvebu/Kconfig" source "drivers/pinctrl/nomadik/Kconfig" source "drivers/pinctrl/nuvoton/Kconfig"
drivers/pinctrl/Makefile +1 -2
@@ -48,9 +48,7 @@ obj-$(CONFIG_PINCTRL_OCELOT) += pinctrl-ocelot.o obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o 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-iomux0.o obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o obj-$(CONFIG_PINCTRL_RP1) += pinctrl-rp1.o
@@ -76,6 +74,7 @@ obj-y += freescale/ obj-$(CONFIG_X86) += intel/ obj-y += mediatek/ obj-$(CONFIG_PINCTRL_MESON) += meson/ +obj-y += microchip/ obj-y += mvebu/ obj-y += nomadik/ obj-y += nuvoton/
drivers/pinctrl/microchip/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config PINCTRL_PIC64GX + bool "pic64gx gpio2 pinctrl driver" + depends on ARCH_MICROCHIP || COMPILE_TEST + depends on OF + select GENERIC_PINCONF + help + This selects the pinctrl driver for gpio2 on pic64gx. + +config PINCTRL_POLARFIRE_SOC + bool "Polarfire SoC pinctrl driver" + depends on ARCH_MICROCHIP || COMPILE_TEST + depends on OF + select GENERIC_PINCONF + help + This selects the pinctrl driver for Microchip Polarfire SoC.
drivers/pinctrl/microchip/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_PINCTRL_PIC64GX) += pinctrl-pic64gx-gpio2.o +obj-$(CONFIG_PINCTRL_POLARFIRE_SOC) += pinctrl-mpfs-iomux0.o
drivers/pinctrl/microchip/pinctrl-mpfs-iomux0.c renamed from drivers/pinctrl/pinctrl-mpfs-iomux0.c +4 -4
@@ -15,10 +15,10 @@#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> -#include "core.h" -#include "pinctrl-utils.h" -#include "pinconf.h" -#include "pinmux.h" +#include "../core.h" +#include "../pinctrl-utils.h" +#include "../pinconf.h" +#include "../pinmux.h" #define MPFS_IOMUX0_REG 0x200
drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c renamed from drivers/pinctrl/pinctrl-pic64gx-gpio2.c +1 -1
@@ -14,7 +14,7 @@#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> -#include "pinctrl-utils.h" +#include "../pinctrl-utils.h" #define PIC64GX_PINMUX_REG 0x0
Signature · 1 line
2.51.0
Conor Dooley
maintainerPATCH v4 2/5 pinctrl: add generic functions + pins mapper
In reply to Conor DooleyFrom: Conor Dooley <[email protected]>
Add a generic function to allow creation of groups and functions at runtime based on devicetree content, before setting up mux mappings. It works similarly to pinconf_generic_dt_node_to_map(), and therefore parses pinconf properties and maps those too, allowing it to be used as the dt_node_to_map member of the pinctrl_ops struct.
--- drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinconf.h | 16 +++ drivers/pinctrl/pinctrl-generic.c | 189 ++++++++++++++++++++++++++++++ 4 files changed, 212 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-generic.c
drivers/pinctrl/Kconfig +6 -0
@@ -25,6 +25,12 @@ config GENERIC_PINCONF bool select PINCONF +config GENERIC_PINCTRL + bool + depends on GENERIC_PINCONF + depends on GENERIC_PINCTRL_GROUPS + depends on GENERIC_PINMUX_FUNCTIONS + config DEBUG_PINCTRL bool "Debug PINCTRL calls" depends on DEBUG_KERNEL
drivers/pinctrl/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += core.o pinctrl-utils.o obj-$(CONFIG_PINMUX) += pinmux.o obj-$(CONFIG_PINCONF) += pinconf.o obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o +obj-$(CONFIG_GENERIC_PINCTRL) += pinctrl-generic.o obj-$(CONFIG_OF) += devicetree.o obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o
drivers/pinctrl/pinconf.h +16 -0
@@ -160,3 +160,19 @@ pinconf_generic_parse_dt_pinmux(struct device_node *np, struct device *dev, return -ENOTSUPP; }#endif + +#if defined(CONFIG_GENERIC_PINCTRL ) && defined (CONFIG_OF ) +int pinctrl_generic_pins_function_dt_node_to_map (struct pinctrl_dev *pctldev, +struct device_node *np, +struct pinctrl_map **maps, +unsigned int *num_maps); +#else +static inline int +pinctrl_generic_pins_function_dt_node_to_map (struct pinctrl_dev *pctldev, +struct device_node *np, +struct pinctrl_map **maps, +unsigned int *num_maps) +{ +return -ENOTSUPP ; +} +#endif
drivers/pinctrl/pinctrl-generic.c new file +189 -0
189 lines not on this page · raw message
Signature · 1 line
2.51.0
Conor Dooley
maintainerPATCH v4 3/5 dt-bindings: pinctrl: document polarfire soc mssio pin controller
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.
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 | 109 ++++++++++++++++++ .../microchip,mpfs-mss-top-sysreg.yaml | 4 + 2 files changed, 113 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml
Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml new file +109 -0
@@ -0,0 +1,109 @@ +# 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: + oneOf: + - const: microchip,mpfs-pinctrl-mssio + - items: + - const: microchip,pic64gx-pinctrl-mssio + - 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 ] + + power-source: + description: + Which bank voltage to use. This cannot differ for pins in a + given bank, the whole bank uses the same voltage. + enum: [ 1200000, 1500000, 1800000, 2500000, 3300000 ] + + microchip,clamp-diode: + $ref: /schemas/types.yaml#/definitions/flag + description: + Reflects the "Clamp Diode" setting in the MSS Configurator for + this pin. This setting controls whether or not input voltage + clamping should be enabled. + + 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 + - power-source + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pinctrl@204 { + compatible = "microchip,mpfs-pinctrl-mssio"; + reg = <0x204 0x7c>; + + ikrd-spi1-cfg { + spi1-pins { + pins = <30>, <31>, <32>, <33>; + function = "spi"; + bias-pull-up; + drive-strength = <8>; + power-source = <3300000>; + microchip,ibufmd = <0x1>; + }; + }; + }; +...
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: [PATCH v4 3/5] dt-bindings: pinctrl: document polarfire soc mssio pin controller
Quoted 14 lines · Conor Dooley
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_CRs1 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.
Quoted 7 lines
Signed-off-by Conor Dooley <[email protected]>--- .../pinctrl/microchip,mpfs-pinctrl-mssio.yaml | 109 ++++++++++++++++++ .../microchip,mpfs-mss-top-sysreg.yaml | 4 + 2 files changed, 113 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/microchip,mpfs-pinctrl-mssio.yaml
Conor Dooley
maintainerPATCH v4 4/5 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/microchip/Kconfig | 6 +- drivers/pinctrl/microchip/Makefile | 1 + .../pinctrl/microchip/pinctrl-mpfs-mssio.c | 737 ++++++++++++++++++ 3 files changed, 741 insertions(+), 3 deletions(-) create mode 100644 drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
drivers/pinctrl/microchip/Kconfig +3 -3
@@ -9,9 +9,9 @@ config PINCTRL_PIC64GX This selects the pinctrl driver for gpio2 on pic64gx. config PINCTRL_POLARFIRE_SOC - bool "Polarfire SoC pinctrl driver" + bool "Polarfire SoC pinctrl drivers" depends on ARCH_MICROCHIP || COMPILE_TEST depends on OF - select GENERIC_PINCONF + select GENERIC_PINCTRL help - This selects the pinctrl driver for Microchip Polarfire SoC. + This selects the pinctrl drivers for Microchip Polarfire SoC.
drivers/pinctrl/microchip/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_PINCTRL_PIC64GX) += pinctrl-pic64gx-gpio2.o obj-$(CONFIG_PINCTRL_POLARFIRE_SOC) += pinctrl-mpfs-iomux0.o +obj-$(CONFIG_PINCTRL_POLARFIRE_SOC) += pinctrl-mpfs-mssio.o
drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c new file +737 -0
737 lines not on this page · raw message
Signature · 1 line
2.51.0
Conor Dooley
maintainerPATCH v4 5/5 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
@@ -22458,6 +22458,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
@@ -22473,6 +22474,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/microchip/pinctrl-mpfs-iomux0.c +F: drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c F: drivers/pinctrl/microchip/pinctrl-pic64gx-gpio2.c F: drivers/pwm/pwm-microchip-core.c F: drivers/reset/reset-mpfs.c
Signature · 1 line
2.51.0
Linus Walleij
maintainerQuoted 5 lines · Conor Dooley
From: Conor Dooley <[email protected]>
Hey Linus,
Rebased as requested, with the dts patch that snuck in dropped.
Excellent, patches applied!
Thanks Conor!
Yours,
Linus Walleij