Add device tree probe support for tty/serial/imx
Subsystems (5)
v3 cover Add device tree probe support for tty/serial/imx
The first patch removes the use of cpu_is_mx1(). The second patch adds device tree probe with a dependency on the following patch.
http://article.gmane.org/gmane.linux.drivers.devicetree/6128
Changes since v2:
* Not use generic naming imx-uart, instead use specific soc name to show uart type compatibility (Sascha's suggestion)
Changes since v1:
* Address review comments given by Grant and Uwe
Shawn Guo (2):
serial/imx: get rid of the uses of cpu_is_mx1() serial/imx: add device tree probe support
.../bindings/tty/serial/fsl-imx-uart.txt | 19 +++ arch/arm/mach-imx/clock-imx1.c | 6 +- arch/arm/mach-imx/clock-imx21.c | 8 +- arch/arm/mach-imx/clock-imx25.c | 11 +- arch/arm/mach-imx/clock-imx27.c | 13 +- arch/arm/mach-imx/clock-imx31.c | 11 +- arch/arm/mach-imx/clock-imx35.c | 7 +- arch/arm/mach-mx5/clock-mx51-mx53.c | 18 ++- arch/arm/plat-mxc/devices/platform-imx-uart.c | 7 +- drivers/tty/serial/imx.c | 149 +++++++++++++++++--- 10 files changed, 190 insertions(+), 59 deletions(-)
PATCH v3 1/2 serial/imx: get rid of the uses of cpu_is_mx1()
The patch removes all the uses of cpu_is_mx1(). Instead, it uses the .id_table of platform_driver to distinguish the uart device type, IMX1_UART and IMX21_UART. The IMX21_UART type runs on all i.mx except i.mx1.
A couple of !cpu_is_mx1() logic gets turned into IS_IMX21_UART, as the codes wrapped there are really IMX21 type uart specific.
It also removes macro MX1_UCR3_REF25 and MX1_UCR3_REF30 which are not used anywhere.
--- arch/arm/mach-imx/clock-imx1.c | 6 +- arch/arm/mach-imx/clock-imx21.c | 8 ++-- arch/arm/mach-imx/clock-imx25.c | 11 ++-- arch/arm/mach-imx/clock-imx27.c | 13 +++-- arch/arm/mach-imx/clock-imx31.c | 11 ++-- arch/arm/mach-imx/clock-imx35.c | 7 ++- arch/arm/mach-mx5/clock-mx51-mx53.c | 18 ++++--- arch/arm/plat-mxc/devices/platform-imx-uart.c | 7 ++- drivers/tty/serial/imx.c | 66 ++++++++++++++++++++----- 9 files changed, 97 insertions(+), 50 deletions(-)
arch/arm/mach-imx/clock-imx1.c +3 -3
@@ -587,9 +587,9 @@ static struct clk_lookup lookups[] __initdata = { _REGISTER_CLOCK(NULL, "mma", mma_clk) _REGISTER_CLOCK("imx_udc.0", NULL, usbd_clk) _REGISTER_CLOCK(NULL, "gpt", gpt_clk) - _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk) + _REGISTER_CLOCK("imx1-uart.0", NULL, uart_clk) + _REGISTER_CLOCK("imx1-uart.1", NULL, uart_clk) + _REGISTER_CLOCK("imx1-uart.2", NULL, uart_clk) _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) _REGISTER_CLOCK("imx1-cspi.0", NULL, spi_clk)_REGISTER_CLOCK ("imx1-cspi.1" ,NULL , spi_clk)
arch/arm/mach-imx/clock-imx21.c +4 -4
@@ -1162,10 +1162,10 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK(NULL, "perclk3", per_clk[2]) _REGISTER_CLOCK(NULL, "perclk4", per_clk[3]) _REGISTER_CLOCK(NULL, "clko", clko_clk) - _REGISTER_CLOCK("imx-uart.0", NULL, uart_clk[0]) - _REGISTER_CLOCK("imx-uart.1", NULL, uart_clk[1]) - _REGISTER_CLOCK("imx-uart.2", NULL, uart_clk[2]) - _REGISTER_CLOCK("imx-uart.3", NULL, uart_clk[3]) + _REGISTER_CLOCK("imx21-uart.0", NULL, uart_clk[0]) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart_clk[1]) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart_clk[2]) + _REGISTER_CLOCK("imx21-uart.3", NULL, uart_clk[3]) _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[0]) _REGISTER_CLOCK(NULL, "gpt1", gpt_clk[1])_REGISTER_CLOCK (NULL ,"gpt1" , gpt_clk[2 ])
arch/arm/mach-imx/clock-imx25.c +6 -5
@@ -272,11 +272,12 @@ DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL); },static struct clk_lookup lookups[] = { - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) +/* i.mx25 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)_REGISTER_CLOCK ("mxc-ehci.2" ,"usb" , usbotg_clk)
arch/arm/mach-imx/clock-imx27.c +7 -6
@@ -624,12 +624,13 @@ DEFINE_CLOCK1(csi_clk, 0, NULL, 0, parent, &csi_clk1, &per4_clk); },static struct clk_lookup lookups[] = { - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) - _REGISTER_CLOCK("imx-uart.5", NULL, uart6_clk) +/* i.mx27 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) + _REGISTER_CLOCK("imx21-uart.5", NULL, uart6_clk) _REGISTER_CLOCK(NULL, "gpt1", gpt1_clk) _REGISTER_CLOCK(NULL, "gpt2", gpt2_clk)_REGISTER_CLOCK (NULL ,"gpt3" , gpt3_clk)
arch/arm/mach-imx/clock-imx31.c +6 -5
@@ -547,11 +547,12 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk1) _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk2)_REGISTER_CLOCK ("mx3-camera.0" ,NULL , csi_clk) - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) + /* i.mx31 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)_REGISTER_CLOCK ("imx-i2c.2" ,NULL , i2c3_clk)
arch/arm/mach-imx/clock-imx35.c +4 -3
@@ -486,9 +486,10 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK(NULL, "spdif", spdif_clk) _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)_REGISTER_CLOCK ("imx-ssi.1" ,NULL , ssi2_clk) - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) + /* i.mx35 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) _REGISTER_CLOCK("mxc-ehci.0", "usb", usbotg_clk) _REGISTER_CLOCK("mxc-ehci.1", "usb", usbotg_clk)_REGISTER_CLOCK ("mxc-ehci.2" ,"usb" , usbotg_clk)
arch/arm/mach-mx5/clock-mx51-mx53.c +10 -8
@@ -1422,9 +1422,10 @@ DEFINE_CLOCK(ipu_di1_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG6_OFFSET, },static struct clk_lookup mx51_lookups[] = { - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) +/* i.mx51 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) _REGISTER_CLOCK(NULL, "gpt", gpt_clk) _REGISTER_CLOCK("fec.0", NULL, fec_clk)_REGISTER_CLOCK ("mxc_pwm.0" ,"pwm" , pwm1_clk)
@@ -1469,11 +1470,12 @@ static struct clk_lookup mx51_lookups[] = { };static struct clk_lookup mx53_lookups[] = { - _REGISTER_CLOCK("imx-uart.0", NULL, uart1_clk) - _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk) - _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) - _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk) - _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk) +/* i.mx53 has the i.mx21 type uart */ + _REGISTER_CLOCK("imx21-uart.0", NULL, uart1_clk) + _REGISTER_CLOCK("imx21-uart.1", NULL, uart2_clk) + _REGISTER_CLOCK("imx21-uart.2", NULL, uart3_clk) + _REGISTER_CLOCK("imx21-uart.3", NULL, uart4_clk) + _REGISTER_CLOCK("imx21-uart.4", NULL, uart5_clk) _REGISTER_CLOCK(NULL, "gpt", gpt_clk) _REGISTER_CLOCK("fec.0", NULL, fec_clk)_REGISTER_CLOCK (NULL ,"iim_clk" , iim_clk)
arch/arm/plat-mxc/devices/platform-imx-uart.c +4 -3
@@ -152,7 +152,7 @@ struct platform_device *__init imx_add_imx_uart_3irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res, +return imx_add_platform_device ("imx1-uart" , data->id, res,ARRAY_SIZE (res), pdata,sizeof (*pdata)); }
@@ -172,6 +172,7 @@ struct platform_device *__init imx_add_imx_uart_1irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res,ARRAY_SIZE (res), - pdata,sizeof (*pdata)); +/* i.mx21 type uart runs on all i.mx expcept i.mx1 */ +return imx_add_platform_device ("imx21-uart" , data->id, + res,ARRAY_SIZE (res), pdata,sizeof (*pdata)); }
drivers/tty/serial/imx.c +53 -13
140 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Sascha Hauer
maintainerPATCH v3 1/2 serial/imx: get rid of the uses of cpu_is_mx1()
Quoted 10 lines · Shawn Guo
The patch removes all the uses of
cpu_is_mx1(). Instead, it uses the .id_table ofplatform_driverto distinguish the uart device type,IMX1_UARTandIMX21_UART. TheIMX21_UARTtype runs on all i.mx except i.mx1.A couple of !cpu_is_mx1() logic gets turned into
IS_IMX21_UART, as the codes wrapped there are really IMX21 type uart specific.It also removes macro
MX1_UCR3_REF25andMX1_UCR3_REF30which are not used anywhere.
Two typos and one minor nitpick, otherwise I'm fine with it. Should go via the i.MX tree rather than the serial tree. Alan?
Quoted 38 lines
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>Acked-by Grant Likely <[email protected]>--- arch/arm/mach-imx/clock-imx1.c | 6 +- arch/arm/mach-imx/clock-imx21.c | 8 ++-- arch/arm/mach-imx/clock-imx25.c | 11 ++-- arch/arm/mach-imx/clock-imx27.c | 13 +++-- arch/arm/mach-imx/clock-imx31.c | 11 ++-- arch/arm/mach-imx/clock-imx35.c | 7 ++- arch/arm/mach-mx5/clock-mx51-mx53.c | 18 ++++--- arch/arm/plat-mxc/devices/platform-imx-uart.c | 7 ++- drivers/tty/serial/imx.c | 66 ++++++++++++++++++++----- 9 files changed, 97 insertions(+), 50 deletions(-)arch/arm/mach-imx/clock-imx25.c +0
-0@@ -272,11 +272,12 @@ DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL); },arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-1@@ -152,7 +152,7 @@ struct platform_device *__init imx_add_imx_uart_3irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res, +return imx_add_platform_device ("imx1-uart" , data->id, res,ARRAY_SIZE (res), pdata,sizeof (*pdata)); }
arch/arm/plat-mxc/devices/platform-imx-uart.c struct platform_device *__init imx_add_imx_uart_1irq( · line 175
Quoted 6 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-2@@ -172,6 +172,7 @@ struct platform_device *__init imx_add_imx_uart_1irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res,ARRAY_SIZE (res), - pdata,sizeof (*pdata)); +/* i.mx21 type uart runs on all i.mx expcept i.mx1 */
s/expcept/except/
Quoted 10 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-3#define UCR3_AIRINTEN (1<<5)/* Async IR wake interrupt enable */ #define UCR3_AWAKEN (1<<4)/* Async wake interrupt enable */ -#define MX1_UCR3_REF25 (1<<3)/* Ref freq 25 MHz, only on mx1 */ -#define MX1_UCR3_REF30 (1<<2)/* Ref Freq 30 MHz, only on mx1 */ -#define MX2_UCR3_RXDMUXSEL (1<<2)/* RXD Muxed Input Select, on mx2/mx3 */ +#define IMX21_UCR3_RXDMUXSEL (1<<2)/* RXD Muxed Input Select */ #define UCR3_INVT (1<<1)/* Inverted Infrared transmission */ #define UCR3_BPEN (1<<0)/* Preset registers enable */ #define UCR4_CTSTL_SHF 10/* CTS trigger level shift */
arch/arm/plat-mxc/devices/platform-imx-uart.c line 182
Quoted 4 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-0@@ -181,6 +179,18 @@#define UART_NR 8 +/* i.mx21 type uart runs on all i.mx expcept i.mx1 */
ditto
arch/arm/plat-mxc/devices/platform-imx-uart.c line 185
Quoted 4 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +3
-0+#define UTS (sport->devdata->uts_reg) +#define IS_IMX1_UART () (sport->devdata->devtype == IMX1_UART) +#define IS_IMX21_UART () (sport->devdata->devtype == IMX21_UART)
Can we make this a static inline function?
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v3 1/2 serial/imx: get rid of the uses of cpu_is_mx1()
Quoted 80 lines · Sascha Hauer
Quoted 10 lines · Shawn Guo
The patch removes all the uses of
cpu_is_mx1(). Instead, it uses the .id_table ofplatform_driverto distinguish the uart device type,IMX1_UARTandIMX21_UART. TheIMX21_UARTtype runs on all i.mx except i.mx1.A couple of !cpu_is_mx1() logic gets turned into
IS_IMX21_UART, as the codes wrapped there are really IMX21 type uart specific.It also removes macro
MX1_UCR3_REF25andMX1_UCR3_REF30which are not used anywhere.Two typos and one minor nitpick, otherwise I'm fine with it. Should go via the i.MX tree rather than the serial tree. Alan?
Quoted 38 lines
Signed-off-by Shawn Guo <[email protected]>Cc Sascha Hauer <[email protected]>Cc Alan Cox <[email protected]>Acked-by Grant Likely <[email protected]>--- arch/arm/mach-imx/clock-imx1.c | 6 +- arch/arm/mach-imx/clock-imx21.c | 8 ++-- arch/arm/mach-imx/clock-imx25.c | 11 ++-- arch/arm/mach-imx/clock-imx27.c | 13 +++-- arch/arm/mach-imx/clock-imx31.c | 11 ++-- arch/arm/mach-imx/clock-imx35.c | 7 ++- arch/arm/mach-mx5/clock-mx51-mx53.c | 18 ++++--- arch/arm/plat-mxc/devices/platform-imx-uart.c | 7 ++- drivers/tty/serial/imx.c | 66 ++++++++++++++++++++----- 9 files changed, 97 insertions(+), 50 deletions(-)arch/arm/mach-imx/clock-imx25.c +0
-0@@ -272,11 +272,12 @@ DEFINE_CLOCK(can2_clk, 1, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL); },arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-1@@ -152,7 +152,7 @@ struct platform_device *__init imx_add_imx_uart_3irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res, +return imx_add_platform_device ("imx1-uart" , data->id, res,ARRAY_SIZE (res), pdata,sizeof (*pdata)); }arch/arm/plat-mxc/devices/platform-imx-uart.c struct platform_device *__init imx_add_imx_uart_1irq( · line 175
Quoted 6 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-2@@ -172,6 +172,7 @@ struct platform_device *__init imx_add_imx_uart_1irq( }, }; -return imx_add_platform_device ("imx-uart" , data->id, res,ARRAY_SIZE (res), - pdata,sizeof (*pdata)); +/* i.mx21 type uart runs on all i.mx expcept i.mx1 */ s/expcept/except/
Quoted 10 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-3#define UCR3_AIRINTEN (1<<5)/* Async IR wake interrupt enable */ #define UCR3_AWAKEN (1<<4)/* Async wake interrupt enable */ -#define MX1_UCR3_REF25 (1<<3)/* Ref freq 25 MHz, only on mx1 */ -#define MX1_UCR3_REF30 (1<<2)/* Ref Freq 30 MHz, only on mx1 */ -#define MX2_UCR3_RXDMUXSEL (1<<2)/* RXD Muxed Input Select, on mx2/mx3 */ +#define IMX21_UCR3_RXDMUXSEL (1<<2)/* RXD Muxed Input Select */ #define UCR3_INVT (1<<1)/* Inverted Infrared transmission */ #define UCR3_BPEN (1<<0)/* Preset registers enable */ #define UCR4_CTSTL_SHF 10/* CTS trigger level shift */ arch/arm/plat-mxc/devices/platform-imx-uart.c line 182
Quoted 4 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +1
-0@@ -181,6 +179,18 @@#define UART_NR 8 +/* i.mx21 type uart runs on all i.mx expcept i.mx1 */ ditto
Quoted 1 line
Quoted 6 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c
Quoted 3 lines
arch/arm/plat-mxc/devices/platform-imx-uart.c +3
-0+#define UTS (sport->devdata->uts_reg) +#define IS_IMX1_UART () (sport->devdata->devtype == IMX1_UART) +#define IS_IMX21_UART () (sport->devdata->devtype == IMX21_UART)Can we make this a static inline function?
Ok, will resend it right now to get these fixed.
Signature · 2 lines
Regards, Shawn
PATCH v3 2/2 serial/imx: add device tree probe support
In reply to Shawn GuoIt adds device tree probe support for imx tty/serial driver.
--- .../bindings/tty/serial/fsl-imx-uart.txt | 19 +++++ drivers/tty/serial/imx.c | 85 +++++++++++++++++--- 2 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt
Documentation/devicetree/bindings/tty/serial/fsl-imx-uart.txt new file +19 -0
@@ -0,0 +1,19 @@ +* Freescale i.MX Universal Asynchronous Receiver/Transmitter (UART) + +Required properties: +- compatible : Should be "fsl,<soc>-uart" +- reg : Address and length of the register set for the device +- interrupts : Should contain uart interrupt + +Optional properties: +- fsl,uart-has-rtscts : Indicate the uart has rts and cts +- fsl,irda-mode : Indicate the uart supports irda mode + +Example: + +uart@73fbc000 { + compatible = "fsl,imx51-uart", "fsl,imx21-uart"; + reg = <0x73fbc000 0x4000>; + interrupts = <31>; + fsl,uart-has-rtscts; +};
drivers/tty/serial/imx.c +75 -10
129 lines not on this page · raw message
Signature · 1 line
1.7.4.1