]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/esd/common/xilinx_jtag/micro.c
drivers, block: remove sil680 driver
[people/ms/u-boot.git] / board / esd / common / xilinx_jtag / micro.c
index f21c23599dd81079038953a17ed21ba644a8827d..556636c55483487e0d2e3f4dff7fc2b74b51edf6 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2003
  * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.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+
  */
 
 /*****************************************************************************
 #include "lenval.h"
 #include "ports.h"
 
-
-extern const unsigned char fpgadata[];
-extern int filesize;
-
+const unsigned char *xsvfdata;
 
 /*============================================================================
  * XSVF #define
@@ -114,20 +95,20 @@ extern int filesize;
 
 #ifdef  DEBUG_MODE
 #define XSVFDBG_PRINTF(iDebugLevel,pzFormat) \
-                { if ( xsvf_iDebugLevel >= iDebugLevel ) \
-                    printf( pzFormat ); }
+               { if ( xsvf_iDebugLevel >= iDebugLevel ) \
+                   printf( pzFormat ); }
 #define XSVFDBG_PRINTF1(iDebugLevel,pzFormat,arg1) \
-                { if ( xsvf_iDebugLevel >= iDebugLevel ) \
-                    printf( pzFormat, arg1 ); }
+               { if ( xsvf_iDebugLevel >= iDebugLevel ) \
+                   printf( pzFormat, arg1 ); }
 #define XSVFDBG_PRINTF2(iDebugLevel,pzFormat,arg1,arg2) \
-                { if ( xsvf_iDebugLevel >= iDebugLevel ) \
-                    printf( pzFormat, arg1, arg2 ); }
+               { if ( xsvf_iDebugLevel >= iDebugLevel ) \
+                   printf( pzFormat, arg1, arg2 ); }
 #define XSVFDBG_PRINTF3(iDebugLevel,pzFormat,arg1,arg2,arg3) \
-                { if ( xsvf_iDebugLevel >= iDebugLevel ) \
-                    printf( pzFormat, arg1, arg2, arg3 ); }
+               { if ( xsvf_iDebugLevel >= iDebugLevel ) \
+                   printf( pzFormat, arg1, arg2, arg3 ); }
 #define XSVFDBG_PRINTLENVAL(iDebugLevel,plenVal) \
-                { if ( xsvf_iDebugLevel >= iDebugLevel ) \
-                    xsvfPrintLenVal(plenVal); }
+               { if ( xsvf_iDebugLevel >= iDebugLevel ) \
+                   xsvfPrintLenVal(plenVal); }
 #else   /* !DEBUG_MODE */
 #define XSVFDBG_PRINTF(iDebugLevel,pzFormat)
 #define XSVFDBG_PRINTF1(iDebugLevel,pzFormat,arg1)
@@ -327,68 +308,68 @@ TXsvfDoCmdFuncPtr   xsvf_pfDoCmd[]  =
 #ifdef  DEBUG_MODE
 char* xsvf_pzCommandName[]  =
 {
-        "XCOMPLETE",
-        "XTDOMASK",
-        "XSIR",
-        "XSDR",
-        "XRUNTEST",
-        "Reserved5",
-        "Reserved6",
-        "XREPEAT",
-        "XSDRSIZE",
-        "XSDRTDO",
-        "XSETSDRMASKS",
-        "XSDRINC",
-        "XSDRB",
-        "XSDRC",
-        "XSDRE",
-        "XSDRTDOB",
-        "XSDRTDOC",
-        "XSDRTDOE",
-        "XSTATE",
-        "XENDIR",
-        "XENDDR",
-        "XSIR2",
-        "XCOMMENT",
-        "XWAIT"
+       "XCOMPLETE",
+       "XTDOMASK",
+       "XSIR",
+       "XSDR",
+       "XRUNTEST",
+       "Reserved5",
+       "Reserved6",
+       "XREPEAT",
+       "XSDRSIZE",
+       "XSDRTDO",
+       "XSETSDRMASKS",
+       "XSDRINC",
+       "XSDRB",
+       "XSDRC",
+       "XSDRE",
+       "XSDRTDOB",
+       "XSDRTDOC",
+       "XSDRTDOE",
+       "XSTATE",
+       "XENDIR",
+       "XENDDR",
+       "XSIR2",
+       "XCOMMENT",
+       "XWAIT"
 };
 
 char*   xsvf_pzErrorName[]  =
 {
-        "No error",
-        "ERROR:  Unknown",
-        "ERROR:  TDO mismatch",
-        "ERROR:  TDO mismatch and exceeded max retries",
-        "ERROR:  Unsupported XSVF command",
-        "ERROR:  Illegal state specification",
-        "ERROR:  Data overflows allocated MAX_LEN buffer size"
+       "No error",
+       "ERROR:  Unknown",
+       "ERROR:  TDO mismatch",
+       "ERROR:  TDO mismatch and exceeded max retries",
+       "ERROR:  Unsupported XSVF command",
+       "ERROR:  Illegal state specification",
+       "ERROR:  Data overflows allocated MAX_LEN buffer size"
 };
 
 char*   xsvf_pzTapState[] =
 {
-        "RESET",        /* 0x00 */
-        "RUNTEST/IDLE", /* 0x01 */
-        "DRSELECT",     /* 0x02 */
-        "DRCAPTURE",    /* 0x03 */
-        "DRSHIFT",      /* 0x04 */
-        "DREXIT1",      /* 0x05 */
-        "DRPAUSE",      /* 0x06 */
-        "DREXIT2",      /* 0x07 */
-        "DRUPDATE",     /* 0x08 */
-        "IRSELECT",     /* 0x09 */
-        "IRCAPTURE",    /* 0x0A */
-        "IRSHIFT",      /* 0x0B */
-        "IREXIT1",      /* 0x0C */
-        "IRPAUSE",      /* 0x0D */
-        "IREXIT2",      /* 0x0E */
-        "IRUPDATE"      /* 0x0F */
+       "RESET",        /* 0x00 */
+       "RUNTEST/IDLE", /* 0x01 */
+       "DRSELECT",     /* 0x02 */
+       "DRCAPTURE",    /* 0x03 */
+       "DRSHIFT",      /* 0x04 */
+       "DREXIT1",      /* 0x05 */
+       "DRPAUSE",      /* 0x06 */
+       "DREXIT2",      /* 0x07 */
+       "DRUPDATE",     /* 0x08 */
+       "IRSELECT",     /* 0x09 */
+       "IRCAPTURE",    /* 0x0A */
+       "IRSHIFT",      /* 0x0B */
+       "IREXIT1",      /* 0x0C */
+       "IRPAUSE",      /* 0x0D */
+       "IREXIT2",      /* 0x0E */
+       "IRUPDATE"      /* 0x0F */
 };
 #endif  /* DEBUG_MODE */
 
-//#ifdef DEBUG_MODE
-//    FILE* in;   /* Legacy DEBUG_MODE file pointer */
+/*#ifdef DEBUG_MODE    */
+/*    FILE* in;   /XXX* Legacy DEBUG_MODE file pointer */
 int xsvf_iDebugLevel;
-//#endif /* DEBUG_MODE */
+/*#endif /XXX* DEBUG_MODE */
 
 /*============================================================================
  * Utility Functions
@@ -493,7 +474,7 @@ void xsvfTmsTransition( short sTms )
  * Returns:      int             - 0 = success; otherwise error.
  *****************************************************************************/
 int xsvfGotoTapState( unsigned char*   pucTapState,
-                      unsigned char    ucTargetState )
+                     unsigned char    ucTargetState )
 {
        int i;
        int iErrorCode;
@@ -708,9 +689,9 @@ int xsvfGotoTapState( unsigned char*   pucTapState,
  * Returns:      void.
  *****************************************************************************/
 void xsvfShiftOnly( long    lNumBits,
-                    lenVal* plvTdi,
-                    lenVal* plvTdoCaptured,
-                    int     iExitShift )
+                   lenVal* plvTdi,
+                   lenVal* plvTdoCaptured,
+                   int     iExitShift )
 {
        unsigned char*  pucTdi;
        unsigned char*  pucTdo;
@@ -796,15 +777,15 @@ void xsvfShiftOnly( long    lNumBits,
  *               is NOT all zeros and sMatch==1.
  *****************************************************************************/
 int xsvfShift( unsigned char*   pucTapState,
-               unsigned char    ucStartState,
-               long             lNumBits,
-               lenVal*          plvTdi,
-               lenVal*          plvTdoCaptured,
-               lenVal*          plvTdoExpected,
-               lenVal*          plvTdoMask,
-               unsigned char    ucEndState,
-               long             lRunTestTime,
-               unsigned char    ucMaxRepeat )
+              unsigned char    ucStartState,
+              long             lNumBits,
+              lenVal*          plvTdi,
+              lenVal*          plvTdoCaptured,
+              lenVal*          plvTdoExpected,
+              lenVal*          plvTdoMask,
+              unsigned char    ucEndState,
+              long             lRunTestTime,
+              unsigned char    ucMaxRepeat )
 {
        int             iErrorCode;
        int             iMismatch;
@@ -935,15 +916,15 @@ int xsvfShift( unsigned char*   pucTapState,
  * Returns:      int                 - 0 = success; otherwise TDO mismatch.
  *****************************************************************************/
 int xsvfBasicXSDRTDO( unsigned char*    pucTapState,
-                      long              lShiftLengthBits,
-                      short             sShiftLengthBytes,
-                      lenVal*           plvTdi,
-                      lenVal*           plvTdoCaptured,
-                      lenVal*           plvTdoExpected,
-                      lenVal*           plvTdoMask,
-                      unsigned char     ucEndState,
-                      long              lRunTestTime,
-                      unsigned char     ucMaxRepeat )
+                     long              lShiftLengthBits,
+                     short             sShiftLengthBytes,
+                     lenVal*           plvTdi,
+                     lenVal*           plvTdoCaptured,
+                     lenVal*           plvTdoExpected,
+                     lenVal*           plvTdoMask,
+                     unsigned char     ucEndState,
+                     long              lRunTestTime,
+                     unsigned char     ucMaxRepeat )
 {
        readVal( plvTdi, sShiftLengthBytes );
        if ( plvTdoExpected )
@@ -968,9 +949,9 @@ int xsvfBasicXSDRTDO( unsigned char*    pucTapState,
  *****************************************************************************/
 #ifdef  XSVF_SUPPORT_COMPRESSION
 void xsvfDoSDRMasking( lenVal*  plvTdi,
-                       lenVal*  plvNextData,
-                       lenVal*  plvAddressMask,
-                       lenVal*  plvDataMask )
+                      lenVal*  plvNextData,
+                      lenVal*  plvAddressMask,
+                      lenVal*  plvDataMask )
 {
        int             i;
        unsigned char   ucTdi;
@@ -1831,19 +1812,28 @@ int xsvfExecute(void)
  *               ppzArgv  - array of ptrs to strings (command-line arguments).
  * Returns:      int      - Legacy return value:  1 = success; 0 = error.
  *****************************************************************************/
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        int     iErrorCode;
-       char*   pzXsvfFileName;
        unsigned long duration;
        unsigned long long startClock, endClock;
 
+       if (argc == 2)
+               xsvfdata = (unsigned char *)simple_strtoul(argv[1], NULL, 16);
+       else {
+#ifdef CONFIG_SYS_XSVF_DEFAULT_ADDR
+               xsvfdata = (unsigned char *)CONFIG_SYS_XSVF_DEFAULT_ADDR;
+#else
+               printf("Usage:\ncpld %s\n", cmdtp->help);
+               return -1;
+#endif
+       }
+
        iErrorCode          = XSVF_ERRORCODE( XSVF_ERROR_NONE );
-       pzXsvfFileName      = 0;
        xsvf_iDebugLevel    = 0;
 
        printf("XSVF Player v%s, Xilinx, Inc.\n", XSVF_VERSION);
-       printf("XSVF Filesize = %d bytes\n", filesize);
+       printf("Reading XSVF data @ %p\n", xsvfdata);
 
        /* Initialize the I/O.  SetPort initializes I/O on first call */
        setPort( TMS, 1 );
@@ -1858,7 +1848,7 @@ int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        return( iErrorCode );
 }
 U_BOOT_CMD(
-       cpld,   1,      1,      do_cpld,
-       "cpld    - Program onboard CPLD\n",
-       NULL
-       );
+       cpld,   2,      1,      do_cpld,
+       "program onboard CPLD",
+       "<xsvf-addr>"
+);