All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] warp7: add UART6 support
@ 2018-01-19  9:53 Ryan Harkin
  2018-01-19  9:53 ` [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode Ryan Harkin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ryan Harkin @ 2018-01-19  9:53 UTC (permalink / raw)
  To: u-boot

This small series adds support for using the console on UART6 on
the WaRP7 board.

The board retains current functionality: UART6 is not used by
default and needs it needs to be enabled in defconfig.

[PATCH 1/2] serial: mxc: support DTE mode
[PATCH 2/2] warp7: add support for console on UART6 and mikroBus

 board/warp7/Kconfig         |  9 +++++++++
 board/warp7/warp7.c         |  6 ++++++
 drivers/serial/Kconfig      |  7 +++++++
 drivers/serial/serial_mxc.c | 10 ++++++++--
 include/configs/warp7.h     |  8 +++++++-
 5 files changed, 37 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode
  2018-01-19  9:53 [U-Boot] [PATCH 0/2] warp7: add UART6 support Ryan Harkin
@ 2018-01-19  9:53 ` Ryan Harkin
  2018-01-19 12:23   ` Stefan Agner
  2018-01-19  9:53 ` [U-Boot] [PATCH 2/2] warp7: add support for console on UART6 and mikroBus Ryan Harkin
  2018-01-19 11:18 ` [U-Boot] [PATCH 0/2] warp7: add UART6 support Bryan O'Donoghue
  2 siblings, 1 reply; 8+ messages in thread
From: Ryan Harkin @ 2018-01-19  9:53 UTC (permalink / raw)
  To: u-boot

Add DTE mode support via Kconfig on the MXC uart.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/serial/Kconfig      |  7 +++++++
 drivers/serial/serial_mxc.c | 10 ++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 122b8e7..0df57c0 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -597,4 +597,11 @@ config SYS_SDMR
 	depends on MPC8XX_CONS
 	default 0
 
+config SERIAL_MXC_DTE_MODE
+	bool "Use DTE mode for the MXC UART"
+	default n
+	help
+	  This is used to set DTE mode on the serial console controlled by
+	  serial_mxc.c.
+
 endmenu
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index cce80a8..e7ea30c 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -111,6 +111,12 @@
 #define TXTL		2  /* reset default */
 #define RXTL		1  /* reset default */
 
+#ifdef CONFIG_SERIAL_MXC_DTE_MODE
+#define MXC_DTE_MODE	true
+#else
+#define MXC_DTE_MODE	false
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 struct mxc_uart {
@@ -189,7 +195,7 @@ static void mxc_serial_setbrg(void)
 	if (!gd->baudrate)
 		gd->baudrate = CONFIG_BAUDRATE;
 
-	_mxc_serial_setbrg(mxc_base, clk, gd->baudrate, false);
+	_mxc_serial_setbrg(mxc_base, clk, gd->baudrate, MXC_DTE_MODE);
 }
 
 static int mxc_serial_getc(void)
@@ -367,7 +373,7 @@ static inline void _debug_uart_init(void)
 
 	_mxc_serial_init(base);
 	_mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
-			   CONFIG_BAUDRATE, false);
+			   CONFIG_BAUDRATE, MXC_DTE_MODE);
 }
 
 static inline void _debug_uart_putc(int ch)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 2/2] warp7: add support for console on UART6 and mikroBus
  2018-01-19  9:53 [U-Boot] [PATCH 0/2] warp7: add UART6 support Ryan Harkin
  2018-01-19  9:53 ` [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode Ryan Harkin
@ 2018-01-19  9:53 ` Ryan Harkin
  2018-01-19 11:18 ` [U-Boot] [PATCH 0/2] warp7: add UART6 support Bryan O'Donoghue
  2 siblings, 0 replies; 8+ messages in thread
From: Ryan Harkin @ 2018-01-19  9:53 UTC (permalink / raw)
  To: u-boot

Add support to route the serial console on the NXP WaRP7 board
to UART6 and the mikroBus.

To use UART6 on the WaRP7 board, I add the following lines to
configs/warp7_defconfig:

+CONFIG_MXC_CONSOLE_NUM=6
+CONFIG_SERIAL_MXC_DTE_MODE=y

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 board/warp7/Kconfig     | 9 +++++++++
 board/warp7/warp7.c     | 6 ++++++
 include/configs/warp7.h | 8 +++++++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/board/warp7/Kconfig b/board/warp7/Kconfig
index 61c33fb..5fb4824 100644
--- a/board/warp7/Kconfig
+++ b/board/warp7/Kconfig
@@ -6,4 +6,13 @@ config SYS_BOARD
 config SYS_CONFIG_NAME
 	default "warp7"
 
+config MXC_CONSOLE_NUM
+	int "UART used for the console"
+	default 1
+	help
+	  The UART used for the console, expressed as a 1-based integer.
+	  This is also used to set the console variable passed to the kernel.
+	  Currently, only UART1 and UART6 are supported. Specifying a value
+	  other than 6 will result in using UART1.
+
 endif
diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index d422d63..d345b0e 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -67,6 +67,11 @@ static iomux_v3_cfg_t const uart1_pads[] = {
 	MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const uart6_pads[] = {
+	MX7D_PAD_ECSPI1_MOSI__UART6_DTE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+	MX7D_PAD_ECSPI1_SCLK__UART6_DTE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
 static iomux_v3_cfg_t const usdhc3_pads[] = {
 	MX7D_PAD_SD3_CLK__SD3_CLK     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
 	MX7D_PAD_SD3_CMD__SD3_CMD     | MUX_PAD_CTRL(USDHC_PAD_CTRL),
@@ -84,6 +89,7 @@ static iomux_v3_cfg_t const usdhc3_pads[] = {
 static void setup_iomux_uart(void)
 {
 	imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
+	imx_iomux_v3_setup_multiple_pads(uart6_pads, ARRAY_SIZE(uart6_pads));
 };
 
 static struct fsl_esdhc_cfg usdhc_cfg[1] = {
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 11f1bc3..271667d 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -13,7 +13,13 @@
 
 #define PHYS_SDRAM_SIZE			SZ_512M
 
+#if (CONFIG_MXC_CONSOLE_NUM == 6)
+#define CONFIG_MXC_UART_BASE		UART6_IPS_BASE_ADDR
+#define CONSOLE				"ttymxc5"
+#else
 #define CONFIG_MXC_UART_BASE		UART1_IPS_BASE_ADDR
+#define CONSOLE				"ttymxc0"
+#endif
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(35 * SZ_1M)
@@ -31,7 +37,7 @@
 	CONFIG_DFU_ENV_SETTINGS \
 	"script=boot.scr\0" \
 	"image=zImage\0" \
-	"console=ttymxc0\0" \
+	"console=" CONSOLE "\0" \
 	"ethact=usb_ether\0" \
 	"fdt_high=0xffffffff\0" \
 	"initrd_high=0xffffffff\0" \
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 0/2] warp7: add UART6 support
  2018-01-19  9:53 [U-Boot] [PATCH 0/2] warp7: add UART6 support Ryan Harkin
  2018-01-19  9:53 ` [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode Ryan Harkin
  2018-01-19  9:53 ` [U-Boot] [PATCH 2/2] warp7: add support for console on UART6 and mikroBus Ryan Harkin
@ 2018-01-19 11:18 ` Bryan O'Donoghue
  2 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2018-01-19 11:18 UTC (permalink / raw)
  To: u-boot



On 19/01/18 09:53, Ryan Harkin wrote:
> This small series adds support for using the console on UART6 on
> the WaRP7 board.
> 
> The board retains current functionality: UART6 is not used by
> default and needs it needs to be enabled in defconfig.
> 
> [PATCH 1/2] serial: mxc: support DTE mode
> [PATCH 2/2] warp7: add support for console on UART6 and mikroBus
> 
>   board/warp7/Kconfig         |  9 +++++++++
>   board/warp7/warp7.c         |  6 ++++++
>   drivers/serial/Kconfig      |  7 +++++++
>   drivers/serial/serial_mxc.c | 10 ++++++++--
>   include/configs/warp7.h     |  8 +++++++-
>   5 files changed, 37 insertions(+), 3 deletions(-)
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
> 

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode
  2018-01-19  9:53 ` [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode Ryan Harkin
@ 2018-01-19 12:23   ` Stefan Agner
  2018-01-19 13:21     ` Ryan Harkin
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Agner @ 2018-01-19 12:23 UTC (permalink / raw)
  To: u-boot

Hi Ryan,


On 19.01.2018 10:53, Ryan Harkin wrote:
> Add DTE mode support via Kconfig on the MXC uart.

Make use of the driver model, there DTE is supported already today:
https://lists.denx.de/pipermail/u-boot/2016-July/259573.html

--
Stefan

>
> Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/serial/Kconfig      |  7 +++++++
>  drivers/serial/serial_mxc.c | 10 ++++++++--
>  2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 122b8e7..0df57c0 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -597,4 +597,11 @@ config SYS_SDMR
>  	depends on MPC8XX_CONS
>  	default 0
>  
> +config SERIAL_MXC_DTE_MODE
> +	bool "Use DTE mode for the MXC UART"
> +	default n
> +	help
> +	  This is used to set DTE mode on the serial console controlled by
> +	  serial_mxc.c.
> +
>  endmenu
> diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
> index cce80a8..e7ea30c 100644
> --- a/drivers/serial/serial_mxc.c
> +++ b/drivers/serial/serial_mxc.c
> @@ -111,6 +111,12 @@
>  #define TXTL		2  /* reset default */
>  #define RXTL		1  /* reset default */
>  
> +#ifdef CONFIG_SERIAL_MXC_DTE_MODE
> +#define MXC_DTE_MODE	true
> +#else
> +#define MXC_DTE_MODE	false
> +#endif
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  struct mxc_uart {
> @@ -189,7 +195,7 @@ static void mxc_serial_setbrg(void)
>  	if (!gd->baudrate)
>  		gd->baudrate = CONFIG_BAUDRATE;
>  
> -	_mxc_serial_setbrg(mxc_base, clk, gd->baudrate, false);
> +	_mxc_serial_setbrg(mxc_base, clk, gd->baudrate, MXC_DTE_MODE);
>  }
>  
>  static int mxc_serial_getc(void)
> @@ -367,7 +373,7 @@ static inline void _debug_uart_init(void)
>  
>  	_mxc_serial_init(base);
>  	_mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
> -			   CONFIG_BAUDRATE, false);
> +			   CONFIG_BAUDRATE, MXC_DTE_MODE);
>  }
>  
>  static inline void _debug_uart_putc(int ch)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode
  2018-01-19 12:23   ` Stefan Agner
@ 2018-01-19 13:21     ` Ryan Harkin
  2018-01-22  0:29       ` Simon Glass
  0 siblings, 1 reply; 8+ messages in thread
From: Ryan Harkin @ 2018-01-19 13:21 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

Thanks for looking so quickly.

On 19 January 2018 at 12:23, Stefan Agner <stefan.agner@toradex.com> wrote:

> Hi Ryan,
>
>
> On 19.01.2018 10:53, Ryan Harkin wrote:
> > Add DTE mode support via Kconfig on the MXC uart.
>
> Make use of the driver model, there DTE is supported already today:
> https://lists.denx.de/pipermail/u-boot/2016-July/259573.html


My change would be useful for other non-DM users of serial_mxc.c, of
course. Not just WaRP7.

I don't have any objection to WaRP7 moving to DM, although that isn't my
call, but moving using the driver model is not a straight-forward change,
is it? WaRP7 today doesn't use it.

Do you have an example of a board using this driver that switched using the
driver model? I'd like to see the scale of the changes needed.

Regards,
Ryan.



>
> --
> Stefan
>
> >
> > Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> > Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > ---
> >  drivers/serial/Kconfig      |  7 +++++++
> >  drivers/serial/serial_mxc.c | 10 ++++++++--
> >  2 files changed, 15 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > index 122b8e7..0df57c0 100644
> > --- a/drivers/serial/Kconfig
> > +++ b/drivers/serial/Kconfig
> > @@ -597,4 +597,11 @@ config SYS_SDMR
> >       depends on MPC8XX_CONS
> >       default 0
> >
> > +config SERIAL_MXC_DTE_MODE
> > +     bool "Use DTE mode for the MXC UART"
> > +     default n
> > +     help
> > +       This is used to set DTE mode on the serial console controlled by
> > +       serial_mxc.c.
> > +
> >  endmenu
> > diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
> > index cce80a8..e7ea30c 100644
> > --- a/drivers/serial/serial_mxc.c
> > +++ b/drivers/serial/serial_mxc.c
> > @@ -111,6 +111,12 @@
> >  #define TXTL         2  /* reset default */
> >  #define RXTL         1  /* reset default */
> >
> > +#ifdef CONFIG_SERIAL_MXC_DTE_MODE
> > +#define MXC_DTE_MODE true
> > +#else
> > +#define MXC_DTE_MODE false
> > +#endif
> > +
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> >  struct mxc_uart {
> > @@ -189,7 +195,7 @@ static void mxc_serial_setbrg(void)
> >       if (!gd->baudrate)
> >               gd->baudrate = CONFIG_BAUDRATE;
> >
> > -     _mxc_serial_setbrg(mxc_base, clk, gd->baudrate, false);
> > +     _mxc_serial_setbrg(mxc_base, clk, gd->baudrate, MXC_DTE_MODE);
> >  }
> >
> >  static int mxc_serial_getc(void)
> > @@ -367,7 +373,7 @@ static inline void _debug_uart_init(void)
> >
> >       _mxc_serial_init(base);
> >       _mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
> > -                        CONFIG_BAUDRATE, false);
> > +                        CONFIG_BAUDRATE, MXC_DTE_MODE);
> >  }
> >
> >  static inline void _debug_uart_putc(int ch)
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode
  2018-01-19 13:21     ` Ryan Harkin
@ 2018-01-22  0:29       ` Simon Glass
  2018-01-22  9:12         ` Ryan Harkin
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2018-01-22  0:29 UTC (permalink / raw)
  To: u-boot

Hi Ryan,

On 19 January 2018 at 06:21, Ryan Harkin <ryan.harkin@linaro.org> wrote:
> Hi Stefan,
>
> Thanks for looking so quickly.
>
> On 19 January 2018 at 12:23, Stefan Agner <stefan.agner@toradex.com> wrote:
>>
>> Hi Ryan,
>>
>>
>> On 19.01.2018 10:53, Ryan Harkin wrote:
>> > Add DTE mode support via Kconfig on the MXC uart.
>>
>> Make use of the driver model, there DTE is supported already today:
>> https://lists.denx.de/pipermail/u-boot/2016-July/259573.html
>
>
> My change would be useful for other non-DM users of serial_mxc.c, of course.
> Not just WaRP7.
>
> I don't have any objection to WaRP7 moving to DM, although that isn't my
> call, but moving using the driver model is not a straight-forward change, is
> it? WaRP7 today doesn't use it.

We are planning to require that board use CONFIG_BLK fairly soon, and
that likely means conversion to device tree I don't think it makes
sense to accept patches like this. If the board can be converted, then
let's do it!

>
> Do you have an example of a board using this driver that switched using the
> driver model? I'd like to see the scale of the changes needed.

It probably requires:

- Adding a DT (with u-boot,dm-pre-reloc as needed)
- Checking that stdio-path is correct

Regards,
Simon

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode
  2018-01-22  0:29       ` Simon Glass
@ 2018-01-22  9:12         ` Ryan Harkin
  0 siblings, 0 replies; 8+ messages in thread
From: Ryan Harkin @ 2018-01-22  9:12 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On 22 January 2018 at 00:29, Simon Glass <sjg@chromium.org> wrote:

> Hi Ryan,
>
> On 19 January 2018 at 06:21, Ryan Harkin <ryan.harkin@linaro.org> wrote:
> > Hi Stefan,
> >
> > Thanks for looking so quickly.
> >
> > On 19 January 2018 at 12:23, Stefan Agner <stefan.agner@toradex.com>
> wrote:
> >>
> >> Hi Ryan,
> >>
> >>
> >> On 19.01.2018 10:53, Ryan Harkin wrote:
> >> > Add DTE mode support via Kconfig on the MXC uart.
> >>
> >> Make use of the driver model, there DTE is supported already today:
> >> https://lists.denx.de/pipermail/u-boot/2016-July/259573.html
> >
> >
> > My change would be useful for other non-DM users of serial_mxc.c, of
> course.
> > Not just WaRP7.
> >
> > I don't have any objection to WaRP7 moving to DM, although that isn't my
> > call, but moving using the driver model is not a straight-forward
> change, is
> > it? WaRP7 today doesn't use it.
>
> We are planning to require that board use CONFIG_BLK fairly soon, and
> that likely means conversion to device tree I don't think it makes
> sense to accept patches like this. If the board can be converted, then
> let's do it!
>

I'm not the maintainer of this board. I'm only making this patch so I can
put it into our test farm. But I'm interested in giving it a go. In fact, I
started already after Stefan's email. And bricked my board :-)


> >
> > Do you have an example of a board using this driver that switched using
> the
> > driver model? I'd like to see the scale of the changes needed.
>
> It probably requires:
>
> - Adding a DT (with u-boot,dm-pre-reloc as needed)
>

I take it we add the DT from the upstream linux kernel? The upstream DT
doesn't define UART6, the one I want to use. I have a patch for the kernel
that I have not attempted to send upstream yet.

What approach should I take?
- upstream my patch to the kernel first
- use the DT from upstream kernel as-is and add a separate patch in the
u-boot tree
- use the DT from upstream kernel as-is and squash in my patch

Or something else?

Updating the DT from upstream will possibly mean updating the DTs for all
other iMX7 boards [1], because the include/dt-bindings stuff has changed
slightly, as well as the imx7s.dtsi file. I have no way of testing the
other boards, but I guess their maintainers can help there.


- Checking that stdio-path is correct
>

That's probably what bricked my board...

Cheers,
Ryan.

[1] There only appear to be two iMX7 board in u-boot already:
arch/arm/dts/imx7d.dtsi:44:#include "imx7s.dtsi"
arch/arm/dts/imx7-colibri.dts:9:#include "imx7d.dtsi"
arch/arm/dts/imx7d-sdb.dts:9:#include "imx7d.dtsi"



> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-22  9:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19  9:53 [U-Boot] [PATCH 0/2] warp7: add UART6 support Ryan Harkin
2018-01-19  9:53 ` [U-Boot] [PATCH 1/2] serial: mxc: support DTE mode Ryan Harkin
2018-01-19 12:23   ` Stefan Agner
2018-01-19 13:21     ` Ryan Harkin
2018-01-22  0:29       ` Simon Glass
2018-01-22  9:12         ` Ryan Harkin
2018-01-19  9:53 ` [U-Boot] [PATCH 2/2] warp7: add support for console on UART6 and mikroBus Ryan Harkin
2018-01-19 11:18 ` [U-Boot] [PATCH 0/2] warp7: add UART6 support Bryan O'Donoghue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.