]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/bf533-stamp/bf533-stamp.c
Merge branch 'master' of git://git.denx.de/u-boot-blackfin
[karo-tx-uboot.git] / board / bf533-stamp / bf533-stamp.c
index b9dff99171a46cf81b2eebdad9d2ab4255b67e37..44ebc931946a041feabd64c59a47eac28c092b2e 100644 (file)
  */
 
 #include <common.h>
-#include <asm/mem_init.h>
 #include <asm/io.h>
 #include "bf533-stamp.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define STATUS_LED_OFF 0
 #define STATUS_LED_ON  1
 
 
 int checkboard(void)
 {
-#if (BFIN_CPU == ADSP_BF531)
-       printf("CPU:   ADSP BF531 Rev.: 0.%d\n", *pCHIPID >> 28);
-#elif (BFIN_CPU == ADSP_BF532)
-       printf("CPU:   ADSP BF532 Rev.: 0.%d\n", *pCHIPID >> 28);
-#else
-       printf("CPU:   ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28);
-#endif
        printf("Board: ADI BF533 Stamp board\n");
        printf("       Support: http://blackfin.uclinux.org/\n");
        return 0;
 }
 
-long int initdram(int board_type)
+phys_size_t 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);
-#endif
-       gd->bd->bi_memstart = CFG_SDRAM_BASE;
-       gd->bd->bi_memsize = CFG_MAX_RAM_SIZE;
-       return (gd->bd->bi_memsize);
+       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+       gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+       return gd->bd->bi_memsize;
 }
 
+/* PF0 and PF1 are used to switch between the ethernet and flash:
+ *         PF0  PF1
+ *  flash:  0    0
+ *  ether:  1    0
+ */
 void swap_to(int device_id)
 {
-
-       if (device_id == ETHERNET) {
-               *pFIO_DIR = PF0;
-               sync();
-               *pFIO_FLAG_S = PF0;
-               sync();
-       } else if (device_id == FLASH) {
-               *pFIO_DIR = (PF4 | PF3 | PF2 | PF1 | PF0);
-               *pFIO_FLAG_S = (PF4 | PF3 | PF2);
-               *pFIO_MASKA_D = (PF8 | PF6 | PF5);
-               *pFIO_MASKB_D = (PF7);
-               *pFIO_POLAR = (PF8 | PF6 | PF5);
-               *pFIO_EDGE = (PF8 | PF7 | PF6 | PF5);
-               *pFIO_INEN = (PF8 | PF7 | PF6 | PF5);
-               *pFIO_FLAG_D = (PF4 | PF3 | PF2);
-               sync();
-       } else {
-               printf("Unknown bank to switch\n");
-       }
-
-       return;
+       bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF1 | PF0);
+       SSYNC();
+       bfin_write_FIO_FLAG_C(PF1);
+       if (device_id == ETHERNET)
+               bfin_write_FIO_FLAG_S(PF0);
+       else if (device_id == FLASH)
+               bfin_write_FIO_FLAG_C(PF0);
+       else
+               printf("Unknown device to switch\n");
+       SSYNC();
 }
 
 #if defined(CONFIG_MISC_INIT_R)
@@ -120,9 +98,6 @@ int misc_init_r(void)
        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++)
@@ -154,15 +129,15 @@ void cf_outb(unsigned char val, volatile unsigned char *addr)
         */
        *pFIO_FLAG_S = CF_PF0;
        *pFIO_FLAG_C = CF_PF1;
-       sync();
+       SSYNC();
 
        *(addr) = val;
-       sync();
+       SSYNC();
 
        /* Setback PF1 PF0 to 0 0 to address external
         * memory banks  */
        *(volatile unsigned short *)pFIO_FLAG_C = CF_PF1_PF0;
-       sync();
+       SSYNC();
 }
 
 unsigned char cf_inb(volatile unsigned char *addr)
@@ -171,13 +146,13 @@ unsigned char cf_inb(volatile unsigned char *addr)
 
        *pFIO_FLAG_S = CF_PF0;
        *pFIO_FLAG_C = CF_PF1;
-       sync();
+       SSYNC();
 
        c = *(addr);
-       sync();
+       SSYNC();
 
        *pFIO_FLAG_C = CF_PF1_PF0;
-       sync();
+       SSYNC();
 
        return c;
 }
@@ -188,15 +163,15 @@ void cf_insw(unsigned short *sect_buf, unsigned short *addr, int words)
 
        *pFIO_FLAG_S = CF_PF0;
        *pFIO_FLAG_C = CF_PF1;
-       sync();
+       SSYNC();
 
        for (i = 0; i < words; i++) {
                *(sect_buf + i) = *(addr);
-               sync();
+               SSYNC();
        }
 
        *pFIO_FLAG_C = CF_PF1_PF0;
-       sync();
+       SSYNC();
 }
 
 void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
@@ -205,15 +180,15 @@ void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words)
 
        *pFIO_FLAG_S = CF_PF0;
        *pFIO_FLAG_C = CF_PF1;
-       sync();
+       SSYNC();
 
        for (i = 0; i < words; i++) {
                *(addr) = *(sect_buf + i);
-               sync();
+               SSYNC();
        }
 
        *pFIO_FLAG_C = CF_PF1_PF0;
-       sync();
+       SSYNC();
 }
 #endif
 
@@ -234,7 +209,7 @@ void stamp_led_set(int LED1, int LED2, int LED3)
                *pFIO_FLAG_S = PF4;
        else
                *pFIO_FLAG_C = PF4;
-       sync();
+       SSYNC();
 }
 
 void show_boot_progress(int status)