]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Merge branch 'master' of git://www.denx.de/git/u-boot-arm
authorWolfgang Denk <wd@denx.de>
Mon, 7 Apr 2008 22:05:42 +0000 (00:05 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 7 Apr 2008 22:05:42 +0000 (00:05 +0200)
89 files changed:
CREDITS
MAINTAINERS
MAKEALL
Makefile
README
board/MigoR/Makefile [new file with mode: 0644]
board/MigoR/config.mk [new file with mode: 0644]
board/MigoR/lowlevel_init.S [new file with mode: 0644]
board/MigoR/migo_r.c [new file with mode: 0644]
board/MigoR/u-boot.lds [new file with mode: 0644]
board/amcc/canyonlands/canyonlands.c
board/amcc/canyonlands/u-boot.lds
board/esd/du440/du440.c
board/esd/du440/du440.h
board/esd/pmc440/cmd_pmc440.c
board/esd/pmc440/pmc440.c
board/freescale/mpc8323erdb/mpc8323erdb.c
board/freescale/mpc8360emds/mpc8360emds.c
board/freescale/mpc837xemds/mpc837xemds.c
board/freescale/mpc837xerdb/mpc837xerdb.c
board/korat/config.mk
board/korat/init.S
board/korat/korat.c
board/korat/u-boot-F7FC.lds [new file with mode: 0644]
board/lwmon5/sdram.c
board/mpr2/Makefile [new file with mode: 0644]
board/mpr2/config.mk [new file with mode: 0644]
board/mpr2/lowlevel_init.S [new file with mode: 0644]
board/mpr2/mpr2.c [new file with mode: 0644]
board/mpr2/u-boot.lds [new file with mode: 0644]
board/prodrive/alpr/alpr.c
board/prodrive/alpr/init.S
board/r2dplus/Makefile [new file with mode: 0644]
board/r2dplus/config.mk [new file with mode: 0644]
board/r2dplus/lowlevel_init.S [new file with mode: 0644]
board/r2dplus/r2dplus.c [new file with mode: 0644]
board/r2dplus/u-boot.lds [new file with mode: 0644]
board/r7780mp/Makefile [new file with mode: 0644]
board/r7780mp/config.mk [new file with mode: 0644]
board/r7780mp/lowlevel_init.S [new file with mode: 0644]
board/r7780mp/r7780mp.c [new file with mode: 0644]
board/r7780mp/r7780mp.h [new file with mode: 0644]
board/r7780mp/u-boot.lds [new file with mode: 0644]
cpu/mpc83xx/cpu.c
cpu/mpc83xx/spd_sdram.c
cpu/mpc83xx/speed.c
cpu/mpc83xx/start.S
cpu/ppc4xx/4xx_enet.c
cpu/ppc4xx/cpu_init.c
cpu/ppc4xx/denali_spd_ddr2.c
cpu/ppc4xx/interrupts.c
cpu/sh4/cpu.c
doc/README.korat [new file with mode: 0644]
doc/README.sh
drivers/mtd/cfi_flash.c
drivers/mtd/jedec_flash.c
drivers/pci/Makefile
drivers/pci/pci_sh4.c [new file with mode: 0644]
drivers/pci/pci_sh7751.c [new file with mode: 0644]
drivers/pci/pci_sh7780.c [new file with mode: 0644]
drivers/serial/serial_sh.c
include/asm-ppc/global_data.h
include/asm-sh/cache.h [new file with mode: 0644]
include/asm-sh/cpu_sh4.h
include/asm-sh/cpu_sh7720.h
include/asm-sh/cpu_sh7750.h
include/asm-sh/cpu_sh7780.h [new file with mode: 0644]
include/asm-sh/pci.h [new file with mode: 0644]
include/asm-sh/processor.h
include/configs/DU440.h
include/configs/MPC8315ERDB.h
include/configs/MPC8323ERDB.h
include/configs/MPC837XEMDS.h
include/configs/MPC837XERDB.h
include/configs/MigoR.h [new file with mode: 0644]
include/configs/alpr.h
include/configs/canyonlands.h
include/configs/korat.h
include/configs/lwmon5.h
include/configs/mpr2.h [new file with mode: 0644]
include/configs/r2dplus.h [new file with mode: 0644]
include/configs/r7780mp.h [new file with mode: 0644]
include/configs/sequoia.h
include/linux/stat.h
include/mpc83xx.h
include/ppc440.h
include/ppc4xx_enet.h
lib_ppc/board.c
lib_sh/board.c

diff --git a/CREDITS b/CREDITS
index 1627dc7f0af0808143ef702c750045121da6cd1a..26d5f51b99c791d3090637fd48284e27d02d7a92 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -236,6 +236,10 @@ E: mark.jonas@freescale.com
 D: Support for Freescale Total5200 platform
 W: http://www.mobilegt.com/
 
+N: Mark Jonas
+E: mark.jonas@de.bosch.com
+D: Support for MPR2 board
+
 N: Sam Song
 E: samsongshu@yahoo.com.cn
 D: Port to the RPXlite_DW board
index e31ea06afb4f63253ee99ae9e23fcf8249229e92..31c0311312765d9223bdc477eebe8ba775eb9f47 100644 (file)
@@ -322,6 +322,7 @@ Stefan Roese <sr@denx.de>
        bunbinga                PPC405EP
        canyonlands             PPC460EX
        ebony                   PPC440GP
+       glacier                 PPC460GT
        haleakala               PPC405EXr
        katmai                  PPC440SPe
        kilauea                 PPC405EX
@@ -694,15 +695,25 @@ Haavard Skinnemoen <hskinnemoen@atmel.com>
 #      Board                   CPU                                     #
 #########################################################################
 
-Nobuhiro Iwmaatsu <iwamatsu@nigauri.org>
+Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
 
        MS7750SE                SH7750
        MS7722SE                SH7722
+       R7780MP                 SH7780
+       R2DPlus                 SH7751R
+
+Mark Jonas <mark.jonas@de.bosch.com>
+
+       mpr2                    SH7720
 
 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
 
        MS7720SE                SH7720
 
+Yusuke Goda <goda.yusuke@renesas.com>
+
+       MIGO-R                  SH7722
+
 #########################################################################
 # Blackfin Systems:                                                    #
 #                                                                      #
diff --git a/MAKEALL b/MAKEALL
index 72bd75e45c471584bfaf55a9f7914fc7dad57692..6728d3f6e3b6fef9c3895f281daea8aa07d07373 100755 (executable)
--- a/MAKEALL
+++ b/MAKEALL
@@ -185,6 +185,7 @@ LIST_4xx="          \
        ERIC            \
        EXBITGEN        \
        G2000           \
+       glacier         \
        haleakala       \
        haleakala_nand  \
        hcu4            \
@@ -703,9 +704,13 @@ LIST_blackfin="            \
 LIST_sh4="             \
        ms7750se        \
        ms7722se        \
+       Migo-R          \
+       r7780mp         \
+       r2dplus         \
 "
 
 LIST_sh3="             \
+       mpr2            \
        ms7720se        \
 "
 
index f160d25ab252e6a829b420e9bc21c1338c277946..4c07c2e6919e124e19de744f9e324a33b256558e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1172,8 +1172,13 @@ bubinga_config:  unconfig
 CANBT_config:  unconfig
        @$(MKCONFIG) $(@:_config=) ppc ppc4xx canbt esd
 
-canyonlands_config:    unconfig
-       @$(MKCONFIG) $(@:_config=) ppc ppc4xx canyonlands amcc
+# Canyonlands & Glacier use different U-Boot images
+canyonlands_config \
+glacier_config:        unconfig
+       @mkdir -p $(obj)include
+       @echo "#define CONFIG_$$(echo $(subst ,,$(@:_config=)) | \
+               tr '[:lower:]' '[:upper:]')" >$(obj)include/config.h
+       @$(MKCONFIG) -n $@ -a canyonlands ppc ppc4xx canyonlands amcc
 
 canyonlands_nand_config:       unconfig
        @mkdir -p $(obj)include $(obj)board/amcc/canyonlands
@@ -2849,6 +2854,11 @@ atngw100_config  :       unconfig
 #########################################################################
 ## sh3 (Renesas SuperH)
 #########################################################################
+mpr2_config: unconfig
+       @ >include/config.h
+       @echo "#define CONFIG_MPR2 1" >> include/config.h
+       @$(MKCONFIG) -a $(@:_config=) sh sh3 mpr2
+
 ms7720se_config: unconfig
        @echo "#define CONFIG_MS7720SE 1" > include/config.h
        @$(MKCONFIG) -a $(@:_config=) sh sh3 ms7720se
@@ -2864,6 +2874,21 @@ ms7722se_config :        unconfig
        @echo "#define CONFIG_MS7722SE 1" > $(obj)include/config.h
        @$(MKCONFIG) -a $(@:_config=) sh sh4 ms7722se
 
+MigoR_config :       unconfig
+       @ >include/config.h
+       @echo "#define CONFIG_MIGO_R 1" >> include/config.h
+       @./mkconfig -a $(@:_config=) sh sh4 MigoR
+
+r7780mp_config: unconfig
+       @ >include/config.h
+       @echo "#define CONFIG_R7780MP 1" >> include/config.h
+       @./mkconfig -a $(@:_config=) sh sh4 r7780mp
+
+r2dplus_config  :   unconfig
+       @ >include/config.h
+       @echo "#define CONFIG_R2DPLUS 1" >> include/config.h
+       @./mkconfig -a $(@:_config=) sh sh4 r2dplus
+
 #########################################################################
 #########################################################################
 #########################################################################
diff --git a/README b/README
index 5cbe7c1e80daabeee8c43247db7041b999919025..3f3666879137a846c9fb616af281173f555931cb 100644 (file)
--- a/README
+++ b/README
@@ -1929,6 +1929,27 @@ Configuration Settings:
                Scratch address used by the alternate memory test
                You only need to set this if address zero isn't writeable
 
+- CFG_MEM_TOP_HIDE (PPC only):
+               If CFG_MEM_TOP_HIDE is defined in the board config header,
+               this specified memory area will get subtracted from the top
+               (end) of ram and won't get "touched" at all by U-Boot. By
+               fixing up gd->ram_size the Linux kernel should gets passed
+               the now "corrected" memory size and won't touch it either.
+               This should work for arch/ppc and arch/powerpc. Only Linux
+               board ports in arch/powerpc with bootwrapper support that
+               recalculate the memory size from the SDRAM controller setup
+               will have to get fixed in Linux additionally.
+
+               This option can be used as a workaround for the 440EPx/GRx
+               CHIP 11 errata where the last 256 bytes in SDRAM shouldn't
+               be touched.
+
+               WARNING: Please make sure that this value is a multiple of
+               the Linux page size (normally 4k). If this is not the case,
+               then the end address of the Linux memory will be located at a
+               non page size aligned address and this could cause major
+               problems.
+
 - CFG_TFTP_LOADADDR:
                Default load address for network file downloads
 
diff --git a/board/MigoR/Makefile b/board/MigoR/Makefile
new file mode 100644 (file)
index 0000000..5a9d651
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2007
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# Copyright (C) 2007
+# Kenati Technologies, Inc.
+#
+# board/MigoR/Makefile
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB    = lib$(BOARD).a
+
+OBJS   := migo_r.o
+SOBJS  := lowlevel_init.o
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+-include .depend
+
+#########################################################################
diff --git a/board/MigoR/config.mk b/board/MigoR/config.mk
new file mode 100644 (file)
index 0000000..c68cb72
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2007
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# Copyright (C) 2007
+# Kenati Technologies, Inc.
+#
+# board/MigoR/config.mk
+#
+# 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
+
+#
+# TEXT_BASE refers to image _after_ relocation.
+#
+# NOTE: Must match value used in u-boot.lds (in this directory).
+#
+
+TEXT_BASE = 0x8FFC0000
+
diff --git a/board/MigoR/lowlevel_init.S b/board/MigoR/lowlevel_init.S
new file mode 100644 (file)
index 0000000..7fd771d
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2007
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * Copyright (C) 2007
+ * Kenati Technologies, Inc.
+ *
+ * board/MigoR/lowlevel_init.S
+ *
+ * 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>
+
+#include <asm/processor.h>
+
+/*
+ *  Board specific low level init code, called _very_ early in the
+ *  startup sequence. Relocation to SDRAM has not happened yet, no
+ *  stack is available, bss section has not been initialised, etc.
+ *
+ *  (Note: As no stack is available, no subroutines can be called...).
+ */
+
+       .global lowlevel_init
+
+       .text
+       .align  2
+
+lowlevel_init:
+
+       mov.l   CCR_A, r1       ! Address of Cache Control Register
+       mov.l   CCR_D, r0       ! Instruction Cache Invalidate
+       mov.l   r0, @r1
+
+       mov.l   MMUCR_A, r1     ! Address of MMU Control Register
+       mov.l   MMUCR_D, r0     ! TI == TLB Invalidate bit
+       mov.l   r0, @r1
+
+       mov.l   MSTPCR0_A, r1   ! Address of Power Control Register 0
+       mov.l   MSTPCR0_D, r0   !
+       mov.l   r0, @r1
+
+       mov.l   MSTPCR2_A, r1   ! Address of Power Control Register 2
+       mov.l   MSTPCR2_D, r0   !
+       mov.l   r0, @r1
+
+       mov.l   PFC_PULCR_A, r1
+       mov.w   PFC_PULCR_D, r0
+       mov.w   r0,@r1
+
+       mov.l   PFC_DRVCR_A, r1
+       mov.w   PFC_DRVCR_D, r0
+       mov.w   r0, @r1
+
+       mov.l   SBSCR_A, r1     !
+       mov.w   SBSCR_D, r0     !
+       mov.w   r0, @r1
+
+       mov.l   PSCR_A, r1      !
+       mov.w   PSCR_D, r0      !
+       mov.w   r0, @r1
+
+       mov.l   RWTCSR_A, r1    ! 0xA4520004 (Watchdog Control / Status Register)
+       mov.w   RWTCSR_D_1, r0  ! 0xA507 -> timer_STOP/WDT_CLK=max
+       mov.w   r0, @r1
+
+       mov.l   RWTCNT_A, r1    ! 0xA4520000 (Watchdog Count Register)
+       mov.w   RWTCNT_D, r0    ! 0x5A00 -> Clear
+       mov.w   r0, @r1
+
+       mov.l   RWTCSR_A, r1    ! 0xA4520004 (Watchdog Control / Status Register)
+       mov.w   RWTCSR_D_2, r0  ! 0xA504 -> timer_STOP/CLK=500ms
+       mov.w   r0, @r1
+
+       mov.l   DLLFRQ_A, r1    ! 20080115
+       mov.l   DLLFRQ_D, r0    ! 20080115
+       mov.l   r0, @r1
+
+       mov.l   FRQCR_A, r1             ! 0xA4150000 Frequency control register
+       mov.l   FRQCR_D, r0     ! 20080115
+       mov.l   r0, @r1
+
+       mov.l   CCR_A, r1               ! Address of Cache Control Register
+       mov.l   CCR_D_2, r0     ! ??
+       mov.l   r0, @r1
+
+bsc_init:
+
+       mov.l   CMNCR_A, r1     ! CMNCR address -> R1
+       mov.l   CMNCR_D, r0     ! CMNCR data    -> R0
+       mov.l   r0, @r1         ! CMNCR set
+
+       mov.l   CS0BCR_A, r1    ! CS0BCR address -> R1
+       mov.l   CS0BCR_D, r0    ! CS0BCR data    -> R0
+       mov.l   r0, @r1         ! CS0BCR set
+
+       mov.l   CS4BCR_A, r1    ! CS4BCR address -> R1
+       mov.l   CS4BCR_D, r0    ! CS4BCR data    -> R0
+       mov.l   r0, @r1         ! CS4BCR set
+
+       mov.l   CS5ABCR_A, r1   ! CS5ABCR address -> R1
+       mov.l   CS5ABCR_D, r0   ! CS5ABCR data    -> R0
+       mov.l   r0, @r1         ! CS5ABCR set
+
+       mov.l   CS5BBCR_A, r1   ! CS5BBCR address -> R1
+       mov.l   CS5BBCR_D, r0   ! CS5BBCR data    -> R0
+       mov.l   r0, @r1         ! CS5BBCR set
+
+       mov.l   CS6ABCR_A, r1   ! CS6ABCR address -> R1
+       mov.l   CS6ABCR_D, r0   ! CS6ABCR data    -> R0
+       mov.l   r0, @r1         ! CS6ABCR set
+
+       mov.l   CS0WCR_A, r1    ! CS0WCR address -> R1
+       mov.l   CS0WCR_D, r0    ! CS0WCR data    -> R0
+       mov.l   r0, @r1         ! CS0WCR set
+
+       mov.l   CS4WCR_A, r1    ! CS4WCR address -> R1
+       mov.l   CS4WCR_D, r0    ! CS4WCR data    -> R0
+       mov.l   r0, @r1         ! CS4WCR set
+
+       mov.l   CS5AWCR_A, r1   ! CS5AWCR address -> R1
+       mov.l   CS5AWCR_D, r0   ! CS5AWCR data    -> R0
+       mov.l   r0, @r1         ! CS5AWCR set
+
+       mov.l   CS5BWCR_A, r1   ! CS5BWCR address -> R1
+       mov.l   CS5BWCR_D, r0   ! CS5BWCR data    -> R0
+       mov.l   r0, @r1         ! CS5BWCR set
+
+       mov.l   CS6AWCR_A, r1   ! CS6AWCR address -> R1
+       mov.l   CS6AWCR_D, r0   ! CS6AWCR data    -> R0
+       mov.l   r0, @r1         ! CS6AWCR set
+
+       ! SDRAM initialization
+       mov.l   SDCR_A, r1      ! SB_SDCR address -> R1
+       mov.l   SDCR_D, r0      ! SB_SDCR data    -> R0
+       mov.l   r0, @r1         ! SB_SDCR set
+
+       mov.l   SDWCR_A, r1     ! SB_SDWCR address -> R1
+       mov.l   SDWCR_D, r0     ! SB_SDWCR data    -> R0
+       mov.l   r0, @r1         ! SB_SDWCR set
+
+       mov.l   SDPCR_A, r1     ! SB_SDPCR address -> R1
+       mov.l   SDPCR_D, r0     ! SB_SDPCR data    -> R0
+       mov.l   r0, @r1         ! SB_SDPCR set
+
+       mov.l   RTCOR_A, r1     ! SB_RTCOR address -> R1
+       mov.l   RTCOR_D, r0     ! SB_RTCOR data    -> R0
+       mov.l   r0, @r1         ! SB_RTCOR set
+
+       mov.l   RTCNT_A, r1     ! SB_RTCNT address -> R1
+       mov.l   RTCNT_D, r0     ! SB_RTCNT data    -> R0
+       mov.l   r0, @r1
+
+       mov.l   RTCSR_A, r1     ! SB_RTCSR address -> R1
+       mov.l   RTCSR_D, r0     ! SB_RTCSR data    -> R0
+       mov.l   r0, @r1         ! SB_RTCSR set
+
+       mov.l   RFCR_A, r1      ! SB_RFCR address -> R1
+       mov.l   RFCR_D, r0      ! SB_RFCR data    -> R0
+       mov.l   r0, @r1
+
+       mov.l   SDMR3_A, r1     ! SDMR3 address -> R1
+       mov     #0x00, r0       ! SDMR3 data    -> R0
+       mov.b   r0, @r1         ! SDMR3 set
+
+       ! BL bit off (init = ON)  (?!?)
+
+       stc     sr, r0                          ! BL bit off(init=ON)
+       mov.l   SR_MASK_D, r1
+       and     r1, r0
+       ldc     r0, sr
+
+       rts
+       mov     #0, r0
+
+
+
+       .align  4
+
+CCR_A:         .long   CCR
+MMUCR_A:       .long   MMUCR
+MSTPCR0_A:     .long   MSTPCR0
+MSTPCR2_A:     .long   MSTPCR2
+PFC_PULCR_A:   .long   PULCR
+PFC_DRVCR_A:   .long   DRVCR
+SBSCR_A:       .long   SBSCR
+PSCR_A:                .long   PSCR
+RWTCSR_A:      .long   RWTCSR
+RWTCNT_A:      .long   RWTCNT
+FRQCR_A:       .long   FRQCR
+PLLCR_A:       .long   PLLCR
+DLLFRQ_A:      .long   DLLFRQ
+
+CCR_D:         .long   0x00000800
+CCR_D_2:       .long   0x00000103
+MMUCR_D:       .long   0x00000004
+MSTPCR0_D:     .long   0x00001001
+MSTPCR2_D:     .long   0xffffffff
+PFC_PULCR_D:   .long   0x6000
+PFC_DRVCR_D:   .long   0x0464
+FRQCR_D:       .long   0x07033639
+PLLCR_D:       .long   0x00005000
+DLLFRQ_D:      .long   0x000004F6      ! 20080115
+
+CMNCR_A:       .long   CMNCR
+CMNCR_D:       .long   0x0000001B      ! 20080115
+CS0BCR_A:      .long   CS0BCR          ! Flash bank 1
+CS0BCR_D:      .long   0x24920400
+CS4BCR_A:      .long   CS4BCR          !
+CS4BCR_D:      .long   0x10003400      ! 20080115
+CS5ABCR_A:     .long   CS5ABCR         !
+CS5ABCR_D:     .long   0x24920400
+CS5BBCR_A:     .long   CS5BBCR         !
+CS5BBCR_D:     .long   0x24920400
+CS6ABCR_A:     .long   CS6ABCR         !
+CS6ABCR_D:     .long   0x24920400
+
+CS0WCR_A:      .long   CS0WCR
+CS0WCR_D:      .long   0x00000380
+CS4WCR_A:      .long   CS4WCR
+CS4WCR_D:      .long   0x00100A81      ! 20080115
+CS5AWCR_A:     .long   CS5AWCR
+CS5AWCR_D:     .long   0x00000300
+CS5BWCR_A:     .long   CS5BWCR
+CS5BWCR_D:     .long   0x00000300
+CS6AWCR_A:     .long   CS6AWCR
+CS6AWCR_D:     .long   0x00000300
+
+SDCR_A:                .long   SBSC_SDCR
+SDCR_D:                .long   0x80160809      ! 20080115
+SDWCR_A:       .long   SBSC_SDWCR
+SDWCR_D:       .long   0x0014450C      ! 20080115
+SDPCR_A:       .long   SBSC_SDPCR
+SDPCR_D:       .long   0x00000087
+RTCOR_A:       .long   SBSC_RTCOR
+RTCNT_A:       .long   SBSC_RTCNT
+RTCNT_D:       .long   0xA55A0012
+RTCOR_D:       .long   0xA55A001C      ! 20080115
+RTCSR_A:       .long   SBSC_RTCSR
+RFCR_A:                .long   SBSC_RFCR
+RFCR_D:                .long   0xA55A0221
+RTCSR_D:       .long   0xA55A009a      ! 20080115
+SDMR3_A:       .long   0xFE581180      ! 20080115
+
+SR_MASK_D:     .long   0xEFFFFF0F
+
+       .align  2
+
+SBSCR_D:       .word   0x0044
+PSCR_D:                .word   0x0000
+RWTCSR_D_1:    .word   0xA507
+RWTCSR_D_2:    .word   0xA504          ! 20080115
+RWTCNT_D:      .word   0x5A00
+
diff --git a/board/MigoR/migo_r.c b/board/MigoR/migo_r.c
new file mode 100644 (file)
index 0000000..53f4bb2
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2007
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * Copyright (C) 2007
+ * Kenati Technologies, Inc.
+ *
+ * board/MigoR/migo_r.c
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+
+int checkboard(void)
+{
+       puts("BOARD: Renesas MigoR\n");
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}
+
+int dram_init (void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       gd->bd->bi_memstart = CFG_SDRAM_BASE;
+       gd->bd->bi_memsize = CFG_SDRAM_SIZE;
+       printf("DRAM:  %dMB\n", CFG_SDRAM_SIZE / (1024 * 1024));
+       return 0;
+}
+
+void led_set_state (unsigned short value)
+{
+}
+
diff --git a/board/MigoR/u-boot.lds b/board/MigoR/u-boot.lds
new file mode 100644 (file)
index 0000000..1877b81
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyrigth (c) 2007
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+OUTPUT_ARCH(sh)
+ENTRY(_start)
+
+SECTIONS
+{
+       /*
+          Base address of internal SDRAM is 0x0C000000.
+          Although size of SDRAM can be either 16 or 32 MBytes,
+          we assume 16 MBytes (ie ignore upper half if the full
+          32 MBytes is present).
+
+          NOTE: This address must match with the definition of
+          TEXT_BASE in config.mk (in this directory).
+
+       */
+       . = 0x8C000000 + (64*1024*1024) - (256*1024);
+
+       PROVIDE (reloc_dst = .);
+
+       PROVIDE (_ftext = .);
+       PROVIDE (_fcode = .);
+       PROVIDE (_start = .);
+
+       .text :
+       {
+               cpu/sh4/start.o         (.text)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenv)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenvr)
+               . = ALIGN(8192);
+               *(.text)
+               . = ALIGN(4);
+       } =0xFF
+       PROVIDE (_ecode = .);
+       .rodata :
+       {
+               *(.rodata)
+               . = ALIGN(4);
+       }
+       PROVIDE (_etext = .);
+
+
+       PROVIDE (_fdata = .);
+       .data :
+       {
+               *(.data)
+               . = ALIGN(4);
+       }
+       PROVIDE (_edata = .);
+
+       PROVIDE (_fgot = .);
+       .got :
+       {
+               *(.got)
+               . = ALIGN(4);
+       }
+       PROVIDE (_egot = .);
+
+       PROVIDE (__u_boot_cmd_start = .);
+       .u_boot_cmd :
+       {
+               *(.u_boot_cmd)
+               . = ALIGN(4);
+       }
+       PROVIDE (__u_boot_cmd_end = .);
+
+       PROVIDE (reloc_dst_end = .);
+       /* _reloc_dst_end = .; */
+
+       PROVIDE (bss_start = .);
+       PROVIDE (__bss_start = .);
+       .bss :
+       {
+               *(.bss)
+               . = ALIGN(4);
+       }
+       PROVIDE (bss_end = .);
+
+       PROVIDE (_end = .);
+}
+
index 36779f576f2b650ba693f434cad916657410eb02..9986e9a9c6ef8a87684f91282919222af5f82a30 100644 (file)
@@ -32,13 +32,20 @@ extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define CFG_BCSR3_PCIE         0x10
+
+#define BOARD_CANYONLANDS_PCIE 1
+#define BOARD_CANYONLANDS_SATA 2
+#define BOARD_GLACIER          3
+
 int board_early_init_f(void)
 {
        u32 sdr0_cust0;
+       u32 pvr = get_pvr();
 
-       /*------------------------------------------------------------------+
+       /*
         * Setup the interrupt controller polarities, triggers, etc.
-        *------------------------------------------------------------------*/
+        */
        mtdcr(uic0sr, 0xffffffff);      /* clear all */
        mtdcr(uic0er, 0x00000000);      /* disable all */
        mtdcr(uic0cr, 0x00000005);      /* ATI & UIC1 crit are critical */
@@ -105,27 +112,69 @@ int board_early_init_f(void)
        mtdcr(AHB_TOP, 0x8000004B);
        mtdcr(AHB_BOT, 0x8000004B);
 
-       /*
-        * Configure USB-STP pins as alternate and not GPIO
-        * It seems to be neccessary to configure the STP pins as GPIO
-        * input at powerup (perhaps while USB reset is asserted). So
-        * we configure those pins to their "real" function now.
-        */
-       gpio_config(16, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
-       gpio_config(19, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
+       if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA)) {
+               /*
+                * Configure USB-STP pins as alternate and not GPIO
+                * It seems to be neccessary to configure the STP pins as GPIO
+                * input at powerup (perhaps while USB reset is asserted). So
+                * we configure those pins to their "real" function now.
+                */
+               gpio_config(16, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
+               gpio_config(19, GPIO_OUT, GPIO_ALT1, GPIO_OUT_1);
+       }
 
        return 0;
 }
 
-int checkboard (void)
+static void canyonlands_sata_init(int board_type)
+{
+       u32 reg;
+
+       if (board_type == BOARD_CANYONLANDS_SATA) {
+               /* Put SATA in reset */
+               SDR_WRITE(SDR0_SRST1, 0x00020001);
+
+               /* Set the phy for SATA, not PCI-E port 0 */
+               reg = SDR_READ(PESDR0_PHY_CTL_RST);
+               SDR_WRITE(PESDR0_PHY_CTL_RST, (reg & 0xeffffffc) | 0x00000001);
+               reg = SDR_READ(PESDR0_L0CLK);
+               SDR_WRITE(PESDR0_L0CLK, (reg & 0xfffffff8) | 0x00000007);
+               SDR_WRITE(PESDR0_L0CDRCTL, 0x00003111);
+               SDR_WRITE(PESDR0_L0DRV, 0x00000104);
+
+               /* Bring SATA out of reset */
+               SDR_WRITE(SDR0_SRST1, 0x00000000);
+       }
+}
+
+int checkboard(void)
 {
        char *s = getenv("serial#");
        u32 pvr = get_pvr();
 
-       if ((pvr == PVR_460GT_RA) || (pvr == PVR_460GT_SE_RA))
+       if ((pvr == PVR_460GT_RA) || (pvr == PVR_460GT_SE_RA)) {
                printf("Board: Glacier - AMCC PPC460GT Evaluation Board");
-       else
+               gd->board_type = BOARD_GLACIER;
+       } else {
                printf("Board: Canyonlands - AMCC PPC460EX Evaluation Board");
+               if (in_8((void *)(CFG_BCSR_BASE + 3)) & CFG_BCSR3_PCIE)
+                       gd->board_type = BOARD_CANYONLANDS_PCIE;
+               else
+                       gd->board_type = BOARD_CANYONLANDS_SATA;
+       }
+
+       switch (gd->board_type) {
+       case BOARD_CANYONLANDS_PCIE:
+       case BOARD_GLACIER:
+               puts(", 2*PCIe");
+               break;
+
+       case BOARD_CANYONLANDS_SATA:
+               puts(", 1*PCIe/1*SATA");
+               break;
+       }
+
+       printf(", Rev. %X", in_8((void *)(CFG_BCSR_BASE + 0)));
 
        if (s != NULL) {
                puts(", serial# ");
@@ -133,6 +182,8 @@ int checkboard (void)
        }
        putc('\n');
 
+       canyonlands_sata_init(gd->board_type);
+
        return (0);
 }
 
@@ -198,37 +249,36 @@ int testdram(void)
 }
 #endif
 
-/*************************************************************************
+/*
  *  pci_target_init
  *
  *     The bootstrap configuration provides default settings for the pci
  *     inbound map (PIM). But the bootstrap config choices are limited and
  *     may not be sufficient for a given board.
- *
- ************************************************************************/
+ */
 #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
 void pci_target_init(struct pci_controller * hose )
 {
-       /*-------------------------------------------------------------------+
+       /*
         * Disable everything
-        *-------------------------------------------------------------------*/
+        */
        out_le32((void *)PCIX0_PIM0SA, 0); /* disable */
        out_le32((void *)PCIX0_PIM1SA, 0); /* disable */
        out_le32((void *)PCIX0_PIM2SA, 0); /* disable */
        out_le32((void *)PCIX0_EROMBA, 0); /* disable expansion rom */
 
-       /*-------------------------------------------------------------------+
+       /*
         * Map all of SDRAM to PCI address 0x0000_0000. Note that the 440
         * strapping options to not support sizes such as 128/256 MB.
-        *-------------------------------------------------------------------*/
+        */
        out_le32((void *)PCIX0_PIM0LAL, CFG_SDRAM_BASE);
        out_le32((void *)PCIX0_PIM0LAH, 0);
        out_le32((void *)PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1);
        out_le32((void *)PCIX0_BAR0, 0);
 
-       /*-------------------------------------------------------------------+
+       /*
         * Program the board's subsystem id/vendor id
-        *-------------------------------------------------------------------*/
+        */
        out_le16((void *)PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID);
        out_le16((void *)PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID);
 
@@ -265,13 +315,24 @@ void pcie_setup_hoses(int busno)
        int ret = 0;
        char *env;
        unsigned int delay;
+       int start;
 
        /*
         * assume we're called after the PCIX hose is initialized, which takes
         * bus ID 0 and therefore start numbering PCIe's from 1.
         */
        bus = busno;
-       for (i = 0; i <= 1; i++) {
+
+       /*
+        * Canyonlands with SATA enabled has only one PCIe slot
+        * (2nd one).
+        */
+       if (gd->board_type == BOARD_CANYONLANDS_SATA)
+               start = 1;
+       else
+               start = 0;
+
+       for (i = start; i <= 1; i++) {
 
                if (is_end_point(i))
                        ret = ppc4xx_init_pcie_endport(i);
@@ -369,6 +430,7 @@ int misc_init_r(void)
 {
        u32 sdr0_srst1 = 0;
        u32 eth_cfg;
+       u32 pvr = get_pvr();
 
        /*
         * Set EMAC mode/configuration (GMII, SGMII, RGMII...).
@@ -382,7 +444,10 @@ int misc_init_r(void)
        /* Set the for 2 RGMII mode */
        /* GMC0 EMAC4_0, GMC0 EMAC4_1, RGMII Bridge 0 */
        eth_cfg &= ~SDR0_ETH_CFG_GMC0_BRIDGE_SEL;
-       eth_cfg |= SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
+       if ((pvr == PVR_460EX_RA) || (pvr == PVR_460EX_SE_RA))
+               eth_cfg |= SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
+       else
+               eth_cfg &= ~SDR0_ETH_CFG_GMC1_BRIDGE_SEL;
        mtsdr(SDR0_ETH_CFG, eth_cfg);
 
        /*
@@ -407,7 +472,7 @@ void ft_board_setup(void *blob, bd_t *bd)
        /* Fixup NOR mapping */
        val[0] = 0;                             /* chip select number */
        val[1] = 0;                             /* always 0 */
-       val[2] = gd->bd->bi_flashstart;
+       val[2] = CFG_FLASH_BASE_PHYS_L;         /* we fixed up this address */
        val[3] = gd->bd->bi_flashsize;
        rc = fdt_find_and_setprop(blob, "/plb/opb/ebc", "ranges",
                                  val, sizeof(val), 1);
index 7496f485ea6ed7b67d543388717084c0e2386aa1..3df6ad4f4d1b614663be42552a2a7d956056e7b9 100644 (file)
@@ -139,8 +139,6 @@ SECTIONS
    *(COMMON)
   }
 
-  ppcenv_assert = ASSERT(. < 0xFFFF8000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified.");
-
   _end = . ;
   PROVIDE (end = .);
 }
index ceb128c14881be221f1f2657869794878629fddc..3dbb2e135cc4df73a3e946cb25f8387647dfe25e 100644 (file)
@@ -67,12 +67,12 @@ int board_early_init_f(void)
        out_be32((void*)GPIO1_OR, 0x00000000);
        out_be32((void*)GPIO1_TCR, 0xc2000000 |
                 CFG_GPIO1_IORSTN |
+                CFG_GPIO1_IORST2N |
                 CFG_GPIO1_LEDUSR1 |
                 CFG_GPIO1_LEDUSR2 |
                 CFG_GPIO1_LEDPOST |
                 CFG_GPIO1_LEDDU);
        out_be32((void*)GPIO1_ODR, CFG_GPIO1_LEDDU);
-
        out_be32((void*)GPIO1_OSRL, 0x5c280000);
        out_be32((void*)GPIO1_OSRH, 0x00000000);
        out_be32((void*)GPIO1_TSRL, 0x0c000000);
@@ -243,7 +243,8 @@ int misc_init_r(void)
         * release IO-RST#
         * We have to wait at least 560ms until we may call usbhub_init
         */
-       out_be32((void*)GPIO1_OR, in_be32((void*)GPIO1_OR) | CFG_GPIO1_IORSTN);
+       out_be32((void*)GPIO1_OR, in_be32((void*)GPIO1_OR) |
+                CFG_GPIO1_IORSTN | CFG_GPIO1_IORST2N);
 
        /*
         * flash USR1/2 LEDs (600ms)
index 5c362e481873c746a0b445e7315c4b890ff1dd62..83fdac7c63fe85784efc0de32edc5faf1af1e135 100644 (file)
@@ -24,6 +24,7 @@
 #define CFG_GPIO1_DCF77                (0x80000000 >> (42-32))  /* GPIO1_42 */
 
 #define CFG_GPIO1_IORSTN       (0x80000000 >> (55-32))  /* GPIO1_55 */
+#define CFG_GPIO1_IORST2N      (0x80000000 >> (47-32))  /* GPIO1_47 */
 
 #define CFG_GPIO1_HWVER_MASK   0x000000f0 /* GPIO1_56-59 */
 #define CFG_GPIO1_HWVER_SHIFT  4
index 350af48638490ac4365ade03be062491c545de62..90d93095558f7b201f2557cd2fe4d3840b6c465b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007
+ * (C) Copyright 2007-2008
  * Matthias Fuchs, esd Gmbh, matthias.fuchs@esd-electronics.com.
  *
  * See file CREDITS for list of people who contributed to this
@@ -21,7 +21,6 @@
  * MA 02111-1307 USA
  *
  */
-
 #include <common.h>
 #include <command.h>
 #include <asm/io.h>
@@ -31,7 +30,8 @@
 #include "pmc440.h"
 
 int is_monarch(void);
-int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
+int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset,
+                          uchar *buffer, unsigned cnt);
 int eeprom_write_enable(unsigned dev_addr, int state);
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -64,7 +64,6 @@ int fpga_interrupt(u32 arg)
        return rc;
 }
 
-
 int do_waithci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        pmc440_fpga_t *fpga = (pmc440_fpga_t *)FPGA_BA;
@@ -100,7 +99,6 @@ U_BOOT_CMD(
        NULL
        );
 
-
 void dump_fifo(pmc440_fpga_t *fpga, int f, int *n)
 {
        u32 ctrl;
@@ -117,7 +115,6 @@ void dump_fifo(pmc440_fpga_t *fpga, int f, int *n)
        }
 }
 
-
 int do_fifo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        pmc440_fpga_t *fpga = (pmc440_fpga_t *)FPGA_BA;
@@ -200,7 +197,8 @@ int do_fifo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                        got_fifoirq = 0;
                                        /* unmask global fifo irq */
                                        FPGA_OUT32(&fpga->hostctrl,
-                                                  HOSTCTRL_FIFOIE_GATE | HOSTCTRL_FIFOIE_FLAG);
+                                                  HOSTCTRL_FIFOIE_GATE |
+                                                  HOSTCTRL_FIFOIE_FLAG);
                                }
                        }
 
@@ -237,7 +235,8 @@ int do_fifo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                for (i=0; i<n; i++)
                                        FPGA_OUT32(&fpga->fifo[f].data, data);
                        } else {
-                               printf("writing %d x %08x to fifo port at address %08x\n",
+                               printf("writing %d x %08x to fifo port at "
+                                      "address %08x\n",
                                       n, data, f);
                                for (i=0; i<n; i++)
                                        out32(f, data);
@@ -263,10 +262,10 @@ U_BOOT_CMD(
        "  - without arguments: print all fifo's status\n"
        "  - with 'wait' argument: interrupt driven read from all fifos\n"
        "  - with 'read' argument: read current contents from all fifos\n"
-       "  - with 'write' argument: write 'data' 'cnt' times to 'fifo' or 'address'\n"
+       "  - with 'write' argument: write 'data' 'cnt' times to "
+       "'fifo' or 'address'\n"
        );
 
-
 int do_setup_bootstrap_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        ulong sdsdp[5];
@@ -301,10 +300,12 @@ int do_setup_bootstrap_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]
                        sdsdp[2]=0x40082350;
                        sdsdp[3]=0x0d050000;
                } else if (!strcmp(argv[1], "test")) {
-                       /* TODO: this will replace the 667 MHz config above.
+                       /*
+                        * TODO: this will replace the 667 MHz config above.
                         * But it needs some more testing on a real 667 MHz CPU.
                         */
-                       printf("Bootstrapping for test (667MHz PLB=133PLB PLB/PCI=3)\n");
+                       printf("Bootstrapping for test"
+                              " (667MHz PLB=133PLB PLB/PCI=3)\n");
                        sdsdp[0]=0x8778a256;
                        sdsdp[1]=0x095fa030;
                        sdsdp[2]=0x40082350;
@@ -347,7 +348,6 @@ U_BOOT_CMD(
        "<cpufreq:400|533|667> [<console-uart:0|1> [<bringup delay (0..20s)>]]"
        );
 
-
 #if defined(CONFIG_PRAM)
 #include <environment.h>
 extern env_t *env_ptr;
@@ -394,7 +394,6 @@ U_BOOT_CMD(
        );
 #endif /* CONFIG_PRAM */
 
-
 int do_selfreset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        if (argc > 1) {
@@ -423,7 +422,6 @@ U_BOOT_CMD(
        NULL
        );
 
-
 int do_resetout(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        pmc440_fpga_t *fpga = (pmc440_fpga_t *)FPGA_BA;
@@ -444,7 +442,8 @@ int do_resetout(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        /* deassert */
                        printf("PMC-RESETOUT# deasserted\n");
                        FPGA_OUT32(&fpga->hostctrl,
-                                  HOSTCTRL_PMCRSTOUT_GATE | HOSTCTRL_PMCRSTOUT_FLAG);
+                                  HOSTCTRL_PMCRSTOUT_GATE |
+                                  HOSTCTRL_PMCRSTOUT_FLAG);
                }
        } else {
                printf("PMC-RESETOUT# is %s\n",
@@ -460,7 +459,6 @@ U_BOOT_CMD(
        NULL
        );
 
-
 int do_inta(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        if (is_monarch()) {
@@ -481,7 +479,9 @@ int do_inta(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                 in_be32((void*)GPIO1_TCR) & ~GPIO1_INTA_FAKE);
                }
        } else {
-               printf("inta# is %s\n", in_be32((void*)GPIO1_TCR) & GPIO1_INTA_FAKE ? "active" : "inactive");
+               printf("inta# is %s\n",
+                      in_be32((void*)GPIO1_TCR) & GPIO1_INTA_FAKE ?
+                      "active" : "inactive");
        }
        return 0;
 }
@@ -491,7 +491,6 @@ U_BOOT_CMD(
        NULL
        );
 
-
 /* test-only */
 int do_pmm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
@@ -503,11 +502,17 @@ int do_pmm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                pciaddr &= 0xf0000000;
 
                /* map PCI address at 0xc0000000 in PLB space */
-               out32r(PCIX0_PMM1MA, 0x00000000); /* PMM1 Mask/Attribute - disabled b4 setting */
-               out32r(PCIX0_PMM1LA, 0xc0000000); /* PMM1 Local Address */
-               out32r(PCIX0_PMM1PCILA, pciaddr); /* PMM1 PCI Low Address */
-               out32r(PCIX0_PMM1PCIHA, 0x00000000); /* PMM1 PCI High Address */
-               out32r(PCIX0_PMM1MA, 0xf0000001); /* 256MB + No prefetching, and enable region */
+
+               /* PMM1 Mask/Attribute - disabled b4 setting */
+               out32r(PCIX0_PMM1MA, 0x00000000);
+               /* PMM1 Local Address */
+               out32r(PCIX0_PMM1LA, 0xc0000000);
+               /* PMM1 PCI Low Address */
+               out32r(PCIX0_PMM1PCILA, pciaddr);
+               /* PMM1 PCI High Address */
+               out32r(PCIX0_PMM1PCIHA, 0x00000000);
+               /* 256MB + No prefetching, and enable region */
+               out32r(PCIX0_PMM1MA, 0xf0000001);
        } else {
                printf("Usage:\npmm %s\n", cmdtp->help);
        }
index edf3a140b548554ca562d85ae3e4c4207545a842..5b811bba9adcea4f8f51776bf3f695844e2452d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007
+ * (C) Copyright 2007-2008
  * Matthias Fuchs, esd gmbh, matthias.fuchs@esd-electronics.com.
  * Based on board/amcc/sequoia/sequoia.c
  *
@@ -32,6 +32,7 @@
 #include <ppc440.h>
 #include <asm/processor.h>
 #include <asm/io.h>
+#include <asm/bitops.h>
 #include <command.h>
 #include <i2c.h>
 #ifdef CONFIG_RESET_PHY_R
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips   */
+extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
 
 ulong flash_get_size(ulong base, int banknum);
 int pci_is_66mhz(void);
-int bootstrap_eeprom_read(unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
-
+int bootstrap_eeprom_read(unsigned dev_addr, unsigned offset,
+                         uchar *buffer, unsigned cnt);
 
 struct serial_device *default_serial_console(void)
 {
@@ -70,7 +71,8 @@ struct serial_device *default_serial_console(void)
                /* mark scratchreg valid */
                scratchreg = (scratchreg & 0xffffff00) | 0x80;
 
-               i = bootstrap_eeprom_read(CFG_I2C_BOOT_EEPROM_ADDR, 0x10, buf, 4);
+               i = bootstrap_eeprom_read(CFG_I2C_BOOT_EEPROM_ADDR,
+                                         0x10, buf, 4);
                if ((i != -1) && (buf[0] == 0x19) && (buf[1] == 0x75)) {
                        scratchreg |= buf[2];
 
@@ -99,10 +101,10 @@ int board_early_init_f(void)
        mtdcr(ebccfga, xbcfg);
        mtdcr(ebccfgd, 0xf8400000);
 
-       /*--------------------------------------------------------------------
+       /*
         * Setup the GPIO pins
         * TODO: setup GPIOs via CFG_4xx_GPIO_TABLE in board's config file
-        *-------------------------------------------------------------------*/
+        */
        out32(GPIO0_OR,    0x40000002);
        out32(GPIO0_TCR,   0x4c90011f);
        out32(GPIO0_OSRL,  0x28011400);
@@ -141,9 +143,9 @@ int board_early_init_f(void)
                mtspr(dbcr0, 0x20000000); /* do chip reset */
        }
 
-       /*--------------------------------------------------------------------
+       /*
         * Setup the interrupt controller polarities, triggers, etc.
-        *-------------------------------------------------------------------*/
+        */
        mtdcr(uic0sr, 0xffffffff);      /* clear all */
        mtdcr(uic0er, 0x00000000);      /* disable all */
        mtdcr(uic0cr, 0x00000005);      /* ATI & UIC1 crit are critical */
@@ -170,9 +172,11 @@ int board_early_init_f(void)
 
        /* select Ethernet pins */
        mfsdr(SDR0_PFC1, sdr0_pfc1);
-       sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) | SDR0_PFC1_SELECT_CONFIG_4;
+       sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
+               SDR0_PFC1_SELECT_CONFIG_4;
        mfsdr(SDR0_PFC2, sdr0_pfc2);
-       sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) | SDR0_PFC2_SELECT_CONFIG_4;
+       sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
+               SDR0_PFC2_SELECT_CONFIG_4;
 
        /* enable 2nd IIC */
        sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_IIC1_SEL;
@@ -192,9 +196,9 @@ int board_early_init_f(void)
        return 0;
 }
 
-/*---------------------------------------------------------------------------+
 | misc_init_r.
 +---------------------------------------------------------------------------*/
+/*
* misc_init_r.
+ */
 int misc_init_r(void)
 {
        uint pbcr;
@@ -221,32 +225,7 @@ int misc_init_r(void)
        mtdcr(ebccfga, pb0cr);
 #endif
        pbcr = mfdcr(ebccfgd);
-       switch (gd->bd->bi_flashsize) {
-       case 1 << 20:
-               size_val = 0;
-               break;
-       case 2 << 20:
-               size_val = 1;
-               break;
-       case 4 << 20:
-               size_val = 2;
-               break;
-       case 8 << 20:
-               size_val = 3;
-               break;
-       case 16 << 20:
-               size_val = 4;
-               break;
-       case 32 << 20:
-               size_val = 5;
-               break;
-       case 64 << 20:
-               size_val = 6;
-               break;
-       case 128 << 20:
-               size_val = 7;
-               break;
-       }
+       size_val = ffs(gd->bd->bi_flashsize) - 21;
        pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
 #if defined(CONFIG_NAND_U_BOOT) || defined(CONFIG_NAND_SPL)
        mtdcr(ebccfga, pb2cr);
@@ -286,20 +265,22 @@ int misc_init_r(void)
                mfsdr(SDR0_USB2H0CR, usb2h0cr);
 
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;       /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ;    /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_16BIT_30MHZ;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;         /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;          /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;          /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
 
-               /* An 8-bit/60MHz interface is the only possible alternative
-                  when connecting the Device to the PHY */
+               /*
+                * An 8-bit/60MHz interface is the only possible alternative
+                * when connecting the Device to the PHY
+                */
                usb2h0cr   = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
-               usb2h0cr   = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ;        /*1*/
+               usb2h0cr   = usb2h0cr | SDR0_USB2H0CR_WDINT_16BIT_30MHZ;
 
                usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
                sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
@@ -309,7 +290,7 @@ int misc_init_r(void)
                mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
                mtsdr(SDR0_USB2H0CR, usb2h0cr);
 
-               /*clear resets*/
+               /* clear resets */
                udelay(1000);
                mtsdr(SDR0_SRST1, 0x00000000);
                udelay(1000);
@@ -317,18 +298,18 @@ int misc_init_r(void)
 
                printf("USB:   Host\n");
 
-       } else if ((strcmp(act, "dev") == 0) || (in_be32((void*)GPIO0_IR) & GPIO0_USB_PRSNT)) {
-               /*-------------------PATCH-------------------------------*/
+       } else if ((strcmp(act, "dev") == 0) ||
+                  (in_be32((void*)GPIO0_IR) & GPIO0_USB_PRSNT)) {
                mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
 
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;       /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;         /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PURDIS;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;          /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_HOST;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;          /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_HOST;
                mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
 
                udelay (1000);
@@ -344,7 +325,6 @@ int misc_init_r(void)
 
                udelay (1000);
                mtsdr(SDR0_SRST1, 0x60306000);
-               /*-------------------PATCH-------------------------------*/
 
                /* SDR Setting */
                mfsdr(SDR0_USB2PHY0CR, usb2phy0cr);
@@ -353,23 +333,23 @@ int misc_init_r(void)
                mfsdr(SDR0_PFC1, sdr0_pfc1);
 
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_XOCLK_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;       /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_XOCLK_EXTERNAL;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_WDINT_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_8BIT_60MHZ;     /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_WDINT_8BIT_60MHZ;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DVBUS_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN;          /*1*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DVBUS_PUREN;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_DWNSTR_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_DEV;           /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_DWNSTR_DEV;
                usb2phy0cr = usb2phy0cr &~SDR0_USB2PHY0CR_UTMICN_MASK;
-               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_DEV;           /*0*/
+               usb2phy0cr = usb2phy0cr | SDR0_USB2PHY0CR_UTMICN_DEV;
 
                usb2h0cr   = usb2h0cr &~SDR0_USB2H0CR_WDINT_MASK;
-               usb2h0cr   = usb2h0cr | SDR0_USB2H0CR_WDINT_8BIT_60MHZ;         /*0*/
+               usb2h0cr   = usb2h0cr | SDR0_USB2H0CR_WDINT_8BIT_60MHZ;
 
                usb2d0cr = usb2d0cr &~SDR0_USB2D0CR_USB2DEV_EBC_SEL_MASK;
 
                sdr0_pfc1 = sdr0_pfc1 &~SDR0_PFC1_UES_MASK;
-               sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_EBCHR_SEL;                /*1*/
+               sdr0_pfc1 = sdr0_pfc1 | SDR0_PFC1_UES_EBCHR_SEL;
 
                mtsdr(SDR0_USB2H0CR, usb2h0cr);
                mtsdr(SDR0_USB2PHY0CR, usb2phy0cr);
@@ -453,43 +433,42 @@ void pmc440_pci_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 }
 #endif
 
-/*************************************************************************
- *  pci_pre_init
- *
- *  This routine is called just prior to registering the hose and gives
- *  the board the opportunity to check things. Returning a value of zero
- *  indicates that things are bad & PCI initialization should be aborted.
+/*
+ * pci_pre_init
  *
- *     Different boards may wish to customize the pci controller structure
- *     (add regions, override default access routines, etc) or perform
- *     certain pre-initialization actions.
+ * This routine is called just prior to registering the hose and gives
+ * the board the opportunity to check things. Returning a value of zero
+ * indicates that things are bad & PCI initialization should be aborted.
  *
- ************************************************************************/
+ * Different boards may wish to customize the pci controller structure
+ * (add regions, override default access routines, etc) or perform
+ * certain pre-initialization actions.
+ */
 #if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller *hose)
 {
        unsigned long addr;
 
-       /*-------------------------------------------------------------------------+
-         | Set priority for all PLB3 devices to 0.
-         | Set PLB3 arbiter to fair mode.
-         +-------------------------------------------------------------------------*/
+       /*
+        * Set priority for all PLB3 devices to 0.
+        * Set PLB3 arbiter to fair mode.
+        */
        mfsdr(sdr_amp1, addr);
        mtsdr(sdr_amp1, (addr & 0x000000FF) | 0x0000FF00);
        addr = mfdcr(plb3_acr);
        mtdcr(plb3_acr, addr | 0x80000000);
 
-       /*-------------------------------------------------------------------------+
-         | Set priority for all PLB4 devices to 0.
-         +-------------------------------------------------------------------------*/
+       /*
+        * Set priority for all PLB4 devices to 0.
+        */
        mfsdr(sdr_amp0, addr);
        mtsdr(sdr_amp0, (addr & 0x000000FF) | 0x0000FF00);
        addr = mfdcr(plb4_acr) | 0xa0000000;    /* Was 0x8---- */
        mtdcr(plb4_acr, addr);
 
-       /*-------------------------------------------------------------------------+
-         | Set Nebula PLB4 arbiter to fair mode.
-         +-------------------------------------------------------------------------*/
+       /*
+        * Set Nebula PLB4 arbiter to fair mode.
+        */
        /* Segment0 */
        addr = (mfdcr(plb0_acr) & ~plb0_acr_ppm_mask) | plb0_acr_ppm_fair;
        addr = (addr & ~plb0_acr_hbu_mask) | plb0_acr_hbu_enabled;
@@ -512,64 +491,84 @@ int pci_pre_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) */
 
-/*************************************************************************
- *  pci_target_init
- *
- *     The bootstrap configuration provides default settings for the pci
- *     inbound map (PIM). But the bootstrap config choices are limited and
- *     may not be sufficient for a given board.
+/*
+ * pci_target_init
  *
- ************************************************************************/
+ * The bootstrap configuration provides default settings for the pci
+ * inbound map (PIM). But the bootstrap config choices are limited and
+ * may not be sufficient for a given board.
+ */
 #if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
 void pci_target_init(struct pci_controller *hose)
 {
-       /*--------------------------------------------------------------------------+
+       char *ptmla_str, *ptmms_str;
+
+       /*
         * Set up Direct MMIO registers
-        *--------------------------------------------------------------------------*/
-       /*--------------------------------------------------------------------------+
-         | PowerPC440EPX PCI Master configuration.
-         | Map one 1Gig range of PLB/processor addresses to PCI memory space.
-         |   PLB address 0x80000000-0xBFFFFFFF ==> PCI address 0x80000000-0xBFFFFFFF
-         |   Use byte reversed out routines to handle endianess.
-         | Make this region non-prefetchable.
-         +--------------------------------------------------------------------------*/
-       out32r(PCIX0_PMM0MA, 0x00000000);       /* PMM0 Mask/Attribute - disabled b4 setting */
+        */
+       /*
+        * PowerPC440EPX PCI Master configuration.
+        * Map one 1Gig range of PLB/processor addresses to PCI memory space.
+        * PLB address 0x80000000-0xBFFFFFFF
+        *     ==> PCI address 0x80000000-0xBFFFFFFF
+        * Use byte reversed out routines to handle endianess.
+        * Make this region non-prefetchable.
+        */
+       out32r(PCIX0_PMM0MA, 0x00000000);       /* PMM0 Mask/Attribute */
+                                               /* - disabled b4 setting */
        out32r(PCIX0_PMM0LA, CFG_PCI_MEMBASE);  /* PMM0 Local Address */
-       out32r(PCIX0_PMM0PCILA, CFG_PCI_MEMBASE);       /* PMM0 PCI Low Address */
+       out32r(PCIX0_PMM0PCILA, CFG_PCI_MEMBASE); /* PMM0 PCI Low Address */
        out32r(PCIX0_PMM0PCIHA, 0x00000000);    /* PMM0 PCI High Address */
-       out32r(PCIX0_PMM0MA, 0xc0000001);       /* 1G + No prefetching, and enable region */
+       out32r(PCIX0_PMM0MA, 0xc0000001);       /* 1G + No prefetching, */
+                                               /* and enable region */
 
        if (!is_monarch()) {
-               /* BAR1: top 64MB of RAM */
-               out32r(PCIX0_PTM1MS, 0xfc000001);       /* Memory Size/Attribute */
-               out32r(PCIX0_PTM1LA, 0x0c000000);       /* Local Addr. Reg */
+               ptmla_str = getenv("ptm1la");
+               ptmms_str = getenv("ptm1ms");
+               if(NULL != ptmla_str && NULL != ptmms_str ) {
+                       out32r(PCIX0_PTM1MS,
+                              simple_strtoul(ptmms_str, NULL, 16));
+                       out32r(PCIX0_PTM1LA,
+                              simple_strtoul(ptmla_str, NULL, 16));
+               } else {
+                       /* BAR1: default top 64MB of RAM */
+                       out32r(PCIX0_PTM1MS, 0xfc000001);
+                       out32r(PCIX0_PTM1LA, 0x0c000000);
+               }
        } else {
-               /* BAR1: complete 256MB RAM (TODO: make dynamic) */
-               out32r(PCIX0_PTM1MS, 0xf0000001);       /* Memory Size/Attribute */
-               out32r(PCIX0_PTM1LA, 0x00000000);       /* Local Addr. Reg */
+               /* BAR1: default: complete 256MB RAM */
+               out32r(PCIX0_PTM1MS, 0xf0000001);
+               out32r(PCIX0_PTM1LA, 0x00000000);
        }
 
-       /* BAR2: 16 MB FPGA registers */
-       out32r(PCIX0_PTM2MS, 0xff000001);       /* Memory Size/Attribute */
-       out32r(PCIX0_PTM2LA, 0xef000000);       /* Local Addr. Reg */
+       ptmla_str = getenv("ptm2la");           /* Local Addr. Reg */
+       ptmms_str = getenv("ptm2ms");           /* Memory Size/Attribute */
+       if(NULL != ptmla_str && NULL != ptmms_str ) {
+               out32r(PCIX0_PTM2MS, simple_strtoul(ptmms_str, NULL, 16));
+               out32r(PCIX0_PTM2LA, simple_strtoul(ptmla_str, NULL, 16));
+       } else {
+               /* BAR2: default: 16 MB FPGA + registers */
+               out32r(PCIX0_PTM2MS, 0xff000001); /* Memory Size/Attribute */
+               out32r(PCIX0_PTM2LA, 0xef000000); /* Local Addr. Reg */
+       }
 
        if (is_monarch()) {
                /* BAR2: map FPGA registers behind system memory at 1GB */
                pci_write_config_dword(0, PCI_BASE_ADDRESS_2, 0x40000008);
        }
 
-       /*--------------------------------------------------------------------------+
+       /*
         * Set up Configuration registers
-        *--------------------------------------------------------------------------*/
+        */
 
        /* Program the board's vendor id */
        pci_write_config_word(0, PCI_SUBSYSTEM_VENDOR_ID,
                              CFG_PCI_SUBSYS_VENDORID);
 
-#if 0   /* disabled for PMC405 backward compatibility */
+       /* disabled for PMC405 backward compatibility */
        /* Configure command register as bus master */
-       pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER);
-#endif
+       /* pci_write_config_word(0, PCI_COMMAND, PCI_COMMAND_MASTER); */
+
 
        /* 240nS PCI clock */
        pci_write_config_word(0, PCI_LATENCY_TIMER, 1);
@@ -587,8 +586,10 @@ void pci_target_init(struct pci_controller *hose)
                                      CFG_PCI_CLASSCODE_NONMONARCH);
 
                /* PCI configuration done: release ERREADY */
-               out_be32((void*)GPIO1_OR,  in_be32((void*)GPIO1_OR)  | GPIO1_PPC_EREADY);
-               out_be32((void*)GPIO1_TCR, in_be32((void*)GPIO1_TCR) | GPIO1_PPC_EREADY);
+               out_be32((void*)GPIO1_OR,
+                        in_be32((void*)GPIO1_OR) | GPIO1_PPC_EREADY);
+               out_be32((void*)GPIO1_TCR,
+                        in_be32((void*)GPIO1_TCR) | GPIO1_PPC_EREADY);
        } else {
                /* Program the board's subsystem id/classcode */
                pci_write_config_word(0, PCI_SUBSYSTEM_ID,
@@ -599,20 +600,19 @@ void pci_target_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
 
-/*************************************************************************
- *  pci_master_init
- *
- ************************************************************************/
+/*
+ * pci_master_init
+ */
 #if defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT)
 void pci_master_init(struct pci_controller *hose)
 {
        unsigned short temp_short;
 
-       /*--------------------------------------------------------------------------+
-         | Write the PowerPC440 EP PCI Configuration regs.
-         |   Enable PowerPC440 EP to be a master on the PCI bus (PMM).
-         |   Enable PowerPC440 EP to act as a PCI memory target (PTM).
-         +--------------------------------------------------------------------------*/
+       /*
+        * Write the PowerPC440 EP PCI Configuration regs.
+        * Enable PowerPC440 EP to be a master on the PCI bus (PMM).
+        * Enable PowerPC440 EP to act as a PCI memory target (PTM).
+        */
        if (is_monarch()) {
                pci_read_config_word(0, PCI_COMMAND, &temp_short);
                pci_write_config_word(0, PCI_COMMAND,
@@ -622,7 +622,6 @@ void pci_master_init(struct pci_controller *hose)
 }
 #endif /* defined(CONFIG_PCI) && defined(CFG_PCI_MASTER_INIT) */
 
-
 static void wait_for_pci_ready(void)
 {
        int i;
@@ -649,22 +648,19 @@ static void wait_for_pci_ready(void)
        }
 }
 
-
-/*************************************************************************
- *  is_pci_host
- *
- *     This routine is called to determine if a pci scan should be
- *     performed. With various hardware environments (especially cPCI and
- *     PPMC) it's insufficient to depend on the state of the arbiter enable
- *     bit in the strap register, or generic host/adapter assumptions.
- *
- *     Rather than hard-code a bad assumption in the general 440 code, the
- *     440 pci code requires the board to decide at runtime.
+/*
+ * is_pci_host
  *
- *     Return 0 for adapter mode, non-zero for host (monarch) mode.
+ * This routine is called to determine if a pci scan should be
+ * performed. With various hardware environments (especially cPCI and
+ * PPMC) it's insufficient to depend on the state of the arbiter enable
+ * bit in the strap register, or generic host/adapter assumptions.
  *
+ * Rather than hard-code a bad assumption in the general 440 code, the
+ * 440 pci code requires the board to decide at runtime.
  *
- ************************************************************************/
+ * Return 0 for adapter mode, non-zero for host (monarch) mode.
+ */
 #if defined(CONFIG_PCI)
 int is_pci_host(struct pci_controller *hose)
 {
@@ -681,6 +677,7 @@ int is_pci_host(struct pci_controller *hose)
        return 0;
 }
 #endif /* defined(CONFIG_PCI) */
+
 #if defined(CONFIG_POST)
 /*
  * Returns 1 if keys pressed to start the power-on long-running tests
@@ -692,7 +689,6 @@ int post_hotkeys_pressed(void)
 }
 #endif /* CONFIG_POST */
 
-
 #ifdef CONFIG_RESET_PHY_R
 void reset_phy(void)
 {
@@ -713,17 +709,19 @@ void reset_phy(void)
 #endif
 
 #if defined(CFG_EEPROM_WREN)
-/* Input: <dev_addr>  I2C address of EEPROM device to enable.
- *         <state>     -1: deliver current state
+/*
+ *  Input: <dev_addr> I2C address of EEPROM device to enable.
+ *         <state>    -1: deliver current state
  *                    0: disable write
  *                    1: enable write
- *  Returns:           -1: wrong device address
- *                      0: dis-/en- able done
+ *  Returns:          -1: wrong device address
+ *                     0: dis-/en- able done
  *                  0/1: current state if <state> was -1.
  */
 int eeprom_write_enable(unsigned dev_addr, int state)
 {
-       if ((CFG_I2C_EEPROM_ADDR != dev_addr) && (CFG_I2C_BOOT_EEPROM_ADDR != dev_addr)) {
+       if ((CFG_I2C_EEPROM_ADDR != dev_addr) &&
+           (CFG_I2C_BOOT_EEPROM_ADDR != dev_addr)) {
                return -1;
        } else {
                switch (state) {
@@ -747,9 +745,9 @@ int eeprom_write_enable(unsigned dev_addr, int state)
 }
 #endif /* #if defined(CFG_EEPROM_WREN) */
 
-
 #define CFG_BOOT_EEPROM_PAGE_WRITE_BITS 3
-int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
+int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset,
+                          uchar *buffer, unsigned cnt)
 {
        unsigned end = offset + cnt;
        unsigned blk_off;
@@ -758,7 +756,8 @@ int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset, uchar *buffer, un
 #if defined(CFG_EEPROM_WREN)
        eeprom_write_enable(dev_addr, 1);
 #endif
-       /* Write data until done or would cross a write page boundary.
+       /*
+        * Write data until done or would cross a write page boundary.
         * We must write the address again when changing pages
         * because the address counter only increments within a page.
         */
@@ -780,7 +779,8 @@ int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset, uchar *buffer, un
 #define        BOOT_EEPROM_PAGE_SIZE      (1 << CFG_BOOT_EEPROM_PAGE_WRITE_BITS)
 #define        BOOT_EEPROM_PAGE_OFFSET(x) ((x) & (BOOT_EEPROM_PAGE_SIZE - 1))
 
-               maxlen = BOOT_EEPROM_PAGE_SIZE - BOOT_EEPROM_PAGE_OFFSET(blk_off);
+               maxlen = BOOT_EEPROM_PAGE_SIZE -
+                       BOOT_EEPROM_PAGE_OFFSET(blk_off);
                if (maxlen > I2C_RXTX_LEN)
                        maxlen = I2C_RXTX_LEN;
 
@@ -803,14 +803,15 @@ int bootstrap_eeprom_write(unsigned dev_addr, unsigned offset, uchar *buffer, un
        return rcode;
 }
 
-
-int bootstrap_eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt)
+int bootstrap_eeprom_read (unsigned dev_addr, unsigned offset,
+                          uchar *buffer, unsigned cnt)
 {
        unsigned end = offset + cnt;
        unsigned blk_off;
        int rcode = 0;
 
-       /* Read data until done or would cross a page boundary.
+       /*
+        * Read data until done or would cross a page boundary.
         * We must write the address again when changing pages
         * because the next page may be in a different device.
         */
@@ -844,7 +845,6 @@ int bootstrap_eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, un
        return rcode;
 }
 
-
 #if defined(CONFIG_USB_OHCI_NEW) && defined(CFG_USB_OHCI_BOARD_INIT)
 int usb_board_init(void)
 {
@@ -854,7 +854,8 @@ int usb_board_init(void)
        if ((act == NULL || strcmp(act, "hostdev") == 0) &&
            !(in_be32((void*)GPIO0_IR) & GPIO0_USB_PRSNT))
                /* enable power on USB socket */
-               out_be32((void*)GPIO1_OR, in_be32((void*)GPIO1_OR) & ~GPIO1_USB_PWR_N);
+               out_be32((void*)GPIO1_OR,
+                        in_be32((void*)GPIO1_OR) & ~GPIO1_USB_PWR_N);
 
        for (i=0; i<1000; i++)
                udelay(1000);
index 88d5e8fb40efb5430e5971915dfe230fca4e7488..afc0eee3b70783fc0222d4375e006c48c32ca4a3 100644 (file)
@@ -185,3 +185,37 @@ void ft_board_setup(void *blob, bd_t *bd)
 #endif
 }
 #endif
+
+#if defined(CFG_I2C_MAC_OFFSET)
+int mac_read_from_eeprom(void)
+{
+       uchar buf[28];
+       char str[18];
+       int i = 0;
+       unsigned int crc = 0;
+       unsigned char enetvar[32];
+
+       /* Read MAC addresses from EEPROM */
+       if (eeprom_read(CFG_I2C_EEPROM_ADDR, CFG_I2C_MAC_OFFSET, buf, 28)) {
+               printf("\nEEPROM @ 0x%02x read FAILED!!!\n",
+                      CFG_I2C_EEPROM_ADDR);
+       } else {
+               if (crc32(crc, buf, 24) == *(unsigned int *)&buf[24]) {
+                       printf("Reading MAC from EEPROM\n");
+                       for (i = 0; i < 4; i++) {
+                               if (memcmp(&buf[i * 6], "\0\0\0\0\0\0", 6)) {
+                                       sprintf(str,
+                                               "%02X:%02X:%02X:%02X:%02X:%02X",
+                                               buf[i * 6], buf[i * 6 + 1],
+                                               buf[i * 6 + 2], buf[i * 6 + 3],
+                                               buf[i * 6 + 4], buf[i * 6 + 5]);
+                                       sprintf((char *)enetvar,
+                                               i ? "eth%daddr" : "ethaddr", i);
+                                       setenv((char *)enetvar, str);
+                               }
+                       }
+               }
+       }
+       return 0;
+}
+#endif                         /* CONFIG_I2C_MAC_OFFSET */
index d90cdb3d3c270d0a4e617dd4c747abac0fbe127f..2119320da7f423d6395e4eef87dafa409790f7bc 100644 (file)
@@ -98,11 +98,8 @@ int board_early_init_f(void)
        /* Enable flash write */
        bcsr[0xa] &= ~0x04;
 
-       /* Disable G1TXCLK, G2TXCLK h/w buffers (rev.2 h/w bug workaround) */
-       if (immr->sysconf.spridr == SPR_8360_REV20 ||
-           immr->sysconf.spridr == SPR_8360E_REV20 ||
-           immr->sysconf.spridr == SPR_8360_REV21 ||
-           immr->sysconf.spridr == SPR_8360E_REV21)
+       /* Disable G1TXCLK, G2TXCLK h/w buffers (rev.2.x h/w bug workaround) */
+       if (REVID_MAJOR(immr->sysconf.spridr) == 2)
                bcsr[0xe] = 0x30;
 
        /* Enable second UART */
@@ -308,8 +305,8 @@ void ft_board_setup(void *blob, bd_t *bd)
         * if on mpc8360ea rev. 2.1,
         * change both ucc phy-connection-types from rgmii-id to rgmii-rxid
         */
-       if (immr->sysconf.spridr == SPR_8360_REV21 ||
-           immr->sysconf.spridr == SPR_8360E_REV21) {
+       if ((REVID_MAJOR(immr->sysconf.spridr) == 2) &&
+           (REVID_MINOR(immr->sysconf.spridr) == 1)) {
                int nodeoffset;
                const char *prop;
                int path;
index e57a53fde33ad4020e7bb44ab69bdde2c4f3de14..f7cd5fe1764c77b228eba9aa94bd890b9982ead9 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <asm/io.h>
+#include <asm/fsl_serdes.h>
 #include <spd_sdram.h>
 #if defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
@@ -29,6 +31,34 @@ int board_early_init_f(void)
        /* Clear all of the interrupt of BCSR */
        bcsr[0xe] = 0xff;
 
+#ifdef CONFIG_FSL_SERDES
+       immap_t *immr = (immap_t *)CFG_IMMR;
+       u32 spridr = in_be32(&immr->sysconf.spridr);
+
+       /* we check only part num, and don't look for CPU revisions */
+       switch (spridr) {
+       case SPR_8377:
+               fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
+                                FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
+                                FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+               break;
+       case SPR_8378:
+               fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
+                                FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+               break;
+       case SPR_8379:
+               fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
+                                FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
+                                FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
+               break;
+       default:
+               printf("serdes not configured: unknown CPU part number: "
+                      "%04x\n", spridr >> 16);
+               break;
+       }
+#endif /* CONFIG_FSL_SERDES */
        return 0;
 }
 
index 83fb60da004476e6a911ff87bed4899d456081ef..e054f4e44d143034acb58704cce9b6d472892098 100644 (file)
@@ -140,24 +140,21 @@ int board_early_init_f(void)
        u32 spridr = in_be32(&immr->sysconf.spridr);
 
        /* we check only part num, and don't look for CPU revisions */
-       switch (spridr >> 16) {
-       case SPR_8379E_REV10 >> 16:
-       case SPR_8379_REV10 >> 16:
+       switch (PARTID_NO_E(spridr)) {
+       case SPR_8377:
                fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
                                 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
-               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
+               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
                                 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
                break;
-       case SPR_8378E_REV10 >> 16:
-       case SPR_8378_REV10 >> 16:
+       case SPR_8378:
                fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
                                 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
                break;
-       case SPR_8377E_REV10 >> 16:
-       case SPR_8377_REV10 >> 16:
+       case SPR_8379:
                fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_SATA,
                                 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
-               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_PEX,
+               fsl_setup_serdes(CONFIG_FSL_SERDES2, FSL_SERDES_PROTO_SATA,
                                 FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
                break;
        default:
index 39966e03eb4460b45e16e87669b11c2d4317cc30..fa8374f17f77c0e3f35ed95ee2863b4c34492f51 100644 (file)
 # Korat (PPC440EPx) board
 #
 
-TEXT_BASE = 0xFFFA0000
-
 PLATFORM_CPPFLAGS += -DCONFIG_440=1
 
 ifeq ($(debug),1)
 PLATFORM_CPPFLAGS += -DDEBUG
 endif
 
+ifeq ($(emul),1)
+PLATFORM_CPPFLAGS += -fno-schedule-insns -fno-schedule-insns2
+endif
+
 ifeq ($(dbcr),1)
-PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
+PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8CFF0000
+endif
+
+ifeq ($(perm),1)
+PLATFORM_CPPFLAGS += -DCONFIG_KORAT_PERMANENT
+TEXT_BASE = 0xFFFA0000
+else
+TEXT_BASE = 0xF7F60000
+LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-F7FC.lds
 endif
index bd0e8b4daaf958f35f9fa8c7222e1be5fac658ed..bf8b2c808b69833edd887c693c49ae0f20328e3e 100644 (file)
@@ -43,7 +43,7 @@ tlbtab:
         * BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
         * speed up boot process. It is patched after relocation to enable SA_I
         */
-       tlbentry( CFG_BOOT_BASE_ADDR, SZ_256M, CFG_BOOT_BASE_ADDR, 1, AC_R|AC_W|AC_X|SA_G )
+       tlbentry( 0xF0000000, SZ_256M, 0xF0000000, 1, AC_R|AC_W|AC_X|SA_G )
 
        /*
         * TLB entries for SDRAM are not needed on this platform.  They are
@@ -52,24 +52,32 @@ tlbtab:
 
 #ifdef CFG_INIT_RAM_DCACHE
        /* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
-       tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
+       tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0,
+                 AC_R|AC_W|AC_X|SA_G )
 #endif
 
        /* TLB-entry for PCI Memory */
-       tlbentry( CFG_PCI_MEMBASE, SZ_256M, CFG_PCI_MEMBASE, 1, AC_R|AC_W|SA_G|SA_I )
-       tlbentry( CFG_PCI_MEMBASE1, SZ_256M, CFG_PCI_MEMBASE1, 1, AC_R|AC_W|SA_G|SA_I )
-       tlbentry( CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 1, AC_R|AC_W|SA_G|SA_I )
-       tlbentry( CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 1, AC_R|AC_W|SA_G|SA_I )
+       tlbentry( CFG_PCI_MEMBASE + 0x00000000, SZ_256M,
+                 CFG_PCI_MEMBASE + 0x00000000, 1, AC_R|AC_W|SA_G|SA_I )
+
+       tlbentry( CFG_PCI_MEMBASE + 0x10000000, SZ_256M,
+                 CFG_PCI_MEMBASE + 0x10000000, 1, AC_R|AC_W|SA_G|SA_I )
+
+       tlbentry( CFG_PCI_MEMBASE + 0x20000000, SZ_256M,
+                 CFG_PCI_MEMBASE + 0x20000000, 1, AC_R|AC_W|SA_G|SA_I )
+
+       tlbentry( CFG_PCI_MEMBASE + 0x30000000, SZ_256M,
+                 CFG_PCI_MEMBASE + 0x30000000, 1, AC_R|AC_W|SA_G|SA_I )
 
        /* TLB-entry for EBC */
        tlbentry( CFG_CPLD_BASE, SZ_1K, CFG_CPLD_BASE, 1, AC_R|AC_W|SA_G|SA_I )
 
        /* TLB-entry for Internal Registers & OCM */
        /* I wonder why this must be executable -- lrj@acm.org 2007-10-08 */
-       tlbentry( 0xE0000000, SZ_16M, 0xE0000000, 0,  AC_R|AC_W|AC_X|SA_I )
+       tlbentry( 0xE0000000, SZ_16M, 0xE0000000, 0, AC_R|AC_W|AC_X|SA_I )
 
        /*TLB-entry PCI registers*/
-       tlbentry( 0xEEC00000, SZ_1K, 0xEEC00000, 1,  AC_R|AC_W|SA_G|SA_I )
+       tlbentry( 0xEEC00000, SZ_1K, 0xEEC00000, 1, AC_R|AC_W|SA_G|SA_I )
 
        /* TLB-entry for peripherals */
        tlbentry( 0xEF000000, SZ_16M, 0xEF000000, 1, AC_R|AC_W|SA_G|SA_I)
@@ -78,3 +86,10 @@ tlbtab:
        tlbentry(0xE8000000, SZ_64K, 0xE8000000, 1, AC_R|AC_W|SA_G|SA_I)
 
        tlbtab_end
+
+#if defined(CONFIG_KORAT_PERMANENT)
+       .globl  korat_branch_absolute
+korat_branch_absolute:
+       mtlr    r3
+       blr
+#endif
index 90fd0a753212d1b30dffa23ea839e322a38dc29c..a7b4b27c6d3bab70f7ebe3343c8e164708f193b6 100644 (file)
@@ -2,12 +2,12 @@
  * (C) Copyright 2007-2008
  * Larry Johnson, lrj@acm.org
  *
- * (C) Copyright 2006-2008
+ * (C) Copyright 2006-2007
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * (C) Copyright 2006
  * Jacqueline Pira-Ferriol, AMCC/IBM, jpira-ferriol@fr.ibm.com
- * Alain Saurel,            AMCC/IBM, alain.saurel@fr.ibm.com
+ * Alain Saurel,           AMCC/IBM, alain.saurel@fr.ibm.com
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -39,12 +39,45 @@ extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
 
 ulong flash_get_size(ulong base, int banknum);
 
+#if defined(CONFIG_KORAT_PERMANENT)
+void korat_buzzer(int const on)
+{
+       if (on) {
+               out_8((u8 *) CFG_CPLD_BASE + 0x05,
+                     in_8((u8 *) CFG_CPLD_BASE + 0x05) | 0x80);
+       } else {
+               out_8((u8 *) CFG_CPLD_BASE + 0x05,
+                     in_8((u8 *) CFG_CPLD_BASE + 0x05) & ~0x80);
+       }
+}
+#endif
+
 int board_early_init_f(void)
 {
-       u32 sdr0_pfc1, sdr0_pfc2;
-       u32 reg;
+       uint32_t sdr0_pfc1, sdr0_pfc2;
+       uint32_t reg;
        int eth;
 
+#if defined(CONFIG_KORAT_PERMANENT)
+       unsigned mscount;
+
+       extern void korat_branch_absolute(uint32_t addr);
+
+       for (mscount = 0;  mscount < CFG_KORAT_MAN_RESET_MS; ++mscount) {
+               udelay(1000);
+               if (gpio_read_in_bit(CFG_GPIO_RESET_PRESSED_)) {
+                       /* This call does not return. */
+                       korat_branch_absolute(
+                               CFG_FLASH1_TOP - 2 * CFG_ENV_SECT_SIZE - 4);
+               }
+       }
+       korat_buzzer(1);
+       while (!gpio_read_in_bit(CFG_GPIO_RESET_PRESSED_))
+               udelay(1000);
+
+       korat_buzzer(0);
+#endif
+
        mtdcr(ebccfga, xbcfg);
        mtdcr(ebccfgd, 0xb8400000);
 
@@ -75,8 +108,11 @@ int board_early_init_f(void)
        mtdcr(uic2vr, 0x00000000);      /* int31 highest, base=0x000 */
        mtdcr(uic2sr, 0xffffffff);      /* clear all */
 
-       /* take sim card reader and CF controller out of reset */
-       out_8((u8 *) CFG_CPLD_BASE + 0x04, 0x80);
+       /*
+        * Take sim card reader and CF controller out of reset.  Also enable PHY
+        * auto-detect until board-specific PHY resets are available.
+        */
+       out_8((u8 *) CFG_CPLD_BASE + 0x02, 0xC0);
 
        /* Configure the two Ethernet PHYs.  For each PHY, configure for fiber
         * if the SFP module is present, and for copper if it is not present.
@@ -85,8 +121,8 @@ int board_early_init_f(void)
                if (gpio_read_in_bit(CFG_GPIO_SFP0_PRESENT_ + eth)) {
                        /* SFP module not present: configure PHY for copper. */
                        /* Set PHY to autonegotate 10 MB, 100MB, or 1 GB */
-                       out_8((u8 *) CFG_CPLD_BASE + 0x06,
-                             in_8((u8 *) CFG_CPLD_BASE + 0x06) |
+                       out_8((u8 *) CFG_CPLD_BASE + 0x03,
+                             in_8((u8 *) CFG_CPLD_BASE + 0x03) |
                              0x06 << (4 * eth));
                } else {
                        /* SFP module present: configure PHY for fiber and
@@ -99,10 +135,18 @@ int board_early_init_f(void)
        gpio_write_bit(CFG_GPIO_PHY0_EN, 1);
        gpio_write_bit(CFG_GPIO_PHY1_EN, 1);
 
-       /* select Ethernet pins */
+       /* Wait 1 ms, then enable Fiber signal detect to PHYs. */
+       udelay(1000);
+       out_8((u8 *) CFG_CPLD_BASE + 0x03,
+             in_8((u8 *) CFG_CPLD_BASE + 0x03) | 0x88);
+
+       /* select Ethernet (and optionally IIC1) pins */
        mfsdr(SDR0_PFC1, sdr0_pfc1);
        sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SELECT_MASK) |
                SDR0_PFC1_SELECT_CONFIG_4;
+#ifdef CONFIG_I2C_MULTI_BUS
+       sdr0_pfc1 |= ((sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_IIC1_SEL);
+#endif
        mfsdr(SDR0_PFC2, sdr0_pfc2);
        sdr0_pfc2 = (sdr0_pfc2 & ~SDR0_PFC2_SELECT_MASK) |
                SDR0_PFC2_SELECT_CONFIG_4;
@@ -116,6 +160,58 @@ int board_early_init_f(void)
        return 0;
 }
 
+/*
+ * The boot flash on CS0 normally has its write-enable pin disabled, and so will
+ * not respond to CFI commands.  This routine therefore fills in the flash
+ * information for the boot flash.  (The flash at CS1 operates normally.)
+ */
+ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
+{
+       uint32_t addr;
+       int i;
+
+       if (1 != banknum)
+               return 0;
+
+       info->size              = CFG_FLASH0_SIZE;
+       info->sector_count      = CFG_FLASH0_SIZE / 0x20000;
+       info->flash_id          = 0x01000000;
+       info->portwidth         = 2;
+       info->chipwidth         = 2;
+       info->buffer_size       = 32;
+       info->erase_blk_tout    = 16384;
+       info->write_tout        = 2;
+       info->buffer_write_tout = 5;
+       info->vendor            = 2;
+       info->cmd_reset         = 0x00F0;
+       info->interface         = 2;
+       info->legacy_unlock     = 0;
+       info->manufacturer_id   = 1;
+       info->device_id         = 0x007E;
+
+#if CFG_FLASH0_SIZE == 0x01000000
+       info->device_id2        = 0x2101;
+#elif CFG_FLASH0_SIZE == 0x04000000
+       info->device_id2        = 0x2301;
+#else
+#error Unable to set device_id2 for current CFG_FLASH0_SIZE
+#endif
+
+       info->ext_addr          = 0x0040;
+       info->cfi_version       = 0x3133;
+       info->cfi_offset        = 0x0055;
+       info->addr_unlock1      = 0x00000555;
+       info->addr_unlock2      = 0x000002AA;
+       info->name              = "CFI conformant";
+       for (i = 0, addr = -info->size;
+            i < info->sector_count;
+            ++i, addr += 0x20000) {
+               info->start[i] = addr;
+               info->protect[i] = 0x00;
+       }
+       return 1;
+}
+
 static int man_data_read(unsigned int addr)
 {
        /*
@@ -189,12 +285,20 @@ static void set_serial_number(void)
         * If the environmental variable "serial#" is not set, try to set it
         * from the manufacturer's information serial EEPROM.
         */
-       char s[MAN_SERIAL_NO_LENGTH + 1];
+       char s[MAN_INFO_LENGTH + MAN_MAC_ADDR_LENGTH + 2];
+
+       if (getenv("serial#"))
+               return;
+
+       if (!man_data_read_field(s, MAN_INFO_FIELD, MAN_INFO_LENGTH))
+               return;
+
+       s[MAN_INFO_LENGTH] = '-';
+       if (!man_data_read_field(s + MAN_INFO_LENGTH + 1, MAN_MAC_ADDR_FIELD,
+                                MAN_MAC_ADDR_LENGTH))
+               return;
 
-       if (0 == getenv("serial#") &&
-           0 != man_data_read_field(s, MAN_SERIAL_NO_FIELD,
-                                    MAN_SERIAL_NO_LENGTH))
-               setenv("serial#", s);
+       setenv("serial#", s);
 }
 
 static void set_mac_addresses(void)
@@ -204,45 +308,58 @@ static void set_mac_addresses(void)
         * set, try to set them from the manufacturer's information serial
         * EEPROM.
         */
-       char s[MAN_MAC_ADDR_LENGTH + 1];
+
+#if MAN_MAC_ADDR_LENGTH % 2 != 0
+#error MAN_MAC_ADDR_LENGTH must be an even number
+#endif
+
+       char s[(3 * MAN_MAC_ADDR_LENGTH) / 2];
+       char *src;
+       char *dst;
 
        if (0 != getenv("ethaddr") && 0 != getenv("eth1addr"))
                return;
 
-       if (0 == man_data_read_field(s, MAN_MAC_ADDR_FIELD,
-                                    MAN_MAC_ADDR_LENGTH))
+       if (0 == man_data_read_field(s + (MAN_MAC_ADDR_LENGTH / 2) - 1,
+                                    MAN_MAC_ADDR_FIELD, MAN_MAC_ADDR_LENGTH))
                return;
 
+       for (src = s + (MAN_MAC_ADDR_LENGTH / 2) - 1, dst = s; src != dst;) {
+               *dst++ = *src++;
+               *dst++ = *src++;
+               *dst++ = ':';
+       }
        if (0 == getenv("ethaddr"))
                setenv("ethaddr", s);
 
        if (0 == getenv("eth1addr")) {
-               ++s[MAN_MAC_ADDR_LENGTH - 1];
+               ++s[((3 * MAN_MAC_ADDR_LENGTH) / 2) - 2];
                setenv("eth1addr", s);
        }
 }
 
 int misc_init_r(void)
 {
-       uint pbcr;
-       int size_val = 0;
-       u32 reg;
+       uint32_t pbcr;
+       int size_val;
+       uint32_t reg;
        unsigned long usb2d0cr = 0;
        unsigned long usb2phy0cr, usb2h0cr = 0;
        unsigned long sdr0_pfc1;
-       char *act = getenv("usbact");
-
-       /* Re-do flash sizing to get full correct info */
+       uint32_t const flash1_size = gd->bd->bi_flashsize - CFG_FLASH0_SIZE;
+       char const *const act = getenv("usbact");
 
-       /* adjust flash start and offset */
-       gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize;
+       /*
+        * Re-do FLASH1 sizing and adjust flash start and offset.
+        */
+       gd->bd->bi_flashstart = CFG_FLASH1_TOP - flash1_size;
        gd->bd->bi_flashoffset = 0;
 
-       mtdcr(ebccfga, pb0cr);
+       mtdcr(ebccfga, pb1cr);
        pbcr = mfdcr(ebccfgd);
-       size_val = ffs(gd->bd->bi_flashsize) - 21;
+       size_val = ffs(flash1_size) - 21;
        pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
-       mtdcr(ebccfga, pb0cr);
+       mtdcr(ebccfga, pb1cr);
        mtdcr(ebccfgd, pbcr);
 
        /*
@@ -250,14 +367,37 @@ int misc_init_r(void)
         */
        flash_get_size(gd->bd->bi_flashstart, 0);
 
-       /* Monitor protection ON by default */
-       (void)flash_protect(FLAG_PROTECT_SET, -CFG_MONITOR_LEN, 0xffffffff,
-                           &flash_info[0]);
+       /*
+        * Re-do FLASH1 sizing and adjust flash offset to reserve space for
+        * environment
+        */
+       gd->bd->bi_flashoffset =
+               CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - CFG_FLASH1_ADDR;
 
+       mtdcr(ebccfga, pb1cr);
+       pbcr = mfdcr(ebccfgd);
+       size_val = ffs(gd->bd->bi_flashsize - CFG_FLASH0_SIZE) - 21;
+       pbcr = (pbcr & 0x0001ffff) | gd->bd->bi_flashstart | (size_val << 17);
+       mtdcr(ebccfga, pb1cr);
+       mtdcr(ebccfgd, pbcr);
+
+       /* Monitor protection ON by default */
+#if defined(CONFIG_KORAT_PERMANENT)
+       (void)flash_protect(FLAG_PROTECT_SET, CFG_MONITOR_BASE,
+                           CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
+                           flash_info + 1);
+#else
+       (void)flash_protect(FLAG_PROTECT_SET, CFG_MONITOR_BASE,
+                           CFG_MONITOR_BASE + CFG_MONITOR_LEN - 1,
+                           flash_info);
+#endif
        /* Env protection ON by default */
+       (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR,
+                           CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
+                           flash_info);
        (void)flash_protect(FLAG_PROTECT_SET, CFG_ENV_ADDR_REDUND,
-                           CFG_ENV_ADDR_REDUND + 2 * CFG_ENV_SECT_SIZE - 1,
-                           &flash_info[0]);
+                           CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1,
+                           flash_info);
 
        /*
         * USB suff...
@@ -393,6 +533,8 @@ int misc_init_r(void)
 
        set_serial_number();
        set_mac_addresses();
+       gpio_write_bit(CFG_GPIO_ATMEGA_RESET_, 1);
+
        return 0;
 }
 
@@ -402,10 +544,10 @@ int checkboard(void)
        u8 const rev = in_8((u8 *) CFG_CPLD_BASE + 0);
 
        printf("Board: Korat, Rev. %X", rev);
-       if (s != NULL)
+       if (s)
                printf(", serial# %s", s);
 
-       printf(", Ethernet PHY 0: ");
+       printf(".\n       Ethernet PHY 0: ");
        if (gpio_read_out_bit(CFG_GPIO_PHY0_FIBER_SEL))
                printf("fiber");
        else
@@ -418,7 +560,10 @@ int checkboard(void)
                printf("copper");
 
        printf(".\n");
-       return (0);
+#if defined(CONFIG_KORAT_PERMANENT)
+       printf("       Executing permanent copy of U-Boot.\n");
+#endif
+       return 0;
 }
 
 #if defined(CFG_DRAM_TEST)
@@ -529,23 +674,26 @@ void pci_target_init(struct pci_controller *hose)
        /*
         * PowerPC440EPX PCI Master configuration.
         * Map one 1Gig range of PLB/processor addresses to PCI memory space.
-        * PLB address 0xA0000000-0xDFFFFFFF
-        *     ==> PCI address 0xA0000000-0xDFFFFFFF
+        * PLB address 0x80000000-0xBFFFFFFF
+        *     ==> PCI address 0x80000000-0xBFFFFFFF
         * Use byte reversed out routines to handle endianess.
         * Make this region non-prefetchable.
         */
        out32r(PCIX0_PMM0MA, 0x00000000);       /* PMM0 Mask/Attribute */
                                                /* - disabled b4 setting */
        out32r(PCIX0_PMM0LA, CFG_PCI_MEMBASE);  /* PMM0 Local Address */
-       out32r(PCIX0_PMM0PCILA, CFG_PCI_MEMBASE); /* PMM0 PCI Low Address */
+       out32r(PCIX0_PMM0PCILA,
+              CFG_PCI_MEMBASE);                /* PMM0 PCI Low Address */
        out32r(PCIX0_PMM0PCIHA, 0x00000000);    /* PMM0 PCI High Address */
        out32r(PCIX0_PMM0MA, 0xE0000001);       /* 512M + No prefetching, */
                                                /* and enable region */
 
        out32r(PCIX0_PMM1MA, 0x00000000);       /* PMM0 Mask/Attribute */
                                                /* - disabled b4 setting */
-       out32r(PCIX0_PMM1LA, CFG_PCI_MEMBASE2); /* PMM0 Local Address */
-       out32r(PCIX0_PMM1PCILA, CFG_PCI_MEMBASE2); /* PMM0 PCI Low Address */
+       out32r(PCIX0_PMM1LA,
+              CFG_PCI_MEMBASE + 0x20000000);   /* PMM0 Local Address */
+       out32r(PCIX0_PMM1PCILA,
+              CFG_PCI_MEMBASE + 0x20000000);   /* PMM0 PCI Low Address */
        out32r(PCIX0_PMM1PCIHA, 0x00000000);    /* PMM0 PCI High Address */
        out32r(PCIX0_PMM1MA, 0xE0000001);       /* 512M + No prefetching, */
                                                /* and enable region */
diff --git a/board/korat/u-boot-F7FC.lds b/board/korat/u-boot-F7FC.lds
new file mode 100644 (file)
index 0000000..cceb4f5
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd@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
+ */
+
+OUTPUT_ARCH(powerpc)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  .resetvec 0xF7FBFFFC :
+  {
+    *(.resetvec)
+  } = 0xffff
+
+  .bootpg 0xF7FBF000 :
+  {
+    cpu/ppc4xx/start.o (.bootpg)
+  } = 0xffff
+
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)          }
+  .dynsym        : { *(.dynsym)                }
+  .dynstr        : { *(.dynstr)                }
+  .rel.text      : { *(.rel.text)              }
+  .rela.text     : { *(.rela.text)     }
+  .rel.data      : { *(.rel.data)              }
+  .rela.data     : { *(.rela.data)     }
+  .rel.rodata    : { *(.rel.rodata)    }
+  .rela.rodata   : { *(.rela.rodata)   }
+  .rel.got       : { *(.rel.got)               }
+  .rela.got      : { *(.rela.got)              }
+  .rel.ctors     : { *(.rel.ctors)     }
+  .rela.ctors    : { *(.rela.ctors)    }
+  .rel.dtors     : { *(.rel.dtors)     }
+  .rela.dtors    : { *(.rela.dtors)    }
+  .rel.bss       : { *(.rel.bss)               }
+  .rela.bss      : { *(.rela.bss)              }
+  .rel.plt       : { *(.rel.plt)               }
+  .rela.plt      : { *(.rela.plt)              }
+  .init          : { *(.init)  }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    /* WARNING - the following is hand-optimized to fit within */
+    /* the sector layout of our flash chips!   XXX FIXME XXX   */
+
+    cpu/ppc4xx/start.o (.text)
+
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+
+  _end = . ;
+  PROVIDE (end = .);
+}
index affaeff1ae47f978aad928d9a05817750c554832..7c3cf496be7f13cd6eea5b773bc66ba7bb4fec70 100644 (file)
@@ -6,7 +6,7 @@
  * Alain Saurel,           AMCC/IBM, alain.saurel@fr.ibm.com
  * Robert Snyder,          AMCC/IBM, rob.snyder@fr.ibm.com
  *
- * (C) Copyright 2007
+ * (C) Copyright 2007-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * This program is free software; you can redistribute it and/or
@@ -35,6 +35,7 @@
 #include <asm/mmu.h>
 #include <asm/io.h>
 #include <ppc440.h>
+#include <watchdog.h>
 
 /*
  * This DDR2 setup code can dynamically setup the TLB entries for the DDR2 memory
@@ -99,87 +100,37 @@ static void wait_ddr_idle(void)
         */
 }
 
-static void blank_string(int size)
-{
-       int i;
-
-       for (i=0; i<size; i++)
-               putc('\b');
-       for (i=0; i<size; i++)
-               putc(' ');
-       for (i=0; i<size; i++)
-               putc('\b');
-}
-
 static void program_ecc(u32 start_address,
                        u32 num_bytes,
                        u32 tlb_word2_i_value)
 {
-       u32 current_address;
-       u32 end_address;
-       u32 address_increment;
        u32 val;
-       char str[] = "ECC generation -";
-       char slash[] = "\\|/-\\|/-";
-       int loop = 0;
-       int loopi = 0;
-
-       current_address = start_address;
+       u32 current_addr = start_address;
+       int bytes_remaining;
 
        sync();
-       eieio();
        wait_ddr_idle();
 
-       if (tlb_word2_i_value == TLB_WORD2_I_ENABLE) {
-               /* ECC bit set method for non-cached memory */
-               address_increment = 4;
-               end_address = current_address + num_bytes;
-
-               puts(str);
-
-               while (current_address < end_address) {
-                       *((u32 *)current_address) = 0x00000000;
-                       current_address += address_increment;
-
-                       if ((loop++ % (2 << 20)) == 0) {
-                               putc('\b');
-                               putc(slash[loopi++ % 8]);
-                       }
-               }
+       /*
+        * Because of 440EPx errata CHIP 11, we don't touch the last 256
+        * bytes of SDRAM.
+        */
+       bytes_remaining = num_bytes - CFG_MEM_TOP_HIDE;
 
-               blank_string(strlen(str));
-       } else {
-               /* ECC bit set method for cached memory */
-#if 0 /* test-only: will remove this define later, when ECC problems are solved! */
-               /*
-                * Some boards (like lwmon5) need to preserve the memory
-                * content upon ECC generation (for the log-buffer).
-                * Therefore we don't fill the memory with a pattern or
-                * just zero it, but write the same values back that are
-                * already in the memory cells.
-                */
-               address_increment = CFG_CACHELINE_SIZE;
-               end_address = current_address + num_bytes;
-
-               current_address = start_address;
-               while (current_address < end_address) {
-                       /*
-                        * TODO: Th following sequence doesn't work correctly.
-                        * Just invalidating and flushing the cache doesn't
-                        * seem to trigger the re-write of the memory.
-                        */
-                       ppcDcbi(current_address);
-                       ppcDcbf(current_address);
-                       current_address += CFG_CACHELINE_SIZE;
-               }
-#else
-               dcbz_area(start_address, num_bytes);
-               dflush();
-#endif
+       /*
+        * We have to write the ECC bytes by zeroing and flushing in smaller
+        * steps, since the whole 256MByte takes too long for the external
+        * watchdog.
+        */
+       while (bytes_remaining > 0) {
+               dcbz_area(current_addr, min((64 << 20), bytes_remaining));
+               current_addr += 64 << 20;
+               bytes_remaining -= 64 << 20;
+               WATCHDOG_RESET();
        }
+       dflush();
 
        sync();
-       eieio();
        wait_ddr_idle();
 
        /* Clear error status */
@@ -191,7 +142,6 @@ static void program_ecc(u32 start_address,
        mtsdram(DDR0_01, ((val &~ DDR0_01_INT_MASK_MASK) | DDR0_01_INT_MASK_ALL_OFF));
 
        sync();
-       eieio();
        wait_ddr_idle();
 }
 #endif
diff --git a/board/mpr2/Makefile b/board/mpr2/Makefile
new file mode 100644 (file)
index 0000000..17ca17e
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2007
+# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+#
+# Copyright (C) 2007
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# Copyright (C) 2007
+# Kenati Technologies, Inc.
+#
+# (C) Copyright 2008
+# Mark Jonas <mark.jonas@de.bosch.com>
+#
+# board/mpr2/Makefile
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB    = lib$(BOARD).a
+
+OBJS   := mpr2.o
+SOBJS  := lowlevel_init.o
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+-include .depend
+
+#########################################################################
diff --git a/board/mpr2/config.mk b/board/mpr2/config.mk
new file mode 100644 (file)
index 0000000..6d41d97
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# Copyright (C) 2007
+# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+#
+# Copyright (C) 2007
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# Copyright (C) 2007
+# Kenati Technologies, Inc.
+#
+# Copyright (C) 2008
+# Mark Jonas <mark.jonas@de.bosch.com>
+#
+# board/mpr2/config.mk
+#
+# 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
+
+#
+# TEXT_BASE refers to image _after_ relocation.
+#
+# NOTE: Must match value used in u-boot.lds (in this directory).
+#
+
+TEXT_BASE = 0x8FFC0000
diff --git a/board/mpr2/lowlevel_init.S b/board/mpr2/lowlevel_init.S
new file mode 100644 (file)
index 0000000..060957a
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * (C) Copyright 2008
+ * Mark Jonas <mark.jonas@de.bosch.com>
+ *
+ * (C) Copyright 2007
+ * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+ *
+ * board/mpr2/lowlevel_init.S
+ *
+ * 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
+ */
+
+       .global lowlevel_init
+
+       .text
+       .align  2
+
+lowlevel_init:
+
+/*
+ * Set frequency multipliers and dividers in FRQCR.
+ */
+       mov.l   WTCSR_A,r1
+       mov.l   WTCSR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   WTCNT_A,r1
+       mov.l   WTCNT_D,r0
+       mov.w   r0,@r1
+
+       mov.l   FRQCR_A,r1
+       mov.l   FRQCR_D,r0
+       mov.w   r0,@r1
+
+/*
+ * Setup CS0 (Flash).
+ */
+       mov.l   CS0BCR_A, r1
+       mov.l   CS0BCR_D, r0
+       mov.l   r0, @r1
+
+       mov.l   CS0WCR_A, r1
+       mov.l   CS0WCR_D, r0
+       mov.l   r0, @r1
+
+/*
+ * Setup CS3 (SDRAM).
+ */
+       mov.l   CS3BCR_A, r1
+       mov.l   CS3BCR_D, r0
+       mov.l   r0, @r1
+
+       mov.l   CS3WCR_A, r1
+       mov.l   CS3WCR_D, r0
+       mov.l   r0, @r1
+
+       mov.l   SDCR_A, r1
+       mov.l   SDCR_D1, r0
+       mov.l   r0, @r1
+
+       mov.l   RTCSR_A, r1
+       mov.l   RTCSR_D, r0
+       mov.l   r0, @r1
+
+       mov.l   RTCNT_A, r1
+       mov.l   RTCNT_D, r0
+       mov.l   r0, @r1
+
+       mov.l   RTCOR_A, r1
+       mov.l   RTCOR_D, r0
+       mov.l   r0, @r1
+
+       mov.l   SDCR_A, r1
+       mov.l   SDCR_D2, r0
+       mov.l   r0, @r1
+
+       mov.l   SDMR3_A, r1
+       mov.l   SDMR3_D, r0
+       add     r0, r1
+       mov     #0, r0
+       mov.w   r0, @r1
+
+       rts
+       nop
+
+       .align 4
+
+/*
+ * Configuration for MPR2 A.3 through A.7
+ */
+
+/*
+ * PLL Settings
+ */
+FRQCR_D:       .long   0x1103          /* I:B:P=8:4:2 */
+WTCNT_D:       .long   0x5A00          /* start counting at zero */
+WTCSR_D:       .long   0xA507          /* divide by 4096 */
+
+/*
+ * Spansion S29GL256N11 @ 48 MHz
+ */
+CS0BCR_D:      .long   0x12490400  /* 1 idle cycle inserted, normal space, 16 bit */
+CS0WCR_D:      .long   0x00000340  /* tSW=0.5ck, 6 wait cycles, NO external wait, tHW=0.5ck */
+
+/*
+ * Samsung K4S511632B-UL75 @ 48 MHz
+ * Micron MT48LC32M16A2-75 @ 48 MHz
+ */
+CS3BCR_D:      .long   0x10004400  /* CS3BCR = 0x10004400, minimum idle cycles, SDRAM, 16 bit */
+CS3WCR_D:      .long   0x00000091  /* tRP=1ck, tRCD=1ck, CL=2, tRWL=2ck, tRC=4ck */
+SDCR_D1:       .long   0x00000012  /* no refresh, 13 rows, 10 cols, NO bank active mode */
+SDCR_D2:       .long   0x00000812  /* refresh */
+RTCSR_D:       .long   0xA55A0008  /* 1/4, once */
+RTCNT_D:       .long   0xA55A005D  /* count 93 */
+RTCOR_D:       .long   0xa55a005d  /* count 93 */
+SDMR3_D:       .long   0x440       /* mode register CL2, burst read and SINGLE WRITE */
+
+/*
+ * Registers
+ */
+
+FRQCR_A:       .long   0xA415FF80
+WTCNT_A:       .long   0xA415FF84
+WTCSR_A:       .long   0xA415FF86
+
+#define BSC_BASE       0xA4FD0000
+CS0BCR_A:      .long   BSC_BASE + 0x04
+CS3BCR_A:      .long   BSC_BASE + 0x0C
+CS0WCR_A:      .long   BSC_BASE + 0x24
+CS3WCR_A:      .long   BSC_BASE + 0x2C
+SDCR_A:                .long   BSC_BASE + 0x44
+RTCSR_A:       .long   BSC_BASE + 0x48
+RTCNT_A:       .long   BSC_BASE + 0x4C
+RTCOR_A:       .long   BSC_BASE + 0x50
+SDMR3_A:       .long   BSC_BASE + 0x5000
diff --git a/board/mpr2/mpr2.c b/board/mpr2/mpr2.c
new file mode 100644 (file)
index 0000000..2ddb0c1
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2008
+ * Mark Jonas <mark.jonas@de.bosch.com>
+ *
+ * board/mpr2/mpr2.c
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+
+int checkboard(void)
+{
+       puts("BOARD: MPR2\n");
+       return 0;
+}
+
+int board_init(void)
+{
+       /*
+        * For MPR2 A.3 through A.7
+        */
+
+       /* CS2: Ethernet (0xA8000000 - 0xABFFFFFF) */
+       __raw_writel(0x36db0400, CS2BCR);    /* 4 idle cycles, normal space, 16 bit data bus */
+       __raw_writel(0x000003c0, CS2WCR);    /* (WR:8), no ext. wait */
+
+       /* CS4: CAN1 (0xB0000000 - 0xB3FFFFFF) */
+       __raw_writel(0x00000200, CS4BCR);    /* no idle cycles, normal space, 8 bit data bus */
+       __raw_writel(0x00100981, CS4WCR);    /* (SW:1.5 WR:3 HW:1.5), ext. wait */
+
+       /* CS5a: CAN2 (0xB4000000 - 0xB5FFFFFF) */
+       __raw_writel(0x00000200, CS5ABCR);   /* no idle cycles, normal space, 8 bit data bus */
+       __raw_writel(0x00100981, CS5AWCR);   /* (SW:1.5 WR:3 HW:1.5), ext. wait */
+
+       /* CS5b: CAN3 (0xB6000000 - 0xB7FFFFFF) */
+       __raw_writel(0x00000200, CS5BBCR);   /* no idle cycles, normal space, 8 bit data bus */
+       __raw_writel(0x00100981, CS5BWCR);   /* (SW:1.5 WR:3 HW:1.5), ext. wait */
+
+       /* CS6a: Rotary (0xB8000000 - 0xB9FFFFFF) */
+       __raw_writel(0x00000200, CS6ABCR);   /* no idle cycles, normal space, 8 bit data bus */
+       __raw_writel(0x001009C1, CS6AWCR);   /* (SW:1.5 WR:3 HW:1.5), no ext. wait */
+
+       /* set Pin Select Register A: /PCC_CD1, /PCC_CD2, PCC_BVD1, PCC_BVD2, /IOIS16, IRQ4, IRQ5, USB1d_SUSPEND */
+       __raw_writew(0xAABC, PSELA);  /*    10        10        10        10       10    11    11             00 */
+
+       /* set Pin Select Register B: /SCIF0_RTS, /SCIF0_CTS, LCD_VCPWC, LCD_VEPWC, IIC_SDA, IIC_SCL, Reserved */
+       __raw_writew(0x3C00, PSELB);  /*       0           0         11         11        0        0  00000000 */
+
+       /* set Pin Select Register C: SIOF1_SCK, SIOF1_RxD, SCIF1_RxD, SCIF1_TxD, Reserved */
+       __raw_writew(0x0000, PSELC);  /*     00         00         00         00  00000000 */
+
+       /* set Pin Select Register D: Reserved, SIOF1_TxD, Reserved, SIOF1_MCLK, Reserved, SIOF1_SYNC, Reserved, SCIF1_SCK, Reserved */
+       __raw_writew(0x0000, PSELD);  /*     0         00        00          00        00          00        00         00         0 */
+       
+       /* OTH:  (00) Other fuction
+        * GPO:  (01) General Purpose Output
+        * GPI:  (11) General Purpose Input
+        * GPI+: (10) General Purpose Input with internal pull-up
+        *-------------------------------------------------------
+        * A7 GPO(LED8);     A6 GPO(LED7);     A5 GPO(LED6);        A4 GPO(LED5);
+        * A3 GPO(LED4);     A2 GPO(LED3);     A1 GPO(LED2);        A0 GPO(LED1); */
+       __raw_writew(0x5555, PACR);   /* 01 01 01 01 01 01 01 01 */
+
+       /* B7 GPO(RST4);     B6 GPO(RST3);     B5 GPO(RST2);        B4 GPO(RST1);
+        * B3 GPO(PB3);      B2 GPO(PB2);      B1 GPO(PB1);         B0 GPO(PB0); */
+       __raw_writew(0x5555, PBCR);   /* 01 01 01 01 01 01 01 01 */
+
+       /* C7 GPO(PC7);      C6 GPO(PC6);      C5 GPO(PC5);         C4 GPO(PC4);
+        * C3 LCD_DATA3;     C2 LCD_DATA2;     C1 LCD_DATA1;        C0 LCD_DATA0; */
+       __raw_writew(0x5500, PCCR);   /* 01 01 01 01 00 00 00 00 */
+
+       /* D7 GPO(PD7);      D6 GPO(PD6);      D5 GPO(PD5);         D4 GPO(PD4);
+        * D3 GPO(PD3);      D2 GPO(PD2);      D1 GPO(PD1);         D0 GPO(PD0); */
+       __raw_writew(0x5555, PDCR);   /* 01 01 01 01 01 01 01 01 */
+
+       /* E7 (x);           E6 GPI(nu);       E5 GPI(nu);          E4 LCD_M_DISP;
+        * E3 LCD_CL1;       E2 LCD_CL2;       E1 LCD_DON;          E0 LCD_FLM; */
+       __raw_writew(0x2800, PECR);   /* 00 10 10 00 00 00 00 00 */
+
+       /* F7 (x);           F6 DA1(VLCD);     F5 DA0(nc);          F4 AN3;
+        * F3 AN2(MID_AD);   F2 AN1(EARTH_AD); F1 AN0(TEMP);        F0 GPI+(nc); */
+       __raw_writew(0x0002, PFCR);   /* 00 00 00 00 00 00 00 10 */
+
+       /* G7 (x);          G6 IRQ5(TOUCH_BUSY); G5 IRQ4(TOUCH_IRQ);G4 GPI(KEY2);
+        * G3 GPI(KEY1);     G2 GPO(LED11);      G1 GPO(LED10);     G0 GPO(LED9); */
+       __raw_writew(0x03D5, PGCR);   /* 00 00 00 11 11 01 01 01 */
+
+       /* H7 (x);            H6 /RAS(BRAS);      H5 /CAS(BCAS);    H4 CKE(BCKE);
+        * H3 GPO(EARTH_OFF); H2 GPO(EARTH_TEST); H1 USB2_PWR;      H0 USB1_PWR; */
+       __raw_writew(0x0050, PHCR);   /* 00 00 00 00 01 01 00 00 */
+
+       /* J7 (x);           J6 AUDCK;         J5 ASEBRKAK;         J4 AUDATA3;
+        * J3 AUDATA2;       J2 AUDATA1;       J1 AUDATA0;          J0 AUDSYNC; */
+       __raw_writew(0x0000, PJCR);   /* 00 00 00 00 00 00 00 00 */
+
+       /* K7 (x);           K6 (x);           K5 (x);              K4 (x)
+        * K3 PINT7(/PWR2);  K2 PINT6(/PWR1);  K1 PINT5(nc);        K0 PINT4(FLASH_READY); */
+       __raw_writew(0x00FB, PKCR);   /* 00 00 00 00 11 11 10 11 */
+
+       /* L7 TRST;          L6 TMS;           L5 TDO;              L4 TDI;
+        * L3 TCK;           L2 (x);           L1 (x);              L0 (x); */
+       __raw_writew(0x0000, PLCR);    /* 00 00 00 00 00 00 00 00 */
+
+       /* M7 GPO(CURRENT_SINK);M6 GPO(PWR_SWITCH);  M5 GPO(LAN_SPEED);   M4 GPO(LAN_RESET);
+        * M3 GPO(BUZZER);      M2 GPO(LCD_BL);      M1 CS5B(CAN3_CS);    M0 GPI+(nc); */
+       __raw_writew(0x5552, PMCR);   /* 01 01 01 01 01 01 00 10 */
+       __raw_writeb(0xF0, PMDR);     /* CURRENT_SINK=off, PWR_SWITCH=off, LAN_SPEED=100MBit, LAN_RESET=off, BUZZER=off, LCD_BL=off */
+
+       /* P7 (x);           P6 (x);           P5 (x);              P4 GPO(on pullup);
+        * P3 IRQ3(LAN_IRQ); P2 IRQ2(CAN3_IRQ);P1 IRQ1(CAN2_IRQ);   P0 IRQ0(CAN1_IRQ); */
+       __raw_writew(0x0100, PPCR);   /* 00 00 00 01 00 00 00 00 */
+       __raw_writeb(0x10, PPDR);     /* no current flow through pullup */
+
+       /* R7 A25;           R6 A24;           R5 A23;              R4 A22;
+        * R3 A21;           R2 A20;           R1 A19;              R0 A0; */
+       __raw_writew(0x0000, PRCR);   /* 00 00 00 00 00 00 00 00 */
+
+       /* S7 (x);              S6 (x);        S5 (x);              S4 GPO(EEPROM_CS2);
+        * S3 GPO(EEPROM_CS1);  S2 SIOF0_TXD;  S1 SIOF0_RXD;        S0 SIOF0_SCK; */
+       __raw_writew(0x0140, PSCR);   /* 00 00 00 01 01 00 00 00 */
+
+       /* T7 (x);           T6 (x);           T5 (x);              T4 COM1_CTS;
+        * T3 COM1_RTS;      T2 COM1_TXD;      T1 COM1_RXD;         T0 GPO(WDOG); */
+       __raw_writew(0x0001, PTCR);   /* 00 00 00 00 00 00 00 01 */
+
+       /* U7 (x);           U6 (x);           U5 (x);              U4 GPI+(/AC_FAULT);
+        * U3 GPO(TOUCH_CS); U2 TOUCH_TXD;     U1 TOUCH_RXD;        U0 TOUCH_SCK; */
+       __raw_writew(0x0240, PUCR);   /* 00 00 00 10 01 00 00 00 */
+
+       /* V7 (x);           V6 (x);           V5 (x);              V4 GPO(MID2);
+        * V3 GPO(MID1);     V2 CARD_TxD;      V1 CARD_RxD;         V0 GPI+(/BAT_FAULT); */
+       __raw_writew(0x0142, PVCR);   /* 00 00 00 01 01 00 00 10 */
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       gd->bd->bi_memstart = CFG_SDRAM_BASE;
+       gd->bd->bi_memsize = CFG_SDRAM_SIZE;
+       printf("SDRAM: %dMB\n", CFG_SDRAM_SIZE / (1024 * 1024));
+       return 0;
+}
+
diff --git a/board/mpr2/u-boot.lds b/board/mpr2/u-boot.lds
new file mode 100644 (file)
index 0000000..6fee7f2
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2007
+ * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+ *
+ * Copyright (C) 2007
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * Copyright (C) 2008
+ * Mark Jonas <mark.jonas@de.bosch.com>
+ * 
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+OUTPUT_ARCH(sh)
+ENTRY(_start)
+
+SECTIONS
+{
+       /*
+          Base address of internal SDRAM is 0x8C000000.
+          U-Boot resides in the last 256 kB of the 64 MB.
+
+          NOTE: This address must match with the definition of
+          TEXT_BASE in config.mk (in this directory).
+
+       */
+       . = 0x8C000000 + (64*1024*1024) - (256*1024);
+
+       PROVIDE (reloc_dst = .);
+
+       PROVIDE (_ftext = .);
+       PROVIDE (_fcode = .);
+       PROVIDE (_start = .);
+
+       .text :
+       {
+               cpu/sh3/start.o         (.text)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenv)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenvr)
+               . = ALIGN(8192);
+               *(.text)
+               . = ALIGN(4);
+       } =0xFF
+       PROVIDE (_ecode = .);
+       .rodata :
+       {
+               *(.rodata)
+               . = ALIGN(4);
+       }
+       PROVIDE (_etext = .);
+
+
+       PROVIDE (_fdata = .);
+       .data :
+       {
+               *(.data)
+               . = ALIGN(4);
+       }
+       PROVIDE (_edata = .);
+
+       PROVIDE (_fgot = .);
+       .got :
+       {
+               *(.got)
+               . = ALIGN(4);
+       }
+       PROVIDE (_egot = .);
+
+       PROVIDE (__u_boot_cmd_start = .);
+       .u_boot_cmd :
+       {
+               *(.u_boot_cmd)
+               . = ALIGN(4);
+       }
+       PROVIDE (__u_boot_cmd_end = .);
+
+       PROVIDE (reloc_dst_end = .);
+       /* _reloc_dst_end = .; */
+
+       PROVIDE (bss_start = .);
+       PROVIDE (__bss_start = .);
+       .bss :
+       {
+               *(.bss)
+               . = ALIGN(4);
+       }
+       PROVIDE (bss_end = .);
+
+       PROVIDE (_end = .);
+}
index b76449989bc58238786b2c04bdbe1c859c19547d..287f32e587a0ec398d3280fbfdbf04e0d3f97a23 100644 (file)
 
 
 #include <common.h>
-#include <asm/processor.h>
+#include <libfdt.h>
+#include <fdt_support.h>
 #include <spd_sdram.h>
 #include <ppc4xx_enet.h>
 #include <miiphy.h>
+#include <asm/processor.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -315,3 +317,24 @@ int post_hotkeys_pressed(void)
        return (ctrlc());
 }
 #endif
+
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+void ft_board_setup(void *blob, bd_t *bd)
+{
+       u32 val[4];
+       int rc;
+
+       ft_cpu_setup(blob, bd);
+
+       /* Fixup NOR mapping */
+       val[0] = 0;                             /* chip select number */
+       val[1] = 0;                             /* always 0 */
+       val[2] = gd->bd->bi_flashstart;
+       val[3] = gd->bd->bi_flashsize;
+       rc = fdt_find_and_setprop(blob, "/plb/opb/ebc", "ranges",
+                                 val, sizeof(val), 1);
+       if (rc)
+               printf("Unable to update property NOR mapping, err=%s\n",
+                      fdt_strerror(rc));
+}
+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
index 135674c26a72e933c5ae84fa110ff39acef6644e..76164ce1db8a349eab2709a4353955b43f5480bc 100644 (file)
@@ -90,7 +90,16 @@ tlbtab:
        tlbentry( CFG_PERIPHERAL_BASE, SZ_256M, 0x40000000, 1, AC_R|AC_W|SA_G|SA_I )
        tlbentry( CFG_ISRAM_BASE, SZ_4K, 0x80000000, 0, AC_R|AC_W|AC_X )
        tlbentry( CFG_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X )
+#ifdef CONFIG_4xx_DCACHE
+       tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G)
+#else
        tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
+#endif
+
+#ifdef CFG_INIT_RAM_DCACHE
+       /* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
+       tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
+#endif
        tlbentry( CFG_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I )
 
        /* PCI */
diff --git a/board/r2dplus/Makefile b/board/r2dplus/Makefile
new file mode 100644 (file)
index 0000000..ed609ea
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2007,2008
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB    = lib$(BOARD).a
+
+OBJS   := r2dplus.o
+SOBJS  := lowlevel_init.o
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#################################################################
+
+.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+       $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+-include .depend
+
+#################################################################
diff --git a/board/r2dplus/config.mk b/board/r2dplus/config.mk
new file mode 100644 (file)
index 0000000..1ec7dcc
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2007,2008
+# Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+#
+# 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
+#
+#
+# NOTE: Must match value used in u-boot.lds (in this directory).
+#
+TEXT_BASE = 0x0FFC0000
diff --git a/board/r2dplus/lowlevel_init.S b/board/r2dplus/lowlevel_init.S
new file mode 100644 (file)
index 0000000..5755de8
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * modified from SH-IPL+g (init-r0p751rlc0011rl.S)
+ * Initial Register Data for R0P751RLC0011RL (SH7751R 240MHz/120MHz/60MHz)
+ * Coyright (c) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+*/
+
+#include <config.h>
+#include <version.h>
+
+#include <asm/processor.h>
+
+       .global lowlevel_init
+       .text
+       .align  2
+
+lowlevel_init:
+
+       mov.l   CCR_A, r1
+       mov.l   CCR_D_D, r0
+       mov.l   r0,@r1
+
+       mov.l   MMUCR_A,r1
+       mov.l   MMUCR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   BCR1_A,r1
+       mov.l   BCR1_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BCR2_A,r1
+       mov.l   BCR2_D,r0
+       mov.w   r0,@r1
+
+       mov.l   BCR3_A,r1
+       mov.l   BCR3_D,r0
+       mov.w   r0,@r1
+
+       mov.l   BCR4_A,r1
+       mov.l   BCR4_D,r0
+       mov.l   r0,@r1
+
+       mov.l   WCR1_A,r1
+       mov.l   WCR1_D,r0
+       mov.l   r0,@r1
+
+       mov.l   WCR2_A,r1
+       mov.l   WCR2_D,r0
+       mov.l   r0,@r1
+
+       mov.l   WCR3_A,r1
+       mov.l   WCR3_D,r0
+       mov.l   r0,@r1
+
+       mov.l   PCR_A,r1
+       mov.l   PCR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   LED_A,r1
+       mov     #0xff,r0
+       mov.w   r0,@r1
+
+       mov.l   MCR_A,r1
+       mov.l   MCR_D1,r0
+       mov.l   r0,@r1
+
+       mov.l   RTCNT_A,r1
+       mov.l   RTCNT_D,r0
+       mov.w   r0,@r1
+
+       mov.l   RTCOR_A,r1
+       mov.l   RTCOR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   RFCR_A,r1
+       mov.l   RFCR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   RTCSR_A,r1
+       mov.l   RTCSR_D,r0
+       mov.w   r0,@r1
+
+       mov.l   SDMR3_A,r1
+       mov     #0x55,r0
+       mov.b   r0,@r1
+
+       /* Wait DRAM refresh 30 times */
+       mov.l   RFCR_A,r1
+       mov     #30,r3
+1:
+       mov.w   @r1,r0
+       extu.w  r0,r2
+       cmp/hi  r3,r2
+       bf      1b
+
+       mov.l   MCR_A,r1
+       mov.l   MCR_D2,r0
+       mov.l   r0,@r1
+
+       mov.l   SDMR3_A,r1
+       mov     #0,r0
+       mov.b   r0,@r1
+
+       mov.l   IRLMASK_A,r1
+       mov.l   IRLMASK_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CCR_A, r1
+       mov.l   CCR_D_E, r0
+       mov.l   r0, @r1
+
+       rts
+       nop
+
+       .align  2
+CCR_A:         .long   CCR             /* Cache Control Register */
+CCR_D_D:       .long   0x0808          /* Flush the cache, disable */
+CCR_D_E:       .long   0x8000090B
+
+FRQCR_A:       .long   FRQCR           /* FRQCR Address */
+FRQCR_D:       .long   0x00000e0a      /* 03/07/15 modify */
+BCR1_A:        .long   BCR1            /* BCR1 Address */
+BCR1_D:        .long   0x00180008
+BCR2_A:        .long   BCR2            /* BCR2 Address */
+BCR2_D:        .long   0xabe8
+BCR3_A:        .long   BCR3            /* BCR3 Address */
+BCR3_D:        .long   0x0000
+BCR4_A:        .long   BCR4            /* BCR4 Address */
+BCR4_D:        .long   0x00000010
+WCR1_A:        .long   WCR1            /* WCR1 Address */
+WCR1_D:        .long   0x33343333
+WCR2_A:        .long   WCR2            /* WCR2 Address */
+WCR2_D:        .long   0xcff86fbf
+WCR3_A:        .long   WCR3            /* WCR3 Address */
+WCR3_D:        .long   0x07777707
+LED_A:         .long   0x04000036      /* LED Address */
+RTCNT_A:       .long   RTCNT           /* RTCNT Address */
+RTCNT_D:       .long   0xA500          /* RTCNT Write Code A5h Data 00h */
+RTCOR_A:       .long   RTCOR           /* RTCOR Address */
+RTCOR_D:       .long   0xA534          /* RTCOR Write Code  */
+RTCSR_A:       .long   RTCSR           /* RTCSR Address */
+RTCSR_D:       .long   0xA510          /* RTCSR Write Code */
+SDMR3_A:       .long   0xFF9400CC      /* SDMR3 Address */
+SDMR3_D:       .long   0x55
+MCR_A:         .long   MCR             /* MCR Address */
+MCR_D1:        .long   0x081901F4      /* MRSET:'0' */
+MCR_D2:        .long   0x481901F4      /* MRSET:'1' */
+RFCR_A:        .long   RFCR            /* RFCR Address */
+RFCR_D:        .long   0xA400          /* RFCR Write Code A4h Data 00h */
+PCR_A:         .long   PCR             /* PCR Address */
+PCR_D:         .long   0x0000
+MMUCR_A:       .long   MMUCR           /* MMUCCR Address */
+MMUCR_D:       .long   0x00000000      /* MMUCCR Data */
+IRLMASK_A:     .long   0xA4000000      /* IRLMASK Address */
+IRLMASK_D:     .long   0x00000000      /* IRLMASK Data */
diff --git a/board/r2dplus/r2dplus.c b/board/r2dplus/r2dplus.c
new file mode 100644 (file)
index 0000000..2ee3ea2
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007,2008
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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 <common.h>
+#include <ide.h>
+#include <asm/processor.h>
+#include <asm/pci.h>
+
+int checkboard(void)
+{
+       puts("BOARD: Renesas Solutions R2D Plus\n");
+       return 0;
+}
+
+int board_init(void)
+{
+       return 0;
+}
+
+int dram_init (void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       gd->bd->bi_memstart = CFG_SDRAM_BASE;
+       gd->bd->bi_memsize = CFG_SDRAM_SIZE;
+       printf("DRAM:  %dMB\n", CFG_SDRAM_SIZE / (1024 * 1024));
+       return 0;
+}
+
+int board_late_init(void)
+{
+       return 0;
+}
+
+#define FPGA_BASE          0xA4000000
+#define FPGA_CFCTL         (FPGA_BASE + 0x04)
+#define FPGA_CFPOW         (FPGA_BASE + 0x06)
+#define FPGA_CFCDINTCLR    (FPGA_BASE + 0x2A)
+
+void ide_set_reset (int idereset)
+{
+       /* if reset = 1 IDE reset will be asserted */
+       if (idereset){
+               (*(vu_short *)FPGA_CFCTL) = 0x432;
+               (*(vu_short *)FPGA_CFPOW) |= 0x02;
+               (*(vu_short *)FPGA_CFCDINTCLR) = 0x01;
+       }
+}
+
+#if defined(CONFIG_PCI)
+static struct pci_controller hose;
+void pci_init_board(void)
+{
+       pci_sh7751_init( &hose );
+}
+#endif /* CONFIG_PCI */
diff --git a/board/r2dplus/u-boot.lds b/board/r2dplus/u-boot.lds
new file mode 100644 (file)
index 0000000..96d8d81
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyrigth (c) 2007,2008
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+OUTPUT_ARCH(sh)
+ENTRY(_start)
+
+SECTIONS
+{
+       /*
+          Base address of internal SDRAM is 0x0C000000.
+          Although size of SDRAM can be either 16 or 32 MBytes,
+          we assume 16 MBytes (ie ignore upper half if the full
+          32 MBytes is present).
+
+          NOTE: This address must match with the definition of
+          TEXT_BASE in config.mk (in this directory).
+
+       */
+       . = 0x0C000000 + (64*1024*1024) - (256*1024);
+
+       PROVIDE (reloc_dst = .);
+
+       PROVIDE (_ftext = .);
+       PROVIDE (_fcode = .);
+       PROVIDE (_start = .);
+
+       .text :
+       {
+               cpu/sh4/start.o         (.text)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenv)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenvr)
+               . = ALIGN(8192);
+               *(.text)
+               . = ALIGN(4);
+       } =0xFF
+       PROVIDE (_ecode = .);
+       .rodata :
+       {
+               *(.rodata)
+               . = ALIGN(4);
+       }
+       PROVIDE (_etext = .);
+
+
+       PROVIDE (_fdata = .);
+       .data :
+       {
+               *(.data)
+               . = ALIGN(4);
+       }
+       PROVIDE (_edata = .);
+
+       PROVIDE (_fgot = .);
+       .got :
+       {
+               *(.got)
+               . = ALIGN(4);
+       }
+       PROVIDE (_egot = .);
+
+       PROVIDE (__u_boot_cmd_start = .);
+       .u_boot_cmd :
+       {
+               *(.u_boot_cmd)
+               . = ALIGN(4);
+       }
+       PROVIDE (__u_boot_cmd_end = .);
+
+       PROVIDE (reloc_dst_end = .);
+       /* _reloc_dst_end = .; */
+
+       PROVIDE (bss_start = .);
+       PROVIDE (__bss_start = .);
+       .bss :
+       {
+               *(.bss)
+               . = ALIGN(4);
+       }
+       PROVIDE (bss_end = .);
+
+       PROVIDE (_end = .);
+}
diff --git a/board/r7780mp/Makefile b/board/r7780mp/Makefile
new file mode 100644 (file)
index 0000000..554dca1
--- /dev/null
@@ -0,0 +1,44 @@
+#
+# Copyright (C) 2007,2008 Nobuhiro Iwamatsu
+#
+# board/r7780mp/Makefile
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB    = lib$(BOARD).a
+
+OBJS   := r7780mp.o
+SOBJS  := lowlevel_init.o
+
+$(LIB):        $(OBJS) $(SOBJS)
+       $(AR) crv $@ $(OBJS) $(SOBJS)
+
+clean:
+       rm -f $(SOBJS) $(OBJS)
+
+distclean:     clean
+       rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+.depend:       Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+               $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+-include .depend
+
+#########################################################################
diff --git a/board/r7780mp/config.mk b/board/r7780mp/config.mk
new file mode 100644 (file)
index 0000000..6a045a1
--- /dev/null
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2007,2008 Nobuhiro Iwamatsu
+#
+# board/r77870mp/config.mk
+#
+# 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
+
+#
+# TEXT_BASE refers to image _after_ relocation.
+#
+# NOTE: Must match value used in u-boot.lds (in this directory).
+#
+
+TEXT_BASE = 0x0FFC0000
diff --git a/board/r7780mp/lowlevel_init.S b/board/r7780mp/lowlevel_init.S
new file mode 100644 (file)
index 0000000..eb5d8b7
--- /dev/null
@@ -0,0 +1,428 @@
+/*
+ * Copyright (C) 2007,2008 Nobuhiro Iwamatsu
+ *
+ * u-boot/board/r7780mp/lowlevel_init.S
+ *
+ * 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>
+#include <asm/processor.h>
+
+/*
+ *  Board specific low level init code, called _very_ early in the
+ *  startup sequence. Relocation to SDRAM has not happened yet, no
+ *  stack is available, bss section has not been initialised, etc.
+ *
+ *  (Note: As no stack is available, no subroutines can be called...).
+ */
+
+       .global lowlevel_init
+
+       .text
+       .align  2
+
+lowlevel_init:
+
+       mov.l   CCR_A, r1       /* Address of Cache Control Register */
+       mov.l   CCR_D, r0       /* Instruction Cache Invalidate */
+       mov.l   r0, @r1
+
+       mov.l   FRQCR_A, r1     /* Frequency control register */
+       mov.l   FRQCR_D, r0
+       mov.l   r0, @r1
+
+       /* pin_multi_setting */
+       mov.l   BBG_PMMR_A,r1
+       mov.l   BBG_PMMR_D_PMSR1,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMSR1_A,r1
+       mov.l   BBG_PMSR1_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMMR_A,r1
+       mov.l   BBG_PMMR_D_PMSR2,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMSR2_A,r1
+       mov.l   BBG_PMSR2_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMMR_A,r1
+       mov.l   BBG_PMMR_D_PMSR3,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMSR3_A,r1
+       mov.l   BBG_PMSR3_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMMR_A,r1
+       mov.l   BBG_PMMR_D_PMSR4,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMSR4_A,r1
+       mov.l   BBG_PMSR4_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMMR_A,r1
+       mov.l   BBG_PMMR_D_PMSRG,r0
+       mov.l   r0,@r1
+
+       mov.l   BBG_PMSRG_A,r1
+       mov.l   BBG_PMSRG_D,r0
+       mov.l   r0,@r1
+
+       /* cpg_setting */
+       mov.l   FRQCR_A,r1
+       mov.l   FRQCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   DLLCSR_A,r1
+       mov.l   DLLCSR_D,r0
+       mov.l   r0,@r1
+
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+
+       /* wait 200us */
+       mov.l   REPEAT0_R3,r3
+       mov     #0,r2
+repeat0:
+       add     #1,r2
+       cmp/hs  r3,r2
+       bf      repeat0
+       nop
+
+       /* bsc_setting */
+       mov.l   MMSELR_A,r1
+       mov.l   MMSELR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   BCR_A,r1
+       mov.l   BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS0BCR_A,r1
+       mov.l   CS0BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS1BCR_A,r1
+       mov.l   CS1BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS2BCR_A,r1
+       mov.l   CS2BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS4BCR_A,r1
+       mov.l   CS4BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS5BCR_A,r1
+       mov.l   CS5BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS6BCR_A,r1
+       mov.l   CS6BCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS0WCR_A,r1
+       mov.l   CS0WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS1WCR_A,r1
+       mov.l   CS1WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS2WCR_A,r1
+       mov.l   CS2WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS4WCR_A,r1
+       mov.l   CS4WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS5WCR_A,r1
+       mov.l   CS5WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS6WCR_A,r1
+       mov.l   CS6WCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS5PCR_A,r1
+       mov.l   CS5PCR_D,r0
+       mov.l   r0,@r1
+
+       mov.l   CS6PCR_A,r1
+       mov.l   CS6PCR_D,r0
+       mov.l   r0,@r1
+
+       /* ddr_setting */
+       /* wait 200us */
+       mov.l   REPEAT0_R3,r3
+       mov     #0,r2
+repeat1:
+       add     #1,r2
+       cmp/hs  r3,r2
+       bf      repeat1
+       nop
+
+       mov.l   MIM_U_A,r0
+       mov.l   MIM_U_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       mov.l   MIM_L_A,r0
+       mov.l   MIM_L_D0,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       mov.l   STR_L_A,r0
+       mov.l   STR_L_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       mov.l   SDR_L_A,r0
+       mov.l   SDR_L_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+       nop
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D0,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D1,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   EMRS_A,r0
+       mov.l   EMRS_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   MRS1_A,r0
+       mov.l   MRS1_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D2,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D3,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D4,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   MRS2_A,r0
+       mov.l   MRS2_D,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       nop
+       nop
+       nop
+
+       mov.l   SCR_L_A,r0
+       mov.l   SCR_L_D5,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       /* wait 200us */
+       mov.l   REPEAT0_R1,r3
+       mov     #0,r2
+repeat2:
+       add     #1,r2
+       cmp/hs  r3,r2
+       bf      repeat2
+
+       synco
+
+       mov.l   MIM_L_A,r0
+       mov.l   MIM_L_D1,r1
+       synco
+       mov.l   r1,@r0
+       synco
+
+       rts
+       nop
+       .align  4
+
+RWTCSR_D_1:                            .word   0xA507
+RWTCSR_D_2:                            .word   0xA507
+RWTCNT_D:                              .word   0x5A00
+
+BBG_PMMR_A:                    .long   0xFF800010
+BBG_PMSR1_A:                   .long   0xFF800014
+BBG_PMSR2_A:                   .long   0xFF800018
+BBG_PMSR3_A:                   .long   0xFF80001C
+BBG_PMSR4_A:                   .long   0xFF800020
+BBG_PMSRG_A:                   .long   0xFF800024
+
+BBG_PMMR_D_PMSR1:       .long  0xffffbffd
+BBG_PMSR1_D:            .long  0x00004002
+BBG_PMMR_D_PMSR2:       .long  0xfc21a7ff
+BBG_PMSR2_D:            .long  0x03de5800
+BBG_PMMR_D_PMSR3:       .long  0xfffffff8
+BBG_PMSR3_D:            .long  0x00000007
+BBG_PMMR_D_PMSR4:       .long  0xdffdfff9
+BBG_PMSR4_D:            .long  0x20020006
+BBG_PMMR_D_PMSRG:       .long  0xffffffff
+BBG_PMSRG_D:            .long  0x00000000
+
+FRQCR_A:                               .long   FRQCR
+DLLCSR_A:                              .long   0xffc40010
+FRQCR_D:                               .long   0x40233035
+DLLCSR_D:                              .long   0x00000000
+
+/* for DDR-SDRAM */
+MIM_U_A:                               .long   MIM_1
+MIM_L_A:                               .long   MIM_2
+SCR_U_A:                               .long   SCR_1
+SCR_L_A:                               .long   SCR_2
+STR_U_A:                               .long   STR_1
+STR_L_A:                               .long   STR_2
+SDR_U_A:                               .long   SDR_1
+SDR_L_A:                               .long   SDR_2
+
+EMRS_A:                                        .long   0xFEC02000
+MRS1_A:                                        .long   0xFEC00B08
+MRS2_A:                                        .long   0xFEC00308
+
+MIM_U_D:                               .long   0x00004000
+MIM_L_D0:                              .long   0x03e80009
+MIM_L_D1:                              .long   0x03e80209
+SCR_L_D0:                              .long   0x3
+SCR_L_D1:                              .long   0x2
+SCR_L_D2:                              .long   0x2
+SCR_L_D3:                              .long   0x4
+SCR_L_D4:                              .long   0x4
+SCR_L_D5:                              .long   0x0
+STR_L_D:                               .long   0x000f0000
+SDR_L_D:                               .long   0x00000400
+EMRS_D:                                        .long   0x0
+MRS1_D:                                        .long   0x0
+MRS2_D:                                        .long   0x0
+
+/* Cache Controller */
+CCR_A:         .long   CCR
+MMUCR_A:       .long   MMUCR
+RWTCNT_A:      .long   WTCNT
+
+CCR_D:         .long   0x0000090b
+CCR_D_2:       .long   0x00000103
+MMUCR_D:       .long   0x00000004
+MSTPCR0_D:     .long   0x00001001
+MSTPCR2_D:     .long   0xffffffff
+
+/* local Bus State Controller */
+MMSELR_A:   .long   MMSELR
+BCR_A:      .long   BCR
+CS0BCR_A:   .long   CS0BCR
+CS1BCR_A:   .long   CS1BCR
+CS2BCR_A:   .long   CS2BCR
+CS4BCR_A:   .long   CS4BCR
+CS5BCR_A:   .long   CS5BCR
+CS6BCR_A:   .long   CS6BCR
+CS0WCR_A:   .long   CS0WCR
+CS1WCR_A:   .long   CS1WCR
+CS2WCR_A:   .long   CS2WCR
+CS4WCR_A:   .long   CS4WCR
+CS5WCR_A:   .long   CS5WCR
+CS6WCR_A:   .long   CS6WCR
+CS5PCR_A:   .long   CS5PCR
+CS6PCR_A:   .long   CS6PCR
+
+MMSELR_D:              .long   0xA5A50003
+BCR_D:                 .long   0x00000000
+CS0BCR_D:              .long   0x77777770
+CS1BCR_D:              .long   0x77777670
+CS2BCR_D:              .long   0x77777770
+CS4BCR_D:              .long   0x77777770
+CS5BCR_D:              .long   0x77777670
+CS6BCR_D:              .long   0x77777770
+CS0WCR_D:              .long   0x00020006
+CS1WCR_D:              .long   0x00232304
+CS2WCR_D:              .long   0x7777770F
+CS4WCR_D:              .long   0x7777770F
+CS5WCR_D:              .long   0x00101006
+CS6WCR_D:              .long   0x77777703
+CS5PCR_D:              .long   0x77000000
+CS6PCR_D:              .long   0x77000000
+
+REPEAT0_R3:    .long   0x00002000
+REPEAT0_R1:    .long   0x0000200
diff --git a/board/r7780mp/r7780mp.c b/board/r7780mp/r7780mp.c
new file mode 100644 (file)
index 0000000..1a37711
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * 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 <common.h>
+#include <ide.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <asm/pci.h>
+#include "r7780mp.h"
+
+int checkboard(void)
+{
+#if defined(CONFIG_R7780MP)
+       puts("BOARD: Renesas Solutions R7780MP\n");
+#else
+       puts("BOARD: Renesas Solutions R7780RP\n");
+#endif
+       return 0;
+}
+
+int board_init(void)
+{
+       /* SCIF Enable */
+       *(vu_short*)PHCR = 0x0000;
+
+       return 0;
+}
+
+int dram_init (void)
+{
+       DECLARE_GLOBAL_DATA_PTR;
+
+       gd->bd->bi_memstart = CFG_SDRAM_BASE;
+       gd->bd->bi_memsize = CFG_SDRAM_SIZE;
+       printf("DRAM:  %dMB\n", CFG_SDRAM_SIZE / (1024 * 1024));
+       return 0;
+}
+
+void led_set_state (unsigned short value)
+{
+
+}
+
+void ide_set_reset (int idereset)
+{
+       /* if reset = 1 IDE reset will be asserted */
+       if (idereset){
+               (*(vu_short *)FPGA_CFCTL) = 0x432;
+#if defined(CONFIG_R7780MP)
+               (*(vu_short *)FPGA_CFPOW) |= 0x01;
+#else
+               (*(vu_short *)FPGA_CFPOW) |= 0x02;
+#endif
+               (*(vu_short *)FPGA_CFCDINTCLR) = 0x01;
+       }
+}
+
+#if defined(CONFIG_PCI)
+static struct pci_controller hose;
+void pci_init_board(void)
+{
+       pci_sh7780_init( &hose );
+}
+#endif
diff --git a/board/r7780mp/r7780mp.h b/board/r7780mp/r7780mp.h
new file mode 100644 (file)
index 0000000..476a413
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2007 Nobuhiro Iwamatsu
+ * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * u-boot/board/r7780mp/r7780mp.h
+ *
+ * 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
+ */
+
+#ifndef _BOARD_R7780MP_R7780MP_H_
+#define _BOARD_R7780MP_R7780MP_H_
+
+/* R7780MP's FPGA register map */
+#define FPGA_BASE          0xa4000000
+#define FPGA_IRLMSK        (FPGA_BASE + 0x00)
+#define FPGA_IRLMON        (FPGA_BASE + 0x02)
+#define FPGA_IRLPRI1       (FPGA_BASE + 0x04)
+#define FPGA_IRLPRI2       (FPGA_BASE + 0x06)
+#define FPGA_IRLPRI3       (FPGA_BASE + 0x08)
+#define FPGA_IRLPRI4       (FPGA_BASE + 0x0A)
+#define FPGA_RSTCTL        (FPGA_BASE + 0x0C)
+#define FPGA_PCIBD         (FPGA_BASE + 0x0E)
+#define FPGA_PCICD         (FPGA_BASE + 0x10)
+#define FPGA_EXTGIO        (FPGA_BASE + 0x16)
+#define FPGA_IVDRMON       (FPGA_BASE + 0x18)
+#define FPGA_IVDRCR        (FPGA_BASE + 0x1A)
+#define FPGA_OBLED         (FPGA_BASE + 0x1C)
+#define FPGA_OBSW          (FPGA_BASE + 0x1E)
+#define FPGA_TPCTL         (FPGA_BASE + 0x100)
+#define FPGA_TPDCKCTL      (FPGA_BASE + 0x102)
+#define FPGA_TPCLR         (FPGA_BASE + 0x104)
+#define FPGA_TPXPOS        (FPGA_BASE + 0x106)
+#define FPGA_TPYPOS        (FPGA_BASE + 0x108)
+#define FPGA_DBSW          (FPGA_BASE + 0x200)
+#define FPGA_VERSION       (FPGA_BASE + 0x700)
+#define FPGA_CFCTL         (FPGA_BASE + 0x300)
+#define FPGA_CFPOW         (FPGA_BASE + 0x302)
+#define FPGA_CFCDINTCLR    (FPGA_BASE + 0x304)
+#define FPGA_PMR           (FPGA_BASE + 0x900)
+
+#endif /* _BOARD_R7780RP_R7780RP_H_ */
diff --git a/board/r7780mp/u-boot.lds b/board/r7780mp/u-boot.lds
new file mode 100644 (file)
index 0000000..e7499e5
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyrigth (c) 2007,2008
+ * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+OUTPUT_ARCH(sh)
+ENTRY(_start)
+
+SECTIONS
+{
+       /*
+          Base address of internal SDRAM is 0x0C000000.
+          Although size of SDRAM can be either 16 or 32 MBytes,
+          we assume 16 MBytes (ie ignore upper half if the full
+          32 MBytes is present).
+
+          NOTE: This address must match with the definition of
+          TEXT_BASE in config.mk (in this directory).
+
+       */
+       . = 0x08000000 + (128*1024*1024) - (256*1024);
+
+       PROVIDE (reloc_dst = .);
+
+       PROVIDE (_ftext = .);
+       PROVIDE (_fcode = .);
+       PROVIDE (_start = .);
+
+       .text :
+       {
+               cpu/sh4/start.o         (.text)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenv)
+               . = ALIGN(8192);
+               common/environment.o    (.ppcenvr)
+               . = ALIGN(8192);
+               *(.text)
+               . = ALIGN(4);
+       } =0xFF
+       PROVIDE (_ecode = .);
+       .rodata :
+       {
+               *(.rodata)
+               . = ALIGN(4);
+       }
+       PROVIDE (_etext = .);
+
+
+       PROVIDE (_fdata = .);
+       .data :
+       {
+               *(.data)
+               . = ALIGN(4);
+       }
+       PROVIDE (_edata = .);
+
+       PROVIDE (_fgot = .);
+       .got :
+       {
+               *(.got)
+               . = ALIGN(4);
+       }
+       PROVIDE (_egot = .);
+
+       PROVIDE (__u_boot_cmd_start = .);
+       .u_boot_cmd :
+       {
+               *(.u_boot_cmd)
+               . = ALIGN(4);
+       }
+       PROVIDE (__u_boot_cmd_end = .);
+
+       PROVIDE (reloc_dst_end = .);
+       /* _reloc_dst_end = .; */
+
+       PROVIDE (bss_start = .);
+       PROVIDE (__bss_start = .);
+       .bss :
+       {
+               *(.bss)
+               . = ALIGN(4);
+       }
+       PROVIDE (bss_end = .);
+
+       PROVIDE (_end = .);
+}
index bff3cefda94934770c47f3267abfb8e9cb07c41f..36de78d270877ebaa8727c5db81878d2e135d1f2 100644 (file)
@@ -42,6 +42,30 @@ int checkcpu(void)
        u32 pvr = get_pvr();
        u32 spridr;
        char buf[32];
+       int i;
+
+#define CPU_TYPE_ENTRY(x) {#x, SPR_##x}
+       const struct cpu_type {
+               char name[15];
+               u32 partid;
+       } cpu_type_list [] = {
+               CPU_TYPE_ENTRY(8311),
+               CPU_TYPE_ENTRY(8313),
+               CPU_TYPE_ENTRY(8314),
+               CPU_TYPE_ENTRY(8315),
+               CPU_TYPE_ENTRY(8321),
+               CPU_TYPE_ENTRY(8323),
+               CPU_TYPE_ENTRY(8343),
+               CPU_TYPE_ENTRY(8347_TBGA_),
+               CPU_TYPE_ENTRY(8347_PBGA_),
+               CPU_TYPE_ENTRY(8349),
+               CPU_TYPE_ENTRY(8358_TBGA_),
+               CPU_TYPE_ENTRY(8358_PBGA_),
+               CPU_TYPE_ENTRY(8360),
+               CPU_TYPE_ENTRY(8377),
+               CPU_TYPE_ENTRY(8378),
+               CPU_TYPE_ENTRY(8379),
+       };
 
        immr = (immap_t *)CFG_IMMR;
 
@@ -69,130 +93,26 @@ int checkcpu(void)
        }
 
        spridr = immr->sysconf.spridr;
-       switch(spridr) {
-       case SPR_8349E_REV10:
-       case SPR_8349E_REV11:
-       case SPR_8349E_REV31:
-               puts("MPC8349E, ");
-               break;
-       case SPR_8349_REV10:
-       case SPR_8349_REV11:
-       case SPR_8349_REV31:
-               puts("MPC8349, ");
-               break;
-       case SPR_8347E_REV10_TBGA:
-       case SPR_8347E_REV11_TBGA:
-       case SPR_8347E_REV31_TBGA:
-       case SPR_8347E_REV10_PBGA:
-       case SPR_8347E_REV11_PBGA:
-       case SPR_8347E_REV31_PBGA:
-               puts("MPC8347E, ");
-               break;
-       case SPR_8347_REV10_TBGA:
-       case SPR_8347_REV11_TBGA:
-       case SPR_8347_REV31_TBGA:
-       case SPR_8347_REV10_PBGA:
-       case SPR_8347_REV11_PBGA:
-       case SPR_8347_REV31_PBGA:
-               puts("MPC8347, ");
-               break;
-       case SPR_8343E_REV10:
-       case SPR_8343E_REV11:
-       case SPR_8343E_REV31:
-               puts("MPC8343E, ");
-               break;
-       case SPR_8343_REV10:
-       case SPR_8343_REV11:
-       case SPR_8343_REV31:
-               puts("MPC8343, ");
-               break;
-       case SPR_8360E_REV10:
-       case SPR_8360E_REV11:
-       case SPR_8360E_REV12:
-       case SPR_8360E_REV20:
-       case SPR_8360E_REV21:
-               puts("MPC8360E, ");
-               break;
-       case SPR_8360_REV10:
-       case SPR_8360_REV11:
-       case SPR_8360_REV12:
-       case SPR_8360_REV20:
-       case SPR_8360_REV21:
-               puts("MPC8360, ");
-               break;
-       case SPR_8323E_REV10:
-       case SPR_8323E_REV11:
-               puts("MPC8323E, ");
-               break;
-       case SPR_8323_REV10:
-       case SPR_8323_REV11:
-               puts("MPC8323, ");
-               break;
-       case SPR_8321E_REV10:
-       case SPR_8321E_REV11:
-               puts("MPC8321E, ");
-               break;
-       case SPR_8321_REV10:
-       case SPR_8321_REV11:
-               puts("MPC8321, ");
-               break;
-       case SPR_8311_REV10:
-               puts("MPC8311, ");
-               break;
-       case SPR_8311E_REV10:
-               puts("MPC8311E, ");
-               break;
-       case SPR_8313_REV10:
-               puts("MPC8313, ");
-               break;
-       case SPR_8313E_REV10:
-               puts("MPC8313E, ");
-               break;
-       case SPR_8315E_REV10:
-               puts("MPC8315E, ");
-               break;
-       case SPR_8315_REV10:
-               puts("MPC8315, ");
-               break;
-       case SPR_8314E_REV10:
-               puts("MPC8314E, ");
-               break;
-       case SPR_8314_REV10:
-               puts("MPC8314, ");
-               break;
-       case SPR_8379E_REV10:
-               puts("MPC8379E, ");
-               break;
-       case SPR_8379_REV10:
-               puts("MPC8379, ");
-               break;
-       case SPR_8378E_REV10:
-               puts("MPC8378E, ");
-               break;
-       case SPR_8378_REV10:
-               puts("MPC8378, ");
-               break;
-       case SPR_8377E_REV10:
-               puts("MPC8377E, ");
-               break;
-       case SPR_8377_REV10:
-               puts("MPC8377, ");
-               break;
-       default:
-               printf("Rev: Unknown revision number:%08x\n"
-                       "Warning: Unsupported cpu revision!\n",spridr);
-               return 0;
-       }
 
-#if defined(CONFIG_MPC834X)
-       /* Multiple revisons of 834x processors may have the same SPRIDR value.
-        * So use PVR to identify the revision number.
-        */
-       printf("Rev: %02x at %s MHz", PVR_MAJ(pvr)<<4 | PVR_MIN(pvr), strmhz(buf, clock));
-#else
-       printf("Rev: %02x at %s MHz", spridr & 0x0000FFFF, strmhz(buf, clock));
-#endif
-       printf(", CSB: %4d MHz\n", gd->csb_clk / 1000000);
+       for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++)
+               if (cpu_type_list[i].partid == PARTID_NO_E(spridr)) {
+                       puts("MPC");
+                       puts(cpu_type_list[i].name);
+                       if (IS_E_PROCESSOR(spridr))
+                               puts("E");
+                       if (REVID_MAJOR(spridr) >= 2)
+                               puts("A");
+                       printf(", Rev: %d.%d", REVID_MAJOR(spridr),
+                              REVID_MINOR(spridr));
+                       break;
+               }
+
+       if (i == ARRAY_SIZE(cpu_type_list))
+               printf("(SPRIDR %08x unknown), ", spridr);
+
+       printf(" at %s MHz, ", strmhz(buf, clock));
+
+       printf("CSB: %s MHz\n", strmhz(buf, gd->csb_clk));
 
        return 0;
 }
index 0acca4771783dc30f6a0953968732828f4523915..97ac7bb3d95a0f00bafe5745c9e8b4eb43ca72e0 100644 (file)
 #include <asm/mmu.h>
 #include <spd_sdram.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 void board_add_ram_info(int use_default)
 {
        volatile immap_t *immap = (immap_t *) CFG_IMMR;
        volatile ddr83xx_t *ddr = &immap->ddr;
+       char buf[32];
 
        printf(" (DDR%d", ((ddr->sdram_cfg & SDRAM_CFG_SDRAM_TYPE_MASK)
                           >> SDRAM_CFG_SDRAM_TYPE_SHIFT) - 1);
@@ -48,9 +51,11 @@ void board_add_ram_info(int use_default)
                puts(", 64-bit");
 
        if (ddr->sdram_cfg & SDRAM_CFG_ECC_EN)
-               puts(", ECC on)");
+               puts(", ECC on");
        else
-               puts(", ECC off)");
+               puts(", ECC off");
+
+       printf(", %s MHz)", strmhz(buf, gd->mem_clk));
 
 #if defined(CFG_LB_SDRAM) && defined(CFG_LBC_SDRAM_SIZE)
        puts("\nSDRAM: ");
@@ -60,8 +65,6 @@ void board_add_ram_info(int use_default)
 
 #ifdef CONFIG_SPD_EEPROM
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRC)
 extern void dma_init(void);
 extern uint dma_check(void);
@@ -78,12 +81,12 @@ extern int dma_xfer(void *dest, uint count, void *src);
 int
 picos_to_clk(int picos)
 {
-       unsigned int ddr_bus_clk;
+       unsigned int mem_bus_clk;
        int clks;
 
-       ddr_bus_clk = gd->ddr_clk >> 1;
-       clks = picos / (1000000000 / (ddr_bus_clk / 1000));
-       if (picos % (1000000000 / (ddr_bus_clk / 1000)) != 0)
+       mem_bus_clk = gd->mem_clk >> 1;
+       clks = picos / (1000000000 / (mem_bus_clk / 1000));
+       if (picos % (1000000000 / (mem_bus_clk / 1000)) != 0)
                clks++;
 
        return clks;
@@ -313,7 +316,7 @@ long int spd_sdram()
 
        debug("DDR:Module maximum data rate is: %dMhz\n", max_data_rate);
 
-       ddrc_clk = gd->ddr_clk / 1000000;
+       ddrc_clk = gd->mem_clk / 1000000;
        effective_data_rate = 0;
 
        if (max_data_rate >= 390 && max_data_rate < 460) { /* it is DDR 400 */
index f598699b2c6271564850c8ae5e549072fd39cd1b..16145dd355f8f7084d5a3787000ab2f741fac442 100644 (file)
@@ -122,9 +122,9 @@ int get_clocks(void)
        u32 enc_clk;
        u32 lbiu_clk;
        u32 lclk_clk;
-       u32 ddr_clk;
+       u32 mem_clk;
 #if defined(CONFIG_MPC8360)
-       u32 ddr_sec_clk;
+       u32 mem_sec_clk;
 #endif
 #if defined(CONFIG_MPC8360) || defined(CONFIG_MPC832X)
        u32 qepmf;
@@ -400,11 +400,11 @@ int get_clocks(void)
                return -12;
        }
 
-       ddr_clk = csb_clk *
+       mem_clk = csb_clk *
                  (1 + ((im->reset.rcwl & HRCWL_DDRCM) >> HRCWL_DDRCM_SHIFT));
        corepll = (im->reset.rcwl & HRCWL_COREPLL) >> HRCWL_COREPLL_SHIFT;
 #if defined(CONFIG_MPC8360)
-       ddr_sec_clk = csb_clk * (1 +
+       mem_sec_clk = csb_clk * (1 +
                       ((im->reset.rcwl & HRCWL_LBIUCM) >> HRCWL_LBIUCM_SHIFT));
 #endif
 
@@ -466,9 +466,9 @@ int get_clocks(void)
        gd->enc_clk = enc_clk;
        gd->lbiu_clk = lbiu_clk;
        gd->lclk_clk = lclk_clk;
-       gd->ddr_clk = ddr_clk;
+       gd->mem_clk = mem_clk;
 #if defined(CONFIG_MPC8360)
-       gd->ddr_sec_clk = ddr_sec_clk;
+       gd->mem_sec_clk = mem_sec_clk;
 #endif
 #if defined(CONFIG_MPC8360) || defined(CONFIG_MPC832X)
        gd->qe_clk = qe_clk;
@@ -508,9 +508,9 @@ int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 #endif
        printf("  Local Bus Controller:%4d MHz\n", gd->lbiu_clk / 1000000);
        printf("  Local Bus:           %4d MHz\n", gd->lclk_clk / 1000000);
-       printf("  DDR:                 %4d MHz\n", gd->ddr_clk / 1000000);
+       printf("  DDR:                 %4d MHz\n", gd->mem_clk / 1000000);
 #if defined(CONFIG_MPC8360)
-       printf("  DDR Secondary:       %4d MHz\n", gd->ddr_sec_clk / 1000000);
+       printf("  DDR Secondary:       %4d MHz\n", gd->mem_sec_clk / 1000000);
 #endif
        printf("  SEC:                 %4d MHz\n", gd->enc_clk / 1000000);
        printf("  I2C1:                %4d MHz\n", gd->i2c1_clk / 1000000);
index 309eb30e8e97b423218d5f5f761461c5fedf1e3b..fdf9d35e25688e6667a4189dbc96acef2148304a 100644 (file)
@@ -172,8 +172,11 @@ boot_warm: /* time t 5 */
        /* there and deflate the flash size back to minimal size      */
        /*------------------------------------------------------------*/
        bl map_flash_by_law1
-       lis r4, (CFG_MONITOR_BASE)@h
-       ori r4, r4, (CFG_MONITOR_BASE)@l
+
+       GET_GOT                 /* initialize GOT access        */
+       lwz r4, GOT(_start)
+       addi r4, r4, -EXC_OFF_SYS_RESET
+
        addi r5, r4, in_flash - _start + EXC_OFF_SYS_RESET
        mtlr r5
        blr
@@ -872,8 +875,8 @@ relocate_code:
        mr      r10, r5         /* Save copy of Destination Address */
 
        mr      r3,  r5                         /* Destination Address */
-       lis     r4, CFG_MONITOR_BASE@h          /* Source      Address */
-       ori     r4, r4, CFG_MONITOR_BASE@l
+       lwz     r4, GOT(_start)
+       addi    r4, r4, -EXC_OFF_SYS_RESET
        lwz     r5, GOT(__init_end)
        sub     r5, r5, r4
        li      r6, CFG_CACHELINE_SIZE          /* Cache Line Size */
index d990250fcb3b23e8e05247a871aa03d190159a48..007cb4f1ecf64ed6b46a23b3716c1f9208db2751 100644 (file)
@@ -274,7 +274,7 @@ static void emac_loopback_disable(EMAC_4XX_HW_PST hw_p)
 static void ppc_4xx_eth_halt (struct eth_device *dev)
 {
        EMAC_4XX_HW_PST hw_p = dev->priv;
-       uint32_t failsafe = 10000;
+       u32 val = 10000;
 
        out_be32((void *)EMAC_IER + hw_p->hw_addr, 0x00000000); /* disable emac interrupts */
 
@@ -290,8 +290,8 @@ static void ppc_4xx_eth_halt (struct eth_device *dev)
        /* wait for reset */
        while (mfdcr (malrxcasr) & (MAL_CR_MMSR >> hw_p->devnum)) {
                udelay (1000);  /* Delay 1 MS so as not to hammer the register */
-               failsafe--;
-               if (failsafe == 0)
+               val--;
+               if (val == 0)
                        break;
        }
 
@@ -308,6 +308,13 @@ static void ppc_4xx_eth_halt (struct eth_device *dev)
        hw_p->print_speed = 1;  /* print speed message again next time */
 #endif
 
+#if defined(CONFIG_460EX) || defined(CONFIG_460GT)
+       /* don't bypass the TAHOE0/TAHOE1 cores for Linux */
+       mfsdr(SDR0_ETH_CFG, val);
+       val &= ~(SDR0_ETH_CFG_TAHOE0_BYPASS | SDR0_ETH_CFG_TAHOE1_BYPASS);
+       mtsdr(SDR0_ETH_CFG, val);
+#endif
+
        return;
 }
 
@@ -494,11 +501,18 @@ int ppc_4xx_eth_setup_bridge(int devnum, bd_t * bis)
        u32 zmiifer;            /* ZMII0_FER reg. */
        u32 rmiifer;            /* RGMII0_FER reg. Bridge 0 */
        u32 rmiifer1;           /* RGMII0_FER reg. Bridge 1 */
+       int mode;
 
        zmiifer  = 0;
        rmiifer  = 0;
        rmiifer1 = 0;
 
+#if defined(CONFIG_460EX)
+       mode = 9;
+#else
+       mode = 10;
+#endif
+
        /* TODO:
         * NOTE: 460GT has 2 RGMII bridge cores:
         *              emac0 ------ RGMII0_BASE
@@ -520,7 +534,7 @@ int ppc_4xx_eth_setup_bridge(int devnum, bd_t * bis)
         * Right now only 2*RGMII is supported. Please extend when needed.
         * sr - 2008-02-19
         */
-       switch (9) {
+       switch (mode) {
        case 1:
                /* 1 MII - 460EX */
                /* GMC0 EMAC4_0, ZMII Bridge */
@@ -703,6 +717,11 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
 #ifdef CONFIG_4xx_DCACHE
        static u32 last_used_ea = 0;
 #endif
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
+    defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
+    defined(CONFIG_405EX)
+       int rgmii_channel;
+#endif
 
        EMAC_4XX_HW_PST hw_p = dev->priv;
 
@@ -836,10 +855,12 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
                reg = CONFIG_PHY1_ADDR;
                break;
 #endif
-#if defined (CONFIG_440GX)
+#if defined (CONFIG_PHY2_ADDR)
        case 2:
                reg = CONFIG_PHY2_ADDR;
                break;
+#endif
+#if defined (CONFIG_PHY3_ADDR)
        case 3:
                reg = CONFIG_PHY3_ADDR;
                break;
@@ -1006,12 +1027,17 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
 #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
     defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
     defined(CONFIG_405EX)
+       if (devnum >= 2)
+               rgmii_channel = devnum - 2;
+       else
+               rgmii_channel = devnum;
+
        if (speed == 1000)
-               reg = (RGMII_SSR_SP_1000MBPS << RGMII_SSR_V (devnum));
+               reg = (RGMII_SSR_SP_1000MBPS << RGMII_SSR_V(rgmii_channel));
        else if (speed == 100)
-               reg = (RGMII_SSR_SP_100MBPS << RGMII_SSR_V (devnum));
+               reg = (RGMII_SSR_SP_100MBPS << RGMII_SSR_V(rgmii_channel));
        else if (speed == 10)
-               reg = (RGMII_SSR_SP_10MBPS << RGMII_SSR_V (devnum));
+               reg = (RGMII_SSR_SP_10MBPS << RGMII_SSR_V(rgmii_channel));
        else {
                printf("Error in RGMII Speed\n");
                return -1;
@@ -1131,7 +1157,7 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
 #endif
 
 #if defined(CONFIG_460EX) || defined(CONFIG_460GT)
-               mtdcr (malrxctp8r, hw_p->rx);
+               mtdcr (malrxctp8r, hw_p->rx_phys);
                /* set RX buffer size */
                mtdcr (malrcbs8, ENET_MAX_MTU_ALIGNED / 16);
 #else
@@ -1160,6 +1186,26 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
                mtdcr (malrcbs3, ENET_MAX_MTU_ALIGNED / 16);
                break;
 #endif /* CONFIG_440GX */
+#if defined (CONFIG_460GT)
+       case 2:
+               /* setup MAL tx & rx channel pointers */
+               mtdcr (maltxbattr, 0x0);
+               mtdcr (malrxbattr, 0x0);
+               mtdcr (maltxctp2r, hw_p->tx_phys);
+               mtdcr (malrxctp16r, hw_p->rx_phys);
+               /* set RX buffer size */
+               mtdcr (malrcbs16, ENET_MAX_MTU_ALIGNED / 16);
+               break;
+       case 3:
+               /* setup MAL tx & rx channel pointers */
+               mtdcr (maltxbattr, 0x0);
+               mtdcr (malrxbattr, 0x0);
+               mtdcr (maltxctp3r, hw_p->tx_phys);
+               mtdcr (malrxctp24r, hw_p->rx_phys);
+               /* set RX buffer size */
+               mtdcr (malrcbs24, ENET_MAX_MTU_ALIGNED / 16);
+               break;
+#endif /* CONFIG_460GT */
        case 0:
        default:
                /* setup MAL tx & rx channel pointers */
@@ -1866,14 +1912,22 @@ int ppc_4xx_eth_initialize (bd_t * bis)
                case 2:
                        memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
                               bis->bi_enet2addr, 6);
+#if defined(CONFIG_460GT)
+                       hw_addr[eth_num] = 0x300;
+#else
                        hw_addr[eth_num] = 0x400;
+#endif
                        break;
 #endif
 #ifdef CONFIG_HAS_ETH3
                case 3:
                        memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
                               bis->bi_enet3addr, 6);
+#if defined(CONFIG_460GT)
+                       hw_addr[eth_num] = 0x400;
+#else
                        hw_addr[eth_num] = 0x600;
+#endif
                        break;
 #endif
                }
index 5d15e2f2a039af0cbd1a0dca21db99dcd4ce5a60..42eabfe568a5b6b0d48a5ebb8eb9bf435dcfe1f3 100644 (file)
@@ -99,10 +99,107 @@ DECLARE_GLOBAL_DATA_PTR;
 # endif
 #endif /* CFG_INIT_DCACHE_CS */
 
+#ifndef CFG_PLL_RECONFIG
+#define CFG_PLL_RECONFIG       0
+#endif
+
+void reconfigure_pll(u32 new_cpu_freq)
+{
+#if defined(CONFIG_440EPX)
+       int     reset_needed = 0;
+       u32     reg, temp;
+       u32     prbdv0, target_prbdv0,                          /* CLK_PRIMBD */
+               fwdva, target_fwdva, fwdvb, target_fwdvb,       /* CLK_PLLD */
+               fbdv, target_fbdv, lfbdv, target_lfbdv,
+               perdv0, target_perdv0,                          /* CLK_PERD */
+               spcid0, target_spcid0;                          /* CLK_SPCID */
+
+       /* Reconfigure clocks if necessary.
+        * See PPC440EPx User's Manual, sections 8.2 and 14 */
+       if (new_cpu_freq == 667) {
+               target_prbdv0 = 2;
+               target_fwdva = 2;
+               target_fwdvb = 4;
+               target_fbdv = 20;
+               target_lfbdv = 1;
+               target_perdv0 = 4;
+               target_spcid0 = 4;
+
+               mfcpr(clk_primbd, reg);
+               temp = (reg & PRBDV_MASK) >> 24;
+               prbdv0 = temp ? temp : 8;
+               if (prbdv0 != target_prbdv0) {
+                       reg &= ~PRBDV_MASK;
+                       reg |= ((target_prbdv0 == 8 ? 0 : target_prbdv0) << 24);
+                       mtcpr(clk_primbd, reg);
+                       reset_needed = 1;
+               }
+
+               mfcpr(clk_plld, reg);
+
+               temp = (reg & PLLD_FWDVA_MASK) >> 16;
+               fwdva = temp ? temp : 16;
+
+               temp = (reg & PLLD_FWDVB_MASK) >> 8;
+               fwdvb = temp ? temp : 8;
+
+               temp = (reg & PLLD_FBDV_MASK) >> 24;
+               fbdv = temp ? temp : 32;
+
+               temp = (reg & PLLD_LFBDV_MASK);
+               lfbdv = temp ? temp : 64;
+
+               if (fwdva != target_fwdva || fbdv != target_fbdv || lfbdv != target_lfbdv) {
+                       reg &= ~(PLLD_FWDVA_MASK | PLLD_FWDVB_MASK |
+                                PLLD_FBDV_MASK | PLLD_LFBDV_MASK);
+                       reg |= ((target_fwdva == 16 ? 0 : target_fwdva) << 16) |
+                               ((target_fwdvb == 8 ? 0 : target_fwdvb) << 8) |
+                               ((target_fbdv == 32 ? 0 : target_fbdv) << 24) |
+                               (target_lfbdv == 64 ? 0 : target_lfbdv);
+                       mtcpr(clk_plld, reg);
+                       reset_needed = 1;
+               }
+
+               mfcpr(clk_perd, reg);
+               perdv0 = (reg & CPR0_PERD_PERDV0_MASK) >> 24;
+               if (perdv0 != target_perdv0) {
+                       reg &= ~CPR0_PERD_PERDV0_MASK;
+                       reg |= (target_perdv0 << 24);
+                       mtcpr(clk_perd, reg);
+                       reset_needed = 1;
+               }
+
+               mfcpr(clk_spcid, reg);
+               temp = (reg & CPR0_SPCID_SPCIDV0_MASK) >> 24;
+               spcid0 = temp ? temp : 4;
+               if (spcid0 != target_spcid0) {
+                       reg &= ~CPR0_SPCID_SPCIDV0_MASK;
+                       reg |= ((target_spcid0 == 4 ? 0 : target_spcid0) << 24);
+                       mtcpr(clk_spcid, reg);
+                       reset_needed = 1;
+               }
+
+               /* Set reload inhibit so configuration will persist across
+                * processor resets */
+               mfcpr(clk_icfg, reg);
+               reg &= ~CPR0_ICFG_RLI_MASK;
+               reg |= 1 << 31;
+               mtcpr(clk_icfg, reg);
+       }
+
+       /* Reset processor if configuration changed */
+       if (reset_needed) {
+               __asm__ __volatile__ ("sync; isync");
+               mtspr(dbcr0, 0x20000000);
+       }
+#endif
+}
+
 /*
  * Breath some life into the CPU...
  *
- * Set up the memory map,
+ * Reconfigure PLL if necessary,
+ * set up the memory map,
  * initialize a bunch of registers
  */
 void
@@ -111,6 +208,7 @@ cpu_init_f (void)
 #if defined(CONFIG_WATCHDOG)
        unsigned long val;
 #endif
+       reconfigure_pll(CFG_PLL_RECONFIG);
 
 #if (defined(CONFIG_405EP) || defined (CONFIG_405EX)) && !defined(CFG_4xx_GPIO_TABLE)
        /*
@@ -135,6 +233,7 @@ cpu_init_f (void)
 #if defined (CFG_GPIO0_TCR)
        out32(GPIO0_TCR, CFG_GPIO0_TCR);        /* enable output driver for outputs     */
 #endif
+#endif /* CONFIG_405EP ... && !CFG_4xx_GPIO_TABLE */
 
 #if defined (CONFIG_405EP)
        /*
@@ -147,7 +246,6 @@ cpu_init_f (void)
         */
        mtdcr(cpc0_pci, mfdcr(cpc0_pci) | CPC0_PCI_HOST_CFG_EN | CPC0_PCI_ARBIT_EN);
 #endif /* CONFIG_405EP */
-#endif /* CONFIG_405EP */
 
 #if defined(CFG_4xx_GPIO_TABLE)
        gpio_set_chip_configuration();
index 60f89c97fc804fdb2e03ff4f320b0bd3b8a9c47e..e20c9ebf879803ff485466a51359914ecfb83f31 100644 (file)
@@ -1093,10 +1093,10 @@ long int initdram(int board_type)
 
        program_ddr0_06(dimm_ranks, iic0_dimm_addr, num_dimm_banks, sdram_freq);
 
-       /*------------------------------------------------------------------
+       /*
         * TODO: tFAW not found in SPD.  Value of 13 taken from Sequoia
-        * board SDRAM, but may be overly concervate.
-        *-----------------------------------------------------------------*/
+        * board SDRAM, but may be overly conservative.
+        */
        mtsdram(DDR0_07, DDR0_07_NO_CMD_INIT_ENCODE(0) |
                DDR0_07_TFAW_ENCODE(13) |
                DDR0_07_AUTO_REFRESH_MODE_ENCODE(1) |
@@ -1181,26 +1181,29 @@ long int initdram(int board_type)
        denali_wait_for_dlllock();
 
 #if defined(CONFIG_DDR_DATA_EYE)
-       /* -----------------------------------------------------------+
-        * Perform data eye search if requested.
-        * ----------------------------------------------------------*/
-       program_tlb(0, CFG_SDRAM_BASE, dram_size, TLB_WORD2_I_ENABLE);
+       /*
+        * Map the first 1 MiB of memory in the TLB, and perform the data eye
+        * search.
+        */
+       program_tlb(0, CFG_SDRAM_BASE, TLB_1MB_SIZE, TLB_WORD2_I_ENABLE);
        denali_core_search_data_eye();
        denali_sdram_register_dump();
-       remove_tlb(CFG_SDRAM_BASE, dram_size);
+       remove_tlb(CFG_SDRAM_BASE, TLB_1MB_SIZE);
 #endif
 
 #if defined(CONFIG_ZERO_SDRAM) || defined(CONFIG_DDR_ECC)
        program_tlb(0, CFG_SDRAM_BASE, dram_size, 0);
        sync();
-       eieio();
        /* Zero the memory */
        debug("Zeroing SDRAM...");
-       dcbz_area(CFG_SDRAM_BASE, dram_size);
+#if defined(CFG_MEM_TOP_HIDE)
+       dcbz_area(CFG_SDRAM_BASE, dram_size - CFG_MEM_TOP_HIDE);
+#else
+#error Please define CFG_MEM_TOP_HIDE (see README) in your board config file
+#endif
        dflush();
        debug("Completed\n");
        sync();
-       eieio();
        remove_tlb(CFG_SDRAM_BASE, dram_size);
 
 #if defined(CONFIG_DDR_ECC)
@@ -1211,7 +1214,6 @@ long int initdram(int board_type)
                u32 val;
 
                sync();
-               eieio();
                /* Clear error status */
                mfsdram(DDR0_00, val);
                mtsdram(DDR0_00, val | DDR0_00_INT_ACK_ALL);
@@ -1229,7 +1231,6 @@ long int initdram(int board_type)
                print_mcsr();
 #endif
                sync();
-               eieio();
        }
 #endif /* defined(CONFIG_DDR_ECC) */
 #endif /* defined(CONFIG_ZERO_SDRAM) || defined(CONFIG_DDR_ECC) */
index 698bcb57d7ce9ae5ba9929dafb5ecd3c250672ad..8620e2b48476da48b2ad97f905f1ef9cd562f2a7 100644 (file)
@@ -218,15 +218,16 @@ static void uic_interrupt(u32 uic_base, int vec_base)
                        } else {
                                set_dcr(uic_base + UIC_ER,
                                        get_dcr(uic_base + UIC_ER) &
-                                       ~(0x80000000 >> vec));
+                                       ~(0x80000000 >> (vec & 0x1f)));
                                printf("Masking bogus interrupt vector %d"
                                       " (UIC_BASE=0x%x)\n", vec, uic_base);
                        }
 
                        /*
-                        * After servicing the interrupt, we have to remove the status indicator.
+                        * After servicing the interrupt, we have to remove the
+                        * status indicator
                         */
-                       set_dcr(uic_base + UIC_SR, (0x80000000 >> vec));
+                       set_dcr(uic_base + UIC_SR, (0x80000000 >> (vec & 0x1f)));
                }
 
                /*
index 0ebf95180c302d99d4be34209bf8a72c3304622e..d94e139815e9ac0e063bd644c06e5cd8e5c155d3 100644 (file)
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/cache.h>
 
 int checkcpu(void)
 {
@@ -51,7 +52,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 void flush_cache (unsigned long addr, unsigned long size)
 {
-
+       dcache_invalid_range( addr , addr + size );
 }
 
 void icache_enable (void)
diff --git a/doc/README.korat b/doc/README.korat
new file mode 100644 (file)
index 0000000..0a59f40
--- /dev/null
@@ -0,0 +1,51 @@
+The Korat board has two NOR flashes, FLASH0 and FLASH1, which are connected to
+chip select 0 and 1, respectively.  FLASH0 contains 16 MiB, and is mapped to
+addresses 0xFF000000 - 0xFFFFFFFF as U-Boot Flash Bank #2.  FLASH1 contains
+from 16 to 128 MiB, and is mapped to 0xF?000000 - 0xF7FFFFFF as U-Boot Flash
+Bank #1 (with the starting address depending on the flash size detected at
+runtime).  The write-enable pin on FLASH0 is disabled, so the contents of FLASH0
+cannot be modified in the field.  This also prevents FLASH0 from executing
+commands to return chip information, so its configuration is hard-coded in
+U-Boot.
+
+There are two versions of U-Boot for Korat: "permanent" and "upgradable".  The
+permanent U-Boot is pre-programmed at the top of FLASH0, e.g., at addresses
+0xFFFA0000 - 0xFFFFFFFF for the current 384 KiB size.  The upgradable U-Boot is
+located 256 KiB from the top of FLASH1, e.g. at addresses 0xF7F6000 - 0xF7FC0000
+for the current 384 KiB size.  FLASH1 addresses 0xF7FE0000 - 0xF7FF0000 are
+used for the U-Boot environmental parameters, and addresses 0xF7FC0000 -
+0xF7FDFFFF are used for the redundant copy of the parameters.  These locations
+are used by both versions of U-Boot.
+
+On booting, the permanent U-Boot in FLASH0 begins executing.  After performing
+minimal setup, it monitors the state of the board's Reset switch (GPIO47).  If
+the switch is sensed as open before a timeout period, then U-Boot branches to
+address 0xF7FBFFFC.  This causes the upgradable U-Boot to execute from the
+beginning.  If the switch remains closed thoughout the timeout period, the
+permanent U-Boot activates the on-board buzzer until the switch is sensed as
+opened.  It then continues to execute without branching to FLASH1.  The effect
+of this is that normally the Korat board boots its upgradable U-Boot, but, if
+this has been corrupted, the user can boot the permanent U-Boot, which can then
+be used to erase and reload FLASH1 as needed.
+
+Note that it is not necessary for the permanent U-Boot to have all the latest
+features, but only that it have sufficient functionality (working "tftp",
+"erase", "cp.b", etc.) to repair FLASH1.  Also, the permanent U-Boot makes no
+assumptions about the size of FLASH1 or the size of the upgradable U-Boot: it is
+sufficient that the upgradable U-Boot can be started by a branch to 0xF7FBFFFC.
+
+The build sequence:
+
+       make korat_config
+       make all perm=1
+
+builds the permanent U-Boot by selecting loader file "u-boot.lds" and defining
+preprocessor symbol "CONFIG_KORAT_PERMANENT".  The default build:
+
+       make korat_config
+       make all
+
+creates the upgradable U-Boot but selecting loader file "u-boot-F7FC.lds" and
+leaving preprocessor symbol "CONFIG_KORAT_PERMANENT" undefined.
+
+2008-02-22, Larry Johnson <lrj@acm.org>
index 075d360e90866da190104a2ef2b84791a562e8e8..6baee089e3d947abf8bf230471fdae25ef5db304 100644 (file)
@@ -1,6 +1,6 @@
 
 U-Boot for Renesas SuperH
-       Last update 08/10/2007 by Nobuhiro Iwamatsu
+       Last update 01/18/2008 by Nobuhiro Iwamatsu
 
 ================================================================================
 0. What's this?
@@ -18,7 +18,19 @@ U-Boot for Renesas SuperH
 2. Supported CPUs
 
        2.1. Renesas SH7750/SH7750R
+               This CPU has the SH4 core.
+
        2.2. Renesas SH7722
+               This CPU has the SH4AL-DSP core.
+
+       2.3. Renesas SH7720
+               This CPU has the SH3 core.
+
+       2.4. Renesas SH7710/SH7712
+               This CPU has the SH3-DSP core and Ethernet controller.
+
+       2.5. Renesas SH7780
+               This CPU has the SH4A core.
 
 ================================================================================
 3. Supported Boards
@@ -26,10 +38,42 @@ U-Boot for Renesas SuperH
        3.1. Hitachi UL MS7750SE01/MS7750RSE01
                Board specific code is in board/ms7750se
                To use this board, type "make ms7750se_config".
+               Support devices are :
+                       - SCIF
+                       - SDRAM
+                       - NOR Flash
+                       - Marubun PCMCIA
 
        3.2. Hitachi UL MS7722SE01
                Board specific code is in board/ms7722se
                To use this board, type "make ms7722se_config".
+               Support devices are :
+                       - SCIF
+                       - SDRAM
+                       - NOR Flash
+                       - Marubun PCMCIA
+                       - SMC91x ethernet
+
+       3.2. Hitachi UL MS7720ERP01
+               Board specific code is in board/ms7720se
+               To use this board, type "make ms7720se_config".
+               Support devices are :
+                       - SCIF
+                       - SDRAM
+                       - NOR Flash
+                       - Marubun PCMCIA
+
+       3.3. Renesas R7780MP
+               Board specific code is in board/r7780mp
+               To use this board, type "make r7780mp_config".
+               Support devices are :
+                       - SCIF
+                       - DDR-SDRAM
+                       - NOR Flash
+                       - Compact Flash
+                       - ASIX ethernet
+                       - SH7780 PCI bridge
+                       - RTL8110 ethernet
 
        ** README **
                In SuperH, S-record and binary of made u-boot work on the memory.
@@ -49,13 +93,12 @@ U-Boot for Renesas SuperH
 5. Future
        I plan to support the following CPUs and boards.
                5.1. CPUs
-                       - SH7710/SH7712 (SH3)
-                       - SH7780(SH4)
+                       - SH7751R(SH4)
                        - SH7785(SH4)
 
                5.2. Boards
                        - Many boards ;-)
 
 ================================================================================
-Copyright (c) 2007
+Copyright (c) 2007,2008
     Nobuhiro Iwamatsu <iwamatsu@nigaur.org>
index f04c72d05a33bc6a2c0e2f6cefb660e001994416..40fddcddad5aa0b9edd3b270da059b87e9eba085 100644 (file)
@@ -239,12 +239,14 @@ static u32 flash_read32(void *addr)
        return __raw_readl(addr);
 }
 
-static u64 flash_read64(void *addr)
+static u64 __flash_read64(void *addr)
 {
        /* No architectures currently implement __raw_readq() */
        return *(volatile u64 *)addr;
 }
 
+u64 flash_read64(void *addr)__attribute__((weak, alias("__flash_read64")));
+
 /*-----------------------------------------------------------------------
  */
 #if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
@@ -364,6 +366,20 @@ static inline uchar flash_read_uchar (flash_info_t * info, uint offset)
        return retval;
 }
 
+/*-----------------------------------------------------------------------
+ * read a word at a port width address, assume 16bit bus
+ */
+static inline ushort flash_read_word (flash_info_t * info, uint offset)
+{
+       ushort *addr, retval;
+
+       addr = flash_map (info, 0, offset);
+       retval = flash_read16 (addr);
+       flash_unmap (info, 0, offset, addr);
+       return retval;
+}
+
+
 /*-----------------------------------------------------------------------
  * read a long word by picking the least significant byte of each maximum
  * port size word. Swap for ppc format.
@@ -1449,17 +1465,29 @@ static void cmdset_amd_read_jedec_ids(flash_info_t *info)
        flash_unlock_seq(info, 0);
        flash_write_cmd(info, 0, info->addr_unlock1, FLASH_CMD_READ_ID);
        udelay(1000); /* some flash are slow to respond */
+
        info->manufacturer_id = flash_read_uchar (info,
                                        FLASH_OFFSET_MANUFACTURER_ID);
-       info->device_id = flash_read_uchar (info,
-                                       FLASH_OFFSET_DEVICE_ID);
-       if (info->device_id == 0x7E) {
-               /* AMD 3-byte (expanded) device ids */
-               info->device_id2 = flash_read_uchar (info,
-                                       FLASH_OFFSET_DEVICE_ID2);
-               info->device_id2 <<= 8;
-               info->device_id2 |= flash_read_uchar (info,
-                                       FLASH_OFFSET_DEVICE_ID3);
+
+       switch (info->chipwidth){
+       case FLASH_CFI_8BIT:
+               info->device_id = flash_read_uchar (info,
+                                               FLASH_OFFSET_DEVICE_ID);
+               if (info->device_id == 0x7E) {
+                       /* AMD 3-byte (expanded) device ids */
+                       info->device_id2 = flash_read_uchar (info,
+                                               FLASH_OFFSET_DEVICE_ID2);
+                       info->device_id2 <<= 8;
+                       info->device_id2 |= flash_read_uchar (info,
+                                               FLASH_OFFSET_DEVICE_ID3);
+               }
+               break;
+       case FLASH_CFI_16BIT:
+               info->device_id = flash_read_word (info,
+                                               FLASH_OFFSET_DEVICE_ID);
+               break;
+       default:
+               break;
        }
        flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
 }
index 41aad3bd6a5f28e230aa3e8b695f4dc2319c3eea..b958d1723a2a5acc690d12627670bdffd8a21daa 100644 (file)
@@ -216,6 +216,25 @@ static const struct amd_flash_info jedec_table[] = {
                }
        },
 #endif
+#ifdef CFG_FLASH_LEGACY_512Kx16
+       {
+               .mfr_id         = MANUFACTURER_AMD,
+               .dev_id         = AM29LV400BB,
+               .name           = "AMD AM29LV400BB",
+               .uaddr          = {
+                       [1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+               },
+               .DevSize        = SIZE_512KiB,
+               .CmdSet         = CFI_CMDSET_AMD_LEGACY,
+               .NumEraseRegions= 4,
+               .regions        = {
+                       ERASEINFO(0x04000,1),
+                       ERASEINFO(0x02000,2),
+                       ERASEINFO(0x08000,1),
+                       ERASEINFO(0x10000,7),
+               }
+       },
+#endif
 };
 
 static inline void fill_info(flash_info_t *info, const struct amd_flash_info *jedec_entry, ulong base)
index fe45839466162b36d54a560ae1e8aa2694a8b149..ad1b7ddb43161c9298eaeb1ebddb5c4b9afa9d5c 100644 (file)
@@ -31,6 +31,9 @@ COBJS-y += pci_auto.o
 COBJS-y += pci_indirect.o
 COBJS-y += tsi108_pci.o
 COBJS-y += w83c553f.o
+COBJS-$(CONFIG_SH4_PCI) += pci_sh4.o
+COBJS-$(CONFIG_SH7751_PCI) +=pci_sh7751.o
+COBJS-$(CONFIG_SH7780_PCI) +=pci_sh7780.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/pci/pci_sh4.c b/drivers/pci/pci_sh4.c
new file mode 100644 (file)
index 0000000..1290c0a
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * SH4 PCI Controller (PCIC) for U-Boot.
+ * (C) Dustin McIntire (dustin@sensoria.com)
+ * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * u-boot/cpu/sh4/pci-sh4.c
+ *
+ * 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 <common.h>
+
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <asm/pci.h>
+#include <pci.h>
+
+int pci_sh4_init(struct pci_controller *hose)
+{
+       hose->first_busno = 0;
+       hose->region_count = 0;
+       hose->last_busno = 0xff;
+
+       /* PCI memory space */
+       pci_set_region(hose->regions + 0,
+               CONFIG_PCI_MEM_BUS,
+               CONFIG_PCI_MEM_PHYS,
+               CONFIG_PCI_MEM_SIZE,
+               PCI_REGION_MEM);
+       hose->region_count++;
+
+       /* PCI IO space */
+       pci_set_region(hose->regions + 1,
+               CONFIG_PCI_IO_BUS,
+               CONFIG_PCI_IO_PHYS,
+               CONFIG_PCI_IO_SIZE,
+               PCI_REGION_IO);
+       hose->region_count++;
+
+       udelay(1000);
+
+       pci_set_ops(hose,
+                   pci_hose_read_config_byte_via_dword,
+                   pci_hose_read_config_word_via_dword,
+                   pci_sh4_read_config_dword,
+                   pci_hose_write_config_byte_via_dword,
+                   pci_hose_write_config_word_via_dword,
+                   pci_sh4_write_config_dword);
+
+       pci_register_hose(hose);
+
+       udelay(1000);
+
+#ifdef CONFIG_PCI_SCAN_SHOW
+       printf("PCI:   Bus Dev VenId DevId Class Int\n");
+#endif
+       hose->last_busno = pci_hose_scan(hose);
+       return 0;
+}
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c
new file mode 100644 (file)
index 0000000..a058e1d
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * SH7751 PCI Controller (PCIC) for U-Boot.
+ * (C) Dustin McIntire (dustin@sensoria.com)
+ * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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 <common.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <pci.h>
+
+/* Register addresses and such */
+#define SH7751_BCR1    (vu_long *)0xFF800000
+#define SH7751_BCR2    (vu_short*)0xFF800004
+#define SH7751_WCR1    (vu_long *)0xFF800008
+#define SH7751_WCR2    (vu_long *)0xFF80000C
+#define SH7751_WCR3    (vu_long *)0xFF800010
+#define SH7751_MCR     (vu_long *)0xFF800014
+#define SH7751_BCR3    (vu_short*)0xFF800050
+#define SH7751_PCICONF0 (vu_long *)0xFE200000
+#define SH7751_PCICONF1 (vu_long *)0xFE200004
+#define SH7751_PCICONF2 (vu_long *)0xFE200008
+#define SH7751_PCICONF3 (vu_long *)0xFE20000C
+#define SH7751_PCICONF4 (vu_long *)0xFE200010
+#define SH7751_PCICONF5 (vu_long *)0xFE200014
+#define SH7751_PCICONF6 (vu_long *)0xFE200018
+#define SH7751_PCICR    (vu_long *)0xFE200100
+#define SH7751_PCILSR0  (vu_long *)0xFE200104
+#define SH7751_PCILSR1  (vu_long *)0xFE200108
+#define SH7751_PCILAR0  (vu_long *)0xFE20010C
+#define SH7751_PCILAR1  (vu_long *)0xFE200110
+#define SH7751_PCIMBR   (vu_long *)0xFE2001C4
+#define SH7751_PCIIOBR  (vu_long *)0xFE2001C8
+#define SH7751_PCIPINT  (vu_long *)0xFE2001CC
+#define SH7751_PCIPINTM (vu_long *)0xFE2001D0
+#define SH7751_PCICLKR  (vu_long *)0xFE2001D4
+#define SH7751_PCIBCR1  (vu_long *)0xFE2001E0
+#define SH7751_PCIBCR2  (vu_long *)0xFE2001E4
+#define SH7751_PCIWCR1  (vu_long *)0xFE2001E8
+#define SH7751_PCIWCR2  (vu_long *)0xFE2001EC
+#define SH7751_PCIWCR3  (vu_long *)0xFE2001F0
+#define SH7751_PCIMCR   (vu_long *)0xFE2001F4
+#define SH7751_PCIBCR3  (vu_long *)0xFE2001F8
+
+#define BCR1_BREQEN                            0x00080000
+#define PCI_SH7751_ID                  0x35051054
+#define PCI_SH7751R_ID                 0x350E1054
+#define SH7751_PCICONF1_WCC            0x00000080
+#define SH7751_PCICONF1_PER            0x00000040
+#define SH7751_PCICONF1_BUM            0x00000004
+#define SH7751_PCICONF1_MES            0x00000002
+#define SH7751_PCICONF1_CMDS   0x000000C6
+#define SH7751_PCI_HOST_BRIDGE 0x6
+#define SH7751_PCICR_PREFIX            0xa5000000
+#define SH7751_PCICR_PRST              0x00000002
+#define SH7751_PCICR_CFIN              0x00000001
+#define SH7751_PCIPINT_D3              0x00000002
+#define SH7751_PCIPINT_D0              0x00000001
+#define SH7751_PCICLKR_PREFIX   0xa5000000
+
+#define SH7751_PCI_MEM_BASE            0xFD000000
+#define SH7751_PCI_MEM_SIZE            0x01000000
+#define SH7751_PCI_IO_BASE             0xFE240000
+#define SH7751_PCI_IO_SIZE             0x00040000
+
+#define SH7751_CS3_BASE_ADDR    0x0C000000
+#define SH7751_P2CS3_BASE_ADDR  0xAC000000
+
+#define SH7751_PCIPAR   (vu_long *)0xFE2001C0
+#define SH7751_PCIPDR   (vu_long *)0xFE200220
+
+#define p4_in(addr)     *(addr)
+#define p4_out(data,addr) *(addr) = (data)
+
+/* Double word */
+int pci_sh4_read_config_dword(struct pci_controller *hose,
+                             pci_dev_t dev, int offset, u32 * value)
+{
+       u32 par_data = 0x80000000 | dev;
+
+       p4_out(par_data | (offset & 0xfc), SH7751_PCIPAR);
+       *value = p4_in(SH7751_PCIPDR);
+
+       return 0;
+}
+
+int pci_sh4_write_config_dword(struct pci_controller *hose,
+                              pci_dev_t dev, int offset, u32 * value)
+{
+       u32 par_data = 0x80000000 | dev;
+
+       p4_out(par_data | (offset & 0xfc), SH7751_PCIPAR);
+       p4_out(value, SH7751_PCIPDR);
+
+       return 0;
+}
+
+int pci_sh7751_init(struct pci_controller *hose)
+{
+       /* Double-check that we're a 7751 or 7751R chip */
+       if (p4_in(SH7751_PCICONF0) != PCI_SH7751_ID
+           && p4_in(SH7751_PCICONF0) != PCI_SH7751R_ID) {
+               printf("PCI: Unknown PCI host bridge.\n");
+               return 1;
+       }
+       printf("PCI: SH7751 PCI host bridge found.\n");
+
+       /* Double-check some BSC config settings */
+       /* (Area 3 non-MPX 32-bit, PCI bus pins) */
+       if ((p4_in(SH7751_BCR1) & 0x20008) == 0x20000) {
+               printf("SH7751_BCR1 0x%08X\n", p4_in(SH7751_BCR1));
+               return 2;
+       }
+       if ((p4_in(SH7751_BCR2) & 0xC0) != 0xC0) {
+               printf("SH7751_BCR2 0x%08X\n", p4_in(SH7751_BCR2));
+               return 3;
+       }
+       if (p4_in(SH7751_BCR2) & 0x01) {
+               printf("SH7751_BCR2 0x%08X\n", p4_in(SH7751_BCR2));
+               return 4;
+       }
+
+       /* Force BREQEN in BCR1 to allow PCIC access */
+       p4_out((p4_in(SH7751_BCR1) | BCR1_BREQEN), SH7751_BCR1);
+
+       /* Toggle PCI reset pin */
+       p4_out((SH7751_PCICR_PREFIX | SH7751_PCICR_PRST), SH7751_PCICR);
+       udelay(32);
+       p4_out(SH7751_PCICR_PREFIX, SH7751_PCICR);
+
+       /* Set cmd bits: WCC, PER, BUM, MES */
+       /* (Addr/Data stepping, Parity enabled, Bus Master, Memory enabled) */
+       p4_out(0xfb900047, SH7751_PCICONF1);    /* K.Kino */
+
+       /* Define this host as the host bridge */
+       p4_out((SH7751_PCI_HOST_BRIDGE << 24), SH7751_PCICONF2);
+
+       /* Force PCI clock(s) on */
+       p4_out(0, SH7751_PCICLKR);
+       p4_out(0x03, SH7751_PCICLKR);
+
+       /* Clear powerdown IRQs, also mask them (unused) */
+       p4_out((SH7751_PCIPINT_D0 | SH7751_PCIPINT_D3), SH7751_PCIPINT);
+       p4_out(0, SH7751_PCIPINTM);
+
+       p4_out(0xab000001, SH7751_PCICONF4);
+
+       /* Set up target memory mappings (for external DMA access) */
+       /* Map both P0 and P2 range to Area 3 RAM for ease of use */
+       p4_out((64 - 1) << 20, SH7751_PCILSR0);
+       p4_out(SH7751_CS3_BASE_ADDR, SH7751_PCILAR0);
+       p4_out(0, SH7751_PCILSR1);
+       p4_out(0, SH7751_PCILAR1);
+       p4_out(SH7751_CS3_BASE_ADDR, SH7751_PCICONF5);
+       p4_out(0xd0000000, SH7751_PCICONF6);
+
+       /* Map memory window to same address on PCI bus */
+       p4_out(SH7751_PCI_MEM_BASE, SH7751_PCIMBR);
+
+       /* Map IO window to same address on PCI bus */
+       p4_out(0x2000 & 0xfffc0000, SH7751_PCIIOBR);
+
+       /* set BREQEN */
+       p4_out(inl(SH7751_BCR1) | 0x00080000, SH7751_BCR1);
+
+       /* Copy BSC registers into PCI BSC */
+       p4_out(inl(SH7751_BCR1), SH7751_PCIBCR1);
+       p4_out(inl(SH7751_BCR2), SH7751_PCIBCR2);
+       p4_out(inl(SH7751_BCR3), SH7751_PCIBCR3);
+       p4_out(inl(SH7751_WCR1), SH7751_PCIWCR1);
+       p4_out(inl(SH7751_WCR2), SH7751_PCIWCR2);
+       p4_out(inl(SH7751_WCR3), SH7751_PCIWCR3);
+       p4_out(inl(SH7751_MCR), SH7751_PCIMCR);
+
+       /* Finally, set central function init complete */
+       p4_out((SH7751_PCICR_PREFIX | SH7751_PCICR_CFIN), SH7751_PCICR);
+
+       pci_sh4_init(hose);
+
+       return 0;
+}
diff --git a/drivers/pci/pci_sh7780.c b/drivers/pci/pci_sh7780.c
new file mode 100644 (file)
index 0000000..d63d67d
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * SH7780 PCI Controller (PCIC) for U-Boot.
+ * (C) Dustin McIntire (dustin@sensoria.com)
+ * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * 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 <common.h>
+
+#include <asm/processor.h>
+#include <asm/io.h>
+#include <pci.h>
+
+#define SH7780_VENDOR_ID       0x1912
+#define SH7780_DEVICE_ID       0x0002
+#define SH7780_PCICR_PREFIX    0xA5000000
+#define SH7780_PCICR_PFCS      0x00000800
+#define SH7780_PCICR_FTO       0x00000400
+#define SH7780_PCICR_PFE       0x00000200
+#define SH7780_PCICR_TBS       0x00000100
+#define SH7780_PCICR_ARBM      0x00000040
+#define SH7780_PCICR_IOCS      0x00000004
+#define SH7780_PCICR_PRST      0x00000002
+#define SH7780_PCICR_CFIN      0x00000001
+
+#define p4_in(addr)                    *((vu_long *)addr)
+#define p4_out(data,addr)      *(vu_long *)(addr) = (data)
+#define p4_inw(addr)           *((vu_short *)addr)
+#define p4_outw(data,addr)     *(vu_short *)(addr) = (data)
+
+int pci_sh4_read_config_dword(struct pci_controller *hose,
+                                   pci_dev_t dev, int offset, u32 *value)
+{
+       u32 par_data = 0x80000000 | dev;
+
+       p4_out(par_data | (offset & 0xfc), SH7780_PCIPAR);
+       *value = p4_in(SH7780_PCIPDR);
+
+       return 0;
+}
+
+int pci_sh4_write_config_dword(struct pci_controller *hose,
+                                    pci_dev_t dev, int offset, u32 value)
+{
+       u32 par_data = 0x80000000 | dev;
+
+       p4_out(par_data | (offset & 0xfc), SH7780_PCIPAR);
+       p4_out(value, SH7780_PCIPDR);
+       return 0;
+}
+
+int pci_sh7780_init(struct pci_controller *hose)
+{
+       p4_out(0x01, SH7780_PCIECR);
+
+       if (p4_inw(SH7780_PCIVID) != SH7780_VENDOR_ID
+           && p4_inw(SH7780_PCIDID) != SH7780_DEVICE_ID){
+               printf("PCI: Unknown PCI host bridge.\n");
+               return;
+       }
+       printf("PCI: SH7780 PCI host bridge found.\n");
+
+       /* Toggle PCI reset pin */
+       p4_out((SH7780_PCICR_PREFIX | SH7780_PCICR_PRST), SH7780_PCICR);
+       udelay(100000);
+       p4_out(SH7780_PCICR_PREFIX, SH7780_PCICR);
+       p4_outw(0x0047, SH7780_PCICMD);
+
+       p4_out(0x07F00001, SH7780_PCILSR0);
+       p4_out(0x08000000, SH7780_PCILAR0);
+       p4_out(0x00000000, SH7780_PCILSR1);
+       p4_out(0, SH7780_PCILAR1);
+       p4_out(0x08000000, SH7780_PCIMBAR0);
+       p4_out(0x00000000, SH7780_PCIMBAR1);
+
+       p4_out(0xFD000000, SH7780_PCIMBR0);
+       p4_out(0x00FC0000, SH7780_PCIMBMR0);
+
+       /* if use Operand Cache then enable PCICSCR Soonp bits. */
+       p4_out(0x08000000, SH7780_PCICSAR0);
+       p4_out(0x0000001B, SH7780_PCICSCR0);    /* Snoop bit :On */
+
+       p4_out((SH7780_PCICR_PREFIX | SH7780_PCICR_CFIN | SH7780_PCICR_ARBM
+             | SH7780_PCICR_FTO | SH7780_PCICR_PFCS | SH7780_PCICR_PFE),
+            SH7780_PCICR);
+
+       pci_sh4_init(hose);
+       return 0;
+}
index 70fd23ff0af6d53548d2f0c228dd26100a9bdd29..522f96d5db6f305c052071c0343ba3c1ab3caf59 100644 (file)
 #define SCFCR  (vu_short *)(SCIF_BASE + 0x18)
 #define SCFDR  (vu_short *)(SCIF_BASE + 0x1C)
 #ifdef CONFIG_CPU_SH7720 /* SH7720 specific */
-#define SCFSR  (vu_short *)(SCIF_BASE + 0x14)   /* SCSSR */
-#define SCFTDR (vu_char  *)(SCIF_BASE + 0x20)
-#define SCFRDR (vu_char  *)(SCIF_BASE + 0x24)
+# define SCFSR (vu_short *)(SCIF_BASE + 0x14) /* SCSSR */
+# define SCFTDR        (vu_char  *)(SCIF_BASE + 0x20)
+# define SCFRDR        (vu_char  *)(SCIF_BASE + 0x24)
 #else
-#define SCFTDR         (vu_char  *)(SCIF_BASE + 0xC)
-#define SCFSR  (vu_short *)(SCIF_BASE + 0x10)
-#define SCFRDR         (vu_char  *)(SCIF_BASE + 0x14)
+# define SCFTDR (vu_char  *)(SCIF_BASE + 0xC)
+# define SCFSR         (vu_short *)(SCIF_BASE + 0x10)
+# define SCFRDR (vu_char  *)(SCIF_BASE + 0x14)
 #endif
 
-#if defined(CONFIG_SH4A)
-#define SCRFDR (vu_short *)(SCIF_BASE + 0x20)
-#define SCSPTR (vu_short *)(SCIF_BASE + 0x24)
-#define SCLSR   (vu_short *)(SCIF_BASE + 0x28)
-#define SCRER  (vu_short *)(SCIF_BASE + 0x2C)
-#define LSR_ORER       1
-#elif defined (CONFIG_SH4)
-#define SCSPTR         (vu_short *)(SCIF_BASE + 0x20)
-#define SCLSR  (vu_short *)(SCIF_BASE + 0x24)
-#define LSR_ORER       1
-#elif defined (CONFIG_SH3)
-#ifdef CONFIG_CPU_SH7720 /* SH7720 specific */
-#define SCLSR   (vu_short *)(SCIF_BASE + 0x24)
-#define LSR_ORER       0x0200
-#else
-#define SCLSR  SCFSR   /* SCSSR */
-#define LSR_ORER       1
-#endif
+#if defined(CONFIG_CPU_SH7780) || \
+       defined(CONFIG_CPU_SH7785)
+# define SCRFDR        (vu_short *)(SCIF_BASE + 0x20)
+# define SCSPTR        (vu_short *)(SCIF_BASE + 0x24)
+# define SCLSR   (vu_short *)(SCIF_BASE + 0x28)
+# define SCRER (vu_short *)(SCIF_BASE + 0x2C)
+# define LSR_ORER      1
+# define FIFOLEVEL_MASK        0xFF
+#elif defined(CONFIG_CPU_SH7750) || \
+       defined(CONFIG_CPU_SH7751) || \
+       defined(CONFIG_CPU_SH7722)
+# define SCSPTR        (vu_short *)(SCIF_BASE + 0x20)
+# define SCLSR         (vu_short *)(SCIF_BASE + 0x24)
+# define LSR_ORER      1
+# define FIFOLEVEL_MASK        0x1F
+#elif defined(CONFIG_CPU_SH7720)
+# define SCLSR   (vu_short *)(SCIF_BASE + 0x24)
+# define LSR_ORER      0x0200
+# define FIFOLEVEL_MASK        0x1F
+#elif defined(CONFIG_CPU_SH7710)
+       defined(CONFIG_CPU_SH7712)
+# define SCLSR SCFSR   /* SCSSR */
+# define LSR_ORER      1
+# define FIFOLEVEL_MASK        0x1F
 #endif
 
+/* SCBRR register value setting */
 #if defined(CONFIG_CPU_SH7720)
-#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
+# define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
 #else  /* Generic SuperH */
-#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
+# define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
 #endif
 
 #define SCR_RE                 (1 << 4)
@@ -105,14 +112,13 @@ int serial_init (void)
        return 0;
 }
 
-static int serial_tx_fifo_level (void)
-{
-       return (*SCFDR >> 8) & 0x1F;
-}
-
 static int serial_rx_fifo_level (void)
 {
-       return (*SCFDR >> 0) & 0x1F;
+#if defined(CONFIG_SH4A)
+       return (*SCRFDR >> 0) & FIFOLEVEL_MASK;
+#else
+       return (*SCFDR >> 0) & FIFOLEVEL_MASK;
+#endif
 }
 
 void serial_raw_putc (const char c)
index b43dba3352f0b11de2e7bd53dc15f4c8e6a038f5..9ccf7d6017d3f70d3479ae81ec1193eb92217ec8 100644 (file)
@@ -74,7 +74,6 @@ typedef       struct  global_data {
        u32 enc_clk;
        u32 lbiu_clk;
        u32 lclk_clk;
-       u32 ddr_clk;
        u32 pci_clk;
 #if defined(CONFIG_MPC837X)
        u32 pciexp1_clk;
@@ -84,7 +83,7 @@ typedef       struct  global_data {
        u32 sata_clk;
 #endif
 #if defined(CONFIG_MPC8360)
-       u32  ddr_sec_clk;
+       u32  mem_sec_clk;
 #endif /* CONFIG_MPC8360 */
 #endif
 #if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
new file mode 100644 (file)
index 0000000..67474c7
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef __ASM_SH_CACHE_H
+#define __ASM_SH_CACHE_H
+
+#if defined(CONFIG_SH4) || defined(CONFIG_SH4A)
+
+#define L1_CACHE_BYTES 32
+struct __large_struct { unsigned long buf[100]; };
+#define __m(x) (*(struct __large_struct *)(x))
+
+void dcache_wback_range(u32 start, u32 end)
+{
+    u32 v;
+
+    start &= ~(L1_CACHE_BYTES-1);
+    for (v = start; v < end; v+=L1_CACHE_BYTES) {
+        asm volatile("ocbwb     %0"
+                     : /* no output */
+                     : "m" (__m(v)));
+    }
+}
+
+void dcache_invalid_range(u32 start, u32 end)
+{
+    u32 v;
+
+    start &= ~(L1_CACHE_BYTES-1);
+    for (v = start; v < end; v+=L1_CACHE_BYTES) {
+        asm volatile("ocbi     %0"
+                     : /* no output */
+                     : "m" (__m(v)));
+    }
+}
+#endif /* CONFIG_SH4 || CONFIG_SH4A */
+
+#endif /* __ASM_SH_CACHE_H */
index 265803956df4284aa7c0bc4ba33027fe47a00e16..c200ba5a46318201db26c6a81acdb7a7c2f4f1d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * (C) Copyright 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
 #define CACHE_OC_NUM_ENTRIES   512
 #define CACHE_OC_ENTRY_SHIFT   5
 
-#if defined (CONFIG_CPU_SH7750)
-#include <asm/cpu_sh7750.h>
+#if defined (CONFIG_CPU_SH7750) || \
+       defined(CONFIG_CPU_SH7751)
+# include <asm/cpu_sh7750.h>
 #elif defined (CONFIG_CPU_SH7722)
-#include <asm/cpu_sh7722.h>
+# include <asm/cpu_sh7722.h>
+#elif defined (CONFIG_CPU_SH7780)
+# include <asm/cpu_sh7780.h>
 #else
-#error "Unknown SH4 variant"
+# error "Unknown SH4 variant"
 #endif
 
 #endif /* _ASM_CPU_SH4_H_ */
index bafb8deb195c3b5fba7413cb6a1d831ce0ffa6ae..1b393b88a607598503067e45e0dab4da37067e61 100644 (file)
@@ -1,5 +1,9 @@
 /*
- * (C) Copyright 2007 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+ * Copyright 2007 (C)
+ * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
+ *
+ * Copyright 2008 (C)
+ * Mark Jonas <mark.jonas@de.bosch.com>
  *
  * SH7720 Internal I/O register
  *
 #define PSELD          (PFC_BASE + 0x2A)
 
 /*     I/O Port        */
+#define PORT_BASE      0xA4050100
+#define PADR           (PORT_BASE + 0x40)
+#define PBDR           (PORT_BASE + 0x42)
+#define PCDR           (PORT_BASE + 0x44)
+#define PDDR           (PORT_BASE + 0x46)
+#define PEDR           (PORT_BASE + 0x48)
+#define PFDR           (PORT_BASE + 0x4A)
+#define PGDR           (PORT_BASE + 0x4C)
+#define PHDR           (PORT_BASE + 0x4E)
+#define PJDR           (PORT_BASE + 0x50)
+#define PKDR           (PORT_BASE + 0x52)
+#define PLDR           (PORT_BASE + 0x54)
+#define PMDR           (PORT_BASE + 0x56)
+#define PPDR           (PORT_BASE + 0x58)
+#define PRDR           (PORT_BASE + 0x5A)
+#define PSDR           (PORT_BASE + 0x5C)
+#define PTDR           (PORT_BASE + 0x5E)
+#define PUDR           (PORT_BASE + 0x60)
+#define PVDR           (PORT_BASE + 0x62)
 
 /*     H-UDI   */
 
index bb6461a6bfc73a084e5df91f5c0e4118344a6ccf..3c3c30980aa19decb5e0caf2bbe4fcd0775fbed5 100644 (file)
 
 #ifdef CONFIG_CPU_TYPE_R
 #define CACHE_OC_NUM_WAYS     2
-#define CCR_CACHE_INIT   0x8000090d     /* EMODE,ICI,ICE(16k),OCI,P1-wb,OCE(32k) */
+#define CCR_CACHE_INIT   0x8000090D     /* EMODE,ICI,ICE(16k),OCI,P1-wb,OCE(32k) */
 #else
 #define CACHE_OC_NUM_WAYS     1
-#define CCR_CACHE_INIT   0x0000090b
+#define CCR_CACHE_INIT   0x0000090B
 #endif
 
 /*      OCN     */
diff --git a/include/asm-sh/cpu_sh7780.h b/include/asm-sh/cpu_sh7780.h
new file mode 100644 (file)
index 0000000..d4f824e
--- /dev/null
@@ -0,0 +1,503 @@
+#ifndef        _ASM_CPU_SH7780_H_
+#define        _ASM_CPU_SH7780_H_
+
+/*
+ * Copyright (c) 2007,2008 Nobuhiro Iwamatsu
+ * Copyright (c) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * 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
+ *
+ */
+
+#define        CACHE_OC_NUM_WAYS       1
+#define        CCR_CACHE_INIT          0x0000090b
+
+/*     Exceptions      */
+#define        TRA             0xFF000020
+#define        EXPEVT  0xFF000024
+#define        INTEVT  0xFF000028
+
+/* Memory Management Unit */
+#define        PTEH    0xFF000000
+#define        PTEL    0xFF000004
+#define        TTB             0xFF000008
+#define        TEA             0xFF00000C
+#define        MMUCR   0xFF000010
+#define        PASCR   0xFF000070
+#define        IRMCR   0xFF000078
+
+/* Cache Controller */
+#define        CCR             0xFF00001C
+#define        QACR0   0xFF000038
+#define        QACR1   0xFF00003C
+#define        RAMCR   0xFF000074
+
+/* L Memory    */
+#define        RAMCR   0xFF000074
+#define        LSA0    0xFF000050
+#define        LSA1    0xFF000054
+#define        LDA0    0xFF000058
+#define        LDA1    0xFF00005C
+
+/* Interrupt Controller */
+#define        ICR0            0xFFD00000
+#define        ICR1            0xFFD0001C
+#define        INTPRI          0xFFD00010
+#define        INTREQ          0xFFD00024
+#define        INTMSK0         0xFFD00044
+#define        INTMSK1         0xFFD00048
+#define        INTMSK2         0xFFD40080
+#define        INTMSKCLR0      0xFFD00064
+#define        INTMSKCLR1      0xFFD00068
+#define        INTMSKCLR2      0xFFD40084
+#define        NMIFCR          0xFFD000C0
+#define        USERIMASK       0xFFD30000
+#define        INT2PRI0        0xFFD40000
+#define        INT2PRI1        0xFFD40004
+#define        INT2PRI2        0xFFD40008
+#define        INT2PRI3        0xFFD4000C
+#define        INT2PRI4        0xFFD40010
+#define        INT2PRI5        0xFFD40014
+#define        INT2PRI6        0xFFD40018
+#define        INT2PRI7        0xFFD4001C
+#define        INT2A0          0xFFD40030
+#define        INT2A1          0xFFD40034
+#define        INT2MSKR        0xFFD40038
+#define        INT2MSKCR       0xFFD4003C
+#define        INT2B0          0xFFD40040
+#define        INT2B1          0xFFD40044
+#define        INT2B2          0xFFD40048
+#define        INT2B3          0xFFD4004C
+#define        INT2B4          0xFFD40050
+#define        INT2B5          0xFFD40054
+#define        INT2B6          0xFFD40058
+#define        INT2B7          0xFFD4005C
+#define        INT2GPIC        0xFFD40090
+
+/* local Bus State Controller */
+#define        MMSELR          0xFF400020
+#define        BCR                     0xFF801000
+#define        CS0BCR          0xFF802000
+#define        CS1BCR          0xFF802010
+#define        CS2BCR          0xFF802020
+#define        CS4BCR          0xFF802040
+#define        CS5BCR          0xFF802050
+#define        CS6BCR          0xFF802060
+#define        CS0WCR          0xFF802008
+#define        CS1WCR          0xFF802018
+#define        CS2WCR          0xFF802028
+#define        CS4WCR          0xFF802048
+#define        CS5WCR          0xFF802058
+#define        CS6WCR          0xFF802068
+#define        CS5PCR          0xFF802070
+#define        CS6PCR          0xFF802080
+
+/* DDR-SDRAM I/F */
+#define        MIM_1           0xFE800008
+#define        MIM_2           0xFE80000C
+#define        SCR_1           0xFE800010
+#define        SCR_2           0xFE800014
+#define        STR_1           0xFE800018
+#define        STR_2           0xFE80001C
+#define        SDR_1           0xFE800030
+#define        SDR_2           0xFE800034
+#define        DBK_1           0xFE800400
+#define        DBK_2           0xFE800404
+
+/* PCI Controller */
+#define        SH7780_PCIECR           0xFE000008
+#define        SH7780_PCIVID           0xFE040000
+#define        SH7780_PCIDID           0xFE040002
+#define        SH7780_PCICMD           0xFE040004
+#define        SH7780_PCISTATUS        0xFE040006
+#define        SH7780_PCIRID           0xFE040008
+#define        SH7780_PCIPIF           0xFE040009
+#define        SH7780_PCISUB           0xFE04000A
+#define        SH7780_PCIBCC           0xFE04000B
+#define        SH7780_PCICLS           0xFE04000C
+#define        SH7780_PCILTM           0xFE04000D
+#define        SH7780_PCIHDR           0xFE04000E
+#define        SH7780_PCIBIST          0xFE04000F
+#define        SH7780_PCIIBAR          0xFE040010
+#define        SH7780_PCIMBAR0         0xFE040014
+#define        SH7780_PCIMBAR1         0xFE040018
+#define        SH7780_PCISVID          0xFE04002C
+#define        SH7780_PCISID           0xFE04002E
+#define        SH7780_PCICP            0xFE040034
+#define        SH7780_PCIINTLINE       0xFE04003C
+#define        SH7780_PCIINTPIN        0xFE04003D
+#define        SH7780_PCIMINGNT        0xFE04003E
+#define        SH7780_PCIMAXLAT        0xFE04003F
+#define        SH7780_PCICID           0xFE040040
+#define        SH7780_PCINIP           0xFE040041
+#define        SH7780_PCIPMC           0xFE040042
+#define        SH7780_PCIPMCSR         0xFE040044
+#define        SH7780_PCIPMCSRBSE      0xFE040046
+#define        SH7780_PCI_CDD          0xFE040047
+#define        SH7780_PCICR            0xFE040100
+#define        SH7780_PCILSR0          0xFE040104
+#define        SH7780_PCILSR1          0xFE040108
+#define        SH7780_PCILAR0          0xFE04010C
+#define        SH7780_PCILAR1          0xFE040110
+#define        SH7780_PCIIR            0xFE040114
+#define        SH7780_PCIIMR           0xFE040118
+#define        SH7780_PCIAIR           0xFE04011C
+#define        SH7780_PCICIR           0xFE040120
+#define        SH7780_PCIAINT          0xFE040130
+#define        SH7780_PCIAINTM         0xFE040134
+#define        SH7780_PCIBMIR          0xFE040138
+#define        SH7780_PCIPAR           0xFE0401C0
+#define        SH7780_PCIPINT          0xFE0401CC
+#define        SH7780_PCIPINTM         0xFE0401D0
+#define        SH7780_PCIMBR0          0xFE0401E0
+#define        SH7780_PCIMBMR0         0xFE0401E4
+#define        SH7780_PCIMBR1          0xFE0401E8
+#define        SH7780_PCIMBMR1         0xFE0401EC
+#define        SH7780_PCIMBR2          0xFE0401F0
+#define        SH7780_PCIMBMR2         0xFE0401F4
+#define        SH7780_PCIIOBR          0xFE0401F8
+#define        SH7780_PCIIOBMR         0xFE0401FC
+#define        SH7780_PCICSCR0         0xFE040210
+#define        SH7780_PCICSCR1         0xFE040214
+#define        SH7780_PCICSAR0         0xFE040218
+#define        SH7780_PCICSAR1         0xFE04021C
+#define        SH7780_PCIPDR           0xFE040220
+
+/* DMAC */
+#define        DMAC_SAR0       0xFC808020
+#define        DMAC_DAR0       0xFC808024
+#define        DMAC_TCR0       0xFC808028
+#define        DMAC_CHCR0      0xFC80802C
+#define        DMAC_SAR1       0xFC808030
+#define        DMAC_DAR1       0xFC808034
+#define        DMAC_TCR1       0xFC808038
+#define        DMAC_CHCR1      0xFC80803C
+#define        DMAC_SAR2       0xFC808040
+#define        DMAC_DAR2       0xFC808044
+#define        DMAC_TCR2       0xFC808048
+#define        DMAC_CHCR2      0xFC80804C
+#define        DMAC_SAR3       0xFC808050
+#define        DMAC_DAR3       0xFC808054
+#define        DMAC_TCR3       0xFC808058
+#define        DMAC_CHCR3      0xFC80805C
+#define        DMAC_DMAOR0     0xFC808060
+#define        DMAC_SAR4       0xFC808070
+#define        DMAC_DAR4       0xFC808074
+#define        DMAC_TCR4       0xFC808078
+#define        DMAC_CHCR4      0xFC80807C
+#define        DMAC_SAR5       0xFC808080
+#define        DMAC_DAR5       0xFC808084
+#define        DMAC_TCR5       0xFC808088
+#define        DMAC_CHCR5      0xFC80808C
+#define        DMAC_SARB0      0xFC808120
+#define        DMAC_DARB0      0xFC808124
+#define        DMAC_TCRB0      0xFC808128
+#define        DMAC_SARB1      0xFC808130
+#define        DMAC_DARB1      0xFC808134
+#define        DMAC_TCRB1      0xFC808138
+#define        DMAC_SARB2      0xFC808140
+#define        DMAC_DARB2      0xFC808144
+#define        DMAC_TCRB2      0xFC808148
+#define        DMAC_SARB3      0xFC808150
+#define        DMAC_DARB3      0xFC808154
+#define        DMAC_TCRB3      0xFC808158
+#define        DMAC_DMARS0     0xFC809000
+#define        DMAC_DMARS1     0xFC809004
+#define        DMAC_DMARS2     0xFC809008
+#define        DMAC_SAR6       0xFC818020
+#define        DMAC_DAR6       0xFC818024
+#define        DMAC_TCR6       0xFC818028
+#define        DMAC_CHCR6      0xFC81802C
+#define        DMAC_SAR7       0xFC818030
+#define        DMAC_DAR7       0xFC818034
+#define        DMAC_TCR7       0xFC818038
+#define        DMAC_CHCR7      0xFC81803C
+#define        DMAC_SAR8       0xFC818040
+#define        DMAC_DAR8       0xFC818044
+#define        DMAC_TCR8       0xFC818048
+#define        DMAC_CHCR8      0xFC81804C
+#define        DMAC_SAR9       0xFC818050
+#define        DMAC_DAR9       0xFC818054
+#define        DMAC_TCR9       0xFC818058
+#define        DMAC_CHCR9      0xFC81805C
+#define        DMAC_DMAOR1     0xFC818060
+#define        DMAC_SAR10      0xFC818070
+#define        DMAC_DAR10      0xFC818074
+#define        DMAC_TCR10      0xFC818078
+#define        DMAC_CHCR10     0xFC81807C
+#define        DMAC_SAR11      0xFC818080
+#define        DMAC_DAR11      0xFC818084
+#define        DMAC_TCR11      0xFC818088
+#define        DMAC_CHCR11     0xFC81808C
+#define        DMAC_SARB6      0xFC818120
+#define        DMAC_DARB6      0xFC818124
+#define        DMAC_TCRB6      0xFC818128
+#define        DMAC_SARB7      0xFC818130
+#define        DMAC_DARB7      0xFC818134
+#define        DMAC_TCRB7      0xFC818138
+#define        DMAC_SARB8      0xFC818140
+#define        DMAC_DARB8      0xFC818144
+#define        DMAC_TCRB8      0xFC818148
+#define        DMAC_SARB9      0xFC818150
+#define        DMAC_DARB9      0xFC818154
+#define        DMAC_TCRB9      0xFC818158
+
+/* Clock Pulse Generator */
+#define        FRQCR   0xFFC80000
+#define        PLLCR   0xFFC80024
+#define        MSTPCR  0xFFC80030
+
+/* Watchdog Timer and Reset */
+#define        WTCNT   WDTCNT
+#define        WDTST   0xFFCC0000
+#define        WDTCSR  0xFFCC0004
+#define        WDTBST  0xFFCC0008
+#define        WDTCNT  0xFFCC0010
+#define        WDTBCNT 0xFFCC0018
+
+/* System Control */
+#define        MSTPCR  0xFFC80030
+
+/* Timer Unit */
+#define        TSTR    TSTR0
+#define        TOCR    0xFFD80000
+#define        TSTR0   0xFFD80004
+#define        TCOR0   0xFFD80008
+#define        TCNT0   0xFFD8000C
+#define        TCR0    0xFFD80010
+#define        TCOR1   0xFFD80014
+#define        TCNT1   0xFFD80018
+#define        TCR1    0xFFD8001C
+#define        TCOR2   0xFFD80020
+#define        TCNT2   0xFFD80024
+#define        TCR2    0xFFD80028
+#define        TCPR2   0xFFD8002C
+#define        TSTR1   0xFFDC0004
+#define        TCOR3   0xFFDC0008
+#define        TCNT3   0xFFDC000C
+#define        TCR3    0xFFDC0010
+#define        TCOR4   0xFFDC0014
+#define        TCNT4   0xFFDC0018
+#define        TCR4    0xFFDC001C
+#define        TCOR5   0xFFDC0020
+#define        TCNT5   0xFFDC0024
+#define        TCR5    0xFFDC0028
+
+/* Timer/Counter */
+#define        CMTCFG  0xFFE30000
+#define        CMTFRT  0xFFE30004
+#define        CMTCTL  0xFFE30008
+#define        CMTIRQS 0xFFE3000C
+#define        CMTCH0T 0xFFE30010
+#define        CMTCH0ST        0xFFE30020
+#define        CMTCH0C 0xFFE30030
+#define        CMTCH1T 0xFFE30014
+#define        CMTCH1ST        0xFFE30024
+#define        CMTCH1C 0xFFE30034
+#define        CMTCH2T 0xFFE30018
+#define        CMTCH2C 0xFFE30038
+#define        CMTCH3T 0xFFE3001C
+#define        CMTCH3C 0xFFE3003C
+
+/* Realtime Clock */
+#define        R64CNT  0xFFE80000
+#define        RSECCNT 0xFFE80004
+#define        RMINCNT 0xFFE80008
+#define        RHRCNT  0xFFE8000C
+#define        RWKCNT  0xFFE80010
+#define        RDAYCNT 0xFFE80014
+#define        RMONCNT 0xFFE80018
+#define        RYRCNT  0xFFE8001C
+#define        RSECAR  0xFFE80020
+#define        RMINAR  0xFFE80024
+#define        RHRAR   0xFFE80028
+#define        RWKAR   0xFFE8002C
+#define        RDAYAR  0xFFE80030
+#define        RMONAR  0xFFE80034
+#define        RCR1    0xFFE80038
+#define        RCR2    0xFFE8003C
+#define        RCR3    0xFFE80050
+#define        RYRAR   0xFFE80054
+
+/* Serial Communication        Interface with FIFO */
+#define        SCIF0_BASE SCSMR0
+#define        SCSMR0  0xFFE00000
+#define        SCBRR0  0xFFE00004
+#define        SCSCR0  0xFFE00008
+#define        SCFSR0  0xFFE00010
+#define        SCFCR0  0xFFE00018
+#define        SCTFDR0 0xFFE0001C
+#define        SCRFDR0 0xFFE00020
+#define        SCSPTR0 0xFFE00024
+#define        SCLSR0  0xFFE00028
+#define        SCRER0  0xFFE0002C
+#define        SCSMR1  0xFFE10000
+#define        SCBRR1  0xFFE10004
+#define        SCSCR1  0xFFE10008
+#define        SCFSR1  0xFFE10010
+#define        SCFCR1  0xFFE10018
+#define        SCTFDR1 0xFFE1001C
+#define        SCRFDR1 0xFFE10020
+#define        SCSPTR1 0xFFE10024
+#define        SCLSR1  0xFFE10028
+#define        SCRER1  0xFFE1002C
+
+/* Serial I/O with FIFO */
+#define        SIMDR   0xFFE20000
+#define        SISCR   0xFFE20002
+#define        SITDAR  0xFFE20004
+#define        SIRDAR  0xFFE20006
+#define        SICDAR  0xFFE20008
+#define        SICTR   0xFFE2000C
+#define        SIFCTR  0xFFE20010
+#define        SISTR   0xFFE20014
+#define        SIIER   0xFFE20016
+#define        SITCR   0xFFE20028
+#define        SIRCR   0xFFE2002C
+#define        SPICR   0xFFE20030
+
+/* Serial Protocol Interface */
+#define        SPCR    0xFFE50000
+#define        SPSR    0xFFE50004
+#define        SPSCR   0xFFE50008
+#define        SPTBR   0xFFE5000C
+#define        SPRBR   0xFFE50010
+
+/* Multimedia Card Interface */
+#define        CMDR0   0xFFE60000
+#define        CMDR1   0xFFE60001
+#define        CMDR2   0xFFE60002
+#define        CMDR3   0xFFE60003
+#define        CMDR4   0xFFE60004
+#define        CMDR5   0xFFE60005
+#define        CMDSTRT 0xFFE60006
+#define        OPCR    0xFFE6000A
+#define        CSTR    0xFFE6000B
+#define        INTCR0  0xFFE6000C
+#define        INTCR1  0xFFE6000D
+#define        INTSTR0 0xFFE6000E
+#define        INTSTR1 0xFFE6000F
+#define        CLKON   0xFFE60010
+#define        CTOCR   0xFFE60011
+#define        TBCR    0xFFE60014
+#define        MODER   0xFFE60016
+#define        CMDTYR  0xFFE60018
+#define        RSPTYR  0xFFE60019
+#define        TBNCR   0xFFE6001A
+#define        RSPR0   0xFFE60020
+#define        RSPR1   0xFFE60021
+#define        RSPR2   0xFFE60022
+#define        RSPR3   0xFFE60023
+#define        RSPR4   0xFFE60024
+#define        RSPR5   0xFFE60025
+#define        RSPR6   0xFFE60026
+#define        RSPR7   0xFFE60027
+#define        RSPR8   0xFFE60028
+#define        RSPR9   0xFFE60029
+#define        RSPR10  0xFFE6002A
+#define        RSPR11  0xFFE6002B
+#define        RSPR12  0xFFE6002C
+#define        RSPR13  0xFFE6002D
+#define        RSPR14  0xFFE6002E
+#define        RSPR15  0xFFE6002F
+#define        RSPR16  0xFFE60030
+#define        RSPRD   0xFFE60031
+#define        DTOUTR  0xFFE60032
+#define        DR              0xFFE60040
+#define        DMACR   0xFFE60044
+#define        INTCR2  0xFFE60046
+#define        INTSTR2 0xFFE60048
+
+/* Audio Codec Interface */
+#define        HACCR   0xFFE40008
+#define        HACCSAR 0xFFE40020
+#define        HACCSDR 0xFFE40024
+#define        HACPCML 0xFFE40028
+#define        HACPCMR 0xFFE4002C
+#define        HACTIER 0xFFE40050
+#define        HACTSR  0xFFE40054
+#define        HACRIER 0xFFE40058
+#define        HACRSR  0xFFE4005C
+#define        HACACR  0xFFE40060
+
+/* Serial Sound Interface */
+#define        SSICR   0xFFE70000
+#define        SSISR   0xFFE70004
+#define        SSITDR  0xFFE70008
+#define        SSIRDR  0xFFE7000C
+
+/* Flash memory Controller */
+#define        FLCMNCR 0xFFE90000
+#define        FLCMDCR 0xFFE90004
+#define        FLCMCDR 0xFFE90008
+#define        FLADR   0xFFE9000C
+#define        FLDATAR 0xFFE90010
+#define        FLDTCNTR        0xFFE90014
+#define        FLINTDMACR      0xFFE90018
+#define        FLBSYTMR        0xFFE9001C
+#define        FLBSYCNT        0xFFE90020
+#define        FLTRCR  0xFFE9002C
+
+/* General     Purpose I/O */
+#define        PACR    0xFFEA0000
+#define        PBCR    0xFFEA0002
+#define        PCCR    0xFFEA0004
+#define        PDCR    0xFFEA0006
+#define        PECR    0xFFEA0008
+#define        PFCR    0xFFEA000A
+#define        PGCR    0xFFEA000C
+#define        PHCR    0xFFEA000E
+#define        PJCR    0xFFEA0010
+#define        PKCR    0xFFEA0012
+#define        PLCR    0xFFEA0014
+#define        PMCR    0xFFEA0016
+#define        PADR    0xFFEA0020
+#define        PBDR    0xFFEA0022
+#define        PCDR    0xFFEA0024
+#define        PDDR    0xFFEA0026
+#define        PEDR    0xFFEA0028
+#define        PFDR    0xFFEA002A
+#define        PGDR    0xFFEA002C
+#define        PHDR    0xFFEA002E
+#define        PJDR    0xFFEA0030
+#define        PKDR    0xFFEA0032
+#define        PLDR    0xFFEA0034
+#define        PMDR    0xFFEA0036
+#define        PEPUPR  0xFFEA0048
+#define        PHPUPR  0xFFEA004E
+#define        PJPUPR  0xFFEA0050
+#define        PKPUPR  0xFFEA0052
+#define        PMPUPR  0xFFEA0056
+#define        PPUPR1  0xFFEA0060
+#define        PPUPR2  0xFFEA0062
+#define        PMSELR  0xFFEA0080
+
+/* User        Break Controller */
+#define        CBR0    0xFF200000
+#define        CRR0    0xFF200004
+#define        CAR0    0xFF200008
+#define        CAMR0   0xFF20000C
+#define        CBR1    0xFF200020
+#define        CRR1    0xFF200024
+#define        CAR1    0xFF200028
+#define        CAMR1   0xFF20002C
+#define        CDR1    0xFF200030
+#define        CDMR1   0xFF200034
+#define        CETR1   0xFF200038
+#define        CCMFR   0xFF200600
+#define        CBCR    0xFF200620
+
+#endif /* _ASM_CPU_SH7780_H_ */
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
new file mode 100644 (file)
index 0000000..bc59491
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * SH4 PCI Controller (PCIC) for U-Boot.
+ * (C) Dustin McIntire (dustin@sensoria.com)
+ * (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * u-boot/include/asm-sh/pci.h
+ *
+ * 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
+ */
+#ifndef _ASM_PCI_H_
+#define _ASM_PCI_H_
+
+#include <pci.h>
+#if defined(CONFIG_SH7751_PCI)
+int pci_sh7751_init(struct pci_controller *hose);
+#elif defined(CONFIG_SH7780_PCI)
+int pci_sh7780_init(struct pci_controller *hose);
+#else
+#error "Not support PCI."
+#endif
+
+/* PCI dword read for sh4 */
+int pci_sh4_read_config_dword(struct pci_controller *hose,
+               pci_dev_t dev, int offset, u32 *value);
+
+/* PCI dword write for sh4 */
+int pci_sh4_write_config_dword(struct pci_controller *hose,
+               pci_dev_t dev, int offset, u32 value);
+
+#endif /* _ASM_PCI_H_ */
index bb9a35f643f42d337f6987fed6599717f88d16b6..388aa69c64cee49d8eb5f8b1e5897a8c34890c67 100644 (file)
@@ -2,7 +2,8 @@
 #define _ASM_SH_PROCESSOR_H_
 #if defined CONFIG_SH3
 # include <asm/cpu_sh3.h>
-#elif defined (CONFIG_SH4)
+#elif defined (CONFIG_SH4) || \
+       defined (CONFIG_SH4A)
 # include <asm/cpu_sh4.h>
 #endif
 #endif
index 4fb6921eadebfb03aa8d835da9ab93abd1533a8b..d54da9717b7326193655286a2d09863278f26e4a 100644 (file)
  */
 #define CFG_MBYTES_SDRAM        (1024) /* 512 MiB      TODO: remove    */
 #define CONFIG_DDR_DATA_EYE            /* use DDR2 optimization        */
+#define CFG_MEM_TOP_HIDE        (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 #define CONFIG_SPD_EEPROM              /* Use SPD EEPROM for setup     */
-#if 0
-#define CONFIG_ZERO_SDRAM              /* Zero SDRAM after setup       */
-#endif
 #define CONFIG_DDR_ECC                 /* Use ECC when available       */
 #define SPD_EEPROM_ADDRESS     {0x50}
 #define CONFIG_PROG_SDRAM_TLB
        "update=protect off FFFA0000 FFFFFFFF;era FFFA0000 FFFFFFFF;"   \
                "cp.b 100000 FFFA0000 60000\0"                          \
        ""
-#if 0
-#define CONFIG_BOOTCOMMAND     "run flash_self"
-#endif
 
 #define CONFIG_PREBOOT                  /* enable preboot variable      */
 
@@ -264,7 +260,7 @@ int du440_phy_addr(int devnum);
 #define CONFIG_PHY_ADDR                du440_phy_addr(0) /* PHY address        */
 
 #define CONFIG_PHY_RESET        1      /* reset phy upon startup       */
-#define CONFIG_PHY_GIGE                1       /* Include GbE detection        */
+#undef CONFIG_PHY_GIGE                 /* no GbE detection             */
 
 #define CONFIG_HAS_ETH0
 #define CFG_RX_ETH_BUFFER      128
@@ -295,7 +291,9 @@ int du440_phy_addr(int devnum);
 
 #include <config_cmd_default.h>
 
+#define CONFIG_CMD_AUTOSCRIPT
 #define CONFIG_CMD_BSP
+#define CONFIG_CMD_BMP
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DHCP
@@ -431,8 +429,6 @@ int du440_phy_addr(int devnum);
 #define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
-#if 0
-#define CONFIG_SHOW_ACTIVITY      1
-#endif
+#define CONFIG_AUTOSCRIPT      1
 
 #endif /* __CONFIG_H */
index af7872628ed15575778b63a61424fef6d9471e70..432fb311de4a15686b14e76d0e80fa7448ff426a 100644 (file)
 /* Options are: eTSEC[0-1] */
 #define CONFIG_ETHPRIME                "eTSEC1"
 
+/*
+ * SATA
+ */
+#define CONFIG_LIBATA
+#define CONFIG_FSL_SATA
+
+#define CFG_SATA_MAX_DEVICE    2
+#define CONFIG_SATA1
+#define CFG_SATA1_OFFSET       0x18000
+#define CFG_SATA1              (CFG_IMMR + CFG_SATA1_OFFSET)
+#define CFG_SATA1_FLAGS                FLAGS_DMA
+#define CONFIG_SATA2
+#define CFG_SATA2_OFFSET       0x19000
+#define CFG_SATA2              (CFG_IMMR + CFG_SATA2_OFFSET)
+#define CFG_SATA2_FLAGS                FLAGS_DMA
+
+#ifdef CONFIG_FSL_SATA
+#define CONFIG_LBA48
+#define CONFIG_CMD_SATA
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#endif
+
 /*
  * Environment
  */
index 94c4c6b040e78570c250dfd55794c8838d8cde24..92d7aa42b40dd8b4070472f943c0581d0f6ef554 100644 (file)
 /*
  * Config on-board EEPROM
  */
-#define CFG_I2C_EEPROM_ADDR     0x50
-#define CFG_I2C_EEPROM_ADDR_LEN 2
+#define CFG_I2C_EEPROM_ADDR            0x50
+#define CFG_I2C_EEPROM_ADDR_LEN                2
+#define CFG_EEPROM_PAGE_WRITE_BITS     6
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
+#define CFG_EEPROM_PAGE_WRITE_ENABLE
 
 /*
  * General PCI
 #define CFG_PCI1_IO_SIZE               0x04000000      /* 64M */
 
 #ifdef CONFIG_PCI
-
+#define CONFIG_PCI_SKIP_HOST_BRIDGE
 #define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP         /* do pci plug-and-play */
 
 #define CONFIG_HAS_ETH1                                /* add support for "eth1addr" */
 #define CONFIG_ETH1ADDR        00:04:9f:ef:03:02
 
+/* use mac_read_from_eeprom() to read ethaddr from I2C EEPROM (see CFG_I2C_EEPROM) */
+#define CFG_I2C_MAC_OFFSET     0x7f00  /* MAC address offset in I2C EEPROM */
+
 #define CONFIG_IPADDR          10.0.0.2
 #define CONFIG_SERVERIP                10.0.0.1
 #define CONFIG_GATEWAYIP       10.0.0.1
index b307bf71effc9d2032a7d13667a8ad9910f3a1cd..7c4e76e27324be72a7391bda98099991f617187c 100644 (file)
 /* Options are: TSEC[0-1] */
 #define CONFIG_ETHPRIME                "eTSEC1"
 
+/* SERDES */
+#define CONFIG_FSL_SERDES
+#define CONFIG_FSL_SERDES1     0xe3000
+#define CONFIG_FSL_SERDES2     0xe3100
+
+/*
+ * SATA
+ */
+#define CONFIG_LIBATA
+#define CONFIG_FSL_SATA
+
+#define CFG_SATA_MAX_DEVICE    2
+#define CONFIG_SATA1
+#define CFG_SATA1_OFFSET       0x18000
+#define CFG_SATA1              (CFG_IMMR + CFG_SATA1_OFFSET)
+#define CFG_SATA1_FLAGS                FLAGS_DMA
+#define CONFIG_SATA2
+#define CFG_SATA2_OFFSET       0x19000
+#define CFG_SATA2              (CFG_IMMR + CFG_SATA2_OFFSET)
+#define CFG_SATA2_FLAGS                FLAGS_DMA
+
+#ifdef CONFIG_FSL_SATA
+#define CONFIG_LBA48
+#define CONFIG_CMD_SATA
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#endif
+
 /*
  * Environment
  */
index 90812e92a9dd5865c562d9c160fbd51278bba071..eaac525a35555c532886e50fd622298c30ab42f4 100644 (file)
 
 #endif
 
+/*
+ * SATA
+ */
+#define CONFIG_LIBATA
+#define CONFIG_FSL_SATA
+
+#define CFG_SATA_MAX_DEVICE    2
+#define CONFIG_SATA1
+#define CFG_SATA1_OFFSET       0x18000
+#define CFG_SATA1              (CFG_IMMR + CFG_SATA1_OFFSET)
+#define CFG_SATA1_FLAGS                FLAGS_DMA
+#define CONFIG_SATA2
+#define CFG_SATA2_OFFSET       0x19000
+#define CFG_SATA2              (CFG_IMMR + CFG_SATA2_OFFSET)
+#define CFG_SATA2_FLAGS                FLAGS_DMA
+
+#ifdef CONFIG_FSL_SATA
+#define CONFIG_LBA48
+#define CONFIG_CMD_SATA
+#define CONFIG_DOS_PARTITION
+#define CONFIG_CMD_EXT2
+#endif
+
 /*
  * Environment
  */
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h
new file mode 100644 (file)
index 0000000..99e1179
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Configuation settings for the Renesas Solutions Migo-R board
+ *
+ * Copyright (C) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ *
+ * 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
+ */
+
+#ifndef __MIGO_R_H
+#define __MIGO_R_H
+
+#undef DEBUG
+#define CONFIG_SH              1
+#define CONFIG_SH4             1
+#define CONFIG_CPU_SH7722      1
+#define CONFIG_MIGO_R          1
+
+#define CONFIG_CMD_LOADB
+#define CONFIG_CMD_LOADS
+#define CONFIG_CMD_FLASH
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_DFL
+#define CONFIG_CMD_SDRAM
+#define CONFIG_CMD_ENV
+
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTARGS                "console=ttySC0,115200 root=1f01"
+#define CONFIG_NETMASK         255.255.255.0
+#define CONFIG_IPADDR          192.168.10.100
+#define CONFIG_SERVERIP                192.168.10.77
+#define CONFIG_GATEWAYIP       192.168.10.77
+
+#define CONFIG_VERSION_VARIABLE
+#undef  CONFIG_SHOW_BOOT_PROGRESS
+
+/* SMC9111 */
+#define CONFIG_DRIVER_SMC91111
+#define CONFIG_SMC91111_BASE    (0xB0000000)
+
+/* MEMORY */
+#define MIGO_R_SDRAM_BASE      (0x8C000000)
+#define MIGO_R_FLASH_BASE_1    (0xA0000000)
+#define MIGO_R_FLASH_BANK_SIZE (64 * 1024 * 1024)
+
+#define CFG_LONGHELP                   /* undef to save memory */
+#define CFG_PROMPT             "=> "   /* Monitor Command Prompt */
+#define CFG_CBSIZE             256             /* Buffer size for input from the Console */
+#define CFG_PBSIZE             256             /* Buffer size for Console output */
+#define CFG_MAXARGS            16              /* max args accepted for monitor commands */
+#define CFG_BARGSIZE   512             /* Buffer size for Boot Arguments passed to kernel */
+#define CFG_BAUDRATE_TABLE     { 115200 }      /* List of legal baudrate settings for this board */
+
+/* SCIF */
+#define CFG_SCIF_CONSOLE       1
+#define CONFIG_CONS_SCIF0      1
+#undef  CFG_CONSOLE_INFO_QUIET /* Suppress display of console
+                                                                  information at boot */
+#undef  CFG_CONSOLE_OVERWRITE_ROUTINE
+#undef  CFG_CONSOLE_ENV_OVERWRITE
+
+#define CFG_MEMTEST_START      (MIGO_R_SDRAM_BASE)
+#define CFG_MEMTEST_END                (CFG_MEMTEST_START + (60 * 1024 * 1024))
+
+/* Enable alternate, more extensive, memory test */
+#undef  CFG_ALT_MEMTEST
+/* Scratch address used by the alternate memory test */
+#undef  CFG_MEMTEST_SCRATCH
+
+/* Enable temporary baudrate change while serial download */
+#undef  CFG_LOADS_BAUD_CHANGE
+
+#define CFG_SDRAM_BASE (MIGO_R_SDRAM_BASE)
+/* maybe more, but if so u-boot doesn't know about it... */
+#define CFG_SDRAM_SIZE (64 * 1024 * 1024)
+/* default load address for scripts ?!? */
+#define CFG_LOAD_ADDR  (CFG_SDRAM_BASE + 16 * 1024 * 1024)
+
+/* Address of u-boot image in Flash (NOT run time address in SDRAM) ?!? */
+#define CFG_MONITOR_BASE       (MIGO_R_FLASH_BASE_1)
+/* Monitor size */
+#define CFG_MONITOR_LEN        (128 * 1024)
+/* Size of DRAM reserved for malloc() use */
+#define CFG_MALLOC_LEN (256 * 1024)
+/* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_SIZE      (256)
+#define CFG_BOOTMAPSZ  (8 * 1024 * 1024)
+
+/* FLASH */
+#define CFG_FLASH_CFI
+#define CFG_FLASH_CFI_DRIVER
+#undef  CFG_FLASH_QUIET_TEST
+/* print 'E' for empty sector on flinfo */
+#define CFG_FLASH_EMPTY_INFO
+/* Physical start address of Flash memory */
+#define CFG_FLASH_BASE (MIGO_R_FLASH_BASE_1)
+/* Max number of sectors on each Flash chip */
+#define CFG_MAX_FLASH_SECT     512
+
+/* if you use all NOR Flash , you change dip-switch. Please see MIGO_R01 Manual. */
+#define CFG_MAX_FLASH_BANKS    1
+#define CFG_FLASH_BANKS_LIST   { CFG_FLASH_BASE + (0 * MIGO_R_FLASH_BANK_SIZE) }
+
+/* Timeout for Flash erase operations (in ms) */
+#define CFG_FLASH_ERASE_TOUT   (3 * 1000)
+/* Timeout for Flash write operations (in ms) */
+#define CFG_FLASH_WRITE_TOUT   (3 * 1000)
+/* Timeout for Flash set sector lock bit operations (in ms) */
+#define CFG_FLASH_LOCK_TOUT    (3 * 1000)
+/* Timeout for Flash clear lock bit operations (in ms) */
+#define CFG_FLASH_UNLOCK_TOUT  (3 * 1000)
+
+/* Use hardware flash sectors protection instead of U-Boot software protection */
+#undef  CFG_FLASH_PROTECTION
+#undef  CFG_DIRECT_FLASH_TFTP
+
+/* ENV setting */
+#define CFG_ENV_IS_IN_FLASH
+#define CONFIG_ENV_OVERWRITE   1
+#define CFG_ENV_SECT_SIZE      (128 * 1024)
+#define CFG_ENV_SIZE           (CFG_ENV_SECT_SIZE)
+#define CFG_ENV_ADDR           (CFG_FLASH_BASE + CFG_MONITOR_LEN)
+/* Offset of env Flash sector relative to CFG_FLASH_BASE */
+#define CFG_ENV_OFFSET         (CFG_ENV_ADDR - CFG_FLASH_BASE)
+#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SECT_SIZE)
+
+/* Board Clock */
+#define CONFIG_SYS_CLK_FREQ    33333333
+#define TMU_CLK_DIVIDER                (4)     /* 4 (default), 16, 64, 256 or 1024 */
+#define CFG_HZ                 (CONFIG_SYS_CLK_FREQ / TMU_CLK_DIVIDER)
+
+#endif /* __MIGO_R_H */
index 38fb7c6c789dae1adc4189f9cf91ebcddff17113..3e906c4251570833c7528db4de4356ded6a2193d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2006-2007
+ * (C) Copyright 2006-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * See file CREDITS for list of people who contributed to this
@@ -35,6 +35,7 @@
 #define CONFIG_LAST_STAGE_INIT 1           /* call last_stage_init()   */
 #undef CFG_DRAM_TEST                       /* Disable-takes long time! */
 #define CONFIG_SYS_CLK_FREQ    33333333    /* external freq to pll     */
+#define CONFIG_4xx_DCACHE              /* Enable i- and d-cache        */
 
 /*-----------------------------------------------------------------------
  * Base addresses -- Note these are effective addresses where the
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        "netdev=eth3\0"                                                 \
        "hostname=alpr\0"                                               \
+       "fdt_file=alpr/alpr.dtb\0"                                      \
+       "fdt_addr=400000\0"                                             \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=${serverip}:${rootpath} ${init}\0"             \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addtty;"     \
                "bootm\0"                                               \
+       "net_nfs_fdt=tftp 200000 ${bootfile};"                          \
+               "tftp ${fdt_addr} ${fdt_file};"                         \
+               "run nfsargs addip addtty;"                             \
+               "bootm 200000 - ${fdt_addr}\0"                          \
        "rootpath=/opt/projects/alpr/nfs_root\0"                        \
        "bootfile=/alpr/uImage\0"                                       \
        "kernel_addr=fff00000\0"                                        \
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
 #define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT       1
+#define CONFIG_OF_BOARD_SETUP  1
+
 #endif /* __CONFIG_H */
index a4bcc655ee2bab8bd6b5cf1d28f80a2fd9f9fc27..a1c6674b1ad5860939df7bdd0a3b6128c6db3cab 100644 (file)
 /*-----------------------------------------------------------------------
  * High Level Configuration Options
  *----------------------------------------------------------------------*/
-#define CONFIG_CANYONLANDS     1       /* Board is Canyonlands */
+/* This config file is used for Canyonlands (460EX) and Glacier (460GT)        */
+#ifndef CONFIG_CANYONLANDS
+#define CONFIG_460GT           1       /* Specific PPC460GT            */
+#else
+#define CONFIG_460EX           1       /* Specific PPC460EX            */
+#endif
 #define CONFIG_440             1
 #define CONFIG_4xx             1       /* ... PPC4xx family */
-#define CONFIG_460EX           1       /* Specific PPC460EX support */
 
 #define CONFIG_SYS_CLK_FREQ    66666667        /* external freq to pll */
 
 #define CONFIG_BOARD_EARLY_INIT_F      1       /* Call board_early_init_f */
 #define CONFIG_BOARD_EARLY_INIT_R      1       /* Call board_early_init_r */
 #define CONFIG_MISC_INIT_R             1       /* Call misc_init_r */
+#define CONFIG_BOARD_TYPES             1       /* support board types */
 
 /*-----------------------------------------------------------------------
  * Base addresses -- Note these are effective addresses where the
 #define CONFIG_MII             1       /* MII PHY management           */
 #define CONFIG_PHY_ADDR                0       /* PHY address, See schematics  */
 #define CONFIG_PHY1_ADDR       1
-#define CONFIG_HAS_ETH0                1
-#define CONFIG_HAS_ETH1                1       /* add support for "eth1addr"   */
+#define CONFIG_HAS_ETH0
+#define CONFIG_HAS_ETH1
+/* Only Glacier (460GT) has 4 EMAC interfaces */
+#ifdef CONFIG_460GT
+#define CONFIG_PHY2_ADDR       2
+#define CONFIG_PHY3_ADDR       3
+#define CONFIG_HAS_ETH2
+#define CONFIG_HAS_ETH3
+#endif
 #define CONFIG_NET_MULTI       1
 
 #define CONFIG_PHY_RESET       1       /* reset phy upon startup       */
 /*-----------------------------------------------------------------------
  * USB-OHCI
  *----------------------------------------------------------------------*/
+/* Only Canyonlands (460EX) has USB */
+#ifdef CONFIG_460EX
 #define CONFIG_USB_OHCI_NEW
 #define CONFIG_USB_STORAGE
 #undef CFG_OHCI_BE_CONTROLLER          /* 460EX has little endian descriptors  */
 #define CFG_USB_OHCI_REGS_BASE (CFG_AHB_BASE | 0xd0000)
 #define CFG_USB_OHCI_SLOT_NAME "ppc440"
 #define CFG_USB_OHCI_MAX_ROOT_PORTS 15
+#endif
 
 /*-----------------------------------------------------------------------
  * Default environment
 
 #undef CONFIG_BOOTARGS
 
+/* Setup some board specific values for the default environment variables */
+#ifdef CONFIG_CANYONLANDS
+#define CONFIG_HOSTNAME                canyonlands
+#define CFG_BOOTFILE           "bootfile=canyonlands/uImage\0"
+#define CFG_DTBFILE            "fdt_file=canyonlands/canyonlands.dtb\0"
+#else
+#define CONFIG_HOSTNAME                glacier
+#define CFG_BOOTFILE           "bootfile=glacier/uImage\0"
+#define CFG_DTBFILE            "fdt_file=glacier/glacier.dtb\0"
+#endif
+
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
+       CFG_BOOTFILE                                                    \
+       CFG_DTBFILE                                                     \
        "netdev=eth0\0"                                                 \
-       "hostname=canyonlands\0"                                        \
        "nfsargs=setenv bootargs root=/dev/nfs rw "                     \
                "nfsroot=${serverip}:${rootpath}\0"                     \
        "ramargs=setenv bootargs root=/dev/ram rw\0"                    \
        "flash_self=run ramargs addip addtty;"                          \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "rootpath=/opt/eldk/ppc_4xxFP\0"                                \
-       "bootfile=canyonlands/uImage\0"                                 \
-       "fdt_file=canyonlands/canyonlands.dtb\0"                        \
        "fdt_addr=400000\0"                                             \
        "kernel_addr=fc000000\0"                                        \
        "ramdisk_addr=fc200000\0"                                       \
        "initrd_high=30000000\0"                                        \
-       "load=tftp 200000 canyonlands/u-boot.bin\0"                     \
+       "load=tftp 200000 ${hostname}/u-boot.bin\0"                     \
        "update=protect off fffa0000 ffffffff;era fffa0000 ffffffff;"   \
                "cp.b ${fileaddr} fffa0000 ${filesize};"                \
                "setenv filesize;saveenv\0"                             \
        "upd=run load update\0"                                         \
-       "nload=tftp 200000 canyonlands/u-boot-nand.bin\0"               \
+       "nload=tftp 200000 ${hostname}/u-boot-nand.bin\0"               \
        "nupdate=nand erase 0 60000;nand write 200000 0 60000;"         \
                "setenv filesize;saveenv\0"                             \
        "nupd=run nload nupdate\0"                                      \
 #define CONFIG_CMD_DIAG
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_ELF
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_IRQ
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_SDRAM
+#ifdef CONFIG_460EX
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 #define CONFIG_CMD_USB
+#endif
 
 /* Partitions */
 #define CONFIG_MAC_PARTITION
 /*
  * PPC4xx GPIO Configuration
  */
+#ifdef CONFIG_460EX
+/* 460EX: Use USB configuration */
 #define CFG_4xx_GPIO_TABLE { /*          Out             GPIO  Alternate1      Alternate2      Alternate3 */ \
 {                                                                                      \
 /* GPIO Core 0 */                                                                      \
 {GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO63  Unselect via TraceSelect Bit */      \
 }                                                                                      \
 }
+#else
+/* 460GT: Use EMAC2+3 configuration */
+#define CFG_4xx_GPIO_TABLE { /*          Out             GPIO  Alternate1      Alternate2      Alternate3 */ \
+{                                                                                      \
+/* GPIO Core 0 */                                                                      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO0        GMC1TxD(0)      USB2HostD(0)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO1        GMC1TxD(1)      USB2HostD(1)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO2        GMC1TxD(2)      USB2HostD(2)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO3        GMC1TxD(3)      USB2HostD(3)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO4        GMC1TxD(4)      USB2HostD(4)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO5        GMC1TxD(5)      USB2HostD(5)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO6        GMC1TxD(6)      USB2HostD(6)    */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO7        GMC1TxD(7)      USB2HostD(7)    */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO8        GMC1RxD(0)      USB2OTGD(0)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO9        GMC1RxD(1)      USB2OTGD(1)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO10 GMC1RxD(2)    USB2OTGD(2)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO11 GMC1RxD(3)    USB2OTGD(3)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO12 GMC1RxD(4)    USB2OTGD(4)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO13 GMC1RxD(5)    USB2OTGD(5)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO14 GMC1RxD(6)    USB2OTGD(6)     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO15 GMC1RxD(7)    USB2OTGD(7)     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO16 GMC1TxER      USB2HostStop    */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO17 GMC1CD                USB2HostNext    */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO18 GMC1RxER      USB2HostDir     */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO19 GMC1TxEN      USB2OTGStop     */      \
+{GPIO0_BASE, GPIO_BI , GPIO_ALT1, GPIO_OUT_0}, /* GPIO20 GMC1CRS       USB2OTGNext     */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO21 GMC1RxDV      USB2OTGDir      */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO22 NFRDY                         */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO23 NFREN                         */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO24 NFWEN                         */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO25 NFCLE                         */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO26 NFALE                         */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO27 IRQ(0)                                */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO28 IRQ(1)                                */      \
+{GPIO0_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO29 IRQ(2)                                */      \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO30 PerPar0       DMAReq2         IRQ(7)*/ \
+{GPIO0_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO31 PerPar1       DMAAck2         IRQ(8)*/ \
+},                                                                                     \
+{                                                                                      \
+/* GPIO Core 1 */                                                                      \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO32 PerPar2       EOT2/TC2        IRQ(9)*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_SEL , GPIO_OUT_1}, /* GPIO33 PerPar3       DMAReq3         IRQ(4)*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT3, GPIO_OUT_1}, /* GPIO34 UART0_DCD_N   UART1_DSR_CTS_N UART2_SOUT*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT3, GPIO_OUT_0}, /* GPIO35 UART0_8PIN_DSR_N UART1_RTS_DTR_N UART2_SIN*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT3, GPIO_OUT_0}, /* GPIO36 UART0_8PIN_CTS_N DMAAck3      UART3_SIN*/ \
+{GPIO1_BASE, GPIO_BI , GPIO_ALT2, GPIO_OUT_0}, /* GPIO37 UART0_RTS_N   EOT3/TC3        UART3_SOUT*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT2, GPIO_OUT_1}, /* GPIO38 UART0_DTR_N   UART1_SOUT      */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT2, GPIO_OUT_0}, /* GPIO39 UART0_RI_N    UART1_SIN       */      \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT1, GPIO_OUT_0}, /* GPIO40 IRQ(3)                                */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO41 CS(1)                         */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO42 CS(2)                         */      \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO43 CS(3)         DMAReq1         IRQ(10)*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT3, GPIO_OUT_0}, /* GPIO44 CS(4)         DMAAck1         IRQ(11)*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_ALT3, GPIO_OUT_0}, /* GPIO45 CS(5)         EOT/TC1         IRQ(12)*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO46 PerAddr(5)    DMAReq0         IRQ(13)*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO47 PerAddr(6)    DMAAck0         IRQ(14)*/ \
+{GPIO1_BASE, GPIO_OUT, GPIO_ALT1, GPIO_OUT_0}, /* GPIO48 PerAddr(7)    EOT/TC0         IRQ(15)*/ \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO49  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO50  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO51  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO52  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO53  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO54  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO55  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO56  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO57  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO58  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO59  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO60  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO61  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO62  Unselect via TraceSelect Bit */      \
+{GPIO1_BASE, GPIO_IN , GPIO_SEL , GPIO_OUT_0}, /* GPIO63  Unselect via TraceSelect Bit */      \
+}                                                                                      \
+}
+#endif
 
 /* pass open firmware flat tree */
 #define CONFIG_OF_LIBFDT       1
index dcec9b039d865b3f6e3276e7b613327547c1b2a8..48d73ac376f77974a48bb593965b2abf562eb61c 100644 (file)
  * Manufacturer's information serial EEPROM parameters
  */
 #define MAN_DATA_EEPROM_ADDR   0x53    /* EEPROM I2C address           */
-#define MAN_SERIAL_NO_FIELD    2
-#define MAN_SERIAL_NO_LENGTH   13
+#define MAN_INFO_FIELD         2
+#define MAN_INFO_LENGTH                9
 #define MAN_MAC_ADDR_FIELD     3
-#define MAN_MAC_ADDR_LENGTH    17
+#define MAN_MAC_ADDR_LENGTH    12
 
 /*
  * Base addresses -- Note these are effective addresses where the actual
 #define CFG_MONITOR_LEN                (384 * 1024) /* Reserve 384 kiB for Monitor  */
 #define CFG_MALLOC_LEN         (256 * 1024) /* Reserve 256 kiB for malloc() */
 
-#define CFG_BOOT_BASE_ADDR     0xf0000000
 #define CFG_SDRAM_BASE         0x00000000      /* _must_ be 0          */
-#define CFG_FLASH_BASE         0xfc000000      /* start of FLASH       */
+#define CFG_FLASH0_SIZE                0x01000000
+#define CFG_FLASH0_ADDR                (-CFG_FLASH0_SIZE)
+#define CFG_FLASH1_TOP         0xF8000000
+#define CFG_FLASH1_MAX_SIZE    0x08000000
+#define CFG_FLASH1_ADDR                (CFG_FLASH1_TOP - CFG_FLASH1_MAX_SIZE)
+#define CFG_FLASH_BASE         CFG_FLASH1_ADDR /* start of FLASH       */
 #define CFG_MONITOR_BASE       TEXT_BASE
 #define CFG_OCM_BASE           0xe0010000      /* ocm                  */
 #define CFG_OCM_DATA_ADDR      CFG_OCM_BASE
 #define CFG_PCI_BASE           0xe0000000      /* Internal PCI regs    */
 #define CFG_PCI_MEMBASE                0x80000000      /* mapped pci memory    */
-#define CFG_PCI_MEMBASE1       CFG_PCI_MEMBASE  + 0x10000000
-#define CFG_PCI_MEMBASE2       CFG_PCI_MEMBASE1 + 0x10000000
-#define CFG_PCI_MEMBASE3       CFG_PCI_MEMBASE2 + 0x10000000
 
 /* Don't change either of these */
 #define CFG_PERIPHERAL_BASE    0xef600000      /* internal peripherals */
 /*
  * FLASH related
  */
-#define CFG_FLASH_CFI                  /* The flash is CFI compatible  */
-#define CFG_FLASH_CFI_DRIVER           /* Use common CFI driver        */
+#define CFG_FLASH_CFI                  /* The flash is CFI compatible        */
+#define CFG_FLASH_CFI_DRIVER           /* Use common CFI driver              */
+#define CONFIG_FLASH_CFI_LEGACY                /* Allow hard-coded config for FLASH0 */
 
-#define CFG_FLASH_BANKS_LIST   { CFG_FLASH_BASE }
+#define CFG_FLASH_BANKS_LIST   { CFG_FLASH1_ADDR, CFG_FLASH0_ADDR }
 
-#define CFG_MAX_FLASH_BANKS    1       /* max number of memory banks         */
-#define CFG_MAX_FLASH_SECT     512     /* max number of sectors on one chip  */
+#define CFG_MAX_FLASH_BANKS    2       /* max number of memory banks         */
+#define CFG_MAX_FLASH_SECT     1024    /* max number of sectors on one chip  */
 
 #define CFG_FLASH_ERASE_TOUT   120000  /* Timeout for Flash Erase (in ms)    */
 #define CFG_FLASH_WRITE_TOUT   500     /* Timeout for Flash Write (in ms)    */
 #define CFG_FLASH_QUIET_TEST   1       /* don't warn upon unknown flash      */
 
 #define CFG_ENV_SECT_SIZE      0x20000 /* size of one complete sector        */
-#define CFG_ENV_ADDR           ((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
+#define CFG_ENV_ADDR           (CFG_FLASH1_TOP - CFG_ENV_SECT_SIZE)
 #define        CFG_ENV_SIZE            0x2000  /* Total Size of Environment Sector   */
 
-/* Address and size of Redundant Environment Sector    */
-#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR-CFG_ENV_SECT_SIZE)
-#define CFG_ENV_SIZE_REDUND    (CFG_ENV_SIZE)
+/* Address and size of Redundant Environment Sector */
+#define CFG_ENV_ADDR_REDUND    (CFG_ENV_ADDR - CFG_ENV_SECT_SIZE)
+#define CFG_ENV_SIZE_REDUND    CFG_ENV_SIZE
 
 /*
  * DDR SDRAM
 #define SPD_EEPROM_ADDRESS     {0x50}
 #define CONFIG_PROG_SDRAM_TLB
 #define CFG_DRAM_TEST
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /*
  * I2C
 #define CFG_BOOTFILE           "bootfile=/tftpboot/korat/uImage\0"
 #define CFG_ROOTPATH           "rootpath=/opt/eldk/ppc_4xxFP\0"
 
+/* Note: kernel_addr and ramdisk_addr assume that FLASH1 is 64 MiB. */
 #define        CONFIG_EXTRA_ENV_SETTINGS                                       \
        CFG_BOOTFILE                                                    \
        CFG_ROOTPATH                                                    \
                "bootm ${kernel_addr} ${ramdisk_addr}\0"                \
        "net_nfs=tftp 200000 ${bootfile};run nfsargs addip addtty;"     \
                "bootm\0"                                               \
-       "kernel_addr=FC000000\0"                                        \
-       "ramdisk_addr=FC180000\0"                                       \
+       "kernel_addr=F4000000\0"                                        \
+       "ramdisk_addr=F4400000\0"                                       \
        "load=tftp 200000 /tftpboot/${hostname}/u-boot.bin\0"           \
        "update=protect off FFFA0000 FFFFFFFF;era FFFA0000 FFFFFFFF;"   \
                "cp.b 200000 FFFA0000 60000\0"                          \
 #define CONFIG_PHY_ADDR                2       /* PHY address, See schematics  */
 #define CONFIG_PHY_DYNAMIC_ANEG        1
 
-#define CONFIG_PHY_RESET       1       /* reset phy upon startup       */
+#undef CONFIG_PHY_RESET                        /* Don't do software PHY reset  */
 #define CONFIG_PHY_GIGE                1       /* Include GbE speed/duplex detection */
 
 #define CONFIG_HAS_ETH0
 #define CONFIG_ZERO_BOOTDELAY_CHECK    /* check for keypress on bootdelay==0 */
 #define CONFIG_VERSION_VARIABLE 1      /* include version env variable */
 
+/*
+ * Korat-specific options
+ */
+#define CFG_KORAT_MAN_RESET_MS 10000   /* timeout for manufacturer reset */
+
 /*
  * PCI stuff
  */
  */
 
 /* Memory Bank 0 (NOR-FLASH) initialization                            */
+#if CFG_FLASH0_SIZE == 0x01000000
+#define CFG_EBC_PB0AP          0x04017300
+#define CFG_EBC_PB0CR          (CFG_FLASH0_ADDR | 0x0009A000)
+#elif CFG_FLASH0_SIZE == 0x04000000
 #define CFG_EBC_PB0AP          0x04017300
-#define CFG_EBC_PB0CR          (CFG_FLASH_BASE | 0x000DA000)
+#define CFG_EBC_PB0CR          (CFG_FLASH0_ADDR | 0x000DA000)
+#else
+#error Unable to configure chip select for current CFG_FLASH0_SIZE
+#endif
 
 /* Memory Bank 1 (NOR-FLASH) initialization                            */
+#if CFG_FLASH1_MAX_SIZE == 0x08000000
 #define CFG_EBC_PB1AP          0x04017300
-#define CFG_EBC_PB1CR          (0xF8000000 | 0x000DA000)
+#define CFG_EBC_PB1CR          (CFG_FLASH1_ADDR | 0x000FA000)
+#else
+#error Unable to configure chip select for current CFG_FLASH1_MAX_SIZE
+#endif
 
 /* Memory Bank 2 (CPLD) initialization                                 */
 #define CFG_EBC_PB2AP          0x04017300
  * GPIO63  xxxx   x    x   (reserved for trace port)
  */
 
+#define CFG_GPIO_ATMEGA_RESET_ 12
 #define CFG_GPIO_ATMEGA_SS_    13
 #define CFG_GPIO_PHY0_FIBER_SEL        27
 #define CFG_GPIO_PHY1_FIBER_SEL        28
 #define CFG_GPIO_SFP1_TX_EN_   33
 #define CFG_GPIO_PHY0_EN       45
 #define CFG_GPIO_PHY1_EN       46
+#define CFG_GPIO_RESET_PRESSED_        47
 
 /*
  * PPC440 GPIO Configuration
index ced7ba6f05cf3bf05e3fb09d09685811ba562068..4398b87ae1b13da4ad6dec682c089e435e593072 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007
+ * (C) Copyright 2007-2008
  * Stefan Roese, DENX Software Engineering, sr@denx.de.
  *
  * This program is free software; you can redistribute it and/or
@@ -86,6 +86,8 @@
 #define CFG_INIT_SP_OFFSET     CFG_GBL_DATA_OFFSET
 #define CFG_POST_ALT_WORD_ADDR (CFG_PERIPHERAL_BASE + GPT0_COMP6)
                                                /* unused GPT0 COMP reg */
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /* Additional registers for watchdog timer post test */
 
 #define CFG_MBYTES_SDRAM       (256)           /* 256MB                        */
 #define CFG_DDR_CACHED_ADDR    0x40000000      /* setup 2nd TLB cached here    */
 #define CONFIG_DDR_DATA_EYE    1               /* use DDR2 optimization        */
-#if 0 /* test-only: disable ECC for now */
 #define CONFIG_DDR_ECC         1               /* enable ECC                   */
 #define CFG_POST_ECC_ON                CFG_POST_ECC
-#else
-#define CFG_POST_ECC_ON                0
-#endif
 
 /* POST support */
 #define CONFIG_POST            (CFG_POST_CACHE    | \
diff --git a/include/configs/mpr2.h b/include/configs/mpr2.h
new file mode 100644 (file)
index 0000000..0fc0b97
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Configuation settings for MPR2
+ *
+ * Copyright (C) 2008
+ * Mark Jonas <mark.jonas@de.bosch.com>
+ *
+ * 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
+ */
+
+#ifndef __MPR2_H
+#define __MPR2_H
+
+/* Supported commands */
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_FLASH
+
+/* Default environment variables */
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_BOOTARGS                "console=ttySC0,115200"
+#define CONFIG_BOOTFILE                /boot/zImage
+#define CONFIG_LOADADDR                0x8E000000
+#define CONFIG_VERSION_VARIABLE
+
+/* CPU and platform */
+#define CONFIG_SH              1
+#define CONFIG_SH3             1
+#define CONFIG_CPU_SH7720      1
+#define CONFIG_MPR2            1
+
+/* U-Boot internals */
+#define CFG_LONGHELP                   /* undef to save memory */
+#define CFG_PROMPT             "=> "   /* Monitor Command Prompt */
+#define CFG_CBSIZE             256     /* Buffer size for input from the Console */
+#define CFG_PBSIZE             256     /* Buffer size for Console output */
+#define CFG_MAXARGS            16      /* max args accepted for monitor commands */
+#define CFG_BARGSIZE           512     /* Buffer size for Boot Arguments passed to kernel */
+#define CFG_BAUDRATE_TABLE     { 115200 }      /* List of legal baudrate settings for this board */
+#define CFG_LOAD_ADDR          (CFG_SDRAM_BASE + 32 * 1024 * 1024)
+#define CFG_MONITOR_BASE       CFG_FLASH_BASE
+#define CFG_MONITOR_LEN                (128 * 1024)
+#define CFG_MALLOC_LEN         (256 * 1024)
+#define CFG_GBL_DATA_SIZE      256
+
+/* Memory */
+#define CFG_SDRAM_BASE         0x8C000000
+#define CFG_SDRAM_SIZE         (64 * 1024 * 1024)
+#define CFG_MEMTEST_START      CFG_SDRAM_BASE
+#define CFG_MEMTEST_END                (CFG_MEMTEST_START + (60 * 1024 * 1024))
+
+/* Flash */
+#define CFG_FLASH_CFI
+#define CFG_FLASH_CFI_DRIVER
+#define CFG_FLASH_EMPTY_INFO
+#define CFG_FLASH_BASE         0xA0000000
+#define CFG_MAX_FLASH_SECT     256
+#define CFG_MAX_FLASH_BANKS    1
+#define CFG_FLASH_BANKS_LIST   { CFG_FLASH_BASE }
+#define CFG_ENV_IS_IN_FLASH
+#define CFG_ENV_SECT_SIZE      (128 * 1024)
+#define CFG_ENV_SIZE           CFG_ENV_SECT_SIZE
+#define CFG_ENV_ADDR           (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#define CFG_FLASH_ERASE_TOUT   120000
+#define CFG_FLASH_WRITE_TOUT   500
+
+/* Clocks */
+#define CONFIG_SYS_CLK_FREQ    24000000
+#define TMU_CLK_DIVIDER                4       /* 4 (default), 16, 64, 256 or 1024 */
+#define CFG_HZ                 (CONFIG_SYS_CLK_FREQ / TMU_CLK_DIVIDER)
+
+/* UART */
+#define CFG_SCIF_CONSOLE       1
+#define CONFIG_CONS_SCIF0      1
+
+#endif /* __MPR2_H */
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
new file mode 100644 (file)
index 0000000..c20baca
--- /dev/null
@@ -0,0 +1,150 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#undef DEBUG
+
+#define CONFIG_SH              1
+#define CONFIG_SH4             1
+#define CONFIG_CPU_SH7751      1
+#define CONFIG_CPU_SH_TYPE_R   1
+#define CONFIG_R2DPLUS         1
+#define __LITTLE_ENDIAN__      1
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_DFL
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_FLASH
+#define CONFIG_CMD_PCI
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_EXT2
+#define CONFIG_DOS_PARTITION
+
+/* SCIF */
+#define CFG_SCIF_CONSOLE       1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_CONS_SCIF1      1
+#define BOARD_LATE_INIT                1
+
+#define CONFIG_BOOTDELAY       -1
+#define CONFIG_BOOTARGS                "console=ttySC0,115200"
+#define CONFIG_ENV_OVERWRITE   1
+
+/* Network setting */
+#define CONFIG_NETMASK         255.0.0.0
+#define CONFIG_IPADDR          10.0.192.51
+#define CONFIG_SERVERIP                10.0.0.1
+#define CONFIG_GATEWAYIP       10.0.0.1
+
+/* SDRAM */
+#define CFG_SDRAM_BASE         (0x8C000000)
+#define CFG_SDRAM_SIZE         (0x04000000)
+
+#define CFG_LONGHELP
+#define CFG_PROMPT             "=> "
+#define CFG_CBSIZE             256
+#define CFG_PBSIZE             256
+#define CFG_MAXARGS            16
+#define CFG_BARGSIZE           512
+/* List of legal baudrate settings for this board */
+#define CFG_BAUDRATE_TABLE     { 115200, 57600, 38400, 19200, 9600 }
+
+#define CFG_MEMTEST_START      (CFG_SDRAM_BASE)
+#define CFG_MEMTEST_END                (TEXT_BASE - 0x100000)
+
+#define CFG_LOAD_ADDR          (CFG_SDRAM_BASE + 32 * 1024 * 1024)
+/* Address of u-boot image in Flash */
+#define CFG_MONITOR_BASE       (CFG_FLASH_BASE)
+#define CFG_MONITOR_LEN                (128 * 1024)
+/* Size of DRAM reserved for malloc() use */
+#define CFG_MALLOC_LEN         (256 * 1024)
+/* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_SIZE      (256)
+#define CFG_BOOTMAPSZ          (8 * 1024 * 1024)
+
+/*
+ * NOR Flash
+ */
+#define CFG_FLASH_CFI
+#define CFG_FLASH_CFI_DRIVER
+
+#if defined(CONFIG_R2DPLUS_OLD)
+#define CFG_FLASH_BASE         (0xA0000000)
+#define CFG_MAX_FLASH_BANKS (1)        /* Max number of
+                                * Flash memory banks
+                                */
+#define CFG_MAX_FLASH_SECT  142
+#define CFG_FLASH_BANKS_LIST    { CFG_FLASH_BASE }
+
+#else /* CONFIG_R2DPLUS_OLD */
+
+#define CFG_FLASH_BASE         (0xA0000000)
+#define CFG_FLASH_CFI_WIDTH    0x04    /* 32bit */
+#define CFG_MAX_FLASH_BANKS    (2)
+#define CFG_MAX_FLASH_SECT     270
+#define CFG_FLASH_BANKS_LIST    { CFG_FLASH_BASE,\
+                       CFG_FLASH_BASE + 0x100000,\
+                       CFG_FLASH_BASE + 0x400000,\
+                       CFG_FLASH_BASE + 0x700000, }
+#endif /* CONFIG_R2DPLUS_OLD */
+
+#define CFG_ENV_IS_IN_FLASH
+#define CFG_ENV_SECT_SIZE      0x20000
+#define CFG_ENV_SIZE           (CFG_ENV_SECT_SIZE)
+#define CFG_ENV_ADDR           (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#define CFG_FLASH_ERASE_TOUT   120000
+#define CFG_FLASH_WRITE_TOUT   500
+
+/*
+ * SuperH Clock setting
+ */
+#define CONFIG_SYS_CLK_FREQ    60000000
+#define TMU_CLK_DIVIDER                4
+#define CFG_HZ                 (CONFIG_SYS_CLK_FREQ / TMU_CLK_DIVIDER)
+#define        CFG_PLL_SETTLING_TIME   100/* in us */
+
+/*
+ * IDE support
+ */
+#define CONFIG_IDE_RESET       1
+#define CFG_PIO_MODE           1
+#define CFG_IDE_MAXBUS         1 /* IDE bus */
+#define CFG_IDE_MAXDEVICE      1
+#define CFG_ATA_BASE_ADDR      0xb4000000
+#define CFG_ATA_STRIDE         2 /* 1bit shift */
+#define CFG_ATA_DATA_OFFSET    0x1000  /* data reg offset */
+#define CFG_ATA_REG_OFFSET     0x1000  /* reg offset */
+#define CFG_ATA_ALT_OFFSET     0x800   /* alternate register offset */
+
+/*
+ * SuperH PCI Bridge Configration
+ */
+#define CONFIG_PCI
+#define CONFIG_SH4_PCI
+#define CONFIG_SH7751_PCI
+#define CONFIG_PCI_PNP
+#define CONFIG_PCI_SCAN_SHOW   1
+#define __io
+#define __mem_pci
+
+#define CONFIG_PCI_MEM_BUS     0xFD000000      /* Memory space base addr */
+#define CONFIG_PCI_MEM_PHYS    CONFIG_PCI_MEM_BUS
+#define CONFIG_PCI_MEM_SIZE    0x01000000      /* Size of Memory window */
+#define CONFIG_PCI_IO_BUS      0xFE240000      /* IO space base address */
+#define CONFIG_PCI_IO_PHYS     CONFIG_PCI_IO_BUS
+#define CONFIG_PCI_IO_SIZE     0x00040000      /* Size of IO window */
+
+/*
+ * Network device (RTL8139) support
+ */
+#define CONFIG_NET_MULTI
+#define CONFIG_RTL8139
+#define _IO_BASE               0x00000000
+#define KSEG1ADDR(x)           (x)
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/r7780mp.h b/include/configs/r7780mp.h
new file mode 100644 (file)
index 0000000..42787f4
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Configuation settings for the Renesas R7780MP board
+ *
+ * Copyright (C) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+ * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
+ *
+ * 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
+ */
+
+#ifndef __R7780RP_H
+#define __R7780RP_H
+
+#undef DEBUG
+#define CONFIG_SH              1
+#define CONFIG_SH4A            1
+#define CONFIG_CPU_SH7780      1
+#define CONFIG_R7780MP         1
+#define __LITTLE_ENDIAN 1
+
+/*
+ * Command line configuration.
+ */
+#define CONFIG_CMD_SDRAM
+#define CONFIG_CMD_FLASH
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_PCI
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_EXT2
+#define CONFIG_DOS_PARTITION
+
+#define CFG_SCIF_CONSOLE       1
+#define CONFIG_BAUDRATE                115200
+#define CONFIG_CONS_SCIF0      1
+
+#define CONFIG_BOOTDELAY       3
+#define CONFIG_BOOTARGS                "console=ttySC0,115200"
+#define CONFIG_ENV_OVERWRITE   1
+
+/* check for keypress on bootdelay==0 */
+/*#define CONFIG_ZERO_BOOTDELAY_CHECK*/
+
+/* Network setting */
+#define CONFIG_NETMASK         255.0.0.0
+#define CONFIG_IPADDR          10.0.192.82
+#define CONFIG_SERVERIP                10.0.0.1
+#define CONFIG_GATEWAYIP       10.0.0.1
+
+#define CFG_SDRAM_BASE         (0x08000000)
+#define CFG_SDRAM_SIZE         (128 * 1024 * 1024)
+
+#define CFG_LONGHELP
+#define CFG_PROMPT             "=> "
+#define CFG_CBSIZE             256
+#define CFG_PBSIZE             256
+#define CFG_MAXARGS            16
+#define CFG_BARGSIZE   512
+/* List of legal baudrate settings for this board */
+#define CFG_BAUDRATE_TABLE     { 115200, 57600, 38400, 19200, 9600 }
+
+#define CFG_MEMTEST_START      (CFG_SDRAM_BASE)
+#define CFG_MEMTEST_END                (TEXT_BASE - 0x100000)
+
+/* NOR Flash (S29PL127J60TFI130) */
+#define CFG_FLASH_BASE         (0xA0000000)
+#define CFG_FLASH_CFI_WIDTH FLASH_CFI_32BIT
+#define CFG_MAX_FLASH_BANKS (2)
+#define CFG_MAX_FLASH_SECT  270
+#define CFG_FLASH_BANKS_LIST    { CFG_FLASH_BASE,\
+                               CFG_FLASH_BASE + 0x100000,\
+                               CFG_FLASH_BASE + 0x400000,\
+                               CFG_FLASH_BASE + 0x700000, }
+
+#define CFG_LOAD_ADDR          (CFG_SDRAM_BASE + 4 * 1024 * 1024)
+/* Address of u-boot image in Flash */
+#define CFG_MONITOR_BASE       (CFG_FLASH_BASE)
+#define CFG_MONITOR_LEN                (112 * 1024)
+/* Size of DRAM reserved for malloc() use */
+#define CFG_MALLOC_LEN         (256 * 1024)
+
+/* size in bytes reserved for initial data */
+#define CFG_GBL_DATA_SIZE      (256)
+#define CFG_BOOTMAPSZ          (8 * 1024 * 1024)
+#define CFG_RX_ETH_BUFFER      (8)
+
+#define CFG_FLASH_CFI
+#define CFG_FLASH_CFI_DRIVER
+#undef CFG_FLASH_CFI_BROKEN_TABLE
+#undef  CFG_FLASH_QUIET_TEST
+/* print 'E' for empty sector on flinfo */
+#define CFG_FLASH_EMPTY_INFO
+
+#define CFG_ENV_IS_IN_FLASH
+#define CFG_ENV_SECT_SIZE      (16 * 1024)
+#define CFG_ENV_SIZE           (CFG_ENV_SECT_SIZE)
+#define CFG_ENV_ADDR           (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#define CFG_FLASH_ERASE_TOUT   120000
+#define CFG_FLASH_WRITE_TOUT   500
+
+/* Board Clock */
+#define CONFIG_SYS_CLK_FREQ    33333333
+#define TMU_CLK_DIVIDER                4
+#define CFG_HZ (CONFIG_SYS_CLK_FREQ / TMU_CLK_DIVIDER)
+
+/* PCI Controller */
+#if defined(CONFIG_CMD_PCI)
+#define CONFIG_PCI
+#define CONFIG_SH4_PCI
+#define CONFIG_SH7780_PCI
+#define CONFIG_PCI_PNP
+#define CONFIG_PCI_SCAN_SHOW   1
+#define __io
+#define __mem_pci
+
+#define CONFIG_PCI_MEM_BUS     0xFD000000      /* Memory space base addr */
+#define CONFIG_PCI_MEM_PHYS    CONFIG_PCI_MEM_BUS
+#define CONFIG_PCI_MEM_SIZE    0x01000000      /* Size of Memory window */
+
+#define CONFIG_PCI_IO_BUS      0xFE200000      /* IO space base address */
+#define CONFIG_PCI_IO_PHYS     CONFIG_PCI_IO_BUS
+#define CONFIG_PCI_IO_SIZE     0x00200000      /* Size of IO window */
+#endif /* CONFIG_CMD_PCI */
+
+#if defined(CONFIG_CMD_NET)
+/* #define CONFIG_NET_MULTI
+   #define CONFIG_RTL8169 */
+/* AX88696L Support(NE2000 base chip) */
+#define CONFIG_DRIVER_NE2000
+#define CONFIG_DRIVER_AX88796L
+#define CONFIG_DRIVER_NE2000_BASE      0xA4100000
+#endif
+
+/* Compact flash Support */
+#if defined(CONFIG_CMD_IDE)
+#define CONFIG_IDE_RESET        1
+#define CFG_PIO_MODE            1
+#define CFG_IDE_MAXBUS          1   /* IDE bus */
+#define CFG_IDE_MAXDEVICE       1
+#define CFG_ATA_BASE_ADDR       0xb4000000
+#define CFG_ATA_STRIDE          2               /* 1bit shift */
+#define CFG_ATA_DATA_OFFSET     0x1000          /* data reg offset */
+#define CFG_ATA_REG_OFFSET      0x1000          /* reg offset */
+#define CFG_ATA_ALT_OFFSET      0x800           /* alternate register offset */
+#endif /* CONFIG_CMD_IDE */
+
+#endif /* __R7780RP_H */
index dfa8779bccc31c8f7118cb73c1dc55e4c2177ddd..555316ff63811598d64e6f365cd8c7330fd564d9 100644 (file)
 #if !defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
 #define CONFIG_DDR_DATA_EYE            /* use DDR2 optimization        */
 #endif
+#define CFG_MEM_TOP_HIDE       (4 << 10) /* don't use last 4kbytes     */
+                                       /* 440EPx errata CHIP 11        */
 
 /*
  * I2C
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off panic=1\0"                  \
        "addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
-       "addmisc=setenv bootargs ${bootargs} mem=${mem}\0"              \
+       "addmisc=setenv bootargs ${bootargs}\0"                         \
        "flash_nfs=run nfsargs addip addtty addmisc;"                   \
                "bootm ${kernel_addr}\0"                                \
        "flash_self=run ramargs addip addtty addmisc;"                  \
index 37f2924df18881bf6569c21607cc9d19518f794a..2ce1c25ac309b79328a82053d4fb3477f51ad2a8 100644 (file)
@@ -126,7 +126,7 @@ struct stat {
 
 #endif /* __MIPS__ */
 
-#if defined(__AVR32__)
+#if defined(__AVR32__) || defined(__SH__)
 
 struct stat {
        unsigned long st_dev;
@@ -149,7 +149,7 @@ struct stat {
        unsigned long  __unused5;
 };
 
-#endif /* __AVR32__ */
+#endif /* __AVR32__ || __SH__ */
 
 #ifdef __cplusplus
 }
index 4ee38aafa94f0dfc988ee77ed21c5f769c686011..d2e1e2bb6c8705256568decada830cd0b3f5d25c 100644 (file)
 
 /* SPRIDR - System Part and Revision ID Register
  */
-#define SPRIDR_PARTID                  0xFFFF0000      /* Part Identification */
-#define SPRIDR_REVID                   0x0000FFFF      /* Revision Identification */
-
-#define SPR_8349E_REV10                        0x80300100
-#define SPR_8349_REV10                 0x80310100
-#define SPR_8347E_REV10_TBGA           0x80320100
-#define SPR_8347_REV10_TBGA            0x80330100
-#define SPR_8347E_REV10_PBGA           0x80340100
-#define SPR_8347_REV10_PBGA            0x80350100
-#define SPR_8343E_REV10                        0x80360100
-#define SPR_8343_REV10                 0x80370100
-
-#define SPR_8349E_REV11                        0x80300101
-#define SPR_8349_REV11                 0x80310101
-#define SPR_8347E_REV11_TBGA           0x80320101
-#define SPR_8347_REV11_TBGA            0x80330101
-#define SPR_8347E_REV11_PBGA           0x80340101
-#define SPR_8347_REV11_PBGA            0x80350101
-#define SPR_8343E_REV11                        0x80360101
-#define SPR_8343_REV11                 0x80370101
-
-#define SPR_8349E_REV31                        0x80300300
-#define SPR_8349_REV31                 0x80310300
-#define SPR_8347E_REV31_TBGA           0x80320300
-#define SPR_8347_REV31_TBGA            0x80330300
-#define SPR_8347E_REV31_PBGA           0x80340300
-#define SPR_8347_REV31_PBGA            0x80350300
-#define SPR_8343E_REV31                        0x80360300
-#define SPR_8343_REV31                 0x80370300
-
-#define SPR_8360E_REV10                        0x80480010
-#define SPR_8360_REV10                 0x80490010
-#define SPR_8360E_REV11                        0x80480011
-#define SPR_8360_REV11                 0x80490011
-#define SPR_8360E_REV12                        0x80480012
-#define SPR_8360_REV12                 0x80490012
-#define SPR_8360E_REV20                        0x80480020
-#define SPR_8360_REV20                 0x80490020
-#define SPR_8360E_REV21                        0x80480021
-#define SPR_8360_REV21                 0x80490021
-
-#define SPR_8323E_REV10                        0x80620010
-#define SPR_8323_REV10                 0x80630010
-#define SPR_8321E_REV10                        0x80660010
-#define SPR_8321_REV10                 0x80670010
-#define SPR_8323E_REV11                        0x80620011
-#define SPR_8323_REV11                 0x80630011
-#define SPR_8321E_REV11                        0x80660011
-#define SPR_8321_REV11                 0x80670011
-
-#define SPR_8313E_REV10                        0x80B00010
-#define SPR_8313_REV10                 0x80B10010
-#define SPR_8311E_REV10                        0x80B20010
-#define SPR_8311_REV10                 0x80B30010
-#define SPR_8315E_REV10                        0x80B40010
-#define SPR_8315_REV10                 0x80B50010
-#define SPR_8314E_REV10                        0x80B60010
-#define SPR_8314_REV10                 0x80B70010
-
-#define SPR_8379E_REV10                        0x80C20010
-#define SPR_8379_REV10                 0x80C30010
-#define SPR_8378E_REV10                        0x80C40010
-#define SPR_8378_REV10                 0x80C50010
-#define SPR_8377E_REV10                        0x80C60010
-#define SPR_8377_REV10                 0x80C70010
+#define SPRIDR_PARTID                  0xFFFF0000      /* Part Id */
+#define SPRIDR_REVID                   0x0000FFFF      /* Revision Id */
+
+#if defined(CONFIG_MPC834X)
+#define REVID_MAJOR(spridr)            ((spridr & 0x0000FF00) >> 8)
+#define REVID_MINOR(spridr)            (spridr & 0x000000FF)
+#else
+#define REVID_MAJOR(spridr)            ((spridr & 0x000000F0) >> 4)
+#define REVID_MINOR(spridr)            (spridr & 0x0000000F)
+#endif
+
+#define PARTID_NO_E(spridr)            ((spridr & 0xFFFE0000) >> 16)
+#define IS_E_PROCESSOR(spridr)         (!(spridr & 0x00010000)) /* has SEC */
+
+#define SPR_8311                       0x80B2
+#define SPR_8313                       0x80B0
+#define SPR_8314                       0x80B6
+#define SPR_8315                       0x80B4
+#define SPR_8321                       0x8066
+#define SPR_8323                       0x8062
+#define SPR_8343                       0x8036
+#define SPR_8347_TBGA_                 0x8032
+#define SPR_8347_PBGA_                 0x8034
+#define SPR_8349                       0x8030
+#define SPR_8358_TBGA_                 0x804A
+#define SPR_8358_PBGA_                 0x804E
+#define SPR_8360                       0x8048
+#define SPR_8377                       0x80C6
+#define SPR_8378                       0x80C4
+#define SPR_8379                       0x80C2
 
 /* SPCR - System Priority Configuration Register
  */
index 10517cbb6509e3fd9dd6e3500e79566ea5dde4ba..642d1ded7628edd3e0db4e2653bbb2f0b4b30674 100644 (file)
 #define malrxctp2r  (MAL_DCR_BASE+0x42) /* RX 2 Channel table pointer reg   */
 #define malrxctp3r  (MAL_DCR_BASE+0x43) /* RX 3 Channel table pointer reg   */
 #define malrxctp8r  (MAL_DCR_BASE+0x48) /* RX 8 Channel table pointer reg   */
+#define malrxctp16r (MAL_DCR_BASE+0x50) /* RX 16 Channel table pointer reg  */
+#define malrxctp24r (MAL_DCR_BASE+0x58) /* RX 24 Channel table pointer reg  */
 #define malrcbs2    (MAL_DCR_BASE+0x62) /* RX 2 Channel buffer size reg            */
 #define malrcbs3    (MAL_DCR_BASE+0x63) /* RX 3 Channel buffer size reg            */
 #define malrcbs8    (MAL_DCR_BASE+0x68) /* RX 8 Channel buffer size reg            */
+#define malrcbs16   (MAL_DCR_BASE+0x70) /* RX 16 Channel buffer size reg    */
+#define malrcbs24   (MAL_DCR_BASE+0x78) /* RX 24 Channel buffer size reg    */
 #endif /* CONFIG_440GX */
 
 
index 02084546b2f14d2a1840d50936d4e163fa70e534..89ff26f991254b4863d4905ecf48524ccaa9e644 100644 (file)
@@ -213,6 +213,10 @@ typedef struct emac_4xx_hw_st {
 #define RGMII_FER              (RGMII_BASE + 0x00)
 #define RGMII_SSR              (RGMII_BASE + 0x04)
 
+#if defined(CONFIG_460GT)
+#define RGMII1_BASE_OFFSET     0x100
+#endif
+
 /* RGMII Function Enable (FER) Register Bit Definitions */
 /* Note: for EMAC 2 and 3 only, 440GX only */
 #define RGMII_FER_DIS          (0x00)
index 30383027c78d33d310c9468340ec635d7c4aed4a..7d339144924846d81f586c24bc715c913ad363eb 100644 (file)
@@ -120,6 +120,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define        TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
 #endif
 
+#if !defined(CFG_MEM_TOP_HIDE)
+#define CFG_MEM_TOP_HIDE       0
+#endif
+
+extern ulong _start;
 extern ulong __init_end;
 extern ulong _end;
 ulong monitor_flash_len;
@@ -428,13 +433,26 @@ void board_init_f (ulong bootflag)
         * relocate the code and continue running from DRAM.
         *
         * Reserve memory at end of RAM for (top down in that order):
+        *  - area that won't get touched by U-Boot and Linux (optional)
         *  - kernel log buffer
         *  - protected RAM
         *  - LCD framebuffer
         *  - monitor code
         *  - board info struct
         */
-       len = (ulong)&_end - CFG_MONITOR_BASE;
+       len = (ulong)&_end - (ulong)&_start + EXC_OFF_SYS_RESET;
+
+       /*
+        * Subtract specified amount of memory to hide so that it won't
+        * get "touched" at all by U-Boot. By fixing up gd->ram_size
+        * the Linux kernel should now get passed the now "corrected"
+        * memory size and won't touch it either. This should work
+        * for arch/ppc and arch/powerpc. Only Linux board ports in
+        * arch/powerpc with bootwrapper support, that recalculate the
+        * memory size from the SDRAM controller setup will have to
+        * get fixed.
+        */
+       gd->ram_size -= CFG_MEM_TOP_HIDE;
 
 #ifndef CONFIG_MAX_MEM_MAPPED
 #define CONFIG_MAX_MEM_MAPPED (256 << 20)
@@ -876,7 +894,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
        sc3_read_eeprom();
 #endif
 
-#ifdef CFG_ID_EEPROM
+#if defined (CFG_ID_EEPROM) || defined (CFG_I2C_MAC_OFFSET)
        mac_read_from_eeprom();
 #endif
 
index 2cd60d76be28e4f51c3144abde4d4eb3e4c13044..883c381e641ba47d3c7b8c5c42dabdc786aeb689 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007
+ * Copyright (C) 2007,2008
  * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  *
  * This program is free software; you can redistribute it and/or
@@ -95,6 +95,14 @@ static int sh_marubun_init(void)
 }
 #endif /* (CONFIG_CMD_IDE) */
 
+#if defined(CONFIG_PCI)
+static int sh_pci_init(void)
+{
+       pci_init();
+       return 0;
+}
+#endif /* CONFIG_PCI */
+
 static int sh_mem_env_init(void)
 {
        mem_malloc_init();
@@ -140,6 +148,9 @@ init_fnc_t *init_sequence[] =
        sh_mem_env_init,
 #if defined(CONFIG_CMD_NAND)
        sh_nand_init,           /* Flash memory (NAND) init */
+#endif
+#if defined(CONFIG_PCI)
+       sh_pci_init,            /* PCI Init */
 #endif
        devices_init,
        console_init_r,