ppc4xx: Add dcache_enable() for 440
[platform/kernel/u-boot.git] / common / xilinx.c
index cb153e1..c898238 100644 (file)
@@ -30,8 +30,9 @@
 #include <common.h>
 #include <virtex2.h>
 #include <spartan2.h>
+#include <spartan3.h>
 
-#if (CONFIG_FPGA & CFG_FPGA_XILINX)
+#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
 
 #if 0
 #define FPGA_DEBUG
@@ -53,12 +54,12 @@ int xilinx_load (Xilinx_desc * desc, void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;        /* assume a failure */
 
-       if (!xilinx_validate (desc, __FUNCTION__)) {
+       if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
                printf ("%s: Invalid device descriptor\n", __FUNCTION__);
        } else
                switch (desc->family) {
                case Xilinx_Spartan2:
-#if (CONFIG_FPGA & CFG_SPARTAN2)
+#if defined(CONFIG_FPGA_SPARTAN2)
                        PRINTF ("%s: Launching the Spartan-II Loader...\n",
                                        __FUNCTION__);
                        ret_val = Spartan2_load (desc, buf, bsize);
@@ -67,8 +68,18 @@ int xilinx_load (Xilinx_desc * desc, void *buf, size_t bsize)
                                        __FUNCTION__);
 #endif
                        break;
+               case Xilinx_Spartan3:
+#if defined(CONFIG_FPGA_SPARTAN3)
+                       PRINTF ("%s: Launching the Spartan-III Loader...\n",
+                                       __FUNCTION__);
+                       ret_val = Spartan3_load (desc, buf, bsize);
+#else
+                       printf ("%s: No support for Spartan-III devices.\n",
+                                       __FUNCTION__);
+#endif
+                       break;
                case Xilinx_Virtex2:
-#if (CONFIG_FPGA & CFG_VIRTEX2)
+#if defined(CONFIG_FPGA_VIRTEX2)
                        PRINTF ("%s: Launching the Virtex-II Loader...\n",
                                        __FUNCTION__);
                        ret_val = Virtex2_load (desc, buf, bsize);
@@ -90,12 +101,12 @@ int xilinx_dump (Xilinx_desc * desc, void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;        /* assume a failure */
 
-       if (!xilinx_validate (desc, __FUNCTION__)) {
+       if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
                printf ("%s: Invalid device descriptor\n", __FUNCTION__);
        } else
                switch (desc->family) {
                case Xilinx_Spartan2:
-#if (CONFIG_FPGA & CFG_SPARTAN2)
+#if defined(CONFIG_FPGA_SPARTAN2)
                        PRINTF ("%s: Launching the Spartan-II Reader...\n",
                                        __FUNCTION__);
                        ret_val = Spartan2_dump (desc, buf, bsize);
@@ -104,8 +115,18 @@ int xilinx_dump (Xilinx_desc * desc, void *buf, size_t bsize)
                                        __FUNCTION__);
 #endif
                        break;
+               case Xilinx_Spartan3:
+#if defined(CONFIG_FPGA_SPARTAN3)
+                       PRINTF ("%s: Launching the Spartan-III Reader...\n",
+                                       __FUNCTION__);
+                       ret_val = Spartan3_dump (desc, buf, bsize);
+#else
+                       printf ("%s: No support for Spartan-III devices.\n",
+                                       __FUNCTION__);
+#endif
+                       break;
                case Xilinx_Virtex2:
-#if (CONFIG_FPGA & CFG_VIRTEX2)
+#if defined( CONFIG_FPGA_VIRTEX2)
                        PRINTF ("%s: Launching the Virtex-II Reader...\n",
                                        __FUNCTION__);
                        ret_val = Virtex2_dump (desc, buf, bsize);
@@ -127,12 +148,15 @@ int xilinx_info (Xilinx_desc * desc)
 {
        int ret_val = FPGA_FAIL;
 
-       if (xilinx_validate (desc, __FUNCTION__)) {
+       if (xilinx_validate (desc, (char *)__FUNCTION__)) {
                printf ("Family:        \t");
                switch (desc->family) {
                case Xilinx_Spartan2:
                        printf ("Spartan-II\n");
                        break;
+               case Xilinx_Spartan3:
+                       printf ("Spartan-III\n");
+                       break;
                case Xilinx_Virtex2:
                        printf ("Virtex-II\n");
                        break;
@@ -174,7 +198,7 @@ int xilinx_info (Xilinx_desc * desc)
                        printf ("Device Function Table @ 0x%p\n", desc->iface_fns);
                        switch (desc->family) {
                        case Xilinx_Spartan2:
-#if (CONFIG_FPGA & CFG_SPARTAN2)
+#if defined(CONFIG_FPGA_SPARTAN2)
                                Spartan2_info (desc);
 #else
                                /* just in case */
@@ -182,8 +206,17 @@ int xilinx_info (Xilinx_desc * desc)
                                                __FUNCTION__);
 #endif
                                break;
+                       case Xilinx_Spartan3:
+#if defined(CONFIG_FPGA_SPARTAN3)
+                               Spartan3_info (desc);
+#else
+                               /* just in case */
+                               printf ("%s: No support for Spartan-III devices.\n",
+                                               __FUNCTION__);
+#endif
+                               break;
                        case Xilinx_Virtex2:
-#if (CONFIG_FPGA & CFG_VIRTEX2)
+#if defined(CONFIG_FPGA_VIRTEX2)
                                Virtex2_info (desc);
 #else
                                /* just in case */
@@ -194,6 +227,7 @@ int xilinx_info (Xilinx_desc * desc)
                                /* Add new family types here */
                        default:
                                /* we don't need a message here - we give one up above */
+                               ;
                        }
                } else
                        printf ("No Device Function Table.\n");
@@ -210,20 +244,28 @@ int xilinx_reloc (Xilinx_desc * desc, ulong reloc_offset)
 {
        int ret_val = FPGA_FAIL;        /* assume a failure */
 
-       if (!xilinx_validate (desc, __FUNCTION__)) {
+       if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
                printf ("%s: Invalid device descriptor\n", __FUNCTION__);
        } else
                switch (desc->family) {
                case Xilinx_Spartan2:
-#if (CONFIG_FPGA & CFG_SPARTAN2)
+#if defined(CONFIG_FPGA_SPARTAN2)
                        ret_val = Spartan2_reloc (desc, reloc_offset);
 #else
                        printf ("%s: No support for Spartan-II devices.\n",
                                        __FUNCTION__);
 #endif
                        break;
+               case Xilinx_Spartan3:
+#if defined(CONFIG_FPGA_SPARTAN3)
+                       ret_val = Spartan3_reloc (desc, reloc_offset);
+#else
+                       printf ("%s: No support for Spartan-III devices.\n",
+                                       __FUNCTION__);
+#endif
+                       break;
                case Xilinx_Virtex2:
-#if (CONFIG_FPGA & CFG_VIRTEX2)
+#if defined(CONFIG_FPGA_VIRTEX2)
                        ret_val = Virtex2_reloc (desc, reloc_offset);
 #else
                        printf ("%s: No support for Virtex-II devices.\n",
@@ -266,4 +308,4 @@ static int xilinx_validate (Xilinx_desc * desc, char *fn)
        return ret_val;
 }
 
-#endif                                                 /* CONFIG_FPGA & CFG_FPGA_XILINX */
+#endif /* CONFIG_FPGA && CONFIG_FPGA_XILINX */