serial: add support for the OMRPv2 simple wishbone UART
PATCH 1/1 serial: add support for the OMRPv2 simple wishbone UART
(please CC me as I am not on the list yet).
--
From: Florian Fainelli <[email protected]>
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
--- drivers/serial/Makefile | 1 + drivers/serial/serial_wbuart.c | 73 +++++++++++++++++++++ include/asm-microblaze/arch-microblaze/wbuart_l.h | 15 ++++ include/asm-microblaze/serial_wbuart.h | 25 +++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 drivers/serial/serial_wbuart.c create mode 100644 include/asm-microblaze/arch-microblaze/wbuart_l.h create mode 100644 include/asm-microblaze/serial_wbuart.h
drivers/serial/Makefile +1 -0
@@ -36,6 +36,7 @@ COBJS-y += serial_pl010.o COBJS-y += serial_pl011.o COBJS-y += serial_xuartlite.o COBJS-y += serial_sh.o +COBJS-y += serial_wbuart.o COBJS-y += usbtty.o COBJS := $(COBJS-y)
drivers/serial/serial_wbuart.c new file +73 -0
73 lines not on this page · raw message
include/asm-microblaze/arch-microblaze/wbuart_l.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Wishbone UART low-level definitions +*/ + +#ifndef WBUART_L_H +#define WUBART_L_H + +#define WUB_UCR_OFFSET 0x0 +#define WUB_RXTX_OFFSET 0x4 + +#define WUB_DR 0x01 +#define WUB_ERR 0x02 +#define WUB_BUSY 0x10 + +#endif /* WBUART_L_H */
include/asm-microblaze/serial_wbuart.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* (C) Copyright 2008 OpenPattern SARL +* +* Florian Fainelli <[email protected]> +* +* 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>
PATCH 1/1 serial: add support for the OMRPv2 simple wishbone UART
Quoted 11 lines · Florian Fainelli
(please CC me as I am not on the list yet).
--
From: Florian Fainelli <[email protected]>
Date: Wed, 24 Sep 2008 10:46:10 +0200
Subject: [PATCH] serial: add support for the OMRPv2 simple wishbone UARTThis patch adds support for the wishbone UART we are using on the OpenPattern Modular Routing Platform v2.
wb_uartHDL files can be found here : https://dev.openpattern.org/browser/trunk/fpga/aemb/rtl/wb_uartSigned-off-by Florian Fainelli <[email protected]>
Quoted 10 lines
--- drivers/serial/Makefile | 1 + drivers/serial/serial_wbuart.c | 73 +++++++++++++++++++++ include/asm-microblaze/arch-microblaze/wbuart_l.h | 15 ++++ include/asm-microblaze/serial_wbuart.h | 25 +++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 drivers/serial/serial_wbuart.c create mode 100644 include/asm-microblaze/arch-microblaze/wbuart_l.h create mode 100644 include/asm-microblaze/serial_wbuart.h
Is it applied?
Best Regards,
J.
PATCH 1/1 serial: add support for the OMRPv2 simple wishbone UART
In reply to Florian FainelliDear Florian Fainelli,
Quoted 9 lines · In message <[email protected]> you wrote:
(please CC me as I am not on the list yet).
--
From: Florian Fainelli <[email protected]>
Date: Wed, 24 Sep 2008 10:46:10 +0200
Subject: [PATCH] serial: add support for the OMRPv2 simple wishbone UARTThis patch adds support for the wishbone UART we are using on the OpenPattern Modular Routing Platform v2.
wb_uartHDL 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?
Quoted 3 lines
drivers/serial/serial_wbuart.c new file +0
-0
...
drivers/serial/serial_wbuart.c line 35
Quoted 5 lines
drivers/serial/serial_wbuart.c new file +5
-0+#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.
drivers/serial/serial_wbuart.c line 46
Quoted 4 lines
drivers/serial/serial_wbuart.c new file +4
-0+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?
drivers/serial/serial_wbuart.c line 51
Quoted 4 lines
drivers/serial/serial_wbuart.c new file +4
-0+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) ;
drivers/serial/serial_wbuart.c line 59
Quoted 5 lines
drivers/serial/serial_wbuart.c new file +5
-0+void serial_puts (const char * s) +{ +while (*s) { +serial_putc (*s++); + }
No curly braces for a single line statement, please.
drivers/serial/serial_wbuart.c line 64
Quoted 1 line
drivers/serial/serial_wbuart.c new file +1
-0+while (!(IO_SERIAL_UCR &WUB_DR ));
See above.
Quoted 18 lines
include/asm-microblaze/serial_wbuart.h new file +15
-0@@ -0,0 +1,25 @@ +/* +* (C) Copyright 2008 OpenPattern SARL +* +* Florian Fainelli <[email protected]> +* +* 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
include/asm-microblaze/serial_wbuart.h line 25
Quoted 10 lines
include/asm-microblaze/serial_wbuart.h new file +10
-0+* 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
Signature · 4 lines
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.
PATCH 1/1 serial: add support for the OMRPv2 simple wishbone UART
Hi Wolfgang,
Le Tuesday 14 October 2008 15:08:14 Wolfgang Denk, vous avez ?crit?:
Quoted 5 lines
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?
Of course. I actually wanted to know about the good programming pratice before submitting it.
Quoted 2 lines
Accesses to device registers through volatile pointers are depre- cated. Please use the respective accessor macros / functions instead.
Ok, I could probably fixup the uartlite driver with another patch to use the proper accessors. I derived this driver from it.
Quoted 2 lines
That's to set the baud rate. This function seems to be missing in your driver?
Baudrate is hardcoded in the IP core because it is very simple and occupyiong only a few LUTs. I do not think I will have to change the baudrate ever.
Quoted 4 lines
Please write like this:
while(IO_SERIAL_UCR & WUB_BUSY) ;
Ok.
Quoted 9 lines
drivers/serial/serial_wbuart.c line 59
Quoted 6 lines
drivers/serial/serial_wbuart.c new file +5
-0+void serial_puts (const char * s) +{ +while (*s) { +serial_putc (*s++); + }No curly braces for a single line statement, please.
Quoted 6 lines
drivers/serial/serial_wbuart.c line 64
Quoted 1 line
drivers/serial/serial_wbuart.c new file +1
-0+while (!(IO_SERIAL_UCR &WUB_DR ));See above.
This makes no sense to me - a header file which contains just a single line include for another header file?
I was following the uartlite/microblaze pratice, but that's right it does not make sense at all.
Thank you very much for your comments, when board support is ready I will resubmit everything in separate patches.
Signature · 14 lines
Cordialement, Florian Fainelli OpenPattern SARL - Lead software architect GSM: +33.632843955 109/111 rue des C?tes 78 600 Maisons-Laffitte ------------------------------ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20081014/233e4aee/attachment.pgp