Skip to contentSkip to conversation

Support for GRLIB APBUART serial port

PATCH Applied Kristoffer Glembo 2 participants 3 messages Nov 4, 2009 – Nov 5, 2009 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support for GRLIB APBUART serial port

This patch adds support for the APBUART serial port from Aeroflex Gaisler's IP library GRLIB. It is currently used in all LEON3 designs (SPARC V8) but can be used on other platforms as well (which support OF).

---
 drivers/serial/Kconfig      |   13 +
 drivers/serial/Makefile     |    1 +
 drivers/serial/apbuart.c    |  710 +++++++++++++++++++++++++++++++++++++++++++
 drivers/serial/apbuart.h    |   64 ++++
 include/linux/serial_core.h |    3 +
 5 files changed, 791 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/apbuart.c
 create mode 100644 drivers/serial/apbuart.h
drivers/serial/Kconfig +13 -0
index e522572..6c3a94e 100644
@@ -1477,4 +1477,17 @@ config SERIAL_BCM63XX_CONSOLE
 	  If you have enabled the serial port on the bcm63xx CPU
 	  you can make it the console by answering Y to this option.
 
+config SERIAL_GRLIB_GAISLER_APBUART
+	tristate "GRLIB APBUART serial support"
+	depends on OF
+	---help---
+	Add support for the GRLIB APBUART serial port.
+
+config SERIAL_GRLIB_GAISLER_APBUART_CONSOLE
+	bool "Console on GRLIB APBUART serial port"
+	depends on SERIAL_GRLIB_GAISLER_APBUART
+	select SERIAL_CORE_CONSOLE
+	help
+	Support for running a console on the GRLIB APBUART
+
 endmenu
drivers/serial/Makefile +1 -0
index d21d5dd..5548fe7 100644
@@ -81,3 +81,4 @@ obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
 obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
 obj-$(CONFIG_SERIAL_TIMBERDALE)	+= timbuart.o
+obj-$(CONFIG_SERIAL_GRLIB_GAISLER_APBUART) += apbuart.o
drivers/serial/apbuart.c new file +710 -0

710 lines not on this page · raw message

drivers/serial/apbuart.h new file +64 -0

64 lines not on this page · raw message

include/linux/serial_core.h +3 -0
index db532ce..8c3dd36 100644
@@ -179,6 +179,9 @@
 /* BCM63xx family SoCs */
 #define PORT_BCM63XX	89
 
+/* Aeroflex Gaisler GRLIB APBUART */
+#define PORT_APBUART    90
+
 #ifdef __KERNEL__
 
 #include <linux/compiler.h>
Signature · 1 line
1.5.2.2
Applied
#1 lore raw

From: Kristoffer Glembo <[email protected]>
Date: Wed, 4 Nov 2009 17:32:48 +0100

Quoted 6 lines

This patch adds support for the APBUART serial port from Aeroflex Gaisler's IP library GRLIB. It is currently used in all LEON3 designs (SPARC V8) but can be used on other platforms as well (which support OF).

Applied, but I had to make two fixes:

Review

Quoted 6 lines
(quoted diff) +6 -0
+config SERIAL_GRLIB_GAISLER_APBUART_CONSOLE
+	bool "Console on GRLIB APBUART serial port"
+	depends on SERIAL_GRLIB_GAISLER_APBUART
+	select SERIAL_CORE_CONSOLE
+	help
+	Support for running a console on the GRLIB APBUART

You must make this depend on "SERIAL_GRLIB_GAISLER_APBUART=y" not just plain "SERIAL_GRLIB_GAISLER_APBUART".

Because when modular, things like console_initcall() are not available.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	printk(KERN_INFO "grlib-apbuart at 0x%x, irq %d\n",
+	       port->mapbase, port->irq);

This will warn on some platforms, port->mapbase is of type resource_size_t and that can be anything. I fixed it like so:

apbuart: Fix build warning.

drivers/serial/apbuart.c: In function ‘apbuart_probe’:
drivers/serial/apbuart.c:574: warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type ‘resource_size_t’

---
 drivers/serial/apbuart.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/serial/apbuart.c +2 -2
index 8a34304..c7883a3 100644
@@ -570,8 +570,8 @@ static int __devinit apbuart_probe(struct of_device *op,
 
 	apbuart_flush_fifo((struct uart_port *) port);
 
-	printk(KERN_INFO "grlib-apbuart at 0x%x, irq %d\n",
-	       port->mapbase, port->irq);
+	printk(KERN_INFO "grlib-apbuart at 0x%llx, irq %d\n",
+	       (unsigned long long) port->mapbase, port->irq);
 	return 0;
 
 }
Signature · 3 lines
1.6.5.2

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¬¥ªÜ–)îÇø§¶›¡Ü¨}©ž²Æ zÚ&j:+v‰¨þø¯ù®w¥þŠà2ŠÞ™¨è­Ú&¢)ß¡«a¶Úÿÿûàz¿äz¹Þ—ú+ƒùšŽŠÝ¢jÿŠwèþf
#2 lore raw
In reply to Kristoffer Glembo
Quoted 12 lines · David Miller

From: Kristoffer Glembo <[email protected]>
Date: Wed, 4 Nov 2009 17:32:48 +0100

Quoted 6 lines

This patch adds support for the APBUART serial port from Aeroflex Gaisler's IP library GRLIB. It is currently used in all LEON3 designs (SPARC V8) but can be used on other platforms as well (which support OF).

Applied, but I had to make two fixes:

Thanks a lot. I will remember to test drivers as modules and on other architectures in the future!

Best regards,
Kristoffer Glembo