diff mbox series

[v4,1/2] dt-bindings: gpio: Add Spreadtrum GPIO controller documentation

Message ID c2db9b3b5c611cadfbe5ea97327be7ee5981fa54.1519360872.git.baolin.wang@linaro.org
State Superseded
Headers show
Series [v4,1/2] dt-bindings: gpio: Add Spreadtrum GPIO controller documentation | expand

Commit Message

(Exiting) Baolin Wang Feb. 23, 2018, 4:44 a.m. UTC
This patch adds the device tree bindings for the Spreadtrum
GPIO controller. The gpios will be supported by the GPIO
generic library.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

Acked-by: Rob Herring <robh@kernel.org>

---
Changes since v3:
 - Add acked tag from Rob.

Changes since v2:
 - No updates.

Changes since v1:
 - No updates.
---
 .../devicetree/bindings/gpio/gpio-sprd.txt         |   28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-sprd.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andy Shevchenko Feb. 23, 2018, 1:35 p.m. UTC | #1
On Fri, Feb 23, 2018 at 6:44 AM, Baolin Wang <baolin.wang@linaro.org> wrote:
> The Spreadtrum SC9860 platform GPIO controller contains 16 groups and

> each group contains 16 GPIOs. Each GPIO can set input/output and has

> the interrupt capability.

>


Sorry, couple comments below.

> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


> +/* We have 16 banks GPIOs and each bank contain 16 GPIOs */

> +#define SPRD_GPIO_BANK_NR      16

> +#define SPRD_GPIO_NR           256


> +#define SPRD_GPIO_BANK_SIZE    0x80


128 ?

> +       irq->handler = handle_simple_irq;


Shouldn't be handle_bad_irq() ?


> +static const struct of_device_id sprd_gpio_of_match[] = {

> +       { .compatible = "sprd,sc9860-gpio", },


> +       { /* end of list */ },


Comma is redundant. Absence of it even better at compile time if at
some weird case the item goes after a terminator.

> +};


-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
(Exiting) Baolin Wang Feb. 24, 2018, 1:57 a.m. UTC | #2
Hi Andy,

On 23 February 2018 at 21:35, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Fri, Feb 23, 2018 at 6:44 AM, Baolin Wang <baolin.wang@linaro.org> wrote:

>> The Spreadtrum SC9860 platform GPIO controller contains 16 groups and

>> each group contains 16 GPIOs. Each GPIO can set input/output and has

>> the interrupt capability.

>>

>

> Sorry, couple comments below.

>

>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

>> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

>

>> +/* We have 16 banks GPIOs and each bank contain 16 GPIOs */

>> +#define SPRD_GPIO_BANK_NR      16

>> +#define SPRD_GPIO_NR           256

>

>> +#define SPRD_GPIO_BANK_SIZE    0x80

>

> 128 ?


Um, I still would like to use 0x80 here to keep consistent with our GPIO Spec.

>

>> +       irq->handler = handle_simple_irq;

>

> Shouldn't be handle_bad_irq() ?


Yes, handle_bad_irq() is better.

>> +static const struct of_device_id sprd_gpio_of_match[] = {

>> +       { .compatible = "sprd,sc9860-gpio", },

>

>> +       { /* end of list */ },

>

> Comma is redundant. Absence of it even better at compile time if at

> some weird case the item goes after a terminator.


Sure. Thanks.

-- 
Baolin.wang
Best Regards
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/gpio-sprd.txt b/Documentation/devicetree/bindings/gpio/gpio-sprd.txt
new file mode 100644
index 0000000..eca97d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-sprd.txt
@@ -0,0 +1,28 @@ 
+Spreadtrum GPIO controller bindings
+
+The controller's registers are organized as sets of sixteen 16-bit
+registers with each set controlling a bank of up to 16 pins. A single
+interrupt is shared for all of the banks handled by the controller.
+
+Required properties:
+- compatible: Should be "sprd,sc9860-gpio".
+- reg: Define the base and range of the I/O address space containing
+the GPIO controller registers.
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells: Should be <2>. The first cell is the gpio number and
+the second cell is used to specify optional parameters.
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells: Should be <2>. Specifies the number of cells needed
+to encode interrupt source.
+- interrupts: Should be the port interrupt shared by all the gpios.
+
+Example:
+	ap_gpio: gpio@40280000 {
+		compatible = "sprd,sc9860-gpio";
+		reg = <0 0x40280000 0 0x1000>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+	};