linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] More atmel_serial updates
@ 2006-09-28 13:31 Haavard Skinnemoen
  2006-09-28 13:31 ` [PATCH 1/4] atmel_serial: Pass fixed register mappings through platform_data Haavard Skinnemoen
  0 siblings, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 13:31 UTC (permalink / raw)
  To: Andrew Victor; +Cc: Russell King, linux-kernel, Haavard Skinnemoen

Hi,

Now that Andrew Victor seems to be happy about the renaming (thanks
a lot for reviewing, Andrew), here are a few more patches to make
atmel_serial usable for AVR32, as well as a general bugfix.

I've dropped the break fix for now, as it doesn't seem to work on
my AT91RM9200-EK board. I'll see if I can fix it properly later --
it's not really a showstopper, for me anyway.

There's also a pure AVR32 patch in this set. Feel free to ignore it,
but I thought I'd include it so that you can see the whole picture.

Shortlog and diffstat for the whole series follows.

Haavard

Haavard Skinnemoen:
      atmel_serial: Pass fixed register mappings through platform_data
      atmel_serial: Support AVR32
      AVR32: Allow renumbering of serial devices
      atmel_serial: Fix roundoff error in atmel_console_get_options

 arch/arm/mach-at91rm9200/devices.c      |    1 +
 arch/avr32/boards/atstk1000/atstk1002.c |   16 ++++++++-
 arch/avr32/kernel/setup.c               |    1 +
 arch/avr32/mach-at32ap/at32ap.c         |    3 --
 arch/avr32/mach-at32ap/at32ap7000.c     |   53 +++++++++++++++++++++----------
 drivers/serial/Kconfig                  |   24 +++++++-------
 drivers/serial/atmel_serial.c           |   17 ++++++++--
 include/asm-arm/arch-at91rm9200/board.h |    1 +
 include/asm-avr32/arch-at32ap/board.h   |    6 ++++
 include/asm-avr32/arch-at32ap/init.h    |    1 +
 10 files changed, 85 insertions(+), 38 deletions(-)

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

* [PATCH 1/4] atmel_serial: Pass fixed register mappings through platform_data
  2006-09-28 13:31 [PATCH 0/4] More atmel_serial updates Haavard Skinnemoen
@ 2006-09-28 13:31 ` Haavard Skinnemoen
  2006-09-28 13:31   ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
  0 siblings, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 13:31 UTC (permalink / raw)
  To: Andrew Victor; +Cc: Russell King, linux-kernel, Haavard Skinnemoen

In order to initialize the serial console early, the atmel_serial
driver had to do a hack where it compared the physical address of the
port with an address known to be permanently mapped, and used it as a
virtual address. This got around the limitation that ioremap() isn't
always available when the console is being initalized.

This patch removes that hack and replaces it with a new "regs" field
in struct atmel_uart_data that the board-specific code can initialize
to a fixed virtual mapping for platform devices where this is possible.
It also initializes the DBGU's regs field with the address the driver
used to check against.

On AVR32, the "regs" field is initialized from the physical base
address when this it can be accessed through a permanently 1:1 mapped
segment, i.e. the P4 segment.

If regs is NULL, the console initialization is delayed until the "real"
driver is up and running and ioremap() can be used.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 arch/arm/mach-at91rm9200/devices.c      |    1 +
 arch/avr32/mach-at32ap/at32ap7000.c     |   33 +++++++++++++++++++++++++------
 drivers/serial/atmel_serial.c           |    5 +++--
 include/asm-arm/arch-at91rm9200/board.h |    1 +
 include/asm-avr32/arch-at32ap/board.h   |    5 +++++
 5 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c
index b8c0344..a4ea616 100644
--- a/arch/arm/mach-at91rm9200/devices.c
+++ b/arch/arm/mach-at91rm9200/devices.c
@@ -561,6 +561,7 @@ static struct resource dbgu_resources[] 
 static struct atmel_uart_data dbgu_data = {
 	.use_dma_tx	= 0,
 	.use_dma_rx	= 0,		/* DBGU not capable of receive DMA */
+	.regs		= (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
 };
 
 static struct platform_device at91rm9200_dbgu_device = {
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index 05d1296..3dd3058 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -523,32 +523,48 @@ void __init at32_add_system_devices(void
  *  USART
  * -------------------------------------------------------------------- */
 
+static struct atmel_uart_data atmel_usart0_data = {
+	.use_dma_tx	= 1,
+	.use_dma_rx	= 1,
+};
 static struct resource atmel_usart0_resource[] = {
 	PBMEM(0xffe00c00),
 	IRQ(7),
 };
-DEFINE_DEV(atmel_usart, 0);
+DEFINE_DEV_DATA(atmel_usart, 0);
 DEV_CLK(usart, atmel_usart0, pba, 4);
 
+static struct atmel_uart_data atmel_usart1_data = {
+	.use_dma_tx	= 1,
+	.use_dma_rx	= 1,
+};
 static struct resource atmel_usart1_resource[] = {
 	PBMEM(0xffe01000),
 	IRQ(7),
 };
-DEFINE_DEV(atmel_usart, 1);
+DEFINE_DEV_DATA(atmel_usart, 1);
 DEV_CLK(usart, atmel_usart1, pba, 4);
 
+static struct atmel_uart_data atmel_usart2_data = {
+	.use_dma_tx	= 1,
+	.use_dma_rx	= 1,
+};
 static struct resource atmel_usart2_resource[] = {
 	PBMEM(0xffe01400),
 	IRQ(8),
 };
-DEFINE_DEV(atmel_usart, 2);
+DEFINE_DEV_DATA(atmel_usart, 2);
 DEV_CLK(usart, atmel_usart2, pba, 5);
 
+static struct atmel_uart_data atmel_usart3_data = {
+	.use_dma_tx	= 1,
+	.use_dma_rx	= 1,
+};
 static struct resource atmel_usart3_resource[] = {
 	PBMEM(0xffe01800),
 	IRQ(9),
 };
-DEFINE_DEV(atmel_usart, 3);
+DEFINE_DEV_DATA(atmel_usart, 3);
 DEV_CLK(usart, atmel_usart3, pba, 6);
 
 static inline void configure_usart0_pins(void)
@@ -597,8 +613,13 @@ static struct platform_device *setup_usa
 		configure_usart3_pins();
 		break;
 	default:
-		pdev = NULL;
-		break;
+		return NULL;
+	}
+
+	if (PXSEG(pdev->resource[0].start) == P4SEG) {
+		/* Addresses in the P4 segment are permanently mapped 1:1 */
+		struct atmel_uart_data *data = pdev->dev.platform_data;
+		data->regs = (void __iomem *)pdev->resource[0].start;
 	}
 
 	return pdev;
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 4625541..8fff85c 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -694,8 +694,9 @@ static void __devinit atmel_init_port(st
 	port->mapbase	= pdev->resource[0].start;
 	port->irq	= pdev->resource[1].start;
 
-	if (port->mapbase == AT91_VA_BASE_SYS + AT91_DBGU)		/* Part of system perpherals - already mapped */
-		port->membase = (void __iomem *) port->mapbase;
+	if (data->regs)
+		/* Already mapped by setup code */
+		port->membase = data->regs;
 	else {
 		port->flags	|= UPF_IOREMAP;
 		port->membase	= NULL;
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91rm9200/board.h
index d565270..3cc9aec 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91rm9200/board.h
@@ -103,6 +103,7 @@ extern void __init at91_init_serial(stru
 struct atmel_uart_data {
 	short		use_dma_tx;	/* use transmit DMA? */
 	short		use_dma_rx;	/* use receive DMA? */
+	void __iomem	*regs;		/* virtual base address, if any */
 };
 extern void __init at91_add_device_serial(void);
 
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 82e5404..4355072 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -12,6 +12,11 @@ void at32_add_system_devices(void);
 #define ATMEL_MAX_UART	4
 extern struct platform_device *atmel_default_console_device;
 
+struct atmel_uart_data {
+	short		use_dma_tx;	/* use transmit DMA? */
+	short		use_dma_rx;	/* use receive DMA? */
+	void __iomem	*regs;		/* virtual base address, if any */
+};
 struct platform_device *at32_add_device_usart(unsigned int id);
 
 struct eth_platform_data {
-- 
1.4.1.1


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

* [PATCH 2/4] atmel_serial: Support AVR32
  2006-09-28 13:31 ` [PATCH 1/4] atmel_serial: Pass fixed register mappings through platform_data Haavard Skinnemoen
@ 2006-09-28 13:31   ` Haavard Skinnemoen
  2006-09-28 13:31     ` [PATCH 3/4] AVR32: Allow renumbering of serial devices Haavard Skinnemoen
  2006-09-28 14:01     ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
  0 siblings, 2 replies; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 13:31 UTC (permalink / raw)
  To: Andrew Victor; +Cc: Russell King, linux-kernel, Haavard Skinnemoen

Make CONFIG_SERIAL_ATMEL selectable on AVR32 and #ifdef out some ARM-
specific code in the driver.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/serial/Kconfig        |   24 ++++++++++++------------
 drivers/serial/atmel_serial.c |    4 ++++
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 4f962de..7eff74a 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -301,31 +301,31 @@ config SERIAL_AMBA_PL011_CONSOLE
 
 config SERIAL_ATMEL
 	bool "AT91 / AT32 on-chip serial port support"
-	depends on ARM && (ARCH_AT91RM9200 || ARCH_AT91SAM9261)
+	depends on ARM && (ARCH_AT91RM9200 || ARCH_AT91SAM9261) || AVR32
 	select SERIAL_CORE
 	help
 	  This enables the driver for the on-chip UARTs of the Atmel
-	  AT91RM9200 and AT91SAM926 processor.
+	  AT91RM9200, AT91SAM926 and AT32AP7000 processors.
 
 config SERIAL_ATMEL_CONSOLE
 	bool "Support for console on AT91 / AT32 serial port"
 	depends on SERIAL_ATMEL=y
 	select SERIAL_CORE_CONSOLE
 	help
-	  Say Y here if you wish to use a UART on the Atmel AT91RM9200 or
-	  AT91SAM9261 as the system console (the system console is the device
-	  which receives all kernel messages and warnings and which allows
-	  logins in single user mode).
+	  Say Y here if you wish to use a UART on the Atmel AT91RM9200,
+	  AT91SAM9261 or AT32AP7000 as the system console (the system
+	  console is the device which receives all kernel messages and
+	  warnings and which allows logins in single user mode).
 
 config SERIAL_ATMEL_TTYAT
-	bool "Install as device ttyAT0-4 instead of ttyS0-4"
+	bool "Install as device ttyATn instead of ttySn"
 	depends on SERIAL_ATMEL=y
 	help
-	  Say Y here if you wish to have the five internal AT91RM9200 UARTs
-	  appear as /dev/ttyAT0-4 (major 204, minor 154-158) instead of the
-	  normal /dev/ttyS0-4 (major 4, minor 64-68). This is necessary if
-	  you also want other UARTs, such as external 8250/16C550 compatible
-	  UARTs.
+	  Say Y here if you wish to have the internal AT91 / AT32 UARTs
+	  appear as /dev/ttyATn (major 204, minor starting at 154)
+	  instead of the normal /dev/ttySn (major 4, minor starting at
+	  64). This is necessary if you also want other UARTs, such as
+	  external 8250/16C550 compatible UARTs.
 	  The ttySn nodes are legally reserved for the 8250 serial driver
 	  but are often misused by other serial drivers.
 
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 8fff85c..6f1f4ea 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -39,8 +39,10 @@ #include <asm/io.h>
 #include <asm/arch/at91rm9200_pdc.h>
 #include <asm/mach/serial_at91.h>
 #include <asm/arch/board.h>
+#ifdef CONFIG_ARM
 #include <asm/arch/system.h>
 #include <asm/arch/gpio.h>
+#endif
 
 #include "atmel_serial.h"
 
@@ -135,6 +137,7 @@ static void atmel_set_mctrl(struct uart_
 	unsigned int control = 0;
 	unsigned int mode;
 
+#ifdef CONFIG_ARM
 	if (arch_identify() == ARCH_ID_AT91RM9200) {
 		/*
 		 * AT91RM9200 Errata #39: RTS0 is not internally connected to PA21.
@@ -147,6 +150,7 @@ static void atmel_set_mctrl(struct uart_
 				at91_set_gpio_value(AT91_PIN_PA21, 1);
 		}
 	}
+#endif
 
 	if (mctrl & TIOCM_RTS)
 		control |= ATMEL_US_RTSEN;
-- 
1.4.1.1


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

* [PATCH 3/4] AVR32: Allow renumbering of serial devices
  2006-09-28 13:31   ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
@ 2006-09-28 13:31     ` Haavard Skinnemoen
  2006-09-28 13:31       ` [PATCH 4/4] atmel_serial: Fix roundoff error in atmel_console_get_options Haavard Skinnemoen
  2006-09-28 14:01     ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
  1 sibling, 1 reply; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 13:31 UTC (permalink / raw)
  To: Andrew Victor; +Cc: Russell King, linux-kernel, Haavard Skinnemoen

Allow the board to remap actual USART peripheral devices to serial
devices by calling at32_map_usart(hw_id, serial_line). This ensures
that even though ATSTK1002 uses USART1 as the first serial port, it
will still have a ttyS0 device.

This also adds a board-specific early setup hook and moves the
at32_setup_serial_console() call there from the platform code.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 arch/avr32/boards/atstk1000/atstk1002.c |   16 +++++++++++++---
 arch/avr32/kernel/setup.c               |    1 +
 arch/avr32/mach-at32ap/at32ap.c         |    3 ---
 arch/avr32/mach-at32ap/at32ap7000.c     |   22 ++++++++++------------
 include/asm-avr32/arch-at32ap/board.h   |    1 +
 include/asm-avr32/arch-at32ap/init.h    |    1 +
 6 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 49164e9..cced73c 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 
 #include <asm/arch/board.h>
+#include <asm/arch/init.h>
 
 struct eth_platform_data __initdata eth0_data = {
 	.valid		= 1,
@@ -20,13 +21,22 @@ struct eth_platform_data __initdata eth0
 
 extern struct lcdc_platform_data atstk1000_fb0_data;
 
+void __init setup_board(void)
+{
+	at32_map_usart(1, 0);	/* /dev/ttyS0 */
+	at32_map_usart(2, 1);	/* /dev/ttyS1 */
+	at32_map_usart(3, 2);	/* /dev/ttyS2 */
+
+	at32_setup_serial_console(0);
+}
+
 static int __init atstk1002_init(void)
 {
 	at32_add_system_devices();
 
-	at32_add_device_usart(1);	/* /dev/ttyS0 */
-	at32_add_device_usart(2);	/* /dev/ttyS1 */
-	at32_add_device_usart(3);	/* /dev/ttyS2 */
+	at32_add_device_usart(0);
+	at32_add_device_usart(1);
+	at32_add_device_usart(2);
 
 	at32_add_device_eth(0, &eth0_data);
 	at32_add_device_spi(0);
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index 5d68f3c..ea2d1ff 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -292,6 +292,7 @@ void __init setup_arch (char **cmdline_p
 
 	setup_processor();
 	setup_platform();
+	setup_board();
 
 	cpu_clk = clk_get(NULL, "cpu");
 	if (IS_ERR(cpu_clk)) {
diff --git a/arch/avr32/mach-at32ap/at32ap.c b/arch/avr32/mach-at32ap/at32ap.c
index f7cedf5..90f207e 100644
--- a/arch/avr32/mach-at32ap/at32ap.c
+++ b/arch/avr32/mach-at32ap/at32ap.c
@@ -48,9 +48,6 @@ void __init setup_platform(void)
 	at32_sm_init();
 	at32_clock_init();
 	at32_portmux_init();
-
-	/* FIXME: This doesn't belong here */
-	at32_setup_serial_console(1);
 }
 
 static int __init pdc_probe(struct platform_device *pdev)
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index 3dd3058..7ff6ad8 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -591,11 +591,13 @@ static inline void configure_usart3_pins
 	portmux_set_func(PIOB, 17, FUNC_B);	/* TXD	*/
 }
 
-static struct platform_device *setup_usart(unsigned int id)
+static struct platform_device *at32_usarts[4];
+
+void __init at32_map_usart(unsigned int hw_id, unsigned int line)
 {
 	struct platform_device *pdev;
 
-	switch (id) {
+	switch (hw_id) {
 	case 0:
 		pdev = &atmel_usart0_device;
 		configure_usart0_pins();
@@ -613,7 +615,7 @@ static struct platform_device *setup_usa
 		configure_usart3_pins();
 		break;
 	default:
-		return NULL;
+		return;
 	}
 
 	if (PXSEG(pdev->resource[0].start) == P4SEG) {
@@ -622,25 +624,21 @@ static struct platform_device *setup_usa
 		data->regs = (void __iomem *)pdev->resource[0].start;
 	}
 
-	return pdev;
+	pdev->id = line;
+	at32_usarts[line] = pdev;
 }
 
 struct platform_device *__init at32_add_device_usart(unsigned int id)
 {
-	struct platform_device *pdev;
-
-	pdev = setup_usart(id);
-	if (pdev)
-		platform_device_register(pdev);
-
-	return pdev;
+	platform_device_register(at32_usarts[id]);
+	return at32_usarts[id];
 }
 
 struct platform_device *atmel_default_console_device;
 
 void __init at32_setup_serial_console(unsigned int usart_id)
 {
-	atmel_default_console_device = setup_usart(usart_id);
+	atmel_default_console_device = at32_usarts[usart_id];
 }
 
 /* --------------------------------------------------------------------
diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h
index 4355072..a39b3e9 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -17,6 +17,7 @@ struct atmel_uart_data {
 	short		use_dma_rx;	/* use receive DMA? */
 	void __iomem	*regs;		/* virtual base address, if any */
 };
+void at32_map_usart(unsigned int hw_id, unsigned int line);
 struct platform_device *at32_add_device_usart(unsigned int id);
 
 struct eth_platform_data {
diff --git a/include/asm-avr32/arch-at32ap/init.h b/include/asm-avr32/arch-at32ap/init.h
index 4372263..5e75d85 100644
--- a/include/asm-avr32/arch-at32ap/init.h
+++ b/include/asm-avr32/arch-at32ap/init.h
@@ -11,6 +11,7 @@ #ifndef __ASM_AVR32_AT32AP_INIT_H__
 #define __ASM_AVR32_AT32AP_INIT_H__
 
 void setup_platform(void);
+void setup_board(void);
 
 /* Called by setup_platform */
 void at32_clock_init(void);
-- 
1.4.1.1


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

* [PATCH 4/4] atmel_serial: Fix roundoff error in atmel_console_get_options
  2006-09-28 13:31     ` [PATCH 3/4] AVR32: Allow renumbering of serial devices Haavard Skinnemoen
@ 2006-09-28 13:31       ` Haavard Skinnemoen
  0 siblings, 0 replies; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 13:31 UTC (permalink / raw)
  To: Andrew Victor; +Cc: Russell King, linux-kernel, Haavard Skinnemoen

The atmel_console_get_options() function initializes the baud,
parity and bits settings from the actual hardware setup, in
case it has been initialized by a e.g. boot loader.

The baud rate, however, is not necessarily exactly equal to one of
the standard baud rates (115200, etc.) This means that the baud rate
calculated by this function may be slightly higher or slightly lower
than one of the standard baud rates.

If the baud rate is slightly lower than the target, this causes
problems when uart_set_option() tries to match the detected baud rate
against the standard baud rate, as it will always select a baud rate
that is lower or equal to the target rate. For example if the
detected baud rate is slightly lower than 115200, usart_set_options()
will select 57600.

This patch fixes the problem by subtracting 1 from the value in BRGR
when calculating the baud rate. The detected baud rate will thus
always be higher than the nearest standard baud rate, and
uart_set_options() will end up doing the right thing.

Tested on ATSTK1000 and AT91RM9200-EK boards. Both are broken without
this patch.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/serial/atmel_serial.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 6f1f4ea..2613a7e 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -793,8 +793,14 @@ static void __init atmel_console_get_opt
 	else if (mr == ATMEL_US_PAR_ODD)
 		*parity = 'o';
 
+	/*
+	 * The serial core only rounds down when matching this to a
+	 * supported baud rate. Make sure we don't end up slightly
+	 * lower than one of those, as it would make us fall through
+	 * to a much lower baud rate than we really want.
+	 */
 	quot = UART_GET_BRGR(port);
-	*baud = port->uartclk / (16 * (quot));
+	*baud = port->uartclk / (16 * (quot - 1));
 }
 
 static int __init atmel_console_setup(struct console *co, char *options)
-- 
1.4.1.1


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

* Re: [PATCH 2/4] atmel_serial: Support AVR32
  2006-09-28 13:31   ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
  2006-09-28 13:31     ` [PATCH 3/4] AVR32: Allow renumbering of serial devices Haavard Skinnemoen
@ 2006-09-28 14:01     ` Haavard Skinnemoen
  1 sibling, 0 replies; 6+ messages in thread
From: Haavard Skinnemoen @ 2006-09-28 14:01 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: Andrew Victor, Russell King, linux-kernel

On Thu, 28 Sep 2006 15:31:40 +0200
Haavard Skinnemoen <hskinnemoen@atmel.com> wrote:

> Make CONFIG_SERIAL_ATMEL selectable on AVR32 and #ifdef out some ARM-
> specific code in the driver.

Hmm...the dependency changes I promised to make got left out during the
final git-reset/git-am/git-format-patch shuffling. This patch includes
them.

Haavard
---
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH 2/4] atmel_serial: Support AVR32

Make CONFIG_SERIAL_ATMEL selectable on AVR32 and #ifdef out some ARM-
specific code in the driver.

Also simplify the ARM dependencies a bit. This driver is usable on all
AT91 parts, and ARCH_AT91 implies ARCH_AT91RM9200 || ARCH_AT91SAM9261
as well as any future AT91 parts.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/serial/Kconfig        |   24 ++++++++++++------------
 drivers/serial/atmel_serial.c |    4 ++++
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 4f962de..b9c277d 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -301,31 +301,31 @@ config SERIAL_AMBA_PL011_CONSOLE
 
 config SERIAL_ATMEL
 	bool "AT91 / AT32 on-chip serial port support"
-	depends on ARM && (ARCH_AT91RM9200 || ARCH_AT91SAM9261)
+	depends on (ARM && ARCH_AT91) || AVR32
 	select SERIAL_CORE
 	help
 	  This enables the driver for the on-chip UARTs of the Atmel
-	  AT91RM9200 and AT91SAM926 processor.
+	  AT91 and AT32 processors.
 
 config SERIAL_ATMEL_CONSOLE
 	bool "Support for console on AT91 / AT32 serial port"
 	depends on SERIAL_ATMEL=y
 	select SERIAL_CORE_CONSOLE
 	help
-	  Say Y here if you wish to use a UART on the Atmel AT91RM9200 or
-	  AT91SAM9261 as the system console (the system console is the device
-	  which receives all kernel messages and warnings and which allows
-	  logins in single user mode).
+	  Say Y here if you wish to use an on-chip UART on a Atmel
+	  AT91 or AT32 processor as the system console (the system
+	  console is the device which receives all kernel messages and
+	  warnings and which allows logins in single user mode).
 
 config SERIAL_ATMEL_TTYAT
-	bool "Install as device ttyAT0-4 instead of ttyS0-4"
+	bool "Install as device ttyATn instead of ttySn"
 	depends on SERIAL_ATMEL=y
 	help
-	  Say Y here if you wish to have the five internal AT91RM9200 UARTs
-	  appear as /dev/ttyAT0-4 (major 204, minor 154-158) instead of the
-	  normal /dev/ttyS0-4 (major 4, minor 64-68). This is necessary if
-	  you also want other UARTs, such as external 8250/16C550 compatible
-	  UARTs.
+	  Say Y here if you wish to have the internal AT91 / AT32 UARTs
+	  appear as /dev/ttyATn (major 204, minor starting at 154)
+	  instead of the normal /dev/ttySn (major 4, minor starting at
+	  64). This is necessary if you also want other UARTs, such as
+	  external 8250/16C550 compatible UARTs.
 	  The ttySn nodes are legally reserved for the 8250 serial driver
 	  but are often misused by other serial drivers.
 
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 8fff85c..6f1f4ea 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -39,8 +39,10 @@ #include <asm/io.h>
 #include <asm/arch/at91rm9200_pdc.h>
 #include <asm/mach/serial_at91.h>
 #include <asm/arch/board.h>
+#ifdef CONFIG_ARM
 #include <asm/arch/system.h>
 #include <asm/arch/gpio.h>
+#endif
 
 #include "atmel_serial.h"
 
@@ -135,6 +137,7 @@ static void atmel_set_mctrl(struct uart_
 	unsigned int control = 0;
 	unsigned int mode;
 
+#ifdef CONFIG_ARM
 	if (arch_identify() == ARCH_ID_AT91RM9200) {
 		/*
 		 * AT91RM9200 Errata #39: RTS0 is not internally connected to PA21.
@@ -147,6 +150,7 @@ static void atmel_set_mctrl(struct uart_
 				at91_set_gpio_value(AT91_PIN_PA21, 1);
 		}
 	}
+#endif
 
 	if (mctrl & TIOCM_RTS)
 		control |= ATMEL_US_RTSEN;
-- 
1.4.1.1


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

end of thread, other threads:[~2006-09-28 14:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-28 13:31 [PATCH 0/4] More atmel_serial updates Haavard Skinnemoen
2006-09-28 13:31 ` [PATCH 1/4] atmel_serial: Pass fixed register mappings through platform_data Haavard Skinnemoen
2006-09-28 13:31   ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen
2006-09-28 13:31     ` [PATCH 3/4] AVR32: Allow renumbering of serial devices Haavard Skinnemoen
2006-09-28 13:31       ` [PATCH 4/4] atmel_serial: Fix roundoff error in atmel_console_get_options Haavard Skinnemoen
2006-09-28 14:01     ` [PATCH 2/4] atmel_serial: Support AVR32 Haavard Skinnemoen

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).