1/7 Nios: bugfixes
PATCH 1/1 1/7 Nios: bugfixes
Hi all,
Hi Scott,
last week I've made some bugfixes, structure changes and expansion of the U-Boot NIOS port:
1/7 bugfixes 2/7 split board configuration of DK1C20 3/7 split board configuration of DK1S10 4/7 new CPU configuration / support at DK1S10 (Microtronix LDK 2.0) 5/7 new documentation for DK1S10 6/7 Nios SPI Master support 7/7 DS1306 with external SPI transfer
These pathes are realy important for my upcoming new Nios board support. Scott, could you check-up the pathes at your DK1C20 board and note me and Wolfgang so we can put it into CVS ? -- thanks.
Best Regards,
Stephan Linz
------------------ THIS IS PATCH 1/7 ------------------
* Patch by Stephan Linz, 30 Jan 2004
- board/altera/common/flash.c:flash_erase():
o allow interrupts befor get_timer() call
o check-up each erased sector and avoid unexpected timeouts
- board/altera/common/sevenseg.c:
o avoid 'unused' warning
- board/altera/dk1c20/dk1c20.c:board_early_init_f():
- board/altera/dk1c20/dk1s10.c:board_early_init_f():
o enclose sevenseg_set() in cpp condition
- makes the ASMI configuration of DK1C20 more conform to documentation
- remove the ASMI configuration for DK1S10_standard_32 (never present)
- fix some typed in mistakes in the NIOS documentation
-------------- next part --------------
board/altera/common/flash.c +22 -18
@@ -71,7 +71,6 @@ int flash_erase (flash_info_t * info, involatile CFG_FLASH_WORD_SIZE *addr = (CFG_FLASH_WORD_SIZE *) (info->start[0 ]);volatile CFG_FLASH_WORD_SIZE *addr2;int prot, sect; -int any =0 ;unsigned oldpri;ulong start;
@@ -94,6 +93,12 @@ int flash_erase (flash_info_t * info, inprintf ("\n" ); } +#ifdef DEBUG +for (sect = s_first; sect <= s_last; sect++) { +printf ("- Erase: Sect: %i @ 0x%08x\n" , sect, info->start[sect]); + } +#endif +/* NOTE: disabling interrupts on Nios can be very bad since it * also disables the LO_LIMIT exception. It's better here to * set the interrupt priority to 3 & restore it when we're done.
@@ -114,27 +119,26 @@ int flash_erase (flash_info_t * info, in *addr =0xaa ; *addr =0x55 ; *addr2 =0x30 ; - any =1 ; - } - } - -/* Now just wait for 0xff & provide some user feedback while -* we wait. -*/ -if (any) { - addr2 = (CFG_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); -while (*addr2 !=0xff ) { -udelay (1000 *1000 ); -putc ('.' ); -if (get_timer (start) >CFG_FLASH_ERASE_TOUT ) { -printf ("timeout\n" ); -return 1 ; +/* Now just wait for 0xff & provide some user +* feedback while we wait. Here we have to grant +* timer interrupts. Otherwise get_timer() can't +* work right. */ +ipri (oldpri); + start =get_timer (0 ); +while (*addr2 !=0xff ) { +udelay (1000 *1000 ); +putc ('.' ); +if (get_timer (start) >CFG_FLASH_ERASE_TOUT ) { +printf ("timeout\n" ); +return 1 ; + } } + oldpri =ipri (3 );/* disallow non important irqs again */ } -printf ("\n" ); } +printf ("\n" ); +/* Restore interrupt priority */ ipri (oldpri);
board/altera/common/sevenseg.c +3 -3
@@ -44,7 +44,7 @@ static int sevenseg_init_done = 0;static inline void __sevenseg_set_masked (unsigned int mask,int value) { -nios_pio_t *piop = (nios_pio_t *)SEVENSEG_BASE ; + nios_pio_t *piop __attribute__((unused)) = (nios_pio_t*)SEVENSEG_BASE;#ifdef SEVENSEG_WRONLY /* emulate read access */
@@ -97,7 +97,7 @@ static inline void __sevenseg_toggle_masstatic inline void __sevenseg_set (unsigned int value) { -nios_pio_t *piop = (nios_pio_t *)SEVENSEG_BASE ; + nios_pio_t *piop __attribute__((unused)) = (nios_pio_t*)SEVENSEG_BASE;#ifdef SEVENSEG_WRONLY /* emulate read access */
@@ -126,7 +126,7 @@ static inline void __sevenseg_set (unsigstatic inline void __sevenseg_init (void ) { -nios_pio_t *piop = (nios_pio_t *)SEVENSEG_BASE ; + nios_pio_t *piop __attribute__((unused)) = (nios_pio_t*)SEVENSEG_BASE;__sevenseg_set (0 );
board/altera/dk1c20/dk1c20.c +2 -0
@@ -33,8 +33,10 @@ void _default_hdlr (void)int board_early_init_f (void ) { +#if defined(CONFIG_SEVENSEG )/* init seven segment led display and switch off */ sevenseg_set (SEVENSEG_OFF ); +#endif return 0 ; }
board/altera/dk1s10/dk1s10.c +2 -0
@@ -33,8 +33,10 @@ void _default_hdlr (void)int board_early_init_f (void ) { +#if defined(CONFIG_SEVENSEG )/* init seven segment led display and switch off */ sevenseg_set (SEVENSEG_OFF ); +#endif return 0 ; }
doc/README.dk1c20 +6 -6
@@ -24,7 +24,7 @@ Contents: 1. Files ========= - board/dk1c20/* + board/altera/dk1c20/* include/configs/DK1C20.h 2. Memory Organization
@@ -73,11 +73,7 @@ see the following: 2. Quit nios-run and start your terminal application (e.g. start Hyperterminal or minicom). -3. From the U-Boot command prompt, erase flash 0x40000 to 0x 5ffff: - - ==> erase 1:4-5 - -4. Download the u-boot code to RAM. When using Hyperterminal, do the +3. Download the u-boot code to RAM. When using Hyperterminal, do the following: a. From the u-boot command prompt start a binary download to SRAM:
@@ -86,6 +82,10 @@ following: b. Download u-boot.bin using kermit. +4. From the U-Boot command prompt, erase flash 0x40000 to 0x5ffff: + + ==> erase 1:4-5 + 5. Copy the binary image from SRAM to flash: ==> cp.b 800000 40000 10000
doc/README.dk1c20_std32 +3 -2
@@ -91,10 +91,10 @@ IDE: (TODO) 0x02000000 ---32-----------16|15------------0- | : | \ | : | | - SDRAM | : | > CFG_NIOS_CPU_SRAM_SIZE + SDRAM | : | > CFG_NIOS_CPU_SDRAM_SIZE | : | | = 0x01000000 | : | / - 0x01000000 ---32-----------16|15------------0- CFG_NIOS_CPU_SRAM_BASE + 0x01000000 ---32-----------16|15------------0- CFG_NIOS_CPU_SDRAM_BASE | | : gap : : :
@@ -345,6 +345,7 @@ IDE: (TODO) | : | | 0x00040000 --+- - - - - - - -:- - - - - - - -+-|- u-boot _start() | : | / + 0x00000000 |- - - - - - - -:- - - - - - - -+- - u-boot environment 0x00000000 ---8-------------4|3-------------0-
doc/README.dk1s10_std32 +3 -2
@@ -87,10 +87,10 @@ IDE: (TODO) 0x02000000 ---32-----------16|15------------0- | : | \ | : | | - SDRAM | : | > CFG_NIOS_CPU_SRAM_SIZE + SDRAM | : | > CFG_NIOS_CPU_SDRAM_SIZE | : | | = 0x01000000 | : | / - 0x01000000 ---32-----------16|15------------0- CFG_NIOS_CPU_SRAM_BASE + 0x01000000 ---32-----------16|15------------0- CFG_NIOS_CPU_SDRAM_BASE | | : gap : : :
@@ -335,6 +335,7 @@ IDE: (TODO) | : | | 0x00040000 --+- - - - - - - -:- - - - - - - -+-|- u-boot _start() | : | / + 0x00000000 |- - - - - - - -:- - - - - - - -+- - u-boot environment 0x00000000 ---8-------------4|3-------------0-
doc/README.dk20k200_std32 +1 -1
@@ -117,7 +117,7 @@ UART: UART0: fixed baudrate of 115200, f + 0x18 |- - - - - - - - - - - - - - - -| | | (unused) | | + 0x14 |- - - - - - - - - - - - - - - -| | - UART0 | (unused) | > 0x00000020 + UART1 | (unused) | > 0x00000020 [2] + 0x10 |- - - - - - - - - - - - - - - -| | | control (10 bit) (rw) | | + 0x0c |- - - - - - - - - - - - - - - -| |
include/configs/DK1C20.h +2 -2
@@ -647,8 +647,8 @@* ASMI is for Cyclone devices only and only works when the configuration * is loaded via JTAG or ASMI. Please see doc/README.dk1c20 for details. *----------------------------------------------------------------------*/ -#define CONFIG_NIOS_ASMI /* Enable ASMI */ -#define CFG_NIOS_ASMIBASE 0x00920b00/* ASMI base address */ +#define CONFIG_NIOS_ASMI /* Enable ASMI */ +#define CFG_NIOS_ASMIBASE CFG_NIOS_CPU_ASMI0/* ASMI base address */ /*------------------------------------------------------------------------ * COMMANDS
include/configs/DK1S10.h +0 -5
@@ -243,11 +243,6 @@#define CFG_NIOS_CPU_IDE_NUMS 1/* number of IDE contr. */ #define CFG_NIOS_CPU_IDE0 0x00920a00/* IDE0 addr */ -/* active serial memory i/f */ -#define CFG_NIOS_CPU_ASMI_NUMS 1/* number of ASMI */ -#define CFG_NIOS_CPU_ASMI0 0x00920b00/* ASMI0 addr */ -#define CFG_NIOS_CPU_ASMI0_IRQ 45/* IRQ */ -/* memory accessibility */ #define CFG_NIOS_CPU_SRAM_BASE 0x00800000/* board SRAM addr */ #define CFG_NIOS_CPU_SRAM_SIZE (1024 * 1024)/* 1 MB size */
-------------- next part --------------
* Patch by Stephan Linz, 30 Jan 2004
- board/altera/common/flash.c:flash_erase():
o allow interrupts befor get_timer() call
o check-up each erased sector and avoid unexpected timeouts
- board/altera/common/sevenseg.c:
o avoid 'unused' warning
- board/altera/dk1c20/dk1c20.c:board_early_init_f():
- board/altera/dk1c20/dk1s10.c:board_early_init_f():
o enclose sevenseg_set() in cpp condition
- makes the ASMI configuration of DK1C20 more conform to documentation
- remove the ASMI configuration for DK1S10_standard_32 (never present)
- fix some typed in mistakes in the NIOS documentation
PATCH 1/1 1/7 Nios: bugfixes
Quoted 4 lines · In message <04020211535701.17605@pcj86> you wrote:
last week I've made some bugfixes, structure changes and expansion of the U-Boot NIOS port:
1/7 bugfixes
Quoted 6 lines
2/7 split board configuration of DK1C20 3/7 split board configuration of DK1S10 4/7 new CPU configuration / support at DK1S10 (Microtronix LDK 2.0) 5/7 new documentation for DK1S10 6/7 Nios SPI Master support 7/7 DS1306 with external SPI transfer
Added, thanks.
[I cleaned up the conflicts with the previous patches.]
Best regards,
Wolfgang Denk
Signature · 4 lines
See us @ Embedded World, Nuremberg, Feb 17 - 19, Hall 12.0 Booth 440 Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Too much of anything, even love, isn't necessarily a good thing. -- Kirk, "The Trouble with Tribbles", stardate 4525.6