Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reset: Add generic GPIO reset driver.
From: Philipp Zabel @ 2014-02-11 17:36 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CANh8QzwERe-zxCaAd4QujZJ4zcZ7SchK+w8u52fvJj0s5tx2nA@mail.gmail.com>

Hi Martin,

Am Dienstag, den 11.02.2014, 10:34 +0100 schrieb Fuzzey, Martin:
[...]
> >> 2) Allow hardware on discoverable busses to be rest via a GPIO line
> >> without driver modifications.
> >>
> >> Examples of the second use case include:
> >> * SDIO wifi modules
> >> * USB hub chips with a reset line
> >
> > Now this is interesting. But if you export it to userspace anyway, why
> > not use the existing gpio sysfs API?
> >
> 
> In the normal case of reset on boot the userspace interface isn't needed.
> Setting the "auto" dt property will make the kernel do the reset by
> itself during
> early boot. This is the standard use case.
> 
> The userspace interface is to let applications deal with special cases.
> It is also simpler for userspace than manlually toggling the GPIO line
> and keeps the configuration (active high / low, delay) centralised in
> the DT and consistent between the automatic on boot reset and the
> manually triggered reset.
>
> > I think a proper solution should handle this in the kernel. For SDIO
> > wifi modules you usually have a powerdown line that can be implemented
> > as an rfkill switch.
> >
> 
> I think this is too specific. It's not just for SDIO wifi. We also
> have the problem
> of a USB hub needing to be reset.
> 
> Also even for the SDIO wifi case rfkill doesn't ssem the right
> abstraction to say "reset me"
> (particularly when firmware fails to load on warm boot if you don't).

so long as you need to take devices out of reset before they can be
discovered, maybe the corresponding host controller would be the right
place to put the reset.

regards
Philipp

^ permalink raw reply

* [PATCH v2] ARM: asm: rename logical shift macros push pull into lspush lspull
From: Dave Martin @ 2014-02-11 17:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.11.1402111159230.17677@knanqh.ubzr>

On Tue, Feb 11, 2014 at 12:09:35PM -0500, Nicolas Pitre wrote:
> On Tue, 11 Feb 2014, Dave Martin wrote:
> 
> > On Mon, Feb 10, 2014 at 04:30:01PM -0500, Nicolas Pitre wrote:
> > > On Mon, 10 Feb 2014, Victor Kamensky wrote:
> > > 
> > > > Renames logical shift macros, 'push' and 'pull', defined in
> > > > arch/arm/include/asm/assembler.h, into 'lspush' and 'lspull'.
> > > 
> > > I don't have any fundamental objection to the idea, except maybe for the 
> > > actual names.  I just can't come up with anything better though.  
> > 
> > For consistency with the get_byte_ stuff, how about:
> > 
> > 	push -> towards_byte_0
> > 	pull -> from_byte_0
> > 
> > That may make the purpose a little clearer, too.
> 
> I don't know if
> 
> 	mov	r0, r1, from_byte_0 #8
> 
> is that much clearer though.
> 
> > (Assuming I've got them the right way around...)
> 
> As you later noticed you got it wrong.  :-)
> Most likely because "full from" and "push towards" are common english 
> constructs.

No more so than "pull towards" and "push from".

I'll blame it on the fact that the get_byte_ macros have wrong-
endian numbering, which I didn't look at carefully enough ;)

But I think we proved that my suggestion didn't really make things
easier to understand...

Cheers
---Dave

^ permalink raw reply

* [PATCH 4/8] ARM: mvebu: make use of of_find_matching_node_and_match
From: Josh Cartwright @ 2014-02-11 17:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211173446.GC27395@titan.lakedaemon.net>

On Tue, Feb 11, 2014 at 12:34:46PM -0500, Jason Cooper wrote:
> 
> Ok, great!  Josh, do you want us to take the two mvebu patches through
> mvebu/arm-soc?  Or would you prefer to take them?

Please, take them through the mvebu tree.

Thanks,
  Josh

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

^ permalink raw reply

* [PATCH 1/3] ARM: mvebu: remove unneeded ->map_io field for Armada 370/XP
From: Gregory CLEMENT @ 2014-02-11 17:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392138433-12573-2-git-send-email-thomas.petazzoni@free-electrons.com>

On 11/02/2014 18:07, Thomas Petazzoni wrote:
> The ->map_io() implementation of Armada 370/XP simply calls
> debug_ll_io_init(), which is exactly what the kernel does when
> ->map_io is NULL. Therefore, there is no need to have a specific
> ->map_io() implementation in Armada 370/XP.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

We missed it because the change made in arch/arm/mm/mmu.c was made in the same time
than our change in arch/arm/mach-mvebu/armada-370-xp.c to use debug_ll_io_init().


Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


> ---
>  arch/arm/mach-mvebu/armada-370-xp.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
> index f6c9d1d..161cf2f 100644
> --- a/arch/arm/mach-mvebu/armada-370-xp.c
> +++ b/arch/arm/mach-mvebu/armada-370-xp.c
> @@ -31,11 +31,6 @@
>  #include "coherency.h"
>  #include "mvebu-soc-id.h"
>  
> -static void __init armada_370_xp_map_io(void)
> -{
> -	debug_ll_io_init();
> -}
> -
>  static void __init armada_370_xp_timer_and_clk_init(void)
>  {
>  	of_clk_init(NULL);
> @@ -90,7 +85,6 @@ static const char * const armada_370_xp_dt_compat[] = {
>  DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)")
>  	.smp		= smp_ops(armada_xp_smp_ops),
>  	.init_machine	= armada_370_xp_dt_init,
> -	.map_io		= armada_370_xp_map_io,
>  	.init_time	= armada_370_xp_timer_and_clk_init,
>  	.restart	= mvebu_restart,
>  	.dt_compat	= armada_370_xp_dt_compat,
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH 2/3] ARM: mvebu: use GPIO DT defines in Armada 370/XP boards
From: Gregory CLEMENT @ 2014-02-11 17:44 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392138433-12573-3-git-send-email-thomas.petazzoni@free-electrons.com>

On 11/02/2014 18:07, Thomas Petazzoni wrote:
> Instead of harcoding 0 and 1 for the gpio specifications in the Armada
> 370/XP boards, use the <dt-bindings/gpio/gpio.h> header file and its
> GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW definitions.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


> ---
>  arch/arm/boot/dts/armada-370-mirabox.dts         | 7 ++++---
>  arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
>  arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
>  arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 9 +++++----
>  4 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
> index 944e878..2354fe0 100644
> --- a/arch/arm/boot/dts/armada-370-mirabox.dts
> +++ b/arch/arm/boot/dts/armada-370-mirabox.dts
> @@ -9,6 +9,7 @@
>   */
>  
>  /dts-v1/;
> +#include <dt-bindings/gpio/gpio.h>
>  #include "armada-370.dtsi"
>  
>  / {
> @@ -73,19 +74,19 @@
>  
>  				green_pwr_led {
>  					label = "mirabox:green:pwr";
> -					gpios = <&gpio1 31 1>;
> +					gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
>  					default-state = "keep";
>  				};
>  
>  				blue_stat_led {
>  					label = "mirabox:blue:stat";
> -					gpios = <&gpio2 0 1>;
> +					gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
>  					default-state = "off";
>  				};
>  
>  				green_stat_led {
>  					label = "mirabox:green:stat";
> -					gpios = <&gpio2 1 1>;
> +					gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
>  					default-state = "off";
>  				};
>  			};
> diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
> index abbb807..c28865d 100644
> --- a/arch/arm/boot/dts/armada-370-rd.dts
> +++ b/arch/arm/boot/dts/armada-370-rd.dts
> @@ -12,6 +12,7 @@
>   */
>  
>  /dts-v1/;
> +#include <dt-bindings/gpio/gpio.h>
>  #include "armada-370.dtsi"
>  
>  / {
> @@ -101,7 +102,7 @@
>  				button at 1 {
>  					label = "Software Button";
>  					linux,code = <116>;
> -					gpios = <&gpio0 6 1>;
> +					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
>  				};
>  			};
>  
> diff --git a/arch/arm/boot/dts/armada-xp-axpwifiap.dts b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> index c5fe572..db1ef58 100644
> --- a/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> +++ b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> @@ -16,6 +16,7 @@
>   */
>  
>  /dts-v1/;
> +#include <dt-bindings/gpio/gpio.h>
>  #include "armada-xp-mv78230.dtsi"
>  
>  / {
> @@ -158,7 +159,7 @@
>  		button at 1 {
>  			label = "Factory Reset Button";
>  			linux,code = <141>; /* KEY_SETUP */
> -			gpios = <&gpio1 1 1>;
> +			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
>  		};
>  	};
>  };
> diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> index 99bcf76..944acfb 100644
> --- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> +++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> @@ -11,6 +11,7 @@
>   */
>  
>  /dts-v1/;
> +#include <dt-bindings/gpio/gpio.h>
>  #include "armada-xp-mv78260.dtsi"
>  
>  / {
> @@ -90,19 +91,19 @@
>  
>  				red_led {
>  					label = "red_led";
> -					gpios = <&gpio1 17 1>;
> +					gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
>  					default-state = "off";
>  				};
>  
>  				yellow_led {
>  					label = "yellow_led";
> -					gpios = <&gpio1 19 1>;
> +					gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
>  					default-state = "off";
>  				};
>  
>  				green_led {
>  					label = "green_led";
> -					gpios = <&gpio1 21 1>;
> +					gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
>  					default-state = "keep";
>  				};
>  			};
> @@ -115,7 +116,7 @@
>  				button at 1 {
>  					label = "Init Button";
>  					linux,code = <116>;
> -					gpios = <&gpio1 28 0>;
> +					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
>  				};
>  			};
>  
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH v2 0/4] tty/serial: Add helpers to use GPIOs to control modem lines
From: Richard Genoud @ 2014-02-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel

The USART controller on sam9x5 chips (and also all AT91/SAMA5 chips
but at91rm9200) are not capable of handling DTR/DSR/DCD/RI signal.
Moreover, even if the controller can handle CTS/RTS, the dedicated
CTS/RTS pins are already muxed for other peripherals (LCDC/EMAC/MMC).

So this patchset adds the possibility to control those lines via GPIO,
as it is done for RTS in the patch "switch atmel serial to use gpiolib"

As it was suggested by Alexander Shiyan, I made that available for
every board.

This is based on 3.14-rc2 + Linus Walleij/Nicolas Ferre's patch:
 354e57f3a0a2 ARM/serial: at91: switch atmel serial to use gpiolib
(in Uwe's tree git://git.pengutronix.de/git/ukl/linux.git dropmachtimexh )
and Philipp Zabel's patch:
gpiolib: make gpiod_direction_output take a logical value, add gpiod_direction_output_raw
(there won't be a merge conflict if this last patch is not present, the
gpios will "just" be on the wrong direction.)
 
Tested on at91sam9g35, with a null modem cable between 2 serial ports,
one with CTS/RTS controlled by the USART controller, the other via GPIO,
full duplex transfers.
Did some tests also with null modem cables on a PC.

Updates from v2:
	- Instead of controlling modem signal only on atmel board, the
	code is now available for every board.
	- The active low flag from device tree is now used.

Richard Genoud (4):
  tty/serial: Add GPIOLIB helpers for controlling modem lines
  tty/serial: at91: use dev_err instead of printk
  tty/serial: at91: remove unused open/close hooks
  tty/serial: at91: use mctrl_gpio helpers

 .../devicetree/bindings/serial/atmel-usart.txt     |  12 +-
 Documentation/serial/driver                        |  21 ++
 arch/arm/mach-at91/at91rm9200_devices.c            |  25 ++
 arch/arm/mach-at91/at91sam9260_devices.c           |  35 +++
 arch/arm/mach-at91/at91sam9261_devices.c           |  20 ++
 arch/arm/mach-at91/at91sam9263_devices.c           |  20 ++
 arch/arm/mach-at91/at91sam9g45_devices.c           |  25 ++
 arch/arm/mach-at91/at91sam9rl_devices.c            |  25 ++
 drivers/tty/serial/Kconfig                         |   4 +
 drivers/tty/serial/Makefile                        |   3 +
 drivers/tty/serial/atmel_serial.c                  | 313 +++++++++++++++++----
 drivers/tty/serial/serial_mctrl_gpio.c             | 113 ++++++++
 drivers/tty/serial/serial_mctrl_gpio.h             |  56 ++++
 include/linux/platform_data/atmel.h                |   5 +
 14 files changed, 615 insertions(+), 62 deletions(-)
 create mode 100644 drivers/tty/serial/serial_mctrl_gpio.c
 create mode 100644 drivers/tty/serial/serial_mctrl_gpio.h

-- 
1.8.5

^ permalink raw reply

* [PATCH v2 1/4] tty/serial: Add GPIOLIB helpers for controlling modem lines
From: Richard Genoud @ 2014-02-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392140715-15295-1-git-send-email-richard.genoud@gmail.com>

This patch add some helpers to control modem lines (CTS/RTS/DSR...) via
GPIO.
This will be useful for many boards which have a serial controller that
only handle CTS/RTS pins (or even just RX/TX).

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 Documentation/serial/driver            |  21 ++++++
 drivers/tty/serial/Kconfig             |   4 ++
 drivers/tty/serial/Makefile            |   3 +
 drivers/tty/serial/serial_mctrl_gpio.c | 113 +++++++++++++++++++++++++++++++++
 drivers/tty/serial/serial_mctrl_gpio.h |  56 ++++++++++++++++
 5 files changed, 197 insertions(+)
 create mode 100644 drivers/tty/serial/serial_mctrl_gpio.c
 create mode 100644 drivers/tty/serial/serial_mctrl_gpio.h

diff --git a/Documentation/serial/driver b/Documentation/serial/driver
index c3a7689a90e6..b33f0f9e1b8e 100644
--- a/Documentation/serial/driver
+++ b/Documentation/serial/driver
@@ -429,3 +429,24 @@ thus:
 		struct uart_port	port;
 		int			my_stuff;
 	};
+
+Modem control lines via GPIO
+----------------------------
+
+Some helpers are provided in order to set/get modem control lines via GPIO.
+
+mctrl_gpio_init(dev, gpios):
+	This will get the {cts,rts,...}-gpios from device tree if they are
+	present and request them, set direction etc.
+
+mctrl_gpio_free(gpios):
+	This will free the requested gpios in mctrl_gpio_init().
+
+mctrl_gpio_set(gpios, mctrl):
+	This will sets the gpios according to the mctrl state.
+
+mctrl_gpio_get(gpios, mctrl):
+	This will update mctrl with the gpios values.
+
+get_mctrl_gpio_name(mctrl_gpio_idx):
+	Returns a name associated to the GPIO modem line.
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index a3815eaed421..58c54d7eae53 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1509,4 +1509,8 @@ config SERIAL_ST_ASC_CONSOLE
 
 endmenu
 
+config SERIAL_MCTRL_GPIO
+	def_bool y
+	depends on GPIOLIB
+
 endif # TTY
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 3680854fef41..bcf31da267dd 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -87,3 +87,6 @@ obj-$(CONFIG_SERIAL_EFM32_UART) += efm32-uart.o
 obj-$(CONFIG_SERIAL_ARC)	+= arc_uart.o
 obj-$(CONFIG_SERIAL_RP2)	+= rp2.o
 obj-$(CONFIG_SERIAL_FSL_LPUART)	+= fsl_lpuart.o
+
+# GPIOLIB helpers for modem control lines
+obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o
diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
new file mode 100644
index 000000000000..ddcc7538f487
--- /dev/null
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -0,0 +1,113 @@
+/*
+ *  Helpers for controlling modem lines via GPIO
+ *
+ *  Copyright (C) 2014 Paratronic S.A.
+ *
+ */
+
+#include <linux/device.h>
+#include <linux/gpio/consumer.h>
+#include <uapi/asm-generic/termios.h>
+
+#include "serial_mctrl_gpio.h"
+
+static const char *mctrl_gpio_of_names[UART_GPIO_MAX] = {
+	"cts", "dsr", "dcd", "ri", "rts", "dtr"
+};
+
+const char *get_mctrl_gpio_name(enum mctrl_gpio_idx idx)
+{
+	return mctrl_gpio_of_names[idx];
+}
+EXPORT_SYMBOL_GPL(get_mctrl_gpio_name);
+
+void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl)
+{
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_RTS]))
+		gpiod_set_value(gpios->gpio[UART_GPIO_RTS],
+				!!(mctrl & TIOCM_RTS));
+
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_DTR]))
+		gpiod_set_value(gpios->gpio[UART_GPIO_DTR],
+				!!(mctrl & TIOCM_DTR));
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_set);
+
+unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl)
+{
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_CTS])) {
+		if (gpiod_get_value(gpios->gpio[UART_GPIO_CTS]))
+			*mctrl |= TIOCM_CTS;
+		else
+			*mctrl &= ~TIOCM_CTS;
+	}
+
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_DSR])) {
+		if (gpiod_get_value(gpios->gpio[UART_GPIO_DSR]))
+			*mctrl |= TIOCM_DSR;
+		else
+			*mctrl &= ~TIOCM_DSR;
+	}
+
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_RI])) {
+		if (gpiod_get_value(gpios->gpio[UART_GPIO_RI]))
+			*mctrl |= TIOCM_RI;
+		else
+			*mctrl &= ~TIOCM_RI;
+	}
+
+	if (!IS_ERR_OR_NULL(gpios->gpio[UART_GPIO_DCD])) {
+		if (gpiod_get_value(gpios->gpio[UART_GPIO_DCD]))
+			*mctrl |= TIOCM_CD;
+		else
+			*mctrl &= ~TIOCM_CD;
+	}
+
+	return *mctrl;
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_get);
+
+int mctrl_gpio_init(struct device *dev, struct mctrl_gpios *gpios)
+{
+	enum mctrl_gpio_idx i;
+	int err = 0;
+	int ret = 0;
+
+	for (i = UART_GPIO_MIN; i < UART_GPIO_MAX; i++) {
+		gpios->gpio[i] = gpiod_get(dev, mctrl_gpio_of_names[i]);
+
+		/*
+		 * The GPIOs are maybe not all filled,
+		 * this is not an error.
+		 */
+		if (IS_ERR_OR_NULL(gpios->gpio[i]))
+			continue;
+
+		if (i < UART_GPIO_MAX_INPUT)
+			err = gpiod_direction_input(gpios->gpio[i]);
+		else
+			err = gpiod_direction_output(gpios->gpio[i], 0);
+		if (err) {
+			dev_err(dev, "Unable to set direction for %s GPIO",
+				mctrl_gpio_of_names[i]);
+			gpiod_put(gpios->gpio[i]);
+			gpios->gpio[i] = NULL;
+			ret--;
+		}
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_init);
+
+void mctrl_gpio_free(struct mctrl_gpios *gpios)
+{
+	enum mctrl_gpio_idx i;
+
+	for (i = UART_GPIO_MIN; i < UART_GPIO_MAX; i++)
+		if (!IS_ERR_OR_NULL(gpios->gpio[i])) {
+			gpiod_put(gpios->gpio[i]);
+			gpios->gpio[i] = NULL;
+		}
+}
+EXPORT_SYMBOL_GPL(mctrl_gpio_free);
diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h
new file mode 100644
index 000000000000..5b8be48f6442
--- /dev/null
+++ b/drivers/tty/serial/serial_mctrl_gpio.h
@@ -0,0 +1,56 @@
+/*
+ *  Helpers for controlling modem lines via GPIO
+ *
+ *  Copyright (C) 2014 Paratronic S.A.
+ *
+ */
+
+#ifndef __SERIAL_MCTRL_GPIO__
+#define __SERIAL_MCTRL_GPIO__
+
+#include <linux/gpio/consumer.h>
+
+enum mctrl_gpio_idx {
+	UART_GPIO_MIN = 0,
+	UART_GPIO_CTS = 0,
+	UART_GPIO_DSR = 1,
+	UART_GPIO_DCD = 2,
+	UART_GPIO_RI = 3,
+	UART_GPIO_MAX_INPUT = 4,
+	UART_GPIO_RTS = 4,
+	UART_GPIO_DTR = 5,
+	UART_GPIO_MAX,
+};
+
+struct mctrl_gpios {
+	struct gpio_desc *gpio[UART_GPIO_MAX];
+};
+
+/*
+ * Names of the modem lines (cts, dsr, dcd...)
+ */
+const char *get_mctrl_gpio_name(enum mctrl_gpio_idx idx);
+
+/*
+ * Set state of the modem control output lines via GPIOs.
+ */
+void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl);
+
+/*
+ * Get state of the modem control output lines from GPIOs.
+ * The mctrl flags are updated and returned.
+ */
+unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl);
+
+/*
+ * Request and set direction of modem control lines GPIOs.
+ * Returns 0 if ok, -nb_err if setting direction failed.
+ */
+int mctrl_gpio_init(struct device *dev, struct mctrl_gpios *gpios);
+
+/*
+ * Free all modem control lines GPIOs
+ */
+void mctrl_gpio_free(struct mctrl_gpios *gpios);
+
+#endif
-- 
1.8.5

^ permalink raw reply related

* [PATCH v2 2/4] tty/serial: at91: use dev_err instead of printk
From: Richard Genoud @ 2014-02-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392140715-15295-1-git-send-email-richard.genoud@gmail.com>

For better consistency.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/tty/serial/atmel_serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 91c0d8839570..ed9621a21d67 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1549,7 +1549,7 @@ static int atmel_startup(struct uart_port *port)
 	retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED,
 			tty ? tty->name : "atmel_serial", port);
 	if (retval) {
-		printk("atmel_serial: atmel_startup - Can't get irq\n");
+		dev_err(port->dev, "atmel_startup - Can't get irq\n");
 		return retval;
 	}
 
@@ -1732,7 +1732,7 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
 		clk_disable_unprepare(atmel_port->clk);
 		break;
 	default:
-		printk(KERN_ERR "atmel_serial: unknown pm %d\n", state);
+		dev_err(port->dev, "atmel_serial: unknown pm %d\n", state);
 	}
 }
 
-- 
1.8.5

^ permalink raw reply related

* [PATCH v2 3/4] tty/serial: at91: remove unused open/close hooks
From: Richard Genoud @ 2014-02-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392140715-15295-1-git-send-email-richard.genoud@gmail.com>

commit 95e629b761ce36996d1befe2824d5346b5a220b9 removed the use of board
specific hooks in serial_at91.h, so now, the open/close hook are just
dead code.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/tty/serial/atmel_serial.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index ed9621a21d67..a51b3a762948 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -112,9 +112,6 @@ static void atmel_stop_rx(struct uart_port *port);
 #define UART_PUT_TCR(port,v)	__raw_writel(v, (port)->membase + ATMEL_PDC_TCR)
 #define UART_GET_TCR(port)	__raw_readl((port)->membase + ATMEL_PDC_TCR)
 
-static int (*atmel_open_hook)(struct uart_port *);
-static void (*atmel_close_hook)(struct uart_port *);
-
 struct atmel_dma_buffer {
 	unsigned char	*buf;
 	dma_addr_t	dma_addr;
@@ -1569,17 +1566,6 @@ static int atmel_startup(struct uart_port *port)
 		if (retval < 0)
 			atmel_set_ops(port);
 	}
-	/*
-	 * If there is a specific "open" function (to register
-	 * control line interrupts)
-	 */
-	if (atmel_open_hook) {
-		retval = atmel_open_hook(port);
-		if (retval) {
-			free_irq(port->irq, port);
-			return retval;
-		}
-	}
 
 	/* Save current CSR for comparison in atmel_tasklet_func() */
 	atmel_port->irq_status_prev = UART_GET_CSR(port);
@@ -1678,13 +1664,6 @@ static void atmel_shutdown(struct uart_port *port)
 	 * Free the interrupt
 	 */
 	free_irq(port->irq, port);
-
-	/*
-	 * If there is a specific "close" function (to unregister
-	 * control line interrupts)
-	 */
-	if (atmel_close_hook)
-		atmel_close_hook(port);
 }
 
 /*
-- 
1.8.5

^ permalink raw reply related

* [PATCH v2 4/4] tty/serial: at91: use mctrl_gpio helpers
From: Richard Genoud @ 2014-02-11 17:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392140715-15295-1-git-send-email-richard.genoud@gmail.com>

On sam9x5, dedicated CTS (and RTS) pins are unusable together with the
LCDC, the EMAC, or the MMC because they share the same line.

Moreover, the USART controller doesn't handle DTR/DSR/DCD/RI signals,
so we have to control them via GPIO.

This patch permits to use GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI
signals.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 .../devicetree/bindings/serial/atmel-usart.txt     |  12 +-
 arch/arm/mach-at91/at91rm9200_devices.c            |  25 ++
 arch/arm/mach-at91/at91sam9260_devices.c           |  35 +++
 arch/arm/mach-at91/at91sam9261_devices.c           |  20 ++
 arch/arm/mach-at91/at91sam9263_devices.c           |  20 ++
 arch/arm/mach-at91/at91sam9g45_devices.c           |  25 ++
 arch/arm/mach-at91/at91sam9rl_devices.c            |  25 ++
 drivers/tty/serial/atmel_serial.c                  | 290 ++++++++++++++++++---
 include/linux/platform_data/atmel.h                |   5 +
 9 files changed, 417 insertions(+), 40 deletions(-)

diff --git a/Documentation/devicetree/bindings/serial/atmel-usart.txt b/Documentation/devicetree/bindings/serial/atmel-usart.txt
index 17c1042b2df8..77edc6504a29 100644
--- a/Documentation/devicetree/bindings/serial/atmel-usart.txt
+++ b/Documentation/devicetree/bindings/serial/atmel-usart.txt
@@ -13,8 +13,9 @@ Required properties:
 Optional properties:
 - atmel,use-dma-rx: use of PDC or DMA for receiving data
 - atmel,use-dma-tx: use of PDC or DMA for transmitting data
-- rts-gpios: specify a GPIO for RTS line. It will use specified PIO instead of the peripheral
-  function pin for the USART RTS feature. If unsure, don't specify this property.
+- {rts,cts,dtr,dsr,ri,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
+  It will use specified PIO instead of the peripheral function pin for the USART feature.
+  If unsure, don't specify this property.
 - add dma bindings for dma transfer:
 	- dmas: DMA specifier, consisting of a phandle to DMA controller node,
 		memory peripheral interface and USART DMA channel ID, FIFO configuration.
@@ -35,7 +36,12 @@ Example:
 		clock-names = "usart";
 		atmel,use-dma-rx;
 		atmel,use-dma-tx;
-		rts-gpios = <&pioD 15 0>;
+		rts-gpios = <&pioD 15 GPIO_ACTIVE_LOW>;
+		cts-gpios = <&pioD 16 GPIO_ACTIVE_LOW>;
+		dtr-gpios = <&pioD 17 GPIO_ACTIVE_LOW>;
+		dsr-gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
+		dcd-gpios = <&pioD 20 GPIO_ACTIVE_LOW>;
+		ri-gpios = <&pioD 19 GPIO_ACTIVE_LOW>;
 	};
 
 - use DMA:
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 605add05af7e..288421f38b42 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -923,6 +923,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -962,6 +967,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1013,6 +1023,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1065,6 +1080,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1109,6 +1129,11 @@ static struct atmel_uart_data uart3_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index b52527c78b12..0e20ba04d43f 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -820,6 +820,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -859,6 +864,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -911,6 +921,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -955,6 +970,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -999,6 +1019,11 @@ static struct atmel_uart_data uart3_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart3_dmamask = DMA_BIT_MASK(32);
@@ -1043,6 +1068,11 @@ static struct atmel_uart_data uart4_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart4_dmamask = DMA_BIT_MASK(32);
@@ -1082,6 +1112,11 @@ static struct atmel_uart_data uart5_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart5_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 6c1a2ecc306f..d3d7a546db9b 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -881,6 +881,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -920,6 +925,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -964,6 +974,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1008,6 +1023,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 97cc2a0d6f90..5fcb2a0383d1 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -1325,6 +1325,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1364,6 +1369,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1408,6 +1418,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1452,6 +1467,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index c10149588e21..bd44970403e5 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1588,6 +1588,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -1627,6 +1632,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1671,6 +1681,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1715,6 +1730,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1759,6 +1779,11 @@ static struct atmel_uart_data uart3_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 4120af972b61..e43623dc1c9e 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -957,6 +957,11 @@ static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 dbgu_dmamask = DMA_BIT_MASK(32);
@@ -996,6 +1001,11 @@ static struct atmel_uart_data uart0_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart0_dmamask = DMA_BIT_MASK(32);
@@ -1048,6 +1058,11 @@ static struct atmel_uart_data uart1_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart1_dmamask = DMA_BIT_MASK(32);
@@ -1092,6 +1107,11 @@ static struct atmel_uart_data uart2_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart2_dmamask = DMA_BIT_MASK(32);
@@ -1136,6 +1156,11 @@ static struct atmel_uart_data uart3_data = {
 	.use_dma_tx	= 1,
 	.use_dma_rx	= 1,
 	.rts_gpio	= -EINVAL,
+	.cts_gpio	= -EINVAL,
+	.dtr_gpio	= -EINVAL,
+	.dsr_gpio	= -EINVAL,
+	.ri_gpio	= -EINVAL,
+	.dcd_gpio	= -EINVAL,
 };
 
 static u64 uart3_dmamask = DMA_BIT_MASK(32);
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index a51b3a762948..7cb6d1954062 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -43,6 +43,8 @@
 #include <linux/platform_data/atmel.h>
 #include <linux/timer.h>
 #include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
+#include <linux/irq.h>
 
 #include <asm/io.h>
 #include <asm/ioctls.h>
@@ -57,6 +59,8 @@
 
 #include <linux/serial_core.h>
 
+#include "serial_mctrl_gpio.h"
+
 static void atmel_start_rx(struct uart_port *port);
 static void atmel_stop_rx(struct uart_port *port);
 
@@ -162,8 +166,10 @@ struct atmel_uart_port {
 	struct circ_buf		rx_ring;
 
 	struct serial_rs485	rs485;		/* rs485 settings */
-	int			rts_gpio;	/* optional RTS GPIO */
+	struct mctrl_gpios	gpios;
+	int			gpio_irq[UART_GPIO_MAX_INPUT];
 	unsigned int		tx_done_mask;
+	bool			ms_irq_enabled;
 	bool			is_usart;	/* usart or uart */
 	struct timer_list	uart_timer;	/* uart timer */
 	int (*prepare_rx)(struct uart_port *port);
@@ -237,6 +243,46 @@ static bool atmel_use_dma_rx(struct uart_port *port)
 	return atmel_port->use_dma_rx;
 }
 
+static unsigned int atmel_get_lines_status(struct uart_port *port)
+{
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+	unsigned int status, ret = 0;
+
+	status = UART_GET_CSR(port);
+
+	mctrl_gpio_get(&atmel_port->gpios, &ret);
+
+	if (!IS_ERR_OR_NULL(atmel_port->gpios.gpio[UART_GPIO_CTS])) {
+		if (ret & TIOCM_CTS)
+			status &= ~ATMEL_US_CTS;
+		else
+			status |= ATMEL_US_CTS;
+	}
+
+	if (!IS_ERR_OR_NULL(atmel_port->gpios.gpio[UART_GPIO_DSR])) {
+		if (ret & TIOCM_DSR)
+			status &= ~ATMEL_US_DSR;
+		else
+			status |= ATMEL_US_DSR;
+	}
+
+	if (!IS_ERR_OR_NULL(atmel_port->gpios.gpio[UART_GPIO_RI])) {
+		if (ret & TIOCM_RI)
+			status &= ~ATMEL_US_RI;
+		else
+			status |= ATMEL_US_RI;
+	}
+
+	if (!IS_ERR_OR_NULL(atmel_port->gpios.gpio[UART_GPIO_DCD])) {
+		if (ret & TIOCM_CD)
+			status &= ~ATMEL_US_DCD;
+		else
+			status |= ATMEL_US_DCD;
+	}
+
+	return status;
+}
+
 /* Enable or disable the rs485 support */
 void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
 {
@@ -296,17 +342,6 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
 	unsigned int mode;
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
-	/*
-	 * AT91RM9200 Errata #39: RTS0 is not internally connected
-	 * to PA21. We need to drive the pin as a GPIO.
-	 */
-	if (gpio_is_valid(atmel_port->rts_gpio)) {
-		if (mctrl & TIOCM_RTS)
-			gpio_set_value(atmel_port->rts_gpio, 0);
-		else
-			gpio_set_value(atmel_port->rts_gpio, 1);
-	}
-
 	if (mctrl & TIOCM_RTS)
 		control |= ATMEL_US_RTSEN;
 	else
@@ -319,6 +354,8 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
 
 	UART_PUT_CR(port, control);
 
+	mctrl_gpio_set(&atmel_port->gpios, mctrl);
+
 	/* Local loopback mode? */
 	mode = UART_GET_MR(port) & ~ATMEL_US_CHMODE;
 	if (mctrl & TIOCM_LOOP)
@@ -346,7 +383,8 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl)
  */
 static u_int atmel_get_mctrl(struct uart_port *port)
 {
-	unsigned int status, ret = 0;
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+	unsigned int ret = 0, status;
 
 	status = UART_GET_CSR(port);
 
@@ -362,7 +400,7 @@ static u_int atmel_get_mctrl(struct uart_port *port)
 	if (!(status & ATMEL_US_RI))
 		ret |= TIOCM_RI;
 
-	return ret;
+	return mctrl_gpio_get(&atmel_port->gpios, &ret);
 }
 
 /*
@@ -449,8 +487,38 @@ static void atmel_stop_rx(struct uart_port *port)
  */
 static void atmel_enable_ms(struct uart_port *port)
 {
-	UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC
-			| ATMEL_US_DCDIC | ATMEL_US_CTSIC);
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+	uint32_t ier = 0;
+
+	/*
+	 * Interrupt should not be enabled twice
+	 */
+	if (atmel_port->ms_irq_enabled)
+		return;
+
+	atmel_port->ms_irq_enabled = true;
+
+	if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0)
+		enable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]);
+	else
+		ier |= ATMEL_US_CTSIC;
+
+	if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0)
+		enable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]);
+	else
+		ier |= ATMEL_US_DSRIC;
+
+	if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0)
+		enable_irq(atmel_port->gpio_irq[UART_GPIO_RI]);
+	else
+		ier |= ATMEL_US_RIIC;
+
+	if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0)
+		enable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]);
+	else
+		ier |= ATMEL_US_DCDIC;
+
+	UART_PUT_IER(port, ier);
 }
 
 /*
@@ -1039,11 +1107,35 @@ atmel_handle_status(struct uart_port *port, unsigned int pending,
 static irqreturn_t atmel_interrupt(int irq, void *dev_id)
 {
 	struct uart_port *port = dev_id;
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 	unsigned int status, pending, pass_counter = 0;
+	bool gpio_handled = false;
 
 	do {
-		status = UART_GET_CSR(port);
+		status = atmel_get_lines_status(port);
 		pending = status & UART_GET_IMR(port);
+		if (!gpio_handled) {
+			/*
+			 * Dealing with GPIO interrupt
+			 */
+			if ((irq >= 0) &&
+			    (irq == atmel_port->gpio_irq[UART_GPIO_CTS]))
+				pending |= ATMEL_US_CTSIC;
+
+			if ((irq >= 0) &&
+			    (irq == atmel_port->gpio_irq[UART_GPIO_DSR]))
+				pending |= ATMEL_US_DSRIC;
+
+			if ((irq >= 0) &&
+			    (irq == atmel_port->gpio_irq[UART_GPIO_RI]))
+				pending |= ATMEL_US_RIIC;
+
+			if ((irq >= 0) &&
+			    (irq == atmel_port->gpio_irq[UART_GPIO_DCD]))
+				pending |= ATMEL_US_DCDIC;
+
+			gpio_handled = true;
+		}
 		if (!pending)
 			break;
 
@@ -1523,6 +1615,45 @@ static void atmel_get_ip_name(struct uart_port *port)
 	}
 }
 
+static void atmel_free_gpio_irq(struct uart_port *port)
+{
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+	enum mctrl_gpio_idx i;
+
+	for (i = UART_GPIO_MIN; i < UART_GPIO_MAX_INPUT; i++)
+		if (atmel_port->gpio_irq[i] >= 0)
+			free_irq(atmel_port->gpio_irq[i], port);
+}
+
+static int atmel_request_gpio_irq(struct uart_port *port)
+{
+	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+	int *irq = atmel_port->gpio_irq;
+	enum mctrl_gpio_idx i;
+	int err = 0;
+
+	for (i = UART_GPIO_MIN; (i < UART_GPIO_MAX_INPUT) && !err; i++) {
+		if (irq[i] < 0)
+			continue;
+
+		irq_set_status_flags(irq[i], IRQ_NOAUTOEN);
+		err = request_irq(irq[i], atmel_interrupt, IRQ_TYPE_EDGE_BOTH,
+				  get_mctrl_gpio_name(i), port);
+		if (err)
+			dev_err(port->dev, "atmel_startup - Can't get %s irq\n",
+				get_mctrl_gpio_name(i));
+	}
+
+	/*
+	 * If something went wrong, rollback.
+	 */
+	while (err && --i)
+		if (irq[i] >= 0)
+			free_irq(irq[i], port);
+
+	return err;
+}
+
 /*
  * Perform initialization and enable port for reception
  */
@@ -1539,6 +1670,7 @@ static int atmel_startup(struct uart_port *port)
 	 * handle an unexpected interrupt
 	 */
 	UART_PUT_IDR(port, -1);
+	atmel_port->ms_irq_enabled = false;
 
 	/*
 	 * Allocate the IRQ
@@ -1551,6 +1683,13 @@ static int atmel_startup(struct uart_port *port)
 	}
 
 	/*
+	 * Get the GPIO lines IRQ
+	 */
+	retval = atmel_request_gpio_irq(port);
+	if (retval)
+		goto free_irq;
+
+	/*
 	 * Initialize DMA (if necessary)
 	 */
 	atmel_init_property(atmel_port, pdev);
@@ -1568,7 +1707,7 @@ static int atmel_startup(struct uart_port *port)
 	}
 
 	/* Save current CSR for comparison in atmel_tasklet_func() */
-	atmel_port->irq_status_prev = UART_GET_CSR(port);
+	atmel_port->irq_status_prev = atmel_get_lines_status(port);
 	atmel_port->irq_status = atmel_port->irq_status_prev;
 
 	/*
@@ -1614,6 +1753,11 @@ static int atmel_startup(struct uart_port *port)
 	}
 
 	return 0;
+
+free_irq:
+	free_irq(port->irq, port);
+
+	return retval;
 }
 
 /*
@@ -1661,9 +1805,12 @@ static void atmel_shutdown(struct uart_port *port)
 	atmel_port->rx_ring.tail = 0;
 
 	/*
-	 * Free the interrupt
+	 * Free the interrupts
 	 */
 	free_irq(port->irq, port);
+	atmel_free_gpio_irq(port);
+
+	atmel_port->ms_irq_enabled = false;
 }
 
 /*
@@ -2327,6 +2474,86 @@ static int atmel_serial_resume(struct platform_device *pdev)
 #define atmel_serial_resume NULL
 #endif
 
+/*
+ * TODO:
+ * Suppress that stuff when the platform data is eradicated
+ */
+static int atmel_get_pdata_gpio(struct atmel_uart_port *p, struct device *dev)
+{
+	struct atmel_uart_data *pdata = dev_get_platdata(dev);
+	enum mctrl_gpio_idx i;
+	int err;
+	int ret = 0;
+
+	if (gpio_is_valid(pdata->cts_gpio))
+		p->gpios.gpio[UART_GPIO_CTS] = gpio_to_desc(pdata->cts_gpio);
+	if (gpio_is_valid(pdata->rts_gpio))
+		p->gpios.gpio[UART_GPIO_RTS] = gpio_to_desc(pdata->rts_gpio);
+	if (gpio_is_valid(pdata->dtr_gpio))
+		p->gpios.gpio[UART_GPIO_DTR] = gpio_to_desc(pdata->dtr_gpio);
+	if (gpio_is_valid(pdata->dsr_gpio))
+		p->gpios.gpio[UART_GPIO_DSR] = gpio_to_desc(pdata->dsr_gpio);
+	if (gpio_is_valid(pdata->dcd_gpio))
+		p->gpios.gpio[UART_GPIO_DCD] = gpio_to_desc(pdata->dcd_gpio);
+	if (gpio_is_valid(pdata->ri_gpio))
+		p->gpios.gpio[UART_GPIO_RI] = gpio_to_desc(pdata->ri_gpio);
+
+	for (i = UART_GPIO_MIN; i < UART_GPIO_MAX; i++) {
+		/*
+		 * The GPIOs are maybe not all filled,
+		 * this is not an error.
+		 */
+		if (IS_ERR_OR_NULL(p->gpios.gpio[i]))
+			continue;
+
+		err = devm_gpio_request(dev, desc_to_gpio(p->gpios.gpio[i]),
+					get_mctrl_gpio_name(i));
+		if (err) {
+			dev_err(dev, "error requesting %s GPIO\n",
+				get_mctrl_gpio_name(i));
+			ret--;
+			continue;
+		}
+
+		/* Default to 1 as all signals are active low */
+		(void) gpiod_sysfs_set_active_low(p->gpios.gpio[i], 1);
+
+		if (i < UART_GPIO_MAX_INPUT)
+			err = gpiod_direction_input(p->gpios.gpio[i]);
+		else
+			err = gpiod_direction_output(p->gpios.gpio[i], 0);
+		if (err) {
+			dev_err(dev, "Unable to set direction for %s GPIO",
+				get_mctrl_gpio_name(i));
+			devm_gpio_free(dev, desc_to_gpio(p->gpios.gpio[i]));
+			p->gpios.gpio[i] = NULL;
+			ret--;
+		}
+	}
+
+	return ret;
+}
+
+static int atmel_init_gpios(struct atmel_uart_port *p, struct device *dev)
+{
+	struct atmel_uart_data *pdata = dev_get_platdata(dev);
+	enum mctrl_gpio_idx i;
+	int err;
+
+	if (pdata)
+		err = atmel_get_pdata_gpio(p, dev);
+	else
+		err = mctrl_gpio_init(dev, &p->gpios);
+
+	for (i = UART_GPIO_MIN; i < UART_GPIO_MAX_INPUT; i++)
+		if (IS_ERR_OR_NULL(p->gpios.gpio[i]))
+			p->gpio_irq[i] = -EINVAL;
+		else
+			p->gpio_irq[i] = gpiod_to_irq(p->gpios.gpio[i]);
+
+	return err;
+}
+
 static int atmel_serial_probe(struct platform_device *pdev)
 {
 	struct atmel_uart_port *port;
@@ -2362,25 +2589,11 @@ static int atmel_serial_probe(struct platform_device *pdev)
 	port = &atmel_ports[ret];
 	port->backup_imr = 0;
 	port->uart.line = ret;
-	port->rts_gpio = -EINVAL; /* Invalid, zero could be valid */
-	if (pdata)
-		port->rts_gpio = pdata->rts_gpio;
-	else if (np)
-		port->rts_gpio = of_get_named_gpio(np, "rts-gpios", 0);
 
-	if (gpio_is_valid(port->rts_gpio)) {
-		ret = devm_gpio_request(&pdev->dev, port->rts_gpio, "RTS");
-		if (ret) {
-			dev_err(&pdev->dev, "error requesting RTS GPIO\n");
-			goto err;
-		}
-		/* Default to 1 as RTS is active low */
-		ret = gpio_direction_output(port->rts_gpio, 1);
-		if (ret) {
-			dev_err(&pdev->dev, "error setting up RTS GPIO\n");
-			goto err;
-		}
-	}
+	ret = atmel_init_gpios(port, &pdev->dev);
+	if (ret < 0)
+		dev_err(&pdev->dev, "Failed to initialize %d GPIOs. The serial port may not work as expected",
+			ret * -1);
 
 	ret = atmel_init_port(port, pdev);
 	if (ret)
@@ -2434,6 +2647,7 @@ err_alloc_ring:
 		port->clk = NULL;
 	}
 err:
+	mctrl_gpio_free(&port->gpios);
 	return ret;
 }
 
@@ -2457,6 +2671,8 @@ static int atmel_serial_remove(struct platform_device *pdev)
 
 	clk_put(atmel_port->clk);
 
+	mctrl_gpio_free(&atmel_port->gpios);
+
 	return ret;
 }
 
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index e26b0c14edea..565c5c693c7f 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -85,6 +85,11 @@ struct atmel_uart_data {
 	void __iomem		*regs;		/* virt. base address, if any */
 	struct serial_rs485	rs485;		/* rs485 settings */
 	int			rts_gpio;	/* optional RTS GPIO */
+	int			cts_gpio;	/* optional CTS GPIO */
+	int			dtr_gpio;	/* optional DTR GPIO */
+	int			dsr_gpio;	/* optional DSR GPIO */
+	int			dcd_gpio;	/* optional DCD GPIO */
+	int			ri_gpio;	/* optional Ring GPIO */
 };
 
  /* Touchscreen Controller */
-- 
1.8.5

^ permalink raw reply related

* [PATCH 3/8] ARM: at91: make use of of_find_matching_node_and_match
From: Nicolas Ferre @ 2014-02-11 17:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392135847-30791-4-git-send-email-joshc@codeaurora.org>

On 11/02/2014 17:24, Josh Cartwright :
> Instead of the of_find_matching_node()/of_match_node() pair, which requires two
> iterations through the match table, make use of of_find_matching_node_and_match(),
> which only iterates through the table once.
> 
> While we're here, mark the rtsc id table const.

Well, I might remove this one, just because other id tables are not
marked as "const" in the same file... So it can be good to change all of
them in a raw.


> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> ---
>  arch/arm/mach-at91/setup.c | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
> index f7ca97b..e884de8 100644
> --- a/arch/arm/mach-at91/setup.c
> +++ b/arch/arm/mach-at91/setup.c
> @@ -352,7 +352,7 @@ void __init at91_ioremap_matrix(u32 base_addr)
>  }
>  
>  #if defined(CONFIG_OF)
> -static struct of_device_id rstc_ids[] = {
> +static const struct of_device_id rstc_ids[] = {
>  	{ .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart },
>  	{ .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
>  	{ /*sentinel*/ }
> @@ -363,7 +363,7 @@ static void at91_dt_rstc(void)
>  	struct device_node *np;
>  	const struct of_device_id *of_id;
>  
> -	np = of_find_matching_node(NULL, rstc_ids);
> +	np = of_find_matching_node_and_match(NULL, rstc_ids, &of_id);
>  	if (!np)
>  		panic("unable to find compatible rstc node in dtb\n");
>  
> @@ -371,10 +371,6 @@ static void at91_dt_rstc(void)
>  	if (!at91_rstc_base)
>  		panic("unable to map rstc cpu registers\n");
>  
> -	of_id = of_match_node(rstc_ids, np);
> -	if (!of_id)
> -		panic("AT91: rtsc no restart function available\n");
> -
>  	arm_pm_restart = of_id->data;
>  
>  	of_node_put(np);
> @@ -392,7 +388,7 @@ static void at91_dt_ramc(void)
>  	struct device_node *np;
>  	const struct of_device_id *of_id;
>  
> -	np = of_find_matching_node(NULL, ramc_ids);
> +	np = of_find_matching_node_and_match(NULL, ramc_ids, &of_id);
>  	if (!np)
>  		panic("unable to find compatible ram controller node in dtb\n");
>  
> @@ -402,11 +398,7 @@ static void at91_dt_ramc(void)
>  	/* the controller may have 2 banks */
>  	at91_ramc_base[1] = of_iomap(np, 1);
>  
> -	of_id = of_match_node(ramc_ids, np);
> -	if (!of_id)
> -		pr_warn("AT91: ramc no standby function available\n");
> -	else
> -		at91_pm_set_standby(of_id->data);
> +	at91_pm_set_standby(of_id->data);

Even if it changes the strict behavior of the function, I do not see any
advantage in keeping the pr_warn() path instead of a simple panic()
protecting the "find" and "match" together...

So, without the "const" modification, it ends up with a:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

=> if you want, I can take the patch with me through arm-soc with at91
material for 3.15 and complete your "const" modification. What do you
think about that?

>  
>  	of_node_put(np);
>  }
> 

Thanks for having taking care of this file, bye,
-- 
Nicolas Ferre

^ permalink raw reply

* [PATCH 05/12] GPIO: gpio-generic: Add label to platform data
From: Lee Jones @ 2014-02-11 17:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392139256.3380.45.camel@hornet>

> > > When registering more than one platform device, it is
> > > useful to set the gpio chip label in the platform data.
> > >
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > Cc: Alexandre Courbot <gnurou@gmail.com>
> > > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > > Cc: Lee Jones <lee.jones@linaro.org>
> > > Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> > > ---
> > > This patch has been already merged by Linux; it has been included
> > > for completeness only.
> > >
> > >  drivers/gpio/gpio-generic.c     | 2 ++
> > >  include/linux/basic_mmio_gpio.h | 1 +
> > >  2 files changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> > > index d2196bf..8c778af 100644
> > > --- a/drivers/gpio/gpio-generic.c
> > > +++ b/drivers/gpio/gpio-generic.c
> > > @@ -531,6 +531,8 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
> > >             return err;
> > >
> > >     if (pdata) {
> > > +           if (pdata->label)
> >
> > Why is this check necessary?
> >
> > > +                   bgc->gc.label = pdata->label;
> 
> Because bgc->gc.label is initialized to a default value in bgpio_init()
> and I don't want to override it with NULL if there is no label passed in
> the platform data.

Ah ha, thanks for clarifying.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* [PATCH 3/3] ARM: mvebu: use input DT defines in Armada 370/XP boards
From: Gregory CLEMENT @ 2014-02-11 17:47 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392138433-12573-4-git-send-email-thomas.petazzoni@free-electrons.com>

Hi Thomas,

On 11/02/2014 18:07, Thomas Petazzoni wrote:
> Instead of harcoding keycodes specifications in the Armada 370/XP
> boards, use the <dt-bindings/input/input.h> header file and its
> keycode definitions.

It's easier to read now,

Thanks,

Gregory


> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


> ---
>  arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
>  arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
>  arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 3 ++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
> index c28865d..3e2c857 100644
> --- a/arch/arm/boot/dts/armada-370-rd.dts
> +++ b/arch/arm/boot/dts/armada-370-rd.dts
> @@ -12,6 +12,7 @@
>   */
>  
>  /dts-v1/;
> +#include <dt-bindings/input/input.h>
>  #include <dt-bindings/gpio/gpio.h>
>  #include "armada-370.dtsi"
>  
> @@ -101,7 +102,7 @@
>  				#size-cells = <0>;
>  				button at 1 {
>  					label = "Software Button";
> -					linux,code = <116>;
> +					linux,code = <KEY_POWER>;
>  					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
>  				};
>  			};
> diff --git a/arch/arm/boot/dts/armada-xp-axpwifiap.dts b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> index db1ef58..d83d7d6 100644
> --- a/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> +++ b/arch/arm/boot/dts/armada-xp-axpwifiap.dts
> @@ -17,6 +17,7 @@
>  
>  /dts-v1/;
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
>  #include "armada-xp-mv78230.dtsi"
>  
>  / {
> @@ -158,7 +159,7 @@
>  
>  		button at 1 {
>  			label = "Factory Reset Button";
> -			linux,code = <141>; /* KEY_SETUP */
> +			linux,code = <KEY_SETUP>;
>  			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
>  		};
>  	};
> diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> index 944acfb..985948c 100644
> --- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> +++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
> @@ -12,6 +12,7 @@
>  
>  /dts-v1/;
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
>  #include "armada-xp-mv78260.dtsi"
>  
>  / {
> @@ -115,7 +116,7 @@
>  
>  				button at 1 {
>  					label = "Init Button";
> -					linux,code = <116>;
> +					linux,code = <KEY_POWER>;
>  					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
>  				};
>  			};
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH 08/12] mfd: vexpress-sysreg: Add syscon labels as platform data
From: Lee Jones @ 2014-02-11 17:48 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392139946.3380.48.camel@hornet>

On Tue, 11 Feb 2014, Pawel Moll wrote:

> On Tue, 2014-02-11 at 17:29 +0000, Lee Jones wrote:
> > There must be better
> > ways of passing a name than through pdata, and if there isn't I'd
> > suggest setting up a sysconf pdata struct that others can use in case
> > they wish to expand the functionality further in some other
> > unfathomable way. :)
> 
> ... which I proposed in the previous patch :-)
> 
> > Alternatively I could define a syscon platform data structure,
> > something like this:
> > 
> > struct syscon_platform_data {
> > 	const char *label;
> > };

So you did.

Yes, this would be the lesser of the two evils. 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* [Patch v5 1/2] dmaengine: add Qualcomm BAM dma driver
From: Josh Cartwright @ 2014-02-11 17:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211173048.GP10628@intel.com>

On Tue, Feb 11, 2014 at 11:00:48PM +0530, Vinod Koul wrote:
> On Tue, Feb 04, 2014 at 02:42:35PM -0600, Andy Gross wrote:
> > Add the DMA engine driver for the QCOM Bus Access Manager (BAM) DMA controller
> > found in the MSM 8x74 platforms.
> > 
> > Each BAM DMA device is associated with a specific on-chip peripheral.  Each
> > channel provides a uni-directional data transfer engine that is capable of
> > transferring data between the peripheral and system memory (System mode), or
> > between two peripherals (BAM2BAM).
> > 
> > The initial release of this driver only supports slave transfers between
> > peripherals and system memory.
> > 
> > Signed-off-by: Andy Gross <agross@codeaurora.org>
>
> > +++ b/drivers/dma/qcom_bam_dma.c
[..]
> > +static void bam_reset_channel(struct bam_chan *bchan)
> > +{
> > +	struct bam_device *bdev = bchan->bdev;
> > +
> > +	/* reset channel */
> > +	writel_relaxed(1, bdev->regs + BAM_P_RST(bchan->id));
> > +	writel_relaxed(0, bdev->regs + BAM_P_RST(bchan->id));
> > +
> > +	/* don't allow reorder of the channel reset */
> > +	wmb();
> Documentation/memory-barriers.txt describes wmb() as a CPU barier but based on
> above you want it to be a compiler barrier then you should do 1st write,
> barrier(), second write.

It could also be that the intent was to prevent these writes from being
ordered before setting the initialized flag below, either way the
comment could be made clearer.

> > +
> > +	/* make sure hw is initialized when channel is used the first time  */
> > +	bchan->initialized = 0;
> > +}

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

^ permalink raw reply

* [Patch v5 1/2] dmaengine: add Qualcomm BAM dma driver
From: Josh Cartwright @ 2014-02-11 17:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211174910.GE841@joshc.qualcomm.com>

Ugh.

On Tue, Feb 11, 2014 at 11:49:10AM -0600, Josh Cartwright wrote:
> On Tue, Feb 11, 2014 at 11:00:48PM +0530, Vinod Koul wrote:
> > On Tue, Feb 04, 2014 at 02:42:35PM -0600, Andy Gross wrote:
> > > Add the DMA engine driver for the QCOM Bus Access Manager (BAM) DMA controller
> > > found in the MSM 8x74 platforms.
> > > 
> > > Each BAM DMA device is associated with a specific on-chip peripheral.  Each
> > > channel provides a uni-directional data transfer engine that is capable of
> > > transferring data between the peripheral and system memory (System mode), or
> > > between two peripherals (BAM2BAM).
> > > 
> > > The initial release of this driver only supports slave transfers between
> > > peripherals and system memory.
> > > 
> > > Signed-off-by: Andy Gross <agross@codeaurora.org>
> >
> > > +++ b/drivers/dma/qcom_bam_dma.c
> [..]
> > > +static void bam_reset_channel(struct bam_chan *bchan)
> > > +{
> > > +	struct bam_device *bdev = bchan->bdev;
> > > +
> > > +	/* reset channel */
> > > +	writel_relaxed(1, bdev->regs + BAM_P_RST(bchan->id));
> > > +	writel_relaxed(0, bdev->regs + BAM_P_RST(bchan->id));
> > > +
> > > +	/* don't allow reorder of the channel reset */
> > > +	wmb();
> > Documentation/memory-barriers.txt describes wmb() as a CPU barier but based on
> > above you want it to be a compiler barrier then you should do 1st write,
> > barrier(), second write.
> 
> It could also be that the intent was to prevent these writes from being
> ordered before setting the initialized flag below, either way the

          ^ after

> comment could be made clearer.

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

^ permalink raw reply

* [PATCH] ARM: dts: exynos5250-arndale: Keep G3D regulator always on
From: Tomasz Figa @ 2014-02-11 17:50 UTC (permalink / raw)
  To: linux-arm-kernel

Apparently, if G3D regulator is powered off, the SoC cannot enter low
power modes and just hangs. This patch fixes this by keeping the
regulator always on when the system is running, as suggested by Exynos 4
User's Manual in case of Exynos4210/4x12 SoCs (Exynos5250 UM does not
have such note, but observed behavior seems to confirm that it is true
for this SoC as well).

This fixes an issue preventing Arndale board from entering sleep mode
observed since commit

346f372f7b72a0 clk: exynos5250: Add CLK_IGNORE_UNUSED flag for pmu clock

that landed in kernel 3.11, which has fixed the clock driver to make the
SoC actually try to enter the sleep mode.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: stable at vger.kernel.org
---
 arch/arm/boot/dts/exynos5250-arndale.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index e14dd62..5e9ddb8 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -287,6 +287,7 @@
 					regulator-name = "vdd_g3d";
 					regulator-min-microvolt = <1000000>;
 					regulator-max-microvolt = <1000000>;
+					regulator-always-on;
 					regulator-boot-on;
 					op_mode = <1>;
 				};
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH v2 00/12] Samsung PM consolidation part 2 (multiplatform)
From: Tomasz Figa @ 2014-02-11 17:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1391713977-22300-1-git-send-email-t.figa@samsung.com>

On 06.02.2014 20:12, Tomasz Figa wrote:
> Current Samsung PM code is heavily unprepared for multiplatform systems.
> The design implies accessing functions and global variables defined in
> particular mach- subdirectory from common code in plat-, which is not
> allowed when building ARCH_MULTIPLATFORM. In addition there is a lot of
> forced code unification, which makes common function handle any possible
> quirks of all supported SoCs. In the end this design turned out to not
> work too well, ending with a lot of empty functions exported from mach-,
> just because code in common pm.c calls them. Moreover, recent trend of
> moving lower level suspend/resume code to proper drivers, like pinctrl
> or clk, made a lot of code there redundant, especially on DT-only platforms
> like Exynos.
>
> This patch series attempts to untie Exynos PM support from the legacy
> Samsung PM core and make it multiplatform-aware, by isolating truly
> generic parts of the latter, making them multiplatform-friendly and then
> reimplementing Exynos PM support in a multiplatform-capable way by using
> those generic parts. The result is that now PM initialization is started
> from mach-exynos*-dt, which calls Exynos-specific initialization code that
> registers platform_suspend_ops, so control flow is basically reversed
> ending with mach- code calling more generic plat- code if needed.
>
> This is limited to Exynos right now, but remaining SoCs could follow
> in further series.
>
> Depends on Samsung PM consolidation part 1 (clocks) series:
>   - http://thread.gmane.org/gmane.linux.kernel.samsung-soc/26816
>
> On Exynos4210-based Trats, Exynos4412-based Trats2 and Exynos5250-based
> Arndale boards (except suspend/resume, which is broken because of
> unrelated reasons):
>
> Tested-by: Tomasz Figa <t.figa@samsung.com>
>
> Changes since v1 (RFC):
>   - fixed l2x0 resume,
>   - fixed checkpatch complaints (about issues in existing code being moved),
>   - rebased on top of current linux-next,
>   - slightly reordered patches to make the order more logical.
>
> Tomasz Figa (12):
>    ARM: EXYNOS: Do not resume l2x0 if not enabled before suspend
>    ARM: SAMSUNG: Add soc_is_s3c2410() helper
>    ARM: SAMSUNG: pm: Save UART DIVSLOT register based on SoC type
>    ARM: SAMSUNG: pm: Use debug_ll_addr() to get UART base address
>    ARM: SAMSUNG: pm: Consolidate PM debug functions
>    ARM: SAMSUNG: pm: Move Samsung PM debug code into separate file
>    ARM: SAMSUNG: Move common save/restore helpers to separate file
>    ARM: SAMSUNG: pm: Move s3c_pm_check_* prototypes to plat/pm-common.h
>    ARM: EXYNOS: Kconfig: Fix abuse of CONFIG_PM
>    ARM: EXYNOS: Remove PM initcalls and useless indirection
>    ARM: EXYNOS: Stop using legacy Samsung PM code
>    ARM: exynos: Allow wake-up using GIC interrupts
>
>   arch/arm/mach-exynos/Kconfig                   |  16 +--
>   arch/arm/mach-exynos/Makefile                  |   2 +-
>   arch/arm/mach-exynos/common.c                  |   1 +
>   arch/arm/mach-exynos/common.h                  |  14 ++
>   arch/arm/mach-exynos/include/mach/pm-core.h    |  75 -----------
>   arch/arm/mach-exynos/pm.c                      | 172 +++++++++++++++++++------
>   arch/arm/mach-exynos/regs-pmu.h                |   2 +
>   arch/arm/mach-exynos/sleep.S                   |  85 ++++++++++++
>   arch/arm/mach-s3c64xx/pm.c                     |   1 -
>   arch/arm/mach-s5p64x0/pm.c                     |   1 -
>   arch/arm/plat-samsung/Makefile                 |   2 +
>   arch/arm/plat-samsung/include/plat/cpu.h       |   6 +
>   arch/arm/plat-samsung/include/plat/pm-common.h | 110 ++++++++++++++++
>   arch/arm/plat-samsung/include/plat/pm.h        |  80 +-----------
>   arch/arm/plat-samsung/pm-check.c               |   2 +-
>   arch/arm/plat-samsung/pm-common.c              |  75 +++++++++++
>   arch/arm/plat-samsung/pm-debug.c               |  98 ++++++++++++++
>   arch/arm/plat-samsung/pm.c                     | 146 ---------------------
>   arch/arm/plat-samsung/s5p-sleep.S              |  43 -------
>   19 files changed, 531 insertions(+), 400 deletions(-)
>   delete mode 100644 arch/arm/mach-exynos/include/mach/pm-core.h
>   create mode 100644 arch/arm/mach-exynos/sleep.S
>   create mode 100644 arch/arm/plat-samsung/include/plat/pm-common.h
>   create mode 100644 arch/arm/plat-samsung/pm-common.c
>   create mode 100644 arch/arm/plat-samsung/pm-debug.c
>

With patch

[PATCH] ARM: dts: exynos5250-arndale: Keep G3D regulator always on

on Exynos5250-based Arndale board, including suspend to RAM:

Tested-by: Tomasz Figa <t.figa@samsung.com>

Best regards,
Tomasz

^ permalink raw reply

* [PATCH v2 1/2] mfd: syscon: Add platform data with a regmap config name
From: Pawel Moll @ 2014-02-11 17:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211174829.GJ15081@lee--X1>

Define syscon platform data structure that can be used
to define a regmap config name. This is particularly useful
in the regmap debugfs when there is more than one syscon
device registered, to distinguish the register blocks.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/mfd/syscon.c                 | 4 ++++
 include/linux/platform_data/syscon.h | 8 ++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 include/linux/platform_data/syscon.h

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 71841f9..854b8d9 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/syscon.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
@@ -126,6 +127,7 @@ static struct regmap_config syscon_regmap_config = {
 static int syscon_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct syscon_platform_data *pdata = dev_get_platdata(dev);
 	struct syscon *syscon;
 	struct resource *res;
 	void __iomem *base;
@@ -143,6 +145,8 @@ static int syscon_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	syscon_regmap_config.max_register = res->end - res->start - 3;
+	if (pdata)
+		syscon_regmap_config.name = pdata->label;
 	syscon->regmap = devm_regmap_init_mmio(dev, base,
 					&syscon_regmap_config);
 	if (IS_ERR(syscon->regmap)) {
diff --git a/include/linux/platform_data/syscon.h b/include/linux/platform_data/syscon.h
new file mode 100644
index 0000000..921e59a
--- /dev/null
+++ b/include/linux/platform_data/syscon.h
@@ -0,0 +1,8 @@
+#ifndef PLATFORM_DATA_SYSCON_H
+#define PLATFORM_DATA_SYSCON_H
+
+struct syscon_platform_data {
+	        const char *label;
+};
+
+#endif
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH v2 2/2] mfd: vexpress-sysreg: Add syscon labels as platform data
From: Pawel Moll @ 2014-02-11 17:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392141165-14338-1-git-send-email-pawel.moll@arm.com>

This patch adds platform data with label names for syscon
registers in the relevant MFD cells.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 drivers/mfd/vexpress-sysreg.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index ece5ac8..952df84 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -17,6 +17,7 @@
 #include <linux/mfd/core.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
+#include <linux/platform_data/syscon.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
@@ -132,6 +133,10 @@ void __init vexpress_sysreg_early_init(void __iomem *base)
 
 /* The sysreg block is just a random collection of various functions... */
 
+static struct syscon_platform_data vexpress_sysreg_sys_id_pdata = {
+	.label = "sys_id",
+};
+
 static struct bgpio_pdata vexpress_sysreg_sys_led_pdata = {
 	.label = "sys_led",
 	.base = -1,
@@ -150,6 +155,14 @@ static struct bgpio_pdata vexpress_sysreg_sys_flash_pdata = {
 	.ngpio = 1,
 };
 
+static struct syscon_platform_data vexpress_sysreg_sys_misc_pdata = {
+	.label = "sys_misc",
+};
+
+static struct syscon_platform_data vexpress_sysreg_sys_procid_pdata = {
+	.label = "sys_procid",
+};
+
 static struct mfd_cell vexpress_sysreg_cells[] = {
 	{
 		.name = "syscon",
@@ -157,6 +170,8 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_ID, 0x4),
 		},
+		.platform_data = &vexpress_sysreg_sys_id_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_id_pdata),
 	}, {
 		.name = "basic-mmio-gpio",
 		.of_compatible = "arm,vexpress-sysreg,sys_led",
@@ -190,12 +205,16 @@ static struct mfd_cell vexpress_sysreg_cells[] = {
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_MISC, 0x4),
 		},
+		.platform_data = &vexpress_sysreg_sys_misc_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_misc_pdata),
 	}, {
 		.name = "syscon",
 		.num_resources = 1,
 		.resources = (struct resource []) {
 			DEFINE_RES_MEM(SYS_PROCID0, 0x8),
 		},
+		.platform_data = &vexpress_sysreg_sys_procid_pdata,
+		.pdata_size = sizeof(vexpress_sysreg_sys_procid_pdata),
 	}, {
 		.name = "vexpress-syscfg",
 		.num_resources = 1,
-- 
1.8.3.2

^ permalink raw reply related

* [PATCH v2 0/2] ohci-/ehci-platform: Change compatible string to generic-?hci
From: Kevin Hilman @ 2014-02-11 17:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392136529-5060-1-git-send-email-hdegoede@redhat.com>

Hans de Goede <hdegoede@redhat.com> writes:

> Hi Greg,
>
> And here is v2 of my ohci-/ehci-platform fixes for the regression of USB
> support on various ARM boards I caused in linux-next.
>
> As expected some people still did not like the ?hci-platform compatible
> string I went for in v1, hence this v2. The good news is it seems everyone
> seems to be able to live with generic-?hci as compatible now, so it seems this
> issue is finally settled.
>
> Please add these 2 patches to your usb-next tree, as said in the cover-letter
> of v1, I'm fine with you squashing these into the first 2 patches of my
> original series, but if you want them separate to preserve history that is
> fine too.

I tested this series on top of next-20140211 on the OMAP platforms where
I noticed the regressions, and confirm it fixes the problem.

Tested-by: Kevin Hilman <khilman@linaro.org>

Kevin

^ permalink raw reply

* [PATCH v2 1/2] mfd: syscon: Add platform data with a regmap config name
From: Pawel Moll @ 2014-02-11 17:55 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1392141165-14338-1-git-send-email-pawel.moll@arm.com>

On Tue, 2014-02-11 at 17:52 +0000, Pawel Moll wrote:
> +	        const char *label;

Obviously should be a single tab only:

+       const char *label;

Pawel

^ permalink raw reply

* [PATCH v2] ARM: asm: rename logical shift macros push pull into lspush lspull
From: Nicolas Pitre @ 2014-02-11 17:58 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211173754.GE3035@e103592.cambridge.arm.com>

On Tue, 11 Feb 2014, Dave Martin wrote:

> On Tue, Feb 11, 2014 at 12:09:35PM -0500, Nicolas Pitre wrote:
> > On Tue, 11 Feb 2014, Dave Martin wrote:
> > 
> > > On Mon, Feb 10, 2014 at 04:30:01PM -0500, Nicolas Pitre wrote:
> > > > On Mon, 10 Feb 2014, Victor Kamensky wrote:
> > > > 
> > > > > Renames logical shift macros, 'push' and 'pull', defined in
> > > > > arch/arm/include/asm/assembler.h, into 'lspush' and 'lspull'.
> > > > 
> > > > I don't have any fundamental objection to the idea, except maybe for the 
> > > > actual names.  I just can't come up with anything better though.  
> > > 
> > > For consistency with the get_byte_ stuff, how about:
> > > 
> > > 	push -> towards_byte_0
> > > 	pull -> from_byte_0
> > > 
> > > That may make the purpose a little clearer, too.
> > 
> > I don't know if
> > 
> > 	mov	r0, r1, from_byte_0 #8
> > 
> > is that much clearer though.
> > 
> > > (Assuming I've got them the right way around...)
> > 
> > As you later noticed you got it wrong.  :-)
> > Most likely because "full from" and "push towards" are common english 
> > constructs.
> 
> No more so than "pull towards" and "push from".

OK.  I'll trust you on that account.

> I'll blame it on the fact that the get_byte_ macros have wrong-
> endian numbering, which I didn't look at carefully enough ;)
> 
> But I think we proved that my suggestion didn't really make things
> easier to understand...

What about:

	push -> next
	pull -> prev

?

That would make:

	mov	r0, r1, next #8


Nicolas

^ permalink raw reply

* [Patch v5 1/2] dmaengine: add Qualcomm BAM dma driver
From: Vinod Koul @ 2014-02-11 18:03 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140211174910.GE841@joshc.qualcomm.com>

On Tue, Feb 11, 2014 at 11:49:10AM -0600, Josh Cartwright wrote:
> On Tue, Feb 11, 2014 at 11:00:48PM +0530, Vinod Koul wrote:
> > On Tue, Feb 04, 2014 at 02:42:35PM -0600, Andy Gross wrote:
> > > Add the DMA engine driver for the QCOM Bus Access Manager (BAM) DMA controller
> > > found in the MSM 8x74 platforms.
> > > 
> > > Each BAM DMA device is associated with a specific on-chip peripheral.  Each
> > > channel provides a uni-directional data transfer engine that is capable of
> > > transferring data between the peripheral and system memory (System mode), or
> > > between two peripherals (BAM2BAM).
> > > 
> > > The initial release of this driver only supports slave transfers between
> > > peripherals and system memory.
> > > 
> > > Signed-off-by: Andy Gross <agross@codeaurora.org>
> >
> > > +++ b/drivers/dma/qcom_bam_dma.c
> [..]
> > > +static void bam_reset_channel(struct bam_chan *bchan)
> > > +{
> > > +	struct bam_device *bdev = bchan->bdev;
> > > +
> > > +	/* reset channel */
> > > +	writel_relaxed(1, bdev->regs + BAM_P_RST(bchan->id));
> > > +	writel_relaxed(0, bdev->regs + BAM_P_RST(bchan->id));
> > > +
> > > +	/* don't allow reorder of the channel reset */
> > > +	wmb();
> > Documentation/memory-barriers.txt describes wmb() as a CPU barier but based on
> > above you want it to be a compiler barrier then you should do 1st write,
> > barrier(), second write.
> 
> It could also be that the intent was to prevent these writes from being
> ordered before setting the initialized flag below, either way the
> comment could be made clearer.
yes for that case, but i am suspecting the comment is correct as it would make
sense to ensure reset is in sequence...

-- 
~Vinod
> 
> > > +
> > > +	/* make sure hw is initialized when channel is used the first time  */
> > > +	bchan->initialized = 0;
> > > +}
> 
-- 

^ permalink raw reply

* [PATCH v3 3/5] ARM: qcom: Split Qualcomm support into legacy and multiplatform
From: Bryan Huntsman @ 2014-02-11 18:10 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <392A0D29-65A3-403D-B645-DB74A1897170@codeaurora.org>

On 02/11/2014 07:13 AM, Kumar Gala wrote:
>>>  *  Copyright (c) 2010, Code Aurora Forum. All rights reserved.
>>> >> + *  Copyright (c) 2014 The Linux Foundation. All rights reserved.
>> > 
>> > We should replace the Code Aurora Forum copyright with Linux
>> > Foundation here.
> Is this something we?ve been doing?  Its normally bad form to make such changes, but I don?t know what the details re when LF took over CAF w/regards to something like Copyright.
> 
> - k

Yes, the line should read:

- *  Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+ *  Copyright (c) 2010,2014 The Linux Foundation. All rights reserved.

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

^ 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