imx: cpu.c, serial_mxc, dts fixes/improvements
Subsystems (3)
cover imx: cpu.c, serial_mxc, dts fixes/improvements
This series addresses some shortcomings concerning reset cause in SPL, serial in DTE mode and fixes some device-tree address/size-cells warnings.
Marcel Ziswiler (1):
ARM: dts: i.MX6Q, i.MX6QDL: fix address/size-cells warnings
Max Krummenacher (2):
imx: serial_mxc: disable ri and dcd irq in dte mode
imx: cpu.c: give access to reset cause in spl
arch/arm/dts/imx6q.dtsi | 4 ---- arch/arm/dts/imx6qdl.dtsi | 9 --------- arch/arm/mach-imx/cpu.c | 27 +++++++++++++++------------ drivers/serial/serial_mxc.c | 13 +++++++++---- 4 files changed, 24 insertions(+), 29 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/3 ARM: dts: i.MX6Q, i.MX6QDL: fix address/size-cells warnings
From: Marcel Ziswiler <[email protected]>
This fixes the following warnings:
arch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/clocks: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/aips-bus at 02100000/mipi at 021e0000: unnecessary #address-cells/ #size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02400000/port at 2: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02400000/port at 3: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02800000/port at 2: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02800000/port at 3: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
---
arch/arm/dts/imx6q.dtsi | 4 ---- arch/arm/dts/imx6qdl.dtsi | 9 --------- 2 files changed, 13 deletions(-)
arch/arm/dts/imx6q.dtsi +0 -4
@@ -150,8 +150,6 @@ }; ipu2_di0: port at 2 { - #address-cells = <1>; - #size-cells = <0>; reg = <2>; ipu2_di0_disp0: disp0-endpoint {
@@ -175,8 +173,6 @@ }; ipu2_di1: port at 3 { - #address-cells = <1>; - #size-cells = <0>; reg = <3>; ipu2_di1_hdmi: hdmi-endpoint {
arch/arm/dts/imx6qdl.dtsi +0 -9
@@ -49,9 +49,6 @@ }; clocks { - #address-cells = <1>; - #size-cells = <0>; - ckil { compatible = "fsl,imx-ckil", "fixed-clock"; #clock-cells = <0>;
@@ -1125,8 +1122,6 @@ }; mipi_dsi: mipi at 021e0000 { - #address-cells = <1>; - #size-cells = <0>; reg = <0x021e0000 0x4000>; status = "disabled";
@@ -1228,8 +1223,6 @@ }; ipu1_di0: port at 2 { - #address-cells = <1>; - #size-cells = <0>; reg = <2>; ipu1_di0_disp0: disp0-endpoint {
@@ -1253,8 +1246,6 @@ }; ipu1_di1: port at 3 { - #address-cells = <1>; - #size-cells = <0>; reg = <3>; ipu1_di1_disp1: disp1-endpoint {
Signature · 1 line
2.20.1
PATCH 1/3 ARM: dts: i.MX6Q, i.MX6QDL: fix address/size-cells warnings
Quoted 20 lines
From: Marcel Ziswiler <[email protected]>
This fixes the following warnings:arch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/clocks: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/aips-bus at 02100000/mipi at021e0000: unnecessary #address-cells/ #size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02400000/port at 2: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02400000/port at 3: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02800000/port at 2: unnecessary #address-cells/#size-cells without "ranges" or child "reg" propertyarch/arm/dts/imx6-apalis.dtb: Warning (avoid_unnecessary_addr_size):
/soc/ipu at 02800000/port at 3: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
Quoted 1 line
Signed-off-by Marcel Ziswiler <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/3 imx: serial_mxc: disable ri and dcd irq in dte mode
In reply to Marcel ZiswilerFrom: Max Krummenacher <[email protected]>
If the UART is used in DTE mode the RI and DCD bits in UCR3 become irq enable bits. Both are set to enabled after reset and both likely are pending.
Disable the bits to prevent an interrupt storm when Linux enables the UART interrupts.
---
drivers/serial/serial_mxc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/serial/serial_mxc.c +9 -4
@@ -138,13 +138,18 @@ struct mxc_uart {u32 ts; }; -static void _mxc_serial_init (struct mxc_uart *base) +static void _mxc_serial_init (struct mxc_uart *base,int use_dte) {writel (0 , &base->cr1);writel (0 , &base->cr2);while (!(readl (&base->cr2) &UCR2_SRST )); +if (use_dte) +writel (0x404 |UCR3_ADNIMP , &base->cr3); +else +writel (0x704 |UCR3_ADNIMP , &base->cr3); +writel (0x704 |UCR3_ADNIMP , &base->cr3);writel (0x8000 , &base->cr4);writel (0x2b , &base->esc);
@@ -226,7 +231,7 @@ static int mxc_serial_tstc(void)*/ static int mxc_serial_init (void ) { -_mxc_serial_init (mxc_base); +_mxc_serial_init (mxc_base, false);serial_setbrg ();
@@ -271,7 +276,7 @@ static int mxc_serial_probe(struct udevice *dev) {struct mxc_serial_platdata *plat = dev->platdata; -_mxc_serial_init (plat->reg); +_mxc_serial_init (plat->reg, plat->use_dte);return 0 ; }
@@ -367,7 +372,7 @@ static inline void _debug_uart_init(void) {struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE ; -_mxc_serial_init (base); +_mxc_serial_init (base, false);_mxc_serial_setbrg (base,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE , false); }
Signature · 1 line
2.20.1
PATCH 2/3 imx: serial_mxc: disable ri and dcd irq in dte mode
Hi Marcel,
Quoted 6 lines · Marcel Ziswiler
From: Max Krummenacher <[email protected]>
If the UART is used in DTE mode the RI and DCD bits in UCR3 become irq enable bits. Both are set to enabled after reset and both likely are pending.
Quoted 8 lines
Disable the bits to prevent an interrupt storm when Linux enables the UART interrupts.
Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>---
I never seen this issue, but you fix looks plausible - I applied this to my working branch and queued for next PR.
Regards,
Stefano
Quoted 55 lines
drivers/serial/serial_mxc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)drivers/serial/serial_mxc.c +9
-4@@ -138,13 +138,18 @@ struct mxc_uart {u32 ts; }; -static void _mxc_serial_init (struct mxc_uart *base) +static void _mxc_serial_init (struct mxc_uart *base,int use_dte) {writel (0 , &base->cr1);writel (0 , &base->cr2);while (!(readl (&base->cr2) &UCR2_SRST )); +if (use_dte) +writel (0x404 |UCR3_ADNIMP , &base->cr3); +else +writel (0x704 |UCR3_ADNIMP , &base->cr3); +writel (0x704 |UCR3_ADNIMP , &base->cr3);writel (0x8000 , &base->cr4);writel (0x2b , &base->esc);@@ -226,7 +231,7 @@ static int mxc_serial_tstc(void)*/ static int mxc_serial_init (void ) { -_mxc_serial_init (mxc_base); +_mxc_serial_init (mxc_base, false);serial_setbrg ();@@ -271,7 +276,7 @@ static int mxc_serial_probe(struct udevice *dev) {struct mxc_serial_platdata *plat = dev->platdata; -_mxc_serial_init (plat->reg); +_mxc_serial_init (plat->reg, plat->use_dte);return 0 ; }@@ -367,7 +372,7 @@ static inline void _debug_uart_init(void) {struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE ; -_mxc_serial_init (base); +_mxc_serial_init (base, false);_mxc_serial_setbrg (base,CONFIG_DEBUG_UART_CLOCK ,CONFIG_BAUDRATE , false); }
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/3 imx: serial_mxc: disable ri and dcd irq in dte mode
In reply to Marcel ZiswilerQuoted 8 lines
From: Max Krummenacher <[email protected]>
If the UART is used in DTE mode the RI and DCD bits in UCR3 become irq enable bits. Both are set to enabled after reset and both likely are pending.
Disable the bits to prevent an interrupt storm when Linux enables the UART interrupts.Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/3 imx: cpu.c: give access to reset cause in spl
In reply to Marcel ZiswilerFrom: Max Krummenacher <[email protected]>
This makes get_imx_reset_cause() accessible in SPL, but keeps the SRSR register content intact so that U-Boot proper can evaluated the reset_cause again should this be needed.
---
arch/arm/mach-imx/cpu.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
arch/arm/mach-imx/cpu.c +15 -12
@@ -25,19 +25,27 @@#include <fsl_esdhc.h> #endif -#if defined(CONFIG_DISPLAY_CPUINFO ) && !defined(CONFIG_SPL_BUILD )static u32 reset_cause =-1 ; -static char *get_reset_cause (void ) +u32 get_imx_reset_cause (void ) { -u32 cause;struct src *src_regs = (struct src *)SRC_BASE_ADDR ; - cause =readl (&src_regs->srsr); -writel (cause, &src_regs->srsr); - reset_cause = cause; +if (reset_cause ==-1 ) { + reset_cause =readl (&src_regs->srsr); +/* preserve the value for U-Boot proper */ +#if !defined(CONFIG_SPL_BUILD ) +writel (reset_cause, &src_regs->srsr); +#endif + } + +return reset_cause; +} -switch (cause) { +#if defined(CONFIG_DISPLAY_CPUINFO ) && !defined(CONFIG_SPL_BUILD ) +static char *get_reset_cause (void ) +{ +switch (get_imx_reset_cause ()) {case 0x00001 :case 0x00011 :return "POR" ;
@@ -77,11 +85,6 @@ static char *get_reset_cause(void) return "unknown reset"; } } - -u32 get_imx_reset_cause (void ) -{ -return reset_cause; -}#endif #if defined(CONFIG_MX53 ) || defined(CONFIG_MX6 )
Signature · 1 line
2.20.1
PATCH 3/3 imx: cpu.c: give access to reset cause in spl
Quoted 6 lines
From: Max Krummenacher <[email protected]>
This makesget_imx_reset_cause()accessible in SPL, but keeps the SRSR register content intact so that U-Boot proper can evaluated thereset_causeagain should this be needed.Signed-off-by Max Krummenacher <[email protected]>Acked-by Marcel Ziswiler <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================