From 8f86c061ebc6bb8de271c34754a453e8bae73764 Mon Sep 17 00:00:00 2001 From: Bill Mills Date: Wed, 23 Nov 2011 17:07:30 -0500 Subject: [PATCH 1/1] Refix c64x: uart API and null_uart Recent changes broke c64x platforms because they assume C66 uart. This commit seperates UART user API from implementation It also adds a "null" uart for platforms w/o a UART This null UART is used on all c64x platforms for now Signed-off-by: Bill Mills --- src/device/c64x/make/makefile | 2 +- src/device/c66x/c66x.c | 2 +- src/hw/c64x/make/makefile | 16 ++++-- src/hw/uart/c66x_uart/evmc66x_uart.h | 7 +-- src/hw/uart/null_uart/null_uart.c | 63 +++++++++++++++++++++++ src/hw/uart/uart.h | 52 +++++++++++++++++++ src/main/c64x/make/makefile | 2 +- src/main/iblmain.c | 2 +- src/make/ibl_c6455/ibl_objs_template.inc | 1 + src/make/ibl_c6457/ibl_objs_template.inc | 1 + src/make/ibl_c6472/ibl_objs_template.inc | 1 + src/make/ibl_c6474/ibl_objs_template.inc | 1 + src/make/ibl_c6474l/ibl_objs_template.inc | 1 + 13 files changed, 136 insertions(+), 15 deletions(-) create mode 100644 src/hw/uart/null_uart/null_uart.c create mode 100644 src/hw/uart/uart.h diff --git a/src/device/c64x/make/makefile b/src/device/c64x/make/makefile index d1af17a..38f9f43 100644 --- a/src/device/c64x/make/makefile +++ b/src/device/c64x/make/makefile @@ -101,7 +101,7 @@ C6X_C_DIR+= ;$(IBL_ROOT)/hw/nands C6X_C_DIR+= ;$(IBL_ROOT)/hw/nors C6X_C_DIR+= ;$(IBL_ROOT)/driver/eth C6X_C_DIR+= ;$(IBL_ROOT)/hw/spi -C6X_C_DIR+= ;$(IBL_ROOT)/hw/uart/c66x_uart +C6X_C_DIR+= ;$(IBL_ROOT)/hw/uart export C6X_C_DIR vpath % $(IBL_ROOT)/device/$(TARGET) diff --git a/src/device/c66x/c66x.c b/src/device/c66x/c66x.c index 51e83cd..e7a2cf7 100755 --- a/src/device/c66x/c66x.c +++ b/src/device/c66x/c66x.c @@ -66,7 +66,7 @@ #include "spi_api.h" #include #include -#include "evmc66x_uart.h" +#include "uart.h" #define PLL_DDR_INIT_LOOPMAX 10 #define IBL_RESULT_CODE_STR_LEN 20 diff --git a/src/hw/c64x/make/makefile b/src/hw/c64x/make/makefile index 8691010..009331d 100644 --- a/src/hw/c64x/make/makefile +++ b/src/hw/c64x/make/makefile @@ -48,19 +48,19 @@ ECODIR= $(IBL_ROOT)/hw # If no target specified, set CSRC to all files (used for clean) ifeq ($(TARGET),c6472) - CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c + CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c null_uart.c else ifeq ($(TARGET),c6474) - CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmii.c + CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmii.c null_uart.c else ifeq ($(TARGET),c6474l) - CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmii.c + CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmii.c null_uart.c else ifeq ($(TARGET),c6457) - CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmiicur.c + CSRC= t64.c cpmacdrv.c pll.c psc.c emif31.c mdio.c gpio.c nandgpio.c i2c.c sgmiicur.c null_uart.c else ifeq ($(TARGET),c6455) - CSRC= t64.c cpmacdrv.c pll.c emif31.c mdio.c gpio.c nandgpio.c i2c.c + CSRC= t64.c cpmacdrv.c pll.c emif31.c mdio.c gpio.c nandgpio.c i2c.c null_uart.c else ifeq ($(TARGET),c66x) CSRC= t64.c pll.c cfgpll.c cfgpll2.c mdio.c i2c.c psc.c cpsw.c qm.c cpdma.c pa.c sgmii.c serdes.c gmacsl.c emif4.c gpio.c @@ -110,6 +110,7 @@ C6X_C_DIR+= ;$(IBL_ROOT)/hw/pa C6X_C_DIR+= ;$(IBL_ROOT)/hw/spi C6X_C_DIR+= ;$(IBL_ROOT)/hw/nors C6X_C_DIR+= ;$(IBL_ROOT)/hw/emif25 +C6X_C_DIR+= ;$(IBL_ROOT)/hw/uart C6X_C_DIR+= ;$(IBL_ROOT)/ecc export C6X_C_DIR @@ -125,6 +126,7 @@ ifeq ($(TARGET),c6472) vpath % $(ECODIR)/gpio vpath % $(ECODIR)/nands/gpio vpath % $(ECODIR)/i2c + vpath % $(ECODIR)/uart/null_uart endif ifeq ($(TARGET),c6474) @@ -137,6 +139,7 @@ ifeq ($(TARGET),c6474) vpath % $(ECODIR)/nands/gpio vpath % $(ECODIR)/i2c vpath % $(ECODIR)/sgmii + vpath % $(ECODIR)/uart/null_uart endif ifeq ($(TARGET),c6474l) @@ -149,6 +152,7 @@ ifeq ($(TARGET),c6474l) vpath % $(ECODIR)/nands/gpio vpath % $(ECODIR)/i2c vpath % $(ECODIR)/sgmii + vpath % $(ECODIR)/uart/null_uart endif ifeq ($(TARGET),c6457) @@ -161,6 +165,7 @@ ifeq ($(TARGET),c6457) vpath % $(ECODIR)/nands/gpio vpath % $(ECODIR)/i2c vpath % $(ECODIR)/sgmii + vpath % $(ECODIR)/uart/null_uart endif ifeq ($(TARGET),c6455) @@ -171,6 +176,7 @@ ifeq ($(TARGET),c6455) vpath % $(ECODIR)/gpio vpath % $(ECODIR)/nands/gpio vpath % $(ECODIR)/i2c + vpath % $(ECODIR)/uart/null_uart endif ifeq ($(TARGET),c66x) diff --git a/src/hw/uart/c66x_uart/evmc66x_uart.h b/src/hw/uart/c66x_uart/evmc66x_uart.h index 5dad276..6f8067a 100755 --- a/src/hw/uart/c66x_uart/evmc66x_uart.h +++ b/src/hw/uart/c66x_uart/evmc66x_uart.h @@ -42,6 +42,7 @@ #ifndef _EVM66X_I2C_UART_H_ #define _EVM66X_I2C_UART_H_ +#include "uart.h" #include #define UART_REGS_BASE (0x02540000) @@ -83,10 +84,4 @@ typedef struct { #define UART_LSR_THRE_MASK (0x00000020u) #define UART_THR_DATA_MASK (0x000000FFu) -/************************ - * Function declarations - ************************/ -void uart_init(void); -void uart_write_string(char * str, uint32_t length); - #endif /* _EVM66X_I2C_UART_H_ */ diff --git a/src/hw/uart/null_uart/null_uart.c b/src/hw/uart/null_uart/null_uart.c new file mode 100644 index 0000000..82f7165 --- /dev/null +++ b/src/hw/uart/null_uart/null_uart.c @@ -0,0 +1,63 @@ +/****************************************************************************** + * Copyright (c) 2011 Texas Instruments Incorporated - http://www.ti.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +#include "uart.h" + +/****************************************************************************** + * + * Function: uart_init + * + * Description: This function initializes UART peripheral for C66x + * + * Parameters: none + * Return Value: none + ******************************************************************************/ +void uart_init(void) +{ +} + +/****************************************************************************** + * + * Function: uart_write_string + * + * Description: This function writes a string of data to UART device + * + * Parameters: str - string to print + * length - length of the string to print, maximum is 80 + * + * Return Value: none + ******************************************************************************/ +void uart_write_string(char * str, uint32_t length) +{ +} + diff --git a/src/hw/uart/uart.h b/src/hw/uart/uart.h new file mode 100644 index 0000000..4b0c20b --- /dev/null +++ b/src/hw/uart/uart.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2011 Texas Instruments Incorporated - http://www.ti.com + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ + +/****************************************************************************** + * + * File Name: evmc66x_uart.h + * + * Description: This contains the UART API + * + ******************************************************************************/ +#ifndef _UART_H_ +#define _UART_H_ + +#include + +/************************ + * Function declarations + ************************/ +void uart_init(void); +void uart_write_string(char * str, uint32_t length); + +#endif /* _UART_H_ */ diff --git a/src/main/c64x/make/makefile b/src/main/c64x/make/makefile index b546c60..3ca5705 100644 --- a/src/main/c64x/make/makefile +++ b/src/main/c64x/make/makefile @@ -74,7 +74,7 @@ C6X_C_DIR+= ;$(IBL_ROOT)/nandboot C6X_C_DIR+= ;$(IBL_ROOT)/norboot C6X_C_DIR+= ;$(IBL_ROOT)/driver/timer C6X_C_DIR+= ;$(IBL_ROOT)/hw/i2c -C6X_C_DIR+= ;$(IBL_ROOT)/hw/uart/c66x_uart +C6X_C_DIR+= ;$(IBL_ROOT)/hw/uart C6X_C_DIR+= ;$(IBL_ROOT)/hw/spi C6X_C_DIR+= ;$(IBL_ROOT)/cfg/$(TARGET) C6X_C_DIR+= ;$(STDINC) diff --git a/src/main/iblmain.c b/src/main/iblmain.c index 20955ac..52f6c10 100755 --- a/src/main/iblmain.c +++ b/src/main/iblmain.c @@ -65,7 +65,7 @@ #include "spi_api.h" #include "ibl_elf.h" #include -#include "evmc66x_uart.h" +#include "uart.h" extern cregister unsigned int IER; diff --git a/src/make/ibl_c6455/ibl_objs_template.inc b/src/make/ibl_c6455/ibl_objs_template.inc index 1fb45c4..0fd7dd1 100644 --- a/src/make/ibl_c6455/ibl_objs_template.inc +++ b/src/make/ibl_c6455/ibl_objs_template.inc @@ -8,6 +8,7 @@ ../driver/c64x/make/timer.ENDIAN_TAG.oc ../hw/c64x/make/t64.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc +../hw/c64x/make/null_uart.ENDIAN_TAG.oc #ifndef EXCLUDE_BIS diff --git a/src/make/ibl_c6457/ibl_objs_template.inc b/src/make/ibl_c6457/ibl_objs_template.inc index 2822632..76eb221 100644 --- a/src/make/ibl_c6457/ibl_objs_template.inc +++ b/src/make/ibl_c6457/ibl_objs_template.inc @@ -9,6 +9,7 @@ ../hw/c64x/make/t64.ENDIAN_TAG.oc ../hw/c64x/make/psc.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc +../hw/c64x/make/null_uart.ENDIAN_TAG.oc #ifndef EXCLUDE_BIS diff --git a/src/make/ibl_c6472/ibl_objs_template.inc b/src/make/ibl_c6472/ibl_objs_template.inc index f4d7ba6..a2da498 100644 --- a/src/make/ibl_c6472/ibl_objs_template.inc +++ b/src/make/ibl_c6472/ibl_objs_template.inc @@ -9,6 +9,7 @@ ../hw/c64x/make/t64.ENDIAN_TAG.oc ../hw/c64x/make/psc.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc +../hw/c64x/make/null_uart.ENDIAN_TAG.oc #ifndef EXCLUDE_BIS diff --git a/src/make/ibl_c6474/ibl_objs_template.inc b/src/make/ibl_c6474/ibl_objs_template.inc index 87a24e2..93fd060 100644 --- a/src/make/ibl_c6474/ibl_objs_template.inc +++ b/src/make/ibl_c6474/ibl_objs_template.inc @@ -9,6 +9,7 @@ ../hw/c64x/make/t64.ENDIAN_TAG.oc ../hw/c64x/make/psc.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc +../hw/c64x/make/null_uart.ENDIAN_TAG.oc #ifndef EXCLUDE_BIS diff --git a/src/make/ibl_c6474l/ibl_objs_template.inc b/src/make/ibl_c6474l/ibl_objs_template.inc index 86b79a9..3f9a71d 100644 --- a/src/make/ibl_c6474l/ibl_objs_template.inc +++ b/src/make/ibl_c6474l/ibl_objs_template.inc @@ -9,6 +9,7 @@ ../hw/c64x/make/t64.ENDIAN_TAG.oc ../hw/c64x/make/psc.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc +../hw/c64x/make/null_uart.ENDIAN_TAG.oc #ifndef EXCLUDE_BIS -- 2.39.2