]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/fpga/spartan3.c
mxs: spl: replace bogus early_delay() function with standard udelay() calls
[karo-tx-uboot.git] / drivers / fpga / spartan3.c
index c63c6052925306ee799d8dce4c2cdfac276d1c00..b0213e69992b5772f4e1984bf0a697cd34331832 100644 (file)
@@ -2,24 +2,7 @@
  * (C) Copyright 2002
  * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
  *
- * 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
- *
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
 #define CONFIG_SYS_FPGA_WAIT CONFIG_SYS_HZ/100 /* 10 ms */
 #endif
 
-static int Spartan3_sp_load(Xilinx_desc *desc, const void *buf, size_t bsize);
-static int Spartan3_sp_dump(Xilinx_desc *desc, const void *buf, size_t bsize);
-/* static int Spartan3_sp_info(Xilinx_desc *desc ); */
+static int spartan3_sp_load(xilinx_desc *desc, const void *buf, size_t bsize);
+static int spartan3_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize);
+/* static int spartan3_sp_info(xilinx_desc *desc ); */
 
-static int Spartan3_ss_load(Xilinx_desc *desc, const void *buf, size_t bsize);
-static int Spartan3_ss_dump(Xilinx_desc *desc, const void *buf, size_t bsize);
-/* static int Spartan3_ss_info(Xilinx_desc *desc); */
+static int spartan3_ss_load(xilinx_desc *desc, const void *buf, size_t bsize);
+static int spartan3_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize);
+/* static int spartan3_ss_info(xilinx_desc *desc); */
 
 /* ------------------------------------------------------------------------- */
 /* Spartan-II Generic Implementation */
-int Spartan3_load(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_load(xilinx_desc *desc, const void *buf, size_t bsize,
+                        bitstream_type bstype)
 {
        int ret_val = FPGA_FAIL;
 
        switch (desc->iface) {
        case slave_serial:
                PRINTF ("%s: Launching Slave Serial Load\n", __FUNCTION__);
-               ret_val = Spartan3_ss_load (desc, buf, bsize);
+               ret_val = spartan3_ss_load(desc, buf, bsize);
                break;
 
        case slave_parallel:
                PRINTF ("%s: Launching Slave Parallel Load\n", __FUNCTION__);
-               ret_val = Spartan3_sp_load (desc, buf, bsize);
+               ret_val = spartan3_sp_load(desc, buf, bsize);
                break;
 
        default:
@@ -85,19 +69,19 @@ int Spartan3_load(Xilinx_desc *desc, const void *buf, size_t bsize)
        return ret_val;
 }
 
-int Spartan3_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_dump(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;
 
        switch (desc->iface) {
        case slave_serial:
                PRINTF ("%s: Launching Slave Serial Dump\n", __FUNCTION__);
-               ret_val = Spartan3_ss_dump (desc, buf, bsize);
+               ret_val = spartan3_ss_dump(desc, buf, bsize);
                break;
 
        case slave_parallel:
                PRINTF ("%s: Launching Slave Parallel Dump\n", __FUNCTION__);
-               ret_val = Spartan3_sp_dump (desc, buf, bsize);
+               ret_val = spartan3_sp_dump(desc, buf, bsize);
                break;
 
        default:
@@ -108,7 +92,7 @@ int Spartan3_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
        return ret_val;
 }
 
-int Spartan3_info( Xilinx_desc *desc )
+static int spartan3_info(xilinx_desc *desc)
 {
        return FPGA_SUCCESS;
 }
@@ -117,10 +101,10 @@ int Spartan3_info( Xilinx_desc *desc )
 /* ------------------------------------------------------------------------- */
 /* Spartan-II Slave Parallel Generic Implementation */
 
-static int Spartan3_sp_load(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_sp_load(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;        /* assume the worst */
-       Xilinx_Spartan3_Slave_Parallel_fns *fn = desc->iface_fns;
+       xilinx_spartan3_slave_parallel_fns *fn = desc->iface_fns;
 
        PRINTF ("%s: start with interface functions @ 0x%p\n",
                        __FUNCTION__, fn);
@@ -271,10 +255,10 @@ static int Spartan3_sp_load(Xilinx_desc *desc, const void *buf, size_t bsize)
        return ret_val;
 }
 
-static int Spartan3_sp_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;        /* assume the worst */
-       Xilinx_Spartan3_Slave_Parallel_fns *fn = desc->iface_fns;
+       xilinx_spartan3_slave_parallel_fns *fn = desc->iface_fns;
 
        if (fn) {
                unsigned char *data = (unsigned char *) buf;
@@ -319,10 +303,10 @@ static int Spartan3_sp_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
 
 /* ------------------------------------------------------------------------- */
 
-static int Spartan3_ss_load(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        int ret_val = FPGA_FAIL;        /* assume the worst */
-       Xilinx_Spartan3_Slave_Serial_fns *fn = desc->iface_fns;
+       xilinx_spartan3_slave_serial_fns *fn = desc->iface_fns;
        int i;
        unsigned char val;
 
@@ -474,7 +458,7 @@ static int Spartan3_ss_load(Xilinx_desc *desc, const void *buf, size_t bsize)
        return ret_val;
 }
 
-static int Spartan3_ss_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
+static int spartan3_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize)
 {
        /* Readback is only available through the Slave Parallel and         */
        /* boundary-scan interfaces.                                         */
@@ -482,3 +466,9 @@ static int Spartan3_ss_dump(Xilinx_desc *desc, const void *buf, size_t bsize)
                        __FUNCTION__);
        return FPGA_FAIL;
 }
+
+struct xilinx_fpga_op spartan3_op = {
+       .load = spartan3_load,
+       .dump = spartan3_dump,
+       .info = spartan3_info,
+};