]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Patch by Steven Scholz, 13 Dec 2004:
authorwdenk <wdenk>
Thu, 31 Mar 2005 23:44:33 +0000 (23:44 +0000)
committerwdenk <wdenk>
Thu, 31 Mar 2005 23:44:33 +0000 (23:44 +0000)
Remove duplicated code by merging memsetup.S files for
at91rm9200 boards into one cpu/at91rm9200/lowlevel.S

CHANGELOG
board/at91rm9200dk/Makefile
board/at91rm9200dk/memsetup.S [deleted file]
board/cmc_pu2/Makefile
cpu/at91rm9200/Makefile
cpu/at91rm9200/lowlevel.S [moved from board/cmc_pu2/memsetup.S with 67% similarity]
cpu/at91rm9200/start.S
include/configs/at91rm9200dk.h
include/configs/cmc_pu2.h

index e7fc57cf8aac8851b5521b031eae611c20cffa39..e4bff20bdfbfdf4dd8d2d703d066e6dc8e95d9a1 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,10 @@
 Changes for U-Boot 1.1.3:
 ======================================================================
 
+* Patch by Steven Scholz, 13 Dec 2004:
+  Remove duplicated code by merging memsetup.S files for
+  at91rm9200 boards into one cpu/at91rm9200/lowlevel.S
+
 * Patch by Detlev Zundel, 31 Mar 2005:
   Cleanup duplicate definition of overwrite_console()
 
index f94bd990da102eb657bd557557a623e98aff041b..2f70ec6f368820e83fc8e8fa55fd84645b417721 100644 (file)
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk
 LIB    = lib$(BOARD).a
 
 OBJS   := at91rm9200dk.o at45.o dm9161.o flash.o
-SOBJS  := memsetup.o
 
 $(LIB):        $(OBJS) $(SOBJS)
        $(AR) crv $@ $(OBJS) $(SOBJS)
diff --git a/board/at91rm9200dk/memsetup.S b/board/at91rm9200dk/memsetup.S
deleted file mode 100644 (file)
index 725b62e..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Memory Setup stuff - taken from blob memsetup.S
- *
- * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
- *                    Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
- *
- * Modified for the at91rm9200dk board by
- * (C) Copyright 2004
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * 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
- */
-
-#include <config.h>
-#include <version.h>
-
-#ifdef CONFIG_BOOTBINFUNC
-/*
- * some parameters for the board
- *
- * This is based on rm9200dk.cfg for the BDI2000 from ABATRON which in
- * turn is based on the boot.bin code from ATMEL
- *
- */
-
-/* flash */
-#define MC_PUIA 0xFFFFFF10
-#define MC_PUIA_VAL 0x00000000
-#define MC_PUP 0xFFFFFF50
-#define MC_PUP_VAL 0x00000000
-#define MC_PUER 0xFFFFFF54
-#define MC_PUER_VAL 0x00000000
-#define MC_ASR 0xFFFFFF04
-#define MC_ASR_VAL 0x00000000
-#define MC_AASR 0xFFFFFF08
-#define MC_AASR_VAL 0x00000000
-#define EBI_CFGR 0xFFFFFF64
-#define EBI_CFGR_VAL 0x00000000
-#define SMC2_CSR 0xFFFFFF70
-#define SMC2_CSR_VAL 0x00003284 /* 16bit, 2 TDF, 4 WS */
-
-/* clocks */
-#define PLLAR 0xFFFFFC28
-#define PLLAR_VAL 0x20263E04 /* 179.712000 MHz for PCK */
-#define PLLBR 0xFFFFFC2C
-#define PLLBR_VAL 0x10483E0E /* 48.054857 MHz (divider by 2 for USB) */
-#define MCKR 0xFFFFFC30
-#define MCKR_VAL 0x00000202 /* PCK/3 = MCK Master Clock = 59.904000MHz from PLLA */
-
-/* sdram */
-#define PIOC_ASR 0xFFFFF870
-#define PIOC_ASR_VAL 0xFFFF0000 /* Configure PIOC as peripheral (D16/D31) */
-#define PIOC_BSR 0xFFFFF874
-#define PIOC_BSR_VAL 0x00000000
-#define PIOC_PDR 0xFFFFF804
-#define PIOC_PDR_VAL 0xFFFF0000
-#define EBI_CSA 0xFFFFFF60
-#define EBI_CSA_VAL 0x00000002 /* CS1=SDRAM */
-#define SDRC_CR 0xFFFFFF98
-#define SDRC_CR_VAL 0x2188c155 /* set up the SDRAM */
-#define SDRAM 0x20000000 /* address of the SDRAM */
-#define SDRAM1 0x20000080 /* address of the SDRAM */
-#define SDRAM_VAL 0x00000000 /* value written to SDRAM */
-#define SDRC_MR 0xFFFFFF90
-#define SDRC_MR_VAL 0x00000002 /* Precharge All */
-#define SDRC_MR_VAL1 0x00000004 /* refresh */
-#define SDRC_MR_VAL2 0x00000003 /* Load Mode Register */
-#define SDRC_MR_VAL3 0x00000000 /* Normal Mode */
-#define SDRC_TR 0xFFFFFF94
-#define SDRC_TR_VAL 0x000002E0 /* Write refresh rate */
-
-
-_TEXT_BASE:
-       .word   TEXT_BASE
-
-.globl lowlevelinit
-lowlevelinit:
-       /* memory control configuration */
-       /* this isn't very elegant, but  what the heck */
-       ldr     r0, =SMRDATA
-       ldr     r1, _TEXT_BASE
-       sub     r0, r0, r1
-       add     r2, r0, #80
-0:
-       /* the address */
-       ldr     r1, [r0], #4
-       /* the value */
-       ldr     r3, [r0], #4
-       str     r3, [r1]
-       cmp     r2, r0
-       bne     0b
-       /* delay - this is all done by guess */
-       ldr     r0, =0x00010000
-1:
-       subs    r0, r0, #1
-       bhi     1b
-       ldr     r0, =SMRDATA1
-       ldr     r1, _TEXT_BASE
-       sub     r0, r0, r1
-       add     r2, r0, #176
-2:
-       /* the address */
-       ldr     r1, [r0], #4
-       /* the value */
-       ldr     r3, [r0], #4
-       str     r3, [r1]
-       cmp     r2, r0
-       bne     2b
-
-       /* everything is fine now */
-       mov     pc, lr
-
-       .ltorg
-
-SMRDATA:
-       .word MC_PUIA
-       .word MC_PUIA_VAL
-       .word MC_PUP
-       .word MC_PUP_VAL
-       .word MC_PUER
-       .word MC_PUER_VAL
-       .word MC_ASR
-       .word MC_ASR_VAL
-       .word MC_AASR
-       .word MC_AASR_VAL
-       .word EBI_CFGR
-       .word EBI_CFGR_VAL
-       .word SMC2_CSR
-       .word SMC2_CSR_VAL
-       .word PLLAR
-       .word PLLAR_VAL
-       .word PLLBR
-       .word PLLBR_VAL
-       .word MCKR
-       .word MCKR_VAL
-       /* SMRDATA is 80 bytes long */
-       /* here there's a delay of 100 */
-SMRDATA1:
-       .word PIOC_ASR
-       .word PIOC_ASR_VAL
-       .word PIOC_BSR
-       .word PIOC_BSR_VAL
-       .word PIOC_PDR
-       .word PIOC_PDR_VAL
-       .word EBI_CSA
-       .word EBI_CSA_VAL
-       .word SDRC_CR
-       .word SDRC_CR_VAL
-       .word SDRC_MR
-       .word SDRC_MR_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRC_MR
-       .word SDRC_MR_VAL1
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRC_MR
-       .word SDRC_MR_VAL2
-       .word SDRAM1
-       .word SDRAM_VAL
-       .word SDRC_TR
-       .word SDRC_TR_VAL
-       .word SDRAM
-       .word SDRAM_VAL
-       .word SDRC_MR
-       .word SDRC_MR_VAL3
-       .word SDRAM
-       .word SDRAM_VAL
-       /* SMRDATA1 is 176 bytes long */
-#endif /* CONFIG_BOOTBINFUNC */
index a939bbb782178dd791a5f9d3cc608b6a59a16245..ba433d5bf2f5ffadbac0cb02377d7b8cef261335 100644 (file)
@@ -26,7 +26,6 @@ include $(TOPDIR)/config.mk
 LIB    = lib$(BOARD).a
 
 OBJS   := cmc_pu2.o at45.o dm9161.o flash.o
-SOBJS  := memsetup.o
 
 $(LIB):        $(OBJS) $(SOBJS)
        $(AR) crv $@ $(OBJS) $(SOBJS)
index b7a30c93b203537a10e575e2b360257101d4ca2b..18c995b6a74cf6cb39f8670598c897691b7052fc 100644 (file)
@@ -28,11 +28,12 @@ LIB = lib$(CPU).a
 START  = start.o
 OBJS   = serial.o interrupts.o cpu.o \
          at91rm9200_ether.o i2c.o
+SOBJS  = lowlevel.o
 
 all:   .depend $(START) $(LIB)
 
-$(LIB):        $(OBJS)
-       $(AR) crv $@ $(OBJS)
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
 
 #########################################################################
 
similarity index 67%
rename from board/cmc_pu2/memsetup.S
rename to cpu/at91rm9200/lowlevel.S
index e6a255f0afdb05bd745c2b394a258923826fd7e2..030f9e194a89626da111d9c4e95f71d221730df7 100644 (file)
  */
 
 /* flash */
-#define MC_PUIA 0xFFFFFF10
-#define MC_PUIA_VAL 0x00000000
-#define MC_PUP 0xFFFFFF50
-#define MC_PUP_VAL 0x00000000
-#define MC_PUER 0xFFFFFF54
-#define MC_PUER_VAL 0x00000000
-#define MC_ASR 0xFFFFFF04
-#define MC_ASR_VAL 0x00000000
-#define MC_AASR 0xFFFFFF08
-#define MC_AASR_VAL 0x00000000
-#define EBI_CFGR 0xFFFFFF64
-#define EBI_CFGR_VAL 0x00000000
-#define SMC2_CSR 0xFFFFFF70
-#define SMC2_CSR_VAL 0x100032ad /* 16bit, 2 TDF, 4 WS */
+#define MC_PUIA                0xFFFFFF10
+#define MC_PUP         0xFFFFFF50
+#define MC_PUER                0xFFFFFF54
+#define MC_ASR         0xFFFFFF04
+#define MC_AASR                0xFFFFFF08
+#define EBI_CFGR       0xFFFFFF64
+#define SMC2_CSR       0xFFFFFF70
 
 /* clocks */
-#define PLLAR 0xFFFFFC28
-#define PLLAR_VAL 0x202CBE04 /* 207.360 MHz for PCK */
-#define PLLBR 0xFFFFFC2C
-#define PLLBR_VAL 0x10483E0E /* 48.054857 MHz (divider by 2 for USB) */
-#define MCKR 0xFFFFFC30
-#define MCKR_VAL 0x00000202 /* PCK/3 = MCK Master Clock = 69.120MHz from PLLA */
+#define PLLAR          0xFFFFFC28
+#define PLLBR          0xFFFFFC2C
+#define MCKR           0xFFFFFC30
+
+#define AT91C_BASE_CKGR 0xFFFFFC20
+#define CKGR_MOR 0
 
 /* sdram */
-#define PIOC_ASR 0xFFFFF870
-#define PIOC_ASR_VAL 0xFFFF0000 /* Configure PIOC as peripheral (D16/D31) */
-#define PIOC_BSR 0xFFFFF874
-#define PIOC_BSR_VAL 0x00000000
-#define PIOC_PDR 0xFFFFF804
-#define PIOC_PDR_VAL 0xFFFF0000
-#define EBI_CSA 0xFFFFFF60
-#define EBI_CSA_VAL 0x00000002 /* CS1=SDRAM */
-#define SDRC_CR 0xFFFFFF98
-#define SDRC_CR_VAL 0x3399c1d4 /* set up the SDRAM */
-#define SDRAM 0x20000000 /* address of the SDRAM */
-#define SDRAM1 0x20000080 /* address of the SDRAM */
-#define SDRAM_VAL 0x00000000 /* value written to SDRAM */
-#define SDRC_MR 0xFFFFFF90
-#define SDRC_MR_VAL 0x00000002 /* Precharge All */
-#define SDRC_MR_VAL1 0x00000004 /* refresh */
-#define SDRC_MR_VAL2 0x00000003 /* Load Mode Register */
-#define SDRC_MR_VAL3 0x00000000 /* Normal Mode */
-#define SDRC_TR 0xFFFFFF94
-#define SDRC_TR_VAL 0x000002E0 /* Write refresh rate */
+#define PIOC_ASR       0xFFFFF870
+#define PIOC_BSR       0xFFFFF874
+#define PIOC_PDR       0xFFFFF804
+#define EBI_CSA                0xFFFFFF60
+#define SDRC_CR                0xFFFFFF98
+#define SDRC_MR                0xFFFFFF90
+#define SDRC_TR                0xFFFFFF94
 
 
 _MTEXT_BASE:
@@ -96,6 +76,21 @@ _MTEXT_BASE:
 
 .globl lowlevelinit
 lowlevelinit:
+       /* Get the CKGR Base Address */
+       ldr     r1, =AT91C_BASE_CKGR
+       /* Main oscillator Enable register */
+#ifdef CFG_USE_MAIN_OSCILLATOR
+       ldr     r0, =0x0000FF01         /* Enable main oscillator,  OSCOUNT = 0xFF */
+#else
+       ldr     r0, =0x0000FF00         /* Disable main oscillator, OSCOUNT = 0xFF */
+#endif
+       str     r0, [r1, #CKGR_MOR]
+       /* Add loop to compensate Main Oscillator startup time */
+       ldr     r0, =0x00000010
+LoopOsc:
+       subs    r0, r0, #1
+       bhi     LoopOsc
+
        /* memory control configuration */
        /* this isn't very elegant, but  what the heck */
        ldr     r0, =SMRDATA
index 51bd2407c5926cc9784c1dd715335c80ca88ce6f..43ab93db611869b3c48c867b7d8a46bf5904d61a 100644 (file)
@@ -116,22 +116,6 @@ reset:
        msr     cpsr,r0
 
 #ifdef CONFIG_BOOTBINFUNC
-/* code based on entry.S from ATMEL */
-#define AT91C_BASE_CKGR 0xFFFFFC20
-#define CKGR_MOR 0
-       /* Get the CKGR Base Address */
-       ldr     r1, =AT91C_BASE_CKGR
-
-/* Main oscillator Enable register     APMC_MOR : Enable main oscillator , OSCOUNT = 0xFF */
-/*     ldr     r0, = AT91C_CKGR_MOSCEN:OR:AT91C_CKGR_OSCOUNT */
-       ldr     r0, =0x0000FF01
-       str     r0, [r1, #CKGR_MOR]
-       /* Add loop to compensate Main Oscillator startup time */
-       ldr     r0, =0x00000010
-LoopOsc:
-       subs    r0, r0, #1
-       bhi     LoopOsc
-
        /* scratch stack */
        ldr     r1, =0x00204000
        /* Insure word alignment */
@@ -142,7 +126,7 @@ LoopOsc:
         * This does a lot more than just set up the memory, which
         * is why it's called lowlevelinit
         */
-       bl      lowlevelinit /* in memsetup.S */
+       bl      lowlevelinit /* in lowlevel.S */
        bl      icache_enable;
        /*------------------------------------
          Read/modify/write CP15 control register
index 58e20455445c4c3627942feab0e9ac715fe5f6ce..8146fe723d61c5480ebf98bd983496db613704d7 100644 (file)
 /* define this to include the functionality of boot.bin in u-boot */
 #undef CONFIG_BOOTBINFUNC
 
+#ifdef CONFIG_BOOTBINFUNC
+#define CFG_USE_MAIN_OSCILLATOR                1
+/* flash */
+#define MC_PUIA_VAL    0x00000000
+#define MC_PUP_VAL     0x00000000
+#define MC_PUER_VAL    0x00000000
+#define MC_ASR_VAL     0x00000000
+#define MC_AASR_VAL    0x00000000
+#define EBI_CFGR_VAL   0x00000000
+#define SMC2_CSR_VAL   0x00003284 /* 16bit, 2 TDF, 4 WS */
+
+/* clocks */
+#define PLLAR_VAL      0x20263E04 /* 179.712000 MHz for PCK */
+#define PLLBR_VAL      0x10483E0E /* 48.054857 MHz (divider by 2 for USB) */
+#define MCKR_VAL       0x00000202 /* PCK/3 = MCK Master Clock = 59.904000MHz from PLLA */
+
+/* sdram */
+#define PIOC_ASR_VAL   0xFFFF0000 /* Configure PIOC as peripheral (D16/D31) */
+#define PIOC_BSR_VAL   0x00000000
+#define PIOC_PDR_VAL   0xFFFF0000
+#define EBI_CSA_VAL    0x00000002 /* CS1=SDRAM */
+#define SDRC_CR_VAL    0x2188c155 /* set up the SDRAM */
+#define SDRAM          0x20000000 /* address of the SDRAM */
+#define SDRAM1         0x20000080 /* address of the SDRAM */
+#define SDRAM_VAL      0x00000000 /* value written to SDRAM */
+#define SDRC_MR_VAL    0x00000002 /* Precharge All */
+#define SDRC_MR_VAL1   0x00000004 /* refresh */
+#define SDRC_MR_VAL2   0x00000003 /* Load Mode Register */
+#define SDRC_MR_VAL3   0x00000000 /* Normal Mode */
+#define SDRC_TR_VAL    0x000002E0 /* Write refresh rate */
+#endif
 /*
  * Size of malloc() pool
  */
index e87e3184ff52420fb7254998265182e45c7d6391..a9742c19b26b2b5f3b7b1557b6227fa98907c926 100644 (file)
 #define CONFIG_BOOTBINFUNC
 #endif
 
+#ifdef CONFIG_BOOTBINFUNC
+#define CFG_USE_MAIN_OSCILLATOR                1
+/* flash */
+#define MC_PUIA_VAL    0x00000000
+#define MC_PUP_VAL     0x00000000
+#define MC_PUER_VAL    0x00000000
+#define MC_ASR_VAL     0x00000000
+#define MC_AASR_VAL    0x00000000
+#define EBI_CFGR_VAL   0x00000000
+#define SMC2_CSR_VAL   0x100032ad /* 16bit, 2 TDF, 4 WS */
+
+/* clocks */
+#define PLLAR_VAL      0x202CBE04 /* 207.360 MHz for PCK */
+#define PLLBR_VAL      0x10483E0E /* 48.054857 MHz (divider by 2 for USB) */
+#define MCKR_VAL       0x00000202 /* PCK/3 = MCK Master Clock = 69.120MHz from PLLA */
+
+/* sdram */
+#define PIOC_ASR_VAL   0xFFFF0000 /* Configure PIOC as peripheral (D16/D31) */
+#define PIOC_BSR_VAL   0x00000000
+#define PIOC_PDR_VAL   0xFFFF0000
+#define EBI_CSA_VAL    0x00000002 /* CS1=SDRAM */
+#define SDRC_CR_VAL    0x3399c1d4 /* set up the SDRAM */
+#define SDRAM          0x20000000 /* address of the SDRAM */
+#define SDRAM1         0x20000080 /* address of the SDRAM */
+#define SDRAM_VAL      0x00000000 /* value written to SDRAM */
+#define SDRC_MR_VAL    0x00000002 /* Precharge All */
+#define SDRC_MR_VAL1   0x00000004 /* refresh */
+#define SDRC_MR_VAL2   0x00000003 /* Load Mode Register */
+#define SDRC_MR_VAL3   0x00000000 /* Normal Mode */
+#define SDRC_TR_VAL    0x000002E0 /* Write refresh rate */
+#endif
+
 /*
  * Size of malloc() pool
  */