Coding Style cleanup

This commit is contained in:
Wolfgang Denk 2006-03-12 02:55:22 +01:00
parent 1264b4050c
commit 8e7b703a62
35 changed files with 482 additions and 500 deletions

View File

@ -2,6 +2,8 @@
Changes since U-Boot 1.1.4:
======================================================================
* Coding Style cleanup
* Avoid dereferencing NULL in find_cmd() if no valid commands were found
Patch by Andrew Dyer, 13 Jun 2005

View File

@ -23,4 +23,3 @@
TEXT_BASE = 0x01FC0000
PLATFORM_CPPFLAGS += -I$(TOPDIR)

View File

@ -65,4 +65,3 @@
#define PSDA_LED6 0x04 /* LED 6, 1 = LED ON */
#define PSDA_LED5 0x02 /* LED 5, 1 = LED ON */
#define PSDA_LED4 0x01 /* LED 4, 1 = LED ON */

View File

@ -146,4 +146,3 @@ SECTIONS
_end = . ;
PROVIDE (end = .);
}

View File

@ -23,4 +23,3 @@
TEXT_BASE = 0x07FC0000
PLATFORM_CPPFLAGS += -I$(TOPDIR)

View File

@ -38,55 +38,55 @@
# define SHOW_BOOT_PROGRESS(arg)
#endif
int checkboard(void)
int checkboard (void)
{
printf("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28);
printf("Board: ADI BF533 Stamp board\n");
printf(" Support: http://blackfin.uclinux.org/\n");
printf(" Richard Klingler <richard@uclinux.net>\n");
printf ("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28);
printf ("Board: ADI BF533 Stamp board\n");
printf (" Support: http://blackfin.uclinux.org/\n");
printf (" Richard Klingler <richard@uclinux.net>\n");
return 0;
}
long int initdram(int board_type)
long int initdram (int board_type)
{
DECLARE_GLOBAL_DATA_PTR;
#ifdef DEBUG
printf("SDRAM attributes:\n");
printf(" tRCD:%d Cycles; tRP:%d Cycles; tRAS:%d Cycles; tWR:%d Cycles; "
"CAS Latency:%d cycles\n", (SDRAM_tRCD >> 15), (SDRAM_tRP >> 11),
(SDRAM_tRAS >> 6), ( SDRAM_tWR >> 19), (SDRAM_CL >> 2 ));
printf("SDRAM Begin: 0x%x\n", CFG_SDRAM_BASE);
printf("Bank size = %d MB\n", 128);
printf ("SDRAM attributes:\n");
printf (" tRCD:%d Cycles; tRP:%d Cycles; tRAS:%d Cycles; tWR:%d Cycles; "
"CAS Latency:%d cycles\n",
(SDRAM_tRCD >> 15),
(SDRAM_tRP >> 11),
(SDRAM_tRAS >> 6),
(SDRAM_tWR >> 19),
(SDRAM_CL >> 2));
printf ("SDRAM Begin: 0x%x\n", CFG_SDRAM_BASE);
printf ("Bank size = %d MB\n", 128);
#endif
gd->bd->bi_memstart = CFG_SDRAM_BASE;
gd->bd->bi_memsize = CFG_MAX_RAM_SIZE;
return (gd->bd->bi_memsize);
}
void swap_to(int device_id)
void swap_to (int device_id)
{
if (device_id == ETHERNET)
{
if (device_id == ETHERNET) {
*pFIO_DIR = PF0;
asm("ssync;");
asm ("ssync;");
*pFIO_FLAG_S = PF0;
asm("ssync;");
}
else if (device_id == FLASH)
{
asm ("ssync;");
} else if (device_id == FLASH) {
*pFIO_DIR = (PF4 | PF3 | PF2 | PF1 | PF0);
*pFIO_FLAG_S = (PF4 | PF3 | PF2 );
*pFIO_FLAG_S = (PF4 | PF3 | PF2);
*pFIO_MASKA_D = (PF8 | PF6 | PF5);
*pFIO_MASKB_D = (PF7);
*pFIO_POLAR = (PF8 | PF6 | PF5 );
*pFIO_POLAR = (PF8 | PF6 | PF5);
*pFIO_EDGE = (PF8 | PF7 | PF6 | PF5);
*pFIO_INEN = (PF8 | PF7 | PF6 | PF5);
*pFIO_FLAG_D = (PF4 | PF3 | PF2 );
asm("ssync;");
}
else {
printf("Unknown bank to switch\n");
*pFIO_FLAG_D = (PF4 | PF3 | PF2);
asm ("ssync;");
} else {
printf ("Unknown bank to switch\n");
}
return;
@ -94,7 +94,7 @@ void swap_to(int device_id)
#if defined(CONFIG_MISC_INIT_R)
/* miscellaneous platform dependent initialisations */
int misc_init_r(void)
int misc_init_r (void)
{
int i;
int cf_stat = 0;
@ -102,14 +102,12 @@ int misc_init_r(void)
/* Check whether CF card is inserted */
*pFIO_EDGE = FIO_EDGE_CF_BITS;
*pFIO_POLAR = FIO_POLAR_CF_BITS;
for (i=0; i < 0x300 ; i++) asm("nop;");
for (i = 0; i < 0x300; i++)
asm ("nop;");
if ( (*pFIO_FLAG_S) & CF_STAT_BITS)
{
if ((*pFIO_FLAG_S) & CF_STAT_BITS) {
cf_stat = 0;
}
else
{
} else {
cf_stat = 1;
}
@ -117,25 +115,26 @@ int misc_init_r(void)
*pFIO_POLAR = FIO_POLAR_BITS;
if (cf_stat)
{
if (cf_stat) {
printf ("Booting from COMPACT flash\n");
/* Set cycle time for CF */
*(volatile unsigned long *) ambctl1 = CF_AMBCTL1VAL;
for (i=0; i < 0x1000 ; i++) asm("nop;");
for (i=0; i < 0x1000 ; i++) asm("nop;");
for (i=0; i < 0x1000 ; i++) asm("nop;");
for (i = 0; i < 0x1000; i++)
asm ("nop;");
for (i = 0; i < 0x1000; i++)
asm ("nop;");
for (i = 0; i < 0x1000; i++)
asm ("nop;");
serial_setbrg();
ide_init();
serial_setbrg ();
ide_init ();
setenv ("bootargs", "");
setenv ("bootcmd", "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000" );
}
else
{
setenv ("bootcmd",
"fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000");
} else {
printf ("Booting from FLASH\n");
}
@ -145,7 +144,7 @@ int misc_init_r(void)
#ifdef CONFIG_STAMP_CF
void cf_outb(unsigned char val, volatile unsigned char* addr)
void cf_outb (unsigned char val, volatile unsigned char *addr)
{
/*
* Set PF1 PF0 respectively to 0 1 to divert address
@ -153,113 +152,111 @@ void cf_outb(unsigned char val, volatile unsigned char* addr)
*/
*pFIO_FLAG_S = CF_PF0;
*pFIO_FLAG_C = CF_PF1;
asm("ssync;");
asm ("ssync;");
*(addr) = val;
asm("ssync;");
asm ("ssync;");
/* Setback PF1 PF0 to 0 0 to address external
* memory banks */
*(volatile unsigned short *) pFIO_FLAG_C = CF_PF1_PF0;
asm("ssync;");
asm ("ssync;");
}
unsigned char cf_inb(volatile unsigned char *addr)
unsigned char cf_inb (volatile unsigned char *addr)
{
volatile unsigned char c;
*pFIO_FLAG_S = CF_PF0;
*pFIO_FLAG_C = CF_PF1;
asm("ssync;");
asm ("ssync;");
c = *(addr);
asm("ssync;");
asm ("ssync;");
*pFIO_FLAG_C = CF_PF1_PF0;
asm("ssync;");
asm ("ssync;");
return c;
}
void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
void cf_insw (unsigned short *sect_buf, unsigned short *addr, int words)
{
int i;
*pFIO_FLAG_S = CF_PF0;
*pFIO_FLAG_C = CF_PF1;
asm("ssync;");
asm ("ssync;");
for (i = 0;i < words; i++)
{
for (i = 0; i < words; i++) {
*(sect_buf + i) = *(addr);
asm("ssync;");
asm ("ssync;");
}
*pFIO_FLAG_C = CF_PF1_PF0;
asm("ssync;");
asm ("ssync;");
}
void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
void cf_outsw (unsigned short *addr, unsigned short *sect_buf, int words)
{
int i;
*pFIO_FLAG_S = CF_PF0;
*pFIO_FLAG_C = CF_PF1;
asm("ssync;");
asm ("ssync;");
for (i = 0;i < words; i++)
{
for (i = 0; i < words; i++) {
*(addr) = *(sect_buf + i);
asm("ssync;");
asm ("ssync;");
}
*pFIO_FLAG_C = CF_PF1_PF0;
asm("ssync;");
asm ("ssync;");
}
#endif
void stamp_led_set(int LED1, int LED2, int LED3)
void stamp_led_set (int LED1, int LED2, int LED3)
{
*pFIO_INEN &= ~( PF2 | PF3 | PF4);
*pFIO_DIR |= ( PF2 | PF3 | PF4);
*pFIO_INEN &= ~(PF2 | PF3 | PF4);
*pFIO_DIR |= (PF2 | PF3 | PF4);
if(LED1 == STATUS_LED_OFF)
if (LED1 == STATUS_LED_OFF)
*pFIO_FLAG_S = PF2;
else
*pFIO_FLAG_C = PF2;
if(LED2 == STATUS_LED_OFF)
if (LED2 == STATUS_LED_OFF)
*pFIO_FLAG_S = PF3;
else
*pFIO_FLAG_C = PF3;
if(LED3 == STATUS_LED_OFF)
if (LED3 == STATUS_LED_OFF)
*pFIO_FLAG_S = PF4;
else
*pFIO_FLAG_C = PF4;
asm("ssync;");
asm ("ssync;");
}
void show_boot_progress(int status)
void show_boot_progress (int status)
{
switch(status){
switch (status) {
case 1:
stamp_led_set(STATUS_LED_OFF,STATUS_LED_OFF,STATUS_LED_ON);
stamp_led_set (STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
break;
case 2:
stamp_led_set(STATUS_LED_OFF,STATUS_LED_ON,STATUS_LED_OFF);
stamp_led_set (STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
break;
case 3:
stamp_led_set(STATUS_LED_OFF,STATUS_LED_ON,STATUS_LED_ON);
stamp_led_set (STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
break;
case 4:
stamp_led_set(STATUS_LED_ON,STATUS_LED_OFF,STATUS_LED_OFF);
stamp_led_set (STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
break;
case 5:
case 6:
stamp_led_set(STATUS_LED_ON,STATUS_LED_OFF,STATUS_LED_ON);
stamp_led_set (STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
break;
case 7:
case 8:
stamp_led_set(STATUS_LED_ON,STATUS_LED_ON,STATUS_LED_OFF);
stamp_led_set (STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
break;
case 9:
case 10:
@ -268,11 +265,11 @@ void show_boot_progress(int status)
case 13:
case 14:
case 15:
stamp_led_set(STATUS_LED_OFF,STATUS_LED_OFF,STATUS_LED_OFF);
stamp_led_set (STATUS_LED_OFF, STATUS_LED_OFF,
STATUS_LED_OFF);
break;
default:
stamp_led_set(STATUS_LED_ON,STATUS_LED_ON,STATUS_LED_ON);
stamp_led_set (STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
break;
}
}

View File

@ -145,4 +145,3 @@ SECTIONS
_end = . ;
PROVIDE (end = .);
}

View File

@ -191,4 +191,3 @@ do_not_know_what_to_do:
panic_bfin:
RTS;

View File

@ -86,10 +86,6 @@ static unsigned int dcplb_table[16][2]={
{0x20000000,SDRAM_EBIU}, /*For Network */
};
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
__asm__ __volatile__
@ -173,7 +169,6 @@ void dcache_enable(void)
sti();
}
void dcache_disable(void)
{
cli();

View File

@ -272,9 +272,6 @@
#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */
#define CFG_MONITOR_BASE (CFG_MAX_RAM_SIZE - CFG_MONITOR_LEN)
#if ( CONFIG_CLKIN_HALF == 0 )
#define CONFIG_VCO_HZ ( CONFIG_CLKIN_HZ * CONFIG_VCO_MULT )
#else
@ -289,8 +286,6 @@
#define CONFIG_SCLK_HZ CONFIG_CLKIN_HZ
#endif
/*
* Miscellaneous configurable options
*/
@ -311,7 +306,6 @@
*/
#define CONFIG_STACKSIZE (128*1024) /* regular stack */
/*
* FLASH organization and environment definitions
*/
@ -336,5 +330,4 @@
#define VDSP_ENTRY_ADDR 0xFFA00000
#endif
#endif

View File

@ -26,16 +26,15 @@
*/
/* for now: just dummy functions to satisfy the linker */
extern void blackfin_icache_range(unsigned long *,unsigned long *);
extern void blackfin_dcache_range(unsigned long *,unsigned long *);
void flush_cache(unsigned long dummy1, unsigned long dummy2)
extern void blackfin_icache_range (unsigned long *, unsigned long *);
extern void blackfin_dcache_range (unsigned long *, unsigned long *);
void flush_cache (unsigned long dummy1, unsigned long dummy2)
{
if(icache_status()){
blackfin_icache_flush_range(dummy1,dummy1+dummy2);
if (icache_status ()) {
blackfin_icache_flush_range (dummy1, dummy1 + dummy2);
}
if(dcache_status()){
blackfin_dcache_flush_range(dummy1,dummy1+dummy2);
if (dcache_status ()) {
blackfin_dcache_flush_range (dummy1, dummy1 + dummy2);
}
return;
}

View File

@ -54,25 +54,25 @@
#include <asm/blackfin.h>
#include <asm/cpu/bf533_rtc.h>
void rtc_reset(void)
void rtc_reset (void)
{
return; /* nothing to do */
}
/* Wait for pending writes to complete */
void wait_for_complete(void)
void wait_for_complete (void)
{
while (!(*(volatile unsigned short *) RTC_ISTAT & 0x8000)) {
printf("");
printf ("");
}
*(volatile unsigned short *) RTC_ISTAT = 0x8000;
}
/* Enable the RTC prescaler enable register */
void rtc_init()
void rtc_init ()
{
*(volatile unsigned short *) RTC_PREN = 0x1;
wait_for_complete();
wait_for_complete ();
}
/* Set the time. Get the time_in_secs which is the number of seconds since Jan 1970 and set the RTC registers
@ -87,18 +87,20 @@ void rtc_set (struct rtc_time *tmp)
unsigned long n_secs = 0;
unsigned long time_in_secs;
if(tmp == NULL) {
printf("Error setting the date/time \n");
if (tmp == NULL) {
printf ("Error setting the date/time \n");
return;
}
time_in_secs = mktime(tmp->tm_year, tmp->tm_mon, tmp->tm_mday,tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
time_in_secs =
mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
tmp->tm_min, tmp->tm_sec);
/* Compute no. of days since 1970 */
n_days_1970 = (unsigned long) (time_in_secs / (NUM_SECS_IN_DAY));
/* From the remining secs, compute the hrs(0-23), mins(0-59) and secs(0-59) */
n_secs_rem = (unsigned long)(time_in_secs % (NUM_SECS_IN_DAY));
n_secs_rem = (unsigned long) (time_in_secs % (NUM_SECS_IN_DAY));
n_hrs = n_secs_rem / (NUM_SECS_IN_HOUR);
n_secs_rem = n_secs_rem % (NUM_SECS_IN_HOUR);
n_mins = n_secs_rem / (NUM_SECS_IN_MIN);
@ -109,7 +111,7 @@ void rtc_set (struct rtc_time *tmp)
((n_days_1970 << DAY_BITS_OFF) | (n_hrs << HOUR_BITS_OFF) |
(n_mins << MIN_BITS_OFF) | (n_secs << SEC_BITS_OFF));
wait_for_complete();
wait_for_complete ();
}
/* Read the time from the RTC_STAT. time_in_seconds is seconds since Jan 1970 */
@ -119,8 +121,8 @@ void rtc_get (struct rtc_time *tmp)
unsigned long time_in_sec;
unsigned long tm_sec = 0, tm_min = 0, tm_hour = 0, tm_day = 0;
if(tmp == NULL) {
printf("Error getting the date/time \n");
if (tmp == NULL) {
printf ("Error getting the date/time \n");
return;
}
@ -135,9 +137,9 @@ void rtc_get (struct rtc_time *tmp)
/* Calculate the total number of seconds since Jan 1970 */
time_in_sec = (tm_sec) +
MIN_TO_SECS(tm_min) +
HRS_TO_SECS(tm_hour) +
DAYS_TO_SECS(tm_day);
to_tm(time_in_sec,tmp);
MIN_TO_SECS (tm_min) +
HRS_TO_SECS (tm_hour) +
DAYS_TO_SECS (tm_day);
to_tm (time_in_sec, tmp);
}
#endif /* CONFIG_RTC_BF533 && CFG_CMD_DATE */