tty: serial: add Freescale lpuart driver support
Subsystems (2)
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Add Freescale lpuart driver support. The lpuart device can be found on Vybrid VF610 and Layerscape LS-1 SoCs.
---
changes in v6:
Enable being built as a module support.
changes in v5:
Coding style fix, remove redundant code.
Checking clk_prepare_enable return value.
Using devm_ioremap_resource instead of devm_request_and_ioremap.
changes in v4:
Change Vybrid VF610 SoC compatible string to "fsl,vf610-lpuart"
changes in v3:
Use general driver name lpuart instead of mvf for further share between SoCs. Add bind doc in Documentation/devicetree/bindings/tty/serial. Remove unused #include header lines and clean up code.
changes in v2:
Remove unused variables and clean up the code.
.../devicetree/bindings/tty/serial/fsl-lpuart.txt | 14 + drivers/tty/serial/Kconfig | 14 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/fsl_lpuart.c | 873 +++++++++++++++++++++ include/uapi/linux/serial_core.h | 3 + 5 files changed, 905 insertions(+) create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-lpuart.txt create mode 100644 drivers/tty/serial/fsl_lpuart.c
Documentation/devicetree/bindings/tty/serial/fsl-lpuart.txt new file +14 -0
@@ -0,0 +1,14 @@ +* Freescale low power universal asynchronous receiver/transmitter (lpuart) + +Required properties: +- compatible : Should be "fsl,<soc>-lpuart" +- reg : Address and length of the register set for the device +- interrupts : Should contain uart interrupt + +Example: + +uart0: serial at 40027000 { + compatible = "fsl,vf610-lpuart"; + reg = <0x40027000 0x1000>; + interrupts = <0 61 0x00>; + };
drivers/tty/serial/Kconfig +14 -0
@@ -1484,6 +1484,20 @@ config SERIAL_RP2_NR_UARTS If multiple cards are present, the default limit of 32 ports may need to be increased. +config SERIAL_FSL_LPUART + tristate "Freescale lpuart serial port support" + select SERIAL_CORE + help + Support for the on-chip lpuart on some Freescale SOCs. + +config SERIAL_FSL_LPUART_CONSOLE + bool "Console on Freescale lpuart serial port" + depends on SERIAL_FSL_LPUART=y + select SERIAL_CORE_CONSOLE + help + If you have enabled the lpuart serial port on the Freescale SoCs, + you can make it the console by answering Y to this option. + endmenu endif # TTY
drivers/tty/serial/Makefile +1 -0
@@ -85,3 +85,4 @@ obj-$(CONFIG_SERIAL_AR933X) += ar933x_uart.o obj-$(CONFIG_SERIAL_EFM32_UART) += efm32-uart.o obj-$(CONFIG_SERIAL_ARC) += arc_uart.o obj-$(CONFIG_SERIAL_RP2) += rp2.o +obj-$(CONFIG_SERIAL_FSL_LPUART) += fsl_lpuart.o
drivers/tty/serial/fsl_lpuart.c new file +873 -0
873 lines not on this page · raw message
include/uapi/linux/serial_core.h +3 -0
@@ -226,4 +226,7 @@/* Rocketport EXPRESS/INFINITY */ #define PORT_RP2 102 +/* Freescale lpuart */ +#define PORT_LPUART 103 +#endif /* _UAPILINUX_SERIAL_CORE_H */
Signature · 1 line
1.8.0
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
drivers/tty/serial/Kconfig config SERIAL_RP2_NR_UARTS · line 1494
Quoted 8 lines · Jingchang Lu
drivers/tty/serial/Kconfig +8
-0+config SERIAL_FSL_LPUART + tristate "Freescale lpuart serial port support" + select SERIAL_CORE + help + Support for the on-chip lpuart on some Freescale SOCs. + +config SERIAL_FSL_LPUART_CONSOLE + bool "Console on Freescale lpuart serial port"
It is better yo use tristate here as well.
I have just sent the same fix for imx serial.
Keeping it bool may lead to build error when SERIAL_FSL_LPUART=m and SERIAL_FSL_LPUART_CONSOLE=y
Regards,
Fabio Estevam
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 24 lines
-----Original Message-----
From: Fabio Estevam [mailto:festevam at gmail.com]
Sent: Tuesday, June 04, 2013 10:55 AM
To: Lu Jingchang-B35083
Cc: linux-serial at vger.kernel.org; gregkh at linuxfoundation.org; s.hauer at pengutronix.de; shawn.guo at linaro.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH v6] tty: serial: add Freescale lpuart driver supportdrivers/tty/serial/Kconfig config SERIAL_RP2_NR_UARTS · line 1494
Quoted 8 lines · Jingchang Lu
drivers/tty/serial/Kconfig +8
-0+config SERIAL_FSL_LPUART + tristate "Freescale lpuart serial port support" + select SERIAL_CORE + help + Support for the on-chip lpuart on some Freescale SOCs. + +config SERIAL_FSL_LPUART_CONSOLE + bool "Console on Freescale lpuart serial port"It is better yo use tristate here as well.
Quoted 4 lines
I have just sent the same fix for imx serial.
Keeping it bool may lead to build error when SERIAL_FSL_LPUART=m and SERIAL_FSL_LPUART_CONSOLE=y
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLE depends on SERIAL_FSL_LPUART=y in the patch as below, when SERIAL_FSL_LPUART is configured as module, it can't be configured as console. Thanks!
+config SERIAL_FSL_LPUART_CONSOLE
+ bool "Console on Freescale lpuart serial port"
+ depends on SERIAL_FSL_LPUART=y
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 2 lines · On Tue, Jun 4, 2013 at 12:02 AM, Lu Jingchang-B35083 <[email protected]>…
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLEdepends on SERIAL_FSL_LPUART=y in the patch as below, whenSERIAL_FSL_LPUARTis configured as module, it can't be configured as console. Thanks!
Why to prevent using the console of the driver is built as module?
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 7 lines · Fabio Estevam
Quoted 2 lines · On Tue, Jun 4, 2013 at 12:02 AM, Lu Jingchang-B35083 <[email protected]>…
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLEdepends on SERIAL_FSL_LPUART=y in the patch as below, whenSERIAL_FSL_LPUARTis configured as module, it can't be configured as console. Thanks!Why to prevent using the console of the driver is built as module?
I meant "if the driver is built as module"
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 15 lines
-----Original Message-----
From: Fabio Estevam [mailto:festevam at gmail.com]
Sent: Tuesday, June 04, 2013 11:09 AM
To: Lu Jingchang-B35083
Cc: linux-serial at vger.kernel.org; gregkh at linuxfoundation.org; s.hauer at pengutronix.de; shawn.guo at linaro.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH v6] tty: serial: add Freescale lpuart driver supportQuoted 3 lines · Fabio Estevam
On Tue, Jun 4, 2013 at 12:02 AM, Lu Jingchang-B35083 <[email protected]> wrote:
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLEdepends on SERIAL_FSL_LPUART=y in the patchas below, when
SERIAL_FSL_LPUARTis configured as module, it can't be configured as console. Thanks!Quoted 2 lines
Why to prevent using the console of the driver is built as module?
I meant "if the driver is built as module"
[Lu Jingchang-B35083]
In serial driver imx.c, when CONFIG_SERIAL_IMX_CONSOLE=m, does the code between #ifdef CONFIG_SERIAL_IMX_CONSOLE ... #else be compiled? Thanks!
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
In reply to Fabio EstevamQuoted 15 lines
-----Original Message-----
From: Fabio Estevam [mailto:festevam at gmail.com]
Sent: Tuesday, June 04, 2013 11:09 AM
To: Lu Jingchang-B35083
Cc: linux-serial at vger.kernel.org; gregkh at linuxfoundation.org; s.hauer at pengutronix.de; shawn.guo at linaro.org; linux-arm- kernel at lists.infradead.org
Subject: Re: [PATCH v6] tty: serial: add Freescale lpuart driver supportQuoted 3 lines · Fabio Estevam
On Tue, Jun 4, 2013 at 12:02 AM, Lu Jingchang-B35083 <[email protected]> wrote:
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLEdepends on SERIAL_FSL_LPUART=y in the patchas below, when
SERIAL_FSL_LPUARTis configured as module, it can't be configured as console. Thanks!Quoted 2 lines
Why to prevent using the console of the driver is built as module?
I meant "if the driver is built as module"
[Lu Jingchang-B35083]
From your patch of " serial: imx: Allow module build", I think the code between #ifdef CONFIG_SERIAL_IMX_CONSOLE ... #else in imx.c won't be built because the configuration is CONFIG_SERIAL_IMX_CONSOLE_MODULE now. So it is the same as if disable CONFIG_SERIAL_IMX_CONSOLE when built the driver as a module, isn't it?
On other hand, if enable CONFIG_SERIAL_X_CONSOLE option when the driver is configured as module, the build will fail with message like ERROR: "uart_console_device" [drivers/tty/serial/**.ko] undefined! Stephen Rothwel gives the solution once at url:
http://www.linuxhorizon.com/9-linux/42b33a65f64d95a2.htm
I have checked drivers/tty/serial/Kconfig to make sure that other serial drivers indeed did this way.
Thanks!
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 4 lines · On Tue, Jun 4, 2013 at 1:55 AM, Lu Jingchang-B35083 <[email protected]>…
From your patch of " serial: imx: Allow module build", I think the code between #ifdef
CONFIG_SERIAL_IMX_CONSOLE... #else inimx.cwon't be built because the configuration isCONFIG_SERIAL_IMX_CONSOLE_MODULEnow. So it is the same as if disableCONFIG_SERIAL_IMX_CONSOLEwhen built the driver as a module, isn't it?
On other hand, if enableCONFIG_SERIAL_X_CONSOLEoption when the driver is configured as module, the build will fail with message like ERROR: "uart_console_device" [drivers/tty/serial/**.ko] undefined! Stephen Rothwel gives the solution once at url:
http://www.linuxhorizon.com/9-linux/42b33a65f64d95a2.htm
I have checkeddrivers/tty/serial/Kconfigto make sure that other serial drivers indeed did this way.
Maybe we need to use "#if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE)"
I will resend the series tomorrow.
Thanks,
Fabio Estevam
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
In reply to Fabio EstevamQuoted 7 lines · On Tuesday 04 June 2013 00:08:27 Fabio Estevam wrote:
Quoted 2 lines · On Tue, Jun 4, 2013 at 12:02 AM, Lu Jingchang-B35083 <[email protected]>…
[Lu Jingchang-B35083]
SERIAL_FSL_LPUART_CONSOLEdepends on SERIAL_FSL_LPUART=y in the patch as below, whenSERIAL_FSL_LPUARTis configured as module, it can't be configured as console. Thanks!Why to prevent using the console of the driver is built as module?
All serial port drivers do this. IIRC the reason is that the console has to be started from console_initcall(), which is not available in modules.
Arnd
Greg KH
maintainerPATCH v6 1/1 tty: serial: add Freescale lpuart driver support
In reply to Jingchang LuQuoted 4 lines · Jingchang Lu
Add Freescale lpuart driver support. The lpuart device can be found on Vybrid VF610 and Layerscape LS-1 SoCs.
Signed-off-by Jingchang Lu <[email protected]>
This breaks the build on x86 systems with:
CC [M] drivers/tty/serial/fsl_lpuart.odrivers/tty/serial/fsl_lpuart.c: In function ?lpuart_probe?:drivers/tty/serial/fsl_lpuart.c:751:2: error: implicit declaration of function ?of_alias_get_id? [-Werror=implicit-function-declaration]
so I can't take this :(
greg k-h
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Hi Jingchang,
Quoted 4 lines · Greg KH
Quoted 3 lines · Jingchang Lu
Add Freescale lpuart driver support. The lpuart device can be found on Vybrid VF610 and Layerscape LS-1 SoCs.
Quoted 8 lines
Quoted 1 line
Signed-off-by Jingchang Lu <[email protected]>This breaks the build on x86 systems with:
CC [M]drivers/tty/serial/fsl_lpuart.odrivers/tty/serial/fsl_lpuart.c: In function ?lpuart_probe?:drivers/tty/serial/fsl_lpuart.c:751:2: error: implicit declaration of function ?of_alias_get_id? [-Werror=implicit-function-declaration]so I can't take this :(
On imx serial driver this build error is avoided by protecting the serial_imx_probe_dt() with "#ifdef CONFIG_OF" and you could so the same on the fsl_lpaurt driver to avoid the build issue that Greg reported.
Regards,
Fabio Estevam
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
Quoted 11 lines
Quoted 7 lines
This breaks the build on x86 systems with:
CC [M]drivers/tty/serial/fsl_lpuart.odrivers/tty/serial/fsl_lpuart.c: In function ?lpuart_probe?:drivers/tty/serial/fsl_lpuart.c:751:2: error: implicit declaration of function ?of_alias_get_id? [-Werror=implicit-function-declaration]so I can't take this :(
On imx serial driver this build error is avoided by protecting the
serial_imx_probe_dt()with "#ifdefCONFIG_OF" and you could so the same on thefsl_lpaurtdriver to avoid the build issue that Greg reported.
[Lu Jingchang-B35083]
imx serial driver supports dt and non-dt uart device, "#ifdef CONFIG_OF" seems
to distinguish these, but fsl_lpuart only support dt device.
of_alias_get_id is defined in <linux/of.h>, it's referenced by <linux/of_device.h>
but with "#ifdef CONFIG_OF_DEVICE" restriction. So indirectly referencing "of.h" by "of_device.h" without CONFIG_OF_DEVICE option will cause build error. Add direct reference to "<linux/of.h>" in driver can resolve this error.
Thanks!
PATCH v6 1/1 tty: serial: add Freescale lpuart driver support
In reply to Greg KHQuoted 6 lines
This breaks the build on x86 systems with:
CC [M]drivers/tty/serial/fsl_lpuart.odrivers/tty/serial/fsl_lpuart.c: In function ?lpuart_probe?:drivers/tty/serial/fsl_lpuart.c:751:2: error: implicit declaration of function ?of_alias_get_id? [-Werror=implicit-function-declaration]
[Lu Jingchang-B35083]
I will send the v7 patch with this error fixed. Thanks!