Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0ff7f2eda | ||
|
|
4a5517094d | ||
|
|
54387ac931 | ||
|
|
fc3e2165ef | ||
|
|
ef1464cc01 | ||
|
|
d9a405aaf6 | ||
|
|
147031aef1 | ||
|
|
887b372f5d | ||
|
|
fbe4b5cbde | ||
|
|
bb65a31267 | ||
|
|
88a1bfa8b8 | ||
|
|
cad07371fc | ||
|
|
ab209d5107 | ||
|
|
87970ebeb5 | ||
|
|
8a42eac744 | ||
|
|
91e940d9bc | ||
|
|
29127b6a23 | ||
|
|
1d70468b03 | ||
|
|
c3d98ed9ca | ||
|
|
80369866a4 | ||
|
|
65bd0e284b | ||
|
|
206c60cbea | ||
|
|
5f535fe170 | ||
|
|
b0639ca332 | ||
|
|
f54ebdfa28 |
No files matched your search
@@ -2,6 +2,119 @@
|
||||
Changes for U-Boot 1.0.0:
|
||||
======================================================================
|
||||
|
||||
* Patch by Martin Krause, 09 Oct 2003:
|
||||
Fixes for TRAB board
|
||||
- /board/trab/rs485.c: correct baudrate
|
||||
- /board/trab/cmd_trab.c: bug fix for problem with timer overflow in
|
||||
udelay(); fix some timing problems with adc controller
|
||||
- /board/trab/trab_fkt.c: add new commands: gain, eeprom and power;
|
||||
modify commands: touch and buzzer
|
||||
|
||||
* Disable CONFIG_SUPPORT_VFAT when used with CONFIG_AUTO_UPDATE
|
||||
(quick & dirty workaround for rogue pointer problem in get_vfatname());
|
||||
Use direct function calls for auto_update instead of hush commands
|
||||
|
||||
* Patch by Scott McNutt, 04 Oct 2003:
|
||||
- add support for Altera Nios-32 CPU
|
||||
- add support for Nios Cyclone Development Kit (DK-1C20)
|
||||
|
||||
* Patch by Steven Scholz, 29 Sep 2003:
|
||||
- A second parameter for bootm overwrites the load address for
|
||||
"Standalone Application" images.
|
||||
- bootm sets environment variable "filesize" to the resulting
|
||||
(uncompressed) data length for "Standalone Application" images
|
||||
when autostart is set to "no". Now you can do something like
|
||||
if bootm $fpgadata $some_free_ram ; then
|
||||
fpga load 0 $some_free_ram $filesize
|
||||
fi
|
||||
|
||||
* Patch by Denis Peter, 25 Sept 2003:
|
||||
add support for the MIP405 Rev. C board
|
||||
|
||||
* Patch by Yuli Barcohen, 25 Sep 2003:
|
||||
add support for Zephyr Engineering ZPC.1900 board
|
||||
|
||||
* Patch by Anders Larsen, 23 Sep 2003:
|
||||
add CMD_PORTIO to CFG_CMD_NONSTD (commands in question are only
|
||||
implemented for the x86 architecture)
|
||||
|
||||
* Patch by Sangmoon Kim, 23 Sep 2003:
|
||||
fix pll_pci_to_mem_multiplier table for MPC8245
|
||||
|
||||
* Patch by Anders Larsen, 22 Sep 2003:
|
||||
enable timed autoboot on PXA
|
||||
|
||||
* Patch by David Müller, 22 Sep 2003:
|
||||
- add $(CFLAGS) to "-print-libgcc-filename" so compiler driver
|
||||
returns correct libgcc file path
|
||||
- "latency" reduction of busy-loop waiting to improve "U-Boot" boot
|
||||
time on s3c24x0 systems
|
||||
|
||||
* Patch by Jon Diekema, 19 Sep 2003:
|
||||
- Add CFG_FAULT_ECHO_LINK_DOWN option to echo the inverted Ethernet
|
||||
link state to the fault LED.
|
||||
- In NetLoop, make the Fault LED reflect the link status. The link
|
||||
status gets updated on entry, and on timeouts.
|
||||
|
||||
* Patch by Anders Larsen, 18 Sep 2003:
|
||||
allow mkimage to build and run on Cygwin-hosted systems
|
||||
|
||||
* Patch by Frank Müller, 18 Sep 2003:
|
||||
use bi_intfreq instead of bi_busfreq to compute fec_mii_speed in
|
||||
cpu/mpc8xx/fec.c
|
||||
|
||||
* Patch by Pantelis Antoniou, 16 Sep 2003:
|
||||
add tool to compute fileds in the PLPRCR register for MPC86x
|
||||
|
||||
* Use IH_TYPE_FILESYSTEM for TRAB "disk" images.
|
||||
|
||||
* Fix build problems under FreeBSD
|
||||
|
||||
* Add generic filesystem image type
|
||||
|
||||
* Make fatload set filesize environment variable
|
||||
|
||||
* enable basic / medium / high-end configurations for PPChameleonEVB
|
||||
board; fix NAND code
|
||||
|
||||
* enable TFTP client code to specify to the server the desired
|
||||
timeout value (see RFC-2349)
|
||||
|
||||
* Improve SDRAM setup for TRAB board
|
||||
|
||||
* Suppress all output with splashscreen configured only if "splashimage"
|
||||
is set
|
||||
|
||||
* Fix problems with I2C support for mpc5200
|
||||
|
||||
* Adapt TRAB configuration and auto_update to new memory layout
|
||||
|
||||
* Add configuration for wtk board
|
||||
|
||||
* Add support for the Sharp LQ065T9DR51U LCD display
|
||||
|
||||
* Patch by Rune Torgersen, 17 Sep 2003:
|
||||
- Fixes for MPC8266 default config
|
||||
- Allow eth_loopback_test() on 8260 to use a subset of the FCC's
|
||||
|
||||
* Patches by Jon Diekema, 17 Sep 2003:
|
||||
- update README (SHOW_BOOT_PROGRESS values for cmd_nand.c and
|
||||
env_common.c)
|
||||
- sbc8260 tweaks
|
||||
- adjust "help" output
|
||||
|
||||
* Patches by Anders Larsen, 17 Sep 2003:
|
||||
- fix spelling errors
|
||||
- set GD_FLG_DEVINIT flag only after device function pointers
|
||||
are valid
|
||||
- Allow CFG_ALT_MEMTEST on systems where address zero isn't
|
||||
writeable
|
||||
- enable 3.rd UART (ST-UART) on PXA(XScale) CPUs
|
||||
- trigger watchdog while waiting in serial driver
|
||||
|
||||
* Add auto-update code for TRAB board using USB memory sticks,
|
||||
support new configuration with more memory
|
||||
|
||||
* disable MPC5200 bus pipelining as workaround for bus contention
|
||||
|
||||
* Modify XLB arbiter priorities on MPC5200 so all devices use same
|
||||
@@ -63,6 +176,14 @@ Changes for U-Boot 1.0.0:
|
||||
Changes for U-Boot 0.4.8:
|
||||
======================================================================
|
||||
|
||||
<<<<<<< CHANGELOG
|
||||
<<<<<<< CHANGELOG
|
||||
<<<<<<< CHANGELOG
|
||||
* Add I2C and RTC support for RMU board
|
||||
|
||||
=======
|
||||
=======
|
||||
=======
|
||||
* Patches by Denis Peter, 9 Sep 2003:
|
||||
add FAT support for IDE, SCSI and USB
|
||||
|
||||
@@ -95,6 +216,7 @@ Changes for U-Boot 0.4.8:
|
||||
|
||||
* Avoid flicker on TRAB's VFD
|
||||
|
||||
>>>>>>> 1.130
|
||||
* Add support for SK98xx driver
|
||||
|
||||
* Add PCI support for SL8245 board
|
||||
@@ -140,6 +262,7 @@ Changes for U-Boot 0.4.7:
|
||||
* Add GCC library to examples/Makefile so GCC utility functions will
|
||||
be resolved, too
|
||||
|
||||
>>>>>>> 1.118
|
||||
* Add I2C and RTC support for RMU board using software I2C driver
|
||||
(because of better response to iprobe command); fix problem with
|
||||
"reset" command
|
||||
@@ -148,6 +271,7 @@ Changes for U-Boot 0.4.7:
|
||||
Added CONFIG_BOOTP_DNS2 and CONFIG_BOOTP_SEND_HOSTNAME to
|
||||
CONFIG_BOOTP_MAKS (see README).
|
||||
|
||||
>>>>>>> 1.112
|
||||
* Fix ICU862 environment problem
|
||||
|
||||
* Fix RAM size detection for RMU board
|
||||
|
||||
@@ -219,6 +219,10 @@ N: David M
|
||||
E: d.mueller@elsoft.ch
|
||||
D: Support for Samsung ARM920T SMDK2410 eval board
|
||||
|
||||
N: Scott McNutt
|
||||
E: smcnutt@psyent.com
|
||||
D: Support for Altera Nios-32 CPU, for Nios Cyclone Development Kit (DK-1C20)
|
||||
|
||||
N: Rolf Offermanns
|
||||
E: rof@sysgo.de
|
||||
D: Initial support for SSV-DNP1110, SMC91111 driver
|
||||
|
||||
+15
@@ -25,6 +25,10 @@ Pantelis Antoniou <panto@intracom.gr>
|
||||
|
||||
NETVIA MPC8xx
|
||||
|
||||
Yuli Barcohen <yuli@arabellasw.com>
|
||||
|
||||
ZPC1900 MPC8265
|
||||
|
||||
Jerry Van Baren <gerald.vanbaren@smiths-aerospace.com>
|
||||
|
||||
sacsng MPC8260
|
||||
@@ -333,6 +337,17 @@ Wolfgang Denk <wd@denx.de>
|
||||
incaip MIPS32 4Kc
|
||||
purple MIPS64 5Kc
|
||||
|
||||
#########################################################################
|
||||
# Nios-32 Systems: #
|
||||
# #
|
||||
# Maintainer Name, Email Address #
|
||||
# Board CPU #
|
||||
#########################################################################
|
||||
|
||||
Scott McNutt <smcnutt@psyent.com>
|
||||
|
||||
DK1C20 Nios-32
|
||||
|
||||
#########################################################################
|
||||
# End of MAINTAINERS list #
|
||||
#########################################################################
|
||||
@@ -82,7 +82,7 @@ LIST_8260=" \
|
||||
gw8260 hymod IPHASE4539 MPC8260ADS \
|
||||
MPC8266ADS PM826 ppmc8260 RPXsuper \
|
||||
rsdproto sacsng sbc8260 SCM \
|
||||
TQM8260_AC TQM8260_AD TQM8260_AE \
|
||||
TQM8260_AC TQM8260_AD TQM8260_AE ZPC1900 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
|
||||
@@ -69,6 +69,9 @@ endif
|
||||
ifeq ($(ARCH),mips)
|
||||
CROSS_COMPILE = mips_4KC-
|
||||
endif
|
||||
ifeq ($(ARCH),nios)
|
||||
CROSS_COMPILE = nios-elf-
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -118,7 +121,7 @@ LIBS += post/libpost.a post/cpu/libcpu.a
|
||||
LIBS += common/libcommon.a
|
||||
LIBS += lib_generic/libgeneric.a
|
||||
# Add GCC lib
|
||||
PLATFORM_LIBS += -L $(shell dirname `$(CC) -print-libgcc-file-name`) -lgcc
|
||||
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||
|
||||
#########################################################################
|
||||
#########################################################################
|
||||
@@ -470,9 +473,15 @@ v37_config: unconfig
|
||||
@echo "#define CONFIG_SHARP_LQ084V1DG21" >>include/config.h
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx v37
|
||||
|
||||
wtk_config: unconfig
|
||||
@echo "#define CONFIG_LCD" >include/config.h
|
||||
@echo "#define CONFIG_SHARP_LQ065T9DR51U" >>include/config.h
|
||||
@./mkconfig -a TQM823L ppc mpc8xx tqm8xx
|
||||
|
||||
#########################################################################
|
||||
## PPC4xx Systems
|
||||
#########################################################################
|
||||
xtract_4xx = $(subst _MODEL_BA,,$(subst _MODEL_ME,,$(subst _MODEL_HI,,$(subst _config,,$1))))
|
||||
|
||||
ADCIOP_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx adciop esd
|
||||
@@ -552,8 +561,24 @@ PLU405_config: unconfig
|
||||
PMC405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx pmc405 esd
|
||||
|
||||
PPChameleonEVB_MODEL_BA_config \
|
||||
PPChameleonEVB_MODEL_ME_config \
|
||||
PPChameleonEVB_MODEL_HI_config \
|
||||
PPChameleonEVB_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx PPChameleonEVB dave
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _MODEL_BA,$@)" ] || \
|
||||
{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 0" >>include/config.h ; \
|
||||
echo "... BASIC model" ; \
|
||||
}
|
||||
@[ -z "$(findstring _MODEL_ME,$@)" ] || \
|
||||
{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 1" >>include/config.h ; \
|
||||
echo "... MEDIUM model" ; \
|
||||
}
|
||||
@[ -z "$(findstring _MODEL_HI,$@)" ] || \
|
||||
{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 2" >>include/config.h ; \
|
||||
echo "... HIGH-END model" ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
|
||||
|
||||
VOH405_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx voh405 esd
|
||||
@@ -620,6 +645,9 @@ utx8245_config: unconfig
|
||||
## MPC8260 Systems
|
||||
#########################################################################
|
||||
|
||||
atc_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 atc
|
||||
|
||||
cogent_mpc8260_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 cogent
|
||||
|
||||
@@ -743,8 +771,8 @@ TQM8265_AA_config: unconfig
|
||||
fi
|
||||
@./mkconfig -a TQM8260 ppc mpc8260 tqm8260
|
||||
|
||||
atc_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 atc
|
||||
ZPC1900_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8260 zpc1900
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
@@ -796,7 +824,7 @@ shannon_config : unconfig
|
||||
## ARM92xT Systems
|
||||
#########################################################################
|
||||
|
||||
xtract_trab = $(subst _big_flash,,$(subst _config,,$1))
|
||||
xtract_trab = $(subst _bigram,,$(subst _bigflash,,$(subst _old,,$(subst _config,,$1))))
|
||||
|
||||
omap1510inn_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm925t omap1510inn
|
||||
@@ -811,11 +839,23 @@ smdk2410_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm920t smdk2410
|
||||
|
||||
trab_config \
|
||||
trab_big_flash_config: unconfig
|
||||
trab_bigram_config \
|
||||
trab_bigflash_config \
|
||||
trab_old_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _big_flash,$@)" ] || \
|
||||
{ echo "#define CONFIG_BIG_FLASH" >>include/config.h ; \
|
||||
echo "... with big flash support" ; \
|
||||
@[ -z "$(findstring _bigram,$@)" ] || \
|
||||
{ echo "#define CONFIG_FLASH_8MB" >>include/config.h ; \
|
||||
echo "... with 8 MB Flash, 32 MB RAM" ; \
|
||||
}
|
||||
@[ -z "$(findstring _bigflash,$@)" ] || \
|
||||
{ echo "#define CONFIG_RAM_16MB" >>include/config.h ; \
|
||||
echo "... with 16 MB Flash, 16 MB RAM" ; \
|
||||
echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \
|
||||
}
|
||||
@[ -z "$(findstring _old,$@)" ] || \
|
||||
{ echo "#define CONFIG_OLD_VERSION" >>include/config.h ; \
|
||||
echo "... with small memory configuration" ; \
|
||||
echo "TEXT_BASE = 0x0CF00000" >board/trab/config.tmp ; \
|
||||
}
|
||||
@./mkconfig -a $(call xtract_trab,$@) arm arm920t trab
|
||||
|
||||
@@ -904,6 +944,17 @@ incaip_config: unconfig
|
||||
purple_config : unconfig
|
||||
@./mkconfig $(@:_config=) mips mips purple
|
||||
|
||||
#========================================================================
|
||||
# Nios
|
||||
#========================================================================
|
||||
#########################################################################
|
||||
## Nios32
|
||||
#########################################################################
|
||||
|
||||
DK1C20_config: unconfig
|
||||
@./mkconfig $(@:_config=) nios nios dk1c20
|
||||
|
||||
|
||||
#########################################################################
|
||||
#########################################################################
|
||||
|
||||
@@ -921,7 +972,7 @@ clean:
|
||||
rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
|
||||
rm -f tools/env/fw_printenv tools/env/fw_setenv
|
||||
rm -f board/cray/L1/bootscript.c board/cray/L1/bootscript.image
|
||||
rm -f board/trab/trab_fkt
|
||||
rm -f board/trab/trab_fkt board/trab/config.tmp
|
||||
|
||||
clobber: clean
|
||||
find . -type f \
|
||||
|
||||
@@ -239,6 +239,7 @@ Directory Hierarchy:
|
||||
- board/westel/ Files specific to boards manufactured by Westel Wireless
|
||||
- board/westel/amx860 Files specific to AMX860 boards
|
||||
- board/utx8245 Files specific to UTX8245 boards
|
||||
- board/zpc1900 Files specific to Zephyr Engineering ZPC.1900 board
|
||||
|
||||
Software Configuration:
|
||||
=======================
|
||||
@@ -355,7 +356,7 @@ The following options need to be configured:
|
||||
CONFIG_IAD210, CONFIG_RPXlite, CONFIG_sbc8260,
|
||||
CONFIG_EBONY, CONFIG_sacsng, CONFIG_FPS860L,
|
||||
CONFIG_V37, CONFIG_ELPT860, CONFIG_CMI,
|
||||
CONFIG_NETVIA, CONFIG_RBC823
|
||||
CONFIG_NETVIA, CONFIG_RBC823, CONFIG_ZPC1900
|
||||
|
||||
ARM based boards:
|
||||
-----------------
|
||||
@@ -393,7 +394,7 @@ The following options need to be configured:
|
||||
Possible values are:
|
||||
CFG_8260ADS - original MPC8260ADS
|
||||
CFG_8266ADS - MPC8266ADS (untested)
|
||||
CFG_PQ2FADS - PQ2FADS-ZU
|
||||
CFG_PQ2FADS - PQ2FADS-ZU or PQ2FADS-VR
|
||||
|
||||
|
||||
- MPC824X Family Member (if CONFIG_MPC824X is defined)
|
||||
@@ -1416,7 +1417,13 @@ The following options need to be configured:
|
||||
-1 common/cmd_ide.c Read Error on boot device
|
||||
-1 common/cmd_ide.c Image header has bad magic number
|
||||
|
||||
-1 common/cmd_nvedit.c Environment not changable, but has bad CRC
|
||||
-1 common/cmd_nand.c Bad usage of "nand" command
|
||||
-1 common/cmd_nand.c No boot device
|
||||
-1 common/cmd_nand.c Unknown Chip ID on boot device
|
||||
-1 common/cmd_nand.c Read Error on boot device
|
||||
-1 common/cmd_nand.c Image header has bad magic number
|
||||
|
||||
-1 common/env_common.c Environment has a bad CRC, using default
|
||||
|
||||
|
||||
Modem Support:
|
||||
@@ -1498,6 +1505,10 @@ Configuration Settings:
|
||||
- CFG_ALT_MEMTEST:
|
||||
Enable an alternate, more extensive memory test.
|
||||
|
||||
- CFG_MEMTEST_SCRATCH:
|
||||
Scratch address used by the alternate memory test
|
||||
You only need to set this if address zero isn't writeable
|
||||
|
||||
- CFG_TFTP_LOADADDR:
|
||||
Default load address for network file downloads
|
||||
|
||||
@@ -1739,6 +1750,14 @@ Note: once the monitor has been relocated, then it will complain if
|
||||
the default environment is used; a new CRC is computed as soon as you
|
||||
use the "saveenv" command to store a valid environment.
|
||||
|
||||
- CFG_FAULT_ECHO_LINK_DOWN:
|
||||
Echo the inverted Ethernet link state to the fault LED.
|
||||
|
||||
Note: If this option is active, then CFG_FAULT_MII_ADDR
|
||||
also needs to be defined.
|
||||
|
||||
- CFG_FAULT_MII_ADDR:
|
||||
MII address of the PHY to check for the Ethernet link state.
|
||||
|
||||
Low Level (hardware related) configuration options:
|
||||
---------------------------------------------------
|
||||
@@ -1925,7 +1944,8 @@ configurations; the following names are supported:
|
||||
GEN860T_config EBONY_config FPS860L_config
|
||||
ELPT860_config cmi_mpc5xx_config NETVIA_config
|
||||
at91rm9200dk_config omap1510inn_config MPC8260ADS_config
|
||||
omap1610inn_config
|
||||
omap1610inn_config ZPC1900_config
|
||||
|
||||
Note: for some board special configuration names may exist; check if
|
||||
additional information is available from the board vendor; for
|
||||
instance, the TQM8xxL systems run normally at 50 MHz and use a
|
||||
|
||||
@@ -160,7 +160,7 @@ ulong flash_init (void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic ("configured to many flash banks!\n");
|
||||
panic ("configured too many flash banks!\n");
|
||||
|
||||
sector = 0;
|
||||
start_address = flashbase;
|
||||
|
||||
@@ -59,7 +59,7 @@ ulong flash_init(void)
|
||||
flashbase = PHYS_FLASH_2;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
|
||||
@@ -62,7 +62,7 @@ ulong flash_init(void)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++) {
|
||||
|
||||
@@ -261,10 +261,13 @@ nand_probe(ulong physadr);
|
||||
void
|
||||
nand_init(void)
|
||||
{
|
||||
ulong totlen;
|
||||
ulong totlen = 0;
|
||||
|
||||
#if (CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_ME) || \
|
||||
(CONFIG_PPCHAMELEON_MODULE_MODEL == CONFIG_PPCHAMELEON_MODULE_HI)
|
||||
debug ("Probing at 0x%.8x\n", CFG_NAND0_BASE);
|
||||
totlen = nand_probe (CFG_NAND0_BASE);
|
||||
totlen += nand_probe (CFG_NAND0_BASE);
|
||||
#endif /* CONFIG_PPCHAMELEON_MODULE_ME, CONFIG_PPCHAMELEON_MODULE_HI */
|
||||
|
||||
debug ("Probing at 0x%.8x\n", CFG_NAND1_BASE);
|
||||
totlen += nand_probe (CFG_NAND1_BASE);
|
||||
|
||||
@@ -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 = vectors.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $^
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Psyent Corporation
|
||||
# Scott McNutt <smcnutt@psyent.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 = 0x018c0000
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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 _default_hdlr (void)
|
||||
{
|
||||
printf ("default_hdlr\n");
|
||||
}
|
||||
|
||||
int board_pre_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ("Board: Altera Nios 1C20 Development Kit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* (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 <common.h>
|
||||
#include <nios.h>
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define BANKSZ (8 * 1024 * 1024)
|
||||
#define SECTSZ (64 * 1024)
|
||||
#define USERFLASH (2 * 1024 * 1024) /* bottom 2 MB for user */
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
#define FLASH_WORD_SIZE unsigned char
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
unsigned long addr;
|
||||
flash_info_t *fli = &flash_info[0];
|
||||
|
||||
fli->size = BANKSZ;
|
||||
fli->sector_count = CFG_MAX_FLASH_SECT;
|
||||
fli->flash_id = FLASH_MAN_AMD;
|
||||
|
||||
addr = CFG_FLASH_BASE;
|
||||
for (i = 0; i < fli->sector_count; ++i) {
|
||||
fli->start[i] = addr;
|
||||
addr += SECTSZ;
|
||||
|
||||
/* Protect all but 2 MByte user area */
|
||||
if (addr < (CFG_FLASH_BASE + USERFLASH))
|
||||
fli->protect[i] = 0;
|
||||
else
|
||||
fli->protect[i] = 1;
|
||||
}
|
||||
|
||||
return (BANKSZ);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i, k;
|
||||
unsigned long size;
|
||||
int erased;
|
||||
volatile unsigned char *flash;
|
||||
|
||||
printf (" Size: %ld KB in %d Sectors\n",
|
||||
info->size >> 10, info->sector_count);
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
|
||||
/* Check if whole sector is erased */
|
||||
if (i != (info->sector_count - 1))
|
||||
size = info->start[i + 1] - info->start[i];
|
||||
else
|
||||
size = info->start[0] + info->size - info->start[i];
|
||||
erased = 1;
|
||||
flash = (volatile unsigned char *) info->start[i];
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Print the info */
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s%s", info->start[i], erased ? " E" : " ",
|
||||
info->protect[i] ? "RO " : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *addr2;
|
||||
int prot, sect;
|
||||
int any = 0;
|
||||
unsigned oldpri;
|
||||
ulong start;
|
||||
|
||||
/* Some sanity checking */
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
printf ("- no sectors to erase\n");
|
||||
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");
|
||||
}
|
||||
|
||||
/* NOTE: disabling interrupts on Nios can be very bad since it
|
||||
* also disables the LO_LIMIT exception. It's better here to
|
||||
* set the interrupt priority to 3 & restore it when we're done.
|
||||
*/
|
||||
oldpri = ipri (3);
|
||||
|
||||
/* It's ok to erase multiple sectors provided we don't delay more
|
||||
* than 50 usec between cmds ... at which point the erase time-out
|
||||
* occurs. So don't go and put printf() calls in the loop ... it
|
||||
* won't be very helpful ;-)
|
||||
*/
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
*addr = 0xaa;
|
||||
*addr = 0x55;
|
||||
*addr = 0x80;
|
||||
*addr = 0xaa;
|
||||
*addr = 0x55;
|
||||
*addr2 = 0x30;
|
||||
any = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now just wait for 0xff & provide some user feedback while
|
||||
* we wait.
|
||||
*/
|
||||
if (any) {
|
||||
addr2 = (FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
start = get_timer (0);
|
||||
while (*addr2 != 0xff) {
|
||||
udelay (1000 * 1000);
|
||||
putc ('.');
|
||||
if (get_timer (start) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("timeout\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/* Restore interrupt priority */
|
||||
ipri (oldpri);
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
vu_char *cmd = (vu_char *) info->start[0];
|
||||
vu_char *dst = (vu_char *) addr;
|
||||
unsigned char b;
|
||||
unsigned oldpri;
|
||||
ulong start;
|
||||
|
||||
while (cnt) {
|
||||
/* Check for sufficient erase */
|
||||
b = *src;
|
||||
if ((*dst & b) != b) {
|
||||
printf ("%02x : %02x\n", *dst, b);
|
||||
return (2);
|
||||
}
|
||||
|
||||
/* Disable interrupts other than window underflow
|
||||
* (interrupt priority 2)
|
||||
*/
|
||||
oldpri = ipri (3);
|
||||
*cmd = 0xaa;
|
||||
*cmd = 0x55;
|
||||
*cmd = 0xa0;
|
||||
*dst = b;
|
||||
|
||||
/* Verify write */
|
||||
start = get_timer (0);
|
||||
while (*dst != b) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
ipri (oldpri);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
cnt--;
|
||||
ipri (oldpri);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
OUTPUT_FORMAT("elf32-nios")
|
||||
OUTPUT_ARCH(nios)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
cpu/nios/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
__text_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
__rodata_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__data_end = .;
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd :
|
||||
{
|
||||
*(.u_boot_cmd)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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
|
||||
*/
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Exception Vector Table
|
||||
*
|
||||
* This could have gone in the cpu soure tree, but the whole point of
|
||||
* Nios is customization -- and polluting the cpu source tree with
|
||||
* board-specific ifdef's really defeats the purpose, no? With this in
|
||||
* the board-specific tree, each board has the freedom to organize
|
||||
* vectors/traps, etc anyway it wants. The init code copies this table
|
||||
* to the proper location.
|
||||
*
|
||||
* Each board can do what it likes here. But there are four "standard"
|
||||
* handlers availble:
|
||||
*
|
||||
* _cwp_lolimit -Handles register window underflows.
|
||||
* _cwp_hilimit -Handles register window overflows.
|
||||
* _timebase_int -Increments the timebase.
|
||||
* _def_xhandler -Default exception handler.
|
||||
*
|
||||
* _timebase_int handles a Nios Timer interrupt and increments the
|
||||
* timestamp used for the get_timer(), reset_timer(), etc. routines. It
|
||||
* expects the timer to be configured like the standard-32 low priority
|
||||
* timer.
|
||||
*
|
||||
* _def_xhandler dispatches exceptions/traps via the external_interrupt()
|
||||
* routine. This lets you use the irq_install_handler() and handle your
|
||||
* interrupts/traps with code written in C.
|
||||
************************************************************************/
|
||||
|
||||
.data
|
||||
.global _vectors
|
||||
.align 4
|
||||
_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 _def_xhandler@h /* Vector 5 - GNUPro debug */
|
||||
.long _def_xhandler@h /* Vector 6 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 7 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 8 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 9 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 10 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 11 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 12 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 13 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 14 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 15 - future reserved */
|
||||
.long _def_xhandler@h /* Vector 16 */
|
||||
.long _def_xhandler@h /* Vector 17 */
|
||||
.long _def_xhandler@h /* Vector 18 */
|
||||
.long _def_xhandler@h /* Vector 19 */
|
||||
.long _def_xhandler@h /* Vector 20 */
|
||||
.long _def_xhandler@h /* Vector 21 */
|
||||
.long _def_xhandler@h /* Vector 22 */
|
||||
.long _def_xhandler@h /* Vector 23 */
|
||||
.long _def_xhandler@h /* Vector 24 */
|
||||
.long _def_xhandler@h /* Vector 25 */
|
||||
.long _def_xhandler@h /* Vector 26 */
|
||||
.long _def_xhandler@h /* Vector 27 */
|
||||
.long _def_xhandler@h /* Vector 28 */
|
||||
.long _def_xhandler@h /* Vector 29 */
|
||||
.long _def_xhandler@h /* Vector 30 */
|
||||
.long _def_xhandler@h /* Vector 31 */
|
||||
.long _def_xhandler@h /* Vector 32 */
|
||||
.long _def_xhandler@h /* Vector 33 */
|
||||
.long _def_xhandler@h /* Vector 34 */
|
||||
.long _def_xhandler@h /* Vector 35 */
|
||||
.long _def_xhandler@h /* Vector 36 */
|
||||
.long _def_xhandler@h /* Vector 37 */
|
||||
.long _def_xhandler@h /* Vector 38 */
|
||||
.long _def_xhandler@h /* Vector 39 */
|
||||
.long _def_xhandler@h /* Vector 40 */
|
||||
.long _def_xhandler@h /* Vector 41 */
|
||||
.long _def_xhandler@h /* Vector 42 */
|
||||
.long _def_xhandler@h /* Vector 43 */
|
||||
.long _def_xhandler@h /* Vector 44 */
|
||||
.long _def_xhandler@h /* Vector 45 */
|
||||
.long _def_xhandler@h /* Vector 46 */
|
||||
.long _def_xhandler@h /* Vector 47 */
|
||||
.long _def_xhandler@h /* Vector 48 */
|
||||
.long _def_xhandler@h /* Vector 49 */
|
||||
.long _timebase_int@h /* Vector 50 - lopri timer*/
|
||||
.long _def_xhandler@h /* Vector 51 */
|
||||
.long _def_xhandler@h /* Vector 52 */
|
||||
.long _def_xhandler@h /* Vector 53 */
|
||||
.long _def_xhandler@h /* Vector 54 */
|
||||
.long _def_xhandler@h /* Vector 55 */
|
||||
.long _def_xhandler@h /* Vector 56 */
|
||||
.long _def_xhandler@h /* Vector 57 */
|
||||
.long _def_xhandler@h /* Vector 58 */
|
||||
.long _def_xhandler@h /* Vector 59 */
|
||||
.long _def_xhandler@h /* Vector 60 */
|
||||
.long _def_xhandler@h /* Vector 61 */
|
||||
.long _def_xhandler@h /* Vector 62 */
|
||||
.long _def_xhandler@h /* Vector 63 */
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ unsigned long flash_init (void)
|
||||
flash_get_offsets(PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
|
||||
@@ -50,7 +50,7 @@ ulong flash_init (void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic ("configured to many flash banks!\n");
|
||||
panic ("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++) {
|
||||
flash_info[i].start[j] = flashbase + j * MAIN_SECT_SIZE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ ulong flash_init(void)
|
||||
else if (i == 1)
|
||||
flashbase = PHYS_FLASH_2;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
if (j <= 7)
|
||||
|
||||
@@ -276,7 +276,7 @@ ulong flash_init(void)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++) {
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ ulong flash_init(void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
if (j <= 7)
|
||||
|
||||
@@ -91,7 +91,7 @@ ulong flash_init(void)
|
||||
flashbase = PHYS_FLASH_2;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
|
||||
@@ -76,7 +76,7 @@ unsigned long flash_init (void)
|
||||
flash_get_offsets (PHYS_FLASH_2, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured to many flash banks!\n");
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ ulong flash_init(void) {
|
||||
if (i==0)
|
||||
flashbase = CFG_FLASH_BASE;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
flash_info[i].start[j]=flashbase + j * SECT_SIZE;
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ long int initdram(int board_type)
|
||||
bsma = ((31 - width) - 14) - ((rows > cols) ? rows : cols);
|
||||
sda10 = sdam + 2;
|
||||
#else
|
||||
sdam = cols - 6;
|
||||
sdam = cols + banks - 8;
|
||||
bsma = ((31 - width) - 14) - ((rows > cols) ? rows : cols);
|
||||
sda10 = sdam;
|
||||
#endif
|
||||
@@ -557,9 +557,18 @@ long int initdram(int board_type)
|
||||
printf("SDRAM configuration read from SPD\n");
|
||||
printf("\tSize per side = %dMB\n", sdram_size >> 20);
|
||||
printf("\tOrganization: %d sides, %d banks, %d Columns, %d Rows, Data width = %d bits\n", chipselects, 1<<(banks), cols, rows, data_width);
|
||||
printf("\tRefresh rate = %d, CAS latency = %d\n", psrt, caslatency);
|
||||
printf("\tRefresh rate = %d, CAS latency = %d", psrt, caslatency);
|
||||
#if(CONFIG_PBI == 0) /* bank-based interleaving */
|
||||
printf(", Using Bank Based Interleave\n");
|
||||
#else
|
||||
printf(", Using Page Based Interleave\n");
|
||||
#endif
|
||||
printf("\tTotal size: ");
|
||||
|
||||
/* this delay only needed for original 16MB DIMM...
|
||||
* Not needed for any other memory configuration */
|
||||
if ((sdram_size * chipselects) == (16 *1024 *1024))
|
||||
udelay (250000);
|
||||
return (sdram_size * chipselects);
|
||||
/*return (16 * 1024 * 1024);*/
|
||||
}
|
||||
@@ -575,3 +584,4 @@ void pci_init_board(void)
|
||||
pci_mpc8250_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -155,7 +155,7 @@ void setup_cs_reloc(void)
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size_b0, size_b1,flashcr;
|
||||
unsigned long size_b0, size_b1,flashcr, size_reg;
|
||||
int mode, i;
|
||||
extern char version_string;
|
||||
char *p=&version_string;
|
||||
@@ -196,6 +196,21 @@ unsigned long flash_init (void)
|
||||
size_b1 = 0 ;
|
||||
flash_info[0].size = size_b0;
|
||||
/* set up flash cs according to the size */
|
||||
size_reg=(flash_info[0].size >>20);
|
||||
switch (size_reg) {
|
||||
case 0:
|
||||
case 1: i=0; break; /* <= 1MB */
|
||||
case 2: i=1; break; /* = 2MB */
|
||||
case 4: i=2; break; /* = 4MB */
|
||||
case 8: i=3; break; /* = 8MB */
|
||||
case 16: i=4; break; /* = 16MB */
|
||||
case 32: i=5; break; /* = 32MB */
|
||||
case 64: i=6; break; /* = 64MB */
|
||||
case 128: i=7; break; /*= 128MB */
|
||||
default:
|
||||
printf("\n #### ERROR, wrong size %ld MByte reset board #####\n",size_reg);
|
||||
while(1);
|
||||
}
|
||||
if(mode & BOOT_MPS) {
|
||||
/* flash is on CS1 */
|
||||
mtdcr(ebccfga, pb1cr);
|
||||
@@ -203,7 +218,7 @@ unsigned long flash_init (void)
|
||||
/* we map the flash high in every case */
|
||||
flashcr&=0x0001FFFF; /* mask out address bits */
|
||||
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
|
||||
flashcr|= (((flash_info[0].size >>21) & 0x07) << 17); /* size addr */
|
||||
flashcr|= (i << 17); /* size addr */
|
||||
mtdcr(ebccfga, pb1cr);
|
||||
mtdcr(ebccfgd, flashcr);
|
||||
}
|
||||
@@ -214,7 +229,7 @@ unsigned long flash_init (void)
|
||||
/* we map the flash high in every case */
|
||||
flashcr&=0x0001FFFF; /* mask out address bits */
|
||||
flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */
|
||||
flashcr|= (((flash_info[0].size >>21) & 0x07) << 17); /* size addr */
|
||||
flashcr|= (i << 17); /* size addr */
|
||||
mtdcr(ebccfga, pb0cr);
|
||||
mtdcr(ebccfgd, flashcr);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,15 @@ const sdram_t sdram_table[] = {
|
||||
3, /* Address Mode = 3 */
|
||||
5, /* size value */
|
||||
1}, /* ECC enabled */
|
||||
{ 0x2f, /* Rev C, 128MByte -3 Board */
|
||||
3, /* Case Latenty = 3 */
|
||||
3, /* trp 20ns / 7.5 ns datain[27] */
|
||||
3, /* trcd 20ns /7.5 ns (datain[29]) */
|
||||
6, /* tras 44ns /7.5 ns (datain[30]) */
|
||||
4, /* tcpt 44 - 20ns = 24ns */
|
||||
3, /* Address Mode = 3 */
|
||||
5, /* size value */
|
||||
1}, /* ECC enabled */
|
||||
{ 0xff, /* terminator */
|
||||
0xff,
|
||||
0xff,
|
||||
@@ -550,7 +559,8 @@ void get_pcbrev_var(unsigned char *pcbrev, unsigned char *var)
|
||||
tmp >>= 1;
|
||||
}
|
||||
rc++;
|
||||
if((((bc>>4) & 0xf)==0x1) /* Rev B PCB with */
|
||||
if(( (((bc>>4) & 0xf)==0x2) /* Rev C PCB or */
|
||||
|| (((bc>>4) & 0xf)==0x1)) /* Rev B PCB with */
|
||||
&& (rc==0x1)) /* Population Option 1 is a -3 */
|
||||
rc=3;
|
||||
*pcbrev=(bc >> 4) & 0xf;
|
||||
|
||||
@@ -80,7 +80,7 @@ ulong flash_init(void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
if (j <= 3)
|
||||
|
||||
@@ -72,7 +72,7 @@ unsigned long flash_init (void)
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured to many flash banks!\n");
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
|
||||
@@ -96,7 +96,7 @@ unsigned long flash_init (void)
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured to many flash banks!\n");
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
|
||||
@@ -234,7 +234,7 @@ ulong flash_init(void)
|
||||
flashbase = SC520_FLASH_BANK2_BASE;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
}
|
||||
|
||||
id = identify_flash(flashbase, 4);
|
||||
|
||||
@@ -101,7 +101,7 @@ ulong flash_init(void)
|
||||
flashbase = SC520_FLASH_BANK0_BASE;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
}
|
||||
|
||||
for (j = 0; j < flash_info[i].sector_count; j++) {
|
||||
|
||||
@@ -239,7 +239,7 @@ ulong flash_init(void)
|
||||
flashbase = SC520_FLASH_BANK0_BASE;
|
||||
break;
|
||||
default:
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
}
|
||||
|
||||
id = identify_flash(flashbase, 2);
|
||||
|
||||
@@ -73,7 +73,7 @@ ulong flash_init(void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ int board_init (void)
|
||||
*(unsigned long *)temp = 0x00060006;
|
||||
|
||||
}
|
||||
#endif /* CONFIG_INIT_CRITICAL */
|
||||
#endif /* CONFIG_INFERNO */
|
||||
|
||||
/* arch number for shannon */
|
||||
gd->bd->bi_arch_number = 97;
|
||||
|
||||
@@ -80,7 +80,7 @@ ulong flash_init(void)
|
||||
if (i == 0)
|
||||
flashbase = PHYS_FLASH_1;
|
||||
else
|
||||
panic("configured to many flash banks!\n");
|
||||
panic("configured too many flash banks!\n");
|
||||
for (j = 0; j < flash_info[i].sector_count; j++)
|
||||
{
|
||||
if (j <= 3)
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := trab.o flash.o vfd.o cmd_trab.o memory.o tsc2000.o
|
||||
OBJS := trab.o flash.o vfd.o cmd_trab.o memory.o tsc2000.o auto_update.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
|
||||
|
||||
@@ -0,0 +1,614 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Gary Jennejohn, DENX Software Engineering, gj@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 <command.h>
|
||||
#include <malloc.h>
|
||||
#include <image.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <usb.h>
|
||||
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
#include <hush.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AUTO_UPDATE
|
||||
|
||||
#ifndef CONFIG_USB_OHCI
|
||||
#error "must define CONFIG_USB_OHCI"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USB_STORAGE
|
||||
#error "must define CONFIG_USB_STORAGE"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_HUSH_PARSER
|
||||
#error "must define CFG_HUSH_PARSER"
|
||||
#endif
|
||||
|
||||
#if !(CONFIG_COMMANDS & CFG_CMD_FAT)
|
||||
#error "must define CFG_CMD_FAT"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check whether a USB memory stick is plugged in.
|
||||
* If one is found:
|
||||
* 1) if prepare.img ist found load it into memory. If it is
|
||||
* valid then run it.
|
||||
* 2) if preinst.img is found load it into memory. If it is
|
||||
* valid then run it. Update the EEPROM.
|
||||
* 3) if firmware.img is found load it into memory. If it is valid,
|
||||
* burn it into FLASH and update the EEPROM.
|
||||
* 4) if kernel.img is found load it into memory. If it is valid,
|
||||
* burn it into FLASH and update the EEPROM.
|
||||
* 5) if app.img is found load it into memory. If it is valid,
|
||||
* burn it into FLASH and update the EEPROM.
|
||||
* 6) if disk.img is found load it into memory. If it is valid,
|
||||
* burn it into FLASH and update the EEPROM.
|
||||
* 7) if postinst.img is found load it into memory. If it is
|
||||
* valid then run it. Update the EEPROM.
|
||||
*/
|
||||
|
||||
#undef AU_DEBUG
|
||||
|
||||
#undef debug
|
||||
#ifdef AU_DEBUG
|
||||
#define debug(fmt,args...) printf (fmt ,##args)
|
||||
#else
|
||||
#define debug(fmt,args...)
|
||||
#endif /* AU_DEBUG */
|
||||
|
||||
/* possible names of files on the USB stick. */
|
||||
#define AU_PREPARE "prepare.img"
|
||||
#define AU_PREINST "preinst.img"
|
||||
#define AU_FIRMWARE "firmware.img"
|
||||
#define AU_KERNEL "kernel.img"
|
||||
#define AU_APP "app.img"
|
||||
#define AU_DISK "disk.img"
|
||||
#define AU_POSTINST "postinst.img"
|
||||
|
||||
struct flash_layout
|
||||
{
|
||||
long start;
|
||||
long end;
|
||||
};
|
||||
|
||||
/* layout of the FLASH. ST = start address, ND = end address. */
|
||||
#ifndef CONFIG_FLASH_8MB /* 16 MB Flash, 32 MB RAM */
|
||||
#define AU_FL_FIRMWARE_ST 0x00000000
|
||||
#define AU_FL_FIRMWARE_ND 0x0009FFFF
|
||||
#define AU_FL_VFD_ST 0x000A0000
|
||||
#define AU_FL_VFD_ND 0x000BFFFF
|
||||
#define AU_FL_KERNEL_ST 0x000C0000
|
||||
#define AU_FL_KERNEL_ND 0x001BFFFF
|
||||
#define AU_FL_APP_ST 0x001C0000
|
||||
#define AU_FL_APP_ND 0x005BFFFF
|
||||
#define AU_FL_DISK_ST 0x005C0000
|
||||
#define AU_FL_DISK_ND 0x00FFFFFF
|
||||
#else /* 8 MB Flash, 32 MB RAM */
|
||||
#define AU_FL_FIRMWARE_ST 0x00000000
|
||||
#define AU_FL_FIRMWARE_ND 0x0005FFFF
|
||||
#define AU_FL_KERNEL_ST 0x00060000
|
||||
#define AU_FL_KERNEL_ND 0x0013FFFF
|
||||
#define AU_FL_APP_ST 0x00140000
|
||||
#define AU_FL_APP_ND 0x0067FFFF
|
||||
#define AU_FL_DISK_ST 0x00680000
|
||||
#define AU_FL_DISK_ND 0x007DFFFF
|
||||
#define AU_FL_VFD_ST 0x007E0000
|
||||
#define AU_FL_VFD_ND 0x007FFFFF
|
||||
#endif /* CONFIG_FLASH_8MB */
|
||||
|
||||
/* a structure with the offsets to values in the EEPROM */
|
||||
struct eeprom_layout
|
||||
{
|
||||
int time;
|
||||
int size;
|
||||
int dcrc;
|
||||
};
|
||||
|
||||
/* layout of the EEPROM - offset from the start. All entries are 32 bit. */
|
||||
#define AU_EEPROM_TIME_PREINST 64
|
||||
#define AU_EEPROM_SIZE_PREINST 68
|
||||
#define AU_EEPROM_DCRC_PREINST 72
|
||||
#define AU_EEPROM_TIME_FIRMWARE 76
|
||||
#define AU_EEPROM_SIZE_FIRMWARE 80
|
||||
#define AU_EEPROM_DCRC_FIRMWARE 84
|
||||
#define AU_EEPROM_TIME_KERNEL 88
|
||||
#define AU_EEPROM_SIZE_KERNEL 92
|
||||
#define AU_EEPROM_DCRC_KERNEL 96
|
||||
#define AU_EEPROM_TIME_APP 100
|
||||
#define AU_EEPROM_SIZE_APP 104
|
||||
#define AU_EEPROM_DCRC_APP 108
|
||||
#define AU_EEPROM_TIME_DISK 112
|
||||
#define AU_EEPROM_SIZE_DISK 116
|
||||
#define AU_EEPROM_DCRC_DISK 120
|
||||
#define AU_EEPROM_TIME_POSTINST 124
|
||||
#define AU_EEPROM_SIZE_POSTINST 128
|
||||
#define AU_EEPROM_DCRC_POSTINST 132
|
||||
|
||||
static int au_usb_stor_curr_dev; /* current device */
|
||||
|
||||
/* index of each file in the following arrays */
|
||||
#define IDX_PREPARE 0
|
||||
#define IDX_PREINST 1
|
||||
#define IDX_FIRMWARE 2
|
||||
#define IDX_KERNEL 3
|
||||
#define IDX_APP 4
|
||||
#define IDX_DISK 5
|
||||
#define IDX_POSTINST 6
|
||||
/* max. number of files which could interest us */
|
||||
#define AU_MAXFILES 7
|
||||
/* pointers to file names */
|
||||
char *aufile[AU_MAXFILES];
|
||||
/* sizes of flash areas for each file */
|
||||
long ausize[AU_MAXFILES];
|
||||
/* offsets into the EEEPROM */
|
||||
struct eeprom_layout auee_off[AU_MAXFILES] = { \
|
||||
{0}, \
|
||||
{AU_EEPROM_TIME_PREINST, AU_EEPROM_SIZE_PREINST, AU_EEPROM_DCRC_PREINST,}, \
|
||||
{AU_EEPROM_TIME_FIRMWARE, AU_EEPROM_SIZE_FIRMWARE, AU_EEPROM_DCRC_FIRMWARE,}, \
|
||||
{AU_EEPROM_TIME_KERNEL, AU_EEPROM_SIZE_KERNEL, AU_EEPROM_DCRC_KERNEL,}, \
|
||||
{AU_EEPROM_TIME_APP, AU_EEPROM_SIZE_APP, AU_EEPROM_DCRC_APP,}, \
|
||||
{AU_EEPROM_TIME_DISK, AU_EEPROM_SIZE_DISK, AU_EEPROM_DCRC_DISK,}, \
|
||||
{AU_EEPROM_TIME_POSTINST, AU_EEPROM_SIZE_POSTINST, AU_EEPROM_DCRC_POSTINST,} \
|
||||
};
|
||||
/* array of flash areas start and end addresses */
|
||||
struct flash_layout aufl_layout[AU_MAXFILES - 3] = { \
|
||||
{AU_FL_FIRMWARE_ST, AU_FL_FIRMWARE_ND,}, \
|
||||
{AU_FL_KERNEL_ST, AU_FL_KERNEL_ND,}, \
|
||||
{AU_FL_APP_ST, AU_FL_APP_ND,}, \
|
||||
{AU_FL_DISK_ST, AU_FL_DISK_ND,}, \
|
||||
};
|
||||
/* convert the index into aufile[] to an index into aufl_layout[] */
|
||||
#define FIDX_TO_LIDX(idx) ((idx) - 2)
|
||||
|
||||
/* where to load files into memory */
|
||||
#define LOAD_ADDR ((unsigned char *)0x0C100000)
|
||||
/* the app is the largest image */
|
||||
#define MAX_LOADSZ ausize[IDX_APP]
|
||||
|
||||
/* externals */
|
||||
extern int fat_register_device(block_dev_desc_t *, int);
|
||||
extern int file_fat_detectfs(void);
|
||||
extern long file_fat_read(const char *, void *, unsigned long);
|
||||
extern int i2c_read (unsigned char, unsigned int, int , unsigned char* , int);
|
||||
extern int i2c_write (uchar, uint, int , uchar* , int);
|
||||
#ifdef CONFIG_VFD
|
||||
extern int trab_vfd (ulong);
|
||||
extern int transfer_pic(unsigned char, unsigned char *, int, int);
|
||||
#endif
|
||||
extern int flash_sect_erase(ulong, ulong);
|
||||
extern int flash_sect_protect (int, ulong, ulong);
|
||||
extern int flash_write (uchar *, ulong, ulong);
|
||||
/* change char* to void* to shutup the compiler */
|
||||
extern int i2c_write_multiple (uchar, uint, int, void *, int);
|
||||
extern int i2c_read_multiple (uchar, uint, int, void *, int);
|
||||
extern block_dev_desc_t *get_dev (char*, int);
|
||||
|
||||
int
|
||||
au_check_valid(int idx, long nbytes)
|
||||
{
|
||||
image_header_t *hdr;
|
||||
unsigned long checksum;
|
||||
unsigned char buf[4];
|
||||
|
||||
hdr = (image_header_t *)LOAD_ADDR;
|
||||
/* check the easy ones first */
|
||||
#undef CHECK_VALID_DEBUG
|
||||
#ifdef CHECK_VALID_DEBUG
|
||||
printf("magic %#x %#x ", ntohl(hdr->ih_magic), IH_MAGIC);
|
||||
printf("arch %#x %#x ", hdr->ih_arch, IH_CPU_ARM);
|
||||
printf("size %#x %#lx ", ntohl(hdr->ih_size), nbytes);
|
||||
printf("type %#x %#x ", hdr->ih_type, IH_TYPE_KERNEL);
|
||||
#endif
|
||||
if (ntohl(hdr->ih_magic) != IH_MAGIC ||
|
||||
hdr->ih_arch != IH_CPU_ARM ||
|
||||
nbytes != (sizeof(*hdr) + ntohl(hdr->ih_size)))
|
||||
{
|
||||
printf ("Image %s bad MAGIC or ARCH or SIZE\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
/* check the hdr CRC */
|
||||
checksum = ntohl(hdr->ih_hcrc);
|
||||
hdr->ih_hcrc = 0;
|
||||
|
||||
if (crc32 (0, (char *)hdr, sizeof(*hdr)) != checksum) {
|
||||
printf ("Image %s bad header checksum\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
hdr->ih_hcrc = htonl(checksum);
|
||||
/* check the data CRC */
|
||||
checksum = ntohl(hdr->ih_dcrc);
|
||||
|
||||
if (crc32 (0, (char *)(LOAD_ADDR + sizeof(*hdr)), ntohl(hdr->ih_size))
|
||||
!= checksum)
|
||||
{
|
||||
printf ("Image %s bad data checksum\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
/* check the type - could do this all in one gigantic if() */
|
||||
if ((idx == IDX_FIRMWARE) && (hdr->ih_type != IH_TYPE_FIRMWARE)) {
|
||||
printf ("Image %s wrong type\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
if ((idx == IDX_KERNEL) && (hdr->ih_type != IH_TYPE_KERNEL)) {
|
||||
printf ("Image %s wrong type\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
if ((idx == IDX_DISK) && (hdr->ih_type != IH_TYPE_FILESYSTEM)) {
|
||||
printf ("Image %s wrong type\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
if ((idx == IDX_APP) && (hdr->ih_type != IH_TYPE_RAMDISK)) {
|
||||
printf ("Image %s wrong type\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
if ((idx == IDX_PREPARE || idx == IDX_PREINST || idx == IDX_POSTINST)
|
||||
&& (hdr->ih_type != IH_TYPE_SCRIPT))
|
||||
{
|
||||
printf ("Image %s wrong type\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
/* special case for prepare.img */
|
||||
if (idx == IDX_PREPARE)
|
||||
return 0;
|
||||
/* recycle checksum */
|
||||
checksum = ntohl(hdr->ih_size);
|
||||
/* for kernel and app the image header must also fit into flash */
|
||||
if (idx != IDX_DISK)
|
||||
checksum += sizeof(*hdr);
|
||||
/* check the size does not exceed space in flash. HUSH scripts */
|
||||
/* all have ausize[] set to 0 */
|
||||
if ((ausize[idx] != 0) && (ausize[idx] < checksum)) {
|
||||
printf ("Image %s is bigger than FLASH\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
/* check the time stamp from the EEPROM */
|
||||
/* read it in */
|
||||
i2c_read_multiple(0x54, auee_off[idx].time, 1, buf, sizeof(buf));
|
||||
#ifdef CHECK_VALID_DEBUG
|
||||
printf ("buf[0] %#x buf[1] %#x buf[2] %#x buf[3] %#x "
|
||||
"as int %#x time %#x\n",
|
||||
buf[0], buf[1], buf[2], buf[3],
|
||||
*((unsigned int *)buf), ntohl(hdr->ih_time));
|
||||
#endif
|
||||
/* check it */
|
||||
if (*((unsigned int *)buf) >= ntohl(hdr->ih_time)) {
|
||||
printf ("Image %s is too old\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* power control defines */
|
||||
#define CPLD_VFD_BK ((volatile char *)0x04038002)
|
||||
#define POWER_OFF (1 << 1)
|
||||
|
||||
int
|
||||
au_do_update(int idx, long sz)
|
||||
{
|
||||
image_header_t *hdr;
|
||||
char *addr;
|
||||
long start, end;
|
||||
int off, rc;
|
||||
uint nbytes;
|
||||
|
||||
hdr = (image_header_t *)LOAD_ADDR;
|
||||
|
||||
/* disable the power switch */
|
||||
*CPLD_VFD_BK |= POWER_OFF;
|
||||
|
||||
/* execute a script */
|
||||
if (hdr->ih_type == IH_TYPE_SCRIPT) {
|
||||
addr = (char *)((char *)hdr + sizeof(*hdr));
|
||||
/* stick a NULL at the end of the script, otherwise */
|
||||
/* parse_string_outer() runs off the end. */
|
||||
addr[ntohl(hdr->ih_size)] = 0;
|
||||
addr += 8;
|
||||
parse_string_outer(addr, FLAG_PARSE_SEMICOLON);
|
||||
return 0;
|
||||
}
|
||||
|
||||
start = aufl_layout[FIDX_TO_LIDX(idx)].start;
|
||||
end = aufl_layout[FIDX_TO_LIDX(idx)].end;
|
||||
|
||||
/* unprotect the address range */
|
||||
/* this assumes that ONLY the firmware is protected! */
|
||||
if (idx == IDX_FIRMWARE) {
|
||||
#undef AU_UPDATE_TEST
|
||||
#ifdef AU_UPDATE_TEST
|
||||
/* erase it where Linux goes */
|
||||
start = aufl_layout[1].start;
|
||||
end = aufl_layout[1].end;
|
||||
#endif
|
||||
flash_sect_protect(0, start, end);
|
||||
}
|
||||
|
||||
/*
|
||||
* erase the address range.
|
||||
*/
|
||||
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
|
||||
flash_sect_erase(start, end);
|
||||
wait_ms(100);
|
||||
/* strip the header - except for the kernel and app */
|
||||
if (idx == IDX_FIRMWARE || idx == IDX_DISK) {
|
||||
addr = (char *)((char *)hdr + sizeof(*hdr));
|
||||
#ifdef AU_UPDATE_TEST
|
||||
/* copy it to where Linux goes */
|
||||
if (idx == IDX_FIRMWARE)
|
||||
start = aufl_layout[1].start;
|
||||
#endif
|
||||
off = 0;
|
||||
nbytes = ntohl(hdr->ih_size);
|
||||
} else {
|
||||
addr = (char *)hdr;
|
||||
off = sizeof(*hdr);
|
||||
nbytes = sizeof(*hdr) + ntohl(hdr->ih_size);
|
||||
}
|
||||
|
||||
/* copy the data from RAM to FLASH */
|
||||
debug ("flash_write(%p, %lx %x)\n", addr, start, nbytes);
|
||||
rc = flash_write(addr, start, nbytes);
|
||||
if (rc != 0) {
|
||||
printf("Flashing failed due to error %d\n", rc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check the dcrc of the copy */
|
||||
if (crc32 (0, (char *)(start + off), ntohl(hdr->ih_size)) != ntohl(hdr->ih_dcrc)) {
|
||||
printf ("Image %s Bad Data Checksum After COPY\n", aufile[idx]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* protect the address range */
|
||||
/* this assumes that ONLY the firmware is protected! */
|
||||
if (idx == IDX_FIRMWARE)
|
||||
flash_sect_protect(1, start, end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
au_update_eeprom(int idx)
|
||||
{
|
||||
image_header_t *hdr;
|
||||
int off;
|
||||
uint32_t val;
|
||||
|
||||
hdr = (image_header_t *)LOAD_ADDR;
|
||||
/* write the time field into EEPROM */
|
||||
off = auee_off[idx].time;
|
||||
val = ntohl(hdr->ih_time);
|
||||
i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
|
||||
/* write the size field into EEPROM */
|
||||
off = auee_off[idx].size;
|
||||
val = ntohl(hdr->ih_size);
|
||||
i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
|
||||
/* write the dcrc field into EEPROM */
|
||||
off = auee_off[idx].dcrc;
|
||||
val = ntohl(hdr->ih_dcrc);
|
||||
i2c_write_multiple(0x54, off, 1, &val, sizeof(val));
|
||||
/* enable the power switch */
|
||||
*CPLD_VFD_BK &= ~POWER_OFF;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* this is called from board_init() after the hardware has been set up
|
||||
* and is usable. That seems like a good time to do this.
|
||||
* Right now the return value is ignored.
|
||||
*/
|
||||
int
|
||||
do_auto_update(void)
|
||||
{
|
||||
block_dev_desc_t *stor_dev;
|
||||
long sz;
|
||||
int i, res, bitmap_first, cnt, old_ctrlc, got_ctrlc;
|
||||
char *env;
|
||||
long start, end;
|
||||
|
||||
#undef ERASE_EEPROM
|
||||
#ifdef ERASE_EEPROM
|
||||
int arr[18];
|
||||
memset(arr, 0, sizeof(arr));
|
||||
i2c_write_multiple(0x54, 64, 1, arr, sizeof(arr));
|
||||
#endif
|
||||
au_usb_stor_curr_dev = -1;
|
||||
/* start USB */
|
||||
if (usb_stop() < 0) {
|
||||
debug ("usb_stop failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (usb_init() < 0) {
|
||||
debug ("usb_init failed\n");
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* check whether a storage device is attached (assume that it's
|
||||
* a USB memory stick, since nothing else should be attached).
|
||||
*/
|
||||
au_usb_stor_curr_dev = usb_stor_scan(1);
|
||||
if (au_usb_stor_curr_dev == -1) {
|
||||
debug ("No device found. Not initialized?\n");
|
||||
return -1;
|
||||
}
|
||||
/* check whether it has a partition table */
|
||||
stor_dev = get_dev("usb", 0);
|
||||
if (stor_dev == NULL) {
|
||||
debug ("uknown device type\n");
|
||||
return -1;
|
||||
}
|
||||
if (fat_register_device(stor_dev, 1) != 0) {
|
||||
debug ("Unable to use USB %d:%d for fatls\n",
|
||||
au_usb_stor_curr_dev, 1);
|
||||
return -1;
|
||||
}
|
||||
if (file_fat_detectfs() != 0) {
|
||||
debug ("file_fat_detectfs failed\n");
|
||||
}
|
||||
|
||||
/* initialize the array of file names */
|
||||
memset(aufile, 0, sizeof(aufile));
|
||||
aufile[IDX_PREPARE] = AU_PREPARE;
|
||||
aufile[IDX_PREINST] = AU_PREINST;
|
||||
aufile[IDX_FIRMWARE] = AU_FIRMWARE;
|
||||
aufile[IDX_KERNEL] = AU_KERNEL;
|
||||
aufile[IDX_APP] = AU_APP;
|
||||
aufile[IDX_DISK] = AU_DISK;
|
||||
aufile[IDX_POSTINST] = AU_POSTINST;
|
||||
/* initialize the array of flash sizes */
|
||||
memset(ausize, 0, sizeof(ausize));
|
||||
ausize[IDX_FIRMWARE] = (AU_FL_FIRMWARE_ND + 1) - AU_FL_FIRMWARE_ST;
|
||||
ausize[IDX_KERNEL] = (AU_FL_KERNEL_ND + 1) - AU_FL_KERNEL_ST;
|
||||
ausize[IDX_APP] = (AU_FL_APP_ND + 1) - AU_FL_APP_ST;
|
||||
ausize[IDX_DISK] = (AU_FL_DISK_ND + 1) - AU_FL_DISK_ST;
|
||||
/*
|
||||
* now check whether start and end are defined using environment
|
||||
* variables.
|
||||
*/
|
||||
start = -1;
|
||||
end = 0;
|
||||
env = getenv("firmware_st");
|
||||
if (env != NULL)
|
||||
start = simple_strtoul(env, NULL, 16);
|
||||
env = getenv("firmware_nd");
|
||||
if (env != NULL)
|
||||
end = simple_strtoul(env, NULL, 16);
|
||||
if (start >= 0 && end && end > start) {
|
||||
ausize[IDX_FIRMWARE] = (end + 1) - start;
|
||||
aufl_layout[0].start = start;
|
||||
aufl_layout[0].end = end;
|
||||
}
|
||||
start = -1;
|
||||
end = 0;
|
||||
env = getenv("kernel_st");
|
||||
if (env != NULL)
|
||||
start = simple_strtoul(env, NULL, 16);
|
||||
env = getenv("kernel_nd");
|
||||
if (env != NULL)
|
||||
end = simple_strtoul(env, NULL, 16);
|
||||
if (start >= 0 && end && end > start) {
|
||||
ausize[IDX_KERNEL] = (end + 1) - start;
|
||||
aufl_layout[1].start = start;
|
||||
aufl_layout[1].end = end;
|
||||
}
|
||||
start = -1;
|
||||
end = 0;
|
||||
env = getenv("app_st");
|
||||
if (env != NULL)
|
||||
start = simple_strtoul(env, NULL, 16);
|
||||
env = getenv("app_nd");
|
||||
if (env != NULL)
|
||||
end = simple_strtoul(env, NULL, 16);
|
||||
if (start >= 0 && end && end > start) {
|
||||
ausize[IDX_APP] = (end + 1) - start;
|
||||
aufl_layout[2].start = start;
|
||||
aufl_layout[2].end = end;
|
||||
}
|
||||
start = -1;
|
||||
end = 0;
|
||||
env = getenv("disk_st");
|
||||
if (env != NULL)
|
||||
start = simple_strtoul(env, NULL, 16);
|
||||
env = getenv("disk_nd");
|
||||
if (env != NULL)
|
||||
end = simple_strtoul(env, NULL, 16);
|
||||
if (start >= 0 && end && end > start) {
|
||||
ausize[IDX_DISK] = (end + 1) - start;
|
||||
aufl_layout[3].start = start;
|
||||
aufl_layout[3].end = end;
|
||||
}
|
||||
/* make sure that we see CTRL-C and save the old state */
|
||||
old_ctrlc = disable_ctrlc(0);
|
||||
|
||||
bitmap_first = 0;
|
||||
/* just loop thru all the possible files */
|
||||
for (i = 0; i < AU_MAXFILES; i++) {
|
||||
sz = file_fat_read(aufile[i], LOAD_ADDR, MAX_LOADSZ);
|
||||
debug ("read %s sz %ld hdr %d\n",
|
||||
aufile[i], sz, sizeof(image_header_t));
|
||||
if (sz <= 0 || sz <= sizeof(image_header_t)) {
|
||||
debug ("%s not found\n", aufile[i]);
|
||||
continue;
|
||||
}
|
||||
if (au_check_valid(i, sz) < 0) {
|
||||
debug ("%s not valid\n", aufile[i]);
|
||||
continue;
|
||||
}
|
||||
#ifdef CONFIG_VFD
|
||||
/* now that we have a valid file we can display the */
|
||||
/* bitmap. */
|
||||
if (bitmap_first == 0) {
|
||||
env = getenv("bitmap2");
|
||||
if (env == NULL) {
|
||||
trab_vfd(0);
|
||||
} else {
|
||||
/* not so simple - bitmap2 is supposed to */
|
||||
/* contain the address of the bitmap */
|
||||
env = (char *)simple_strtoul(env, NULL, 16);
|
||||
/* NOTE: these are taken from vfd_logo.h. If that file changes then */
|
||||
/* these defines MUST also be updated! These may be wrong for bitmap2. */
|
||||
#define VFD_LOGO_WIDTH 112
|
||||
#define VFD_LOGO_HEIGHT 72
|
||||
/* must call transfer_pic directly */
|
||||
transfer_pic(3, env, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
|
||||
}
|
||||
bitmap_first = 1;
|
||||
}
|
||||
#endif
|
||||
/* this is really not a good idea, but it's what the */
|
||||
/* customer wants. */
|
||||
cnt = 0;
|
||||
got_ctrlc = 0;
|
||||
do {
|
||||
res = au_do_update(i, sz);
|
||||
/* let the user break out of the loop */
|
||||
if (ctrlc() || had_ctrlc()) {
|
||||
clear_ctrlc();
|
||||
if (res < 0)
|
||||
got_ctrlc = 1;
|
||||
break;
|
||||
}
|
||||
cnt++;
|
||||
#ifdef AU_TEST_ONLY
|
||||
} while (res < 0 && cnt < 3);
|
||||
if (cnt < 3)
|
||||
#else
|
||||
} while (res < 0);
|
||||
#endif
|
||||
/*
|
||||
* it doesn't make sense to update the EEPROM if the
|
||||
* update was interrupted by the user due to errors.
|
||||
*/
|
||||
if (got_ctrlc == 0)
|
||||
au_update_eeprom(i);
|
||||
else
|
||||
/* enable the power switch */
|
||||
*CPLD_VFD_BK &= ~POWER_OFF;
|
||||
}
|
||||
usb_stop();
|
||||
/* restore the old state */
|
||||
disable_ctrlc(old_ctrlc);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_AUTO_UPDATE */
|
||||
+425
-404
File diff suppressed because it is too large.
Load diff
@@ -8,16 +8,19 @@
|
||||
#
|
||||
|
||||
#
|
||||
# TRAB has 1 bank of 16 MB DRAM
|
||||
# TRAB has 1 bank of 16 MB or 32 MB DRAM
|
||||
#
|
||||
# 0c00'0000 to 0e00'0000
|
||||
#
|
||||
# Linux-Kernel is expected to be at 0c00'8000, entry 0c00'8000
|
||||
#
|
||||
# we load ourself to 0cf0'0000
|
||||
# we load ourself to 0CF0'0000 / 0DF0'0000
|
||||
#
|
||||
# download areas is 0c80'0000
|
||||
# download areas is 0C80'0000
|
||||
#
|
||||
|
||||
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
|
||||
|
||||
TEXT_BASE = 0x0cf00000
|
||||
ifndef TEXT_BASE
|
||||
TEXT_BASE = 0x0DF00000
|
||||
endif
|
||||
+19
-3
@@ -5,7 +5,7 @@
|
||||
* Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
|
||||
*
|
||||
* Modified for the TRAB board by
|
||||
* (C) Copyright 2002
|
||||
* (C) Copyright 2002-2003
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -101,6 +101,17 @@
|
||||
#define B5_Tacp 0x0
|
||||
#define B5_PMC 0x0 /* normal */
|
||||
|
||||
#ifndef CONFIG_RAM_16MB /* 32 MB RAM */
|
||||
/* Bank6 */
|
||||
#define B6_MT 0x3 /* SDRAM */
|
||||
#define B6_Trcd 0x0 /* 2clk */
|
||||
#define B6_SCAN 0x1 /* 9 bit */
|
||||
|
||||
/* Bank7 */
|
||||
#define B7_MT 0x3 /* SDRAM */
|
||||
#define B7_Trcd 0x0 /* 2clk */
|
||||
#define B7_SCAN 0x1 /* 9 bit */
|
||||
#else /* CONFIG_RAM_16MB = 16 MB RAM */
|
||||
/* Bank6 */
|
||||
#define B6_MT 0x3 /* SDRAM */
|
||||
#define B6_Trcd 0x1 /* 2clk */
|
||||
@@ -110,6 +121,7 @@
|
||||
#define B7_MT 0x3 /* SDRAM */
|
||||
#define B7_Trcd 0x1 /* 2clk */
|
||||
#define B7_SCAN 0x0 /* 8 bit */
|
||||
#endif /* CONFIG_RAM_16MB */
|
||||
|
||||
/* refresh parameter */
|
||||
#define REFEN 0x1 /* enable refresh */
|
||||
@@ -161,6 +173,10 @@ SMRDATA:
|
||||
.word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN)) /* GCS6 */
|
||||
.word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) /* GCS7 */
|
||||
.word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)
|
||||
#ifndef CONFIG_RAM_16MB /* 32 MB RAM */
|
||||
.word 0x10 /* BUSWIDTH=32, SCLK power saving mode, BANKSIZE 32M/32M */
|
||||
#else /* CONFIG_RAM_16MB = 16 MB RAM */
|
||||
.word 0x17 /* BUSWIDTH=32, SCLK power saving mode, BANKSIZE 16M/16M */
|
||||
.word 0x30 /* MRSR6, CL=3clk */
|
||||
.word 0x30 /* MRSR7 */
|
||||
#endif /* CONFIG_RAM_16MB */
|
||||
.word 0x20 /* MRSR6, CL=2clk */
|
||||
.word 0x20 /* MRSR7 */
|
||||
+18
-18
@@ -47,8 +47,8 @@ static void rs485_setbrg (void)
|
||||
unsigned int reg = 0;
|
||||
|
||||
/* value is calculated so : (int)(PCLK/16./baudrate) -1 */
|
||||
/* reg = (33000000 / (16 * gd->baudrate)) - 1; */
|
||||
reg = (33000000 / (16 * 38.400)) - 1;
|
||||
/* reg = (33000000 / (16 * gd->baudrate)) - 1; */
|
||||
reg = (33000000 / (16 * 38400)) - 1;
|
||||
|
||||
/* FIFO enable, Tx/Rx FIFO clear */
|
||||
uart->UFCON = 0x07;
|
||||
@@ -67,18 +67,18 @@ static void rs485_setbrg (void)
|
||||
|
||||
static void rs485_cfgio (void)
|
||||
{
|
||||
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
|
||||
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
|
||||
|
||||
gpio->PFCON &= ~(0x3 << 2);
|
||||
gpio->PFCON |= (0x2 << 2); /* configure GPF1 as RXD1 */
|
||||
gpio->PFCON &= ~(0x3 << 2);
|
||||
gpio->PFCON |= (0x2 << 2); /* configure GPF1 as RXD1 */
|
||||
|
||||
gpio->PFCON &= ~(0x3 << 6);
|
||||
gpio->PFCON |= (0x2 << 6); /* configure GPF3 as TXD1 */
|
||||
gpio->PFCON &= ~(0x3 << 6);
|
||||
gpio->PFCON |= (0x2 << 6); /* configure GPF3 as TXD1 */
|
||||
|
||||
gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */
|
||||
gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */
|
||||
gpio->PFUP |= (1 << 1); /* disable pullup on GPF1 */
|
||||
gpio->PFUP |= (1 << 3); /* disable pullup on GPF3 */
|
||||
|
||||
gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */
|
||||
gpio->PACON &= ~(1 << 11); /* set GPA11 (RS485_DE) to output */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -88,8 +88,8 @@ static void rs485_cfgio (void)
|
||||
*/
|
||||
int rs485_init (void)
|
||||
{
|
||||
rs485_cfgio ();
|
||||
rs485_setbrg ();
|
||||
rs485_cfgio ();
|
||||
rs485_setbrg ();
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -168,13 +168,13 @@ static void set_rs485re(unsigned char rs485re_state)
|
||||
|
||||
static void set_rs485de(unsigned char rs485de_state)
|
||||
{
|
||||
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
|
||||
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
|
||||
|
||||
/* This is on PORT A bit 11 */
|
||||
if(rs485de_state)
|
||||
gpio->PADAT |= (1 << 11);
|
||||
else
|
||||
gpio->PADAT &= ~(1 << 11);
|
||||
/* This is on PORT A bit 11 */
|
||||
if(rs485de_state)
|
||||
gpio->PADAT |= (1 << 11);
|
||||
else
|
||||
gpio->PADAT &= ~(1 << 11);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +169,12 @@ int misc_init_r (void)
|
||||
uchar *str;
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_AUTO_UPDATE
|
||||
extern int do_auto_update(void);
|
||||
/* this has priority over all else */
|
||||
do_auto_update();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < KEYBD_KEY_NUM; ++i) {
|
||||
keybd_env[i] = '0' + ((kbd_data >> i) & 1);
|
||||
}
|
||||
|
||||
+878
-558
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
||||
|
||||
#
|
||||
# (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
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# Modified by, Yuli Barcohen, Arabella Software Ltd. <yuli@arabellasw.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
|
||||
#
|
||||
|
||||
#
|
||||
# ZPC.1900 board
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xFFF00000
|
||||
#TEXT_BASE = 0x03000000
|
||||
@@ -0,0 +1,818 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Brad Kemp, Seranoa Networks, Brad.Kemp@seranoa.com
|
||||
*
|
||||
* Copyright (C) 2003 Arabella Software Ltd.
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
* Modified to work with AMD flashes
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#undef DEBUG_FLASH
|
||||
/*
|
||||
* This file implements a Common Flash Interface (CFI) driver for U-Boot.
|
||||
* The width of the port and the width of the chips are determined at initialization.
|
||||
* These widths are used to calculate the address for access CFI data structures.
|
||||
* It has been tested on an Intel Strataflash implementation and AMD 29F016D.
|
||||
*
|
||||
* References
|
||||
* JEDEC Standard JESD68 - Common Flash Interface (CFI)
|
||||
* JEDEC Standard JEP137-A Common Flash Interface (CFI) ID Codes
|
||||
* Intel Application Note 646 Common Flash Interface (CFI) and Command Sets
|
||||
* Intel 290667-008 3 Volt Intel StrataFlash Memory datasheet
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
* Use Primary Extended Query table (PRI) and Alternate Algorithm Query
|
||||
* Table (ALT) to determine if protection is available
|
||||
*
|
||||
* Add support for other command sets Use the PRI and ALT to determine command set
|
||||
* Verify erase and program timeouts.
|
||||
*/
|
||||
|
||||
#define FLASH_CMD_CFI 0x98
|
||||
#define FLASH_CMD_READ_ID 0x90
|
||||
#define FLASH_CMD_RESET 0xff
|
||||
#define FLASH_CMD_BLOCK_ERASE 0x20
|
||||
#define FLASH_CMD_ERASE_CONFIRM 0xD0
|
||||
#define FLASH_CMD_WRITE 0x40
|
||||
#define FLASH_CMD_PROTECT 0x60
|
||||
#define FLASH_CMD_PROTECT_SET 0x01
|
||||
#define FLASH_CMD_PROTECT_CLEAR 0xD0
|
||||
#define FLASH_CMD_CLEAR_STATUS 0x50
|
||||
#define FLASH_CMD_WRITE_TO_BUFFER 0xE8
|
||||
#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0
|
||||
|
||||
#define FLASH_STATUS_DONE 0x80
|
||||
#define FLASH_STATUS_ESS 0x40
|
||||
#define FLASH_STATUS_ECLBS 0x20
|
||||
#define FLASH_STATUS_PSLBS 0x10
|
||||
#define FLASH_STATUS_VPENS 0x08
|
||||
#define FLASH_STATUS_PSS 0x04
|
||||
#define FLASH_STATUS_DPS 0x02
|
||||
#define FLASH_STATUS_R 0x01
|
||||
#define FLASH_STATUS_PROTECT 0x01
|
||||
|
||||
#define AMD_CMD_RESET 0xF0
|
||||
#define AMD_CMD_WRITE 0xA0
|
||||
#define AMD_CMD_ERASE_START 0x80
|
||||
#define AMD_CMD_ERASE_SECTOR 0x30
|
||||
|
||||
#define AMD_STATUS_TOGGLE 0x40
|
||||
#define AMD_STATUS_ERROR 0x20
|
||||
|
||||
#define FLASH_OFFSET_CFI 0x55
|
||||
#define FLASH_OFFSET_CFI_RESP 0x10
|
||||
#define FLASH_OFFSET_WTOUT 0x1F
|
||||
#define FLASH_OFFSET_WBTOUT 0x20
|
||||
#define FLASH_OFFSET_ETOUT 0x21
|
||||
#define FLASH_OFFSET_CETOUT 0x22
|
||||
#define FLASH_OFFSET_WMAX_TOUT 0x23
|
||||
#define FLASH_OFFSET_WBMAX_TOUT 0x24
|
||||
#define FLASH_OFFSET_EMAX_TOUT 0x25
|
||||
#define FLASH_OFFSET_CEMAX_TOUT 0x26
|
||||
#define FLASH_OFFSET_SIZE 0x27
|
||||
#define FLASH_OFFSET_INTERFACE 0x28
|
||||
#define FLASH_OFFSET_BUFFER_SIZE 0x2A
|
||||
#define FLASH_OFFSET_NUM_ERASE_REGIONS 0x2C
|
||||
#define FLASH_OFFSET_ERASE_REGIONS 0x2D
|
||||
#define FLASH_OFFSET_PROTECT 0x02
|
||||
#define FLASH_OFFSET_USER_PROTECTION 0x85
|
||||
#define FLASH_OFFSET_INTEL_PROTECTION 0x81
|
||||
|
||||
|
||||
#define FLASH_MAN_CFI 0x01000000
|
||||
|
||||
|
||||
typedef union {
|
||||
unsigned char c;
|
||||
unsigned short w;
|
||||
unsigned long l;
|
||||
} cfiword_t;
|
||||
|
||||
typedef union {
|
||||
volatile unsigned char *cp;
|
||||
volatile unsigned short *wp;
|
||||
volatile unsigned long *lp;
|
||||
} cfiptr_t;
|
||||
|
||||
#define NUM_ERASE_REGIONS 4
|
||||
|
||||
static ulong bank_base[CFG_MAX_FLASH_BANKS] = CFG_FLASH_BANKS_LIST;
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
|
||||
|
||||
static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c);
|
||||
static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf);
|
||||
static void flash_write_cmd(flash_info_t * info, int sect, uint offset, uchar cmd);
|
||||
static void flash_unlock_seq(flash_info_t *info);
|
||||
static int flash_isequal(flash_info_t * info, int sect, uint offset, uchar cmd);
|
||||
static int flash_isset(flash_info_t * info, int sect, uint offset, uchar cmd);
|
||||
static int flash_toggle(flash_info_t * info, int sect, uint offset, uchar cmd);
|
||||
static int flash_detect_cfi(flash_info_t * info);
|
||||
static ulong flash_get_size (ulong base, int banknum);
|
||||
static int flash_write_cfiword (flash_info_t *info, ulong dest, cfiword_t cword);
|
||||
static int flash_full_status_check(flash_info_t * info, ulong sector, ulong tout, char * prompt);
|
||||
#ifdef CFG_FLASH_USE_BUFFER_WRITE
|
||||
static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len);
|
||||
#endif
|
||||
/*-----------------------------------------------------------------------
|
||||
* create an address based on the offset and the port width
|
||||
*/
|
||||
inline uchar * flash_make_addr(flash_info_t * info, int sect, uint offset)
|
||||
{
|
||||
return ((uchar *)(info->start[sect] + (offset * info->portwidth)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
* read a character at a port width address
|
||||
*/
|
||||
inline uchar flash_read_uchar(flash_info_t * info, uint offset)
|
||||
{
|
||||
uchar *cp;
|
||||
cp = flash_make_addr(info, 0, offset);
|
||||
return (cp[info->portwidth - 1]);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* read a short word by swapping for ppc format.
|
||||
*/
|
||||
ushort flash_read_ushort(flash_info_t * info, int sect, uint offset)
|
||||
{
|
||||
uchar * addr;
|
||||
|
||||
addr = flash_make_addr(info, sect, offset);
|
||||
return ((addr[(2*info->portwidth) - 1] << 8) | addr[info->portwidth - 1]);
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* read a long word by picking the least significant byte of each maiximum
|
||||
* port size word. Swap for ppc format.
|
||||
*/
|
||||
ulong flash_read_long(flash_info_t * info, int sect, uint offset)
|
||||
{
|
||||
uchar * addr;
|
||||
|
||||
addr = flash_make_addr(info, sect, offset);
|
||||
return ( (addr[(2*info->portwidth) - 1] << 24 ) | (addr[(info->portwidth) -1] << 16) |
|
||||
(addr[(4*info->portwidth) - 1] << 8) | addr[(3*info->portwidth) - 1]);
|
||||
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size = 0;
|
||||
int i;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
size += flash_info[i].size = flash_get_size(bank_base[i], i);
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
|
||||
i, flash_info[i].size, flash_info[i].size << 20);
|
||||
}
|
||||
}
|
||||
|
||||
/* Monitor protection ON by default */
|
||||
#if (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE + monitor_flash_len - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int rcode = 0;
|
||||
int prot;
|
||||
int sect;
|
||||
|
||||
if( info->flash_id != FLASH_MAN_CFI) {
|
||||
printf ("Can't erase unknown flash type - aborted\n");
|
||||
return 1;
|
||||
}
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
printf ("- no sectors to erase\n");
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
#ifdef INTEL_COMMANDS
|
||||
flash_write_cmd(info, sect, 0, FLASH_CMD_CLEAR_STATUS);
|
||||
flash_write_cmd(info, sect, 0, FLASH_CMD_BLOCK_ERASE);
|
||||
flash_write_cmd(info, sect, 0, FLASH_CMD_ERASE_CONFIRM);
|
||||
#else
|
||||
flash_unlock_seq(info);
|
||||
flash_write_cmd(info, sect, 0x555, AMD_CMD_ERASE_START);
|
||||
flash_unlock_seq(info);
|
||||
flash_write_cmd(info, sect, 0, AMD_CMD_ERASE_SECTOR);
|
||||
#endif
|
||||
|
||||
if(flash_full_status_check(info, sect, info->erase_blk_tout, "erase")) {
|
||||
rcode = 1;
|
||||
} else
|
||||
printf(".");
|
||||
}
|
||||
}
|
||||
printf (" done\n");
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id != FLASH_MAN_CFI) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("CFI conformant FLASH (%d x %d)",
|
||||
(info->portwidth << 3 ), (info->chipwidth << 3 ));
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
printf(" Erase timeout %ld ms, write timeout %ld ms, buffer write timeout %ld ms, buffer size %d\n",
|
||||
info->erase_blk_tout, info->write_tout, info->buffer_write_tout, info->buffer_size);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n");
|
||||
printf (" %08lX%5s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* 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 wp;
|
||||
ulong cp;
|
||||
int aln;
|
||||
cfiword_t cword;
|
||||
int i, rc;
|
||||
|
||||
/* get lower aligned address */
|
||||
wp = (addr & ~(info->portwidth - 1));
|
||||
|
||||
/* handle unaligned start */
|
||||
if((aln = addr - wp) != 0) {
|
||||
cword.l = 0;
|
||||
cp = wp;
|
||||
for(i=0;i<aln; ++i, ++cp)
|
||||
flash_add_byte(info, &cword, (*(uchar *)cp));
|
||||
|
||||
for(; (i< info->portwidth) && (cnt > 0) ; i++) {
|
||||
flash_add_byte(info, &cword, *src++);
|
||||
cnt--;
|
||||
cp++;
|
||||
}
|
||||
for(; (cnt == 0) && (i < info->portwidth); ++i, ++cp)
|
||||
flash_add_byte(info, &cword, (*(uchar *)cp));
|
||||
if((rc = flash_write_cfiword(info, wp, cword)) != 0)
|
||||
return rc;
|
||||
wp = cp;
|
||||
}
|
||||
|
||||
#ifdef CFG_FLASH_USE_BUFFER_WRITE
|
||||
while(cnt >= info->portwidth) {
|
||||
i = info->buffer_size > cnt? cnt: info->buffer_size;
|
||||
if((rc = flash_write_cfibuffer(info, wp, src,i)) != ERR_OK)
|
||||
return rc;
|
||||
wp += i;
|
||||
src += i;
|
||||
cnt -=i;
|
||||
}
|
||||
#else
|
||||
/* handle the aligned part */
|
||||
while(cnt >= info->portwidth) {
|
||||
cword.l = 0;
|
||||
for(i = 0; i < info->portwidth; i++) {
|
||||
flash_add_byte(info, &cword, *src++);
|
||||
}
|
||||
if((rc = flash_write_cfiword(info, wp, cword)) != 0)
|
||||
return rc;
|
||||
wp += info->portwidth;
|
||||
cnt -= info->portwidth;
|
||||
}
|
||||
#endif /* CFG_FLASH_USE_BUFFER_WRITE */
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
cword.l = 0;
|
||||
for (i=0, cp=wp; (i<info->portwidth) && (cnt>0); ++i, ++cp) {
|
||||
flash_add_byte(info, &cword, *src++);
|
||||
--cnt;
|
||||
}
|
||||
for (; i<info->portwidth; ++i, ++cp) {
|
||||
flash_add_byte(info, & cword, (*(uchar *)cp));
|
||||
}
|
||||
|
||||
return flash_write_cfiword(info, wp, cword);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef CFG_FLASH_PROTECTION
|
||||
|
||||
int flash_real_protect(flash_info_t *info, long sector, int prot)
|
||||
{
|
||||
int retcode = 0;
|
||||
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT);
|
||||
if(prot)
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_SET);
|
||||
else
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT_CLEAR);
|
||||
|
||||
if((retcode = flash_full_status_check(info, sector, info->erase_blk_tout,
|
||||
prot?"protect":"unprotect")) == 0) {
|
||||
|
||||
info->protect[sector] = prot;
|
||||
/* Intel's unprotect unprotects all locking */
|
||||
if(prot == 0) {
|
||||
int i;
|
||||
for(i = 0 ; i<info->sector_count; i++) {
|
||||
if(info->protect[i])
|
||||
flash_real_protect(info, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
#endif /* CFG_FLASH_PROTECTION */
|
||||
/*-----------------------------------------------------------------------
|
||||
* wait for XSR.7 to be set. Time out with an error if it does not.
|
||||
* This routine does not set the flash to read-array mode.
|
||||
*/
|
||||
static int flash_status_check(flash_info_t * info, ulong sector, ulong tout, char * prompt)
|
||||
{
|
||||
ulong start;
|
||||
|
||||
/* Wait for command completion */
|
||||
start = get_timer (0);
|
||||
while (
|
||||
#ifdef INTEL_COMMANDS
|
||||
!flash_isset(info, sector, 0, FLASH_STATUS_DONE)
|
||||
#else
|
||||
flash_toggle(info, sector, 0, AMD_STATUS_TOGGLE)
|
||||
#endif
|
||||
) {
|
||||
if (get_timer(start) > info->erase_blk_tout) {
|
||||
printf("Flash %s timeout at address %lx\n", prompt, info->start[sector]);
|
||||
#ifdef INTEL_COMMANDS
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_RESET);
|
||||
#else
|
||||
flash_write_cmd(info, sector, 0, AMD_CMD_RESET);
|
||||
#endif
|
||||
return ERR_TIMOUT;
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
* Wait for XSR.7 to be set, if it times out print an error, otherwise do a full status check.
|
||||
* This routine sets the flash to read-array mode.
|
||||
*/
|
||||
static int flash_full_status_check(flash_info_t * info, ulong sector, ulong tout, char * prompt)
|
||||
{
|
||||
int retcode;
|
||||
retcode = flash_status_check(info, sector, tout, prompt);
|
||||
#ifdef INTEL_COMMANDS
|
||||
if((retcode == ERR_OK) && !flash_isequal(info,sector, 0, FLASH_STATUS_DONE)) {
|
||||
retcode = ERR_INVAL;
|
||||
printf("Flash %s error at address %lx\n", prompt,info->start[sector]);
|
||||
if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS | FLASH_STATUS_PSLBS)){
|
||||
printf("Command Sequence Error.\n");
|
||||
} else if(flash_isset(info, sector, 0, FLASH_STATUS_ECLBS)){
|
||||
printf("Block Erase Error.\n");
|
||||
retcode = ERR_NOT_ERASED;
|
||||
} else if (flash_isset(info, sector, 0, FLASH_STATUS_PSLBS)) {
|
||||
printf("Locking Error\n");
|
||||
}
|
||||
if(flash_isset(info, sector, 0, FLASH_STATUS_DPS)){
|
||||
printf("Block locked.\n");
|
||||
retcode = ERR_PROTECTED;
|
||||
}
|
||||
if(flash_isset(info, sector, 0, FLASH_STATUS_VPENS))
|
||||
printf("Vpp Low Error.\n");
|
||||
}
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_RESET);
|
||||
#endif
|
||||
return retcode;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_add_byte(flash_info_t *info, cfiword_t * cword, uchar c)
|
||||
{
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
cword->c = c;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
cword->w = (cword->w << 8) | c;
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
cword->l = (cword->l << 8) | c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* make a proper sized command based on the port and chip widths
|
||||
*/
|
||||
static void flash_make_cmd(flash_info_t * info, uchar cmd, void * cmdbuf)
|
||||
{
|
||||
int i;
|
||||
uchar *cp = (uchar *)cmdbuf;
|
||||
for(i=0; i< info->portwidth; i++)
|
||||
*cp++ = ((i+1) % info->chipwidth) ? '\0':cmd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a proper sized command to the correct address
|
||||
*/
|
||||
static void flash_write_cmd(flash_info_t * info, int sect, uint offset, uchar cmd)
|
||||
{
|
||||
|
||||
volatile cfiptr_t addr;
|
||||
cfiword_t cword;
|
||||
addr.cp = flash_make_addr(info, sect, offset);
|
||||
flash_make_cmd(info, cmd, &cword);
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
*addr.cp = cword.c;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
*addr.wp = cword.w;
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
*addr.lp = cword.l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void flash_unlock_seq(flash_info_t *info)
|
||||
{
|
||||
flash_write_cmd(info, 0, 0x555, 0xAA);
|
||||
flash_write_cmd(info, 0, 0x2AA, 0x55);
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int flash_isequal(flash_info_t * info, int sect, uint offset, uchar cmd)
|
||||
{
|
||||
cfiptr_t cptr;
|
||||
cfiword_t cword;
|
||||
int retval;
|
||||
cptr.cp = flash_make_addr(info, sect, offset);
|
||||
flash_make_cmd(info, cmd, &cword);
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
retval = (cptr.cp[0] == cword.c);
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
retval = (cptr.wp[0] == cword.w);
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
retval = (cptr.lp[0] == cword.l);
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int flash_isset(flash_info_t * info, int sect, uint offset, uchar cmd)
|
||||
{
|
||||
cfiptr_t cptr;
|
||||
cfiword_t cword;
|
||||
int retval;
|
||||
cptr.cp = flash_make_addr(info, sect, offset);
|
||||
flash_make_cmd(info, cmd, &cword);
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
retval = ((cptr.cp[0] & cword.c) == cword.c);
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
retval = ((cptr.wp[0] & cword.w) == cword.w);
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
retval = ((cptr.lp[0] & cword.l) == cword.l);
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int flash_toggle(flash_info_t * info, int sect, uint offset, uchar cmd)
|
||||
{
|
||||
cfiptr_t cptr;
|
||||
cfiword_t cword;
|
||||
int retval;
|
||||
cptr.cp = flash_make_addr(info, sect, offset);
|
||||
flash_make_cmd(info, cmd, &cword);
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
retval = ((cptr.cp[0] & cword.c) != (cptr.cp[0] & cword.c));
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
retval = ((cptr.wp[0] & cword.w) != (cptr.wp[0] & cword.w));
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
retval = ((cptr.lp[0] & cword.l) != (cptr.lp[0] & cword.l));
|
||||
break;
|
||||
default:
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* detect if flash is compatible with the Common Flash Interface (CFI)
|
||||
* http://www.jedec.org/download/search/jesd68.pdf
|
||||
*
|
||||
*/
|
||||
static int flash_detect_cfi(flash_info_t * info)
|
||||
{
|
||||
|
||||
for(info->portwidth=FLASH_CFI_8BIT; info->portwidth <= FLASH_CFI_32BIT;
|
||||
info->portwidth <<= 1) {
|
||||
for(info->chipwidth =FLASH_CFI_BY8;
|
||||
info->chipwidth <= info->portwidth;
|
||||
info->chipwidth <<= 1) {
|
||||
flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
|
||||
flash_write_cmd(info, 0, FLASH_OFFSET_CFI, FLASH_CMD_CFI);
|
||||
if(flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP,'Q') &&
|
||||
flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 1, 'R') &&
|
||||
flash_isequal(info, 0, FLASH_OFFSET_CFI_RESP + 2, 'Y'))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*
|
||||
*/
|
||||
static ulong flash_get_size (ulong base, int banknum)
|
||||
{
|
||||
flash_info_t * info = &flash_info[banknum];
|
||||
int i, j;
|
||||
int sect_cnt;
|
||||
unsigned long sector;
|
||||
unsigned long tmp;
|
||||
int size_ratio;
|
||||
uchar num_erase_regions;
|
||||
int erase_region_size;
|
||||
int erase_region_count;
|
||||
|
||||
info->start[0] = base;
|
||||
|
||||
if(flash_detect_cfi(info)){
|
||||
size_ratio = info->portwidth / info->chipwidth;
|
||||
num_erase_regions = flash_read_uchar(info, FLASH_OFFSET_NUM_ERASE_REGIONS);
|
||||
#ifdef DEBUG_FLASH
|
||||
printf("found %d erase regions\n", num_erase_regions);
|
||||
#endif
|
||||
sect_cnt = 0;
|
||||
sector = base;
|
||||
for(i = 0 ; i < num_erase_regions; i++) {
|
||||
if(i > NUM_ERASE_REGIONS) {
|
||||
printf("%d erase regions found, only %d used\n",
|
||||
num_erase_regions, NUM_ERASE_REGIONS);
|
||||
break;
|
||||
}
|
||||
tmp = flash_read_long(info, 0, FLASH_OFFSET_ERASE_REGIONS);
|
||||
erase_region_size = (tmp & 0xffff)? ((tmp & 0xffff) * 256): 128;
|
||||
tmp >>= 16;
|
||||
erase_region_count = (tmp & 0xffff) +1;
|
||||
for(j = 0; j< erase_region_count; j++) {
|
||||
info->start[sect_cnt] = sector;
|
||||
sector += (erase_region_size * size_ratio);
|
||||
info->protect[sect_cnt] = flash_isset(info, sect_cnt, FLASH_OFFSET_PROTECT, FLASH_STATUS_PROTECT);
|
||||
sect_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
info->sector_count = sect_cnt;
|
||||
/* multiply the size by the number of chips */
|
||||
info->size = (1 << flash_read_uchar(info, FLASH_OFFSET_SIZE)) * size_ratio;
|
||||
info->buffer_size = (1 << flash_read_ushort(info, 0, FLASH_OFFSET_BUFFER_SIZE));
|
||||
tmp = 1 << flash_read_uchar(info, FLASH_OFFSET_ETOUT);
|
||||
info->erase_blk_tout = (tmp * (1 << flash_read_uchar(info, FLASH_OFFSET_EMAX_TOUT)));
|
||||
tmp = 1 << flash_read_uchar(info, FLASH_OFFSET_WBTOUT);
|
||||
info->buffer_write_tout = (tmp * (1 << flash_read_uchar(info, FLASH_OFFSET_WBMAX_TOUT)));
|
||||
tmp = 1 << flash_read_uchar(info, FLASH_OFFSET_WTOUT);
|
||||
info->write_tout = (tmp * (1 << flash_read_uchar(info, FLASH_OFFSET_WMAX_TOUT)))/ 1000;
|
||||
info->flash_id = FLASH_MAN_CFI;
|
||||
}
|
||||
|
||||
flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
|
||||
return(info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int flash_write_cfiword (flash_info_t *info, ulong dest, cfiword_t cword)
|
||||
{
|
||||
|
||||
cfiptr_t ctladdr;
|
||||
cfiptr_t cptr;
|
||||
int flag;
|
||||
|
||||
ctladdr.cp = flash_make_addr(info, 0, 0);
|
||||
cptr.cp = (uchar *)dest;
|
||||
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
flag = ((cptr.cp[0] & cword.c) == cword.c);
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
flag = ((cptr.wp[0] & cword.w) == cword.w);
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
flag = ((cptr.lp[0] & cword.l) == cword.l);
|
||||
break;
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
if(!flag)
|
||||
return 2;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
#ifdef INTEL_COMMANDS
|
||||
flash_write_cmd(info, 0, 0, FLASH_CMD_CLEAR_STATUS);
|
||||
flash_write_cmd(info, 0, 0, FLASH_CMD_WRITE);
|
||||
#else
|
||||
flash_unlock_seq(info);
|
||||
flash_write_cmd(info, 0, 0x555, AMD_CMD_WRITE);
|
||||
#endif
|
||||
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
cptr.cp[0] = cword.c;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
cptr.wp[0] = cword.w;
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
cptr.lp[0] = cword.l;
|
||||
break;
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if(flag)
|
||||
enable_interrupts();
|
||||
|
||||
return flash_full_status_check(info, 0, info->write_tout, "write");
|
||||
}
|
||||
|
||||
#ifdef CFG_FLASH_USE_BUFFER_WRITE
|
||||
|
||||
/* loop through the sectors from the highest address
|
||||
* when the passed address is greater or equal to the sector address
|
||||
* we have a match
|
||||
*/
|
||||
static int find_sector(flash_info_t *info, ulong addr)
|
||||
{
|
||||
int sector;
|
||||
for(sector = info->sector_count - 1; sector >= 0; sector--) {
|
||||
if(addr >= info->start[sector])
|
||||
break;
|
||||
}
|
||||
return sector;
|
||||
}
|
||||
|
||||
static int flash_write_cfibuffer(flash_info_t * info, ulong dest, uchar * cp, int len)
|
||||
{
|
||||
|
||||
int sector;
|
||||
int cnt;
|
||||
int retcode;
|
||||
volatile cfiptr_t src;
|
||||
volatile cfiptr_t dst;
|
||||
|
||||
src.cp = cp;
|
||||
dst.cp = (uchar *)dest;
|
||||
sector = find_sector(info, dest);
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_TO_BUFFER);
|
||||
if((retcode = flash_status_check(info, sector, info->buffer_write_tout,
|
||||
"write to buffer")) == ERR_OK) {
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
cnt = len;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
cnt = len >> 1;
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
cnt = len >> 2;
|
||||
break;
|
||||
default:
|
||||
return ERR_INVAL;
|
||||
break;
|
||||
}
|
||||
flash_write_cmd(info, sector, 0, (uchar)cnt-1);
|
||||
while(cnt-- > 0) {
|
||||
switch(info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
*dst.cp++ = *src.cp++;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
*dst.wp++ = *src.wp++;
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
*dst.lp++ = *src.lp++;
|
||||
break;
|
||||
default:
|
||||
return ERR_INVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM);
|
||||
retcode = flash_full_status_check(info, sector, info->buffer_write_tout,
|
||||
"buffer write");
|
||||
}
|
||||
flash_write_cmd(info, sector, 0, FLASH_CMD_CLEAR_STATUS);
|
||||
return retcode;
|
||||
}
|
||||
#endif /* CFG_USE_FLASH_BUFFER_WRITE */
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* Modified by Yuli Barcohen <yuli@arabellasw.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)
|
||||
SECTIONS
|
||||
{
|
||||
/* 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/mpc8260/start.o (.text)
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
. = ALIGN(16);
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x0FFF) & 0xFFFFF000;
|
||||
_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(4096);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(4096);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
ENTRY(_start)
|
||||
@@ -0,0 +1,308 @@
|
||||
/*
|
||||
* (C) Copyright 2001-2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003 Arabella Software Ltd.
|
||||
* Yuli Barcohen <yuli@arabellasw.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ioports.h>
|
||||
#include <mpc8260.h>
|
||||
#include <asm/m8260_pci.h>
|
||||
#include <i2c.h>
|
||||
#include <spd.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
{ /* 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 }, /* SMC2 TXD */
|
||||
/* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* SMC2 RXD */
|
||||
/* PA7 */ { 0, 0, 0, 0, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */
|
||||
/* PA5 */ { 0, 0, 0, 0, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 0, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 0, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 0, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */
|
||||
/* PA0 */ { 0, 0, 0, 0, 0, 0 } /* PA0 */
|
||||
},
|
||||
|
||||
/* Port B */
|
||||
{ /* 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, 0, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN CLSN */
|
||||
/* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */
|
||||
/* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */
|
||||
/* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 0, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 0, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
|
||||
/* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
|
||||
/* PC21 */ { 0, 0, 0, 0, 0, 0 }, /* PC21 */
|
||||
/* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK13) */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK14) */
|
||||
/* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */
|
||||
/* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */
|
||||
/* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RENA */
|
||||
/* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */
|
||||
/* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */
|
||||
/* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* LXT972 MDC */
|
||||
/* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* LXT972 MDIO */
|
||||
/* PC8 */ { 0, 0, 0, 0, 0, 0 }, /* PC8 */
|
||||
/* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */
|
||||
/* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */
|
||||
/* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */
|
||||
/* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */
|
||||
},
|
||||
|
||||
/* 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 */ { 0, 0, 0, 0, 0, 0 }, /* PD28 */
|
||||
/* PD27 */ { 0, 0, 0, 0, 0, 0 }, /* PD27 */
|
||||
/* PD26 */ { 0, 0, 0, 0, 0, 0 }, /* PD26 */
|
||||
/* PD25 */ { 0, 0, 0, 0, 0, 0 }, /* PD25 */
|
||||
/* PD24 */ { 0, 0, 0, 0, 0, 0 }, /* PD24 */
|
||||
/* PD23 */ { 0, 0, 0, 0, 0, 0 }, /* PD23 */
|
||||
/* PD22 */ { 0, 0, 0, 0, 0, 0 }, /* PD22 */
|
||||
/* PD21 */ { 0, 0, 0, 0, 0, 0 }, /* PD21 */
|
||||
/* PD20 */ { 0, 0, 0, 0, 0, 0 }, /* PD20 */
|
||||
/* PD19 */ { 0, 0, 0, 0, 0, 0 }, /* PD19 */
|
||||
/* PD18 */ { 0, 0, 0, 0, 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, 1, 0 }, /* I2C SCL */
|
||||
/* 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 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 0, 0, 0 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 0, 0, 0 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 0, 0, 0 }, /* PD5 */
|
||||
/* PD4 */ { 0, 0, 0, 0, 0, 0 }, /* 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 */
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef CFG_NVRAM_ACCESS_ROUTINE
|
||||
void *nvram_read(void *dest, long src, size_t count)
|
||||
{
|
||||
return memcpy(dest, (const void *)src, count);
|
||||
}
|
||||
|
||||
void nvram_write(long dest, const void *src, size_t count)
|
||||
{
|
||||
vu_char *p1 = (vu_char *)(CFG_EEPROM + 0x1555);
|
||||
vu_char *p2 = (vu_char *)(CFG_EEPROM + 0x0AAA);
|
||||
vu_char *d = (vu_char *)dest;
|
||||
const uchar *s = (const uchar *)src;
|
||||
|
||||
/* Unprotect the EEPROM */
|
||||
*p1 = 0xAA;
|
||||
*p2 = 0x55;
|
||||
*p1 = 0x80;
|
||||
*p1 = 0xAA;
|
||||
*p2 = 0x55;
|
||||
*p1 = 0x20;
|
||||
udelay(10000);
|
||||
|
||||
/* Write the data to the EEPROM */
|
||||
while (count--) {
|
||||
*d++ = *s++;
|
||||
while (*(d - 1) != *(s - 1))
|
||||
/* wait */;
|
||||
}
|
||||
|
||||
/* Protect the EEPROM */
|
||||
*p1 = 0xAA;
|
||||
*p2 = 0x55;
|
||||
*p1 = 0xA0;
|
||||
udelay(10000);
|
||||
}
|
||||
#endif /* CFG_NVRAM_ACCESS_ROUTINE */
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
vu_char *bcsr = (vu_char *)CFG_BCSR;
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile memctl8260_t *memctl = &immap->im_memctl;
|
||||
vu_char *ramaddr;
|
||||
uchar c = 0xFF;
|
||||
long int msize = CFG_SDRAM_SIZE;
|
||||
uint psdmr = CFG_PSDMR;
|
||||
int i;
|
||||
|
||||
if (bcsr[4] & BCSR_PCI_MODE) { /* PCI mode selected by JP9 */
|
||||
immap->im_clkrst.car_sccr |= M826X_SCCR_PCI_MODE_EN;
|
||||
immap->im_siu_conf.sc_siumcr =
|
||||
(immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
|
||||
| SIUMCR_LBPC01;
|
||||
}
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
immap->im_siu_conf.sc_ppc_acr = 0x03;
|
||||
immap->im_siu_conf.sc_ppc_alrh = 0x30126745;
|
||||
immap->im_siu_conf.sc_tescr1 = 0x00004000;
|
||||
|
||||
memctl->memc_mptpr = CFG_MPTPR;
|
||||
|
||||
#ifdef CFG_LSDRAM_BASE
|
||||
/*
|
||||
Initialise local bus SDRAM only if the pins
|
||||
are configured as local bus pins and not as PCI.
|
||||
*/
|
||||
if ((immap->im_siu_conf.sc_siumcr & SIUMCR_LBPC11) == SIUMCR_LBPC00) {
|
||||
memctl->memc_lsrt = CFG_LSRT;
|
||||
memctl->memc_or4 = 0xFFC01480;
|
||||
memctl->memc_br4 = CFG_LSDRAM_BASE | 0x00001861;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | PSDMR_OP_PREA;
|
||||
ramaddr = (vu_char *)CFG_LSDRAM_BASE;
|
||||
*ramaddr = c;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | PSDMR_OP_CBRR;
|
||||
for (i = 0; i < 8; i++)
|
||||
*ramaddr = c;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | PSDMR_OP_MRW;
|
||||
*ramaddr = c;
|
||||
memctl->memc_lsdmr = CFG_LSDMR | PSDMR_RFEN;
|
||||
}
|
||||
#endif /* CFG_LSDRAM_BASE */
|
||||
|
||||
/* Initialise 60x bus SDRAM */
|
||||
memctl->memc_psrt = CFG_PSRT;
|
||||
memctl->memc_or2 = 0xFC0028C0;
|
||||
memctl->memc_br2 = CFG_SDRAM_BASE | 0x00000041;
|
||||
/*
|
||||
* The mode data for Mode Register Write command must appear on
|
||||
* the address lines during a mode-set cycle. It is driven by
|
||||
* the memory controller, in single PowerQUICC II mode,
|
||||
* according to PSDMR[CL] and PSDMR[BL] fields. In
|
||||
* 60x-compatible mode, software must drive the correct value on
|
||||
* the address lines. BL=0 because for 64-bit port size burst
|
||||
* length must be 4.
|
||||
*/
|
||||
ramaddr = (vu_char *)(CFG_SDRAM_BASE |
|
||||
((psdmr & PSDMR_CL_MSK) << 7) | 0x10);
|
||||
memctl->memc_psdmr = psdmr | PSDMR_OP_PREA; /* Precharge all banks */
|
||||
*ramaddr = c;
|
||||
memctl->memc_psdmr = psdmr | PSDMR_OP_CBRR; /* CBR refresh */
|
||||
for (i = 0; i < 8; i++)
|
||||
*ramaddr = c;
|
||||
memctl->memc_psdmr = psdmr | PSDMR_OP_MRW; /* Mode Register write */
|
||||
*ramaddr = c;
|
||||
memctl->memc_psdmr = psdmr | PSDMR_RFEN; /* Refresh enable */
|
||||
*ramaddr = c;
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
/* Return total 60x bus SDRAM size */
|
||||
return msize * 1024 * 1024;
|
||||
}
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
vu_char *bcsr = (vu_char *)CFG_BCSR;
|
||||
|
||||
printf("Board: Zephyr ZPC.1900 Rev. %c\n", bcsr[2] + 0x40);
|
||||
return 0;
|
||||
}
|
||||
@@ -95,6 +95,33 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NIOS) /* NIOS*/
|
||||
|
||||
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int i;
|
||||
bd_t *bd = gd->bd;
|
||||
|
||||
print_num ("memstart", (ulong)bd->bi_memstart);
|
||||
print_num ("memsize", (ulong)bd->bi_memsize);
|
||||
print_num ("flashstart", (ulong)bd->bi_flashstart);
|
||||
print_num ("flashsize", (ulong)bd->bi_flashsize);
|
||||
print_num ("flashoffset", (ulong)bd->bi_flashoffset);
|
||||
|
||||
printf ("ethaddr =");
|
||||
for (i=0; i<6; ++i) {
|
||||
printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
|
||||
}
|
||||
printf ("\nip_addr = ");
|
||||
print_IPaddr (bd->bi_ip_addr);
|
||||
printf ("\nbaudrate = %ld bps\n", bd->bi_baudrate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#else /* ! PPC, which leaves MIPS */
|
||||
|
||||
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
@@ -59,7 +59,14 @@ int do_go (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
*/
|
||||
argv[0] = (char *)gd;
|
||||
#endif
|
||||
#if !defined(CONFIG_NIOS)
|
||||
rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);
|
||||
#else
|
||||
/*
|
||||
* Nios function pointers are address >> 1
|
||||
*/
|
||||
rc = ((ulong (*)(int, char *[]))(addr>>1)) (--argc, &argv[1]);
|
||||
#endif
|
||||
if (rc != 0) rcode = 1;
|
||||
|
||||
printf ("## Application terminated, rc = 0x%lX\n", rc);
|
||||
|
||||
+11
-1
@@ -235,6 +235,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (hdr->ih_arch != IH_CPU_I386)
|
||||
#elif defined(__mips__)
|
||||
if (hdr->ih_arch != IH_CPU_MIPS)
|
||||
#elif defined(__nios__)
|
||||
if (hdr->ih_arch != IH_CPU_NIOS)
|
||||
#else
|
||||
# error Unknown CPU type
|
||||
#endif
|
||||
@@ -247,6 +249,10 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
switch (hdr->ih_type) {
|
||||
case IH_TYPE_STANDALONE: name = "Standalone Application";
|
||||
/* A second argument overwrites the load address */
|
||||
if (argc > 2) {
|
||||
hdr->ih_load = simple_strtoul(argv[2], NULL, 16);
|
||||
}
|
||||
break;
|
||||
case IH_TYPE_KERNEL: name = "Kernel Image";
|
||||
break;
|
||||
@@ -347,8 +353,12 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
/* load (and uncompress), but don't start if "autostart"
|
||||
* is set to "no"
|
||||
*/
|
||||
if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0))
|
||||
if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) {
|
||||
char buf[32];
|
||||
sprintf(buf, "%lX", len);
|
||||
setenv("filesize", buf);
|
||||
return 0;
|
||||
}
|
||||
appl = (int (*)(cmd_tbl_t *, int, int, char *[]))ntohl(hdr->ih_ep);
|
||||
(*appl)(cmdtp, flag, argc-1, &argv[1]);
|
||||
return 0;
|
||||
|
||||
+7
-2
@@ -74,6 +74,7 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
long size;
|
||||
unsigned long offset;
|
||||
unsigned long count;
|
||||
char buf [12];
|
||||
block_dev_desc_t *dev_desc=NULL;
|
||||
int dev=0;
|
||||
int part=1;
|
||||
@@ -107,11 +108,15 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
count = 0;
|
||||
size = file_fat_read (argv[4], (unsigned char *) offset, count);
|
||||
|
||||
if(size==-1)
|
||||
if(size==-1) {
|
||||
printf("\n** Unable to read \"%s\" from %s %d:%d **\n",argv[4],argv[1],dev,part);
|
||||
else
|
||||
} else {
|
||||
printf ("\n%ld bytes read\n", size);
|
||||
|
||||
sprintf(buf, "%lX", size);
|
||||
setenv("filesize", buf);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
char *ep;
|
||||
int size;
|
||||
int rcode = 0;
|
||||
char buf [10];
|
||||
char buf [12];
|
||||
int drive = CFG_FDC_DRIVE_NUMBER;
|
||||
|
||||
/* pre-set load_addr */
|
||||
|
||||
+1
-1
@@ -634,7 +634,7 @@ U_BOOT_CMD(
|
||||
|
||||
U_BOOT_CMD(
|
||||
iopset, 5, 0, do_iopset,
|
||||
"iopset - set I/O Port registers\n",
|
||||
"iopset - set I/O Port registers\n",
|
||||
"PORT PIN CMD VALUE\nPORT: A-D, PIN: 0-31, CMD: [dat|dir|odr|sor], VALUE: 0|1"
|
||||
);
|
||||
|
||||
|
||||
@@ -555,7 +555,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
vu_long temp;
|
||||
vu_long anti_pattern;
|
||||
vu_long num_words;
|
||||
#if defined(CFG_MEMTEST_SCRATCH)
|
||||
vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
|
||||
#else
|
||||
vu_long *dummy = NULL;
|
||||
#endif
|
||||
int j;
|
||||
int iterations = 1;
|
||||
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
U_BOOT_CMD(
|
||||
sspi, 5, 1, do_spi,
|
||||
"sspi - SPI utility commands\n",
|
||||
"sspi - SPI utility commands\n",
|
||||
"<device> <bit_len> <dout> - Send <bit_len> bits from <dout> out the SPI\n"
|
||||
"<device> - Identifies the chip select of the device\n"
|
||||
"<bit_len> - Number of bits to send (base 10)\n"
|
||||
|
||||
+10
-2
@@ -436,6 +436,8 @@ int console_init_r (void)
|
||||
console_setfile (stdin, inputdev);
|
||||
}
|
||||
|
||||
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
|
||||
|
||||
#ifndef CFG_CONSOLE_INFO_QUIET
|
||||
/* Print information */
|
||||
printf ("In: ");
|
||||
@@ -480,12 +482,16 @@ int console_init_r (void)
|
||||
/* Called after the relocation - use desired console functions */
|
||||
int console_init_r (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
device_t *inputdev = NULL, *outputdev = NULL;
|
||||
int i, items = ListNumItems (devlist);
|
||||
|
||||
#ifdef CONFIG_SPLASH_SCREEN
|
||||
/* suppress all output if splash screen is enabled */
|
||||
outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
|
||||
/* suppress all output if splash screen is enabled and we have
|
||||
a bmp to display */
|
||||
if (getenv("splashimage") != NULL)
|
||||
outputdev = search_device (DEV_FLAGS_OUTPUT, "nulldev");
|
||||
#endif
|
||||
|
||||
/* Scan devices looking for input and output devices */
|
||||
@@ -514,6 +520,8 @@ int console_init_r (void)
|
||||
console_setfile (stdin, inputdev);
|
||||
}
|
||||
|
||||
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
|
||||
|
||||
#ifndef CFG_CONSOLE_INFO_QUIET
|
||||
/* Print information */
|
||||
printf ("In: ");
|
||||
|
||||
+1
-3
@@ -158,9 +158,9 @@ int device_deregister(char *devname)
|
||||
|
||||
int devices_init (void)
|
||||
{
|
||||
#ifndef CONFIG_ARM /* already relocated for current ARM implementation */
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#ifndef CONFIG_ARM /* already relocated for current ARM implementation */
|
||||
ulong relocation_offset = gd->reloc_off;
|
||||
int i;
|
||||
|
||||
@@ -195,8 +195,6 @@ int devices_init (void)
|
||||
#endif
|
||||
drv_system_init ();
|
||||
|
||||
gd-> flags |= GD_FLG_DEVINIT; /* device initialization done */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,4 +169,27 @@ int miiphy_duplex (unsigned char addr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CFG_FAULT_ECHO_LINK_DOWN
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Determine link status
|
||||
*/
|
||||
int miiphy_link (unsigned char addr)
|
||||
{
|
||||
unsigned short reg;
|
||||
|
||||
if (miiphy_read (addr, PHY_BMSR, ®)) {
|
||||
printf ("PHY_BMSR read failed, assuming no link\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Determine if a link is active */
|
||||
if ((reg & PHY_BMSR_LS) != 0) {
|
||||
return (1);
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_MII || (CONFIG_COMMANDS & CFG_CMD_MII) */
|
||||
+1
-1
@@ -595,7 +595,7 @@ struct usb_device * usb_alloc_new_device(void)
|
||||
int i;
|
||||
USB_PRINTF("New Device %d\n",dev_index);
|
||||
if(dev_index==USB_MAX_DEVICE) {
|
||||
printf("ERROR, to many USB Devices max=%d\n",USB_MAX_DEVICE);
|
||||
printf("ERROR, too many USB Devices, max=%d\n",USB_MAX_DEVICE);
|
||||
return NULL;
|
||||
}
|
||||
usb_dev[dev_index].devnum=dev_index+1; /* default Address is 0, real addresses start with 1 */
|
||||
|
||||
@@ -188,7 +188,7 @@ int usb_stor_scan(int mode)
|
||||
memset(usb_stor_buf, 0, sizeof(usb_stor_buf));
|
||||
|
||||
if(mode==1) {
|
||||
printf("scanning bus for storage devices...\n");
|
||||
printf(" scanning bus for storage devices...\n");
|
||||
}
|
||||
usb_disable_asynch(1); /* asynch transfer not allowed */
|
||||
|
||||
|
||||
@@ -71,9 +71,6 @@ _fiq: .word fiq
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#elif CONFIG_SERIAL2
|
||||
# if defined(CONFIG_TRAB)
|
||||
# #error "TRAB supports only CONFIG_SERIAL1"
|
||||
# error "TRAB supports only CONFIG_SERIAL1"
|
||||
# endif
|
||||
#define UART_NR S3C24X0_UART1
|
||||
|
||||
|
||||
@@ -72,9 +72,6 @@ _fiq: .word fiq
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
+76
-11
@@ -51,8 +51,6 @@
|
||||
#define OHCI_CONTROL_INIT \
|
||||
(OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
|
||||
|
||||
#define OHCI_UNLINK_TIMEOUT (CFG_HZ / 10)
|
||||
|
||||
#define readl(a) (*((vu_long *)(a)))
|
||||
#define writel(a, b) (*((vu_long *)(b)) = ((vu_long)a))
|
||||
|
||||
@@ -85,6 +83,10 @@ struct ohci_hcca *phcca;
|
||||
struct ohci_device ohci_dev;
|
||||
/* urb_priv */
|
||||
urb_priv_t urb_priv;
|
||||
/* RHSC flag */
|
||||
int got_rhsc;
|
||||
/* device which was disconnected */
|
||||
struct usb_device *devgone;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
@@ -952,8 +954,29 @@ static unsigned char root_hub_str_index1[] =
|
||||
|
||||
/* request to virtual root hub */
|
||||
|
||||
static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int transfer_len, struct devrequest *cmd)
|
||||
int rh_check_port_status(ohci_t *controller)
|
||||
{
|
||||
__u32 temp, ndp, i;
|
||||
int res;
|
||||
|
||||
res = -1;
|
||||
temp = roothub_a (controller);
|
||||
ndp = (temp & RH_A_NDP);
|
||||
for (i = 0; i < ndp; i++) {
|
||||
temp = roothub_portstatus (controller, i);
|
||||
/* check for a device disconnect */
|
||||
if (((temp & (RH_PS_PESC | RH_PS_CSC)) ==
|
||||
(RH_PS_PESC | RH_PS_CSC)) &&
|
||||
((temp & RH_PS_CCS) == 0)) {
|
||||
res = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
|
||||
void *buffer, int transfer_len, struct devrequest *cmd)
|
||||
{
|
||||
void * data = buffer;
|
||||
int leni = transfer_len;
|
||||
@@ -1178,6 +1201,12 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int maxsize = usb_maxpacket(dev, pipe);
|
||||
int timeout;
|
||||
|
||||
/* device pulled? Shortcut the action. */
|
||||
if (devgone == dev) {
|
||||
dev->status = USB_ST_CRC_ERR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
urb_priv.actual_length = 0;
|
||||
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe));
|
||||
@@ -1199,7 +1228,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
/* ohci_dump_status(&gohci); */
|
||||
|
||||
/* allow more time for a BULK device to react - some are slow */
|
||||
#define BULK_TO 2000 /* timeout in milliseconds */
|
||||
#define BULK_TO 5000 /* timeout in milliseconds */
|
||||
if (usb_pipetype (pipe) == PIPE_BULK)
|
||||
timeout = BULK_TO;
|
||||
else
|
||||
@@ -1210,7 +1239,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
/* check whether the controller is done */
|
||||
stat = hc_interrupt();
|
||||
if (stat < 0) {
|
||||
stat = 1;
|
||||
stat = USB_ST_CRC_ERR;
|
||||
break;
|
||||
}
|
||||
if (stat >= 0 && stat != 0xff) {
|
||||
@@ -1220,11 +1249,33 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
if (--timeout) {
|
||||
wait_ms(1);
|
||||
} else {
|
||||
err("CTL:TIMEOUT");
|
||||
stat = 1;
|
||||
err("CTL:TIMEOUT ");
|
||||
stat = USB_ST_CRC_ERR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* we got an Root Hub Status Change interrupt */
|
||||
if (got_rhsc) {
|
||||
#ifdef DEBUG
|
||||
ohci_dump_roothub (&gohci, 1);
|
||||
#endif
|
||||
got_rhsc = 0;
|
||||
/* abuse timeout */
|
||||
timeout = rh_check_port_status(&gohci);
|
||||
if (timeout >= 0) {
|
||||
#if 0 /* this does nothing useful, but leave it here in case that changes */
|
||||
/* the called routine adds 1 to the passed value */
|
||||
usb_hub_port_connect_change(gohci.rh.dev, timeout - 1);
|
||||
#endif
|
||||
/*
|
||||
* XXX
|
||||
* This is potentially dangerous because it assumes
|
||||
* that only one device is ever plugged in!
|
||||
*/
|
||||
devgone = dev;
|
||||
}
|
||||
}
|
||||
|
||||
dev->status = stat;
|
||||
dev->act_len = transfer_len;
|
||||
|
||||
@@ -1264,10 +1315,12 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
pipe);
|
||||
return -1;
|
||||
}
|
||||
if (((pipe >> 8) & 0x7f) == gohci.rh.devnum)
|
||||
if (((pipe >> 8) & 0x7f) == gohci.rh.devnum) {
|
||||
gohci.rh.dev = dev;
|
||||
/* root hub - redirect */
|
||||
return ohci_submit_rh_msg(dev, pipe, buffer, transfer_len,
|
||||
setup);
|
||||
}
|
||||
|
||||
return submit_common_msg(dev, pipe, buffer, transfer_len, setup, 0);
|
||||
}
|
||||
@@ -1356,9 +1409,17 @@ static int hc_start (ohci_t * ohci)
|
||||
ohci->disabled = 0;
|
||||
writel (ohci->hc_control, &ohci->regs->control);
|
||||
|
||||
/* Choose the interrupts we care about now, others later on demand */
|
||||
mask = OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_WDH | OHCI_INTR_SO;
|
||||
/* disable all interrupts */
|
||||
mask = (OHCI_INTR_SO | OHCI_INTR_WDH | OHCI_INTR_SF | OHCI_INTR_RD |
|
||||
OHCI_INTR_UE | OHCI_INTR_FNO | OHCI_INTR_RHSC |
|
||||
OHCI_INTR_OC | OHCI_INTR_MIE);
|
||||
writel (mask, &ohci->regs->intrdisable);
|
||||
/* clear all interrupts */
|
||||
mask &= ~OHCI_INTR_MIE;
|
||||
writel (mask, &ohci->regs->intrstatus);
|
||||
/* Choose the interrupts we care about now - but w/o MIE */
|
||||
mask = OHCI_INTR_RHSC | OHCI_INTR_UE | OHCI_INTR_WDH | OHCI_INTR_SO;
|
||||
writel (mask, &ohci->regs->intrenable);
|
||||
|
||||
#ifdef OHCI_USE_NPS
|
||||
/* required for AMD-756 and some Mac platforms */
|
||||
@@ -1397,6 +1458,10 @@ hc_interrupt (void)
|
||||
|
||||
/* dbg("Interrupt: %x frame: %x", ints, le16_to_cpu (ohci->hcca->frame_no)); */
|
||||
|
||||
if (ints & OHCI_INTR_RHSC) {
|
||||
got_rhsc = 1;
|
||||
}
|
||||
|
||||
if (ints & OHCI_INTR_UE) {
|
||||
ohci->disabled++;
|
||||
err ("OHCI Unrecoverable Error, controller usb-%s disabled",
|
||||
|
||||
@@ -81,9 +81,6 @@ _fiq: .word fiq
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -90,9 +90,6 @@ _fiq:
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -71,9 +71,6 @@ _fiq: .word fiq
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -424,7 +424,9 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
|
||||
#endif
|
||||
} while (!(phyStatus & 0x0004)); /* !link up */
|
||||
|
||||
#if (DEBUG & 0x2)
|
||||
printf ("done.\n");
|
||||
#endif
|
||||
} else { /* MII100 */
|
||||
/*
|
||||
* Set the auto-negotiation advertisement register bits
|
||||
|
||||
+55
-3
@@ -28,15 +28,22 @@
|
||||
#include <mpc5xxx.h>
|
||||
#include <i2c.h>
|
||||
|
||||
#ifdef CFG_I2C_MODULE
|
||||
#if (CFG_I2C_MODULE == 2)
|
||||
#define I2C_BASE MPC5XXX_I2C2
|
||||
#else
|
||||
#elif (CFG_I2C_MODULE == 1)
|
||||
#define I2C_BASE MPC5XXX_I2C1
|
||||
#else
|
||||
#error CFG_I2C_MODULE is not properly configured
|
||||
#endif
|
||||
|
||||
#define I2C_TIMEOUT 100
|
||||
#define I2C_RETRIES 3
|
||||
|
||||
struct mpc5xxx_i2c_tap {
|
||||
int scl2tap;
|
||||
int tap2tap;
|
||||
};
|
||||
|
||||
static int mpc_reg_in (volatile u32 *reg);
|
||||
static void mpc_reg_out (volatile u32 *reg, int val, int mask);
|
||||
static int wait_for_bb (void);
|
||||
@@ -44,6 +51,7 @@ static int wait_for_pin (int *status);
|
||||
static int do_address (uchar chip, char rdwr_flag);
|
||||
static int send_bytes (uchar chip, char *buf, int len);
|
||||
static int receive_bytes (uchar chip, char *buf, int len);
|
||||
static int mpc_get_fdr (int);
|
||||
|
||||
static int mpc_reg_in(volatile u32 *reg)
|
||||
{
|
||||
@@ -207,7 +215,7 @@ void i2c_init(int speed, int saddr)
|
||||
|
||||
/* Set clock
|
||||
*/
|
||||
mpc_reg_out(®s->mfdr, speed, 0);
|
||||
mpc_reg_out(®s->mfdr, mpc_get_fdr(speed), 0);
|
||||
|
||||
/* Enable module
|
||||
*/
|
||||
@@ -217,6 +225,50 @@ void i2c_init(int speed, int saddr)
|
||||
return;
|
||||
}
|
||||
|
||||
static int mpc_get_fdr(int speed)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
static int fdr = -1;
|
||||
static int best_speed = 0;
|
||||
|
||||
if (fdr == -1) {
|
||||
ulong ipb, scl;
|
||||
ulong bestmatch = 0xffffffffUL;
|
||||
int best_i = 0, best_j = 0, i, j;
|
||||
int SCL_Tap[] = { 9, 10, 12, 15, 5, 6, 7, 8};
|
||||
struct mpc5xxx_i2c_tap scltap[] = {
|
||||
{4, 1},
|
||||
{4, 2},
|
||||
{6, 4},
|
||||
{6, 8},
|
||||
{14, 16},
|
||||
{30, 32},
|
||||
{62, 64},
|
||||
{126, 128}
|
||||
};
|
||||
|
||||
ipb = gd->ipb_clk;
|
||||
for (i = 7; i >= 0; i--) {
|
||||
for (j = 7; j >= 0; j--) {
|
||||
scl = 2 * (scltap[j].scl2tap +
|
||||
(SCL_Tap[i] - 1) * scltap[j].tap2tap + 2);
|
||||
if (ipb <= speed*scl) {
|
||||
if ((speed*scl - ipb) < bestmatch) {
|
||||
bestmatch = speed*scl - ipb;
|
||||
best_i = i;
|
||||
best_j = j;
|
||||
best_speed = ipb/scl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fdr = (best_i & 3) | ((best_i & 4) << 3) | (best_j << 2);
|
||||
printf("%d kHz, ", best_speed / 1000);
|
||||
}
|
||||
|
||||
return fdr;
|
||||
}
|
||||
|
||||
int i2c_probe(uchar chip)
|
||||
{
|
||||
struct mpc5xxx_i2c *regs = (struct mpc5xxx_i2c *)I2C_BASE;
|
||||
|
||||
+2
-2
@@ -61,8 +61,8 @@ short pll_pci_to_mem_multiplier[] = {
|
||||
25, 0, 10, 0, 15, 15, 0, 0,
|
||||
#elif defined(CONFIG_MPC8245)
|
||||
30, 30, 10, 10, 20, 10, 10, 10,
|
||||
10, 20, 20, 15, 20, 15, 20, 0,
|
||||
30, 0, 15, 40, 20, 25, 20, 40,
|
||||
10, 20, 20, 15, 20, 15, 20, 30,
|
||||
30, 40, 15, 40, 20, 25, 20, 40,
|
||||
25, 20, 10, 20, 15, 15, 15, 0,
|
||||
#else
|
||||
#error Specific type of MPC824x must be defined (i.e. CONFIG_MPC8240)
|
||||
|
||||
@@ -119,6 +119,9 @@ int checkcpu (void)
|
||||
case 0x0062:
|
||||
printf ("B.1 4K25A");
|
||||
break;
|
||||
case 0x0064:
|
||||
printf ("C.0 5K25A");
|
||||
break;
|
||||
case 0x0A00:
|
||||
printf ("0.0 0K49M");
|
||||
break;
|
||||
|
||||
+33
-7
@@ -650,6 +650,15 @@ eth_loopback_test (void)
|
||||
/* 28.9 - (1-2): ioports have been set up already */
|
||||
|
||||
#if defined(CONFIG_HYMOD)
|
||||
/*
|
||||
* Attention: this is board-specific
|
||||
* 0, FCC1
|
||||
* 1, FCC2
|
||||
* 2, FCC3
|
||||
*/
|
||||
# define FCC_START_LOOP 0
|
||||
# define FCC_END_LOOP 2
|
||||
|
||||
/*
|
||||
* Attention: this is board-specific
|
||||
* - FCC1 Rx-CLK is CLK10
|
||||
@@ -665,13 +674,30 @@ eth_loopback_test (void)
|
||||
immr->im_cpmux.cmx_fcr = CMXFCR_RF1CS_CLK10|CMXFCR_TF1CS_CLK11|\
|
||||
CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14|\
|
||||
CMXFCR_RF3CS_CLK15|CMXFCR_TF3CS_CLK16;
|
||||
#elif defined(CONFIG_SBC8260) || defined(CONFIG_SACSng)
|
||||
/*
|
||||
* Attention: this is board-specific
|
||||
* 1, FCC2
|
||||
*/
|
||||
# define FCC_START_LOOP 1
|
||||
# define FCC_END_LOOP 1
|
||||
|
||||
/*
|
||||
* Attention: this is board-specific
|
||||
* - FCC2 Rx-CLK is CLK13
|
||||
* - FCC2 Tx-CLK is CLK14
|
||||
*/
|
||||
|
||||
/* 28.9 - (3): connect FCC's tx and rx clocks */
|
||||
immr->im_cpmux.cmx_uar = 0;
|
||||
immr->im_cpmux.cmx_fcr = CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14;
|
||||
#else
|
||||
#error "eth_loopback_test not supported on your board"
|
||||
#endif
|
||||
|
||||
puts ("Initialise FCC channels:");
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
|
||||
elbt_chan *ecp = &elbt_chans[c];
|
||||
volatile fcc_t *fcp = &immr->im_fcc[c];
|
||||
volatile fcc_enet_t *fpp;
|
||||
@@ -853,7 +879,7 @@ eth_loopback_test (void)
|
||||
do {
|
||||
nclosed = 0;
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
|
||||
volatile fcc_t *fcp = &immr->im_fcc[c];
|
||||
elbt_chan *ecp = &elbt_chans[c];
|
||||
int i;
|
||||
@@ -1082,7 +1108,7 @@ eth_loopback_test (void)
|
||||
}
|
||||
}
|
||||
|
||||
} while (nclosed < 3);
|
||||
} while (nclosed < (FCC_END_LOOP - FCC_START_LOOP + 1));
|
||||
|
||||
runtime = get_timer (runtime);
|
||||
if (runtime <= ELBT_CLSWAIT) {
|
||||
@@ -1099,7 +1125,7 @@ eth_loopback_test (void)
|
||||
* now print stats
|
||||
*/
|
||||
|
||||
for (c = 0; c < 3; c++) {
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++) {
|
||||
elbt_chan *ecp = &elbt_chans[c];
|
||||
uint rxpps, txpps, nerr;
|
||||
|
||||
@@ -1131,17 +1157,17 @@ eth_loopback_test (void)
|
||||
}
|
||||
|
||||
puts ("Receive Error Counts:\n");
|
||||
for (c = 0; c < 3; c++)
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
|
||||
bases[c] = (uchar *)&elbt_chans[c].rxeacc;
|
||||
print_desc (rxeacc_descs, rxeacc_ndesc, bases, 3);
|
||||
|
||||
puts ("\nTransmit Error Counts:\n");
|
||||
for (c = 0; c < 3; c++)
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
|
||||
bases[c] = (uchar *)&elbt_chans[c].txeacc;
|
||||
print_desc (txeacc_descs, txeacc_ndesc, bases, 3);
|
||||
|
||||
puts ("\nRMON(-like) Counters:\n");
|
||||
for (c = 0; c < 3; c++)
|
||||
for (c = FCC_START_LOOP; c <= FCC_END_LOOP; c++)
|
||||
bases[c] = (uchar *)&immr->im_dprambase[elbt_chans[c].proff];
|
||||
print_desc (epram_descs, epram_ndesc, bases, 3);
|
||||
}
|
||||
|
||||
+2
-2
@@ -348,7 +348,7 @@ static int fec_init(struct eth_device* dev, bd_t * bd)
|
||||
* This MDC frequency is equal to system clock / (2 * MII_SPEED).
|
||||
* Then MII_SPEED = system_clock / 2 * 2,5 Mhz.
|
||||
*/
|
||||
fecp->fec_mii_speed = ((bd->bi_busfreq + 4999999) / 5000000) << 1;
|
||||
fecp->fec_mii_speed = ((bd->bi_intfreq + 4999999) / 5000000) << 1;
|
||||
|
||||
#if !defined(CONFIG_ICU862) && !defined(CONFIG_IAD210)
|
||||
/* Configure all of port D for MII.
|
||||
@@ -612,7 +612,7 @@ void mii_init (void)
|
||||
* This MDC frequency is equal to system clock / (2 * MII_SPEED).
|
||||
* Then MII_SPEED = system_clock / 2 * 2,5 Mhz.
|
||||
*/
|
||||
fecp->fec_mii_speed = ((bd->bi_busfreq + 4999999) / 5000000) << 1;
|
||||
fecp->fec_mii_speed = ((bd->bi_intfreq + 4999999) / 5000000) << 1;
|
||||
|
||||
#if !defined(CONFIG_ICU862) && !defined(CONFIG_IAD210)
|
||||
/* Configure all of port D for MII.
|
||||
|
||||
@@ -224,6 +224,18 @@ static vidinfo_t panel_info = {
|
||||
};
|
||||
#endif /* CONFIG_SHARP_LQ64D341 */
|
||||
|
||||
#ifdef CONFIG_SHARP_LQ065T9DR51U
|
||||
/*
|
||||
* Sharp LQ065T9DR51U display, 400x240. Active, color, single scan.
|
||||
*/
|
||||
static vidinfo_t panel_info = {
|
||||
400, 240, 143, 79, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
|
||||
3, 0, 0, 1, 1, 248, 4, 0, 35
|
||||
/* wbl, vpw, lcdac, wbf */
|
||||
};
|
||||
#define LCD_INFO_BELOW_LOGO
|
||||
#endif /* CONFIG_SHARP_LQ065T9DR51U */
|
||||
|
||||
#ifdef CONFIG_SHARP_LQ084V1DG21
|
||||
/*
|
||||
* Sharp LQ084V1DG21 display, 640x480. Active, color, single scan.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# (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
|
||||
AOBJS = traps.o
|
||||
OBJS = cpu.o interrupts.o serial.o
|
||||
|
||||
all: .depend $(START) $(LIB)
|
||||
|
||||
$(LIB): $(OBJS) $(AOBJS)
|
||||
$(AR) crv $@ $(OBJS) $(AOBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.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 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
|
||||
#
|
||||
|
||||
PLATFORM_RELFLAGS +=
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <nios.h>
|
||||
|
||||
|
||||
int checkcpu (void)
|
||||
{
|
||||
unsigned val;
|
||||
unsigned rev_major;
|
||||
unsigned rev_minor;
|
||||
short nregs, hi_limit, lo_limit;
|
||||
|
||||
/* Get cpu version info */
|
||||
val = rdctl (CTL_CPU_ID);
|
||||
printf ("CPU: ");
|
||||
printf ("%s", (val & 0x00008000) ? "Nios-16 " : "Nios-32 ");
|
||||
rev_major = (val>>12) & 0x07;
|
||||
rev_minor = val & 0x0f;
|
||||
printf ("Rev. %d.%02d (0x%04x)", rev_major, rev_minor,
|
||||
val & 0xffff);
|
||||
if (rev_major == 0x08)
|
||||
printf (" [OpenCore (R) Plus]");
|
||||
printf ("\n");
|
||||
|
||||
/* Check register file */
|
||||
val = rdctl (CTL_WVALID);
|
||||
lo_limit = val & 0x01f;
|
||||
hi_limit = (val>>5) & 0x1f;
|
||||
nregs = (hi_limit + 2) * 16;
|
||||
printf ("Reg file size: %d LO_LIMIT/HI_LIMIT: %d/%d\n",
|
||||
nregs, lo_limit, hi_limit);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
int do_reset (void)
|
||||
{
|
||||
/* trap 0 does the trick ... at least with the OCI debug
|
||||
* present -- haven't tested without it yet (stm).
|
||||
*/
|
||||
disable_interrupts ();
|
||||
ipri (1);
|
||||
asm volatile ("trap 0\n");
|
||||
|
||||
/* No return ;-) */
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
#if defined(CONFIG_WATCHDOG)
|
||||
void watchdog_reset (void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_WATCHDOG */
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2002
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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 <nios.h>
|
||||
#include <nios-io.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct irq_action {
|
||||
interrupt_handler_t *handler;
|
||||
void *arg;
|
||||
int count;
|
||||
};
|
||||
|
||||
static struct irq_action irq_vecs[64];
|
||||
|
||||
/*************************************************************************/
|
||||
volatile ulong timestamp = 0;
|
||||
|
||||
void reset_timer (void)
|
||||
{
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
ulong get_timer (ulong base)
|
||||
{
|
||||
return (timestamp - base);
|
||||
}
|
||||
|
||||
void set_timer (ulong t)
|
||||
{
|
||||
timestamp = t;
|
||||
}
|
||||
|
||||
|
||||
/* The board must handle this interrupt if a timer is not
|
||||
* provided.
|
||||
*/
|
||||
#if defined(CFG_NIOS_TMRBASE)
|
||||
void timer_interrupt (struct pt_regs *regs)
|
||||
{
|
||||
/* Interrupt is cleared by writing anything to the
|
||||
* status register.
|
||||
*/
|
||||
nios_timer_t *tmr = (nios_timer_t *)CFG_NIOS_TMRBASE;
|
||||
tmr->status = 0;
|
||||
timestamp += CFG_NIOS_TMRMS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************************************************/
|
||||
int disable_interrupts (void)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
/* Writing anything to CLR_IE disables interrupts */
|
||||
val = rdctl (CTL_STATUS);
|
||||
wrctl (CTL_CLR_IE, 0);
|
||||
return (val & STATUS_IE);
|
||||
}
|
||||
|
||||
void enable_interrupts( void )
|
||||
{
|
||||
/* Writing anything SET_IE enables interrupts */
|
||||
wrctl (CTL_SET_IE, 0);
|
||||
}
|
||||
|
||||
void external_interrupt (struct pt_regs *regs)
|
||||
{
|
||||
unsigned vec;
|
||||
|
||||
vec = (regs->status & STATUS_IPRI) >> 9; /* ipri */
|
||||
|
||||
irq_vecs[vec].count++;
|
||||
if (irq_vecs[vec].handler != NULL) {
|
||||
(*irq_vecs[vec].handler)(irq_vecs[vec].arg);
|
||||
} else {
|
||||
/* A sad side-effect of masking a bogus interrupt is
|
||||
* that lower priority interrupts will also be disabled.
|
||||
* This is probably not what we want ... so hang insted.
|
||||
*/
|
||||
printf ("Unhandled interrupt: 0x%x\n", vec);
|
||||
disable_interrupts ();
|
||||
hang ();
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
int interrupt_init (void)
|
||||
{
|
||||
int vec;
|
||||
|
||||
#if defined(CFG_NIOS_TMRBASE)
|
||||
nios_timer_t *tmr = (nios_timer_t *)CFG_NIOS_TMRBASE;
|
||||
|
||||
tmr->control &= ~NIOS_TIMER_ITO;
|
||||
tmr->control |= NIOS_TIMER_STOP;
|
||||
#endif
|
||||
|
||||
for (vec=0; vec<64; vec++ ) {
|
||||
irq_vecs[vec].handler = NULL;
|
||||
irq_vecs[vec].arg = NULL;
|
||||
irq_vecs[vec].count = 0;
|
||||
}
|
||||
|
||||
/* Need timus interruptus -- start the lopri timer */
|
||||
#if defined(CFG_NIOS_TMRBASE)
|
||||
tmr->control |= ( NIOS_TIMER_ITO |
|
||||
NIOS_TIMER_CONT |
|
||||
NIOS_TIMER_START );
|
||||
ipri (CFG_NIOS_TMRIRQ + 1);
|
||||
#endif
|
||||
enable_interrupts ();
|
||||
return (0);
|
||||
}
|
||||
|
||||
void irq_install_handler (int vec, interrupt_handler_t *handler, void *arg)
|
||||
{
|
||||
struct irq_action *irqa = irq_vecs;
|
||||
int i = vec;
|
||||
int flag;
|
||||
|
||||
if (irqa[i].handler != NULL) {
|
||||
printf ("Interrupt vector %d: handler 0x%x "
|
||||
"replacing 0x%x\n",
|
||||
vec, (uint)handler, (uint)irqa[i].handler);
|
||||
}
|
||||
|
||||
flag = disable_interrupts ();
|
||||
irqa[i].handler = handler;
|
||||
irqa[i].arg = arg;
|
||||
if (flag )
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_IRQ)
|
||||
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");
|
||||
|
||||
for (vec=0; vec<64; vec++) {
|
||||
if (irq_vecs[vec].handler != NULL) {
|
||||
printf ("%02d %08lx %08lx %d\n",
|
||||
vec,
|
||||
(ulong)irq_vecs[vec].handler<<1,
|
||||
(ulong)irq_vecs[vec].arg,
|
||||
irq_vecs[vec].count);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* CONFIG_COMMANDS & CFG_CMD_IRQ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include <common.h>
|
||||
#include <nios-io.h>
|
||||
|
||||
|
||||
static nios_uart_t *uart = (nios_uart_t *)CFG_NIOS_CONSOLE;
|
||||
|
||||
#if defined(CFG_NIOS_FIXEDBAUD)
|
||||
|
||||
/* Everything's already setup for fixed-baud PTF
|
||||
* assignment
|
||||
*/
|
||||
void serial_setbrg( void ){ return; }
|
||||
int serial_init( void ) { return(0);}
|
||||
|
||||
#else
|
||||
|
||||
void serial_setbrg( void )
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
unsigned div;
|
||||
|
||||
div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
|
||||
uart->divisor = div;
|
||||
return;
|
||||
}
|
||||
|
||||
int serial_init( void )
|
||||
{
|
||||
serial_setbrg();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#endif /* CFG_NIOS_FIXEDBAUD */
|
||||
|
||||
|
||||
void serial_putc( char c )
|
||||
{
|
||||
if (c == '\n')
|
||||
serial_putc('\r');
|
||||
while( (uart->status & NIOS_UART_TRDY) == 0 )
|
||||
;
|
||||
uart->txdata = (unsigned char)c;
|
||||
}
|
||||
|
||||
void serial_puts( const char *s )
|
||||
{
|
||||
while( *s != 0 ) {
|
||||
serial_putc( *s++ );
|
||||
}
|
||||
}
|
||||
|
||||
int serial_tstc( void )
|
||||
{
|
||||
return( uart->status & NIOS_UART_RRDY);
|
||||
}
|
||||
|
||||
int serial_getc( void )
|
||||
{
|
||||
while( serial_tstc() == 0 )
|
||||
;
|
||||
return( uart->rxdata & 0x00ff );
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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>
|
||||
#include <version.h>
|
||||
|
||||
#if !defined(CONFIG_IDENT_STRING)
|
||||
#define CONFIG_IDENT_STRING ""
|
||||
#endif
|
||||
|
||||
#define STATUS_INIT 0x8600 /* IE=1, IPRI=2 */
|
||||
|
||||
/*************************************************************************
|
||||
* RESTART
|
||||
************************************************************************/
|
||||
|
||||
.text
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
bsr 0f
|
||||
nop
|
||||
.long _start
|
||||
|
||||
/* GERMS -- The "standard-32" configuration GERMS monitor looks
|
||||
* for the string "Nios" at flash_base + 0xc (actually it only
|
||||
* tests for 'N', 'i'). You can leave support for this in place
|
||||
* as it's only a few words.
|
||||
*/
|
||||
. = _start + 0x000c
|
||||
.string "Nios"
|
||||
|
||||
.align 4
|
||||
0:
|
||||
/*
|
||||
* Early setup -- set cwp = HI_LIMIT, IPRI = 2, IE = 1 to
|
||||
* enable underflow exceptions. Disable cache.
|
||||
* NOTE: %o7 has return addr -- save in %g7 use later.
|
||||
*/
|
||||
mov %g7, %o7
|
||||
|
||||
pfx 2 /* WVALID */
|
||||
rdctl %g0
|
||||
lsri %g0, 1
|
||||
pfx %hi(STATUS_INIT)
|
||||
or %g0, %lo(STATUS_INIT)
|
||||
wrctl %g0 /* update status */
|
||||
nop
|
||||
|
||||
/*
|
||||
* STACK
|
||||
*/
|
||||
pfx %hi(CFG_INIT_SP)
|
||||
movi %sp, %lo(CFG_INIT_SP)
|
||||
pfx %xhi(CFG_INIT_SP)
|
||||
movhi %sp, %xlo(CFG_INIT_SP)
|
||||
mov %fp, %sp
|
||||
|
||||
pfx %hi(4*16)
|
||||
subi %sp, %lo(4*16) /* Space for reg window mgmt */
|
||||
|
||||
/*
|
||||
* RELOCATE -- %g7 has return addr from bsr at _start.
|
||||
*/
|
||||
pfx %hi(__u_boot_cmd_end)
|
||||
movi %g5, %lo(__u_boot_cmd_end)
|
||||
pfx %xhi(__u_boot_cmd_end)
|
||||
movhi %g5, %xlo(__u_boot_cmd_end) /* %g5 <- end address */
|
||||
|
||||
lsli %g7, 1 /* mem = retaddr << 1 */
|
||||
mov %g6, %g7
|
||||
subi %g6, 4 /* %g6 <- src addr */
|
||||
ld %g7, [%g7] /* %g7 <- dst addr */
|
||||
|
||||
1: cmp %g7, %g5
|
||||
skps cc_nz
|
||||
br 2f
|
||||
nop /* delay slot */
|
||||
|
||||
ld %g0, [%g6]
|
||||
addi %g6, 4 /* src++ */
|
||||
st [%g7], %g0
|
||||
addi %g7, 4 /* dst++ */
|
||||
br 1b
|
||||
nop /* delay slot */
|
||||
2:
|
||||
|
||||
/*
|
||||
* Jump to relocation address
|
||||
*/
|
||||
pfx %hi(reloc@h)
|
||||
movi %g0, %lo(reloc@h)
|
||||
pfx %xhi(reloc@h)
|
||||
movhi %g0, %xlo(reloc@h)
|
||||
jmp %g0
|
||||
reloc:
|
||||
|
||||
/*
|
||||
* CLEAR BSS
|
||||
*/
|
||||
pfx %hi(__bss_end)
|
||||
movi %g5, %lo(__bss_end)
|
||||
pfx %xhi(__bss_end)
|
||||
movhi %g5, %xlo(__bss_end) /* %g5 <- end address */
|
||||
pfx %hi(__bss_start)
|
||||
movi %g7, %lo(__bss_start)
|
||||
pfx %xhi(__bss_start)
|
||||
movhi %g7, %xlo(__bss_start) /* %g7 <- end address */
|
||||
|
||||
movi %g0, 0
|
||||
3: cmp %g7, %g5
|
||||
skps cc_nz
|
||||
br 4f
|
||||
nop /* delay slot */
|
||||
|
||||
st [%g7], %g0
|
||||
addi %g7, 4 /* (delay slot) dst++ */
|
||||
br 3b
|
||||
nop /* delay slot */
|
||||
4:
|
||||
|
||||
/*
|
||||
* Call board_init -- never returns
|
||||
*/
|
||||
pfx %hi(board_init@h)
|
||||
movi %g1, %lo(board_init@h)
|
||||
pfx %xhi(board_init@h)
|
||||
movhi %g1, %xlo(board_init@h)
|
||||
call %g1
|
||||
nop /* Delaly slot */
|
||||
/* NEVER RETURNS */
|
||||
|
||||
/*
|
||||
* dly_clks -- Nios doesn't have a time/clk reference for simple
|
||||
* delay loops, so we do our best by counting instruction cycles.
|
||||
* A control register that counts system clock cycles would be
|
||||
* a handy feature -- hint for Altera ;-)
|
||||
*/
|
||||
.globl dly_clks
|
||||
/* Each loop is 4 instructions as delay slot is always
|
||||
* executed. Each instruction is approximately 4 clocks
|
||||
* (according to some lame info from Altera). So ...
|
||||
* ... each loop is about 16 clocks.
|
||||
*/
|
||||
|
||||
dly_clks:
|
||||
lsri %o0, 4 /* cnt/16 */
|
||||
|
||||
8: skprnz %o0
|
||||
br 9f
|
||||
subi %o0, 1 /* cnt--, Delay slot */
|
||||
br 8b
|
||||
nop
|
||||
|
||||
9: lret
|
||||
nop /* Delay slot */
|
||||
|
||||
|
||||
.data
|
||||
.globl version_string
|
||||
|
||||
version_string:
|
||||
.ascii U_BOOT_VERSION
|
||||
.ascii " (", __DATE__, " - ", __TIME__, ")"
|
||||
.ascii CONFIG_IDENT_STRING, "\0"
|
||||
@@ -0,0 +1,559 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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>
|
||||
|
||||
/*************************************************************************
|
||||
* Register window underflow
|
||||
*
|
||||
* The register window underflow exception occurs whenever the lowest
|
||||
* valid register window is in use (CWP=LO_LIMIT) and a save instruction
|
||||
* is issued. The save moves CWP below LO_LIMIT, %sp is set as normal,
|
||||
* then the exception is generated prior to executing the instruction
|
||||
* after the save.
|
||||
************************************************************************/
|
||||
.text
|
||||
.global _cwp_lolimit
|
||||
.align 4
|
||||
|
||||
_cwp_lolimit:
|
||||
|
||||
/* Sixteen words are always allocated by the compiler in every
|
||||
* procedure's stack frame, always starting at %sp, for saving
|
||||
* 'in' and 'local' registers on a window overflow.
|
||||
*
|
||||
* Save the 'global' and 'in' regs on stack. They are restored
|
||||
* at cwp = HI_LIMIT. The 'local' regs aren't in-use at this point.
|
||||
*/
|
||||
sts [%sp,0], %g0 /* Save 'global' regs*/
|
||||
sts [%sp,1], %g1
|
||||
sts [%sp,2], %g2
|
||||
sts [%sp,3], %g3
|
||||
sts [%sp,4], %g4
|
||||
sts [%sp,5], %g5
|
||||
sts [%sp,6], %g6
|
||||
sts [%sp,7], %g7
|
||||
|
||||
sts [%sp,8], %i0 /* Save 'in' regs */
|
||||
sts [%sp,9], %i1
|
||||
sts [%sp,10], %i2
|
||||
sts [%sp,11], %i3
|
||||
sts [%sp,12], %i4
|
||||
sts [%sp,13], %i5
|
||||
sts [%sp,14], %i6
|
||||
sts [%sp,15], %i7
|
||||
|
||||
/* Save current %sp and return address in a global so they are
|
||||
* available at cwp = HI_LIMIT ... where the 'global'/'in' regs
|
||||
* are restored. NOTE: %sp changes with cwp.
|
||||
*/
|
||||
mov %g7, %o7
|
||||
mov %g6, %sp
|
||||
|
||||
/* Get LO_LIMIT/HI_LIMIT to know where to start & stop. Note: in
|
||||
* the underflow exception, cwp is __NOT__ guaranteed to be zero.
|
||||
* If the OCI debug module is enabled the reset value for LO_LIMIT
|
||||
* is 2, not 1 -- so cwp can be 1 or 0.
|
||||
*/
|
||||
pfx 2 /* WVALID */
|
||||
rdctl %g1
|
||||
mov %g2, %g1
|
||||
pfx 0
|
||||
and %g1, 0x1f /* g1 <- LO_LIMIT */
|
||||
lsri %g2, 5
|
||||
pfx 0
|
||||
and %g2,0x1f /* g2 <- HI_LIMIT */
|
||||
|
||||
/* Set istatus so cwp = HI_LIMIT after tret
|
||||
*/
|
||||
movi %g5, 0x1f
|
||||
lsli %g5, 4
|
||||
not %g5 /* mask to clr cwp */
|
||||
pfx 1 /* istatus */
|
||||
rdctl %g0
|
||||
and %g0, %g5 /* clear cwp field */
|
||||
|
||||
mov %g4, %g2
|
||||
lsli %g4, 4
|
||||
or %g0, %g4 /* cwp = HI_LIMIT */
|
||||
pfx 1
|
||||
wrctl %g0 /* update istatus */
|
||||
|
||||
/* Now move up the register file, saving as we go. When loop
|
||||
* is first entered, %g1 is at LO_LIMIT.
|
||||
*/
|
||||
0:
|
||||
restore /* cwp++ */
|
||||
sts [%sp,0], %l0 /* Save "local" regs*/
|
||||
sts [%sp,1], %l1
|
||||
sts [%sp,2], %l2
|
||||
sts [%sp,3], %l3
|
||||
sts [%sp,4], %l4
|
||||
sts [%sp,5], %l5
|
||||
sts [%sp,6], %l6
|
||||
sts [%sp,7], %l7
|
||||
|
||||
sts [%sp,8], %i0 /* Save 'in' regs */
|
||||
sts [%sp,9], %i1
|
||||
sts [%sp,10], %i2
|
||||
sts [%sp,11], %i3
|
||||
sts [%sp,12], %i4
|
||||
sts [%sp,13], %i5
|
||||
sts [%sp,14], %i6
|
||||
sts [%sp,15], %i7
|
||||
|
||||
cmp %g1, %g2 /* cwp == HI_LIMIT ? */
|
||||
skps cc_ne /* if so, we're done */
|
||||
br 1f
|
||||
nop /* delay slot */
|
||||
|
||||
inc %g1 /* g1 <- cwp++ */
|
||||
br 0b
|
||||
nop /* delay slot */
|
||||
|
||||
/* At this point cwp = HI_LIMIT, so the global/in regs that were
|
||||
* in place when the underflow occurred must be restored using
|
||||
* the original stack pointer (saved in g6).
|
||||
*/
|
||||
1:
|
||||
mov %o7, %g7 /* restore return addr */
|
||||
mov %sp, %g6 /* Restore original sp */
|
||||
|
||||
lds %g0, [%sp,0] /* Restore 'global' regs*/
|
||||
lds %g1, [%sp,1]
|
||||
lds %g2, [%sp,2]
|
||||
lds %g3, [%sp,3]
|
||||
lds %g4, [%sp,4]
|
||||
lds %g5, [%sp,5]
|
||||
lds %g6, [%sp,6]
|
||||
lds %g7, [%sp,7]
|
||||
|
||||
lds %i0, [%sp,8] /* Restore 'in' regs*/
|
||||
lds %i1, [%sp,9]
|
||||
lds %i2, [%sp,10]
|
||||
lds %i3, [%sp,11]
|
||||
lds %i4, [%sp,12]
|
||||
lds %i5, [%sp,13]
|
||||
lds %i6, [%sp,14]
|
||||
lds %i7, [%sp,15]
|
||||
|
||||
tret %o7 /* All done */
|
||||
|
||||
/*************************************************************************
|
||||
* Register window overflow
|
||||
*
|
||||
* The register window overflow exception occurs whenever the highest
|
||||
* valid register window is in use (cwp = HI_LIMIT) and a restore
|
||||
* instruction is issued. Control is transferred to the overflow handler
|
||||
* before the instruction following restore is executed.
|
||||
*
|
||||
* When a register window overflow exception is taken, the exception
|
||||
* handler sees cwp at HI_LIMIT.
|
||||
************************************************************************/
|
||||
.text
|
||||
.global _cwp_hilimit
|
||||
.align 4
|
||||
|
||||
_cwp_hilimit:
|
||||
|
||||
/* Save 'global'/'in' regs on the stack -- will restore when cwp
|
||||
* is at LO_LIMIT. Locals don't need saving as they are going away.
|
||||
*/
|
||||
sts [%sp,0], %g0 /* Save "global" regs*/
|
||||
sts [%sp,1], %g1
|
||||
sts [%sp,2], %g2
|
||||
sts [%sp,3], %g3
|
||||
sts [%sp,4], %g4
|
||||
sts [%sp,5], %g5
|
||||
sts [%sp,6], %g6
|
||||
sts [%sp,7], %g7
|
||||
|
||||
sts [%sp,8], %i0 /* Save 'in' regs */
|
||||
sts [%sp,9], %i1
|
||||
sts [%sp,10], %i2
|
||||
sts [%sp,11], %i3
|
||||
sts [%sp,12], %i4
|
||||
sts [%sp,13], %i5
|
||||
sts [%sp,14], %i6
|
||||
sts [%sp,15], %i7
|
||||
|
||||
/* The current %sp must be available in global to restore regs
|
||||
* saved on stack. Need return addr as well ;-)
|
||||
*/
|
||||
mov %g7, %o7
|
||||
mov %g6, %sp
|
||||
|
||||
/* Get HI_LIMIT & LO_LIMIT
|
||||
*/
|
||||
pfx 2 /* WVALID */
|
||||
rdctl %g1
|
||||
mov %g2, %g1
|
||||
pfx 0
|
||||
and %g1, 0x1f /* g1 <- LO_LIMIT */
|
||||
lsri %g2, 5
|
||||
pfx 0
|
||||
and %g2,0x1f /* g2 <- HI_LIMIT */
|
||||
|
||||
/* Set istatus so cwp = LO_LIMIT after tret
|
||||
*/
|
||||
movi %g5, 0x1f
|
||||
lsli %g5, 4
|
||||
not %g5 /* mask to clr cwp */
|
||||
pfx 1 /* istatus */
|
||||
rdctl %g0
|
||||
and %g0, %g5 /* clear cwp field */
|
||||
|
||||
mov %g4, %g1 /* g4 <- LO_LIMIT */
|
||||
lsli %g4, 4
|
||||
or %g0, %g4 /* cwp = LO_LIMIT */
|
||||
pfx 1
|
||||
wrctl %g0 /* update istatus */
|
||||
|
||||
/* Move to cwp = LO_LIMIT-1 and restore 'in' regs.
|
||||
*/
|
||||
subi %g4,(1 << 4) /* g4 <- LO_LIMIT - 1 */
|
||||
rdctl %g0
|
||||
and %g0, %g5 /* clear cwp field */
|
||||
or %g0, %g4 /* cwp = LO_LIMIT - 1 */
|
||||
wrctl %g0 /* update status */
|
||||
nop
|
||||
|
||||
mov %sp, %g6 /* Restore sp */
|
||||
lds %i0, [%sp,8] /* Restore 'in' regs */
|
||||
lds %i1, [%sp,9]
|
||||
lds %i2, [%sp,10]
|
||||
lds %i3, [%sp,11]
|
||||
lds %i4, [%sp,12]
|
||||
lds %i5, [%sp,13]
|
||||
lds %i6, [%sp,14] /* sp in next window */
|
||||
lds %i7, [%sp,15]
|
||||
|
||||
/* Starting at LO_LIMIT-1, move up the register file, restoring
|
||||
* along the way.
|
||||
*/
|
||||
0:
|
||||
restore /* cwp++ */
|
||||
lds %l0, [%sp,0] /* Restore 'local' regs*/
|
||||
lds %l1, [%sp,1]
|
||||
lds %l2, [%sp,2]
|
||||
lds %l3, [%sp,3]
|
||||
lds %l4, [%sp,4]
|
||||
lds %l5, [%sp,5]
|
||||
lds %l6, [%sp,6]
|
||||
lds %l7, [%sp,7]
|
||||
|
||||
lds %i0, [%sp,8] /* Restore 'in' regs */
|
||||
lds %i1, [%sp,9]
|
||||
lds %i2, [%sp,10]
|
||||
lds %i3, [%sp,11]
|
||||
lds %i4, [%sp,12]
|
||||
lds %i5, [%sp,13]
|
||||
lds %i6, [%sp,14] /* sp in next window */
|
||||
lds %i7, [%sp,15]
|
||||
|
||||
cmp %g1, %g2 /* cwp == HI_LIMIT ? */
|
||||
skps cc_ne /* if so, we're done */
|
||||
br 1f
|
||||
nop /* delay slot */
|
||||
|
||||
inc %g1 /* cwp++ */
|
||||
br 0b
|
||||
nop /* delay slot */
|
||||
|
||||
/* All windows have been updated at this point, but the globals
|
||||
* still need to be restored. Go to cwp = LO_LIMIT-1 to get
|
||||
* some registers to use.
|
||||
*/
|
||||
1:
|
||||
rdctl %g0
|
||||
and %g0, %g5 /* clear cwp field */
|
||||
or %g0, %g4 /* cwp = LO_LIMIT - 1 */
|
||||
wrctl %g0 /* update status */
|
||||
nop
|
||||
|
||||
/* Now there are some registers available to use in restoring
|
||||
* the globals.
|
||||
*/
|
||||
mov %sp, %g6
|
||||
mov %o7, %g7
|
||||
|
||||
lds %g0, [%sp,0] /* Restore "global" regs*/
|
||||
lds %g1, [%sp,1]
|
||||
lds %g2, [%sp,2]
|
||||
lds %g3, [%sp,3]
|
||||
lds %g4, [%sp,4]
|
||||
lds %g5, [%sp,5]
|
||||
lds %g6, [%sp,6]
|
||||
lds %g7, [%sp,7]
|
||||
|
||||
/* The tret moves istatus -> status. istatus was already set for
|
||||
* cwp = LO_LIMIT.
|
||||
*/
|
||||
|
||||
tret %o7 /* done */
|
||||
|
||||
/*************************************************************************
|
||||
* Default exception handler
|
||||
*
|
||||
* The default handler passes control to external_interrupt(). So trap
|
||||
* or hardware interrupt hanlders can be installed using the familiar
|
||||
* irq_install_handler().
|
||||
*
|
||||
* Here, the stack is fixed-up and cwp is incremented prior to calling
|
||||
* external_interrupt(). This lets the underflow and overflow handlers
|
||||
* operate normally during the exception.
|
||||
************************************************************************/
|
||||
.text
|
||||
.global _def_xhandler
|
||||
.align 4
|
||||
|
||||
_def_xhandler:
|
||||
|
||||
/* Allocate some stack space: 16 words at %sp to accomodate
|
||||
* a reg window underflow, 8 words to save interrupted task's
|
||||
* 'out' regs (which are now the 'in' regs), 8 words to preserve
|
||||
* the 'global' regs and 3 words to save the return address,
|
||||
* status and istatus. istatus must be saved in the event an
|
||||
* underflow occurs in a dispatched handler. status is saved so
|
||||
* a handler can access it on stack.
|
||||
*/
|
||||
pfx %hi((16+16+3) * 4)
|
||||
subi %fp, %lo((16+16+3) * 4)
|
||||
mov %sp, %fp
|
||||
|
||||
/* Save the 'global' regs and the interrupted task's 'out' regs
|
||||
* (our 'in' regs) along with the return addr, status & istatus.
|
||||
* First 16 words are for underflow exception.
|
||||
*/
|
||||
rdctl %l0 /* status */
|
||||
pfx 1 /* istatus */
|
||||
rdctl %l1
|
||||
|
||||
sts [%sp,16+0], %g0 /* Save 'global' regs*/
|
||||
sts [%sp,16+1], %g1
|
||||
sts [%sp,16+2], %g2
|
||||
sts [%sp,16+3], %g3
|
||||
sts [%sp,16+4], %g4
|
||||
sts [%sp,16+5], %g5
|
||||
sts [%sp,16+6], %g6
|
||||
sts [%sp,16+7], %g7
|
||||
|
||||
sts [%sp,16+8], %i0 /* Save 'in' regs */
|
||||
sts [%sp,16+9], %i1
|
||||
sts [%sp,16+10], %i2
|
||||
sts [%sp,16+11], %i3
|
||||
sts [%sp,16+12], %i4
|
||||
sts [%sp,16+13], %i5
|
||||
sts [%sp,16+14], %i6
|
||||
sts [%sp,16+15], %i7
|
||||
|
||||
sts [%sp,16+16], %l0 /* status */
|
||||
sts [%sp,16+17], %l1 /* istatus */
|
||||
sts [%sp,16+18], %o7 /* return addr */
|
||||
|
||||
/* Move to cwp+1 ... this guarantees cwp is at or above LO_LIMIT.
|
||||
* Need to set IPRI=3 and IE=1 to enable underflow exceptions.
|
||||
* NOTE: only the 'out' regs have been saved ... can't touch
|
||||
* the 'in' or 'local' here.
|
||||
*/
|
||||
restore /* cwp++ */
|
||||
rdctl %o0 /* o0 <- status */
|
||||
|
||||
pfx %hi(0x7e00)
|
||||
movi %o1, %lo(0x7e00)
|
||||
not %o1
|
||||
and %o0, %o1 /* clear IPRI */
|
||||
|
||||
pfx %hi(0x8600)
|
||||
movi %o1, %lo(0x8600)
|
||||
or %o0, %o1 /* IPRI=3, IE=1 */
|
||||
|
||||
wrctl %o0 /* o0 -> status */
|
||||
nop
|
||||
|
||||
/* It's ok to call a C routine now since cwp >= LO_LIMIT,
|
||||
* interrupt task's registers are/will be preserved, and
|
||||
* underflow exceptions can be handled.
|
||||
*/
|
||||
pfx %hi(external_interrupt@h)
|
||||
movi %o1, %lo(external_interrupt@h)
|
||||
pfx %xhi(external_interrupt@h)
|
||||
movhi %o1, %xlo(external_interrupt@h)
|
||||
bgen %o0, 4+2 /* 16 * 4 */
|
||||
add %o0, %sp /* Ptr to regs */
|
||||
call %o1
|
||||
nop
|
||||
|
||||
/* Move back to the exception register window, restore the 'out'
|
||||
* registers, then return from exception.
|
||||
*/
|
||||
rdctl %o0 /* o0 <- status */
|
||||
subi %o0, 16
|
||||
wrctl %o0 /* cwp-- */
|
||||
nop
|
||||
|
||||
mov %sp, %fp
|
||||
lds %g0, [%sp,16+0] /* Restore 'global' regs*/
|
||||
lds %g1, [%sp,16+1]
|
||||
lds %g2, [%sp,16+2]
|
||||
lds %g3, [%sp,16+3]
|
||||
lds %g4, [%sp,16+4]
|
||||
lds %g5, [%sp,16+5]
|
||||
lds %g6, [%sp,16+6]
|
||||
lds %g7, [%sp,16+7]
|
||||
|
||||
lds %i0, [%sp,16+8] /* Restore 'in' regs*/
|
||||
lds %i1, [%sp,16+9]
|
||||
lds %i2, [%sp,16+10]
|
||||
lds %i3, [%sp,16+11]
|
||||
lds %i4, [%sp,16+12]
|
||||
lds %i5, [%sp,16+13]
|
||||
lds %i6, [%sp,16+14]
|
||||
lds %i7, [%sp,16+15]
|
||||
|
||||
lds %l0, [%sp,16+16] /* status */
|
||||
lds %l1, [%sp,16+17] /* istatus */
|
||||
lds %o7, [%sp,16+18] /* return addr */
|
||||
|
||||
pfx 1
|
||||
wrctl %l1 /* restore istatus */
|
||||
|
||||
pfx %hi((16+16+3) * 4)
|
||||
addi %sp, %lo((16+16+3) * 4)
|
||||
mov %fp, %sp
|
||||
|
||||
tret %o7 /* Done */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Timebase Timer Interrupt -- This has identical structure to above,
|
||||
* but calls timer_interrupt(). Doing it this way keeps things similar
|
||||
* to other architectures (e.g. ppc).
|
||||
************************************************************************/
|
||||
.text
|
||||
.global _timebase_int
|
||||
.align 4
|
||||
|
||||
_timebase_int:
|
||||
|
||||
/* Allocate stack space.
|
||||
*/
|
||||
pfx %hi((16+16+3) * 4)
|
||||
subi %fp, %lo((16+16+3) * 4)
|
||||
mov %sp, %fp
|
||||
|
||||
/* Save the 'global' regs & 'out' regs (our 'in' regs)
|
||||
*/
|
||||
rdctl %l0 /* status */
|
||||
pfx 1 /* istatus */
|
||||
rdctl %l1
|
||||
|
||||
sts [%sp,16+0], %g0 /* Save 'global' regs*/
|
||||
sts [%sp,16+1], %g1
|
||||
sts [%sp,16+2], %g2
|
||||
sts [%sp,16+3], %g3
|
||||
sts [%sp,16+4], %g4
|
||||
sts [%sp,16+5], %g5
|
||||
sts [%sp,16+6], %g6
|
||||
sts [%sp,16+7], %g7
|
||||
|
||||
sts [%sp,16+8], %i0 /* Save 'in' regs */
|
||||
sts [%sp,16+9], %i1
|
||||
sts [%sp,16+10], %i2
|
||||
sts [%sp,16+11], %i3
|
||||
sts [%sp,16+12], %i4
|
||||
sts [%sp,16+13], %i5
|
||||
sts [%sp,16+14], %i6
|
||||
sts [%sp,16+15], %i7
|
||||
|
||||
sts [%sp,16+16], %l0 /* status */
|
||||
sts [%sp,16+17], %l1 /* istatus */
|
||||
sts [%sp,16+18], %o7 /* return addr */
|
||||
|
||||
/* Move to cwp+1.
|
||||
*/
|
||||
restore /* cwp++ */
|
||||
rdctl %o0 /* o0 <- status */
|
||||
|
||||
pfx %hi(0x7e00)
|
||||
movi %o1, %lo(0x7e00)
|
||||
not %o1
|
||||
and %o0, %o1 /* clear IPRI */
|
||||
|
||||
pfx %hi(0x8600)
|
||||
movi %o1, %lo(0x8600)
|
||||
or %o0, %o1 /* IPRI=3, IE=1 */
|
||||
|
||||
wrctl %o0 /* o0 -> status */
|
||||
nop
|
||||
|
||||
/* Call timer_interrupt()
|
||||
*/
|
||||
pfx %hi(timer_interrupt@h)
|
||||
movi %o1, %lo(timer_interrupt@h)
|
||||
pfx %xhi(timer_interrupt@h)
|
||||
movhi %o1, %xlo(timer_interrupt@h)
|
||||
bgen %o0, 4+2 /* 16 * 4 */
|
||||
add %o0, %sp /* Ptr to regs */
|
||||
call %o1
|
||||
nop
|
||||
|
||||
/* Move back to the exception register window, restore the 'out'
|
||||
* registers, then return from exception.
|
||||
*/
|
||||
rdctl %o0 /* o0 <- status */
|
||||
subi %o0, 16
|
||||
wrctl %o0 /* cwp-- */
|
||||
nop
|
||||
|
||||
mov %sp, %fp
|
||||
lds %g0, [%sp,16+0] /* Restore 'global' regs*/
|
||||
lds %g1, [%sp,16+1]
|
||||
lds %g2, [%sp,16+2]
|
||||
lds %g3, [%sp,16+3]
|
||||
lds %g4, [%sp,16+4]
|
||||
lds %g5, [%sp,16+5]
|
||||
lds %g6, [%sp,16+6]
|
||||
lds %g7, [%sp,16+7]
|
||||
|
||||
lds %i0, [%sp,16+8] /* Restore 'in' regs*/
|
||||
lds %i1, [%sp,16+9]
|
||||
lds %i2, [%sp,16+10]
|
||||
lds %i3, [%sp,16+11]
|
||||
lds %i4, [%sp,16+12]
|
||||
lds %i5, [%sp,16+13]
|
||||
lds %i6, [%sp,16+14]
|
||||
lds %i7, [%sp,16+15]
|
||||
|
||||
lds %l0, [%sp,16+16] /* status */
|
||||
lds %l1, [%sp,16+17] /* istatus */
|
||||
lds %o7, [%sp,16+18] /* return addr */
|
||||
|
||||
pfx 1
|
||||
wrctl %l1 /* restore istatus */
|
||||
|
||||
pfx %hi((16+16+3) * 4)
|
||||
addi %sp, %lo((16+16+3) * 4)
|
||||
mov %fp, %sp
|
||||
|
||||
tret %o7 /* Done */
|
||||
+1
-1
@@ -83,7 +83,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
extern void reset_cpu (ulong addr);
|
||||
|
||||
printf ("reseting ...\n");
|
||||
printf ("resetting ...\n");
|
||||
|
||||
udelay (50000); /* wait 50 ms */
|
||||
disable_interrupts ();
|
||||
|
||||
@@ -202,3 +202,23 @@ void udelay_masked (unsigned long usec)
|
||||
while (tmo >= get_timer_masked ())
|
||||
/*NOP*/;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is derived from PowerPC code (read timebase as long long).
|
||||
* On ARM it just returns the timer value.
|
||||
*/
|
||||
unsigned long long get_ticks(void)
|
||||
{
|
||||
return get_timer(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is derived from PowerPC code (timebase clock frequency).
|
||||
* On ARM it returns the number of timer ticks per second.
|
||||
*/
|
||||
ulong get_tbclk (void)
|
||||
{
|
||||
ulong tbclk;
|
||||
tbclk = CFG_HZ;
|
||||
return tbclk;
|
||||
}
|
||||
+31
-11
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <watchdog.h>
|
||||
#include <asm/arch/pxa-regs.h>
|
||||
|
||||
void serial_setbrg (void)
|
||||
@@ -38,7 +39,7 @@ void serial_setbrg (void)
|
||||
unsigned int quot = 0;
|
||||
|
||||
if (gd->baudrate == 1200)
|
||||
quot = 192;
|
||||
quot = 768;
|
||||
else if (gd->baudrate == 9600)
|
||||
quot = 96;
|
||||
else if (gd->baudrate == 19200)
|
||||
@@ -53,7 +54,6 @@ void serial_setbrg (void)
|
||||
hang ();
|
||||
|
||||
#ifdef CONFIG_FFUART
|
||||
|
||||
CKEN |= CKEN6_FFUART;
|
||||
|
||||
FFIER = 0; /* Disable for now */
|
||||
@@ -82,9 +82,21 @@ void serial_setbrg (void)
|
||||
BTIER = IER_UUE; /* Enable BFUART */
|
||||
|
||||
#elif defined(CONFIG_STUART)
|
||||
#error "Bad: not implemented yet!"
|
||||
CKEN |= CKEN5_STUART;
|
||||
|
||||
STIER = 0;
|
||||
STFCR = 0;
|
||||
|
||||
/* set baud rate */
|
||||
STLCR = LCR_DLAB;
|
||||
STDLL = quot & 0xff;
|
||||
STDLH = quot >> 8;
|
||||
STLCR = LCR_WLS0 | LCR_WLS1;
|
||||
|
||||
STIER = IER_UUE; /* Enable STUART */
|
||||
|
||||
#else
|
||||
#error "Bad: you didn't configured serial ..."
|
||||
#error "Bad: you didn't configure serial ..."
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -109,13 +121,17 @@ void serial_putc (const char c)
|
||||
{
|
||||
#ifdef CONFIG_FFUART
|
||||
/* wait for room in the tx FIFO on FFUART */
|
||||
while ((FFLSR & LSR_TEMT) == 0);
|
||||
|
||||
while ((FFLSR & LSR_TEMT) == 0)
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
FFTHR = c;
|
||||
#elif defined(CONFIG_BTUART)
|
||||
while ((BTLSR & LSR_TEMT ) == 0 );
|
||||
while ((BTLSR & LSR_TEMT ) == 0 )
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
BTTHR = c;
|
||||
#elif defined(CONFIG_STUART)
|
||||
while ((STLSR & LSR_TEMT ) == 0 )
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
STTHR = c;
|
||||
#endif
|
||||
|
||||
/* If \n, also do \r */
|
||||
@@ -135,6 +151,7 @@ int serial_tstc (void)
|
||||
#elif defined(CONFIG_BTUART)
|
||||
return BTLSR & LSR_DR;
|
||||
#elif defined(CONFIG_STUART)
|
||||
return STLSR & LSR_DR;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -146,14 +163,17 @@ int serial_tstc (void)
|
||||
int serial_getc (void)
|
||||
{
|
||||
#ifdef CONFIG_FFUART
|
||||
while (!(FFLSR & LSR_DR));
|
||||
|
||||
while (!(FFLSR & LSR_DR))
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
return (char) FFRBR & 0xff;
|
||||
#elif defined(CONFIG_BTUART)
|
||||
while (!(BTLSR & LSR_DR));
|
||||
|
||||
while (!(BTLSR & LSR_DR))
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
return (char) BTRBR & 0xff;
|
||||
#elif defined(CONFIG_STUART)
|
||||
while (!(STLSR & LSR_DR))
|
||||
WATCHDOG_RESET (); /* Reset HW Watchdog, if needed */
|
||||
return (char) STRBR & 0xff;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,6 @@ _fiq: .word fiq
|
||||
* - jump to second stage
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -73,9 +73,6 @@ _fiq: .word fiq
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* CFG_MEM_END is in the board dependent config-file (configs/config_BOARD.h)
|
||||
*/
|
||||
_TEXT_BASE:
|
||||
.word TEXT_BASE
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
Nios Development Kit
|
||||
Cyclone Editions
|
||||
|
||||
Last Update: October 4, 2003
|
||||
====================================================================
|
||||
|
||||
This file contains information regarding U-Boot and the Altera
|
||||
Nios Development Kit, Cyclone Edition (DK-1C20). For general Nios
|
||||
information see doc/README.nios.
|
||||
|
||||
For those interested in contributing ... see HELP WANTED section
|
||||
in doc/README.nios.
|
||||
|
||||
|
||||
Files
|
||||
------
|
||||
board/dk1c20/*
|
||||
include/configs/DK1C20.h
|
||||
|
||||
Memory Organization
|
||||
--------------------
|
||||
|
||||
-The heap is placed below the monitor (U-Boot code).
|
||||
-Global data is placed below the heap.
|
||||
-The stack is placed below global data (&grows down).
|
||||
|
||||
Misc
|
||||
-----
|
||||
|
||||
The hello_world example works fine.
|
||||
|
||||
|
||||
Programming U-Boot into FLASH with GERMS
|
||||
-----------------------------------------
|
||||
The current version of the DK-1C20 port occupies less than
|
||||
60 KByte. So everything will fit into a single Flash sector.
|
||||
To program U-Boot into the DK-1C20 flash using GERMS do the
|
||||
following:
|
||||
|
||||
1. From the command line, download U-Boot using the nios-run:
|
||||
|
||||
$ nios-run -r u-boot.srec
|
||||
|
||||
This takes about 45 seconds (GERMS is not very speedy here).
|
||||
After u-boot is downloaded it will be executed. You should
|
||||
see the following:
|
||||
|
||||
U-Boot 1.0.0-pre (Oct 4 2003 - 07:39:24)
|
||||
|
||||
CPU: Nios-32 Rev. 3.08 (0x3018)
|
||||
Reg file size: 256 LO_LIMIT/HI_LIMIT: 2/14
|
||||
Board: Altera Nios 1C20 Development Kit
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
==>
|
||||
|
||||
|
||||
2. Quit nios-run and start your terminal application (e.g. start
|
||||
Hyperterminal or minicom).
|
||||
|
||||
3. From the U-Boot command prompt, erase a sector of flash at 0x40000:
|
||||
|
||||
==> erase 40000 4ffff
|
||||
|
||||
4. Download the u-boot code to RAM. When using Hyperterminal, do the
|
||||
following:
|
||||
|
||||
--From the u-boot command prompt start a binary download to SRAM:
|
||||
|
||||
==> loadb 800000
|
||||
|
||||
--Download u-boot.bin using kermit.
|
||||
|
||||
5. Copy the binary image from SRAM to flash:
|
||||
|
||||
==> cp.b 800000 40000 10000
|
||||
|
||||
U-Boot will now automatically start when the board is powered on or
|
||||
reset using the Standard-32 configuration. To start U-Boot with the
|
||||
Safe-32 configuration, enter the following GERMS command:
|
||||
|
||||
+ g 40000
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
|
||||
U-Boot for Nios-32
|
||||
|
||||
Last Update: October 4, 2003
|
||||
====================================================================
|
||||
|
||||
This file contains information regarding U-Boot and the Altera
|
||||
Nios CPU. For information regarding U-Boot and the Nios Development
|
||||
Kit, Cyclone Edition (DK-1C20), see doc/README.dk1c20.
|
||||
|
||||
For those interested in contributing ... see HELP WANTED below.
|
||||
|
||||
|
||||
1. OVERVIEW
|
||||
------------
|
||||
|
||||
U-Boot has been successfully tested on the Nios Cyclone development
|
||||
board using both the 'safe' and 'standard 32' configurations with
|
||||
Nios CPU revision 3.08 (CPU_ID = 0x3008). U-Boot can be used with
|
||||
or without the GERMS monitor. The initial version of U-Boot for the
|
||||
Cyclone development kit is about 60 Kbyte and will fit in a single
|
||||
sector of on-board FLASH. Only the Nios 32-bit CPU is supported.
|
||||
|
||||
1.1 GERMS Monitor
|
||||
------------------
|
||||
If GERMS is just not enough, then U-Boot is a great antibiotic.
|
||||
You will be very pleased with its high degree of configurability
|
||||
and its rich feature set.
|
||||
|
||||
A few of the most obvious limitations of GERMS are overcome by
|
||||
using U-Boot (See 'Brain Damage'). Most notably, you can use
|
||||
minicom or Hyperterminal (duh).
|
||||
|
||||
1.2 Altera Source Code
|
||||
-----------------------
|
||||
The Nios port does NOT include ANY sources that Altera has the
|
||||
copyright. This was a conscious decision ... not an accident.
|
||||
The Altera license is not clear in terms of distributing Altera
|
||||
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.
|
||||
|
||||
The Nios port also does not use the long-winded peripheral
|
||||
structure definitions from the Nios SDK.
|
||||
|
||||
|
||||
|
||||
2. CONFIGURATION OPTIONS/SETTINGS
|
||||
----------------------------------
|
||||
|
||||
2.1 Nios-specific Options/Settings
|
||||
-----------------------------------
|
||||
All configuration options/settings that are specific to Nios begin
|
||||
with "CONFIG_NIOS_" or "CFG_NIOS_". The following is a list of
|
||||
currently defined Nios-specific options/parameters. If any options
|
||||
are related to Standard-32 Nios SDK excalibur.h definitions, the
|
||||
related definition follows the description).
|
||||
|
||||
|
||||
CONFIG_NIOS -- defined for all Nios-32 boards.
|
||||
|
||||
CFG_NIOS_CONSOLE -- the base address of the console UART.
|
||||
(standard-32: na_uart1_base).
|
||||
|
||||
CFG_NIOS_FIXEDBAUD -- defined if the console UART PTF fixed_baud
|
||||
parameter is set to '1'.
|
||||
|
||||
CFG_NIOS_MULT_HW -- use full hardware multiply (not yet implemented).
|
||||
|
||||
CFG_NIOS_MULT_MSTEP -- use hardware assisted multiply using the
|
||||
MSTEP instruction (not yet implemented).
|
||||
|
||||
CFG_NIOS_TMRBASE -- the base address of the timer used to support
|
||||
xxx_timer routines (e.g. set_timer(), get_timer(), etc.).
|
||||
(standard-32: na_lo_priority_timer2_base).
|
||||
|
||||
CFG_NIOS_TMRIRQ -- the interrupt request (vector number) assigned to
|
||||
the timer. (standard-32: na_low_priority_timer2_irq).
|
||||
|
||||
CFG_NIOS_TMRMS -- the period of the timer in milliseconds.
|
||||
|
||||
2.2 Differences in U-Boot Options/Settings
|
||||
-------------------------------------------
|
||||
Some 'standard' U-Boot options/settings are treated differently in
|
||||
the Nios port. These are described below.
|
||||
|
||||
CFG_GBL_DATA_OFFSET -- in the Nios port, this is the offset of the
|
||||
global data structure in the Nios memory space. More simply,
|
||||
the address of global data.
|
||||
|
||||
|
||||
3. ASSEMBLY CODING
|
||||
-------------------
|
||||
|
||||
In browsing the assembly source files, you may notice the absence
|
||||
of the 'magic macros' (e.g. MOVIA, MOVIP, ADDIP etc.). This is
|
||||
deliberate. The documentation for the magic macros is scant and
|
||||
it is hard to find ... it does not appear in the Nios programmer's
|
||||
manual, nor does it appear in the assembler manual. Regardless,
|
||||
the macros actually do very little to improve readability anyway.
|
||||
|
||||
With this in mind, all assembler modules use only instructions that
|
||||
appear in the Nios programmer's manual OR are directly supported
|
||||
by the nios-elf toolchain. For example, the 'dec %rB' instruction
|
||||
is an alias for 'subi %rB,1' that is supported by the assembler
|
||||
but does not appear in the programmer's manual.
|
||||
|
||||
|
||||
4. 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.
|
||||
|
||||
4.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.
|
||||
|
||||
4.2 cygwin Incompatibility
|
||||
---------------------------
|
||||
The version of cygwin distributed with the nios GNUPro toolchain is
|
||||
out-of-date and incompatible with the latest cygwin distributions.
|
||||
In addition, many of the standard utilities are very dated as well.
|
||||
If you try to download and build the lastest version of grep for
|
||||
example, you'll quickly realize that a native gcc is not available
|
||||
(the next topic) which leads to U-Boot build problems (following
|
||||
topic).
|
||||
|
||||
The solution ... well, you can wait for Altera ... or build as
|
||||
set of tools for linux.
|
||||
|
||||
4.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
|
||||
environment -- forget it! A native (cygwin) gcc is not distributed,
|
||||
and the old version of cygwin makes locating one challenging.
|
||||
|
||||
The solution ... same as above. Just download the gcc source from
|
||||
Altera and build up a set of cross tools for your favorite linux
|
||||
distro.
|
||||
|
||||
4.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
|
||||
native gcc, this (obviously) causes problems.
|
||||
|
||||
For developers using the Altera cygwin tools you can remove the
|
||||
'tools' directory from SUBDIRS in the top-level Makefile. You will
|
||||
also have to edit common/Makefile:
|
||||
|
||||
Replace:
|
||||
environment.o: environment.c ../tools/envcrc
|
||||
$(CC) $(AFLAGS) -Wa,--no-warn \
|
||||
-DENV_CRC=$(shell ../tools/envcrc) \
|
||||
-c -o $@ environment.c
|
||||
|
||||
With:
|
||||
environment.o: environment.c ../tools/envcrc
|
||||
$(CC) $(AFLAGS) -Wa,--no-warn \
|
||||
-DENV_CRC=0 \
|
||||
-c -o $@ environment.c
|
||||
|
||||
BTW, thats a 'zero' ... not the letter 'O'.
|
||||
|
||||
|
||||
5. HELP WANTED
|
||||
---------------
|
||||
|
||||
There are plenty of areas where help is needed. Here's are some ideas
|
||||
for those interested in contributing:
|
||||
|
||||
-SMC 91C111 support. E.g. add in tftpboot, etc.
|
||||
|
||||
-CompactFlash. Port & test CF/FAT.
|
||||
|
||||
-ASMI support. Use ASMI for environment, etc.
|
||||
|
||||
-Bedbug. Develop bedbug for Nios ... or at least provide a disassemble
|
||||
command.
|
||||
|
||||
-Add boot support for ucLinux (niosnommu).
|
||||
|
||||
-Implement (don't copy Altera code) the __mulxx routines using the
|
||||
MSTEP and MUL instructions (e.g. CFG_NIOS_MULT_HW and CFG_NIOS_MULT_MSTEP).
|
||||
|
||||
|
||||
|
||||
Regards,
|
||||
|
||||
--Scott
|
||||
<smcnutt@psyent.com>
|
||||
+271
-273
@@ -91,359 +91,357 @@ static void SetI2CSCL(int x)
|
||||
}
|
||||
|
||||
|
||||
static int WaitForXfer(void)
|
||||
static int WaitForXfer (void)
|
||||
{
|
||||
S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
|
||||
int i, status;
|
||||
S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
|
||||
int i, status;
|
||||
|
||||
i = I2C_TIMEOUT * 1000;
|
||||
status = i2c->IICCON;
|
||||
while ((i > 0) && !(status & I2CCON_IRPND)) {
|
||||
udelay(1000);
|
||||
i = I2C_TIMEOUT * 10000;
|
||||
status = i2c->IICCON;
|
||||
i--;
|
||||
}
|
||||
while ((i > 0) && !(status & I2CCON_IRPND)) {
|
||||
udelay (100);
|
||||
status = i2c->IICCON;
|
||||
i--;
|
||||
}
|
||||
|
||||
return(status & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
|
||||
return (status & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
|
||||
}
|
||||
|
||||
static int IsACK(void)
|
||||
static int IsACK (void)
|
||||
{
|
||||
S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
|
||||
S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
|
||||
|
||||
return(!(i2c->IICSTAT & I2CSTAT_NACK));
|
||||
return (!(i2c->IICSTAT & I2CSTAT_NACK));
|
||||
}
|
||||
|
||||
static void ReadWriteByte(void)
|
||||
static void ReadWriteByte (void)
|
||||
{
|
||||
S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
|
||||
S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
|
||||
|
||||
i2c->IICCON &= ~I2CCON_IRPND;
|
||||
i2c->IICCON &= ~I2CCON_IRPND;
|
||||
}
|
||||
|
||||
void i2c_init (int speed, int slaveadd)
|
||||
{
|
||||
S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
|
||||
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
|
||||
ulong freq, pres = 16, div;
|
||||
int i, status;
|
||||
S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
|
||||
S3C24X0_GPIO *const gpio = S3C24X0_GetBase_GPIO ();
|
||||
ulong freq, pres = 16, div;
|
||||
int i, status;
|
||||
|
||||
/* wait for some time to give previous transfer a chance to finish */
|
||||
/* wait for some time to give previous transfer a chance to finish */
|
||||
|
||||
i = I2C_TIMEOUT * 1000;
|
||||
status = i2c->IICSTAT;
|
||||
while ((i > 0) && (status & I2CSTAT_BSY)) {
|
||||
udelay(1000);
|
||||
i = I2C_TIMEOUT * 1000;
|
||||
status = i2c->IICSTAT;
|
||||
i--;
|
||||
}
|
||||
|
||||
if ((status & I2CSTAT_BSY) || GetI2CSDA() == 0) {
|
||||
#ifdef CONFIG_S3C2410
|
||||
ulong old_gpecon = gpio->GPECON;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2400
|
||||
ulong old_gpecon = gpio->PGCON;
|
||||
#endif
|
||||
/* bus still busy probably by (most) previously interrupted transfer */
|
||||
|
||||
#ifdef CONFIG_S3C2410
|
||||
/* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */
|
||||
gpio->GPECON = (gpio->GPECON & ~0xF0000000) | 0x10000000;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2400
|
||||
/* set I2CSDA and I2CSCL (PG5, PG6) to GPIO */
|
||||
gpio->PGCON = (gpio->PGCON & ~0x00003c00) | 0x00000c00;
|
||||
#endif
|
||||
|
||||
/* toggle I2CSCL until bus idle */
|
||||
SetI2CSCL(0); udelay(1000);
|
||||
i = 10;
|
||||
while ((i > 0) && (GetI2CSDA() != 1)) {
|
||||
SetI2CSCL(1); udelay(1000);
|
||||
SetI2CSCL(0); udelay(1000);
|
||||
while ((i > 0) && (status & I2CSTAT_BSY)) {
|
||||
udelay (1000);
|
||||
status = i2c->IICSTAT;
|
||||
i--;
|
||||
}
|
||||
SetI2CSCL(1); udelay(1000);
|
||||
|
||||
/* restore pin functions */
|
||||
if ((status & I2CSTAT_BSY) || GetI2CSDA () == 0) {
|
||||
#ifdef CONFIG_S3C2410
|
||||
gpio->GPECON = old_gpecon;
|
||||
ulong old_gpecon = gpio->GPECON;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2400
|
||||
gpio->PGCON = old_gpecon;
|
||||
ulong old_gpecon = gpio->PGCON;
|
||||
#endif
|
||||
}
|
||||
/* bus still busy probably by (most) previously interrupted transfer */
|
||||
|
||||
/* calculate prescaler and divisor values */
|
||||
freq = get_PCLK();
|
||||
if ((freq / pres / (16+1)) > speed)
|
||||
/* set prescaler to 512 */
|
||||
pres = 512;
|
||||
#ifdef CONFIG_S3C2410
|
||||
/* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */
|
||||
gpio->GPECON = (gpio->GPECON & ~0xF0000000) | 0x10000000;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2400
|
||||
/* set I2CSDA and I2CSCL (PG5, PG6) to GPIO */
|
||||
gpio->PGCON = (gpio->PGCON & ~0x00003c00) | 0x00000c00;
|
||||
#endif
|
||||
|
||||
div = 0;
|
||||
while ((freq / pres / (div+1)) > speed)
|
||||
div++;
|
||||
/* toggle I2CSCL until bus idle */
|
||||
SetI2CSCL (0);
|
||||
udelay (1000);
|
||||
i = 10;
|
||||
while ((i > 0) && (GetI2CSDA () != 1)) {
|
||||
SetI2CSCL (1);
|
||||
udelay (1000);
|
||||
SetI2CSCL (0);
|
||||
udelay (1000);
|
||||
i--;
|
||||
}
|
||||
SetI2CSCL (1);
|
||||
udelay (1000);
|
||||
|
||||
/* set prescaler, divisor according to freq, also set
|
||||
ACKGEN, IRQ */
|
||||
i2c->IICCON = (div & 0x0F) | 0xA0 | ((pres == 512) ? 0x40 : 0);
|
||||
/* restore pin functions */
|
||||
#ifdef CONFIG_S3C2410
|
||||
gpio->GPECON = old_gpecon;
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2400
|
||||
gpio->PGCON = old_gpecon;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* init to SLAVE REVEIVE and set slaveaddr */
|
||||
i2c->IICSTAT = 0;
|
||||
i2c->IICADD = slaveadd;
|
||||
/* program Master Transmit (and implicit STOP) */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
|
||||
/* calculate prescaler and divisor values */
|
||||
freq = get_PCLK ();
|
||||
if ((freq / pres / (16 + 1)) > speed)
|
||||
/* set prescaler to 512 */
|
||||
pres = 512;
|
||||
|
||||
div = 0;
|
||||
while ((freq / pres / (div + 1)) > speed)
|
||||
div++;
|
||||
|
||||
/* set prescaler, divisor according to freq, also set
|
||||
* ACKGEN, IRQ */
|
||||
i2c->IICCON = (div & 0x0F) | 0xA0 | ((pres == 512) ? 0x40 : 0);
|
||||
|
||||
/* init to SLAVE REVEIVE and set slaveaddr */
|
||||
i2c->IICSTAT = 0;
|
||||
i2c->IICADD = slaveadd;
|
||||
/* program Master Transmit (and implicit STOP) */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
cmd_type is 0 for write 1 for read.
|
||||
|
||||
addr_len can take any value from 0-255, it is only limited
|
||||
by the char, we could make it larger if needed. If it is
|
||||
0 we skip the address write cycle.
|
||||
|
||||
*/
|
||||
* cmd_type is 0 for write, 1 for read.
|
||||
*
|
||||
* addr_len can take any value from 0-255, it is only limited
|
||||
* by the char, we could make it larger if needed. If it is
|
||||
* 0 we skip the address write cycle.
|
||||
*/
|
||||
static
|
||||
int i2c_transfer(unsigned char cmd_type,
|
||||
unsigned char chip,
|
||||
unsigned char addr[],
|
||||
unsigned char addr_len,
|
||||
unsigned char data[],
|
||||
unsigned short data_len)
|
||||
int i2c_transfer (unsigned char cmd_type,
|
||||
unsigned char chip,
|
||||
unsigned char addr[],
|
||||
unsigned char addr_len,
|
||||
unsigned char data[], unsigned short data_len)
|
||||
{
|
||||
S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
|
||||
int i, status, result;
|
||||
S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
|
||||
int i, status, result;
|
||||
|
||||
if (data == 0 || data_len == 0) {
|
||||
/*Don't support data transfer of no length or to address 0*/
|
||||
printf( "i2c_transfer: bad call\n" );
|
||||
return I2C_NOK;
|
||||
}
|
||||
if (data == 0 || data_len == 0) {
|
||||
/*Don't support data transfer of no length or to address 0 */
|
||||
printf ("i2c_transfer: bad call\n");
|
||||
return I2C_NOK;
|
||||
}
|
||||
|
||||
/*CheckDelay(); */
|
||||
|
||||
/* Check I2C bus idle */
|
||||
i = I2C_TIMEOUT * 1000;
|
||||
status = i2c->IICSTAT;
|
||||
while ((i > 0) && (status & I2CSTAT_BSY)) {
|
||||
udelay(1000);
|
||||
/* Check I2C bus idle */
|
||||
i = I2C_TIMEOUT * 1000;
|
||||
status = i2c->IICSTAT;
|
||||
i--;
|
||||
}
|
||||
while ((i > 0) && (status & I2CSTAT_BSY)) {
|
||||
udelay (1000);
|
||||
status = i2c->IICSTAT;
|
||||
i--;
|
||||
}
|
||||
|
||||
if (status & I2CSTAT_BSY)
|
||||
return I2C_NOK_TOUT;
|
||||
|
||||
if (status & I2CSTAT_BSY) {
|
||||
result = I2C_NOK_TOUT;
|
||||
return(result);
|
||||
}
|
||||
i2c->IICCON |= 0x80;
|
||||
result = I2C_OK;
|
||||
|
||||
i2c->IICCON |= 0x80;
|
||||
|
||||
result = I2C_OK;
|
||||
|
||||
switch (cmd_type) {
|
||||
switch (cmd_type) {
|
||||
case I2C_WRITE:
|
||||
if (addr && addr_len) {
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
|
||||
i = 0;
|
||||
while ((i < addr_len) && (result == I2C_OK)) {
|
||||
result = WaitForXfer();
|
||||
i2c->IICDS = addr[i];
|
||||
ReadWriteByte();
|
||||
i++;
|
||||
if (addr && addr_len) {
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
|
||||
i = 0;
|
||||
while ((i < addr_len) && (result == I2C_OK)) {
|
||||
result = WaitForXfer ();
|
||||
i2c->IICDS = addr[i];
|
||||
ReadWriteByte ();
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
result = WaitForXfer ();
|
||||
i2c->IICDS = data[i];
|
||||
ReadWriteByte ();
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
|
||||
i = 0;
|
||||
while ((i < data_len) && (result = I2C_OK)) {
|
||||
result = WaitForXfer ();
|
||||
i2c->IICDS = data[i];
|
||||
ReadWriteByte ();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
result = WaitForXfer();
|
||||
i2c->IICDS = data[i];
|
||||
ReadWriteByte();
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA | I2C_START_STOP;
|
||||
i = 0;
|
||||
while ((i < data_len) && (result = I2C_OK)) {
|
||||
result = WaitForXfer();
|
||||
i2c->IICDS = data[i];
|
||||
ReadWriteByte();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == I2C_OK)
|
||||
result = WaitForXfer();
|
||||
if (result == I2C_OK)
|
||||
result = WaitForXfer ();
|
||||
|
||||
/* send STOP */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
|
||||
ReadWriteByte();
|
||||
break;
|
||||
/* send STOP */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
|
||||
ReadWriteByte ();
|
||||
break;
|
||||
|
||||
case I2C_READ:
|
||||
if (addr && addr_len) {
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT |= I2C_START_STOP;
|
||||
result = WaitForXfer();
|
||||
if (IsACK()) {
|
||||
i = 0;
|
||||
while ((i < addr_len) && (result == I2C_OK)) {
|
||||
i2c->IICDS = addr[i];
|
||||
ReadWriteByte();
|
||||
result = WaitForXfer();
|
||||
i++;
|
||||
}
|
||||
if (addr && addr_len) {
|
||||
i2c->IICSTAT = I2C_MODE_MT | I2C_TXRX_ENA;
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT |= I2C_START_STOP;
|
||||
result = WaitForXfer ();
|
||||
if (IsACK ()) {
|
||||
i = 0;
|
||||
while ((i < addr_len) && (result == I2C_OK)) {
|
||||
i2c->IICDS = addr[i];
|
||||
ReadWriteByte ();
|
||||
result = WaitForXfer ();
|
||||
i++;
|
||||
}
|
||||
|
||||
i2c->IICDS = chip;
|
||||
/* resend START */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA |
|
||||
I2C_START_STOP;
|
||||
ReadWriteByte ();
|
||||
result = WaitForXfer ();
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
/* disable ACK for final READ */
|
||||
if (i == data_len - 1)
|
||||
i2c->IICCON &= ~0x80;
|
||||
ReadWriteByte ();
|
||||
result = WaitForXfer ();
|
||||
data[i] = i2c->IICDS;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
result = I2C_NACK;
|
||||
}
|
||||
|
||||
i2c->IICDS = chip;
|
||||
/* resend START */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA | I2C_START_STOP;
|
||||
ReadWriteByte();
|
||||
result = WaitForXfer();
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
/* disable ACK for final READ */
|
||||
if (i == data_len - 1)
|
||||
i2c->IICCON &= ~0x80;
|
||||
ReadWriteByte();
|
||||
result = WaitForXfer();
|
||||
data[i] = i2c->IICDS;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
result = I2C_NACK;
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT |= I2C_START_STOP;
|
||||
result = WaitForXfer ();
|
||||
|
||||
if (IsACK ()) {
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
/* disable ACK for final READ */
|
||||
if (i == data_len - 1)
|
||||
i2c->IICCON &= ~0x80;
|
||||
ReadWriteByte ();
|
||||
result = WaitForXfer ();
|
||||
data[i] = i2c->IICDS;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
result = I2C_NACK;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* send STOP */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
|
||||
i2c->IICDS = chip;
|
||||
/* send START */
|
||||
i2c->IICSTAT |= I2C_START_STOP;
|
||||
result = WaitForXfer();
|
||||
|
||||
if (IsACK()) {
|
||||
i = 0;
|
||||
while ((i < data_len) && (result == I2C_OK)) {
|
||||
/* disable ACK for final READ */
|
||||
if (i == data_len - 1)
|
||||
i2c->IICCON &= ~0x80;
|
||||
ReadWriteByte();
|
||||
result = WaitForXfer();
|
||||
data[i] = i2c->IICDS;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
result = I2C_NACK;
|
||||
}
|
||||
}
|
||||
|
||||
/* send STOP */
|
||||
i2c->IICSTAT = I2C_MODE_MR | I2C_TXRX_ENA;
|
||||
ReadWriteByte();
|
||||
break;
|
||||
ReadWriteByte ();
|
||||
break;
|
||||
|
||||
default:
|
||||
printf( "i2c_transfer: bad call\n" );
|
||||
result = I2C_NOK;
|
||||
break;
|
||||
}
|
||||
printf ("i2c_transfer: bad call\n");
|
||||
result = I2C_NOK;
|
||||
break;
|
||||
}
|
||||
|
||||
return (result);
|
||||
return (result);
|
||||
}
|
||||
|
||||
int i2c_probe (uchar chip)
|
||||
{
|
||||
uchar buf[1];
|
||||
uchar buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
buf[0] = 0;
|
||||
|
||||
/*
|
||||
* What is needed is to send the chip address and verify that the
|
||||
* address was <ACK>ed (i.e. there was a chip at that address which
|
||||
* drove the data line low).
|
||||
*/
|
||||
return(i2c_transfer (I2C_READ, chip << 1, 0, 0, buf, 1) != I2C_OK);
|
||||
/*
|
||||
* What is needed is to send the chip address and verify that the
|
||||
* address was <ACK>ed (i.e. there was a chip at that address which
|
||||
* drove the data line low).
|
||||
*/
|
||||
return (i2c_transfer (I2C_READ, chip << 1, 0, 0, buf, 1) != I2C_OK);
|
||||
}
|
||||
|
||||
int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
|
||||
{
|
||||
uchar xaddr[4];
|
||||
int ret;
|
||||
uchar xaddr[4];
|
||||
int ret;
|
||||
|
||||
if ( alen > 4 ) {
|
||||
printf ("I2C read: addr len %d not supported\n", alen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( alen > 0 ) {
|
||||
xaddr[0] = (addr >> 24) & 0xFF;
|
||||
xaddr[1] = (addr >> 16) & 0xFF;
|
||||
xaddr[2] = (addr >> 8) & 0xFF;
|
||||
xaddr[3] = addr & 0xFF;
|
||||
}
|
||||
if (alen > 4) {
|
||||
printf ("I2C read: addr len %d not supported\n", alen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (alen > 0) {
|
||||
xaddr[0] = (addr >> 24) & 0xFF;
|
||||
xaddr[1] = (addr >> 16) & 0xFF;
|
||||
xaddr[2] = (addr >> 8) & 0xFF;
|
||||
xaddr[3] = addr & 0xFF;
|
||||
}
|
||||
|
||||
#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
|
||||
/*
|
||||
* EEPROM chips that implement "address overflow" are ones
|
||||
* like Catalyst 24WC04/08/16 which has 9/10/11 bits of
|
||||
* address and the extra bits end up in the "chip address"
|
||||
* bit slots. This makes a 24WC08 (1Kbyte) chip look like
|
||||
* four 256 byte chips.
|
||||
*
|
||||
* Note that we consider the length of the address field to
|
||||
* still be one byte because the extra address bits are
|
||||
* hidden in the chip address.
|
||||
*/
|
||||
if( alen > 0 )
|
||||
chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
|
||||
/*
|
||||
* EEPROM chips that implement "address overflow" are ones
|
||||
* like Catalyst 24WC04/08/16 which has 9/10/11 bits of
|
||||
* address and the extra bits end up in the "chip address"
|
||||
* bit slots. This makes a 24WC08 (1Kbyte) chip look like
|
||||
* four 256 byte chips.
|
||||
*
|
||||
* Note that we consider the length of the address field to
|
||||
* still be one byte because the extra address bits are
|
||||
* hidden in the chip address.
|
||||
*/
|
||||
if (alen > 0)
|
||||
chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
|
||||
#endif
|
||||
if( (ret = i2c_transfer(I2C_READ, chip<<1, &xaddr[4-alen], alen, buffer, len )) != 0) {
|
||||
printf( "I2c read: failed %d\n", ret);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
if ((ret =
|
||||
i2c_transfer (I2C_READ, chip << 1, &xaddr[4 - alen], alen,
|
||||
buffer, len)) != 0) {
|
||||
printf ("I2c read: failed %d\n", ret);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
|
||||
{
|
||||
uchar xaddr[4];
|
||||
uchar xaddr[4];
|
||||
|
||||
if ( alen > 4 ) {
|
||||
printf ("I2C write: addr len %d not supported\n", alen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( alen > 0 ) {
|
||||
xaddr[0] = (addr >> 24) & 0xFF;
|
||||
xaddr[1] = (addr >> 16) & 0xFF;
|
||||
xaddr[2] = (addr >> 8) & 0xFF;
|
||||
xaddr[3] = addr & 0xFF;
|
||||
}
|
||||
if (alen > 4) {
|
||||
printf ("I2C write: addr len %d not supported\n", alen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (alen > 0) {
|
||||
xaddr[0] = (addr >> 24) & 0xFF;
|
||||
xaddr[1] = (addr >> 16) & 0xFF;
|
||||
xaddr[2] = (addr >> 8) & 0xFF;
|
||||
xaddr[3] = addr & 0xFF;
|
||||
}
|
||||
#ifdef CFG_I2C_EEPROM_ADDR_OVERFLOW
|
||||
/*
|
||||
* EEPROM chips that implement "address overflow" are ones
|
||||
* like Catalyst 24WC04/08/16 which has 9/10/11 bits of
|
||||
* address and the extra bits end up in the "chip address"
|
||||
* bit slots. This makes a 24WC08 (1Kbyte) chip look like
|
||||
* four 256 byte chips.
|
||||
*
|
||||
* Note that we consider the length of the address field to
|
||||
* still be one byte because the extra address bits are
|
||||
* hidden in the chip address.
|
||||
*/
|
||||
if( alen > 0 )
|
||||
chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
|
||||
/*
|
||||
* EEPROM chips that implement "address overflow" are ones
|
||||
* like Catalyst 24WC04/08/16 which has 9/10/11 bits of
|
||||
* address and the extra bits end up in the "chip address"
|
||||
* bit slots. This makes a 24WC08 (1Kbyte) chip look like
|
||||
* four 256 byte chips.
|
||||
*
|
||||
* Note that we consider the length of the address field to
|
||||
* still be one byte because the extra address bits are
|
||||
* hidden in the chip address.
|
||||
*/
|
||||
if (alen > 0)
|
||||
chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
|
||||
#endif
|
||||
return (i2c_transfer(I2C_WRITE, chip<<1, &xaddr[4-alen], alen, buffer, len ) != 0);
|
||||
return (i2c_transfer
|
||||
(I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer,
|
||||
len) != 0);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HARD_I2C */
|
||||
|
||||
#endif /* CONFIG_DRIVER_S3C24X0_I2C */
|
||||
@@ -37,6 +37,10 @@ ifeq ($(ARCH),mips)
|
||||
LOAD_ADDR = 0x80200000 -T mips.lds
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),nios)
|
||||
LOAD_ADDR = 0x01000000 -L $(gcclibdir)/m32 -T nios.lds
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
SREC = hello_world.srec
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
OUTPUT_FORMAT("elf32-nios")
|
||||
OUTPUT_ARCH(nios)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
__text_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
__rodata_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__data_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
. = ALIGN(4);
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__bss_end = .;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,23 @@ gd_t *global_data;
|
||||
" lw $25, %1($25)\n" \
|
||||
" jr $25\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
|
||||
#elif defined(CONFIG_NIOS)
|
||||
/*
|
||||
* %g7 holds the pointer to the global_data. %g0 is call clobbered.
|
||||
*/
|
||||
#define EXPORT_FUNC(x) \
|
||||
asm volatile ( \
|
||||
" .globl " #x "\n" \
|
||||
#x ":\n" \
|
||||
" pfx %%hi(%0)\n" \
|
||||
" movi %%g0, %%lo(%0)\n" \
|
||||
" add %%g0, %%g7\n" \
|
||||
" ld %%g0, [%%g0]\n" \
|
||||
" pfx %1\n" \
|
||||
" ld %%g0, [%%g0]\n" \
|
||||
" jmp %%g0\n" \
|
||||
" nop \n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
|
||||
#else
|
||||
#error stubs definition missing for this architecture
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_FAT)
|
||||
|
||||
#ifdef CONFIG_AUTO_UPDATE
|
||||
/* the VFAT code has a bug which breaks auto update */
|
||||
#undef CONFIG_SUPPORT_VFAT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert a string to lowercase.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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_NIOS_BITOPS_H_
|
||||
#define _ASM_NIOS_BITOPS_H_
|
||||
|
||||
|
||||
extern void set_bit(int nr, volatile void * a);
|
||||
extern void clear_bit(int nr, volatile void * a);
|
||||
extern int test_and_clear_bit(int nr, volatile void * a);
|
||||
extern void change_bit(unsigned long nr, volatile void *addr);
|
||||
extern int test_and_set_bit(int nr, volatile void * a);
|
||||
extern int test_and_change_bit(int nr, volatile void * addr);
|
||||
extern int test_bit(int nr, volatile void * a);
|
||||
extern int ffs(int i);
|
||||
|
||||
#endif /* _ASM_NIOS_BITOPS_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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_NIOS_BYTEORDER_H
|
||||
#define __ASM_NIOS_BYTEORDER_H
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.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_NIOS_GLOBALDATA_H
|
||||
#define __ASM_NIOS_GLOBALDATA_H
|
||||
|
||||
typedef struct global_data {
|
||||
bd_t *bd;
|
||||
unsigned long flags;
|
||||
unsigned long baudrate;
|
||||
unsigned long cpu_clk; /* CPU clock in Hz! */
|
||||
unsigned long have_console; /* serial_init() was called */
|
||||
unsigned long ram_size; /* RAM size */
|
||||
unsigned long reloc_off; /* Relocation Offset */
|
||||
unsigned long env_addr; /* Address of Environment struct */
|
||||
unsigned long env_valid; /* Checksum of Environment valid */
|
||||
void **jt; /* Standalone app jump table */
|
||||
} gd_t;
|
||||
|
||||
/* flags */
|
||||
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
|
||||
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7")
|
||||
|
||||
#endif /* __ASM_NIOS_GLOBALDATA_H */
|
||||
@@ -0,0 +1 @@
|
||||
/*FIXME: Implement this! */
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef __ASM_NIOS_POSIX_TYPES_H
|
||||
#define __ASM_NIOS_POSIX_TYPES_H
|
||||
|
||||
/*
|
||||
* This file is generally used by user-level software, so you need to
|
||||
* be a little careful about namespace pollution etc. Also, we cannot
|
||||
* assume GCC is being used.
|
||||
*/
|
||||
|
||||
typedef unsigned short __kernel_dev_t;
|
||||
typedef unsigned long __kernel_ino_t;
|
||||
typedef unsigned short __kernel_mode_t;
|
||||
typedef unsigned short __kernel_nlink_t;
|
||||
typedef long __kernel_off_t;
|
||||
typedef int __kernel_pid_t;
|
||||
typedef unsigned short __kernel_ipc_pid_t;
|
||||
typedef unsigned short __kernel_uid_t;
|
||||
typedef unsigned short __kernel_gid_t;
|
||||
typedef unsigned long __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;
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef long long __kernel_loff_t;
|
||||
#endif
|
||||
|
||||
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(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
|
||||
|
||||
#undef __FD_CLR
|
||||
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
|
||||
|
||||
#undef __FD_ISSET
|
||||
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
|
||||
|
||||
#undef __FD_ZERO
|
||||
#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
|
||||
|
||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
|
||||
|
||||
#endif
|
||||
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user