Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v10] gpio: add a driver for the Synopsys DesignWare APB GPIO block
From: delicious quinoa @ 2014-02-06 22:09 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Linus Walleij, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, Jamie Iles,
	devicetree@vger.kernel.org, Grant Likely, rob.herring@calxeda.com,
	Steffen Trumtrar, Sebastian Hesselbarth, Heiko Stuebner,
	Alan Tull, Dinh Nguyen, Yves Vandervennet
In-Reply-To: <20140206170325.GF16551@e106331-lin.cambridge.arm.com>

On Thu, Feb 6, 2014 at 11:03 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Thu, Feb 06, 2014 at 03:55:47PM +0000, Alan Tull wrote:
>> From: Jamie Iles <jamie@jamieiles.com>
>>
>> The Synopsys DesignWare block is used in some ARM devices (picoxcell)
>> and can be configured to provide multiple banks of GPIO pins.
>>
>> Signed-off-by: Jamie Iles <jamie@jamieiles.com>
>> Signed-off-by: Alan Tull <atull@altera.com>
>> Reviewed-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>>
>> v10:    - in documentation nr-gpio -> nr-gpios
>> v9:     - cleanup in dt bindings doc
>>         - use of_get_child_count()
>> v8:     - remove socfpga.dtsi changes
>>         - minor cleanup in devicetree documentation
>> v7:     - use irq_generic_chip
>>         - support one irq per gpio line or one irq for many
>>         - s/bank/port/ and other cleanup
>> v6:     - (atull) squash the set of patches
>>         - use linear irq domain
>>         - build fixes. Original driver was reviewed on v3.2.
>>         - Fix setting irq edge type for 'rising' and 'both'.
>>         - Support as a loadable module.
>>         - Use bgpio_chip's spinlock during register access.
>>         - Clean up register names to match spec
>>         - s/bank/port/ because register names use the word 'port'
>>         - s/nr-gpio/nr-gpios/
>>         - don't get/put the of_node
>>         - remove signoffs/acked-by's because of changes
>>         - other cleanup
>> v5:     - handle sparse bank population correctly
>> v3:     - depend on rather than select IRQ_DOMAIN
>>         - split IRQ support into a separate patch
>> v2:     - use Rob Herring's irqdomain in generic irq chip patches
>>         - use reg property to indicate bank index
>>         - support irqs on both edges based on LinusW's u300 driver
>> ---
>>  .../devicetree/bindings/gpio/snps-dwapb-gpio.txt   |   59 +++
>>  drivers/gpio/Kconfig                               |    9 +
>>  drivers/gpio/Makefile                              |    1 +
>>  drivers/gpio/gpio-dwapb.c                          |  415 ++++++++++++++++++++
>>  4 files changed, 484 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
>>  create mode 100644 drivers/gpio/gpio-dwapb.c
>>
>> diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
>> new file mode 100644
>> index 0000000..cb01f9f
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
>> @@ -0,0 +1,59 @@
>> +* Synopsys DesignWare APB GPIO controller
>> +
>> +Required properties:
>> +- compatible : Should contain "snps,dw-apb-gpio"
>> +- reg : Address and length of the register set for the device
>
> Presumably #address-cells and #size-cells should be described here?
>
>> +
>> +The GPIO controller has a configurable number of ports, each of which are
>> +represented as child nodes with the following properties:
>> +
>> +Required properties:
>> +- compatible : "snps,dw-apb-gpio-port"
>> +- gpio-controller : Marks the device node as a gpio controller.
>> +- #gpio-cells : Should be two.  The first cell is the pin number and
>> +  the second cell is used to specify optional parameters (currently
>> +  unused).
>
> Why not just have this as one cell for now if the second cell is unused?
>
> If it needs to be expanded the driver can read #gpio-cells to figure out
> what to do at runtime, and it prevents crap DTSs in the mean time that
> could get in the way if you need to use additional cells in future.
>
>> +- reg : The integer port index of the port, a single cell.
>> +- #address-cells : should be 1.
>> +- #size-cells : should be 0.
>
> As mentioned above, presumably #address-cells and #size-cells should be
> in the parent node, as is the case in the example?
>
>> +
>> +Optional properties:
>> +- interrupt-controller : The first port may be configured to be an interrupt
>> +controller.
>> +- #interrupt-cells : Specifies the number of cells needed to encode an
>> +interrupt.  Shall be set to 2.  The first cell defines the interrupt number,
>> +the second encodes the triger flags encoded as described in
>> +Documentation/devicetree/bindings/interrupts.txt
>> +- interrupt-parent : The parent interrupt controller.
>> +- interrupts : The interrupts to the parent controller raised when GPIOs
>> +generate the interrupts.
>
> How many are expected?
>
> Otherwise, the binding looks ok to me.
>
> [...]
>
>> +static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
>> +                                struct dwapb_gpio_port *port)
>> +{
>> +       struct gpio_chip *gc = &port->bgc.gc;
>> +       struct device_node *node =  gc->of_node;
>> +       struct irq_chip_generic *irq_gc;
>> +       unsigned int hwirq, ngpio = gc->ngpio;
>> +       struct irq_chip_type *ct;
>> +       int reg, err, irq;
>> +
>> +       if (of_get_property(node, "interrupts", &reg) == NULL)
>> +               return;
>
> of_get_property can take a NULL lenp (core OF code depends on this
> fact), so you don't need the somewhat confusing &reg here.
>
> Cheers,
> Mark.

Hi Mark,

Thanks for the feedback.  I have made the changes in v11, which I just sent out.

Alan Tull
aka
delicious quinoa

^ permalink raw reply

* Re: [PATCH v2 1/5] drivers: of: add initialization code for reserved memory
From: Laura Abbott @ 2014-02-06 22:08 UTC (permalink / raw)
  To: Marek Szyprowski, linux-kernel, linux-arm-kernel, linaro-mm-sig,
	devicetree, linux-doc
  Cc: Mark Rutland, Pawel Moll, Arnd Bergmann, Stephen Warren,
	Josh Cartwright, Benjamin Herrenschmidt, Tomasz Figa,
	Olof Johansson, Tomasz Figa, Michal Nazarewicz, Rob Herring,
	Kyungmin Park, Kumar Gala, Grant Likely, Ian Campbell,
	Nishanth Peethambaran, Sascha Hauer, Marc
In-Reply-To: <1391515773-6112-2-git-send-email-m.szyprowski@samsung.com>

Hi,

On 2/4/2014 4:09 AM, Marek Szyprowski wrote:
...
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index efd05102c405..ed9660adad77 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -9,3 +9,4 @@ obj-$(CONFIG_OF_MDIO)	+= of_mdio.o
>   obj-$(CONFIG_OF_PCI)	+= of_pci.o
>   obj-$(CONFIG_OF_PCI_IRQ)  += of_pci_irq.o
>   obj-$(CONFIG_OF_MTD)	+= of_mtd.o
> +obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> new file mode 100644
> index 000000000000..f17cd56e68d9
> --- /dev/null
> +++ b/drivers/of/of_reserved_mem.c
> @@ -0,0 +1,219 @@
> +/*
> + * Device tree based initialization code for reserved memory.
> + *
> + * Copyright (c) 2013, The Linux Foundation. All Rights Reserved.
> + * Copyright (c) 2013 Samsung Electronics Co., Ltd.
> + *		http://www.samsung.com
> + * Author: Marek Szyprowski <m.szyprowski@samsung.com>
> + * Author: Josh Cartwright <joshc@codeaurora.org>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of the
> + * License or (at your optional) any later version of the license.
> + */
> +#include <linux/memblock.h>
> +#include <linux/err.h>
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +#include <linux/of_platform.h>
> +#include <linux/mm.h>
> +#include <linux/sizes.h>
> +#include <linux/of_reserved_mem.h>
> +
> +#define MAX_RESERVED_REGIONS	16

Make this a config option?

> +static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
> +static int reserved_mem_count;
> +
> +int __init of_parse_flat_dt_reg(unsigned long node, const char *uname,
> +				   phys_addr_t *base, phys_addr_t *size)
> +{
> +	unsigned long len;
> +	__be32 *prop;
> +
> +	prop = of_get_flat_dt_prop(node, "reg", &len);
> +	if (!prop)
> +		return -EINVAL;
> +
> +	if (len < (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32)) {
> +		pr_err("Reserved memory: invalid reg property in '%s' node.\n",
> +				uname);
> +		return -EINVAL;
> +	}
> +
> +	*base = dt_mem_next_cell(dt_root_addr_cells, &prop);
> +	*size = dt_mem_next_cell(dt_root_size_cells, &prop);
> +	return 0;
> +}
> +
> +int __init of_parse_flat_dt_size(unsigned long node, const char *uname,
> +				    phys_addr_t *size)
> +{
> +	unsigned long len;
> +	__be32 *prop;
> +
> +	prop = of_get_flat_dt_prop(node, "size", &len);
> +	if (!prop)
> +		return -EINVAL;
> +
> +	if (len < dt_root_size_cells * sizeof(__be32)) {
> +		pr_err("Reserved memory: invalid size property in '%s' node.\n",
> +				uname);
> +		return -EINVAL;
> +	}
> +
> +	*size = dt_mem_next_cell(dt_root_size_cells, &prop);
> +	return 0;
> +}
> +
> +static int __init rmem_default_early_setup(struct reserved_mem *rmem,
> +					   unsigned long node,
> +					   const char *uname)
> +{
> +	int err;
> +
> +	if (of_get_flat_dt_prop(node, "compatible", NULL))
> +		return -EINVAL;
> +
> +	err = of_parse_flat_dt_reg(node, uname, &rmem->base, &rmem->size);
> +	if (err)
> +		return err;
> +
> +	if (of_get_flat_dt_prop(node, "no-map", NULL))
> +		err = memblock_remove(rmem->base, rmem->size);
> +	else
> +		err = memblock_reserve(rmem->base, rmem->size);
> +

The CMA code aligns to pageblock size, do we need to do something 
similar here as well? With reserved it might not be much of an issue but 
we've hit issues before with non-pageblock aligned memblock_removed 
memory because the page structures are not initialized.

> +	if (err == 0)
> +		pr_info("Reserved memory: found '%s', memory base %pa, size %ld MiB\n",
> +			uname, &rmem->base, (unsigned long)rmem->size / SZ_1M);
> +
> +	return err;
> +}
> +
> +static const struct of_device_id rmem_default_id
> +	__used __section(__reservedmem_of_table_end) = {
> +	.data		= rmem_default_early_setup,
> +};
> +
> +static int __init fdt_scan_reserved_mem(unsigned long node, const char *uname,
> +					int depth, void *data)
> +{
> +	struct reserved_mem *rmem = &reserved_mem[reserved_mem_count];
> +	extern const struct of_device_id __reservedmem_of_table[];
> +	const struct of_device_id *id;
> +	const char *status;
> +
> +	if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) {
> +		pr_err("Reserved memory: not enough space all defined regions.\n");
> +		return -ENOSPC;
> +	}
> +
> +	status = of_get_flat_dt_prop(node, "status", NULL);
> +	if (status && strcmp(status, "okay") != 0)
> +		return 0;
> +

strncmp(status, "ok", 2) to handle alternate spellings

>

Thanks,
Laura

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply

* [PATCH v11] gpio: add a driver for the Synopsys DesignWare APB GPIO block
From: Alan Tull @ 2014-02-06 22:06 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-kernel, linux-gpio, linux-doc, Jamie Iles,
	devicetree@vger.kernel.org, Mark Rutland, Grant Likely,
	Rob Herring, Steffen Trumtrar, Sebastian Hesselbarth,
	delicious quinoa, Heiko Stuebner, Alan Tull, Dinh Nguyen,
	Yves Vandervennet

From: Jamie Iles <jamie@jamieiles.com>

The Synopsys DesignWare block is used in some ARM devices (picoxcell)
and can be configured to provide multiple banks of GPIO pins.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Alan Tull <atull@altera.com>
Reviewed-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

v11: - Use NULL when checking existence of 'interrupts' property
     - Bindings descriptions cleanup
v10: - in documentation nr-gpio -> nr-gpios
v9:  - cleanup in dt bindings doc
     - use of_get_child_count()
v8:  - remove socfpga.dtsi changes
     - minor cleanup in devicetree documentation
v7:  - use irq_generic_chip
     - support one irq per gpio line or one irq for many
     - s/bank/port/ and other cleanup
v6:  - (atull) squash the set of patches
     - use linear irq domain
     - build fixes. Original driver was reviewed on v3.2.
     - Fix setting irq edge type for 'rising' and 'both'.
     - Support as a loadable module.
     - Use bgpio_chip's spinlock during register access.
     - Clean up register names to match spec
     - s/bank/port/ because register names use the word 'port'
     - s/nr-gpio/nr-gpios/
     - don't get/put the of_node
     - remove signoffs/acked-by's because of changes
     - other cleanup
v5:  - handle sparse bank population correctly
v3:  - depend on rather than select IRQ_DOMAIN
     - split IRQ support into a separate patch
v2:  - use Rob Herring's irqdomain in generic irq chip patches
     - use reg property to indicate bank index
     - support irqs on both edges based on LinusW's u300 driver
---
 .../devicetree/bindings/gpio/snps-dwapb-gpio.txt   |   58 +++
 drivers/gpio/Kconfig                               |    9 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-dwapb.c                          |  415 ++++++++++++++++++++
 4 files changed, 483 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
 create mode 100644 drivers/gpio/gpio-dwapb.c

diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
new file mode 100644
index 0000000..38c2224
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt
@@ -0,0 +1,58 @@
+* Synopsys DesignWare APB GPIO controller
+
+Required properties:
+- compatible : Should contain "snps,dw-apb-gpio"
+- reg : Address and length of the register set for the device.
+- #address-cells : should be 1 (for addressing port subnodes).
+- #size-cells : should be 0 (port subnodes).
+
+The GPIO controller has a configurable number of ports, each of which are
+represented as child nodes with the following properties:
+
+Required properties:
+- compatible : "snps,dw-apb-gpio-port"
+- gpio-controller : Marks the device node as a gpio controller.
+- #gpio-cells : Should be 1.  It is the pin number.
+- reg : The integer port index of the port, a single cell.
+
+Optional properties:
+- interrupt-controller : The first port may be configured to be an interrupt
+controller.
+- #interrupt-cells : Specifies the number of cells needed to encode an
+  interrupt.  Shall be set to 2.  The first cell defines the interrupt number,
+  the second encodes the triger flags encoded as described in
+  Documentation/devicetree/bindings/interrupts.txt
+- interrupt-parent : The parent interrupt controller.
+- interrupts : The interrupts to the parent controller raised when GPIOs
+  generate the interrupts.  The number of interrupts depends on the hardware
+  configuration of the DesignWare IP block.
+- snps,nr-gpios : The number of pins in the port, a single cell.
+
+Example:
+
+gpio: gpio@20000 {
+	compatible = "snps,dw-apb-gpio";
+	reg = <0x20000 0x1000>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	porta: gpio-controller@0 {
+		compatible = "snps,dw-apb-gpio-port";
+		gpio-controller;
+		#gpio-cells = <2>;
+		snps,nr-gpios = <8>;
+		reg = <0>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		interrupt-parent = <&vic1>;
+		interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>;
+	};
+
+	portb: gpio-controller@1 {
+		compatible = "snps,dw-apb-gpio-port";
+		gpio-controller;
+		#gpio-cells = <2>;
+		snps,nr-gpios = <8>;
+		reg = <1>;
+	};
+};
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 6973387..b72cd85 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -128,6 +128,15 @@ config GPIO_GENERIC_PLATFORM
 	help
 	  Say yes here to support basic platform_device memory-mapped GPIO controllers.
 
+config GPIO_DWAPB
+	tristate "Synopsys DesignWare APB GPIO driver"
+	select GPIO_GENERIC
+	select GENERIC_IRQ_CHIP
+	depends on OF_GPIO && IRQ_DOMAIN
+	help
+	  Say Y or M here to build support for the Synopsys DesignWare APB
+	  GPIO block.
+
 config GPIO_IT8761E
 	tristate "IT8761E GPIO support"
 	depends on X86  # unconditional access to IO space.
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 5d50179..2d09f04 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_GPIO_CS5535)	+= gpio-cs5535.o
 obj-$(CONFIG_GPIO_DA9052)	+= gpio-da9052.o
 obj-$(CONFIG_GPIO_DA9055)	+= gpio-da9055.o
 obj-$(CONFIG_GPIO_DAVINCI)	+= gpio-davinci.o
+obj-$(CONFIG_GPIO_DWAPB)	+= gpio-dwapb.o
 obj-$(CONFIG_GPIO_EM)		+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_F7188X)	+= gpio-f7188x.o
diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
new file mode 100644
index 0000000..a689c2b
--- /dev/null
+++ b/drivers/gpio/gpio-dwapb.c
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2011 Jamie Iles
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * All enquiries to support@picochip.com
+ */
+#include <linux/basic_mmio_gpio.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/irq.h>
+#include <linux/irqdomain.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+
+#define GPIO_SWPORTA_DR		0x00
+#define GPIO_SWPORTA_DDR	0x04
+#define GPIO_SWPORTB_DR		0x0c
+#define GPIO_SWPORTB_DDR	0x10
+#define GPIO_SWPORTC_DR		0x18
+#define GPIO_SWPORTC_DDR	0x1c
+#define GPIO_SWPORTD_DR		0x24
+#define GPIO_SWPORTD_DDR	0x28
+#define GPIO_INTEN		0x30
+#define GPIO_INTMASK		0x34
+#define GPIO_INTTYPE_LEVEL	0x38
+#define GPIO_INT_POLARITY	0x3c
+#define GPIO_INTSTATUS		0x40
+#define GPIO_PORTA_EOI		0x4c
+#define GPIO_EXT_PORTA		0x50
+#define GPIO_EXT_PORTB		0x54
+#define GPIO_EXT_PORTC		0x58
+#define GPIO_EXT_PORTD		0x5c
+
+#define DWAPB_MAX_PORTS		4
+#define GPIO_EXT_PORT_SIZE	(GPIO_EXT_PORTB - GPIO_EXT_PORTA)
+#define GPIO_SWPORT_DR_SIZE	(GPIO_SWPORTB_DR - GPIO_SWPORTA_DR)
+#define GPIO_SWPORT_DDR_SIZE	(GPIO_SWPORTB_DDR - GPIO_SWPORTA_DDR)
+
+struct dwapb_gpio;
+
+struct dwapb_gpio_port {
+	struct bgpio_chip	bgc;
+	bool			is_registered;
+	struct dwapb_gpio	*gpio;
+};
+
+struct dwapb_gpio {
+	struct	device		*dev;
+	void __iomem		*regs;
+	struct dwapb_gpio_port	*ports;
+	unsigned int		nr_ports;
+	struct irq_domain	*domain;
+};
+
+static int dwapb_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
+{
+	struct bgpio_chip *bgc = to_bgpio_chip(gc);
+	struct dwapb_gpio_port *port = container_of(bgc, struct
+						    dwapb_gpio_port, bgc);
+	struct dwapb_gpio *gpio = port->gpio;
+
+	return irq_create_mapping(gpio->domain, offset);
+}
+
+static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)
+{
+	u32 v = readl(gpio->regs + GPIO_INT_POLARITY);
+
+	if (gpio_get_value(gpio->ports[0].bgc.gc.base + offs))
+		v &= ~BIT(offs);
+	else
+		v |= BIT(offs);
+
+	writel(v, gpio->regs + GPIO_INT_POLARITY);
+}
+
+static void dwapb_irq_handler(u32 irq, struct irq_desc *desc)
+{
+	struct dwapb_gpio *gpio = irq_get_handler_data(irq);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
+	u32 irq_status = readl_relaxed(gpio->regs + GPIO_INTSTATUS);
+
+	while (irq_status) {
+		int hwirq = fls(irq_status) - 1;
+		int gpio_irq = irq_find_mapping(gpio->domain, hwirq);
+
+		generic_handle_irq(gpio_irq);
+		irq_status &= ~BIT(hwirq);
+
+		if ((irq_get_trigger_type(gpio_irq) & IRQ_TYPE_SENSE_MASK)
+			== IRQ_TYPE_EDGE_BOTH)
+			dwapb_toggle_trigger(gpio, hwirq);
+	}
+
+	if (chip->irq_eoi)
+		chip->irq_eoi(irq_desc_get_irq_data(desc));
+}
+
+static void dwapb_irq_enable(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct dwapb_gpio *gpio = gc->private;
+	struct bgpio_chip *bgc = &gpio->ports[0].bgc;
+	unsigned long flags;
+	u32 val;
+
+	spin_lock_irqsave(&bgc->lock, flags);
+	val = readl(gpio->regs + GPIO_INTEN);
+	val |= BIT(d->hwirq);
+	writel(val, gpio->regs + GPIO_INTEN);
+	spin_unlock_irqrestore(&bgc->lock, flags);
+}
+
+static void dwapb_irq_disable(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct dwapb_gpio *gpio = gc->private;
+	struct bgpio_chip *bgc = &gpio->ports[0].bgc;
+	unsigned long flags;
+	u32 val;
+
+	spin_lock_irqsave(&bgc->lock, flags);
+	val = readl(gpio->regs + GPIO_INTEN);
+	val &= ~BIT(d->hwirq);
+	writel(val, gpio->regs + GPIO_INTEN);
+	spin_unlock_irqrestore(&bgc->lock, flags);
+}
+
+static int dwapb_irq_set_type(struct irq_data *d, u32 type)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct dwapb_gpio *gpio = gc->private;
+	struct bgpio_chip *bgc = &gpio->ports[0].bgc;
+	int bit = d->hwirq;
+	unsigned long level, polarity, flags;
+
+	if (type & ~(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
+		     IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
+		return -EINVAL;
+
+	spin_lock_irqsave(&bgc->lock, flags);
+	level = readl(gpio->regs + GPIO_INTTYPE_LEVEL);
+	polarity = readl(gpio->regs + GPIO_INT_POLARITY);
+
+	switch (type) {
+	case IRQ_TYPE_EDGE_BOTH:
+		level |= BIT(bit);
+		dwapb_toggle_trigger(gpio, bit);
+		break;
+	case IRQ_TYPE_EDGE_RISING:
+		level |= BIT(bit);
+		polarity |= BIT(bit);
+		break;
+	case IRQ_TYPE_EDGE_FALLING:
+		level |= BIT(bit);
+		polarity &= ~BIT(bit);
+		break;
+	case IRQ_TYPE_LEVEL_HIGH:
+		level &= ~BIT(bit);
+		polarity |= BIT(bit);
+		break;
+	case IRQ_TYPE_LEVEL_LOW:
+		level &= ~BIT(bit);
+		polarity &= ~BIT(bit);
+		break;
+	}
+
+	writel(level, gpio->regs + GPIO_INTTYPE_LEVEL);
+	writel(polarity, gpio->regs + GPIO_INT_POLARITY);
+	spin_unlock_irqrestore(&bgc->lock, flags);
+
+	return 0;
+}
+
+static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
+				 struct dwapb_gpio_port *port)
+{
+	struct gpio_chip *gc = &port->bgc.gc;
+	struct device_node *node =  gc->of_node;
+	struct irq_chip_generic	*irq_gc;
+	unsigned int hwirq, ngpio = gc->ngpio;
+	struct irq_chip_type *ct;
+	int reg, err, irq;
+
+	if (of_get_property(node, "interrupts", NULL) == NULL)
+		return;
+
+	gpio->domain = irq_domain_add_linear(node, ngpio, &irq_generic_chip_ops,
+					     gpio);
+	if (!gpio->domain)
+		return;
+
+	err = irq_alloc_domain_generic_chips(gpio->domain, ngpio, 1,
+					     "gpio-dwapb", handle_level_irq,
+					     IRQ_NOREQUEST, 0,
+					     IRQ_GC_INIT_NESTED_LOCK);
+	if (err) {
+		dev_info(gpio->dev, "irq_alloc_domain_generic_chips failed\n");
+		irq_domain_remove(gpio->domain);
+		gpio->domain = NULL;
+		return;
+	}
+
+	for (hwirq = 0 ; hwirq < ngpio ; hwirq++) {
+		irq_gc = irq_get_domain_generic_chip(gpio->domain, hwirq);
+		if (!irq_gc) {
+			irq_domain_remove(gpio->domain);
+			gpio->domain = NULL;
+			return;
+		}
+
+		irq_gc->reg_base = gpio->regs;
+		irq_gc->private = gpio;
+
+		ct = irq_gc->chip_types;
+		ct->chip.irq_ack = irq_gc_ack_set_bit;
+		ct->chip.irq_mask = irq_gc_mask_set_bit;
+		ct->chip.irq_unmask = irq_gc_mask_clr_bit;
+		ct->chip.irq_set_type = dwapb_irq_set_type;
+		ct->chip.irq_enable = dwapb_irq_enable;
+		ct->chip.irq_disable = dwapb_irq_disable;
+		ct->regs.ack = GPIO_PORTA_EOI;
+		ct->regs.mask = GPIO_INTMASK;
+
+		irq_setup_generic_chip(irq_gc, IRQ_MSK(port->bgc.gc.ngpio),
+				IRQ_GC_INIT_NESTED_LOCK, IRQ_NOREQUEST, 0);
+
+		irq = irq_of_parse_and_map(node, hwirq);
+		if (!irq && (hwirq == 0)) {
+			dev_warn(gpio->dev, "no irq for bank %s\n",
+				port->bgc.gc.of_node->full_name);
+			return;
+		} else if (!irq)
+			break;
+
+		irq_set_chained_handler(irq, dwapb_irq_handler);
+		irq_set_handler_data(irq, gpio);
+	}
+	port->bgc.gc.to_irq = dwapb_gpio_to_irq;
+}
+
+static void dwapb_irq_teardown(struct dwapb_gpio *gpio)
+{
+	struct dwapb_gpio_port *port = &gpio->ports[0];
+	struct gpio_chip *gc = &port->bgc.gc;
+	unsigned int ngpio = gc->ngpio;
+	irq_hw_number_t hwirq;
+
+	if (!gpio->domain)
+		return;
+
+	for (hwirq = 0 ; hwirq < ngpio ; hwirq++)
+		irq_dispose_mapping(irq_find_mapping(gpio->domain, hwirq));
+
+	irq_domain_remove(gpio->domain);
+	gpio->domain = NULL;
+}
+
+static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
+			       struct device_node *port_np,
+			       unsigned int offs)
+{
+	struct dwapb_gpio_port *port;
+	u32 port_idx, ngpio;
+	void __iomem *dat, *set, *dirout;
+	int err;
+
+	if (of_property_read_u32(port_np, "reg", &port_idx) ||
+		port_idx >= DWAPB_MAX_PORTS) {
+		dev_err(gpio->dev, "missing/invalid port index for %s\n",
+			port_np->full_name);
+		return -EINVAL;
+	}
+
+	port = &gpio->ports[offs];
+	port->gpio = gpio;
+
+	if (of_property_read_u32(port_np, "snps,nr-gpios", &ngpio)) {
+		dev_info(gpio->dev, "failed to get number of gpios for %s\n",
+			 port_np->full_name);
+		ngpio = 32;
+	}
+
+	dat = gpio->regs + GPIO_EXT_PORTA + (port_idx * GPIO_EXT_PORT_SIZE);
+	set = gpio->regs + GPIO_SWPORTA_DR + (port_idx * GPIO_SWPORT_DR_SIZE);
+	dirout = gpio->regs + GPIO_SWPORTA_DDR +
+		(port_idx * GPIO_SWPORT_DDR_SIZE);
+
+	err = bgpio_init(&port->bgc, gpio->dev, 4, dat, set, NULL, dirout,
+			 NULL, false);
+	if (err) {
+		dev_err(gpio->dev, "failed to init gpio chip for %s\n",
+			port_np->full_name);
+		return err;
+	}
+
+	port->bgc.gc.ngpio = ngpio;
+	port->bgc.gc.of_node = port_np;
+
+	/*
+	 * Only port A can provide interrupts in all configurations of the IP.
+	 */
+	if (port_idx == 0 &&
+	    of_property_read_bool(port_np, "interrupt-controller"))
+		dwapb_configure_irqs(gpio, port);
+
+	err = gpiochip_add(&port->bgc.gc);
+	if (err)
+		dev_err(gpio->dev, "failed to register gpiochip for %s\n",
+			port_np->full_name);
+	else
+		port->is_registered = true;
+
+	return err;
+}
+
+static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
+{
+	unsigned int m;
+
+	for (m = 0; m < gpio->nr_ports; ++m)
+		if (gpio->ports[m].is_registered)
+			WARN_ON(gpiochip_remove(&gpio->ports[m].bgc.gc));
+}
+
+static int dwapb_gpio_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	struct dwapb_gpio *gpio;
+	struct device_node *np;
+	int err;
+	unsigned int offs = 0;
+
+	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
+	if (!gpio)
+		return -ENOMEM;
+	gpio->dev = &pdev->dev;
+
+	gpio->nr_ports = of_get_child_count(pdev->dev.of_node);
+	if (!gpio->nr_ports) {
+		err = -EINVAL;
+		goto out_err;
+	}
+	gpio->ports = devm_kzalloc(&pdev->dev, gpio->nr_ports *
+				   sizeof(*gpio->ports), GFP_KERNEL);
+	if (!gpio->ports) {
+		err = -ENOMEM;
+		goto out_err;
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	gpio->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(gpio->regs)) {
+		err = PTR_ERR(gpio->regs);
+		goto out_err;
+	}
+
+	for_each_child_of_node(pdev->dev.of_node, np) {
+		err = dwapb_gpio_add_port(gpio, np, offs++);
+		if (err)
+			goto out_unregister;
+	}
+	platform_set_drvdata(pdev, gpio);
+
+	return 0;
+
+out_unregister:
+	dwapb_gpio_unregister(gpio);
+	dwapb_irq_teardown(gpio);
+
+out_err:
+	return err;
+}
+
+static int dwapb_gpio_remove(struct platform_device *pdev)
+{
+	struct dwapb_gpio *gpio = platform_get_drvdata(pdev);
+
+	dwapb_gpio_unregister(gpio);
+	dwapb_irq_teardown(gpio);
+
+	return 0;
+}
+
+static const struct of_device_id dwapb_of_match[] = {
+	{ .compatible = "snps,dw-apb-gpio" },
+	{ /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, dwapb_of_match);
+
+static struct platform_driver dwapb_gpio_driver = {
+	.driver		= {
+		.name	= "gpio-dwapb",
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(dwapb_of_match),
+	},
+	.probe		= dwapb_gpio_probe,
+	.remove		= dwapb_gpio_remove,
+};
+
+module_platform_driver(dwapb_gpio_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jamie Iles");
+MODULE_DESCRIPTION("Synopsys DesignWare APB GPIO driver");
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/2] ARM: shmobile: lager: add Ether DT support
From: Sergei Shtylyov @ 2014-02-06 21:58 UTC (permalink / raw)
  To: horms, linux-sh, devicetree, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: magnus.damm, linux, linux-arm-kernel
In-Reply-To: <201402070054.39989.sergei.shtylyov@cogentembedded.com>

Define the Lager board dependent part of the Ether device node. 

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 arch/arm/boot/dts/r8a7790-lager.dts |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

Index: renesas/arch/arm/boot/dts/r8a7790-lager.dts
===================================================================
--- renesas.orig/arch/arm/boot/dts/r8a7790-lager.dts
+++ renesas/arch/arm/boot/dts/r8a7790-lager.dts
@@ -1,7 +1,8 @@
 /*
  * Device Tree Source for the Lager board
  *
- * Copyright (C) 2013 Renesas Solutions Corp.
+ * Copyright (C) 2013-2014 Renesas Solutions Corp.
+ * Copyright (C) 2014 Cogent Embedded, Inc.
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
@@ -76,12 +77,40 @@
 		renesas,function = "scif1";
 	};
 
+	ether_pins: ether {
+		renesas,groups = "eth_link", "eth_mdio", "eth_rmii";
+		renesas,function = "eth";
+	};
+
+	phy1_pins: phy1 {
+		renesas,groups = "intc_irq0";
+		renesas,function = "intc";
+	};
+
 	mmc1_pins: mmc1 {
 		renesas,groups = "mmc1_data8", "mmc1_ctrl";
 		renesas,function = "mmc1";
 	};
 };
 
+&ether {
+	pinctrl-0 = <&ether_pins>;
+	pinctrl-names = "default";
+
+	phy-handle = <&phy1>;
+	renesas,ether-link-active-low;
+	status = "ok";
+
+	phy1: ethernet-phy@1 {
+		reg = <1>;
+		interrupt-parent = <&irqc0>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+
+		pinctrl-0 = <&phy1_pins>;
+		pinctrl-names = "default";
+	};
+};
+
 &mmcif1 {
 	pinctrl-0 = <&mmc1_pins>;
 	pinctrl-names = "default";

^ permalink raw reply

* [PATCH 1/2] ARM: shmobile: r8a7790: add Ether DT support
From: Sergei Shtylyov @ 2014-02-06 21:56 UTC (permalink / raw)
  To: horms, linux-sh, devicetree, robh+dt, pawel.moll, mark.rutland,
	ijc+devicetree, galak
  Cc: magnus.damm, linux, linux-arm-kernel
In-Reply-To: <201402070054.39989.sergei.shtylyov@cogentembedded.com>

Define the generic R8A7790 part of the Ether device node. 

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 arch/arm/boot/dts/r8a7790.dtsi |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Index: renesas/arch/arm/boot/dts/r8a7790.dtsi
===================================================================
--- renesas.orig/arch/arm/boot/dts/r8a7790.dtsi
+++ renesas/arch/arm/boot/dts/r8a7790.dtsi
@@ -1,7 +1,8 @@
 /*
  * Device Tree Source for the r8a7790 SoC
  *
- * Copyright (C) 2013 Renesas Solutions Corp.
+ * Copyright (C) 2013-2014 Renesas Solutions Corp.
+ * Copyright (C) 2014 Cogent Embedded Inc.
  *
  * This file is licensed under the terms of the GNU General Public License
  * version 2.  This program is licensed "as is" without any warranty of any
@@ -400,6 +401,18 @@
 		status = "disabled";
 	};
 
+	ether: ethernet@ee700000 {
+		compatible = "renesas,ether-r8a7790";
+		reg = <0 0xee700000 0 0x400>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 162 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp8_clks R8A7790_CLK_ETHER>;
+		phy-mode = "rmii";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
+
 	sata0: sata@ee300000 {
 		compatible = "renesas,sata-r8a7790";
 		reg = <0 0xee300000 0 0x2000>;

^ permalink raw reply

* [PATCH 0/2] Add Ether DT support for R8A7790/Lager reference board
From: Sergei Shtylyov @ 2014-02-06 21:54 UTC (permalink / raw)
  To: horms, linux-sh, devicetree
  Cc: magnus.damm, linux, linux-arm-kernel, robh+dt, pawel.moll,
	mark.rutland, ijc+devicetree, galak

Hello.

   Here's the set of 2 patches against Simon Horman's 'renesas.git' repo,
'renesas-devel-v3.14-rc1-20140206v2' tag. Here we add the Ether device tree
support working on the R8A7790/Lager reference board. The patchset requires the
'sh_eth' driver device tree support posted earlier in order to work.

[1/2] ARM: shmobile: r8a7790: add Ether DT support
[2/2] ARM: shmobile: lager: add Ether DT support

WBR, Sergei

^ permalink raw reply

* Re: [PATCH v1 1/2] leds: leds-gpio: add retain-state-suspended property
From: Bryan Wu @ 2014-02-06 19:24 UTC (permalink / raw)
  To: Robin Gong
  Cc: Pawel Moll, Mark Rutland, Ian Campbell, galak, Rob Landley,
	rpurdie@rpsys.net, Grant Likely, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, lkml, Linux LED Subsystem, Rob Herring
In-Reply-To: <1390218087-14597-1-git-send-email-b38343@freescale.com>

On Mon, Jan 20, 2014 at 3:41 AM, Robin Gong <b38343@freescale.com> wrote:
> Some gpio-leds need retain the state even in suspend, such as charger led.
> But this property missed in devicetree, add it.
>

Good catch, I just fold these 2 patches into one patch and applied.
Thanks,
-Bryan


> Signed-off-by: Robin Gong <b38343@freescale.com>
> ---
>  drivers/leds/leds-gpio.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 78b0e27..1bb3f1a 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -204,6 +204,9 @@ static struct gpio_leds_priv *gpio_leds_create_of(struct platform_device *pdev)
>                                 led.default_state = LEDS_GPIO_DEFSTATE_OFF;
>                 }
>
> +               if (of_get_property(child, "retain-state-suspended", NULL))
> +                       led.retain_state_suspended = 1;
> +
>                 ret = create_gpio_led(&led, &priv->leds[priv->num_leds++],
>                                       &pdev->dev, NULL);
>                 if (ret < 0) {
> --
> 1.7.5.4
>
>

^ permalink raw reply

* Re: [PATCH v6 18/19] ARM: mvebu: Enable watchdog support in defconfig
From: Jason Cooper @ 2014-02-06 19:12 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Thomas Petazzoni, devicetree, linux-watchdog, Andrew Lunn,
	Wim Van Sebroeck, Lior Amsalem, Gregory Clement, linux-arm-kernel,
	Sebastian Hesselbarth
In-Reply-To: <20140206191023.GA19328@localhost>

On Thu, Feb 06, 2014 at 04:10:24PM -0300, Ezequiel Garcia wrote:
> On Thu, Feb 06, 2014 at 12:51:59PM -0500, Jason Cooper wrote:
> > On Thu, Feb 06, 2014 at 02:20:25PM -0300, Ezequiel Garcia wrote:
> > > Now that we have proper support for Armada 370/XP watchdog
> > > let's enable it in the defconfig.
> > > 
> > > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > > ---
> > >  arch/arm/configs/mvebu_defconfig | 2 ++
> > >  1 file changed, 2 insertions(+)
> > 
> > If this ends up being the last version for this series, I'll add a patch
> > for multi_v7_defconfig.  Otherwise, please add for the next round.
> > 
> 
> Oh, yes, I forgot about your request on this. Let's hope I don't forget
> next time.

Yes, we found the i2c hang because of multi_v7, so it's definitely worth
the effort.

thx,

Jason.

^ permalink raw reply

* Re: [PATCH v6 18/19] ARM: mvebu: Enable watchdog support in defconfig
From: Ezequiel Garcia @ 2014-02-06 19:10 UTC (permalink / raw)
  To: Jason Cooper
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Thomas Petazzoni, Gregory Clement, Lior Amsalem,
	Sebastian Hesselbarth, Andrew Lunn
In-Reply-To: <20140206175159.GI8533-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>

On Thu, Feb 06, 2014 at 12:51:59PM -0500, Jason Cooper wrote:
> On Thu, Feb 06, 2014 at 02:20:25PM -0300, Ezequiel Garcia wrote:
> > Now that we have proper support for Armada 370/XP watchdog
> > let's enable it in the defconfig.
> > 
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > ---
> >  arch/arm/configs/mvebu_defconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> If this ends up being the last version for this series, I'll add a patch
> for multi_v7_defconfig.  Otherwise, please add for the next round.
> 

Oh, yes, I forgot about your request on this. Let's hope I don't forget
next time.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v3 5/5] leds: leds-mc13783: Add devicetree support
From: Bryan Wu @ 2014-02-06 19:02 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: Linux LED Subsystem, Richard Purdie, devicetree@vger.kernel.org
In-Reply-To: <1391236643-16585-1-git-send-email-shc_work@mail.ru>

On Fri, Jan 31, 2014 at 10:37 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
> This patch adds devicetree support for the MC13XXX LED driver.
>

I'm OK for this whole patchset and will merge it soon.

Thanks,
-Bryan

> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  Documentation/devicetree/bindings/mfd/mc13xxx.txt |  47 +++++++++
>  drivers/leds/leds-mc13783.c                       | 112 ++++++++++++++++++----
>  2 files changed, 140 insertions(+), 19 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
> index abd9e3c..1413f39 100644
> --- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
> +++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
> @@ -10,9 +10,44 @@ Optional properties:
>  - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
>
>  Sub-nodes:
> +- leds : Contain the led nodes and initial register values in property
> +  "led-control". Number of register depends of used IC, for MC13783 is 6,
> +  for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of
> +  these registers.
> +  - #address-cells: Must be 1.
> +  - #size-cells: Must be 0.
> +  Each led node should contain "reg", which used as LED ID (described below).
> +  Optional properties "label" and "linux,default-trigger" is described in
> +  Documentation/devicetree/bindings/leds/common.txt.
>  - regulators : Contain the regulator nodes. The regulators are bound using
>    their names as listed below with their registers and bits for enabling.
>
> +MC13783 LED IDs:
> +    0  : Main display
> +    1  : AUX display
> +    2  : Keypad
> +    3  : Red 1
> +    4  : Green 1
> +    5  : Blue 1
> +    6  : Red 2
> +    7  : Green 2
> +    8  : Blue 2
> +    9  : Red 3
> +    10 : Green 3
> +    11 : Blue 3
> +
> +MC13892 LED IDs:
> +    0  : Main display
> +    1  : AUX display
> +    2  : Keypad
> +    3  : Red
> +    4  : Green
> +    5  : Blue
> +
> +MC34708 LED IDs:
> +    0  : Charger Red
> +    1  : Charger Green
> +
>  MC13783 regulators:
>      sw1a      : regulator SW1A      (register 24, bit 0)
>      sw1b      : regulator SW1B      (register 25, bit 0)
> @@ -89,6 +124,18 @@ ecspi@70010000 { /* ECSPI1 */
>                 interrupt-parent = <&gpio0>;
>                 interrupts = <8>;
>
> +               leds {
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +                       led-control = <0x000 0x000 0x0e0 0x000>;
> +
> +                       sysled {
> +                               reg = <3>;
> +                               label = "system:red:live";
> +                               linux,default-trigger = "heartbeat";
> +                       };
> +               };
> +
>                 regulators {
>                         sw1_reg: mc13892__sw1 {
>                                 regulator-min-microvolt = <600000>;
> diff --git a/drivers/leds/leds-mc13783.c b/drivers/leds/leds-mc13783.c
> index 4cfcfde..e4e4ef5 100644
> --- a/drivers/leds/leds-mc13783.c
> +++ b/drivers/leds/leds-mc13783.c
> @@ -19,6 +19,7 @@
>  #include <linux/kernel.h>
>  #include <linux/platform_device.h>
>  #include <linux/leds.h>
> +#include <linux/of.h>
>  #include <linux/workqueue.h>
>  #include <linux/mfd/mc13xxx.h>
>
> @@ -41,7 +42,7 @@ struct mc13xxx_leds {
>         struct mc13xxx                  *master;
>         struct mc13xxx_led_devtype      *devtype;
>         int                             num_leds;
> -       struct mc13xxx_led              led[0];
> +       struct mc13xxx_led              *led;
>  };
>
>  static unsigned int mc13xxx_max_brightness(int id)
> @@ -119,6 +120,74 @@ static void mc13xxx_led_set(struct led_classdev *led_cdev,
>         schedule_work(&led->work);
>  }
>
> +#ifdef CONFIG_OF
> +static struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
> +       struct platform_device *pdev)
> +{
> +       struct mc13xxx_leds *leds = platform_get_drvdata(pdev);
> +       struct mc13xxx_leds_platform_data *pdata;
> +       struct device_node *parent, *child;
> +       struct device *dev = &pdev->dev;
> +       int i = 0, ret = -ENODATA;
> +
> +       pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +       if (!pdata)
> +               return ERR_PTR(-ENOMEM);
> +
> +       of_node_get(dev->parent->of_node);
> +
> +       parent = of_find_node_by_name(dev->parent->of_node, "leds");
> +       if (!parent)
> +               goto out_node_put;
> +
> +       ret = of_property_read_u32_array(parent, "led-control",
> +                                        pdata->led_control,
> +                                        leds->devtype->num_regs);
> +       if (ret)
> +               goto out_node_put;
> +
> +       pdata->num_leds = of_get_child_count(parent);
> +
> +       pdata->led = devm_kzalloc(dev, pdata->num_leds * sizeof(*pdata->led),
> +                                 GFP_KERNEL);
> +       if (!pdata->led) {
> +               ret = -ENOMEM;
> +               goto out_node_put;
> +       }
> +
> +       for_each_child_of_node(parent, child) {
> +               const char *str;
> +               u32 tmp;
> +
> +               if (of_property_read_u32(child, "reg", &tmp))
> +                       continue;
> +               pdata->led[i].id = leds->devtype->led_min + tmp;
> +
> +               if (!of_property_read_string(child, "label", &str))
> +                       pdata->led[i].name = str;
> +               if (!of_property_read_string(child, "linux,default-trigger",
> +                                            &str))
> +                       pdata->led[i].default_trigger = str;
> +
> +               i++;
> +       };
> +
> +       pdata->num_leds = i;
> +       ret = i > 0 ? 0 : -ENODATA;
> +
> +out_node_put:
> +       of_node_put(parent);
> +
> +       return ret ? ERR_PTR(ret) : pdata;
> +}
> +#else
> +static inline struct mc13xxx_leds_platform_data __init *mc13xxx_led_probe_dt(
> +       struct platform_device *pdev)
> +{
> +       return ERR_PTR(-ENOSYS);
> +}
> +#endif
> +
>  static int __init mc13xxx_led_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
> @@ -127,32 +196,37 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
>         struct mc13xxx_led_devtype *devtype =
>                 (struct mc13xxx_led_devtype *)pdev->id_entry->driver_data;
>         struct mc13xxx_leds *leds;
> -       int i, id, num_leds, ret = -ENODATA;
> +       int i, id, ret = -ENODATA;
>         u32 init_led = 0;
>
> -       if (!pdata) {
> -               dev_err(dev, "Missing platform data\n");
> -               return -ENODEV;
> -       }
> -
> -       num_leds = pdata->num_leds;
> -
> -       if ((num_leds < 1) ||
> -           (num_leds > (devtype->led_max - devtype->led_min + 1))) {
> -               dev_err(dev, "Invalid LED count %d\n", num_leds);
> -               return -EINVAL;
> -       }
> -
> -       leds = devm_kzalloc(dev, num_leds * sizeof(struct mc13xxx_led) +
> -                           sizeof(struct mc13xxx_leds), GFP_KERNEL);
> +       leds = devm_kzalloc(dev, sizeof(*leds), GFP_KERNEL);
>         if (!leds)
>                 return -ENOMEM;
>
>         leds->devtype = devtype;
> -       leds->num_leds = num_leds;
>         leds->master = mcdev;
>         platform_set_drvdata(pdev, leds);
>
> +       if (dev->parent->of_node) {
> +               pdata = mc13xxx_led_probe_dt(pdev);
> +               if (IS_ERR(pdata))
> +                       return PTR_ERR(pdata);
> +       } else if (!pdata)
> +               return -ENODATA;
> +
> +       leds->num_leds = pdata->num_leds;
> +
> +       if ((leds->num_leds < 1) ||
> +           (leds->num_leds > (devtype->led_max - devtype->led_min + 1))) {
> +               dev_err(dev, "Invalid LED count %d\n", leds->num_leds);
> +               return -EINVAL;
> +       }
> +
> +       leds->led = devm_kzalloc(dev, leds->num_leds * sizeof(*leds->led),
> +                                GFP_KERNEL);
> +       if (!leds->led)
> +               return -ENOMEM;
> +
>         for (i = 0; i < devtype->num_regs; i++) {
>                 ret = mc13xxx_reg_write(mcdev, leds->devtype->ledctrl_base + i,
>                                         pdata->led_control[i]);
> @@ -160,7 +234,7 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
>                         return ret;
>         }
>
> -       for (i = 0; i < num_leds; i++) {
> +       for (i = 0; i < leds->num_leds; i++) {
>                 const char *name, *trig;
>
>                 ret = -EINVAL;
> --
> 1.8.3.2
>

^ permalink raw reply

* [PATCH v2 8/8] regulator: da9055: Remove use of regmap_irq_get_virq()
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource-WBD+wuPFNBhBDgjK7y7TUQ@public.gmane.org>
---
 drivers/regulator/da9055-regulator.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c
index d90f785..3b7a26c 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -637,7 +637,9 @@ static int da9055_regulator_probe(struct platform_device *pdev)
 	/* Only LDO 5 and 6 has got the over current interrupt */
 	if (pdev->id == DA9055_ID_LDO5 || pdev->id ==  DA9055_ID_LDO6) {
 		irq = platform_get_irq_byname(pdev, "REGULATOR");
-		irq = regmap_irq_get_virq(da9055->irq_data, irq);
+		if (irq < 0)
+			return irq;
+
 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 						da9055_ldo5_6_oc_irq,
 						IRQF_TRIGGER_HIGH |
--
1.7.0.4

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

^ permalink raw reply related

* [PATCH v2 7/8] rtc: da9055: Remove use of regmap_irq_get_virq()
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 drivers/rtc/rtc-da9055.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
index 48cb2ac..a825491 100644
--- a/drivers/rtc/rtc-da9055.c
+++ b/drivers/rtc/rtc-da9055.c
@@ -302,7 +302,9 @@ static int da9055_rtc_probe(struct platform_device *pdev)
 	}

 	alm_irq = platform_get_irq_byname(pdev, "ALM");
-	alm_irq = regmap_irq_get_virq(rtc->da9055->irq_data, alm_irq);
+	if (alm_irq < 0)
+		return alm_irq;
+
 	ret = devm_request_threaded_irq(&pdev->dev, alm_irq, NULL,
 					da9055_rtc_alm_irq,
 					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 6/8] hwmon: da9055: Remove use of regmap_irq_get_virq()
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 drivers/hwmon/da9055-hwmon.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
index 029ecab..73b3865 100644
--- a/drivers/hwmon/da9055-hwmon.c
+++ b/drivers/hwmon/da9055-hwmon.c
@@ -278,10 +278,6 @@ static int da9055_hwmon_probe(struct platform_device *pdev)
 	if (hwmon_irq < 0)
 		return hwmon_irq;

-	hwmon_irq = regmap_irq_get_virq(hwmon->da9055->irq_data, hwmon_irq);
-	if (hwmon_irq < 0)
-		return hwmon_irq;
-
 	ret = devm_request_threaded_irq(&pdev->dev, hwmon_irq,
 					NULL, da9055_auxadc_irq,
 					IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 5/8] onkey: da9055: Remove use of regmap_irq_get_virq()
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Using platform_get_irq_byname() to retrieve the IRQ number
returns the VIRQ number rather than the local IRQ number for
the device. Passing that value then into regmap_irq_get_virq()
causes a failure because the function is expecting the local
IRQ number (e.g. 0, 1, 2, 3, etc). This patch removes use of
regmap_irq_get_virq() to prevent this failure from happening.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 drivers/input/misc/da9055_onkey.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c
index 4b11ede..4765799 100644
--- a/drivers/input/misc/da9055_onkey.c
+++ b/drivers/input/misc/da9055_onkey.c
@@ -109,7 +109,6 @@ static int da9055_onkey_probe(struct platform_device *pdev)

 	INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work);

-	irq = regmap_irq_get_virq(da9055->irq_data, irq);
 	err = request_threaded_irq(irq, NULL, da9055_onkey_irq,
 				   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
 				   "ONKEY", onkey);
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 4/8] regulator: da9055: Add DT support
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 drivers/regulator/da9055-regulator.c |   69 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c
index 7f34020..d90f785 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -19,6 +19,8 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
+#include <linux/of.h>
+#include <linux/regulator/of_regulator.h>

 #include <linux/mfd/da9055/core.h>
 #include <linux/mfd/da9055/reg.h>
@@ -446,6 +448,9 @@ static int da9055_gpio_init(struct da9055_regulator *regulator,
 	struct da9055_regulator_info *info = regulator->info;
 	int ret = 0;

+	if (!pdata)
+		return 0;
+
 	if (pdata->gpio_ren && pdata->gpio_ren[id]) {
 		char name[18];
 		int gpio_mux = pdata->gpio_ren[id];
@@ -530,6 +535,59 @@ static inline struct da9055_regulator_info *find_regulator_info(int id)
 	return NULL;
 }

+#ifdef CONFIG_OF
+static struct of_regulator_match da9055_reg_matches[] = {
+	{ .name = "BUCK1", },
+	{ .name = "BUCK2", },
+	{ .name = "LDO1", },
+	{ .name = "LDO2", },
+	{ .name = "LDO3", },
+	{ .name = "LDO4", },
+	{ .name = "LDO5", },
+	{ .name = "LDO6", },
+};
+
+static int da9055_regulator_dt_init(struct platform_device *pdev,
+				    struct da9055_regulator *regulator,
+				    struct regulator_config *config,
+				    int regid)
+{
+	struct device_node *nproot, *np;
+	int ret;
+
+	nproot = of_node_get(pdev->dev.parent->of_node);
+	if (!nproot)
+		return -ENODEV;
+
+	np = of_find_node_by_name(nproot, "regulators");
+	if (!np)
+		return -ENODEV;
+
+	ret = of_regulator_match(&pdev->dev, np, &da9055_reg_matches[regid], 1);
+	of_node_put(nproot);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Error matching regulator: %d\n", ret);
+		return -ENODEV;
+	}
+
+	config->init_data = da9055_reg_matches[regid].init_data;
+	config->of_node = da9055_reg_matches[regid].of_node;
+
+	if (!config->of_node)
+		return -ENODEV;
+
+	return 0;
+}
+#else
+static inline da9055_regulator_dt_init(struct platform_device *pdev,
+				       struct da9055_regulator *regulator,
+				       struct regulator_config *config,
+				       int regid)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_OF */
+
 static int da9055_regulator_probe(struct platform_device *pdev)
 {
 	struct regulator_config config = { };
@@ -538,9 +596,6 @@ static int da9055_regulator_probe(struct platform_device *pdev)
 	struct da9055_pdata *pdata = dev_get_platdata(da9055->dev);
 	int ret, irq;

-	if (pdata == NULL || pdata->regulators[pdev->id] == NULL)
-		return -ENODEV;
-
 	regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator),
 				 GFP_KERNEL);
 	if (!regulator)
@@ -557,8 +612,14 @@ static int da9055_regulator_probe(struct platform_device *pdev)
 	config.driver_data = regulator;
 	config.regmap = da9055->regmap;

-	if (pdata && pdata->regulators)
+	if (pdata && pdata->regulators) {
 		config.init_data = pdata->regulators[pdev->id];
+	} else {
+		ret = da9055_regulator_dt_init(pdev, regulator, &config,
+					       pdev->id);
+		if (ret < 0)
+			return ret;
+	}

 	ret = da9055_gpio_init(regulator, &config, pdata, pdev->id);
 	if (ret < 0)
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 3/8] mfd: da9055: Add DT support for PMIC
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 Documentation/devicetree/bindings/mfd/da9055.txt |   73 ++++++++++++++++++++++
 drivers/mfd/da9055-i2c.c                         |    8 +++
 2 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/da9055.txt

diff --git a/Documentation/devicetree/bindings/mfd/da9055.txt b/Documentation/devicetree/bindings/mfd/da9055.txt
new file mode 100644
index 0000000..f903c3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/da9055.txt
@@ -0,0 +1,73 @@
+* Dialog DA9055 Power Management Integrated Circuit (PMIC)
+
+DA9055 consists of a large and varied group of sub-devices (I2C Only):
+
+Device			 Supply Names	 Description
+------			 ------------	 -----------
+da9055-gpio		:		: GPIOs
+da9055-regulator	:		: Regulators
+da9055-onkey		:		: On key
+da9055-rtc		:		: RTC
+da9055-hwmon		:		: ADC
+da9055-watchdog		:		: Watchdog
+
+The CODEC device in DA9055 has a separate, configurable I2C address and so
+is instantiated separately from the PMIC.
+
+For details on accompanying CODEC I2C device, see the following:
+Documentation/devicetree/bindings/sound/da9055.txt
+
+======
+
+Required properties:
+- compatible : Should be "dlg,da9055-pmic"
+- reg: Specifies the I2C slave address (defaults to 0x5a but can be modified)
+- interrupt-parent: Specifies the phandle of the interrupt controller to which
+  the IRQs from da9055 are delivered to.
+- interrupts: IRQ line info for da9055 chip.
+- interrupt-controller: da9055 has internal IRQs (has own IRQ domain).
+- #interrupt-cells: Should be 1, is the local IRQ number for da9055.
+
+Sub-nodes:
+- regulators : Contain the regulator nodes. The DA9055 regulators are
+  bound using their names as listed below:
+
+    buck1     : regulator BUCK1
+    buck2     : regulator BUCK2
+    ldo1      : regulator LDO1
+    ldo2      : regulator LDO2
+    ldo3      : regulator LDO3
+    ldo4      : regulator LDO4
+    ldo5      : regulator LDO5
+    ldo6      : regulator LDO6
+
+  The bindings details of individual regulator device can be found in:
+  Documentation/devicetree/bindings/regulator/regulator.txt
+
+
+Example:
+
+	pmic: da9055-pmic@5a {
+		compatible = "dlg,da9055-pmic";
+		reg = <0x5a>;
+		interrupt-parent = <&intc>;
+		interrupts = <5 0x8>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+
+		regulators {
+			buck1: BUCK1 {
+				regulator-min-microvolt = <725000>;
+				regulator-max-microvolt = <2075000>;
+			};
+
+			buck2: BUCK2 {
+				regulator-min-microvolt = <925000>;
+				regulator-max-microvolt = <2500000>;
+			};
+			ldo1: LDO1 {
+				regulator-min-microvolt = <900000>;
+				regulator-max-microvolt = <3300000>;
+			};
+		};
+	};
diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 8103e43..366a3e2 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -15,6 +15,8 @@
 #include <linux/device.h>
 #include <linux/i2c.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>

 #include <linux/mfd/da9055/core.h>

@@ -66,6 +68,11 @@ static struct i2c_device_id da9055_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);

+static const struct of_device_id da9055_of_match[] = {
+	{ .compatible = "dlg,da9055-pmic", .data = (void *)&da9055_i2c_id[0] },
+	{ }
+};
+
 static struct i2c_driver da9055_i2c_driver = {
 	.probe = da9055_i2c_probe,
 	.remove = da9055_i2c_remove,
@@ -73,6 +80,7 @@ static struct i2c_driver da9055_i2c_driver = {
 	.driver = {
 		.name = "da9055-pmic",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(da9055_of_match),
 	},
 };

--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 2/8] ASoC: da9055: Add DT support for CODEC
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: devicetree, alsa-devel, Alessandro Zummo, Linus Walleij,
	Dmitry Torokhov, linux-kernel, Rob Herring, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
 Documentation/devicetree/bindings/sound/da9055.txt |   22 ++++++++++++++++++++
 sound/soc/codecs/da9055.c                          |    8 +++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/da9055.txt

diff --git a/Documentation/devicetree/bindings/sound/da9055.txt b/Documentation/devicetree/bindings/sound/da9055.txt
new file mode 100644
index 0000000..ed1b7cc
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/da9055.txt
@@ -0,0 +1,22 @@
+* Dialog DA9055 Audio CODEC
+
+DA9055 provides Audio CODEC support (I2C only).
+
+The Audio CODEC device in DA9055 has it's own I2C address which is configurable,
+so the device is instantiated separately from the PMIC (MFD) device.
+
+For details on accompanying PMIC I2C device, see the following:
+Documentation/devicetree/bindings/mfd/da9055.txt
+
+Required properties:
+
+  - compatible: "dlg,da9055-codec"
+  - reg: Specifies the I2C slave address
+
+
+Example:
+
+	codec: da9055-codec@1a {
+		compatible = "dlg,da9055-codec";
+		reg = <0x1a>;
+	};
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 4228126..be31f3c 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -18,6 +18,8 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -1536,11 +1538,17 @@ static const struct i2c_device_id da9055_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);

+static const struct of_device_id da9055_of_match[] = {
+	{ .compatible = "dlg,da9055-codec", },
+	{ }
+};
+
 /* I2C codec control layer */
 static struct i2c_driver da9055_i2c_driver = {
 	.driver = {
 		.name = "da9055-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(da9055_of_match),
 	},
 	.probe		= da9055_i2c_probe,
 	.remove		= da9055_remove,
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 1/8] ASoC: da9055: Fix device registration of PMIC and CODEC devices
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: alsa-devel, linux-kernel, devicetree, Rob Herring, Linus Walleij,
	Dmitry Torokhov, Alessandro Zummo, Guenter Roeck
In-Reply-To: <cover.1391705989.git.Adam.Thomson.Opensource@diasemi.com>

Currently the I2C device Ids conflict for the MFD and CODEC so
cannot be both instantiated on one platform. This patch updates
the Ids and names to make them unique from each other.

It should be noted that the I2C addresses for both PMIC and CODEC
are modifiable so instantiation of the two are kept as separate
devices, rather than instantiating the CODEC from the MFD code.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Acked-by: Mark Brown <broonie@linaro.org>
---
 drivers/mfd/da9055-i2c.c  |   12 ++++++++++--
 sound/soc/codecs/da9055.c |   11 +++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 13af7e5..8103e43 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -53,17 +53,25 @@ static int da9055_i2c_remove(struct i2c_client *i2c)
 	return 0;
 }

+/*
+ * DO NOT change the device Ids. The naming is intentionally specific as both
+ * the PMIC and CODEC parts of this chip are instantiated separately as I2C
+ * devices (both have configurable I2C addresses, and are to all intents and
+ * purposes separate). As a result there are specific DA9055 ids for PMIC
+ * and CODEC, which must be different to operate together.
+ */
 static struct i2c_device_id da9055_i2c_id[] = {
-	{"da9055", 0},
+	{"da9055-pmic", 0},
 	{ }
 };
+MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);

 static struct i2c_driver da9055_i2c_driver = {
 	.probe = da9055_i2c_probe,
 	.remove = da9055_i2c_remove,
 	.id_table = da9055_i2c_id,
 	.driver = {
-		.name = "da9055",
+		.name = "da9055-pmic",
 		.owner = THIS_MODULE,
 	},
 };
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index 52b79a4..4228126 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -1523,8 +1523,15 @@ static int da9055_remove(struct i2c_client *client)
 	return 0;
 }

+/*
+ * DO NOT change the device Ids. The naming is intentionally specific as both
+ * the CODEC and PMIC parts of this chip are instantiated separately as I2C
+ * devices (both have configurable I2C addresses, and are to all intents and
+ * purposes separate). As a result there are specific DA9055 Ids for CODEC
+ * and PMIC, which must be different to operate together.
+ */
 static const struct i2c_device_id da9055_i2c_id[] = {
-	{ "da9055", 0 },
+	{ "da9055-codec", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);
@@ -1532,7 +1539,7 @@ MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);
 /* I2C codec control layer */
 static struct i2c_driver da9055_i2c_driver = {
 	.driver = {
-		.name = "da9055",
+		.name = "da9055-codec",
 		.owner = THIS_MODULE,
 	},
 	.probe		= da9055_i2c_probe,
--
1.7.0.4

^ permalink raw reply related

* [PATCH v2 0/8] da9055: Driver initialisation fixes, add DT support
From: Adam Thomson @ 2014-02-06 18:03 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: devicetree, alsa-devel, Alessandro Zummo, Linus Walleij,
	Dmitry Torokhov, linux-kernel, Rob Herring, Guenter Roeck

This patch series provides the following updates for DA9055 drivers:

 - Fixes an issue with da9055 driver initialisation (conflicting device ids) of
   PMIC (MFD) and CODEC drivers which means they cannot be used together on
   the same I2C bus.
 - Add initial DT support for DA9055 related drivers, including binding
   documentation.
 - Remove use of regmap_irq_get_virq() in driver probes which was conflicting
   with use of platform_get_irq_byname(). platform_get_irq_byname() already
   returns the VIRQ number due to MFD core translation so using
   regmap_irq_get_virq() on that returned value results in an incorrect IRQ
   being requested. The driver probes then fail because of this.

[Changes since v1]:

 - Regulator:
    * fixed coding style issue (lack of braces for if,else statement)
    * removal of 'ifdef' around DT related headers
    * Use of 'of_regulator_match()' for retrieving regulator related info
      from DT nodes.

 - General:
    * Instead of removing platform_get_irq_byname() usage and device resources
      to fix IRQ conflict in driver probes, now removed 'regmap_irq_get_virq()'
      as advised. This has been tested on target for both DT and non-DT setups
      and works as expected.

Adam Thomson (8):
  ASoC: da9055: Fix device registration of PMIC and CODEC devices
  ASoC: da9055: Add DT support for CODEC
  mfd: da9055: Add DT support for PMIC
  regulator: da9055: Add DT support
  onkey: da9055: Remove use of regmap_irq_get_virq()
  hwmon: da9055: Remove use of regmap_irq_get_virq()
  rtc: da9055: Remove use of regmap_irq_get_virq()
  regulator: da9055: Remove use of regmap_irq_get_virq()

 Documentation/devicetree/bindings/mfd/da9055.txt   |   73 ++++++++++++++++++++
 Documentation/devicetree/bindings/sound/da9055.txt |   22 ++++++
 drivers/hwmon/da9055-hwmon.c                       |    4 -
 drivers/input/misc/da9055_onkey.c                  |    1 -
 drivers/mfd/da9055-i2c.c                           |   20 +++++-
 drivers/regulator/da9055-regulator.c               |   73 ++++++++++++++++++--
 drivers/rtc/rtc-da9055.c                           |    4 +-
 sound/soc/codecs/da9055.c                          |   19 +++++-
 8 files changed, 201 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/da9055.txt
 create mode 100644 Documentation/devicetree/bindings/sound/da9055.txt

^ permalink raw reply

* Re: [PATCH v6 18/19] ARM: mvebu: Enable watchdog support in defconfig
From: Jason Cooper @ 2014-02-06 17:51 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Thomas Petazzoni, Gregory Clement, Lior Amsalem,
	Sebastian Hesselbarth, Andrew Lunn
In-Reply-To: <1391707226-18258-19-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On Thu, Feb 06, 2014 at 02:20:25PM -0300, Ezequiel Garcia wrote:
> Now that we have proper support for Armada 370/XP watchdog
> let's enable it in the defconfig.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  arch/arm/configs/mvebu_defconfig | 2 ++
>  1 file changed, 2 insertions(+)

If this ends up being the last version for this series, I'll add a patch
for multi_v7_defconfig.  Otherwise, please add for the next round.

thx,

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

^ permalink raw reply

* Re: [PATCH 0/2] spi: Add Qualcomm QUP SPI controller support
From: Mark Brown @ 2014-02-06 17:50 UTC (permalink / raw)
  To: Ivan T. Ivanov
  Cc: Grant Likely, Rob Herring, linux-spi, linux-arm-msm, linux-kernel,
	devicetree
In-Reply-To: <1391705868-20091-1-git-send-email-iivanov@mm-sol.com>

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

On Thu, Feb 06, 2014 at 06:57:46PM +0200, Ivan T. Ivanov wrote:

> Ivan T. Ivanov (2):
>   spi: qup: Add device tree bindings information
>   spi: Add Qualcomm QUP SPI controller support

I only seem to have the second patch here?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 2/2] mfd: max14577: Add device tree bindings document
From: Tomasz Figa @ 2014-02-06 17:30 UTC (permalink / raw)
  To: k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ, t.figa-Sze3O3UU22JBDgjK7y7TUQ
  Cc: Kyungmin Park, Marek Szyprowski,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
	Mark Rutland
In-Reply-To: <1391707641-13543-2-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Hi,

Oops, I have forgotten to add suppress-cc to git send-email and the 
series went outside the intended audience... Please disregard these patches.

Sorry for the noise.

Best regards,
Tomasz

On 06.02.2014 18:27, Tomasz Figa wrote:
> From: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>
> Add document describing device tree bindings for MAX14577 MFD driver
> (for both MAX14577 and MAX77836 chipsets).
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Cc: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Cc: Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Cc: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> ---
>   Documentation/devicetree/bindings/mfd/max14577.txt |  149 ++++++++++++++++++++
>   1 file changed, 149 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/mfd/max14577.txt
>
> diff --git a/Documentation/devicetree/bindings/mfd/max14577.txt b/Documentation/devicetree/bindings/mfd/max14577.txt
> new file mode 100644
> index 0000000..f59a4f3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/max14577.txt
> @@ -0,0 +1,149 @@
> +Maxim MAX14577/77836 Multi-Function Device
> +
> +MAX14577 is a Multi-Function Device with Micro-USB Interface Circuit, Li+
> +Battery Charger and SFOUT LDO output for powering USB devices. It is
> +interfaced to host controller using I2C.
> +
> +MAX77836 additionally contains PMIC (with two LDO regulators) and Fuel Gauge.
> +
> +
> +Required properties:
> +- compatible : Must be "maxim,max14577" or "maxim,max77836".
> +- reg : I2C slave address for the max14577 chip (0x25 for max14577/max77836)
> +- interrupts : IRQ line for the chip.
> +- interrupt-parent :  The parent interrupt controller.
> +
> +
> +Optional nodes:
> +- max14577-muic/max77836-muic :
> +	Node used only by extcon consumers.
> +	Required properties:
> +		- compatible : "maxim,max14577-muic" or "maxim,max77836-muic"
> +
> +- regulators :
> +	Required properties:
> +		- compatible : "maxim,max14577-regulator"
> +			or "maxim,max77836-regulator"
> +
> +	May contain a sub-node per regulator from the list below. Each
> +	sub-node should contain the constraints and initialization information
> +	for that regulator. See regulator.txt for a description of standard
> +	properties for these sub-nodes.
> +
> +	List of valid regulator names:
> +	- for max14577: CHARGER, SAFEOUT.
> +	- for max77836: CHARGER, SAFEOUT, LDO1, LDO2.
> +
> +	The SAFEOUT is a fixed voltage regulator so there is no need to specify
> +	voltages for it.
> +
> + - charger :
> +	Required properties:
> +		- compatible : "maxim,max14577-charger"
> +			or "maxim,max77836-charger"
> +		- maxim,fast-charge-timer : Timer in hours to trigger the
> +			INT3/MBCCHGERR interrupt; Valid values:
> +			- 5, 6 or 7 (hours),
> +			- 0 to disable.
> +		- maxim,fast-charge-uamp : Current in uA for Fast Charge;
> +			Valid values:
> +			- for max14577: 90000 - 950000;
> +			- for max77836: 45000 - 475000;
> +		- maxim,eoc-uamp : Current in uA for End-Of-Charge mode;
> +			Valid values:
> +			- for max14577: 50000 - 200000;
> +			- for max77836: 5000 - 10000;
> +		- maxim,ovp-uvolt : OverVoltage Protection Threshold in uV;
> +			In an overvoltage condition, INT asserts and charging
> +			stops. Valid values:
> +			- 6000000, 6500000, 7000000, 7500000;
> +		- maxim,constant-uvolt : Battery Constant Voltage in uV;
> +			Valid values:
> +			- 4000000 - 4280000;
> +			- 4350000;
> +
> +
> +Example:
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +max14577@25 {
> +	compatible = "maxim,max14577";
> +	reg = <0x25>;
> +	interrupt-parent = <&gpx1>;
> +	interrupts = <5 IRQ_TYPE_NONE>;
> +
> +	muic: max14577-muic {
> +		compatible = "maxim,max14577-muic";
> +	};
> +
> +	regulators {
> +		compatible = "maxim,max14577-regulator";
> +
> +		SAFEOUT {
> +			regulator-name = "SAFEOUT";
> +		};
> +		CHARGER {
> +			regulator-name = "CHARGER";
> +			regulator-min-microamp = <90000>;
> +			regulator-max-microamp = <950000>;
> +			regulator-boot-on;
> +		};
> +	};
> +
> +	charger {
> +		compatible = "maxim,max14577-charger";
> +
> +		maxim,fast-charge-timer = <6>;
> +		maxim,constant-uvolt = <4350000>;
> +		maxim,fast-charge-uamp = <450000>;
> +		maxim,eoc-uamp = <50000>;
> +		maxim,ovp-uvolt = <6500000>;
> +	};
> +};
> +
> +
> +max77836@25 {
> +	compatible = "maxim,max77836";
> +	reg = <0x25>;
> +	interrupt-parent = <&gpx1>;
> +	interrupts = <5 IRQ_TYPE_NONE>;
> +
> +	muic: max77836-muic {
> +		compatible = "maxim,max77836-muic";
> +	};
> +
> +	regulators {
> +		compatible = "maxim,max77836-regulator";
> +
> +		SAFEOUT {
> +			regulator-name = "SAFEOUT";
> +		};
> +		CHARGER {
> +			regulator-name = "CHARGER";
> +			regulator-min-microamp = <90000>;
> +			regulator-max-microamp = <950000>;
> +			regulator-boot-on;
> +		};
> +		LDO1 {
> +			regulator-name = "LDO1";
> +			regulator-min-microvolt = <2700000>;
> +			regulator-max-microvolt = <2700000>;
> +		};
> +		LDO2 {
> +			regulator-name = "LDO2";
> +			regulator-min-microvolt = <800000>;
> +			regulator-max-microvolt = <3950000>;
> +		};
> +	};
> +
> +	charger {
> +		compatible = "maxim,max77836-charger";
> +
> +		maxim,fast-charge-timer = <6>;
> +		maxim,constant-uvolt = <4350000>;
> +		maxim,fast-charge-uamp = <225000>;
> +		maxim,eoc-uamp = <7500>;
> +		maxim,ovp-uvolt = <6500000>;
> +	};
> +};
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH V4 0/8]PCI:Add SPEAr13xx PCie support
From: Pratyush Anand @ 2014-02-06 17:30 UTC (permalink / raw)
  To: Pratyush Anand, Arnd Bergmann
  Cc: devicetree@vger.kernel.org, linux-pci@vger.kernel.org,
	spear-devel, linux-kernel, linux-ide@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <cover.1391661589.git.pratyush.anand@st.com>

Hi Arnd,

Do you see any more improvement in this series.

Else we will send V5 (probably the final one) with modifications for
Kishon's comment.

Regards
Pratyush

On Thu, Feb 6, 2014 at 10:14 AM, Pratyush Anand <pratyush.anand@st.com> wrote:
> First three patches are improvement and fixes for SPEAr13xx support.
> Patches 4-6 add miphy40lp skelten driver and support for spear1310/40 miphy
> wrapper. Patch 7 add support for SPEAr13xx PCIe.
>
> These pathes are tested with linux-3.14-rc1 with following patch on the top of
> it:
> Author: Balaji T K <balajitk@ti.com>
> Date:   Mon Jan 20 16:41:27 2014 +0200
>
>     ata: ahci_platform: Manage SATA PHY
>
> Tested with SPEAr1310 evaluation board:
>         - INTEL PRO 100/100 EP card
>         - USB xhci gen2 card
>         - Above cards connected through LeCROY PTC switch
>
> Modifications for SATA are tested with SPEAr1340-evb board
>
> Changes since v3:
> - Phy driver renamed to phy-miphy40lp
> - ahci phy hook patch used as suggested by Arnd
> - Incorporated other minor comments from v3
>
> Changes since v2:
> - Incorporated comments to move SPEAr13xx PCIe and SATA phy specific routines to
>   the phy framework
> - Modify ahci driver to include phy hooks
> - phy-core driver modifications for subsys_initcall()
>
> Changes since v1:
> - Few patches of the series are already accepted and applied to mainline e.g.
>  pcie designware driver improvements,fixes for IO translation bug, PCIe dw
>  driver maintainer. So dropped these from v2.
> - Incorporated comment to move the common/reset PCIe code to the seperate driver
> - PCIe and SATA share common PHY configuration registers, so move SATA
>  platform code to the system config driver
> Fourth patch is improves pcie designware driver and fixes the IO
> translation bug. IO translation bug fix leads to the working of PCIe EP devices
> connected to RC through switch.
>
> PCIe driver support for SPEAr1310/40 platform board is added.
>
> These patches are tested with SPEAr1310 evaluation board:
>         - INTEL PRO 100/100 EP card
>         - USB xhci gen2 card
>         - Above cards connected through LeCROY PTC switch
>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-ide@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> Cc: spear-devel@list.st.com
> Cc: linux-kernel@vger.kernel.org
>
> Mohit Kumar (2):
>   SPEAr13xx: defconfig: Update
>   MAINTAINERS: Add ST SPEAr13xx PCIe driver maintainer
>
> Pratyush Anand (6):
>   clk: SPEAr13xx: Fix pcie clock name
>   SPEAr13xx: Fix static mapping table
>   phy: st-miphy-40lp: Add skeleton driver
>   SPEAr13xx: Fixup: Move SPEAr1340 SATA platform code to phy driver
>   phy: st-miphy-40lp: Add SPEAr1310 and SPEAr1340 PCIe phy support
>   pcie: SPEAr13xx: Add designware pcie support
>
>  .../devicetree/bindings/arm/spear-misc.txt         |   4 +
>  .../devicetree/bindings/pci/spear13xx-pcie.txt     |   7 +
>  .../devicetree/bindings/phy/st-miphy40lp.txt       |  12 +
>  MAINTAINERS                                        |   6 +
>  arch/arm/boot/dts/spear1310-evb.dts                |   4 +
>  arch/arm/boot/dts/spear1310.dtsi                   |  96 +++-
>  arch/arm/boot/dts/spear1340-evb.dts                |   4 +
>  arch/arm/boot/dts/spear1340.dtsi                   |  32 +-
>  arch/arm/boot/dts/spear13xx.dtsi                   |  10 +-
>  arch/arm/configs/spear13xx_defconfig               |  15 +
>  arch/arm/mach-spear/Kconfig                        |   3 +
>  arch/arm/mach-spear/include/mach/spear.h           |   4 +-
>  arch/arm/mach-spear/spear1340.c                    | 127 +----
>  arch/arm/mach-spear/spear13xx.c                    |   2 +-
>  drivers/clk/spear/spear1310_clock.c                |   6 +-
>  drivers/clk/spear/spear1340_clock.c                |   2 +-
>  drivers/pci/host/Kconfig                           |   5 +
>  drivers/pci/host/Makefile                          |   1 +
>  drivers/pci/host/pcie-spear13xx.c                  | 414 ++++++++++++++++
>  drivers/phy/Kconfig                                |   6 +
>  drivers/phy/Makefile                               |   1 +
>  drivers/phy/phy-miphy40lp.c                        | 544 +++++++++++++++++++++
>  22 files changed, 1166 insertions(+), 139 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/arm/spear-misc.txt
>  create mode 100644 Documentation/devicetree/bindings/pci/spear13xx-pcie.txt
>  create mode 100644 Documentation/devicetree/bindings/phy/st-miphy40lp.txt
>  create mode 100644 drivers/pci/host/pcie-spear13xx.c
>  create mode 100644 drivers/phy/phy-miphy40lp.c
>
> --
> 1.8.1.2
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 2/2] mfd: max14577: Add device tree bindings document
From: Tomasz Figa @ 2014-02-06 17:27 UTC (permalink / raw)
  To: k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ, t.figa-Sze3O3UU22JBDgjK7y7TUQ
  Cc: Kyungmin Park, Marek Szyprowski,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
	Mark Rutland
In-Reply-To: <1391707641-13543-1-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

From: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Add document describing device tree bindings for MAX14577 MFD driver
(for both MAX14577 and MAX77836 chipsets).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Kyungmin Park <kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
---
 Documentation/devicetree/bindings/mfd/max14577.txt |  149 ++++++++++++++++++++
 1 file changed, 149 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/max14577.txt

diff --git a/Documentation/devicetree/bindings/mfd/max14577.txt b/Documentation/devicetree/bindings/mfd/max14577.txt
new file mode 100644
index 0000000..f59a4f3
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/max14577.txt
@@ -0,0 +1,149 @@
+Maxim MAX14577/77836 Multi-Function Device
+
+MAX14577 is a Multi-Function Device with Micro-USB Interface Circuit, Li+
+Battery Charger and SFOUT LDO output for powering USB devices. It is
+interfaced to host controller using I2C.
+
+MAX77836 additionally contains PMIC (with two LDO regulators) and Fuel Gauge.
+
+
+Required properties:
+- compatible : Must be "maxim,max14577" or "maxim,max77836".
+- reg : I2C slave address for the max14577 chip (0x25 for max14577/max77836)
+- interrupts : IRQ line for the chip.
+- interrupt-parent :  The parent interrupt controller.
+
+
+Optional nodes:
+- max14577-muic/max77836-muic :
+	Node used only by extcon consumers.
+	Required properties:
+		- compatible : "maxim,max14577-muic" or "maxim,max77836-muic"
+
+- regulators :
+	Required properties:
+		- compatible : "maxim,max14577-regulator"
+			or "maxim,max77836-regulator"
+
+	May contain a sub-node per regulator from the list below. Each
+	sub-node should contain the constraints and initialization information
+	for that regulator. See regulator.txt for a description of standard
+	properties for these sub-nodes.
+
+	List of valid regulator names:
+	- for max14577: CHARGER, SAFEOUT.
+	- for max77836: CHARGER, SAFEOUT, LDO1, LDO2.
+
+	The SAFEOUT is a fixed voltage regulator so there is no need to specify
+	voltages for it.
+
+ - charger :
+	Required properties:
+		- compatible : "maxim,max14577-charger"
+			or "maxim,max77836-charger"
+		- maxim,fast-charge-timer : Timer in hours to trigger the
+			INT3/MBCCHGERR interrupt; Valid values:
+			- 5, 6 or 7 (hours),
+			- 0 to disable.
+		- maxim,fast-charge-uamp : Current in uA for Fast Charge;
+			Valid values:
+			- for max14577: 90000 - 950000;
+			- for max77836: 45000 - 475000;
+		- maxim,eoc-uamp : Current in uA for End-Of-Charge mode;
+			Valid values:
+			- for max14577: 50000 - 200000;
+			- for max77836: 5000 - 10000;
+		- maxim,ovp-uvolt : OverVoltage Protection Threshold in uV;
+			In an overvoltage condition, INT asserts and charging
+			stops. Valid values:
+			- 6000000, 6500000, 7000000, 7500000;
+		- maxim,constant-uvolt : Battery Constant Voltage in uV;
+			Valid values:
+			- 4000000 - 4280000;
+			- 4350000;
+
+
+Example:
+
+#include <dt-bindings/interrupt-controller/irq.h>
+
+max14577@25 {
+	compatible = "maxim,max14577";
+	reg = <0x25>;
+	interrupt-parent = <&gpx1>;
+	interrupts = <5 IRQ_TYPE_NONE>;
+
+	muic: max14577-muic {
+		compatible = "maxim,max14577-muic";
+	};
+
+	regulators {
+		compatible = "maxim,max14577-regulator";
+
+		SAFEOUT {
+			regulator-name = "SAFEOUT";
+		};
+		CHARGER {
+			regulator-name = "CHARGER";
+			regulator-min-microamp = <90000>;
+			regulator-max-microamp = <950000>;
+			regulator-boot-on;
+		};
+	};
+
+	charger {
+		compatible = "maxim,max14577-charger";
+
+		maxim,fast-charge-timer = <6>;
+		maxim,constant-uvolt = <4350000>;
+		maxim,fast-charge-uamp = <450000>;
+		maxim,eoc-uamp = <50000>;
+		maxim,ovp-uvolt = <6500000>;
+	};
+};
+
+
+max77836@25 {
+	compatible = "maxim,max77836";
+	reg = <0x25>;
+	interrupt-parent = <&gpx1>;
+	interrupts = <5 IRQ_TYPE_NONE>;
+
+	muic: max77836-muic {
+		compatible = "maxim,max77836-muic";
+	};
+
+	regulators {
+		compatible = "maxim,max77836-regulator";
+
+		SAFEOUT {
+			regulator-name = "SAFEOUT";
+		};
+		CHARGER {
+			regulator-name = "CHARGER";
+			regulator-min-microamp = <90000>;
+			regulator-max-microamp = <950000>;
+			regulator-boot-on;
+		};
+		LDO1 {
+			regulator-name = "LDO1";
+			regulator-min-microvolt = <2700000>;
+			regulator-max-microvolt = <2700000>;
+		};
+		LDO2 {
+			regulator-name = "LDO2";
+			regulator-min-microvolt = <800000>;
+			regulator-max-microvolt = <3950000>;
+		};
+	};
+
+	charger {
+		compatible = "maxim,max77836-charger";
+
+		maxim,fast-charge-timer = <6>;
+		maxim,constant-uvolt = <4350000>;
+		maxim,fast-charge-uamp = <225000>;
+		maxim,eoc-uamp = <7500>;
+		maxim,ovp-uvolt = <6500000>;
+	};
+};
-- 
1.7.9.5

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

^ permalink raw reply related

* Re: [PATCH 4/4] ARM: Kirkwood: Add support for many Synology NAS devices
From: Jason Cooper @ 2014-02-06 17:26 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Arnd Bergmann, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Mark Rutland, Ben Peddell, pawel.moll-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kumar Gala, Ian Campbell
In-Reply-To: <20140206170333.GK29860-g2DYL2Zd6BY@public.gmane.org>

On Thu, Feb 06, 2014 at 06:03:33PM +0100, Andrew Lunn wrote:
> On Thu, Feb 06, 2014 at 05:38:28PM +0100, Arnd Bergmann wrote:
> > On Thursday 06 February 2014 17:01:26 Andrew Lunn wrote:
> > 
> > > , but this is, imho,
> > > > over-fragmenting.  I'm sure there's a reason you chose this path, but
> > > > you haven't explained why in your commit log. So I'm left guessing...
> > > 
> > > Synology seem to build there devices like lego. They have two
> > > different RTC blocks. They have three different fan alarm blocks, four
> > > different led blocks, etc. And to build a product, the just select a
> > > group of blocks and put them together.
> > 
> > I guess the Armada-370 and newer based ds213j and dsx14 will also be
> > able to reuse some of the blocks, right?
> 
> Hi Arnd
> 
> I've not looked at any sources for those yet. I guess the RTC .dtsi
> files should be reusable. The ethernet driver on 370 is different so
> no re-use there. Maybe the fan controller, but the rest will depend on
> what GPIO lines they have used, if they are compatible.

perhaps all of the pinctrl nodes should be moved into synology-6281,
synology-6282, and synology-370 ?

thx,

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

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox