diff options
Diffstat (limited to 'board/gdsys/405ep')
-rw-r--r-- | board/gdsys/405ep/405ep.c | 45 | ||||
-rw-r--r-- | board/gdsys/405ep/405ep.h | 10 | ||||
-rw-r--r-- | board/gdsys/405ep/Makefile | 1 | ||||
-rw-r--r-- | board/gdsys/405ep/dlvision-10g.c | 80 | ||||
-rw-r--r-- | board/gdsys/405ep/io.c | 79 | ||||
-rw-r--r-- | board/gdsys/405ep/iocon.c | 70 | ||||
-rw-r--r-- | board/gdsys/405ep/neo.c | 161 |
7 files changed, 377 insertions, 69 deletions
diff --git a/board/gdsys/405ep/405ep.c b/board/gdsys/405ep/405ep.c index 8b80533..bc9b7d0 100644 --- a/board/gdsys/405ep/405ep.c +++ b/board/gdsys/405ep/405ep.c @@ -28,12 +28,9 @@ #include <asm/ppc4xx-gpio.h> #include <asm/global_data.h> +#include "405ep.h" #include <gdsys_fpga.h> -#define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) -#define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) -#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) - #define REFLECTION_TESTPATTERN 0xdede #define REFLECTION_TESTPATTERN_INV (~REFLECTION_TESTPATTERN & 0xffff) @@ -55,7 +52,6 @@ void print_fpga_state(unsigned dev) int board_early_init_f(void) { unsigned k; - unsigned ctr; for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) gd->fpga_state[k] = 0; @@ -73,26 +69,29 @@ int board_early_init_f(void) * -> ca. 15 us */ mtebc(EBC0_CFG, 0xa8400000); /* ebc always driven */ + return 0; +} - /* - * setup io-latches for reset - */ - out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET); - out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET); +int board_early_init_r(void) +{ + unsigned k; + unsigned ctr; - /* - * set "startup-finished"-gpios - */ - gpio_write_bit(21, 0); - gpio_write_bit(22, 1); + for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) + gd->fpga_state[k] = 0; /* - * wait for fpga-done + * reset FPGA */ + gd405ep_init(); + + gd405ep_set_fpga_reset(1); + + gd405ep_setup_hw(); + for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) { ctr = 0; - while (!(in_le16((void *)LATCH2_BASE) - & CONFIG_SYS_FPGA_DONE(k))) { + while (!gd405ep_get_fpga_done(k)) { udelay(100000); if (ctr++ > 5) { gd->fpga_state[k] |= FPGA_STATE_DONE_FAILED; @@ -101,15 +100,13 @@ int board_early_init_f(void) } } - /* - * setup io-latches for boot (stop reset) - */ udelay(10); - out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT); - out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT); + + gd405ep_set_fpga_reset(0); for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k) { - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(k); + struct ihs_fpga *fpga = + (struct ihs_fpga *)CONFIG_SYS_FPGA_BASE(k); #ifdef CONFIG_SYS_FPGA_NO_RFL_HI u16 *reflection_target = &fpga->reflection_low; #else diff --git a/board/gdsys/405ep/405ep.h b/board/gdsys/405ep/405ep.h new file mode 100644 index 0000000..5647dbc --- /dev/null +++ b/board/gdsys/405ep/405ep.h @@ -0,0 +1,10 @@ +#ifndef __405EP_H_ +#define __405EP_H_ + +/* functions to be provided by board implementation */ +void gd405ep_init(void); +void gd405ep_set_fpga_reset(unsigned state); +void gd405ep_setup_hw(void); +int gd405ep_get_fpga_done(unsigned fpga); + +#endif /* __405EP_H_ */ diff --git a/board/gdsys/405ep/Makefile b/board/gdsys/405ep/Makefile index feb5cec..38e5ea4 100644 --- a/board/gdsys/405ep/Makefile +++ b/board/gdsys/405ep/Makefile @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o +COBJS-$(CONFIG_NEO) += neo.o COBJS-$(CONFIG_IO) += io.o COBJS-$(CONFIG_IOCON) += iocon.o COBJS-$(CONFIG_DLVISION_10G) += dlvision-10g.o diff --git a/board/gdsys/405ep/dlvision-10g.c b/board/gdsys/405ep/dlvision-10g.c index f55afbd..644493b 100644 --- a/board/gdsys/405ep/dlvision-10g.c +++ b/board/gdsys/405ep/dlvision-10g.c @@ -26,16 +26,20 @@ #include <asm/processor.h> #include <asm/io.h> #include <asm/ppc4xx-gpio.h> +#include <dtt.h> +#include "405ep.h" #include <gdsys_fpga.h> #include "../common/osd.h" +#define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) +#define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) #define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) -#define LATCH2_MC2_PRESENT_N 0x0080 - #define LATCH3_BASE (CONFIG_SYS_LATCH_BASE + 0x300) +#define LATCH2_MC2_PRESENT_N 0x0080 + enum { UNITTYPE_VIDEO_USER = 0, UNITTYPE_MAIN_USER = 1, @@ -46,6 +50,8 @@ enum { enum { HWVER_101 = 0, HWVER_110 = 1, + HWVER_120 = 2, + HWVER_130 = 3, }; enum { @@ -65,6 +71,14 @@ enum { RAM_DDR2_64 = 2, }; +int misc_init_r(void) +{ + /* startup fans */ + dtt_init(); + + return 0; +} + static unsigned int get_hwver(void) { u16 latch3 = in_le16((void *)LATCH3_BASE); @@ -81,7 +95,7 @@ static unsigned int get_mc2_present(void) static void print_fpga_info(unsigned dev) { - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(dev); + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(dev); u16 versions = in_le16(&fpga->versions); u16 fpga_version = in_le16(&fpga->fpga_version); u16 fpga_features = in_le16(&fpga->fpga_features); @@ -146,7 +160,15 @@ static void print_fpga_info(unsigned dev) break; case HWVER_110: - printf(" HW-Ver 1.10\n"); + printf(" HW-Ver 1.10-1.12\n"); + break; + + case HWVER_120: + printf(" HW-Ver 1.20\n"); + break; + + case HWVER_130: + printf(" HW-Ver 1.30\n"); break; default: @@ -223,32 +245,31 @@ static void print_fpga_info(unsigned dev) */ int checkboard(void) { - char buf[64]; - int i = getenv_f("serial#", buf, sizeof(buf)); + char *s = getenv("serial#"); - printf("Board: "); + puts("Board: "); - printf("DLVision 10G"); + puts("DLVision 10G"); - if (i > 0) { + if (s != NULL) { puts(", serial# "); - puts(buf); + puts(s); } puts("\n"); - print_fpga_info(0); - if (get_mc2_present()) - print_fpga_info(1); - return 0; } int last_stage_init(void) { - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0); + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); u16 versions = in_le16(&fpga->versions); + print_fpga_info(0); + if (get_mc2_present()) + print_fpga_info(1); + if (((versions >> 4) & 0x000f) != UNITTYPE_MAIN_USER) return 0; @@ -261,3 +282,32 @@ int last_stage_init(void) return 0; } + +void gd405ep_init(void) +{ +} + +void gd405ep_set_fpga_reset(unsigned state) +{ + if (state) { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET); + } else { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT); + } +} + +void gd405ep_setup_hw(void) +{ + /* + * set "startup-finished"-gpios + */ + gpio_write_bit(21, 0); + gpio_write_bit(22, 1); +} + +int gd405ep_get_fpga_done(unsigned fpga) +{ + return in_le16((void *)LATCH2_BASE) & CONFIG_SYS_FPGA_DONE(fpga); +} diff --git a/board/gdsys/405ep/io.c b/board/gdsys/405ep/io.c index db1ea7f..070dcbb 100644 --- a/board/gdsys/405ep/io.c +++ b/board/gdsys/405ep/io.c @@ -27,10 +27,16 @@ #include <asm/io.h> #include <asm/ppc4xx-gpio.h> +#include <dtt.h> #include <miiphy.h> +#include "405ep.h" #include <gdsys_fpga.h> +#define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) +#define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) +#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) + #define PHYREG_CONTROL 0 #define PHYREG_PAGE_ADDRESS 22 #define PHYREG_PG0_COPPER_SPECIFIC_CONTROL_1 16 @@ -47,6 +53,14 @@ enum { HWVER_122 = 3, }; +int misc_init_r(void) +{ + /* startup fans */ + dtt_init(); + + return 0; +} + int configure_gbit_phy(unsigned char addr) { unsigned short value; @@ -87,9 +101,23 @@ err_out: */ int checkboard(void) { - char buf[64]; - int i = getenv_f("serial#", buf, sizeof(buf)); - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0); + char *s = getenv("serial#"); + + puts("Board: CATCenter Io"); + + if (s != NULL) { + puts(", serial# "); + puts(s); + } + + puts("\n"); + + return 0; +} + +static void print_fpga_info(void) +{ + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); u16 versions = in_le16(&fpga->versions); u16 fpga_version = in_le16(&fpga->fpga_version); u16 fpga_features = in_le16(&fpga->fpga_features); @@ -103,15 +131,7 @@ int checkboard(void) feature_channels = fpga_features & 0x007f; feature_expansion = fpga_features & (1<<15); - printf("Board: "); - - printf("CATCenter Io"); - - if (i > 0) { - puts(", serial# "); - puts(buf); - } - puts("\n "); + puts("FPGA: "); switch (unit_type) { case UNITTYPE_CCD_SWITCH: @@ -152,8 +172,6 @@ int checkboard(void) printf(" %d channel(s)", feature_channels); printf(", expansion %ssupported\n", feature_expansion ? "" : "un"); - - return 0; } /* @@ -161,9 +179,11 @@ int checkboard(void) */ int last_stage_init(void) { - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0); + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); unsigned int k; + print_fpga_info(); + miiphy_register(CONFIG_SYS_GBIT_MII_BUSNAME, bb_miiphy_read, bb_miiphy_write); @@ -175,3 +195,32 @@ int last_stage_init(void) return 0; } + +void gd405ep_init(void) +{ +} + +void gd405ep_set_fpga_reset(unsigned state) +{ + if (state) { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET); + } else { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT); + } +} + +void gd405ep_setup_hw(void) +{ + /* + * set "startup-finished"-gpios + */ + gpio_write_bit(21, 0); + gpio_write_bit(22, 1); +} + +int gd405ep_get_fpga_done(unsigned fpga) +{ + return in_le16((void *)LATCH2_BASE) & CONFIG_SYS_FPGA_DONE(fpga); +} diff --git a/board/gdsys/405ep/iocon.c b/board/gdsys/405ep/iocon.c index ce53340..0fc7db2 100644 --- a/board/gdsys/405ep/iocon.c +++ b/board/gdsys/405ep/iocon.c @@ -27,10 +27,15 @@ #include <asm/io.h> #include <asm/ppc4xx-gpio.h> +#include "405ep.h" #include <gdsys_fpga.h> #include "../common/osd.h" +#define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) +#define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) +#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) + enum { UNITTYPE_MAIN_SERVER = 0, UNITTYPE_MAIN_USER = 1, @@ -69,9 +74,25 @@ enum { */ int checkboard(void) { - char buf[64]; - int i = getenv_f("serial#", buf, sizeof(buf)); - ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0); + char *s = getenv("serial#"); + + puts("Board: "); + + puts("IoCon"); + + if (s != NULL) { + puts(", serial# "); + puts(s); + } + + puts("\n"); + + return 0; +} + +static void print_fpga_info(void) +{ + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); u16 versions = in_le16(&fpga->versions); u16 fpga_version = in_le16(&fpga->fpga_version); u16 fpga_features = in_le16(&fpga->fpga_features); @@ -95,16 +116,6 @@ int checkboard(void) feature_carriers = (fpga_features & 0x000c) >> 2; feature_video_channels = fpga_features & 0x0003; - printf("Board: "); - - printf("IoCon"); - - if (i > 0) { - puts(", serial# "); - puts(buf); - } - puts("\n "); - switch (unit_type) { case UNITTYPE_MAIN_USER: printf("Mainchannel"); @@ -205,12 +216,12 @@ int checkboard(void) printf(", %d carrier(s)", feature_carriers); printf(", %d video channel(s)\n", feature_video_channels); - - return 0; } int last_stage_init(void) { + print_fpga_info(); + return osd_probe(0); } @@ -231,3 +242,32 @@ int fpga_gpio_get(int pin) { return in_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x14)) & pin; } + +void gd405ep_init(void) +{ +} + +void gd405ep_set_fpga_reset(unsigned state) +{ + if (state) { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET); + } else { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT); + } +} + +void gd405ep_setup_hw(void) +{ + /* + * set "startup-finished"-gpios + */ + gpio_write_bit(21, 0); + gpio_write_bit(22, 1); +} + +int gd405ep_get_fpga_done(unsigned fpga) +{ + return in_le16((void *)LATCH2_BASE) & CONFIG_SYS_FPGA_DONE(fpga); +} diff --git a/board/gdsys/405ep/neo.c b/board/gdsys/405ep/neo.c new file mode 100644 index 0000000..d336e55 --- /dev/null +++ b/board/gdsys/405ep/neo.c @@ -0,0 +1,161 @@ +/* + * (C) Copyright 2011 + * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de + * + * 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 <common.h> +#include <command.h> +#include <asm/processor.h> +#include <asm/io.h> +#include <asm/ppc4xx-gpio.h> +#include <dtt.h> + +#include "405ep.h" +#include <gdsys_fpga.h> + +#define LATCH0_BASE (CONFIG_SYS_LATCH_BASE) +#define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100) +#define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200) + +enum { + UNITTYPE_CCX16 = 1, + UNITTYPE_CCIP216 = 2, +}; + +enum { + HWVER_300 = 3, +}; + +int misc_init_r(void) +{ + /* startup fans */ + dtt_init(); + + return 0; +} + +int checkboard(void) +{ + char *s = getenv("serial#"); + + puts("Board: CATCenter Neo"); + + if (s != NULL) { + puts(", serial# "); + puts(s); + } + + puts("\n"); + + return 0; +} + +static void print_fpga_info(void) +{ + struct ihs_fpga *fpga = (struct ihs_fpga *) CONFIG_SYS_FPGA_BASE(0); + u16 versions = in_le16(&fpga->versions); + u16 fpga_version = in_le16(&fpga->fpga_version); + u16 fpga_features = in_le16(&fpga->fpga_features); + int fpga_state = get_fpga_state(0); + unsigned unit_type; + unsigned hardware_version; + unsigned feature_channels; + + puts("FPGA: "); + if (fpga_state & FPGA_STATE_DONE_FAILED) { + printf(" done timed out\n"); + return; + } + + if (fpga_state & FPGA_STATE_REFLECTION_FAILED) { + printf(" refelectione test failed\n"); + return; + } + + unit_type = (versions & 0xf000) >> 12; + hardware_version = versions & 0x000f; + feature_channels = fpga_features & 0x007f; + + switch (unit_type) { + case UNITTYPE_CCX16: + printf("CCX-Switch"); + break; + + default: + printf("UnitType %d(not supported)", unit_type); + break; + } + + switch (hardware_version) { + case HWVER_300: + printf(" HW-Ver 3.00-3.12\n"); + break; + + default: + printf(" HW-Ver %d(not supported)\n", + hardware_version); + break; + } + + printf(" FPGA V %d.%02d, features:", + fpga_version / 100, fpga_version % 100); + + printf(" %d channel(s)\n", feature_channels); +} + +int last_stage_init(void) +{ + print_fpga_info(); + + return 0; +} + +void gd405ep_init(void) +{ +} + +void gd405ep_set_fpga_reset(unsigned state) +{ + if (state) { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_RESET); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_RESET); + } else { + out_le16((void *)LATCH0_BASE, CONFIG_SYS_LATCH0_BOOT); + out_le16((void *)LATCH1_BASE, CONFIG_SYS_LATCH1_BOOT); + } +} + +void gd405ep_setup_hw(void) +{ + /* + * set "startup-finished"-gpios + */ + gpio_write_bit(21, 0); + gpio_write_bit(22, 1); +} + +int gd405ep_get_fpga_done(unsigned fpga) +{ + /* + * Neo hardware has no FPGA-DONE GPIO + */ + return 1; +} |