Blackfin: serial driver for Blackfinarchitecture against Linux kernel 2.6.20
PATCH 2/3 Blackfin: serial driver for Blackfinarchitecture against Linux kernel 2.6.20
Hi folks,
Thanks Russell's review, we update the serial core driver according to Russell's comments. Here is the change log:
a) use "ttyBF" as blackfin serial name and use new serial major/minor number
b) can accept command line serial setting like "console=ttyBF0,115200", delete the baud rate setting macros
c) termios can be changed on the fly
--- drivers/serial/Kconfig | 94 ++++ drivers/serial/Makefile | 1 drivers/serial/bfin_5xx.c | 992 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/serial_core.h | 3 4 files changed, 1090 insertions(+)
drivers/serial/Kconfig +94 -0
@@ -498,6 +498,100 @@ your boot loader (lilo or loadlin) about how to pass options to the kernel at boot time.) +config SERIAL_BFIN + tristate "Blackfin serial port support (EXPERIMENTAL)" + depends on BFIN && EXPERIMENTAL + select SERIAL_CORE + select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) + help + Add support for the built-in UARTs on the Blackfin. + + To compile this driver as a module, choose M here: the + module will be called bfin_5xx. + +config SERIAL_BFIN_CONSOLE + bool "Console on Blackfin serial port" + depends on SERIAL_BFIN + select SERIAL_CORE_CONSOLE + +choice + prompt "Blackfin UART Mode" + depends on SERIAL_BFIN + default SERIAL_BFIN_DMA + help + This driver supports the built-in serial ports of the Blackfin family + of CPUs + +config SERIAL_BFIN_DMA + bool "Blackfin UART DMA mode" + depends on DMA_UNCACHED_1M + help + This driver works under DMA mode. If this option is selected, the + blackfin simple dma driver is also enabled. + +config SERIAL_BFIN_PIO + bool "Blackfin UART PIO mode" + help + This driver works under PIO mode. + +endchoice + +config SERIAL_BFIN_UART0 + bool "Enable UART0" + depends on SERIAL_BFIN + help + Enable UART0 + +config BFIN_UART0_CTSRTS + bool "Enable UART0 hardware flow control" + depends on SERIAL_BFIN_UART0 + help + Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS + signal. + +config UART0_CTS_PIN + int "UART0 CTS pin" + depends on BFIN_UART0_CTSRTS + default 23 + help + The default pin is GPIO_GP7. + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + +config UART0_RTS_PIN + int "UART0 RTS pin" + depends on BFIN_UART0_CTSRTS + default 22 + help + The default pin is GPIO_GP6. + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + +config SERIAL_BFIN_UART1 + bool "Enable UART1" + depends on SERIAL_BFIN && BF537 + help + Enable UART1 + +config BFIN_UART1_CTSRTS + bool "Enable UART1 hardware flow control" + depends on SERIAL_BFIN_UART1 + help + Enable hardware flow control in the driver. Using GPIO emulate the CTS/RTS + signal. + +config UART1_CTS_PIN + int "UART1 CTS pin" + depends on BFIN_UART1_CTSRTS + default -1 + help + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + +config UART1_RTS_PIN + int "UART1 RTS pin" + depends on BFIN_UART1_CTSRTS + default -1 + help + Refer to ./include/asm-blackfin/gpio.h to see the GPIO map. + config SERIAL_IMX bool "IMX serial port support" depends on ARM && ARCH_IMX
drivers/serial/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o obj-$(CONFIG_SERIAL_PXA) += pxa.o obj-$(CONFIG_SERIAL_SA1100) += sa1100.o +obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o obj-$(CONFIG_SERIAL_SUNHV) += sunhv.o
drivers/serial/bfin_5xx.c new file +992 -0
992 lines not on this page · raw message
include/linux/serial_core.h +3 -0
@@ -135,6 +135,9 @@/* Xilinx uartlite */ #define PORT_UARTLITE 74 +/* Blackfin bf5xx */ +#define PORT_BFIN 75 +#ifdef __KERNEL__#include <linux/compiler.h>
---
Thanks a lot
Best Regards,
Bryan Wu <[email protected]>
Quoted 6 lines · Bryan
Thanks Russell's review, we update the serial core driver according to Russell's comments. Here is the change log:
a) use "ttyBF" as blackfin serial name and use new serial major/minor number
b) can accept command line serial setting like "console=ttyBF0,115200", delete the baud rate setting macros
c) termios can be changed on the fly
Since you're not implementing the ability to handle INPCK, BRKINT, PARMRK, IGNPAR and IGNBRK, please arrange for your driver to reflect the real settings in the termios.
In other words:
Quoted 24 lines
drivers/serial/bfin_5xx.c new file +24
-0+static void +bfin_serial_set_termios (struct uart_port *port,struct ktermios *termios, +struct ktermios *old) +{ +struct bfin_serial_port *uart = (struct bfin_serial_port *)port; +unsigned long flags; +unsigned int baud, quot; +unsigned short val, ier, lcr =0 ; + +switch (termios->c_cflag &CSIZE ) { +case CS8 : + lcr =WLS (8 ); +break ; +case CS7 : + lcr =WLS (7 ); +break ; +case CS6 : + lcr =WLS (6 ); +break ; +case CS5 : + lcr =WLS (5 ); +break ; +default : + printk(KERN_ERR "%s: word lengh not supported\n",
drivers/serial/bfin_5xx.c line 608
Quoted 10 lines
drivers/serial/bfin_5xx.c new file +10
-0+ __FUNCTION__); + } + +if (termios->c_cflag &CSTOPB ); + lcr |=STB ; +if (termios->c_cflag &PARENB ) { + lcr |=PEN ; +if (!(termios->c_cflag &PARODD )) + lcr |=EPS ; + }
Insert here:
termios->c_iflag |= INPCK | BRKINT | PARMRK; termios->c_iflag &= ~(IGNPAR | IGNBRK);
This way applications will know that these controls are not implemented for this port.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of:
Quoted 50 lines · Russell King
Quoted 6 lines · Bryan
Thanks Russell's review, we update the serial core driver according to Russell's comments. Here is the change log:
a) use "ttyBF" as blackfin serial name and use new serial major/minor number
b) can accept command line serial setting like "console=ttyBF0,115200", delete the baud rate setting macros
c) termios can be changed on the flySince you're not implementing the ability to handle INPCK, BRKINT, PARMRK, IGNPAR and IGNBRK, please arrange for your driver to reflect the real settings in the termios.
In other words:
Quoted 24 lines
drivers/serial/bfin_5xx.c new file +24
-0+static void +bfin_serial_set_termios (struct uart_port *port,struct ktermios *termios, +struct ktermios *old) +{ +struct bfin_serial_port *uart = (struct bfin_serial_port *)port; +unsigned long flags; +unsigned int baud, quot; +unsigned short val, ier, lcr =0 ; + +switch (termios->c_cflag &CSIZE ) { +case CS8 : + lcr =WLS (8 ); +break ; +case CS7 : + lcr =WLS (7 ); +break ; +case CS6 : + lcr =WLS (6 ); +break ; +case CS5 : + lcr =WLS (5 ); +break ; +default : + printk(KERN_ERR "%s: word lengh not supported\n",drivers/serial/bfin_5xx.c line 608
Quoted 10 lines
drivers/serial/bfin_5xx.c new file +10
-0+ __FUNCTION__); + } + +if (termios->c_cflag &CSTOPB ); + lcr |=STB ; +if (termios->c_cflag &PARENB ) { + lcr |=PEN ; +if (!(termios->c_cflag &PARODD )) + lcr |=EPS ; + }Insert here:
Quoted 5 lines
termios->c_iflag |= INPCK | BRKINT | PARMRK; termios->c_iflag &= ~(IGNPAR | IGNBRK);This way applications will know that these controls are not implemented for this port.
Thanks a lot to point it out. I'll fix this and re-send the patch.
Regards,
-Aubrey
Review
Quoted 2 lines · Bryan
(quoted diff) +2
-0+ if (request_irq + (uart->port.irq+1, bfin_serial_int, SA_INTERRUPT | SA_SHIRQ,
merely a cosmetic thing atm, but down the line we should convert these SA_* flags to the new IRQF_* ones
-mike