Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6945979126 | ||
|
|
e4cc71aa44 | ||
|
|
10767ccb86 | ||
|
|
02b11f8e09 | ||
|
|
6c1362cf63 | ||
|
|
953e2062c0 | ||
|
|
9d9e283790 | ||
|
|
baac607c13 | ||
|
|
32877d66aa | ||
|
|
62b4ac98a4 | ||
|
|
2729af9d54 | ||
|
|
08f1080c9c | ||
|
|
fc1cfcdb12 | ||
|
|
0b8fa03b6d | ||
|
|
b9711de102 | ||
|
|
e9132ea94c | ||
|
|
5cf91d6bdc | ||
|
|
e35745bb64 | ||
|
|
2471111d35 | ||
|
|
498b8db7f5 | ||
|
|
a8bd82de46 | ||
|
|
7abf0c5886 | ||
|
|
d4326aca18 | ||
|
|
507bbe3e80 |
No files matched your search
@@ -1,7 +1,160 @@
|
||||
======================================================================
|
||||
Changes since U-Boot 1.1.1:
|
||||
======================================================================
|
||||
|
||||
* Patch by Scott McNutt, 25 Apr 2004:
|
||||
Add Nios GDB/JTAG Console support:
|
||||
- Add stubs to support gdb via JTAG.
|
||||
- Add support for console over JTAG.
|
||||
- Minor cleanup.
|
||||
|
||||
* Add support for CATcenter board (based on PPChameleon ME module)
|
||||
|
||||
* Patch by Klaus Heydeck, 12 May 2004:
|
||||
Using external watchdog for KUP4 boards in mpc8xx/cpu.c;
|
||||
load_sernum_ethaddr() for KUP4 boards in lib_ppc/board.c;
|
||||
various changes to KUP4 board specific files
|
||||
|
||||
* Fix minor network problem on MPC5200: need some delay between
|
||||
resetting the PHY and sending the first packet. Implemented in a
|
||||
"natural" way by invoking the PHY reset and initialization code
|
||||
only once after power on vs. each time the interface is brought up.
|
||||
|
||||
* Add some limited support for low-speed devices to SL811 USB controller
|
||||
(at least "usb reset" now passes successfully and "usb info" displays
|
||||
correct information)
|
||||
|
||||
* Change init sequence for multiple network interfaces: initialize
|
||||
on-chip interfaces before external cards.
|
||||
|
||||
* Fix memory leak in the NAND-specific JFFS2 code
|
||||
|
||||
* Fix SL811 USB controller when attached to a USB hub
|
||||
|
||||
* Fix config option spelling in PM520 config file
|
||||
|
||||
* Fix PHY discovery problem in cpu/mpc8xx/fec.c (introduced by
|
||||
patches by Pantelis Antoniou, 30 Mar 2004)
|
||||
|
||||
* Fix minor NAND JFFS2 related issue
|
||||
|
||||
* Fixes for SL811 USB controller:
|
||||
- implement workaround for broken memory stick
|
||||
- improve error handling
|
||||
|
||||
* Increase packet send timeout to 1 ms in cpu/mpc8xx/scc.c to better
|
||||
cope with congested networks.
|
||||
|
||||
======================================================================
|
||||
Changes for U-Boot 1.1.1:
|
||||
======================================================================
|
||||
|
||||
|
||||
* Patch by Travis Sawyer, 23 Apr 2004:
|
||||
Fix VSC/CIS 8201 phy descrambler interoperability timing due to
|
||||
errata from Vitesse Semiconductor.
|
||||
|
||||
* Patch by Philippe Robin, 22 Apr 2004:
|
||||
Fix ethernet configuration for "versatile" board
|
||||
|
||||
* Patch by Kshitij Gupta, 21 Apr 2004:
|
||||
Remove busy loop and use MPU timer fr usleep() on OMAP1510/1610 boards
|
||||
|
||||
* Patch by Steven Scholz, 24 Feb 2004:
|
||||
Fix a bug in AT91RM9200 ethernet driver:
|
||||
The MII interface is now initialized before accessing the PHY.
|
||||
|
||||
* Patch by John Kerl, 19 Apr 2004:
|
||||
Use U-boot's miiphy.h for PHY register names, rather than
|
||||
introducing a new header file.
|
||||
|
||||
* Update pci_ids.h from linux-2.4.26
|
||||
|
||||
* Patch by Masami Komiya, 19 Apr 2004:
|
||||
Fix problem cause by VLAN function on little endian architecture
|
||||
without VLAN environment
|
||||
|
||||
* Clean up the TQM8xx_YYMHz configurations; allow to use the same
|
||||
binary image for all clock frequencies. Implement run-time
|
||||
optimization of flash access timing based on the actual bus
|
||||
frequency.
|
||||
|
||||
* Modify KUP4X board configuration to use SL811 driver for USB memory
|
||||
sticks (including FAT / VFAT filesystem support)
|
||||
|
||||
* Add SL811 Host Controller Interface driver for USB
|
||||
|
||||
* Add CFG_I2C_EEPROM_ADDR_OVERFLOW desription to README
|
||||
|
||||
* Patch by Pantelis Antoniou, 19 Apr 2004:
|
||||
Allow to use shell style syntax (i. e. ${var} ) with standard parser.
|
||||
Minor patches for Intracom boards.
|
||||
|
||||
* Patch by Christian Pell, 19 Apr 2004:
|
||||
cleanup support for CF/IDE on PCMCIA for PXA25X
|
||||
|
||||
* Temporarily disabled John Kerl's extended MII command code because
|
||||
"miivals.h" is missing
|
||||
|
||||
* Patches by Mark Jonas, 13 Apr 2004:
|
||||
- Remove CS0 chip select timing setting from cpu/mpc5xxx/start.S
|
||||
- Add sync instructions to IceCube SDRAM init code
|
||||
- Move SDRAM chip constants into seperate include files
|
||||
- Unify DDR and SDR initialization code
|
||||
- Unify all IceCube (Lite5xxx) target names
|
||||
|
||||
* Patch by John Kerl, 16 Apr 2004:
|
||||
Enable ranges in mii command, e.g. mii read 0-1f 0 or
|
||||
mii read 4-7 18-1a. Also add mii dump subcommand for
|
||||
pretty-printing standard regs 0-5.
|
||||
|
||||
* Patch by Stephen Williams, 16 April 2004:
|
||||
fix typo in JSE.h; update MAINTAINERS
|
||||
|
||||
* Patch by Matthew S. McClintock, 14 Apr 2004:
|
||||
fix initdram function for utx8245 board
|
||||
|
||||
* Patch by Markus Pietrek, 14 Apr 2004:
|
||||
use ATAG_INITRD2 instead of deprecated ATAG_INITRD tag
|
||||
|
||||
* Patch by Reinhard Meyer, 18 Apr 2004:
|
||||
provide the IDE Reset Function for EMK 5200 boards
|
||||
|
||||
* Patch by Masami Komiya, 12 Apr 2004:
|
||||
fix pci_hose_write_config_{byte,word}_via_dword problems
|
||||
|
||||
* Patch by Sangmoon Kim, 12 Apr 2004:
|
||||
Update max RAM size for debris board
|
||||
|
||||
* Patch by Travis Sawyer, 08 Apr 2004:
|
||||
Add TLB entry for second DIMM slot on ocotea
|
||||
|
||||
* Patch by Masami Komiya, 08 Apr 2004:
|
||||
add RTL8169 network driver
|
||||
|
||||
* Patch by Dan Malek, 07 Apr 2004:
|
||||
- Add support for RPC/STx GP3, Motorola 8560 board
|
||||
- Update 85xx TSEC driver so it searches MII for first available PHY
|
||||
and uses that one.
|
||||
- Add functions to support console MII commands.
|
||||
|
||||
* Patch by Tolunay Orkun, 07 Apr 2004:
|
||||
Move initialization of bi_iic_fast[]
|
||||
from board_init_f() to board_init_r()
|
||||
|
||||
* Patch by Yasushi Shoji, 07 Apr 2004:
|
||||
Cleanup microblaze port
|
||||
|
||||
* Patch by Sangmoon Kim, 07 Apr 2004:
|
||||
Add auto SDRAM module detection for Debris board
|
||||
|
||||
* Patch by Rune Torgersen, 06 Apr 2004:
|
||||
- Fix some PCI problems on the MPC8266ADS board
|
||||
- Fix the location of some PCI entries in the immap structure
|
||||
|
||||
* Patch by Yasushi Shoji, 07 Apr 2004:
|
||||
- add support for microblaze processors
|
||||
- add support for AtmarkTechno "suzaku" board
|
||||
|
||||
* Configure PPChameleon board to use redundand environment in flash
|
||||
|
||||
* Configure PPChameleon board to use JFFS2 NAND support.
|
||||
|
||||
+8
-1
@@ -98,7 +98,6 @@ Wolfgang Denk <wd@denx.de>
|
||||
TQM8255 MPC8255
|
||||
|
||||
CPU86 MPC8260
|
||||
PM825 MPC8250
|
||||
PM826 MPC8260
|
||||
TQM8260 MPC8260
|
||||
|
||||
@@ -255,6 +254,10 @@ Rune Torgersen <runet@innovsys.com>
|
||||
|
||||
MPC8266ADS MPC8266
|
||||
|
||||
Stephen Williams <steve@icarus.com>
|
||||
|
||||
JSE PPC405GPr
|
||||
|
||||
John Zhan <zhanz@sinovee.com>
|
||||
|
||||
svm_sc8xx MPC8xx
|
||||
@@ -264,6 +267,10 @@ Xianghua Xiao <x.xiao@motorola.com>
|
||||
MPC8540ADS MPC8540
|
||||
MPC8560ADS MPC8560
|
||||
|
||||
Dan Malek <dan@embeddededge.com>
|
||||
|
||||
STxGP3 MPC85xx
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Unknown / orphaned boards:
|
||||
|
||||
@@ -25,7 +25,7 @@ LIST_5xx=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_5xxx=" \
|
||||
IceCube_5100 IceCube_5200 EVAL5200 PM520 \
|
||||
icecube_5100 icecube_5200 EVAL5200 PM520 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -97,7 +97,7 @@ LIST_8260=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_85xx=" \
|
||||
MPC8540ADS MPC8560ADS \
|
||||
MPC8540ADS MPC8560ADS stxgp3 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
|
||||
@@ -75,6 +75,9 @@ endif
|
||||
ifeq ($(ARCH),m68k)
|
||||
CROSS_COMPILE = m68k-elf-
|
||||
endif
|
||||
ifeq ($(ARCH),microblaze)
|
||||
CROSS_COMPILE = mb-
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -209,16 +212,16 @@ PATI_config: unconfig
|
||||
#########################################################################
|
||||
## MPC5xxx Systems
|
||||
#########################################################################
|
||||
MPC5200LITE_config \
|
||||
MPC5200LITE_LOWBOOT_config \
|
||||
MPC5200LITE_LOWBOOT08_config \
|
||||
icecube_5200_DDR_config \
|
||||
IceCube_5200_DDR_config \
|
||||
icecube_5200_DDR_LOWBOOT_config \
|
||||
icecube_5200_DDR_LOWBOOT08_config \
|
||||
icecube_5200_config \
|
||||
IceCube_5200_config \
|
||||
IceCube_5100_config: unconfig
|
||||
Lite5200_config \
|
||||
Lite5200_LOWBOOT_config \
|
||||
Lite5200_LOWBOOT08_config \
|
||||
icecube_5200_config \
|
||||
icecube_5200_LOWBOOT_config \
|
||||
icecube_5200_LOWBOOT08_config \
|
||||
icecube_5200_DDR_config \
|
||||
icecube_5200_DDR_LOWBOOT_config \
|
||||
icecube_5200_DDR_LOWBOOT08_config \
|
||||
icecube_5100_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring LOWBOOT_,$@)" ] || \
|
||||
{ if [ "$(findstring DDR,$@)" ] ; \
|
||||
@@ -483,66 +486,26 @@ TOP860_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx top860 emk
|
||||
|
||||
# Play some tricks for configuration selection
|
||||
# All boards can come with 50 MHz (default), 66MHz, 80MHz or 100 MHz clock,
|
||||
# but only 855 and 860 boards may come with FEC
|
||||
# and 823 boards may have LCD support
|
||||
xtract_8xx = $(subst _66MHz,,$(subst _80MHz,,$(subst _100MHz,,$(subst _133MHz,,$(subst _LCD,,$(subst _config,,$1))))))
|
||||
# Only 855 and 860 boards may come with FEC
|
||||
# and only 823 boards may have LCD support
|
||||
xtract_8xx = $(subst _LCD,,$(subst _config,,$1))
|
||||
|
||||
FPS850L_config \
|
||||
FPS860L_config \
|
||||
NSCU_config \
|
||||
TQM823L_config \
|
||||
TQM823L_66MHz_config \
|
||||
TQM823L_80MHz_config \
|
||||
TQM823L_LCD_config \
|
||||
TQM823L_LCD_66MHz_config \
|
||||
TQM823L_LCD_80MHz_config \
|
||||
TQM850L_config \
|
||||
TQM850L_66MHz_config \
|
||||
TQM850L_80MHz_config \
|
||||
TQM855L_config \
|
||||
TQM855L_66MHz_config \
|
||||
TQM855L_80MHz_config \
|
||||
TQM860L_config \
|
||||
TQM860L_66MHz_config \
|
||||
TQM860L_80MHz_config \
|
||||
TQM862L_config \
|
||||
TQM862L_66MHz_config \
|
||||
TQM862L_80MHz_config \
|
||||
TQM823M_config \
|
||||
TQM823M_66MHz_config \
|
||||
TQM823M_80MHz_config \
|
||||
TQM850M_config \
|
||||
TQM850M_66MHz_config \
|
||||
TQM850M_80MHz_config \
|
||||
TQM855M_config \
|
||||
TQM855M_66MHz_config \
|
||||
TQM855M_80MHz_config \
|
||||
TQM860M_config \
|
||||
TQM860M_66MHz_config \
|
||||
TQM860M_80MHz_config \
|
||||
TQM862M_config \
|
||||
TQM862M_66MHz_config \
|
||||
TQM862M_80MHz_config \
|
||||
TQM862M_100MHz_config \
|
||||
TQM866M_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _66MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_66MHz" >>include/config.h ; \
|
||||
echo "... with 66MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _80MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_80MHz" >>include/config.h ; \
|
||||
echo "... with 80MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _100MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_100MHz" >>include/config.h ; \
|
||||
echo "... with 100MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _133MHz,$@)" ] || \
|
||||
{ echo "#define CONFIG_133MHz" >>include/config.h ; \
|
||||
echo "... with 133MHz system clock" ; \
|
||||
}
|
||||
@[ -z "$(findstring _LCD,$@)" ] || \
|
||||
{ echo "#define CONFIG_LCD" >>include/config.h ; \
|
||||
echo "#define CONFIG_NEC_NL6448BC20" >>include/config.h ; \
|
||||
@@ -585,6 +548,11 @@ BUBINGA405EP_config: unconfig
|
||||
CANBT_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx canbt esd
|
||||
|
||||
CATcenter_config: unconfig
|
||||
@ echo "/* CATcenter uses PPChameleon Model ME */" > include/config.h
|
||||
@ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 1" >> include/config.h
|
||||
@./mkconfig -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
|
||||
|
||||
CPCI405_config \
|
||||
CPCI4052_config \
|
||||
CPCI405AB_config: unconfig
|
||||
@@ -719,6 +687,9 @@ CPC45_ROMBOOT_config: unconfig
|
||||
CU824_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x cu824
|
||||
|
||||
debris_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x debris etin
|
||||
|
||||
eXalion_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x eXalion
|
||||
|
||||
@@ -944,6 +915,9 @@ MPC8540ADS_config: unconfig
|
||||
MPC8560ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc85xx mpc8560ads
|
||||
|
||||
stxgp3_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc85xx stxgp3
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
#########################################################################
|
||||
@@ -960,9 +934,6 @@ DB64360_config: unconfig
|
||||
DB64460_config: unconfig
|
||||
@./mkconfig DB64460 ppc 74xx_7xx db64460 Marvell
|
||||
|
||||
debris_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x debris etin
|
||||
|
||||
ELPPC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx elppc eltec
|
||||
|
||||
@@ -1176,6 +1147,24 @@ incaip_config: unconfig
|
||||
tb0229_config: unconfig
|
||||
@./mkconfig $(@:_config=) mips mips tb0229
|
||||
|
||||
#########################################################################
|
||||
## MIPS32 AU1X00
|
||||
#########################################################################
|
||||
dbau1000_config : unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1000 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
|
||||
dbau1100_config : unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1100 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
|
||||
dbau1500_config : unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1500 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
|
||||
#########################################################################
|
||||
## MIPS64 5Kc
|
||||
#########################################################################
|
||||
@@ -1250,23 +1239,16 @@ ADNPESC1_config: unconfig
|
||||
@./mkconfig -a ADNPESC1 nios nios adnpesc1 ssv
|
||||
|
||||
|
||||
#========================================================================
|
||||
# MicroBlaze
|
||||
#========================================================================
|
||||
#########################################################################
|
||||
## MIPS32 AU1X00
|
||||
## Microblaze
|
||||
#########################################################################
|
||||
dbau1000_config : unconfig
|
||||
suzaku_config: unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1000 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
|
||||
dbau1100_config : unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1100 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
|
||||
dbau1500_config : unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_DBAU1500 1" >>include/config.h
|
||||
@./mkconfig -a dbau1x00 mips mips dbau1x00
|
||||
@echo "#define CONFIG_SUZAKU 1" >> include/config.h
|
||||
@./mkconfig -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
|
||||
|
||||
#########################################################################
|
||||
#########################################################################
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# (C) Copyright 2004 Atmark Techno, Inc.
|
||||
#
|
||||
# Yasushi SHOJI <yashi@atmark-techno.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
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x80F00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-mul
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-div
|
||||
PLATFORM_CPPFLAGS += -mxl-barrel-shift
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flash_print_info(flash_info_t *info)
|
||||
{
|
||||
}
|
||||
|
||||
int flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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>
|
||||
|
||||
void do_reset(void)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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_ARCH(microblaze)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text ALIGN(0x4):
|
||||
{
|
||||
__text_start = .;
|
||||
cpu/microblaze/start.o (.text)
|
||||
*(.text)
|
||||
__text_end = .;
|
||||
}
|
||||
|
||||
.rodata ALIGN(0x4):
|
||||
{
|
||||
__rodata_start = .;
|
||||
*(.rodata)
|
||||
__rodata_end = .;
|
||||
}
|
||||
|
||||
.data ALIGN(0x4):
|
||||
{
|
||||
__data_start = .;
|
||||
*(.data)
|
||||
__data_end = .;
|
||||
}
|
||||
|
||||
.u_boot_cmd ALIGN(0x4):
|
||||
{
|
||||
__u_boot_cmd_start = .;
|
||||
*(.u_boot_cmd)
|
||||
__u_boot_cmd_end = .;
|
||||
}
|
||||
|
||||
.bss ALIGN(0x4):
|
||||
{
|
||||
__bss_start = .;
|
||||
*(.bss)
|
||||
__bss_start = .;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,8 @@
|
||||
* _cwp_lolimit -Handles register window underflows.
|
||||
* _cwp_hilimit -Handles register window overflows.
|
||||
* _timebase_int -Increments the timebase.
|
||||
* _brkpt_hw_int -Hardware breakpoint handler.
|
||||
* _brkpt_sw_int -Software breakpoint handler.
|
||||
* _def_xhandler -Default exception handler.
|
||||
*
|
||||
* _timebase_int handles a Nios Timer interrupt and increments the
|
||||
@@ -58,9 +60,8 @@ _vectors:
|
||||
.long _def_xhandler@h /* Vector 0 - NMI */
|
||||
.long _cwp_lolimit@h /* Vector 1 - underflow */
|
||||
.long _cwp_hilimit@h /* Vector 2 - overflow */
|
||||
|
||||
.long _def_xhandler@h /* Vector 3 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 4 - GNUPro debug */
|
||||
.long _brkpt_hw_int@h /* Vector 3 - Breakpoint */
|
||||
.long _brkpt_sw_int@h /* Vector 4 - Single step*/
|
||||
.long _def_xhandler@h /* Vector 5 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 6 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 7 - future reserved */
|
||||
|
||||
@@ -141,7 +141,7 @@ SECTIONS
|
||||
}
|
||||
|
||||
. = 0xFFFF8000;
|
||||
.ppcenv :
|
||||
.ppcenv :
|
||||
{
|
||||
common/environment.o(.ppcenv);
|
||||
}
|
||||
|
||||
+18
-10
@@ -182,21 +182,29 @@ void pci_init_board(void)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* provide the PCI Reset Function
|
||||
* provide the IDE Reset Function
|
||||
*****************************************************************************/
|
||||
#ifdef CFG_CMD_IDE
|
||||
#define GPIO_PSC1_4 0x01000000ul
|
||||
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
||||
|
||||
#define GPIO_PSC1_4 0x01000000UL
|
||||
|
||||
void init_ide_reset (void)
|
||||
{
|
||||
debug ("init_ide_reset\n");
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
debug ("ide_reset(%d)\n", idereset);
|
||||
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
/* (it does not matter we do this every time) */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
||||
+62
-19
@@ -24,6 +24,7 @@
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
#include <pci.h>
|
||||
#include <i2c.h>
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
@@ -52,28 +53,70 @@ int checkflash (void)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long size;
|
||||
#if 0
|
||||
long new_bank0_end;
|
||||
long mear1;
|
||||
long emear1;
|
||||
#endif
|
||||
int m, row, col, bank, i;
|
||||
unsigned long start, end;
|
||||
uint32_t mccr1;
|
||||
uint32_t mear1 = 0, emear1 = 0, msar1 = 0, emsar1 = 0;
|
||||
uint32_t mear2 = 0, emear2 = 0, msar2 = 0, emsar2 = 0;
|
||||
uint8_t mber = 0;
|
||||
|
||||
size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
|
||||
i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
#if 0
|
||||
new_bank0_end = size - 1;
|
||||
mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
#endif
|
||||
if (i2c_reg_read (0x50, 2) != 0x04) return 0; /* Memory type */
|
||||
m = i2c_reg_read (0x50, 5); /* # of physical banks */
|
||||
row = i2c_reg_read (0x50, 3); /* # of rows */
|
||||
col = i2c_reg_read (0x50, 4); /* # of columns */
|
||||
bank = i2c_reg_read (0x50, 17); /* # of logical banks */
|
||||
|
||||
return (size);
|
||||
CONFIG_READ_WORD(MCCR1, mccr1);
|
||||
mccr1 &= 0xffff0000;
|
||||
|
||||
start = CFG_SDRAM_BASE;
|
||||
end = start + (1 << (col + row + 3) ) * bank - 1;
|
||||
|
||||
for (i = 0; i < m; i++) {
|
||||
mccr1 |= ((row == 13)? 2 : (bank == 4)? 0 : 3) << i * 2;
|
||||
if (i < 4) {
|
||||
msar1 |= ((start >> 20) & 0xff) << i * 8;
|
||||
emsar1 |= ((start >> 28) & 0xff) << i * 8;
|
||||
mear1 |= ((end >> 20) & 0xff) << i * 8;
|
||||
emear1 |= ((end >> 28) & 0xff) << i * 8;
|
||||
} else {
|
||||
msar2 |= ((start >> 20) & 0xff) << (i-4) * 8;
|
||||
emsar2 |= ((start >> 28) & 0xff) << (i-4) * 8;
|
||||
mear2 |= ((end >> 20) & 0xff) << (i-4) * 8;
|
||||
emear2 |= ((end >> 28) & 0xff) << (i-4) * 8;
|
||||
}
|
||||
mber |= 1 << i;
|
||||
start += (1 << (col + row + 3) ) * bank;
|
||||
end += (1 << (col + row + 3) ) * bank;
|
||||
}
|
||||
for (; i < 8; i++) {
|
||||
if (i < 4) {
|
||||
msar1 |= 0xff << i * 8;
|
||||
emsar1 |= 0x30 << i * 8;
|
||||
mear1 |= 0xff << i * 8;
|
||||
emear1 |= 0x30 << i * 8;
|
||||
} else {
|
||||
msar2 |= 0xff << (i-4) * 8;
|
||||
emsar2 |= 0x30 << (i-4) * 8;
|
||||
mear2 |= 0xff << (i-4) * 8;
|
||||
emear2 |= 0x30 << (i-4) * 8;
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_WRITE_WORD(MCCR1, mccr1);
|
||||
CONFIG_WRITE_WORD(MSAR1, msar1);
|
||||
CONFIG_WRITE_WORD(EMSAR1, emsar1);
|
||||
CONFIG_WRITE_WORD(MEAR1, mear1);
|
||||
CONFIG_WRITE_WORD(EMEAR1, emear1);
|
||||
CONFIG_WRITE_WORD(MSAR2, msar2);
|
||||
CONFIG_WRITE_WORD(EMSAR2, emsar2);
|
||||
CONFIG_WRITE_WORD(MEAR2, mear2);
|
||||
CONFIG_WRITE_WORD(EMEAR2, emear2);
|
||||
CONFIG_WRITE_BYTE(MBER, mber);
|
||||
|
||||
return (1 << (col + row + 3) ) * bank * m;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+149
-80
@@ -2,6 +2,9 @@
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
@@ -25,90 +28,84 @@
|
||||
#include <mpc5xxx.h>
|
||||
#include <pci.h>
|
||||
|
||||
#if defined(CONFIG_MPC5200_DDR)
|
||||
#include "mt46v16m16-75.h"
|
||||
#else
|
||||
#include "mt48lc16m16a2-75.h"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
static void sdram_start (int hi_addr)
|
||||
{
|
||||
long hi_addr_bit = hi_addr ? 0x01000000 : 0;
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f00 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f02 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#if SDRAM_DDR
|
||||
/* set mode register: extended mode */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x40090000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register: reset DLL */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x058d0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f02 | hi_addr_bit;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f04 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x018d0000;
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x705f0f00 | hi_addr_bit;
|
||||
#else
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0000 | hi_addr_bit;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x00cd0000;
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004 | hi_addr_bit;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x00cd0000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x504f0000 | hi_addr_bit;
|
||||
#endif
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATTENTION: Although partially referenced initdram does NOT make real use
|
||||
* use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
|
||||
* is something else than 0x00000000.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
ulong dramsize2 = 0;
|
||||
#endif
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* configure SDRAM start/end */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* setup SDRAM chip selects */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0x73722930;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x47770000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set tap delay to 0x10 */
|
||||
*(vu_long *)MPC5XXX_CDM_PORCFG = 0x10000000;
|
||||
#else
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xd2322800;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x8ad70000;
|
||||
#if SDRAM_DDR
|
||||
/* set tap delay */
|
||||
*(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xc2222600;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x88b70004;
|
||||
|
||||
/* address select register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_XLBSEL = 0x03000000;
|
||||
#endif
|
||||
/* find RAM size using SDRAM CS0 only */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
sdram_start(1);
|
||||
@@ -119,11 +116,23 @@ long int initdram (int board_type)
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG =
|
||||
(0x13 + __builtin_ffs(dramsize >> 20) - 1);
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize < (1 << 20)) {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS0 size according to the amount of RAM found */
|
||||
if (dramsize > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1;
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
|
||||
}
|
||||
|
||||
/* let SDRAM CS1 start right after CS0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */
|
||||
|
||||
/* find RAM size using SDRAM CS1 only */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
|
||||
sdram_start(1);
|
||||
@@ -134,34 +143,94 @@ long int initdram (int board_type)
|
||||
} else {
|
||||
dramsize2 = test2;
|
||||
}
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG =
|
||||
dramsize + (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
|
||||
#else
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
#endif
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
|
||||
#endif
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
#ifdef CONFIG_MGT5100
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
|
||||
#else
|
||||
dramsize = ((1 << (*(vu_long *)MPC5XXX_SDRAM_CS0CFG - 0x13)) << 20);
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
dramsize2 = ((1 << (*(vu_long *)MPC5XXX_SDRAM_CS1CFG - 0x13)) << 20);
|
||||
#endif
|
||||
#endif
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize2 < (1 << 20)) {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS1 size according to the amount of RAM found */
|
||||
if (dramsize2 > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
|
||||
| (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
}
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS0 */
|
||||
dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
|
||||
if (dramsize >= 0x13) {
|
||||
dramsize = (1 << (dramsize - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS1 */
|
||||
dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
|
||||
if (dramsize2 >= 0x13) {
|
||||
dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
return dramsize + dramsize2;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* setup and enable SDRAM chip selects */
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
|
||||
|
||||
/* address select register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_XLBSEL = SDRAM_ADDRSEL;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* find RAM size */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
sdram_start(1);
|
||||
test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
if (test1 > test2) {
|
||||
sdram_start(0);
|
||||
dramsize = test1;
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
|
||||
/* set SDRAM end address according to size */
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
|
||||
/* Retrieve amount of SDRAM available */
|
||||
dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
|
||||
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
dramsize += dramsize2;
|
||||
#endif
|
||||
/* return total ram size */
|
||||
return dramsize;
|
||||
}
|
||||
|
||||
#else
|
||||
#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
|
||||
#endif
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if defined(CONFIG_MPC5200)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.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
|
||||
*/
|
||||
|
||||
#define SDRAM_DDR 1 /* is DDR */
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* Settings for XLB = 132 MHz */
|
||||
#define SDRAM_MODE 0x018D0000
|
||||
#define SDRAM_EMODE 0x40090000
|
||||
#define SDRAM_CONTROL 0x705f0f00
|
||||
#define SDRAM_CONFIG1 0x73722930
|
||||
#define SDRAM_CONFIG2 0x47770000
|
||||
#define SDRAM_TAPDELAY 0x10000000
|
||||
|
||||
#else
|
||||
#error CONFIG_MPC5200 not defined
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.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
|
||||
*/
|
||||
|
||||
#define SDRAM_DDR 0 /* is SDR */
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* Settings for XLB = 132 MHz */
|
||||
#define SDRAM_MODE 0x00CD0000
|
||||
#define SDRAM_CONTROL 0x504F0000
|
||||
#define SDRAM_CONFIG1 0xD2322800
|
||||
#define SDRAM_CONFIG2 0x8AD70000
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
/* Settings for XLB = 66 MHz */
|
||||
#define SDRAM_MODE 0x008D0000
|
||||
#define SDRAM_CONTROL 0x504F0000
|
||||
#define SDRAM_CONFIG1 0xC2222600
|
||||
#define SDRAM_CONFIG2 0x88B70004
|
||||
#define SDRAM_ADDRSEL 0x02000000
|
||||
|
||||
#else
|
||||
#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
|
||||
#endif
|
||||
+4
-37
@@ -54,19 +54,17 @@ static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0;
|
||||
unsigned long base_b0;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
flash_info[0].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
size_b0 =
|
||||
flash_get_size ((vu_long *) FLASH_BASE0_PRELIM,
|
||||
&flash_info[0]);
|
||||
size_b0 = flash_get_size ((vu_long *) FLASH_BASE0_PRELIM, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n", size_b0, size_b0 << 20);
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size_b0, size_b0 << 20);
|
||||
}
|
||||
|
||||
/* Only one bank */
|
||||
@@ -212,15 +210,10 @@ void flash_print_info (flash_info_t * info)
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
#if 0 /* test-only */
|
||||
printf (" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " "
|
||||
#else
|
||||
printf (" %08lX%s%s",
|
||||
info->start[i],
|
||||
erased ? " E" : " ", info->protect[i] ? "RO " : " "
|
||||
#endif
|
||||
);
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
@@ -248,11 +241,7 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info)
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00900090;
|
||||
|
||||
#ifdef CONFIG_ADCIOP
|
||||
value = addr2[2];
|
||||
#else
|
||||
value = addr2[0];
|
||||
#endif
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
@@ -271,12 +260,7 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info)
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ADCIOP
|
||||
value = addr2[0]; /* device ID */
|
||||
/* printf("\ndev_code=%x\n", value); */
|
||||
#else
|
||||
value = addr2[1]; /* device ID */
|
||||
#endif
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_ID_F040B:
|
||||
@@ -387,36 +371,19 @@ static ulong flash_get_size (vu_long * addr, flash_info_t * info)
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
#ifdef CONFIG_ADCIOP
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
info->protect[i] = addr2[4] & 1;
|
||||
#else
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
#if 0 /* test-only */
|
||||
#ifdef CONFIG_ADCIOP
|
||||
addr2 = (volatile unsigned char *) info->start[0];
|
||||
addr2[ADDR0] = 0xAA;
|
||||
addr2[ADDR1] = 0x55;
|
||||
addr2[ADDR0] = 0xF0; /* reset bank */
|
||||
#else
|
||||
addr2 = (FLASH_WORD_SIZE *) info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
#endif
|
||||
#else /* test-only */
|
||||
addr2 = (FLASH_WORD_SIZE *) info->start[0];
|
||||
*addr2 = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
#endif /* test-only */
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
|
||||
@@ -70,3 +70,14 @@ void poweron_key (void)
|
||||
else
|
||||
setenv ("key1", "on");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed (void)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Process Hardware Information Block:
|
||||
*
|
||||
* If we boot on a system fresh from factory, check if the Hardware
|
||||
* Information Block exists and save the information it contains.
|
||||
*
|
||||
* The KUP Hardware Information Block is defined as
|
||||
* follows:
|
||||
* - located in first flash bank
|
||||
* - starts at offset CFG_HWINFO_OFFSET
|
||||
* - size CFG_HWINFO_SIZE
|
||||
*
|
||||
* Internal structure:
|
||||
* - sequence of ASCII character lines
|
||||
* - fields separated by <CR><LF>
|
||||
* - last field terminated by NUL character (0x00)
|
||||
*
|
||||
* Fields in Hardware Information Block:
|
||||
* 1) Module Type
|
||||
* 2) MAC Address
|
||||
* 3) ....
|
||||
*/
|
||||
|
||||
|
||||
#define ETHADDR_TOKEN "ethaddr="
|
||||
#define LCD_TOKEN "lcd="
|
||||
|
||||
void load_sernum_ethaddr (void)
|
||||
{
|
||||
unsigned char *hwi;
|
||||
unsigned char *var;
|
||||
unsigned char hwi_stack[CFG_HWINFO_SIZE];
|
||||
unsigned char *p;
|
||||
|
||||
hwi = (unsigned char *) (CFG_FLASH_BASE + CFG_HWINFO_OFFSET);
|
||||
if (*((unsigned long *) hwi) != (unsigned long) CFG_HWINFO_MAGIC) {
|
||||
printf ("HardwareInfo not found!\n");
|
||||
return;
|
||||
}
|
||||
memcpy (hwi_stack, hwi, CFG_HWINFO_SIZE);
|
||||
|
||||
/*
|
||||
** ethaddr
|
||||
*/
|
||||
var = strstr (hwi_stack, ETHADDR_TOKEN);
|
||||
if (var) {
|
||||
var += sizeof (ETHADDR_TOKEN) - 1;
|
||||
p = strchr (var, '\r');
|
||||
if (p < hwi + CFG_HWINFO_SIZE) {
|
||||
*p = '\0';
|
||||
setenv ("ethaddr", var);
|
||||
*p = '\r';
|
||||
}
|
||||
}
|
||||
/*
|
||||
** lcd
|
||||
*/
|
||||
var = strstr (hwi_stack, LCD_TOKEN);
|
||||
if (var) {
|
||||
var += sizeof (LCD_TOKEN) - 1;
|
||||
p = strchr (var, '\r');
|
||||
if (p < hwi + CFG_HWINFO_SIZE) {
|
||||
*p = '\0';
|
||||
setenv ("lcd", var);
|
||||
*p = '\r';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o ../common/load_sernum_ethaddr.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
@@ -129,11 +129,11 @@ int checkboard (void)
|
||||
*/
|
||||
immap->im_memctl.memc_or4 = 0xFFFF8926;
|
||||
immap->im_memctl.memc_br4 = 0x90000401;
|
||||
|
||||
__asm__ ("eieio");
|
||||
latch=(uchar *)0x90000200;
|
||||
rev = (*latch & 0xF8) >> 3;
|
||||
mod=(*latch & 0x03);
|
||||
printf ("Board: KUP4K Rev %d.%d SN: %s\n",rev,mod,getenv("ethaddr"));
|
||||
printf ("Board: KUP4K Rev %d.%d\n",rev,mod);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -346,6 +346,7 @@ void lcd_logo (bd_t * bd)
|
||||
*/
|
||||
memctl->memc_or5 = 0xFFC007F0; /* 4 MB 17 WS or externel TA */
|
||||
memctl->memc_br5 = 0x80080801; /* Start at 0x80080000 */
|
||||
__asm__ ("eieio");
|
||||
|
||||
fb_info.VmemAddr = (unsigned char *) (S1D_PHYSICAL_VMEM_ADDR);
|
||||
fb_info.RegAddr = (unsigned char *) (S1D_PHYSICAL_REG_ADDR);
|
||||
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o usb.o
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o ../common/load_sernum_ethaddr.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
#include <post.h>
|
||||
#include "../common/kup.h"
|
||||
#ifdef CONFIG_KUP4K_LOGO
|
||||
/* #include "s1d13706.h" */
|
||||
@@ -115,19 +116,19 @@ int checkboard (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
uchar *latch, rev, mod;
|
||||
volatile uchar *latch;
|
||||
uchar rev, mod;
|
||||
|
||||
/*
|
||||
* Init ChipSelect #4 (CAN + HW-Latch)
|
||||
*/
|
||||
memctl->memc_or4 = 0xFFFF8926;
|
||||
memctl->memc_br4 = 0x90000401;
|
||||
|
||||
latch = (uchar *) 0x90000200;
|
||||
__asm__ ("eieio");
|
||||
latch = (volatile uchar *) 0x90000200;
|
||||
rev = (*latch & 0xF8) >> 3;
|
||||
mod = (*latch & 0x03);
|
||||
printf ("Board: KUP4X Rev %d.%d SN: %s\n", rev, mod,
|
||||
getenv ("ethaddr"));
|
||||
printf ("Board: KUP4X Rev %d.%d\n",rev,mod);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
#include "../common/kup.h"
|
||||
|
||||
|
||||
#define SL811_ADR (0x50000000)
|
||||
#define SL811_DAT (0x50000001)
|
||||
|
||||
|
||||
static void sl811_write_index_data (__u8 index, __u8 data)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
*(volatile unsigned char *) (SL811_DAT) = data;
|
||||
__asm__ ("eieio");
|
||||
}
|
||||
|
||||
static __u8 sl811_read_index_data (__u8 index)
|
||||
{
|
||||
__u8 data;
|
||||
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
data = *(volatile unsigned char *) (SL811_DAT);
|
||||
__asm__ ("eieio");
|
||||
return (data);
|
||||
}
|
||||
|
||||
int usb_init_kup4x (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
int i;
|
||||
unsigned char tmp;
|
||||
|
||||
memctl = &immap->im_memctl;
|
||||
memctl->memc_or7 = 0xFFFF8726;
|
||||
memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */
|
||||
/* BP 14 low = USB ON */
|
||||
immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
|
||||
/* PB 14 nomal port */
|
||||
immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
|
||||
/* output */
|
||||
immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
|
||||
|
||||
puts ("USB: ");
|
||||
|
||||
for (i = 0x10; i < 0xff; i++) {
|
||||
sl811_write_index_data (i, i);
|
||||
tmp = (sl811_read_index_data (i));
|
||||
if (tmp != i) {
|
||||
printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
printf ("SL811 ready\n");
|
||||
return (0);
|
||||
}
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <common.h>
|
||||
#include <miiphy.h>
|
||||
#include <sed156x.h>
|
||||
#include <status_led.h>
|
||||
|
||||
#include "mpc8xx.h"
|
||||
|
||||
@@ -659,6 +660,7 @@ int overwrite_console(void)
|
||||
|
||||
extern int drv_phone_init(void);
|
||||
extern int drv_phone_use_me(void);
|
||||
extern int drv_phone_is_idle(void);
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
@@ -691,6 +693,12 @@ int last_stage_init(void)
|
||||
do_poll();
|
||||
|
||||
if (drv_phone_use_me()) {
|
||||
status_led_set(0, STATUS_LED_ON);
|
||||
while (!drv_phone_is_idle()) {
|
||||
do_poll();
|
||||
udelay(1000000 / CFG_HZ);
|
||||
}
|
||||
|
||||
console_assign(stdin, "phone");
|
||||
console_assign(stdout, "phone");
|
||||
console_assign(stderr, "phone");
|
||||
|
||||
@@ -179,7 +179,6 @@ static int last_input_mode;
|
||||
static int refresh_time;
|
||||
static int blink_time;
|
||||
static char last_fast_punct;
|
||||
static int last_tab_indicator = -1;
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
@@ -239,8 +238,6 @@ static void console_init(void)
|
||||
refresh_time = REFRESH_HZ;
|
||||
blink_time = BLINK_HZ;
|
||||
|
||||
tab_indicator = 1;
|
||||
|
||||
memset(vty_buf, ' ', sizeof(vty_buf));
|
||||
|
||||
memset(last_visible_buf, ' ', sizeof(last_visible_buf));
|
||||
@@ -253,6 +250,8 @@ static void console_init(void)
|
||||
sed156x_init();
|
||||
width = sed156x_text_width;
|
||||
height = sed156x_text_height - 1;
|
||||
|
||||
tab_indicator = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -718,8 +717,10 @@ static void update(void)
|
||||
if (input_mode != last_input_mode)
|
||||
sed156x_output_at(sed156x_text_width - 3, sed156x_text_height - 1, input_mode_txt[input_mode], 3);
|
||||
|
||||
if (tab_indicator != last_tab_indicator)
|
||||
if (tab_indicator == 0) {
|
||||
sed156x_output_at(0, sed156x_text_height - 1, "\\t", 2);
|
||||
tab_indicator = 1;
|
||||
}
|
||||
|
||||
if (fast_punct != last_fast_punct)
|
||||
sed156x_output_at(4, sed156x_text_height - 1, &fast_punct, 1);
|
||||
@@ -779,7 +780,6 @@ static void update(void)
|
||||
|
||||
last_input_mode = input_mode;
|
||||
last_fast_punct = fast_punct;
|
||||
last_tab_indicator = tab_indicator;
|
||||
}
|
||||
|
||||
/* ensure visibility; the trick is to minimize the screen movement */
|
||||
@@ -891,7 +891,8 @@ void phone_putc(const char c)
|
||||
blink_time = BLINK_HZ;
|
||||
|
||||
switch (c) {
|
||||
case 13: /* ignore */
|
||||
case '\a': /* ignore bell */
|
||||
case '\r': /* ignore carriage return */
|
||||
break;
|
||||
|
||||
case '\n': /* next line */
|
||||
@@ -1141,3 +1142,10 @@ static void kp_do_poll(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
int drv_phone_is_idle(void)
|
||||
{
|
||||
return kp_state == SCAN;
|
||||
}
|
||||
@@ -91,6 +91,7 @@ tlbtab:
|
||||
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 )
|
||||
tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_SDRAM_BASE+0x10000000, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_MEMBASE, SZ_256M, 0x00000000, 3, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbtab_end
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := $(BOARD).o flash.o
|
||||
SOBJS := init.o
|
||||
#SOBJS :=
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(SOBJS)
|
||||
|
||||
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
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,33 @@
|
||||
# Modified by Xianghua Xiao, X.Xiao@motorola.com
|
||||
# (C) Copyright 2002,2003 Motorola Inc.
|
||||
#
|
||||
# Copied from ADS85xx for STx GP3 - Dan Malek
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
#
|
||||
# default CCARBAR is at 0xff700000
|
||||
# assume U-Boot is less than 0.5MB
|
||||
#
|
||||
TEXT_BASE = 0xfff80000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_MPC8560=1
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_E500=1
|
||||
@@ -0,0 +1,517 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Dan Malek, Embedded Edge, LLC. <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updated to support the Silicon Tx GP3 8560. We should only find
|
||||
* two Intel 28F640 parts in 16-bit mode (i.e. 32-bit wide flash),
|
||||
* but I left other code here in case people order custom boards.
|
||||
*
|
||||
* (C) Copyright 2003 Motorola Inc.
|
||||
* Xianghua Xiao,(X.Xiao@motorola.com)
|
||||
*
|
||||
* (C) Copyright 2000, 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com
|
||||
* Add support the Sharp chips on the mpc8260ads.
|
||||
* I started with board/ip860/flash.c and made changes I found in
|
||||
* the MTD project by David Schleef.
|
||||
*
|
||||
* 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>
|
||||
|
||||
#if !defined(CFG_NO_FLASH)
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info);
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data);
|
||||
static int clear_block_lock_bit(vu_long * addr);
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size;
|
||||
int i;
|
||||
|
||||
/* Init: enable write,
|
||||
* or we cannot even write flash commands
|
||||
*/
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* set the default sector offset */
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
size = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size, size<<20);
|
||||
}
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
flash_info[0].size = size;
|
||||
|
||||
#if !defined(CONFIG_RAM_AS_FLASH)
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+monitor_flash_len-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
#endif
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL: printf ("Intel "); break;
|
||||
case FLASH_MAN_SHARP: printf ("Sharp "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F640C3T: printf ("28F640C3T (64 Mbit x 2, 128 x 128k)\n");
|
||||
break;
|
||||
default: printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
ulong sector_offset;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Check flash at 0x%08x\n",(uint)addr);
|
||||
#endif
|
||||
/* Write "Intelligent Identifier" command: read Manufacturer ID */
|
||||
*addr = 0x90909090;
|
||||
udelay(20);
|
||||
asm("sync");
|
||||
|
||||
value = addr[0] & 0x00FF00FF;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("manufacturer=0x%x\n",(uint)value);
|
||||
#endif
|
||||
switch (value) {
|
||||
case MT_MANUFACT: /* SHARP, MT or => Intel */
|
||||
case INTEL_ALT_MANU:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
default:
|
||||
printf("unknown manufacturer: %x\n", (unsigned int)value);
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("deviceID=0x%x\n",(uint)value);
|
||||
#endif
|
||||
switch (value) {
|
||||
|
||||
case (INTEL_ID_28F640C3T):
|
||||
info->flash_id += FLASH_28F640C3T;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x01000000;
|
||||
sector_offset = 0x20000;
|
||||
break; /* => 2x8 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
/* set up sector start address table
|
||||
* The first 127 blocks are large, the last 8 are small.
|
||||
*/
|
||||
for (i = 0; i < 127; i++) {
|
||||
info->start[i] = base;
|
||||
base += sector_offset;
|
||||
/* Sectors are locked upon reset */
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
for (i = 127; i < 135; i++) {
|
||||
info->start[i] = base;
|
||||
base += 0x4000;
|
||||
/* Sectors are locked upon reset */
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (vu_long *)info->start[0];
|
||||
*addr = 0xFFFFFF; /* reset bank to read array mode */
|
||||
asm("sync");
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL)
|
||||
&& ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_SHARP) ) {
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("\nFlash Erase:\n");
|
||||
#endif
|
||||
/* Make Sure Block Lock Bit is not set. */
|
||||
if(clear_block_lock_bit((vu_long *)(info->start[s_first]))){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
#if defined(DEBUG)
|
||||
printf("Begin to erase now,s_first=0x%x s_last=0x%x...\n",s_first,s_last);
|
||||
#endif
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_long *addr = (vu_long *)(info->start[sect]);
|
||||
asm("sync");
|
||||
|
||||
last = start = get_timer (0);
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Reset Array */
|
||||
*addr = 0xffffffff;
|
||||
asm("sync");
|
||||
/* Clear Status Register */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
/* Single Block Erase Command */
|
||||
*addr = 0x20202020;
|
||||
asm("sync");
|
||||
/* Confirm */
|
||||
*addr = 0xD0D0D0D0;
|
||||
asm("sync");
|
||||
|
||||
if((info->flash_id & FLASH_TYPEMASK) != FLASH_LH28F016SCT) {
|
||||
/* Resume Command, as per errata update */
|
||||
*addr = 0xD0D0D0D0;
|
||||
asm("sync");
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
while ((*addr & 0x00800080) != 0x00800080) {
|
||||
if(*addr & 0x00200020){
|
||||
printf("Error in Block Erase - Lock Bit may be set!\n");
|
||||
printf("Status Register = 0x%X\n", (uint)*addr);
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
/* reset to read mode */
|
||||
*addr = 0xFFFFFFFF;
|
||||
asm("sync");
|
||||
}
|
||||
}
|
||||
|
||||
printf ("flash erase done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
for (; i<4 && cnt>0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i=0; i<4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
vu_long *addr = (vu_long *)dest;
|
||||
ulong start, csr;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Write Command */
|
||||
*addr = 0x10101010;
|
||||
asm("sync");
|
||||
|
||||
/* Write Data */
|
||||
*addr = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
flag = 0;
|
||||
|
||||
while (((csr = *addr) & 0x00800080) != 0x00800080) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (csr & 0x40404040) {
|
||||
printf ("CSR indicates write error (%08lx) at %08lx\n", csr, (ulong)addr);
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
/* Clear Status Registers Command */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
/* Reset to read array mode */
|
||||
*addr = 0xFFFFFFFF;
|
||||
asm("sync");
|
||||
|
||||
return (flag);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Clear Block Lock Bit, returns:
|
||||
* 0 - OK
|
||||
* 1 - Timeout
|
||||
*/
|
||||
|
||||
static int clear_block_lock_bit(vu_long * addr)
|
||||
{
|
||||
ulong start, now;
|
||||
|
||||
/* Reset Array */
|
||||
*addr = 0xffffffff;
|
||||
asm("sync");
|
||||
/* Clear Status Register */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
|
||||
*addr = 0x60606060;
|
||||
asm("sync");
|
||||
*addr = 0xd0d0d0d0;
|
||||
asm("sync");
|
||||
|
||||
start = get_timer (0);
|
||||
while((*addr & 0x00800080) != 0x00800080){
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout on clearing Block Lock Bit\n");
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !CFG_NO_FLASH */
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Embedded Edge, LLC
|
||||
* Dan Malek <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560. We only support 32-bit flash
|
||||
* and DDR with SPD EEPROM configuration.
|
||||
*
|
||||
* Copyright (C) 2002,2003, Motorola Inc.
|
||||
* Xianghua Xiao <X.Xiao@motorola.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 <ppc_asm.tmpl>
|
||||
#include <ppc_defs.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <config.h>
|
||||
#include <mpc85xx.h>
|
||||
|
||||
#define entry_start \
|
||||
mflr r1 ; \
|
||||
bl 0f ;
|
||||
|
||||
#define entry_end \
|
||||
0: mflr r0 ; \
|
||||
mtlr r1 ; \
|
||||
blr ;
|
||||
|
||||
/* TLB1 entries configuration: */
|
||||
|
||||
.section .bootpg, "ax"
|
||||
.globl tlb1_entry
|
||||
tlb1_entry:
|
||||
entry_start
|
||||
|
||||
/* If RAMBOOT, we are testing and the BDI has set up
|
||||
* much of the MMU already.
|
||||
* TLB 4,5 SDRAM
|
||||
* TLB 15 is default CCSRBAR.
|
||||
*/
|
||||
.long 0x09 /* the following data table uses a few of 16 TLB entries */
|
||||
|
||||
.long TLB1_MAS0(1,1,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_CCSRBAR>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_CCSRBAR>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,2,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_16M)
|
||||
.long TLB1_MAS2(((CFG_FLASH_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_FLASH_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,3,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_LBC_LCLDEVS_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_LBC_LCLDEVS_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
.long TLB1_MAS0(1,4,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,5,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,6,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_64M)
|
||||
#if defined(CONFIG_RAM_AS_FLASH)
|
||||
.long TLB1_MAS2(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
#else
|
||||
.long TLB1_MAS2(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,0,0,0,0)
|
||||
#endif
|
||||
.long TLB1_MAS3(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,7,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_16K)
|
||||
#ifdef CONFIG_L2_INIT_RAM
|
||||
.long TLB1_MAS2(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,1,0,0,0,0)
|
||||
#else
|
||||
.long TLB1_MAS2(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,0,0,0,0,0)
|
||||
#endif
|
||||
.long TLB1_MAS3(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,8,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_256M)
|
||||
.long TLB1_MAS2(((CFG_PCI_MEM_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_PCI_MEM_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR)
|
||||
.long TLB1_MAS0(1,15,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_CCSRBAR_DEFAULT>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_CCSRBAR_DEFAULT>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
#else
|
||||
.long TLB1_MAS0(1,15,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
#endif
|
||||
entry_end
|
||||
|
||||
/* LAW(Local Access Window) configuration:
|
||||
* 0000_0000-8000_0000: Up to 2G DDR
|
||||
* f000_0000-f3ff_ffff: PCI(256M)
|
||||
* f400_0000-f7ff_ffff: RapidIO(128M)
|
||||
* f800_0000-ffff_ffff: localbus(128M)
|
||||
* f800_0000-fbff_ffff: LBC SDRAM(64M)
|
||||
* fc00_0000-fcff_ffff: LBC BCSR (1M, Chip select 1)
|
||||
* fdf0_0000-fdff_ffff: CCSRBAR(1M)
|
||||
* ff00_0000-ffff_ffff: Flash(16M)
|
||||
* We don't need a local window for CCSRBAR and flash because they
|
||||
* reside in their default mapped spaces.
|
||||
*/
|
||||
|
||||
#define LAWBAR0 0
|
||||
#define LAWAR0 ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_2G)) & ~LAWAR_EN)
|
||||
|
||||
#define LAWBAR1 ((CFG_PCI_MEM_BASE>>12) & 0xfffff)
|
||||
#define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_256M))
|
||||
|
||||
#if !defined(CONFIG_RAM_AS_FLASH)
|
||||
#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff)
|
||||
#define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_128M))
|
||||
#else
|
||||
#define LAWBAR2 0
|
||||
#define LAWAR2 ((LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN)
|
||||
#endif
|
||||
|
||||
.section .bootpg, "ax"
|
||||
.globl law_entry
|
||||
law_entry:
|
||||
entry_start
|
||||
.long 0x03
|
||||
.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2
|
||||
entry_end
|
||||
@@ -0,0 +1,423 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Embedded Edge, LLC
|
||||
* Dan Malek, <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560
|
||||
*
|
||||
* (C) Copyright 2003,Motorola Inc.
|
||||
* Xianghua Xiao, (X.Xiao@motorola.com)
|
||||
*
|
||||
* (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.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
|
||||
*/
|
||||
|
||||
|
||||
extern long int spd_sdram (void);
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/immap_85xx.h>
|
||||
#include <ioports.h>
|
||||
#include <asm/io.h>
|
||||
#include <spd.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
long int fixed_sdram (void);
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
*
|
||||
* if conf is 1, then that port pin will be configured at boot time
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
|
||||
/* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
|
||||
/* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
|
||||
/* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
|
||||
/* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
|
||||
/* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
|
||||
/* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
|
||||
/* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
|
||||
/* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
|
||||
/* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
|
||||
/* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
|
||||
/* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
|
||||
/* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
|
||||
/* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
|
||||
/* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
|
||||
/* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
|
||||
/* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
|
||||
/* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
|
||||
/* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
|
||||
/* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
|
||||
/* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
|
||||
/* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
|
||||
/* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
|
||||
/* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
|
||||
/* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
|
||||
/* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
|
||||
/* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
|
||||
},
|
||||
|
||||
/* Port B configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
|
||||
/* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
|
||||
/* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
|
||||
/* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
|
||||
/* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
|
||||
/* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
|
||||
/* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
|
||||
/* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
|
||||
/* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
|
||||
/* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
|
||||
/* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
|
||||
/* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
|
||||
/* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
|
||||
/* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
|
||||
/* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
|
||||
/* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
|
||||
/* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
|
||||
/* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
|
||||
/* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
|
||||
/* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
|
||||
/* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
|
||||
/* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
|
||||
/* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
|
||||
/* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
|
||||
/* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
|
||||
/* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
|
||||
/* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
|
||||
/* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
|
||||
/* PC15 */ { 0, 1, 0, 0, 0, 0 }, /* PC15 */
|
||||
/* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
|
||||
/* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
|
||||
/* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
|
||||
/* PC10 */ { 0, 0, 0, 1, 0, 0 }, /* FETHMDC */
|
||||
/* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* FETHMDIO */
|
||||
/* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
|
||||
/* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
|
||||
/* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
|
||||
/* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
|
||||
/* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
|
||||
},
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
|
||||
/* PD30 */ { 0, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
|
||||
/* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
|
||||
/* PD28 */ { 1, 1, 0, 0, 0, 0 }, /* SCC2 RxD */
|
||||
/* PD27 */ { 1, 1, 0, 1, 0, 0 }, /* SCC2 TxD */
|
||||
/* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
|
||||
/* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
|
||||
/* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
|
||||
/* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
|
||||
/* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
|
||||
/* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
|
||||
/* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
|
||||
/* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
|
||||
/* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
|
||||
/* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
|
||||
/* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 0, 0 }, /* I2C CLK */
|
||||
/* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
|
||||
/* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
|
||||
/* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
|
||||
/* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
|
||||
/* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
|
||||
/* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
|
||||
/* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
}
|
||||
};
|
||||
|
||||
static uint64_t next_led_update;
|
||||
static uint led_bit;
|
||||
|
||||
int board_pre_init (void)
|
||||
{
|
||||
#if defined(CONFIG_PCI)
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_pcix_t *pci = &immr->im_pcix;
|
||||
|
||||
pci->peer &= 0xfffffffdf; /* disable master abort */
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_phy (void)
|
||||
{
|
||||
volatile uint *blatch;
|
||||
|
||||
blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
|
||||
|
||||
/* reset Giga bit Ethernet port if needed here */
|
||||
|
||||
*blatch &= ~0x000000c0;
|
||||
udelay(100);
|
||||
*blatch = 0x000000c1; /* Light one led, too */
|
||||
udelay(1000);
|
||||
|
||||
#if 0 /* This is the port we really want to use for debugging. */
|
||||
/* reset the CPM FEC port */
|
||||
#if (CONFIG_ETHER_INDEX == 2)
|
||||
bcsr->bcsr2 &= ~FETH2_RST;
|
||||
udelay(2);
|
||||
bcsr->bcsr2 |= FETH2_RST;
|
||||
udelay(1000);
|
||||
#elif (CONFIG_ETHER_INDEX == 3)
|
||||
bcsr->bcsr3 &= ~FETH3_RST;
|
||||
udelay(2);
|
||||
bcsr->bcsr3 |= FETH3_RST;
|
||||
udelay(1000);
|
||||
#endif
|
||||
#if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
|
||||
miiphy_reset(0x0); /* reset PHY */
|
||||
miiphy_write(0, PHY_MIPSCR, 0xf028); /* change PHY address to 0x02 */
|
||||
miiphy_write(0x02, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#endif /* CONFIG_MII */
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
sys_info_t sysinfo;
|
||||
|
||||
get_sys_info (&sysinfo);
|
||||
|
||||
printf ("Board: Silicon Tx GPPP 8560 Board\n");
|
||||
printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
|
||||
printf ("\tCCB: %lu MHz\n", sysinfo.freqSystemBus / 1000000);
|
||||
printf ("\tDDR: %lu MHz\n", sysinfo.freqSystemBus / 2000000);
|
||||
if((CFG_LBC_LCRR & 0x0f) == 2 || (CFG_LBC_LCRR & 0x0f) == 4 \
|
||||
|| (CFG_LBC_LCRR & 0x0f) == 8) {
|
||||
printf ("\tLBC: %lu MHz\n", sysinfo.freqSystemBus / 1000000 /(CFG_LBC_LCRR & 0x0f));
|
||||
} else {
|
||||
printf("\tLBC: unknown\n");
|
||||
}
|
||||
printf("\tCPM: %lu Mhz\n", sysinfo.freqSystemBus / 1000000);
|
||||
printf("L1 D-cache 32KB, L1 I-cache 32KB enabled.\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Blinkin' LEDS for Robert.
|
||||
*/
|
||||
void
|
||||
show_activity(int flag)
|
||||
{
|
||||
volatile uint *blatch;
|
||||
|
||||
if (next_led_update > get_ticks())
|
||||
return;
|
||||
|
||||
blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
|
||||
|
||||
led_bit >>= 1;
|
||||
if (led_bit == 0)
|
||||
led_bit = 0x08;
|
||||
*blatch = (0xc0 | led_bit);
|
||||
eieio();
|
||||
next_led_update += (get_tbclk() / 4);
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long dram_size = 0;
|
||||
extern long spd_sdram (void);
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
|
||||
#if defined(CONFIG_DDR_DLL)
|
||||
volatile ccsr_gur_t *gur= &immap->im_gur;
|
||||
uint temp_ddrdll = 0;
|
||||
|
||||
/* Work around to stabilize DDR DLL */
|
||||
temp_ddrdll = gur->ddrdllcr;
|
||||
gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000;
|
||||
asm("sync;isync;msync");
|
||||
#endif
|
||||
|
||||
dram_size = spd_sdram ();
|
||||
|
||||
#if defined(CONFIG_DDR_ECC)
|
||||
{
|
||||
/* Initialize all of memory for ECC, then
|
||||
* enable errors */
|
||||
uint *p = 0;
|
||||
uint i = 0;
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_ddr_t *ddr= &immap->im_ddr;
|
||||
dma_init();
|
||||
for (*p = 0; p < (uint *)(8 * 1024); p++) {
|
||||
if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
|
||||
*p = (unsigned int)0xdeadbeef;
|
||||
if (((unsigned int)p & 0x1c) == 0x1c) { dcbf(p); }
|
||||
}
|
||||
|
||||
/* 8K */
|
||||
dma_xfer((uint *)0x2000,0x2000,(uint *)0);
|
||||
/* 16K */
|
||||
dma_xfer((uint *)0x4000,0x4000,(uint *)0);
|
||||
/* 32K */
|
||||
dma_xfer((uint *)0x8000,0x8000,(uint *)0);
|
||||
/* 64K */
|
||||
dma_xfer((uint *)0x10000,0x10000,(uint *)0);
|
||||
/* 128k */
|
||||
dma_xfer((uint *)0x20000,0x20000,(uint *)0);
|
||||
/* 256k */
|
||||
dma_xfer((uint *)0x40000,0x40000,(uint *)0);
|
||||
/* 512k */
|
||||
dma_xfer((uint *)0x80000,0x80000,(uint *)0);
|
||||
/* 1M */
|
||||
dma_xfer((uint *)0x100000,0x100000,(uint *)0);
|
||||
/* 2M */
|
||||
dma_xfer((uint *)0x200000,0x200000,(uint *)0);
|
||||
/* 4M */
|
||||
dma_xfer((uint *)0x400000,0x400000,(uint *)0);
|
||||
|
||||
for (i = 1; i < dram_size / 0x800000; i++) {
|
||||
dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
|
||||
}
|
||||
|
||||
/* Enable errors for ECC */
|
||||
ddr->err_disable = 0x00000000;
|
||||
asm("sync;isync;msync");
|
||||
}
|
||||
#endif
|
||||
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
|
||||
#if defined(CFG_DRAM_TEST)
|
||||
int testdram (void)
|
||||
{
|
||||
uint *pstart = (uint *) CFG_MEMTEST_START;
|
||||
uint *pend = (uint *) CFG_MEMTEST_END;
|
||||
uint *p;
|
||||
|
||||
printf("SDRAM test phase 1:\n");
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0xaaaaaaaa;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0xaaaaaaaa) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("SDRAM test phase 2:\n");
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0x55555555;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0x55555555) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("SDRAM test passed.\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPD_EEPROM)
|
||||
/*************************************************************************
|
||||
* fixed sdram init -- doesn't use serial presence detect.
|
||||
************************************************************************/
|
||||
long int fixed_sdram (void)
|
||||
{
|
||||
#ifndef CFG_RAMBOOT
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_ddr_t *ddr= &immap->im_ddr;
|
||||
|
||||
ddr->cs0_bnds = CFG_DDR_CS0_BNDS;
|
||||
ddr->cs0_config = CFG_DDR_CS0_CONFIG;
|
||||
ddr->timing_cfg_1 = CFG_DDR_TIMING_1;
|
||||
ddr->timing_cfg_2 = CFG_DDR_TIMING_2;
|
||||
ddr->sdram_mode = CFG_DDR_MODE;
|
||||
ddr->sdram_interval = CFG_DDR_INTERVAL;
|
||||
#if defined (CONFIG_DDR_ECC)
|
||||
ddr->err_disable = 0x0000000D;
|
||||
ddr->err_sbe = 0x00ff0000;
|
||||
#endif
|
||||
asm("sync;isync;msync");
|
||||
udelay(500);
|
||||
#if defined (CONFIG_DDR_ECC)
|
||||
/* Enable ECC checking */
|
||||
ddr->sdram_cfg = (CFG_DDR_CONTROL | 0x20000000);
|
||||
#else
|
||||
ddr->sdram_cfg = CFG_DDR_CONTROL;
|
||||
#endif
|
||||
asm("sync; isync; msync");
|
||||
udelay(500);
|
||||
#endif
|
||||
return ( CFG_SDRAM_SIZE * 1024 * 1024);
|
||||
}
|
||||
#endif /* !defined(CONFIG_SPD_EEPROM) */
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* (C) Copyright 2003 Embedded Edge, LLC
|
||||
* Dan Malek, <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560.
|
||||
*
|
||||
* (C) Copyright 2002,2003,Motorola,Inc.
|
||||
* Xianghua Xiao, X.Xiao@motorola.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_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 0xFFFFFFFC :
|
||||
{
|
||||
*(.resetvec)
|
||||
} = 0xffff
|
||||
|
||||
.bootpg 0xFFFFF000 :
|
||||
{
|
||||
cpu/mpc85xx/start.o (.bootpg)
|
||||
board/stxgp3/init.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 :
|
||||
{
|
||||
cpu/mpc85xx/start.o (.text)
|
||||
board/stxgp3/init.o (.text)
|
||||
cpu/mpc85xx/commproc.o (.text)
|
||||
cpu/mpc85xx/traps.o (.text)
|
||||
cpu/mpc85xx/interrupts.o (.text)
|
||||
cpu/mpc85xx/serial_scc.o (.text)
|
||||
cpu/mpc85xx/ether_fcc.o (.text)
|
||||
cpu/mpc85xx/cpu_init.o (.text)
|
||||
cpu/mpc85xx/cpu.o (.text)
|
||||
cpu/mpc85xx/tsec.o (.text)
|
||||
cpu/mpc85xx/speed.o (.text)
|
||||
cpu/mpc85xx/i2c.o (.text)
|
||||
cpu/mpc85xx/spd_sdram.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.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 :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -29,6 +29,15 @@
|
||||
#include <mpc8xx.h>
|
||||
#include <environment.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
|
||||
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M)
|
||||
# ifndef CFG_OR_TIMING_FLASH_AT_50MHZ
|
||||
# define CFG_OR_TIMING_FLASH_AT_50MHZ (OR_ACS_DIV1 | OR_TRLX | OR_CSNT_SAM | \
|
||||
OR_SCY_2_CLK | OR_EHTR | OR_BI)
|
||||
# endif
|
||||
#endif /* CONFIG_TQM8xxL/M, !TQM866M */
|
||||
|
||||
#ifndef CFG_ENV_ADDR
|
||||
#define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
#endif
|
||||
@@ -51,6 +60,50 @@ unsigned long flash_init (void)
|
||||
unsigned long size_b0, size_b1;
|
||||
int i;
|
||||
|
||||
#ifdef CFG_OR_TIMING_FLASH_AT_50MHZ
|
||||
int scy, trlx, flash_or_timing, clk_diff;
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
scy = (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
|
||||
if (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {
|
||||
trlx = OR_TRLX;
|
||||
scy *= 2;
|
||||
} else
|
||||
trlx = 0;
|
||||
|
||||
/* We assume that each 10MHz of bus clock require 1-clk SCY
|
||||
* adjustment.
|
||||
*/
|
||||
clk_diff = (gd->bus_clk / 1000000) - 50;
|
||||
|
||||
/* We need proper rounding here. This is what the "+5" and "-5"
|
||||
* are here for.
|
||||
*/
|
||||
if (clk_diff >= 0)
|
||||
scy += (clk_diff + 5) / 10;
|
||||
else
|
||||
scy += (clk_diff - 5) / 10;
|
||||
|
||||
/* For bus frequencies above 50MHz, we want to use relaxed timing
|
||||
* (OR_TRLX).
|
||||
*/
|
||||
if (gd->bus_clk >= 50000000)
|
||||
trlx = OR_TRLX;
|
||||
else
|
||||
trlx = 0;
|
||||
|
||||
if (trlx)
|
||||
scy /= 2;
|
||||
|
||||
if (scy > 0xf)
|
||||
scy = 0xf;
|
||||
if (scy < 1)
|
||||
scy = 1;
|
||||
|
||||
flash_or_timing = (scy << 4) | trlx |
|
||||
(CFG_OR_TIMING_FLASH_AT_50MHZ & ~(OR_TRLX | OR_SCY_MSK));
|
||||
#endif
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
@@ -95,7 +148,11 @@ unsigned long flash_init (void)
|
||||
memctl->memc_br1, memctl->memc_or1);
|
||||
|
||||
/* Remap FLASH according to real size */
|
||||
#ifndef CFG_OR_TIMING_FLASH_AT_50MHZ
|
||||
memctl->memc_or0 = CFG_OR_TIMING_FLASH | (-size_b0 & OR_AM_MSK);
|
||||
#else
|
||||
memctl->memc_or0 = flash_or_timing | (-size_b0 & OR_AM_MSK);
|
||||
#endif
|
||||
memctl->memc_br0 = (CFG_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
|
||||
|
||||
debug ("## BR0: 0x%08x OR0: 0x%08x\n",
|
||||
@@ -146,7 +203,11 @@ unsigned long flash_init (void)
|
||||
#endif
|
||||
|
||||
if (size_b1) {
|
||||
#ifndef CFG_OR_TIMING_FLASH_AT_50MHZ
|
||||
memctl->memc_or1 = CFG_OR_TIMING_FLASH | (-size_b1 & 0xFFFF8000);
|
||||
#else
|
||||
memctl->memc_or1 = flash_or_timing | (-size_b1 & 0xFFFF8000);
|
||||
#endif
|
||||
memctl->memc_br1 = ((CFG_FLASH_BASE + size_b0) & BR_BA_MSK) |
|
||||
BR_MS_GPCM | BR_V;
|
||||
|
||||
|
||||
+11
-16
@@ -48,35 +48,30 @@ int checkboard(void)
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
#if 1
|
||||
long size;
|
||||
long new_bank0_end;
|
||||
long new_bank1_end;
|
||||
long mear1;
|
||||
long emear1;
|
||||
/*
|
||||
write_bat(IBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
|
||||
( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
|
||||
|
||||
write_bat(DBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
|
||||
( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
|
||||
*/
|
||||
size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
|
||||
|
||||
new_bank0_end = size - 1;
|
||||
new_bank0_end = size/2 - 1;
|
||||
new_bank1_end = size - 1;
|
||||
mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
|
||||
mear1 = (mear1 & 0xFFFF0000) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
|
||||
((new_bank1_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT << 8);
|
||||
emear1 = (emear1 & 0xFFFF0000) |
|
||||
((new_bank0_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
|
||||
((new_bank1_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT << 8);
|
||||
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
|
||||
return (size);
|
||||
#else
|
||||
return (CFG_MAX_RAM_SIZE);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-3
@@ -53,7 +53,7 @@ static unsigned ace_readw(unsigned offset)
|
||||
return readw(CFG_SYSTEMACE_BASE+offset);
|
||||
}
|
||||
|
||||
static unsigned ace_writew(unsigned val, unsigned offset)
|
||||
static void ace_writew(unsigned val, unsigned offset)
|
||||
{
|
||||
writew(val, CFG_SYSTEMACE_BASE+offset);
|
||||
}
|
||||
@@ -119,7 +119,6 @@ static unsigned long systemace_read(int dev,
|
||||
unsigned long blkcnt,
|
||||
unsigned long *buffer)
|
||||
{
|
||||
unsigned val;
|
||||
int retry;
|
||||
unsigned blk_countdown;
|
||||
unsigned char*dp = (unsigned char*)buffer;
|
||||
@@ -218,4 +217,4 @@ static unsigned long systemace_read(int dev,
|
||||
|
||||
return blkcnt;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_SYSTEMACE */
|
||||
@@ -242,6 +242,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (hdr->ih_arch != IH_CPU_NIOS)
|
||||
#elif defined(__M68K__)
|
||||
if (hdr->ih_arch != IH_CPU_M68K)
|
||||
#elif defined(__microblaze__)
|
||||
if (hdr->ih_arch != IH_CPU_MICROBLAZE)
|
||||
#else
|
||||
# error Unknown CPU type
|
||||
#endif
|
||||
@@ -1185,6 +1187,7 @@ print_type (image_header_t *hdr)
|
||||
case IH_CPU_SPARC: arch = "SPARC"; break;
|
||||
case IH_CPU_SPARC64: arch = "SPARC 64 Bit"; break;
|
||||
case IH_CPU_M68K: arch = "M68K"; break;
|
||||
case IH_CPU_MICROBLAZE: arch = "Microblaze"; break;
|
||||
default: arch = "Unknown Architecture"; break;
|
||||
}
|
||||
|
||||
|
||||
+29
-40
@@ -60,6 +60,11 @@ static unsigned long mips_io_port_base = 0;
|
||||
# define SHOW_BOOT_PROGRESS(arg)
|
||||
#endif
|
||||
|
||||
#ifdef __PPC__
|
||||
# define EIEIO __asm__ volatile ("eieio")
|
||||
#else
|
||||
# define EIEIO /* nothing */
|
||||
#endif
|
||||
|
||||
#undef IDE_DEBUG
|
||||
|
||||
@@ -790,9 +795,7 @@ ide_outb(int dev, int port, unsigned char val)
|
||||
dev, port, val, (ATA_CURR_BASE(dev)+port));
|
||||
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
@@ -810,9 +813,7 @@ ide_inb(int dev, int port)
|
||||
{
|
||||
uchar val;
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
val = *((uchar *)(ATA_CURR_BASE(dev)+port));
|
||||
PRINTF ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
|
||||
dev, port, (ATA_CURR_BASE(dev)+port), val);
|
||||
@@ -837,9 +838,9 @@ output_data_short(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
if (words&1)
|
||||
@@ -895,13 +896,9 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -913,13 +910,13 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
dbuf = (uchar *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -946,13 +943,9 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
PRINTF("in input data base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -964,13 +957,13 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
dbuf = (uchar *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -994,9 +987,9 @@ input_data_short(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
if (words&1) {
|
||||
@@ -1608,9 +1601,7 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
PRINTF("in output data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1621,9 +1612,9 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
while (shorts--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -1642,9 +1633,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
PRINTF("in input data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1655,9 +1644,9 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
while (shorts--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
+414
-1
@@ -27,10 +27,11 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_MII)
|
||||
#include <miiphy.h>
|
||||
|
||||
#ifdef CONFIG_TERSE_MII
|
||||
/*
|
||||
* Display values from last command.
|
||||
*/
|
||||
@@ -144,5 +145,417 @@ U_BOOT_CMD(
|
||||
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
|
||||
);
|
||||
|
||||
#else /* ! CONFIG_TERSE_MII ================================================= */
|
||||
|
||||
typedef struct _MII_reg_desc_t {
|
||||
ushort regno;
|
||||
char * name;
|
||||
} MII_reg_desc_t;
|
||||
|
||||
MII_reg_desc_t reg_0_5_desc_tbl[] = {
|
||||
{ 0, "PHY control register" },
|
||||
{ 1, "PHY status register" },
|
||||
{ 2, "PHY ID 1 register" },
|
||||
{ 3, "PHY ID 2 register" },
|
||||
{ 4, "Autonegotiation advertisement register" },
|
||||
{ 5, "Autonegotiation partner abilities register" },
|
||||
};
|
||||
|
||||
typedef struct _MII_field_desc_t {
|
||||
ushort hi;
|
||||
ushort lo;
|
||||
ushort mask;
|
||||
char * name;
|
||||
} MII_field_desc_t;
|
||||
|
||||
MII_field_desc_t reg_0_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "reset" },
|
||||
{ 14, 14, 0x01, "loopback" },
|
||||
{ 13, 6, 0x81, "speed selection" }, /* special */
|
||||
{ 12, 12, 0x01, "A/N enable" },
|
||||
{ 11, 11, 0x01, "power-down" },
|
||||
{ 10, 10, 0x01, "isolate" },
|
||||
{ 9, 9, 0x01, "restart A/N" },
|
||||
{ 8, 8, 0x01, "duplex" }, /* special */
|
||||
{ 7, 7, 0x01, "collision test enable" },
|
||||
{ 5, 0, 0x3f, "(reserved)" }
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_1_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "100BASE-T4 able" },
|
||||
{ 14, 14, 0x01, "100BASE-X full duplex able" },
|
||||
{ 13, 13, 0x01, "100BASE-X half duplex able" },
|
||||
{ 12, 12, 0x01, "10 Mbps full duplex able" },
|
||||
{ 11, 11, 0x01, "10 Mbps half duplex able" },
|
||||
{ 10, 10, 0x01, "100BASE-T2 full duplex able" },
|
||||
{ 9, 9, 0x01, "100BASE-T2 half duplex able" },
|
||||
{ 8, 8, 0x01, "extended status" },
|
||||
{ 7, 7, 0x01, "(reserved)" },
|
||||
{ 6, 6, 0x01, "MF preamble suppression" },
|
||||
{ 5, 5, 0x01, "A/N complete" },
|
||||
{ 4, 4, 0x01, "remote fault" },
|
||||
{ 3, 3, 0x01, "A/N able" },
|
||||
{ 2, 2, 0x01, "link status" },
|
||||
{ 1, 1, 0x01, "jabber detect" },
|
||||
{ 0, 0, 0x01, "extended capabilities" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_2_desc_tbl[] = {
|
||||
{ 15, 0, 0xffff, "OUI portion" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_3_desc_tbl[] = {
|
||||
{ 15, 10, 0x3f, "OUI portion" },
|
||||
{ 9, 4, 0x3f, "manufacturer part number" },
|
||||
{ 3, 0, 0x0f, "manufacturer rev. number" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_4_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "next page able" },
|
||||
{ 14, 14, 0x01, "reserved" },
|
||||
{ 13, 13, 0x01, "remote fault" },
|
||||
{ 12, 12, 0x01, "reserved" },
|
||||
{ 11, 11, 0x01, "asymmetric pause" },
|
||||
{ 10, 10, 0x01, "pause enable" },
|
||||
{ 9, 9, 0x01, "100BASE-T4 able" },
|
||||
{ 8, 8, 0x01, "100BASE-TX full duplex able" },
|
||||
{ 7, 7, 0x01, "100BASE-TX able" },
|
||||
{ 6, 6, 0x01, "10BASE-T full duplex able" },
|
||||
{ 5, 5, 0x01, "10BASE-T able" },
|
||||
{ 4, 0, 0x1f, "xxx to do" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_5_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "next page able" },
|
||||
{ 14, 14, 0x01, "acknowledge" },
|
||||
{ 13, 13, 0x01, "remote fault" },
|
||||
{ 12, 12, 0x01, "(reserved)" },
|
||||
{ 11, 11, 0x01, "asymmetric pause able" },
|
||||
{ 10, 10, 0x01, "pause able" },
|
||||
{ 9, 9, 0x01, "100BASE-T4 able" },
|
||||
{ 8, 8, 0x01, "100BASE-X full duplex able" },
|
||||
{ 7, 7, 0x01, "100BASE-TX able" },
|
||||
{ 6, 6, 0x01, "10BASE-T full duplex able" },
|
||||
{ 5, 5, 0x01, "10BASE-T able" },
|
||||
{ 4, 0, 0x1f, "xxx to do" },
|
||||
};
|
||||
|
||||
#define DESC0LEN (sizeof(reg_0_desc_tbl)/sizeof(reg_0_desc_tbl[0]))
|
||||
#define DESC1LEN (sizeof(reg_1_desc_tbl)/sizeof(reg_1_desc_tbl[0]))
|
||||
#define DESC2LEN (sizeof(reg_2_desc_tbl)/sizeof(reg_2_desc_tbl[0]))
|
||||
#define DESC3LEN (sizeof(reg_3_desc_tbl)/sizeof(reg_3_desc_tbl[0]))
|
||||
#define DESC4LEN (sizeof(reg_4_desc_tbl)/sizeof(reg_4_desc_tbl[0]))
|
||||
#define DESC5LEN (sizeof(reg_5_desc_tbl)/sizeof(reg_5_desc_tbl[0]))
|
||||
|
||||
typedef struct _MII_field_desc_and_len_t {
|
||||
MII_field_desc_t * pdesc;
|
||||
ushort len;
|
||||
} MII_field_desc_and_len_t;
|
||||
|
||||
MII_field_desc_and_len_t desc_and_len_tbl[] = {
|
||||
{ reg_0_desc_tbl, DESC0LEN },
|
||||
{ reg_1_desc_tbl, DESC1LEN },
|
||||
{ reg_2_desc_tbl, DESC2LEN },
|
||||
{ reg_3_desc_tbl, DESC3LEN },
|
||||
{ reg_4_desc_tbl, DESC4LEN },
|
||||
{ reg_5_desc_tbl, DESC5LEN },
|
||||
};
|
||||
|
||||
static void dump_reg(
|
||||
ushort regval,
|
||||
MII_reg_desc_t * prd,
|
||||
MII_field_desc_and_len_t * pdl);
|
||||
|
||||
static int special_field(
|
||||
ushort regno,
|
||||
MII_field_desc_t * pdesc,
|
||||
ushort regval);
|
||||
|
||||
void MII_dump_0_to_5(
|
||||
ushort regvals[6],
|
||||
uchar reglo,
|
||||
uchar reghi)
|
||||
{
|
||||
ulong i;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if ((reglo <= i) && (i <= reghi))
|
||||
dump_reg(regvals[i], ®_0_5_desc_tbl[i],
|
||||
&desc_and_len_tbl[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_reg(
|
||||
ushort regval,
|
||||
MII_reg_desc_t * prd,
|
||||
MII_field_desc_and_len_t * pdl)
|
||||
{
|
||||
ulong i;
|
||||
ushort mask_in_place;
|
||||
MII_field_desc_t * pdesc;
|
||||
|
||||
printf("%u. (%04hx) -- %s --\n",
|
||||
prd->regno, regval, prd->name);
|
||||
|
||||
for (i = 0; i < pdl->len; i++) {
|
||||
pdesc = &pdl->pdesc[i];
|
||||
|
||||
mask_in_place = pdesc->mask << pdesc->lo;
|
||||
|
||||
printf(" (%04hx:%04hx) %u.",
|
||||
mask_in_place,
|
||||
regval & mask_in_place,
|
||||
prd->regno);
|
||||
|
||||
if (special_field(prd->regno, pdesc, regval)) {
|
||||
}
|
||||
else {
|
||||
if (pdesc->hi == pdesc->lo)
|
||||
printf("%2u ", pdesc->lo);
|
||||
else
|
||||
printf("%2u-%2u", pdesc->hi, pdesc->lo);
|
||||
printf(" = %5u %s",
|
||||
(regval & mask_in_place) >> pdesc->lo,
|
||||
pdesc->name);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* Special fields:
|
||||
** 0.6,13
|
||||
** 0.8
|
||||
** 2.15-0
|
||||
** 3.15-0
|
||||
** 4.4-0
|
||||
** 5.4-0
|
||||
*/
|
||||
|
||||
static int special_field(
|
||||
ushort regno,
|
||||
MII_field_desc_t * pdesc,
|
||||
ushort regval)
|
||||
{
|
||||
if ((regno == 0) && (pdesc->lo == 6)) {
|
||||
ushort speed_bits = regval & PHY_BMCR_SPEED_MASK;
|
||||
printf("%2u,%2u = b%u%u speed selection = %s Mbps",
|
||||
6, 13,
|
||||
(regval >> 6) & 1,
|
||||
(regval >> 13) & 1,
|
||||
speed_bits == PHY_BMCR_1000_MBPS ? "1000" :
|
||||
speed_bits == PHY_BMCR_100_MBPS ? "100" :
|
||||
speed_bits == PHY_BMCR_10_MBPS ? "10" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 0) && (pdesc->lo == 8)) {
|
||||
printf("%2u = %5u duplex = %s",
|
||||
pdesc->lo,
|
||||
(regval >> pdesc->lo) & 1,
|
||||
((regval >> pdesc->lo) & 1) ? "full" : "half");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 4) && (pdesc->lo == 0)) {
|
||||
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
|
||||
printf("%2u-%2u = %5u selector = %s",
|
||||
pdesc->hi, pdesc->lo, sel_bits,
|
||||
sel_bits == PHY_ANLPAR_PSB_802_3 ?
|
||||
"IEEE 802.3" :
|
||||
sel_bits == PHY_ANLPAR_PSB_802_9 ?
|
||||
"IEEE 802.9 ISLAN-16T" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 5) && (pdesc->lo == 0)) {
|
||||
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
|
||||
printf("%2u-%2u = %u selector = %s",
|
||||
pdesc->hi, pdesc->lo, sel_bits,
|
||||
sel_bits == PHY_ANLPAR_PSB_802_3 ?
|
||||
"IEEE 802.3" :
|
||||
sel_bits == PHY_ANLPAR_PSB_802_9 ?
|
||||
"IEEE 802.9 ISLAN-16T" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint last_op;
|
||||
uint last_data;
|
||||
uint last_addr_lo;
|
||||
uint last_addr_hi;
|
||||
uint last_reg_lo;
|
||||
uint last_reg_hi;
|
||||
|
||||
static void extract_range(
|
||||
char * input,
|
||||
unsigned char * plo,
|
||||
unsigned char * phi)
|
||||
{
|
||||
char * end;
|
||||
*plo = simple_strtoul(input, &end, 16);
|
||||
if (*end == '-') {
|
||||
end++;
|
||||
*phi = simple_strtoul(end, NULL, 16);
|
||||
}
|
||||
else {
|
||||
*phi = *plo;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
char op;
|
||||
unsigned char addrlo, addrhi, reglo, reghi;
|
||||
unsigned char addr = 0, reg = 0;
|
||||
unsigned short data;
|
||||
int rcode = 0;
|
||||
|
||||
#ifdef CONFIG_8xx
|
||||
mii_init ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We use the last specified parameters, unless new ones are
|
||||
* entered.
|
||||
*/
|
||||
op = last_op;
|
||||
addrlo = last_addr_lo;
|
||||
addrhi = last_addr_hi;
|
||||
reglo = last_reg_lo;
|
||||
reghi = last_reg_hi;
|
||||
data = last_data;
|
||||
|
||||
if ((flag & CMD_FLAG_REPEAT) == 0) {
|
||||
op = argv[1][0];
|
||||
if (argc >= 3)
|
||||
extract_range(argv[2], &addrlo, &addrhi);
|
||||
if (argc >= 4)
|
||||
extract_range(argv[3], ®lo, ®hi);
|
||||
if (argc >= 5)
|
||||
data = simple_strtoul (argv[4], NULL, 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* check info/read/write.
|
||||
*/
|
||||
if (op == 'i') {
|
||||
unsigned char j, start, end;
|
||||
unsigned int oui;
|
||||
unsigned char model;
|
||||
unsigned char rev;
|
||||
|
||||
/*
|
||||
* Look for any and all PHYs. Valid addresses are 0..31.
|
||||
*/
|
||||
if (argc >= 3) {
|
||||
start = addr; end = addr + 1;
|
||||
} else {
|
||||
start = 0; end = 32;
|
||||
}
|
||||
|
||||
for (j = start; j < end; j++) {
|
||||
if (miiphy_info (j, &oui, &model, &rev) == 0) {
|
||||
printf("PHY 0x%02X: "
|
||||
"OUI = 0x%04X, "
|
||||
"Model = 0x%02X, "
|
||||
"Rev = 0x%02X, "
|
||||
"%3dbaseT, %s\n",
|
||||
j, oui, model, rev,
|
||||
miiphy_speed (j),
|
||||
miiphy_duplex (j) == FULL ? "FDX" : "HDX");
|
||||
}
|
||||
}
|
||||
} else if (op == 'r') {
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = reglo; reg <= reghi; reg++) {
|
||||
data = 0xffff;
|
||||
if (miiphy_read (addr, reg, &data) != 0) {
|
||||
printf(
|
||||
"Error reading from the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
else {
|
||||
if ((addrlo != addrhi) || (reglo != reghi))
|
||||
printf("addr=%02x reg=%02x data=",
|
||||
(uint)addr, (uint)reg);
|
||||
printf("%04X\n", data & 0x0000FFFF);
|
||||
}
|
||||
}
|
||||
if ((addrlo != addrhi) && (reglo != reghi))
|
||||
printf("\n");
|
||||
}
|
||||
} else if (op == 'w') {
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = reglo; reg <= reghi; reg++) {
|
||||
if (miiphy_write (addr, reg, data) != 0) {
|
||||
printf("Error writing to the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (op == 'd') {
|
||||
ushort regs[6];
|
||||
int ok = 1;
|
||||
if ((reglo > 5) || (reghi > 5)) {
|
||||
printf(
|
||||
"The MII dump command only formats the "
|
||||
"standard MII registers, 0-5.\n");
|
||||
return 1;
|
||||
}
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = 0; reg < 6; reg++) {
|
||||
if (miiphy_read(addr, reg, ®s[reg]) != 0) {
|
||||
ok = 0;
|
||||
printf(
|
||||
"Error reading from the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
MII_dump_0_to_5(regs, reglo, reghi);
|
||||
printf("\n");
|
||||
}
|
||||
} else {
|
||||
printf("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the parameters for repeats.
|
||||
*/
|
||||
last_op = op;
|
||||
last_addr_lo = addrlo;
|
||||
last_addr_hi = addrhi;
|
||||
last_reg_lo = reglo;
|
||||
last_reg_hi = reghi;
|
||||
last_data = data;
|
||||
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/***************************************************/
|
||||
|
||||
U_BOOT_CMD(
|
||||
mii, 5, 1, do_mii,
|
||||
"mii - MII utility commands\n",
|
||||
"info <addr> - display MII PHY info\n"
|
||||
"mii read <addr> <reg> - read MII PHY <addr> register <reg>\n"
|
||||
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
|
||||
"mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n"
|
||||
"Addr and/or reg may be ranges, e.g. 2-7.\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_TERSE_MII */
|
||||
|
||||
#endif /* CFG_CMD_MII */
|
||||
+8
-8
@@ -598,14 +598,14 @@ U_BOOT_CMD(
|
||||
usb, 5, 1, do_usb,
|
||||
"usb - USB sub-system\n",
|
||||
"reset - reset (rescan) USB controller\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\n"
|
||||
"usb tree - show USB device tree\n"
|
||||
"usb info [dev] - show available USB devices\n"
|
||||
"usb scan - (re-)scan USB bus for storage devices\n"
|
||||
"usb device [dev] - show or set current USB storage device\n"
|
||||
"usb part [dev] - print partition table of one or all USB storage devices\n"
|
||||
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
|
||||
" to memory address `addr'\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\n"
|
||||
"usb tree - show USB device tree\n"
|
||||
"usb info [dev] - show available USB devices\n"
|
||||
"usb scan - (re-)scan USB bus for storage devices\n"
|
||||
"usb device [dev] - show or set current USB storage device\n"
|
||||
"usb part [dev] - print partition table of one or all USB storage devices\n"
|
||||
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
|
||||
" to memory address `addr'\n"
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ uchar default_environment[] = {
|
||||
#ifdef CONFIG_ETH2ADDR
|
||||
"eth2addr=" MK_STR(CONFIG_ETH2ADDR) "\0"
|
||||
#endif
|
||||
#ifdef CONFIG_ETH3ADDR
|
||||
"eth3addr=" MK_STR(CONFIG_ETH3ADDR) "\0"
|
||||
#endif
|
||||
#ifdef CONFIG_IPADDR
|
||||
"ipaddr=" MK_STR(CONFIG_IPADDR) "\0"
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -726,8 +726,8 @@ static void process_macros (const char *input, char *output)
|
||||
int inputcnt = strlen (input);
|
||||
int outputcnt = CFG_CBSIZE;
|
||||
int state = 0; /* 0 = waiting for '$' */
|
||||
/* 1 = waiting for '(' */
|
||||
/* 2 = waiting for ')' */
|
||||
/* 1 = waiting for '(' or '{' */
|
||||
/* 2 = waiting for ')' or '}' */
|
||||
/* 3 = waiting for ''' */
|
||||
#ifdef DEBUG_PARSER
|
||||
char *output_start = output;
|
||||
@@ -765,7 +765,7 @@ static void process_macros (const char *input, char *output)
|
||||
}
|
||||
break;
|
||||
case 1: /* Waiting for ( */
|
||||
if (c == '(') {
|
||||
if (c == '(' || c == '{') {
|
||||
state++;
|
||||
varname_start = input;
|
||||
} else {
|
||||
@@ -780,7 +780,7 @@ static void process_macros (const char *input, char *output)
|
||||
}
|
||||
break;
|
||||
case 2: /* Waiting for ) */
|
||||
if (c == ')') {
|
||||
if (c == ')' || c == '}') {
|
||||
int i;
|
||||
char envname[CFG_CBSIZE], *envval;
|
||||
int envcnt = input-varname_start-1; /* Varname # of chars */
|
||||
|
||||
@@ -1105,7 +1105,10 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t
|
||||
unsigned long *capacity,*blksz;
|
||||
ccb *pccb=&usb_ccb;
|
||||
|
||||
ss->transport_reset(ss);
|
||||
/* For some mysterious reason the 256MB flash disk of Ours Technology, Inc
|
||||
* doesn't survive this reset */
|
||||
if (dev->descriptor.idVendor != 0xea0 || dev->descriptor.idProduct != 0x6828)
|
||||
ss->transport_reset(ss);
|
||||
pccb->pdata=usb_stor_buf;
|
||||
|
||||
dev_desc->target=dev->devnum;
|
||||
|
||||
@@ -126,7 +126,7 @@ endif
|
||||
# this option have to be placed behind -Wall -- that's why it is here
|
||||
ifeq ($(ARCH),nios)
|
||||
ifeq ($(findstring 2.9,$(shell $(CC) --version)),2.9)
|
||||
CFLAGS := $(CPPFLAGS) -Wno-trigraphs
|
||||
CFLAGS := $(CPPFLAGS) -Wall -Wno-trigraphs
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -215,16 +215,9 @@ void set_timer (ulong t)
|
||||
timestamp = t;
|
||||
}
|
||||
|
||||
/* delay x useconds AND perserve advance timstamp value */
|
||||
/* delay x useconds AND preserve advance timestamp value */
|
||||
void udelay (unsigned long usec)
|
||||
{
|
||||
#ifdef CONFIG_INNOVATOROMAP1510
|
||||
#define LOOPS_PER_MSEC 60 /* tuned on omap1510 */
|
||||
volatile int i, time_remaining = LOOPS_PER_MSEC * usec;
|
||||
|
||||
for (i = time_remaining; i > 0; i--) {
|
||||
}
|
||||
#else
|
||||
ulong tmo, tmp;
|
||||
|
||||
if(usec >= 1000){ /* if "big" number, spread normalization to seconds */
|
||||
@@ -242,9 +235,8 @@ void udelay (unsigned long usec)
|
||||
else
|
||||
tmo += tmp; /* else, set advancing stamp wake up time */
|
||||
|
||||
while (get_timer_masked () < tmo)/* loop till event */
|
||||
while (get_timer_masked () < tmo) /* loop till event */
|
||||
/*NOP*/;
|
||||
#endif
|
||||
}
|
||||
|
||||
void reset_timer_masked (void)
|
||||
|
||||
@@ -378,14 +378,21 @@ int eth_init (bd_t * bd)
|
||||
|
||||
p_mac = AT91C_BASE_EMAC;
|
||||
|
||||
*AT91C_PIOA_PDR = AT91C_PA16_EMDIO | AT91C_PA15_EMDC | AT91C_PA14_ERXER | AT91C_PA13_ERX1 | AT91C_PA12_ERX0 | AT91C_PA11_ECRS_ECRSDV | AT91C_PA10_ETX1 | AT91C_PA9_ETX0 | AT91C_PA8_ETXEN | AT91C_PA7_ETXCK_EREFCK; /* PIO Disable Register */
|
||||
/* PIO Disable Register */
|
||||
*AT91C_PIOA_PDR = AT91C_PA16_EMDIO | AT91C_PA15_EMDC | AT91C_PA14_ERXER |
|
||||
AT91C_PA13_ERX1 | AT91C_PA12_ERX0 | AT91C_PA11_ECRS_ECRSDV |
|
||||
AT91C_PA10_ETX1 | AT91C_PA9_ETX0 | AT91C_PA8_ETXEN |
|
||||
AT91C_PA7_ETXCK_EREFCK;
|
||||
|
||||
*AT91C_PIOB_PDR = AT91C_PB25_EF100 |
|
||||
AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV |
|
||||
AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER |
|
||||
AT91C_PB13_ETX3 | AT91C_PB12_ETX2;
|
||||
AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV |
|
||||
AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER |
|
||||
AT91C_PB13_ETX3 | AT91C_PB12_ETX2;
|
||||
|
||||
*AT91C_PIOB_BSR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER | AT91C_PB13_ETX3 | AT91C_PB12_ETX2; /* Select B Register */
|
||||
/* Select B Register */
|
||||
*AT91C_PIOB_BSR = AT91C_PB25_EF100 | AT91C_PB19_ERXCK | AT91C_PB18_ECOL |
|
||||
AT91C_PB17_ERXDV | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 |
|
||||
AT91C_PB14_ETXER | AT91C_PB13_ETX3 | AT91C_PB12_ETX2;
|
||||
|
||||
*AT91C_PMC_PCER = 1 << AT91C_ID_EMAC; /* Peripheral Clock Enable Register */
|
||||
|
||||
@@ -400,6 +407,22 @@ int eth_init (bd_t * bd)
|
||||
rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
|
||||
rbfp = &rbfdt[0];
|
||||
|
||||
p_mac->EMAC_SA2L = (bd->bi_enetaddr[3] << 24) | (bd->bi_enetaddr[2] << 16)
|
||||
| (bd->bi_enetaddr[1] << 8) | (bd->bi_enetaddr[0]);
|
||||
p_mac->EMAC_SA2H = (bd->bi_enetaddr[5] << 8) | (bd->bi_enetaddr[4]);
|
||||
|
||||
p_mac->EMAC_RBQP = (long) (&rbfdt[0]);
|
||||
p_mac->EMAC_RSR &= ~(AT91C_EMAC_RSR_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA);
|
||||
|
||||
p_mac->EMAC_CFG = (p_mac->EMAC_CFG | AT91C_EMAC_CAF | AT91C_EMAC_NBC)
|
||||
& ~AT91C_EMAC_CLK;
|
||||
|
||||
#ifdef CONFIG_AT91C_USE_RMII
|
||||
p_mac->EMAC_CFG |= AT91C_EMAC_RMII;
|
||||
#endif
|
||||
|
||||
p_mac->EMAC_CTL |= AT91C_EMAC_TE | AT91C_EMAC_RE;
|
||||
|
||||
at91rm92000_GetPhyInterface ();
|
||||
|
||||
if (!pPhyOps->IsPhyConnected (p_mac))
|
||||
@@ -416,22 +439,6 @@ int eth_init (bd_t * bd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
p_mac->EMAC_SA2L = (bd->bi_enetaddr[3] << 24) | (bd->bi_enetaddr[2] << 16)
|
||||
| (bd->bi_enetaddr[1] << 8) | (bd->bi_enetaddr[0]);
|
||||
p_mac->EMAC_SA2H = (bd->bi_enetaddr[5] << 8) | (bd->bi_enetaddr[4]);
|
||||
|
||||
p_mac->EMAC_RBQP = (long) (&rbfdt[0]);
|
||||
p_mac->EMAC_RSR &= ~(AT91C_EMAC_RSR_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA);
|
||||
|
||||
p_mac->EMAC_CFG = (p_mac->EMAC_CFG | AT91C_EMAC_CAF | AT91C_EMAC_NBC)
|
||||
& ~AT91C_EMAC_CLK;
|
||||
|
||||
#ifdef CONFIG_AT91C_USE_RMII
|
||||
p_mac->EMAC_CFG |= AT91C_EMAC_RMII;
|
||||
#endif
|
||||
|
||||
p_mac->EMAC_CTL |= AT91C_EMAC_TE | AT91C_EMAC_RE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# 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
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(CPU).a
|
||||
|
||||
START = start.o
|
||||
OBJS = cpu.o interrupts.o
|
||||
|
||||
all: .depend $(START) $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c) $(AOBJS:.o=.S)
|
||||
$(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) $(AOBJS:.o=.S) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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
|
||||
*/
|
||||
|
||||
/* EMPTY FILE */
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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
|
||||
*/
|
||||
|
||||
void enable_interrupts(void)
|
||||
{
|
||||
}
|
||||
|
||||
int disable_interrupts(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 <config.h>
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
|
||||
addi r1, r0, CFG_SDRAM_BASE /* init stack pointer */
|
||||
addi r1, r1, CFG_SDRAM_SIZE /* set sp to high up */
|
||||
|
||||
brai board_init
|
||||
|
||||
1: bri 1b
|
||||
+64
-22
@@ -238,7 +238,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
|
||||
const uint8 phyAddr = CONFIG_PHY_ADDR; /* Only one PHY */
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf ("mpc5xxx_fec_init... Begin\n");
|
||||
@@ -250,17 +249,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
mpc5xxx_fec_rbd_init(fec);
|
||||
mpc5xxx_fec_tbd_init(fec);
|
||||
|
||||
/*
|
||||
* Initialize GPIO pins
|
||||
*/
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/* 10MBit with 7-wire operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
|
||||
} else {
|
||||
/* 100MBit with MD operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear FEC-Lite interrupt event register(IEVENT)
|
||||
*/
|
||||
@@ -371,6 +359,68 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
*(int *)FEC_TBD_NEXT = (int)fec->tbdBase;
|
||||
*(int *)FEC_RBD_NEXT = (int)fec->rbdBase;
|
||||
|
||||
/*
|
||||
* Enable FEC-Lite controller
|
||||
*/
|
||||
fec->eth->ecntrl |= 0x00000006;
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
if (fec->xcv_type != SEVENWIRE)
|
||||
mpc5xxx_fec_phydump ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable SmartDMA receive task
|
||||
*/
|
||||
SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf("mpc5xxx_fec_init... Done \n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
|
||||
const uint8 phyAddr = CONFIG_PHY_ADDR; /* Only one PHY */
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf ("mpc5xxx_fec_init_phy... Begin\n");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize GPIO pins
|
||||
*/
|
||||
if (fec->xcv_type == SEVENWIRE) {
|
||||
/* 10MBit with 7-wire operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
|
||||
} else {
|
||||
/* 100MBit with MD operation */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear FEC-Lite interrupt event register(IEVENT)
|
||||
*/
|
||||
fec->eth->ievent = 0xffffffff;
|
||||
|
||||
/*
|
||||
* Set interrupt mask register
|
||||
*/
|
||||
fec->eth->imask = 0x00000000;
|
||||
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
/*
|
||||
* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
|
||||
* and do not drop the Preamble.
|
||||
*/
|
||||
fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
|
||||
}
|
||||
|
||||
if (fec->xcv_type != SEVENWIRE) {
|
||||
/*
|
||||
* Initialize PHY(LXT971A):
|
||||
@@ -486,23 +536,14 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable FEC-Lite controller
|
||||
*/
|
||||
fec->eth->ecntrl |= 0x00000006;
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
if (fec->xcv_type != SEVENWIRE)
|
||||
mpc5xxx_fec_phydump ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable SmartDMA receive task
|
||||
*/
|
||||
SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
|
||||
|
||||
#if (DEBUG & 0x1)
|
||||
printf("mpc5xxx_fec_init... Done \n");
|
||||
printf("mpc5xxx_fec_init_phy... Done \n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
@@ -859,6 +900,7 @@ int mpc5xxx_fec_initialize(bd_t * bis)
|
||||
mpc5xxx_fec_set_hwaddr(fec, env_enetaddr);
|
||||
}
|
||||
|
||||
mpc5xxx_fec_init_phy(dev, bis);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+8
-12
@@ -103,6 +103,9 @@ boot_cold:
|
||||
boot_warm:
|
||||
mfmsr r5 /* save msr contents */
|
||||
|
||||
/* Move CSBoot and adjust instruction pointer */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
#if defined(CFG_LOWBOOT)
|
||||
#if defined(CFG_RAMBOOT)
|
||||
#error CFG_LOWBOOT is incompatible with CFG_RAMBOOT
|
||||
@@ -113,19 +116,15 @@ boot_warm:
|
||||
stw r3, 0x4(r4) /* CS0 start */
|
||||
lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
|
||||
ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
|
||||
|
||||
stw r3, 0x8(r4) /* CS0 stop */
|
||||
lis r3, 0x00047800@h
|
||||
ori r3, r3, 0x00047800@l
|
||||
stw r3, 0x300(r4) /* set timing, CS0/boot conf reg */
|
||||
lis r3, 0x02010000@h
|
||||
ori r3, r3, 0x02010000@l
|
||||
stw r3, 0x54(r4) /* CS0 and Boot enable, IPBI ctrl reg */
|
||||
stw r3, 0x54(r4) /* CS0 and Boot enable */
|
||||
|
||||
lis r3, lowboot_reentry@h
|
||||
ori r3, r3, lowboot_reentry@l
|
||||
lis r3, lowboot_reentry@h /* jump from bootlow address space (0x0000xxxx) */
|
||||
ori r3, r3, lowboot_reentry@l /* to the address space the linker used */
|
||||
mtlr r3
|
||||
blr /* jump to flash based address */
|
||||
blr
|
||||
|
||||
lowboot_reentry:
|
||||
lis r3, START_REG(CFG_BOOTCS_START)@h
|
||||
@@ -134,12 +133,9 @@ lowboot_reentry:
|
||||
lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
|
||||
ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
|
||||
stw r3, 0x50(r4) /* Boot stop */
|
||||
lis r3, 0x00047800@h
|
||||
ori r3, r3, 0x00047800@l
|
||||
stw r3, 0x300(r4) /* set timing, CS0/boot conf reg */
|
||||
lis r3, 0x02000001@h
|
||||
ori r3, r3, 0x02000001@l
|
||||
stw r3, 0x54(r4) /* Boot enable, CS0 disable, wait state enable */
|
||||
stw r3, 0x54(r4) /* Boot enable, CS0 disable */
|
||||
#endif /* CFG_LOWBOOT */
|
||||
|
||||
#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
|
||||
|
||||
+2
-2
@@ -291,8 +291,8 @@ void pci_mpc8250_init (struct pci_controller *hose)
|
||||
immap->im_memctl.memc_pcibr0 = PCI_MSTR0_LOCAL | PCIBR_ENABLE;
|
||||
|
||||
#ifdef CONFIG_MPC8266ADS
|
||||
immap->im_memctl.memc_pcimsk0 = PCIMSK1_MASK;
|
||||
immap->im_memctl.memc_pcibr0 = PCI_MSTR1_LOCAL | PCIBR_ENABLE;
|
||||
immap->im_memctl.memc_pcimsk1 = PCIMSK1_MASK;
|
||||
immap->im_memctl.memc_pcibr1 = PCI_MSTR1_LOCAL | PCIBR_ENABLE;
|
||||
#endif
|
||||
|
||||
/* Release PCI RST (by default the PCI RST signal is held low) */
|
||||
|
||||
+106
-23
@@ -49,9 +49,12 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length);
|
||||
static int tsec_recv(struct eth_device* dev);
|
||||
static int tsec_init(struct eth_device* dev, bd_t * bd);
|
||||
static void tsec_halt(struct eth_device* dev);
|
||||
static void init_registers(volatile tsec_t *regs);
|
||||
static void startup_tsec(volatile tsec_t *regs);
|
||||
static void init_phy(volatile tsec_t *regs);
|
||||
static void init_registers(tsec_t *regs);
|
||||
static void startup_tsec(tsec_t *regs);
|
||||
static void init_phy(tsec_t *regs);
|
||||
uint read_phy_reg(tsec_t *regbase, uint phyid, uint offset);
|
||||
|
||||
static int phy_id = -1;
|
||||
|
||||
/* Initialize device structure. returns 0 on failure, 1 on
|
||||
* success */
|
||||
@@ -59,6 +62,7 @@ int tsec_initialize(bd_t *bis)
|
||||
{
|
||||
struct eth_device* dev;
|
||||
int i;
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
dev = (struct eth_device*) malloc(sizeof *dev);
|
||||
|
||||
@@ -67,7 +71,7 @@ int tsec_initialize(bd_t *bis)
|
||||
|
||||
memset(dev, 0, sizeof *dev);
|
||||
|
||||
sprintf(dev->name, "MOTOROLA ETHERNET");
|
||||
sprintf(dev->name, "MOTO ETHERNET");
|
||||
dev->iobase = 0;
|
||||
dev->priv = 0;
|
||||
dev->init = tsec_init;
|
||||
@@ -81,6 +85,45 @@ int tsec_initialize(bd_t *bis)
|
||||
|
||||
eth_register(dev);
|
||||
|
||||
/* Reconfigure the PHY to advertise everything here
|
||||
* so that it works with both gigabit and 10/100 */
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
/* Assign a Physical address to the TBI */
|
||||
regs->tbipa=TBIPA_VALUE;
|
||||
|
||||
/* reset the management interface */
|
||||
regs->miimcfg=MIIMCFG_RESET;
|
||||
|
||||
regs->miimcfg=MIIMCFG_INIT_VALUE;
|
||||
|
||||
/* Wait until the bus is free */
|
||||
while(regs->miimind & MIIMIND_BUSY);
|
||||
|
||||
/* Locate PHYs. Skip TBIPA, which we know is 31.
|
||||
*/
|
||||
for (i=0; i<31; i++) {
|
||||
if (read_phy_reg(regs, i, 2) == 0x141) {
|
||||
if (phy_id == -1)
|
||||
phy_id = i;
|
||||
#ifdef TSEC_DEBUG
|
||||
printf("Found Marvell PHY at 0x%02x\n", i);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef TSEC_DEBUG
|
||||
printf("Using PHY ID 0x%02x\n", phy_id);
|
||||
#endif
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_RESET);
|
||||
|
||||
RESET_ERRATA(regs, phy_id);
|
||||
|
||||
/* Configure the PHY to advertise gbit and 10/100 */
|
||||
write_phy_reg(regs, phy_id, MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT);
|
||||
write_phy_reg(regs, phy_id, MIIM_ANAR, MIIM_ANAR_INIT);
|
||||
|
||||
/* Reset the PHY so the new settings take effect */
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_RESET);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -89,12 +132,12 @@ int tsec_initialize(bd_t *bis)
|
||||
* and brings the interface up */
|
||||
int tsec_init(struct eth_device* dev, bd_t * bd)
|
||||
{
|
||||
volatile tsec_t *regs;
|
||||
tsec_t *regs;
|
||||
uint tempval;
|
||||
char tmpbuf[MAC_ADDR_LEN];
|
||||
int i;
|
||||
|
||||
regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
/* Make sure the controller is stopped */
|
||||
tsec_halt(dev);
|
||||
@@ -146,7 +189,7 @@ int tsec_init(struct eth_device* dev, bd_t * bd)
|
||||
/* and then passes those bits on to the variable specified in */
|
||||
/* value */
|
||||
/* Before it does the read, it needs to clear the command field */
|
||||
uint read_phy_reg(volatile tsec_t *regbase, uint phyid, uint offset)
|
||||
uint read_phy_reg(tsec_t *regbase, uint phyid, uint offset)
|
||||
{
|
||||
uint value;
|
||||
|
||||
@@ -173,7 +216,7 @@ uint read_phy_reg(volatile tsec_t *regbase, uint phyid, uint offset)
|
||||
}
|
||||
|
||||
/* Setup the PHY */
|
||||
static void init_phy(volatile tsec_t *regs)
|
||||
static void init_phy(tsec_t *regs)
|
||||
{
|
||||
uint testval;
|
||||
unsigned int timeout = TSEC_TIMEOUT;
|
||||
@@ -198,17 +241,17 @@ static void init_phy(volatile tsec_t *regs)
|
||||
#endif
|
||||
|
||||
/* Set the PHY to gigabit, full duplex, Auto-negotiate */
|
||||
write_phy_reg(regs, 0, MIIM_CONTROL, MIIM_CONTROL_INIT);
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_INIT);
|
||||
|
||||
/* Wait until TBI_STATUS indicates AN is done */
|
||||
/* Wait until STATUS indicates Auto-Negotiation is done */
|
||||
DBGPRINT("Waiting for Auto-negotiation to complete\n");
|
||||
testval=read_phy_reg(regs, 0, MIIM_TBI_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_STATUS);
|
||||
|
||||
while((!(testval & MIIM_TBI_STATUS_AN_DONE))&& timeout--) {
|
||||
testval=read_phy_reg(regs, 0, MIIM_TBI_STATUS);
|
||||
while((!(testval & MIIM_STATUS_AN_DONE))&& timeout--) {
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_STATUS);
|
||||
}
|
||||
|
||||
if(testval & MIIM_TBI_STATUS_AN_DONE)
|
||||
if(testval & MIIM_STATUS_AN_DONE)
|
||||
DBGPRINT("Auto-negotiation done\n");
|
||||
else
|
||||
DBGPRINT("Auto-negotiation timed-out.\n");
|
||||
@@ -216,7 +259,7 @@ static void init_phy(volatile tsec_t *regs)
|
||||
#ifdef CONFIG_PHY_CIS8201
|
||||
/* Find out what duplexity (duplicity?) we have */
|
||||
/* Read it twice to make sure */
|
||||
testval=read_phy_reg(regs, 0, MIIM_AUX_CONSTAT);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_AUX_CONSTAT);
|
||||
|
||||
if(testval & MIIM_AUXCONSTAT_DUPLEX) {
|
||||
DBGPRINT("Enet starting in full duplex\n");
|
||||
@@ -246,17 +289,17 @@ static void init_phy(volatile tsec_t *regs)
|
||||
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
/* Read the PHY to see what speed and duplex we are */
|
||||
testval=read_phy_reg(regs, 0, MIIM_PHY_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_PHY_STATUS);
|
||||
|
||||
timeout = TSEC_TIMEOUT;
|
||||
while((!(testval & MIIM_PHYSTAT_SPDDONE)) && timeout--) {
|
||||
testval = read_phy_reg(regs,0,MIIM_PHY_STATUS);
|
||||
testval = read_phy_reg(regs,phy_id,MIIM_PHY_STATUS);
|
||||
}
|
||||
|
||||
if(!(testval & MIIM_PHYSTAT_SPDDONE))
|
||||
DBGPRINT("Enet: Speed not resolved\n");
|
||||
|
||||
testval=read_phy_reg(regs, 0, MIIM_PHY_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_PHY_STATUS);
|
||||
if(testval & MIIM_PHYSTAT_DUPLEX) {
|
||||
DBGPRINT("Enet starting in Full Duplex\n");
|
||||
regs->maccfg2 |= MACCFG2_FULL_DUPLEX;
|
||||
@@ -280,7 +323,7 @@ static void init_phy(volatile tsec_t *regs)
|
||||
}
|
||||
|
||||
|
||||
static void init_registers(volatile tsec_t *regs)
|
||||
static void init_registers(tsec_t *regs)
|
||||
{
|
||||
/* Clear IEVENT */
|
||||
regs->ievent = IEVENT_INIT_CLEAR;
|
||||
@@ -322,7 +365,7 @@ static void init_registers(volatile tsec_t *regs)
|
||||
|
||||
}
|
||||
|
||||
static void startup_tsec(volatile tsec_t *regs)
|
||||
static void startup_tsec(tsec_t *regs)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -363,7 +406,7 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
{
|
||||
int i;
|
||||
int result = 0;
|
||||
volatile tsec_t * regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t * regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
/* Find an empty buffer descriptor */
|
||||
for(i=0; rtx.txbd[txIdx].status & TXBD_READY; i++) {
|
||||
@@ -397,7 +440,7 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
static int tsec_recv(struct eth_device* dev)
|
||||
{
|
||||
int length;
|
||||
volatile tsec_t *regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
while(!(rtx.rxbd[rxIdx].status & RXBD_EMPTY)) {
|
||||
|
||||
@@ -428,7 +471,7 @@ static int tsec_recv(struct eth_device* dev)
|
||||
|
||||
static void tsec_halt(struct eth_device* dev)
|
||||
{
|
||||
volatile tsec_t *regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
regs->dmactrl &= ~(DMACTRL_GRS | DMACTRL_GTS);
|
||||
regs->dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);
|
||||
@@ -438,4 +481,44 @@ static void tsec_halt(struct eth_device* dev)
|
||||
regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
|
||||
|
||||
}
|
||||
|
||||
#ifndef CONFIG_BITBANGMII
|
||||
/*
|
||||
* Read a MII PHY register.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success
|
||||
*/
|
||||
int miiphy_read(unsigned char addr,
|
||||
unsigned char reg,
|
||||
unsigned short *value)
|
||||
{
|
||||
tsec_t *regs;
|
||||
unsigned short rv;
|
||||
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
rv = (unsigned short)read_phy_reg(regs, addr, reg);
|
||||
*value = rv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a MII PHY register.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success
|
||||
*/
|
||||
int miiphy_write(unsigned char addr,
|
||||
unsigned char reg,
|
||||
unsigned short value)
|
||||
{
|
||||
tsec_t *regs;
|
||||
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
write_phy_reg(regs, addr, reg, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BITBANGMII */
|
||||
#endif /* CONFIG_TSEC_ENET */
|
||||
+21
-9
@@ -19,6 +19,9 @@
|
||||
#include <net.h>
|
||||
#include <mpc85xx.h>
|
||||
|
||||
/* TSEC1 is offset 0x24000, TSEC2 is offset 0x25000
|
||||
#define TSEC_BASE_ADDR (CFG_IMMR + 0x25000)
|
||||
*/
|
||||
#define TSEC_BASE_ADDR (CFG_IMMR + 0x24000)
|
||||
#define TSEC_MEM_SIZE 0x01000
|
||||
|
||||
@@ -56,16 +59,16 @@
|
||||
#define MIIMIND_BUSY 0x00000001
|
||||
#define MIIMIND_NOTVALID 0x00000004
|
||||
|
||||
#define MIIM_TBICON 0x11
|
||||
#define MIIM_TBICON_GMII 0x00000010
|
||||
#define MIIM_TBICON_AN 0x00000100
|
||||
|
||||
#define MIIM_CONTROL 0x00
|
||||
#define MIIM_CONTROL_INIT 0x00001140
|
||||
#define MIIM_ANEN 0x00001000
|
||||
#define MIIM_CONTROL_RESET 0x00009140
|
||||
|
||||
#define MIIM_TBI_STATUS 0x1
|
||||
#define MIIM_TBI_STATUS_AN_DONE 0x00000020
|
||||
#define MIIM_STATUS 0x1
|
||||
#define MIIM_STATUS_AN_DONE 0x00000020
|
||||
|
||||
#define MIIM_GBIT_CONTROL 0x9
|
||||
#define MIIM_GBIT_CONTROL_INIT 0xe00
|
||||
|
||||
#define MIIM_TBI_ANEX 0x6
|
||||
#define MIIM_TBI_ANEX_NP 0x00000004
|
||||
@@ -89,11 +92,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
#define MIIM_ANAR 0x04
|
||||
#define MIIM_ANAR_ADVERTISEMENT 0x01e1
|
||||
#define MIIM_ANAR 0x4
|
||||
#define MIIM_ANAR_INIT 0x1e1
|
||||
|
||||
#define MIIM_GBIT_CON 0x09
|
||||
#define MIIM_GBIT_CON_ADVERT 0x1e00
|
||||
#define MIIM_GBIT_CON_ADVERT 0x0e00
|
||||
|
||||
#define MIIM_PHY_STATUS 0x11
|
||||
#define MIIM_PHYSTAT_SPEED 0xc000
|
||||
@@ -130,6 +133,15 @@
|
||||
} while(0)
|
||||
|
||||
|
||||
/* This works around errata in reseting the PHY */
|
||||
#define RESET_ERRATA(regs, ID) do { \
|
||||
write_phy_reg(regs, (ID), 0x1d, 0x1f); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x200c); \
|
||||
write_phy_reg(regs, (ID), 0x1d, 0x5); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x0); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x100); \
|
||||
} while(0)
|
||||
|
||||
#define IEVENT_INIT_CLEAR 0xffffffff
|
||||
#define IEVENT_BABR 0x80000000
|
||||
#define IEVENT_RXC 0x40000000
|
||||
|
||||
@@ -567,6 +567,17 @@ void reset_8xx_watchdog (volatile immap_t * immr)
|
||||
immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
|
||||
immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
|
||||
|
||||
immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
|
||||
# elif defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
|
||||
/*
|
||||
* The KUP4 boards uses a TPS3705 Watchdog
|
||||
* with the trigger pin connected to port PA.5
|
||||
*/
|
||||
# define WATCHDOG_BIT 0x0400
|
||||
immr->im_ioport.iop_papar &= ~(WATCHDOG_BIT); /* GPIO */
|
||||
immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
|
||||
immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
|
||||
|
||||
immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
|
||||
# else
|
||||
/*
|
||||
|
||||
+4
-3
@@ -689,13 +689,14 @@ static int fec_init (struct eth_device *dev, bd_t * bd)
|
||||
* wait for the PHY to wake up after reset
|
||||
*/
|
||||
efis->actual_phy_addr = mii_discover_phy (dev);
|
||||
#else
|
||||
efis->actual_phy_addr = -1;
|
||||
#endif
|
||||
|
||||
if (efis->actual_phy_addr == -1) {
|
||||
printf ("Unable to discover phy!\n");
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
efis->actual_phy_addr = -1;
|
||||
#endif
|
||||
} else {
|
||||
efis->actual_phy_addr = efis->phy_addr;
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@
|
||||
|
||||
#define TX_BUF_CNT 2
|
||||
|
||||
#define TOUT_LOOP 100
|
||||
#define TOUT_LOOP 10000 /* 10 ms to have a packet sent */
|
||||
|
||||
static char txbuf[DBUF_LENGTH];
|
||||
|
||||
|
||||
@@ -347,4 +347,32 @@ static long init_pll_866 (long clk)
|
||||
|
||||
#endif /* CONFIG_MPC866_et_al */
|
||||
|
||||
#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M)
|
||||
/*
|
||||
* Adjust sdram refresh rate to actual CPU clock
|
||||
* and set timebase source according to actual CPU clock
|
||||
*/
|
||||
int adjust_sdram_tbs_8xx (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
long mamr;
|
||||
long sccr;
|
||||
|
||||
mamr = immr->im_memctl.memc_mamr;
|
||||
mamr &= ~MAMR_PTA_MSK;
|
||||
mamr |= ((gd->cpu_clk / CFG_PTA_PER_CLK) << MAMR_PTA_SHIFT);
|
||||
immr->im_memctl.memc_mamr = mamr;
|
||||
|
||||
if (gd->cpu_clk < 67000000) {
|
||||
sccr = immr->im_clkrst.car_sccr;
|
||||
sccr |= SCCR_TBS;
|
||||
immr->im_clkrst.car_sccr = sccr;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_TQM8xxL/M, !TQM866M */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -179,7 +179,7 @@ int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
int vec;
|
||||
|
||||
printf ("\nInterrupt-Information:\n");
|
||||
printf ("Nr Routine Arg CouIt's ok to cnt\n");
|
||||
printf ("Nr Routine Arg Count\n");
|
||||
|
||||
for (vec=0; vec<64; vec++) {
|
||||
if (irq_vecs[vec].handler != NULL) {
|
||||
|
||||
+63
-16
@@ -26,6 +26,48 @@
|
||||
#include <watchdog.h>
|
||||
#include <nios-io.h>
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* JTAG acts as the serial port
|
||||
*-----------------------------------------------------------------*/
|
||||
#if defined(CONFIG_CONSOLE_JTAG)
|
||||
|
||||
static nios_jtag_t *jtag = (nios_jtag_t *)CFG_NIOS_CONSOLE;
|
||||
|
||||
void serial_setbrg( void ){ return; }
|
||||
int serial_init( void ) { return(0);}
|
||||
|
||||
void serial_putc (char c)
|
||||
{
|
||||
while ((jtag->txcntl & NIOS_JTAG_TRDY) != 0)
|
||||
WATCHDOG_RESET ();
|
||||
jtag->txcntl = NIOS_JTAG_TRDY | (unsigned char)c;
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s != 0)
|
||||
serial_putc (*s++);
|
||||
}
|
||||
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return (jtag->rxcntl & NIOS_JTAG_RRDY);
|
||||
}
|
||||
|
||||
int serial_getc (void)
|
||||
{
|
||||
int c;
|
||||
while (serial_tstc() == 0)
|
||||
WATCHDOG_RESET ();
|
||||
c = jtag->rxcntl & 0x0ff;
|
||||
jtag->rxcntl = 0;
|
||||
return (c);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
* UART the serial port
|
||||
*-----------------------------------------------------------------*/
|
||||
#else
|
||||
|
||||
static nios_uart_t *uart = (nios_uart_t *)CFG_NIOS_CONSOLE;
|
||||
|
||||
@@ -34,12 +76,12 @@ static nios_uart_t *uart = (nios_uart_t *)CFG_NIOS_CONSOLE;
|
||||
/* Everything's already setup for fixed-baud PTF
|
||||
* assignment
|
||||
*/
|
||||
void serial_setbrg( void ){ return; }
|
||||
int serial_init( void ) { return(0);}
|
||||
void serial_setbrg (void){ return; }
|
||||
int serial_init (void) { return (0);}
|
||||
|
||||
#else
|
||||
|
||||
void serial_setbrg( void )
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
unsigned div;
|
||||
@@ -49,39 +91,44 @@ void serial_setbrg( void )
|
||||
return;
|
||||
}
|
||||
|
||||
int serial_init( void )
|
||||
int serial_init (void)
|
||||
{
|
||||
serial_setbrg();
|
||||
return(0);
|
||||
serial_setbrg ();
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif /* CFG_NIOS_FIXEDBAUD */
|
||||
|
||||
|
||||
void serial_putc( char c )
|
||||
/*-----------------------------------------------------------------------
|
||||
* UART CONSOLE
|
||||
*---------------------------------------------------------------------*/
|
||||
void serial_putc (char c)
|
||||
{
|
||||
if (c == '\n')
|
||||
serial_putc('\r');
|
||||
while( (uart->status & NIOS_UART_TRDY) == 0 )
|
||||
serial_putc ('\r');
|
||||
while ((uart->status & NIOS_UART_TRDY) == 0)
|
||||
WATCHDOG_RESET ();
|
||||
uart->txdata = (unsigned char)c;
|
||||
}
|
||||
|
||||
void serial_puts( const char *s )
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while( *s != 0 ) {
|
||||
serial_putc( *s++ );
|
||||
while (*s != 0) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int serial_tstc( void )
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return( uart->status & NIOS_UART_RRDY);
|
||||
return (uart->status & NIOS_UART_RRDY);
|
||||
}
|
||||
|
||||
int serial_getc( void )
|
||||
int serial_getc (void)
|
||||
{
|
||||
while( serial_tstc() == 0 )
|
||||
while (serial_tstc () == 0)
|
||||
WATCHDOG_RESET ();
|
||||
return( uart->rxdata & 0x00ff );
|
||||
}
|
||||
|
||||
#endif /* CONFIG_JTAG_CONSOLE */
|
||||
@@ -93,6 +93,14 @@ _start:
|
||||
subi %g6, 4 /* %g6 <- src addr */
|
||||
ld %g7, [%g7] /* %g7 <- dst addr */
|
||||
|
||||
/* No need to move text sections if we're already located
|
||||
* at the proper address.
|
||||
*/
|
||||
cmp %g7, %g6
|
||||
ifs cc_z
|
||||
br reloc
|
||||
nop /* delay slot */
|
||||
|
||||
1: cmp %g7, %g5
|
||||
skps cc_nz
|
||||
br 2f
|
||||
@@ -114,6 +122,7 @@ _start:
|
||||
pfx %xhi(reloc@h)
|
||||
movhi %g0, %xlo(reloc@h)
|
||||
jmp %g0
|
||||
nop /* delay slot */
|
||||
reloc:
|
||||
|
||||
/*
|
||||
@@ -140,6 +149,48 @@ reloc:
|
||||
nop /* delay slot */
|
||||
4:
|
||||
|
||||
/*
|
||||
* INIT VECTOR TABLE
|
||||
*/
|
||||
pfx %hi(CFG_VECT_BASE)
|
||||
movi %g0, %lo(CFG_VECT_BASE)
|
||||
pfx %xhi(CFG_VECT_BASE)
|
||||
movhi %g0, %xlo(CFG_VECT_BASE) /* dst */
|
||||
mov %l0, %g0
|
||||
|
||||
pfx %hi(_vectors)
|
||||
movi %g1, %lo(_vectors)
|
||||
pfx %xhi(_vectors)
|
||||
movhi %g1, %xlo(_vectors) /* src */
|
||||
bgen %g2, 6 /* cnt = 64 */
|
||||
|
||||
ldp %g3, [%l0, 3] /* bkpt vector */
|
||||
ldp %g4, [%l0, 4] /* single step vector */
|
||||
|
||||
5: ld %g7, [%g1]
|
||||
addi %g1, 4 /* src++ */
|
||||
st [%g0], %g7
|
||||
addi %g0, 4 /* dst++ */
|
||||
|
||||
subi %g2, 1 /* cnt-- */
|
||||
ifrnz %g2
|
||||
br 5b
|
||||
nop /* delay slot */
|
||||
|
||||
#if defined(CONFIG_ROM_STUBS)
|
||||
/* Restore the breakpoint and single step exception
|
||||
* vectors to their original values.
|
||||
*/
|
||||
stp [%l0,3], %g3 /* breakpoint */
|
||||
stp [%l0,4], %g4 /* single step */
|
||||
#endif
|
||||
|
||||
/* For debug startup convenience ... software breakpoints
|
||||
* set prior to this point may not succeed ;-)
|
||||
*/
|
||||
.global __start
|
||||
__start:
|
||||
|
||||
/*
|
||||
* Call board_init -- never returns
|
||||
*/
|
||||
|
||||
@@ -557,3 +557,26 @@ _timebase_int:
|
||||
mov %fp, %sp
|
||||
|
||||
tret %o7 /* Done */
|
||||
|
||||
/*************************************************************************
|
||||
* GDB stubs
|
||||
************************************************************************/
|
||||
.text
|
||||
.global _brkpt_hw_int, _brkpt_sw_int
|
||||
.align 4
|
||||
|
||||
_brkpt_hw_int:
|
||||
movi %l1, 9
|
||||
pfx 3
|
||||
wrctl %l1
|
||||
pfx 4
|
||||
wrctl %l1
|
||||
|
||||
_brkpt_sw_int:
|
||||
movi %l1, 9
|
||||
pfx 3
|
||||
wrctl %l1
|
||||
pfx 4
|
||||
wrctl %l1
|
||||
|
||||
tret %o7
|
||||
+19
-3
@@ -437,6 +437,22 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
*/
|
||||
if ( ((devnum == 2) || (devnum ==3)) && (4 == ethgroup) ) {
|
||||
miiphy_write (reg, 23, 0x1200);
|
||||
/*
|
||||
* Vitesse VSC8201/Cicada CIS8201 errata:
|
||||
* Interoperability problem with Intel 82547EI phys
|
||||
* This work around (provided by Vitesse) changes
|
||||
* the default timer convergence from 8ms to 12ms
|
||||
*/
|
||||
miiphy_write (reg, 0x1f, 0x2a30);
|
||||
miiphy_write (reg, 0x08, 0x0200);
|
||||
miiphy_write (reg, 0x1f, 0x52b5);
|
||||
miiphy_write (reg, 0x02, 0x0004);
|
||||
miiphy_write (reg, 0x01, 0x0671);
|
||||
miiphy_write (reg, 0x00, 0x8fae);
|
||||
miiphy_write (reg, 0x1f, 0x2a30);
|
||||
miiphy_write (reg, 0x08, 0x0000);
|
||||
miiphy_write (reg, 0x1f, 0x0000);
|
||||
/* end Vitesse/Cicada errata */
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -917,7 +933,7 @@ int enetInt (struct eth_device *dev)
|
||||
mtdcr (uic0sr, UIC_MTE);
|
||||
}
|
||||
/* handle MAL RX EOB interupt from a receive */
|
||||
/* check for EOB on valid channels */
|
||||
/* check for EOB on valid channels */
|
||||
if (my_uic0msr & UIC_MRE) {
|
||||
mal_rx_eob = mfdcr (malrxeobisr);
|
||||
if ((mal_rx_eob & (0x80000000 >> hw_p->devnum)) != 0) { /* call emac routine for channel x */
|
||||
@@ -1033,9 +1049,9 @@ static void enet_rcv (struct eth_device *dev, unsigned long malisr)
|
||||
MAX_ERR_LOG)
|
||||
hw_p->rx_err_index =
|
||||
0;
|
||||
} /* emac_erros */
|
||||
} /* emac_erros */
|
||||
} /* data_len < max mtu */
|
||||
} /* if data_len */
|
||||
} /* if data_len */
|
||||
if (!data_len) { /* no data */
|
||||
hw_p->rx[i].ctrl |= MAL_RX_CTRL_EMPTY; /* Free Recv Buffer */
|
||||
|
||||
|
||||
+6
-3
@@ -1,9 +1,12 @@
|
||||
---------------------------------------------------------------------------
|
||||
Build target Flash address | BDI "go" command | Reset Vector
|
||||
---------------------------------------------------------------------------
|
||||
MPC5200LITE 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
MPC5200LITE_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
MPC5200LITE_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
Lite5200 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
Lite5200_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
Lite5200_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
icecube_5200_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
icecube_5200_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
icecube_5200_DDR_LOWBOOT 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
|
||||
+109
-9
@@ -55,6 +55,12 @@ sources (when altera silicon is not involved). This isn't really
|
||||
a problem as little, if any, of the Altera source contains
|
||||
features that are not already available in U-Boot.
|
||||
|
||||
1.3 Debugging via OCI
|
||||
---------------------
|
||||
The Nios port supports debugging with gdb and/or nios-console
|
||||
via the JTAG port. Stubs for debugging with gdb via the serial
|
||||
port are not currently implemented.
|
||||
|
||||
|
||||
2. CONFIGURATION OPTIONS/SETTINGS
|
||||
----------------------------------
|
||||
@@ -79,7 +85,11 @@ description).
|
||||
|
||||
CONFIG_NIOS -- defined for all Nios-32 boards.
|
||||
|
||||
CFG_NIOS_CONSOLE -- the base address of the console UART.
|
||||
CFG_NIOS_CONSOLE -- the base address of the console UART or the JTAG
|
||||
stdio port. To enable a console via JTAG, define
|
||||
CONFIG_CONSOLE_JTAG and set CGF_NIOS_CONSOLE to the base address
|
||||
of the JTAG stdio port (normally OCI base + 0x00fa). Then
|
||||
run nios-console with the -w option.
|
||||
(standard-32: nasys_uart_0 resp. na_uart1_base).
|
||||
|
||||
CFG_NIOS_FIXEDBAUD -- defined if the console UART PTF fixed_baud
|
||||
@@ -176,20 +186,109 @@ GERMS monitor (that is, avoid running code stored in flash memory):
|
||||
3. Release CFG_NIOS_CPU_BUTTON_PIO, button number 0.
|
||||
|
||||
|
||||
5. BRAIN DAMAGE
|
||||
5. DEBUGGING WITH GDB
|
||||
---------------------
|
||||
|
||||
Debug sessions using gdb are currently supported only via JTAG. The
|
||||
stubs for debugging via a serial port are not implemented. To enable
|
||||
the gdb JTAG stubs, simply reference _brkpt_hw_int and _brkpt_sw_int
|
||||
at vector table offsets 3 and 4, respectively. For an example, see
|
||||
board/altera/dk1c20/vectors.S.
|
||||
|
||||
5.1 Vector Table Initialization and ROM Stubs
|
||||
---------------------------------------------
|
||||
If CONFIG_ROM_STUBS is defined, the debug breakpoint and single step
|
||||
entries in the vector table are restored to their initial values
|
||||
immediately _after_ initializing the vector table. Defining this macro
|
||||
is useful when ROM-based stubs are implemented.
|
||||
|
||||
NOTE: The default GERMS monitor does NOT implement gdb stubs, nor does
|
||||
it initialize the vector table. Therefore, when debugging U-Boot, you
|
||||
should NOT set a software breakpoint prior to vector table initialization.
|
||||
|
||||
5.2 Starting a Debug Session
|
||||
----------------------------
|
||||
If you're not familiar with gdb, you follow these step-by-step instructions.
|
||||
These instructions are NOT the only way to start a debug session, but they
|
||||
cover most of the individual functions to get you started.
|
||||
|
||||
1. Start the JTAG gdb server. Open a Nios shell window and start
|
||||
the server. When the server is started you must provide the base
|
||||
address of the OCI core. For example, when using the Cyclone
|
||||
development kit (DK1C20):
|
||||
|
||||
$ nios-gdb-server --ocibase=0x00920800 --tcpport=2342
|
||||
|
||||
2. Start gdb. Open a Nios shell window, change to the top-level
|
||||
U-Boot directory and start gdb, specifying the u-boot elf file:
|
||||
|
||||
$ nios-elf-gdb u-boot
|
||||
|
||||
3. Update target settings. From the file menu, select
|
||||
"Target Settings ..." and select the following, then click 'Ok':
|
||||
|
||||
Target: Remote/TCP
|
||||
Port : 2342 (same as in step 1)
|
||||
Display download dialog: checked
|
||||
All other check boxes: unchecked
|
||||
|
||||
4. Connect to the target. Select menu: 'Run->Connect to target'.
|
||||
You should see a dialog box indicating the you successfully connected
|
||||
to the target.
|
||||
|
||||
5. Download U-Boot. Select menu: 'Run->Download'.
|
||||
|
||||
6. Open a gdb console window and set the source directory paths.
|
||||
Select menu: 'View->Console'. In the console window, enter the
|
||||
following commands, then close the console window:
|
||||
|
||||
(gdb) directory common
|
||||
(gdb) directory cpu/nios
|
||||
(gdb) directory lib_nios
|
||||
(gdb) directory board/altera/dk1c20
|
||||
|
||||
Note that the last command is for the DK1C20 board only. If you
|
||||
are using another board, specify that board's directory.
|
||||
|
||||
7. Open the file board.c (using the file menu in the lower
|
||||
left hand corner). Scroll to the board_init() routine and set
|
||||
a breakpoint.
|
||||
|
||||
8. Run U-Boot. Just click on the run icon, or select menu:
|
||||
'Run->Run'. U-Boot should start running, then break at your
|
||||
breakpoint.
|
||||
|
||||
9. Have fun & start learning more about gdb.
|
||||
|
||||
|
||||
5.3 For advanced Users
|
||||
----------------------
|
||||
A few notes for those more familiar with gdb.
|
||||
|
||||
-Serial port stubs are not implemented. Sorry, but it's just not
|
||||
worth _my_ effort. The JTAG stubs work great and are ridiculously
|
||||
simple to implement.
|
||||
|
||||
-If you need to debug the early startup code (prior to the vector
|
||||
table initialization), use the nios-console debugger.
|
||||
|
||||
- Connect, download & run -- there are some problems here. Connect
|
||||
download and run seperately to avoid trouble.
|
||||
|
||||
6. BRAIN DAMAGE
|
||||
----------------
|
||||
|
||||
This section describes some of the unfortunate and avoidable aspects
|
||||
of working with the Nios CPU ... and some things you can do to
|
||||
reduce your pain.
|
||||
|
||||
5.1 GERMS doesn't work with Hyperterminal
|
||||
6.1 GERMS doesn't work with Hyperterminal
|
||||
------------------------------------------
|
||||
GERMS doesn't do CR/LF mapping that is compatible with Hyperterminal
|
||||
(or minicom) -- geez. Regardless of you opion of Hyperterminal, this
|
||||
sad design decision is remedied by using U-Boot.
|
||||
|
||||
5.2 cygwin Incompatibility
|
||||
6.2 cygwin Incompatibility
|
||||
---------------------------
|
||||
The version of cygwin distributed with the nios GNUPro toolchain is
|
||||
out-of-date and incompatible with the latest cygwin distributions.
|
||||
@@ -202,7 +301,7 @@ topic).
|
||||
The solution ... well, you can wait for Altera ... or build as
|
||||
set of tools for linux.
|
||||
|
||||
5.3 No native gcc
|
||||
6.3 No native gcc
|
||||
------------------
|
||||
I'm not sure how this one slipped through the cracks ... but it is
|
||||
a real pain. Basically, if you want to build anything for the native
|
||||
@@ -215,7 +314,7 @@ distro. Anybody who wants to use an already precompiled NIOS cross
|
||||
toolchain can it found in the CDK4NIOS project hosted by Source
|
||||
Forge at http://cdk4nios.sourceforge.net.
|
||||
|
||||
5.4 Can't build default U-Boot
|
||||
6.4 Can't build default U-Boot
|
||||
-------------------------------
|
||||
By default, when you build U-Boot you will be building some native
|
||||
tools along with the target elf, bin, and srec files. Without a
|
||||
@@ -232,15 +331,16 @@ environment.o: environment.c ../tools/envcrc
|
||||
-c -o $@ environment.c
|
||||
|
||||
With:
|
||||
environment.o: environment.c ../tools/envcrc
|
||||
environment.o: environment.c
|
||||
$(CC) $(AFLAGS) -Wa,--no-warn \
|
||||
-DENV_CRC=0 \
|
||||
-c -o $@ environment.c
|
||||
|
||||
BTW, thats a 'zero' ... not the letter 'O'.
|
||||
BTW, thats a 'zero' ... not the letter 'O'. And not that the
|
||||
"../tools/envcrc" dependency is removed.
|
||||
|
||||
|
||||
6. HELP WANTED
|
||||
7. HELP WANTED
|
||||
---------------
|
||||
|
||||
There are plenty of areas where help is needed. Here's are some ideas
|
||||
|
||||
+3
-2
@@ -37,9 +37,10 @@ OBJS = 3c589.o 5701rls.o ali512x.o \
|
||||
pci.o pci_auto.o pci_indirect.o \
|
||||
pcnet.o plb2800_eth.o \
|
||||
ps2ser.o ps2mult.o pc_keyb.o keyboard.o \
|
||||
rtl8019.o rtl8139.o \
|
||||
rtl8019.o rtl8139.o rtl8169.o \
|
||||
s3c24x0_i2c.o sed13806.o sed156x.o \
|
||||
serial.o serial_max3100.o serial_pl011.o serial_pl010.o \
|
||||
serial.o serial_max3100.o serial_pl010.o serial_pl011.o \
|
||||
serial_xuartlite.o sl811_usb.o \
|
||||
smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \
|
||||
ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \
|
||||
usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o \
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ static int ns8382x_poll(struct eth_device *dev);
|
||||
static void ns8382x_disable(struct eth_device *dev);
|
||||
|
||||
static struct pci_device_id supported[] = {
|
||||
{PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_8382x},
|
||||
{PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83820},
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -103,14 +103,14 @@ int pci_hose_write_config_##size##_via_dword(struct pci_controller *hose,\
|
||||
pci_dev_t dev, \
|
||||
int offset, type val) \
|
||||
{ \
|
||||
u32 val32, mask, ldata; \
|
||||
u32 val32, mask, ldata, shift; \
|
||||
\
|
||||
if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0)\
|
||||
return -1; \
|
||||
\
|
||||
mask = val_mask; \
|
||||
ldata = (((unsigned long)val) & mask) << ((offset & (int)off_mask) * 8);\
|
||||
mask <<= ((mask & (int)off_mask) * 8); \
|
||||
shift = ((offset & (int)off_mask) * 8); \
|
||||
ldata = (((unsigned long)val) & val_mask) << shift; \
|
||||
mask = val_mask << shift; \
|
||||
val32 = (val32 & ~mask) | ldata; \
|
||||
\
|
||||
if (pci_hose_write_config_dword(hose, dev, offset & 0xfc, val32) < 0)\
|
||||
|
||||
@@ -0,0 +1,888 @@
|
||||
/*
|
||||
* rtl8169.c : U-Boot driver for the RealTek RTL8169
|
||||
*
|
||||
* Masami Komiya (mkomiya@sonare.it)
|
||||
*
|
||||
* Most part is taken from r8169.c of etherboot
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
* r8169.c: Etherboot device driver for the RealTek RTL-8169 Gigabit
|
||||
* Written 2003 by Timothy Legge <tlegge@rogers.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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* Portions of this code based on:
|
||||
* r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver
|
||||
* for Linux kernel 2.4.x.
|
||||
*
|
||||
* Written 2002 ShuChen <shuchen@realtek.com.tw>
|
||||
* See Linux Driver for full information
|
||||
*
|
||||
* Linux Driver Version 1.27a, 10.02.2002
|
||||
*
|
||||
* Thanks to:
|
||||
* Jean Chen of RealTek Semiconductor Corp. for
|
||||
* providing the evaluation NIC used to develop
|
||||
* this driver. RealTek's support for Etherboot
|
||||
* is appreciated.
|
||||
*
|
||||
* REVISION HISTORY:
|
||||
* ================
|
||||
*
|
||||
* v1.0 11-26-2003 timlegge Initial port of Linux driver
|
||||
* v1.5 01-17-2004 timlegge Initial driver output cleanup
|
||||
*
|
||||
* Indent Options: indent -kr -i8
|
||||
***************************************************************************/
|
||||
|
||||
#include <common.h>
|
||||
#include <malloc.h>
|
||||
#include <net.h>
|
||||
#include <asm/io.h>
|
||||
#include <pci.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
|
||||
defined(CONFIG_RTL8169)
|
||||
|
||||
#undef DEBUG_RTL8169
|
||||
#undef DEBUG_RTL8169_TX
|
||||
#undef DEBUG_RTL8169_RX
|
||||
|
||||
#define drv_version "v1.5"
|
||||
#define drv_date "01-17-2004"
|
||||
|
||||
static u32 ioaddr;
|
||||
|
||||
/* Condensed operations for readability. */
|
||||
#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
|
||||
#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
|
||||
|
||||
#define currticks() get_timer(0)
|
||||
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a)
|
||||
#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
|
||||
|
||||
/* media options */
|
||||
#define MAX_UNITS 8
|
||||
static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
|
||||
/* MAC address length*/
|
||||
#define MAC_ADDR_LEN 6
|
||||
|
||||
/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
|
||||
#define TX_FIFO_THRESH 256 /* In bytes */
|
||||
|
||||
#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
|
||||
#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
|
||||
#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
|
||||
#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */
|
||||
#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */
|
||||
#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
|
||||
|
||||
#define NUM_TX_DESC 1 /* Number of Tx descriptor registers */
|
||||
#define NUM_RX_DESC 4 /* Number of Rx descriptor registers */
|
||||
#define RX_BUF_SIZE 1536 /* Rx Buffer size */
|
||||
#define RX_BUF_LEN 8192
|
||||
|
||||
#define RTL_MIN_IO_SIZE 0x80
|
||||
#define TX_TIMEOUT (6*HZ)
|
||||
|
||||
/* write/read MMIO register */
|
||||
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
|
||||
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
|
||||
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
|
||||
#define RTL_R8(reg) readb (ioaddr + (reg))
|
||||
#define RTL_R16(reg) readw (ioaddr + (reg))
|
||||
#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
|
||||
|
||||
#define ETH_FRAME_LEN MAX_ETH_FRAME_SIZE
|
||||
#define ETH_ALEN MAC_ADDR_LEN
|
||||
#define ETH_ZLEN 60
|
||||
|
||||
enum RTL8169_registers {
|
||||
MAC0 = 0, /* Ethernet hardware address. */
|
||||
MAR0 = 8, /* Multicast filter. */
|
||||
TxDescStartAddr = 0x20,
|
||||
TxHDescStartAddr = 0x28,
|
||||
FLASH = 0x30,
|
||||
ERSR = 0x36,
|
||||
ChipCmd = 0x37,
|
||||
TxPoll = 0x38,
|
||||
IntrMask = 0x3C,
|
||||
IntrStatus = 0x3E,
|
||||
TxConfig = 0x40,
|
||||
RxConfig = 0x44,
|
||||
RxMissed = 0x4C,
|
||||
Cfg9346 = 0x50,
|
||||
Config0 = 0x51,
|
||||
Config1 = 0x52,
|
||||
Config2 = 0x53,
|
||||
Config3 = 0x54,
|
||||
Config4 = 0x55,
|
||||
Config5 = 0x56,
|
||||
MultiIntr = 0x5C,
|
||||
PHYAR = 0x60,
|
||||
TBICSR = 0x64,
|
||||
TBI_ANAR = 0x68,
|
||||
TBI_LPAR = 0x6A,
|
||||
PHYstatus = 0x6C,
|
||||
RxMaxSize = 0xDA,
|
||||
CPlusCmd = 0xE0,
|
||||
RxDescStartAddr = 0xE4,
|
||||
EarlyTxThres = 0xEC,
|
||||
FuncEvent = 0xF0,
|
||||
FuncEventMask = 0xF4,
|
||||
FuncPresetState = 0xF8,
|
||||
FuncForceEvent = 0xFC,
|
||||
};
|
||||
|
||||
enum RTL8169_register_content {
|
||||
/*InterruptStatusBits */
|
||||
SYSErr = 0x8000,
|
||||
PCSTimeout = 0x4000,
|
||||
SWInt = 0x0100,
|
||||
TxDescUnavail = 0x80,
|
||||
RxFIFOOver = 0x40,
|
||||
RxUnderrun = 0x20,
|
||||
RxOverflow = 0x10,
|
||||
TxErr = 0x08,
|
||||
TxOK = 0x04,
|
||||
RxErr = 0x02,
|
||||
RxOK = 0x01,
|
||||
|
||||
/*RxStatusDesc */
|
||||
RxRES = 0x00200000,
|
||||
RxCRC = 0x00080000,
|
||||
RxRUNT = 0x00100000,
|
||||
RxRWT = 0x00400000,
|
||||
|
||||
/*ChipCmdBits */
|
||||
CmdReset = 0x10,
|
||||
CmdRxEnb = 0x08,
|
||||
CmdTxEnb = 0x04,
|
||||
RxBufEmpty = 0x01,
|
||||
|
||||
/*Cfg9346Bits */
|
||||
Cfg9346_Lock = 0x00,
|
||||
Cfg9346_Unlock = 0xC0,
|
||||
|
||||
/*rx_mode_bits */
|
||||
AcceptErr = 0x20,
|
||||
AcceptRunt = 0x10,
|
||||
AcceptBroadcast = 0x08,
|
||||
AcceptMulticast = 0x04,
|
||||
AcceptMyPhys = 0x02,
|
||||
AcceptAllPhys = 0x01,
|
||||
|
||||
/*RxConfigBits */
|
||||
RxCfgFIFOShift = 13,
|
||||
RxCfgDMAShift = 8,
|
||||
|
||||
/*TxConfigBits */
|
||||
TxInterFrameGapShift = 24,
|
||||
TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */
|
||||
|
||||
/*rtl8169_PHYstatus */
|
||||
TBI_Enable = 0x80,
|
||||
TxFlowCtrl = 0x40,
|
||||
RxFlowCtrl = 0x20,
|
||||
_1000bpsF = 0x10,
|
||||
_100bps = 0x08,
|
||||
_10bps = 0x04,
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
/*GIGABIT_PHY_registers */
|
||||
PHY_CTRL_REG = 0,
|
||||
PHY_STAT_REG = 1,
|
||||
PHY_AUTO_NEGO_REG = 4,
|
||||
PHY_1000_CTRL_REG = 9,
|
||||
|
||||
/*GIGABIT_PHY_REG_BIT */
|
||||
PHY_Restart_Auto_Nego = 0x0200,
|
||||
PHY_Enable_Auto_Nego = 0x1000,
|
||||
|
||||
/* PHY_STAT_REG = 1; */
|
||||
PHY_Auto_Neco_Comp = 0x0020,
|
||||
|
||||
/* PHY_AUTO_NEGO_REG = 4; */
|
||||
PHY_Cap_10_Half = 0x0020,
|
||||
PHY_Cap_10_Full = 0x0040,
|
||||
PHY_Cap_100_Half = 0x0080,
|
||||
PHY_Cap_100_Full = 0x0100,
|
||||
|
||||
/* PHY_1000_CTRL_REG = 9; */
|
||||
PHY_Cap_1000_Full = 0x0200,
|
||||
|
||||
PHY_Cap_Null = 0x0,
|
||||
|
||||
/*_MediaType*/
|
||||
_10_Half = 0x01,
|
||||
_10_Full = 0x02,
|
||||
_100_Half = 0x04,
|
||||
_100_Full = 0x08,
|
||||
_1000_Full = 0x10,
|
||||
|
||||
/*_TBICSRBit*/
|
||||
TBILinkOK = 0x02000000,
|
||||
};
|
||||
|
||||
static struct {
|
||||
const char *name;
|
||||
u8 version; /* depend on RTL8169 docs */
|
||||
u32 RxConfigMask; /* should clear the bits supported by this chip */
|
||||
} rtl_chip_info[] = {
|
||||
{"RTL-8169", 0x00, 0xff7e1880,},
|
||||
{"RTL-8169", 0x04, 0xff7e1880,},
|
||||
};
|
||||
|
||||
enum _DescStatusBit {
|
||||
OWNbit = 0x80000000,
|
||||
EORbit = 0x40000000,
|
||||
FSbit = 0x20000000,
|
||||
LSbit = 0x10000000,
|
||||
};
|
||||
|
||||
struct TxDesc {
|
||||
u32 status;
|
||||
u32 vlan_tag;
|
||||
u32 buf_addr;
|
||||
u32 buf_Haddr;
|
||||
};
|
||||
|
||||
struct RxDesc {
|
||||
u32 status;
|
||||
u32 vlan_tag;
|
||||
u32 buf_addr;
|
||||
u32 buf_Haddr;
|
||||
};
|
||||
|
||||
/* Define the TX Descriptor */
|
||||
static u8 tx_ring[NUM_TX_DESC * sizeof(struct TxDesc) + 256];
|
||||
/* __attribute__ ((aligned(256))); */
|
||||
|
||||
/* Create a static buffer of size RX_BUF_SZ for each
|
||||
TX Descriptor. All descriptors point to a
|
||||
part of this buffer */
|
||||
static unsigned char txb[NUM_TX_DESC * RX_BUF_SIZE];
|
||||
|
||||
/* Define the RX Descriptor */
|
||||
static u8 rx_ring[NUM_RX_DESC * sizeof(struct TxDesc) + 256];
|
||||
/* __attribute__ ((aligned(256))); */
|
||||
|
||||
/* Create a static buffer of size RX_BUF_SZ for each
|
||||
RX Descriptor All descriptors point to a
|
||||
part of this buffer */
|
||||
static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
|
||||
|
||||
struct rtl8169_private {
|
||||
void *mmio_addr; /* memory map physical address */
|
||||
int chipset;
|
||||
unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
|
||||
unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
|
||||
unsigned long dirty_tx;
|
||||
unsigned char *TxDescArrays; /* Index of Tx Descriptor buffer */
|
||||
unsigned char *RxDescArrays; /* Index of Rx Descriptor buffer */
|
||||
struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
|
||||
struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
|
||||
unsigned char *RxBufferRings; /* Index of Rx Buffer */
|
||||
unsigned char *RxBufferRing[NUM_RX_DESC]; /* Index of Rx Buffer array */
|
||||
unsigned char *Tx_skbuff[NUM_TX_DESC];
|
||||
} tpx;
|
||||
|
||||
static struct rtl8169_private *tpc;
|
||||
|
||||
static const u16 rtl8169_intr_mask =
|
||||
SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr |
|
||||
TxOK | RxErr | RxOK;
|
||||
static const unsigned int rtl8169_rx_config =
|
||||
(RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
|
||||
|
||||
static struct pci_device_id supported[] = {
|
||||
{PCI_VENDOR_ID_REALTEK, 0x8169},
|
||||
{}
|
||||
};
|
||||
|
||||
void mdio_write(int RegAddr, int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
|
||||
udelay(1000);
|
||||
|
||||
for (i = 2000; i > 0; i--) {
|
||||
/* Check if the RTL8169 has completed writing to the specified MII register */
|
||||
if (!(RTL_R32(PHYAR) & 0x80000000)) {
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mdio_read(int RegAddr)
|
||||
{
|
||||
int i, value = -1;
|
||||
|
||||
RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
|
||||
udelay(1000);
|
||||
|
||||
for (i = 2000; i > 0; i--) {
|
||||
/* Check if the RTL8169 has completed retrieving data from the specified MII register */
|
||||
if (RTL_R32(PHYAR) & 0x80000000) {
|
||||
value = (int) (RTL_R32(PHYAR) & 0xFFFF);
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
static int rtl8169_init_board(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
u32 tmp;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* Soft reset the chip. */
|
||||
RTL_W8(ChipCmd, CmdReset);
|
||||
|
||||
/* Check that the chip has finished the reset. */
|
||||
for (i = 1000; i > 0; i--)
|
||||
if ((RTL_R8(ChipCmd) & CmdReset) == 0)
|
||||
break;
|
||||
else
|
||||
udelay(10);
|
||||
|
||||
/* identify chip attached to board */
|
||||
tmp = RTL_R32(TxConfig);
|
||||
tmp = ((tmp & 0x7c000000) + ((tmp & 0x00800000) << 2)) >> 24;
|
||||
|
||||
for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--){
|
||||
if (tmp == rtl_chip_info[i].version) {
|
||||
tpc->chipset = i;
|
||||
goto match;
|
||||
}
|
||||
}
|
||||
|
||||
/* if unknown chip, assume array element #0, original RTL-8169 in this case */
|
||||
printf("PCI device %s: unknown chip version, assuming RTL-8169\n", dev->name);
|
||||
printf("PCI device: TxConfig = 0x%hX\n", (unsigned long) RTL_R32(TxConfig));
|
||||
tpc->chipset = 0;
|
||||
|
||||
match:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
RECV - Receive a frame
|
||||
***************************************************************************/
|
||||
static int rtl_recv(struct eth_device *dev)
|
||||
{
|
||||
/* return true if there's an ethernet packet ready to read */
|
||||
/* nic->packet should contain data on return */
|
||||
/* nic->packetlen should contain length of data */
|
||||
int cur_rx;
|
||||
int length = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169_RX
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
cur_rx = tpc->cur_rx;
|
||||
if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
|
||||
if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
|
||||
unsigned char rxdata[RX_BUF_LEN];
|
||||
length = (int) (tpc->RxDescArray[cur_rx].
|
||||
status & 0x00001FFF) - 4;
|
||||
|
||||
memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);
|
||||
NetReceive(rxdata, length);
|
||||
|
||||
if (cur_rx == NUM_RX_DESC - 1)
|
||||
tpc->RxDescArray[cur_rx].status =
|
||||
(OWNbit | EORbit) + RX_BUF_SIZE;
|
||||
else
|
||||
tpc->RxDescArray[cur_rx].status =
|
||||
OWNbit + RX_BUF_SIZE;
|
||||
tpc->RxDescArray[cur_rx].buf_addr =
|
||||
virt_to_bus(tpc->RxBufferRing[cur_rx]);
|
||||
} else {
|
||||
puts("Error Rx");
|
||||
}
|
||||
cur_rx = (cur_rx + 1) % NUM_RX_DESC;
|
||||
tpc->cur_rx = cur_rx;
|
||||
return 1;
|
||||
|
||||
}
|
||||
tpc->cur_rx = cur_rx;
|
||||
return (0); /* initially as this is called to flush the input */
|
||||
}
|
||||
|
||||
#define HZ 1000
|
||||
/**************************************************************************
|
||||
SEND - Transmit a frame
|
||||
***************************************************************************/
|
||||
static int rtl_send(struct eth_device *dev, volatile void *packet, int length)
|
||||
{
|
||||
/* send the packet to destination */
|
||||
|
||||
u32 to;
|
||||
u8 *ptxb;
|
||||
int entry = tpc->cur_tx % NUM_TX_DESC;
|
||||
u32 len = length;
|
||||
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
printf("sending %d bytes\n", len);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* point to the current txb incase multiple tx_rings are used */
|
||||
ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];
|
||||
memcpy(ptxb, (char *)packet, (int)length);
|
||||
|
||||
while (len < ETH_ZLEN)
|
||||
ptxb[len++] = '\0';
|
||||
|
||||
tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
|
||||
if (entry != (NUM_TX_DESC - 1)) {
|
||||
tpc->TxDescArray[entry].status =
|
||||
(OWNbit | FSbit | LSbit) | ((len > ETH_ZLEN) ?
|
||||
len : ETH_ZLEN);
|
||||
} else {
|
||||
tpc->TxDescArray[entry].status =
|
||||
(OWNbit | EORbit | FSbit | LSbit) |
|
||||
((len > ETH_ZLEN) ? length : ETH_ZLEN);
|
||||
}
|
||||
RTL_W8(TxPoll, 0x40); /* set polling bit */
|
||||
|
||||
tpc->cur_tx++;
|
||||
to = currticks() + TX_TIMEOUT;
|
||||
while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
|
||||
|
||||
if (currticks() >= to) {
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
puts ("tx timeout/error\n");
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
puts("tx done\n");
|
||||
#endif
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtl8169_set_rx_mode(struct eth_device *dev)
|
||||
{
|
||||
u32 mc_filter[2]; /* Multicast hash filter */
|
||||
int rx_mode;
|
||||
u32 tmp = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
/* IFF_ALLMULTI */
|
||||
/* Too many to filter perfectly -- accept all multicasts. */
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0xffffffff;
|
||||
|
||||
tmp = rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) &
|
||||
rtl_chip_info[tpc->chipset].RxConfigMask);
|
||||
|
||||
RTL_W32(RxConfig, tmp);
|
||||
RTL_W32(MAR0 + 0, mc_filter[0]);
|
||||
RTL_W32(MAR0 + 4, mc_filter[1]);
|
||||
}
|
||||
|
||||
static void rtl8169_hw_start(struct eth_device *dev)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Soft reset the chip. */
|
||||
RTL_W8(ChipCmd, CmdReset);
|
||||
|
||||
/* Check that the chip has finished the reset. */
|
||||
for (i = 1000; i > 0; i--) {
|
||||
if ((RTL_R8(ChipCmd) & CmdReset) == 0)
|
||||
break;
|
||||
else
|
||||
udelay(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
RTL_W8(Cfg9346, Cfg9346_Unlock);
|
||||
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
|
||||
RTL_W8(EarlyTxThres, EarlyTxThld);
|
||||
|
||||
/* For gigabit rtl8169 */
|
||||
RTL_W16(RxMaxSize, RxPacketMaxSize);
|
||||
|
||||
/* Set Rx Config register */
|
||||
i = rtl8169_rx_config | (RTL_R32(RxConfig) &
|
||||
rtl_chip_info[tpc->chipset].RxConfigMask);
|
||||
RTL_W32(RxConfig, i);
|
||||
|
||||
/* Set DMA burst size and Interframe Gap Time */
|
||||
RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) |
|
||||
(InterFrameGap << TxInterFrameGapShift));
|
||||
|
||||
|
||||
tpc->cur_rx = 0;
|
||||
|
||||
RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray));
|
||||
RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray));
|
||||
RTL_W8(Cfg9346, Cfg9346_Lock);
|
||||
udelay(10);
|
||||
|
||||
RTL_W32(RxMissed, 0);
|
||||
|
||||
rtl8169_set_rx_mode(dev);
|
||||
|
||||
/* no early-rx interrupts */
|
||||
RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000);
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rtl8169_init_ring(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
tpc->cur_rx = 0;
|
||||
tpc->cur_tx = 0;
|
||||
tpc->dirty_tx = 0;
|
||||
memset(tpc->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc));
|
||||
memset(tpc->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc));
|
||||
|
||||
for (i = 0; i < NUM_TX_DESC; i++) {
|
||||
tpc->Tx_skbuff[i] = &txb[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
||||
if (i == (NUM_RX_DESC - 1))
|
||||
tpc->RxDescArray[i].status =
|
||||
(OWNbit | EORbit) + RX_BUF_SIZE;
|
||||
else
|
||||
tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
|
||||
|
||||
tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
|
||||
tpc->RxDescArray[i].buf_addr =
|
||||
virt_to_bus(tpc->RxBufferRing[i]);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
RESET - Finish setting up the ethernet interface
|
||||
***************************************************************************/
|
||||
static void rtl_reset(struct eth_device *dev, bd_t *bis)
|
||||
{
|
||||
int i;
|
||||
u8 diff;
|
||||
u32 TxPhyAddr, RxPhyAddr;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
tpc->TxDescArrays = tx_ring;
|
||||
if (tpc->TxDescArrays == 0)
|
||||
puts("Allot Error");
|
||||
/* Tx Desscriptor needs 256 bytes alignment; */
|
||||
TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
|
||||
diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
|
||||
TxPhyAddr += diff;
|
||||
tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
|
||||
|
||||
tpc->RxDescArrays = rx_ring;
|
||||
/* Rx Desscriptor needs 256 bytes alignment; */
|
||||
RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
|
||||
diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
|
||||
RxPhyAddr += diff;
|
||||
tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
|
||||
|
||||
if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
|
||||
puts("Allocate RxDescArray or TxDescArray failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rtl8169_init_ring(dev);
|
||||
rtl8169_hw_start(dev);
|
||||
/* Construct a perfect filter frame with the mac address as first match
|
||||
* and broadcast for all others */
|
||||
for (i = 0; i < 192; i++)
|
||||
txb[i] = 0xFF;
|
||||
|
||||
txb[0] = dev->enetaddr[0];
|
||||
txb[1] = dev->enetaddr[1];
|
||||
txb[2] = dev->enetaddr[2];
|
||||
txb[3] = dev->enetaddr[3];
|
||||
txb[4] = dev->enetaddr[4];
|
||||
txb[5] = dev->enetaddr[5];
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
HALT - Turn off ethernet interface
|
||||
***************************************************************************/
|
||||
static void rtl_halt(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8(ChipCmd, 0x00);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16(IntrMask, 0x0000);
|
||||
|
||||
RTL_W32(RxMissed, 0);
|
||||
|
||||
tpc->TxDescArrays = NULL;
|
||||
tpc->RxDescArrays = NULL;
|
||||
tpc->TxDescArray = NULL;
|
||||
tpc->RxDescArray = NULL;
|
||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
||||
tpc->RxBufferRing[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
INIT - Look for an adapter, this routine's visible to the outside
|
||||
***************************************************************************/
|
||||
|
||||
#define board_found 1
|
||||
#define valid_link 0
|
||||
static int rtl_init(struct eth_device *dev, bd_t *bis)
|
||||
{
|
||||
static int board_idx = -1;
|
||||
static int printed_version = 0;
|
||||
int i, rc;
|
||||
int option = -1, Cap10_100 = 0, Cap1000 = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
board_idx++;
|
||||
|
||||
printed_version = 1;
|
||||
|
||||
/* point to private storage */
|
||||
tpc = &tpx;
|
||||
|
||||
rc = rtl8169_init_board(dev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
/* Get MAC address. FIXME: read EEPROM */
|
||||
for (i = 0; i < MAC_ADDR_LEN; i++)
|
||||
dev->enetaddr[i] = RTL_R8(MAC0 + i);
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("MAC Address");
|
||||
for (i = 0; i < MAC_ADDR_LEN; i++)
|
||||
printf(":%02x", dev->enetaddr[i]);
|
||||
putc('\n');
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
/* Print out some hardware info */
|
||||
printf("%s: at ioaddr 0x%x\n", dev->name, ioaddr);
|
||||
#endif
|
||||
|
||||
/* if TBI is not endbled */
|
||||
if (!(RTL_R8(PHYstatus) & TBI_Enable)) {
|
||||
int val = mdio_read(PHY_AUTO_NEGO_REG);
|
||||
|
||||
option = (board_idx >= MAX_UNITS) ? 0 : media[board_idx];
|
||||
/* Force RTL8169 in 10/100/1000 Full/Half mode. */
|
||||
if (option > 0) {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: Force-mode Enabled.\n", dev->name);
|
||||
#endif
|
||||
Cap10_100 = 0, Cap1000 = 0;
|
||||
switch (option) {
|
||||
case _10_Half:
|
||||
Cap10_100 = PHY_Cap_10_Half;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _10_Full:
|
||||
Cap10_100 = PHY_Cap_10_Full;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _100_Half:
|
||||
Cap10_100 = PHY_Cap_100_Half;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _100_Full:
|
||||
Cap10_100 = PHY_Cap_100_Full;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _1000_Full:
|
||||
Cap10_100 = PHY_Cap_Null;
|
||||
Cap1000 = PHY_Cap_1000_Full;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mdio_write(PHY_AUTO_NEGO_REG, Cap10_100 | (val & 0x1F)); /* leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
|
||||
mdio_write(PHY_1000_CTRL_REG, Cap1000);
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: Auto-negotiation Enabled.\n",
|
||||
dev->name);
|
||||
#endif
|
||||
/* enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
|
||||
mdio_write(PHY_AUTO_NEGO_REG,
|
||||
PHY_Cap_10_Half | PHY_Cap_10_Full |
|
||||
PHY_Cap_100_Half | PHY_Cap_100_Full |
|
||||
(val & 0x1F));
|
||||
|
||||
/* enable 1000 Full Mode */
|
||||
mdio_write(PHY_1000_CTRL_REG, PHY_Cap_1000_Full);
|
||||
|
||||
}
|
||||
|
||||
/* Enable auto-negotiation and restart auto-nigotiation */
|
||||
mdio_write(PHY_CTRL_REG,
|
||||
PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego);
|
||||
udelay(100);
|
||||
|
||||
/* wait for auto-negotiation process */
|
||||
for (i = 10000; i > 0; i--) {
|
||||
/* check if auto-negotiation complete */
|
||||
if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
|
||||
udelay(100);
|
||||
option = RTL_R8(PHYstatus);
|
||||
if (option & _1000bpsF) {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: 1000Mbps Full-duplex operation.\n",
|
||||
dev->name);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf
|
||||
("%s: %sMbps %s-duplex operation.\n",
|
||||
dev->name,
|
||||
(option & _100bps) ? "100" :
|
||||
"10",
|
||||
(option & FullDup) ? "Full" :
|
||||
"Half");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
} /* end for-loop to wait for auto-negotiation process */
|
||||
|
||||
} else {
|
||||
udelay(100);
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf
|
||||
("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
|
||||
dev->name,
|
||||
(RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rtl8169_initialize(bd_t *bis)
|
||||
{
|
||||
pci_dev_t devno;
|
||||
int card_number = 0;
|
||||
struct eth_device *dev;
|
||||
u32 iobase;
|
||||
int idx=0;
|
||||
|
||||
while(1){
|
||||
/* Find RTL8169 */
|
||||
if ((devno = pci_find_devices(supported, idx++)) < 0)
|
||||
break;
|
||||
|
||||
pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase);
|
||||
iobase &= ~0xf;
|
||||
|
||||
debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase);
|
||||
|
||||
dev = (struct eth_device *)malloc(sizeof *dev);
|
||||
|
||||
sprintf (dev->name, "RTL8169#%d", card_number);
|
||||
|
||||
dev->priv = (void *) devno;
|
||||
dev->iobase = (int)bus_to_phys(iobase);
|
||||
|
||||
dev->init = rtl_reset;
|
||||
dev->halt = rtl_halt;
|
||||
dev->send = rtl_send;
|
||||
dev->recv = rtl_recv;
|
||||
|
||||
eth_register (dev);
|
||||
|
||||
rtl_init(dev, bis);
|
||||
|
||||
card_number++;
|
||||
}
|
||||
return card_number;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 <config.h>
|
||||
|
||||
#ifdef CONFIG_MICROBLZE
|
||||
|
||||
#include <asm/serial_xuartlite.h>
|
||||
|
||||
/* FIXME: we should convert these to in32 and out32 */
|
||||
#define IO_WORD(offset) (*(volatile unsigned long *)(offset))
|
||||
#define IO_SERIAL(offset) IO_WORD(CONFIG_SERIAL_BASE + (offset))
|
||||
|
||||
#define IO_SERIAL_RX_FIFO IO_SERIAL(XUL_RX_FIFO_OFFSET)
|
||||
#define IO_SERIAL_TX_FIFO IO_SERIAL(XUL_TX_FIFO_OFFSET)
|
||||
#define IO_SERIAL_STATUS IO_SERIAL(XUL_STATUS_REG_OFFSET)
|
||||
#define IO_SERIAL_CONTROL IO_SERIAL(XUL_CONTROL_REG_OFFSET)
|
||||
|
||||
int serial_init(void)
|
||||
{
|
||||
/* FIXME: Nothing for now. We should initialize fifo, etc */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_setbrg(void)
|
||||
{
|
||||
/* FIXME: what's this for? */
|
||||
}
|
||||
|
||||
void serial_putc(const char c)
|
||||
{
|
||||
if (c == '\n') serial_putc('\r');
|
||||
while (IO_SERIAL_STATUS & XUL_SR_TX_FIFO_FULL);
|
||||
IO_SERIAL_TX_FIFO = (unsigned char) (c & 0xff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_puts(const char * s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc(void)
|
||||
{
|
||||
while (!(IO_SERIAL_STATUS & XUL_SR_RX_FIFO_VALID_DATA));
|
||||
return IO_SERIAL_RX_FIFO & 0xff;
|
||||
}
|
||||
|
||||
int serial_tstc(void)
|
||||
{
|
||||
return (IO_SERIAL_STATUS & XUL_SR_RX_FIFO_VALID_DATA);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MICROBLZE */
|
||||
@@ -494,7 +494,7 @@ static struct proc_dir_entry *pSkRootDir;
|
||||
static struct pci_device_id supported[] = {
|
||||
{PCI_VENDOR_ID_3COM, 0x1700},
|
||||
{PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE},
|
||||
{PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE_SA},
|
||||
{PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU},
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#ifndef __UBOOT_SL811_H
|
||||
#define __UBOOT_SL811_H
|
||||
|
||||
#undef SL811_DEBUG
|
||||
|
||||
#ifdef SL811_DEBUG
|
||||
#define PDEBUG(level, fmt, args...) \
|
||||
if (debug >= (level)) printf("[%s:%d] " fmt, \
|
||||
__PRETTY_FUNCTION__, __LINE__ , ## args)
|
||||
#else
|
||||
#define PDEBUG(level, fmt, args...) do {} while(0)
|
||||
#endif
|
||||
|
||||
/* Sl811 host control register */
|
||||
#define SL811_CTRL_A 0x00
|
||||
#define SL811_ADDR_A 0x01
|
||||
#define SL811_LEN_A 0x02
|
||||
#define SL811_STS_A 0x03 /* read */
|
||||
#define SL811_PIDEP_A 0x03 /* write */
|
||||
#define SL811_CNT_A 0x04 /* read */
|
||||
#define SL811_DEV_A 0x04 /* write */
|
||||
#define SL811_CTRL1 0x05
|
||||
#define SL811_INTR 0x06
|
||||
#define SL811_CTRL_B 0x08
|
||||
#define SL811_ADDR_B 0x09
|
||||
#define SL811_LEN_B 0x0A
|
||||
#define SL811_STS_B 0x0B /* read */
|
||||
#define SL811_PIDEP_B 0x0B /* write */
|
||||
#define SL811_CNT_B 0x0C /* read */
|
||||
#define SL811_DEV_B 0x0C /* write */
|
||||
#define SL811_INTRSTS 0x0D /* write clears bitwise */
|
||||
#define SL811_HWREV 0x0E /* read */
|
||||
#define SL811_SOFLOW 0x0E /* write */
|
||||
#define SL811_SOFCNTDIV 0x0F /* read */
|
||||
#define SL811_CTRL2 0x0F /* write */
|
||||
|
||||
/* USB control register bits (addr 0x00 and addr 0x08) */
|
||||
#define SL811_USB_CTRL_ARM 0x01
|
||||
#define SL811_USB_CTRL_ENABLE 0x02
|
||||
#define SL811_USB_CTRL_DIR_OUT 0x04
|
||||
#define SL811_USB_CTRL_ISO 0x10
|
||||
#define SL811_USB_CTRL_SOF 0x20
|
||||
#define SL811_USB_CTRL_TOGGLE_1 0x40
|
||||
#define SL811_USB_CTRL_PREAMBLE 0x80
|
||||
|
||||
/* USB status register bits (addr 0x03 and addr 0x0B) */
|
||||
#define SL811_USB_STS_ACK 0x01
|
||||
#define SL811_USB_STS_ERROR 0x02
|
||||
#define SL811_USB_STS_TIMEOUT 0x04
|
||||
#define SL811_USB_STS_TOGGLE_1 0x08
|
||||
#define SL811_USB_STS_SETUP 0x10
|
||||
#define SL811_USB_STS_OVERFLOW 0x20
|
||||
#define SL811_USB_STS_NAK 0x40
|
||||
#define SL811_USB_STS_STALL 0x80
|
||||
|
||||
/* Control register 1 bits (addr 0x05) */
|
||||
#define SL811_CTRL1_SOF 0x01
|
||||
#define SL811_CTRL1_RESET 0x08
|
||||
#define SL811_CTRL1_JKSTATE 0x10
|
||||
#define SL811_CTRL1_SPEED_LOW 0x20
|
||||
#define SL811_CTRL1_SUSPEND 0x40
|
||||
|
||||
/* Interrut enable (addr 0x06) and interrupt status register bits (addr 0x0D) */
|
||||
#define SL811_INTR_DONE_A 0x01
|
||||
#define SL811_INTR_DONE_B 0x02
|
||||
#define SL811_INTR_SOF 0x10
|
||||
#define SL811_INTR_INSRMV 0x20
|
||||
#define SL811_INTR_DETECT 0x40
|
||||
#define SL811_INTR_NOTPRESENT 0x40
|
||||
#define SL811_INTR_SPEED_FULL 0x80 /* only in status reg */
|
||||
|
||||
/* HW rev and SOF lo register bits (addr 0x0E) */
|
||||
#define SL811_HWR_HWREV 0xF0
|
||||
|
||||
/* SOF counter and control reg 2 (addr 0x0F) */
|
||||
#define SL811_CTL2_SOFHI 0x3F
|
||||
#define SL811_CTL2_DSWAP 0x40
|
||||
#define SL811_CTL2_HOST 0x80
|
||||
|
||||
/* Set up for 1-ms SOF time. */
|
||||
#define SL811_12M_LOW 0xE0
|
||||
#define SL811_12M_HI 0x2E
|
||||
|
||||
#define SL811_DATA_START 0x10
|
||||
#define SL811_DATA_LIMIT 240
|
||||
|
||||
/* Requests: bRequest << 8 | bmRequestType */
|
||||
#define RH_GET_STATUS 0x0080
|
||||
#define RH_CLEAR_FEATURE 0x0100
|
||||
#define RH_SET_FEATURE 0x0300
|
||||
#define RH_SET_ADDRESS 0x0500
|
||||
#define RH_GET_DESCRIPTOR 0x0680
|
||||
#define RH_SET_DESCRIPTOR 0x0700
|
||||
#define RH_GET_CONFIGURATION 0x0880
|
||||
#define RH_SET_CONFIGURATION 0x0900
|
||||
#define RH_GET_STATE 0x0280
|
||||
#define RH_GET_INTERFACE 0x0A80
|
||||
#define RH_SET_INTERFACE 0x0B00
|
||||
#define RH_SYNC_FRAME 0x0C80
|
||||
|
||||
|
||||
#define PIDEP(pid, ep) (((pid) & 0x0f) << 4 | (ep))
|
||||
|
||||
#endif /* __UBOOT_SL811_H */
|
||||
@@ -0,0 +1,737 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This code is based on linux driver for sl811hs chip, source at
|
||||
* drivers/usb/host/sl811.c:
|
||||
*
|
||||
* SL811 Host Controller Interface driver for USB.
|
||||
*
|
||||
* Copyright (c) 2003/06, Courage Co., Ltd.
|
||||
*
|
||||
* Based on:
|
||||
* 1.uhci.c by Linus Torvalds, Johannes Erdfelt, Randy Dunlap,
|
||||
* Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber,
|
||||
* Adam Richter, Gregory P. Smith;
|
||||
* 2.Original SL811 driver (hc_sl811.o) by Pei Liu <pbl@cypress.com>
|
||||
* 3.Rewrited as sl811.o by Yin Aihua <yinah:couragetech.com.cn>
|
||||
*
|
||||
* 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>
|
||||
#ifdef CONFIG_USB_SL811HS
|
||||
#include <mpc8xx.h>
|
||||
#include <usb.h>
|
||||
#include "sl811.h"
|
||||
|
||||
#include "../board/kup/common/kup.h"
|
||||
|
||||
#ifdef __PPC__
|
||||
# define EIEIO __asm__ volatile ("eieio")
|
||||
#else
|
||||
# define EIEIO /* nothing */
|
||||
#endif
|
||||
|
||||
#define SL811_ADR (0x50000000)
|
||||
#define SL811_DAT (0x50000001)
|
||||
|
||||
#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
|
||||
|
||||
#ifdef SL811_DEBUG
|
||||
static int debug = 9;
|
||||
#endif
|
||||
|
||||
static int root_hub_devnum = 0;
|
||||
static struct usb_port_status rh_status = { 0 };/* root hub port status */
|
||||
|
||||
static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
|
||||
void *data, int buf_len, struct devrequest *cmd);
|
||||
|
||||
static void sl811_write (__u8 index, __u8 data)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
EIEIO;
|
||||
*(volatile unsigned char *) (SL811_DAT) = data;
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
static __u8 sl811_read (__u8 index)
|
||||
{
|
||||
__u8 data;
|
||||
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
EIEIO;
|
||||
data = *(volatile unsigned char *) (SL811_DAT);
|
||||
EIEIO;
|
||||
return (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read consecutive bytes of data from the SL811H/SL11H buffer
|
||||
*/
|
||||
static void inline sl811_read_buf(__u8 offset, __u8 *buf, __u8 size)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = offset;
|
||||
EIEIO;
|
||||
while (size--) {
|
||||
*buf++ = *(volatile unsigned char *) (SL811_DAT);
|
||||
EIEIO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write consecutive bytes of data to the SL811H/SL11H buffer
|
||||
*/
|
||||
static void inline sl811_write_buf(__u8 offset, __u8 *buf, __u8 size)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = offset;
|
||||
EIEIO;
|
||||
while (size--) {
|
||||
*(volatile unsigned char *) (SL811_DAT) = *buf++;
|
||||
EIEIO;
|
||||
}
|
||||
}
|
||||
|
||||
int usb_init_kup4x (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
int i;
|
||||
unsigned char tmp;
|
||||
|
||||
memctl = &immap->im_memctl;
|
||||
memctl->memc_or7 = 0xFFFF8726;
|
||||
memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */
|
||||
/* BP 14 low = USB ON */
|
||||
immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
|
||||
/* PB 14 nomal port */
|
||||
immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
|
||||
/* output */
|
||||
immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
|
||||
|
||||
puts ("USB: ");
|
||||
|
||||
for (i = 0x10; i < 0xff; i++) {
|
||||
sl811_write(i, i);
|
||||
tmp = (sl811_read(i));
|
||||
if (tmp != i) {
|
||||
printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
printf ("SL811 ready\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function resets SL811HS controller and detects the speed of
|
||||
* the connecting device
|
||||
*
|
||||
* Return: 0 = no device attached; 1 = USB device attached
|
||||
*/
|
||||
static int sl811_hc_reset(void)
|
||||
{
|
||||
int status ;
|
||||
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
|
||||
mdelay(20);
|
||||
|
||||
/* Disable hardware SOF generation, clear all irq status. */
|
||||
sl811_write(SL811_CTRL1, 0);
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
status = sl811_read(SL811_INTRSTS);
|
||||
|
||||
if (status & SL811_INTR_NOTPRESENT) {
|
||||
/* Device is not present */
|
||||
PDEBUG(0, "Device not present\n");
|
||||
rh_status.wPortStatus &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE);
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_CONNECTION;
|
||||
sl811_write(SL811_INTR, SL811_INTR_INSRMV);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send SOF to address 0, endpoint 0. */
|
||||
sl811_write(SL811_LEN_B, 0);
|
||||
sl811_write(SL811_PIDEP_B, PIDEP(USB_PID_SOF, 0));
|
||||
sl811_write(SL811_DEV_B, 0x00);
|
||||
sl811_write(SL811_SOFLOW, SL811_12M_LOW);
|
||||
|
||||
if (status & SL811_INTR_SPEED_FULL) {
|
||||
/* full speed device connect directly to root hub */
|
||||
PDEBUG (0, "Full speed Device attached\n");
|
||||
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
mdelay(20);
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_SOF);
|
||||
|
||||
/* start the SOF or EOP */
|
||||
sl811_write(SL811_CTRL_B, SL811_USB_CTRL_ARM);
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_CONNECTION;
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_LOW_SPEED;
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
} else {
|
||||
/* slow speed device connect directly to root-hub */
|
||||
PDEBUG(0, "Low speed Device attached\n");
|
||||
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
mdelay(20);
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_CTL2_DSWAP | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_SPEED_LOW | SL811_CTRL1_SOF);
|
||||
|
||||
/* start the SOF or EOP */
|
||||
sl811_write(SL811_CTRL_B, SL811_USB_CTRL_ARM);
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_CONNECTION | USB_PORT_STAT_LOW_SPEED;
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
}
|
||||
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_CONNECTION;
|
||||
sl811_write(SL811_INTR, /*SL811_INTR_INSRMV*/SL811_INTR_DONE_A);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int usb_lowlevel_init(void)
|
||||
{
|
||||
root_hub_devnum = 0;
|
||||
sl811_hc_reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usb_lowlevel_stop(void)
|
||||
{
|
||||
sl811_hc_reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int calc_needed_buswidth(int bytes, int need_preamble)
|
||||
{
|
||||
return !need_preamble ? bytes * 8 + 256 : 8 * 8 * bytes + 2048;
|
||||
}
|
||||
|
||||
static int sl811_send_packet(struct usb_device *dev, unsigned long pipe, __u8 *buffer, int len)
|
||||
{
|
||||
__u8 ctrl = SL811_USB_CTRL_ARM | SL811_USB_CTRL_ENABLE;
|
||||
__u16 status = 0;
|
||||
int err = 0, time_start = get_timer(0);
|
||||
int need_preamble = !(rh_status.wPortStatus & USB_PORT_STAT_LOW_SPEED) &&
|
||||
usb_pipeslow(pipe);
|
||||
|
||||
if (len > 239)
|
||||
return -1;
|
||||
|
||||
if (usb_pipeout(pipe))
|
||||
ctrl |= SL811_USB_CTRL_DIR_OUT;
|
||||
if (usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe)))
|
||||
ctrl |= SL811_USB_CTRL_TOGGLE_1;
|
||||
if (need_preamble)
|
||||
ctrl |= SL811_USB_CTRL_PREAMBLE;
|
||||
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
|
||||
while (err < 3) {
|
||||
sl811_write(SL811_ADDR_A, 0x10);
|
||||
sl811_write(SL811_LEN_A, len);
|
||||
if (usb_pipeout(pipe) && len)
|
||||
sl811_write_buf(0x10, buffer, len);
|
||||
|
||||
if (!(rh_status.wPortStatus & USB_PORT_STAT_LOW_SPEED) &&
|
||||
sl811_read(SL811_SOFCNTDIV)*64 < calc_needed_buswidth(len, need_preamble))
|
||||
ctrl |= SL811_USB_CTRL_SOF;
|
||||
else
|
||||
ctrl &= ~SL811_USB_CTRL_SOF;
|
||||
|
||||
sl811_write(SL811_CTRL_A, ctrl);
|
||||
while (!(sl811_read(SL811_INTRSTS) & SL811_INTR_DONE_A)) {
|
||||
if (5*CFG_HZ < get_timer(time_start)) {
|
||||
printf("USB transmit timed out\n");
|
||||
return -USB_ST_CRC_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
status = sl811_read(SL811_STS_A);
|
||||
|
||||
if (status & SL811_USB_STS_ACK) {
|
||||
int remainder = sl811_read(SL811_CNT_A);
|
||||
if (remainder) {
|
||||
PDEBUG(0, "usb transfer remainder = %d\n", remainder);
|
||||
len -= remainder;
|
||||
}
|
||||
if (usb_pipein(pipe) && len)
|
||||
sl811_read_buf(0x10, buffer, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
if ((status & SL811_USB_STS_NAK) == SL811_USB_STS_NAK)
|
||||
continue;
|
||||
|
||||
PDEBUG(0, "usb transfer error %#x\n", (int)status);
|
||||
err++;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
|
||||
if (status & SL811_USB_STS_ERROR)
|
||||
err |= USB_ST_BUF_ERR;
|
||||
if (status & SL811_USB_STS_TIMEOUT)
|
||||
err |= USB_ST_CRC_ERR;
|
||||
if (status & SL811_USB_STS_STALL)
|
||||
err |= USB_ST_STALLED;
|
||||
|
||||
return -err;
|
||||
}
|
||||
|
||||
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len)
|
||||
{
|
||||
int dir_out = usb_pipeout(pipe);
|
||||
int ep = usb_pipeendpoint(pipe);
|
||||
int max = usb_maxpacket(dev, pipe);
|
||||
int done = 0;
|
||||
|
||||
PDEBUG(7, "dev = %ld pipe = %ld buf = %p size = %d dir_out = %d\n",
|
||||
usb_pipedevice(pipe), usb_pipeendpoint(pipe), buffer, len, dir_out);
|
||||
|
||||
dev->status = 0;
|
||||
|
||||
sl811_write(SL811_DEV_A, usb_pipedevice(pipe));
|
||||
sl811_write(SL811_PIDEP_A, PIDEP(!dir_out ? USB_PID_IN : USB_PID_OUT, ep));
|
||||
while (done < len) {
|
||||
int res = sl811_send_packet(dev, pipe, (__u8*)buffer+done,
|
||||
max > len - done ? len - done : max);
|
||||
if (res < 0) {
|
||||
dev->status = -res;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!dir_out && res < max) /* short packet */
|
||||
break;
|
||||
|
||||
done += res;
|
||||
usb_dotoggle(dev, ep, dir_out);
|
||||
}
|
||||
|
||||
dev->act_len = done;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len,struct devrequest *setup)
|
||||
{
|
||||
int done = 0;
|
||||
int devnum = usb_pipedevice(pipe);
|
||||
int ep = usb_pipeendpoint(pipe);
|
||||
|
||||
dev->status = 0;
|
||||
|
||||
if (devnum == root_hub_devnum)
|
||||
return sl811_rh_submit_urb(dev, pipe, buffer, len, setup);
|
||||
|
||||
PDEBUG(7, "dev = %d pipe = %ld buf = %p size = %d rt = %#x req = %#x bus = %i\n",
|
||||
devnum, ep, buffer, len, (int)setup->requesttype,
|
||||
(int)setup->request, sl811_read(SL811_SOFCNTDIV)*64);
|
||||
|
||||
sl811_write(SL811_DEV_A, devnum);
|
||||
sl811_write(SL811_PIDEP_A, PIDEP(USB_PID_SETUP, ep));
|
||||
/* setup phase */
|
||||
usb_settoggle(dev, ep, 1, 0);
|
||||
if (sl811_send_packet(dev, usb_sndctrlpipe(dev, ep),
|
||||
(__u8*)setup, sizeof(*setup)) == sizeof(*setup)) {
|
||||
int dir_in = usb_pipein(pipe);
|
||||
int max = usb_maxpacket(dev, pipe);
|
||||
|
||||
/* data phase */
|
||||
sl811_write(SL811_PIDEP_A,
|
||||
PIDEP(dir_in ? USB_PID_IN : USB_PID_OUT, ep));
|
||||
usb_settoggle(dev, ep, usb_pipeout(pipe), 1);
|
||||
while (done < len) {
|
||||
int res = sl811_send_packet(dev, pipe, (__u8*)buffer+done,
|
||||
max > len - done ? len - done : max);
|
||||
if (res < 0) {
|
||||
PDEBUG(0, "status data failed!\n");
|
||||
dev->status = -res;
|
||||
return 0;
|
||||
}
|
||||
done += res;
|
||||
usb_dotoggle(dev, ep, usb_pipeout(pipe));
|
||||
if (dir_in && res < max) /* short packet */
|
||||
break;
|
||||
}
|
||||
|
||||
/* status phase */
|
||||
sl811_write(SL811_PIDEP_A,
|
||||
PIDEP(!dir_in ? USB_PID_IN : USB_PID_OUT, ep));
|
||||
usb_settoggle(dev, ep, !usb_pipeout(pipe), 1);
|
||||
if (sl811_send_packet(dev,
|
||||
!dir_in ? usb_rcvctrlpipe(dev, ep) :
|
||||
usb_sndctrlpipe(dev, ep),
|
||||
0, 0) < 0) {
|
||||
PDEBUG(0, "status phase failed!\n");
|
||||
dev->status = -1;
|
||||
}
|
||||
} else {
|
||||
PDEBUG(0, "setup phase failed!\n");
|
||||
dev->status = -1;
|
||||
}
|
||||
|
||||
dev->act_len = done;
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len, int interval)
|
||||
{
|
||||
PDEBUG(0, "dev = %p pipe = %#lx buf = %p size = %d int = %d\n", dev, pipe,
|
||||
buffer, len, interval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SL811 Virtual Root Hub
|
||||
*/
|
||||
|
||||
/* Device descriptor */
|
||||
static __u8 sl811_rh_dev_des[] =
|
||||
{
|
||||
0x12, /* __u8 bLength; */
|
||||
0x01, /* __u8 bDescriptorType; Device */
|
||||
0x10, /* __u16 bcdUSB; v1.1 */
|
||||
0x01,
|
||||
0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
|
||||
0x00, /* __u8 bDeviceSubClass; */
|
||||
0x00, /* __u8 bDeviceProtocol; */
|
||||
0x08, /* __u8 bMaxPacketSize0; 8 Bytes */
|
||||
0x00, /* __u16 idVendor; */
|
||||
0x00,
|
||||
0x00, /* __u16 idProduct; */
|
||||
0x00,
|
||||
0x00, /* __u16 bcdDevice; */
|
||||
0x00,
|
||||
0x00, /* __u8 iManufacturer; */
|
||||
0x02, /* __u8 iProduct; */
|
||||
0x01, /* __u8 iSerialNumber; */
|
||||
0x01 /* __u8 bNumConfigurations; */
|
||||
};
|
||||
|
||||
/* Configuration descriptor */
|
||||
static __u8 sl811_rh_config_des[] =
|
||||
{
|
||||
0x09, /* __u8 bLength; */
|
||||
0x02, /* __u8 bDescriptorType; Configuration */
|
||||
0x19, /* __u16 wTotalLength; */
|
||||
0x00,
|
||||
0x01, /* __u8 bNumInterfaces; */
|
||||
0x01, /* __u8 bConfigurationValue; */
|
||||
0x00, /* __u8 iConfiguration; */
|
||||
0x40, /* __u8 bmAttributes;
|
||||
Bit 7: Bus-powered, 6: Self-powered, 5 Remote-wakwup,
|
||||
4..0: resvd */
|
||||
0x00, /* __u8 MaxPower; */
|
||||
|
||||
/* interface */
|
||||
0x09, /* __u8 if_bLength; */
|
||||
0x04, /* __u8 if_bDescriptorType; Interface */
|
||||
0x00, /* __u8 if_bInterfaceNumber; */
|
||||
0x00, /* __u8 if_bAlternateSetting; */
|
||||
0x01, /* __u8 if_bNumEndpoints; */
|
||||
0x09, /* __u8 if_bInterfaceClass; HUB_CLASSCODE */
|
||||
0x00, /* __u8 if_bInterfaceSubClass; */
|
||||
0x00, /* __u8 if_bInterfaceProtocol; */
|
||||
0x00, /* __u8 if_iInterface; */
|
||||
|
||||
/* endpoint */
|
||||
0x07, /* __u8 ep_bLength; */
|
||||
0x05, /* __u8 ep_bDescriptorType; Endpoint */
|
||||
0x81, /* __u8 ep_bEndpointAddress; IN Endpoint 1 */
|
||||
0x03, /* __u8 ep_bmAttributes; Interrupt */
|
||||
0x08, /* __u16 ep_wMaxPacketSize; */
|
||||
0x00,
|
||||
0xff /* __u8 ep_bInterval; 255 ms */
|
||||
};
|
||||
|
||||
/* root hub class descriptor*/
|
||||
static __u8 sl811_rh_hub_des[] =
|
||||
{
|
||||
0x09, /* __u8 bLength; */
|
||||
0x29, /* __u8 bDescriptorType; Hub-descriptor */
|
||||
0x01, /* __u8 bNbrPorts; */
|
||||
0x00, /* __u16 wHubCharacteristics; */
|
||||
0x00,
|
||||
0x50, /* __u8 bPwrOn2pwrGood; 2ms */
|
||||
0x00, /* __u8 bHubContrCurrent; 0 mA */
|
||||
0xfc, /* __u8 DeviceRemovable; *** 7 Ports max *** */
|
||||
0xff /* __u8 PortPwrCtrlMask; *** 7 ports max *** */
|
||||
};
|
||||
|
||||
/*
|
||||
* helper routine for returning string descriptors in UTF-16LE
|
||||
* input can actually be ISO-8859-1; ASCII is its 7-bit subset
|
||||
*/
|
||||
static int ascii2utf (char *s, u8 *utf, int utfmax)
|
||||
{
|
||||
int retval;
|
||||
|
||||
for (retval = 0; *s && utfmax > 1; utfmax -= 2, retval += 2) {
|
||||
*utf++ = *s++;
|
||||
*utf++ = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* root_hub_string is used by each host controller's root hub code,
|
||||
* so that they're identified consistently throughout the system.
|
||||
*/
|
||||
static int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
|
||||
{
|
||||
char buf [30];
|
||||
|
||||
/* assert (len > (2 * (sizeof (buf) + 1)));
|
||||
assert (strlen (type) <= 8);*/
|
||||
|
||||
/* language ids */
|
||||
if (id == 0) {
|
||||
*data++ = 4; *data++ = 3; /* 4 bytes data */
|
||||
*data++ = 0; *data++ = 0; /* some language id */
|
||||
return 4;
|
||||
|
||||
/* serial number */
|
||||
} else if (id == 1) {
|
||||
sprintf (buf, "%#x", serial);
|
||||
|
||||
/* product description */
|
||||
} else if (id == 2) {
|
||||
sprintf (buf, "USB %s Root Hub", type);
|
||||
|
||||
/* id 3 == vendor description */
|
||||
|
||||
/* unsupported IDs --> "stall" */
|
||||
} else
|
||||
return 0;
|
||||
|
||||
ascii2utf (buf, data + 2, len - 2);
|
||||
data [0] = 2 + strlen(buf) * 2;
|
||||
data [1] = 3;
|
||||
return data [0];
|
||||
}
|
||||
|
||||
/* helper macro */
|
||||
#define OK(x) len = (x); break
|
||||
|
||||
/*
|
||||
* This function handles all USB request to the the virtual root hub
|
||||
*/
|
||||
static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
|
||||
void *data, int buf_len, struct devrequest *cmd)
|
||||
{
|
||||
__u8 data_buf[16];
|
||||
__u8 *bufp = data_buf;
|
||||
int len = 0;
|
||||
int status = 0;
|
||||
|
||||
__u16 bmRType_bReq;
|
||||
__u16 wValue;
|
||||
__u16 wIndex;
|
||||
__u16 wLength;
|
||||
|
||||
if (usb_pipeint(pipe)) {
|
||||
PDEBUG(0, "interrupt transfer unimplemented!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bmRType_bReq = cmd->requesttype | (cmd->request << 8);
|
||||
wValue = le16_to_cpu (cmd->value);
|
||||
wIndex = le16_to_cpu (cmd->index);
|
||||
wLength = le16_to_cpu (cmd->length);
|
||||
|
||||
PDEBUG(5, "submit rh urb, req = %d(%x) val = %#x index = %#x len=%d\n",
|
||||
bmRType_bReq, bmRType_bReq, wValue, wIndex, wLength);
|
||||
|
||||
/* Request Destination:
|
||||
without flags: Device,
|
||||
USB_RECIP_INTERFACE: interface,
|
||||
USB_RECIP_ENDPOINT: endpoint,
|
||||
USB_TYPE_CLASS means HUB here,
|
||||
USB_RECIP_OTHER | USB_TYPE_CLASS almost ever means HUB_PORT here
|
||||
*/
|
||||
switch (bmRType_bReq) {
|
||||
case RH_GET_STATUS:
|
||||
*(__u16 *)bufp = cpu_to_le16(1);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_INTERFACE:
|
||||
*(__u16 *)bufp = cpu_to_le16(0);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_ENDPOINT:
|
||||
*(__u16 *)bufp = cpu_to_le16(0);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_TYPE_CLASS:
|
||||
*(__u32 *)bufp = cpu_to_le32(0);
|
||||
OK(4);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
*(__u32 *)bufp = cpu_to_le32(rh_status.wPortChange<<16 | rh_status.wPortStatus);
|
||||
OK(4);
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_RECIP_ENDPOINT:
|
||||
switch (wValue) {
|
||||
case 1:
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case C_HUB_LOCAL_POWER:
|
||||
OK(0);
|
||||
|
||||
case C_HUB_OVER_CURRENT:
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case USB_PORT_FEAT_ENABLE:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_POWER;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_CONNECTION:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_CONNECTION;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_ENABLE:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_SUSPEND:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_OVER_CURRENT:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_OVERCURRENT;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_RESET:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_RESET;
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_SET_FEATURE | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_RESET:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_RESET;
|
||||
rh_status.wPortChange = 0;
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_RESET;
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_RESET;
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_POWER;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_ENABLE:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_SET_ADDRESS:
|
||||
root_hub_devnum = wValue;
|
||||
OK(0);
|
||||
|
||||
case RH_GET_DESCRIPTOR:
|
||||
switch ((wValue & 0xff00) >> 8) {
|
||||
case USB_DT_DEVICE:
|
||||
len = sizeof(sl811_rh_dev_des);
|
||||
bufp = sl811_rh_dev_des;
|
||||
OK(len);
|
||||
|
||||
case USB_DT_CONFIG:
|
||||
len = sizeof(sl811_rh_config_des);
|
||||
bufp = sl811_rh_config_des;
|
||||
OK(len);
|
||||
|
||||
case USB_DT_STRING:
|
||||
len = usb_root_hub_string(wValue & 0xff, (int)(long)0, "SL811HS", data, wLength);
|
||||
if (len > 0) {
|
||||
bufp = data;
|
||||
OK(len);
|
||||
}
|
||||
|
||||
default:
|
||||
status = -32;
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_GET_DESCRIPTOR | USB_TYPE_CLASS:
|
||||
len = sizeof(sl811_rh_hub_des);
|
||||
bufp = sl811_rh_hub_des;
|
||||
OK(len);
|
||||
|
||||
case RH_GET_CONFIGURATION:
|
||||
bufp[0] = 0x01;
|
||||
OK(1);
|
||||
|
||||
case RH_SET_CONFIGURATION:
|
||||
OK(0);
|
||||
|
||||
default:
|
||||
PDEBUG(1, "unsupported root hub command\n");
|
||||
status = -32;
|
||||
}
|
||||
|
||||
len = min(len, buf_len);
|
||||
if (data != bufp)
|
||||
memcpy(data, bufp, len);
|
||||
|
||||
PDEBUG(5, "len = %d, status = %d\n", len, status);
|
||||
|
||||
usb_dev->status = status;
|
||||
usb_dev->act_len = len;
|
||||
|
||||
return status == 0 ? len : status;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_SL811HS */
|
||||
+5
-1
@@ -38,13 +38,17 @@ LOAD_ADDR = 0x80200000 -T mips.lds
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),nios)
|
||||
LOAD_ADDR = 0x01000000 -L $(gcclibdir)/m32 -T nios.lds
|
||||
LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),m68k)
|
||||
LOAD_ADDR = 0x20000 -L $(clibdir)
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),microblaze)
|
||||
LOAD_ADDR = 0x80F00000
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
SREC = hello_world.srec
|
||||
|
||||
@@ -94,6 +94,18 @@ gd_t *global_data;
|
||||
" move.l (%%a0), %%a0\n" \
|
||||
" jmp (%%a0)\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
|
||||
#elif defined(CONFIG_MICROBLZE)
|
||||
/*
|
||||
* r31 holds the pointer to the global_data. r5 is a call-clobbered.
|
||||
*/
|
||||
#define EXPORT_FUNC(x) \
|
||||
asm volatile ( \
|
||||
" .globl " #x "\n" \
|
||||
#x ":\n" \
|
||||
" lwi r5, r31, %0\n" \
|
||||
" lwi r5, r5, %1\n" \
|
||||
" bra r5\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
|
||||
#else
|
||||
#error stubs definition missing for this architecture
|
||||
#endif
|
||||
|
||||
+13
-10
@@ -182,8 +182,8 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
|
||||
if (!nand_cache) {
|
||||
/* This memory never gets freed but 'cause
|
||||
it's a bootloader, nobody cares */
|
||||
nand_cache = malloc(NAND_CACHE_SIZE);
|
||||
if (!nand_cache) {
|
||||
nand_cache = malloc(NAND_CACHE_SIZE);
|
||||
if (!nand_cache) {
|
||||
printf("read_nand_cached: can't alloc cache size %d bytes\n",
|
||||
NAND_CACHE_SIZE);
|
||||
return -1;
|
||||
@@ -217,7 +217,8 @@ static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
|
||||
return NULL;
|
||||
}
|
||||
if (read_nand_cached(off, size, buf) < 0) {
|
||||
free(buf);
|
||||
if (!ext_buf)
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ static void *get_node_mem(u32 off)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void put_fl_mem(void *buf)
|
||||
static void put_fl_mem(void *buf)
|
||||
{
|
||||
free(buf);
|
||||
}
|
||||
@@ -258,7 +259,7 @@ static inline void *get_node_mem(u32 off)
|
||||
return (void*)off;
|
||||
}
|
||||
|
||||
static inline void put_fl_mem(void *buf)
|
||||
static inline void put_fl_mem(void *buf)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -414,7 +415,7 @@ static int compare_dirents(struct b_node *new, struct b_node *old)
|
||||
struct jffs2_raw_dirent ojOld;
|
||||
struct jffs2_raw_dirent *jNew =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(new->offset, sizeof(ojNew), &ojNew);
|
||||
struct jffs2_raw_dirent *jOld =
|
||||
struct jffs2_raw_dirent *jOld =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(old->offset, sizeof(ojOld), &ojOld);
|
||||
int cmp;
|
||||
|
||||
@@ -511,7 +512,7 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
* we will live with it.
|
||||
*/
|
||||
for (b = pL->frag.listHead; b != NULL; b = b->next) {
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
sizeof(struct jffs2_raw_inode), NULL);
|
||||
if ((inode == jNode->ino)) {
|
||||
/* get actual file length from the newest node */
|
||||
@@ -756,9 +757,11 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
|
||||
while (b2) {
|
||||
jNode = (struct jffs2_raw_inode *)
|
||||
get_fl_mem(b2->offset, sizeof(ojNode), &ojNode);
|
||||
if (jNode->ino == jDir->ino
|
||||
&& jNode->version >= i_version)
|
||||
if (jNode->ino == jDir->ino && jNode->version >= i_version) {
|
||||
if (i)
|
||||
put_fl_mem(i);
|
||||
i = get_fl_mem(b2->offset, sizeof(*i), NULL);
|
||||
}
|
||||
b2 = b2->next;
|
||||
}
|
||||
|
||||
@@ -874,7 +877,7 @@ jffs2_1pass_resolve_inode(struct b_lists * pL, u32 ino)
|
||||
while (b2) {
|
||||
jNode = (struct jffs2_raw_inode *) get_node_mem(b2->offset);
|
||||
if (jNode->ino == jDirFoundIno) {
|
||||
src = (unsigned char *) (b2->offset + sizeof(struct jffs2_raw_inode));
|
||||
src = (unsigned char *)jNode + sizeof(struct jffs2_raw_inode);
|
||||
|
||||
#if 0
|
||||
putLabeledWord("\t\t dsize = ", jNode->dsize);
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Author: Xilinx, Inc.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
|
||||
* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
|
||||
* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
|
||||
* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
|
||||
* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
|
||||
* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* Xilinx hardware products are not intended for use in life support
|
||||
* appliances, devices, or systems. Use in such applications is
|
||||
* expressly prohibited.
|
||||
*
|
||||
*
|
||||
* (c) Copyright 2002-2003 Xilinx Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* 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.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xbasic_types.h
|
||||
*
|
||||
* This file contains basic types for Xilinx software IP. These types do not
|
||||
* follow the standard naming convention with respect to using the component
|
||||
* name in front of each name because they are considered to be primitives.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* This file contains items which are architecture dependent.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00a rmm 12/14/01 First release
|
||||
* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab
|
||||
* compiler warnings
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef XBASIC_TYPES_H /* prevent circular inclusions */
|
||||
#define XBASIC_TYPES_H /* by using protection macros */
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
/** Null */
|
||||
|
||||
#define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
|
||||
#define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
|
||||
|
||||
/* the following constants and declarations are for unit test purposes and are
|
||||
* designed to be used in test applications.
|
||||
*/
|
||||
#define XTEST_PASSED 0
|
||||
#define XTEST_FAILED 1
|
||||
|
||||
#define XASSERT_NONE 0
|
||||
#define XASSERT_OCCURRED 1
|
||||
|
||||
extern unsigned int XAssertStatus;
|
||||
extern void XAssert(char *, int);
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/** @name Primitive types
|
||||
* These primitive types are created for transportability.
|
||||
* They are dependent upon the target architecture.
|
||||
* @{
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct {
|
||||
u32 Upper;
|
||||
u32 Lower;
|
||||
} Xuint64;
|
||||
|
||||
/* Xilinx's unsigned integer types */
|
||||
typedef u32 Xuint32;
|
||||
typedef u16 Xuint16;
|
||||
typedef u8 Xuint8;
|
||||
|
||||
/* and signed integer types */
|
||||
typedef s32 Xint32;
|
||||
typedef s16 Xint16;
|
||||
typedef s8 Xint8;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
typedef unsigned long Xboolean;
|
||||
#define XNULL NULL
|
||||
|
||||
#define XTRUE 1
|
||||
#define XFALSE 0
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* This data type defines an interrupt handler for a device.
|
||||
* The argument points to the instance of the component
|
||||
*/
|
||||
typedef void (*XInterruptHandler) (void *InstancePtr);
|
||||
|
||||
/**
|
||||
* This data type defines a callback to be invoked when an
|
||||
* assert occurs. The callback is invoked only when asserts are enabled
|
||||
*/
|
||||
typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber);
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Return the most significant half of the 64 bit data type.
|
||||
*
|
||||
* @param x is the 64 bit word.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The upper 32 bits of the 64 bit word.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XUINT64_MSW(x) ((x).Upper)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Return the least significant half of the 64 bit data type.
|
||||
*
|
||||
* @param x is the 64 bit word.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The lower 32 bits of the 64 bit word.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XUINT64_LSW(x) ((x).Lower)
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This assert macro is to be used for functions that do not return anything
|
||||
* (void). This in conjunction with the XWaitInAssert boolean can be used to
|
||||
* accomodate tests so that asserts which fail allow execution to continue.
|
||||
*
|
||||
* @param expression is the expression to evaluate. If it evaluates to false,
|
||||
* the assert occurs.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_VOID(expression) \
|
||||
{ \
|
||||
if (expression) { \
|
||||
XAssertStatus = XASSERT_NONE; \
|
||||
} else { \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This assert macro is to be used for functions that do return a value. This in
|
||||
* conjunction with the XWaitInAssert boolean can be used to accomodate tests so
|
||||
* that asserts which fail allow execution to continue.
|
||||
*
|
||||
* @param expression is the expression to evaluate. If it evaluates to false,
|
||||
* the assert occurs.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns 0 unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_NONVOID(expression) \
|
||||
{ \
|
||||
if (expression) { \
|
||||
XAssertStatus = XASSERT_NONE; \
|
||||
} else { \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Always assert. This assert macro is to be used for functions that do not
|
||||
* return anything (void). Use for instances where an assert should always
|
||||
* occur.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_VOID_ALWAYS() \
|
||||
{ \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return; \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Always assert. This assert macro is to be used for functions that do return
|
||||
* a value. Use for instances where an assert should always occur.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_NONVOID_ALWAYS() \
|
||||
{ \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define XASSERT_VOID(expression)
|
||||
#define XASSERT_VOID_ALWAYS()
|
||||
#define XASSERT_NONVOID(expression)
|
||||
#define XASSERT_NONVOID_ALWAYS()
|
||||
#endif
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
void XAssertSetCallback(XAssertCallback Routine);
|
||||
|
||||
#endif /* end of protection macro */
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* xio.h
|
||||
*
|
||||
* Defines XIo functions for Xilinx OCP in terms of Linux primitives
|
||||
*
|
||||
* Author: MontaVista Software, Inc.
|
||||
* source@mvista.com
|
||||
*
|
||||
* 2002 (c) MontaVista, Software, Inc. This file is licensed under the terms
|
||||
* of the GNU General Public License version 2. This program is licensed
|
||||
* "as is" without any warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#ifndef XIO_H
|
||||
#define XIO_H
|
||||
|
||||
#include "xbasic_types.h"
|
||||
#include <asm/io.h>
|
||||
|
||||
typedef u32 XIo_Address;
|
||||
|
||||
extern inline u8
|
||||
XIo_In8(XIo_Address InAddress)
|
||||
{
|
||||
return (u8) in_8((volatile unsigned char *) InAddress);
|
||||
}
|
||||
extern inline u16
|
||||
XIo_In16(XIo_Address InAddress)
|
||||
{
|
||||
return (u16) in_be16((volatile unsigned short *) InAddress);
|
||||
}
|
||||
extern inline u32
|
||||
XIo_In32(XIo_Address InAddress)
|
||||
{
|
||||
return (u32) in_be32((volatile unsigned *) InAddress);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out8(XIo_Address OutAddress, u8 Value)
|
||||
{
|
||||
out_8((volatile unsigned char *) OutAddress, Value);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out16(XIo_Address OutAddress, u16 Value)
|
||||
{
|
||||
out_be16((volatile unsigned short *) OutAddress, Value);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out32(XIo_Address OutAddress, u32 Value)
|
||||
{
|
||||
out_be32((volatile unsigned *) OutAddress, Value);
|
||||
}
|
||||
|
||||
#define XIo_ToLittleEndian16(s,d) (*(u16*)(d) = cpu_to_le16((u16)(s)))
|
||||
#define XIo_ToLittleEndian32(s,d) (*(u32*)(d) = cpu_to_le32((u32)(s)))
|
||||
#define XIo_ToBigEndian16(s,d) (*(u16*)(d) = cpu_to_be16((u16)(s)))
|
||||
#define XIo_ToBigEndian32(s,d) (*(u32*)(d) = cpu_to_be32((u32)(s)))
|
||||
|
||||
#define XIo_FromLittleEndian16(s,d) (*(u16*)(d) = le16_to_cpu((u16)(s)))
|
||||
#define XIo_FromLittleEndian32(s,d) (*(u32*)(d) = le32_to_cpu((u32)(s)))
|
||||
#define XIo_FromBigEndian16(s,d) (*(u16*)(d) = be16_to_cpu((u16)(s)))
|
||||
#define XIo_FromBigEndian32(s,d) (*(u32*)(d) = be32_to_cpu((u32)(s)))
|
||||
|
||||
#endif /* XIO_H */
|
||||
@@ -0,0 +1,256 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
|
||||
* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
|
||||
* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
|
||||
* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
|
||||
* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
|
||||
* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
|
||||
* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
|
||||
* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
|
||||
* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
|
||||
* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
|
||||
* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
|
||||
* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* (c) Copyright 2002 Xilinx Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xuartlite_l.h
|
||||
*
|
||||
* This header file contains identifiers and low-level driver functions (or
|
||||
* macros) that can be used to access the device. High-level driver functions
|
||||
* are defined in xuartlite.h.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00b rpm 04/25/02 First release
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef XUARTLITE_L_H /* prevent circular inclusions */
|
||||
#define XUARTLITE_L_H /* by using protection macros */
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xbasic_types.h"
|
||||
#include "xio.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/* UART Lite register offsets */
|
||||
|
||||
#define XUL_RX_FIFO_OFFSET 0 /* receive FIFO, read only */
|
||||
#define XUL_TX_FIFO_OFFSET 4 /* transmit FIFO, write only */
|
||||
#define XUL_STATUS_REG_OFFSET 8 /* status register, read only */
|
||||
#define XUL_CONTROL_REG_OFFSET 12 /* control register, write only */
|
||||
|
||||
/* control register bit positions */
|
||||
|
||||
#define XUL_CR_ENABLE_INTR 0x10 /* enable interrupt */
|
||||
#define XUL_CR_FIFO_RX_RESET 0x02 /* reset receive FIFO */
|
||||
#define XUL_CR_FIFO_TX_RESET 0x01 /* reset transmit FIFO */
|
||||
|
||||
/* status register bit positions */
|
||||
|
||||
#define XUL_SR_PARITY_ERROR 0x80
|
||||
#define XUL_SR_FRAMING_ERROR 0x40
|
||||
#define XUL_SR_OVERRUN_ERROR 0x20
|
||||
#define XUL_SR_INTR_ENABLED 0x10 /* interrupt enabled */
|
||||
#define XUL_SR_TX_FIFO_FULL 0x08 /* transmit FIFO full */
|
||||
#define XUL_SR_TX_FIFO_EMPTY 0x04 /* transmit FIFO empty */
|
||||
#define XUL_SR_RX_FIFO_FULL 0x02 /* receive FIFO full */
|
||||
#define XUL_SR_RX_FIFO_VALID_DATA 0x01 /* data in receive FIFO */
|
||||
|
||||
/* the following constant specifies the size of the FIFOs, the size of the
|
||||
* FIFOs includes the transmitter and receiver such that it is the total number
|
||||
* of bytes that the UART can buffer
|
||||
*/
|
||||
#define XUL_FIFO_SIZE 16
|
||||
|
||||
/* Stop bits are fixed at 1. Baud, parity, and data bits are fixed on a
|
||||
* per instance basis
|
||||
*/
|
||||
#define XUL_STOP_BITS 1
|
||||
|
||||
/* Parity definitions
|
||||
*/
|
||||
#define XUL_PARITY_NONE 0
|
||||
#define XUL_PARITY_ODD 1
|
||||
#define XUL_PARITY_EVEN 2
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Low-level driver macros and functions. The list below provides signatures
|
||||
* to help the user use the macros.
|
||||
*
|
||||
* void XUartLite_mSetControlReg(u32 BaseAddress, u32 Mask)
|
||||
* u32 XUartLite_mGetControlReg(u32 BaseAddress)
|
||||
* u32 XUartLite_mGetStatusReg(u32 BaseAddress)
|
||||
*
|
||||
* Xboolean XUartLite_mIsReceiveEmpty(u32 BaseAddress)
|
||||
* Xboolean XUartLite_mIsTransmitFull(u32 BaseAddress)
|
||||
* Xboolean XUartLite_mIsIntrEnabled(u32 BaseAddress)
|
||||
*
|
||||
* void XUartLite_mEnableIntr(u32 BaseAddress)
|
||||
* void XUartLite_mDisableIntr(u32 BaseAddress)
|
||||
*
|
||||
* void XUartLite_SendByte(u32 BaseAddress, u8 Data);
|
||||
* u8 XUartLite_RecvByte(u32 BaseAddress);
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Set the contents of the control register. Use the XUL_CR_* constants defined
|
||||
* above to create the bit-mask to be written to the register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
* @param Mask is the 32-bit value to write to the control register
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mSetControlReg(BaseAddress, Mask) \
|
||||
XIo_Out32((BaseAddress) + XUL_CONTROL_REG_OFFSET, (Mask))
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Get the contents of the control register. Use the XUL_CR_* constants defined
|
||||
* above to interpret the bit-mask returned.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return A 32-bit value representing the contents of the control register.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mGetControlReg(BaseAddress) \
|
||||
XIo_In32((BaseAddress) + XUL_CONTROL_REG_OFFSET)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Get the contents of the status register. Use the XUL_SR_* constants defined
|
||||
* above to interpret the bit-mask returned.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return A 32-bit value representing the contents of the status register.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mGetStatusReg(BaseAddress) \
|
||||
XIo_In32((BaseAddress) + XUL_STATUS_REG_OFFSET)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the receiver has data.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the receiver is empty, XFALSE if there is data present.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsReceiveEmpty(BaseAddress) \
|
||||
(!(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_RX_FIFO_VALID_DATA))
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the transmitter is full.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the transmitter is full, XFALSE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsTransmitFull(BaseAddress) \
|
||||
(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_TX_FIFO_FULL)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the interrupt is enabled.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the interrupt is enabled, XFALSE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsIntrEnabled(BaseAddress) \
|
||||
(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_INTR_ENABLED)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Enable the device interrupt. Preserve the contents of the control register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mEnableIntr(BaseAddress) \
|
||||
XUartLite_mSetControlReg((BaseAddress), \
|
||||
XUartLite_mGetControlReg((BaseAddress)) | XUL_CR_ENABLE_INTR)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Disable the device interrupt. Preserve the contents of the control register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mDisableIntr(BaseAddress) \
|
||||
XUartLite_mSetControlReg((BaseAddress), \
|
||||
XUartLite_mGetControlReg((BaseAddress)) & ~XUL_CR_ENABLE_INTR)
|
||||
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
void XUartLite_SendByte(u32 BaseAddress, u8 Data);
|
||||
u8 XUartLite_RecvByte(u32 BaseAddress);
|
||||
|
||||
|
||||
#endif /* end of protection macro */
|
||||
@@ -0,0 +1,392 @@
|
||||
#ifndef _MICROBLAZE_BITOPS_H
|
||||
#define _MICROBLAZE_BITOPS_H
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <asm/byteorder.h> /* swab32 */
|
||||
#include <asm/system.h> /* save_flags */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* Function prototypes to keep gcc -Wall happy
|
||||
*/
|
||||
|
||||
/*
|
||||
* The __ functions are not atomic
|
||||
*/
|
||||
|
||||
extern void set_bit(int nr, volatile void * addr);
|
||||
extern void __set_bit(int nr, volatile void * addr);
|
||||
|
||||
extern void clear_bit(int nr, volatile void * addr);
|
||||
#define __clear_bit(nr, addr) clear_bit(nr, addr)
|
||||
|
||||
extern void change_bit(int nr, volatile void * addr);
|
||||
extern void __change_bit(int nr, volatile void * addr);
|
||||
extern int test_and_set_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_set_bit(int nr, volatile void * addr);
|
||||
extern int test_and_clear_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_clear_bit(int nr, volatile void * addr);
|
||||
extern int test_and_change_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_change_bit(int nr, volatile void * addr);
|
||||
extern int __constant_test_bit(int nr, const volatile void * addr);
|
||||
extern int __test_bit(int nr, volatile void * addr);
|
||||
extern int find_first_zero_bit(void * addr, unsigned size);
|
||||
extern int find_next_zero_bit (void * addr, int size, int offset);
|
||||
|
||||
/*
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
extern __inline__ unsigned long ffz(unsigned long word)
|
||||
{
|
||||
unsigned long result = 0;
|
||||
|
||||
while(word & 1) {
|
||||
result++;
|
||||
word >>= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
extern __inline__ void set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void __set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
*a |= mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* clear_bit() doesn't provide any barrier for the compiler.
|
||||
*/
|
||||
#define smp_mb__before_clear_bit() barrier()
|
||||
#define smp_mb__after_clear_bit() barrier()
|
||||
|
||||
extern __inline__ void clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
save_flags_cli(flags);
|
||||
*ADDR ^= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void __change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
*ADDR ^= mask;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine doesn't need to be atomic.
|
||||
*/
|
||||
extern __inline__ int __constant_test_bit(int nr, const volatile void * addr)
|
||||
{
|
||||
return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
return ((mask & *a) != 0);
|
||||
}
|
||||
|
||||
#define test_bit(nr,addr) \
|
||||
(__builtin_constant_p(nr) ? \
|
||||
__constant_test_bit((nr),(addr)) : \
|
||||
__test_bit((nr),(addr)))
|
||||
|
||||
#define find_first_zero_bit(addr, size) \
|
||||
find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
extern __inline__ int find_next_zero_bit (void * addr, int size, int offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if (offset) {
|
||||
tmp = *(p++);
|
||||
tmp |= ~0UL >> (32-offset);
|
||||
if (size < 32)
|
||||
goto found_first;
|
||||
if (~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while (size & ~31UL) {
|
||||
if (~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if (!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
tmp |= ~0UL >> size;
|
||||
found_middle:
|
||||
return result + ffz(tmp);
|
||||
}
|
||||
|
||||
#define ffs(x) generic_ffs(x)
|
||||
|
||||
/*
|
||||
* hweightN: returns the hamming weight (i.e. the number
|
||||
* of bits set) of a N-bit word
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
|
||||
extern __inline__ int ext2_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR |= mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int ext2_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR &= ~mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int ext2_test_bit(int nr, const volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
const volatile unsigned char *ADDR = (const unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
return ((mask & *ADDR) != 0);
|
||||
}
|
||||
|
||||
#define ext2_find_first_zero_bit(addr, size) \
|
||||
ext2_find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if(offset) {
|
||||
/* We hold the little endian value in tmp, but then the
|
||||
* shift is illegal. So we could keep a big endian value
|
||||
* in tmp, like this:
|
||||
*
|
||||
* tmp = __swab32(*(p++));
|
||||
* tmp |= ~0UL >> (32-offset);
|
||||
*
|
||||
* but this would decrease preformance, so we change the
|
||||
* shift:
|
||||
*/
|
||||
tmp = *(p++);
|
||||
tmp |= __swab32(~0UL >> (32-offset));
|
||||
if(size < 32)
|
||||
goto found_first;
|
||||
if(~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while(size & ~31UL) {
|
||||
if(~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if(!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
/* tmp is little endian, so we would have to swab the shift,
|
||||
* see above. But then we have to swab tmp below for ffz, so
|
||||
* we might as well do this here.
|
||||
*/
|
||||
return result + ffz(__swab32(tmp) | (~0UL << size));
|
||||
found_middle:
|
||||
return result + ffz(__swab32(tmp));
|
||||
}
|
||||
|
||||
/* Bitmap functions for the minix filesystem. */
|
||||
#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
|
||||
#define minix_set_bit(nr,addr) set_bit(nr,addr)
|
||||
#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
|
||||
#define minix_test_bit(nr,addr) test_bit(nr,addr)
|
||||
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
|
||||
|
||||
/**
|
||||
* hweightN - returns the hamming weight of a N-bit word
|
||||
* @x: the word to weigh
|
||||
*
|
||||
* The Hamming Weight of a number is the total number of bits set in it.
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _MICROBLAZE_BITOPS_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* include/asm-microblaze/byteorder.h -- Endian id and conversion ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_BYTEORDER_H__
|
||||
#define __MICROBLAZE_BYTEORDER_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* This is effectively a dupe of the arch-independent byteswap
|
||||
code in include/linux/byteorder/swab.h, however we force a cast
|
||||
of the result up to 32 bits. This in turn forces the compiler
|
||||
to explicitly clear the high 16 bits, which it wasn't doing otherwise.
|
||||
|
||||
I think this is a symptom of a bug in mb-gcc. JW 20040303
|
||||
*/
|
||||
static __inline__ __const__ __u16 ___arch__swab16 (__u16 half_word)
|
||||
{
|
||||
/* 32 bit temp to cast result, forcing clearing of high word */
|
||||
__u32 temp;
|
||||
|
||||
temp = ((half_word & 0x00FFU) << 8) | ((half_word & 0xFF00U) >> 8);
|
||||
|
||||
return (__u16) temp;
|
||||
}
|
||||
|
||||
#define __arch__swab16(x) ___arch__swab16(x)
|
||||
|
||||
/* Microblaze has no arch-specific endian conversion insns */
|
||||
|
||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
||||
# define __BYTEORDER_HAS_U64__
|
||||
# define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
|
||||
#endif /* __MICROBLAZE_BYTEORDER_H__ */
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 __ASM_GBL_DATA_H
|
||||
#define __ASM_GBL_DATA_H
|
||||
/*
|
||||
* The following data structure is placed in some memory wich is
|
||||
* available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
|
||||
* some locked parts of the data cache) to allow for a minimum set of
|
||||
* global variables during system initialization (until we have set
|
||||
* up the memory controller so that we can use RAM).
|
||||
*
|
||||
* Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t)
|
||||
*/
|
||||
|
||||
typedef struct global_data {
|
||||
bd_t *bd;
|
||||
unsigned long flags;
|
||||
unsigned long baudrate;
|
||||
unsigned long have_console; /* serial_init() was called */
|
||||
unsigned long reloc_off; /* Relocation Offset */
|
||||
unsigned long env_addr; /* Address of Environment struct */
|
||||
unsigned long env_valid; /* Checksum of Environment valid? */
|
||||
unsigned long fb_base; /* base address of frame buffer */
|
||||
void **jt; /* jump table */
|
||||
} gd_t;
|
||||
|
||||
/*
|
||||
* Global Data Flags
|
||||
*/
|
||||
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
|
||||
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
|
||||
#define GD_FLG_SILENT 0x00004 /* Silent mode */
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* include/asm-microblaze/io.h -- Misc I/O operations
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,02 NEC Corporation
|
||||
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_IO_H__
|
||||
#define __MICROBLAZE_IO_H__
|
||||
|
||||
#define IO_SPACE_LIMIT 0xFFFFFFFF
|
||||
|
||||
#define readb(addr) \
|
||||
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
|
||||
#define readw(addr) \
|
||||
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
|
||||
#define readl(addr) \
|
||||
({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
|
||||
|
||||
#define writeb(b, addr) \
|
||||
(void)((*(volatile unsigned char *) (addr)) = (b))
|
||||
#define writew(b, addr) \
|
||||
(void)((*(volatile unsigned short *) (addr)) = (b))
|
||||
#define writel(b, addr) \
|
||||
(void)((*(volatile unsigned int *) (addr)) = (b))
|
||||
|
||||
#define memset_io(a,b,c) memset((void *)(a),(b),(c))
|
||||
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
|
||||
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
|
||||
|
||||
#define inb(addr) readb (addr)
|
||||
#define inw(addr) readw (addr)
|
||||
#define inl(addr) readl (addr)
|
||||
#define outb(x, addr) ((void) writeb (x, addr))
|
||||
#define outw(x, addr) ((void) writew (x, addr))
|
||||
#define outl(x, addr) ((void) writel (x, addr))
|
||||
|
||||
/* Some #definitions to keep strange Xilinx code happy */
|
||||
#define in_8(addr) readb (addr)
|
||||
#define in_be16(addr) readw (addr)
|
||||
#define in_be32(addr) readl (addr)
|
||||
|
||||
#define out_8(addr,x ) outb (x,addr)
|
||||
#define out_be16(addr,x ) outw (x,addr)
|
||||
#define out_be32(addr,x ) outl (x,addr)
|
||||
|
||||
|
||||
#define inb_p(port) inb((port))
|
||||
#define outb_p(val, port) outb((val), (port))
|
||||
#define inw_p(port) inw((port))
|
||||
#define outw_p(val, port) outw((val), (port))
|
||||
#define inl_p(port) inl((port))
|
||||
#define outl_p(val, port) outl((val), (port))
|
||||
|
||||
/* Some defines to keep the MTD flash drivers happy */
|
||||
|
||||
#define __raw_readb readb
|
||||
#define __raw_readw readw
|
||||
#define __raw_readl readl
|
||||
#define __raw_writeb writeb
|
||||
#define __raw_writew writew
|
||||
#define __raw_writel writel
|
||||
|
||||
static inline void io_insb (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
while (count--)
|
||||
*p++ = inb (port);
|
||||
}
|
||||
static inline void io_insw (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned short *p = dst;
|
||||
while (count--)
|
||||
*p++ = inw (port);
|
||||
}
|
||||
static inline void io_insl (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned long *p = dst;
|
||||
while (count--)
|
||||
*p++ = inl (port);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_outsb (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
while (count--)
|
||||
outb (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsw (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned short *p = src;
|
||||
while (count--)
|
||||
outw (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsl (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned long *p = src;
|
||||
while (count--)
|
||||
outl (*p++, port);
|
||||
}
|
||||
|
||||
#define outsb(a,b,l) io_outsb(a,b,l)
|
||||
#define outsw(a,b,l) io_outsw(a,b,l)
|
||||
#define outsl(a,b,l) io_outsl(a,b,l)
|
||||
|
||||
#define insb(a,b,l) io_insb(a,b,l)
|
||||
#define insw(a,b,l) io_insw(a,b,l)
|
||||
#define insl(a,b,l) io_insl(a,b,l)
|
||||
|
||||
|
||||
#define iounmap(addr) ((void)0)
|
||||
#define ioremap(physaddr, size) (physaddr)
|
||||
#define ioremap_nocache(physaddr, size) (physaddr)
|
||||
#define ioremap_writethrough(physaddr, size) (physaddr)
|
||||
#define ioremap_fullcache(physaddr, size) (physaddr)
|
||||
|
||||
#endif /* __MICROBLAZE_IO_H__ */
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 <config.h>
|
||||
|
||||
#ifdef CONFIG_SUZAKU
|
||||
#include <asm/suzaku.h>
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* include/asm-microblaze/posix_types.h -- Kernel versions of standard types
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_POSIX_TYPES_H__
|
||||
#define __MICROBLAZE_POSIX_TYPES_H__
|
||||
|
||||
#include <asm/bitops.h>
|
||||
|
||||
|
||||
typedef unsigned int __kernel_dev_t;
|
||||
typedef unsigned long __kernel_ino_t;
|
||||
typedef unsigned long long __kernel_ino64_t;
|
||||
typedef unsigned int __kernel_mode_t;
|
||||
typedef unsigned int __kernel_nlink_t;
|
||||
typedef long __kernel_off_t;
|
||||
typedef long long __kernel_loff_t;
|
||||
typedef int __kernel_pid_t;
|
||||
typedef unsigned short __kernel_ipc_pid_t;
|
||||
typedef unsigned int __kernel_uid_t;
|
||||
typedef unsigned int __kernel_gid_t;
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
typedef long __kernel_time_t;
|
||||
typedef long __kernel_suseconds_t;
|
||||
typedef long __kernel_clock_t;
|
||||
typedef int __kernel_daddr_t;
|
||||
typedef char * __kernel_caddr_t;
|
||||
typedef unsigned short __kernel_uid16_t;
|
||||
typedef unsigned short __kernel_gid16_t;
|
||||
typedef unsigned int __kernel_uid32_t;
|
||||
typedef unsigned int __kernel_gid32_t;
|
||||
|
||||
typedef unsigned short __kernel_old_uid_t;
|
||||
typedef unsigned short __kernel_old_gid_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
#if defined(__KERNEL__) || defined(__USE_ALL)
|
||||
int val[2];
|
||||
#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
|
||||
int __val[2];
|
||||
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
|
||||
} __kernel_fsid_t;
|
||||
|
||||
|
||||
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
|
||||
|
||||
#undef __FD_SET
|
||||
#define __FD_SET(fd, fd_set) \
|
||||
__set_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_CLR
|
||||
#define __FD_CLR(fd, fd_set) \
|
||||
__clear_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ISSET
|
||||
#define __FD_ISSET(fd, fd_set) \
|
||||
__test_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ZERO
|
||||
#define __FD_ZERO(fd_set) \
|
||||
memset (fd_set, 0, sizeof (*(fd_set *)fd_set))
|
||||
|
||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
|
||||
|
||||
#endif /* __MICROBLAZE_POSIX_TYPES_H__ */
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* include/asm-microblaze/ptrace.h -- Access to CPU registers
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_PTRACE_H__
|
||||
#define __MICROBLAZE_PTRACE_H__
|
||||
|
||||
|
||||
/* Microblaze general purpose registers with special meanings. */
|
||||
#define GPR_ZERO 0 /* constant zero */
|
||||
#define GPR_ASM 18 /* reserved for assembler */
|
||||
#define GPR_SP 1 /* stack pointer */
|
||||
#define GPR_GP 2 /* global data pointer */
|
||||
#define GPR_EP 30 /* `element pointer' */
|
||||
#define GPR_LP 15 /* link pointer (current return address) */
|
||||
|
||||
/* These aren't official names, but they make some code more descriptive. */
|
||||
#define GPR_ARG0 5
|
||||
#define GPR_ARG1 6
|
||||
#define GPR_ARG2 7
|
||||
#define GPR_ARG3 8
|
||||
#define GPR_ARG4 9
|
||||
#define GPR_ARG5 10
|
||||
#define GPR_RVAL0 3
|
||||
#define GPR_RVAL1 4
|
||||
#define GPR_RVAL GPR_RVAL0
|
||||
|
||||
#define NUM_GPRS 32
|
||||
|
||||
/* `system' registers. */
|
||||
/* Note these are old v850 values, microblaze has many fewer */
|
||||
#define SR_EIPC 0
|
||||
#define SR_EIPSW 1
|
||||
#define SR_FEPC 2
|
||||
#define SR_FEPSW 3
|
||||
#define SR_ECR 4
|
||||
#define SR_PSW 5
|
||||
#define SR_CTPC 16
|
||||
#define SR_CTPSW 17
|
||||
#define SR_DBPC 18
|
||||
#define SR_DBPSW 19
|
||||
#define SR_CTBP 20
|
||||
#define SR_DIR 21
|
||||
#define SR_ASID 23
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef unsigned long microblaze_reg_t;
|
||||
|
||||
/* How processor state is stored on the stack during a syscall/signal.
|
||||
If you change this structure, change the associated assembly-language
|
||||
macros below too (PT_*)! */
|
||||
struct pt_regs
|
||||
{
|
||||
/* General purpose registers. */
|
||||
microblaze_reg_t gpr[NUM_GPRS];
|
||||
|
||||
microblaze_reg_t pc; /* program counter */
|
||||
microblaze_reg_t psw; /* program status word */
|
||||
|
||||
microblaze_reg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */
|
||||
microblaze_reg_t single_step; /* 1 if in single step mode */
|
||||
};
|
||||
|
||||
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
#define user_mode(regs) (!(regs)->kernel_mode)
|
||||
|
||||
/* When a struct pt_regs is used to save user state for a system call in
|
||||
the kernel, the system call is stored in the space for R0 (since it's
|
||||
never used otherwise, R0 being a constant 0). Non-system-calls
|
||||
simply store 0 there. */
|
||||
#define PT_REGS_SYSCALL(regs) (regs)->gpr[0]
|
||||
#define PT_REGS_SET_SYSCALL(regs, val) ((regs)->gpr[0] = (val))
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
|
||||
/* The number of bytes used to store each register. */
|
||||
#define _PT_REG_SIZE 4
|
||||
|
||||
/* Offset of a general purpose register in a stuct pt_regs. */
|
||||
#define PT_GPR(num) ((num) * _PT_REG_SIZE)
|
||||
|
||||
/* Offsets of various special registers & fields in a struct pt_regs. */
|
||||
#define NUM_SPECIAL 4
|
||||
#define PT_PC ((NUM_GPRS + 0) * _PT_REG_SIZE)
|
||||
#define PT_PSW ((NUM_GPRS + 1) * _PT_REG_SIZE)
|
||||
#define PT_KERNEL_MODE ((NUM_GPRS + 2) * _PT_REG_SIZE)
|
||||
#define PT_SINGLESTEP ((NUM_GPRS + 3) * _PT_REG_SIZE)
|
||||
|
||||
#define PT_SYSCALL PT_GPR(0)
|
||||
|
||||
/* Size of struct pt_regs, including alignment. */
|
||||
#define PT_SIZE ((NUM_GPRS + NUM_SPECIAL) * _PT_REG_SIZE)
|
||||
|
||||
/* These are `magic' values for PTRACE_PEEKUSR that return info about where
|
||||
a process is located in memory. */
|
||||
#define PT_TEXT_ADDR (PT_SIZE + 1)
|
||||
#define PT_TEXT_LEN (PT_SIZE + 2)
|
||||
#define PT_DATA_ADDR (PT_SIZE + 3)
|
||||
#define PT_DATA_LEN (PT_SIZE + 4)
|
||||
|
||||
#endif /* __MICROBLAZE_PTRACE_H__ */
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 <asm/arch/xuartlite_l.h>
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* include/asm-microblaze/string.h -- Architecture specific string routines
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_STRING_H__
|
||||
#define __MICROBLAZE_STRING_H__
|
||||
|
||||
#if 0
|
||||
#define __HAVE_ARCH_BCOPY
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
|
||||
extern void *memcpy (void *, const void *, __kernel_size_t);
|
||||
extern void bcopy (const char *, char *, int);
|
||||
extern void *memset (void *, int, __kernel_size_t);
|
||||
extern void *memmove (void *, const void *, __kernel_size_t);
|
||||
#endif
|
||||
|
||||
#endif /* __MICROBLAZE_STRING_H__ */
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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
|
||||
*/
|
||||
|
||||
/* EMPTY FILE */
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* include/asm-microblaze/system.h -- Low-level interrupt/thread ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams (jwilliams@itee.uq.edu.au)
|
||||
* based upon microblaze version
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_SYSTEM_H__
|
||||
#define __MICROBLAZE_SYSTEM_H__
|
||||
|
||||
#if 0
|
||||
#include <linux/linkage.h>
|
||||
#endif
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
#define prepare_to_switch() do { } while (0)
|
||||
|
||||
/*
|
||||
* switch_to(n) should switch tasks to task ptr, first checking that
|
||||
* ptr isn't the current task, in which case it does nothing.
|
||||
*/
|
||||
struct thread_struct;
|
||||
extern void *switch_thread (struct thread_struct *last,
|
||||
struct thread_struct *next);
|
||||
#define switch_to(prev,next,last) do { \
|
||||
if (prev != next) { \
|
||||
(last) = switch_thread (&prev->thread, &next->thread); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Enable/disable interrupts. */
|
||||
#define __sti() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %0, %0, 2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __cli() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %0, %0, ~2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags(flags) \
|
||||
__asm__ __volatile__ ("mfs %0, rmsr" : "=r" (flags))
|
||||
#define __restore_flags(flags) \
|
||||
__asm__ __volatile__ ("mts rmsr, %0" :: "r" (flags))
|
||||
|
||||
#define __save_flags_cli(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %1, %0, ~2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags), "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags_sti(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %1, %0, 2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags) ,"=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
/* For spinlocks etc */
|
||||
#define local_irq_save(flags) __save_flags_cli (flags)
|
||||
#define local_irq_set(flags) __save_flags_sti (flags)
|
||||
#define local_irq_restore(flags) __restore_flags (flags)
|
||||
#define local_irq_disable() __cli ()
|
||||
#define local_irq_enable() __sti ()
|
||||
|
||||
#define cli() __cli ()
|
||||
#define sti() __sti ()
|
||||
#define save_flags(flags) __save_flags (flags)
|
||||
#define restore_flags(flags) __restore_flags (flags)
|
||||
#define save_flags_cli(flags) __save_flags_cli (flags)
|
||||
|
||||
/*
|
||||
* Force strict CPU ordering.
|
||||
* Not really required on microblaze...
|
||||
*/
|
||||
#define nop() __asm__ __volatile__ ("nop")
|
||||
#define mb() __asm__ __volatile__ ("nop" ::: "memory")
|
||||
#define rmb() mb ()
|
||||
#define wmb() mb ()
|
||||
#define set_mb(var, value) do { var = value; mb(); } while (0)
|
||||
#define set_wmb(var, value) do { var = value; wmb (); } while (0)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define smp_mb() mb ()
|
||||
#define smp_rmb() rmb ()
|
||||
#define smp_wmb() wmb ()
|
||||
#else
|
||||
#define smp_mb() barrier ()
|
||||
#define smp_rmb() barrier ()
|
||||
#define smp_wmb() barrier ()
|
||||
#endif
|
||||
|
||||
#define xchg(ptr, with) \
|
||||
((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr))))
|
||||
#define tas(ptr) (xchg ((ptr), 1))
|
||||
|
||||
extern inline unsigned long __xchg (unsigned long with,
|
||||
__volatile__ void *ptr, int size)
|
||||
{
|
||||
unsigned long tmp, flags;
|
||||
|
||||
save_flags_cli (flags);
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
tmp = *(unsigned char *)ptr;
|
||||
*(unsigned char *)ptr = with;
|
||||
break;
|
||||
case 2:
|
||||
tmp = *(unsigned short *)ptr;
|
||||
*(unsigned short *)ptr = with;
|
||||
break;
|
||||
case 4:
|
||||
tmp = *(unsigned long *)ptr;
|
||||
*(unsigned long *)ptr = with;
|
||||
break;
|
||||
}
|
||||
|
||||
restore_flags (flags);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif /* __MICROBLAZE_SYSTEM_H__ */
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef _ASM_TYPES_H
|
||||
#define _ASM_TYPES_H
|
||||
|
||||
/*
|
||||
* This file is never included by application software unless
|
||||
* explicitly requested (e.g., via linux/types.h) in which case the
|
||||
* application is Linux specific so (user-) name space pollution is
|
||||
* not a major issue. However, for interoperability, libraries still
|
||||
* need to be careful to avoid a name clashes.
|
||||
*/
|
||||
|
||||
typedef unsigned short umode_t;
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
|
||||
/* Dma addresses are 32-bits wide. */
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_TYPES_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.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 _U_BOOT_H_
|
||||
#define _U_BOOT_H_
|
||||
|
||||
typedef struct bd_info {
|
||||
unsigned long bi_memstart; /* start of DRAM memory */
|
||||
unsigned long bi_memsize; /* size of DRAM memory in bytes */
|
||||
unsigned long bi_flashstart; /* start of FLASH memory */
|
||||
unsigned long bi_flashsize; /* size of FLASH memory */
|
||||
unsigned long bi_flashoffset; /* reserved area for startup monitor */
|
||||
unsigned long bi_sramstart; /* start of SRAM memory */
|
||||
unsigned long bi_sramsize; /* size of SRAM memory */
|
||||
unsigned long bi_ip_addr; /* IP Address */
|
||||
unsigned char bi_enetaddr[6]; /* Ethernet adress */
|
||||
unsigned long bi_baudrate; /* Console Baudrate */
|
||||
} bd_t;
|
||||
|
||||
|
||||
#endif /* _U_BOOT_H_ */
|
||||
@@ -135,17 +135,21 @@ typedef struct pci_config {
|
||||
uint pci_imimr;
|
||||
char res5[24];
|
||||
uint pci_ifhpr;
|
||||
char res5_2[4];
|
||||
uint pci_iftpr;
|
||||
char res6[8];
|
||||
char res6[4];
|
||||
uint pci_iphpr;
|
||||
char res6_2[4];
|
||||
uint pci_iptpr;
|
||||
char res7[8];
|
||||
char res7[4];
|
||||
uint pci_ofhpr;
|
||||
char res7_2[4];
|
||||
uint pci_oftpr;
|
||||
char res8[8];
|
||||
char res8[4];
|
||||
uint pci_ophpr;
|
||||
char res8_2[4];
|
||||
uint pci_optpr;
|
||||
char res9[12];
|
||||
char res9[8];
|
||||
uint pci_mucr;
|
||||
char res10[8];
|
||||
uint pci_qbar;
|
||||
|
||||
@@ -372,6 +372,7 @@ int serial_tstc (void);
|
||||
int get_clocks (void);
|
||||
int get_clocks_866 (void);
|
||||
int sdram_adjust_866 (void);
|
||||
int adjust_sdram_tbs_8xx (void);
|
||||
#if defined(CONFIG_8260)
|
||||
int prt_8260_clks (void);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,703 @@
|
||||
/*
|
||||
* (C) Copyright 2004 DENX Software Engineering,
|
||||
* Wolfgang Grandegger <wg@denx.de>
|
||||
* (C) Copyright 2003
|
||||
* DAVE Srl
|
||||
*
|
||||
* http://www.dave-tech.it
|
||||
* http://www.wawnet.biz
|
||||
* mailto:info@wawnet.biz
|
||||
*
|
||||
* Credits: Stefan Roese, Wolfgang Denk
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* board/config.h - configuration options, board specific
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#define CONFIG_PPCHAMELEON_MODULE_BA 0 /* Basic Model */
|
||||
#define CONFIG_PPCHAMELEON_MODULE_ME 1 /* Medium Model */
|
||||
#define CONFIG_PPCHAMELEON_MODULE_HI 2 /* High-End Model */
|
||||
#ifndef CONFIG_PPCHAMELEON_MODULE_MODEL
|
||||
#define CONFIG_PPCHAMELEON_MODULE_MODEL CONFIG_PPCHAMELEON_MODULE_BA
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Debug stuff
|
||||
*/
|
||||
#undef __DEBUG_START_FROM_SRAM__
|
||||
#define __DISABLE_MACHINE_EXCEPTION__
|
||||
|
||||
#ifdef __DEBUG_START_FROM_SRAM__
|
||||
#define CFG_DUMMY_FLASH_SIZE 1024*1024*4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* High Level Configuration Options
|
||||
* (easy to change)
|
||||
*/
|
||||
|
||||
#define CONFIG_405EP 1 /* This is a PPC405 CPU */
|
||||
#define CONFIG_4xx 1 /* ...member of PPC4xx family */
|
||||
#define CONFIG_PPCHAMELEONEVB 1 /* ...on a PPChameleonEVB board */
|
||||
|
||||
#define CONFIG_BOARD_EARLY_INIT_F 1 /* call board_early_init_f() */
|
||||
#define CONFIG_MISC_INIT_R 1 /* call misc_init_r() */
|
||||
|
||||
#define CONFIG_SYS_CLK_FREQ 33333333 /* external frequency to pll */
|
||||
|
||||
#define CONFIG_UART1_CONSOLE 1 /* Use second UART */
|
||||
#define CONFIG_BAUDRATE 115200
|
||||
#define CONFIG_BOOTDELAY 5 /* autoboot after 5 seconds */
|
||||
|
||||
#undef CONFIG_BOOTARGS
|
||||
|
||||
/* Ethernet stuff */
|
||||
#define CONFIG_ENV_OVERWRITE /* Let the user to change the Ethernet MAC addresses */
|
||||
#define CONFIG_ETHADDR 00:50:C2:1E:AF:FC
|
||||
#define CONFIG_ETH1ADDR 00:50:C2:1E:AF:FB
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
|
||||
|
||||
|
||||
#undef CONFIG_EXT_PHY
|
||||
|
||||
#define CONFIG_MII 1 /* MII PHY management */
|
||||
#ifndef CONFIG_EXT_PHY
|
||||
#define CONFIG_PHY_ADDR 1 /* PHY address */
|
||||
#else
|
||||
#define CONFIG_PHY_ADDR 2 /* PHY address */
|
||||
#endif
|
||||
#define CONFIG_PHY_CLK_FREQ EMAC_STACR_CLK_66MHZ
|
||||
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_DATE | \
|
||||
CFG_CMD_ELF | \
|
||||
CFG_CMD_EEPROM | \
|
||||
CFG_CMD_I2C | \
|
||||
CFG_CMD_IRQ | \
|
||||
CFG_CMD_MII | \
|
||||
CFG_CMD_NAND | \
|
||||
CFG_CMD_JFFS2)
|
||||
|
||||
#define CONFIG_MAC_PARTITION
|
||||
#define CONFIG_DOS_PARTITION
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
|
||||
#define CONFIG_RTC_MC146818 /* DS1685 is MC146818 compatible*/
|
||||
#define CFG_RTC_REG_BASE_ADDR 0xF0000500 /* RTC Base Address */
|
||||
|
||||
#define CONFIG_SDRAM_BANK0 1 /* init onboard SDRAM bank 0 */
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "=> " /* Monitor Command Prompt */
|
||||
|
||||
#undef CFG_HUSH_PARSER /* use "hush" command parser */
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
#define CFG_PROMPT_HUSH_PS2 "> "
|
||||
#endif
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
|
||||
#define CFG_DEVICE_NULLDEV 1 /* include nulldev device */
|
||||
|
||||
#define CFG_CONSOLE_INFO_QUIET 1 /* don't print console @ startup*/
|
||||
|
||||
#define CFG_MEMTEST_START 0x0400000 /* memtest works on */
|
||||
#define CFG_MEMTEST_END 0x0C00000 /* 4 ... 12 MB in DRAM */
|
||||
|
||||
#undef CFG_EXT_SERIAL_CLOCK /* no external serial clock used */
|
||||
#define CFG_IGNORE_405_UART_ERRATA_59 /* ignore ppc405gp errata #59 */
|
||||
#define CFG_BASE_BAUD 691200
|
||||
|
||||
/* The following table includes the supported baudrates */
|
||||
#define CFG_BAUDRATE_TABLE \
|
||||
{ 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, \
|
||||
57600, 115200, 230400, 460800, 921600 }
|
||||
|
||||
#define CFG_LOAD_ADDR 0x100000 /* default load address */
|
||||
#define CFG_EXTBDINFO 1 /* To use extended board_into (bd_t) */
|
||||
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
#define CONFIG_ZERO_BOOTDELAY_CHECK /* check for keypress on bootdelay==0 */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* NAND-FLASH stuff
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
#define CFG_NAND0_BASE 0xFF400000
|
||||
#define CFG_NAND1_BASE 0xFF000000
|
||||
|
||||
/* For CATcenter there is only NAND on the module */
|
||||
#define CFG_MAX_NAND_DEVICE 1 /* Max number of NAND devices */
|
||||
#define SECTORSIZE 512
|
||||
#define NAND_NO_RB
|
||||
|
||||
#define ADDR_COLUMN 1
|
||||
#define ADDR_PAGE 2
|
||||
#define ADDR_COLUMN_PAGE 3
|
||||
|
||||
#define NAND_ChipID_UNKNOWN 0x00
|
||||
#define NAND_MAX_FLOORS 1
|
||||
#define NAND_MAX_CHIPS 1
|
||||
|
||||
#define CFG_NAND0_CE (0x80000000 >> 1) /* our CE is GPIO1 */
|
||||
#define CFG_NAND0_CLE (0x80000000 >> 2) /* our CLE is GPIO2 */
|
||||
#define CFG_NAND0_ALE (0x80000000 >> 3) /* our ALE is GPIO3 */
|
||||
#define CFG_NAND0_RDY (0x80000000 >> 4) /* our RDY is GPIO4 */
|
||||
|
||||
#define CFG_NAND1_CE (0x80000000 >> 14) /* our CE is GPIO14 */
|
||||
#define CFG_NAND1_CLE (0x80000000 >> 15) /* our CLE is GPIO15 */
|
||||
#define CFG_NAND1_ALE (0x80000000 >> 16) /* our ALE is GPIO16 */
|
||||
#define CFG_NAND1_RDY (0x80000000 >> 31) /* our RDY is GPIO31 */
|
||||
|
||||
|
||||
#define NAND_DISABLE_CE(nand) do \
|
||||
{ \
|
||||
switch((unsigned long)(((struct nand_chip *)nand)->IO_ADDR)) \
|
||||
{ \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND0_CE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND1_CE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define NAND_ENABLE_CE(nand) do \
|
||||
{ \
|
||||
switch((unsigned long)(((struct nand_chip *)nand)->IO_ADDR)) \
|
||||
{ \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND0_CE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND1_CE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define NAND_CTL_CLRALE(nandptr) do \
|
||||
{ \
|
||||
switch((unsigned long)nandptr) \
|
||||
{ \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND0_ALE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND1_ALE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_SETALE(nandptr) do \
|
||||
{ \
|
||||
switch((unsigned long)nandptr) \
|
||||
{ \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND0_ALE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND1_ALE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_CLRCLE(nandptr) do \
|
||||
{ \
|
||||
switch((unsigned long)nandptr) \
|
||||
{ \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND0_CLE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_NAND1_CLE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define NAND_CTL_SETCLE(nandptr) do { \
|
||||
switch((unsigned long)nandptr) { \
|
||||
case CFG_NAND0_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND0_CLE); \
|
||||
break; \
|
||||
case CFG_NAND1_BASE: \
|
||||
out32(GPIO0_OR, in32(GPIO0_OR) | CFG_NAND1_CLE); \
|
||||
break; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#ifdef NAND_NO_RB
|
||||
/* constant delay (see also tR in the datasheet) */
|
||||
#define NAND_WAIT_READY(nand) do { \
|
||||
udelay(12); \
|
||||
} while (0)
|
||||
#else
|
||||
/* use the R/B pin */
|
||||
/* TBD */
|
||||
#endif
|
||||
|
||||
#define WRITE_NAND_COMMAND(d, adr) do{ *(volatile __u8 *)((unsigned long)adr) = (__u8)(d); } while(0)
|
||||
#define WRITE_NAND_ADDRESS(d, adr) do{ *(volatile __u8 *)((unsigned long)adr) = (__u8)(d); } while(0)
|
||||
#define WRITE_NAND(d, adr) do{ *(volatile __u8 *)((unsigned long)adr) = (__u8)d; } while(0)
|
||||
#define READ_NAND(adr) ((volatile unsigned char)(*(volatile __u8 *)(unsigned long)adr))
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* PCI stuff
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
#if 0 /* No PCI on CATcenter */
|
||||
#define PCI_HOST_ADAPTER 0 /* configure as pci adapter */
|
||||
#define PCI_HOST_FORCE 1 /* configure as pci host */
|
||||
#define PCI_HOST_AUTO 2 /* detected via arbiter enable */
|
||||
|
||||
#define CONFIG_PCI /* include pci support */
|
||||
#define CONFIG_PCI_HOST PCI_HOST_FORCE /* select pci host function */
|
||||
#undef CONFIG_PCI_PNP /* do pci plug-and-play */
|
||||
/* resource configuration */
|
||||
|
||||
#define CONFIG_PCI_SCAN_SHOW /* print pci devices @ startup */
|
||||
|
||||
#define CFG_PCI_SUBSYS_VENDORID 0x12FE /* PCI Vendor ID: esd gmbh */
|
||||
#define CFG_PCI_SUBSYS_DEVICEID 0x0405 /* PCI Device ID: CPCI-405 */
|
||||
#define CFG_PCI_CLASSCODE 0x0b20 /* PCI Class Code: Processor/PPC*/
|
||||
#define CFG_PCI_PTM1LA 0x00000000 /* point to sdram */
|
||||
#define CFG_PCI_PTM1MS 0xfc000001 /* 64MB, enable hard-wired to 1 */
|
||||
#define CFG_PCI_PTM1PCI 0x00000000 /* Host: use this pci address */
|
||||
#define CFG_PCI_PTM2LA 0xffc00000 /* point to flash */
|
||||
#define CFG_PCI_PTM2MS 0xffc00001 /* 4MB, enable */
|
||||
#define CFG_PCI_PTM2PCI 0x04000000 /* Host: use this pci address */
|
||||
#endif /* No PCI */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_FLASH_BASE 0xFFFC0000
|
||||
#define CFG_MONITOR_BASE CFG_FLASH_BASE
|
||||
#define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Monitor */
|
||||
#define CFG_MALLOC_LEN (256 * 1024) /* Reserve 256 kB for malloc() */
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#define CFG_MAX_FLASH_SECT 256 /* max number of sectors on one chip */
|
||||
|
||||
#define CFG_FLASH_ERASE_TOUT 120000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 1000 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
#define CFG_FLASH_WORD_SIZE unsigned short /* flash word size (width) */
|
||||
#define CFG_FLASH_ADDR0 0x5555 /* 1st address for flash config cycles */
|
||||
#define CFG_FLASH_ADDR1 0x2AAA /* 2nd address for flash config cycles */
|
||||
/*
|
||||
* The following defines are added for buggy IOP480 byte interface.
|
||||
* All other boards should use the standard values (CPCI405 etc.)
|
||||
*/
|
||||
#define CFG_FLASH_READ0 0x0000 /* 0 is standard */
|
||||
#define CFG_FLASH_READ1 0x0001 /* 1 is standard */
|
||||
#define CFG_FLASH_READ2 0x0002 /* 2 is standard */
|
||||
|
||||
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on flinfo */
|
||||
|
||||
#if 0 /* test-only */
|
||||
#define CFG_JFFS2_FIRST_BANK 0 /* use for JFFS2 */
|
||||
#define CFG_JFFS2_NUM_BANKS 1 /* ! second bank contains U-Boot */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Environment Variable setup
|
||||
*/
|
||||
#define CFG_ENV_IS_IN_FLASH 1 /* use FLASH for environment vars */
|
||||
#define CFG_ENV_ADDR 0xFFFF8000 /* environment starts at the first small sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x2000 /* 8196 bytes may be used for env vars*/
|
||||
#define CFG_ENV_ADDR_REDUND 0xFFFFA000
|
||||
#define CFG_ENV_SIZE_REDUND 0x2000
|
||||
|
||||
#define CFG_NVRAM_BASE_ADDR 0xF0000500 /* NVRAM base address */
|
||||
#define CFG_NVRAM_SIZE 242 /* NVRAM size */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* I2C EEPROM (CAT24WC16) for environment
|
||||
*/
|
||||
#define CONFIG_HARD_I2C /* I2c with hardware support */
|
||||
#define CFG_I2C_SPEED 400000 /* I2C speed and slave address */
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
|
||||
#define CFG_I2C_EEPROM_ADDR 0x50 /* EEPROM CAT28WC08 */
|
||||
#define CFG_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */
|
||||
/* mask of address bits that overflow into the "EEPROM chip address" */
|
||||
/*#define CFG_I2C_EEPROM_ADDR_OVERFLOW 0x07*/
|
||||
#define CFG_EEPROM_PAGE_WRITE_BITS 4 /* The Catalyst CAT24WC08 has */
|
||||
/* 16 byte page write mode using*/
|
||||
/* last 4 bits of the address */
|
||||
#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10 /* and takes up to 10 msec */
|
||||
#define CFG_EEPROM_PAGE_WRITE_ENABLE
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Cache Configuration
|
||||
*/
|
||||
#define CFG_DCACHE_SIZE 16384 /* For IBM 405 CPUs, older 405 ppc's */
|
||||
/* have only 8kB, 16kB is save here */
|
||||
#define CFG_CACHELINE_SIZE 32 /* ... */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Init Memory Controller:
|
||||
*
|
||||
* BR0/1 and OR0/1 (FLASH)
|
||||
*/
|
||||
|
||||
#define FLASH_BASE0_PRELIM 0xFFC00000 /* FLASH bank #0 */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* External Bus Controller (EBC) Setup
|
||||
*/
|
||||
|
||||
/* Memory Bank 0 (Flash Bank 0, NOR-FLASH) initialization */
|
||||
#define CFG_EBC_PB0AP 0x92015480
|
||||
#define CFG_EBC_PB0CR 0xFFC5A000 /* BAS=0xFFC,BS=4MB,BU=R/W,BW=16bit */
|
||||
|
||||
/* Memory Bank 1 (External SRAM) initialization */
|
||||
/* Since this must replace NOR Flash, we use the same settings for CS0 */
|
||||
#define CFG_EBC_PB1AP 0x92015480
|
||||
#define CFG_EBC_PB1CR 0xFF85A000 /* BAS=0xFF8,BS=4MB,BU=R/W,BW=8bit */
|
||||
|
||||
/* Memory Bank 2 (Flash Bank 1, NAND-FLASH) initialization */
|
||||
#define CFG_EBC_PB2AP 0x92015480
|
||||
#define CFG_EBC_PB2CR 0xFF458000 /* BAS=0xFF4,BS=4MB,BU=R/W,BW=8bit */
|
||||
|
||||
/* Memory Bank 3 (Flash Bank 2, NAND-FLASH) initialization */
|
||||
#define CFG_EBC_PB3AP 0x92015480
|
||||
#define CFG_EBC_PB3CR 0xFF058000 /* BAS=0xFF0,BS=4MB,BU=R/W,BW=8bit */
|
||||
|
||||
|
||||
#if 0 /* Roese */
|
||||
/* Memory Bank 1 (Flash Bank 1, NAND-FLASH) initialization */
|
||||
#define CFG_EBC_PB1AP 0x92015480
|
||||
#define CFG_EBC_PB1CR 0xFF858000 /* BAS=0xFF8,BS=4MB,BU=R/W,BW=8bit */
|
||||
|
||||
/* Memory Bank 2 (CAN0, 1) initialization */
|
||||
#define CFG_EBC_PB2AP 0x010053C0 /* BWT=2,WBN=1,WBF=1,TH=1,RE=1,SOR=1,BEM=1 */
|
||||
#define CFG_EBC_PB2CR 0xF0018000 /* BAS=0xF00,BS=1MB,BU=R/W,BW=8bit */
|
||||
|
||||
/* Memory Bank 3 (CompactFlash IDE) initialization */
|
||||
#define CFG_EBC_PB3AP 0x010053C0 /* BWT=2,WBN=1,WBF=1,TH=1,RE=1,SOR=1,BEM=1 */
|
||||
#define CFG_EBC_PB3CR 0xF011A000 /* BAS=0xF01,BS=1MB,BU=R/W,BW=16bit */
|
||||
|
||||
/* Memory Bank 4 (NVRAM/RTC) initialization */
|
||||
#define CFG_EBC_PB4AP 0x01005280 /* TWT=2,WBN=1,WBF=1,TH=1,SOR=1 */
|
||||
#define CFG_EBC_PB4CR 0xF0218000 /* BAS=0xF02,BS=1MB,BU=R/W,BW=8bit */
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FPGA stuff
|
||||
*/
|
||||
/* FPGA internal regs */
|
||||
#define CFG_FPGA_MODE 0x00
|
||||
#define CFG_FPGA_STATUS 0x02
|
||||
#define CFG_FPGA_TS 0x04
|
||||
#define CFG_FPGA_TS_LOW 0x06
|
||||
#define CFG_FPGA_TS_CAP0 0x10
|
||||
#define CFG_FPGA_TS_CAP0_LOW 0x12
|
||||
#define CFG_FPGA_TS_CAP1 0x14
|
||||
#define CFG_FPGA_TS_CAP1_LOW 0x16
|
||||
#define CFG_FPGA_TS_CAP2 0x18
|
||||
#define CFG_FPGA_TS_CAP2_LOW 0x1a
|
||||
#define CFG_FPGA_TS_CAP3 0x1c
|
||||
#define CFG_FPGA_TS_CAP3_LOW 0x1e
|
||||
|
||||
/* FPGA Mode Reg */
|
||||
#define CFG_FPGA_MODE_CF_RESET 0x0001
|
||||
#define CFG_FPGA_MODE_TS_IRQ_ENABLE 0x0100
|
||||
#define CFG_FPGA_MODE_TS_IRQ_CLEAR 0x1000
|
||||
#define CFG_FPGA_MODE_TS_CLEAR 0x2000
|
||||
|
||||
/* FPGA Status Reg */
|
||||
#define CFG_FPGA_STATUS_DIP0 0x0001
|
||||
#define CFG_FPGA_STATUS_DIP1 0x0002
|
||||
#define CFG_FPGA_STATUS_DIP2 0x0004
|
||||
#define CFG_FPGA_STATUS_FLASH 0x0008
|
||||
#define CFG_FPGA_STATUS_TS_IRQ 0x1000
|
||||
|
||||
#define CFG_FPGA_SPARTAN2 1 /* using Xilinx Spartan 2 now */
|
||||
#define CFG_FPGA_MAX_SIZE 128*1024 /* 128kByte is enough for XC2S50E*/
|
||||
|
||||
/* FPGA program pin configuration */
|
||||
#define CFG_FPGA_PRG 0x04000000 /* FPGA program pin (ppc output) */
|
||||
#define CFG_FPGA_CLK 0x02000000 /* FPGA clk pin (ppc output) */
|
||||
#define CFG_FPGA_DATA 0x01000000 /* FPGA data pin (ppc output) */
|
||||
#define CFG_FPGA_INIT 0x00010000 /* FPGA init pin (ppc input) */
|
||||
#define CFG_FPGA_DONE 0x00008000 /* FPGA done pin (ppc input) */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Definitions for initial stack pointer and data area (in data cache)
|
||||
*/
|
||||
/* use on chip memory ( OCM ) for temperary stack until sdram is tested */
|
||||
#define CFG_TEMP_STACK_OCM 1
|
||||
|
||||
/* On Chip Memory location */
|
||||
#define CFG_OCM_DATA_ADDR 0xF8000000
|
||||
#define CFG_OCM_DATA_SIZE 0x1000
|
||||
#define CFG_INIT_RAM_ADDR CFG_OCM_DATA_ADDR /* inside of SDRAM */
|
||||
#define CFG_INIT_RAM_END CFG_OCM_DATA_SIZE /* End of used area in RAM */
|
||||
|
||||
#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Definitions for GPIO setup (PPC405EP specific)
|
||||
*
|
||||
* GPIO0[0] - External Bus Controller BLAST output
|
||||
* GPIO0[1-9] - Instruction trace outputs -> GPIO
|
||||
* GPIO0[10-13] - External Bus Controller CS_1 - CS_4 outputs
|
||||
* GPIO0[14-16] - External Bus Controller ABUS3-ABUS5 outputs -> GPIO
|
||||
* GPIO0[17-23] - External Interrupts IRQ0 - IRQ6 inputs
|
||||
* GPIO0[24-27] - UART0 control signal inputs/outputs
|
||||
* GPIO0[28-29] - UART1 data signal input/output
|
||||
* GPIO0[30] - EMAC0 input
|
||||
* GPIO0[31] - EMAC1 reject packet as output
|
||||
*/
|
||||
#define CFG_GPIO0_OSRH 0x40000550
|
||||
#define CFG_GPIO0_OSRL 0x00000110
|
||||
#define CFG_GPIO0_ISR1H 0x00000000
|
||||
/*#define CFG_GPIO0_ISR1L 0x15555445*/
|
||||
#define CFG_GPIO0_ISR1L 0x15555444
|
||||
#define CFG_GPIO0_TSRH 0x00000000
|
||||
#define CFG_GPIO0_TSRL 0x00000000
|
||||
#define CFG_GPIO0_TCR 0xF7FF8014
|
||||
|
||||
/*
|
||||
* Internal Definitions
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
|
||||
#define CONFIG_NO_SERIAL_EEPROM
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
#ifdef CONFIG_NO_SERIAL_EEPROM
|
||||
|
||||
/*
|
||||
!-----------------------------------------------------------------------
|
||||
! Defines for entry options.
|
||||
! Note: Because the 405EP SDRAM controller does not support ECC, ECC DIMMs that
|
||||
! are plugged in the board will be utilized as non-ECC DIMMs.
|
||||
!-----------------------------------------------------------------------
|
||||
*/
|
||||
#undef AUTO_MEMORY_CONFIG
|
||||
#define DIMM_READ_ADDR 0xAB
|
||||
#define DIMM_WRITE_ADDR 0xAA
|
||||
|
||||
|
||||
#define CPC0_PLLMR0 (CNTRL_DCR_BASE+0x0) /* PLL mode 0 register */
|
||||
#define CPC0_BOOT (CNTRL_DCR_BASE+0x1) /* Chip Clock Status register */
|
||||
#define CPC0_CR1 (CNTRL_DCR_BASE+0x2) /* Chip Control 1 register */
|
||||
#define CPC0_EPRCSR (CNTRL_DCR_BASE+0x3) /* EMAC PHY Rcv Clk Src register */
|
||||
#define CPC0_PLLMR1 (CNTRL_DCR_BASE+0x4) /* PLL mode 1 register */
|
||||
#define CPC0_UCR (CNTRL_DCR_BASE+0x5) /* UART Control register */
|
||||
#define CPC0_SRR (CNTRL_DCR_BASE+0x6) /* Soft Reset register */
|
||||
#define CPC0_JTAGID (CNTRL_DCR_BASE+0x7) /* JTAG ID register */
|
||||
#define CPC0_SPARE (CNTRL_DCR_BASE+0x8) /* Spare DCR */
|
||||
#define CPC0_PCI (CNTRL_DCR_BASE+0x9) /* PCI Control register */
|
||||
|
||||
/* Defines for CPC0_PLLMR1 Register fields */
|
||||
#define PLL_ACTIVE 0x80000000
|
||||
#define CPC0_PLLMR1_SSCS 0x80000000
|
||||
#define PLL_RESET 0x40000000
|
||||
#define CPC0_PLLMR1_PLLR 0x40000000
|
||||
/* Feedback multiplier */
|
||||
#define PLL_FBKDIV 0x00F00000
|
||||
#define CPC0_PLLMR1_FBDV 0x00F00000
|
||||
#define PLL_FBKDIV_16 0x00000000
|
||||
#define PLL_FBKDIV_1 0x00100000
|
||||
#define PLL_FBKDIV_2 0x00200000
|
||||
#define PLL_FBKDIV_3 0x00300000
|
||||
#define PLL_FBKDIV_4 0x00400000
|
||||
#define PLL_FBKDIV_5 0x00500000
|
||||
#define PLL_FBKDIV_6 0x00600000
|
||||
#define PLL_FBKDIV_7 0x00700000
|
||||
#define PLL_FBKDIV_8 0x00800000
|
||||
#define PLL_FBKDIV_9 0x00900000
|
||||
#define PLL_FBKDIV_10 0x00A00000
|
||||
#define PLL_FBKDIV_11 0x00B00000
|
||||
#define PLL_FBKDIV_12 0x00C00000
|
||||
#define PLL_FBKDIV_13 0x00D00000
|
||||
#define PLL_FBKDIV_14 0x00E00000
|
||||
#define PLL_FBKDIV_15 0x00F00000
|
||||
/* Forward A divisor */
|
||||
#define PLL_FWDDIVA 0x00070000
|
||||
#define CPC0_PLLMR1_FWDVA 0x00070000
|
||||
#define PLL_FWDDIVA_8 0x00000000
|
||||
#define PLL_FWDDIVA_7 0x00010000
|
||||
#define PLL_FWDDIVA_6 0x00020000
|
||||
#define PLL_FWDDIVA_5 0x00030000
|
||||
#define PLL_FWDDIVA_4 0x00040000
|
||||
#define PLL_FWDDIVA_3 0x00050000
|
||||
#define PLL_FWDDIVA_2 0x00060000
|
||||
#define PLL_FWDDIVA_1 0x00070000
|
||||
/* Forward B divisor */
|
||||
#define PLL_FWDDIVB 0x00007000
|
||||
#define CPC0_PLLMR1_FWDVB 0x00007000
|
||||
#define PLL_FWDDIVB_8 0x00000000
|
||||
#define PLL_FWDDIVB_7 0x00001000
|
||||
#define PLL_FWDDIVB_6 0x00002000
|
||||
#define PLL_FWDDIVB_5 0x00003000
|
||||
#define PLL_FWDDIVB_4 0x00004000
|
||||
#define PLL_FWDDIVB_3 0x00005000
|
||||
#define PLL_FWDDIVB_2 0x00006000
|
||||
#define PLL_FWDDIVB_1 0x00007000
|
||||
/* PLL tune bits */
|
||||
#define PLL_TUNE_MASK 0x000003FF
|
||||
#define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
|
||||
#define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
|
||||
#define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
|
||||
#define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
|
||||
#define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
|
||||
#define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
|
||||
#define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
|
||||
|
||||
/* Defines for CPC0_PLLMR0 Register fields */
|
||||
/* CPU divisor */
|
||||
#define PLL_CPUDIV 0x00300000
|
||||
#define CPC0_PLLMR0_CCDV 0x00300000
|
||||
#define PLL_CPUDIV_1 0x00000000
|
||||
#define PLL_CPUDIV_2 0x00100000
|
||||
#define PLL_CPUDIV_3 0x00200000
|
||||
#define PLL_CPUDIV_4 0x00300000
|
||||
/* PLB divisor */
|
||||
#define PLL_PLBDIV 0x00030000
|
||||
#define CPC0_PLLMR0_CBDV 0x00030000
|
||||
#define PLL_PLBDIV_1 0x00000000
|
||||
#define PLL_PLBDIV_2 0x00010000
|
||||
#define PLL_PLBDIV_3 0x00020000
|
||||
#define PLL_PLBDIV_4 0x00030000
|
||||
/* OPB divisor */
|
||||
#define PLL_OPBDIV 0x00003000
|
||||
#define CPC0_PLLMR0_OPDV 0x00003000
|
||||
#define PLL_OPBDIV_1 0x00000000
|
||||
#define PLL_OPBDIV_2 0x00001000
|
||||
#define PLL_OPBDIV_3 0x00002000
|
||||
#define PLL_OPBDIV_4 0x00003000
|
||||
/* EBC divisor */
|
||||
#define PLL_EXTBUSDIV 0x00000300
|
||||
#define CPC0_PLLMR0_EPDV 0x00000300
|
||||
#define PLL_EXTBUSDIV_2 0x00000000
|
||||
#define PLL_EXTBUSDIV_3 0x00000100
|
||||
#define PLL_EXTBUSDIV_4 0x00000200
|
||||
#define PLL_EXTBUSDIV_5 0x00000300
|
||||
/* MAL divisor */
|
||||
#define PLL_MALDIV 0x00000030
|
||||
#define CPC0_PLLMR0_MPDV 0x00000030
|
||||
#define PLL_MALDIV_1 0x00000000
|
||||
#define PLL_MALDIV_2 0x00000010
|
||||
#define PLL_MALDIV_3 0x00000020
|
||||
#define PLL_MALDIV_4 0x00000030
|
||||
/* PCI divisor */
|
||||
#define PLL_PCIDIV 0x00000003
|
||||
#define CPC0_PLLMR0_PPFD 0x00000003
|
||||
#define PLL_PCIDIV_1 0x00000000
|
||||
#define PLL_PCIDIV_2 0x00000001
|
||||
#define PLL_PCIDIV_3 0x00000002
|
||||
#define PLL_PCIDIV_4 0x00000003
|
||||
|
||||
/* CPU - PLB/SDRAM - EBC - OPB - PCI (assuming a 33.3MHz input clock to the 405EP) */
|
||||
#define PLLMR0_133_133_33_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
|
||||
PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
|
||||
PLL_MALDIV_1 | PLL_PCIDIV_4)
|
||||
#define PLLMR1_133_133_33_66_33 (PLL_FBKDIV_4 | \
|
||||
PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
|
||||
PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
|
||||
#define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
|
||||
PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
|
||||
PLL_MALDIV_1 | PLL_PCIDIV_4)
|
||||
#define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
|
||||
PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
|
||||
PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
|
||||
#define PLLMR0_266_133_33_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
|
||||
PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
|
||||
PLL_MALDIV_1 | PLL_PCIDIV_4)
|
||||
#define PLLMR1_266_133_33_66_33 (PLL_FBKDIV_8 | \
|
||||
PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
|
||||
PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
|
||||
#define PLLMR0_333_111_37_55_55 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
|
||||
PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
|
||||
PLL_MALDIV_1 | PLL_PCIDIV_2)
|
||||
#define PLLMR1_333_111_37_55_55 (PLL_FBKDIV_10 | \
|
||||
PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
|
||||
PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
|
||||
|
||||
#if (CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_HI)
|
||||
/* Model HI */
|
||||
#define PLLMR0_DEFAULT PLLMR0_333_111_37_55_55
|
||||
#define PLLMR1_DEFAULT PLLMR1_333_111_37_55_55
|
||||
/* Model ME */
|
||||
#elif (CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_ME)
|
||||
#define PLLMR0_DEFAULT PLLMR0_266_133_33_66_33
|
||||
#define PLLMR1_DEFAULT PLLMR1_266_133_33_66_33
|
||||
#else
|
||||
/* Model BA (default) */
|
||||
#define PLLMR0_DEFAULT PLLMR0_133_133_33_66_33
|
||||
#define PLLMR1_DEFAULT PLLMR1_133_133_33_66_33
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NO_SERIAL_EEPROM */
|
||||
|
||||
#define CONFIG_JFFS2_NAND 1 /* jffs2 on nand support */
|
||||
#define CONFIG_JFFS2_NAND_DEV 0 /* nand device jffs2 lives on */
|
||||
#define CONFIG_JFFS2_NAND_OFF 0 /* start of jffs2 partition */
|
||||
#define CONFIG_JFFS2_NAND_SIZE 2*1024*1024 /* size of jffs2 partition */
|
||||
#define NAND_CACHE_PAGES 16 /* size of nand cache in 512 bytes pages */
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
@@ -471,6 +471,7 @@
|
||||
CFG_CMD_MII | \
|
||||
CFG_CMD_PCI | \
|
||||
CFG_CMD_PCMCIA | \
|
||||
CFG_CMD_REISER | \
|
||||
CFG_CMD_SCSI | \
|
||||
CFG_CMD_SPI | \
|
||||
CFG_CMD_VFD | \
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
/* watchdog disabled */
|
||||
#undef CONFIG_WATCHDOG
|
||||
/* SPD EEPROM (sdram speed config) disabled */
|
||||
#undef CONFIG_SPD_EEPRO
|
||||
#undef CONFIG_SPD_EEPROM
|
||||
#undef SPD_EEPROM_ADDRESS
|
||||
|
||||
/*
|
||||
|
||||
+75
-17
@@ -72,8 +72,8 @@
|
||||
"contrast=55\0" \
|
||||
"silent=1\0" \
|
||||
"load=tftp 200000 bootloader-4k.bitmap;tftp 100000 bootloader-4k.bin\0" \
|
||||
"update=protect off 1:0-5;era 1:0-5;cp.b 100000 40000000 $(filesize);" \
|
||||
"cp.b 200000 40040000 14000\0"
|
||||
"update=protect off 1:0-7;era 1:0-7;cp.b 100000 40000000 $(filesize);" \
|
||||
"cp.b 200000 40050000 14000\0"
|
||||
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"run slot_a_boot;run slot_b_boot;run nfs_boot;run panic_boot"
|
||||
@@ -85,7 +85,7 @@
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#undef CFG_LOADS_BAUD_CHANGE /* don't allow baudrate change */
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
#define CONFIG_WATCHDOG 1 /* watchdog enabled */
|
||||
|
||||
#define CONFIG_STATUS_LED 1 /* Status LED enabled */
|
||||
|
||||
@@ -96,23 +96,81 @@
|
||||
#define CONFIG_MAC_PARTITION
|
||||
#define CONFIG_DOS_PARTITION
|
||||
|
||||
#define CONFIG_RTC_MPC8xx /* use internal RTC of MPC8xx */
|
||||
|
||||
#define CONFIG_HARD_I2C
|
||||
#define CFG_I2C_SPEED 40000
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
/*
|
||||
* enable I2C and select the hardware/software driver
|
||||
*/
|
||||
#undef CONFIG_HARD_I2C /* I2C with hardware support */
|
||||
#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */
|
||||
|
||||
#define CONFIG_ETHADDR 00:0B:64:00:00:00 /* our OUI from IEEE */
|
||||
#define CONFIG_KUP4K_LOGO 0x40040000 /* Address of logo bitmap */
|
||||
#define CFG_I2C_SPEED 93000 /* 93 kHz is supposed to work */
|
||||
#define CFG_I2C_SLAVE 0xFE
|
||||
|
||||
#ifdef CONFIG_SOFT_I2C
|
||||
/*
|
||||
* Software (bit-bang) I2C driver configuration
|
||||
*/
|
||||
#define PB_SCL 0x00000020 /* PB 26 */
|
||||
#define PB_SDA 0x00000010 /* PB 27 */
|
||||
|
||||
#define I2C_INIT (immr->im_cpm.cp_pbdir |= PB_SCL)
|
||||
#define I2C_ACTIVE (immr->im_cpm.cp_pbdir |= PB_SDA)
|
||||
#define I2C_TRISTATE (immr->im_cpm.cp_pbdir &= ~PB_SDA)
|
||||
#define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)
|
||||
#define I2C_SDA(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SDA
|
||||
#define I2C_SCL(bit) if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
|
||||
else immr->im_cpm.cp_pbdat &= ~PB_SCL
|
||||
#define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */
|
||||
#endif /* CONFIG_SOFT_I2C */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* I2C Configuration
|
||||
*/
|
||||
|
||||
#define CFG_I2C_PICIO_ADDR 0x21 /* PCF8574 IO Expander */
|
||||
#define CFG_I2C_RTC_ADDR 0x51 /* PCF8563 RTC */
|
||||
|
||||
|
||||
/* List of I2C addresses to be verified by POST */
|
||||
|
||||
#define I2C_ADDR_LIST {CFG_I2C_PICIO_ADDR, \
|
||||
CFG_I2C_RTC_ADDR, \
|
||||
}
|
||||
|
||||
|
||||
#define CONFIG_RTC_PCF8563 /* use Philips PCF8563 RTC */
|
||||
|
||||
#define CFG_DISCOVER_PHY
|
||||
|
||||
#if 0
|
||||
#define CONFIG_ETHADDR 00:0B:64:00:00:00 /* our OUI from IEEE */
|
||||
#endif
|
||||
#define CONFIG_KUP4K_LOGO 0x40050000 /* Address of logo bitmap */
|
||||
|
||||
/* Define to allow the user to overwrite serial and ethaddr */
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
#if 1
|
||||
/* POST support */
|
||||
|
||||
#define CONFIG_POST (CFG_POST_CPU | \
|
||||
CFG_POST_RTC | \
|
||||
CFG_POST_I2C)
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
#define CFG_CMD_POST_DIAG CFG_CMD_DIAG
|
||||
#else
|
||||
#define CFG_CMD_POST_DIAG 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_IDE | \
|
||||
CFG_CMD_I2C | \
|
||||
CFG_CMD_DATE )
|
||||
CFG_CMD_DATE | \
|
||||
CFG_CMD_POST_DIAG | \
|
||||
CFG_CMD_IDE )
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
@@ -189,7 +247,7 @@
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_OFFSET 0x30000 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_OFFSET 0x40000 /* Offset of Environment Sector */
|
||||
#define CFG_ENV_SIZE 0x1000 /* Total Size of Environment Sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x10000
|
||||
|
||||
@@ -201,10 +259,10 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
* Hardware Information Block
|
||||
*/
|
||||
#if 0
|
||||
#define CFG_HWINFO_OFFSET 0x0003FFC0 /* offset of HW Info block */
|
||||
#define CFG_HWINFO_SIZE 0x00000040 /* size of HW Info block */
|
||||
#define CFG_HWINFO_MAGIC 0x54514D38 /* 'TQM8' */
|
||||
#if 1
|
||||
#define CFG_HWINFO_OFFSET 0x000F0000 /* offset of HW Info block */
|
||||
#define CFG_HWINFO_SIZE 0x00000100 /* size of HW Info block */
|
||||
#define CFG_HWINFO_MAGIC 0x4B26500D /* 'K&P<CR>' */
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------
|
||||
* Cache Configuration
|
||||
@@ -220,7 +278,7 @@
|
||||
*-----------------------------------------------------------------------
|
||||
* Software & Bus Monitor Timer max, Bus Monitor enable, SW Watchdog freeze
|
||||
*/
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
#if 0 && defined(CONFIG_WATCHDOG) /* KUP uses external TPS3705 WD */
|
||||
#define CFG_SYPCR (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | \
|
||||
SYPCR_SWE | SYPCR_SWRI| SYPCR_SWP)
|
||||
#else
|
||||
|
||||
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user