U6715 platform serial driver It's a generic driver for all U6XXX platform
Subsystems (2)
PATCH 1/1 U6715 platform serial driver It's a generic driver for all U6XXX platform
Clock specificity:
It's parent clock depend on baud rate.
The UART port can be used before u6xxx clock framework initialization
--- arch/arm/plat-u6xxx/Makefile | 2 +- arch/arm/plat-u6xxx/include/mach/serial.h | 23 +++ arch/arm/plat-u6xxx/serial.c | 270 +++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+), 1 deletions(-) create mode 100644 arch/arm/plat-u6xxx/include/mach/serial.h create mode 100644 arch/arm/plat-u6xxx/serial.c
arch/arm/plat-u6xxx/Makefile +1 -1
@@ -3,6 +3,6 @@ # # Common support -obj-y := io.o irq.o clock.o gpio.o +obj-y := io.o irq.o clock.o gpio.o serial.o obj-$(CONFIG_U6_MTU_TIMER) += timer.o
arch/arm/plat-u6xxx/include/mach/serial.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* linux/arch/arm/plat-u6xxx/include/mach/serial.h +* +* Copyright (C) ST-Ericsson SA 2010 +* Author: Ludovic Barre <[email protected]> for ST-Ericsson. +* License terms: GNU General Public License (GPL), version 2 +*/ + + +#ifndef __SERIAL_H +#define __SERIAL_H + +#include <linux/clk.h> + +struct u6_uart { +struct clk *uartClk; +char uart_name[7 ]; +}; + +extern unsigned int u6_serial8250_enable_clock (struct uart_port *port); +extern unsigned int u6_serial8250_disable_clock (struct uart_port *port); + +#endif /* __SERIAL_H */
arch/arm/plat-u6xxx/serial.c new file +270 -0
270 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 1/1 U6715 platform serial driver It's a generic driver for all U6XXX platform
Quoted 5 lines · Philippe Langlais
arch/arm/plat-u6xxx/serial.c new file +5
-0+unsigned int u6_serial8250_enable_clock (struct uart_port *port) +{ +struct u6_uart *uart_u6 = port->private_data; + +if (!uart_u6)
arch/arm/plat-u6xxx/serial.c line 92
Quoted 10 lines
arch/arm/plat-u6xxx/serial.c new file +10
-0+return uart_enable_clock (port); + +if (IS_ERR (uart_u6->uartClk)) { +pr_warning ("%s - uart clock failed error:%ld\n" , + __func__,PTR_ERR (uart_u6->uartClk)); +return PTR_ERR (uart_u6->uartClk); + } + +if (clk_get_usecount (uart_u6->uartClk) ==0 ) +clk_enable (uart_u6->uartClk);
This breaks the atomic update nature of the use count of clocks, and breaks the model that the driver should only ever enable the clock if it needs it. I think instead you need to track whether the driver enabled or disabled its own clock.
PATCH 1/1 U6715 platform serial driver It's a generic driver for all U6XXX platform
Quoted 14 lines · Russell King - ARM Linux
Quoted 12 lines · Philippe Langlais
arch/arm/plat-u6xxx/serial.c new file +12
-0+unsigned int u6_serial8250_enable_clock (struct uart_port *port) +{ +struct u6_uart *uart_u6 = port->private_data; + +if (!uart_u6) +return uart_enable_clock (port); + +if (IS_ERR (uart_u6->uartClk)) { +pr_warning ("%s - uart clock failed error:%ld\n" , + __func__,PTR_ERR (uart_u6->uartClk)); +return PTR_ERR (uart_u6->uartClk); + }
Quoted 9 lines
arch/arm/plat-u6xxx/serial.c line 92
Quoted 4 lines
arch/arm/plat-u6xxx/serial.c new file +3
-0+ +if (clk_get_usecount (uart_u6->uartClk) ==0 ) +clk_enable (uart_u6->uartClk);This breaks the atomic update nature of the use count of clocks, and breaks the model that the driver should only ever enable the clock if it needs it. I think instead you need to track whether the driver enabled or disabled its own clock.
Hi,
You are right.
I forgot to withdraw these tests needed for our specific power managment. The new patch will follow.
If you have no more remark, I'm ready to send all U6715 patches in your patch system.
Thanks
Philippe