Linux Serial subsystem development
 help / color / mirror / Atom feed
* Re: [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).
From: Alan Cox @ 2012-11-21 21:30 UTC (permalink / raw)
  To: Ilya Zykov
  Cc: Andrew McGregor, Greg Kroah-Hartman, Alan Cox, linux-kernel,
	linux-serial
In-Reply-To: <50AD43DB.4030800@ilyx.ru>

> Function reset_buffer_flags() also invoked during the
> ioctl(...,TCFLSH,..). At the time of request we can have full buffers
> and throttled driver too. If we don't unthrottle driver, we can get
> forever throttled driver, because after request, we will have
> empty buffers and throttled driver and there is no place to unthrottle driver.
> It simple reproduce with "pty" pair then one side sleep on tty->write_wait,
> and other side do ioctl(...,TCFLSH,..). Then there is no place to do writers wake up.


So instead of revertng it why not just fix it ? Just add an argument to
the reset_buffer_flags function to indicate if unthrottling is permitted.

Alan

^ permalink raw reply

* Re: [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
From: Grant Likely @ 2012-11-22 15:31 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Greg Kroah-Hartman, devicetree-discuss, Sascha Hauer,
	Sascha Hauer,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Alan Cox
In-Reply-To: <20121122054138.GY4398-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>

On Thu, 22 Nov 2012 06:41:38 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> wrote:
> On 18:03 Wed 21 Nov     , Grant Likely wrote:
> > On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
> > <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> wrote:
> > > From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > >
> > > devicetrees may have a linux,stdout-path or stdout-path property
> > > in the chosen node describing the console device. This adds a helper
> > > function to match a device against this property and retrieve the options
> > > so a driver can call add_preferred_console for a matching device.
> > 
> > NIce. Looks like the right behaviour, but is a little inefficient.
> > Since the stdout property doesn't change this code could be called
> > once right after the tree is unflattened and then cache the pointer to
> > the node anarguments. Can you add the code to of_alias_scan()?
> do we assume that we can have only one stdout-path?
> 
> I think we could have more serial, framebuffer console

Nope. stdout-path as currently defined is only one device. Someone would
need to propose an extension for multiple stdout's before I'd bother
trying to support that.

g.

^ permalink raw reply

* [PATCH] serial: ifx6x60: Add modem power off function in the platform reboot process
From: Jun Chen @ 2012-11-22 11:19 UTC (permalink / raw)
  To: Alan Cox; +Cc: Bi Chao, Jun Chen, serial, Linux Kernel, russ.gorby


This patch add modem power off function in the reboot process according registering
reboot callback to the reboot_notifier_list. Also realizing the spi shutdown function.

Signed-off-by: Bi Chao <chao.bi@intel.com>
Signed-off-by: Chen Jun <jun.d.chen@intel.com>
---
 drivers/tty/serial/ifx6x60.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 5b9bc19..a91f4cb 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -60,6 +60,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/spi/ifx_modem.h>
 #include <linux/delay.h>
+#include <linux/reboot.h>
 
 #include "ifx6x60.h"
 
@@ -72,8 +73,14 @@
 #define IFX_SPI_HEADER_0		(-1)
 #define IFX_SPI_HEADER_F		(-2)
 
+#define PO_POST_DELAY		200
+#define IFX_MDM_RST_PMU	4
+
 /* forward reference */
 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
+static int ifx_modem_reboot_callback(struct notifier_block *nfb,
+				unsigned long event, void *data);
+static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev);
 
 /* local variables */
 static int spi_bpw = 16;		/* 8, 16 or 32 bit word length */
@@ -81,6 +88,29 @@ static struct tty_driver *tty_drv;
 static struct ifx_spi_device *saved_ifx_dev;
 static struct lock_class_key ifx_spi_key;
 
+static struct notifier_block ifx_modem_reboot_notifier_block = {
+	.notifier_call = ifx_modem_reboot_callback,
+};
+
+static int ifx_modem_power_off(struct ifx_spi_device *ifx_dev)
+{
+	gpio_set_value(IFX_MDM_RST_PMU, 1);
+	msleep(PO_POST_DELAY);
+
+	return 0;
+}
+
+static int ifx_modem_reboot_callback(struct notifier_block *nfb,
+				 unsigned long event, void *data)
+{
+	if (saved_ifx_dev)
+		ifx_modem_power_off(saved_ifx_dev);
+	else
+		pr_warn("no ifx modem active \n");
+
+	return NOTIFY_OK;
+}
+
 /* GPIO/GPE settings */
 
 /**
@@ -1219,6 +1249,9 @@ static int ifx_spi_spi_remove(struct spi_device *spi)
 
 static void ifx_spi_spi_shutdown(struct spi_device *spi)
 {
+	struct ifx_spi_device *ifx_dev = spi_get_drvdata(spi);
+
+	ifx_modem_power_off(ifx_dev);
 }
 
 /*
@@ -1368,6 +1401,7 @@ static void __exit ifx_spi_exit(void)
 static int __init ifx_spi_init(void)
 {
 	int result;
+	int ret;
 
 	tty_drv = alloc_tty_driver(1);
 	if (!tty_drv) {
@@ -1399,6 +1433,11 @@ static int __init ifx_spi_init(void)
 			DRVNAME, result);
 		tty_unregister_driver(tty_drv);
 	}
+
+	ret = register_reboot_notifier(&ifx_modem_reboot_notifier_block);
+	if (ret)
+		pr_err("cannot register reboot notifier (err=%d)\n", ret);
+
 	return result;
 }
 
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH] serial: ifx6x60: Add modem power off function in the platform reboot process
From: Alan Cox @ 2012-11-22 11:08 UTC (permalink / raw)
  To: Jun Chen; +Cc: Bi Chao, serial, Linux Kernel, russ.gorby
In-Reply-To: <1353583163.23300.7.camel@chenjun-workstation>

On Thu, 22 Nov 2012 06:19:23 -0500
Jun Chen <jun.d.chen@intel.com> wrote:

> 
> This patch add modem power off function in the reboot process
> according registering reboot callback to the reboot_notifier_list.
> Also realizing the spi shutdown function.

Need to unregister the reboot notifier in the ifx_spi_exit path. If the
driver module is unloaded you leave the callback present and the kernel
will call into freed memory.

Alan

^ permalink raw reply

* Re: [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
From: Alan Cox @ 2012-11-22 11:06 UTC (permalink / raw)
  To: chao bi; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel
In-Reply-To: <1353573787.22077.8.camel@bichao>

On Thu, 22 Nov 2012 16:43:07 +0800
chao bi <chao.bi@intel.com> wrote:

> 
> When shut down SPI port, it's possible that MRDY has been asserted
> and a SPI timer was activated waiting for SRDY assert, in the case,
> it needs to delete this timer.
> 
> Signed-off-by: Chen Jun <jun.d.chen@intel.com>
> Signed-off-by: channing <chao.bi@intel.com>
> ---
>  drivers/tty/serial/ifx6x60.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/ifx6x60.c
> b/drivers/tty/serial/ifx6x60.c index 5b9bc19..467020b 100644
> --- a/drivers/tty/serial/ifx6x60.c
> +++ b/drivers/tty/serial/ifx6x60.c
> @@ -552,7 +552,10 @@ static void ifx_port_shutdown(struct tty_port
> *port) container_of(port, struct ifx_spi_device, tty_port);
>  
>  	mrdy_set_low(ifx_dev);
> -	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
> +	if (test_and_clear_bit(IFX_SPI_STATE_TIMER_PENDING,
> +		&ifx_dev->flags)) {
> +		del_timer(&ifx_dev->spi_timer);
> +	}

You don't actually need the test here as far as I can see. Providing a
timer has been initialised (init_timer) then running del_timer is safe
even if the timer is not currently queued or has completed.

Alan

^ permalink raw reply

* [PATCH] serial: samsung: add devicetree properties for non-Exynos SoCs
From: Heiko Stübner @ 2012-11-22 10:37 UTC (permalink / raw)
  To: Alan Cox, Greg Kroah-Hartman; +Cc: linux-serial, linux-kernel

Until now only the Exynos SoCs could use the serial driver via the
device tree. This patch adds compatible properties for the other
supported SoCs as well.

Tested on a s3c2416 based machine.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/tty/serial/samsung.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 740458c..60eb125 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1701,6 +1701,16 @@ MODULE_DEVICE_TABLE(platform, s3c24xx_serial_driver_ids);
 
 #ifdef CONFIG_OF
 static const struct of_device_id s3c24xx_uart_dt_match[] = {
+	{ .compatible = "samsung,s3c2410-uart",
+		.data = (void *)S3C2410_SERIAL_DRV_DATA },
+	{ .compatible = "samsung,s3c2412-uart",
+		.data = (void *)S3C2412_SERIAL_DRV_DATA },
+	{ .compatible = "samsung,s3c2440-uart",
+		.data = (void *)S3C2440_SERIAL_DRV_DATA },
+	{ .compatible = "samsung,s3c6400-uart",
+		.data = (void *)S3C6400_SERIAL_DRV_DATA },
+	{ .compatible = "samsung,s5pv210-uart",
+		.data = (void *)S5PV210_SERIAL_DRV_DATA },
 	{ .compatible = "samsung,exynos4210-uart",
 		.data = (void *)EXYNOS4210_SERIAL_DRV_DATA },
 	{},
-- 
1.7.2.3

^ permalink raw reply related

* [PATCH] serial:ifx6x60:Delete SPI timer when shut down port
From: chao bi @ 2012-11-22  8:43 UTC (permalink / raw)
  To: alan; +Cc: richardx.r.gorby, jun.d.chen, linux-serial, linux-kernel


When shut down SPI port, it's possible that MRDY has been asserted and a SPI
timer was activated waiting for SRDY assert, in the case, it needs to delete
this timer.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 5b9bc19..467020b 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -552,7 +552,10 @@ static void ifx_port_shutdown(struct tty_port *port)
 		container_of(port, struct ifx_spi_device, tty_port);
 
 	mrdy_set_low(ifx_dev);
-	clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
+	if (test_and_clear_bit(IFX_SPI_STATE_TIMER_PENDING,
+		&ifx_dev->flags)) {
+		del_timer(&ifx_dev->spi_timer);
+	}
 	tasklet_kill(&ifx_dev->io_work_tasklet);
 }
 
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH 1/6] DMA: AT91: Serial: Add parameter for serial dma use
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-22  7:44 UTC (permalink / raw)
  To: Elen Song; +Cc: nicolas.ferre, linux-serial, linux-arm-kernel
In-Reply-To: <50ADD70B.6070801@atmel.com>

On 15:40 Thu 22 Nov     , Elen Song wrote:
> On 2012-10-30 14:39, Elen Song wrote:
> >On 2012-10-29 19:42, Jean-Christophe PLAGNIOL-VILLARD wrote:
> >>On 17:09 Mon 29 Oct     , Elen Song wrote:
> >>>Signed-off-by: Elen Song <elen.song@atmel.com>
> >>>---
> >>>  arch/arm/mach-at91/include/mach/board.h |    2 ++
> >>>  drivers/tty/serial/atmel_serial.c       |    1 +
> >>>  include/linux/platform_data/dma-atmel.h |   10 ++++++++++
> >>>  3 files changed, 13 insertions(+)
> >>you will have to rebase this over a clean if the platofrm_data
> >>I'll send today
> >>or tomorrow that will move all the platform_data to inclide/linux
> >
> >ok, please cc me in the mail list.
> Hi JC:
> 
>     any more feedback ?
no time finish to prepare the 3.8 will have to wait after

Best Regards,
J.

^ permalink raw reply

* Re: [PATCH 1/6] DMA: AT91: Serial: Add parameter for serial dma use
From: Elen Song @ 2012-11-22  7:40 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD, nicolas.ferre
  Cc: linux-serial, linux-arm-kernel
In-Reply-To: <508F7629.2040905@atmel.com>

On 2012-10-30 14:39, Elen Song wrote:
> On 2012-10-29 19:42, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 17:09 Mon 29 Oct     , Elen Song wrote:
>>> Signed-off-by: Elen Song <elen.song@atmel.com>
>>> ---
>>>   arch/arm/mach-at91/include/mach/board.h |    2 ++
>>>   drivers/tty/serial/atmel_serial.c       |    1 +
>>>   include/linux/platform_data/dma-atmel.h |   10 ++++++++++
>>>   3 files changed, 13 insertions(+)
>> you will have to rebase this over a clean if the platofrm_data I'll 
>> send today
>> or tomorrow that will move all the platform_data to inclide/linux
>
> ok, please cc me in the mail list.
Hi JC:

     any more feedback ?
>>
>> btw your patch broke the avr32
>
> You mean compile error, driver crash, or I need  a macro to 
> distinguish avr32 to at91sam9 ?
> I only add a few variables that avr32 will not use, it seems no 
> affection to avr32, you think?
>>
>> Best Regards.
>> J.
>>> diff --git a/arch/arm/mach-at91/include/mach/board.h 
>>> b/arch/arm/mach-at91/include/mach/board.h
>>> index c55a436..a2188a6 100644
>>> --- a/arch/arm/mach-at91/include/mach/board.h
>>> +++ b/arch/arm/mach-at91/include/mach/board.h
>>> @@ -129,6 +129,8 @@ struct atmel_uart_data {
>>>       short            use_dma_tx;    /* use transmit DMA? */
>>>       short            use_dma_rx;    /* use receive DMA? */
>>>       void __iomem        *regs;        /* virt. base address, if 
>>> any */
>>> +    struct at_dma_slave     *dma_tx_slave;
>>> +    struct at_dma_slave     *dma_rx_slave;
>>>       struct serial_rs485    rs485;        /* rs485 settings */
>>>   };
>>>   extern void __init at91_add_device_serial(void);
>>> diff --git a/drivers/tty/serial/atmel_serial.c 
>>> b/drivers/tty/serial/atmel_serial.c
>>> index 3d7e1ee..1b1bd4f 100644
>>> --- a/drivers/tty/serial/atmel_serial.c
>>> +++ b/drivers/tty/serial/atmel_serial.c
>>> @@ -45,6 +45,7 @@
>>>     #include <asm/mach/serial_at91.h>
>>>   #include <mach/board.h>
>>> +#include <linux/platform_data/dma-atmel.h>
>>>     #ifdef CONFIG_ARM
>>>   #include <mach/cpu.h>
>>> diff --git a/include/linux/platform_data/dma-atmel.h 
>>> b/include/linux/platform_data/dma-atmel.h
>>> index cab0997..bb05302 100644
>>> --- a/include/linux/platform_data/dma-atmel.h
>>> +++ b/include/linux/platform_data/dma-atmel.h
>>> @@ -26,11 +26,21 @@ struct at_dma_platform_data {
>>>   /**
>>>    * struct at_dma_slave - Controller-specific information about a 
>>> slave
>>>    * @dma_dev: required DMA master device
>>> + * @tx_reg: physical address of data register used for
>>> + *      memory-to-peripheral transfers
>>> + * @rx_reg: physical address of data register used for
>>> + *      peripheral-to-memory transfers
>>> + * @reg_width: peripheral register width
>>>    * @cfg: Platform-specific initializer for the CFG register
>>> + * @ctrla: Platform-specific initializer for the CTRLA register
>>>    */
>>>   struct at_dma_slave {
>>>       struct device        *dma_dev;
>>> +    dma_addr_t              tx_reg;
>>> +    dma_addr_t              rx_reg;
>>> +    u32            reg_width;
>>>       u32            cfg;
>>> +    u32                     ctrla;
>>>   };
>>>     --
>>> 1.7.9.5
>>>
>
>
> _______________________________________________
> 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] serial: mxs-auart: unmap the scatter list before we copy the data
From: Huang Shijie @ 2012-11-22  7:06 UTC (permalink / raw)
  To: gregkh; +Cc: alan, linux-serial, linux-kernel, lauri.hintsala, Huang Shijie
In-Reply-To: <1353567990-19907-1-git-send-email-b32955@freescale.com>

We should first unmap the DMA scatter list for receiving data, and
then copy the data from the DMA buffer.

The old code misses unmap the scatter list for RX. This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> 
---
 drivers/tty/serial/mxs-auart.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 2342b0d..6b51448 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -461,6 +461,8 @@ static void dma_rx_callback(void *arg)
 	int count;
 	u32 stat;
 
+	dma_unmap_sg(s->dev, &s->rx_sgl, 1, DMA_FROM_DEVICE);
+
 	stat = readl(s->port.membase + AUART_STAT);
 	stat &= ~(AUART_STAT_OERR | AUART_STAT_BERR |
 			AUART_STAT_PERR | AUART_STAT_FERR);
-- 
1.7.0.4

^ permalink raw reply related

* [PATCH 1/2] serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled
From: Huang Shijie @ 2012-11-22  7:06 UTC (permalink / raw)
  To: gregkh; +Cc: alan, linux-serial, linux-kernel, lauri.hintsala, Huang Shijie

When the DMA is enabled, the Receive Timeout interrupt is very easy to be arised
in the 3M baud rate.  The interrupt handler (aka mxs_auart_irq_handle) will call
mxs_auart_rx_chars() to handle the received data. This is not right, we can not
get the correct data from the RXFIFO now, the data have been moved to the
DMA buffer by the DMA engine.

This patch
  (1) disables the Receive Timeout Interrupt when the DMA is enabled,
  (2) and invoke the mxs_auart_rx_chars() only when the DMA is not enabled.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> 
---
 drivers/tty/serial/mxs-auart.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index d5b9e30..2342b0d 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -695,7 +695,8 @@ static void mxs_auart_settermios(struct uart_port *u,
 		!test_and_set_bit(MXS_AUART_DMA_RX_READY, &s->flags)) {
 		if (!mxs_auart_dma_prep_rx(s)) {
 			/* Disable the normal RX interrupt. */
-			writel(AUART_INTR_RXIEN, u->membase + AUART_INTR_CLR);
+			writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN,
+					u->membase + AUART_INTR_CLR);
 		} else {
 			mxs_auart_dma_exit(s);
 			dev_err(s->dev, "We can not start up the DMA.\n");
@@ -719,7 +720,8 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
 	}
 
 	if (istat & (AUART_INTR_RTIS | AUART_INTR_RXIS)) {
-		mxs_auart_rx_chars(s);
+		if (!auart_dma_enabled(s))
+			mxs_auart_rx_chars(s);
 		istat &= ~(AUART_INTR_RTIS | AUART_INTR_RXIS);
 	}
 
-- 
1.7.0.4

^ permalink raw reply related

* Re: [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-22  5:41 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman,
	devicetree-discuss, Nicolas Ferre, Sascha Hauer, Sascha Hauer,
	linux-arm-kernel@lists.infradead.org, Alan Cox
In-Reply-To: <CACxGe6tyPpjx4OtjHmhB9Cvnb7OwAjPEE4=K+wgWKYHcAV-ESQ@mail.gmail.com>

On 18:03 Wed 21 Nov     , Grant Likely wrote:
> On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > devicetrees may have a linux,stdout-path or stdout-path property
> > in the chosen node describing the console device. This adds a helper
> > function to match a device against this property and retrieve the options
> > so a driver can call add_preferred_console for a matching device.
> 
> NIce. Looks like the right behaviour, but is a little inefficient.
> Since the stdout property doesn't change this code could be called
> once right after the tree is unflattened and then cache the pointer to
> the node anarguments. Can you add the code to of_alias_scan()?
do we assume that we can have only one stdout-path?

I think we could have more serial, framebuffer console

Best Regards,
J.

^ permalink raw reply

* Re: [PATCH 1/4] OF: Add helper for matching against linux, stdout-path
From: Lothar Waßmann @ 2012-11-22  5:33 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: kernel, Greg Kroah-Hartman, devicetree-discuss, Nicolas Ferre,
	Grant Likely, linux-serial, Jean-Christophe PLAGNIOL-VILLARD,
	linux-arm-kernel, Alan Cox
In-Reply-To: <20121121172631.GV10369@pengutronix.de>

Hi,

Sascha Hauer writes:
> On Wed, Nov 21, 2012 at 04:57:05PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > 
> > devicetrees may have a linux,stdout-path or stdout-path property
> > in the chosen node describing the console device. This adds a helper
> > function to match a device against this property and retrieve the options
> > so a driver can call add_preferred_console for a matching device.
> > 
[...]
> > +	if (!tmp)
> > +		return 0;
> > +
> > +	dn_stdout = of_find_node_by_path(tmp);
> > +
> > +	if (dn_stdout && dn_stdout == dn) {
> > +		is_stdout = 1;
> > +		tmp_option++;
> > +		*option = kstrdup(tmp_option, GFP_KERNEL);
> > +	}
> > +
> > +	of_node_put(dn_stdout);
> 
> dn_stdout may be NULL aswell.
> 
which is handled gracefully by of_node_put()...


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH] tty: Add driver unthrottle in ioctl(...,TCFLSH,..).
From: Ilya Zykov @ 2012-11-21 21:12 UTC (permalink / raw)
  To: Andrew McGregor, Greg Kroah-Hartman, Alan Cox, linux-kernel,
	linux-serial

Revert 'tty: fix "IRQ45: nobody cared"'

This revert commit 7b292b4bf9a9d6098440d85616d6ca4c608b8304

Function reset_buffer_flags() also invoked during the
ioctl(...,TCFLSH,..). At the time of request we can have full buffers
and throttled driver too. If we don't unthrottle driver, we can get
forever throttled driver, because after request, we will have
empty buffers and throttled driver and there is no place to unthrottle driver.
It simple reproduce with "pty" pair then one side sleep on tty->write_wait,
and other side do ioctl(...,TCFLSH,..). Then there is no place to do writers wake up.

About 'tty: fix "IRQ45: nobody cared"':
We don't call tty_unthrottle() if release last filp - ('tty->count == 0')
In other case it must be safely. Maybe we have bug in other place.

Signed-off-by: Ilya Zykov <ilya@ilyx.ru>
---

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 26f0d0e..a783d0e 100644

--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -184,6 +184,7 @@ static void reset_buffer_flags(struct tty_struct *tty)
        tty->canon_head = tty->canon_data = tty->erasing = 0;
        memset(&tty->read_flags, 0, sizeof tty->read_flags);
        n_tty_set_room(tty);
+       check_unthrottle(tty);
 }
 
 /**
@@ -1585,7 +1586,6 @@ static int n_tty_open(struct tty_struct *tty)
                        return -ENOMEM;
        }
        reset_buffer_flags(tty);
-       tty_unthrottle(tty);
        tty->column = 0;
        n_tty_set_termios(tty, NULL);
        tty->minimum_to_wake = 1;

^ permalink raw reply

* [PATCH] serial: max310x: Setup missing "can_sleep" field for GPIO
From: Alexander Shiyan @ 2012-11-21 20:07 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox, Greg Kroah-Hartman, Alexander Shiyan


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/tty/serial/max310x.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 1ab1d2c..343becb 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1178,6 +1178,7 @@ static int __devinit max310x_probe(struct spi_device *spi)
 		s->gpio.set		= max310x_gpio_set;
 		s->gpio.base		= pdata->gpio_base;
 		s->gpio.ngpio		= s->nr_gpio;
+		s->gpio.can_sleep	= 1;
 		if (gpiochip_add(&s->gpio)) {
 			/* Indicate that we should not call gpiochip_remove */
 			s->gpio.base = 0;
-- 
1.7.8.6


^ permalink raw reply related

* Re: [PATCH 3/5] ARM: OMAP: Move plat/omap-serial.h to include/linux/platform_data/serial-omap.h
From: Tony Lindgren @ 2012-11-21 18:41 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kevin Hilman, Russell King, Greg Kroah-Hartman, Felipe Balbi,
	Govindraj.R, linux-serial, linux-omap, Alan Cox
In-Reply-To: <20121121174230.25576.64507.stgit@muffinssi.local>

* Tony Lindgren <tony@atomide.com> [121121 09:44]:
> We need to move this file to allow ARM multiplatform configurations
> to build for omap2+. This can now be done as this file now only
> contains platform_data.

Russell, this one depends on your commit fd9980c7 (SERIAL: omap:
remove OMAP_UART_SYSC_RESET and OMAP_UART_FIFO_CLR).

Is that commit immutable and OK to merge as a dependency to my
branch?

Regards,

Tony

^ permalink raw reply

* Re: [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
From: Grant Likely @ 2012-11-21 18:03 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-arm-kernel@lists.infradead.org, devicetree-discuss,
	Sascha Hauer, linux-serial@vger.kernel.org, Greg Kroah-Hartman,
	Sascha Hauer, Alan Cox, Nicolas Ferre
In-Reply-To: <1353513428-25697-1-git-send-email-plagnioj@jcrosoft.com>

On Wed, Nov 21, 2012 at 3:57 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> devicetrees may have a linux,stdout-path or stdout-path property
> in the chosen node describing the console device. This adds a helper
> function to match a device against this property and retrieve the options
> so a driver can call add_preferred_console for a matching device.

NIce. Looks like the right behaviour, but is a little inefficient.
Since the stdout property doesn't change this code could be called
once right after the tree is unflattened and then cache the pointer to
the node and arguments. Can you add the code to of_alias_scan()?

g.

>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-serial@vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: kernel@pengutronix.de
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/of/base.c  |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h |    7 +++++++
>  2 files changed, 53 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f2f63c8..72c49ce 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1470,3 +1470,49 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
>         return curv;
>  }
>  EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + *                           linux,stdout-path property
> + * @np:                Pointer to the given device_node
> + * @option:    parsed option
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> +       const char *name;
> +       struct device_node *dn_stdout;
> +       bool is_stdout = 0;
> +       const char *tmp;
> +       const char *tmp_option;
> +
> +       name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> +       if (name == NULL)
> +               name = of_get_property(of_chosen, "stdout-path", NULL);
> +
> +       if (name == NULL)
> +               return 0;
> +
> +       tmp_option = strchr(name, ':');
> +
> +       tmp = kstrndup(name, strlen(name) - strlen(tmp_option), GFP_KERNEL);
> +       if (!tmp)
> +               return 0;
> +
> +       dn_stdout = of_find_node_by_path(tmp);
> +
> +       if (dn_stdout && dn_stdout == dn) {
> +               is_stdout = 1;
> +               tmp_option++;
> +               *option = kstrdup(tmp_option, GFP_KERNEL);
> +       }
> +
> +       of_node_put(dn_stdout);
> +
> +       kfree(tmp);
> +
> +       return is_stdout;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 681a6c8..6a82e3f 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -323,6 +323,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
>                 s;                                              \
>                 s = of_prop_next_string(prop, s))
>
> +int of_device_is_stdout_path(struct device_node *dn, char **option);
> +
>  #else /* CONFIG_OF */
>
>  static inline const char* of_node_full_name(struct device_node *np)
> @@ -450,6 +452,11 @@ static inline int of_machine_is_compatible(const char *compat)
>         return 0;
>  }
>
> +static inline int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> +       return 0;
> +}
> +
>  #define of_match_ptr(_ptr)     NULL
>  #define of_match_node(_matches, _node) NULL
>  #define of_property_for_each_u32(np, propname, prop, p, u) \
> --
> 1.7.10.4
>



--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [PATCH 3/5] ARM: OMAP: Move plat/omap-serial.h to include/linux/platform_data/serial-omap.h
From: Felipe Balbi @ 2012-11-21 17:38 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-arm-kernel, Kevin Hilman, Russell King, Greg Kroah-Hartman,
	Felipe Balbi, linux-serial, linux-omap, Alan Cox
In-Reply-To: <20121121174230.25576.64507.stgit@muffinssi.local>

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

On Wed, Nov 21, 2012 at 09:42:30AM -0800, Tony Lindgren wrote:
> We need to move this file to allow ARM multiplatform configurations
> to build for omap2+. This can now be done as this file now only
> contains platform_data.
> 
> cc: Russell King <linux@arm.linux.org.uk>
> cc: Alan Cox <alan@linux.intel.com>
> cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> cc: Govindraj.R <govindraj.raja@ti.com>
> cc: Kevin Hilman <khilman@ti.com>
> cc: Felipe Balbi <balbi@ti.com>
> cc: linux-serial@vger.kernel.org
> Signed-off-by: Tony Lindgren <tony@atomide.com>

nice, thanks :-)

Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
>  arch/arm/mach-omap2/serial.c                  |    4 +---
>  drivers/tty/serial/omap-serial.c              |    3 +--
>  include/linux/platform_data/serial-omap.h     |    0 
>  3 files changed, 2 insertions(+), 5 deletions(-)
>  rename arch/arm/plat-omap/include/plat/omap-serial.h => include/linux/platform_data/serial-omap.h (100%)
> 
> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
> index aa30a3c..25c799b 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -26,9 +26,7 @@
>  #include <linux/slab.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/console.h>
> -
> -#include <plat/omap-serial.h>
> -#include <plat-omap/dma-omap.h>
> +#include <linux/platform_data/serial-omap.h>
>  
>  #include "common.h"
>  #include "omap_hwmod.h"
> diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
> index 17babde..0240aa8 100644
> --- a/drivers/tty/serial/omap-serial.c
> +++ b/drivers/tty/serial/omap-serial.c
> @@ -41,8 +41,7 @@
>  #include <linux/of.h>
>  #include <linux/gpio.h>
>  #include <linux/pinctrl/consumer.h>
> -
> -#include <plat/omap-serial.h>
> +#include <linux/platform_data/serial-omap.h>
>  
>  #define OMAP_MAX_HSUART_PORTS	6
>  
> diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/include/linux/platform_data/serial-omap.h
> similarity index 100%
> rename from arch/arm/plat-omap/include/plat/omap-serial.h
> rename to include/linux/platform_data/serial-omap.h
> 

-- 
balbi

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

^ permalink raw reply

* [PATCH 3/5] ARM: OMAP: Move plat/omap-serial.h to include/linux/platform_data/serial-omap.h
From: Tony Lindgren @ 2012-11-21 17:42 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kevin Hilman, Russell King, Greg Kroah-Hartman, Felipe Balbi,
	Govindraj.R, linux-serial, linux-omap, Alan Cox
In-Reply-To: <20121121174201.25576.61961.stgit@muffinssi.local>

We need to move this file to allow ARM multiplatform configurations
to build for omap2+. This can now be done as this file now only
contains platform_data.

cc: Russell King <linux@arm.linux.org.uk>
cc: Alan Cox <alan@linux.intel.com>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: Govindraj.R <govindraj.raja@ti.com>
cc: Kevin Hilman <khilman@ti.com>
cc: Felipe Balbi <balbi@ti.com>
cc: linux-serial@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/serial.c                  |    4 +---
 drivers/tty/serial/omap-serial.c              |    3 +--
 include/linux/platform_data/serial-omap.h     |    0 
 3 files changed, 2 insertions(+), 5 deletions(-)
 rename arch/arm/plat-omap/include/plat/omap-serial.h => include/linux/platform_data/serial-omap.h (100%)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index aa30a3c..25c799b 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -26,9 +26,7 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <linux/console.h>
-
-#include <plat/omap-serial.h>
-#include <plat-omap/dma-omap.h>
+#include <linux/platform_data/serial-omap.h>
 
 #include "common.h"
 #include "omap_hwmod.h"
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 17babde..0240aa8 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -41,8 +41,7 @@
 #include <linux/of.h>
 #include <linux/gpio.h>
 #include <linux/pinctrl/consumer.h>
-
-#include <plat/omap-serial.h>
+#include <linux/platform_data/serial-omap.h>
 
 #define OMAP_MAX_HSUART_PORTS	6
 
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/include/linux/platform_data/serial-omap.h
similarity index 100%
rename from arch/arm/plat-omap/include/plat/omap-serial.h
rename to include/linux/platform_data/serial-omap.h


^ permalink raw reply related

* Re: [PATCH 1/4] OF: Add helper for matching against linux,stdout-path
From: Sascha Hauer @ 2012-11-21 17:26 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: linux-arm-kernel, devicetree-discuss, linux-serial,
	Greg Kroah-Hartman, kernel, Alan Cox, Grant Likely, Nicolas Ferre
In-Reply-To: <1353513428-25697-1-git-send-email-plagnioj@jcrosoft.com>

On Wed, Nov 21, 2012 at 04:57:05PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
> 
> devicetrees may have a linux,stdout-path or stdout-path property
> in the chosen node describing the console device. This adds a helper
> function to match a device against this property and retrieve the options
> so a driver can call add_preferred_console for a matching device.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-serial@vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: kernel@pengutronix.de
> Cc: Alan Cox <alan@linux.intel.com>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/of/base.c  |   46 ++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h |    7 +++++++
>  2 files changed, 53 insertions(+)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index f2f63c8..72c49ce 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1470,3 +1470,49 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
>  	return curv;
>  }
>  EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + *			      linux,stdout-path property
> + * @np:		Pointer to the given device_node
> + * @option:	parsed option
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn, char **option)
> +{
> +	const char *name;
> +	struct device_node *dn_stdout;
> +	bool is_stdout = 0;
> +	const char *tmp;
> +	const char *tmp_option;
> +
> +	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> +	if (name == NULL)
> +		name = of_get_property(of_chosen, "stdout-path", NULL);
> +
> +	if (name == NULL)
> +		return 0;
> +
> +	tmp_option = strchr(name, ':');
> +
> +	tmp = kstrndup(name, strlen(name) - strlen(tmp_option), GFP_KERNEL);

tmp_option may be NULL.

> +	if (!tmp)
> +		return 0;
> +
> +	dn_stdout = of_find_node_by_path(tmp);
> +
> +	if (dn_stdout && dn_stdout == dn) {
> +		is_stdout = 1;
> +		tmp_option++;
> +		*option = kstrdup(tmp_option, GFP_KERNEL);
> +	}
> +
> +	of_node_put(dn_stdout);

dn_stdout may be NULL aswell.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply

* [PATCH] tty/8250 Add check for pci_ioremap_bar failure
From: Matt Schulte @ 2012-11-21 16:39 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox, Greg Kroah-Hartman

Add check for pci_ioremap_bar failure

Signed-off-by: Matt Schulte <matts@commtech-fastcom.com>
---
Built against tty-next commit: 1e619a1bf9ac878e6a984e4e279ccf712a65bc23

This depends on my previous patch submission:
[PATCH v3] Add support for new devices: Exar's XR17V35x family of
multi-port PCIe UARTs

 drivers/tty/serial/8250/8250_pci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c
b/drivers/tty/serial/8250/8250_pci.c
index 4302c05..4867b70 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1172,6 +1172,8 @@ pci_xr17v35x_setup(struct serial_private *priv,
 	u8 __iomem *p;

 	p = pci_ioremap_bar(priv->dev, 0);
+	if (p == NULL)
+		return -ENOMEM;

 	port->port.flags |= UPF_EXAR_EFR;

-- 
1.7.2.5

^ permalink raw reply related

* [PATCH v2] tty/8250 Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards
From: Matt Schulte @ 2012-11-21 16:35 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox, Greg Kroah-Hartman
In-Reply-To: <CAJp1Oe7syKV54oOisSO=DX+hBaZxugSqQoHXoCPmDVWUiT1dOQ@mail.gmail.com>

Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards

Signed-off-by: Matt Schulte <matts@commtech-fastcom.com>
---
Built against tty-next commit: 1e619a1bf9ac878e6a984e4e279ccf712a65bc23

changes since v1: Move defines and add fail check to pci_ioremap_bar

This depends on my previous patch submissions:
[PATCH v3] Add support for new devices: Exar's XR17V35x family of
multi-port PCIe UARTs
[PATCH 1/2] tty/8250: Add sleep capability to XR17D15X ports
[PATCH 2/2] tty/8250 Add XR17D15x devices to the exar_handle_irq override
[PATCH 1/3] Add register definitions used in several Exar PCI/PCIe UARTs

 drivers/tty/serial/8250/8250_pci.c |  163 ++++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h            |    2 +
 2 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c
b/drivers/tty/serial/8250/8250_pci.c
index 24cf002..4302c05 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1201,6 +1201,55 @@ pci_xr17v35x_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }

+#define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004
+#define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002
+#define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a
+#define PCI_DEVICE_ID_COMMTECH_2328PCI335 0x000b
+
+static int
+pci_fastcom335_setup(struct serial_private *priv,
+		  const struct pciserial_board *board,
+		  struct uart_8250_port *port, int idx)
+{
+	u8 __iomem *p;
+
+	p = pci_ioremap_bar(priv->dev, 0);
+	if (p == NULL)
+		return -ENOMEM;
+
+	port->port.flags |= UPF_EXAR_EFR;
+
+	/*
+	 * Setup Multipurpose Input/Output pins.
+	 */
+	if (idx == 0) {
+		switch (priv->dev->device) {
+		case PCI_DEVICE_ID_COMMTECH_4222PCI335:
+		case PCI_DEVICE_ID_COMMTECH_4224PCI335:
+			writeb(0x78, p + 0x90); /* MPIOLVL[7:0] */
+			writeb(0x00, p + 0x92); /* MPIOINV[7:0] */
+			writeb(0x00, p + 0x93); /* MPIOSEL[7:0] */
+			break;
+		case PCI_DEVICE_ID_COMMTECH_2324PCI335:
+		case PCI_DEVICE_ID_COMMTECH_2328PCI335:
+			writeb(0x00, p + 0x90); /* MPIOLVL[7:0] */
+			writeb(0xc0, p + 0x92); /* MPIOINV[7:0] */
+			writeb(0xc0, p + 0x93); /* MPIOSEL[7:0] */
+			break;
+		}
+		writeb(0x00, p + 0x8f); /* MPIOINT[7:0] */
+		writeb(0x00, p + 0x91); /* MPIO3T[7:0] */
+		writeb(0x00, p + 0x94); /* MPIOOD[7:0] */
+	}
+	writeb(0x00, p + UART_EXAR_8XMODE);
+	writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
+	writeb(32, p + UART_EXAR_TXTRG);
+	writeb(32, p + UART_EXAR_RXTRG);
+	iounmap(p);
+
+	return pci_default_setup(priv, board, port, idx);
+}
+
 static int
 pci_wch_ch353_setup(struct serial_private *priv,
                     const struct pciserial_board *board,
@@ -1250,6 +1299,10 @@ pci_wch_ch353_setup(struct serial_private *priv,
 #define PCI_VENDOR_ID_AGESTAR		0x5372
 #define PCI_DEVICE_ID_AGESTAR_9375	0x6872
 #define PCI_VENDOR_ID_ASIX		0x9710
+#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0019
+#define PCI_DEVICE_ID_COMMTECH_4224PCIE	0x0020
+#define PCI_DEVICE_ID_COMMTECH_4228PCIE	0x0021
+

 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584	0x1584
@@ -1846,6 +1899,59 @@ static struct pci_serial_quirk
pci_serial_quirks[] __refdata = {
 		.setup		= pci_asix_setup,
 	},
 	/*
+	 * Commtech, Inc. Fastcom adapters
+	 *
+	 */
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_4222PCI335,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_fastcom335_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_4224PCI335,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_fastcom335_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_2324PCI335,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_fastcom335_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_2328PCI335,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_fastcom335_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_4222PCIE,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_xr17v35x_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_4224PCIE,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_xr17v35x_setup,
+	},
+	{
+		.vendor = PCI_VENDOR_ID_COMMTECH,
+		.device = PCI_DEVICE_ID_COMMTECH_4228PCIE,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_xr17v35x_setup,
+	},
+	/*
 	 * Default "match everything" terminator entry
 	 */
 	{
@@ -1921,6 +2027,10 @@ enum pci_board_num_t {

 	pbn_b0_4_1152000,

+	pbn_b0_2_1152000_200,
+	pbn_b0_4_1152000_200,
+	pbn_b0_8_1152000_200,
+
 	pbn_b0_2_1843200,
 	pbn_b0_4_1843200,

@@ -2118,6 +2228,27 @@ static struct pciserial_board pci_boards[]
__devinitdata = {
 		.uart_offset	= 8,
 	},

+	[pbn_b0_2_1152000_200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 2,
+		.base_baud	= 1152000,
+		.uart_offset	= 0x200,
+	},
+
+	[pbn_b0_4_1152000_200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 4,
+		.base_baud	= 1152000,
+		.uart_offset	= 0x200,
+	},
+
+	[pbn_b0_8_1152000_200] = {
+		.flags		= FL_BASE0,
+		.num_ports	= 2,
+		.base_baud	= 1152000,
+		.uart_offset	= 0x200,
+	},
+
 	[pbn_b0_2_1843200] = {
 		.flags		= FL_BASE0,
 		.num_ports	= 2,
@@ -4357,6 +4488,38 @@ static struct pci_device_id serial_pci_tbl[] = {
 		0, 0, pbn_b0_bt_2_115200 },

 	/*
+	 * Commtech, Inc. Fastcom adapters
+	 */
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCI335,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_b0_2_1152000_200 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCI335,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_b0_4_1152000_200 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2324PCI335,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_b0_4_1152000_200 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2328PCI335,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_b0_8_1152000_200 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCIE,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_exar_XR17V352 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCIE,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_exar_XR17V354 },
+	{	PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4228PCIE,
+		PCI_ANY_ID, PCI_ANY_ID,
+		0,
+		0, pbn_exar_XR17V358 },
+
+	/*
 	 * These entries match devices with class COMMUNICATION_SERIAL,
 	 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
 	 */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0199a7a..0f84473 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2326,6 +2326,8 @@

 #define PCI_VENDOR_ID_TOPSPIN		0x1867

+#define PCI_VENDOR_ID_COMMTECH		0x18f7
+
 #define PCI_VENDOR_ID_SILAN		0x1904

 #define PCI_VENDOR_ID_RENESAS		0x1912
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH 4/4] tty: Atmel serial: add linux,stdout-path support
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-serial, Greg Kroah-Hartman, devicetree-discuss,
	Nicolas Ferre, Grant Likely, kernel,
	Jean-Christophe PLAGNIOL-VILLARD, Alan Cox
In-Reply-To: <1353513428-25697-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel@pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/tty/serial/atmel_serial.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 5608b6b..f62a3c3 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1427,6 +1427,7 @@ static struct uart_ops atmel_pops = {
 static void __devinit atmel_of_init_port(struct atmel_uart_port *atmel_port,
 					 struct device_node *np)
 {
+	char *option = NULL;
 	u32 rs485_delay[2];
 
 	/* DMA/PDC usage specification */
@@ -1453,6 +1454,10 @@ static void __devinit atmel_of_init_port(struct atmel_uart_port *atmel_port,
 
 		if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL))
 			rs485conf->flags |= SER_RS485_ENABLED;
+	} else if (of_device_is_stdout_path(np, &option)) {
+		pr_info("add preferred console %s%d option=%s\n",
+			ATMEL_DEVICENAME, atmel_port->uart.line, option);
+		add_preferred_console(ATMEL_DEVICENAME, atmel_port->uart.line, option);
 	}
 }
 
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 3/4] serial: i.MX: evaluate linux,stdout-path property
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Sascha Hauer, Alan Cox
In-Reply-To: <1353513428-25697-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>

From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Cc: Alan Cox <alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---
 drivers/tty/serial/imx.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 07a8ca1..28a3193 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1398,6 +1398,7 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 	struct device_node *np = pdev->dev.of_node;
 	const struct of_device_id *of_id =
 			of_match_device(imx_uart_dt_ids, &pdev->dev);
+	char *option = NULL;
 	int ret;
 
 	if (!np)
@@ -1419,6 +1420,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_device_is_stdout_path(np, &option))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, option);
+
 	return 0;
 }
 #else
-- 
1.7.10.4

^ permalink raw reply related

* [PATCH 2/4] serial: i.MX: Make console support non optional
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-21 15:57 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-serial, Greg Kroah-Hartman, devicetree-discuss,
	Nicolas Ferre, Grant Likely, kernel, Sascha Hauer, Alan Cox
In-Reply-To: <1353513428-25697-1-git-send-email-plagnioj@jcrosoft.com>

From: Sascha Hauer <s.hauer@pengutronix.de>

Traditionally console support is optional for serial drivers. This
makes it non optional for the i.MX driver since it's not worth
asking questions for a feature virtually every user of this driver
wants to have.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-serial@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel@pengutronix.de
Cc: Alan Cox <alan@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/tty/serial/Kconfig |   16 +---------------
 drivers/tty/serial/imx.c   |    8 +-------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index b176801..10e5eec 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -541,26 +541,12 @@ config SERIAL_IMX
 	bool "IMX serial port support"
 	depends on ARCH_MXC
 	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
 	select RATIONAL
 	help
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
 
-config SERIAL_IMX_CONSOLE
-	bool "Console on IMX serial port"
-	depends on SERIAL_IMX
-	select SERIAL_CORE_CONSOLE
-	help
-	  If you have enabled the serial port on the Motorola IMX
-	  CPU you can make it the console by answering Y to this option.
-
-	  Even if you say Y here, the currently visible virtual console
-	  (/dev/tty0) will still be used as the system console by default, but
-	  you can alter that using a kernel command line option such as
-	  "console=ttySA0". (Try "man bootparam" or see the documentation of
-	  your boot loader (lilo or loadlin) about how to pass options to the
-	  kernel at boot time.)
-
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
 	depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 5981912..07a8ca1 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1192,7 +1192,6 @@ static struct uart_ops imx_pops = {
 
 static struct imx_port *imx_ports[UART_NR];
 
-#ifdef CONFIG_SERIAL_IMX_CONSOLE
 static void imx_console_putchar(struct uart_port *port, int ch)
 {
 	struct imx_port *sport = (struct imx_port *)port;
@@ -1348,11 +1347,6 @@ static struct console imx_console = {
 	.data		= &imx_reg,
 };
 
-#define IMX_CONSOLE	&imx_console
-#else
-#define IMX_CONSOLE	NULL
-#endif
-
 static struct uart_driver imx_reg = {
 	.owner          = THIS_MODULE,
 	.driver_name    = DRIVER_NAME,
@@ -1360,7 +1354,7 @@ static struct uart_driver imx_reg = {
 	.major          = SERIAL_IMX_MAJOR,
 	.minor          = MINOR_START,
 	.nr             = ARRAY_SIZE(imx_ports),
-	.cons           = IMX_CONSOLE,
+	.cons           = &imx_console,
 };
 
 static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
-- 
1.7.10.4

^ permalink raw reply related


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