Support LATTICE FPGA parts using JTAG programming.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/5 Support LATTICE FPGA parts using JTAG programming.
Dear Pantelis,
Quoted 2 lines · in message <[email protected]> you wrote:
Add support for Lattice FPGA parts programmed using JTAG.
Again, the previous comments on necessary coding style cleanup apply.
Also:
Quoted 2 lines
common/Makefile | 4 common/ec.c | 473 ++++++
^^^^^^^^^^^^^^
Huh? What's "ec"? Please use a more descriptive name.
Quoted 2 lines
common/lattice_ivm_core.c new file +0
-0
...
Quoted 1 line
+* JTAG state machine transistion tragetory table.
Please fix typos ;-)
Quoted 29 lines
common/lattice_ivm_core.c new file +29
-0+struct { +unsigned char CurState;/* From this state */ +unsigned char NextState;/* Step to this state */ +unsigned char Pattern;/* The tragetory of TMS */ +unsigned char Pulses;/* The number of steps */ +} g_JTAGTransistions[24 ] = { + { +RESET ,RESET ,0xFC ,6 },/* Transitions from RESET */ + { +RESET ,IDLE ,0x00 ,1 }, { +RESET ,DRPAUSE ,0x50 ,5 }, { +RESET ,IRPAUSE ,0x68 ,6 }, { +IDLE ,RESET ,0xE0 ,3 },/* Transitions from IDLE */ + { +IDLE ,DRPAUSE ,0xA0 ,4 }, { +IDLE ,IRPAUSE ,0xD0 ,5 }, { +DRPAUSE ,RESET ,0xF8 ,5 },/* Transitions from DRPAUSE */ + { +DRPAUSE ,IDLE ,0xC0 ,3 }, { +DRPAUSE ,IRPAUSE ,0xF4 ,7 }, { +IRPAUSE ,RESET ,0xF8 ,5 },/* Transitions from IRPAUSE */ + { +IRPAUSE ,IDLE ,0xC0 ,3 }, { +IRPAUSE ,DRPAUSE ,0xE8 ,6 }, { +DRPAUSE ,SHIFTDR ,0x80 ,2 },/* Extra transitions using SHIFTDR */ + { +IRPAUSE ,SHIFTDR ,0xE0 ,5 }, { +SHIFTDR ,DRPAUSE ,0x80 ,2 }, { +SHIFTDR ,IDLE ,0xC0 ,3 }, {
common/lattice_ivm_core.c
Quoted 10 lines
common/lattice_ivm_core.c new file +10
-0+ IRPAUSE, SHIFTIR, 0x80, 2}, /* Extra transitions using SHIFTIR */ + { + SHIFTIR, IRPAUSE, 0x80, 2}, { + SHIFTIR, IDLE, 0xC0, 3}, { + DRPAUSE, DRCAPTURE, 0xE0, 4}, /* 11/15/05 Nguyen changed to support DRCAPTURE */ + { + DRCAPTURE, DRPAUSE, 0x80, 2}, { + IDLE, DRCAPTURE, 0x80, 2}, { + IRPAUSE, DRCAPTURE, 0xE0, 4} +};
Please fix indentation.
common/lattice_ivm_core.c
Quoted 11 lines
common/lattice_ivm_core.c new file +11
-0+#ifdef VME_DEBUG +/*************************************************************** +* +* vme_print +* +* Prints VME to SVF file or terminal, depending on the +* pre-compiler definitions. This function may be compiler or OS +* specific. Please see your compiler's documentation regarding +* va_list, va_arg, and va_end. +* +***************************************************************/
Is this really needed?
common/lattice_ivm_core.c
Quoted 6 lines
common/lattice_ivm_core.c new file +6
-0+void vme_print (const char *a_pszString, ...) +{ +va_list list; +unsigned short usStringIndex; +static char szString[5000 ] = {0 }; +static char szTempString[5000 ] = {0 };
Do you really need static stings here?
common/lattice_ivm_core.c
Quoted 6 lines
common/lattice_ivm_core.c new file +6
-0+va_start (list, a_pszString); +for (usStringIndex =0 ; usStringIndex <strlen (a_pszString); + usStringIndex++) { +if (a_pszString[usStringIndex] =='%' ) { + szString[strlen (szString)] = a_pszString[usStringIndex]; + usStringIndex++;
Please note that the variable names are basicly a violation of the Coding Style (see Chapter 4: Naming). This code, even though it's not really complicated, is more or less unreadable as is.
...
Quoted 1 line
+signed char
ispVMRead(unsigned short a_usiDataSize)
...
Quoted 9 lines
common/lattice_ivm_core.c new file +9
-0+for (usDataSizeIndex =0 ; usDataSizeIndex < a_usiDataSize; + usDataSizeIndex++) { +if (cByteIndex ==0 ) { + +/*************************************************************** +* +* Grab byte from TDO buffer. +* +***************************************************************/
common/lattice_ivm_core.c
Quoted 10 lines
common/lattice_ivm_core.c new file +10
-0+ +if (g_usDataType &TDO_DATA ) { + cDataByte = g_pucOutData[usBufferIndex]; + } + +/*************************************************************** +* +* Grab byte from MASK buffer. +* +***************************************************************/
Comments don't line up here and elsewhere.
Quoted 14 lines
common/lattice_ivm_core.c new file +14
-0+/*************************************************************** +* +* internal_udelay +* +* Users must devise their own timing procedure to ensure the +* specified minimum delay is observed when using different +* platform. The timing function used here is for PC only by +* hocking the clock chip. +* +***************************************************************/ + +void internal_udelay (unsigned short a_usMicroSecondDelay) +{ +int i, msecs;
common/lattice_ivm_core.c
Quoted 10 lines
common/lattice_ivm_core.c new file +10
-0+ +if (a_usMicroSecondDelay &0x8000 ) { + msecs = a_usMicroSecondDelay & ~0x8000 ; +for (i =0 ; i < msecs; i++) +udelay (1000 ); +return ; + } + +udelay (a_usMicroSecondDelay); +}
Comment and implementation don't match. Also: are you sure this is needed in U-Boot?
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The great question... which I have not been able to answer... is, `What does woman want?'" - Sigmund Freud
PATCH 2/5 Support LATTICE FPGA parts using JTAG programming.
Quoted 9 lines · Wolfgang Denk
Dear Pantelis,
in message <[email protected]> you
Quoted 2 lines · wrote:
Add support for Lattice FPGA parts programmed using JTAG.
Again, the previous comments on necessary coding style cleanup apply.
Quoted 8 lines
Also:
Quoted 2 lines
common/Makefile | 4 common/ec.c | 473 ++++++^^^^^^^^^^^^^^
Huh? What's "ec"? Please use a more descriptive name.
EC is the family name for the parts - follows the convention by the virtex & spartan families.
Quoted 132 lines
Quoted 2 lines
common/lattice_ivm_core.c new file +0
-0...
Quoted 1 line
+* JTAG state machine transistion tragetory table.
Please fix typos ;-)
Quoted 35 lines
common/lattice_ivm_core.c new file +34
-0+struct { +unsigned char CurState;/* From this state */ +unsigned char NextState;/* Step to this state */ +unsigned char Pattern;/* The tragetory of TMS */ +unsigned char Pulses;/* The number of steps */ +} g_JTAGTransistions[24 ] = { + { +RESET ,RESET ,0xFC ,6 },/* Transitions from RESET */ + { +RESET ,IDLE ,0x00 ,1 }, { +RESET ,DRPAUSE ,0x50 ,5 }, { +RESET ,IRPAUSE ,0x68 ,6 }, { +IDLE ,RESET ,0xE0 ,3 },/* Transitions from IDLE */ + { +IDLE ,DRPAUSE ,0xA0 ,4 }, { +IDLE ,IRPAUSE ,0xD0 ,5 }, { +DRPAUSE ,RESET ,0xF8 ,5 },/* Transitions from DRPAUSE */ + { +DRPAUSE ,IDLE ,0xC0 ,3 }, { +DRPAUSE ,IRPAUSE ,0xF4 ,7 }, { +IRPAUSE ,RESET ,0xF8 ,5 },/* Transitions from IRPAUSE */ + { +IRPAUSE ,IDLE ,0xC0 ,3 }, { +IRPAUSE ,DRPAUSE ,0xE8 ,6 }, { +DRPAUSE ,SHIFTDR ,0x80 ,2 },/* Extra transitions using SHIFTDR */ + { +IRPAUSE ,SHIFTDR ,0xE0 ,5 }, { +SHIFTDR ,DRPAUSE ,0x80 ,2 }, { +SHIFTDR ,IDLE ,0xC0 ,3 }, { +IRPAUSE ,SHIFTIR ,0x80 ,2 },/* Extra transitions using SHIFTIR */ + { +SHIFTIR ,IRPAUSE ,0x80 ,2 }, { +SHIFTIR ,IDLE ,0xC0 ,3 }, { +DRPAUSE ,DRCAPTURE ,0xE0 ,4 },/* 11/15/05 Nguyen changed to support DRCAPTURE */
common/lattice_ivm_core.c
Quoted 5 lines
common/lattice_ivm_core.c new file +5
-0+ { + DRCAPTURE, DRPAUSE, 0x80, 2}, { + IDLE, DRCAPTURE, 0x80, 2}, { + IRPAUSE, DRCAPTURE, 0xE0, 4} +};Please fix indentation.
common/lattice_ivm_core.c
Quoted 11 lines
common/lattice_ivm_core.c new file +11
-0+#ifdef VME_DEBUG +/*************************************************************** +* +* vme_print +* +* Prints VME to SVF file or terminal, depending on the +* pre-compiler definitions. This function may be compiler or OS +* specific. Please see your compiler's documentation regarding +* va_list, va_arg, and va_end. +* +***************************************************************/ Is this really needed?
common/lattice_ivm_core.c
Quoted 6 lines
common/lattice_ivm_core.c new file +6
-0+void vme_print (const char *a_pszString, ...) +{ +va_list list; +unsigned short usStringIndex; +static char szString[5000 ] = {0 }; +static char szTempString[5000 ] = {0 };Do you really need static stings here?
common/lattice_ivm_core.c
Quoted 6 lines
common/lattice_ivm_core.c new file +6
-0+va_start (list, a_pszString); +for (usStringIndex =0 ; usStringIndex <strlen (a_pszString); + usStringIndex++) { +if (a_pszString[usStringIndex] =='%' ) { + szString[strlen (szString)] = a_pszString[usStringIndex]; + usStringIndex++;Please note that the variable names are basicly a violation of the Coding Style (see Chapter 4: Naming). This code, even though it's not really complicated, is more or less unreadable as is.
...
Quoted 1 line
+signed char
ispVMRead(unsigned short a_usiDataSize)...
Quoted 22 lines
common/lattice_ivm_core.c new file +5
-0+for (usDataSizeIndex =0 ; usDataSizeIndex < a_usiDataSize; + usDataSizeIndex++) { +if (cByteIndex ==0 ) { + + /***************************************************************
common/lattice_ivm_core.c new file +4
-0+* +* Grab byte from TDO buffer. +* +***************************************************************/
common/lattice_ivm_core.c new file +6
-0+ +if (g_usDataType &TDO_DATA ) { + cDataByte = g_pucOutData[usBufferIndex]; + } + + /***************************************************************
common/lattice_ivm_core.c new file +4
-0+* +* Grab byte from MASK buffer. +* +Quoted 1 line
***************************************************************/
Comments don't line up here and elsewhere.
Quoted 19 lines
common/lattice_ivm_core.c new file +19
-0+/*************************************************************** +* +* internal_udelay +* +* Users must devise their own timing procedure to ensure the +* specified minimum delay is observed when using different +* platform. The timing function used here is for PC only by +* hocking the clock chip. +* +***************************************************************/ + +void internal_udelay (unsigned short a_usMicroSecondDelay) +{ +int i, msecs; + +if (a_usMicroSecondDelay &0x8000 ) { + msecs = a_usMicroSecondDelay & ~0x8000 ; +for (i =0 ; i < msecs; i++) +udelay (1000 );
Quoted 11 lines
common/lattice_ivm_core.c
Quoted 5 lines
common/lattice_ivm_core.c new file +5
-0+return ; + } + +udelay (a_usMicroSecondDelay); +}Comment and implementation don't match. Also: are you sure this is needed in U-Boot?
As a general comment, this is the same file that RedBoot uses - it's lattice code,
so I didn't do much with it. Yes the formatting is pretty horrible. And the comments are pretty misleading.
It is needed, the kernel expects the FPGA to be already programmed & ready to
go, there is no code to handle FPGA loading in the kernel.
The whole point of this is to have u-boot to be a drop in replacement for RedBoot,
providing backwards compatibility with kernels & images created for RedBoot.
Quoted 9 lines
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The great question... which I have not been able to answer... is, `What does woman want?'" - Sigmund Freud
Regards
Pantelis
PATCH 2/5 Support LATTICE FPGA parts using JTAG programming.
Quoted 25 lines
As a general comment, this is the same file that RedBoot uses - it's lattice code,
so I didn't do much with it. Yes the formatting is pretty horrible. And the comments are pretty misleading.It is needed, the kernel expects the FPGA to be already programmed & ready to
go, there is no code to handle FPGA loading in the kernel.The whole point of this is to have u-boot to be a drop in replacement for RedBoot,
providing backwards compatibility with kernels & images created for RedBoot.Quoted 9 lines
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The great question... which I have not been able to answer... is, `What does woman want?'" - Sigmund Freud
Quoted 4 lines
Regards
Pantelis
If it's any consolation, I have the same problem getting Xilinx-derived code accepted into U-Boot. :)
PATCH 2/5 Support LATTICE FPGA parts using JTAG programming.
Quoted 3 lines · In message <OFD0E1F0C1.FEF8E56C-ON07257235.0079CCE9-07257235.0079F533@mck.us.ra…
If it's any consolation, I have the same problem getting Xilinx-derived code accepted into U-Boot. :)
So maybe we can try together to find a way how to handle this in a clean way. Please try to understand my position: if we accept such alien code ungrudgingly, it will be very hard to maintain any level of common style of the sources. On the other hand, I am well aware that it makes little sense to "beautify" such code for example when there is need to update or re-sync it against some other project's source tree.
I really have no good solution for this problem. Any ideas are welcome.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Microsoft Multimedia: You have nice graphics, sound and animations when the system crashes.
PATCH 2/5 Support LATTICE FPGA parts using JTAG programming.
In reply to Pantelis AntoniouQuoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 2 lines
common/ec.c | 473 ++++++^^^^^^^^^^^^^^
Huh? What's "ec"? Please use a more descriptive name.EC is the family name for the parts - follows the convention by the virtex & spartan families.
lattice_ec ?
Quoted 5 lines
...
As a general comment, this is the same file that RedBoot uses - it's lattice code,
so I didn't do much with it. Yes the formatting is pretty horrible. And the comments are pretty misleading.
Do you see a chance of cleaning this up / re-implementing the needed parts in a clean way in some foreseeable future?
Best regards,
Wolfgang Denk
Signature · 6 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de On my planet, to rest is to rest -- to cease using energy. To me, it is quite illogical to run up and down on green grass, using energy, instead of saving it. -- Spock, "Shore Leave", stardate 3025.2