* [PATCH v4 0/5] LogiCVC mfd and GPIO support
@ 2019-11-28 15:54 Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 1/5] dt-bindings: Add Xylon vendor prefix Paul Kocialkowski
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski
This series introduces support for the LogiCVC GPIO block to the syscon GPIO
driver, with dt bindings documentation also including the top-level mfd
component.
Changes since v3:
- Added collected tags;
- Kept syscon_gpio_data set function pointer line intact;
- Grouped declarations in a single line as requested.
Changes since v2:
- Fixed dt schema examples.
Changes since v1:
- Converted dt bindings documentation to dt schemas;
- Used BIT macro and removed version from structure name;
- Improved documentation example with gpio-line-names;
- Added vendor prefix to dt bindings;
- Added mfd component dt bindings documentation.
Cheers,
Paul
Paul Kocialkowski (5):
dt-bindings: Add Xylon vendor prefix
dt-bindings: mfd: Document the Xylon LogiCVC multi-function device
gpio: syscon: Add support for a custom get operation
dt-bindings: gpio: Document the Xylon LogiCVC GPIO controller
gpio: syscon: Add support for the Xylon LogiCVC GPIOs
.../bindings/gpio/xylon,logicvc-gpio.yaml | 69 +++++++++++++++++++
.../bindings/mfd/xylon,logicvc.yaml | 50 ++++++++++++++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
drivers/gpio/gpio-syscon.c | 68 +++++++++++++++++-
4 files changed, 188 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml
create mode 100644 Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml
--
2.24.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v4 1/5] dt-bindings: Add Xylon vendor prefix
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
@ 2019-11-28 15:54 ` Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 2/5] dt-bindings: mfd: Document the Xylon LogiCVC multi-function device Paul Kocialkowski
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski, Rob Herring
Xylon is an electronics company that produces FPGA hardware block designs
optimized for Xilinx FPGAs.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index fd6fa07c45b8..e7f7bf7c1c22 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1056,6 +1056,8 @@ patternProperties:
description: Xilinx
"^xunlong,.*":
description: Shenzhen Xunlong Software CO.,Limited
+ "^xylon,.*":
+ description: Xylon
"^yones-toptech,.*":
description: Yones Toptech Co., Ltd.
"^ysoft,.*":
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/5] dt-bindings: mfd: Document the Xylon LogiCVC multi-function device
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 1/5] dt-bindings: Add Xylon vendor prefix Paul Kocialkowski
@ 2019-11-28 15:54 ` Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 3/5] gpio: syscon: Add support for a custom get operation Paul Kocialkowski
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski, Rob Herring
The LogiCVC is a display engine which also exposes GPIO functionality.
For this reason, it is described as a multi-function device that is expected
to provide register access to its children nodes for gpio and display.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/mfd/xylon,logicvc.yaml | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml
diff --git a/Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml b/Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml
new file mode 100644
index 000000000000..abc9937506e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Bootlin
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/mfd/xylon,logicvc.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Xylon LogiCVC multi-function device
+
+maintainers:
+ - Paul Kocialkowski <paul.kocialkowski@bootlin.com>
+
+description: |
+ The LogiCVC is a display controller that also contains a GPIO controller.
+ As a result, a multi-function device is exposed as parent of the display
+ and GPIO blocks.
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - xylon,logicvc-3.02.a
+ - const: syscon
+ - const: simple-mfd
+
+ reg:
+ maxItems: 1
+
+select:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - xylon,logicvc-3.02.a
+
+ required:
+ - compatible
+
+required:
+ - compatible
+ - reg
+
+examples:
+ - |
+ logicvc: logicvc@43c00000 {
+ compatible = "xylon,logicvc-3.02.a", "syscon", "simple-mfd";
+ reg = <0x43c00000 0x6000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 3/5] gpio: syscon: Add support for a custom get operation
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 1/5] dt-bindings: Add Xylon vendor prefix Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 2/5] dt-bindings: mfd: Document the Xylon LogiCVC multi-function device Paul Kocialkowski
@ 2019-11-28 15:54 ` Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 4/5] dt-bindings: gpio: Document the Xylon LogiCVC GPIO controller Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs Paul Kocialkowski
4 siblings, 0 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski
Some drivers might need a custom get operation to match custom
behavior implemented in the set operation.
Add plumbing for supporting that.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
drivers/gpio/gpio-syscon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 31f332074d7d..36136b7f3a3b 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -43,6 +43,7 @@ struct syscon_gpio_data {
unsigned int bit_count;
unsigned int dat_bit_offset;
unsigned int dir_bit_offset;
+ int (*get)(struct gpio_chip *chip, unsigned offset);
void (*set)(struct gpio_chip *chip,
unsigned offset, int value);
};
@@ -252,7 +253,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
priv->chip.label = dev_name(dev);
priv->chip.base = -1;
priv->chip.ngpio = priv->data->bit_count;
- priv->chip.get = syscon_gpio_get;
+ priv->chip.get = priv->data->get ? : syscon_gpio_get;
if (priv->data->flags & GPIO_SYSCON_FEAT_IN)
priv->chip.direction_input = syscon_gpio_dir_in;
if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) {
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 4/5] dt-bindings: gpio: Document the Xylon LogiCVC GPIO controller
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
` (2 preceding siblings ...)
2019-11-28 15:54 ` [PATCH v4 3/5] gpio: syscon: Add support for a custom get operation Paul Kocialkowski
@ 2019-11-28 15:54 ` Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs Paul Kocialkowski
4 siblings, 0 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski, Rob Herring
The Xylon LogiCVC display controller exports some GPIOs, which are
exposed as a separate entity.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
.../bindings/gpio/xylon,logicvc-gpio.yaml | 69 +++++++++++++++++++
1 file changed, 69 insertions(+)
create mode 100644 Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml
diff --git a/Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml b/Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml
new file mode 100644
index 000000000000..d102888c1be7
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Bootlin
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/gpio/xylon,logicvc-gpio.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Xylon LogiCVC GPIO controller
+
+maintainers:
+ - Paul Kocialkowski <paul.kocialkowski@bootlin.com>
+
+description: |
+ The LogiCVC GPIO describes the GPIO block included in the LogiCVC display
+ controller. These are meant to be used for controlling display-related
+ signals.
+
+ The controller exposes GPIOs from the display and power control registers,
+ which are mapped by the driver as follows:
+ - GPIO[4:0] (display control) mapped to index 0-4
+ - EN_BLIGHT (power control) mapped to index 5
+ - EN_VDD (power control) mapped to index 6
+ - EN_VEE (power control) mapped to index 7
+ - V_EN (power control) mapped to index 8
+
+properties:
+ $nodename:
+ pattern: "^gpio@[0-9a-f]+$"
+
+ compatible:
+ enum:
+ - xylon,logicvc-3.02.a-gpio
+
+ reg:
+ maxItems: 1
+
+ "#gpio-cells":
+ const: 2
+
+ gpio-controller: true
+
+ gpio-line-names:
+ minItems: 1
+ maxItems: 9
+
+required:
+ - compatible
+ - reg
+ - "#gpio-cells"
+ - gpio-controller
+
+examples:
+ - |
+ logicvc: logicvc@43c00000 {
+ compatible = "xylon,logicvc-3.02.a", "syscon", "simple-mfd";
+ reg = <0x43c00000 0x6000>;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ logicvc_gpio: gpio@40 {
+ compatible = "xylon,logicvc-3.02.a-gpio";
+ reg = <0x40 0x40>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names = "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4",
+ "EN_BLIGHT", "EN_VDD", "EN_VEE", "V_EN";
+ };
+ };
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
` (3 preceding siblings ...)
2019-11-28 15:54 ` [PATCH v4 4/5] dt-bindings: gpio: Document the Xylon LogiCVC GPIO controller Paul Kocialkowski
@ 2019-11-28 15:54 ` Paul Kocialkowski
2019-11-29 9:24 ` Linus Walleij
4 siblings, 1 reply; 8+ messages in thread
From: Paul Kocialkowski @ 2019-11-28 15:54 UTC (permalink / raw)
To: linux-gpio, devicetree, linux-kernel
Cc: Linus Walleij, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni, Paul Kocialkowski
The LogiCVC display hardware block comes with GPIO capabilities
that must be exposed separately from the main driver (as GPIOs) for
use with regulators and panels. A syscon is used to share the same
regmap across the two drivers.
Since the GPIO capabilities are pretty simple, add them to the syscon
GPIO driver.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
drivers/gpio/gpio-syscon.c | 65 ++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 36136b7f3a3b..cf1127f81824 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -190,6 +190,67 @@ static const struct syscon_gpio_data keystone_dsp_gpio = {
.set = keystone_gpio_set,
};
+#define LOGICVC_CTRL_REG 0x40
+#define LOGICVC_CTRL_GPIO_SHIFT 11
+#define LOGICVC_CTRL_GPIO_BITS 5
+
+#define LOGICVC_POWER_CTRL_REG 0x78
+#define LOGICVC_POWER_CTRL_GPIO_SHIFT 0
+#define LOGICVC_POWER_CTRL_GPIO_BITS 4
+
+static void logicvc_gpio_offset(struct syscon_gpio_priv *priv,
+ unsigned offset, unsigned int *reg,
+ unsigned int *bit)
+{
+ if (offset >= LOGICVC_CTRL_GPIO_BITS) {
+ *reg = LOGICVC_POWER_CTRL_REG;
+
+ /* To the (virtual) power ctrl offset. */
+ offset -= LOGICVC_CTRL_GPIO_BITS;
+ /* To the actual bit offset in reg. */
+ offset += LOGICVC_POWER_CTRL_GPIO_SHIFT;
+ } else {
+ *reg = LOGICVC_CTRL_REG;
+
+ /* To the actual bit offset in reg. */
+ offset += LOGICVC_CTRL_GPIO_SHIFT;
+ }
+
+ *bit = BIT(offset);
+}
+
+static int logicvc_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+ struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
+ unsigned int reg, bit, value;
+ int ret;
+
+ logicvc_gpio_offset(priv, offset, ®, &bit);
+
+ ret = regmap_read(priv->syscon, reg, &value);
+ if (ret)
+ return ret;
+
+ return !!(value & bit);
+}
+
+static void logicvc_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
+{
+ struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
+ unsigned int reg, bit;
+
+ logicvc_gpio_offset(priv, offset, ®, &bit);
+
+ regmap_update_bits(priv->syscon, reg, bit, val ? bit : 0);
+}
+
+static const struct syscon_gpio_data logicvc_gpio = {
+ .flags = GPIO_SYSCON_FEAT_OUT,
+ .bit_count = LOGICVC_CTRL_GPIO_BITS + LOGICVC_POWER_CTRL_GPIO_BITS,
+ .get = logicvc_gpio_get,
+ .set = logicvc_gpio_set,
+};
+
static const struct of_device_id syscon_gpio_ids[] = {
{
.compatible = "cirrus,ep7209-mctrl-gpio",
@@ -203,6 +264,10 @@ static const struct of_device_id syscon_gpio_ids[] = {
.compatible = "rockchip,rk3328-grf-gpio",
.data = &rockchip_rk3328_gpio_mute,
},
+ {
+ .compatible = "xylon,logicvc-3.02.a-gpio",
+ .data = &logicvc_gpio,
+ },
{ }
};
MODULE_DEVICE_TABLE(of, syscon_gpio_ids);
--
2.24.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs
2019-11-28 15:54 ` [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs Paul Kocialkowski
@ 2019-11-29 9:24 ` Linus Walleij
2019-12-03 8:57 ` Paul Kocialkowski
0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2019-11-29 9:24 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: open list:GPIO SUBSYSTEM,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
linux-kernel, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni
Hi Paul,
thanks for your patch!
On Thu, Nov 28, 2019 at 4:54 PM Paul Kocialkowski
<paul.kocialkowski@bootlin.com> wrote:
> The LogiCVC display hardware block comes with GPIO capabilities
> that must be exposed separately from the main driver (as GPIOs) for
> use with regulators and panels. A syscon is used to share the same
> regmap across the two drivers.
>
> Since the GPIO capabilities are pretty simple, add them to the syscon
> GPIO driver.
>
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
(...)
> +#define LOGICVC_CTRL_REG 0x40
> +#define LOGICVC_CTRL_GPIO_SHIFT 11
> +#define LOGICVC_CTRL_GPIO_BITS 5
> +
> +#define LOGICVC_POWER_CTRL_REG 0x78
> +#define LOGICVC_POWER_CTRL_GPIO_SHIFT 0
> +#define LOGICVC_POWER_CTRL_GPIO_BITS 4
> +
> +static void logicvc_gpio_offset(struct syscon_gpio_priv *priv,
> + unsigned offset, unsigned int *reg,
> + unsigned int *bit)
> +{
> + if (offset >= LOGICVC_CTRL_GPIO_BITS) {
> + *reg = LOGICVC_POWER_CTRL_REG;
> +
> + /* To the (virtual) power ctrl offset. */
> + offset -= LOGICVC_CTRL_GPIO_BITS;
> + /* To the actual bit offset in reg. */
> + offset += LOGICVC_POWER_CTRL_GPIO_SHIFT;
> + } else {
> + *reg = LOGICVC_CTRL_REG;
> +
> + /* To the actual bit offset in reg. */
> + offset += LOGICVC_CTRL_GPIO_SHIFT;
> + }
> +
> + *bit = BIT(offset);
> +}
The gpio-syscon.c is for simple syscons where the lines
you want to affect are nicely ordered in the registers.
It is intended to be generic.
This is kind of shoehorning a special case into the generic
code.
Isn't it more appropriate to create a specific driver for this
hardware?
Special get/set quirks for any possible quirky offset is
certainly not the way to go, if this should be supported
we need generic properties in struct syscon_gpio_data
to indicate the valid bits and offsets.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs
2019-11-29 9:24 ` Linus Walleij
@ 2019-12-03 8:57 ` Paul Kocialkowski
0 siblings, 0 replies; 8+ messages in thread
From: Paul Kocialkowski @ 2019-12-03 8:57 UTC (permalink / raw)
To: Linus Walleij
Cc: open list:GPIO SUBSYSTEM,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
linux-kernel, Bartosz Golaszewski, Rob Herring, Mark Rutland,
Lee Jones, Thomas Petazzoni
[-- Attachment #1: Type: text/plain, Size: 2781 bytes --]
Hi Linus,
On Fri 29 Nov 19, 10:24, Linus Walleij wrote:
> Hi Paul,
>
> thanks for your patch!
>
> On Thu, Nov 28, 2019 at 4:54 PM Paul Kocialkowski
> <paul.kocialkowski@bootlin.com> wrote:
>
> > The LogiCVC display hardware block comes with GPIO capabilities
> > that must be exposed separately from the main driver (as GPIOs) for
> > use with regulators and panels. A syscon is used to share the same
> > regmap across the two drivers.
> >
> > Since the GPIO capabilities are pretty simple, add them to the syscon
> > GPIO driver.
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> (...)
> > +#define LOGICVC_CTRL_REG 0x40
> > +#define LOGICVC_CTRL_GPIO_SHIFT 11
> > +#define LOGICVC_CTRL_GPIO_BITS 5
> > +
> > +#define LOGICVC_POWER_CTRL_REG 0x78
> > +#define LOGICVC_POWER_CTRL_GPIO_SHIFT 0
> > +#define LOGICVC_POWER_CTRL_GPIO_BITS 4
> > +
> > +static void logicvc_gpio_offset(struct syscon_gpio_priv *priv,
> > + unsigned offset, unsigned int *reg,
> > + unsigned int *bit)
> > +{
> > + if (offset >= LOGICVC_CTRL_GPIO_BITS) {
> > + *reg = LOGICVC_POWER_CTRL_REG;
> > +
> > + /* To the (virtual) power ctrl offset. */
> > + offset -= LOGICVC_CTRL_GPIO_BITS;
> > + /* To the actual bit offset in reg. */
> > + offset += LOGICVC_POWER_CTRL_GPIO_SHIFT;
> > + } else {
> > + *reg = LOGICVC_CTRL_REG;
> > +
> > + /* To the actual bit offset in reg. */
> > + offset += LOGICVC_CTRL_GPIO_SHIFT;
> > + }
> > +
> > + *bit = BIT(offset);
> > +}
>
> The gpio-syscon.c is for simple syscons where the lines
> you want to affect are nicely ordered in the registers.
> It is intended to be generic.
>
> This is kind of shoehorning a special case into the generic
> code.
>
> Isn't it more appropriate to create a specific driver for this
> hardware?
Yes I'm fine with that too. Indeed the driver has custom set/get operations
that don't really fit well into generic code.
> Special get/set quirks for any possible quirky offset is
> certainly not the way to go, if this should be supported
> we need generic properties in struct syscon_gpio_data
> to indicate the valid bits and offsets.
I guess the rationale would be to define multiple possible bit offsets for
different ranges of GPIO offsets, but I don't think it would be very useful
outside of this case.
I'll probably craft a new version with a dedicated driver then.
Cheers,
Paul
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-12-03 8:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28 15:54 [PATCH v4 0/5] LogiCVC mfd and GPIO support Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 1/5] dt-bindings: Add Xylon vendor prefix Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 2/5] dt-bindings: mfd: Document the Xylon LogiCVC multi-function device Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 3/5] gpio: syscon: Add support for a custom get operation Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 4/5] dt-bindings: gpio: Document the Xylon LogiCVC GPIO controller Paul Kocialkowski
2019-11-28 15:54 ` [PATCH v4 5/5] gpio: syscon: Add support for the Xylon LogiCVC GPIOs Paul Kocialkowski
2019-11-29 9:24 ` Linus Walleij
2019-12-03 8:57 ` Paul Kocialkowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).