Merge with /home/hs/U-Boot/u-boot-dev
authorWolfgang Denk <wd@pollux.denx.de>
Sat, 10 Jun 2006 17:27:47 +0000 (19:27 +0200)
committerWolfgang Denk <wd@pollux.denx.de>
Sat, 10 Jun 2006 17:27:47 +0000 (19:27 +0200)
1  2 
CHANGELOG
MAKEALL
Makefile
config.mk
cpu/mcf52x2/cpu.c
cpu/mcf52x2/cpu_init.c
cpu/mcf52x2/fec.c
cpu/mcf52x2/serial.c
cpu/mcf52x2/start.S

diff --combined CHANGELOG
index 3b81ff618ddcd1f717dcd058d49eba7d2f7dda35,aac832dcc93723af560e6cbb3ad80b766d446578..a7e38bdb0ecb01eea2db2d2e5b089dfb9e051f7e
+++ b/CHANGELOG
  Changes since U-Boot 1.1.4:
  ======================================================================
  
 -* Add Altera Nios-II boards EP1C20, EP1S10 and EP1S40
 -  Patch from Scott McNutt, 11 Aug 2005
++* Add MCF5282 support (without preloader)
++  relocate ichache_State to ram
++  u-boot can run from internal flash
++  Add EB+MCF-EV123 board support.
++  Add m68k Boards to MAKEALL
++  Patch from Jens Scharsig, 08 Aug 2005
++
 +* Nios II - Add Altera EP1C20, EP1S10 and EP1S40 boards
 +  Patch by Scott McNutt, 08 Jun 2006
 +
 +* Nios II - Add EPCS Controller bootrom work-around
 +  -When booting from an epcs controller, the epcs bootrom may leave the
 +  slave select in an asserted state causing soft reset hang. This
 +  patch ensures slave select is negated at reset.
 +  Patch by Scott McNutt, 08 Jun 2006
  
 -* Update PK1C20 board for Nios-II 5.0 
 -  Patch from Scott McNutt, 11 Aug 2005
 +* Update PK1C20 board
    -Update base addresses for standard configuration
    -Eliminate use of CACHE_BYPASS in board code
 +  Patch by Scott McNutt, 08 Jun 2006
  
 -* Add EPCS Controller bootrom work-around for Nios-II
 -   Patch from Scott McNutt, 11 Aug 2005
 -   -When booting from an epcs controller, the epcs bootrom may leave the
 -    slave select in an asserted state causing soft reset hang. This
 -    patch ensures slave select is negated at reset.
 -
 -* Fix I/O Macros and mini-app stubs for Nios-II
 -  Patch from Scott McNutt, 11 Aug 2005
 +* Nios II - Fix I/O Macros and mini-app stubs
    -Fix asm/io.h macros
    -Eliminate use of CACHE_BYPASS in cpu code
    -Eliminate assembler warnings
    -Fix mini-app stubs and force no small data
 +  Patch by Scott McNutt, 08 Jun 2006
  
 -* Add MCF5282 support (without preloader)
 -  relocate ichache_State to ram
 -  u-boot can run from internal flash
 -  Add EB+MCF-EV123 board support.
 -  Add m68k Boards to MAKEALL
 -  Patch from Jens Scharsig, 08 Aug 2005
 +* Fix U-Boot environment sector protection on MCC200 board
 +
 +* Minor cleanup for PCS440EP board
 +
 +* Update PCS440EP port to fit into one flash device (incl. environment)
 +  Patch by Stefan Roese, 06 Jun 2006
 +
 +* Add support for PCS440EP board
 +  Patch by Stefan Roese, 02 Jun 2006
 +
 +* Fix examples/Makefile; some build targets were lost
 +
 +* Fix watchdog handling in CFI flash driver
 +  Just use udelay() when waiting for status changes which will
 +  implicitely trigger the watchdog.
 +
 +* Fix PCI to memory window size problems on PM82x boards
 +  We use the "automatic" mode that was used for  the  MPC8266ADS  and
 +  MPC8272 boards. Eventually this should be used on all boards?]
 +  Patch by Wolfgang Grandegger, 17 Jan 2006
 +
 +* Correct GPIO setup (UART1/IRQ's) on yosemite & yellowstone
 +  Patch by Stefan Roese, 29 May 2006
 +
 +* Update Intel IXP4xx support
 +  - Add IXP4xx NPE ethernet MAC support
 +  - Add support for Intel IXDPG425 board
 +  - Add support for Prodrive PDNB3 board
 +  - Add IRQ support
 +  Patch by Stefan Roese, 23 May 2006
 +
 +* Fix problem in PVR detection for 440GR
 +  Patch by Stefan Roese, 18 May 2006
 +
 +* Fix gcc 3.4.x AFLAGS setting for m68k platform.
 +
 +* Enable autoboot for M5271EVB board.
 +
 +* Changed default ramdisk addr in yosemite/yellowstone ports
 +  Patch by Stefan Roese, 15 May 2006
 +
 +* Fix PCMCIA support on virtlab2
 +
 +* Add support for VirtLab2 board
 +  (needed because of differences in the PCMCIA hardware).
 +
 +* Minor cleanup.
 +
 +* Update yosemite configuration to enable flash write buffer support
 +  Patch by Stefan Roese, 10 May 2006
 +
 +* Fix compile warnings in common/xyzModem.c
 +  Patch by Stefan Roese, 10 May 2006
 +
 +* Add support for AMCC 440EP Rev C and 440GR Rev B
 +  Patch by John Otken, 08 May 2006
 +
 +* OMAP 5912/OSK: update EMIFS CS1 timings:
 +  Problems have been seen in the linux kernel's smc91x network driver
 +  due to improper bus timings.  The latest 2.6 OMAP kernels currently
 +  have a workaround, but this fix belongs in u-boot.
 +  Patch by Kevin Hilman, 13 Oct 2005
 +
 +* Fix REG_MPU_LOAD_TIMER definition in multiple OMAP ports
 +  Patch by Hiroki Kaminaga, 11 Mar 2006
 +
 +* Update omap5912osk board support
 +  - Fix OMAP support that omap5912osk compiles in current source tree
 +  - Update with code from "http://omap.spectrumdigital.com/osk5912"
 +    to fix problems with DDR initialization
 +  - Fix timer setup
 +  - Use CFI flash driver and support complete 32MB of onboard flash
 +  - Add "print_cpuinfo()" and "checkboard()" functions to display
 +    CPU (with frequency) and Board infos
 +  Patch by Stefan Roese, 10 May 2006
 +
 +* Fix watchdog issues for ColdFire boards.
 +
 +* Add M5271EVB board support.
 +
 +* Make R5200 specific low level initialization board conditional.
 +
 +* Update CPU target identification strings for ColdFire family.
 +
 +* Update register definitions for MCF5271.
 +
 +* Fix serial console support for MCF5271.
 +
 +* Fixes for gcc 3.4 based m68k toolchain,
 +  based on patch by Jate Sujjavanich.
 +
 +* Fix lowboot support on MCC200 board
 +
 +* Merged MPC8349ADS and MPC8349EMDS ports into MPC8349EMDS port:
 +  - Removed MPC8349ADS port
 +  - Added PCI support to MPC8349ADS
 +  - reworked memory map to allow mapping of all regions with BATs
 +  Patch by Kumar Gala, 20 Apr 2006
 +
 +* Coding Style cleanup
 +
 +* Write RTC seconds first to maintain settings integrity per
 +  Maxim/Dallas DS1306 data sheet.
 +  Patch by Alan J. Luse, 02 May 2006
 +
 +* Scheduled for removal: strnicmp() which is unused
 +
 +* Update for Intel Monahans boards:
 +  - support for magic key detection and handling on delta board
 +  - NAND support for zylonite board + some minor cleanup
 +
 +* Declare load_serial_ymodem() when using CFG_CMD_LOADB.
 +  Patch by Jon Loeliger, 01 May 2006
 +
 +* Fixed handling of bad checksums with "mkimage -l"
 +
 +* Added support for BC3450 board
 +  Patch by Stefan Strobl, 21 Oct 2005
 +
 +* Update for NC650 board:
 +  - Support rev1 and rev2 hardware
 +  - adapt to new NAND layer
 +  - add CP850 configuration based on NC650
  
  * MPC5200: enable snooping of DMA transactions on XLB even if no PCI
    is configured; othrwise DMA accesses aren't cache coherent which
    PMC405 and CPCI2DP: Added firmware download and booting via pci.
    Patch by Matthias Fuchs, 20 Dec 2005
  
 +* Add ColdFire targets to MAKEALL script
 +  Patch by Zachary Landau, 26 Jan 2006
 +
 +* Add support for r5200 board
 +  Patch by Zachary Landau, 26 Jan 2006
 +
 +* Add support for Freescale M5271 processor
 +  Patch by Zachary Landau, 26 Jan 2006
 +
  * Fix 28F256J3A support on PM520 board
    (without bank-switching only 32 MB can be accessed)
  
@@@ -1912,7 -1786,7 +1919,7 @@@ Changes for U-Boot 1.1.3
    - use -mtune=xscale and -march=armv5 options for PXA
  
  * Patch by Florian Schlote, 08 Sep 2004:
 -  Add support for SenTec-COBRA5272-board (Coldfire).
 +  Add support for SenTec-COBRA5272-board (ColdFire).
  
  * Patch by Gleb Natapov, 07 Sep 2004:
    mpc824x: set PCI latency timer to a sane value
@@@ -1970,7 -1844,7 +1977,7 @@@ Changes for U-Boot 1.1.2
  * Patch by Stefan Roese, 16 Dez 2004:
    - ext2fs support added
    - Tundra universe support added
 -  - Coldfire MCF5249 support added (no preloader needed!)
 +  - ColdFire MCF5249 support added (no preloader needed!)
    - MCF5249 board TASREG added
    - PPC boards added: APC405, CPCI405DT, CPCI750, G2000, HH405,
      VOM405, WUH405
  
  * Fix NSCU config; add ethernet wakeup code.
  
 -* Add link for preloader for Motorola Coldfire to README.m68k
 +* Add link for preloader for Motorola ColdFire to README.m68k
  
  * Patch by Michael Bendzick, 12 Jul 2004:
    fix output formatting in drivers/cfi_flash.c
@@@ -3239,7 -3113,7 +3246,7 @@@ Changes for U-Boot 1.1.0
  * Some code cleanup
  
  * Patch by Josef Baumgartner, 10 Feb 2004:
 -  Fixes for Coldfire port
 +  Fixes for ColdFire port
  
  * Patch by Brad Kemp, 11 Feb 2004:
    Fix CFI flash driver problems
@@@ -3505,7 -3379,7 +3512,7 @@@ Changes for U-Boot 1.0.1
    - 4xx: removed spurious MII error messages on "mii info" command.
  
  * Patch by Bernhard Kuhn, 28 Nov 2003:
 -  add support for Coldfire CPU
 +  add support for ColdFire CPU
    add support for Motorola M5272C3 and M5282EVB boards
  
  * Patch by Pierre Aubert, 24 Nov 2003:
diff --combined MAKEALL
index 28b6d9c3e4ed5e000bd928262fdad0326a96005d,75ec51336c258a50ef1e76261daebdbd7850801e..6778b3bd26ba1e8724da863bba3bd0443123a1e0
+++ b/MAKEALL
@@@ -25,10 -25,10 +25,10 @@@ LIST_5xx=" 
  #########################################################################
  
  LIST_5xxx="   \
 -      cpci5200        EVAL5200        icecube_5100    icecube_5200    \
 -      lite5200b       mcc200          o2dnt           pf5200          \
 -      PM520           Total5100       Total5200       Total5200_Rev2  \
 -      TQM5200_auto                                                    \
 +      BC3450          cpci5200        EVAL5200        icecube_5100    \
 +      icecube_5200    lite5200b       mcc200          o2dnt           \
 +      pf5200          PM520           Total5100       Total5200       \
 +      Total5200_Rev2  TQM5200_auto                                    \
  "
  
  #########################################################################
@@@ -71,11 -71,11 +71,11 @@@ LIST_4xx=" 
        HH405           HUB405          JSE             KAREF           \
        luan            METROBOX        MIP405          MIP405T         \
        ML2             ml300           ocotea          OCRTC           \
 -      ORSG            p3p440          PCI405          PIP405          \
 -      PLU405          PMC405          PPChameleonEVB  sbc405          \
 -      VOH405          VOM405          W7OLMC          W7OLMG          \
 -      walnut          WUH405          XPEDITE1K       yellowstone     \
 -      yosemite                                                        \
 +      ORSG            p3p440          PCI405          pcs440ep        \
 +      PIP405          PLU405          PMC405          PPChameleonEVB  \
 +      sbc405          VOH405          VOM405          W7OLMC          \
 +      W7OLMG          walnut          WUH405          XPEDITE1K       \
 +      yellowstone     yosemite                                        \
  "
  
  #########################################################################
@@@ -117,7 -117,7 +117,7 @@@ LIST_8260="        
  #########################################################################
  
  LIST_83xx="   \
 -      MPC8349ADS      TQM834x         MPC8349EMDS                     \
 +      TQM834x         MPC8349EMDS                                     \
  "
  
  
@@@ -209,7 -209,7 +209,7 @@@ LIST_pxa=" 
        zylonite                                                        \
  "
  
 -LIST_ixp="ixdp425"
 +LIST_ixp="ixdp425     ixdpg425        pdnb3"
  
  
  LIST_arm="    \
@@@ -255,29 -255,34 +255,38 @@@ LIST_x86="${LIST_I486}
  #########################################################################
  
  LIST_nios="   \
--      ADNPESC1 ADNPESC1_base_32                                       \
++      ADNPESC1                ADNPESC1_base_32                        \
        ADNPESC1_DNPEVA2_base_32                                        \
--      DK1C20 DK1C20_standard_32                                       \
--      DK1S10 DK1S10_standard_32 DK1S10_mtx_ldk_20                     \
++      DK1C20                  DK1C20_standard_32                      \
++      DK1S10                  DK1S10_standard_32 DK1S10_mtx_ldk_20    \
  "
  
  #########################################################################
  ## Nios-II Systems
  #########################################################################
  
--LIST_nios2="PCI5441 PK1C20 EP1C20 EP1S10 EP1S40"
++LIST_nios2="  \
++      EP1C20          EP1S10          EP1S40                          \
++      PCI5441         PK1C20                                          \
++"
  
  #########################################################################
  ## MicroBlaze Systems
  #########################################################################
  
--LIST_microblaze="suzaku"
++LIST_microblaze="     \
++      suzaku
++"
  
  #########################################################################
 -## M68K Systems
 +## ColdFire Systems
  #########################################################################
  
- LIST_coldfire="cobra5272 M5272C3 M5282EVB TASREG r5200 M5271EVB"
 -LIST_m68k="\
 -      cobra5272 \
 -      EB+MCF-EV123 EB+MCF-EV123_internal \
 -      M5272C3 M5282EVB \
 -      TASREG \
++LIST_coldfire="       \
++      cobra5272       EB+MCF-EV123    EB+MCF-EV123_internal           \
++      M5271EVB        M5272C3         M5282EVB        TASREG          \
++      r5200           M5271EVB                                        \
+ "
  
  #-----------------------------------------------------------------------
  
@@@ -292,7 -297,7 +301,7 @@@ build_target() 
        ${MAKE} distclean >/dev/null
        ${MAKE} ${target}_config
        ${MAKE} ${JOBS} all 2>&1 >LOG/$target.MAKELOG | tee LOG/$target.ERR
      ${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG
#     ${CROSS_COMPILE:-ppc_8xx-}size u-boot | tee -a LOG/$target.MAKELOG
  }
  
  #-----------------------------------------------------------------------
@@@ -306,8 -311,8 +315,8 @@@ d
        microblaze| \
        mips|mips_el| \
        nios|nios2| \
 -      m68k| \
 -      x86|I486)
 +      x86|I486| \
 +      coldfire)
                        for target in `eval echo '$LIST_'${arg}`
                        do
                                build_target ${target}
diff --combined Makefile
index 7424adc7c74a0a926226117e75dffa96276f5394,86640a6bbe806de96f8f1841fd4fe5aa9a89a508..440ab2c627d9ebcf83cc6bfdabb977496949bc45
+++ b/Makefile
@@@ -259,9 -259,6 +259,9 @@@ PATI_config:               unconfi
  aev_config: unconfig
        @./mkconfig -a aev ppc mpc5xxx tqm5200
  
 +BC3450_config:        unconfig
 +      @./mkconfig -a BC3450 ppc mpc5xxx bc3450
 +
  cpci5200_config:  unconfig
        @./mkconfig -a cpci5200  ppc mpc5xxx cpci5200 esd
  
@@@ -326,7 -323,7 +326,7 @@@ mcc200_config      
  mcc200_lowboot_config:        unconfig
        @ >include/config.h
        @[ -z "$(findstring lowboot_,$@)" ] || \
 -              { echo "TEXT_BASE = 0xFE000000" >board/mcc200/config.tmp ; \
 +              { echo "TEXT_BASE = 0xFC000000" >board/mcc200/config.tmp ; \
                  echo "... with lowboot configuration" ; \
                }
        @./mkconfig mcc200 ppc mpc5xxx mcc200
@@@ -636,21 -633,8 +636,21 @@@ NETTA2_config:           unconfi
                 }
        @./mkconfig -a $(call xtract_NETTA2,$@) ppc mpc8xx netta2
  
 -NC650_config: unconfig
 -      @./mkconfig $(@:_config=) ppc mpc8xx nc650
 +NC650_Rev1_config \
 +NC650_Rev2_config \
 +CP850_config: unconfig
 +      @ >include/config.h
 +      @[ -z "$(findstring CP850,$@)" ] || \
 +               { echo "#define CONFIG_CP850 1" >>include/config.h ; \
 +                 echo "#define CONFIG_IDS852_REV2 1" >>include/config.h ; \
 +               }
 +      @[ -z "$(findstring Rev1,$@)" ] || \
 +               { echo "#define CONFIG_IDS852_REV1 1" >>include/config.h ; \
 +               }
 +      @[ -z "$(findstring Rev2,$@)" ] || \
 +               { echo "#define CONFIG_IDS852_REV2 1" >>include/config.h ; \
 +               }
 +      @./mkconfig -a NC650 ppc mpc8xx nc650
  
  NX823_config:         unconfig
        @./mkconfig $(@:_config=) ppc mpc8xx nx823
@@@ -756,8 -740,7 +756,8 @@@ TQM850M_config             
  TQM855M_config                \
  TQM860M_config                \
  TQM862M_config                \
 -TQM866M_config:               unconfig
 +TQM866M_config                \
 +virtlab2_config:      unconfig
        @ >include/config.h
        @[ -z "$(findstring _LCD,$@)" ] || \
                { echo "#define CONFIG_LCD"             >>include/config.h ; \
@@@ -919,9 -902,6 +919,9 @@@ p3p440_config:     unconfi
  PCI405_config:        unconfig
        @./mkconfig $(@:_config=) ppc ppc4xx pci405 esd
  
 +pcs440ep_config:      unconfig
 +      @./mkconfig $(@:_config=) ppc ppc4xx pcs440ep
 +
  PIP405_config:        unconfig
        @./mkconfig $(@:_config=) ppc ppc4xx pip405 mpl
  
@@@ -1300,9 -1280,9 +1300,6 @@@ VoVPN-GW_100MHz_config:         unconfi
  ZPC1900_config: unconfig
        @./mkconfig $(@:_config=) ppc mpc8260 zpc1900
  
--#========================================================================
--# M68K
--#========================================================================
  #########################################################################
  ## Coldfire
  #########################################################################
  cobra5272_config :            unconfig
        @./mkconfig $(@:_config=) m68k mcf52x2 cobra5272
  
++EB+MCF-EV123_config :         unconfig
++      @ >include/config.h
++      @echo "TEXT_BASE = 0xFFE00000"|tee board/BuS/EB+MCF-EV123/textbase.mk
++      @./mkconfig EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
++
++EB+MCF-EV123_internal_config :        unconfig
++      @ >include/config.h
++      @echo "TEXT_BASE = 0xF0000000"|tee board/BuS/EB+MCF-EV123/textbase.mk
++      @./mkconfig EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
++
++M5271EVB_config :             unconfig
++      @./mkconfig $(@:_config=) m68k mcf52x2 m5271evb
++
  M5272C3_config :              unconfig
        @./mkconfig $(@:_config=) m68k mcf52x2 m5272c3
  
@@@ -1319,12 -1299,6 +1329,9 @@@ M5282EVB_config :              unconfi
  TASREG_config :               unconfig
        @./mkconfig $(@:_config=) m68k mcf52x2 tasreg esd
  
- M5271EVB_config :             unconfig
-       @./mkconfig $(@:_config=) m68k mcf52x2 m5271evb
 +r5200_config :                unconfig
 +      @./mkconfig $(@:_config=) m68k mcf52x2 r5200
 +
  #########################################################################
  ## MPC83xx Systems
  #########################################################################
@@@ -1338,6 -1312,20 +1345,6 @@@ TQM834x_config:        unconfi
  MPC8349EMDS_config:   unconfig
        @./mkconfig $(@:_config=) ppc mpc83xx mpc8349emds
  
 -#########################################################################
 -# BuS
 -#########################################################################
 -
 -EB+MCF-EV123_config :         unconfig
 -      @ >include/config.h
 -      @echo "TEXT_BASE = 0xFFE00000"|tee board/BuS/EB+MCF-EV123/textbase.mk
 -      @./mkconfig EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
 -
 -EB+MCF-EV123_internal_config :        unconfig
 -      @ >include/config.h
 -      @echo "TEXT_BASE = 0xF0000000"|tee board/BuS/EB+MCF-EV123/textbase.mk
 -      @./mkconfig EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
 -
  #########################################################################
  ## MPC85xx Systems
  #########################################################################
@@@ -1711,18 -1699,12 +1718,18 @@@ innokom_config       :       unconfi
  ixdp425_config        :       unconfig
        @./mkconfig $(@:_config=) arm ixp ixdp425
  
 +ixdpg425_config       :       unconfig
 +      @./mkconfig $(@:_config=) arm ixp ixdp425
 +
  lubbock_config        :       unconfig
        @./mkconfig $(@:_config=) arm pxa lubbock
  
  logodl_config :       unconfig
        @./mkconfig $(@:_config=) arm pxa logodl
  
 +pdnb3_config  :       unconfig
 +      @./mkconfig $(@:_config=) arm ixp pdnb3 prodrive
 +
  pxa255_idp_config:    unconfig
        @./mkconfig $(@:_config=) arm pxa pxa255_idp
  
diff --combined config.mk
index c7b841da5938902d1582a378be039ab363ccf187,6bf00a378879040d32631d21347101754be90ade..b59667a83311f39458cb501434979b4996b1e029
+++ b/config.mk
@@@ -112,7 -112,7 +112,7 @@@ OBJDUMP = $(CROSS_COMPILE)objdum
  RANLIB        = $(CROSS_COMPILE)RANLIB
  
  RELFLAGS= $(PLATFORM_RELFLAGS)
- DBGFLAGS= -g #-DDEBUG
+ DBGFLAGS= -g # -DDEBUG
  OPTFLAGS= -Os #-fomit-frame-pointer
  ifndef LDSCRIPT
  #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
@@@ -144,14 -144,6 +144,14 @@@ endi
  endif
  
  AFLAGS_DEBUG := -Wa,-gstabs
 +
 +# turn jbsr into jsr for m68k
 +ifeq ($(ARCH),m68k)
 +ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
 +AFLAGS_DEBUG := -Wa,-gstabs,-S
 +endif
 +endif
 +
  AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
  
  LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
diff --combined cpu/mcf52x2/cpu.c
index e6e5d9bee963b082aa26a505818c19b1266e0970,8795bcccffad252990ff4f622c4a97158944b873..aa6b2bd670cea9c61025ccbe1478fb55c4446df7
@@@ -2,6 -2,10 +2,10 @@@
   * (C) Copyright 2003
   * Josef Baumgartner <josef.baumgartner@telex.de>
   *
+  * MCF5282 additionals
+  * (C) Copyright 2005
+  * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
+  *
   * See file CREDITS for list of people who contributed to this
   * project.
   *
  #include <watchdog.h>
  #include <command.h>
  
 +#ifdef  CONFIG_M5271
 +#include <asm/immap_5271.h>
 +#include <asm/m5271.h>
 +#endif
 +
  #ifdef        CONFIG_M5272
  #include <asm/immap_5272.h>
  #include <asm/m5272.h>
  #endif
  
  #ifdef        CONFIG_M5282
+ #include <asm/m5282.h>
+ #include <asm/immap_5282.h>
  #endif
  
  #ifdef        CONFIG_M5249
  #include <asm/m5249.h>
  #endif
  
 +#ifdef        CONFIG_M5271
 +int checkcpu (void)
 +{
 +      char buf[32];
 +
 +      printf ("CPU:   Freescale Coldfire MCF5271 at %s MHz\n", strmhz(buf, CFG_CLK));
 +      return 0;
 +}
 +
 +int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
 +      mbar_writeByte(MCF_RCM_RCR,
 +                      MCF_RCM_RCR_SOFTRST | MCF_RCM_RCR_FRCRSTOUT);
 +      return 0;
 +};
 +
 +#if defined(CONFIG_WATCHDOG)
 +void watchdog_reset (void)
 +{
 +      mbar_writeShort(MCF_WTM_WSR, 0x5555);
 +      mbar_writeShort(MCF_WTM_WSR, 0xAAAA);
 +}
 +
 +int watchdog_disable (void)
 +{
 +      mbar_writeShort(MCF_WTM_WCR, 0);
 +      return (0);
 +}
 +
 +int watchdog_init (void)
 +{
 +      mbar_writeShort(MCF_WTM_WCR, MCF_WTM_WCR_EN);
 +      return (0);
 +}
 +#endif /* #ifdef CONFIG_WATCHDOG */
 +
 +#endif
  
  #ifdef        CONFIG_M5272
  int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
@@@ -107,16 -71,15 +112,15 @@@ int checkcpu(void) 
                case 0x4: suf = "3K75N"; break;
                default:
                        suf = NULL;
 -                      printf ("MOTOROLA MCF5272 (Mask:%01x)\n", msk);
 +                      printf ("Freescale MCF5272 (Mask:%01x)\n", msk);
                        break;
                }
  
        if (suf)
 -              printf ("MOTOROLA MCF5272 %s\n", suf);
 +              printf ("Freescale MCF5272 %s\n", suf);
        return 0;
  };
  
  #if defined(CONFIG_WATCHDOG)
  /* Called by macro WATCHDOG_RESET */
  void watchdog_reset (void)
@@@ -158,11 -121,26 +162,25 @@@ int watchdog_init (void
  #ifdef        CONFIG_M5282
  int checkcpu (void)
  {
-       puts ("CPU:   Freescale Coldfire MCF5282\n");
 -      unsigned char resetsource;
++      unsigned char resetsource = MCFRESET_RSR;
 -      printf ("CPU:   MOTOROLA Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
++      printf ("CPU:   Freescale Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
+               MCFCCM_CIR>>8,MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
 -      puts ("Reset: ");
 -      resetsource = MCFRESET_RSR;
 -      if (resetsource & MCFRESET_RSR_LOL) puts("Lose-of-lock ");
 -      if (resetsource & MCFRESET_RSR_LOC) puts("Lose-of-clock ");
 -      if (resetsource & MCFRESET_RSR_EXT) puts("external ");
 -      if (resetsource & MCFRESET_RSR_POR) puts("Power-on ");
 -      if (resetsource & MCFRESET_RSR_WDR) puts("Watchdog ");
 -      if (resetsource & MCFRESET_RSR_SOFT) puts("Software ");
 -      if (resetsource & MCFRESET_RSR_LVD) puts("Low-voltage ");
 -      puts("\n");
++      printf ("Reset:%s%s%s%s%s%s%s\n",
++              (resetsource & MCFRESET_RSR_LOL)  ? " Loss of Lock"     : "",
++              (resetsource & MCFRESET_RSR_LOC)  ? " Loss of Clock"    : "",
++              (resetsource & MCFRESET_RSR_EXT)  ? " External"         : "",
++              (resetsource & MCFRESET_RSR_POR)  ? " Power On"         : "",
++              (resetsource & MCFRESET_RSR_WDR)  ? " Watchdog"         : "",
++              (resetsource & MCFRESET_RSR_SOFT) ? " Software"         : "",
++              (resetsource & MCFRESET_RSR_LVD)  ? " Low Voltage"      : ""
++      );
        return 0;
  }
  
- int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
+ int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
+ {
+       MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
        return 0;
  };
  #endif
@@@ -172,7 -150,7 +190,7 @@@ int checkcpu (void
  {
        char buf[32];
  
 -      printf ("CPU:   MOTOROLA Coldfire MCF5249 at %s MHz\n", strmhz(buf, CFG_CLK));
 +      printf ("CPU:   Freescale Coldfire MCF5249 at %s MHz\n", strmhz(buf, CFG_CLK));
        return 0;
  }
  
diff --combined cpu/mcf52x2/cpu_init.c
index 451e3f3f10bce5c90444c8135d3d06e206e0e691,0fa2ce2e143d8137c931d5b768072aecc980c775..1748ea9d9b74790c168cacf3f8219042a2bcf9a1
@@@ -2,6 -2,10 +2,10 @@@
   * (C) Copyright 2003
   * Josef Baumgartner <josef.baumgartner@telex.de>
   *
+  * MCF5282 additionals
+  * (C) Copyright 2005
+  * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
+  *
   * See file CREDITS for list of people who contributed to this
   * project.
   *
@@@ -12,7 -16,7 +16,7 @@@
   *
   * 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
 + * 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
  #include <common.h>
  #include <watchdog.h>
  
 +#ifdef        CONFIG_M5271
 +#include <asm/m5271.h>
 +#include <asm/immap_5271.h>
 +#endif
 +
  #ifdef        CONFIG_M5272
  #include <asm/m5272.h>
  #include <asm/immap_5272.h>
  #include <asm/m5249.h>
  #endif
  
 +#if defined(CONFIG_M5271)
 +void cpu_init_f (void)
 +{
 +#ifndef CONFIG_WATCHDOG
 +      /* Disable the watchdog if we aren't using it */
 +      mbar_writeShort(MCF_WTM_WCR, 0);
 +#endif
 +
 +      /* Set clockspeed to 100MHz */
 +      mbar_writeShort(MCF_FMPLL_SYNCR,
 +                      MCF_FMPLL_SYNCR_MFD(0) | MCF_FMPLL_SYNCR_RFD(0));
 +      while (!mbar_readByte(MCF_FMPLL_SYNSR) & MCF_FMPLL_SYNSR_LOCK);
 +
 +      /* Enable UART pins */
 +      mbar_writeShort(MCF_GPIO_PAR_UART, MCF_GPIO_PAR_UART_U0TXD |
 +                      MCF_GPIO_PAR_UART_U0RXD |
 +                      MCF_GPIO_PAR_UART_U1RXD_UART1 |
 +                      MCF_GPIO_PAR_UART_U1TXD_UART1);
 +
 +      /* Enable Ethernet pins */
 +      mbar_writeByte(MCF_GPIO_PAR_FECI2C, CFG_FECI2C);
 +}
 +
 +/*
 + * initialize higher level parts of CPU like timers
 + */
 +int cpu_init_r        (void)
 +{
 +      return (0);
 +}
 +#endif
 +
  #if defined(CONFIG_M5272)
  /*
   * Breath some life into the CPU...
@@@ -97,7 -64,7 +101,7 @@@ void cpu_init_f (void
        regp->sysctrl_reg.sc_scr = CFG_SCR;
        regp->sysctrl_reg.sc_spr = CFG_SPR;
  
 -      /* Setup Ports: */
 +      /* Setup Ports: */
        regp->gpio_reg.gpio_pacnt = CFG_PACNT;
        regp->gpio_reg.gpio_paddr = CFG_PADDR;
        regp->gpio_reg.gpio_padat = CFG_PADAT;
  
  #endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
  
 -    /* enable instruction cache now */
 -    icache_enable();
 +      /* enable instruction cache now */
 +      icache_enable();
  
  }
  
  /*
   * initialize higher level parts of CPU like timers
   */
 -int cpu_init_r  (void)
 +int cpu_init_r        (void)
  {
        return (0);
  }
   */
  void cpu_init_f (void)
  {
+ #ifndef CONFIG_WATCHDOG
+       /* disable watchdog if we aren't using it */
+       MCFWTM_WCR = 0;
+ #endif
+ #ifndef CONFIG_MONITOR_IS_IN_RAM
+       /* Set speed /PLL */
+       MCFCLOCK_SYNCR =  MCFCLOCK_SYNCR_MFD(CFG_MFD) | MCFCLOCK_SYNCR_RFD(CFG_RFD);
+       /* Set up the GPIO ports */
+ #ifdef CFG_PEPAR
+       MCFGPIO_PEPAR = CFG_PEPAR;
+ #endif
+ #ifdef        CFG_PFPAR
+       MCFGPIO_PFPAR = CFG_PFPAR;
+ #endif
+ #ifdef CFG_PJPAR
+       MCFGPIO_PJPAR = CFG_PJPAR;
+ #endif
+ #ifdef CFG_PSDPAR
+       MCFGPIO_PSDPAR = CFG_PSDPAR;
+ #endif
+ #ifdef CFG_PASPAR
+       MCFGPIO_PASPAR = CFG_PASPAR;
+ #endif
+ #ifdef CFG_PEHLPAR
+       MCFGPIO_PEHLPAR = CFG_PEHLPAR;
+ #endif
+ #ifdef CFG_PQSPAR
+       MCFGPIO_PQSPAR = CFG_PQSPAR;
+ #endif
+ #ifdef CFG_PTCPAR
+       MCFGPIO_PTCPAR = CFG_PTCPAR;
+ #endif
+ #ifdef CFG_PTDPAR
+       MCFGPIO_PTDPAR = CFG_PTDPAR;
+ #endif
+ #ifdef CFG_PUAPAR
+       MCFGPIO_PUAPAR = CFG_PUAPAR;
+ #endif
+ #ifdef CFG_DDRUA
+       MCFGPIO_DDRUA = CFG_DDRUA;
+ #endif
+       /* This is probably a bad place to setup chip selects, but everyone
+          else is doing it! */
+ #if defined(CFG_CS0_BASE) & defined(CFG_CS0_SIZE) & \
+     defined(CFG_CS0_WIDTH) & defined(CFG_CS0_RO) & \
+       defined(CFG_CS0_WS)
+       MCFCSM_CSAR0 =  (CFG_CS0_BASE >> 16) & 0xFFFF;
+       #if (CFG_CS0_WIDTH == 8)
+               #define  CFG_CS0_PS  MCFCSM_CSCR_PS_8
+       #elif (CFG_CS0_WIDTH == 16)
+               #define  CFG_CS0_PS  MCFCSM_CSCR_PS_16
+       #elif (CFG_CS0_WIDTH == 32)
+               #define  CFG_CS0_PS  MCFCSM_CSCR_PS_32
+       #else
+               #error  "CFG_CS0_WIDTH: Fault - wrong bus with for CS0"
+       #endif
+       MCFCSM_CSCR0 =  MCFCSM_CSCR_WS(CFG_CS0_WS)
+                       |CFG_CS0_PS
+                       |MCFCSM_CSCR_AA;
+       #if (CFG_CS0_RO != 0)
+               MCFCSM_CSMR0 =  MCFCSM_CSMR_BAM(CFG_CS0_SIZE-1)
+                               |MCFCSM_CSMR_WP|MCFCSM_CSMR_V;
+       #else
+               MCFCSM_CSMR0 =  MCFCSM_CSMR_BAM(CFG_CS0_SIZE-1)|MCFCSM_CSMR_V;
+       #endif
+ #else
+       #waring "Chip Select 0 are not initialized/used"
+ #endif
+ #if defined(CFG_CS1_BASE) & defined(CFG_CS1_SIZE) & \
+     defined(CFG_CS1_WIDTH) & defined(CFG_CS1_RO) & \
+       defined(CFG_CS1_WS)
+       MCFCSM_CSAR1 = (CFG_CS1_BASE >> 16) & 0xFFFF;
+       #if (CFG_CS1_WIDTH == 8)
+               #define  CFG_CS1_PS  MCFCSM_CSCR_PS_8
+       #elif (CFG_CS1_WIDTH == 16)
+               #define  CFG_CS1_PS  MCFCSM_CSCR_PS_16
+       #elif (CFG_CS1_WIDTH == 32)
+               #define  CFG_CS1_PS  MCFCSM_CSCR_PS_32
+       #else
+               #error  "CFG_CS1_WIDTH: Fault - wrong bus with for CS1"
+       #endif
+       MCFCSM_CSCR1 =  MCFCSM_CSCR_WS(CFG_CS1_WS)
+                       |CFG_CS1_PS
+                       |MCFCSM_CSCR_AA;
+       #if (CFG_CS1_RO != 0)
+               MCFCSM_CSMR1 =  MCFCSM_CSMR_BAM(CFG_CS1_SIZE-1)
+                               |MCFCSM_CSMR_WP
+                               |MCFCSM_CSMR_V;
+       #else
+               MCFCSM_CSMR1 =  MCFCSM_CSMR_BAM(CFG_CS1_SIZE-1)
+                               |MCFCSM_CSMR_V;
+       #endif
+ #else
+       #warning "Chip Select 1 are not initialized/used"
+ #endif
+ #if defined(CFG_CS2_BASE) & defined(CFG_CS2_SIZE) & \
+     defined(CFG_CS2_WIDTH) & defined(CFG_CS2_RO) & \
+       defined(CFG_CS2_WS)
+       MCFCSM_CSAR2 = (CFG_CS2_BASE >> 16) & 0xFFFF;
+       #if (CFG_CS2_WIDTH == 8)
+               #define  CFG_CS2_PS  MCFCSM_CSCR_PS_8
+       #elif (CFG_CS2_WIDTH == 16)
+               #define  CFG_CS2_PS  MCFCSM_CSCR_PS_16
+       #elif (CFG_CS2_WIDTH == 32)
+               #define  CFG_CS2_PS  MCFCSM_CSCR_PS_32
+       #else
+               #error  "CFG_CS2_WIDTH: Fault - wrong bus with for CS2"
+       #endif
+       MCFCSM_CSCR2 =  MCFCSM_CSCR_WS(CFG_CS2_WS)
+                       |CFG_CS2_PS
+                       |MCFCSM_CSCR_AA;
+       #if (CFG_CS2_RO != 0)
+               MCFCSM_CSMR2 =  MCFCSM_CSMR_BAM(CFG_CS2_SIZE-1)
+                               |MCFCSM_CSMR_WP
+                               |MCFCSM_CSMR_V;
+       #else
+               MCFCSM_CSMR2 =  MCFCSM_CSMR_BAM(CFG_CS2_SIZE-1)
+                               |MCFCSM_CSMR_V;
+       #endif
+ #else
+       #warning "Chip Select 2 are not initialized/used"
+ #endif
+ #if defined(CFG_CS3_BASE) & defined(CFG_CS3_SIZE) & \
+     defined(CFG_CS3_WIDTH) & defined(CFG_CS3_RO) & \
+       defined(CFG_CS3_WS)
+       MCFCSM_CSAR3 = (CFG_CS3_BASE >> 16) & 0xFFFF;
+       #if (CFG_CS3_WIDTH == 8)
+               #define  CFG_CS3_PS  MCFCSM_CSCR_PS_8
+       #elif (CFG_CS3_WIDTH == 16)
+               #define  CFG_CS3_PS  MCFCSM_CSCR_PS_16
+       #elif (CFG_CS3_WIDTH == 32)
+               #define  CFG_CS3_PS  MCFCSM_CSCR_PS_32
+       #else
+               #error  "CFG_CS3_WIDTH: Fault - wrong bus with for CS1"
+       #endif
+       MCFCSM_CSCR3 =  MCFCSM_CSCR_WS(CFG_CS3_WS)
+                       |CFG_CS3_PS
+                       |MCFCSM_CSCR_AA;
+       #if (CFG_CS3_RO != 0)
+               MCFCSM_CSMR3 =  MCFCSM_CSMR_BAM(CFG_CS3_SIZE-1)
+                               |MCFCSM_CSMR_WP
+                               |MCFCSM_CSMR_V;
+       #else
+               MCFCSM_CSMR3 =  MCFCSM_CSMR_BAM(CFG_CS3_SIZE-1)
+                               |MCFCSM_CSMR_V;
+       #endif
+ #else
+       #warning "Chip Select 3 are not initialized/used"
+ #endif
+ #endif /* CONFIG_MONITOR_IS_IN_RAM */
  
+       /* defer enabling cache until boot (see do_go) */
+       /* icache_enable(); */
  }
  
  /*
   * initialize higher level parts of CPU like timers
   */
 -int cpu_init_r  (void)
 +int cpu_init_r        (void)
  {
        return (0);
  }
@@@ -202,23 -342,23 +379,23 @@@ void cpu_init_f (void
        volatile unsigned long cpll = mbar2_readLong(MCFSIM_PLLCR);
        unsigned long pllcr;
  #ifdef CFG_FAST_CLK
 -      pllcr = 0x925a3100;                       /* ~140MHz clock (PLL bypass = 0) */
 +      pllcr = 0x925a3100;                       /* ~140MHz clock (PLL bypass = 0) */
  #else
 -      pllcr = 0x135a4140;                       /* ~72MHz clock (PLL bypass = 0) */
 +      pllcr = 0x135a4140;                       /* ~72MHz clock (PLL bypass = 0) */
  #endif
 -      cpll = cpll & 0xfffffffe;                 /* Set PLL bypass mode = 0 (PSTCLK = crystal) */
 -      mbar2_writeLong(MCFSIM_PLLCR, cpll);      /* Set the PLL to bypass mode (PSTCLK = crystal) */
 -      mbar2_writeLong(MCFSIM_PLLCR, pllcr);     /* set the clock speed */
 -      pllcr ^= 0x00000001;                      /* Set pll bypass to 1 */
 -      mbar2_writeLong(MCFSIM_PLLCR, pllcr);     /* Start locking (pll bypass = 1) */
 -      udelay(0x20);                             /* Wait for a lock ... */
 +      cpll = cpll & 0xfffffffe;                 /* Set PLL bypass mode = 0 (PSTCLK = crystal) */
 +      mbar2_writeLong(MCFSIM_PLLCR, cpll);      /* Set the PLL to bypass mode (PSTCLK = crystal) */
 +      mbar2_writeLong(MCFSIM_PLLCR, pllcr);     /* set the clock speed */
 +      pllcr ^= 0x00000001;                      /* Set pll bypass to 1 */
 +      mbar2_writeLong(MCFSIM_PLLCR, pllcr);     /* Start locking (pll bypass = 1) */
 +      udelay(0x20);                             /* Wait for a lock ... */
  #endif /* #ifndef CFG_PLL_BYPASS */
  
        /*
         *  NOTE: by setting the GPIO_FUNCTION registers, we ensure that the UART pins
 -       *        (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
 -       *        which is their primary function.
 -       *        ~Jeremy
 +       *        (UART0: gpio 30,27, UART1: gpio 31, 28) will be used as UART pins
 +       *        which is their primary function.
 +       *        ~Jeremy
         */
        mbar2_writeLong(MCFSIM_GPIO_FUNC, CFG_GPIO_FUNC);
        mbar2_writeLong(MCFSIM_GPIO1_FUNC, CFG_GPIO1_FUNC);
         *    (Internal Register Display) command
         *    ~Jeremy
         *
 -       */
 +       */
        mbar_writeByte(MCFSIM_MPARK, 0x30);    /* 5249 Internal Core takes priority over DMA */
        mbar_writeByte(MCFSIM_SYPCR, 0x00);
        mbar_writeByte(MCFSIM_SWIVR, 0x0f);
        mbar_writeByte(MCFSIM_QSPIICR, 0x00);
  
        mbar2_writeLong(MCFSIM_GPIO_INT_EN, 0x00000080);
 -      mbar2_writeByte(MCFSIM_INTBASE, 0x40);  /* Base interrupts at 64 */
 +      mbar2_writeByte(MCFSIM_INTBASE, 0x40);  /* Base interrupts at 64 */
        mbar2_writeByte(MCFSIM_SPURVEC, 0x00);
 -      mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);  /* Enable a 1 cycle pre-drive cycle on CS1 */
 +      mbar2_writeLong(MCFSIM_IDECONFIG1, 0x00000020);  /* Enable a 1 cycle pre-drive cycle on CS1 */
  
        /* Setup interrupt priorities for gpio7 */
        /* mbar2_writeLong(MCFSIM_INTLEV5, 0x70000000); */
  /*
   * initialize higher level parts of CPU like timers
   */
 -int cpu_init_r  (void)
 +int cpu_init_r        (void)
  {
        return (0);
  }
diff --combined cpu/mcf52x2/fec.c
index f207dd6acb59e0b825a5c7e07ecf755a25b36f2b,b8b82d07dc2d859e2c503aebf57167234832b0fb..702563d7dba80de3cadf2cae310948d3525d75d0
  #include <malloc.h>
  #include <asm/fec.h>
  
 +#ifdef  CONFIG_M5271
 +#include <asm/m5271.h>
 +#include <asm/immap_5271.h>
 +#endif
 +
  #ifdef        CONFIG_M5272
  #include <asm/m5272.h>
  #include <asm/immap_5272.h>
@@@ -46,7 -41,7 +46,7 @@@
  #ifdef        CONFIG_M5272
  #define FEC_ADDR              (CFG_MBAR + 0x840)
  #endif
 -#ifdef CONFIG_M5282
 +#if defined(CONFIG_M5282) || defined(CONFIG_M5271)
  #define FEC_ADDR              (CFG_MBAR + 0x1000)
  #endif
  
@@@ -205,7 -200,9 +205,9 @@@ int eth_rx (void
  
  int eth_init (bd_t * bd)
  {
+ #ifndef CFG_ENET_BD_BASE
+       DECLARE_GLOBAL_DATA_PTR;
+ #endif
        int i;
        volatile fec_t *fecp = (fec_t *) (FEC_ADDR);
  
  #endif
  #undef ea
  
 +#ifdef CONFIG_M5271
 +      /* Clear multicast address hash table
 +       */
 +      fecp->fec_ghash_table_high = 0;
 +      fecp->fec_ghash_table_low = 0;
 +
 +      /* Clear individual address hash table
 +       */
 +      fecp->fec_ihash_table_high = 0;
 +      fecp->fec_ihash_table_low = 0;
 +#else
        /* Clear multicast address hash table
         */
+ #ifdef        CONFIG_M5282
+       fecp->fec_ihash_table_high = 0;
+       fecp->fec_ihash_table_low = 0;
+ #else
        fecp->fec_hash_table_high = 0;
        fecp->fec_hash_table_low = 0;
  #endif
 +
        /* Set maximum receive buffer size.
         */
        fecp->fec_r_buff_size = PKT_MAXBLR_SIZE;
        txIdx = 0;
  
        if (!rtx) {
+ #ifdef CFG_ENET_BD_BASE
                rtx = (RTXBD *) CFG_ENET_BD_BASE;
+ #else
+               rtx = (RTXBD *) (CFG_MONITOR_BASE+gd->reloc_off -
+                                (((PKTBUFSRX+TX_BUF_CNT)*+sizeof(cbd_t)
+                                 +0xFF)
+                                 & ~0xFF)
+                               );
+               debug("set ENET_DB_BASE to %lX\n",(long) rtx);
+ #endif
        }
  
        /*
  
        /* Enable MII mode
         */
--#if 0                         /* Full duplex mode */
++
++#if 0 /* Full duplex mode */
        fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE;
        fecp->fec_x_cntrl = FEC_TCNTRL_FDEN;
--#else  /* Half duplex mode */
-       fecp->fec_r_cntrl = FEC_RCNTRL_MII_MODE | FEC_RCNTRL_DRT;
- #ifdef        CONFIG_M5271
-       fecp->fec_r_cntrl |= (PKT_MAXBUF_SIZE << 16); /* set max frame length */
- #endif
++#else /* Half duplex mode */
+         fecp->fec_r_cntrl = (PKT_MAXBUF_SIZE << 16); /* set max frame length */
+       fecp->fec_r_cntrl |= FEC_RCNTRL_MII_MODE | FEC_RCNTRL_DRT;
        fecp->fec_x_cntrl = 0;
  #endif
        /* Set MII speed */
-       fecp->fec_mii_speed = 0x0e;
+         fecp->fec_mii_speed = (((CFG_CLK / 2) / (2500000 / 10)) + 5) / 10;
+         fecp->fec_mii_speed *= 2;
  
        /* Configure port B for MII.
         */
@@@ -422,7 -419,7 +437,7 @@@ static void mii_discover_phy (void
                         */
                        udelay (10000); /* wait 10ms */
                }
-               for (phyno = 0; phyno < 32 && phyaddr < 0; ++phyno) {
+               for (phyno = 1; phyno < 32 && phyaddr < 0; ++phyno) {
                        phytype = mii_send (mk_mii_read (phyno, PHY_PHYIDR1));
  #ifdef ET_DEBUG
                        printf ("PHY type 0x%x pass %d type ", phytype, pass);
diff --combined cpu/mcf52x2/serial.c
index 10117889adac9933534c316874191160acd18440,fe412a0a3aacca2a3a6fd2df6625ca7211ed3add..8be09e34fefdcf9f19718b3c1b44d4bf0e89d1bd
  
  #include <common.h>
  #include <command.h>
 +#include <watchdog.h>
  
  #include <asm/mcfuart.h>
  
 +#ifdef CONFIG_M5271
 +#include <asm/m5271.h>
 +#endif
 +
  #ifdef CONFIG_M5272
  #include <asm/m5272.h>
  #endif
@@@ -45,7 -40,7 +45,7 @@@
  
  DECLARE_GLOBAL_DATA_PTR;
  
 -#ifdef CONFIG_M5249
 +#if defined(CONFIG_M5249) || defined(CONFIG_M5271)
  #define DoubleClock(a) ((double)(CFG_CLK/2) / 32.0 / (double)(a))
  #else
  #define DoubleClock(a) ((double)(CFG_CLK) / 32.0 / (double)(a))
  
  void rs_serial_setbaudrate(int port,int baudrate)
  {
 -#if defined(CONFIG_M5272) || defined(CONFIG_M5249)
 +#if defined(CONFIG_M5272) || defined(CONFIG_M5249) || defined(CONFIG_M5271)
        volatile unsigned char  *uartp;
- #ifndef CONFIG_M5271
 -      double clock, fraction;
++# ifndef CONFIG_M5271
 +      double fraction;
- #endif
++# endif
 +      double clock;
  
        if (port == 0)
--        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
        else
--        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
  
--      clock = DoubleClock(baudrate);      /* Set baud above */
++      clock = DoubleClock(baudrate);  /* Set baud above */
  
-       uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff);  /* set msb baud */
-       uartp[MCFUART_UBG2] = ((int)clock & 0xff);  /* set lsb baud */
 -      fraction = ((clock - (int)clock) * 16.0) + 0.5;
++      uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff);       /* set msb baud */
++      uartp[MCFUART_UBG2] = ((int)clock & 0xff);              /* set lsb baud */
  
- #ifndef CONFIG_M5271
 -      uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff);  /* set msb baud */
 -      uartp[MCFUART_UBG2] = ((int)clock & 0xff);  /* set lsb baud */
 -      uartp[MCFUART_UFPD] = ((int)fraction & 0xf);  /* set baud fraction adjust */
++# ifndef CONFIG_M5271
 +      fraction = ((clock - (int)clock) * 16.0) + 0.5;
-       uartp[MCFUART_UFPD] = ((int)fraction & 0xf);  /* set baud fraction adjust */
++      uartp[MCFUART_UFPD] = ((int)fraction & 0xf);    /* set baud fraction adjust */
++# endif
  #endif
 -      switch (port)
 -      {
 -       case 1:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
 -        break;
 -       case 2:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
 -        break;
 -       default:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
++
+ #if  defined(CONFIG_M5282)
+       volatile unsigned char  *uartp;
+       long clock;
 -      clock = (long) CFG_CLK / ((long) 32 * baudrate);      /* Set baud above */
++      switch (port) {
++      case 1:
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
++              break;
++      case 2:
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
++              break;
++      default:
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
+       }
 -      uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff);  /* set msb baud */
 -      uartp[MCFUART_UBG2] = ((int) clock & 0xff);  /* set lsb baud */
++      clock = (long) CFG_CLK / ((long) 32 * baudrate);        /* Set baud above */
++      uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff);       /* set msb baud */
++      uartp[MCFUART_UBG2] = ((int) clock & 0xff);             /* set lsb baud */
  #endif
  };
  
--void rs_serial_init(int port,int baudrate)
++void rs_serial_init (int port, int baudrate)
  {
--      volatile unsigned char  *uartp;
++      volatile unsigned char *uartp;
  
        /*
--       *      Reset UART, get it into known state...
++       *      Reset UART, get it into known state...
         */
-       if (port == 0)
-               uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
-       else
 -      switch (port)
 -      {
 -       case 1:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
 -        break;
 -      #if  defined(CONFIG_M5282)
 -       case 2:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
 -        break;
 -       #endif
 -       default:
 -        uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
++      switch (port) {
++      case 1:
 +              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
++              break;
++#if  defined(CONFIG_M5282)
++      case 2:
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
++              break;
++#endif
++      default:
++              uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
+       }
  
-       uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX;  /* reset TX */
--      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX;  /* reset RX */
 -      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX;  /* reset TX */
 -      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETMRPTR;  /* reset MR pointer */
 -      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;  /* reset Error pointer */
++      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX;    /* reset TX */
++      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX;    /* reset RX */
 +
-       uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETMRPTR;  /* reset MR pointer */
-       uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;  /* reset Error pointer */
++      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETMRPTR; /* reset MR pointer */
++      uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;   /* reset Error pointer */
  
        /*
         * Set port for CONSOLE_BAUD_RATE, 8 data bits, 1 stop bit, no parity.
        uartp[MCFUART_UMR] = MCFUART_MR1_PARITYNONE | MCFUART_MR1_CS8;
        uartp[MCFUART_UMR] = MCFUART_MR2_STOP1;
  
 -      rs_serial_setbaudrate(port,baudrate);
 +      /* Mask UART interrupts */
 +      uartp[MCFUART_UIMR] = 0;
  
 +      /* Set clock Select Register: Tx/Rx clock is timer */
        uartp[MCFUART_UCSR] = MCFUART_UCSR_RXCLKTIMER | MCFUART_UCSR_TXCLKTIMER;
-       rs_serial_setbaudrate(port,baudrate);
 +
++      rs_serial_setbaudrate (port, baudrate);
 +
 +      /* Enable Tx/Rx */
        uartp[MCFUART_UCR] = MCFUART_UCR_RXENABLE | MCFUART_UCR_TXENABLE;
  
        return;
@@@ -169,15 -183,13 +199,14 @@@ void serial_putc(const char c) 
  }
  
  void serial_puts (const char *s) {
--      while (*s) {
++      while (*s)
                serial_putc(*s++);
--      }
  }
  
  int serial_getc(void) {
 -      while(!rs_is_char());
 +      while(!rs_is_char())
 +              WATCHDOG_RESET();
 +
        return rs_get_char();
  }
  
diff --combined cpu/mcf52x2/start.S
index 3ab812b3d4bf0fe8fcdbab92bcc45663f8ce375f,9a13491fbd3b3d65ea0116cf247d212a24320190..8a83ca5ef7dd933b0ec0e8185892eabb86fcd558
   *    These vectors are to catch any un-intended traps.
   */
  _vectors:
 - .long        0x00000000
 -#ifndef CONFIG_M5282
 -.long _START
 -#else
 +
- #ifndef       CONFIG_R5200
- .long 0x00000000, _START
++.long 0x00000000              /* Flash offset is 0 until we setup CS0 */
++#if defined(CONFIG_R5200)
++.long 0x400
++#elif defined(CONFIG_M5282)
+ .long _start - TEXT_BASE
 +#else
- .long 0x00000000, 0x400       /* Flash offset is 0 until we setup CS0 */
++.long _START
  #endif
++
  .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  
        .text
  
+ #if defined(CFG_INT_FLASH_BASE) && \
+     (defined(CONFIG_M5282) || defined(CONFIG_M5281))
+       #if (TEXT_BASE == CFG_INT_FLASH_BASE)
+               .long   0x55AA55AA,0xAA55AA55 /* CFM Backdoorkey */
+               .long   0xFFFFFFFF /* all sectors protected */
+               .long   0x00000000 /* supervisor/User restriction */
+               .long   0x00000000 /* programm/data space restriction */
+               .long   0x00000000 /* Flash security */
+       #endif
+ #endif
        .globl  _start
  _start:
        nop
        nop
        move.w #0x2700,%sr
  
-       /* if we come from a pre-loader we have no exception table and
-        * therefore no VBR to set
-        */
- #if !defined(CONFIG_MONITOR_IS_IN_RAM)
-       move.l  #CFG_FLASH_BASE, %d0
-       movec   %d0, %VBR
- #endif
  #if defined(CONFIG_M5272) || defined(CONFIG_M5249)
        move.l  #(CFG_MBAR + 1), %d0            /* set MBAR address + valid flag */
        move.c  %d0, %MBAR
        movec   %d0, %RAMBAR0
  #endif /* #if defined(CONFIG_M5272) || defined(CONFIG_M5249) */
  
- #if   defined(CONFIG_M5282) || defined(CONFIG_M5271)
 -#ifdef CONFIG_M5282
++#if defined(CONFIG_M5282) || defined(CONFIG_M5271)
        /* Initialize IPSBAR */
        move.l  #(CFG_MBAR + 1), %d0            /* set IPSBAR address + valid flag */
        move.l  %d0, 0x40000000
  
- #ifdef        CONFIG_M5282
+       /* Initialize RAMBAR1: locate SRAM and validate it */
+       move.l  #(CFG_INIT_RAM_ADDR + 0x21), %d0
+       movec   %d0, %RAMBAR1
+ #if (TEXT_BASE == CFG_INT_FLASH_BASE)
+       /* Setup code in SRAM to initialize FLASHBAR, if start from internal Flash */
+       move.l #(_flashbar_setup-CFG_INT_FLASH_BASE), %a0
+       move.l #(_flashbar_setup_end-CFG_INT_FLASH_BASE), %a1
+       move.l #(CFG_INIT_RAM_ADDR), %a2
+ _copy_flash:
+       move.l (%a0)+, (%a2)+
+       cmp.l %a0, %a1
+       bgt.s _copy_flash
+       jmp CFG_INIT_RAM_ADDR
+ _flashbar_setup:
        /* Initialize FLASHBAR: locate internal Flash and validate it */
        move.l  #(CFG_INT_FLASH_BASE + 0x21), %d0
        movec   %d0, %RAMBAR0
- #endif
+       jmp _after_flashbar_copy.L      /* Force jump to absolute address */
+ _flashbar_setup_end:
+       nop
+ _after_flashbar_copy:
+ #else
+       /* Setup code to initialize FLASHBAR, if start from external Memory */
+       move.l  #(CFG_INT_FLASH_BASE + 0x21), %d0
+       movec   %d0, %RAMBAR0
+ #endif /* (TEXT_BASE == CFG_INT_FLASH_BASE) */
  
-       /* Initialize RAMBAR1: locate SRAM and validate it */
-       move.l  #(CFG_INIT_RAM_ADDR + 0x21), %d0
-       movec   %d0, %RAMBAR1
+ #endif
+       /* if we come from a pre-loader we have no exception table and
+        * therefore no VBR to set
+        */
+ #if !defined(CONFIG_MONITOR_IS_IN_RAM)
+       move.l  #CFG_FLASH_BASE, %d0
+       movec   %d0, %VBR
  #endif
  
 +#ifdef        CONFIG_R5200
 +      move.l  #(_flash_setup-CFG_FLASH_BASE), %a0
 +      move.l  #(_flash_setup_end-CFG_FLASH_BASE), %a1
 +      move.l  #(CFG_INIT_RAM_ADDR), %a2
 +_copy_flash:
 +      move.l  (%a0)+, (%a2)+
 +      cmp.l   %a0, %a1
 +      bgt.s   _copy_flash
 +      jmp     CFG_INIT_RAM_ADDR
 +_after_flash_copy:
 +#endif
 +
 +#if 0
        /* invalidate and disable cache */
        move.l  #0x01000000, %d0                /* Invalidate cache cmd */
        movec   %d0, %CACR                      /* Invalidate cache */
        move.l  #0, %d0
        movec   %d0, %ACR0
        movec   %d0, %ACR1
 +#endif
  
        /* set stackpointer to end of internal ram to get some stackspace for the first c-code */
        move.l  #(CFG_INIT_RAM_ADDR + CFG_INIT_SP_OFFSET), %sp
        bsr cpu_init_f                          /* run low-level CPU init code (from flash) */
        bsr board_init_f                        /* run low-level board init code (from flash) */
  
 -      /* board_init_f() does not return
 +      /* board_init_f() does not return */
  
  /*------------------------------------------------------------------------------*/
 +
 +#ifdef        CONFIG_R5200
 +_flash_setup:
 +      /* CSAR0 */
 +      move.l  #((CFG_FLASH_BASE & 0xffff0000) >> 16), %d0
 +      move.w  %d0, 0x40000080
 +
 +      /* CSCR0 */
 +      move.l  #0x2180, %d0            /* 8 wait states, 16bit port, auto ack,  */
 +      move.w  %d0, 0x4000008A
 +
 +      /* CSMR0 */
 +      move.l  #0x001f0001, %d0        /* 2 MB, valid */
 +      move.l  %d0, 0x40000084
 +
 +      jmp     _after_flash_copy.L
 +_flash_setup_end:
 +#endif
 +
  /*
   * void relocate_code (addr_sp, gd, addr_moni)
   *
@@@ -218,7 -216,6 +253,6 @@@ relocate_code
        move.l #CFG_MONITOR_BASE, %a1
        move.l #__init_end, %a2
        move.l %a0, %a3
        /* copy the code to RAM */
  1:
        move.l (%a1)+, (%a3)+
   * We are done. Do not return, instead branch to second part of board
   * initialization, now running from RAM.
   */
-       move.l  %a0, %a1
+       move.l  %a0, %a1
        add.l   #(in_ram - CFG_MONITOR_BASE), %a1
        jmp     (%a1)
  
  in_ram:
  
  clear_bss:
-       /*
+       /*
         * Now clear BSS segment
         */
        move.l  %a0, %a1
        cmp.l   %a2, %a1
        bne     7b
  
+ #if defined(CONFIG_M5281) || defined(CONFIG_M5282)
+       /* patch the 3 accesspoints to 3 ichache_state */
+       /* quick and dirty */
+       move.l  %a0,%d1
+       add.l   #(icache_state - CFG_MONITOR_BASE),%d1
+       move.l  %a0,%a1
+       add.l   #(icache_state_access_1+2 - CFG_MONITOR_BASE),%a1
+       move.l  %d1,(%a1)
+       move.l  %a0,%a1
+       add.l   #(icache_state_access_2+2 - CFG_MONITOR_BASE),%a1
+       move.l  %d1,(%a1)
+       move.l  %a0,%a1
+       add.l   #(icache_state_access_3+2 - CFG_MONITOR_BASE),%a1
+       move.l  %d1,(%a1)
+ #endif
        /* calculate relative jump to board_init_r in ram */
        move.l %a0, %a1
        add.l #(board_init_r - CFG_MONITOR_BASE), %a1
        /* set parameters for board_init_r */
        move.l %a0,-(%sp)               /* dest_addr */
        move.l %d0,-(%sp)               /* gd */
+       #if defined(DEBUG) && (TEXT_BASE != CFG_INT_FLASH_BASE) && \
+           defined(CFG_HALT_BEFOR_RAM_JUMP)
+               halt
+       #endif
        jsr     (%a1)
  
  /*------------------------------------------------------------------------------*/
@@@ -327,6 -345,7 +382,7 @@@ icache_enable
        move.l  #0x80400100, %d0                /* Setup cache mask, data cache disabel*/
        movec   %d0, %CACR                      /* Enable cache */
        moveq   #1, %d0
+ icache_state_access_1:
        move.l  %d0, icache_state
        rts
  #endif
@@@ -361,18 -380,19 +417,19 @@@ icache_disable
        movec   %d0, %ACR0                      /* Enable cache */
        movec   %d0, %ACR1                      /* Enable cache */
        moveq   #0, %d0
+ icache_state_access_2:
        move.l  %d0, icache_state
        rts
  
        .globl  icache_status
  icache_status:
+ icache_state_access_3:
        move.l  icache_state, %d0
        rts
  
        .data
  icache_state:
-       .long   1
+       .long   0       /* cache is diabled on inirialization */
  
  /*------------------------------------------------------------------------------*/