Microblaze: Uartlite cleaning
Hi Wolfgang and others,
these two patches clean uartlite driver and remove useless headers from microblaze port.
These two patches should go to next merge windows
and will be available at microblaze branch.
WD: I'll send you pull request when merge window
is open.
Thanks,
Michal
PATCH 1/2 microblaze: Clean uartlite driver
From: Michal Simek <[email protected]>
Redesign uartlite driver to in_be32 and out_be32 macros Fix missing header in io.h
--- drivers/serial/serial_xuartlite.c | 37 +++++++++++++++++++++---------------- include/asm-microblaze/io.h | 2 ++ 2 files changed, 23 insertions(+), 16 deletions(-)
drivers/serial/serial_xuartlite.c +21 -16
@@ -1,6 +1,8 @@/* -* (C) Copyright 2004 Atmark Techno, Inc. +* (C) Copyright 2008 Michal Simek <[email protected]> +* Clean driver and add xilinx constant from header file * +* (C) Copyright 2004 Atmark Techno, Inc. * Yasushi SHOJI <[email protected]> * * See file CREDITS for list of people who contributed to this
@@ -13,7 +15,7 @@* * 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 +* 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
@@ -23,19 +25,21 @@*/ #include <config.h> +#include <asm/io.h> #ifdef CONFIG_XILINX_UARTLITE -#include <asm/serial_xuartlite.h> +#define RX_FIFO_OFFSET 0/* receive FIFO, read only */ +#define TX_FIFO_OFFSET 4/* transmit FIFO, write only */ +#define STATUS_REG_OFFSET 8/* status register, read only */ -/* FIXME: we should convert these to in32 and out32 */ -#define IO_WORD (offset) (*(volatile unsigned long *)(offset)) -#define IO_SERIAL (offset) IO_WORD(CONFIG_SERIAL_BASE + (offset)) +#define SR_TX_FIFO_FULL 0x08/* transmit FIFO full */ +#define SR_RX_FIFO_VALID_DATA 0x01/* data in receive FIFO */ +#define SR_RX_FIFO_FULL 0x02/* receive FIFO full */ -#define IO_SERIAL_RX_FIFO IO_SERIAL(XUL_RX_FIFO_OFFSET) -#define IO_SERIAL_TX_FIFO IO_SERIAL(XUL_TX_FIFO_OFFSET) -#define IO_SERIAL_STATUS IO_SERIAL(XUL_STATUS_REG_OFFSET) -#define IO_SERIAL_CONTROL IO_SERIAL(XUL_CONTROL_REG_OFFSET) +#define UARTLITE_STATUS (CONFIG_SERIAL_BASE + STATUS_REG_OFFSET) +#define UARTLITE_TX_FIFO (CONFIG_SERIAL_BASE + TX_FIFO_OFFSET) +#define UARTLITE_RX_FIFO (CONFIG_SERIAL_BASE + RX_FIFO_OFFSET)int serial_init (void ) {
@@ -50,9 +54,10 @@ void serial_setbrg(void)void serial_putc (const char c) { -if (c =='\n' )serial_putc ('\r' ); -while (IO_SERIAL_STATUS &XUL_SR_TX_FIFO_FULL ); -IO_SERIAL_TX_FIFO = (unsigned char ) (c &0xff ); +if (c =='\n' ) +serial_putc ('\r' ); +while (in_be32 (UARTLITE_STATUS ) &SR_TX_FIFO_FULL ); +out_be32 (UARTLITE_TX_FIFO , (unsigned char ) (c &0xff )); }void serial_puts (const char * s)
@@ -64,13 +69,13 @@ void serial_puts(const char * s)int serial_getc (void ) { -while (!(IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA )); -return IO_SERIAL_RX_FIFO &0xff ; +while (!(in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA )); +return in_be32 (UARTLITE_RX_FIFO ) &0xff ; }int serial_tstc (void ) { -return (IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA ); +return (in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA ); }#endif /* CONFIG_MICROBLZE */
include/asm-microblaze/io.h +2 -0
@@ -16,6 +16,8 @@#ifndef __MICROBLAZE_IO_H__#define __MICROBLAZE_IO_H__ +#include <asm/types.h> +#define IO_SPACE_LIMIT 0xFFFFFFFF#define readb (addr) \
Signature · 1 line
1.5.4.GIT
PATCH 2/2 microblaze: Remove useless ancient headers
From: Michal Simek <[email protected]>
--- .../asm-microblaze/arch-microblaze/xbasic_types.h | 301 -------------------- include/asm-microblaze/arch-microblaze/xio.h | 63 ---- .../asm-microblaze/arch-microblaze/xuartlite_l.h | 256 ----------------- include/asm-microblaze/serial_xuartlite.h | 25 -- 4 files changed, 0 insertions(+), 645 deletions(-) delete mode 100644 include/asm-microblaze/arch-microblaze/xbasic_types.h delete mode 100644 include/asm-microblaze/arch-microblaze/xio.h delete mode 100644 include/asm-microblaze/arch-microblaze/xuartlite_l.h delete mode 100644 include/asm-microblaze/serial_xuartlite.h
include/asm-microblaze/arch-microblaze/xbasic_types.h deleted +0 -301
@@ -1,301 +0,0 @@ -/****************************************************************************** -* -* Author: Xilinx, Inc. -* -* -* 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. -* -* -* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A -* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS -* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, -* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE -* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. -* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO -* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM -* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE. -* -* -* Xilinx hardware products are not intended for use in life support -* appliances, devices, or systems. Use in such applications is -* expressly prohibited. -* -* -* (c) Copyright 2002-2003 Xilinx Inc. -* All rights reserved. -* -* -* 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., -* 675 Mass Ave, Cambridge, MA 02139, USA. -* -******************************************************************************/ -/*****************************************************************************/ -/** -* -* @file xbasic_types.h -* -* This file contains basic types for Xilinx software IP. These types do not -* follow the standard naming convention with respect to using the component -* name in front of each name because they are considered to be primitives. -* -* @note -* -* This file contains items which are architecture dependent. -* -* <pre> -* MODIFICATION HISTORY: -* -* Ver Who Date Changes -* ----- ---- -------- ----------------------------------------------- -* 1.00a rmm 12/14/01 First release -* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab -* compiler warnings -* </pre> -* -******************************************************************************/ - -#ifndef XBASIC_TYPES_H /* prevent circular inclusions */ -#define XBASIC_TYPES_H /* by using protection macros */ - -/***************************** Include Files *********************************/ - -/************************** Constant Definitions *****************************/ - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL 0 -#endif -/** Null */ - -#define XCOMPONENT_IS_READY 0x11111111/* component has been initialized */ -#define XCOMPONENT_IS_STARTED 0x22222222/* component has been started */ - -/* the following constants and declarations are for unit test purposes and are -* designed to be used in test applications. -*/ -#define XTEST_PASSED 0 -#define XTEST_FAILED 1 - -#define XASSERT_NONE 0 -#define XASSERT_OCCURRED 1 - -extern unsigned int XAssertStatus; -extern void XAssert (char *,int ); - -/**************************** Type Definitions *******************************/ - -/** @name Primitive types -* These primitive types are created for transportability. -* They are dependent upon the target architecture. -* @{ -*/ -#include <linux/types.h> - -typedef struct { -u32 Upper; -u32 Lower; -}Xuint64 ; - -/* Xilinx's unsigned integer types */ -typedef u32 Xuint32 ; -typedef u16 Xuint16 ; -typedef u8 Xuint8 ; - -/* and signed integer types */ -typedef s32 Xint32 ; -typedef s16 Xint16 ; -typedef s8 Xint8 ; - -#ifndef NULL -#define NULL 0 -#endif - -typedef unsigned long Xboolean ; -#define XNULL NULL - -#define XTRUE 1 -#define XFALSE 0 - -/*@}*/ - -/** -* This data type defines an interrupt handler for a device. -* The argument points to the instance of the component -*/ -typedef void (*XInterruptHandler ) (void *InstancePtr); - -/** -* This data type defines a callback to be invoked when an -* assert occurs. The callback is invoked only when asserts are enabled -*/ -typedef void (*XAssertCallback ) (char *FilenamePtr,int LineNumber); - -/***************** Macros (Inline Functions) Definitions *********************/ - -/*****************************************************************************/ -/** -* Return the most significant half of the 64 bit data type. -* -* @param x is the 64 bit word. -* -* @return -* -* The upper 32 bits of the 64 bit word. -* -* @note -* -* None. -* -******************************************************************************/ -#define XUINT64_MSW (x) ((x).Upper) - -/*****************************************************************************/ -/** -* Return the least significant half of the 64 bit data type. -* -* @param x is the 64 bit word. -* -* @return -* -* The lower 32 bits of the 64 bit word. -* -* @note -* -* None. -* -******************************************************************************/ -#define XUINT64_LSW (x) ((x).Lower) - -#ifndef NDEBUG - -/*****************************************************************************/ -/** -* This assert macro is to be used for functions that do not return anything -* (void). This in conjunction with the XWaitInAssert boolean can be used to -* accomodate tests so that asserts which fail allow execution to continue. -* -* @param expression is the expression to evaluate. If it evaluates to false, -* the assert occurs. -* -* @return -* -* Returns void unless the XWaitInAssert variable is true, in which case -* no return is made and an infinite loop is entered. -* -* @note -* -* None. -* -******************************************************************************/ -#define XASSERT_VOID (expression) \ -{ \ - if (expression) { \ - XAssertStatus = XASSERT_NONE; \ - } else { \ - XAssert(__FILE__, __LINE__); \ - XAssertStatus = XASSERT_OCCURRED; \ - return; \ - } \ -} - -/*****************************************************************************/ -/** -* This assert macro is to be used for functions that do return a value. This in -* conjunction with the XWaitInAssert boolean can be used to accomodate tests so -* that asserts which fail allow execution to continue. -* -* @param expression is the expression to evaluate. If it evaluates to false, -* the assert occurs. -* -* @return -* -* Returns 0 unless the XWaitInAssert variable is true, in which case -* no return is made and an infinite loop is entered. -* -* @note -* -* None. -* -******************************************************************************/ -#define XASSERT_NONVOID (expression) \ -{ \ - if (expression) { \ - XAssertStatus = XASSERT_NONE; \ - } else { \ - XAssert(__FILE__, __LINE__); \ - XAssertStatus = XASSERT_OCCURRED; \ - return 0; \ - } \ -} - -/*****************************************************************************/ -/** -* Always assert. This assert macro is to be used for functions that do not -* return anything (void). Use for instances where an assert should always -* occur. -* -* @return -* -* Returns void unless the XWaitInAssert variable is true, in which case -* no return is made and an infinite loop is entered. -* -* @note -* -* None. -* -******************************************************************************/ -#define XASSERT_VOID_ALWAYS () \ -{ \ - XAssert(__FILE__, __LINE__); \ - XAssertStatus = XASSERT_OCCURRED; \ - return; \ -} - -/*****************************************************************************/ -/** -* Always assert. This assert macro is to be used for functions that do return -* a value. Use for instances where an assert should always occur. -* -* @return -* -* Returns void unless the XWaitInAssert variable is true, in which case -* no return is made and an infinite loop is entered. -* -* @note -* -* None. -* -******************************************************************************/ -#define XASSERT_NONVOID_ALWAYS () \ -{ \ - XAssert(__FILE__, __LINE__); \ - XAssertStatus = XASSERT_OCCURRED; \ - return 0; \ -} - -#else - -#define XASSERT_VOID (expression) -#define XASSERT_VOID_ALWAYS () -#define XASSERT_NONVOID (expression) -#define XASSERT_NONVOID_ALWAYS () -#endif - -/************************** Function Prototypes ******************************/ - -void XAssertSetCallback (XAssertCallback Routine); - -#endif /* end of protection macro */
include/asm-microblaze/arch-microblaze/xio.h deleted +0 -63
63 lines not on this page · raw message
include/asm-microblaze/arch-microblaze/xuartlite_l.h deleted +0 -256
256 lines not on this page · raw message
include/asm-microblaze/serial_xuartlite.h deleted +0 -25
@@ -1,25 +0,0 @@ -/* -* (C) Copyright 2004 Atmark Techno, Inc. -* -* Yasushi SHOJI <[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/xuartlite_l.h>
Signature · 1 line
1.5.4.GIT
Wolfgang Denk
AppliedPATCH 2/2 microblaze: Remove useless ancient headers
Quoted 4 lines · In message <69b11bd6d9bb0dfc44cd15792f19b6cd7bc91992.1215763644.git.monstr@mons…
From: Michal Simek <[email protected]>
Signed-off-by Michal Simek <[email protected]>
Quoted 10 lines
--- .../asm-microblaze/arch-microblaze/xbasic_types.h | 301 -------------------- include/asm-microblaze/arch-microblaze/xio.h | 63 ---- .../asm-microblaze/arch-microblaze/xuartlite_l.h | 256 ----------------- include/asm-microblaze/serial_xuartlite.h | 25 -- 4 files changed, 0 insertions(+), 645 deletions(-) delete mode 100644 include/asm-microblaze/arch-microblaze/xbasic_types.h delete mode 100644 include/asm-microblaze/arch-microblaze/xio.h delete mode 100644 include/asm-microblaze/arch-microblaze/xuartlite_l.h delete mode 100644 include/asm-microblaze/serial_xuartlite.h
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 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 Why can you only have two doors on a chicken coop? If it had four it would be a chicken sedan.
PATCH 1/2 microblaze: Clean uartlite driver
In reply to monstr at seznam.czHi Michal
I have been unable to use your patch:
patching file include/asm-microblaze/io.h
ricardo at aragorn:~/curro/ml507/software/u-boot-ppc4xx$ patch -p1 </tmp/uart2.diff
patching file drivers/serial/serial_xuartlite.c
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 15.
Hunk #3 FAILED at 25.
Hunk #4 FAILED at 54.
Hunk #5 FAILED at 69.
5 out of 5 hunks FAILED -- saving rejects to file drivers/serial/serial_xuartlite.c.rej
What brach of u-boot shall I use.
regards
Quoted 122 lines · On Fri, Jul 11, 2008 at 10:10 AM, <[email protected]> wrote:
From: Michal Simek <[email protected]>
Redesign uartlite driver to
in_be32andout_be32macros Fix missing header inio.hSigned-off-by Michal Simek <[email protected]>--- drivers/serial/serial_xuartlite.c | 37 +++++++++++++++++++++---------------- include/asm-microblaze/io.h | 2 ++ 2 files changed, 23 insertions(+), 16 deletions(-)drivers/serial/serial_xuartlite.c +21
-16@@ -1,6 +1,8 @@/* -* (C) Copyright 2004 Atmark Techno, Inc. +* (C) Copyright 2008 Michal Simek <[email protected]> +* Clean driver and add xilinx constant from header file * +* (C) Copyright 2004 Atmark Techno, Inc. * Yasushi SHOJI <[email protected]> * * See file CREDITS for list of people who contributed to this @@ -13,7 +15,7 @@* * 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 +* 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 @@ -23,19 +25,21 @@*/ #include <config.h> +#include <asm/io.h> #ifdef CONFIG_XILINX_UARTLITE -#include <asm/serial_xuartlite.h> +#define RX_FIFO_OFFSET 0/* receive FIFO, read only */ +#define TX_FIFO_OFFSET 4/* transmit FIFO, write only */ +#define STATUS_REG_OFFSET 8/* status register, read only */ -/* FIXME: we should convert these to in32 and out32 */ -#define IO_WORD (offset) (*(volatile unsigned long *)(offset)) -#define IO_SERIAL (offset) IO_WORD(CONFIG_SERIAL_BASE + (offset)) +#define SR_TX_FIFO_FULL 0x08/* transmit FIFO full */ +#define SR_RX_FIFO_VALID_DATA 0x01/* data in receive FIFO */ +#define SR_RX_FIFO_FULL 0x02/* receive FIFO full */ -#define IO_SERIAL_RX_FIFO IO_SERIAL(XUL_RX_FIFO_OFFSET) -#define IO_SERIAL_TX_FIFO IO_SERIAL(XUL_TX_FIFO_OFFSET) -#define IO_SERIAL_STATUS IO_SERIAL(XUL_STATUS_REG_OFFSET) -#define IO_SERIAL_CONTROL IO_SERIAL(XUL_CONTROL_REG_OFFSET) +#define UARTLITE_STATUS (CONFIG_SERIAL_BASE + STATUS_REG_OFFSET) +#define UARTLITE_TX_FIFO (CONFIG_SERIAL_BASE + TX_FIFO_OFFSET) +#define UARTLITE_RX_FIFO (CONFIG_SERIAL_BASE + RX_FIFO_OFFSET)int serial_init (void ) {@@ -50,9 +54,10 @@ void serial_setbrg(void)void serial_putc (const char c) { -if (c =='\n' )serial_putc ('\r' ); -while (IO_SERIAL_STATUS &XUL_SR_TX_FIFO_FULL ); -IO_SERIAL_TX_FIFO = (unsigned char ) (c &0xff ); +if (c =='\n' ) +serial_putc ('\r' ); +while (in_be32 (UARTLITE_STATUS ) &SR_TX_FIFO_FULL ); +out_be32 (UARTLITE_TX_FIFO , (unsigned char ) (c &0xff )); }void serial_puts (const char * s)@@ -64,13 +69,13 @@ void serial_puts(const char * s)int serial_getc (void ) { -while (!(IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA )); -return IO_SERIAL_RX_FIFO &0xff ; +while (!(in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA )); +return in_be32 (UARTLITE_RX_FIFO ) &0xff ; }int serial_tstc (void ) { -return (IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA ); +return (in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA ); }#endif /* CONFIG_MICROBLZE */ include/asm-microblaze/io.h +2
-1@@ -16,6 +16,8 @@#ifndef __MICROBLAZE_IO_H__#define __MICROBLAZE_IO_H__ +#include <asm/types.h> +#define IO_SPACE_LIMIT 0xFFFFFFFF#define readb (addr) \ --1.5.4.GIT
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 microblaze: Clean uartlite driver
I haven't seen problem with patch.
M
[monstr at seznam u-boot-denx.de]$ git-am < 0001-microblaze-Clean-uartlite-driver.patch Applying microblaze: Clean uartlite driver
[monstr at seznam u-boot-denx.de]$ git log
commit 104b87cd4ee3dbea172ee1d39e81216e46b2070f
Author: Michal Simek <[email protected]> Date: Fri Jul 11 10:06:36 2008 +0200
microblaze: Clean uartlite driver
Redesign uartlite driver to in_be32 and out_be32 macros Fix missing header in io.h
commit 829bef9be1671973b04d9c2fcc279211a4b59b5e
Merge: df76983... c956717...
Author: Michal Simek <[email protected]>
Date: Mon Jul 7 15:14:56 2008 +0200
Merge branch 'master' of git://git.denx.de/u-boot
commit c956717ab25c962ef49d49064dfc73f4edcba1fb
Hi Michal
I have been unable to use your patch:
patching file include/asm-microblaze/io.h
ricardo at aragorn:~/curro/ml507/software/u-boot-ppc4xx$ patch -p1 </tmp/uart2.diff
patching file drivers/serial/serial_xuartlite.c
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 15.
Hunk #3 FAILED at 25.
Hunk #4 FAILED at 54.
Hunk #5 FAILED at 69.
5 out of 5 hunks FAILED -- saving rejects to file drivers/serial/serial_xuartlite.c.rej
What brach of u-boot shall I use.
regards
Quoted 8 lines · On Fri, Jul 11, 2008 at 10:10 AM, <[email protected]> wrote:
From: Michal Simek <[email protected]>
Redesign uartlite driver to
in_be32andout_be32macros Fix missing header inio.hSigned-off-by Michal Simek <[email protected]>--- drivers/serial/serial_xuartlite.c | 37
+++++++++++++++++++++----------------
Review
Quoted 4 lines
include/asm-microblaze/io.h | 2 ++ 2 files changed, 23 insertions(+), 16 deletions(-)(quoted diff) +0
-0
b/drivers/serial/serial_xuartlite.c
Quoted 37 lines
index d678ab6..5c41a1c 100644
drivers/serial/serial_xuartlite.c +8
-5@@ -1,6 +1,8 @@/* -* (C) Copyright 2004 Atmark Techno, Inc. +* (C) Copyright 2008 Michal Simek <[email protected]> +* Clean driver and add xilinx constant from header file * +* (C) Copyright 2004 Atmark Techno, Inc. * Yasushi SHOJI <[email protected]> * * See file CREDITS for list of people who contributed to this @@ -13,7 +15,7 @@* * 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 +* 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 @@ -23,19 +25,21 @@*/ #include <config.h> +#include <asm/io.h> #ifdef CONFIG_XILINX_UARTLITE -#include <asm/serial_xuartlite.h> +#define RX_FIFO_OFFSET 0/* receive FIFO, read only */ +#define TX_FIFO_OFFSET 4/* transmit FIFO, write only */ +#define STATUS_REG_OFFSET 8/* status register, read only */ -/* FIXME: we should convert these to in32 and out32 */ -#define IO_WORD (offset) (*(volatile unsigned long *)(offset))
drivers/serial/serial_xuartlite.c line 40
Quoted 10 lines
drivers/serial/serial_xuartlite.c +4
-5-#define IO_SERIAL (offset) IO_WORD(CONFIG_SERIAL_BASE + (offset)) +#define SR_TX_FIFO_FULL 0x08/* transmit FIFO full */ +#define SR_RX_FIFO_VALID_DATA 0x01/* data in receive FIFO */ +#define SR_RX_FIFO_FULL 0x02/* receive FIFO full */ -#define IO_SERIAL_RX_FIFO IO_SERIAL(XUL_RX_FIFO_OFFSET) -#define IO_SERIAL_TX_FIFO IO_SERIAL(XUL_TX_FIFO_OFFSET) -#define IO_SERIAL_STATUS IO_SERIAL(XUL_STATUS_REG_OFFSET) -#define IO_SERIAL_CONTROL IO_SERIAL(XUL_CONTROL_REG_OFFSET) +#define UARTLITE_STATUS (CONFIG_SERIAL_BASE +
STATUS_REG_OFFSET)
Quoted 63 lines
drivers/serial/serial_xuartlite.c +9
-6+#define UARTLITE_TX_FIFO (CONFIG_SERIAL_BASE + TX_FIFO_OFFSET) +#define UARTLITE_RX_FIFO (CONFIG_SERIAL_BASE + RX_FIFO_OFFSET)int serial_init (void ) {@@ -50,9 +54,10 @@ void serial_setbrg(void)void serial_putc (const char c) { -if (c =='\n' )serial_putc ('\r' ); -while (IO_SERIAL_STATUS &XUL_SR_TX_FIFO_FULL ); -IO_SERIAL_TX_FIFO = (unsigned char ) (c &0xff ); +if (c =='\n' ) +serial_putc ('\r' ); +while (in_be32 (UARTLITE_STATUS ) &SR_TX_FIFO_FULL ); +out_be32 (UARTLITE_TX_FIFO , (unsigned char ) (c &0xff )); }void serial_puts (const char * s)@@ -64,13 +69,13 @@ void serial_puts(const char * s)int serial_getc (void ) { -while (!(IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA )); -return IO_SERIAL_RX_FIFO &0xff ; +while (!(in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA )); +return in_be32 (UARTLITE_RX_FIFO ) &0xff ; }int serial_tstc (void ) { -return (IO_SERIAL_STATUS &XUL_SR_RX_FIFO_VALID_DATA ); +return (in_be32 (UARTLITE_STATUS ) &SR_RX_FIFO_VALID_DATA ); }#endif /* CONFIG_MICROBLZE */ include/asm-microblaze/io.h +2
-1@@ -16,6 +16,8 @@#ifndef __MICROBLAZE_IO_H__#define __MICROBLAZE_IO_H__ +#include <asm/types.h> +#define IO_SPACE_LIMIT 0xFFFFFFFF#define readb (addr) \ --1.5.4.GIT
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users
Signature · 2 lines
Ricardo Ribalda http://www.eps.uam.es/~rribalda/
PATCH 1/2 microblaze: Clean uartlite driver
In reply to monstr at seznam.czQuoted 6 lines · monstr at seznam.cz
From: Michal Simek <[email protected]>
Redesign uartlite driver to
in_be32andout_be32macros Fix missing header inio.hSigned-off-by Michal Simek <[email protected]>
Wolfgang Denk
AppliedPATCH 1/2 microblaze: Clean uartlite driver
In reply to monstr at seznam.czQuoted 10 lines · In message <e1f5c5b356bbfb0b827cb0fbd728b38c532f4bf5.1215763644.git.monstr@mons…
From: Michal Simek <[email protected]>
Redesign uartlite driver to
in_be32andout_be32macros Fix missing header inio.hSigned-off-by Michal Simek <[email protected]>--- drivers/serial/serial_xuartlite.c | 37 +++++++++++++++++++++---------------- include/asm-microblaze/io.h | 2 ++ 2 files changed, 23 insertions(+), 16 deletions(-)
Applied, thanks.
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 The light at the end of the tunnel is usually a "No Exit" sign.