drivers: gpio: and the QIXIS FPGA GPIO controller
Subsystems (5)
v5 cover drivers: gpio: and the QIXIS FPGA GPIO controller
This patch set adds support for the GPIO controllers on the QIXIS FPGAs found on some Layerscape boards such as LX2160ARDB and LS1046AQDS. At the same time it describes the SFP+ cages found on these boards, which are the users of those GPIO lines.
Before actually adding the GPIO driver, patches #2 and #3 add and describe a new compatible string - fsl,lx2160ardb-fpga - which would be used for the QIXIS FPGA found on the LX2160ARDB board. As opposed to the other compatible strings found in fsl,fpga-qixis-i2c.yaml, the fsl,lx2160ardb-fpga imposes a unit address for its child devices. This will be used in the next patches when the gpio controller node will define its unit address as the address of its underlying register offset inside the FPGA. This requirement is described in the yaml file and it only affects the newly added compatible.
Moving on to the GPIO subsystem, patch #4 is extending the gpio-regmap with the fixed_direction_output bitmap which could be used by user drivers to transmit directly the fixed direction of all the GPIO lines.
Even though this patch set touches multiple subsytems, each with their own tree, I submit everything at once so that we can have a clear picture on the overall intention. The hope is that each subsystem can pick up the related patches since there is no compile time dependency between them.
Please note that CHECK_DTBS will fail without the following fixup patch.
https://lore.kernel.org/all/[email protected]/
Changes in v2:
- 1/9: Used the newly added trivial-gpio.yaml file
- 1/9: Removed redundant "bindings" from commit title
- 1/9: Added only one compatible string for the gpio controllers on LX2160ARDB since both registers have the same layout.
- 2/9: Enforce a unit address on the child gpios nodes (remove the ?)
- 2/9: Enforce the use of unit addresses by having #address-size and #size-cells only for the newly added fsl,lx2160ardb-fpga compatible
- 4/9: Add the fixed_direction_output bitmap to the gpio_regmap_config
- 5/9: Use the newly added .fixed_direction_output bitmap representing the fixed direction of the GPIO lines.
- 6/9: Use the same compatible string for both GPIO controller nodes.
Changes in v3:
- 2/10: Replace the trivial-gpio reference with an explicit mention of the accepted child gpio compatible.
- 2/10: Reword the commit message.
- 2/10: Add the 'else' case to the if statement.
- 3/10: New patch
- 5/10: Make a deep copy of the new bitmap.
- 5/10: Remove the offset check against the ngpio.
- 5/10: Added documentation for the new config field.
- 6/10: Remove 'drivers' from the commit title.
- 6/10: Remove the qixis_cpld_gpio_type enum since its not needed.
- 6/10: Remove the NULL check for device_get_match_data().
- 6/10: Use a bitmap declared on the stack as the config field passed to gpio-regmap.
- 9,10/10: Moved the reg property before address/cells-size.
Changes in v4:
- 2/11: Add an extra paragraph in the commit message to better explain the context.
- 4/11: New patch.
- 5/11: Insert the compatible so that the alphabetical order is kept.
- 6/11: Replace devres bitmap allocation with bitmap_alloc() and bitmap_free().
Changes in v5:
- 6/12: New patch. Fix a memory leak.
- 7/12: Rebased on top of latest linux-next, change the extra goto statement.
Ioana Ciornei (12):
dt-bindings: gpio: add QIXIS FPGA based GPIO controller
dt-bindings: fsl,fpga-qixis-i2c: add support for LX2160ARDB FPGA
dt-bindings: fsl,fpga-qixis: describe the gpio child node found on
LS1046AQDS
mfd: simple-mfd-i2c: keep compatible strings in alphabetical order
mfd: simple-mfd-i2c: add compatible string for LX2160ARDB
gpio: regmap: fix memory leak of gpio_regmap structure
gpio: regmap: add the .fixed_direction_output configuration parameter
gpio: add QIXIS FPGA GPIO controller
arm64: dts: lx2160a-rdb: describe the QIXIS FPGA and two child GPIO
controllers
arm64: dts: ls1046a-qds: describe the FPGA based GPIO controller
arm64: dts: lx2160a-rdb: fully describe the two SFP+ cages
arm64: dts: ls1046a-qds: describe the two on-board SFP+ cages
.../bindings/board/fsl,fpga-qixis-i2c.yaml | 58 ++++++++++ .../bindings/board/fsl,fpga-qixis.yaml | 10 ++ .../bindings/gpio/trivial-gpio.yaml | 2 + .../boot/dts/freescale/fsl-ls1046a-qds.dts | 52 +++++++++ .../boot/dts/freescale/fsl-lx2160a-rdb.dts | 78 +++++++++++++ drivers/gpio/Kconfig | 9 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-qixis-fpga.c | 107 ++++++++++++++++++ drivers/gpio/gpio-regmap.c | 28 ++++- drivers/mfd/simple-mfd-i2c.c | 7 +- include/linux/gpio/regmap.h | 5 + 11 files changed, 351 insertions(+), 6 deletions(-) create mode 100644 drivers/gpio/gpio-qixis-fpga.c
Signature · 1 line
2.25.1
PATCH v5 1/12 dt-bindings: gpio: add QIXIS FPGA based GPIO controller
Add a device tree binding for the QIXIS FPGA based GPIO controller. Depending on the board, the QIXIS FPGA exposes registers which act as a GPIO controller, each with 8 GPIO lines of fixed direction.
Since each QIXIS FPGA layout has its particularities, add a separate compatible string for each board/GPIO register combination supported.
Since these GPIO controllers are trivial, make use of the newly added trivial-gpio.yaml file instead of creating an entirely new one.
---
Changes in v2:
- Used the newly added trivial-gpio.yaml file
- Removed redundant "bindings" from commit title
- Added only one compatible string for the gpio controllers on LX2160ARDB since both registers have the same layout.
Changes in v3:
- none
Changes in v4:
- none
Changes in v5:
- none
Documentation/devicetree/bindings/gpio/trivial-gpio.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/gpio/trivial-gpio.yaml +2 -0
@@ -22,6 +22,8 @@ properties: - cznic,moxtet-gpio - dlg,slg7xl45106 - fcs,fxl6408 + - fsl,ls1046aqds-fpga-gpio-stat-pres2 + - fsl,lx2160ardb-fpga-gpio-sfp - gateworks,pld-gpio - ibm,ppc4xx-gpio - loongson,ls1x-gpio
Signature · 1 line
2.25.1
Re: [PATCH v5 01/12] dt-bindings: gpio: add QIXIS FPGA based GPIO controller
Quoted 43 lines · Ioana Ciornei
Add a device tree binding for the QIXIS FPGA based GPIO controller. Depending on the board, the QIXIS FPGA exposes registers which act as a GPIO controller, each with 8 GPIO lines of fixed direction.
Since each QIXIS FPGA layout has its particularities, add a separate compatible string for each board/GPIO register combination supported.
Since these GPIO controllers are trivial, make use of the newly added
trivial-gpio.yamlfile instead of creating an entirely new one.Signed-off-by Ioana Ciornei <[email protected]>Reviewed-by Frank Li <[email protected]>---
Changes in v2:
- Used the newly addedtrivial-gpio.yamlfile
- Removed redundant "bindings" from commit title
- Added only one compatible string for the gpio controllers on LX2160ARDB since both registers have the same layout.
Changes in v3:
- none
Changes in v4:
- none
Changes in v5:
- noneDocumentation/devicetree/bindings/gpio/trivial-gpio.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/gpio/trivial-gpio.yaml +2
-1@@ -22,6 +22,8 @@ properties: - cznic,moxtet-gpio - dlg,slg7xl45106 - fcs,fxl6408 + - fsl,ls1046aqds-fpga-gpio-stat-pres2 + - fsl,lx2160ardb-fpga-gpio-sfp - gateworks,pld-gpio - ibm,ppc4xx-gpio - loongson,ls1x-gpio --
Quoted 3 lines
2.25.1
PATCH v5 2/12 dt-bindings: fsl,fpga-qixis-i2c: add support for LX2160ARDB FPGA
In reply to Ioana CiorneiExtend the list of supported compatible strings with fsl,lx2160ardb-fpga.
Since the register map exposed by the LX2160ARDB's FPGA also contains two GPIO controllers, accept the necessary GPIO pattern property. At the same time, add the #address-cells and #size-cells properties as valid ones so that the child nodes of the fsl,lx2160ardb-fpga node are addressable.
This is necessary because when defining child devices such as the GPIO controller described in the added example, the child device needs a the reg property to properly identify its register location in the parent I2C device address space.
Impose this restriction for the new compatible through an if-statement.
The feature set exposed by these QIXIS FPGA devices is highly dependent on the board type, meaning that even though the FPGA found on the LX2160AQDS board (fsl,lx2160aqds-fpga) works in the same way in terms of access over I2C as the one found on the LX2160ARDB (fsl,lx2160ardb-fpga added here), the register map inside the device space is different since there are different on-board devices to be controlled.
---
Changes in v2:
- Enforce a unit address on the child gpios nodes (remove the ?)
- Enforce the use of unit addresses by having #address-size and #size-cells only for the newly added fsl,lx2160ardb-fpga compatible
Changes in v3:
- Replace the trivial-gpio reference with an explicit mention of the accepted child gpio compatible.
- Reword the commit message.
- Add the 'else' case to the if statement.
Changes in v4:
- Add an extra paragraph in the commit message to better explain the context.
Changes in v5:
- none
.../bindings/board/fsl,fpga-qixis-i2c.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
Documentation/devicetree/bindings/board/fsl,fpga-qixis-i2c.yaml +58 -0
@@ -22,6 +22,13 @@ properties: - fsl,lx2160aqds-fpga - const: fsl,fpga-qixis-i2c - const: simple-mfd + - const: fsl,lx2160ardb-fpga + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 interrupts: maxItems: 1
@@ -32,10 +39,37 @@ properties: mux-controller: $ref: /schemas/mux/reg-mux.yaml +patternProperties: + "^gpio@[0-9a-f]+$": + type: object + additionalProperties: true + + properties: + compatible: + contains: + enum: + - fsl,lx2160ardb-fpga-gpio-sfp + required: - compatible - reg +allOf: + - if: + properties: + compatible: + contains: + enum: + - fsl,lx2160ardb-fpga + then: + required: + - "#address-cells" + - "#size-cells" + else: + properties: + "#address-cells": false + "#size-cells": false + additionalProperties: false examples:
@@ -68,3 +102,27 @@ examples: }; }; + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + board-control@66 { + compatible = "fsl,lx2160ardb-fpga"; + reg = <0x66>; + #address-cells = <1>; + #size-cells = <0>; + + gpio@19 { + compatible = "fsl,lx2160ardb-fpga-gpio-sfp"; + reg = <0x19>; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = + "SFP2_TX_EN", "", + "", "", + "SFP2_RX_LOS", "SFP2_TX_FAULT", + "", "SFP2_MOD_ABS"; + }; + }; + };
Signature · 1 line
2.25.1
PATCH v5 3/12 dt-bindings: fsl,fpga-qixis: describe the gpio child node found on LS1046AQDS
In reply to Ioana CiorneiExtend the list of accepted child nodes with the QIXIS FPGA based GPIO controller and explicitly list its compatible string fsl,ls1046aqds-fpga-gpio-stat-pres2 as the only one accepted.
---
Changes in v3:
- new patch
Changes in v4:
- none
Changes in v5:
- none
.../devicetree/bindings/board/fsl,fpga-qixis.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/board/fsl,fpga-qixis.yaml +10 -0
@@ -57,6 +57,16 @@ patternProperties: '^mdio-mux@[a-f0-9,]+$': $ref: /schemas/net/mdio-mux-mmioreg.yaml + '^gpio@[0-9a-f]+$': + type: object + additionalProperties: true + + properties: + compatible: + contains: + enum: + - fsl,ls1046aqds-fpga-gpio-stat-pres2 + required: - compatible - reg
Signature · 1 line
2.25.1
Re: [PATCH v5 03/12] dt-bindings: fsl,fpga-qixis: describe the gpio child node found on LS1046AQDS
Quoted 13 lines · Ioana Ciornei
Extend the list of accepted child nodes with the QIXIS FPGA based GPIO controller and explicitly list its compatible string fsl,ls1046aqds-fpga-gpio-stat-pres2 as the only one accepted.
Signed-off-by Ioana Ciornei <[email protected]>---
Changes in v3:
- new patch
Changes in v4:
- none
Changes in v5:
- none
Quoted 3 lines
.../devicetree/bindings/board/fsl,fpga-qixis.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
PATCH v5 4/12 mfd: simple-mfd-i2c: keep compatible strings in alphabetical order
In reply to Ioana CiorneiReorder the of_device_id structures so that they are in alphabetical order.
---
Changes in v4:
- new patch
Changes in v5:
- none
drivers/mfd/simple-mfd-i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/simple-mfd-i2c.c +3 -3
@@ -110,13 +110,13 @@ static const struct simple_mfd_data spacemit_p1 = { };static const struct of_device_id simple_mfd_i2c_of_match[] = { + { .compatible ="fsl,ls1028aqds-fpga" }, + { .compatible ="fsl,lx2160aqds-fpga" }, { .compatible ="kontron,sl28cpld" }, - { .compatible ="silergy,sy7636a" , .data = &silergy_sy7636a}, { .compatible ="maxim,max5970" , .data = &maxim_max5970}, { .compatible ="maxim,max5978" , .data = &maxim_max5970}, { .compatible ="maxim,max77705-battery" , .data = &maxim_mon_max77705}, - { .compatible ="fsl,lx2160aqds-fpga" }, - { .compatible ="fsl,ls1028aqds-fpga" }, + { .compatible ="silergy,sy7636a" , .data = &silergy_sy7636a}, { .compatible ="spacemit,p1" , .data = &spacemit_p1, }, {} };
Signature · 1 line
2.25.1
Re: [PATCH v5 04/12] mfd: simple-mfd-i2c: keep compatible strings in alphabetical order
Quoted 4 lines · Ioana Ciornei
Reorder the
of_device_idstructures so that they are in alphabetical order.Signed-off-by Ioana Ciornei <[email protected]>
Quoted 8 lines
---
Changes in v4:
- new patch
Changes in v5:
- nonedrivers/mfd/simple-mfd-i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Applied, thanks
Signature · 1 line
Lee Jones [李琼斯]
PATCH v5 5/12 mfd: simple-mfd-i2c: add compatible string for LX2160ARDB
In reply to Ioana CiorneiExtend the list of supported devices with the QIXIS FPGA found on the LX2160ARDB board.
---
Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- Insert the compatible so that the alphabetical order is kept. Changes in v5:
- none
drivers/mfd/simple-mfd-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/simple-mfd-i2c.c +1 -0
@@ -112,6 +112,7 @@ static const struct simple_mfd_data spacemit_p1 = {static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible ="fsl,ls1028aqds-fpga" }, { .compatible ="fsl,lx2160aqds-fpga" }, + { .compatible ="fsl,lx2160ardb-fpga" }, { .compatible ="kontron,sl28cpld" }, { .compatible ="maxim,max5970" , .data = &maxim_max5970}, { .compatible ="maxim,max5978" , .data = &maxim_max5970},
Signature · 1 line
2.25.1
PATCH v5 6/12 gpio: regmap: fix memory leak of gpio_regmap structure
In reply to Ioana CiorneiThe gpio_regmap structure is leaked on the error path. Fix this by jumping to the appropriate kfree instead of returning directly.
---
Changes in v5:
- new patch
drivers/gpio/gpio-regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-regmap.c +1 -1
@@ -281,7 +281,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *configif (!chip->ngpio) { ret =gpiochip_get_ngpios (chip, chip->parent);if (ret) -return ERR_PTR (ret); + goto err_free_gpio; }/* if not set, assume there is only one register */
Signature · 1 line
2.25.1
Re: [PATCH v5 06/12] gpio: regmap: fix memory leak of gpio_regmap structure
Quoted 6 lines
The
gpio_regmapstructure is leaked on the error path. Fix this by jumping to the appropriate kfree instead of returning directly.Fixes db305161880a ("gpio: regmap: Allow ngpio to be read from the property")Signed-off-by Ioana Ciornei <[email protected]>Suggested-by Michael Walle <[email protected]>
PATCH v5 7/12 gpio: regmap: add the .fixed_direction_output configuration parameter
In reply to Ioana CiorneiThere are GPIO controllers such as the one present in the LX2160ARDB QIXIS FPGA which have fixed-direction input and output GPIO lines mixed together in a single register. This cannot be modeled using the gpio-regmap as-is since there is no way to present the true direction of a GPIO line.
In order to make this use case possible, add a new configuration parameter - fixed_direction_output - into the gpio_regmap_config structure. This will enable user drivers to provide a bitmap that represents the fixed direction of the GPIO lines.
---
Changes in v2:
- Add the fixed_direction_output bitmap to the gpio_regmap_config Changes in v3:
- Make a deep copy of the new bitmap.
- Remove the offset check against the ngpio.
- Added documentation for the new config field.
Changes in v4:
- Replace devres bitmap allocation with bitmap_alloc() and bitmap_free().
Changes in v5:
- Rebased on top of latest linux-next, change the extra goto statement.
drivers/gpio/gpio-regmap.c | 26 ++++++++++++++++++++++++-- include/linux/gpio/regmap.h | 5 +++++ 2 files changed, 29 insertions(+), 2 deletions(-)
drivers/gpio/gpio-regmap.c +24 -2
@@ -31,6 +31,7 @@ struct gpio_regmap {unsigned int reg_clr_base;unsigned int reg_dir_in_base;unsigned int reg_dir_out_base; +unsigned long *fixed_direction_output;#ifdef CONFIG_REGMAP_IRQ int regmap_irq_line;
@@ -134,6 +135,13 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip,unsigned int base, val, reg, mask;int invert, ret; +if (gpio->fixed_direction_output) { +if (test_bit (offset, gpio->fixed_direction_output)) +return GPIO_LINE_DIRECTION_OUT ; +else +return GPIO_LINE_DIRECTION_IN ; + } +if (gpio->reg_dat_base && !gpio->reg_set_base)return GPIO_LINE_DIRECTION_IN ;if (gpio->reg_set_base && !gpio->reg_dat_base)
@@ -284,6 +292,17 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config goto err_free_gpio; } +if (config->fixed_direction_output) { + gpio->fixed_direction_output =bitmap_alloc (chip->ngpio, +GFP_KERNEL ); +if (!gpio->fixed_direction_output) { + ret = -ENOMEM ; + goto err_free_gpio; + } +bitmap_copy (gpio->fixed_direction_output, + config->fixed_direction_output, chip->ngpio); + } +/* if not set, assume there is only one register */ gpio->ngpio_per_reg = config->ngpio_per_reg;if (!gpio->ngpio_per_reg)
@@ -300,7 +319,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config ret =gpiochip_add_data (chip, gpio);if (ret <0 ) - goto err_free_gpio; + goto err_free_bitmap;#ifdef CONFIG_REGMAP_IRQ if (config->regmap_irq_chip) {
@@ -309,7 +328,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config config->regmap_irq_line, config->regmap_irq_flags, 0, config->regmap_irq_chip, &gpio->irq_chip_data);if (ret) - goto err_free_gpio; + goto err_free_bitmap; irq_domain =regmap_irq_get_domain (gpio->irq_chip_data); }else
@@ -326,6 +345,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config err_remove_gpiochip:gpiochip_remove (chip); +err_free_bitmap: +bitmap_free (gpio->fixed_direction_output); err_free_gpio:kfree (gpio);return ERR_PTR (ret);
@@ -344,6 +365,7 @@ void gpio_regmap_unregister(struct gpio_regmap *gpio)#endif gpiochip_remove (&gpio->gpio_chip); +bitmap_free (gpio->fixed_direction_output);kfree (gpio); }EXPORT_SYMBOL_GPL (gpio_regmap_unregister);
include/linux/gpio/regmap.h +5 -0
@@ -38,6 +38,10 @@ struct regmap;* offset to a register/bitmask pair. If not * given the default gpio_regmap_simple_xlate() * is used. +* @fixed_direction_output: +* (Optional) Bitmap representing the fixed direction of +* the GPIO lines. Useful when there are GPIO lines with a +* fixed direction mixed together in the same register. * @drvdata: (Optional) Pointer to driver specific data which is * not used by gpio-remap but is provided "as is" to the * driver callback(s).
@@ -85,6 +89,7 @@ struct gpio_regmap_config {int reg_stride;int ngpio_per_reg;struct irq_domain *irq_domain; +unsigned long *fixed_direction_output;#ifdef CONFIG_REGMAP_IRQ struct regmap_irq_chip *regmap_irq_chip;
Signature · 1 line
2.25.1
Re: [PATCH v5 07/12] gpio: regmap: add the .fixed_direction_output configuration parameter
Quoted 6 lines
There are GPIO controllers such as the one present in the LX2160ARDB QIXIS FPGA which have fixed-direction input and output GPIO lines mixed together in a single register. This cannot be modeled using the gpio-regmap as-is since there is no way to present the true direction of a GPIO line.
Quoted 6 lines
In order to make this use case possible, add a new configuration parameter -
fixed_direction_output- into thegpio_regmap_configstructure. This will enable user drivers to provide a bitmap that represents the fixed direction of the GPIO lines.Signed-off-by Ioana Ciornei <[email protected]>
Re: [PATCH v5 07/12] gpio: regmap: add the .fixed_direction_output configuration parameter
In reply to Ioana CiorneiQuoted 12 lines · Ioana Ciornei
There are GPIO controllers such as the one present in the LX2160ARDB QIXIS FPGA which have fixed-direction input and output GPIO lines mixed together in a single register. This cannot be modeled using the gpio-regmap as-is since there is no way to present the true direction of a GPIO line.
In order to make this use case possible, add a new configuration parameter -
fixed_direction_output- into thegpio_regmap_configstructure. This will enable user drivers to provide a bitmap that represents the fixed direction of the GPIO lines.Signed-off-by Ioana Ciornei <[email protected]>
Quoted 13 lines
---
Changes in v2:
- Add thefixed_direction_outputbitmap to thegpio_regmap_configChanges in v3:
- Make a deep copy of the new bitmap.
- Remove the offset check against the ngpio.
- Added documentation for the new config field.
Changes in v4:
- Replace devres bitmap allocation withbitmap_alloc()andbitmap_free().
Changes in v5:
- Rebased on top of latest linux-next, change the extra goto statement.
PATCH v5 8/12 gpio: add QIXIS FPGA GPIO controller
In reply to Ioana CiorneiAdd support for the GPIO controller found on some QIXIS FPGAs in Layerscape boards such as LX2160ARDB and LS1046AQDS. This driver is using gpio-regmap.
A GPIO controller has a maximum of 8 lines (all found in the same register). Even within the same controller, the GPIO lines' direction is fixed, which mean that both input and output lines are found in the same register. This is why the driver also passed to gpio-regmap the newly added .fixed_direction_output bitmap to represent the true direction of the lines.
---
Changes in v2:
- Use the newly added .fixed_direction_output bitmap representing the fixed direction of the GPIO lines.
Changes in v3:
- Remove 'drivers' from the commit title.
- Remove the qixis_cpld_gpio_type enum since its not needed.
- Remove the NULL check for device_get_match_data().
- Use a bitmap declared on the stack as the config field passed to gpio-regmap.
Changes in v4:
- none
Changes in v5:
- none
drivers/gpio/Kconfig | 9 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-qixis-fpga.c | 107 +++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 drivers/gpio/gpio-qixis-fpga.c
drivers/gpio/Kconfig +9 -0
@@ -1986,6 +1986,15 @@ config GPIO_LATCH Say yes here to enable a driver for GPIO multiplexers based on latches connected to other GPIOs. +config GPIO_QIXIS_FPGA + tristate "NXP QIXIS FPGA GPIO support" + depends on MFD_SIMPLE_MFD_I2C || COMPILE_TEST + select GPIO_REGMAP + help + This enables support for the GPIOs found in the QIXIS FPGA which is + integrated on some NXP Layerscape boards such as LX2160ARDB and + LS1046AQDS. + config GPIO_MOCKUP tristate "GPIO Testing Driver (DEPRECATED)" select IRQ_SIM
drivers/gpio/Makefile +1 -0
@@ -146,6 +146,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o obj-$(CONFIG_GPIO_POLARFIRE_SOC) += gpio-mpfs.o obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o +obj-$(CONFIG_GPIO_QIXIS_FPGA) += gpio-qixis-fpga.o obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
drivers/gpio/gpio-qixis-fpga.c new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v5 08/12] gpio: add QIXIS FPGA GPIO controller
Quoted 11 lines
Add support for the GPIO controller found on some QIXIS FPGAs in Layerscape boards such as LX2160ARDB and LS1046AQDS. This driver is using gpio-regmap.
A GPIO controller has a maximum of 8 lines (all found in the same register). Even within the same controller, the GPIO lines' direction is fixed, which mean that both input and output lines are found in the same register. This is why the driver also passed to gpio-regmap the newly added .fixed_direction_output bitmap to represent the true direction of the lines.
Quoted 2 lines
Signed-off-by Ioana Ciornei <[email protected]>Reviewed-by Frank Li <[email protected]>
Re: [PATCH v5 08/12] gpio: add QIXIS FPGA GPIO controller
In reply to Ioana CiorneiQuoted 13 lines · Ioana Ciornei
Add support for the GPIO controller found on some QIXIS FPGAs in Layerscape boards such as LX2160ARDB and LS1046AQDS. This driver is using gpio-regmap.
A GPIO controller has a maximum of 8 lines (all found in the same register). Even within the same controller, the GPIO lines' direction is fixed, which mean that both input and output lines are found in the same register. This is why the driver also passed to gpio-regmap the newly added .fixed_direction_output bitmap to represent the true direction of the lines.
Signed-off-by Ioana Ciornei <[email protected]>Reviewed-by Frank Li <[email protected]>
Quoted 15 lines
---
Changes in v2:
- Use the newly added .fixed_direction_output bitmap representing the fixed direction of the GPIO lines.
Changes in v3:
- Remove 'drivers' from the commit title.
- Remove theqixis_cpld_gpio_typeenum since its not needed.
- Remove the NULL check fordevice_get_match_data().
- Use a bitmap declared on the stack as the config field passed to gpio-regmap.
Changes in v4:
- none
Changes in v5:
- none
Re: [PATCH v5 08/12] gpio: add QIXIS FPGA GPIO controller
In reply to Ioana CiorneiHi Ioana,
thanks for your patch!
Quoted 13 lines · Ioana Ciornei
Add support for the GPIO controller found on some QIXIS FPGAs in Layerscape boards such as LX2160ARDB and LS1046AQDS. This driver is using gpio-regmap.
A GPIO controller has a maximum of 8 lines (all found in the same register). Even within the same controller, the GPIO lines' direction is fixed, which mean that both input and output lines are found in the same register. This is why the driver also passed to gpio-regmap the newly added .fixed_direction_output bitmap to represent the true direction of the lines.
Signed-off-by Ioana Ciornei <[email protected]>Reviewed-by Frank Li <[email protected]>
(...)
Quoted 7 lines
+++ b/drivers/gpio/Kconfig
drivers/gpio/Kconfig +2
-0@@ -1986,6 +1986,15 @@ config GPIO_LATCH Say yes here to enable a driver for GPIO multiplexers based on latches connected to other GPIOs. +config GPIO_QIXIS_FPGA + tristate "NXP QIXIS FPGA GPIO support"
drivers/gpio/Kconfig config GPIO_LATCH · line 2000
Quoted 10 lines
drivers/gpio/Kconfig +7
-0+ depends on MFD_SIMPLE_MFD_I2C || COMPILE_TEST + select GPIO_REGMAP + help + This enables support for the GPIOs found in the QIXIS FPGA which is + integrated on some NXP Layerscape boards such as LX2160ARDB and + LS1046AQDS. + config GPIO_MOCKUP tristate "GPIO Testing Driver (DEPRECATED)" select IRQ_SIM
Why is this menu entry among the virtual GPIO drivers? Move it under the MFD menu where it should be, please.
With this fixed:
Yours,
Linus Walleij
PATCH v5 9/12 arm64: dts: lx2160a-rdb: describe the QIXIS FPGA and two child GPIO controllers
In reply to Ioana CiorneiDescribe the FPGA present on the LX2160ARDB board as a simple-mfd I2C device. The FPGA presents registers that deal with power-on-reset timing, muxing, SFP cage monitoring and control etc.
Also add the two GPIO controllers responsible for monitoring and controlling the SFP+ cages used for MAC5 and MAC6.
---
Changes in v2:
- Use the same compatible string for both GPIO controller nodes. Changes in v3:
- none
Changes in v4:
- none
Changes in v5:
- none
.../boot/dts/freescale/fsl-lx2160a-rdb.dts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts +31 -0
@@ -170,6 +170,37 @@ mt35xu512aba1: flash@1 { &i2c0 { status = "okay"; + cpld@66 { + compatible = "fsl,lx2160ardb-fpga"; + reg = <0x66>; + #address-cells = <1>; + #size-cells = <0>; + + sfp2_csr: gpio@19 { + compatible = "fsl,lx2160ardb-fpga-gpio-sfp"; + reg = <0x19>; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = + "SFP2_TX_EN", "", + "", "", + "SFP2_RX_LOS", "SFP2_TX_FAULT", + "", "SFP2_MOD_ABS"; + }; + + sfp3_csr: gpio@1a { + compatible = "fsl,lx2160ardb-fpga-gpio-sfp"; + reg = <0x1a>; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = + "SFP3_TX_EN", "", + "", "", + "SFP3_RX_LOS", "SFP3_TX_FAULT", + "", "SFP3_MOD_ABS"; + }; + }; + i2c-mux@77 { compatible = "nxp,pca9547"; reg = <0x77>;
Signature · 1 line
2.25.1
PATCH v5 10/12 arm64: dts: ls1046a-qds: describe the FPGA based GPIO controller
In reply to Ioana CiorneiThe QIXIS FPGA node is extended so that it describes the GPIO controller responsible for all the status presence lines on both SFP+ cages as well as the IO SLOTs present on the board.
---
Changes in v2:
- none
Changes in v3:
- none
Changes in v4:
- none
Changes in v5:
- none
arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts +12 -0
@@ -166,8 +166,20 @@ nand@1,0 { fpga: board-control@2,0 { compatible = "fsl,ls1046aqds-fpga", "fsl,fpga-qixis", "simple-mfd"; + #address-cells = <1>; + #size-cells = <1>; reg = <0x2 0x0 0x0000100>; ranges = <0 2 0 0x100>; + + stat_pres2: gpio@c { + compatible = "fsl,ls1046aqds-fpga-gpio-stat-pres2"; + reg = <0xc 1>; + gpio-controller; + #gpio-cells = <2>; + gpio-line-names = + "SLOT1", "SLOT2", "SLOT3", "SLOT4", "SLOT5", "SLOT6", + "SFP1_MOD_DEF", "SFP2_MOD_DEF"; + }; }; };
Signature · 1 line
2.25.1
PATCH v5 11/12 arm64: dts: lx2160a-rdb: fully describe the two SFP+ cages
In reply to Ioana CiorneiDescribe the two SFP+ cages found on the LX2160ARDB board with their respective I2C buses and GPIO lines.
---
Changes in v2:
- none
Changes in v3:
- Moved the reg property before address/cells-size. Changes in v4:
- none
Changes in v5:
- none
.../boot/dts/freescale/fsl-lx2160a-rdb.dts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/arm64/boot/dts/freescale/fsl-lx2160a-rdb.dts +47 -0
@@ -31,6 +31,28 @@ sb_3v3: regulator-sb3v3 { regulator-boot-on; regulator-always-on; }; + + sfp2: sfp-2 { + compatible = "sff,sfp"; + i2c-bus = <&sfp2_i2c>; + maximum-power-milliwatt = <2000>; + /* Leave commented out if using DPMAC_LINK_TYPE_FIXED mode */ + /* tx-disable-gpios = <&sfp2_csr 0 GPIO_ACTIVE_HIGH>; */ + los-gpios = <&sfp2_csr 4 GPIO_ACTIVE_HIGH>; + tx-fault-gpios = <&sfp2_csr 5 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&sfp2_csr 7 GPIO_ACTIVE_LOW>; + }; + + sfp3: sfp-3 { + compatible = "sff,sfp"; + i2c-bus = <&sfp3_i2c>; + maximum-power-milliwatt = <2000>; + /* Leave commented out if using DPMAC_LINK_TYPE_FIXED mode */ + /* tx-disable-gpios = <&sfp3_csr 0 GPIO_ACTIVE_HIGH>; */ + los-gpios = <&sfp3_csr 4 GPIO_ACTIVE_HIGH>; + tx-fault-gpios = <&sfp3_csr 5 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&sfp3_csr 7 GPIO_ACTIVE_LOW>; + }; }; &crypto {
@@ -236,6 +258,31 @@ temperature-sensor@4d { vcc-supply = <&sb_3v3>; }; }; + + i2c@7 { + reg = <0x7>; + #address-cells = <1>; + #size-cells = <0>; + + i2c-mux@75 { + compatible = "nxp,pca9547"; + reg = <0x75>; + #address-cells = <1>; + #size-cells = <0>; + + sfp2_i2c: i2c@4 { + reg = <0x4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp3_i2c: i2c@5 { + reg = <0x5>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; }; };
Signature · 1 line
2.25.1
PATCH v5 12/12 arm64: dts: ls1046a-qds: describe the two on-board SFP+ cages
In reply to Ioana CiorneiDescribe the two SFP+ cages present on the LS1046AQDS board and their associated I2C buses and GPIO lines.
---
Changes in v2:
- none
Changes in v3:
- Moved the reg property before address/cells-size. Changes in v4:
- none
Changes in v5:
- none
.../boot/dts/freescale/fsl-ls1046a-qds.dts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1046a-qds.dts +40 -0
@@ -42,6 +42,21 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; + + sfp1: sfp-1 { + compatible = "sff,sfp"; + i2c-bus = <&sfp1_i2c>; + maximum-power-milliwatt = <2000>; + mod-def0-gpios = <&stat_pres2 6 GPIO_ACTIVE_LOW>; + }; + + sfp2: sfp-2 { + compatible = "sff,sfp"; + i2c-bus = <&sfp2_i2c>; + maximum-power-milliwatt = <2000>; + mod-def0-gpios = <&stat_pres2 7 GPIO_ACTIVE_LOW>; + }; + }; &dspi {
@@ -139,6 +154,31 @@ temp-sensor@4c { reg = <0x4c>; }; }; + + i2c@7 { + reg = <0x7>; + #address-cells = <1>; + #size-cells = <0>; + + i2c-mux@76 { + compatible = "nxp,pca9547"; + reg = <0x76>; + #address-cells = <1>; + #size-cells = <0>; + + sfp1_i2c: i2c@6 { + reg = <0x6>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp2_i2c: i2c@7 { + reg = <0x7>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; }; };
Signature · 1 line
2.25.1
Re: (subset) [PATCH v5 00/12] drivers: gpio: and the QIXIS FPGA GPIO controller
In reply to Ioana CiorneiFrom: Bartosz Golaszewski <[email protected]>
Quoted 15 lines · Ioana Ciornei
This patch set adds support for the GPIO controllers on the QIXIS FPGAs found on some Layerscape boards such as LX2160ARDB and LS1046AQDS. At the same time it describes the SFP+ cages found on these boards, which are the users of those GPIO lines.
Before actually adding the GPIO driver, patches #2 and #3 add and describe a new compatible string - fsl,lx2160ardb-fpga - which would be used for the QIXIS FPGA found on the LX2160ARDB board. As opposed to the other compatible strings found in fsl,fpga-qixis-i2c.yaml, the fsl,lx2160ardb-fpga imposes a unit address for its child devices. This will be used in the next patches when the gpio controller node will define its unit address as the address of its underlying register offset inside the FPGA. This requirement is described in the yaml file and it only affects the newly added compatible.
Quoted 1 line
[...]
It's too late into the cycle for the entire series to make the v6.18 merge window but I queued this for fixes and will send it for v6.17.
[06/12] gpio: regmap: fix memory leak of gpio_regmap structure
https://git.kernel.org/brgl/linux/c/3bd44edd6c55828fd4e11cb0efce5b7160bfa2de
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
Re: (subset) [PATCH v5 00/12] drivers: gpio: and the QIXIS FPGA GPIO controller
Quoted 19 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Quoted 15 lines · Ioana Ciornei
This patch set adds support for the GPIO controllers on the QIXIS FPGAs found on some Layerscape boards such as LX2160ARDB and LS1046AQDS. At the same time it describes the SFP+ cages found on these boards, which are the users of those GPIO lines.
Before actually adding the GPIO driver, patches #2 and #3 add and describe a new compatible string - fsl,lx2160ardb-fpga - which would be used for the QIXIS FPGA found on the LX2160ARDB board. As opposed to the other compatible strings found in fsl,fpga-qixis-i2c.yaml, the fsl,lx2160ardb-fpga imposes a unit address for its child devices. This will be used in the next patches when the gpio controller node will define its unit address as the address of its underlying register offset inside the FPGA. This requirement is described in the yaml file and it only affects the newly added compatible.
Quoted 7 lines
Quoted 1 line
[...]
It's too late into the cycle for the entire series to make the v6.18 merge window but I queued this for fixes and will send it for v6.17.
[06/12] gpio: regmap: fix memory leak of
gpio_regmapstructurehttps://git.kernel.org/brgl/linux/c/3bd44edd6c55828fd4e11cb0efce5b7160bfa2de
Ok, sure.
I will re-submit after the merge window with what patches remain.
Ioana