All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART
@ 2013-12-13  6:35 Alexey Brodkin
  2013-12-13 13:07 ` Tom Rini
  2014-02-07 13:35 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Brodkin @ 2013-12-13  6:35 UTC (permalink / raw)
  To: u-boot

Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
FPGA Boards such as ARCAngel4/ML50x

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Mischa Jonker <mjonker@synopsys.com>
Cc: Francois Bedard <fbedard@synopsys.com>
Cc: Tom Rini <trini@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
 drivers/serial/Makefile     |   1 +
 drivers/serial/serial.c     |   2 +
 drivers/serial/serial_arc.c | 105 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 drivers/serial/serial_arc.c

diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 6b4cade..5eb4601 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
 obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
 obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
+obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_TTY) += usbtty.o
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index df2b84a..05cb369 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -160,6 +160,7 @@ serial_initfunc(sa1100_serial_initialize);
 serial_initfunc(sh_serial_initialize);
 serial_initfunc(arm_dcc_initialize);
 serial_initfunc(mxs_auart_initialize);
+serial_initfunc(arc_serial_initialize);
 
 /**
  * serial_register() - Register serial driver with serial driver core
@@ -253,6 +254,7 @@ void serial_initialize(void)
 	sh_serial_initialize();
 	arm_dcc_initialize();
 	mxs_auart_initialize();
+	arc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
new file mode 100644
index 0000000..e63d25d
--- /dev/null
+++ b/drivers/serial/serial_arc.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <common.h>
+#include <serial.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct arc_serial_regs {
+	unsigned int id0;
+	unsigned int id1;
+	unsigned int id2;
+	unsigned int id3;
+	unsigned int data;
+	unsigned int status;
+	unsigned int baudl;
+	unsigned int baudh;
+};
+
+/* Bit definitions of STATUS register */
+#define UART_RXEMPTY		(1 << 5)
+#define UART_OVERFLOW_ERR	(1 << 1)
+#define UART_TXEMPTY		(1 << 7)
+
+struct arc_serial_regs *regs;
+
+static void arc_serial_setbrg(void)
+{
+	int arc_console_baud;
+
+	if (!gd->baudrate)
+		gd->baudrate = CONFIG_BAUDRATE;
+
+	arc_console_baud = gd->cpu_clk / (gd->baudrate * 4) - 1;
+	writel(arc_console_baud & 0xff, &regs->baudl);
+	writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+}
+
+static int arc_serial_init(void)
+{
+	regs = (struct arc_serial_regs *)CONFIG_ARC_UART_BASE;
+	serial_setbrg();
+	return 0;
+}
+
+static void arc_serial_putc(const char c)
+{
+	if (c == '\n')
+		arc_serial_putc('\r');
+
+	while (!(readl(&regs->status) & UART_TXEMPTY))
+		;
+
+	writel(c, &regs->data);
+}
+
+static int arc_serial_tstc(void)
+{
+	return !(readl(&regs->status) & UART_RXEMPTY);
+}
+
+static int arc_serial_getc(void)
+{
+	while (!arc_serial_tstc())
+		;
+
+	/* Check for overflow errors */
+	if (readl(&regs->status) & UART_OVERFLOW_ERR)
+		return 0;
+
+	return readl(&regs->data) & 0xFF;
+}
+
+static void arc_serial_puts(const char *s)
+{
+	while (*s)
+		arc_serial_putc(*s++);
+}
+
+static struct serial_device arc_serial_drv = {
+	.name	= "arc_serial",
+	.start	= arc_serial_init,
+	.stop	= NULL,
+	.setbrg	= arc_serial_setbrg,
+	.putc	= arc_serial_putc,
+	.puts	= arc_serial_puts,
+	.getc	= arc_serial_getc,
+	.tstc	= arc_serial_tstc,
+};
+
+void arc_serial_initialize(void)
+{
+	serial_register(&arc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &arc_serial_drv;
+}
-- 
1.8.4.2

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

* [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART
  2013-12-13  6:35 [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART Alexey Brodkin
@ 2013-12-13 13:07 ` Tom Rini
  2013-12-13 13:19   ` Alexey Brodkin
  2014-02-07 13:35 ` [U-Boot] " Tom Rini
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2013-12-13 13:07 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 13, 2013 at 10:35:11AM +0400, Alexey Brodkin wrote:

> Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
> FPGA Boards such as ARCAngel4/ML50x
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Mischa Jonker <mjonker@synopsys.com>
> Cc: Francois Bedard <fbedard@synopsys.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>

Looks fine, please list this as a pre-requisite patch when posting the
rest of the board, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131213/d60a2a94/attachment.pgp>

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

* [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART
  2013-12-13 13:07 ` Tom Rini
@ 2013-12-13 13:19   ` Alexey Brodkin
  2013-12-13 13:36     ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Brodkin @ 2013-12-13 13:19 UTC (permalink / raw)
  To: u-boot

On Fri, 2013-12-13 at 08:07 -0500, Tom Rini wrote:

> Looks fine, please list this as a pre-requisite patch when posting the
> rest of the board, thanks!
> 

Hi Tom,

is my understanding correct that this patch will be accepted as it is
but later when I do submission of corresponding board I just need to
indicate that this driver is a pre-requisite (so commiter makes sure
this patch is already applied)?

-Alexey

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

* [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART
  2013-12-13 13:19   ` Alexey Brodkin
@ 2013-12-13 13:36     ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2013-12-13 13:36 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 13, 2013 at 01:19:12PM +0000, Alexey Brodkin wrote:
> On Fri, 2013-12-13 at 08:07 -0500, Tom Rini wrote:
> 
> > Looks fine, please list this as a pre-requisite patch when posting the
> > rest of the board, thanks!
> > 
> 
> Hi Tom,
> 
> is my understanding correct that this patch will be accepted as it is
> but later when I do submission of corresponding board I just need to
> indicate that this driver is a pre-requisite (so commiter makes sure
> this patch is already applied)?

Yes.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131213/457607d8/attachment.pgp>

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

* [U-Boot] serial/serial_arc - add driver for ARC UART
  2013-12-13  6:35 [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART Alexey Brodkin
  2013-12-13 13:07 ` Tom Rini
@ 2014-02-07 13:35 ` Tom Rini
  2014-02-07 17:35   ` Alexey Brodkin
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2014-02-07 13:35 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 13, 2013 at 10:35:11AM +0400, Alexey Brodkin wrote:

> Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
> FPGA Boards such as ARCAngel4/ML50x
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140207/00c6fc24/attachment.pgp>

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

* [U-Boot] serial/serial_arc - add driver for ARC UART
  2014-02-07 13:35 ` [U-Boot] " Tom Rini
@ 2014-02-07 17:35   ` Alexey Brodkin
  2014-02-07 17:56     ` Tom Rini
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Brodkin @ 2014-02-07 17:35 UTC (permalink / raw)
  To: u-boot

Hello Tom,

On Fri, 2014-02-07 at 08:35 -0500, Tom Rini wrote:
> On Fri, Dec 13, 2013 at 10:35:11AM +0400, Alexey Brodkin wrote:
> 
> > Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
> > FPGA Boards such as ARCAngel4/ML50x
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Applied to u-boot/master, thanks!
> 

Are you sure this patch was applied?
I don't see it in master tree -
http://git.denx.de/?p=u-boot.git;a=tree;f=drivers/serial;h=48a1ed6ee43b81f0392a25b94c54c03fe1e12137;hb=HEAD

And as a result you seeing a build error trying to build "arcangel4"
board.

Could you please double-check?

-Alexey

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

* [U-Boot] serial/serial_arc - add driver for ARC UART
  2014-02-07 17:35   ` Alexey Brodkin
@ 2014-02-07 17:56     ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2014-02-07 17:56 UTC (permalink / raw)
  To: u-boot

On Fri, Feb 07, 2014 at 05:35:21PM +0000, Alexey Brodkin wrote:
> Hello Tom,
> 
> On Fri, 2014-02-07 at 08:35 -0500, Tom Rini wrote:
> > On Fri, Dec 13, 2013 at 10:35:11AM +0400, Alexey Brodkin wrote:
> > 
> > > Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
> > > FPGA Boards such as ARCAngel4/ML50x
> > > 
> > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > 
> > Applied to u-boot/master, thanks!
> > 
> 
> Are you sure this patch was applied?
> I don't see it in master tree -
> http://git.denx.de/?p=u-boot.git;a=tree;f=drivers/serial;h=48a1ed6ee43b81f0392a25b94c54c03fe1e12137;hb=HEAD
> 
> And as a result you seeing a build error trying to build "arcangel4"
> board.
> 
> Could you please double-check?

Whoops, you're right, this got lost in the shuffle by accident, really
applied now.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140207/03944921/attachment.pgp>

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

end of thread, other threads:[~2014-02-07 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13  6:35 [U-Boot] [PATCH] serial/serial_arc - add driver for ARC UART Alexey Brodkin
2013-12-13 13:07 ` Tom Rini
2013-12-13 13:19   ` Alexey Brodkin
2013-12-13 13:36     ` Tom Rini
2014-02-07 13:35 ` [U-Boot] " Tom Rini
2014-02-07 17:35   ` Alexey Brodkin
2014-02-07 17:56     ` Tom Rini

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.