linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 13:22 ` [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together Anton Vorontsov
@ 2010-10-01 12:41   ` Alan Cox
  2010-10-01 13:52     ` Anton Vorontsov
  2010-10-01 14:23   ` [PATCH v3 " Anton Vorontsov
  1 sibling, 1 reply; 21+ messages in thread
From: Alan Cox @ 2010-10-01 12:41 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

On Fri, 1 Oct 2010 17:22:07 +0400
Anton Vorontsov <cbouatmailru@gmail.com> wrote:

> This fixes tty name and major number conflicts. The major number
> 204 is used across many platform-specific serial drivers, so we
> use that.

204 is allocated in small chunks to specific low volume devices so you
need a proper minor allocation

At this point that would be 204,213 for whatever tiny range you need.

Please send me a patch for devices.txt and update accordingly,
otherwise no objections.

Alan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 0/8] Some patches for Altera UART driver
@ 2010-10-01 13:20 Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 1/8] serial: Factor out uart_poll_timeout() from 8250 driver Anton Vorontsov
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Hi all,

Here is v2. Changes:

- Addressed comments by Alan Cox and Tobias Klauser;
- In patch 'Add support for getting mapbase and IRQ from resources',
  added ioremap() return value checking;
- Added a few fixup patches.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/8] serial: Factor out uart_poll_timeout() from 8250 driver
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
@ 2010-10-01 13:21 ` Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less) Anton Vorontsov
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Soon we will use that handy function in the altera_uart driver.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/serial/8250.c       |   14 ++++----------
 include/linux/serial_core.h |    8 ++++++++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 24110f6..61e95dd 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1722,12 +1722,6 @@ static void serial_unlink_irq_chain(struct uart_8250_port *up)
 	mutex_unlock(&hash_mutex);
 }
 
-/* Base timer interval for polling */
-static inline int poll_timeout(int timeout)
-{
-	return timeout > 6 ? (timeout / 2 - 2) : 1;
-}
-
 /*
  * This function is used to handle ports that do not have an
  * interrupt.  This doesn't work very well for 16450's, but gives
@@ -1742,7 +1736,7 @@ static void serial8250_timeout(unsigned long data)
 	iir = serial_in(up, UART_IIR);
 	if (!(iir & UART_IIR_NO_INT))
 		serial8250_handle_port(up);
-	mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
+	mod_timer(&up->timer, jiffies + uart_poll_timeout(&up->port));
 }
 
 static void serial8250_backup_timeout(unsigned long data)
@@ -1787,7 +1781,7 @@ static void serial8250_backup_timeout(unsigned long data)
 
 	/* Standard timer interval plus 0.2s to keep the port running */
 	mod_timer(&up->timer,
-		jiffies + poll_timeout(up->port.timeout) + HZ / 5);
+		jiffies + uart_poll_timeout(&up->port) + HZ / 5);
 }
 
 static unsigned int serial8250_tx_empty(struct uart_port *port)
@@ -2069,7 +2063,7 @@ static int serial8250_startup(struct uart_port *port)
 		up->timer.function = serial8250_backup_timeout;
 		up->timer.data = (unsigned long)up;
 		mod_timer(&up->timer, jiffies +
-			  poll_timeout(up->port.timeout) + HZ / 5);
+			uart_poll_timeout(port) + HZ / 5);
 	}
 
 	/*
@@ -2079,7 +2073,7 @@ static int serial8250_startup(struct uart_port *port)
 	 */
 	if (!is_real_interrupt(up->port.irq)) {
 		up->timer.data = (unsigned long)up;
-		mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
+		mod_timer(&up->timer, jiffies + uart_poll_timeout(port));
 	} else {
 		retval = serial_link_irq_chain(up);
 		if (retval)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 563e234..ac48082 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -411,6 +411,14 @@ unsigned int uart_get_baud_rate(struct uart_port *port, struct ktermios *termios
 				unsigned int max);
 unsigned int uart_get_divisor(struct uart_port *port, unsigned int baud);
 
+/* Base timer interval for polling */
+static inline int uart_poll_timeout(struct uart_port *port)
+{
+	int timeout = port->timeout;
+
+	return timeout > 6 ? (timeout / 2 - 2) : 1;
+}
+
 /*
  * Console helpers.
  */
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less)
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 1/8] serial: Factor out uart_poll_timeout() from 8250 driver Anton Vorontsov
@ 2010-10-01 13:21 ` Anton Vorontsov
  2010-10-01 13:57   ` Tobias Klauser
  2010-10-01 13:21 ` [PATCH 3/8] altera_uart: Add support for getting mapbase and IRQ from resources Anton Vorontsov
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Some Altera UART implementations doesn't route the IRQ line, so we have
to work in polling mode.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/serial/altera_uart.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index f8d8a00..7dd58da 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -15,6 +15,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/timer.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/console.h>
@@ -76,6 +77,7 @@
  */
 struct altera_uart {
 	struct uart_port port;
+	struct timer_list tmr;
 	unsigned int sigs;	/* Local copy of line sigs */
 	unsigned short imr;	/* Local IMR mirror */
 };
@@ -168,6 +170,7 @@ static void altera_uart_set_termios(struct uart_port *port,
 	tty_termios_encode_baud_rate(termios, baud, baud);
 
 	spin_lock_irqsave(&port->lock, flags);
+	uart_update_timeout(port, termios->c_cflag, baud);
 	writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
@@ -268,6 +271,15 @@ static irqreturn_t altera_uart_interrupt(int irq, void *data)
 	return IRQ_RETVAL(isr);
 }
 
+static void altera_uart_timer(unsigned long data)
+{
+	struct uart_port *port = (void *)data;
+	struct altera_uart *pp = container_of(port, struct altera_uart, port);
+
+	altera_uart_interrupt(0, port);
+	mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port));
+}
+
 static void altera_uart_config_port(struct uart_port *port, int flags)
 {
 	port->type = PORT_ALTERA_UART;
@@ -284,6 +296,12 @@ static int altera_uart_startup(struct uart_port *port)
 	unsigned long flags;
 	int ret;
 
+	if (!port->irq) {
+		setup_timer(&pp->tmr, altera_uart_timer, (unsigned long)port);
+		mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port));
+		return 0;
+	}
+
 	ret = request_irq(port->irq, altera_uart_interrupt, IRQF_DISABLED,
 			DRV_NAME, port);
 	if (ret) {
@@ -316,7 +334,10 @@ static void altera_uart_shutdown(struct uart_port *port)
 
 	spin_unlock_irqrestore(&port->lock, flags);
 
-	free_irq(port->irq, port);
+	if (port->irq)
+		free_irq(port->irq, port);
+	else
+		del_timer_sync(&pp->tmr);
 }
 
 static const char *altera_uart_type(struct uart_port *port)
-- 
1.7.0.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/8] altera_uart: Add support for getting mapbase and IRQ from resources
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 1/8] serial: Factor out uart_poll_timeout() from 8250 driver Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less) Anton Vorontsov
@ 2010-10-01 13:21 ` Anton Vorontsov
  2010-10-01 13:21 ` [PATCH 4/8] altera_uart: Add support for different address strides Anton Vorontsov
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

This makes it much easier to integrate the driver with the rest of
the Linux (e.g. MFD subsystem).

The old method is still supported though.

Also, from now on, there is one platform device per port (no
changes are needed for the platform code, as no one registers
the devices anywhere in-tree yet).

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/serial/altera_uart.c |   60 ++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 7dd58da..1dfeffa 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -498,38 +498,54 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
 {
 	struct altera_uart_platform_uart *platp = pdev->dev.platform_data;
 	struct uart_port *port;
-	int i;
+	struct resource *res_mem;
+	struct resource *res_irq;
+	int i = pdev->id;
 
-	for (i = 0; i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS && platp[i].mapbase; i++) {
-		port = &altera_uart_ports[i].port;
+	/* -1 emphasizes that the platform must have one port, no .N suffix */
+	if (i == -1)
+		i = 0;
 
-		port->line = i;
-		port->type = PORT_ALTERA_UART;
-		port->mapbase = platp[i].mapbase;
-		port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
-		port->iotype = SERIAL_IO_MEM;
-		port->irq = platp[i].irq;
-		port->uartclk = platp[i].uartclk;
-		port->ops = &altera_uart_ops;
-		port->flags = ASYNC_BOOT_AUTOCONF;
+	if (i >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
+		return -EINVAL;
 
-		uart_add_one_port(&altera_uart_driver, port);
-	}
+	port = &altera_uart_ports[i].port;
+
+	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res_mem)
+		port->mapbase = res_mem->start;
+	else if (platp->mapbase)
+		port->mapbase = platp->mapbase;
+	else
+		return -EINVAL;
+
+	res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (res_irq)
+		port->irq = res_irq->start;
+	else if (platp->irq)
+		port->irq = platp->irq;
+
+	port->membase = ioremap(port->mapbase, ALTERA_UART_SIZE);
+	if (!port->membase)
+		return -ENOMEM;
+
+	port->line = i;
+	port->type = PORT_ALTERA_UART;
+	port->iotype = SERIAL_IO_MEM;
+	port->uartclk = platp->uartclk;
+	port->ops = &altera_uart_ops;
+	port->flags = ASYNC_BOOT_AUTOCONF;
+
+	uart_add_one_port(&altera_uart_driver, port);
 
 	return 0;
 }
 
 static int __devexit altera_uart_remove(struct platform_device *pdev)
 {
-	struct uart_port *port;
-	int i;
-
-	for (i = 0; i < CONFIG_SERIAL_ALTERA_UART_MAXPORTS; i++) {
-		port = &altera_uart_ports[i].port;
-		if (port)
-			uart_remove_one_port(&altera_uart_driver, port);
-	}
+	struct uart_port *port = &altera_uart_ports[pdev->id].port;
 
+	uart_remove_one_port(&altera_uart_driver, port);
 	return 0;
 }
 
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/8] altera_uart: Add support for different address strides
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
                   ` (2 preceding siblings ...)
  2010-10-01 13:21 ` [PATCH 3/8] altera_uart: Add support for getting mapbase and IRQ from resources Anton Vorontsov
@ 2010-10-01 13:21 ` Anton Vorontsov
  2010-10-01 14:01   ` Tobias Klauser
  2010-10-01 13:22 ` [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together Anton Vorontsov
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Some controllers implement registers with a stride, to support
those we must implement the proper IO accessors.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/serial/altera_uart.c |   58 ++++++++++++++++++++++++++---------------
 include/linux/altera_uart.h  |    1 +
 2 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 1dfeffa..f1985aa 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -82,9 +82,23 @@ struct altera_uart {
 	unsigned short imr;	/* Local IMR mirror */
 };
 
+static u32 altera_uart_readl(struct uart_port *port, int reg)
+{
+	struct altera_uart_platform_uart *platp = port->private_data;
+
+	return readl(port->membase + (reg << platp->bus_shift));
+}
+
+static void altera_uart_writel(struct uart_port *port, u32 dat, int reg)
+{
+	struct altera_uart_platform_uart *platp = port->private_data;
+
+	writel(dat, port->membase + (reg << platp->bus_shift));
+}
+
 static unsigned int altera_uart_tx_empty(struct uart_port *port)
 {
-	return (readl(port->membase + ALTERA_UART_STATUS_REG) &
+	return (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
 		ALTERA_UART_STATUS_TMT_MSK) ? TIOCSER_TEMT : 0;
 }
 
@@ -93,8 +107,7 @@ static unsigned int altera_uart_get_mctrl(struct uart_port *port)
 	struct altera_uart *pp = container_of(port, struct altera_uart, port);
 	unsigned int sigs;
 
-	sigs =
-	    (readl(port->membase + ALTERA_UART_STATUS_REG) &
+	sigs = (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
 	     ALTERA_UART_STATUS_CTS_MSK) ? TIOCM_CTS : 0;
 	sigs |= (pp->sigs & TIOCM_RTS);
 
@@ -110,7 +123,7 @@ static void altera_uart_set_mctrl(struct uart_port *port, unsigned int sigs)
 		pp->imr |= ALTERA_UART_CONTROL_RTS_MSK;
 	else
 		pp->imr &= ~ALTERA_UART_CONTROL_RTS_MSK;
-	writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 }
 
 static void altera_uart_start_tx(struct uart_port *port)
@@ -118,7 +131,7 @@ static void altera_uart_start_tx(struct uart_port *port)
 	struct altera_uart *pp = container_of(port, struct altera_uart, port);
 
 	pp->imr |= ALTERA_UART_CONTROL_TRDY_MSK;
-	writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 }
 
 static void altera_uart_stop_tx(struct uart_port *port)
@@ -126,7 +139,7 @@ static void altera_uart_stop_tx(struct uart_port *port)
 	struct altera_uart *pp = container_of(port, struct altera_uart, port);
 
 	pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
-	writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 }
 
 static void altera_uart_stop_rx(struct uart_port *port)
@@ -134,7 +147,7 @@ static void altera_uart_stop_rx(struct uart_port *port)
 	struct altera_uart *pp = container_of(port, struct altera_uart, port);
 
 	pp->imr &= ~ALTERA_UART_CONTROL_RRDY_MSK;
-	writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 }
 
 static void altera_uart_break_ctl(struct uart_port *port, int break_state)
@@ -147,7 +160,7 @@ static void altera_uart_break_ctl(struct uart_port *port, int break_state)
 		pp->imr |= ALTERA_UART_CONTROL_TRBK_MSK;
 	else
 		pp->imr &= ~ALTERA_UART_CONTROL_TRBK_MSK;
-	writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -171,7 +184,7 @@ static void altera_uart_set_termios(struct uart_port *port,
 
 	spin_lock_irqsave(&port->lock, flags);
 	uart_update_timeout(port, termios->c_cflag, baud);
-	writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
+	altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG);
 	spin_unlock_irqrestore(&port->lock, flags);
 }
 
@@ -181,14 +194,15 @@ static void altera_uart_rx_chars(struct altera_uart *pp)
 	unsigned char ch, flag;
 	unsigned short status;
 
-	while ((status = readl(port->membase + ALTERA_UART_STATUS_REG)) &
+	while ((status = altera_uart_readl(port, ALTERA_UART_STATUS_REG)) &
 	       ALTERA_UART_STATUS_RRDY_MSK) {
-		ch = readl(port->membase + ALTERA_UART_RXDATA_REG);
+		ch = altera_uart_readl(port, ALTERA_UART_RXDATA_REG);
 		flag = TTY_NORMAL;
 		port->icount.rx++;
 
 		if (status & ALTERA_UART_STATUS_E_MSK) {
-			writel(status, port->membase + ALTERA_UART_STATUS_REG);
+			altera_uart_writel(port, status,
+					   ALTERA_UART_STATUS_REG);
 
 			if (status & ALTERA_UART_STATUS_BRK_MSK) {
 				port->icount.brk++;
@@ -228,18 +242,18 @@ static void altera_uart_tx_chars(struct altera_uart *pp)
 
 	if (port->x_char) {
 		/* Send special char - probably flow control */
-		writel(port->x_char, port->membase + ALTERA_UART_TXDATA_REG);
+		altera_uart_writel(port, port->x_char, ALTERA_UART_TXDATA_REG);
 		port->x_char = 0;
 		port->icount.tx++;
 		return;
 	}
 
-	while (readl(port->membase + ALTERA_UART_STATUS_REG) &
+	while (altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
 	       ALTERA_UART_STATUS_TRDY_MSK) {
 		if (xmit->head == xmit->tail)
 			break;
-		writel(xmit->buf[xmit->tail],
-		       port->membase + ALTERA_UART_TXDATA_REG);
+		altera_uart_writel(port, xmit->buf[xmit->tail],
+		       ALTERA_UART_TXDATA_REG);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
 		port->icount.tx++;
 	}
@@ -249,7 +263,7 @@ static void altera_uart_tx_chars(struct altera_uart *pp)
 
 	if (xmit->head == xmit->tail) {
 		pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
-		writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+		altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 	}
 }
 
@@ -259,7 +273,7 @@ static irqreturn_t altera_uart_interrupt(int irq, void *data)
 	struct altera_uart *pp = container_of(port, struct altera_uart, port);
 	unsigned int isr;
 
-	isr = readl(port->membase + ALTERA_UART_STATUS_REG) & pp->imr;
+	isr = altera_uart_readl(port, ALTERA_UART_STATUS_REG) & pp->imr;
 
 	spin_lock(&port->lock);
 	if (isr & ALTERA_UART_STATUS_RRDY_MSK)
@@ -285,9 +299,9 @@ static void altera_uart_config_port(struct uart_port *port, int flags)
 	port->type = PORT_ALTERA_UART;
 
 	/* Clear mask, so no surprise interrupts. */
-	writel(0, port->membase + ALTERA_UART_CONTROL_REG);
+	altera_uart_writel(port, 0, ALTERA_UART_CONTROL_REG);
 	/* Clear status register */
-	writel(0, port->membase + ALTERA_UART_STATUS_REG);
+	altera_uart_writel(port, 0, ALTERA_UART_STATUS_REG);
 }
 
 static int altera_uart_startup(struct uart_port *port)
@@ -407,6 +421,7 @@ int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp)
 		port->uartclk = platp[i].uartclk;
 		port->flags = ASYNC_BOOT_AUTOCONF;
 		port->ops = &altera_uart_ops;
+		port->private_data = platp;
 	}
 
 	return 0;
@@ -414,7 +429,7 @@ int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp)
 
 static void altera_uart_console_putc(struct uart_port *port, const char c)
 {
-	while (!(readl(port->membase + ALTERA_UART_STATUS_REG) &
+	while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
 		 ALTERA_UART_STATUS_TRDY_MSK))
 		cpu_relax();
 
@@ -535,6 +550,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
 	port->uartclk = platp->uartclk;
 	port->ops = &altera_uart_ops;
 	port->flags = ASYNC_BOOT_AUTOCONF;
+	port->private_data = platp;
 
 	uart_add_one_port(&altera_uart_driver, port);
 
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
index 8d44106..c022c82 100644
--- a/include/linux/altera_uart.h
+++ b/include/linux/altera_uart.h
@@ -9,6 +9,7 @@ struct altera_uart_platform_uart {
 	unsigned long mapbase;	/* Physical address base */
 	unsigned int irq;	/* Interrupt vector */
 	unsigned int uartclk;	/* UART clock rate */
+	unsigned int bus_shift;	/* Bus shift (address stride) */
 };
 
 #endif /* __ALTUART_H */
-- 
1.7.0.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
                   ` (3 preceding siblings ...)
  2010-10-01 13:21 ` [PATCH 4/8] altera_uart: Add support for different address strides Anton Vorontsov
@ 2010-10-01 13:22 ` Anton Vorontsov
  2010-10-01 12:41   ` Alan Cox
  2010-10-01 14:23   ` [PATCH v3 " Anton Vorontsov
  2010-10-01 13:22 ` [PATCH 6/8] altera_uart: Fixup type usage of port flags Anton Vorontsov
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

This fixes tty name and major number conflicts. The major number
204 is used across many platform-specific serial drivers, so we
use that.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/serial/altera_uart.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index f1985aa..99e007f 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -28,6 +28,7 @@
 #include <linux/altera_uart.h>
 
 #define DRV_NAME "altera_uart"
+#define SERIAL_ALTERA_MAJOR 204
 
 /*
  * Altera UART register definitions according to the Nios UART datasheet:
@@ -471,7 +472,7 @@ static int __init altera_uart_console_setup(struct console *co, char *options)
 static struct uart_driver altera_uart_driver;
 
 static struct console altera_uart_console = {
-	.name	= "ttyS",
+	.name	= "ttyAL",
 	.write	= altera_uart_console_write,
 	.device	= uart_console_device,
 	.setup	= altera_uart_console_setup,
@@ -502,8 +503,8 @@ console_initcall(altera_uart_console_init);
 static struct uart_driver altera_uart_driver = {
 	.owner		= THIS_MODULE,
 	.driver_name	= DRV_NAME,
-	.dev_name	= "ttyS",
-	.major		= TTY_MAJOR,
+	.dev_name	= "ttyAL",
+	.major		= SERIAL_ALTERA_MAJOR,
 	.minor		= 64,
 	.nr		= CONFIG_SERIAL_ALTERA_UART_MAXPORTS,
 	.cons		= ALTERA_UART_CONSOLE,
@@ -603,3 +604,4 @@ MODULE_DESCRIPTION("Altera UART driver");
 MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" DRV_NAME);
+MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_ALTERA_MAJOR);
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 6/8] altera_uart: Fixup type usage of port flags
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
                   ` (4 preceding siblings ...)
  2010-10-01 13:22 ` [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together Anton Vorontsov
@ 2010-10-01 13:22 ` Anton Vorontsov
  2010-10-01 13:54   ` Tobias Klauser
  2010-10-01 13:22 ` [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console Anton Vorontsov
  2010-10-01 13:23 ` [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer Anton Vorontsov
  7 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

port->flags is of type upf_t, which corresponds to UPF_* flags.

ASYNC_BOOT_AUTOCONF is an unsigned integer, which happen to
be the same as UPF_BOOT_AUTOCONF.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/serial/altera_uart.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 99e007f..304181c 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -420,7 +420,7 @@ int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp)
 		port->iotype = SERIAL_IO_MEM;
 		port->irq = platp[i].irq;
 		port->uartclk = platp[i].uartclk;
-		port->flags = ASYNC_BOOT_AUTOCONF;
+		port->flags = UPF_BOOT_AUTOCONF;
 		port->ops = &altera_uart_ops;
 		port->private_data = platp;
 	}
@@ -550,7 +550,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
 	port->iotype = SERIAL_IO_MEM;
 	port->uartclk = platp->uartclk;
 	port->ops = &altera_uart_ops;
-	port->flags = ASYNC_BOOT_AUTOCONF;
+	port->flags = UPF_BOOT_AUTOCONF;
 	port->private_data = platp;
 
 	uart_add_one_port(&altera_uart_driver, port);
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
                   ` (5 preceding siblings ...)
  2010-10-01 13:22 ` [PATCH 6/8] altera_uart: Fixup type usage of port flags Anton Vorontsov
@ 2010-10-01 13:22 ` Anton Vorontsov
  2010-10-01 13:52   ` Tobias Klauser
  2010-10-01 13:23 ` [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer Anton Vorontsov
  7 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Simply add an early_altera_uart_setup() prototype declaration, otherwise
platform code have to do it in .c files, which is ugly.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 include/linux/altera_uart.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
index c022c82..a10a907 100644
--- a/include/linux/altera_uart.h
+++ b/include/linux/altera_uart.h
@@ -5,6 +5,8 @@
 #ifndef	__ALTUART_H
 #define	__ALTUART_H
 
+#include <linux/init.h>
+
 struct altera_uart_platform_uart {
 	unsigned long mapbase;	/* Physical address base */
 	unsigned int irq;	/* Interrupt vector */
@@ -12,4 +14,6 @@ struct altera_uart_platform_uart {
 	unsigned int bus_shift;	/* Bus shift (address stride) */
 };
 
+int __init early_altera_uart_setup(struct altera_uart_platform_uart *platp);
+
 #endif /* __ALTUART_H */
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer
  2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
                   ` (6 preceding siblings ...)
  2010-10-01 13:22 ` [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console Anton Vorontsov
@ 2010-10-01 13:23 ` Anton Vorontsov
  2010-10-01 13:50   ` Tobias Klauser
  7 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

Fixes sparse warning.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 drivers/serial/altera_uart.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 304181c..f50097e 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -460,7 +460,7 @@ static int __init altera_uart_console_setup(struct console *co, char *options)
 	if (co->index < 0 || co->index >= CONFIG_SERIAL_ALTERA_UART_MAXPORTS)
 		return -EINVAL;
 	port = &altera_uart_ports[co->index].port;
-	if (port->membase == 0)
+	if (!port->membase)
 		return -ENODEV;
 
 	if (options)
-- 
1.7.0.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer
  2010-10-01 13:23 ` [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer Anton Vorontsov
@ 2010-10-01 13:50   ` Tobias Klauser
  0 siblings, 0 replies; 21+ messages in thread
From: Tobias Klauser @ 2010-10-01 13:50 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Alan Cox, Andrew Morton, linux-serial,
	linux-kernel

On 2010-10-01 at 15:23:13 +0200, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> Fixes sparse warning.
> 
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console
  2010-10-01 13:22 ` [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console Anton Vorontsov
@ 2010-10-01 13:52   ` Tobias Klauser
  0 siblings, 0 replies; 21+ messages in thread
From: Tobias Klauser @ 2010-10-01 13:52 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Alan Cox, Andrew Morton, linux-serial,
	linux-kernel

On 2010-10-01 at 15:22:55 +0200, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> Simply add an early_altera_uart_setup() prototype declaration, otherwise
> platform code have to do it in .c files, which is ugly.
> 
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 12:41   ` Alan Cox
@ 2010-10-01 13:52     ` Anton Vorontsov
  2010-10-01 14:18       ` Alan Cox
  0 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 13:52 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

On Fri, Oct 01, 2010 at 01:41:38PM +0100, Alan Cox wrote:
> On Fri, 1 Oct 2010 17:22:07 +0400
> Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> 
> > This fixes tty name and major number conflicts. The major number
> > 204 is used across many platform-specific serial drivers, so we
> > use that.
> 
> 204 is allocated in small chunks to specific low volume devices so you
> need a proper minor allocation
> 
> At this point that would be 204,213 for whatever tiny range you need.
> 
> Please send me a patch for devices.txt and update accordingly,
> otherwise no objections.

Sure thing. Will this work?

Thanks!

- - -
From: Anton Vorontsov <cbouatmailru@gmail.com>
Subject: lanana: Assign a device name and numbering for Altera UART

Note that Altera UART is usually found on an FPGA solutions, so there
could be quite a lot of ports (expanded as needed).

I guess the sane maximum number of ports would be 8, but it is still
possible to do hundreds of them.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
---
 Documentation/devices.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index d0d1df6..984cf24 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -2805,6 +2805,9 @@ Your cooperation is appreciated.
 		 210 = /dev/ttyMAX1		MAX3100 serial port 1
 		 211 = /dev/ttyMAX2		MAX3100 serial port 2
 		 212 = /dev/ttyMAX3		MAX3100 serial port 3
+		 213 = /dev/ttyAL0		Altera UART port 0
+		    ...
+		 221 = /dev/ttyAL7		Altera UART port 7
 
 205 char	Low-density serial ports (alternate device)
 		  0 = /dev/culu0		Callout device for ttyLU0
-- 
1.7.0.5


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/8] altera_uart: Fixup type usage of port flags
  2010-10-01 13:22 ` [PATCH 6/8] altera_uart: Fixup type usage of port flags Anton Vorontsov
@ 2010-10-01 13:54   ` Tobias Klauser
  0 siblings, 0 replies; 21+ messages in thread
From: Tobias Klauser @ 2010-10-01 13:54 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Alan Cox, Andrew Morton, linux-serial,
	linux-kernel

On 2010-10-01 at 15:22:37 +0200, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> port->flags is of type upf_t, which corresponds to UPF_* flags.
> 
> ASYNC_BOOT_AUTOCONF is an unsigned integer, which happen to
> be the same as UPF_BOOT_AUTOCONF.
> 
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less)
  2010-10-01 13:21 ` [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less) Anton Vorontsov
@ 2010-10-01 13:57   ` Tobias Klauser
  0 siblings, 0 replies; 21+ messages in thread
From: Tobias Klauser @ 2010-10-01 13:57 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Alan Cox, Andrew Morton, linux-serial,
	linux-kernel

On 2010-10-01 at 15:21:33 +0200, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> Some Altera UART implementations doesn't route the IRQ line, so we have
> to work in polling mode.
> 
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

Thanks a lot.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/8] altera_uart: Add support for different address strides
  2010-10-01 13:21 ` [PATCH 4/8] altera_uart: Add support for different address strides Anton Vorontsov
@ 2010-10-01 14:01   ` Tobias Klauser
  0 siblings, 0 replies; 21+ messages in thread
From: Tobias Klauser @ 2010-10-01 14:01 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Alan Cox, Andrew Morton, linux-serial,
	linux-kernel

On 2010-10-01 at 15:21:54 +0200, Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> Some controllers implement registers with a stride, to support
> those we must implement the proper IO accessors.
> 
> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

Thanks.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 13:52     ` Anton Vorontsov
@ 2010-10-01 14:18       ` Alan Cox
  2010-10-01 15:22         ` Anton Vorontsov
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Cox @ 2010-10-01 14:18 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

> I guess the sane maximum number of ports would be 8, but it is still
> possible to do hundreds of them.

In that case you may just want to allocate a dynamic major instead - or
do you actually need a fixed major/minor for your boot up ?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v3 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 13:22 ` [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together Anton Vorontsov
  2010-10-01 12:41   ` Alan Cox
@ 2010-10-01 14:23   ` Anton Vorontsov
  1 sibling, 0 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 14:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alan Cox, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

This fixes tty name, major and minor numbers. The major number
204 is used across many platform-specific serial drivers, so we
use that.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
---

Now minor is set to 213.

 drivers/serial/altera_uart.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index f1985aa..fbc8f8e 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -28,6 +28,8 @@
 #include <linux/altera_uart.h>
 
 #define DRV_NAME "altera_uart"
+#define SERIAL_ALTERA_MAJOR 204
+#define SERIAL_ALTERA_MINOR 213
 
 /*
  * Altera UART register definitions according to the Nios UART datasheet:
@@ -471,7 +473,7 @@ static int __init altera_uart_console_setup(struct console *co, char *options)
 static struct uart_driver altera_uart_driver;
 
 static struct console altera_uart_console = {
-	.name	= "ttyS",
+	.name	= "ttyAL",
 	.write	= altera_uart_console_write,
 	.device	= uart_console_device,
 	.setup	= altera_uart_console_setup,
@@ -502,9 +504,9 @@ console_initcall(altera_uart_console_init);
 static struct uart_driver altera_uart_driver = {
 	.owner		= THIS_MODULE,
 	.driver_name	= DRV_NAME,
-	.dev_name	= "ttyS",
-	.major		= TTY_MAJOR,
-	.minor		= 64,
+	.dev_name	= "ttyAL",
+	.major		= SERIAL_ALTERA_MAJOR,
+	.minor		= SERIAL_ALTERA_MINOR,
 	.nr		= CONFIG_SERIAL_ALTERA_UART_MAXPORTS,
 	.cons		= ALTERA_UART_CONSOLE,
 };
@@ -603,3 +605,4 @@ MODULE_DESCRIPTION("Altera UART driver");
 MODULE_AUTHOR("Thomas Chou <thomas@wytron.com.tw>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" DRV_NAME);
+MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_ALTERA_MAJOR);
-- 
1.7.0.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 15:22         ` Anton Vorontsov
@ 2010-10-01 14:57           ` Alan Cox
  2010-10-01 16:05             ` Anton Vorontsov
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Cox @ 2010-10-01 14:57 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

> I don't need it, but someone might.

Why ?

> Plus, it doesn't solve anything as there are only 256 minor
> numbers. ;-) If we ever want  to support the insane number of Altera
> UARTs, we'll have to solve it very differently. For now, I'd vote for
> keeping it simple.

We got past the 256/256 limit some time ago.

Alan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 14:18       ` Alan Cox
@ 2010-10-01 15:22         ` Anton Vorontsov
  2010-10-01 14:57           ` Alan Cox
  0 siblings, 1 reply; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 15:22 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

On Fri, Oct 01, 2010 at 03:18:41PM +0100, Alan Cox wrote:
> > I guess the sane maximum number of ports would be 8, but it is still
> > possible to do hundreds of them.
> 
> In that case you may just want to allocate a dynamic major instead - or
> do you actually need a fixed major/minor for your boot up ?

I don't need it, but someone might.

Plus, it doesn't solve anything as there are only 256 minor numbers. ;-)
If we ever want  to support the insane number of Altera UARTs, we'll
have to solve it very differently. For now, I'd vote for keeping it
simple.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together
  2010-10-01 14:57           ` Alan Cox
@ 2010-10-01 16:05             ` Anton Vorontsov
  0 siblings, 0 replies; 21+ messages in thread
From: Anton Vorontsov @ 2010-10-01 16:05 UTC (permalink / raw)
  To: Alan Cox
  Cc: Greg Kroah-Hartman, Andrew Morton, Tobias Klauser, linux-serial,
	linux-kernel

On Fri, Oct 01, 2010 at 03:57:56PM +0100, Alan Cox wrote:
> > I don't need it, but someone might.
> 
> Why ?

No idea. But why you asked in the first place? :-) I thought you
have had some scenario when static major number is necessary.

> > Plus, it doesn't solve anything as there are only 256 minor
> > numbers. ;-) If we ever want  to support the insane number of Altera
> > UARTs, we'll have to solve it very differently. For now, I'd vote for
> > keeping it simple.
> 
> We got past the 256/256 limit some time ago.

Oh? Then using dynamic major makes a lot of sense, thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2010-10-01 16:05 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 13:20 [PATCH v2 0/8] Some patches for Altera UART driver Anton Vorontsov
2010-10-01 13:21 ` [PATCH 1/8] serial: Factor out uart_poll_timeout() from 8250 driver Anton Vorontsov
2010-10-01 13:21 ` [PATCH 2/8] altera_uart: Add support for polling mode (IRQ-less) Anton Vorontsov
2010-10-01 13:57   ` Tobias Klauser
2010-10-01 13:21 ` [PATCH 3/8] altera_uart: Add support for getting mapbase and IRQ from resources Anton Vorontsov
2010-10-01 13:21 ` [PATCH 4/8] altera_uart: Add support for different address strides Anton Vorontsov
2010-10-01 14:01   ` Tobias Klauser
2010-10-01 13:22 ` [PATCH 5/8] altera_uart: Make it possible to use Altera UART and 8250 ports together Anton Vorontsov
2010-10-01 12:41   ` Alan Cox
2010-10-01 13:52     ` Anton Vorontsov
2010-10-01 14:18       ` Alan Cox
2010-10-01 15:22         ` Anton Vorontsov
2010-10-01 14:57           ` Alan Cox
2010-10-01 16:05             ` Anton Vorontsov
2010-10-01 14:23   ` [PATCH v3 " Anton Vorontsov
2010-10-01 13:22 ` [PATCH 6/8] altera_uart: Fixup type usage of port flags Anton Vorontsov
2010-10-01 13:54   ` Tobias Klauser
2010-10-01 13:22 ` [PATCH 7/8] altera_uart: Fix missing prototype for registering an early console Anton Vorontsov
2010-10-01 13:52   ` Tobias Klauser
2010-10-01 13:23 ` [PATCH 8/8] altera_uart: Don't use plain integer as NULL pointer Anton Vorontsov
2010-10-01 13:50   ` Tobias Klauser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).