From 8dc3b2303d2b57c774b609ca0e7043ed8f9b88c1 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 4 Feb 2008 14:10:01 +0100 Subject: Enable CODEC POST with CFG_POST_CODEC rather than with CFG_POST_DSP. Signed-off-by: Dmitry Rakhchev --- post/tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'post') diff --git a/post/tests.c b/post/tests.c index 698f85c98..ed4ef2b50 100644 --- a/post/tests.c +++ b/post/tests.c @@ -225,7 +225,7 @@ struct post_test post_list[] = CFG_POST_DSP }, #endif -#if CONFIG_POST & CFG_POST_DSP +#if CONFIG_POST & CFG_POST_CODEC { "CODEC test", "codec", -- cgit v1.2.3 From 65b20dcefc89618193fa51947968dada91e4c778 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 4 Feb 2008 14:10:42 +0100 Subject: The patch adds new POST tests for the Lwmon5 board. These are: * External Watchdog test; * dsPIC tests; * FPGA test; * GDC test; * Sysmon tests. Signed-off-by: Dmitry Rakhchev Signed-off-by: Yuri Tikhonov --- board/lwmon5/lwmon5.c | 19 ++++ include/configs/lwmon5.h | 92 ++++++++++++++- include/post.h | 5 + include/ppc440.h | 3 + post/board/lwmon5/Makefile | 28 +++++ post/board/lwmon5/dsp.c | 58 ++++++++++ post/board/lwmon5/dspic.c | 109 ++++++++++++++++++ post/board/lwmon5/fpga.c | 104 +++++++++++++++++ post/board/lwmon5/gdc.c | 94 +++++++++++++++ post/board/lwmon5/sysmon.c | 265 +++++++++++++++++++++++++++++++++++++++++++ post/board/lwmon5/watchdog.c | 132 +++++++++++++++++++++ post/tests.c | 26 +++++ 12 files changed, 931 insertions(+), 4 deletions(-) create mode 100644 post/board/lwmon5/Makefile create mode 100644 post/board/lwmon5/dsp.c create mode 100644 post/board/lwmon5/dspic.c create mode 100644 post/board/lwmon5/fpga.c create mode 100644 post/board/lwmon5/gdc.c create mode 100644 post/board/lwmon5/sysmon.c create mode 100644 post/board/lwmon5/watchdog.c (limited to 'post') diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index 815c01f4e..73d5de588 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -96,6 +96,25 @@ int board_early_init_f(void) gpio_write_bit(CFG_GPIO_FLASH_WP, 1); +#if CONFIG_POST & CFG_POST_BSPEC1 + gpio_write_bit(CFG_GPIO_HIGHSIDE, 1); + + reg = 0; /* reuse as counter */ + out_be32((void *)CFG_DSPIC_TEST_ADDR, + in_be32((void *)CFG_DSPIC_TEST_ADDR) + & ~CFG_DSPIC_TEST_MASK); + while (!gpio_read_in_bit(CFG_GPIO_DSPIC_READY) && reg++ < 1000) { + udelay(1000); + } + gpio_write_bit(CFG_GPIO_HIGHSIDE, 0); + if (gpio_read_in_bit(CFG_GPIO_DSPIC_READY)) { + /* set "boot error" flag */ + out_be32((void *)CFG_DSPIC_TEST_ADDR, + in_be32((void *)CFG_DSPIC_TEST_ADDR) | + CFG_DSPIC_TEST_MASK); + } +#endif + /* * Reset PHY's: * The PHY's need a 2nd reset pulse, since the MDIO address is latched diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h index c3f10c75a..6489e0eef 100644 --- a/include/configs/lwmon5.h +++ b/include/configs/lwmon5.h @@ -86,6 +86,15 @@ #define CFG_POST_ALT_WORD_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP6) /* unused GPT0 COMP reg */ +/* Additional registers for watchdog timer post test */ + +#define CFG_DSPIC_TEST_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP5) +#define CFG_WATCHDOG_TIME_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP4) +#define CFG_WATCHDOG_FLAGS_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP5) +#define CFG_WATCHDOG_MAGIC 0x12480000 +#define CFG_WATCHDOG_MAGIC_MASK 0xFFFF0000 +#define CFG_DSPIC_TEST_MASK 0x00000001 + /*----------------------------------------------------------------------- * Serial Port *----------------------------------------------------------------------*/ @@ -156,7 +165,81 @@ CFG_POST_MEMORY | \ CFG_POST_RTC | \ CFG_POST_SPR | \ - CFG_POST_UART) + CFG_POST_UART | \ + CFG_POST_SYSMON | \ + CFG_POST_WATCHDOG | \ + CFG_POST_DSP | \ + CFG_POST_BSPEC1 | \ + CFG_POST_BSPEC2 | \ + CFG_POST_BSPEC3 | \ + CFG_POST_BSPEC4 | \ + CFG_POST_BSPEC5) + +#define CONFIG_POST_WATCHDOG {\ + "Watchdog timer test", \ + "watchdog", \ + "This test checks the watchdog timer.", \ + POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT, \ + &lwmon5_watchdog_post_test, \ + NULL, \ + NULL, \ + CFG_POST_WATCHDOG \ + } + +#define CONFIG_POST_BSPEC1 {\ + "dsPIC init test", \ + "dspic_init", \ + "This test returns result of dsPIC READY test run earlier.", \ + POST_RAM | POST_ALWAYS, \ + &dspic_init_post_test, \ + NULL, \ + NULL, \ + CFG_POST_BSPEC1 \ + } + +#define CONFIG_POST_BSPEC2 {\ + "dsPIC test", \ + "dspic", \ + "This test gets result of dsPIC POST and dsPIC version.", \ + POST_RAM | POST_ALWAYS, \ + &dspic_post_test, \ + NULL, \ + NULL, \ + CFG_POST_BSPEC2 \ + } + +#define CONFIG_POST_BSPEC3 {\ + "FPGA test", \ + "fpga", \ + "This test checks FPGA registers and memory.", \ + POST_RAM | POST_ALWAYS, \ + &fpga_post_test, \ + NULL, \ + NULL, \ + CFG_POST_BSPEC3 \ + } + +#define CONFIG_POST_BSPEC4 {\ + "GDC test", \ + "gdc", \ + "This test checks GDC registers and memory.", \ + POST_RAM | POST_ALWAYS, \ + &gdc_post_test, \ + NULL, \ + NULL, \ + CFG_POST_BSPEC4 \ + } + +#define CONFIG_POST_BSPEC5 {\ + "SYSMON1 test", \ + "sysmon1", \ + "This test checks GPIO_62_EPX pin indicating power failure.", \ + POST_RAM | POST_MANUAL | POST_NORMAL | POST_SLOWTEST, \ + &sysmon1_post_test, \ + NULL, \ + NULL, \ + CFG_POST_BSPEC5 \ + } #define CFG_POST_CACHE_ADDR 0x7fff0000 /* free virtual address */ #define CONFIG_LOGBUFFER @@ -181,6 +264,7 @@ #define CONFIG_RTC_PCF8563 1 /* enable Philips PCF8563 RTC */ #define CFG_I2C_RTC_ADDR 0x51 /* Philips PCF8563 RTC address */ #define CFG_I2C_KEYBD_ADDR 0x56 /* PIC LWE keyboard */ +#define CFG_I2C_DSPIC_IO_ADDR 0x57 /* PIC I/O addr */ #define CONFIG_POST_KEY_MAGIC "3C+3E" /* press F3 + F5 keys to force POST */ #if 0 @@ -366,9 +450,6 @@ #define CFG_PCI_SUBSYS_VENDORID 0x10e8 /* AMCC */ #define CFG_PCI_SUBSYS_ID 0xcafe /* Whatever */ -/* - * ToDo: Watchdog is not test fully, so exclude it for now - */ #define CONFIG_HW_WATCHDOG 1 /* Use external HW-Watchdog */ #define CONFIG_WD_PERIOD 40000 /* in usec */ @@ -431,10 +512,13 @@ #define CFG_GPIO_PHY1_RST 12 #define CFG_GPIO_FLASH_WP 14 #define CFG_GPIO_PHY0_RST 22 +#define CFG_GPIO_DSPIC_READY 51 #define CFG_GPIO_EEPROM_EXT_WP 55 +#define CFG_GPIO_HIGHSIDE 56 #define CFG_GPIO_EEPROM_INT_WP 57 #define CFG_GPIO_LIME_S 59 #define CFG_GPIO_LIME_RST 60 +#define CFG_GPIO_SYSMON_STATUS 62 #define CFG_GPIO_WATCHDOG 63 /*----------------------------------------------------------------------- diff --git a/include/post.h b/include/post.h index c8062bbbc..12c0e9200 100644 --- a/include/post.h +++ b/include/post.h @@ -93,6 +93,11 @@ extern int post_hotkeys_pressed(void); #define CFG_POST_CODEC 0x00002000 #define CFG_POST_FPU 0x00004000 #define CFG_POST_ECC 0x00008000 +#define CFG_POST_BSPEC1 0x00010000 +#define CFG_POST_BSPEC2 0x00020000 +#define CFG_POST_BSPEC3 0x00040000 +#define CFG_POST_BSPEC4 0x00080000 +#define CFG_POST_BSPEC5 0x00100000 #endif /* CONFIG_POST */ diff --git a/include/ppc440.h b/include/ppc440.h index 80dd33235..6e3b68d67 100644 --- a/include/ppc440.h +++ b/include/ppc440.h @@ -1431,6 +1431,9 @@ #define SDR0_MFR_PKT_REJ_POL 0x00200000 /* Packet Reject Polarity */ #define GPT0_COMP6 0x00000098 +#define GPT0_COMP5 0x00000094 +#define GPT0_COMP4 0x00000090 +#define GPT0_COMP3 0x0000008C #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) #define SDR0_USB2D0CR 0x0320 diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile new file mode 100644 index 000000000..5a92d1ce7 --- /dev/null +++ b/post/board/lwmon5/Makefile @@ -0,0 +1,28 @@ +# +# (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com +# +# Developed for DENX Software Engineering GmbH +# +# 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 + +LIB = libpostlwmon5.a + +COBJS = sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o + +include $(TOPDIR)/post/rules.mk diff --git a/post/board/lwmon5/dsp.c b/post/board/lwmon5/dsp.c new file mode 100644 index 000000000..7b53af992 --- /dev/null +++ b/post/board/lwmon5/dsp.c @@ -0,0 +1,58 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 + +#ifdef CONFIG_POST + +#include + + +#if CONFIG_POST & CFG_POST_DSP +#include + +/* This test verifies DSP status bits in FPGA */ + +DECLARE_GLOBAL_DATA_PTR; + +#define DSP_STATUS_REG 0xC4000008 + +int dsp_post_test(int flags) +{ + uint read_value; + int ret; + + ret = 0; + read_value = in_be32((void *)DSP_STATUS_REG) & 0x3; + if (read_value != 0x3) { + post_log("\nDSP status read %08X\n", read_value); + ret = 1; + } + + return ret; +} + +#endif /* CONFIG_POST & CFG_POST_DSP */ +#endif /* CONFIG_POST */ + diff --git a/post/board/lwmon5/dspic.c b/post/board/lwmon5/dspic.c new file mode 100644 index 000000000..e8fed89ba --- /dev/null +++ b/post/board/lwmon5/dspic.c @@ -0,0 +1,109 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 + +#ifdef CONFIG_POST + +/* There are two tests for dsPIC currently implemented: + * 1. dsPIC ready test. Done in board_early_init_f(). Only result verified here. + * 2. dsPIC POST result test. This test gets dsPIC POST codes and version. + */ + +#include + +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define DSPIC_POST_ERROR_REG 0x800 +#define DSPIC_SYS_ERROR_REG 0x802 +#define DSPIC_VERSION_REG 0x804 + +#if CONFIG_POST & CFG_POST_BSPEC1 + +/* Verify that dsPIC ready test done early at hw init passed ok */ +int dspic_init_post_test(int flags) +{ + if (in_be32((void *)CFG_DSPIC_TEST_ADDR) & CFG_DSPIC_TEST_MASK) { + post_log("dsPIC init test failed\n"); + return 1; + } + + return 0; +} + +#endif /* CONFIG_POST & CFG_POST_BSPEC1 */ + +#if CONFIG_POST & CFG_POST_BSPEC2 +/* Read a register from the dsPIC. */ +int dspic_read(ushort reg) +{ + uchar buf[2]; + + if (i2c_read(CFG_I2C_DSPIC_IO_ADDR, reg, 2, buf, 2)) + return -1; + + return (uint)((buf[0] << 8) | buf[1]); +} + +/* Verify error codes regs, display version */ +int dspic_post_test(int flags) +{ + int data; + int ret = 0; + + post_log("\n"); + data = dspic_read(DSPIC_VERSION_REG); + if (data == -1) { + post_log("dsPIC : failed read version\n"); + ret = 1; + } else { + post_log("dsPIC version: %u.%u\n", + (data >> 8) & 0xFF, data & 0xFF); + } + + data = dspic_read(DSPIC_POST_ERROR_REG); + if (data != 0) ret = 1; + if (data == -1) { + post_log("dsPIC : failed read POST code\n"); + } else { + post_log("dsPIC POST code 0x%04X\n", data); + } + + data = dspic_read(DSPIC_SYS_ERROR_REG); + if (data != 0) ret = 1; + if (data == -1) { + post_log("dsPIC : failed read system error\n"); + } else { + post_log("dsPIC SYS-ERROR code: 0x%04X\n", data); + } + + return ret; +} + +#endif /* CONFIG_POST & CFG_POST_BSPEC2 */ +#endif /* CONFIG_POST */ + diff --git a/post/board/lwmon5/fpga.c b/post/board/lwmon5/fpga.c new file mode 100644 index 000000000..4e3f1d5cd --- /dev/null +++ b/post/board/lwmon5/fpga.c @@ -0,0 +1,104 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 + +#ifdef CONFIG_POST + +/* This test performs testing of FPGA SCRATCH register, + * gets FPGA version and run get_ram_size() on FPGA memory + */ + +#include + +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define FPGA_SCRATCH_REG 0xC4000050 +#define FPGA_VERSION_REG 0xC4000040 +#define FPGA_RAM_START 0xC4200000 +#define FPGA_RAM_END 0xC4203FFF + +#define FPGA_PWM_CTRL_REG 0xC4000020 +#define FPGA_PWM_TV_REG 0xC4000024 + +/* Turn on backlight, set brightness */ +void fpga_backlight_enable(int pwm) +{ + out_be16((void *)FPGA_PWM_CTRL_REG, 0x0701); + out_be16((void *)FPGA_PWM_TV_REG, pwm); +} + +#if CONFIG_POST & CFG_POST_BSPEC3 + +static int one_scratch_test(uint value) +{ + uint read_value; + int ret = 0; + + out_be32((void *)FPGA_SCRATCH_REG, value); + /* read other location (protect against data lines capacity) */ + ret = in_be16((void *)FPGA_VERSION_REG); + /* verify test pattern */ + read_value = in_be32((void *)FPGA_SCRATCH_REG); + if (read_value != value) { + post_log("FPGA SCRATCH test failed write %08X, read %08X\n", + value, read_value); + ret = 1; + } + + return ret; +} + +/* Verify FPGA, get version & memory size */ +int fpga_post_test(int flags) +{ + uint old_value; + ushort version; + uint read_value; + int ret = 0; + + post_log("\n"); + old_value = in_be32((void *)FPGA_SCRATCH_REG); + + if (one_scratch_test(0x55555555)) + ret = 1; + if (one_scratch_test(0xAAAAAAAA)) + ret = 1; + + out_be32((void *)FPGA_SCRATCH_REG, old_value); + + version = in_be16((void *)FPGA_VERSION_REG); + post_log("FPGA : version %u.%u\n", + (version >> 8) & 0xFF, version & 0xFF); + + read_value = get_ram_size((void *)CFG_FPGA_BASE_1, 0x4000); + post_log("FPGA RAM size: %d bytes\n", read_value); + + return ret; +} + +#endif /* CONFIG_POST & CFG_POST_BSPEC3 */ +#endif /* CONFIG_POST */ + diff --git a/post/board/lwmon5/gdc.c b/post/board/lwmon5/gdc.c new file mode 100644 index 000000000..76e5dd62e --- /dev/null +++ b/post/board/lwmon5/gdc.c @@ -0,0 +1,94 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 + +#ifdef CONFIG_POST + +/* This test attempts to verify board GDC. A scratch register tested, then + * simple memory test (get_ram_size()) run over GDC memory. + */ + +#include + +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define GDC_SCRATCH_REG 0xC1FF8044 +#define GDC_VERSION_REG 0xC1FF8084 +#define GDC_RAM_START 0xC0000000 +#define GDC_RAM_END 0xC2000000 + +#if CONFIG_POST & CFG_POST_BSPEC4 + +static int gdc_test_reg_one(uint value) +{ + int ret = 0; + uint read_value; + + /* write test pattern */ + out_be32((void *)GDC_SCRATCH_REG, value); + /* read other location (protect against data lines capacity) */ + ret = in_be32((void *)GDC_RAM_START); + /* verify test pattern */ + read_value = in_be32((void *)GDC_SCRATCH_REG); + if (read_value != value) { + post_log("GDC SCRATCH test failed write %08X, read %08X\n", + value, read_value); + ret = 1; + } + + return ret; +} + +/* Verify GDC, get memory size */ +int gdc_post_test(int flags) +{ + uint old_value; + int ret = 0; + + post_log("\n"); + old_value = in_be32((void *)GDC_SCRATCH_REG); + + if (gdc_test_reg_one(0x55555555)) + ret = 1; + if (gdc_test_reg_one(0xAAAAAAAA)) + ret = 1; + + out_be32((void *)GDC_SCRATCH_REG, old_value); + + old_value = in_be32((void *)GDC_VERSION_REG); + post_log("GDC chip version %u.%u, year %04X\n", + (old_value >> 8) & 0xFF, old_value & 0xFF, + (old_value >> 16) & 0xFFFF); + + old_value = get_ram_size((void *)GDC_RAM_START, + GDC_RAM_END - GDC_RAM_START); + post_log("GDC RAM size: %d bytes\n", old_value); + + return ret; +} +#endif /* CONFIG_POST & CFG_POST_BSPEC4 */ +#endif /* CONFIG_POST */ + diff --git a/post/board/lwmon5/sysmon.c b/post/board/lwmon5/sysmon.c new file mode 100644 index 000000000..0eae4c151 --- /dev/null +++ b/post/board/lwmon5/sysmon.c @@ -0,0 +1,265 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 +#include + +#ifdef CONFIG_POST + +/* + * SYSMON test + * + * This test performs the system hardware monitoring. + * The test passes when all the following voltages and temperatures + * are within allowed ranges: + * + * Temperature -40 .. +85 C + * +5V +4.75 .. +5.25 V + * +5V standby +4.75 .. +5.25 V + * + * LCD backlight is not enabled if temperature values are not within + * allowed ranges (-30 .. + 80). The brightness of backlite can be + * controlled by setting "brightness" enviroment variable. Default value is 50% + * + * See the list of all parameters in the sysmon_table below + */ + +#include +#include +#include + +#if CONFIG_POST & CFG_POST_SYSMON + +DECLARE_GLOBAL_DATA_PTR; + +#define DEFAULT_BRIGHTNESS 50 + +/* from dspic.c */ +extern int dspic_read(ushort reg); +/* from fpga.c */ +extern void fpga_backlight_enable(int v); + +static int sysmon_temp_invalid; + +#define RELOC(x) if (x != NULL) x = (void *) ((ulong) (x) + gd->reloc_off) + +typedef struct sysmon_s sysmon_t; +typedef struct sysmon_table_s sysmon_table_t; + +static void sysmon_dspic_init (sysmon_t * this); +static int sysmon_dspic_read (sysmon_t * this, uint addr); +static void sysmon_backlight_disable (sysmon_table_t * this); +static void sysmon_backlight_enable (sysmon_table_t * this); + +struct sysmon_s +{ + uchar chip; + void (*init)(sysmon_t *); + int (*read)(sysmon_t *, uint); +}; + +static sysmon_t sysmon_dspic = + {CFG_I2C_DSPIC_IO_ADDR, sysmon_dspic_init, sysmon_dspic_read}; + +static sysmon_t * sysmon_list[] = +{ + &sysmon_dspic, + NULL +}; + +struct sysmon_table_s +{ + char * name; + char * unit_name; + sysmon_t * sysmon; + void (*exec_before)(sysmon_table_t *); + void (*exec_after)(sysmon_table_t *); + + int unit_precision; + int unit_div; + int unit_min; + int unit_max; + uint val_mask; + uint val_min; + uint val_max; + int val_valid; + uint val_min_alt; + uint val_max_alt; + int val_valid_alt; + uint addr; +}; + +static sysmon_table_t sysmon_table[] = +{ + {"Temperature", " C", &sysmon_dspic, NULL, sysmon_backlight_disable, + 1, 1, -32768, 32767, 0xFFFF, 0x8000-40, 0x8000+85, 0, + 0x8000-30, 0x8000+80, 0, 0x12BC}, + + {"+ 5 V", "V", &sysmon_dspic, NULL, NULL, + 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, + 0x8000+4750, 0x8000+5250, 0, 0x12CA}, + + {"+ 5 V standby", "V", &sysmon_dspic, NULL, sysmon_backlight_enable, + 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, + 0x8000+4750, 0x8000+5250, 0, 0x12C6}, +}; +static int sysmon_table_size = sizeof(sysmon_table) / sizeof(sysmon_table[0]); + +int sysmon_init_f (void) +{ + sysmon_t ** l; + + for (l = sysmon_list; *l; l++) + (*l)->init(*l); + + return 0; +} + +void sysmon_reloc (void) +{ + sysmon_t ** l; + sysmon_table_t * t; + + for (l = sysmon_list; *l; l++) { + RELOC(*l); + RELOC((*l)->init); + RELOC((*l)->read); + } + + for (t = sysmon_table; t < sysmon_table + sysmon_table_size; t ++) { + RELOC(t->exec_before); + RELOC(t->exec_after); + RELOC(t->sysmon); + } +} + +static char *sysmon_unit_value (sysmon_table_t *s, uint val) +{ + static char buf[32]; + char *p, sign; + int decimal, frac; + int unit_val; + + unit_val = + s->unit_min + (s->unit_max - s->unit_min) * val / s->val_mask; + + if (val == -1) + return "I/O ERROR"; + + if (unit_val < 0) { + sign = '-'; + unit_val = -unit_val; + } else + sign = '+'; + + p = buf + sprintf(buf, "%c%2d", sign, unit_val / s->unit_div); + + + frac = unit_val % s->unit_div; + + frac /= (s->unit_div / s->unit_precision); + + decimal = s->unit_precision; + + if (decimal != 1) + *p++ = '.'; + for (decimal /= 10; decimal != 0; decimal /= 10) + *p++ = '0' + (frac / decimal) % 10; + strcpy(p, s->unit_name); + + return buf; +} + +static void sysmon_dspic_init (sysmon_t * this) +{ +} + +static int sysmon_dspic_read (sysmon_t * this, uint addr) +{ + int res = dspic_read(addr); + + /* To fit into the table range we should add 0x8000 */ + return (res == -1) ? -1 : (res + 0x8000); +} + +static void sysmon_backlight_disable (sysmon_table_t * this) +{ + if (!this->val_valid_alt) + sysmon_temp_invalid = 1; +} + +static void sysmon_backlight_enable (sysmon_table_t * this) +{ + char * param; + int rc; + + if (!sysmon_temp_invalid) { + param = getenv("brightness"); + rc = param ? simple_strtol(param, NULL, 10) : -1; + if (rc >= 0) + fpga_backlight_enable(rc); + else + fpga_backlight_enable(DEFAULT_BRIGHTNESS); + } +} + +int sysmon_post_test (int flags) +{ + int res = 0; + sysmon_table_t * t; + int val; + + for (t = sysmon_table; t < sysmon_table + sysmon_table_size; t ++) { + if (t->exec_before) + t->exec_before(t); + + val = t->sysmon->read(t->sysmon, t->addr); + if (val != -1) { + t->val_valid = val >= t->val_min && val <= t->val_max; + t->val_valid_alt = val >= t->val_min_alt && val <= t->val_max_alt; + } else { + t->val_valid = 0; + t->val_valid_alt = 0; + } + + if (t->exec_after) + t->exec_after(t); + + if ((!t->val_valid) || (flags & POST_MANUAL)) { + printf("%-17s = %-10s ", t->name, sysmon_unit_value(t, val)); + printf("allowed range"); + printf(" %-8s ..", sysmon_unit_value(t, t->val_min)); + printf(" %-8s", sysmon_unit_value(t, t->val_max)); + printf(" %s\n", t->val_valid ? "OK" : "FAIL"); + } + + if (!t->val_valid) + res = 1; + } + + return res; +} + +#endif /* CONFIG_POST & CFG_POST_SYSMON */ +#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/watchdog.c b/post/board/lwmon5/watchdog.c new file mode 100644 index 000000000..ad9e6f384 --- /dev/null +++ b/post/board/lwmon5/watchdog.c @@ -0,0 +1,132 @@ +/* + * (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, rda@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * 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 + +/* This test verifies if the reason of last reset was an abnormal voltage + * condition, than it performs watchdog test, measuing time required to + * trigger watchdog reset. + */ + +#ifdef CONFIG_POST + +#include + +#if CONFIG_POST & CFG_POST_WATCHDOG + +#include +#include +#include + +static uint watchdog_magic_read(void) +{ + return in_be32((void *)CFG_WATCHDOG_FLAGS_ADDR) & + CFG_WATCHDOG_MAGIC_MASK; +} + +static void watchdog_magic_write(uint value) +{ + out_be32((void *)CFG_WATCHDOG_FLAGS_ADDR, value | + (in_be32((void *)CFG_WATCHDOG_FLAGS_ADDR) & + ~CFG_WATCHDOG_MAGIC_MASK)); +} + +int sysmon1_post_test(int flags) +{ + if (gpio_read_in_bit(CFG_GPIO_SYSMON_STATUS)) { + /* 3.1. GPIO62 is low + * Assuming system voltage failure. + */ + post_log("Abnormal voltage detected (GPIO62)\n"); + return 1; + } + + return 0; +} + +int lwmon5_watchdog_post_test(int flags) +{ + /* On each reset scratch register 1 should be tested, + * but first test GPIO62: + */ + if (!(flags & POST_MANUAL) && sysmon1_post_test(flags)) { + /* 3.1. GPIO62 is low + * Assuming system voltage failure. + */ + /* 3.1.1. Set scratch register 1 to 0x0000xxxx */ + watchdog_magic_write(0); + /* 3.1.2. Mark test as failed due to voltage?! */ + return 1; + } + + if (watchdog_magic_read() != CFG_WATCHDOG_MAGIC) { + /* 3.2. Scratch register 1 differs from magic value 0x1248xxxx + * Assuming PowerOn + */ + int ints; + ulong base; + ulong time; + + /* 3.2.1. Set magic value to scratch register */ + watchdog_magic_write(CFG_WATCHDOG_MAGIC); + + ints = disable_interrupts (); + /* 3.2.2. strobe watchdog once */ + WATCHDOG_RESET(); + out_be32((void *)CFG_WATCHDOG_TIME_ADDR, 0); + /* 3.2.3. save time of strobe in scratch register 2 */ + base = post_time_ms (0); + + /* 3.2.4. Wait for 150 ms (enough for reset to happen) */ + while ((time = post_time_ms (base)) < 150) + out_be32((void *)CFG_WATCHDOG_TIME_ADDR, time); + if (ints) + enable_interrupts (); + + /* 3.2.5. Reset didn't happen. - Set 0x0000xxxx + * into scratch register 1 + */ + watchdog_magic_write(0); + /* 3.2.6. Mark test as failed. */ + post_log("hw watchdog time : %u ms, failed ", time); + return 2; + } else { + /* 3.3. Scratch register matches magic value 0x1248xxxx + * Assume this is watchdog-initiated reset + */ + ulong time; + /* 3.3.1. So, the test succeed, save measured time to syslog. */ + time = in_be32((void *)CFG_WATCHDOG_TIME_ADDR); + post_log("hw watchdog time : %u ms, passed ", time); + /* 3.3.2. Set scratch register 1 to 0x0000xxxx */ + watchdog_magic_write(0); + return 0; + } + return -1; +} + + +#endif /* CONFIG_POST & CFG_POST_WATCHDOG */ +#endif /* CONFIG_POST */ + diff --git a/post/tests.c b/post/tests.c index ed4ef2b50..53d01e355 100644 --- a/post/tests.c +++ b/post/tests.c @@ -48,6 +48,13 @@ extern int dsp_post_test (int flags); extern int codec_post_test (int flags); extern int ecc_post_test (int flags); +extern int dspic_init_post_test (int flags); +extern int dspic_post_test (int flags); +extern int gdc_post_test (int flags); +extern int fpga_post_test (int flags); +extern int lwmon5_watchdog_post_test(int flags); +extern int sysmon1_post_test(int flags); + extern int sysmon_init_f (void); extern void sysmon_reloc (void); @@ -68,6 +75,9 @@ struct post_test post_list[] = }, #endif #if CONFIG_POST & CFG_POST_WATCHDOG +#if defined(CONFIG_POST_WATCHDOG) + CONFIG_POST_WATCHDOG, +#else { "Watchdog timer test", "watchdog", @@ -79,6 +89,7 @@ struct post_test post_list[] = CFG_POST_WATCHDOG }, #endif +#endif #if CONFIG_POST & CFG_POST_I2C { "I2C test", @@ -249,6 +260,21 @@ struct post_test post_list[] = CFG_POST_ECC }, #endif +#if CONFIG_POST & CFG_POST_BSPEC1 + CONFIG_POST_BSPEC1, +#endif +#if CONFIG_POST & CFG_POST_BSPEC2 + CONFIG_POST_BSPEC2, +#endif +#if CONFIG_POST & CFG_POST_BSPEC3 + CONFIG_POST_BSPEC3, +#endif +#if CONFIG_POST & CFG_POST_BSPEC4 + CONFIG_POST_BSPEC4, +#endif +#if CONFIG_POST & CFG_POST_BSPEC4 + CONFIG_POST_BSPEC5, +#endif }; unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test); -- cgit v1.2.3 From e262efe35742c1ad4b0966ff501efc26f34a0aec Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 4 Feb 2008 14:11:03 +0100 Subject: The patch introduces the CRITICAL feature of POST tests. If the test marked as POST_CRITICAL fails then the alternative, post_critical, boot-command is used. If this command is not defined then U-Boot enters into interactive mode. Signed-off-by: Dmitry Rakhchev Signed-off-by: Yuri Tikhonov --- common/main.c | 8 +++++++- include/asm-arm/global_data.h | 1 + include/asm-avr32/global_data.h | 1 + include/asm-blackfin/global_data.h | 1 + include/asm-i386/global_data.h | 1 + include/asm-m68k/global_data.h | 1 + include/asm-microblaze/global_data.h | 1 + include/asm-mips/global_data.h | 1 + include/asm-nios/global_data.h | 1 + include/asm-nios2/global_data.h | 1 + include/asm-ppc/global_data.h | 1 + include/asm-sh/global_data.h | 1 + include/post.h | 4 ++++ post/post.c | 18 +++++++++++++++--- 14 files changed, 37 insertions(+), 4 deletions(-) (limited to 'post') diff --git a/common/main.c b/common/main.c index 163ba02e6..21e7afab6 100644 --- a/common/main.c +++ b/common/main.c @@ -40,7 +40,7 @@ #include -#ifdef CONFIG_SILENT_CONSOLE +#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) DECLARE_GLOBAL_DATA_PTR; #endif @@ -369,6 +369,12 @@ void main_loop (void) init_cmd_timeout (); # endif /* CONFIG_BOOT_RETRY_TIME */ +#ifdef CONFIG_POST + if (gd->flags & GD_FLG_POSTFAIL) { + s = getenv("failbootcmd"); + } + else +#endif /* CONFIG_POST */ #ifdef CONFIG_BOOTCOUNT_LIMIT if (bootlimit && (bootcount > bootlimit)) { printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n", diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index c2d52915a..0410b5ef7 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -60,6 +60,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") diff --git a/include/asm-avr32/global_data.h b/include/asm-avr32/global_data.h index 681c514cc..daf64bc00 100644 --- a/include/asm-avr32/global_data.h +++ b/include/asm-avr32/global_data.h @@ -51,6 +51,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5") diff --git a/include/asm-blackfin/global_data.h b/include/asm-blackfin/global_data.h index cb0dfc2d9..6debfc745 100644 --- a/include/asm-blackfin/global_data.h +++ b/include/asm-blackfin/global_data.h @@ -61,6 +61,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register gd_t * volatile gd asm ("P5") diff --git a/include/asm-i386/global_data.h b/include/asm-i386/global_data.h index 1d309d5b5..68a9ad61e 100644 --- a/include/asm-i386/global_data.h +++ b/include/asm-i386/global_data.h @@ -54,6 +54,7 @@ typedef struct { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ extern gd_t *global_data; diff --git a/include/asm-m68k/global_data.h b/include/asm-m68k/global_data.h index 1e26eb037..958736ec7 100644 --- a/include/asm-m68k/global_data.h +++ b/include/asm-m68k/global_data.h @@ -68,6 +68,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #if 0 extern gd_t *global_data; diff --git a/include/asm-microblaze/global_data.h b/include/asm-microblaze/global_data.h index a6e783424..91243b22c 100644 --- a/include/asm-microblaze/global_data.h +++ b/include/asm-microblaze/global_data.h @@ -52,6 +52,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31") diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h index a024194ba..bd9e4dd86 100644 --- a/include/asm-mips/global_data.h +++ b/include/asm-mips/global_data.h @@ -54,6 +54,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0") diff --git a/include/asm-nios/global_data.h b/include/asm-nios/global_data.h index fd1138920..ddd66cfd4 100644 --- a/include/asm-nios/global_data.h +++ b/include/asm-nios/global_data.h @@ -45,6 +45,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7") diff --git a/include/asm-nios2/global_data.h b/include/asm-nios2/global_data.h index a1ac28856..ae5f61700 100644 --- a/include/asm-nios2/global_data.h +++ b/include/asm-nios2/global_data.h @@ -44,6 +44,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r15") diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h index 205f7ed74..e07092baa 100644 --- a/include/asm-ppc/global_data.h +++ b/include/asm-ppc/global_data.h @@ -164,6 +164,7 @@ typedef struct global_data { #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #if 1 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2") diff --git a/include/asm-sh/global_data.h b/include/asm-sh/global_data.h index 0a44a34ce..521a66ffc 100644 --- a/include/asm-sh/global_data.h +++ b/include/asm-sh/global_data.h @@ -44,6 +44,7 @@ typedef struct global_data #define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */ #define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */ #define GD_FLG_SILENT 0x00004 /* Silent mode */ +#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r13") diff --git a/include/post.h b/include/post.h index 12c0e9200..ee07d2caa 100644 --- a/include/post.h +++ b/include/post.h @@ -42,12 +42,16 @@ #define POST_REBOOT 0x0800 /* test may cause rebooting */ #define POST_PREREL 0x1000 /* test runs before relocation */ +#define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */ + #define POST_MEM (POST_RAM | POST_ROM) #define POST_ALWAYS (POST_NORMAL | \ POST_SLOWTEST | \ POST_MANUAL | \ POST_POWERON ) +#define POST_FAIL_SAVE 0x80 + #ifndef __ASSEMBLY__ struct post_test { diff --git a/post/post.c b/post/post.c index 4ff75ee4b..1df0657d8 100644 --- a/post/post.c +++ b/post/post.c @@ -157,8 +157,10 @@ static void post_bootmode_test_off (void) static void post_get_flags (int *test_flags) { - int flag[] = { POST_POWERON, POST_NORMAL, POST_SLOWTEST }; - char *var[] = { "post_poweron", "post_normal", "post_slowtest" }; + int flag[] = { POST_POWERON, POST_NORMAL, POST_SLOWTEST, + POST_CRITICAL }; + char *var[] = { "post_poweron", "post_normal", "post_slowtest", + "post_critical" }; int varnum = sizeof (var) / sizeof (var[0]); char list[128]; /* long enough for POST list */ char *name; @@ -224,7 +226,9 @@ static int post_run_single (struct post_test *test, if (!(flags & POST_REBOOT)) { if ((test_flags & POST_REBOOT) && !(flags & POST_MANUAL)) { - post_bootmode_test_on (i); + post_bootmode_test_on ( + (gd->flags & GD_FLG_POSTFAIL) ? + POST_FAIL_SAVE | i : i); } if (test_flags & POST_PREREL) @@ -236,10 +240,14 @@ static int post_run_single (struct post_test *test, if (test_flags & POST_PREREL) { if ((*test->test) (flags) == 0) post_log_mark_succ ( test->testid ); + else if (test_flags & POST_CRITICAL) + gd->flags |= GD_FLG_POSTFAIL; } else { if ((*test->test) (flags) != 0) { post_log ("FAILED\n"); show_boot_progress (-32); + if (test_flags & POST_CRITICAL) + gd->flags |= GD_FLG_POSTFAIL; } else post_log ("PASSED\n"); @@ -266,6 +274,10 @@ int post_run (char *name, int flags) unsigned int last; if (post_bootmode_get (&last) & POST_POWERTEST) { + if (last & POST_FAIL_SAVE) { + last &= ~POST_FAIL_SAVE; + gd->flags |= GD_FLG_POSTFAIL; + } if (last < post_list_size && (flags & test_flags[last] & POST_ALWAYS) && (flags & test_flags[last] & POST_MEM)) { -- cgit v1.2.3 From 603f194e5ad81bb2ef42d6d8aaa74de175bcb411 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 4 Feb 2008 17:09:55 +0100 Subject: Some fixes to dspic, fpga, and gdc post tests for lwmon5. Disable external watch-dog for now. Signed-off-by: Dmitry Rakhchev Signed-off-by: Yuri Tikhonov --- post/board/lwmon5/dspic.c | 2 +- post/board/lwmon5/fpga.c | 4 ++++ post/board/lwmon5/gdc.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'post') diff --git a/post/board/lwmon5/dspic.c b/post/board/lwmon5/dspic.c index e8fed89ba..f1c9c153f 100644 --- a/post/board/lwmon5/dspic.c +++ b/post/board/lwmon5/dspic.c @@ -94,9 +94,9 @@ int dspic_post_test(int flags) } data = dspic_read(DSPIC_SYS_ERROR_REG); - if (data != 0) ret = 1; if (data == -1) { post_log("dsPIC : failed read system error\n"); + ret = 1; } else { post_log("dsPIC SYS-ERROR code: 0x%04X\n", data); } diff --git a/post/board/lwmon5/fpga.c b/post/board/lwmon5/fpga.c index 4e3f1d5cd..b87fc52c6 100644 --- a/post/board/lwmon5/fpga.c +++ b/post/board/lwmon5/fpga.c @@ -39,6 +39,7 @@ DECLARE_GLOBAL_DATA_PTR; #define FPGA_VERSION_REG 0xC4000040 #define FPGA_RAM_START 0xC4200000 #define FPGA_RAM_END 0xC4203FFF +#define FPGA_STAT 0xC400000C #define FPGA_PWM_CTRL_REG 0xC4000020 #define FPGA_PWM_TV_REG 0xC4000024 @@ -93,6 +94,9 @@ int fpga_post_test(int flags) post_log("FPGA : version %u.%u\n", (version >> 8) & 0xFF, version & 0xFF); + /* Enable write to FPGA RAM */ + out_be32((void *)FPGA_STAT, in_be32((void *)FPGA_STAT) | 0x1000); + read_value = get_ram_size((void *)CFG_FPGA_BASE_1, 0x4000); post_log("FPGA RAM size: %d bytes\n", read_value); diff --git a/post/board/lwmon5/gdc.c b/post/board/lwmon5/gdc.c index 76e5dd62e..0e4f0fd33 100644 --- a/post/board/lwmon5/gdc.c +++ b/post/board/lwmon5/gdc.c @@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define GDC_SCRATCH_REG 0xC1FF8044 +#define GDC_SCRATCH_REG 0xC1FF8008 #define GDC_VERSION_REG 0xC1FF8084 #define GDC_RAM_START 0xC0000000 #define GDC_RAM_END 0xC2000000 -- cgit v1.2.3 From 0f855a1f056a8c22116a2103a3900cbfb669df0b Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Tue, 18 Mar 2008 13:27:57 +0100 Subject: Fix backlight in the lwmon5 POST. Backlight was switcehd on even when temperature was too low. Signed-off-by: Dmitry Rakhchev Signed-off-by: Yuri Tikhonov --- board/lwmon5/lwmon5.c | 24 +++++++++++++++++++++--- post/board/lwmon5/fpga.c | 10 ---------- post/board/lwmon5/sysmon.c | 33 ++++++++------------------------- 3 files changed, 29 insertions(+), 38 deletions(-) (limited to 'post') diff --git a/board/lwmon5/lwmon5.c b/board/lwmon5/lwmon5.c index 7c5f6ccf1..e5fa25937 100644 --- a/board/lwmon5/lwmon5.c +++ b/board/lwmon5/lwmon5.c @@ -567,11 +567,13 @@ unsigned int board_video_init (void) return CFG_LIME_BASE_0; } -void board_backlight_switch (int flag) +#define DEFAULT_BRIGHTNESS 0x64 + +static void board_backlight_brightness(int brightness) { - if (flag) { + if (brightness > 0) { /* pwm duty, lamp on */ - out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000024), 0x64); + out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000024), brightness); out_be32((void *)(CFG_FPGA_BASE_0 + 0x00000020), 0x701); } else { /* lamp off */ @@ -580,6 +582,22 @@ void board_backlight_switch (int flag) } } +void board_backlight_switch (int flag) +{ + char * param; + int rc; + + if (flag) { + param = getenv("brightness"); + rc = param ? simple_strtol(param, NULL, 10) : -1; + if (rc < 0) + rc = DEFAULT_BRIGHTNESS; + } else { + rc = 0; + } + board_backlight_brightness(rc); +} + #if defined(CONFIG_CONSOLE_EXTRA_INFO) /* * Return text to be printed besides the logo. diff --git a/post/board/lwmon5/fpga.c b/post/board/lwmon5/fpga.c index b87fc52c6..162174c3a 100644 --- a/post/board/lwmon5/fpga.c +++ b/post/board/lwmon5/fpga.c @@ -41,16 +41,6 @@ DECLARE_GLOBAL_DATA_PTR; #define FPGA_RAM_END 0xC4203FFF #define FPGA_STAT 0xC400000C -#define FPGA_PWM_CTRL_REG 0xC4000020 -#define FPGA_PWM_TV_REG 0xC4000024 - -/* Turn on backlight, set brightness */ -void fpga_backlight_enable(int pwm) -{ - out_be16((void *)FPGA_PWM_CTRL_REG, 0x0701); - out_be16((void *)FPGA_PWM_TV_REG, pwm); -} - #if CONFIG_POST & CFG_POST_BSPEC3 static int one_scratch_test(uint value) diff --git a/post/board/lwmon5/sysmon.c b/post/board/lwmon5/sysmon.c index 0eae4c151..f7e51a3cf 100644 --- a/post/board/lwmon5/sysmon.c +++ b/post/board/lwmon5/sysmon.c @@ -49,18 +49,16 @@ #include #include +#if defined(CONFIG_VIDEO) +#include +#endif + #if CONFIG_POST & CFG_POST_SYSMON DECLARE_GLOBAL_DATA_PTR; -#define DEFAULT_BRIGHTNESS 50 - /* from dspic.c */ extern int dspic_read(ushort reg); -/* from fpga.c */ -extern void fpga_backlight_enable(int v); - -static int sysmon_temp_invalid; #define RELOC(x) if (x != NULL) x = (void *) ((ulong) (x) + gd->reloc_off) @@ -70,7 +68,6 @@ typedef struct sysmon_table_s sysmon_table_t; static void sysmon_dspic_init (sysmon_t * this); static int sysmon_dspic_read (sysmon_t * this, uint addr); static void sysmon_backlight_disable (sysmon_table_t * this); -static void sysmon_backlight_enable (sysmon_table_t * this); struct sysmon_s { @@ -120,7 +117,7 @@ static sysmon_table_t sysmon_table[] = 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, 0x8000+4750, 0x8000+5250, 0, 0x12CA}, - {"+ 5 V standby", "V", &sysmon_dspic, NULL, sysmon_backlight_enable, + {"+ 5 V standby", "V", &sysmon_dspic, NULL, NULL, 100, 1000, -0x8000, 0x7FFF, 0xFFFF, 0x8000+4750, 0x8000+5250, 0, 0x8000+4750, 0x8000+5250, 0, 0x12C6}, }; @@ -205,23 +202,9 @@ static int sysmon_dspic_read (sysmon_t * this, uint addr) static void sysmon_backlight_disable (sysmon_table_t * this) { - if (!this->val_valid_alt) - sysmon_temp_invalid = 1; -} - -static void sysmon_backlight_enable (sysmon_table_t * this) -{ - char * param; - int rc; - - if (!sysmon_temp_invalid) { - param = getenv("brightness"); - rc = param ? simple_strtol(param, NULL, 10) : -1; - if (rc >= 0) - fpga_backlight_enable(rc); - else - fpga_backlight_enable(DEFAULT_BRIGHTNESS); - } +#if defined(CONFIG_VIDEO) + board_backlight_switch(this->val_valid_alt); +#endif } int sysmon_post_test (int flags) -- cgit v1.2.3 From 3a5d1e7f1309998791702b2a559e3126781746b9 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Tue, 18 Mar 2008 13:33:30 +0100 Subject: lwmon5: Fix register test logic to match the specific GDC h/w. Signed-off-by: Dmitry Rakhchev Signed-off-by: Yuri Tikhonov --- post/board/lwmon5/gdc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'post') diff --git a/post/board/lwmon5/gdc.c b/post/board/lwmon5/gdc.c index 0e4f0fd33..aa1eee05f 100644 --- a/post/board/lwmon5/gdc.c +++ b/post/board/lwmon5/gdc.c @@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define GDC_SCRATCH_REG 0xC1FF8008 +#define GDC_SCRATCH_REG 0xC1FF8044 #define GDC_VERSION_REG 0xC1FF8084 #define GDC_RAM_START 0xC0000000 #define GDC_RAM_END 0xC2000000 @@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; static int gdc_test_reg_one(uint value) { - int ret = 0; + int ret; uint read_value; /* write test pattern */ @@ -56,10 +56,9 @@ static int gdc_test_reg_one(uint value) if (read_value != value) { post_log("GDC SCRATCH test failed write %08X, read %08X\n", value, read_value); - ret = 1; } - return ret; + return (read_value != value); } /* Verify GDC, get memory size */ @@ -71,9 +70,16 @@ int gdc_post_test(int flags) post_log("\n"); old_value = in_be32((void *)GDC_SCRATCH_REG); - if (gdc_test_reg_one(0x55555555)) + /* + * GPIOC2 register behaviour: the LIME graphics processor has a + * maximum of 5 GPIO ports that can be used in this hardware + * configuration. Thus only the bits for these 5 GPIOs can be + * activated in the GPIOC2 register. All other bits will always be + * read as zero. + */ + if (gdc_test_reg_one(0x00150015)) ret = 1; - if (gdc_test_reg_one(0xAAAAAAAA)) + if (gdc_test_reg_one(0x000A000A)) ret = 1; out_be32((void *)GDC_SCRATCH_REG, old_value); -- cgit v1.2.3 From 0a51e9248e2d27e0a02ef1e740c576ce90a39ee1 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 31 Mar 2008 10:49:34 +0200 Subject: POST: preparations for moving CONFIG_POST to Makefiles Remove CONFIG_POST ifdefs from the post/ source files. Signed-off-by: Yuri Tikhonov Signed-off-by: Wolfgang Denk --- post/board/lwmon/sysmon.c | 3 --- post/board/lwmon5/dsp.c | 5 ----- post/board/lwmon5/dspic.c | 4 ---- post/board/lwmon5/fpga.c | 4 ---- post/board/lwmon5/gdc.c | 4 ---- post/board/lwmon5/sysmon.c | 3 --- post/board/lwmon5/watchdog.c | 4 ---- post/board/netta/codec.c | 3 --- post/board/netta/dsp.c | 3 --- post/cpu/mpc8xx/cache.c | 3 --- post/cpu/mpc8xx/cache_8xx.S | 2 -- post/cpu/mpc8xx/ether.c | 4 ---- post/cpu/mpc8xx/spr.c | 3 --- post/cpu/mpc8xx/uart.c | 4 ---- post/cpu/mpc8xx/usb.c | 4 ---- post/cpu/mpc8xx/watchdog.c | 3 --- post/cpu/ppc4xx/cache.c | 3 --- post/cpu/ppc4xx/cache_4xx.S | 3 --- post/cpu/ppc4xx/denali_ecc.c | 4 ++-- post/cpu/ppc4xx/ether.c | 3 --- post/cpu/ppc4xx/fpu.c | 2 -- post/cpu/ppc4xx/spr.c | 3 --- post/cpu/ppc4xx/uart.c | 3 --- post/cpu/ppc4xx/watchdog.c | 3 --- post/drivers/i2c.c | 3 --- post/drivers/memory.c | 3 --- post/drivers/rtc.c | 3 --- post/lib_ppc/andi.c | 3 --- post/lib_ppc/asm.S | 3 --- post/lib_ppc/b.c | 3 --- post/lib_ppc/cmp.c | 3 --- post/lib_ppc/cmpi.c | 3 --- post/lib_ppc/complex.c | 3 --- post/lib_ppc/cpu.c | 3 --- post/lib_ppc/cr.c | 3 --- post/lib_ppc/fpu/20001122-1.c | 3 --- post/lib_ppc/fpu/20010114-2.c | 3 --- post/lib_ppc/fpu/20010226-1.c | 3 --- post/lib_ppc/fpu/980619-1.c | 3 --- post/lib_ppc/fpu/acc1.c | 3 --- post/lib_ppc/fpu/compare-fp-1.c | 3 --- post/lib_ppc/fpu/fpu.c | 3 --- post/lib_ppc/fpu/mul-subnormal-single-1.c | 3 --- post/lib_ppc/load.c | 3 --- post/lib_ppc/multi.c | 3 --- post/lib_ppc/rlwimi.c | 3 --- post/lib_ppc/rlwinm.c | 3 --- post/lib_ppc/rlwnm.c | 3 --- post/lib_ppc/srawi.c | 3 --- post/lib_ppc/store.c | 3 --- post/lib_ppc/string.c | 3 --- post/lib_ppc/three.c | 3 --- post/lib_ppc/threei.c | 3 --- post/lib_ppc/threex.c | 3 --- post/lib_ppc/two.c | 3 --- post/lib_ppc/twox.c | 3 --- post/post.c | 4 ---- post/tests.c | 4 ---- 58 files changed, 2 insertions(+), 182 deletions(-) (limited to 'post') diff --git a/post/board/lwmon/sysmon.c b/post/board/lwmon/sysmon.c index f61d59824..ea8b5a9c6 100644 --- a/post/board/lwmon/sysmon.c +++ b/post/board/lwmon/sysmon.c @@ -24,8 +24,6 @@ #include #include -#ifdef CONFIG_POST - /* * SYSMON test * @@ -328,4 +326,3 @@ int sysmon_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_SYSMON */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/dsp.c b/post/board/lwmon5/dsp.c index 7b53af992..a96ac7d68 100644 --- a/post/board/lwmon5/dsp.c +++ b/post/board/lwmon5/dsp.c @@ -24,11 +24,8 @@ #include -#ifdef CONFIG_POST - #include - #if CONFIG_POST & CFG_POST_DSP #include @@ -54,5 +51,3 @@ int dsp_post_test(int flags) } #endif /* CONFIG_POST & CFG_POST_DSP */ -#endif /* CONFIG_POST */ - diff --git a/post/board/lwmon5/dspic.c b/post/board/lwmon5/dspic.c index f1c9c153f..eb1c31ce3 100644 --- a/post/board/lwmon5/dspic.c +++ b/post/board/lwmon5/dspic.c @@ -24,8 +24,6 @@ #include -#ifdef CONFIG_POST - /* There are two tests for dsPIC currently implemented: * 1. dsPIC ready test. Done in board_early_init_f(). Only result verified here. * 2. dsPIC POST result test. This test gets dsPIC POST codes and version. @@ -105,5 +103,3 @@ int dspic_post_test(int flags) } #endif /* CONFIG_POST & CFG_POST_BSPEC2 */ -#endif /* CONFIG_POST */ - diff --git a/post/board/lwmon5/fpga.c b/post/board/lwmon5/fpga.c index 162174c3a..b48390ba9 100644 --- a/post/board/lwmon5/fpga.c +++ b/post/board/lwmon5/fpga.c @@ -23,8 +23,6 @@ */ #include -#ifdef CONFIG_POST - /* This test performs testing of FPGA SCRATCH register, * gets FPGA version and run get_ram_size() on FPGA memory */ @@ -94,5 +92,3 @@ int fpga_post_test(int flags) } #endif /* CONFIG_POST & CFG_POST_BSPEC3 */ -#endif /* CONFIG_POST */ - diff --git a/post/board/lwmon5/gdc.c b/post/board/lwmon5/gdc.c index aa1eee05f..bc166850f 100644 --- a/post/board/lwmon5/gdc.c +++ b/post/board/lwmon5/gdc.c @@ -23,8 +23,6 @@ */ #include -#ifdef CONFIG_POST - /* This test attempts to verify board GDC. A scratch register tested, then * simple memory test (get_ram_size()) run over GDC memory. */ @@ -96,5 +94,3 @@ int gdc_post_test(int flags) return ret; } #endif /* CONFIG_POST & CFG_POST_BSPEC4 */ -#endif /* CONFIG_POST */ - diff --git a/post/board/lwmon5/sysmon.c b/post/board/lwmon5/sysmon.c index f7e51a3cf..15661e3e0 100644 --- a/post/board/lwmon5/sysmon.c +++ b/post/board/lwmon5/sysmon.c @@ -25,8 +25,6 @@ #include #include -#ifdef CONFIG_POST - /* * SYSMON test * @@ -245,4 +243,3 @@ int sysmon_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_SYSMON */ -#endif /* CONFIG_POST */ diff --git a/post/board/lwmon5/watchdog.c b/post/board/lwmon5/watchdog.c index ad9e6f384..699266bbf 100644 --- a/post/board/lwmon5/watchdog.c +++ b/post/board/lwmon5/watchdog.c @@ -29,8 +29,6 @@ * trigger watchdog reset. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_WATCHDOG @@ -128,5 +126,3 @@ int lwmon5_watchdog_post_test(int flags) #endif /* CONFIG_POST & CFG_POST_WATCHDOG */ -#endif /* CONFIG_POST */ - diff --git a/post/board/netta/codec.c b/post/board/netta/codec.c index e8817520f..115e331fd 100644 --- a/post/board/netta/codec.c +++ b/post/board/netta/codec.c @@ -31,8 +31,6 @@ * in the board specific function. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_CODEC @@ -45,4 +43,3 @@ int codec_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_CODEC */ -#endif /* CONFIG_POST */ diff --git a/post/board/netta/dsp.c b/post/board/netta/dsp.c index 63531a2a4..dcef4e821 100644 --- a/post/board/netta/dsp.c +++ b/post/board/netta/dsp.c @@ -31,8 +31,6 @@ * in the board specific function. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_DSP @@ -45,4 +43,3 @@ int dsp_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_DSP */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/cache.c b/post/cpu/mpc8xx/cache.c index 501465c06..36965a167 100644 --- a/post/cpu/mpc8xx/cache.c +++ b/post/cpu/mpc8xx/cache.c @@ -29,8 +29,6 @@ * several test scenarios. */ -#ifdef CONFIG_POST - #include #include @@ -78,4 +76,3 @@ int cache_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_CACHE */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/cache_8xx.S b/post/cpu/mpc8xx/cache_8xx.S index 2d41b5566..a3fc39bda 100644 --- a/post/cpu/mpc8xx/cache_8xx.S +++ b/post/cpu/mpc8xx/cache_8xx.S @@ -22,7 +22,6 @@ #include -#ifdef CONFIG_POST #if defined(CONFIG_MPC823) || \ defined(CONFIG_MPC850) || \ defined(CONFIG_MPC855) || \ @@ -492,4 +491,3 @@ cache_post_test6_data: #endif /* CONFIG_MPC823 || MPC850 || MPC855 || MPC860 */ #endif /* CONFIG_POST & CFG_POST_CACHE */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/ether.c b/post/cpu/mpc8xx/ether.c index 8c87b5927..2fa5cf4ac 100644 --- a/post/cpu/mpc8xx/ether.c +++ b/post/cpu/mpc8xx/ether.c @@ -35,8 +35,6 @@ * TEST_NUM - number of tests */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_ETHER #if defined(CONFIG_8xx) @@ -627,5 +625,3 @@ int ether_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_ETHER */ - -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/spr.c b/post/cpu/mpc8xx/spr.c index 330b977f1..83f04da55 100644 --- a/post/cpu/mpc8xx/spr.c +++ b/post/cpu/mpc8xx/spr.c @@ -33,8 +33,6 @@ * corresponding table value. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_SPR @@ -149,4 +147,3 @@ int spr_post_test (int flags) return ret; } #endif /* CONFIG_POST & CFG_POST_SPR */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/uart.c b/post/cpu/mpc8xx/uart.c index fd97e3899..635debe8d 100644 --- a/post/cpu/mpc8xx/uart.c +++ b/post/cpu/mpc8xx/uart.c @@ -36,8 +36,6 @@ * TEST_NUM - number of tests */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_UART #if defined(CONFIG_8xx) @@ -556,5 +554,3 @@ int uart_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_UART */ - -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/usb.c b/post/cpu/mpc8xx/usb.c index 0c74cfa5d..58779812f 100644 --- a/post/cpu/mpc8xx/usb.c +++ b/post/cpu/mpc8xx/usb.c @@ -34,8 +34,6 @@ * Initialization Example. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_USB @@ -265,5 +263,3 @@ int usb_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_USB */ - -#endif /* CONFIG_POST */ diff --git a/post/cpu/mpc8xx/watchdog.c b/post/cpu/mpc8xx/watchdog.c index 48c4282e1..f94158aa6 100644 --- a/post/cpu/mpc8xx/watchdog.c +++ b/post/cpu/mpc8xx/watchdog.c @@ -33,8 +33,6 @@ * reboots, on the second iteration the test routine reports a success. */ -#ifdef CONFIG_POST - #include #include @@ -75,4 +73,3 @@ int watchdog_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_WATCHDOG */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/cache.c b/post/cpu/ppc4xx/cache.c index 466ca926b..be6a2bf54 100644 --- a/post/cpu/ppc4xx/cache.c +++ b/post/cpu/ppc4xx/cache.c @@ -31,8 +31,6 @@ * several test scenarios. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_CACHE @@ -122,4 +120,3 @@ int cache_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_CACHE */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/cache_4xx.S b/post/cpu/ppc4xx/cache_4xx.S index d5cb075d6..455ffa072 100644 --- a/post/cpu/ppc4xx/cache_4xx.S +++ b/post/cpu/ppc4xx/cache_4xx.S @@ -25,8 +25,6 @@ #include -#ifdef CONFIG_POST - #include #include #include @@ -489,4 +487,3 @@ cache_post_test_inst: blr #endif /* CONFIG_POST & CFG_POST_CACHE */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/denali_ecc.c b/post/cpu/ppc4xx/denali_ecc.c index 439f80d1f..12a1bbfa8 100644 --- a/post/cpu/ppc4xx/denali_ecc.c +++ b/post/cpu/ppc4xx/denali_ecc.c @@ -31,7 +31,7 @@ #include #include -#if defined(CONFIG_POST) && (defined(CONFIG_440EPX) || defined(CONFIG_440GRX)) +#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) #include @@ -268,4 +268,4 @@ int ecc_post_test(int flags) return ret; } #endif /* CONFIG_POST & CFG_POST_ECC */ -#endif /* defined(CONFIG_POST) && ... */ +#endif /* defined(CONFIG_440EPX) || defined(CONFIG_440GRX) */ diff --git a/post/cpu/ppc4xx/ether.c b/post/cpu/ppc4xx/ether.c index 4ac749134..ccbfcf91a 100644 --- a/post/cpu/ppc4xx/ether.c +++ b/post/cpu/ppc4xx/ether.c @@ -37,8 +37,6 @@ * TEST_NUM - number of tests */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_ETHER @@ -430,4 +428,3 @@ out_free: } #endif /* CONFIG_POST & CFG_POST_ETHER */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/fpu.c b/post/cpu/ppc4xx/fpu.c index 0c26fe00e..fff416997 100644 --- a/post/cpu/ppc4xx/fpu.c +++ b/post/cpu/ppc4xx/fpu.c @@ -25,7 +25,6 @@ #include -#ifdef CONFIG_POST #if defined(CONFIG_440EP) || \ defined(CONFIG_440EPX) @@ -56,4 +55,3 @@ void fpu_enable(void) } #endif -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/spr.c b/post/cpu/ppc4xx/spr.c index 37c95598f..6152eb21a 100644 --- a/post/cpu/ppc4xx/spr.c +++ b/post/cpu/ppc4xx/spr.c @@ -35,8 +35,6 @@ * corresponding table value. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_SPR @@ -199,4 +197,3 @@ int spr_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_SPR */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/uart.c b/post/cpu/ppc4xx/uart.c index f47b48e9d..27cfb9159 100644 --- a/post/cpu/ppc4xx/uart.c +++ b/post/cpu/ppc4xx/uart.c @@ -32,8 +32,6 @@ * characters are transmitted. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_UART @@ -389,4 +387,3 @@ int uart_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_UART */ -#endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/watchdog.c b/post/cpu/ppc4xx/watchdog.c index bd4f4c985..7fdecb485 100644 --- a/post/cpu/ppc4xx/watchdog.c +++ b/post/cpu/ppc4xx/watchdog.c @@ -35,8 +35,6 @@ * reboots, on the second iteration the test routine reports a success. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_WATCHDOG @@ -68,4 +66,3 @@ int watchdog_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_WATCHDOG */ -#endif /* CONFIG_POST */ diff --git a/post/drivers/i2c.c b/post/drivers/i2c.c index 1b2e64471..f54fe9970 100644 --- a/post/drivers/i2c.c +++ b/post/drivers/i2c.c @@ -23,8 +23,6 @@ #include -#ifdef CONFIG_POST - /* * I2C test * @@ -91,4 +89,3 @@ int i2c_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_I2C */ -#endif /* CONFIG_POST */ diff --git a/post/drivers/memory.c b/post/drivers/memory.c index fb969856b..e94d92c08 100644 --- a/post/drivers/memory.c +++ b/post/drivers/memory.c @@ -150,8 +150,6 @@ * the whole RAM. */ -#ifdef CONFIG_POST - #include #include @@ -483,4 +481,3 @@ int memory_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_MEMORY */ -#endif /* CONFIG_POST */ diff --git a/post/drivers/rtc.c b/post/drivers/rtc.c index 7d4f9b88e..4afe8e67e 100644 --- a/post/drivers/rtc.c +++ b/post/drivers/rtc.c @@ -38,8 +38,6 @@ * nonleap-years. */ -#ifdef CONFIG_POST - #include #include @@ -180,4 +178,3 @@ int rtc_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_RTC */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/andi.c b/post/lib_ppc/andi.c index 7ddf2ab2f..e3315bf15 100644 --- a/post/lib_ppc/andi.c +++ b/post/lib_ppc/andi.c @@ -32,8 +32,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -120,4 +118,3 @@ int cpu_post_test_andi (void) } #endif -#endif diff --git a/post/lib_ppc/asm.S b/post/lib_ppc/asm.S index 12791762b..6220ed2bb 100644 --- a/post/lib_ppc/asm.S +++ b/post/lib_ppc/asm.S @@ -22,8 +22,6 @@ #include -#ifdef CONFIG_POST - #include #include #include @@ -358,4 +356,3 @@ cpu_post_complex_2_loop: blr #endif -#endif diff --git a/post/lib_ppc/b.c b/post/lib_ppc/b.c index 6e276c48d..45b9ff26e 100644 --- a/post/lib_ppc/b.c +++ b/post/lib_ppc/b.c @@ -37,8 +37,6 @@ * linked in U-Boot at build time. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -194,4 +192,3 @@ int cpu_post_test_b (void) } #endif -#endif diff --git a/post/lib_ppc/cmp.c b/post/lib_ppc/cmp.c index 789a24cb7..89f754a0b 100644 --- a/post/lib_ppc/cmp.c +++ b/post/lib_ppc/cmp.c @@ -36,8 +36,6 @@ * the result in and the expected result. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -130,4 +128,3 @@ int cpu_post_test_cmp (void) } #endif -#endif diff --git a/post/lib_ppc/cmpi.c b/post/lib_ppc/cmpi.c index e0c2aaff8..0afdd7115 100644 --- a/post/lib_ppc/cmpi.c +++ b/post/lib_ppc/cmpi.c @@ -36,8 +36,6 @@ * the result in and the expected result. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -130,4 +128,3 @@ int cpu_post_test_cmpi (void) } #endif -#endif diff --git a/post/lib_ppc/complex.c b/post/lib_ppc/complex.c index 033584bec..271392a0e 100644 --- a/post/lib_ppc/complex.c +++ b/post/lib_ppc/complex.c @@ -31,8 +31,6 @@ * calculations, but probably under different timing conditions, etc. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -123,4 +121,3 @@ int cpu_post_test_complex (void) } #endif -#endif diff --git a/post/lib_ppc/cpu.c b/post/lib_ppc/cpu.c index 4ab6d2dc0..5c7f76191 100644 --- a/post/lib_ppc/cpu.c +++ b/post/lib_ppc/cpu.c @@ -32,8 +32,6 @@ * For more details refer to post/cpu/ *.c files. */ -#ifdef CONFIG_POST - #include #include #include @@ -147,4 +145,3 @@ int cpu_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_CPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/cr.c b/post/lib_ppc/cr.c index da6ef3745..0bd9e748f 100644 --- a/post/lib_ppc/cr.c +++ b/post/lib_ppc/cr.c @@ -46,8 +46,6 @@ * expected one. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -353,4 +351,3 @@ int cpu_post_test_cr (void) } #endif -#endif diff --git a/post/lib_ppc/fpu/20001122-1.c b/post/lib_ppc/fpu/20001122-1.c index f689b8232..dece61483 100644 --- a/post/lib_ppc/fpu/20001122-1.c +++ b/post/lib_ppc/fpu/20001122-1.c @@ -26,8 +26,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -59,4 +57,3 @@ int fpu_post_test_math1 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/20010114-2.c b/post/lib_ppc/fpu/20010114-2.c index 6e60507f9..8a172174c 100644 --- a/post/lib_ppc/fpu/20010114-2.c +++ b/post/lib_ppc/fpu/20010114-2.c @@ -26,8 +26,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -63,4 +61,3 @@ int fpu_post_test_math2 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/20010226-1.c b/post/lib_ppc/fpu/20010226-1.c index b2c47e365..f366252e6 100644 --- a/post/lib_ppc/fpu/20010226-1.c +++ b/post/lib_ppc/fpu/20010226-1.c @@ -26,8 +26,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -51,4 +49,3 @@ int fpu_post_test_math3 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/980619-1.c b/post/lib_ppc/fpu/980619-1.c index 990aa0c98..7f26482a5 100644 --- a/post/lib_ppc/fpu/980619-1.c +++ b/post/lib_ppc/fpu/980619-1.c @@ -26,8 +26,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -57,4 +55,3 @@ int fpu_post_test_math4 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/acc1.c b/post/lib_ppc/fpu/acc1.c index 4cecbf6a4..921282e8b 100644 --- a/post/lib_ppc/fpu/acc1.c +++ b/post/lib_ppc/fpu/acc1.c @@ -26,8 +26,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -54,4 +52,3 @@ int fpu_post_test_math5 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/compare-fp-1.c b/post/lib_ppc/fpu/compare-fp-1.c index d866ad5a3..be8f6208a 100644 --- a/post/lib_ppc/fpu/compare-fp-1.c +++ b/post/lib_ppc/fpu/compare-fp-1.c @@ -28,8 +28,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -222,4 +220,3 @@ int fpu_post_test_math6 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/fpu.c b/post/lib_ppc/fpu/fpu.c index 07dcba8cc..9ddb67a21 100644 --- a/post/lib_ppc/fpu/fpu.c +++ b/post/lib_ppc/fpu/fpu.c @@ -34,8 +34,6 @@ * For more details refer to post/cpu/ *.c files. */ -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -89,4 +87,3 @@ int fpu_post_test (int flags) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/fpu/mul-subnormal-single-1.c b/post/lib_ppc/fpu/mul-subnormal-single-1.c index 67f48da33..7e6fe87b0 100644 --- a/post/lib_ppc/fpu/mul-subnormal-single-1.c +++ b/post/lib_ppc/fpu/mul-subnormal-single-1.c @@ -28,8 +28,6 @@ #include -#ifdef CONFIG_POST - #include #if CONFIG_POST & CFG_POST_FPU @@ -100,4 +98,3 @@ int fpu_post_test_math7 (void) } #endif /* CONFIG_POST & CFG_POST_FPU */ -#endif /* CONFIG_POST */ diff --git a/post/lib_ppc/load.c b/post/lib_ppc/load.c index 393c56830..86bc2234c 100644 --- a/post/lib_ppc/load.c +++ b/post/lib_ppc/load.c @@ -41,8 +41,6 @@ * register (it must change for "load with update" instructions). */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -252,4 +250,3 @@ int cpu_post_test_load (void) } #endif -#endif diff --git a/post/lib_ppc/multi.c b/post/lib_ppc/multi.c index 872438478..5d3f58428 100644 --- a/post/lib_ppc/multi.c +++ b/post/lib_ppc/multi.c @@ -33,8 +33,6 @@ * of the source and target buffers are then compared. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -78,4 +76,3 @@ int cpu_post_test_multi (void) } #endif -#endif diff --git a/post/lib_ppc/rlwimi.c b/post/lib_ppc/rlwimi.c index f65f79a8e..1d8e61ec1 100644 --- a/post/lib_ppc/rlwimi.c +++ b/post/lib_ppc/rlwimi.c @@ -32,8 +32,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -159,4 +157,3 @@ int cpu_post_test_rlwimi (void) } #endif -#endif diff --git a/post/lib_ppc/rlwinm.c b/post/lib_ppc/rlwinm.c index e240c41b1..113e79d00 100644 --- a/post/lib_ppc/rlwinm.c +++ b/post/lib_ppc/rlwinm.c @@ -32,8 +32,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -152,4 +150,3 @@ int cpu_post_test_rlwinm (void) } #endif -#endif diff --git a/post/lib_ppc/rlwnm.c b/post/lib_ppc/rlwnm.c index 523cf4da5..a6684bf60 100644 --- a/post/lib_ppc/rlwnm.c +++ b/post/lib_ppc/rlwnm.c @@ -32,8 +32,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -162,4 +160,3 @@ int cpu_post_test_rlwnm (void) } #endif -#endif diff --git a/post/lib_ppc/srawi.c b/post/lib_ppc/srawi.c index 91c82c915..8c70007c5 100644 --- a/post/lib_ppc/srawi.c +++ b/post/lib_ppc/srawi.c @@ -32,8 +32,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -153,4 +151,3 @@ int cpu_post_test_srawi (void) } #endif -#endif diff --git a/post/lib_ppc/store.c b/post/lib_ppc/store.c index f495bf2aa..09ec48554 100644 --- a/post/lib_ppc/store.c +++ b/post/lib_ppc/store.c @@ -41,8 +41,6 @@ * with update" instructions). */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -232,4 +230,3 @@ int cpu_post_test_store (void) } #endif -#endif diff --git a/post/lib_ppc/string.c b/post/lib_ppc/string.c index bd83bd136..b2daa8804 100644 --- a/post/lib_ppc/string.c +++ b/post/lib_ppc/string.c @@ -33,8 +33,6 @@ * of the source and target buffers are then compared. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -103,4 +101,3 @@ int cpu_post_test_string (void) } #endif -#endif diff --git a/post/lib_ppc/three.c b/post/lib_ppc/three.c index c2d747604..a7f1a866f 100644 --- a/post/lib_ppc/three.c +++ b/post/lib_ppc/three.c @@ -35,8 +35,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -256,4 +254,3 @@ int cpu_post_test_three (void) } #endif -#endif diff --git a/post/lib_ppc/threei.c b/post/lib_ppc/threei.c index 79f01789c..bbb4f50b7 100644 --- a/post/lib_ppc/threei.c +++ b/post/lib_ppc/threei.c @@ -34,8 +34,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -134,4 +132,3 @@ int cpu_post_test_threei (void) } #endif -#endif diff --git a/post/lib_ppc/threex.c b/post/lib_ppc/threex.c index 2c7206384..6aac93789 100644 --- a/post/lib_ppc/threex.c +++ b/post/lib_ppc/threex.c @@ -35,8 +35,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -226,4 +224,3 @@ int cpu_post_test_threex (void) } #endif -#endif diff --git a/post/lib_ppc/two.c b/post/lib_ppc/two.c index cfbac5e62..3d6b3c016 100644 --- a/post/lib_ppc/two.c +++ b/post/lib_ppc/two.c @@ -35,8 +35,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -173,4 +171,3 @@ int cpu_post_test_two (void) } #endif -#endif diff --git a/post/lib_ppc/twox.c b/post/lib_ppc/twox.c index 48d9954ca..7417a3680 100644 --- a/post/lib_ppc/twox.c +++ b/post/lib_ppc/twox.c @@ -35,8 +35,6 @@ * different sets of operand registers and result registers. */ -#ifdef CONFIG_POST - #include #include "cpu_asm.h" @@ -173,4 +171,3 @@ int cpu_post_test_twox (void) } #endif -#endif diff --git a/post/post.c b/post/post.c index 1df0657d8..c016c3ae4 100644 --- a/post/post.c +++ b/post/post.c @@ -30,8 +30,6 @@ #include #endif -#ifdef CONFIG_POST - DECLARE_GLOBAL_DATA_PTR; #define POST_MAX_NUMBER 32 @@ -442,5 +440,3 @@ unsigned long post_time_ms (unsigned long base) return 0; /* Not implemented yet */ #endif } - -#endif /* CONFIG_POST */ diff --git a/post/tests.c b/post/tests.c index 53d01e355..36473e311 100644 --- a/post/tests.c +++ b/post/tests.c @@ -27,8 +27,6 @@ #include -#ifdef CONFIG_POST - #include extern int cache_post_test (int flags); @@ -278,5 +276,3 @@ struct post_test post_list[] = }; unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test); - -#endif /* CONFIG_POST */ -- cgit v1.2.3 From 2d2b994a30bb100774dc747ae9865b7f95285a88 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Mon, 31 Mar 2008 10:51:37 +0200 Subject: POST: move CONFIG_POST to Makefiles Introduce the new logical option CONFIG_HAS_POST which is set when the platform has CONFIG_POST set. Use CONFIG_HAS_POST in the post/ Makefiles to determine should the POST libs be compiled for the selected target platform, or not. To avoid breaking u-boot linking process, the empty post/libpost.a file is created for platforms which do not have POSTs. Signed-off-by: Yuri Tikhonov Signed-off-by: Wolfgang Denk --- Makefile | 10 +--------- include/common.h | 11 +++++++++++ post/Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++---- post/board/lwmon5/Makefile | 3 ++- post/cpu/ppc4xx/Makefile | 5 +++-- post/drivers/Makefile | 6 ++---- post/lib_ppc/Makefile | 11 +++++------ post/lib_ppc/fpu/Makefile | 6 +++--- post/rules.mk | 2 ++ 9 files changed, 72 insertions(+), 29 deletions(-) (limited to 'post') diff --git a/Makefile b/Makefile index 4fde69967..b2b59b230 100644 --- a/Makefile +++ b/Makefile @@ -233,18 +233,10 @@ LIBS += drivers/rtc/librtc.a LIBS += drivers/serial/libserial.a LIBS += drivers/usb/libusb.a LIBS += drivers/video/libvideo.a -LIBS += post/libpost.a post/drivers/libpostdrivers.a -LIBS += $(shell if [ -d post/lib_$(ARCH) ]; then echo \ - "post/lib_$(ARCH)/libpost$(ARCH).a"; fi) -LIBS += $(shell if [ -d post/lib_$(ARCH)/fpu ]; then echo \ - "post/lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi) -LIBS += $(shell if [ -d post/cpu/$(CPU) ]; then echo \ - "post/cpu/$(CPU)/libpost$(CPU).a"; fi) -LIBS += $(shell if [ -d post/board/$(BOARDDIR) ]; then echo \ - "post/board/$(BOARDDIR)/libpost$(BOARD).a"; fi) LIBS += common/libcommon.a LIBS += libfdt/libfdt.a LIBS += api/libapi.a +LIBS += post/libpost.a LIBS := $(addprefix $(obj),$(LIBS)) .PHONY : $(LIBS) $(VERSION_FILE) diff --git a/include/common.h b/include/common.h index 673afdd15..8d435b97f 100644 --- a/include/common.h +++ b/include/common.h @@ -672,4 +672,15 @@ void inline show_boot_progress (int val); #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/* Multicore arch functions */ +#ifdef CONFIG_MP +int cpu_status(int nr); +int cpu_reset(int nr); +int cpu_release(int nr, int argc, char *argv[]); +#endif + +#ifdef CONFIG_POST +#define CONFIG_HAS_POST +#endif + #endif /* __COMMON_H_ */ diff --git a/post/Makefile b/post/Makefile index f32af9516..02b51544c 100644 --- a/post/Makefile +++ b/post/Makefile @@ -21,11 +21,50 @@ # MA 02111-1307 USA # +include $(TOPDIR)/include/autoconf.mk -SUBDIRS = drivers cpu lib_$(ARCH) board/$(BOARDDIR) +LIB = libpost.a +GPLIB-$(CONFIG_HAS_POST) += libgenpost.a +COBJS-$(CONFIG_HAS_POST) += post.o tests.o -LIB = libpost.a +SPLIB-$(CONFIG_HAS_POST) = drivers/libpostdrivers.a +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH) ]; then echo \ + "lib_$(ARCH)/libpost$(ARCH).a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d lib_$(ARCH)/fpu ]; then echo \ + "lib_$(ARCH)/fpu/libpost$(ARCH)fpu.a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d cpu/$(CPU) ]; then echo \ + "cpu/$(CPU)/libpost$(CPU).a"; fi) +SPLIB-$(CONFIG_HAS_POST) += $(shell if [ -d board/$(BOARD) ]; then echo \ + "board/$(BOARD)/libpost$(BOARD).a"; fi) -COBJS = post.o tests.o +GPLIB := $(GPLIB-y) +SPLIB := $(SPLIB-y) +COBJS := $(COBJS-y) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +LIB := $(obj)$(LIB) -include $(TOPDIR)/post/rules.mk +all: $(LIB) + +# generic POST library +$(GPLIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +# specific POST libraries +$(SPLIB): $(obj).depend + $(MAKE) -C $(dir $(subst $(obj),,$@)) + +# the POST lib archive +$(LIB): $(GPLIB) $(SPLIB) + (echo create $(LIB); for lib in $(GPLIB) $(SPLIB) ; \ + do echo addlib $$lib; done; echo save) \ + | $(AR) -M + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile index 5a92d1ce7..3cb6426e4 100644 --- a/post/board/lwmon5/Makefile +++ b/post/board/lwmon5/Makefile @@ -20,9 +20,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA +include $(TOPDIR)/include/autoconf.mk LIB = libpostlwmon5.a -COBJS = sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o +COBJS-$(CONFIG_HAS_POST) += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o include $(TOPDIR)/post/rules.mk diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile index e3f44b777..7b13413b9 100644 --- a/post/cpu/ppc4xx/Makefile +++ b/post/cpu/ppc4xx/Makefile @@ -20,10 +20,11 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # +include $(TOPDIR)/include/autoconf.mk LIB = libpostppc4xx.a -AOBJS = cache_4xx.o -COBJS = cache.o denali_ecc.o ether.o fpu.o spr.o uart.o watchdog.o +AOBJS-$(CONFIG_HAS_POST) += cache_4xx.o +COBJS-$(CONFIG_HAS_POST) += cache.o denali_ecc.o ether.o fpu.o spr.o uart.o watchdog.o include $(TOPDIR)/post/rules.mk diff --git a/post/drivers/Makefile b/post/drivers/Makefile index cb2f1deac..0b6cdf58c 100644 --- a/post/drivers/Makefile +++ b/post/drivers/Makefile @@ -20,12 +20,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - - -SUBDIRS = +include $(TOPDIR)/config.mk LIB = libpostdrivers.a -COBJS = i2c.o memory.o rtc.o +COBJS-$(CONFIG_HAS_POST) += i2c.o memory.o rtc.o include $(TOPDIR)/post/rules.mk diff --git a/post/lib_ppc/Makefile b/post/lib_ppc/Makefile index 9f1b329d7..bd7a23299 100644 --- a/post/lib_ppc/Makefile +++ b/post/lib_ppc/Makefile @@ -20,14 +20,13 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - -SUBDIRS = fpu +include $(TOPDIR)/config.mk LIB = libpostppc.a -AOBJS = asm.o -COBJS = cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o -COBJS += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o -COBJS += store.o load.o cr.o b.o multi.o string.o complex.o +AOBJS-$(CONFIG_HAS_POST) += asm.o +COBJS-$(CONFIG_HAS_POST) += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o +COBJS-$(CONFIG_HAS_POST) += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o +COBJS-$(CONFIG_HAS_POST) += store.o load.o cr.o b.o multi.o string.o complex.o include $(TOPDIR)/post/rules.mk diff --git a/post/lib_ppc/fpu/Makefile b/post/lib_ppc/fpu/Makefile index 82646c80d..db435931d 100644 --- a/post/lib_ppc/fpu/Makefile +++ b/post/lib_ppc/fpu/Makefile @@ -20,12 +20,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # - +include $(TOPDIR)/config.mk LIB = libpostppcfpu.a -COBJS += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o -COBJS += acc1.o compare-fp-1.o mul-subnormal-single-1.o +COBJS-$(CONFIG_HAS_POST) += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o +COBJS-$(CONFIG_HAS_POST) += acc1.o compare-fp-1.o mul-subnormal-single-1.o include $(TOPDIR)/post/rules.mk diff --git a/post/rules.mk b/post/rules.mk index e2c73c600..94e72bec6 100644 --- a/post/rules.mk +++ b/post/rules.mk @@ -23,6 +23,8 @@ include $(TOPDIR)/config.mk +COBJS := $(COBJS-y) +AOBJS := $(AOBJS-y) SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS)) LIB := $(obj)$(LIB) -- cgit v1.2.3