[U-Boot] [PATCH] serial: add support for the OMRPv2 simple wishbone UART

Wolfgang Denk wd at denx.de
Tue Oct 14 15:08:14 CEST 2008


Dear Florian Fainelli,

In message <200809241230.21624.florian.fainelli at openpattern.org> you wrote:
> (please CC me as I am not on the list yet).
> --
> From: Florian Fainelli <florian.fainelli at openpattern.org>
> Date: Wed, 24 Sep 2008 10:46:10 +0200
> Subject: [PATCH] serial: add support for the OMRPv2 simple wishbone UART
> 
> This patch adds support for the wishbone UART we are using on the
> OpenPattern Modular Routing Platform v2. wb_uart HDL files can be found
> here : https://dev.openpattern.org/browser/trunk/fpga/aemb/rtl/wb_uart

It seems ther eis no board in the mainline U-Boot code which uses this
driver.

Do you plan to submit any board support that will actually use this
driver?

> diff --git a/drivers/serial/serial_wbuart.c b/drivers/serial/serial_wbuart.c
> new file mode 100644
> index 0000000..a13ef2a
...
> +#define IO_WORD(offset)		(*(volatile unsigned long *)(offset))
> +#define IO_SERIAL(offset)	IO_WORD(CONFIG_SERIAL_BASE + (offset))
> +
> +#define IO_SERIAL_RXTX		IO_SERIAL(WUB_RXTX_OFFSET)
> +#define IO_SERIAL_UCR		IO_SERIAL(WUB_UCR_OFFSET)

Accesses to device registers through  volatile  pointers  are  depre-
cated. Please use the respective accessor macros / functions instead.

> +void serial_setbrg(void)
> +{
> +	/* FIXME: what's this for? */
> +}

That's to set the baud rate. This function seems to be missing in your
driver?

> +void serial_putc(const char c)
> +{
> +	if (c == '\n') serial_putc('\r');
> +	while(IO_SERIAL_UCR & WUB_BUSY);

Please write like this:

	while(IO_SERIAL_UCR & WUB_BUSY)
		;

> +void serial_puts(const char * s)
> +{
> +	while (*s) {
> +		serial_putc(*s++);
> +	}

No curly braces for a single line statement, please.

> +	while(!(IO_SERIAL_UCR & WUB_DR));

See above.

> --- /dev/null
> +++ b/include/asm-microblaze/serial_wbuart.h
> @@ -0,0 +1,25 @@
> +/*
> + * (C) Copyright 2008 OpenPattern SARL
> + *
> + * Florian Fainelli <florian.fainelli at openpattern.org>
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +
> +#include <asm/arch/wbuart_l.h>

This makes no sense to me - a  header  file  which  contains  just  a
single line include for another header file? 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Do not underestimate the value of print statements for debugging.


More information about the U-Boot mailing list