]> git.sur5r.net Git - u-boot/blobdiff - board/gdsys/405ep/iocon.c
Merge branch 'master' of git://git.denx.de/u-boot
[u-boot] / board / gdsys / 405ep / iocon.c
index 20770e4eff99a73e8efbcfa31019706ffe950622..0fc7db2012c9ba52d0ff12d5f10a948999a7b4a7 100644 (file)
 #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,8 +74,25 @@ enum {
  */
 int checkboard(void)
 {
-       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);
@@ -94,16 +116,6 @@ int checkboard(void)
        feature_carriers = (fpga_features & 0x000c) >> 2;
        feature_video_channels = fpga_features & 0x0003;
 
-       printf("Board: ");
-
-       printf("IoCon");
-
-       if (s != NULL) {
-               puts(", serial# ");
-               puts(s);
-       }
-       puts("\n       ");
-
        switch (unit_type) {
        case UNITTYPE_MAIN_USER:
                printf("Mainchannel");
@@ -204,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);
 }
 
@@ -230,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);
+}