mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
@ 2015-02-12 19:07 Andrey Panov
  2015-02-12 19:34 ` Uwe Kleine-König
  2015-02-13  6:22 ` Sascha Hauer
  0 siblings, 2 replies; 9+ messages in thread
From: Andrey Panov @ 2015-02-12 19:07 UTC (permalink / raw)
  To: barebox

Signed-off-by: Andrey Panov <rockford@yandex.ru>
---
 arch/arm/Kconfig                               |  1 +
 arch/arm/mach-rockchip/include/mach/debug_ll.h | 60 ++++++++++++++++++++++++++
 common/Kconfig                                 | 15 +++++++
 3 files changed, 76 insertions(+)
 create mode 100644 arch/arm/mach-rockchip/include/mach/debug_ll.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f682803..22fd4d8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -159,6 +159,7 @@ config ARCH_ROCKCHIP
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
 	select HAVE_PBL_MULTI_IMAGES
+	select HAS_DEBUG_LL
 
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA cyclone5"
diff --git a/arch/arm/mach-rockchip/include/mach/debug_ll.h b/arch/arm/mach-rockchip/include/mach/debug_ll.h
new file mode 100644
index 0000000..c666b99
--- /dev/null
+++ b/arch/arm/mach-rockchip/include/mach/debug_ll.h
@@ -0,0 +1,60 @@
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+
+#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 0
+#define UART_BASE	0x10124000
+#endif
+#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 1
+#define UART_BASE	0x10126000
+#endif
+#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 2
+#define UART_BASE	0x20064000
+#endif
+#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 3
+#define UART_BASE	0x20068000
+#endif
+
+#define LSR_THRE	0x20	/* Xmit holding register empty */
+#define LSR		(5 << 2)
+#define THR		(0 << 2)
+
+#define LCR_BKSE	0x80	/* Bank select enable */
+#define LSR		(5 << 2)
+#define THR		(0 << 2)
+#define DLL		(0 << 2)
+#define IER		(1 << 2)
+#define DLM		(1 << 2)
+#define FCR		(2 << 2)
+#define LCR		(3 << 2)
+#define MCR		(4 << 2)
+#define MDR		(8 << 2)
+
+static inline void INIT_LL(void)
+{
+	unsigned int clk = 100000000;
+	unsigned int divisor = clk / 16 / 115200;
+
+	writeb(0x00, UART_BASE + LCR);
+	writeb(0x00, UART_BASE + IER);
+	writeb(0x07, UART_BASE + MDR);
+	writeb(LCR_BKSE, UART_BASE + LCR);
+	writeb(divisor & 0xff, UART_BASE + DLL);
+	writeb(divisor >> 8, UART_BASE + DLM);
+	writeb(0x03, UART_BASE + LCR);
+	writeb(0x03, UART_BASE + MCR);
+	writeb(0x07, UART_BASE + FCR);
+	writeb(0x00, UART_BASE + MDR);
+}
+
+static inline void PUTC_LL(char c)
+{
+	/* Wait until there is space in the FIFO */
+	while ((readb(UART_BASE + LSR) & LSR_THRE) == 0);
+	/* Send the character */
+	writeb(c, UART_BASE + THR);
+	/* Wait to make sure it hits the line, in case we die too soon. */
+	while ((readb(UART_BASE + LSR) & LSR_THRE) == 0);
+}
+#endif
diff --git a/common/Kconfig b/common/Kconfig
index d437343..62d82c6 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -846,6 +846,13 @@ config DEBUG_AM33XX_UART
 	  Say Y here if you want kernel low-level debugging support
 	  on AM33XX.
 
+config DEBUG_ROCKCHIP_UART
+	bool "RK31xx Debug UART"
+	depends on ARCH_ROCKCHIP
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on RK31XX.
+
 endchoice
 
 config DEBUG_IMX_UART_PORT
@@ -878,6 +885,14 @@ config DEBUG_OMAP_UART_PORT
 	  OMAP4: 1 - 3
 	  AM33XX: 0 - 2
 
+config DEBUG_ROCKCHIP_UART_PORT
+	int "RK31xx UART debug port" if DEBUG_ROCKCHIP_UART
+	default 2
+	depends on ARCH_ROCKCHIP
+	help
+	  Choose UART port on which kernel low-level debug messages
+	  should be output.
+
 config DEBUG_INITCALLS
 	bool "Trace initcalls"
 	help
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:07 [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga Andrey Panov
@ 2015-02-12 19:34 ` Uwe Kleine-König
  2015-02-12 19:45   ` Панов Андрей
  2015-02-13  6:22 ` Sascha Hauer
  1 sibling, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2015-02-12 19:34 UTC (permalink / raw)
  To: Andrey Panov; +Cc: barebox

Hello,

On Thu, Feb 12, 2015 at 10:07:11PM +0300, Andrey Panov wrote:
> --- /dev/null
> +++ b/arch/arm/mach-rockchip/include/mach/debug_ll.h
> @@ -0,0 +1,60 @@
> +#ifndef __MACH_DEBUG_LL_H__
> +#define __MACH_DEBUG_LL_H__
> +
> +#include <io.h>
> +
> +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 0
> +#define UART_BASE	0x10124000
> +#endif
> +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 1
> +#define UART_BASE	0x10126000
> +#endif
> +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 2
> +#define UART_BASE	0x20064000
> +#endif
> +#if CONFIG_DEBUG_ROCKCHIP_UART_PORT == 3
> +#define UART_BASE	0x20068000
> +#endif
Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
DEBUG_RK32_UART2. Doesn't one of those fit your needs?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:34 ` Uwe Kleine-König
@ 2015-02-12 19:45   ` Панов Андрей
  2015-02-12 19:51     ` Uwe Kleine-König
  0 siblings, 1 reply; 9+ messages in thread
From: Панов Андрей @ 2015-02-12 19:45 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox



12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> Hello,
>
>
> Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
> And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
> DEBUG_RK32_UART2. Doesn't one of those fit your needs?
>

Which branch contains it? I've checked master and next and there is no such a definitions.

--
 Андрей

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:45   ` Панов Андрей
@ 2015-02-12 19:51     ` Uwe Kleine-König
  2015-02-12 19:55       ` Панов Андрей
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2015-02-12 19:51 UTC (permalink / raw)
  To: Панов
	Андрей
  Cc: barebox

Hello,

On Thu, Feb 12, 2015 at 10:45:19PM +0300, Панов Андрей wrote:
> 12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> > Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
> > And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
> > DEBUG_RK32_UART2. Doesn't one of those fit your needs?
> >
> 
> Which branch contains it? I've checked master and next and there is no such a definitions.
Then you didn't check correctly. It's available since at least
v3.12-rc1:

 $ git show v3.12-rc1:arch/arm/Kconfig.debug | grep DEBUG_RK29_UART1 | wc -l
 3

The same happens when using 3.19 instead of 3.12-rc1.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:51     ` Uwe Kleine-König
@ 2015-02-12 19:55       ` Панов Андрей
  2015-02-12 19:57       ` Uwe Kleine-König
  2015-02-12 19:59       ` Lucas Stach
  2 siblings, 0 replies; 9+ messages in thread
From: Панов Андрей @ 2015-02-12 19:55 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox



12.02.2015, 22:51, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> Hello,
>
> On Thu, Feb 12, 2015 at 10:45:19PM +0300, Панов Андрей wrote:
>>  12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
>>>  Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
>>>  And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
>>>  DEBUG_RK32_UART2. Doesn't one of those fit your needs?
>>  Which branch contains it? I've checked master and next and there is no such a definitions.
>
> Then you didn't check correctly. It's available since at least
> v3.12-rc1:
>
>  $ git show v3.12-rc1:arch/arm/Kconfig.debug | grep DEBUG_RK29_UART1 | wc -l
>  3
>
> The same happens when using 3.19 instead of 3.12-rc1.
>

In Linux yes, but in barebox no. This is patch for barebox. :-)


--
 Андрей

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:51     ` Uwe Kleine-König
  2015-02-12 19:55       ` Панов Андрей
@ 2015-02-12 19:57       ` Uwe Kleine-König
  2015-02-12 20:00         ` Панов Андрей
  2015-02-12 19:59       ` Lucas Stach
  2 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2015-02-12 19:57 UTC (permalink / raw)
  To: Панов
	Андрей
  Cc: barebox

Hello,

On Thu, Feb 12, 2015 at 08:51:44PM +0100, Uwe Kleine-König wrote:
> On Thu, Feb 12, 2015 at 10:45:19PM +0300, Панов Андрей wrote:
> > 12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> > > Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
> > > And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
> > > DEBUG_RK32_UART2. Doesn't one of those fit your needs?
> > >
> > 
> > Which branch contains it? I've checked master and next and there is no such a definitions.
> Then you didn't check correctly. It's available since at least
> v3.12-rc1:
> 
>  $ git show v3.12-rc1:arch/arm/Kconfig.debug | grep DEBUG_RK29_UART1 | wc -l
>  3
> 
> The same happens when using 3.19 instead of 3.12-rc1.
hups, this is the wrong list. I thought we're talking about the kernel.

*blush*

Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:51     ` Uwe Kleine-König
  2015-02-12 19:55       ` Панов Андрей
  2015-02-12 19:57       ` Uwe Kleine-König
@ 2015-02-12 19:59       ` Lucas Stach
  2 siblings, 0 replies; 9+ messages in thread
From: Lucas Stach @ 2015-02-12 19:59 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

Am Donnerstag, den 12.02.2015, 20:51 +0100 schrieb Uwe Kleine-König:
> Hello,
> 
> On Thu, Feb 12, 2015 at 10:45:19PM +0300, Панов Андрей wrote:
> > 12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> > > Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
> > > And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
> > > DEBUG_RK32_UART2. Doesn't one of those fit your needs?
> > >
> > 
> > Which branch contains it? I've checked master and next and there is no such a definitions.
> Then you didn't check correctly. It's available since at least
> v3.12-rc1:
> 
>  $ git show v3.12-rc1:arch/arm/Kconfig.debug | grep DEBUG_RK29_UART1 | wc -l
>  3
> 
> The same happens when using 3.19 instead of 3.12-rc1.
> 
But this is the barebox ML, so your Linux git tree may take you  a bit
into the wrong direction. ;)

Regards,
Lucas


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:57       ` Uwe Kleine-König
@ 2015-02-12 20:00         ` Панов Андрей
  0 siblings, 0 replies; 9+ messages in thread
From: Панов Андрей @ 2015-02-12 20:00 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox



12.02.2015, 22:57, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
> Hello,
>
> On Thu, Feb 12, 2015 at 08:51:44PM +0100, Uwe Kleine-König wrote:
>>  On Thu, Feb 12, 2015 at 10:45:19PM +0300, Панов Андрей wrote:
>>>  12.02.2015, 22:34, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>:
>>>>  Better make use of DEBUG_UART_PHYS and DEBUG_UART_BASE.
>>>>  And there is already DEBUG_RK29_UART[123] and DEBUG_RK3X_UART[0123] and
>>>>  DEBUG_RK32_UART2. Doesn't one of those fit your needs?
>>>  Which branch contains it? I've checked master and next and there is no such a definitions.
>>  Then you didn't check correctly. It's available since at least
>>  v3.12-rc1:
>>
>>   $ git show v3.12-rc1:arch/arm/Kconfig.debug | grep DEBUG_RK29_UART1 | wc -l
>>   3
>>
>>  The same happens when using 3.19 instead of 3.12-rc1.
>
> hups, this is the wrong list. I thought we're talking about the kernel.
>
> *blush*

But I should rename defines to match the same in kernel. Just in case.

--
 Андрей

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
  2015-02-12 19:07 [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga Andrey Panov
  2015-02-12 19:34 ` Uwe Kleine-König
@ 2015-02-13  6:22 ` Sascha Hauer
  1 sibling, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2015-02-13  6:22 UTC (permalink / raw)
  To: Andrey Panov; +Cc: barebox

On Thu, Feb 12, 2015 at 10:07:11PM +0300, Andrey Panov wrote:
> Signed-off-by: Andrey Panov <rockford@yandex.ru>
> ---
>  arch/arm/Kconfig                               |  1 +
>  arch/arm/mach-rockchip/include/mach/debug_ll.h | 60 ++++++++++++++++++++++++++
>  common/Kconfig                                 | 15 +++++++
>  3 files changed, 76 insertions(+)
>  create mode 100644 arch/arm/mach-rockchip/include/mach/debug_ll.h

Applied... to barebox ;)

Thanks
 Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-02-13  6:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-12 19:07 [PATCH] ARM: Rockchip: Add DEBUG_LL based on mach-socfpga Andrey Panov
2015-02-12 19:34 ` Uwe Kleine-König
2015-02-12 19:45   ` Панов Андрей
2015-02-12 19:51     ` Uwe Kleine-König
2015-02-12 19:55       ` Панов Андрей
2015-02-12 19:57       ` Uwe Kleine-König
2015-02-12 20:00         ` Панов Андрей
2015-02-12 19:59       ` Lucas Stach
2015-02-13  6:22 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox