Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42dfe7a184 | ||
|
|
855a496fe9 | ||
|
|
4b248f3f71 | ||
|
|
aaf224ab4e | ||
|
|
3d3befa754 | ||
|
|
4d13cbad1c | ||
|
|
c3f9d4939a | ||
|
|
0e6d798cb3 | ||
|
|
c40b295682 | ||
|
|
6629d2f22b | ||
|
|
bdda519d3c |
No files matched your search
@@ -2,6 +2,122 @@
|
||||
Changes for U-Boot 1.0.2:
|
||||
======================================================================
|
||||
|
||||
* Patches by Travis Sawyer, 12 Mar 2004:
|
||||
- Fix Gigabit Ethernet support for 440GX
|
||||
- Add Gigabit Ethernet Support to MII PHY utilities
|
||||
|
||||
* Patch by Brad Kemp, 12 Mar 2004:
|
||||
Fixes for drivers/cfi_flash.c:
|
||||
- Better support for x8/x16 implementations
|
||||
- Added failure for AMD chips attempting to use CFG_FLASH_USE_BUFFER_WRITE
|
||||
- Added defines for AMD command and address constants
|
||||
|
||||
* Patch by Leon Kukovec, 12 Mar 2004:
|
||||
Fix get_dentfromdir() to correctly handle deleted dentries
|
||||
|
||||
* Patch by George G. Davis, 11 Mar 2004:
|
||||
Remove hard coded network settings in TI OMAP1610 H2
|
||||
default board config
|
||||
|
||||
* Patch by George G. Davis, 11 Mar 2004:
|
||||
add support for ADS GraphicsClient+ board.
|
||||
|
||||
* Patch by Pierre Aubert, 11 Mar 2004:
|
||||
- add bitmap command and splash screen support in cfb console
|
||||
- add [optional] origin in the bitmap display command
|
||||
|
||||
* Patch by Travis Sawyer, 11 Mar 2004:
|
||||
Fix ocotea board early init interrupt setup.
|
||||
|
||||
* Patch by Thomas Viehweger, 11 Mar 2004:
|
||||
Remove redundand code; add PCI-specific bits to include/mpc8260.h
|
||||
|
||||
* Patch by Stephan Linz, 09 Mar 2004
|
||||
- Add support for the SSV ADNP/ESC1 (Nios Softcore)
|
||||
|
||||
* Patch by George G. Davis, 9 Mar 2004:
|
||||
fix recent build failure for SA1100 target
|
||||
|
||||
* Patch by Travis Sawyer, 09 Mar 2004:
|
||||
Support native interrupt mode for the IBM440GX.
|
||||
Previously it was running in 440GP compatibility mode.
|
||||
|
||||
* Patch by Philippe Robin, 09 Mar 2004:
|
||||
Added ARM Integrator AP, CP and Versatile PB926EJ-S Reference
|
||||
Platform support.
|
||||
|
||||
* Patch by Masami Komiya, 08 Mar 2004:
|
||||
Don't overwrite server IP address or boot file name
|
||||
when the boot server does not return values
|
||||
|
||||
* Patch by listmember@orkun.us, 5 Mar 2004:
|
||||
Removed compile time restriction on CFG_I2C_SPEED for DS1338 RTC
|
||||
|
||||
* Patch by Tolunay Orkun, 5 Mar 2004:
|
||||
Fix early board initialization for Cogent CSB272 board
|
||||
|
||||
* Patch by Ed Okerson, 3 Mar 2004:
|
||||
fix CFI flash writes for little endian systems
|
||||
|
||||
* Patch by Reinhard Meyer, 01 Mar 2004:
|
||||
generalize USB and IDE support for MPC5200 with according
|
||||
changes to IceCube.h and TOP5200.h
|
||||
add Am29LV256 256 MBit FLASH support for TOP5200 boards
|
||||
add info about USB and IDE to README
|
||||
|
||||
* Patch by Yuli Barcohen, 4 Mar 2004:
|
||||
Fix problems with GCC 3.3.x which changed handling of global
|
||||
variables explicitly initialized to zero (now in .bss instead of
|
||||
.data as before).
|
||||
|
||||
* Patch by Leon Kukovec, 02 Mar 2004:
|
||||
add strswab() to fix IDE LBA capacity, firmware and model numbers
|
||||
on little endian machines
|
||||
|
||||
* Patch by Masami Komiya, 02 Mar 2004:
|
||||
- Remove get_ticks() from NFS code
|
||||
- Add verification of RPC transaction ID
|
||||
|
||||
* Patch by Pierre Aubert, 02 Mar 2004:
|
||||
cleanup for IDE and USB drivers for MPC5200
|
||||
|
||||
* Patch by Travis Sawyer, 01 Mar 2004:
|
||||
Ocotea:
|
||||
- Add IBM PPC440GX Ref Platform support (Ocotea)
|
||||
Original code by Paul Reynolds <PaulReynolds@lhsolutions.com>
|
||||
Adapted to U-Boot and 440GX port
|
||||
440gx_enet.c:
|
||||
- Add gracious handling of all Ethernet Pin Selections for 440GX
|
||||
- Add RGMII selection for Cicada CIS8201 Gigabit PHY
|
||||
ppc440.h:
|
||||
- Add needed bit definitions
|
||||
- Fix formatting
|
||||
|
||||
* Patch by Carl Riechers, 1 Mar 2004:
|
||||
Add PPC440GX prbdv0 divider to fix memory clock calculation.
|
||||
|
||||
* Patch by Stephan Linz, 27 Feb 2004
|
||||
- avoid problems for targets without NFS download support
|
||||
|
||||
* Patch by Rune Torgersen, 27 Feb 2004:
|
||||
- Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
|
||||
- Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
|
||||
- Added support for 64bit strtoul (CFG_64BIT_STRTOUL)
|
||||
|
||||
* Patch by Masami Komiya, 27 Feb 2004:
|
||||
Fix rarpboot: add autoload by NFS
|
||||
|
||||
* Patch by Dan Eisenhut, 26 Feb 2004:
|
||||
fix flash_write return value in saveenv
|
||||
|
||||
* Patch by Stephan Linz, 11 Dec 2003
|
||||
expand config.mk to avoid trigraph warnings on NIOS
|
||||
|
||||
* Rename "BMS2003" board into "HMI10"
|
||||
|
||||
* SX1 patches: use "serial#" for USB serial #; use redundand environment
|
||||
storage; auto-set console on USB port (using preboot command)
|
||||
|
||||
* Add support for SX1 mobile phone; add support for USB-based console
|
||||
(enable with "setenv stdout usbtty; setenv stdin usbtty")
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ W: http://www.leox.org
|
||||
N: Stephan Linz
|
||||
E: linz@li-pro.net
|
||||
D: Support for Nios Stratix Development Kit (DK-1S10)
|
||||
D: Support for SSV ADNP/ESC1 (Nios Cyclone)
|
||||
W: http://www.li-pro.net
|
||||
|
||||
N: Raymond Lo
|
||||
|
||||
@@ -381,6 +381,7 @@ Thomas Lange <thomas@corelatus.se>
|
||||
Stephan Linz <linz@li-pro.net>
|
||||
|
||||
DK1S10 Nios-32
|
||||
ADNPESC1 Nios-32
|
||||
|
||||
Scott McNutt <smcnutt@psyent.com>
|
||||
|
||||
|
||||
@@ -61,10 +61,10 @@ LIST_4xx=" \
|
||||
CPCI440 CPCIISER4 CRAYL1 csb272 \
|
||||
DASA_SIM DP405 DU405 EBONY \
|
||||
ERIC EXBITGEN HUB405 MIP405 \
|
||||
MIP405T ML2 ml300 OCRTC \
|
||||
ORSG PCI405 PIP405 PLU405 \
|
||||
PMC405 PPChameleonEVB VOH405 W7OLMC \
|
||||
W7OLMG WALNUT405 XPEDITE1K \
|
||||
MIP405T ML2 ml300 OCOTEA \
|
||||
OCRTC ORSG PCI405 PIP405 \
|
||||
PLU405 PMC405 PPChameleonEVB VOH405 \
|
||||
W7OLMC W7OLMG WALNUT405 XPEDITE1K \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -122,7 +122,7 @@ LIST_ppc="${LIST_5xx} ${LIST_5xxx} \
|
||||
## StrongARM Systems
|
||||
#########################################################################
|
||||
|
||||
LIST_SA="dnp1110 lart shannon"
|
||||
LIST_SA="dnp1110 gcplus lart shannon"
|
||||
|
||||
#########################################################################
|
||||
## ARM7 Systems
|
||||
@@ -135,9 +135,10 @@ LIST_ARM7="B2 ep7312 impa7"
|
||||
#########################################################################
|
||||
|
||||
LIST_ARM9=" \
|
||||
at91rm9200dk omap1510inn omap1610h2 omap1610inn \
|
||||
at91rm9200dk integratorcp integratorap \
|
||||
omap1510inn omap1610h2 omap1610inn \
|
||||
smdk2400 smdk2410 trab \
|
||||
VCMA9 \
|
||||
VCMA9 versatile \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -176,6 +177,8 @@ LIST_x86="${LIST_I486}"
|
||||
#########################################################################
|
||||
|
||||
LIST_nios=" \
|
||||
ADNPESC1 ADNPESC1_base_32 \
|
||||
ADNPESC1_DNPEVA2_base_32 \
|
||||
DK1C20 DK1C20_standard_32 \
|
||||
DK1S10 DK1S10_standard_32 DK1S10_mtx_ldk_20 \
|
||||
"
|
||||
|
||||
@@ -111,7 +111,8 @@ LIBS += common/libcommon.a
|
||||
.PHONY : $(LIBS)
|
||||
|
||||
# Add GCC lib
|
||||
PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||
PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||
|
||||
|
||||
# The "tools" are needed early, so put this first
|
||||
# Don't include stuff already done in $(LIBS)
|
||||
@@ -261,9 +262,6 @@ FADS860T_config: unconfig
|
||||
AMX860_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx amx860 westel
|
||||
|
||||
bms2003_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
|
||||
|
||||
c2mon_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx c2mon
|
||||
|
||||
@@ -305,6 +303,9 @@ GTH_config: unconfig
|
||||
hermes_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx hermes
|
||||
|
||||
HMI10_config : unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
|
||||
|
||||
IAD210_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc8xx IAD210 siemens
|
||||
|
||||
@@ -597,6 +598,9 @@ ML2_config:unconfig
|
||||
ml300_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ml300 xilinx
|
||||
|
||||
OCOTEA_config:unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocotea
|
||||
|
||||
OCRTC_config \
|
||||
ORSG_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc ppc4xx ocrtc esd
|
||||
@@ -904,12 +908,15 @@ ZUMA_config: unconfig
|
||||
at91rm9200dk_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm at91rm9200 at91rm9200dk
|
||||
|
||||
lart_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 lart
|
||||
|
||||
dnp1110_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 dnp1110
|
||||
|
||||
gcplus_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 gcplus
|
||||
|
||||
lart_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 lart
|
||||
|
||||
shannon_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm sa1100 shannon
|
||||
|
||||
@@ -924,6 +931,15 @@ xtract_omap1610xxx = $(subst _cs0boot,,$(subst _cs3boot,, $(subst _config,,$1)))
|
||||
SX1_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm925t sx1
|
||||
|
||||
integratorcp_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs integratorcp
|
||||
|
||||
integratorap_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs integratorap
|
||||
|
||||
versatile_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm926ejs versatile
|
||||
|
||||
omap1510inn_config : unconfig
|
||||
@./mkconfig $(@:_config=) arm arm925t omap1510inn
|
||||
|
||||
@@ -1123,6 +1139,24 @@ DK1S10_config: unconfig
|
||||
}
|
||||
@./mkconfig -a DK1S10 nios nios dk1s10 altera
|
||||
|
||||
ADNPESC1_DNPEVA2_base_32_config \
|
||||
ADNPESC1_base_32_config \
|
||||
ADNPESC1_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring _DNPEVA2,$@)" ] || \
|
||||
{ echo "#define CONFIG_DNPEVA2 1" >>include/config.h ; \
|
||||
echo "... DNP/EVA2 configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring _base_32,$@)" ] || \
|
||||
{ echo "#define CONFIG_NIOS_BASE_32 1" >>include/config.h ; \
|
||||
echo "... NIOS 'base_32' configuration" ; \
|
||||
}
|
||||
@[ -z "$(findstring ADNPESC1_config,$@)" ] || \
|
||||
{ echo "#define CONFIG_NIOS_BASE_32 1" >>include/config.h ; \
|
||||
echo "... NIOS 'base_32' configuration (DEFAULT)" ; \
|
||||
}
|
||||
@./mkconfig -a ADNPESC1 nios nios adnpesc1 ssv
|
||||
|
||||
|
||||
#########################################################################
|
||||
## MIPS32 AU1X00
|
||||
|
||||
@@ -660,16 +660,31 @@ The following options need to be configured:
|
||||
one partition type as well.
|
||||
|
||||
- IDE Reset method:
|
||||
CONFIG_IDE_RESET_ROUTINE
|
||||
CONFIG_IDE_RESET_ROUTINE - this is defined in several
|
||||
board configurations files but used nowhere!
|
||||
|
||||
Set this to define that instead of a reset Pin, the
|
||||
routine ide_set_reset(int idereset) will be used.
|
||||
CONFIG_IDE_RESET - is this is defined, IDE Reset will
|
||||
be performed by calling the function
|
||||
ide_set_reset(int reset)
|
||||
which has to be defined in a board specific file
|
||||
|
||||
- ATAPI Support:
|
||||
CONFIG_ATAPI
|
||||
|
||||
Set this to enable ATAPI support.
|
||||
|
||||
- LBA48 Support
|
||||
CONFIG_LBA48
|
||||
|
||||
Set this to enable support for disks larger than 137GB
|
||||
Also look at CFG_64BIT_LBA ,CFG_64BIT_VSPRINTF and CFG_64BIT_STRTOUL
|
||||
Whithout these , LBA48 support uses 32bit variables and will 'only'
|
||||
support disks up to 2.1TB.
|
||||
|
||||
CFG_64BIT_LBA:
|
||||
When enabled, makes the IDE subsystem use 64bit sector addresses.
|
||||
Default is 32bit.
|
||||
|
||||
- SCSI Support:
|
||||
At the moment only there is only support for the
|
||||
SYM53C8XX SCSI controller; define
|
||||
@@ -716,7 +731,7 @@ The following options need to be configured:
|
||||
|
||||
- USB Support:
|
||||
At the moment only the UHCI host controller is
|
||||
supported (PIP405, MIP405); define
|
||||
supported (PIP405, MIP405, MPC5200); define
|
||||
CONFIG_USB_UHCI to enable it.
|
||||
define CONFIG_USB_KEYBOARD to enable the USB Keyboard
|
||||
end define CONFIG_USB_STORAGE to enable the USB
|
||||
@@ -724,6 +739,13 @@ The following options need to be configured:
|
||||
Note:
|
||||
Supported are USB Keyboards and USB Floppy drives
|
||||
(TEAC FD-05PUB).
|
||||
MPC5200 USB requires additional defines:
|
||||
CONFIG_USB_CLOCK
|
||||
for 528 MHz Clock: 0x0001bbbb
|
||||
CONFIG_USB_CONFIG
|
||||
for differential drivers: 0x00001000
|
||||
for single ended drivers: 0x00005000
|
||||
|
||||
|
||||
- MMC Support:
|
||||
The MMC controller on the Intel PXA is supported. To
|
||||
@@ -1713,6 +1735,13 @@ use the "saveenv" command to store a valid environment.
|
||||
- CFG_FAULT_MII_ADDR:
|
||||
MII address of the PHY to check for the Ethernet link state.
|
||||
|
||||
- CFG_64BIT_VSPRINTF:
|
||||
Makes vsprintf (and all *printf functions) support printing
|
||||
of 64bit values by using the L quantifier
|
||||
|
||||
- CFG_64BIT_STRTOUL:
|
||||
Adds simple_strtoull that returns a 64bit value
|
||||
|
||||
Low Level (hardware related) configuration options:
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ int misc_init_f (void)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
#if CONFIG_CMA111
|
||||
#ifdef CONFIG_CMA111
|
||||
return (32L * 1024L * 1024L);
|
||||
#else
|
||||
unsigned char dipsw_val;
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <asm/u-boot.h>
|
||||
#include <asm/processor.h>
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <i2c.h>
|
||||
#include <miiphy.h>
|
||||
#include <405gp_enet.h>
|
||||
@@ -57,10 +56,10 @@ int pll_init(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* board_pre_init: do any preliminary board initialization
|
||||
* board_early_init_f: do early board initialization
|
||||
*
|
||||
*/
|
||||
int board_pre_init(void)
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
/* initialize PLL so UART, LCD, Ethernet clocked at correctly */
|
||||
(void) get_clocks();
|
||||
|
||||
@@ -45,9 +45,6 @@ unsigned long flash_init (void)
|
||||
#else
|
||||
unsigned long size_b0;
|
||||
int i;
|
||||
uint pbcr;
|
||||
unsigned long base_b0;
|
||||
int size_val = 0;
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
|
||||
@@ -51,7 +51,7 @@ SECTIONS
|
||||
armboot_end_data = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
|
||||
armboot_end = .;
|
||||
_end = .;
|
||||
}
|
||||
+81
-15
@@ -40,9 +40,11 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
#define FLASH_CYCLE2 0x02aa
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 1
|
||||
#define FLASH_ID3 0x0e
|
||||
#define FLASH_ID4 0x0F
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_TOP5200)
|
||||
#if defined (CONFIG_TOP5200) && !defined (CONFIG_LITE5200)
|
||||
typedef unsigned char FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned char FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFF
|
||||
@@ -54,6 +56,24 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
#define FLASH_CYCLE2 0x0555
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 2
|
||||
#define FLASH_ID3 0x1c
|
||||
#define FLASH_ID4 0x1E
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_TOP5200) && defined (CONFIG_LITE5200)
|
||||
typedef unsigned char FLASH_PORT_WIDTH;
|
||||
typedef volatile unsigned char FLASH_PORT_WIDTHV;
|
||||
#define FLASH_ID_MASK 0xFF
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define FLASH_CYCLE1 0x0555
|
||||
#define FLASH_CYCLE2 0x02aa
|
||||
#define FLASH_ID1 0
|
||||
#define FLASH_ID2 1
|
||||
#define FLASH_ID3 0x0E
|
||||
#define FLASH_ID4 0x0F
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
@@ -183,6 +203,15 @@ void flash_print_info (flash_info_t *info)
|
||||
case FLASH_AM160B:
|
||||
fmt = "29LV160%s (16 Mbit, %s)\n";
|
||||
break;
|
||||
case FLASH_AMLV640U:
|
||||
fmt = "29LV640M (64 Mbit)\n";
|
||||
break;
|
||||
case FLASH_AMDLV065D:
|
||||
fmt = "29LV065D (64 Mbit)\n";
|
||||
break;
|
||||
case FLASH_AMLV256U:
|
||||
fmt = "29LV256M (256 Mbit)\n";
|
||||
break;
|
||||
default:
|
||||
fmt = "Unknown Chip Type\n";
|
||||
break;
|
||||
@@ -239,7 +268,6 @@ void flash_print_info (flash_info_t *info)
|
||||
ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
ulong offset;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
/* Write auto select command sequence and test FLASH answer */
|
||||
@@ -278,27 +306,64 @@ ulong flash_get_size (FPWV *addr, flash_info_t *info)
|
||||
info->flash_id += FLASH_AM160B;
|
||||
info->sector_count = 35;
|
||||
info->size = 0x00200000;
|
||||
#ifdef CFG_LOWBOOT
|
||||
offset = 0;
|
||||
#else
|
||||
offset = 0x00e00000;
|
||||
#endif
|
||||
info->start[0] = (ulong)addr + offset;
|
||||
info->start[1] = (ulong)addr + offset + 0x4000;
|
||||
info->start[2] = (ulong)addr + offset + 0x6000;
|
||||
info->start[3] = (ulong)addr + offset + 0x8000;
|
||||
info->start[0] = (ulong)addr;
|
||||
info->start[1] = (ulong)addr + 0x4000;
|
||||
info->start[2] = (ulong)addr + 0x6000;
|
||||
info->start[3] = (ulong)addr + 0x8000;
|
||||
for (i = 4; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + offset + 0x10000 * (i-3);
|
||||
info->start[i] = (ulong)addr + 0x10000 * (i-3);
|
||||
}
|
||||
break;
|
||||
|
||||
case (FPW)AMD_ID_LV065D:
|
||||
info->flash_id += FLASH_AMDLV065D;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x00800000;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
|
||||
case (FPW)AMD_ID_MIRROR:
|
||||
/* MIRROR BIT FLASH, read more ID bytes */
|
||||
if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV640U_2 &&
|
||||
(FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV640U_3)
|
||||
{
|
||||
info->flash_id += FLASH_AMLV640U;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x00800000;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ((FPW)addr[FLASH_ID3] == (FPW)AMD_ID_LV256U_2 &&
|
||||
(FPW)addr[FLASH_ID4] == (FPW)AMD_ID_LV256U_3)
|
||||
{
|
||||
/* attention: only the first 16 MB will be used in u-boot */
|
||||
info->flash_id += FLASH_AMLV256U;
|
||||
info->sector_count = 256;
|
||||
info->size = 0x01000000;
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
{
|
||||
info->start[i] = (ulong)addr + 0x10000 * i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* fall thru to here ! */
|
||||
default:
|
||||
printf ("unknown AMD device=%x ", (FPW)addr[FLASH_ID2]);
|
||||
printf ("unknown AMD device=%x %x %x",
|
||||
(FPW)addr[FLASH_ID2],
|
||||
(FPW)addr[FLASH_ID3],
|
||||
(FPW)addr[FLASH_ID4]);
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* => no or unknown flash */
|
||||
info->size = 0x800000;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Put FLASH back in read mode */
|
||||
@@ -329,6 +394,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM160B:
|
||||
case FLASH_AMLV640U:
|
||||
break;
|
||||
case FLASH_UNKNOWN:
|
||||
default:
|
||||
|
||||
@@ -57,7 +57,7 @@ long int initdram (int board_type)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = CFG_DRAM_CONTROL | MODE_EN;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = CFG_DRAM_CONTROL | MODE_EN | SOFT_PRE;
|
||||
#if CFG_DRAM_DDR
|
||||
#ifdef CFG_DRAM_DDR
|
||||
/* set extended mode register */
|
||||
*(vu_short *)MPC5XXX_SDRAM_MODE = CFG_DRAM_EMODE;
|
||||
#endif
|
||||
@@ -113,11 +113,15 @@ int checkboard (void)
|
||||
#if defined (CONFIG_EVAL5200)
|
||||
puts ("Board: EMK TOP5200 on EVAL5200\n");
|
||||
#else
|
||||
#if defined (CONFIG_LITE5200)
|
||||
puts ("Board: LITE5200\n");
|
||||
#else
|
||||
#if defined (CONFIG_MINI5200)
|
||||
puts ("Board: EMK TOP5200 on MINI5200\n");
|
||||
#else
|
||||
puts ("Board: EMK TOP5200\n");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -155,10 +159,11 @@ void flash_afterinit(uint bank, ulong start, ulong size)
|
||||
*****************************************************************************/
|
||||
int misc_init_r (void)
|
||||
{
|
||||
#if !defined (CONFIG_LITE5200)
|
||||
/* read 'factory' part of EEPROM */
|
||||
extern void read_factory_r (void);
|
||||
read_factory_r ();
|
||||
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -175,3 +180,23 @@ void pci_init_board(void)
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* provide the PCI Reset Function
|
||||
*****************************************************************************/
|
||||
#ifdef CFG_CMD_IDE
|
||||
#define GPIO_PSC1_4 0x01000000ul
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
/* (it does not matter we do this every time) */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# 2003 (c) MontaVista Software, Inc.
|
||||
#
|
||||
# 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 := gcplus.o flash.o
|
||||
SOBJS := memsetup.o
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS) $(SOBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# ADS GCPlus board with SA1110 cpu
|
||||
#
|
||||
# The ADS GCPlus has 2 banks of 16 MiB SDRAM
|
||||
#
|
||||
# We use the ADS GCPlus Linux boot ROM to load U-Boot into SDRAM
|
||||
# at c020'0000 and then move ourself to c8f0'0000. Basically, just
|
||||
# install the U-Boot binary as you would the Linux zImage and then
|
||||
# reap the benfits of more convenient Linux development cycles, i.e.
|
||||
# bootp;tftp;bootm, repeat, etc.,.
|
||||
#
|
||||
|
||||
TEXT_BASE = 0xc8f00000
|
||||
@@ -0,0 +1,440 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* 2003 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* 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 <linux/byteorder/swab.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#define FLASH_PORT_WIDTH32
|
||||
#undef FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(FPW * addr, flash_info_t * info);
|
||||
static int write_data(flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets(ulong base, flash_info_t * info);
|
||||
void inline spin_wheel(void);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long
|
||||
flash_init(void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets(PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
flash_get_offsets(ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
flash_print_info(flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F128J3A:
|
||||
printf("28F128J3A\n");
|
||||
break;
|
||||
case FLASH_28F640J5:
|
||||
printf("28F640J5\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf(" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
printf(" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong
|
||||
flash_get_size(FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
case (FPW) INTEL_ID_28F128J3A:
|
||||
info->flash_id += FLASH_28F128J3A;
|
||||
info->sector_count = 128;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 16 MB */
|
||||
case (FPW) INTEL_ID_28F640J5:
|
||||
info->flash_id += FLASH_28F640J5;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x01000000;
|
||||
break; /* => 16 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
flash_erase(flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, last;
|
||||
int rcode = 0;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("- missing\n");
|
||||
} else {
|
||||
printf("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
printf("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf("Erasing sector %2d ... ", sect);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
*addr = (FPW) 0x00200020; /* erase setup */
|
||||
*addr = (FPW) 0x00D000D0; /* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked() > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
*addr = (FPW) 0x00B000B0; /* suspend erase */
|
||||
*addr = (FPW) 0x00FF00FF; /* reset to read mode */
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register cmd. */
|
||||
*addr = (FPW) 0x00FF00FF; /* resest to read mode */
|
||||
|
||||
printf(" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int
|
||||
write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data(info, wp, SWAP(data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data(info, wp, SWAP(data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data(info, wp, SWAP(data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int
|
||||
write_data(flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf("not erased at %08lX (%lX)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked() > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline
|
||||
spin_wheel(void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* 2003-2004 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* 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 <SA-1100.h>
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Miscelaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int
|
||||
board_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_arch_number = 29; /* ADS GraphicsClientPlus Board */
|
||||
|
||||
gd->bd->bi_boot_params = 0xc000003c; /* Weird address? */
|
||||
|
||||
/* Most of the ADS GCPlus I/O is connected to Static nCS2.
|
||||
* So I'm brute forcing nCS2 timiming here for worst case.
|
||||
*/
|
||||
MSC1 &= ~0xFFFF;
|
||||
MSC1 |= 0x8649;
|
||||
|
||||
/* Nothing is connected to Static nCS4 or nCS5. But I'm using
|
||||
* nCS4 as a paranoia safe guard to force nCS2, nOE; nWE high
|
||||
* after accessing I/O via (non-VLIO) nCS2. What can I say, I'm
|
||||
* paranoid and lack decent tools to alleviate my fear. I sure
|
||||
* do wish I had a logic analyzer. : (
|
||||
*/
|
||||
|
||||
MSC2 = 0xfff9fff9;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dram_init(void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
|
||||
gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Memory Setup stuff - taken from blob memsetup.S
|
||||
*
|
||||
* Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
|
||||
* Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
|
||||
* 2003-2004 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
.globl memsetup
|
||||
memsetup:
|
||||
/* The ADS GC+ for Linux Boot Rom Ver. 1.73 does memory init for us.
|
||||
* However the darn thing leaves the MMU enabled before handing control
|
||||
* over to us. So we need to disable the MMU and we use memsetup
|
||||
* to do it.
|
||||
*/
|
||||
|
||||
@ The following code segment was borrowed with gratitude from:
|
||||
@ linux-2.4.19-rmk7/arch/arm/boot/compressed/head-sa1100.S
|
||||
|
||||
@ Data cache might be active.
|
||||
@ Be sure to flush kernel binary out of the cache,
|
||||
@ whatever state it is, before it is turned off.
|
||||
@ This is done by fetching through currently executed
|
||||
@ memory to be sure we hit the same cache.
|
||||
bic r2, pc, #0x1f
|
||||
add r3, r2, #0x4000 @ 16 kb is quite enough...
|
||||
1: ldr r0, [r2], #32
|
||||
teq r2, r3
|
||||
bne 1b
|
||||
mcr p15, 0, r0, c7, c10, 4 @ drain WB
|
||||
mcr p15, 0, r0, c7, c7, 0 @ flush I & D caches
|
||||
|
||||
@ disabling MMU and caches
|
||||
mrc p15, 0, r0, c1, c0, 0 @ read control reg
|
||||
bic r0, r0, #0x0d @ clear WB, DC, MMU
|
||||
bic r0, r0, #0x1000 @ clear Icache
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
b 2f
|
||||
2:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
* 2003 (c) MontaVista Software, Inc.
|
||||
*
|
||||
* 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-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/sa1100/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -207,3 +207,28 @@ void pci_init_board(void)
|
||||
pci_mpc5xxx_init(&hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
||||
|
||||
#define GPIO_PSC1_4 0x01000000UL
|
||||
|
||||
void init_ide_reset (void)
|
||||
{
|
||||
debug ("init_ide_reset\n");
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
debug ("ide_reset(%d)\n", idereset);
|
||||
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
}
|
||||
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
||||
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# ARM Ltd.
|
||||
# Philippe Robin, <philippe.robin@arm.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 $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := integratorap.o flash.o
|
||||
SOBJS := platform.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,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, last;
|
||||
int rcode = 0;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,477 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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>
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
# include <pci.h>
|
||||
#endif
|
||||
|
||||
void flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* arch number of Integrator Board */
|
||||
gd->bd->bi_arch_number = 21;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
#ifdef CONFIG_PCI
|
||||
pci_init();
|
||||
#endif
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize PCI Devices, report devices found.
|
||||
*/
|
||||
#ifdef CONFIG_PCI
|
||||
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
|
||||
static struct pci_config_table pci_integrator_config_table[] = {
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
|
||||
pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
|
||||
PCI_ENET0_MEMADDR,
|
||||
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* V3 access routines */
|
||||
#define _V3Write16(o,v) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned short)(v))
|
||||
#define _V3Read16(o) (*(volatile unsigned short *)(PCI_V3_BASE + (unsigned int)(o)))
|
||||
|
||||
#define _V3Write32(o,v) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o)) = (unsigned int)(v))
|
||||
#define _V3Read32(o) (*(volatile unsigned int *)(PCI_V3_BASE + (unsigned int)(o)))
|
||||
|
||||
/* Compute address necessary to access PCI config space for the given */
|
||||
/* bus and device. */
|
||||
#define PCI_CONFIG_ADDRESS( __bus, __devfn, __offset ) ({ \
|
||||
unsigned int __address, __devicebit; \
|
||||
unsigned short __mapaddress; \
|
||||
unsigned int __dev = PCI_DEV (__devfn); /* FIXME to check!! (slot?) */ \
|
||||
\
|
||||
if (__bus == 0) { \
|
||||
/* local bus segment so need a type 0 config cycle */ \
|
||||
/* build the PCI configuration "address" with one-hot in A31-A11 */ \
|
||||
__address = PCI_CONFIG_BASE; \
|
||||
__address |= ((__devfn & 0x07) << 8); \
|
||||
__address |= __offset & 0xFF; \
|
||||
__mapaddress = 0x000A; /* 101=>config cycle, 0=>A1=A0=0 */ \
|
||||
__devicebit = (1 << (__dev + 11)); \
|
||||
\
|
||||
if ((__devicebit & 0xFF000000) != 0) { \
|
||||
/* high order bits are handled by the MAP register */ \
|
||||
__mapaddress |= (__devicebit >> 16); \
|
||||
} else { \
|
||||
/* low order bits handled directly in the address */ \
|
||||
__address |= __devicebit; \
|
||||
} \
|
||||
} else { /* bus !=0 */ \
|
||||
/* not the local bus segment so need a type 1 config cycle */ \
|
||||
/* A31-A24 are don't care (so clear to 0) */ \
|
||||
__mapaddress = 0x000B; /* 101=>config cycle, 1=>A1&A0 from PCI_CFG */ \
|
||||
__address = PCI_CONFIG_BASE; \
|
||||
__address |= ((__bus & 0xFF) << 16); /* bits 23..16 = bus number */ \
|
||||
__address |= ((__dev & 0x1F) << 11); /* bits 15..11 = device number */ \
|
||||
__address |= ((__devfn & 0x07) << 8); /* bits 10..8 = function number */ \
|
||||
__address |= __offset & 0xFF; /* bits 7..0 = register number */ \
|
||||
} \
|
||||
_V3Write16 (V3_LB_MAP1, __mapaddress); \
|
||||
__address; \
|
||||
})
|
||||
|
||||
/* _V3OpenConfigWindow - open V3 configuration window */
|
||||
#define _V3OpenConfigWindow() { \
|
||||
/* Set up base0 to see all 512Mbytes of memory space (not */ \
|
||||
/* prefetchable), this frees up base1 for re-use by configuration*/ \
|
||||
/* memory */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \
|
||||
0x90 | V3_LB_BASE_M_ENABLE)); \
|
||||
/* Set up base1 to point into configuration space, note that MAP1 */ \
|
||||
/* register is set up by pciMakeConfigAddress(). */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE1, ((CPU_PCI_CNFG_ADRS & 0xFFF00000) | \
|
||||
0x40 | V3_LB_BASE_M_ENABLE)); \
|
||||
}
|
||||
|
||||
/* _V3CloseConfigWindow - close V3 configuration window */
|
||||
#define _V3CloseConfigWindow() { \
|
||||
/* Reassign base1 for use by prefetchable PCI memory */ \
|
||||
_V3Write32 (V3_LB_BASE1, (((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) \
|
||||
| 0x84 | V3_LB_BASE_M_ENABLE)); \
|
||||
_V3Write16 (V3_LB_MAP1, \
|
||||
(((INTEGRATOR_PCI_BASE + 0x10000000) & 0xFFF00000) >> 16) | 0x0006); \
|
||||
\
|
||||
/* And shrink base0 back to a 256M window (NOTE: MAP0 already correct) */ \
|
||||
\
|
||||
_V3Write32 (V3_LB_BASE0, ((INTEGRATOR_PCI_BASE & 0xFFF00000) | \
|
||||
0x80 | V3_LB_BASE_M_ENABLE)); \
|
||||
}
|
||||
|
||||
static int pci_integrator_read_byte (struct pci_controller *hose, pci_dev_t dev,
|
||||
int offset, unsigned char *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned char *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_read__word (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned short *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_read_dword (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned int *val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*val = *(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset);
|
||||
*val |= (*(volatile unsigned int *)
|
||||
PCI_CONFIG_ADDRESS (PCI_BUS (dev), PCI_FUNC (dev),
|
||||
(offset + 2))) << 16;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_byte (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned char val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned char *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = val;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_word (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned short val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = val;
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_integrator_write_dword (struct pci_controller *hose,
|
||||
pci_dev_t dev, int offset,
|
||||
unsigned int val)
|
||||
{
|
||||
_V3OpenConfigWindow ();
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
offset) = (val & 0xFFFF);
|
||||
*(volatile unsigned short *) PCI_CONFIG_ADDRESS (PCI_BUS (dev),
|
||||
PCI_FUNC (dev),
|
||||
(offset + 2)) = ((val >> 16) & 0xFFFF);
|
||||
_V3CloseConfigWindow ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/******************************
|
||||
* PCI initialisation
|
||||
******************************/
|
||||
|
||||
struct pci_controller integrator_hose = {
|
||||
#ifndef CONFIG_PCI_PNP
|
||||
config_table: pci_integrator_config_table,
|
||||
#endif
|
||||
};
|
||||
|
||||
void pci_init_board (void)
|
||||
{
|
||||
volatile int i, j;
|
||||
struct pci_controller *hose = &integrator_hose;
|
||||
|
||||
/* setting this register will take the V3 out of reset */
|
||||
|
||||
*(volatile unsigned int *) (INTEGRATOR_SC_PCIENABLE) = 1;
|
||||
|
||||
/* wait a few usecs to settle the device and the PCI bus */
|
||||
|
||||
for (i = 0; i < 100; i++)
|
||||
j = i + 1;
|
||||
|
||||
/* Now write the Base I/O Address Word to V3_BASE + 0x6C */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_IO_BASE) =
|
||||
(unsigned short) (V3_BASE >> 16);
|
||||
|
||||
do {
|
||||
*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA) = 0xAA;
|
||||
*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA + 4) =
|
||||
0x55;
|
||||
} while (*(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA) != 0xAA
|
||||
|| *(volatile unsigned char *) (V3_BASE + V3_MAIL_DATA +
|
||||
4) != 0x55);
|
||||
|
||||
/* Make sure that V3 register access is not locked, if it is, unlock it */
|
||||
|
||||
if ((*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) &
|
||||
V3_SYSTEM_M_LOCK)
|
||||
== V3_SYSTEM_M_LOCK)
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) = 0xA05F;
|
||||
|
||||
/* Ensure that the slave accesses from PCI are disabled while we */
|
||||
/* setup windows */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) &=
|
||||
~(V3_COMMAND_M_MEM_EN | V3_COMMAND_M_IO_EN);
|
||||
|
||||
/* Clear RST_OUT to 0; keep the PCI bus in reset until we've finished */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) &=
|
||||
~V3_SYSTEM_M_RST_OUT;
|
||||
|
||||
/* Make all accesses from PCI space retry until we're ready for them */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG) |=
|
||||
V3_PCI_CFG_M_RETRY_EN;
|
||||
|
||||
/* Set up any V3 PCI Configuration Registers that we absolutely have to */
|
||||
/* LB_CFG controls Local Bus protocol. */
|
||||
/* Enable LocalBus byte strobes for READ accesses too. */
|
||||
/* set bit 7 BE_IMODE and bit 6 BE_OMODE */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_CFG) |= 0x0C0;
|
||||
|
||||
/* PCI_CMD controls overall PCI operation. */
|
||||
/* Enable PCI bus master. */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) |= 0x04;
|
||||
|
||||
/* PCI_MAP0 controls where the PCI to CPU memory window is on Local Bus */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_MAP0) =
|
||||
(INTEGRATOR_BOOT_ROM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_512M |
|
||||
V3_PCI_MAP_M_REG_EN |
|
||||
V3_PCI_MAP_M_ENABLE);
|
||||
|
||||
/* PCI_BASE0 is the PCI address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_BASE0) =
|
||||
INTEGRATOR_BOOT_ROM_BASE;
|
||||
|
||||
/* PCI_MAP1 is LOCAL address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_MAP1) =
|
||||
(INTEGRATOR_HDR0_SDRAM_BASE) | (V3_PCI_MAP_M_ADR_SIZE_1024M |
|
||||
V3_PCI_MAP_M_REG_EN |
|
||||
V3_PCI_MAP_M_ENABLE);
|
||||
|
||||
/* PCI_BASE1 is the PCI address of the start of the window */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_PCI_BASE1) =
|
||||
INTEGRATOR_HDR0_SDRAM_BASE;
|
||||
|
||||
/* Set up the windows from local bus memory into PCI configuration, */
|
||||
/* I/O and Memory. */
|
||||
/* PCI I/O, LB_BASE2 and LB_MAP2 are used exclusively for this. */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_BASE2) =
|
||||
((CPU_PCI_IO_ADRS >> 24) << 8) | V3_LB_BASE_M_ENABLE;
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP2) = 0;
|
||||
|
||||
/* PCI Configuration, use LB_BASE1/LB_MAP1. */
|
||||
|
||||
/* PCI Memory use LB_BASE0/LB_MAP0 and LB_BASE1/LB_MAP1 */
|
||||
/* Map first 256Mbytes as non-prefetchable via BASE0/MAP0 */
|
||||
/* (INTEGRATOR_PCI_BASE == PCI_MEM_BASE) */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_LB_BASE0) =
|
||||
INTEGRATOR_PCI_BASE | (0x80 | V3_LB_BASE_M_ENABLE);
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP0) =
|
||||
((INTEGRATOR_PCI_BASE >> 20) << 0x4) | 0x0006;
|
||||
|
||||
/* Map second 256 Mbytes as prefetchable via BASE1/MAP1 */
|
||||
|
||||
*(volatile unsigned int *) (V3_BASE + V3_LB_BASE1) =
|
||||
INTEGRATOR_PCI_BASE | (0x84 | V3_LB_BASE_M_ENABLE);
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_LB_MAP1) =
|
||||
(((INTEGRATOR_PCI_BASE + 0x10000000) >> 20) << 4) | 0x0006;
|
||||
|
||||
/* Allow accesses to PCI Configuration space */
|
||||
/* and set up A1, A0 for type 1 config cycles */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG) =
|
||||
((*(volatile unsigned short *) (V3_BASE + V3_PCI_CFG)) &
|
||||
~(V3_PCI_CFG_M_RETRY_EN | V3_PCI_CFG_M_AD_LOW1)) |
|
||||
V3_PCI_CFG_M_AD_LOW0;
|
||||
|
||||
/* now we can allow in PCI MEMORY accesses */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_PCI_CMD)) |
|
||||
V3_COMMAND_M_MEM_EN;
|
||||
|
||||
/* Set RST_OUT to take the PCI bus is out of reset, PCI devices can */
|
||||
/* initialise and lock the V3 system register so that no one else */
|
||||
/* can play with it */
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_SYSTEM)) |
|
||||
V3_SYSTEM_M_RST_OUT;
|
||||
|
||||
*(volatile unsigned short *) (V3_BASE + V3_SYSTEM) =
|
||||
(*(volatile unsigned short *) (V3_BASE + V3_SYSTEM)) |
|
||||
V3_SYSTEM_M_LOCK;
|
||||
|
||||
/*
|
||||
* Register the hose
|
||||
*/
|
||||
hose->first_busno = 0;
|
||||
hose->last_busno = 0xff;
|
||||
|
||||
/* System memory space */
|
||||
pci_set_region (hose->regions + 0,
|
||||
0x00000000, 0x40000000, 0x01000000,
|
||||
PCI_REGION_MEM | PCI_REGION_MEMORY);
|
||||
|
||||
/* PCI Memory - config space */
|
||||
pci_set_region (hose->regions + 1,
|
||||
0x00000000, 0x62000000, 0x01000000, PCI_REGION_MEM);
|
||||
|
||||
/* PCI V3 regs */
|
||||
pci_set_region (hose->regions + 2,
|
||||
0x00000000, 0x61000000, 0x00080000, PCI_REGION_MEM);
|
||||
|
||||
/* PCI I/O space */
|
||||
pci_set_region (hose->regions + 3,
|
||||
0x00000000, 0x60000000, 0x00010000, PCI_REGION_IO);
|
||||
|
||||
pci_set_ops (hose,
|
||||
pci_integrator_read_byte,
|
||||
pci_integrator_read__word,
|
||||
pci_integrator_read_dword,
|
||||
pci_integrator_write_byte,
|
||||
pci_integrator_write_word, pci_integrator_write_dword);
|
||||
|
||||
hose->region_count = 4;
|
||||
|
||||
pci_register_hose (hose);
|
||||
|
||||
pciauto_config_init (hose);
|
||||
pciauto_config_device (hose, 0);
|
||||
|
||||
hose->last_busno = pci_hose_scan (hose);
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2004, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by Integrator's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* 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
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := integratorcp.o flash.o
|
||||
SOBJS := platform.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,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, last;
|
||||
int rcode = 0;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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 flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/* arch number of Integrator Board */
|
||||
gd->bd->bi_arch_number = 275;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
ether__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2003, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by IntegratorCP's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* 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
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -232,7 +232,7 @@ mpl_prg_image(uchar *ld_addr)
|
||||
}
|
||||
puts("OK\n");
|
||||
break;
|
||||
#if CONFIG_BZIP2
|
||||
#ifdef CONFIG_BZIP2
|
||||
case IH_COMP_BZIP2:
|
||||
puts("Uncompressing (BZIP2) ... ");
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
SOBJS = init.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 $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# IBM 440GX Reference Platform (Ocotea) board
|
||||
#
|
||||
|
||||
#TEXT_BASE = 0xFFFE0000
|
||||
|
||||
ifeq ($(ramsym),1)
|
||||
TEXT_BASE = 0x07FD0000
|
||||
else
|
||||
TEXT_BASE = 0xFFF80000
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_440=1
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifeq ($(dbcr),1)
|
||||
PLATFORM_CPPFLAGS += -DCFG_INIT_DBCR=0x8cff0000
|
||||
endif
|
||||
@@ -0,0 +1,595 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2002 Jun Gu <jung@artesyncp.com>
|
||||
* Add support for Am29F016D and dynamic switch setting.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified 4/5/2001
|
||||
* Wait for completion of each sector erase command issued
|
||||
* 4/5/2001
|
||||
* Chris Hallinan - DS4.COM, Inc. - clh@net1plus.com
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <ppc4xx.h>
|
||||
#include <asm/processor.h>
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUGF(x...) printf(x)
|
||||
#else
|
||||
#define DEBUGF(x...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define BOOT_SMALL_FLASH 32 /* 00100000 */
|
||||
#define FLASH_ONBD_N 2 /* 00000010 */
|
||||
#define FLASH_SRAM_SEL 1 /* 00000001 */
|
||||
|
||||
#define BOOT_SMALL_FLASH_VAL 4
|
||||
#define FLASH_ONBD_N_VAL 2
|
||||
#define FLASH_SRAM_SEL_VAL 1
|
||||
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
static unsigned long flash_addr_table[8][CFG_MAX_FLASH_BANKS] = {
|
||||
{0xFF800000, 0xFF900000, 0xFFC00000}, /* 0:000: configuraton 4 */
|
||||
{0xFF900000, 0xFF800000, 0xFFC00000}, /* 1:001: configuraton 3 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 2:010: configuraton 8 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 3:011: configuraton 7 */
|
||||
{0xFFE00000, 0xFFF00000, 0xFF800000}, /* 4:100: configuraton 2 */
|
||||
{0xFFF00000, 0xFFF80000, 0xFF800000}, /* 5:101: configuraton 1 */
|
||||
{0x00000000, 0x00000000, 0x00000000}, /* 6:110: configuraton 6 */
|
||||
{0x00000000, 0x00000000, 0x00000000} /* 7:111: configuraton 5 */
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data);
|
||||
|
||||
|
||||
#ifdef CONFIG_OCOTEA
|
||||
#define ADDR0 0x5555
|
||||
#define ADDR1 0x2aaa
|
||||
#define FLASH_WORD_SIZE unsigned char
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
unsigned long total_b = 0;
|
||||
unsigned long size_b[CFG_MAX_FLASH_BANKS];
|
||||
unsigned char *fpga_base = (unsigned char *) CFG_FPGA_BASE;
|
||||
unsigned char switch_status;
|
||||
unsigned short index = 0;
|
||||
int i;
|
||||
|
||||
/* read FPGA base register FPGA_REG0 */
|
||||
switch_status = *fpga_base;
|
||||
|
||||
/* check the bitmap of switch status */
|
||||
if (switch_status & BOOT_SMALL_FLASH) {
|
||||
index += BOOT_SMALL_FLASH_VAL;
|
||||
}
|
||||
if (switch_status & FLASH_ONBD_N) {
|
||||
index += FLASH_ONBD_N_VAL;
|
||||
}
|
||||
if (switch_status & FLASH_SRAM_SEL) {
|
||||
index += FLASH_SRAM_SEL_VAL;
|
||||
}
|
||||
|
||||
DEBUGF("\n");
|
||||
DEBUGF("FLASH: Index: %d\n", index);
|
||||
|
||||
/* Init: no FLASHes known */
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
|
||||
/* check whether the address is 0 */
|
||||
if (flash_addr_table[index][i] == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* call flash_get_size() to initialize sector address */
|
||||
size_b[i] = flash_get_size((vu_long *) flash_addr_table[index][i], &flash_info[i]);
|
||||
flash_info[i].size = size_b[i];
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank %d - Size = 0x%08lx = %ld MB\n",
|
||||
i, size_b[i], size_b[i] << 20);
|
||||
flash_info[i].sector_count = -1;
|
||||
flash_info[i].size = 0;
|
||||
}
|
||||
|
||||
total_b += flash_info[i].size;
|
||||
}
|
||||
|
||||
return total_b;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info(flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
int k;
|
||||
int size;
|
||||
int erased;
|
||||
volatile unsigned long *flash;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_AMD:
|
||||
printf("AMD ");
|
||||
break;
|
||||
case FLASH_MAN_FUJ:
|
||||
printf("FUJITSU ");
|
||||
break;
|
||||
case FLASH_MAN_SST:
|
||||
printf("SST ");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_AM040:
|
||||
printf("AM29F040 (512 Kbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_AM400B:
|
||||
printf("AM29LV400B (4 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM400T:
|
||||
printf("AM29LV400T (4 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM800B:
|
||||
printf("AM29LV800B (8 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM800T:
|
||||
printf("AM29LV800T (8 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM160B:
|
||||
printf("AM29LV160B (16 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM160T:
|
||||
printf("AM29LV160T (16 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AM320B:
|
||||
printf("AM29LV320B (32 Mbit, bottom boot sect)\n");
|
||||
break;
|
||||
case FLASH_AM320T:
|
||||
printf("AM29LV320T (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_AMDLV033C:
|
||||
printf("AM29LV033C (32 Mbit, top boot sector)\n");
|
||||
break;
|
||||
case FLASH_SST800A:
|
||||
printf("SST39LF/VF800 (8 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
case FLASH_SST160A:
|
||||
printf("SST39LF/VF160 (16 Mbit, uniform sector size)\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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 long *) info->start[i];
|
||||
size = size >> 2; /* divide by 4 for longword access */
|
||||
for (k = 0; k < size; k++) {
|
||||
if (*flash++ != 0xffffffff) {
|
||||
erased = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((i % 5) == 0)
|
||||
printf("\n ");
|
||||
printf(" %08lX%s%s",
|
||||
info->start[i],
|
||||
erased ? " E" : " ", info->protect[i] ? "RO " : " ");
|
||||
}
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size(vu_long * addr, flash_info_t * info)
|
||||
{
|
||||
short i;
|
||||
FLASH_WORD_SIZE value;
|
||||
ulong base = (ulong) addr;
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *) addr;
|
||||
|
||||
DEBUGF("FLASH ADDR: %08x\n", (unsigned) addr);
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
udelay(10000);
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
udelay(1000);
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
udelay(1000);
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00900090;
|
||||
udelay(1000);
|
||||
|
||||
value = addr2[0];
|
||||
DEBUGF("FLASH MANUFACT: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_AMD;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) FUJ_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_FUJ;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) SST_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_SST;
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) STM_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_STM;
|
||||
break;
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr2[1]; /* device ID */
|
||||
|
||||
DEBUGF("\nFLASH DEVICEID: %x\n", value);
|
||||
|
||||
switch (value) {
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_F040B:
|
||||
info->flash_id += FLASH_AM040;
|
||||
info->sector_count = 8;
|
||||
info->size = 0x0080000; /* => 512 ko */
|
||||
break;
|
||||
case (FLASH_WORD_SIZE) AMD_ID_LV033C:
|
||||
info->flash_id += FLASH_AMDLV033C;
|
||||
info->sector_count = 64;
|
||||
info->size = 0x00400000;
|
||||
break; /* => 4 MB */
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
}
|
||||
|
||||
/* set up sector start address table */
|
||||
if (((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) ||
|
||||
(info->flash_id == FLASH_AM040) ||
|
||||
(info->flash_id == FLASH_AMD016)) {
|
||||
for (i = 0; i < info->sector_count; i++)
|
||||
info->start[i] = base + (i * 0x00010000);
|
||||
} else {
|
||||
if (info->flash_id & FLASH_BTYPE) {
|
||||
/* set sector offsets for bottom boot block type */
|
||||
info->start[0] = base + 0x00000000;
|
||||
info->start[1] = base + 0x00004000;
|
||||
info->start[2] = base + 0x00006000;
|
||||
info->start[3] = base + 0x00008000;
|
||||
for (i = 4; i < info->sector_count; i++) {
|
||||
info->start[i] = base + (i * 0x00010000) - 0x00030000;
|
||||
}
|
||||
} else {
|
||||
/* set sector offsets for top boot block type */
|
||||
i = info->sector_count - 1;
|
||||
info->start[i--] = base + info->size - 0x00004000;
|
||||
info->start[i--] = base + info->size - 0x00006000;
|
||||
info->start[i--] = base + info->size - 0x00008000;
|
||||
for (; i >= 0; i--) {
|
||||
info->start[i] = base + i * 0x00010000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check for protected sectors */
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
/* read sector protection at sector address, (A7 .. A0) = 0x02 */
|
||||
/* D0 = 1 if protected */
|
||||
addr2 = (volatile FLASH_WORD_SIZE *) (info->start[i]);
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST)
|
||||
info->protect[i] = 0;
|
||||
else
|
||||
info->protect[i] = addr2[2] & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
int wait_for_DQ7(flash_info_t * info, int sect)
|
||||
{
|
||||
ulong start, now, last;
|
||||
volatile FLASH_WORD_SIZE *addr =
|
||||
(FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
|
||||
start = get_timer(0);
|
||||
last = start;
|
||||
while ((addr[0] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(FLASH_WORD_SIZE) 0x00800080) {
|
||||
if ((now = get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf("Timeout\n");
|
||||
return -1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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 flag, prot, sect, l_sect;
|
||||
int i;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("- missing\n");
|
||||
} else {
|
||||
printf("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf("Can't erase unknown flash type - aborted\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");
|
||||
}
|
||||
|
||||
l_sect = -1;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
addr2 = (FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
printf("Erasing sector %p\n", addr2);
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_SST) {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00500050; /* block erase */
|
||||
for (i = 0; i < 50; i++)
|
||||
udelay(1000); /* wait 1 ms */
|
||||
} else {
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00800080;
|
||||
addr[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[0] = (FLASH_WORD_SIZE) 0x00300030; /* sector erase */
|
||||
}
|
||||
l_sect = sect;
|
||||
/*
|
||||
* Wait for each sector to complete, it's more
|
||||
* reliable. According to AMD Spec, you must
|
||||
* issue all erase commands within a specified
|
||||
* timeout. This has been seen to fail, especially
|
||||
* if printf()s are included (for debug)!!
|
||||
*/
|
||||
wait_for_DQ7(info, sect);
|
||||
}
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay(1000);
|
||||
|
||||
/* reset to read mode */
|
||||
addr = (FLASH_WORD_SIZE *) info->start[0];
|
||||
addr[0] = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
|
||||
|
||||
printf(" done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < 4 && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < 4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word(flash_info_t * info, ulong dest, ulong data)
|
||||
{
|
||||
volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile FLASH_WORD_SIZE *dest2 = (FLASH_WORD_SIZE *) dest;
|
||||
volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *) & data;
|
||||
ulong start;
|
||||
int i;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*((volatile FLASH_WORD_SIZE *) dest) &
|
||||
(FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
|
||||
return (2);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4 / sizeof(FLASH_WORD_SIZE); i++) {
|
||||
int flag;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00AA00AA;
|
||||
addr2[ADDR1] = (FLASH_WORD_SIZE) 0x00550055;
|
||||
addr2[ADDR0] = (FLASH_WORD_SIZE) 0x00A000A0;
|
||||
|
||||
dest2[i] = data2[i];
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer(0);
|
||||
while ((dest2[i] & (FLASH_WORD_SIZE) 0x00800080) !=
|
||||
(data2[i] & (FLASH_WORD_SIZE) 0x00800080)) {
|
||||
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <config.h>
|
||||
|
||||
/* General */
|
||||
#define TLB_VALID 0x00000200
|
||||
|
||||
/* Supported page sizes */
|
||||
|
||||
#define SZ_1K 0x00000000
|
||||
#define SZ_4K 0x00000010
|
||||
#define SZ_16K 0x00000020
|
||||
#define SZ_64K 0x00000030
|
||||
#define SZ_256K 0x00000040
|
||||
#define SZ_1M 0x00000050
|
||||
#define SZ_16M 0x00000070
|
||||
#define SZ_256M 0x00000090
|
||||
|
||||
/* Storage attributes */
|
||||
#define SA_W 0x00000800 /* Write-through */
|
||||
#define SA_I 0x00000400 /* Caching inhibited */
|
||||
#define SA_M 0x00000200 /* Memory coherence */
|
||||
#define SA_G 0x00000100 /* Guarded */
|
||||
#define SA_E 0x00000080 /* Endian */
|
||||
|
||||
/* Access control */
|
||||
#define AC_X 0x00000024 /* Execute */
|
||||
#define AC_W 0x00000012 /* Write */
|
||||
#define AC_R 0x00000009 /* Read */
|
||||
|
||||
/* Some handy macros */
|
||||
|
||||
#define EPN(e) ((e) & 0xfffffc00)
|
||||
#define TLB0(epn,sz) ( (EPN((epn)) | (sz) | TLB_VALID ) )
|
||||
#define TLB1(rpn,erpn) ( ((rpn)&0xfffffc00) | (erpn) )
|
||||
#define TLB2(a) ( (a)&0x00000fbf )
|
||||
|
||||
#define tlbtab_start\
|
||||
mflr r1 ;\
|
||||
bl 0f ;
|
||||
|
||||
#define tlbtab_end\
|
||||
.long 0, 0, 0 ; \
|
||||
0: mflr r0 ; \
|
||||
mtlr r1 ; \
|
||||
blr ;
|
||||
|
||||
#define tlbentry(epn,sz,rpn,erpn,attr)\
|
||||
.long TLB0(epn,sz),TLB1(rpn,erpn),TLB2(attr)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* TLB TABLE
|
||||
*
|
||||
* This table is used by the cpu boot code to setup the initial tlb
|
||||
* entries. Rather than make broad assumptions in the cpu source tree,
|
||||
* this table lets each board set things up however they like.
|
||||
*
|
||||
* Pointer to the table is returned in r1
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
.section .bootpg,"ax"
|
||||
.globl tlbtab
|
||||
|
||||
tlbtab:
|
||||
tlbtab_start
|
||||
tlbentry( 0xf0000000, SZ_256M, 0xf0000000, 1, AC_R|AC_W|AC_X|SA_G|SA_I)
|
||||
tlbentry( CFG_PERIPHERAL_BASE, SZ_256M, 0x40000000, 1, AC_R|AC_W|SA_G|SA_I)
|
||||
tlbentry( CFG_ISRAM_BASE, SZ_4K, 0x80000000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_MEMBASE, SZ_256M, 0x00000000, 3, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbtab_end
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* Copyright (C) 2004 PaulReynolds@lhsolutions.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 "ocotea.h"
|
||||
#include <asm/processor.h>
|
||||
#include <spd_sdram.h>
|
||||
#include <440gx_enet.h>
|
||||
|
||||
#define BOOT_SMALL_FLASH 32 /* 00100000 */
|
||||
#define FLASH_ONBD_N 2 /* 00000010 */
|
||||
#define FLASH_SRAM_SEL 1 /* 00000001 */
|
||||
|
||||
long int fixed_sdram (void);
|
||||
void fpga_init (void);
|
||||
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
unsigned long mfr;
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Initialize EBC CONFIG
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(xbcfg, EBC_CFG_LE_UNLOCK |
|
||||
EBC_CFG_PTD_ENABLE | EBC_CFG_RTC_64PERCLK |
|
||||
EBC_CFG_ATC_PREVIOUS | EBC_CFG_DTC_PREVIOUS |
|
||||
EBC_CFG_CTC_PREVIOUS | EBC_CFG_EMC_NONDEFAULT |
|
||||
EBC_CFG_PME_DISABLE | EBC_CFG_PR_32);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 1 MB FLASH / 1 MB SRAM. Initialize bank 0 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb0ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(8)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb0cr, EBC_BXCR_BAS_ENCODE(0xFFE00000)|
|
||||
EBC_BXCR_BS_2MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 8KB NVRAM/RTC. Initialize bank 1 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb1ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(10)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb1cr, EBC_BXCR_BAS_ENCODE(0x48000000)|
|
||||
EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| 4 MB FLASH. Initialize bank 2 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb2ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(10)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb2cr, EBC_BXCR_BAS_ENCODE(0xFF800000)|
|
||||
EBC_BXCR_BS_4MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| FPGA. Initialize bank 7 with default values.
|
||||
+-------------------------------------------------------------------------*/
|
||||
mtebc(pb7ap, EBC_BXAP_BME_DISABLED|EBC_BXAP_TWT_ENCODE(7)|
|
||||
EBC_BXAP_BCE_DISABLE|
|
||||
EBC_BXAP_CSN_ENCODE(1)|EBC_BXAP_OEN_ENCODE(1)|
|
||||
EBC_BXAP_WBN_ENCODE(1)|EBC_BXAP_WBF_ENCODE(1)|
|
||||
EBC_BXAP_TH_ENCODE(1)|EBC_BXAP_RE_DISABLED|
|
||||
EBC_BXAP_BEM_WRITEONLY|
|
||||
EBC_BXAP_PEN_DISABLED);
|
||||
mtebc(pb7cr, EBC_BXCR_BAS_ENCODE(0x48300000)|
|
||||
EBC_BXCR_BS_1MB|EBC_BXCR_BU_RW|EBC_BXCR_BW_8BIT);
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup the interrupt controller polarities, triggers, etc.
|
||||
*-------------------------------------------------------------------*/
|
||||
mtdcr (uic0sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic0er, 0x00000000); /* disable all */
|
||||
mtdcr (uic0cr, 0x00000009); /* SMI & UIC1 crit are critical */
|
||||
mtdcr (uic0pr, 0xfffffe13); /* per ref-board manual */
|
||||
mtdcr (uic0tr, 0x01c00008); /* per ref-board manual */
|
||||
mtdcr (uic0vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic0sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uic1sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic1er, 0x00000000); /* disable all */
|
||||
mtdcr (uic1cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uic1pr, 0xffffe0ff); /* per ref-board manual */
|
||||
mtdcr (uic1tr, 0x00ffc000); /* per ref-board manual */
|
||||
mtdcr (uic1vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic1sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uic2sr, 0xffffffff); /* clear all */
|
||||
mtdcr (uic2er, 0x00000000); /* disable all */
|
||||
mtdcr (uic2cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uic2pr, 0xffffffff); /* per ref-board manual */
|
||||
mtdcr (uic2tr, 0x00ff8c0f); /* per ref-board manual */
|
||||
mtdcr (uic2vr, 0x00000001); /* int31 highest, base=0x000 */
|
||||
mtdcr (uic2sr, 0xffffffff); /* clear all */
|
||||
|
||||
mtdcr (uicb0sr, 0xfc000000); /* clear all */
|
||||
mtdcr (uicb0er, 0x00000000); /* disable all */
|
||||
mtdcr (uicb0cr, 0x00000000); /* all non-critical */
|
||||
mtdcr (uicb0pr, 0xfc000000); /* */
|
||||
mtdcr (uicb0tr, 0x00000000); /* */
|
||||
mtdcr (uicb0vr, 0x00000001); /* */
|
||||
mfsdr (sdr_mfr, mfr);
|
||||
mfr &= ~SDR0_MFR_ECS_MASK;
|
||||
/* mtsdr(sdr_mfr, mfr); */
|
||||
fpga_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
sys_info_t sysinfo;
|
||||
|
||||
get_sys_info (&sysinfo);
|
||||
|
||||
printf ("Board: IBM 440GX Evaluation Board\n");
|
||||
printf ("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz / 1000000);
|
||||
printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
|
||||
printf ("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
|
||||
printf ("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
|
||||
printf ("\tEPB: %lu MHz\n", sysinfo.freqEPB / 1000000);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long dram_size = 0;
|
||||
|
||||
#if defined(CONFIG_SPD_EEPROM)
|
||||
dram_size = spd_sdram (0);
|
||||
#else
|
||||
dram_size = fixed_sdram ();
|
||||
#endif
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
|
||||
#if defined(CFG_DRAM_TEST)
|
||||
int testdram (void)
|
||||
{
|
||||
uint *pstart = (uint *) 0x00000000;
|
||||
uint *pend = (uint *) 0x08000000;
|
||||
uint *p;
|
||||
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0xaaaaaaaa;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0xaaaaaaaa) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0x55555555;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0x55555555) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPD_EEPROM)
|
||||
/*************************************************************************
|
||||
* fixed sdram init -- doesn't use serial presence detect.
|
||||
*
|
||||
* Assumes: 128 MB, non-ECC, non-registered
|
||||
* PLB @ 133 MHz
|
||||
*
|
||||
************************************************************************/
|
||||
long int fixed_sdram (void)
|
||||
{
|
||||
uint reg;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup some default
|
||||
*------------------------------------------------------------------*/
|
||||
mtsdram (mem_uabba, 0x00000000); /* ubba=0 (default) */
|
||||
mtsdram (mem_slio, 0x00000000); /* rdre=0 wrre=0 rarw=0 */
|
||||
mtsdram (mem_devopt, 0x00000000); /* dll=0 ds=0 (normal) */
|
||||
mtsdram (mem_wddctr, 0x00000000); /* wrcp=0 dcd=0 */
|
||||
mtsdram (mem_clktr, 0x40000000); /* clkp=1 (90 deg wr) dcdt=0 */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Setup for board-specific specific mem
|
||||
*------------------------------------------------------------------*/
|
||||
/*
|
||||
* Following for CAS Latency = 2.5 @ 133 MHz PLB
|
||||
*/
|
||||
mtsdram (mem_b0cr, 0x000a4001); /* SDBA=0x000 128MB, Mode 3, enabled */
|
||||
mtsdram (mem_tr0, 0x410a4012); /* WR=2 WD=1 CL=2.5 PA=3 CP=4 LD=2 */
|
||||
/* RA=10 RD=3 */
|
||||
mtsdram (mem_tr1, 0x8080082f); /* SS=T2 SL=STAGE 3 CD=1 CT=0x02f */
|
||||
mtsdram (mem_rtr, 0x08200000); /* Rate 15.625 ns @ 133 MHz PLB */
|
||||
mtsdram (mem_cfg1, 0x00000000); /* Self-refresh exit, disable PM */
|
||||
udelay (400); /* Delay 200 usecs (min) */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Enable the controller, then wait for DCEN to complete
|
||||
*------------------------------------------------------------------*/
|
||||
mtsdram (mem_cfg0, 0x86000000); /* DCEN=1, PMUD=1, 64-bit */
|
||||
for (;;) {
|
||||
mfsdram (mem_mcsts, reg);
|
||||
if (reg & 0x80000000)
|
||||
break;
|
||||
}
|
||||
|
||||
return (128 * 1024 * 1024); /* 128 MB */
|
||||
}
|
||||
#endif /* !defined(CONFIG_SPD_EEPROM) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* pci_pre_init
|
||||
*
|
||||
* This routine is called just prior to registering the hose and gives
|
||||
* the board the opportunity to check things. Returning a value of zero
|
||||
* indicates that things are bad & PCI initialization should be aborted.
|
||||
*
|
||||
* Different boards may wish to customize the pci controller structure
|
||||
* (add regions, override default access routines, etc) or perform
|
||||
* certain pre-initialization actions.
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
|
||||
int pci_pre_init(struct pci_controller * hose )
|
||||
{
|
||||
unsigned long strap;
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* The ocotea board is always configured as the host & requires the
|
||||
* PCI arbiter to be enabled.
|
||||
*--------------------------------------------------------------------------*/
|
||||
mfsdr(sdr_sdstp1, strap);
|
||||
if( (strap & SDR0_SDSTP1_PAE_MASK) == 0 ){
|
||||
printf("PCI: SDR0_STRP1[%08lX] - PCI Arbiter disabled.\n",strap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
|
||||
|
||||
/*************************************************************************
|
||||
* pci_target_init
|
||||
*
|
||||
* The bootstrap configuration provides default settings for the pci
|
||||
* inbound map (PIM). But the bootstrap config choices are limited and
|
||||
* may not be sufficient for a given board.
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT)
|
||||
void pci_target_init(struct pci_controller * hose )
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Disable everything
|
||||
*--------------------------------------------------------------------------*/
|
||||
out32r( PCIX0_PIM0SA, 0 ); /* disable */
|
||||
out32r( PCIX0_PIM1SA, 0 ); /* disable */
|
||||
out32r( PCIX0_PIM2SA, 0 ); /* disable */
|
||||
out32r( PCIX0_EROMBA, 0 ); /* disable expansion rom */
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Map all of SDRAM to PCI address 0x0000_0000. Note that the 440 strapping
|
||||
* options to not support sizes such as 128/256 MB.
|
||||
*--------------------------------------------------------------------------*/
|
||||
out32r( PCIX0_PIM0LAL, CFG_SDRAM_BASE );
|
||||
out32r( PCIX0_PIM0LAH, 0 );
|
||||
out32r( PCIX0_PIM0SA, ~(gd->ram_size - 1) | 1 );
|
||||
|
||||
out32r( PCIX0_BAR0, 0 );
|
||||
|
||||
/*--------------------------------------------------------------------------+
|
||||
* Program the board's subsystem id/vendor id
|
||||
*--------------------------------------------------------------------------*/
|
||||
out16r( PCIX0_SBSYSVID, CFG_PCI_SUBSYS_VENDORID );
|
||||
out16r( PCIX0_SBSYSID, CFG_PCI_SUBSYS_DEVICEID );
|
||||
|
||||
out16r( PCIX0_CMD, in16r(PCIX0_CMD) | PCI_COMMAND_MEMORY );
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_TARGET_INIT) */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* is_pci_host
|
||||
*
|
||||
* This routine is called to determine if a pci scan should be
|
||||
* performed. With various hardware environments (especially cPCI and
|
||||
* PPMC) it's insufficient to depend on the state of the arbiter enable
|
||||
* bit in the strap register, or generic host/adapter assumptions.
|
||||
*
|
||||
* Rather than hard-code a bad assumption in the general 440 code, the
|
||||
* 440 pci code requires the board to decide at runtime.
|
||||
*
|
||||
* Return 0 for adapter mode, non-zero for host (monarch) mode.
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
#if defined(CONFIG_PCI)
|
||||
int is_pci_host(struct pci_controller *hose)
|
||||
{
|
||||
/* The ocotea board is always configured as host. */
|
||||
return(1);
|
||||
}
|
||||
#endif /* defined(CONFIG_PCI) */
|
||||
|
||||
|
||||
void fpga_init(void)
|
||||
{
|
||||
unsigned long group;
|
||||
unsigned long sdr0_pfc0;
|
||||
unsigned long sdr0_pfc1;
|
||||
unsigned long sdr0_cust0;
|
||||
unsigned long pvr;
|
||||
|
||||
mfsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mfsdr (sdr_pfc1, sdr0_pfc1);
|
||||
group = SDR0_PFC1_EPS_DECODE(sdr0_pfc1);
|
||||
pvr = get_pvr ();
|
||||
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_GEIE_MASK) | SDR0_PFC0_GEIE_TRE;
|
||||
if ( ((pvr == PVR_440GX_RA) || (pvr == PVR_440GX_RB)) && ((group == 4) || (group == 5))) {
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_DISABLE;
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_ENABLE);
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
} else {
|
||||
sdr0_pfc0 = (sdr0_pfc0 & ~SDR0_PFC0_TRE_MASK) | SDR0_PFC0_TRE_ENABLE;
|
||||
switch (group)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
/* CPU trace A */
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_ENABLE);
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_EMS;
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
/* CPU trace B - Over EBMI */
|
||||
sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_CTEMS_MASK) | SDR0_PFC1_CTEMS_CPUTRACE;
|
||||
mtsdr (sdr_pfc0, sdr0_pfc0);
|
||||
mtsdr (sdr_pfc1, sdr0_pfc1);
|
||||
out8(FPGA_REG2, (in8(FPGA_REG2) & ~FPGA_REG2_EXT_INTFACE_MASK) |
|
||||
FPGA_REG2_EXT_INTFACE_DISABLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize the ethernet specific functions in the fpga */
|
||||
mfsdr(sdr_pfc1, sdr0_pfc1);
|
||||
mfsdr(sdr_cust0, sdr0_cust0);
|
||||
if ( (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) == 4) &&
|
||||
((SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII) ||
|
||||
(SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_TBI)))
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
|
||||
FPGA_REG3_ENET_GROUP7);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SDR0_CUST0_RGMII2_DECODE(sdr0_cust0) == RGMII_FER_GMII)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_GROUP7);
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_GROUP8);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK1) |
|
||||
FPGA_REG3_ENET_ENCODE1(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_ENET_MASK2) |
|
||||
FPGA_REG3_ENET_ENCODE2(SDR0_PFC1_EPS_DECODE(sdr0_pfc1)));
|
||||
}
|
||||
}
|
||||
out8(FPGA_REG4, FPGA_REG4_GPHY_MODE10 |
|
||||
FPGA_REG4_GPHY_MODE100 | FPGA_REG4_GPHY_MODE1000 |
|
||||
FPGA_REG4_GPHY_FRC_DPLX | FPGA_REG4_CONNECT_PHYS);
|
||||
|
||||
/* reset the gigabyte phy if necessary */
|
||||
if (SDR0_PFC1_EPS_DECODE(sdr0_pfc1) >= 3)
|
||||
{
|
||||
if ((in8(FPGA_REG0) & FPGA_REG0_ECLS_MASK) == FPGA_REG0_ECLS_VER1)
|
||||
{
|
||||
out8(FPGA_REG3, in8(FPGA_REG3) & ~FPGA_REG3_GIGABIT_RESET_DISABLE);
|
||||
udelay(10000);
|
||||
out8(FPGA_REG3, in8(FPGA_REG3) | FPGA_REG3_GIGABIT_RESET_DISABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
out8(FPGA_REG2, in8(FPGA_REG2) & ~FPGA_REG2_GIGABIT_RESET_DISABLE);
|
||||
udelay(10000);
|
||||
out8(FPGA_REG2, in8(FPGA_REG2) | FPGA_REG2_GIGABIT_RESET_DISABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Turn off the LED's */
|
||||
out8(FPGA_REG3, (in8(FPGA_REG3) & ~FPGA_REG3_STAT_MASK) |
|
||||
FPGA_REG3_STAT_LED8_DISAB | FPGA_REG3_STAT_LED4_DISAB |
|
||||
FPGA_REG3_STAT_LED2_DISAB | FPGA_REG3_STAT_LED1_DISAB);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_POST
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
|
||||
return (ctrlc());
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Board specific FPGA stuff ... */
|
||||
#define FPGA_REG0 (CFG_FPGA_BASE + 0x00)
|
||||
#define FPGA_REG0_SSCG_MASK 0x80
|
||||
#define FPGA_REG0_SSCG_DISABLE 0x00
|
||||
#define FPGA_REG0_SSCG_ENABLE 0x80
|
||||
#define FPGA_REG0_BOOT_MASK 0x40
|
||||
#define FPGA_REG0_BOOT_LARGE_FLASH 0x00
|
||||
#define FPGA_REG0_BOOT_SMALL_FLASH 0x40
|
||||
#define FPGA_REG0_ECLS_MASK 0x38 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_0 0x20 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_1 0x10 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_2 0x08 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER1 0x00 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER3 0x08 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER4 0x10 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER5 0x18 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER2 0x20 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER6 0x28 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER7 0x30 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ECLS_VER8 0x38 /* New for Ocotea Rev 2 */
|
||||
#define FPGA_REG0_ARBITER_MASK 0x04
|
||||
#define FPGA_REG0_ARBITER_EXT 0x00
|
||||
#define FPGA_REG0_ARBITER_INT 0x04
|
||||
#define FPGA_REG0_ONBOARD_FLASH_MASK 0x02
|
||||
#define FPGA_REG0_ONBOARD_FLASH_ENABLE 0x00
|
||||
#define FPGA_REG0_ONBOARD_FLASH_DISABLE 0x02
|
||||
#define FPGA_REG0_FLASH 0x01
|
||||
#define FPGA_REG1 (CFG_FPGA_BASE + 0x01)
|
||||
#define FPGA_REG1_9772_FSELFBX_MASK 0x80
|
||||
#define FPGA_REG1_9772_FSELFBX_6 0x00
|
||||
#define FPGA_REG1_9772_FSELFBX_10 0x80
|
||||
#define FPGA_REG1_9531_SX_MASK 0x60
|
||||
#define FPGA_REG1_9531_SX_33MHZ 0x00
|
||||
#define FPGA_REG1_9531_SX_100MHZ 0x20
|
||||
#define FPGA_REG1_9531_SX_66MHZ 0x40
|
||||
#define FPGA_REG1_9531_SX_133MHZ 0x60
|
||||
#define FPGA_REG1_9772_FSELBX_MASK 0x18
|
||||
#define FPGA_REG1_9772_FSELBX_4 0x00
|
||||
#define FPGA_REG1_9772_FSELBX_6 0x08
|
||||
#define FPGA_REG1_9772_FSELBX_8 0x10
|
||||
#define FPGA_REG1_9772_FSELBX_10 0x18
|
||||
#define FPGA_REG1_SOURCE_MASK 0x07
|
||||
#define FPGA_REG1_SOURCE_TC 0x00
|
||||
#define FPGA_REG1_SOURCE_66MHZ 0x01
|
||||
#define FPGA_REG1_SOURCE_50MHZ 0x02
|
||||
#define FPGA_REG1_SOURCE_33MHZ 0x03
|
||||
#define FPGA_REG1_SOURCE_25MHZ 0x04
|
||||
#define FPGA_REG1_SOURCE_SSDIV1 0x05
|
||||
#define FPGA_REG1_SOURCE_SSDIV2 0x06
|
||||
#define FPGA_REG1_SOURCE_SSDIV4 0x07
|
||||
#define FPGA_REG2 (CFG_FPGA_BASE + 0x02)
|
||||
#define FPGA_REG2_TC0 0x80
|
||||
#define FPGA_REG2_TC1 0x40
|
||||
#define FPGA_REG2_TC2 0x20
|
||||
#define FPGA_REG2_TC3 0x10
|
||||
#define FPGA_REG2_GIGABIT_RESET_DISABLE 0x08 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG2_EXT_INTFACE_MASK 0x04
|
||||
#define FPGA_REG2_EXT_INTFACE_ENABLE 0x00
|
||||
#define FPGA_REG2_EXT_INTFACE_DISABLE 0x04
|
||||
#define FPGA_REG2_DEFAULT_UART1_N 0x01
|
||||
#define FPGA_REG3 (CFG_FPGA_BASE + 0x03)
|
||||
#define FPGA_REG3_GIGABIT_RESET_DISABLE 0x80 /*Use on Ocotea pass 1 boards*/
|
||||
#define FPGA_REG3_ENET_MASK1 0x70 /*Use on Ocotea pass 1 boards*/
|
||||
#define FPGA_REG3_ENET_MASK2 0xF0 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG3_ENET_GROUP0 0x00
|
||||
#define FPGA_REG3_ENET_GROUP1 0x10
|
||||
#define FPGA_REG3_ENET_GROUP2 0x20
|
||||
#define FPGA_REG3_ENET_GROUP3 0x30
|
||||
#define FPGA_REG3_ENET_GROUP4 0x40
|
||||
#define FPGA_REG3_ENET_GROUP5 0x50
|
||||
#define FPGA_REG3_ENET_GROUP6 0x60
|
||||
#define FPGA_REG3_ENET_GROUP7 0x70
|
||||
#define FPGA_REG3_ENET_GROUP8 0x80 /*Use on Ocotea pass 2 boards*/
|
||||
#define FPGA_REG3_ENET_ENCODE1(n) ((((unsigned long)(n))&0x07)<<4) /*pass1*/
|
||||
#define FPGA_REG3_ENET_DECODE1(n) ((((unsigned long)(n))>>4)&0x07) /*pass1*/
|
||||
#define FPGA_REG3_ENET_ENCODE2(n) ((((unsigned long)(n))&0x0F)<<4) /*pass2*/
|
||||
#define FPGA_REG3_ENET_DECODE2(n) ((((unsigned long)(n))>>4)&0x0F) /*pass2*/
|
||||
#define FPGA_REG3_STAT_MASK 0x0F
|
||||
#define FPGA_REG3_STAT_LED8_ENAB 0x08
|
||||
#define FPGA_REG3_STAT_LED4_ENAB 0x04
|
||||
#define FPGA_REG3_STAT_LED2_ENAB 0x02
|
||||
#define FPGA_REG3_STAT_LED1_ENAB 0x01
|
||||
#define FPGA_REG3_STAT_LED8_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED4_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED2_DISAB 0x00
|
||||
#define FPGA_REG3_STAT_LED1_DISAB 0x00
|
||||
#define FPGA_REG4 (CFG_FPGA_BASE + 0x04)
|
||||
#define FPGA_REG4_GPHY_MODE10 0x80
|
||||
#define FPGA_REG4_GPHY_MODE100 0x40
|
||||
#define FPGA_REG4_GPHY_MODE1000 0x20
|
||||
#define FPGA_REG4_GPHY_FRC_DPLX 0x10
|
||||
#define FPGA_REG4_GPHY_ANEG_DIS 0x08
|
||||
#define FPGA_REG4_CONNECT_PHYS 0x04
|
||||
|
||||
|
||||
#define SDR0_CUST0_ENET3_MASK 0x00000080
|
||||
#define SDR0_CUST0_ENET3_COPPER 0x00000000
|
||||
#define SDR0_CUST0_ENET3_FIBER 0x00000080
|
||||
#define SDR0_CUST0_RGMII3_MASK 0x00000070
|
||||
#define SDR0_CUST0_RGMII3_ENCODE(n) ((((unsigned long)(n))&0x7)<<4)
|
||||
#define SDR0_CUST0_RGMII3_DECODE(n) ((((unsigned long)(n))>>4)&0x07)
|
||||
#define SDR0_CUST0_RGMII3_DISAB 0x00000000
|
||||
#define SDR0_CUST0_RGMII3_RTBI 0x00000040
|
||||
#define SDR0_CUST0_RGMII3_RGMII 0x00000050
|
||||
#define SDR0_CUST0_RGMII3_TBI 0x00000060
|
||||
#define SDR0_CUST0_RGMII3_GMII 0x00000070
|
||||
#define SDR0_CUST0_ENET2_MASK 0x00000008
|
||||
#define SDR0_CUST0_ENET2_COPPER 0x00000000
|
||||
#define SDR0_CUST0_ENET2_FIBER 0x00000008
|
||||
#define SDR0_CUST0_RGMII2_MASK 0x00000007
|
||||
#define SDR0_CUST0_RGMII2_ENCODE(n) ((((unsigned long)(n))&0x7)<<0)
|
||||
#define SDR0_CUST0_RGMII2_DECODE(n) ((((unsigned long)(n))>>0)&0x07)
|
||||
#define SDR0_CUST0_RGMII2_DISAB 0x00000000
|
||||
#define SDR0_CUST0_RGMII2_RTBI 0x00000004
|
||||
#define SDR0_CUST0_RGMII2_RGMII 0x00000005
|
||||
#define SDR0_CUST0_RGMII2_TBI 0x00000006
|
||||
#define SDR0_CUST0_RGMII2_GMII 0x00000007
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
.resetvec 0xFFFFFFFC :
|
||||
{
|
||||
*(.resetvec)
|
||||
} = 0xffff
|
||||
|
||||
.bootpg 0xFFFFF000 :
|
||||
{
|
||||
cpu/ppc4xx/start.o (.bootpg)
|
||||
} = 0xffff
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
board/ocotea/init.o (.text)
|
||||
cpu/ppc4xx/kgdb.o (.text)
|
||||
cpu/ppc4xx/traps.o (.text)
|
||||
cpu/ppc4xx/interrupts.o (.text)
|
||||
cpu/ppc4xx/serial.o (.text)
|
||||
cpu/ppc4xx/cpu_init.o (.text)
|
||||
cpu/ppc4xx/speed.o (.text)
|
||||
cpu/ppc4xx/440gx_enet.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/* . = env_offset;*/
|
||||
/* common/environment.o(.text)*/
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_)>>2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* (C) Copyright 2002-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
/* WARNING - the following is hand-optimized to fit within */
|
||||
/* the sector layout of our flash chips! XXX FIXME XXX */
|
||||
|
||||
cpu/ppc4xx/start.o (.text)
|
||||
board/ocotea/init.o (.text)
|
||||
cpu/ppc4xx/kgdb.o (.text)
|
||||
cpu/ppc4xx/traps.o (.text)
|
||||
cpu/ppc4xx/interrupts.o (.text)
|
||||
cpu/ppc4xx/serial.o (.text)
|
||||
cpu/ppc4xx/cpu_init.o (.text)
|
||||
cpu/ppc4xx/speed.o (.text)
|
||||
cpu/ppc4xx/440gx_enet.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
|
||||
/* common/environment.o(.text) */
|
||||
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 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(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ void reset_phy(void)
|
||||
ulong value;
|
||||
|
||||
/* Configure all needed port pins for GPIO */
|
||||
#if CFG_ETH_MDDIS_VALUE
|
||||
#ifdef CFG_ETH_MDDIS_VALUE
|
||||
immr->im_ioport.iop_padat |= CFG_PA_ETH_MDDIS;
|
||||
#else
|
||||
immr->im_ioport.iop_padat &= ~(CFG_PA_ETH_MDDIS | CFG_PA_ETH_RESET); /* Set low */
|
||||
@@ -369,17 +369,17 @@ void reset_phy(void)
|
||||
value |= CFG_PB_ETH_POWERDOWN;
|
||||
|
||||
/* PHY configuration includes MDDIS and CFG1 ... CFG3 */
|
||||
#if CFG_ETH_CFG1_VALUE
|
||||
#ifdef CFG_ETH_CFG1_VALUE
|
||||
value |= CFG_PB_ETH_CFG1;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG1);
|
||||
#endif
|
||||
#if CFG_ETH_CFG2_VALUE
|
||||
#ifdef CFG_ETH_CFG2_VALUE
|
||||
value |= CFG_PB_ETH_CFG2;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG2);
|
||||
#endif
|
||||
#if CFG_ETH_CFG3_VALUE
|
||||
#ifdef CFG_ETH_CFG3_VALUE
|
||||
value |= CFG_PB_ETH_CFG3;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG3);
|
||||
|
||||
@@ -309,7 +309,7 @@ void reset_phy (void)
|
||||
|
||||
/* Configure all needed port pins for GPIO */
|
||||
#if PCU_E_WITH_SWAPPED_CS /* XXX */
|
||||
# if CFG_ETH_MDDIS_VALUE
|
||||
# ifdef CFG_ETH_MDDIS_VALUE
|
||||
immr->im_ioport.iop_padat |= CFG_PA_ETH_MDDIS;
|
||||
# else
|
||||
immr->im_ioport.iop_padat &= ~(CFG_PA_ETH_MDDIS); /* Set low */
|
||||
@@ -329,23 +329,23 @@ void reset_phy (void)
|
||||
|
||||
/* PHY configuration includes MDDIS and CFG1 ... CFG3 */
|
||||
#if !PCU_E_WITH_SWAPPED_CS
|
||||
# if CFG_ETH_MDDIS_VALUE
|
||||
# ifdef CFG_ETH_MDDIS_VALUE
|
||||
value |= CFG_PB_ETH_MDDIS;
|
||||
# else
|
||||
value &= ~(CFG_PB_ETH_MDDIS);
|
||||
# endif
|
||||
#endif
|
||||
#if CFG_ETH_CFG1_VALUE
|
||||
#ifdef CFG_ETH_CFG1_VALUE
|
||||
value |= CFG_PB_ETH_CFG1;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG1);
|
||||
#endif
|
||||
#if CFG_ETH_CFG2_VALUE
|
||||
#ifdef CFG_ETH_CFG2_VALUE
|
||||
value |= CFG_PB_ETH_CFG2;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG2);
|
||||
#endif
|
||||
#if CFG_ETH_CFG3_VALUE
|
||||
#ifdef CFG_ETH_CFG3_VALUE
|
||||
value |= CFG_PB_ETH_CFG3;
|
||||
#else
|
||||
value &= ~(CFG_PB_ETH_CFG3);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# (C) Copyright 2001-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := $(BOARD).o flash.o misc.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,103 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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>
|
||||
#include <spi.h>
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
extern void ssv_wd_pio_init(void); /* comes from ../common/wd_pio.c
|
||||
included by ./misc.c */
|
||||
#endif
|
||||
|
||||
void _default_hdlr (void)
|
||||
{
|
||||
printf ("default_hdlr\n");
|
||||
}
|
||||
|
||||
int board_early_init_f (void)
|
||||
{
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
ssv_wd_pio_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
puts ( "Board: SSV DilNetPC ADNP/ESC1"
|
||||
#if defined(CONFIG_DNPEVA2)
|
||||
" on DNP/EVA2"
|
||||
#endif
|
||||
"\n");
|
||||
#if defined(CONFIG_NIOS_BASE_32)
|
||||
puts ("Conf.: SSV Base 32 (nios_32)\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The following are used to control the SPI chip selects for the SPI command.
|
||||
*/
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_SPI) && CONFIG_NIOS_SPI
|
||||
|
||||
#define SPI_RTC_CS_MASK 0x00000001
|
||||
|
||||
void spi_rtc_chipsel(int cs)
|
||||
{
|
||||
nios_spi_t *spi = (nios_spi_t *)CFG_NIOS_SPIBASE;
|
||||
|
||||
if (cs)
|
||||
spi->slaveselect = SPI_RTC_CS_MASK; /* activate (1) */
|
||||
else
|
||||
spi->slaveselect = 0; /* deactivate (0) */
|
||||
}
|
||||
|
||||
/*
|
||||
* The SPI command uses this table of functions for controlling the SPI
|
||||
* chip selects: it calls the appropriate function to control the SPI
|
||||
* chip selects.
|
||||
*/
|
||||
spi_chipsel_type spi_chipsel[] = {
|
||||
spi_rtc_chipsel
|
||||
};
|
||||
int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]);
|
||||
|
||||
#endif /* CFG_CMD_SPI */
|
||||
|
||||
#if defined(CONFIG_POST)
|
||||
/*
|
||||
* Returns 1 if keys pressed to start the power-on long-running tests
|
||||
* Called from board_init_f().
|
||||
*/
|
||||
int post_hotkeys_pressed(void)
|
||||
{
|
||||
return 0; /* No hotkeys supported */
|
||||
}
|
||||
#endif /* CONFIG_POST */
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# (C) Copyright 2004
|
||||
# Li-Pro.Net <www.li-pro.net>
|
||||
# Stephan Linz <linz@li-pro.net>
|
||||
#
|
||||
# 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 = 0x02fc0000 # ATTENTION: notice your CFG_MONITOR_LEN setting
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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>
|
||||
|
||||
/*
|
||||
* include common flash code (for ssv boards)
|
||||
*/
|
||||
#include "../common/flash.c"
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
#define BANKSZ (8 * 1024 * 1024)
|
||||
#define SECTSZ (64 * 1024)
|
||||
#define UBOOTSECS ((CFG_MONITOR_LEN + CFG_ENV_SIZE) / SECTSZ)
|
||||
#define UBOOTAREA (UBOOTSECS * 64 * 1024) /* monitor / env area */
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
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 + FLASH_AMLV640U;
|
||||
|
||||
addr = CFG_FLASH_BASE;
|
||||
for (i = 0; i < fli->sector_count; ++i) {
|
||||
fli->start[i] = addr;
|
||||
addr += SECTSZ;
|
||||
|
||||
/* Protect monitor / environment area */
|
||||
if (addr <= (CFG_FLASH_BASE + UBOOTAREA))
|
||||
fli->protect[i] = 1;
|
||||
else
|
||||
fli->protect[i] = 0;
|
||||
}
|
||||
|
||||
return (BANKSZ);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* board/ssv/adnpesc1/misc.c
|
||||
*
|
||||
* miscellaneous board interfaces / drivers
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
#include "../common/cmd_sled.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
#include "../common/wd_pio.c"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
|
||||
#include "../common/post.c"
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* (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,138 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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>
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* 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:
|
||||
|
||||
#if defined(CFG_NIOS_CPU_OCI_BASE)
|
||||
/* OCI does the reset job */
|
||||
.long _def_xhandler@h /* Vector 0 - NMI / Reset */
|
||||
#else
|
||||
/* there is no OCI, so we have to do a direct reset jump here */
|
||||
.long CFG_NIOS_CPU_RST_VECT /* Vector 0 - Reset to GERMS */
|
||||
#endif
|
||||
.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 */
|
||||
#if (CFG_NIOS_TMRIRQ == 16)
|
||||
.long _timebase_int@h /* Vector 16 - lopri timer*/
|
||||
#else
|
||||
.long _def_xhandler@h /* Vector 16 */
|
||||
#endif
|
||||
.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 */
|
||||
#if (CFG_NIOS_TMRIRQ == 50)
|
||||
.long _timebase_int@h /* Vector 50 - lopri timer*/
|
||||
#else
|
||||
.long _def_xhandler@h /* Vector 50 */
|
||||
#endif
|
||||
.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 */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <status_led.h>
|
||||
|
||||
#if defined(CONFIG_STATUS_LED)
|
||||
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* !!!!! Q u i c k & D i r t y H a c k !!!!!
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* !!!!! !!!!!
|
||||
* !!!!! Next type definition was coming from original !!!!!
|
||||
* !!!!! status LED driver drivers/status_led.c and !!!!!
|
||||
* !!!!! should exported for using here. !!!!!
|
||||
* !!!!! !!!!!
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
|
||||
|
||||
typedef struct {
|
||||
led_id_t mask;
|
||||
int state;
|
||||
int period;
|
||||
int cnt;
|
||||
} led_dev_t;
|
||||
|
||||
extern led_dev_t led_dev[];
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BSP)
|
||||
int do_sled (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
int led_id = 0;
|
||||
|
||||
if (argc > 1) {
|
||||
#ifdef STATUS_LED_BOOT
|
||||
if (!strcmp (argv[1], "boot")) {
|
||||
led_id = STATUS_LED_BOOT + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_RED
|
||||
if (!strcmp (argv[1], "red")) {
|
||||
led_id = STATUS_LED_RED + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_YELLOW
|
||||
if (!strcmp (argv[1], "yellow")) {
|
||||
led_id = STATUS_LED_YELLOW + 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef STATUS_LED_GREEN
|
||||
if (!strcmp (argv[1], "green")) {
|
||||
led_id = STATUS_LED_GREEN + 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
#if (STATUS_LED_BITS > 3)
|
||||
for (; led_id < 4; led_id++)
|
||||
#elif (STATUS_LED_BITS > 2)
|
||||
for (; led_id < 3; led_id++)
|
||||
#elif (STATUS_LED_BITS > 1)
|
||||
for (; led_id < 2; led_id++)
|
||||
#elif (STATUS_LED_BITS > 0)
|
||||
for (; led_id < 1; led_id++)
|
||||
#else
|
||||
#error "*** STATUS_LED_BITS not correct defined ***"
|
||||
#endif
|
||||
{
|
||||
printf ("Status LED '%s' is %s\n",
|
||||
led_id == STATUS_LED_BOOT ? "boot"
|
||||
: led_id == STATUS_LED_RED ? "red"
|
||||
: led_id == STATUS_LED_YELLOW ? "yellow"
|
||||
: led_id ==
|
||||
STATUS_LED_GREEN ? "green" : "unknown",
|
||||
led_dev[led_id].state ==
|
||||
STATUS_LED_ON ? "on" : led_dev[led_id].
|
||||
state ==
|
||||
STATUS_LED_OFF ? "off" : led_dev[led_id].
|
||||
state ==
|
||||
STATUS_LED_BLINKING ? "blinking" : "unknown");
|
||||
}
|
||||
return 0;
|
||||
case 2:
|
||||
if (led_id) {
|
||||
printf ("Status LED '%s' is %s\n", argv[1],
|
||||
led_dev[led_id - 1].state ==
|
||||
STATUS_LED_ON ? "on" : led_dev[led_id -
|
||||
1].state ==
|
||||
STATUS_LED_OFF ? "off" : led_dev[led_id -
|
||||
1].state ==
|
||||
STATUS_LED_BLINKING ? "blinking" : "unknown");
|
||||
return 0;
|
||||
} else
|
||||
break;
|
||||
case 3:
|
||||
if (led_id) {
|
||||
if (!strcmp (argv[2], "on")) {
|
||||
status_led_set (led_id - 1, STATUS_LED_ON);
|
||||
return 0;
|
||||
} else if (!strcmp (argv[2], "off")) {
|
||||
status_led_set (led_id - 1, STATUS_LED_OFF);
|
||||
return 0;
|
||||
} else if (!strcmp (argv[2], "blink")) {
|
||||
status_led_set (led_id - 1,
|
||||
STATUS_LED_BLINKING);
|
||||
return 0;
|
||||
} else
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef STATUS_LED_BOOT
|
||||
#ifdef STATUS_LED_RED
|
||||
#ifdef STATUS_LED_YELLOW
|
||||
#ifdef STATUS_LED_GREEN
|
||||
#define __NAME_STR " - name: boot|red|yellow|green\n"
|
||||
#else
|
||||
#define __NAME_STR " - name: boot|red|yellow\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: boot|red\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: boot\n"
|
||||
#endif
|
||||
#else
|
||||
#define __NAME_STR " - name: (no such defined)\n"
|
||||
#endif
|
||||
|
||||
U_BOOT_CMD (sled, 3, 0, do_sled,
|
||||
"sled - check and set status led\n",
|
||||
"sled [name [state]]\n" __NAME_STR " - state: on|off|blink\n");
|
||||
#endif /* CFG_CMD_BSP */
|
||||
#endif /* CONFIG_STATUS_LED */
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <watchdog.h>
|
||||
#include <nios.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
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 CFG_FLASH_WORD_SIZE *addr = (CFG_FLASH_WORD_SIZE *) (info->start[0]);
|
||||
volatile CFG_FLASH_WORD_SIZE *addr2;
|
||||
int prot, sect, wait;
|
||||
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");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
printf("- Erase: Sect: %i @ 0x%08x\n", sect, info->start[sect]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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 = (CFG_FLASH_WORD_SIZE *) (info->start[sect]);
|
||||
*addr = 0xf0;
|
||||
*(addr+0xAAA/2) = 0xaa;
|
||||
*(addr+0x554/2) = 0x55;
|
||||
*(addr+0xAAA/2) = 0x80;
|
||||
*(addr+0xAAA/2) = 0xaa;
|
||||
*(addr+0x554/2) = 0x55;
|
||||
*addr2 = 0x30;
|
||||
/* Now just wait for 0xffff & provide some user
|
||||
* feedback while we wait. Here we have to grant
|
||||
* timer interrupts. Otherwise get_timer() can't
|
||||
* work right. */
|
||||
ipri(oldpri);
|
||||
start = get_timer (0);
|
||||
while (*addr2 != 0xffff) {
|
||||
for (wait = 8; wait; wait--) {
|
||||
udelay (125 * 1000);
|
||||
}
|
||||
putc ('.');
|
||||
if (get_timer (start) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("timeout\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
oldpri = ipri (3); /* disallow non important irqs again */
|
||||
}
|
||||
}
|
||||
|
||||
printf ("\n");
|
||||
*addr = 0xf0;
|
||||
|
||||
/* 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 * srcbuffer, ulong addr, ulong cnt)
|
||||
{
|
||||
|
||||
volatile CFG_FLASH_WORD_SIZE *cmd = (vu_short *) info->start[0];
|
||||
volatile CFG_FLASH_WORD_SIZE *dst = (vu_short *) addr;
|
||||
CFG_FLASH_WORD_SIZE *src = (void *) srcbuffer;
|
||||
CFG_FLASH_WORD_SIZE b;
|
||||
unsigned oldpri;
|
||||
ulong start;
|
||||
|
||||
cnt /= sizeof(CFG_FLASH_WORD_SIZE);
|
||||
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+0xAAA/2) = 0xaa;
|
||||
*(cmd+0x554/2) = 0x55;
|
||||
*(cmd+0xAAA/2) = 0xa0;
|
||||
ipri (oldpri);
|
||||
*dst = b;
|
||||
|
||||
/* Verify write */
|
||||
start = get_timer (0);
|
||||
while (*dst != b) {
|
||||
if (get_timer (start) > CFG_FLASH_WRITE_TOUT) {
|
||||
*cmd = 0xf0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
cnt--;
|
||||
}
|
||||
|
||||
*cmd = 0xf0;
|
||||
return (0);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
|
||||
|
||||
#if !defined(CFG_NIOS_POST_WORD_ADDR)
|
||||
#error "*** CFG_NIOS_POST_WORD_ADDR not defined ***"
|
||||
#endif
|
||||
|
||||
void post_word_store (ulong a)
|
||||
{
|
||||
volatile void *save_addr = (void *)(CFG_NIOS_POST_WORD_ADDR);
|
||||
*(volatile ulong *) save_addr = a;
|
||||
}
|
||||
|
||||
ulong post_word_load (void)
|
||||
{
|
||||
volatile void *save_addr = (void *)(CFG_NIOS_POST_WORD_ADDR);
|
||||
return *(volatile ulong *) save_addr;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
|
||||
* Stephan Linz <linz@li-pro.net>
|
||||
*
|
||||
* 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 <nios.h>
|
||||
#include <nios-io.h>
|
||||
|
||||
#if defined(CONFIG_HW_WATCHDOG)
|
||||
|
||||
#if !defined(CONFIG_HW_WDENA_BASE)
|
||||
#error "*** CONFIG_HW_WDENA_BASE not defined ***"
|
||||
#if !defined(CONFIG_HW_WDENA_BIT)
|
||||
#error "*** CONFIG_HW_WDENA_BIT not defined ***"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_HW_WDTOG_BASE)
|
||||
#error "*** CONFIG_HW_WDTOG_BASE not defined ***"
|
||||
#if !defined(CONFIG_HW_WDTOG_BIT)
|
||||
#error "*** CONFIG_HW_WDTOG_BIT not defined ***"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
static unsigned __wd_ena_pio_portval = 0;
|
||||
#endif
|
||||
|
||||
#define WD_PIO_INIT_DONE(V) ((V) & (1 << CONFIG_HW_WDENA_BIT))
|
||||
|
||||
void ssv_wd_pio_init(void)
|
||||
{
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
nios_pio_t *trg_piop = (nios_pio_t*)CONFIG_HW_WDTOG_BASE;
|
||||
|
||||
trg_piop->data &= ~(1 << CONFIG_HW_WDTOG_BIT);
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
|
||||
__wd_ena_pio_portval |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
ena_piop->data = __wd_ena_pio_portval;
|
||||
|
||||
#else /* !CONFIG_HW_WDPORT_WRONLY */
|
||||
|
||||
trg_piop->direction |= (1 << CONFIG_HW_WDTOG_BIT);
|
||||
|
||||
ena_piop->data |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
ena_piop->direction |= (1 << CONFIG_HW_WDENA_BIT);
|
||||
|
||||
#endif /* CONFIG_HW_WDPORT_WRONLY */
|
||||
}
|
||||
|
||||
void ssv_wd_pio_done(void)
|
||||
{
|
||||
nios_pio_t *piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY /* emulate read access */
|
||||
|
||||
__wd_ena_pio_portval &= ~(1 << CONFIG_HW_WDENA_BIT);
|
||||
piop->data = __wd_ena_pio_portval;
|
||||
|
||||
#else /* !CONFIG_HW_WDPORT_WRONLY */
|
||||
|
||||
piop->data &= ~(1 << CONFIG_HW_WDENA_BIT);
|
||||
|
||||
#endif /* CONFIG_HW_WDPORT_WRONLY */
|
||||
}
|
||||
|
||||
void ssv_wd_pio_reset(void)
|
||||
{
|
||||
nios_pio_t *trg_piop = (nios_pio_t*)CONFIG_HW_WDTOG_BASE;
|
||||
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY
|
||||
if (WD_PIO_INIT_DONE(__wd_ena_pio_portval))
|
||||
#else
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
if (WD_PIO_INIT_DONE(ena_piop->data))
|
||||
#endif
|
||||
{
|
||||
trg_piop->data |= (1 << CONFIG_HW_WDTOG_BIT);
|
||||
trg_piop->data &= ~(1 << CONFIG_HW_WDTOG_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
void hw_watchdog_reset(void)
|
||||
{
|
||||
int re_enable = disable_interrupts ();
|
||||
|
||||
ssv_wd_pio_reset();
|
||||
if (re_enable)
|
||||
enable_interrupts ();
|
||||
}
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BSP)
|
||||
int do_wd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
nios_pio_t *ena_piop = (nios_pio_t*)CONFIG_HW_WDENA_BASE;
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
printf ("Watchdog timer status is %s\n",
|
||||
#ifdef CONFIG_HW_WDPORT_WRONLY
|
||||
WD_PIO_INIT_DONE(__wd_ena_pio_portval)
|
||||
#else
|
||||
WD_PIO_INIT_DONE(ena_piop->data)
|
||||
#endif
|
||||
? "on" : "off");
|
||||
return 0;
|
||||
case 2:
|
||||
if (!strcmp(argv[1],"on"))
|
||||
{
|
||||
ssv_wd_pio_init();
|
||||
printf("Watchdog timer now is on\n");
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(argv[1],"off"))
|
||||
{
|
||||
ssv_wd_pio_done();
|
||||
printf("Watchdog timer now is off\n");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
wd, 2, 1, do_wd,
|
||||
"wd - check and set watchdog\n",
|
||||
"on - switch watchDog on\n"
|
||||
"wd off - switch watchdog off\n"
|
||||
"wd - print current status\n"
|
||||
);
|
||||
#endif /* CFG_CMD_BSP */
|
||||
#endif /* CONFIG_HW_WATCHDOG */
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <linux/byteorder/swab.h>
|
||||
#include <environment.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
@@ -94,6 +95,13 @@ unsigned long flash_init (void)
|
||||
CFG_ENV_ADDR + CFG_ENV_SIZE - 1,
|
||||
&flash_info[0]);
|
||||
|
||||
#ifdef CFG_ENV_ADDR_REDUND
|
||||
flash_protect ( FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR_REDUND,
|
||||
CFG_ENV_ADDR_REDUND + CFG_ENV_SIZE_REDUND - 1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ static long int dram_size (long int mamr_value, long int *base, long int maxsize
|
||||
|
||||
#ifdef CONFIG_PS2MULT
|
||||
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
#define BASE_BAUD ( 1843200 / 16 )
|
||||
struct serial_state rs_table[] = {
|
||||
{ BASE_BAUD, 4, (void*)0xec140000 },
|
||||
@@ -441,12 +441,12 @@ int board_early_init_r (void)
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
#endif /* CONFIG_PS2MULT */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
@@ -476,5 +476,5 @@ void ide_led (uchar led, uchar status)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -890,7 +890,7 @@ int do_touch (char **argv)
|
||||
int x, y;
|
||||
|
||||
if (strcmp (argv[2], "tl") == 0) {
|
||||
#if CONFIG_TOUCH_WAIT_PRESSED
|
||||
#ifdef CONFIG_TOUCH_WAIT_PRESSED
|
||||
touch_wait_pressed();
|
||||
#else
|
||||
{
|
||||
@@ -915,7 +915,7 @@ int do_touch (char **argv)
|
||||
return touch_write_clibration_values (CALIB_TL, x, y);
|
||||
}
|
||||
else if (strcmp (argv[2], "dr") == 0) {
|
||||
#if CONFIG_TOUCH_WAIT_PRESSED
|
||||
#ifdef CONFIG_TOUCH_WAIT_PRESSED
|
||||
touch_wait_pressed();
|
||||
#else
|
||||
{
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# (C) Copyright 2000-2004
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := versatile.o flash.o
|
||||
SOBJS := platform.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,5 @@
|
||||
#
|
||||
# image should be loaded at 0x01000000
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x01000000
|
||||
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* (C) Copyright 2001
|
||||
* Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
|
||||
*
|
||||
* (C) Copyright 2001-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.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 <linux/byteorder/swab.h>
|
||||
|
||||
#define PHYS_FLASH_SECT_SIZE 0x00020000 /* 256 KB sectors (x2) */
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
/* Board support for 1 or 2 flash devices */
|
||||
#undef FLASH_PORT_WIDTH32
|
||||
#define FLASH_PORT_WIDTH16
|
||||
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
#define FLASH_PORT_WIDTH ushort
|
||||
#define FLASH_PORT_WIDTHV vu_short
|
||||
#define SWAP(x) __swab16(x)
|
||||
#else
|
||||
#define FLASH_PORT_WIDTH ulong
|
||||
#define FLASH_PORT_WIDTHV vu_long
|
||||
#define SWAP(x) __swab32(x)
|
||||
#endif
|
||||
|
||||
#define FPW FLASH_PORT_WIDTH
|
||||
#define FPWV FLASH_PORT_WIDTHV
|
||||
|
||||
#define mb() __asm__ __volatile__ ("" : : : "memory")
|
||||
|
||||
|
||||
/* Flash Organization Structure */
|
||||
typedef struct OrgDef {
|
||||
unsigned int sector_number;
|
||||
unsigned int sector_size;
|
||||
} OrgDef;
|
||||
|
||||
|
||||
/* Flash Organizations */
|
||||
OrgDef OrgIntel_28F256L18T[] = {
|
||||
{4, 32 * 1024}, /* 4 * 32kBytes sectors */
|
||||
{255, 128 * 1024}, /* 255 * 128kBytes sectors */
|
||||
};
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
unsigned long flash_init (void);
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info);
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data);
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info);
|
||||
void inline spin_wheel (void);
|
||||
void flash_print_info (flash_info_t * info);
|
||||
void flash_unprotect_sectors (FPWV * addr);
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last);
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt);
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
int i;
|
||||
ulong size = 0;
|
||||
for (i = 0; i < CFG_MAX_FLASH_BANKS; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
flash_get_size ((FPW *) PHYS_FLASH_1, &flash_info[i]);
|
||||
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
|
||||
break;
|
||||
default:
|
||||
panic ("configured too many flash banks!\n");
|
||||
break;
|
||||
}
|
||||
size += flash_info[i].size;
|
||||
}
|
||||
|
||||
/* Protect monitor and environment sectors
|
||||
*/
|
||||
flash_protect (FLAG_PROTECT_SET,
|
||||
CFG_FLASH_BASE,
|
||||
CFG_FLASH_BASE + monitor_flash_len - 1, &flash_info[0]);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
static void flash_get_offsets (ulong base, flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
OrgDef *pOrgDef;
|
||||
|
||||
pOrgDef = OrgIntel_28F256L18T;
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) {
|
||||
for (i = 0; i < info->sector_count; i++) {
|
||||
if (i > 255) {
|
||||
info->start[i] = base + (i * 0x8000);
|
||||
info->protect[i] = 0;
|
||||
} else {
|
||||
info->start[i] = base +
|
||||
(i * PHYS_FLASH_SECT_SIZE);
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t * info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL:
|
||||
printf ("INTEL ");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Vendor ");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F256L18T:
|
||||
printf ("FLASH 28F256L18T\n");
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i = 0; i < info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i], info->protect[i] ? " (RO)" : " ");
|
||||
}
|
||||
printf ("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
static ulong flash_get_size (FPW * addr, flash_info_t * info)
|
||||
{
|
||||
volatile FPW value;
|
||||
|
||||
/* Write auto select command: read Manufacturer ID */
|
||||
addr[0x5555] = (FPW) 0x00AA00AA;
|
||||
addr[0x2AAA] = (FPW) 0x00550055;
|
||||
addr[0x5555] = (FPW) 0x00900090;
|
||||
|
||||
mb ();
|
||||
value = addr[0];
|
||||
|
||||
switch (value) {
|
||||
|
||||
case (FPW) INTEL_MANUFACT:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
mb ();
|
||||
value = addr[1]; /* device ID */
|
||||
switch (value) {
|
||||
|
||||
case (FPW) (INTEL_ID_28F256L18T):
|
||||
info->flash_id += FLASH_28F256L18T;
|
||||
info->sector_count = 259;
|
||||
info->size = 0x02000000;
|
||||
break; /* => 32 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (info->sector_count > CFG_MAX_FLASH_SECT) {
|
||||
printf ("** ERROR: sector count %d > max (%d) **\n",
|
||||
info->sector_count, CFG_MAX_FLASH_SECT);
|
||||
info->sector_count = CFG_MAX_FLASH_SECT;
|
||||
}
|
||||
|
||||
addr[0] = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/* unprotects a sector for write and erase
|
||||
* on some intel parts, this unprotects the entire chip, but it
|
||||
* wont hurt to call this additional times per sector...
|
||||
*/
|
||||
void flash_unprotect_sectors (FPWV * addr)
|
||||
{
|
||||
#define PD_FINTEL_WSMS_READY_MASK 0x0080
|
||||
|
||||
*addr = (FPW) 0x00500050; /* clear status register */
|
||||
|
||||
/* this sends the clear lock bit command */
|
||||
*addr = (FPW) 0x00600060;
|
||||
*addr = (FPW) 0x00D000D0;
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong type, start, last;
|
||||
int rcode = 0;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
type = (info->flash_id & FLASH_VENDMASK);
|
||||
if ((type != FLASH_MAN_INTEL)) {
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect = s_first; sect <= s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
|
||||
start = get_timer (0);
|
||||
last = start;
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
for (sect = s_first; sect <= s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
FPWV *addr = (FPWV *) (info->start[sect]);
|
||||
FPW status;
|
||||
|
||||
printf ("Erasing sector %2d ... ", sect);
|
||||
|
||||
flash_unprotect_sectors (addr);
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
*addr = (FPW) 0x00500050;/* clear status register */
|
||||
*addr = (FPW) 0x00200020;/* erase setup */
|
||||
*addr = (FPW) 0x00D000D0;/* erase confirm */
|
||||
|
||||
while (((status =
|
||||
*addr) & (FPW) 0x00800080) !=
|
||||
(FPW) 0x00800080) {
|
||||
if (get_timer_masked () >
|
||||
CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
/* suspend erase */
|
||||
*addr = (FPW) 0x00B000B0;
|
||||
/* reset to read mode */
|
||||
*addr = (FPW) 0x00FF00FF;
|
||||
rcode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear status register cmd. */
|
||||
*addr = (FPW) 0x00500050;
|
||||
*addr = (FPW) 0x00FF00FF;/* resest to read mode */
|
||||
printf (" done\n");
|
||||
}
|
||||
}
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
* 4 - Flash not identified
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp;
|
||||
FPW data;
|
||||
int count, i, l, rc, port_width;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
return 4;
|
||||
}
|
||||
/* get lower word aligned address */
|
||||
#ifdef FLASH_PORT_WIDTH16
|
||||
wp = (addr & ~1);
|
||||
port_width = 2;
|
||||
#else
|
||||
wp = (addr & ~3);
|
||||
port_width = 4;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
for (; i < port_width && cnt > 0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt == 0 && i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
count = 0;
|
||||
while (cnt >= port_width) {
|
||||
data = 0;
|
||||
for (i = 0; i < port_width; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_data (info, wp, SWAP (data))) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += port_width;
|
||||
cnt -= port_width;
|
||||
if (count++ > 0x800) {
|
||||
spin_wheel ();
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i = 0, cp = wp; i < port_width && cnt > 0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i < port_width; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *) cp);
|
||||
}
|
||||
|
||||
return (write_data (info, wp, SWAP (data)));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word or halfword to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_data (flash_info_t * info, ulong dest, FPW data)
|
||||
{
|
||||
FPWV *addr = (FPWV *) dest;
|
||||
ulong status;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
printf ("not erased at %08lx (%x)\n", (ulong) addr, *addr);
|
||||
return (2);
|
||||
}
|
||||
flash_unprotect_sectors (addr);
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts ();
|
||||
*addr = (FPW) 0x00400040; /* write setup */
|
||||
*addr = data;
|
||||
|
||||
/* arm simple, non interrupt dependent timer */
|
||||
reset_timer_masked ();
|
||||
|
||||
/* wait while polling the status register */
|
||||
while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
|
||||
if (get_timer_masked () > CFG_FLASH_WRITE_TOUT) {
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
*addr = (FPW) 0x00FF00FF; /* restore read mode */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void inline spin_wheel (void)
|
||||
{
|
||||
static int p = 0;
|
||||
static char w[] = "\\/-";
|
||||
|
||||
printf ("\010%c", w[p]);
|
||||
(++p == 3) ? (p = 0) : 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Board specific setup info
|
||||
*
|
||||
* (C) Copyright 2003, ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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>
|
||||
|
||||
.globl platformsetup
|
||||
platformsetup:
|
||||
|
||||
/* All done by Versatile's boot monitor! */
|
||||
mov pc, lr
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* 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
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x00000000;
|
||||
. = ALIGN(4);
|
||||
.text :
|
||||
{
|
||||
cpu/arm926ejs/start.o (.text)
|
||||
*(.text)
|
||||
}
|
||||
.rodata : { *(.rodata) }
|
||||
. = ALIGN(4);
|
||||
.data : { *(.data) }
|
||||
. = ALIGN(4);
|
||||
.got : { *(.got) }
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
. = ALIGN(4);
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* David Mueller, ELSOFT AG, <d.mueller@elsoft.ch>
|
||||
*
|
||||
* (C) Copyright 2003
|
||||
* Texas Instruments, <www.ti.com>
|
||||
* Kshitij Gupta <Kshitij@ti.com>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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 flash__init (void);
|
||||
void ether__init (void);
|
||||
void peripheral_power_enable (void);
|
||||
|
||||
#if defined(CONFIG_SHOW_BOOT_PROGRESS)
|
||||
void show_boot_progress(int progress)
|
||||
{
|
||||
printf("Boot reached stage %d\n", progress);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define COMP_MODE_ENABLE ((unsigned int)0x0000EAEF)
|
||||
|
||||
static inline void delay (unsigned long loops)
|
||||
{
|
||||
__asm__ volatile ("1:\n"
|
||||
"subs %0, %1, #1\n"
|
||||
"bne 1b":"=r" (loops):"0" (loops));
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous platform dependent initialisations
|
||||
*/
|
||||
|
||||
int board_init (void)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
||||
/*
|
||||
* set clock frequency:
|
||||
* VERSATILE_REFCLK is 32KHz
|
||||
* VERSATILE_TIMCLK is 1MHz
|
||||
*/
|
||||
*(volatile unsigned int *)(VERSATILE_SCTL_BASE) |=
|
||||
((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
|
||||
(VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel));
|
||||
|
||||
/* arch number of Versatile Board */
|
||||
gd->bd->bi_arch_number = 387;
|
||||
|
||||
/* adress of boot parameters */
|
||||
gd->bd->bi_boot_params = 0x00000100;
|
||||
|
||||
icache_enable ();
|
||||
|
||||
flash__init ();
|
||||
ether__init ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int misc_init_r (void)
|
||||
{
|
||||
setenv("verify", "n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
void flash__init (void)
|
||||
{
|
||||
}
|
||||
/*************************************************************
|
||||
Routine:ether__init
|
||||
Description: take the Ethernet controller out of reset and wait
|
||||
for the EEPROM load to complete.
|
||||
*************************************************************/
|
||||
void ether__init (void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************
|
||||
Routine:
|
||||
Description:
|
||||
******************************/
|
||||
int dram_init (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
+20
-8
@@ -32,7 +32,7 @@
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_BMP)
|
||||
|
||||
static int bmp_info (ulong addr);
|
||||
static int bmp_display (ulong addr);
|
||||
static int bmp_display (ulong addr, int x, int y);
|
||||
|
||||
/*
|
||||
* Subroutine: do_bmp
|
||||
@@ -47,6 +47,7 @@ static int bmp_display (ulong addr);
|
||||
int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
ulong addr;
|
||||
int x = 0, y = 0;
|
||||
|
||||
switch (argc) {
|
||||
case 2: /* use load_addr as default address */
|
||||
@@ -55,6 +56,11 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
case 3: /* use argument */
|
||||
addr = simple_strtoul(argv[2], NULL, 16);
|
||||
break;
|
||||
case 5:
|
||||
addr = simple_strtoul(argv[2], NULL, 16);
|
||||
x = simple_strtoul(argv[3], NULL, 10);
|
||||
y = simple_strtoul(argv[4], NULL, 10);
|
||||
break;
|
||||
default:
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
@@ -66,7 +72,7 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (strncmp(argv[1],"info",1) == 0) {
|
||||
return (bmp_info(addr));
|
||||
} else if (strncmp(argv[1],"display",1) == 0) {
|
||||
return (bmp_display(addr));
|
||||
return (bmp_display(addr, x, y));
|
||||
} else {
|
||||
printf ("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
@@ -74,10 +80,10 @@ int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
bmp, 3, 1, do_bmp,
|
||||
bmp, 5, 1, do_bmp,
|
||||
"bmp - manipulate BMP image data\n",
|
||||
"info <imageAddr> - display image info\n"
|
||||
"bmp display <imageAddr> - display image\n"
|
||||
"info <imageAddr> - display image info\n"
|
||||
"bmp display <imageAddr> [x y] - display image at x,y\n"
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -115,11 +121,17 @@ static int bmp_info(ulong addr)
|
||||
* Return: None
|
||||
*
|
||||
*/
|
||||
static int bmp_display(ulong addr)
|
||||
static int bmp_display(ulong addr, int x, int y)
|
||||
{
|
||||
extern int lcd_display_bitmap (ulong);
|
||||
#ifdef CONFIG_LCD
|
||||
extern int lcd_display_bitmap (ulong, int, int);
|
||||
|
||||
return (lcd_display_bitmap (addr));
|
||||
return (lcd_display_bitmap (addr, x, y));
|
||||
#endif
|
||||
#ifdef CONFIG_VIDEO
|
||||
extern int video_display_bitmap (ulong, int, int);
|
||||
return (video_display_bitmap (addr, x, y));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
|
||||
+154
-44
@@ -139,7 +139,7 @@ static block_dev_desc_t ide_dev_desc[CFG_IDE_MAXDEVICE];
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef CONFIG_IDE_LED
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_BMS2003)
|
||||
#if !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
static void ide_led (uchar led, uchar status);
|
||||
#else
|
||||
extern void ide_led (uchar led, uchar status);
|
||||
@@ -180,7 +180,7 @@ static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len
|
||||
|
||||
#ifdef CONFIG_ATAPI
|
||||
static void atapi_inquiry(block_dev_desc_t *dev_desc);
|
||||
ulong atapi_read (int device, ulong blknr, ulong blkcnt, ulong *buffer);
|
||||
ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -303,12 +303,19 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
|
||||
if (strcmp(argv[1],"read") == 0) {
|
||||
ulong addr = simple_strtoul(argv[2], NULL, 16);
|
||||
ulong blk = simple_strtoul(argv[3], NULL, 16);
|
||||
ulong cnt = simple_strtoul(argv[4], NULL, 16);
|
||||
ulong n;
|
||||
#ifdef CFG_64BIT_STRTOUL
|
||||
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE read: device %d block # %qd, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#else
|
||||
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE read: device %d block # %ld, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#endif
|
||||
|
||||
n = ide_dev_desc[curr_device].block_read (curr_device,
|
||||
blk, cnt,
|
||||
@@ -325,12 +332,19 @@ int do_ide (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
}
|
||||
} else if (strcmp(argv[1],"write") == 0) {
|
||||
ulong addr = simple_strtoul(argv[2], NULL, 16);
|
||||
ulong blk = simple_strtoul(argv[3], NULL, 16);
|
||||
ulong cnt = simple_strtoul(argv[4], NULL, 16);
|
||||
ulong n;
|
||||
#ifdef CFG_64BIT_STRTOUL
|
||||
lbaint_t blk = simple_strtoull(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE write: device %d block # %qd, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#else
|
||||
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
|
||||
|
||||
printf ("\nIDE write: device %d block # %ld, count %ld ... ",
|
||||
curr_device, blk, cnt);
|
||||
#endif
|
||||
|
||||
n = ide_write (curr_device, blk, cnt, (ulong *)addr);
|
||||
|
||||
@@ -495,6 +509,7 @@ void ide_init (void)
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD */
|
||||
|
||||
#ifdef CONFIG_IDE_PREINIT
|
||||
extern int ide_preinit (void);
|
||||
WATCHDOG_RESET();
|
||||
|
||||
if (ide_preinit ()) {
|
||||
@@ -607,8 +622,7 @@ void ide_init (void)
|
||||
ide_led ((LED_IDE1 | LED_IDE2), 0); /* LED's off */
|
||||
#ifdef CONFIG_AMIGAONEG3SE
|
||||
/* If this is the second bus, the first one was OK */
|
||||
if (bus != 0)
|
||||
{
|
||||
if (bus != 0) {
|
||||
ide_bus_ok[bus] = 0;
|
||||
goto skip_bus;
|
||||
}
|
||||
@@ -838,7 +852,7 @@ output_data_short(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
ushort *dbuf = (ushort *)sect_buf;
|
||||
|
||||
@@ -846,7 +860,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
*dbuf++ = ld_le16(pbuf);
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar i;
|
||||
volatile uchar *pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
volatile uchar *pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
@@ -859,7 +873,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
dbuf+=1;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */
|
||||
|
||||
@@ -868,7 +882,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
output_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -880,7 +894,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -898,7 +912,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
static void
|
||||
@@ -912,7 +926,7 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
static void
|
||||
input_data(int dev, ulong *sect_buf, int words)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -924,7 +938,7 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -942,7 +956,7 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
static void
|
||||
@@ -968,8 +982,7 @@ input_data_short(int dev, ulong *sect_buf, int words)
|
||||
__asm__ volatile ("eieio");
|
||||
}
|
||||
|
||||
if (words&1)
|
||||
{
|
||||
if (words&1) {
|
||||
ushort dummy;
|
||||
dummy = *pbuf;
|
||||
}
|
||||
@@ -1023,8 +1036,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
retries = 0;
|
||||
|
||||
/* Warning: This will be tricky to read */
|
||||
while (retries <= 1)
|
||||
{
|
||||
while (retries <= 1) {
|
||||
#endif /* CONFIG_AMIGAONEG3SE */
|
||||
|
||||
/* check signature */
|
||||
@@ -1042,8 +1054,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
* to become ready
|
||||
*/
|
||||
c = ide_wait (device, ATAPI_TIME_OUT);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Start Ident Command
|
||||
@@ -1090,6 +1101,18 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
ident_cpy (dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision));
|
||||
ident_cpy (dev_desc->vendor, iop->model, sizeof(dev_desc->vendor));
|
||||
ident_cpy (dev_desc->product, iop->serial_no, sizeof(dev_desc->product));
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
/*
|
||||
* firmware revision and model number have Big Endian Byte
|
||||
* order in Word. Convert both to little endian.
|
||||
*
|
||||
* See CF+ and CompactFlash Specification Revision 2.0:
|
||||
* 6.2.1.6: Identfy Drive, Table 39 for more details
|
||||
*/
|
||||
|
||||
strswab (dev_desc->revision);
|
||||
strswab (dev_desc->vendor);
|
||||
#endif /* __LITTLE_ENDIAN */
|
||||
|
||||
if ((iop->config & 0x0080)==0x0080)
|
||||
dev_desc->removable = 1;
|
||||
@@ -1131,8 +1154,31 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
}
|
||||
#endif /* CONFIG_ATAPI */
|
||||
|
||||
#ifdef __BIG_ENDIAN
|
||||
/* swap shorts */
|
||||
dev_desc->lba = (iop->lba_capacity << 16) | (iop->lba_capacity >> 16);
|
||||
#else /* ! __BIG_ENDIAN */
|
||||
/*
|
||||
* do not swap shorts on little endian
|
||||
*
|
||||
* See CF+ and CompactFlash Specification Revision 2.0:
|
||||
* 6.2.1.6: Identfy Drive, Table 39, Word Address 57-58 for details.
|
||||
*/
|
||||
dev_desc->lba = iop->lba_capacity;
|
||||
#endif /* __BIG_ENDIAN */
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (iop->command_set_2 & 0x0400) { /* LBA 48 support */
|
||||
dev_desc->lba48support = 1;
|
||||
dev_desc->lba48 = (unsigned long long)iop->lba48_capacity[0] |
|
||||
((unsigned long long)iop->lba48_capacity[1] << 16) |
|
||||
((unsigned long long)iop->lba48_capacity[2] << 32) |
|
||||
((unsigned long long)iop->lba48_capacity[3] << 48);
|
||||
} else {
|
||||
dev_desc->lba48support = 0;
|
||||
dev_desc->lba48 = 0;
|
||||
}
|
||||
#endif /* CONFIG_LBA48 */
|
||||
/* assuming HD */
|
||||
dev_desc->type=DEV_TYPE_HARDDISK;
|
||||
dev_desc->blksz=ATA_BLOCKSIZE;
|
||||
@@ -1158,13 +1204,20 @@ static void ide_ident (block_dev_desc_t *dev_desc)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char c;
|
||||
unsigned char pwrsave=0; /* power save */
|
||||
#ifdef CONFIG_LBA48
|
||||
unsigned char lba48 = 0;
|
||||
|
||||
PRINTF ("ide_read dev %d start %lX, blocks %lX buffer at %lX\n",
|
||||
if (blknr & 0x0000fffff0000000) {
|
||||
/* more than 28 bits used, use 48bit mode */
|
||||
lba48 = 1;
|
||||
}
|
||||
#endif
|
||||
PRINTF ("ide_read dev %d start %qX, blocks %lX buffer at %lX\n",
|
||||
device, blknr, blkcnt, (ulong)buffer);
|
||||
|
||||
ide_led (DEVICE_LED(device), 1); /* LED on */
|
||||
@@ -1208,15 +1261,33 @@ ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
printf ("IDE read: device %d not ready\n", device);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
/* write high bits */
|
||||
ide_outb (device, ATA_SECT_CNT, 0);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
|
||||
}
|
||||
#endif
|
||||
ide_outb (device, ATA_SECT_CNT, 1);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ);
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ_EXT);
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_READ);
|
||||
}
|
||||
|
||||
udelay (50);
|
||||
|
||||
@@ -1228,8 +1299,13 @@ ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
}
|
||||
|
||||
if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
|
||||
device, blknr, c);
|
||||
#else
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
device, (ulong)blknr, c);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1248,10 +1324,18 @@ IDE_READ_E:
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char c;
|
||||
#ifdef CONFIG_LBA48
|
||||
unsigned char lba48 = 0;
|
||||
|
||||
if (blknr & 0x0000fffff0000000) {
|
||||
/* more than 28 bits used, use 48bit mode */
|
||||
lba48 = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
ide_led (DEVICE_LED(device), 1); /* LED on */
|
||||
|
||||
@@ -1267,23 +1351,46 @@ ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
printf ("IDE read: device %d not ready\n", device);
|
||||
goto WR_OUT;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
/* write high bits */
|
||||
ide_outb (device, ATA_SECT_CNT, 0);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 24) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 32) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 40) & 0xFF);
|
||||
}
|
||||
#endif
|
||||
ide_outb (device, ATA_SECT_CNT, 1);
|
||||
ide_outb (device, ATA_LBA_LOW, (blknr >> 0) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_MID, (blknr >> 8) & 0xFF);
|
||||
ide_outb (device, ATA_LBA_HIGH, (blknr >> 16) & 0xFF);
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE);
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (lba48) {
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE_EXT);
|
||||
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ide_outb (device, ATA_DEV_HD, ATA_LBA |
|
||||
ATA_DEVICE(device) |
|
||||
((blknr >> 24) & 0xF) );
|
||||
ide_outb (device, ATA_COMMAND, ATA_CMD_WRITE);
|
||||
}
|
||||
|
||||
udelay (50);
|
||||
|
||||
c = ide_wait (device, IDE_TIME_OUT); /* can't take over 500 ms */
|
||||
|
||||
if ((c&(ATA_STAT_DRQ|ATA_STAT_BUSY|ATA_STAT_ERR)) != ATA_STAT_DRQ) {
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
printf ("Error (no IRQ) dev %d blk %qd: status 0x%02x\n",
|
||||
device, blknr, c);
|
||||
#else
|
||||
printf ("Error (no IRQ) dev %d blk %ld: status 0x%02x\n",
|
||||
device, (ulong)blknr, c);
|
||||
#endif
|
||||
goto WR_OUT;
|
||||
}
|
||||
|
||||
@@ -1426,7 +1533,7 @@ static void ide_reset (void)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K) && !defined(CONFIG_BMS2003)
|
||||
#if defined(CONFIG_IDE_LED) && !defined(CONFIG_AMIGAONEG3SE) && !defined(CONFIG_KUP4K) && !defined(CONFIG_HMI10)
|
||||
|
||||
static uchar led_buffer = 0; /* Buffer for current LED status */
|
||||
|
||||
@@ -1467,7 +1574,7 @@ static void ide_led (uchar led, uchar status)
|
||||
static void
|
||||
output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -1477,7 +1584,7 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -1490,13 +1597,13 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
|
||||
static void
|
||||
input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
{
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
ushort *dbuf;
|
||||
volatile ushort *pbuf;
|
||||
|
||||
@@ -1506,7 +1613,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
uchar *dbuf;
|
||||
volatile uchar *pbuf_even;
|
||||
volatile uchar *pbuf_odd;
|
||||
@@ -1519,7 +1626,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
__asm__ volatile ("eieio");
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
}
|
||||
|
||||
#else /* ! __PPC__ */
|
||||
@@ -1858,6 +1965,9 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc)
|
||||
((unsigned long)iobuf[5]<<16) +
|
||||
((unsigned long)iobuf[6]<< 8) +
|
||||
((unsigned long)iobuf[7]);
|
||||
#ifdef CONFIG_LBA48
|
||||
dev_desc->lba48 = 0; /* ATAPI devices cannot use 48bit addressing (ATA/ATAPI v7) */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1871,7 +1981,7 @@ static void atapi_inquiry(block_dev_desc_t * dev_desc)
|
||||
#define ATAPI_READ_BLOCK_SIZE 2048 /* assuming CD part */
|
||||
#define ATAPI_READ_MAX_BLOCK ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE /* max blocks */
|
||||
|
||||
ulong atapi_read (int device, ulong blknr, ulong blkcnt, ulong *buffer)
|
||||
ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
|
||||
{
|
||||
ulong n = 0;
|
||||
unsigned char ccb[12]; /* Command descriptor block */
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
"Rev = 0x%02X, "
|
||||
"%3dbaseT, %s\n",
|
||||
j, oui, model, rev,
|
||||
miiphy_speed (j) == _100BASET ? 100 : 10,
|
||||
miiphy_speed (j),
|
||||
miiphy_duplex (j) == FULL ? "FDX" : "HDX");
|
||||
}
|
||||
}
|
||||
|
||||
+29
-29
@@ -160,8 +160,8 @@ int pcmcia_on (void)
|
||||
}
|
||||
#else
|
||||
|
||||
#ifdef CONFIG_BMS2003
|
||||
# define BMS2003_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
|
||||
#ifdef CONFIG_HMI10
|
||||
# define HMI10_FRAM_TIMING (PCMCIA_SHT(2) | PCMCIA_SST(2) | PCMCIA_SL(4))
|
||||
#endif
|
||||
#if defined(CONFIG_LWMON) || defined(CONFIG_NSCU)
|
||||
# define CFG_PCMCIA_TIMING (PCMCIA_SHT(9) | PCMCIA_SST(3) | PCMCIA_SL(12))
|
||||
@@ -200,14 +200,14 @@ int pcmcia_on (void)
|
||||
switch (i) {
|
||||
#ifdef CONFIG_IDE_8xx_PCCARD
|
||||
case 4:
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
{ /* map FRAM area */
|
||||
win->or = ( PCMCIA_BSIZE_256K
|
||||
| PCMCIA_PPS_8
|
||||
| PCMCIA_PRS_ATTR
|
||||
| slotbit
|
||||
| PCMCIA_PV
|
||||
| BMS2003_FRAM_TIMING );
|
||||
| HMI10_FRAM_TIMING );
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -241,7 +241,7 @@ int pcmcia_on (void)
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_IDE_8xx_PCCARD */
|
||||
#ifdef CONFIG_BMS2003
|
||||
#ifdef CONFIG_HMI10
|
||||
case 3: { /* map I/O window for 4xUART data/ctrl */
|
||||
win->br += 0x40000;
|
||||
win->or = ( PCMCIA_BSIZE_256K
|
||||
@@ -252,7 +252,7 @@ int pcmcia_on (void)
|
||||
| CFG_PCMCIA_TIMING );
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
default: /* set to not valid */
|
||||
win->or = 0;
|
||||
break;
|
||||
@@ -636,7 +636,7 @@ static int hardware_enable(int slot)
|
||||
PCMCIA_PGCRX(slot) = reg;
|
||||
udelay(500);
|
||||
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
#ifndef CONFIG_NSCU
|
||||
/*
|
||||
* Configure Port C pins for
|
||||
@@ -648,7 +648,7 @@ static int hardware_enable(int slot)
|
||||
|
||||
immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
|
||||
#endif
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
/*
|
||||
* Configure Port B pins for
|
||||
* 5 Volts Enable and 3 Volts enable
|
||||
@@ -657,7 +657,7 @@ static int hardware_enable(int slot)
|
||||
|
||||
/* remove all power */
|
||||
immap->im_cpm.cp_pbdat |= 0x00000300;
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
/*
|
||||
* Make sure there is a card in the slot, then configure the interface.
|
||||
@@ -666,11 +666,11 @@ static int hardware_enable(int slot)
|
||||
debug ("[%d] %s: PIPR(%p)=0x%x\n",
|
||||
__LINE__,__FUNCTION__,
|
||||
&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
|
||||
#else
|
||||
if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
printf (" No Card found\n");
|
||||
return (1);
|
||||
}
|
||||
@@ -686,25 +686,25 @@ static int hardware_enable(int slot)
|
||||
(reg&PCMCIA_VS2(slot))?"n":"ff");
|
||||
#ifndef CONFIG_NSCU
|
||||
if ((reg & mask) == mask) {
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
immap->im_ioport.iop_pcdat |= 0x0004;
|
||||
#else
|
||||
immap->im_cpm.cp_pbdat &= ~(0x0000100);
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
puts (" 5.0V card found: ");
|
||||
} else {
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
immap->im_ioport.iop_pcdat |= 0x0002;
|
||||
#else
|
||||
immap->im_cpm.cp_pbdat &= ~(0x0000200);
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
puts (" 3.3V card found: ");
|
||||
}
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
|
||||
#else
|
||||
immap->im_cpm.cp_pbdir |= 0x00000300;
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
#else
|
||||
if ((reg & mask) == mask) {
|
||||
puts (" 5.0V card found: ");
|
||||
@@ -749,14 +749,14 @@ static int hardware_disable(int slot)
|
||||
immap = (immap_t *)CFG_IMMR;
|
||||
pcmp = (pcmconf8xx_t *)(&(((immap_t *)CFG_IMMR)->im_pcmcia));
|
||||
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
#ifndef CONFIG_NSCU
|
||||
/* remove all power */
|
||||
immap->im_ioport.iop_pcdat &= ~(0x0002 | 0x0004);
|
||||
#endif
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
immap->im_cpm.cp_pbdat |= 0x00000300;
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
debug ("Disable PCMCIA buffers and assert RESET\n");
|
||||
reg = 0;
|
||||
@@ -806,7 +806,7 @@ static int voltage_set(int slot, int vcc, int vpp)
|
||||
PCMCIA_PGCRX(slot) = reg;
|
||||
udelay(500);
|
||||
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
/*
|
||||
* Configure Port C pins for
|
||||
* 5 Volts Enable and 3 Volts enable,
|
||||
@@ -824,7 +824,7 @@ static int voltage_set(int slot, int vcc, int vpp)
|
||||
case 50: reg |= 0x0004; break;
|
||||
default: goto done;
|
||||
}
|
||||
#else /* CONFIG_BMS2003 */
|
||||
#else /* CONFIG_HMI10 */
|
||||
/*
|
||||
* Configure Port B pins for
|
||||
* 5 Volts Enable and 3 Volts enable,
|
||||
@@ -843,7 +843,7 @@ static int voltage_set(int slot, int vcc, int vpp)
|
||||
case 50: reg |= 0x00000100; break;
|
||||
default: goto done;
|
||||
}
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
/* Checking supported voltages */
|
||||
|
||||
@@ -851,21 +851,21 @@ static int voltage_set(int slot, int vcc, int vpp)
|
||||
pcmp->pcmc_pipr,
|
||||
(pcmp->pcmc_pipr & 0x00008000) ? "only 5 V" : "can do 3.3V");
|
||||
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
immap->im_ioport.iop_pcdat |= reg;
|
||||
immap->im_ioport.iop_pcdir |= (0x0002 | 0x0004);
|
||||
#else
|
||||
immap->im_cpm.cp_pbdat &= !reg;
|
||||
immap->im_cpm.cp_pbdir |= 0x00000300;
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
if (reg) {
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
debug ("PCMCIA powered at %sV\n",
|
||||
(reg&0x0004) ? "5.0" : "3.3");
|
||||
#else
|
||||
debug ("PCMCIA powered at %sV\n",
|
||||
(reg&0x00000200) ? "5.0" : "3.3");
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
} else {
|
||||
debug ("PCMCIA powered down\n");
|
||||
}
|
||||
@@ -1850,11 +1850,11 @@ static int hardware_enable (int slot)
|
||||
debug ("[%d] %s: PIPR(%p)=0x%x\n",
|
||||
__LINE__,__FUNCTION__,
|
||||
&(pcmp->pcmc_pipr),pcmp->pcmc_pipr);
|
||||
#ifndef CONFIG_BMS2003
|
||||
#ifndef CONFIG_HMI10
|
||||
if (pcmp->pcmc_pipr & (0x18000000 >> (slot << 4))) {
|
||||
#else
|
||||
if (pcmp->pcmc_pipr & (0x10000000 >> (slot << 4))) {
|
||||
#endif /* CONFIG_BMS2003 */
|
||||
#endif /* CONFIG_HMI10 */
|
||||
printf (" No Card found\n");
|
||||
return (1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ static void drv_system_init (void)
|
||||
|
||||
strcpy (dev.name, "serial");
|
||||
dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
dev.putc = serial_buffered_putc;
|
||||
dev.puts = serial_buffered_puts;
|
||||
dev.getc = serial_buffered_getc;
|
||||
|
||||
+31
-47
@@ -79,9 +79,9 @@ static env_t *flash_addr_new = (env_t *)CFG_ENV_ADDR_REDUND;
|
||||
static ulong end_addr = CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1;
|
||||
static ulong end_addr_new = CFG_ENV_ADDR_REDUND + CFG_ENV_SECT_SIZE - 1;
|
||||
|
||||
static uchar active_flag = 1;
|
||||
static uchar obsolete_flag = 0;
|
||||
#endif
|
||||
#define ACTIVE_FLAG 1
|
||||
#define OBSOLETE_FLAG 0
|
||||
#endif /* CFG_ENV_ADDR_REDUND */
|
||||
|
||||
extern uchar default_environment[];
|
||||
extern int default_environment_size;
|
||||
@@ -112,43 +112,28 @@ int env_init(void)
|
||||
ulong addr1 = (ulong)&(flash_addr->data);
|
||||
ulong addr2 = (ulong)&(flash_addr_new->data);
|
||||
|
||||
if (crc1_ok && ! crc2_ok)
|
||||
{
|
||||
if (crc1_ok && ! crc2_ok) {
|
||||
gd->env_addr = addr1;
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
else if (! crc1_ok && crc2_ok)
|
||||
{
|
||||
} else if (! crc1_ok && crc2_ok) {
|
||||
gd->env_addr = addr2;
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
else if (! crc1_ok && ! crc2_ok)
|
||||
{
|
||||
} else if (! crc1_ok && ! crc2_ok) {
|
||||
gd->env_addr = addr_default;
|
||||
gd->env_valid = 0;
|
||||
}
|
||||
else if (flag1 == active_flag && flag2 == obsolete_flag)
|
||||
{
|
||||
} else if (flag1 == ACTIVE_FLAG && flag2 == OBSOLETE_FLAG) {
|
||||
gd->env_addr = addr1;
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
else if (flag1 == obsolete_flag && flag2 == active_flag)
|
||||
{
|
||||
} else if (flag1 == OBSOLETE_FLAG && flag2 == ACTIVE_FLAG) {
|
||||
gd->env_addr = addr2;
|
||||
gd->env_valid = 1;
|
||||
}
|
||||
else if (flag1 == flag2)
|
||||
{
|
||||
} else if (flag1 == flag2) {
|
||||
gd->env_addr = addr1;
|
||||
gd->env_valid = 2;
|
||||
}
|
||||
else if (flag1 == 0xFF)
|
||||
{
|
||||
} else if (flag1 == 0xFF) {
|
||||
gd->env_addr = addr1;
|
||||
gd->env_valid = 2;
|
||||
}
|
||||
else if (flag2 == 0xFF)
|
||||
{
|
||||
} else if (flag2 == 0xFF) {
|
||||
gd->env_addr = addr2;
|
||||
gd->env_valid = 2;
|
||||
}
|
||||
@@ -161,6 +146,7 @@ int saveenv(void)
|
||||
{
|
||||
char *saved_data = NULL;
|
||||
int rc = 1;
|
||||
char flag = OBSOLETE_FLAG, new_flag = ACTIVE_FLAG;
|
||||
#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
|
||||
ulong up_data = 0;
|
||||
#endif
|
||||
@@ -207,21 +193,18 @@ int saveenv(void)
|
||||
debug (" %08lX ... %08lX ...",
|
||||
(ulong)&(flash_addr_new->data),
|
||||
sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
|
||||
if (flash_write(env_ptr->data,
|
||||
if ((rc = flash_write(env_ptr->data,
|
||||
(ulong)&(flash_addr_new->data),
|
||||
sizeof(env_ptr->data)) ||
|
||||
|
||||
flash_write((char *)&(env_ptr->crc),
|
||||
sizeof(env_ptr->data))) ||
|
||||
(rc = flash_write((char *)&(env_ptr->crc),
|
||||
(ulong)&(flash_addr_new->crc),
|
||||
sizeof(env_ptr->crc)) ||
|
||||
|
||||
flash_write((char *)&obsolete_flag,
|
||||
sizeof(env_ptr->crc))) ||
|
||||
(rc = flash_write(&flag,
|
||||
(ulong)&(flash_addr->flags),
|
||||
sizeof(flash_addr->flags)) ||
|
||||
|
||||
flash_write((char *)&active_flag,
|
||||
sizeof(flash_addr->flags))) ||
|
||||
(rc = flash_write(&new_flag,
|
||||
(ulong)&(flash_addr_new->flags),
|
||||
sizeof(flash_addr_new->flags)))
|
||||
sizeof(flash_addr_new->flags))))
|
||||
{
|
||||
flash_perror (rc);
|
||||
goto Done;
|
||||
@@ -361,8 +344,7 @@ void env_relocate_spec (void)
|
||||
#ifdef CFG_ENV_ADDR_REDUND
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
if (gd->env_addr != (ulong)&(flash_addr->data))
|
||||
{
|
||||
if (gd->env_addr != (ulong)&(flash_addr->data)) {
|
||||
env_t * etmp = flash_addr;
|
||||
ulong ltmp = end_addr;
|
||||
|
||||
@@ -373,24 +355,26 @@ void env_relocate_spec (void)
|
||||
end_addr_new = ltmp;
|
||||
}
|
||||
|
||||
if (flash_addr_new->flags != obsolete_flag &&
|
||||
if (flash_addr_new->flags != OBSOLETE_FLAG &&
|
||||
crc32(0, flash_addr_new->data, ENV_SIZE) ==
|
||||
flash_addr_new->crc)
|
||||
{
|
||||
flash_addr_new->crc) {
|
||||
char flag = OBSOLETE_FLAG;
|
||||
|
||||
gd->env_valid = 2;
|
||||
flash_sect_protect (0, (ulong)flash_addr_new, end_addr_new);
|
||||
flash_write((char *)&obsolete_flag,
|
||||
flash_write(&flag,
|
||||
(ulong)&(flash_addr_new->flags),
|
||||
sizeof(flash_addr_new->flags));
|
||||
flash_sect_protect (1, (ulong)flash_addr_new, end_addr_new);
|
||||
}
|
||||
|
||||
if (flash_addr->flags != active_flag &&
|
||||
(flash_addr->flags & active_flag) == active_flag)
|
||||
{
|
||||
if (flash_addr->flags != ACTIVE_FLAG &&
|
||||
(flash_addr->flags & ACTIVE_FLAG) == ACTIVE_FLAG) {
|
||||
char flag = ACTIVE_FLAG;
|
||||
|
||||
gd->env_valid = 2;
|
||||
flash_sect_protect (0, (ulong)flash_addr, end_addr);
|
||||
flash_write((char *)&active_flag,
|
||||
flash_write(&flag,
|
||||
(ulong)&(flash_addr->flags),
|
||||
sizeof(flash_addr->flags));
|
||||
flash_sect_protect (1, (ulong)flash_addr, end_addr);
|
||||
|
||||
+24
-1
@@ -135,11 +135,20 @@ int miiphy_speed (unsigned char addr)
|
||||
{
|
||||
unsigned short reg;
|
||||
|
||||
if (miiphy_read (addr, PHY_1000BTSR, ®)) {
|
||||
printf ("PHY 1000BT Status read failed\n");
|
||||
} else {
|
||||
if (reg != 0xFFFF) {
|
||||
if ((reg & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) !=0) {
|
||||
return (_1000BASET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (miiphy_read (addr, PHY_ANLPAR, ®)) {
|
||||
printf ("PHY speed1 read failed, assuming 10bT\n");
|
||||
return (_10BASET);
|
||||
}
|
||||
|
||||
if ((reg & PHY_ANLPAR_100) != 0) {
|
||||
return (_100BASET);
|
||||
} else {
|
||||
@@ -156,6 +165,20 @@ int miiphy_duplex (unsigned char addr)
|
||||
{
|
||||
unsigned short reg;
|
||||
|
||||
|
||||
if (miiphy_read (addr, PHY_1000BTSR, ®)) {
|
||||
printf ("PHY 1000BT Status read failed\n");
|
||||
} else {
|
||||
if ( (reg != 0xFFFF) &&
|
||||
(reg & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) ) {
|
||||
if ((reg & PHY_1000BTSR_1000FD) !=0) {
|
||||
return (FULL);
|
||||
} else {
|
||||
return (HALF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (miiphy_read (addr, PHY_ANLPAR, ®)) {
|
||||
printf ("PHY duplex read failed, assuming half duplex\n");
|
||||
return (HALF);
|
||||
|
||||
@@ -122,6 +122,14 @@ else
|
||||
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
|
||||
endif
|
||||
|
||||
# avoid trigraph warnings while parsing pci.h (produced by NIOS gcc-2.9)
|
||||
# this option have to be placed behind -Wall -- that's why it is here
|
||||
ifeq ($(ARCH),nios)
|
||||
ifeq ($(findstring 2.9,$(shell $(CC) --version)),2.9)
|
||||
CFLAGS := $(CPPFLAGS) -Wno-trigraphs
|
||||
endif
|
||||
endif
|
||||
|
||||
AFLAGS_DEBUG := -Wa,-gstabs
|
||||
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
|
||||
|
||||
|
||||
+17
-17
@@ -1,18 +1,18 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* 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
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -28,13 +28,13 @@
|
||||
#ifdef CONFIG_SERIAL1
|
||||
#define UART_NR S3C24X0_UART0
|
||||
|
||||
#elif CONFIG_SERIAL2
|
||||
#elif defined(CONFIG_SERIAL2)
|
||||
# if defined(CONFIG_TRAB)
|
||||
# error "TRAB supports only CONFIG_SERIAL1"
|
||||
# endif
|
||||
#define UART_NR S3C24X0_UART1
|
||||
|
||||
#elif CONFIG_SERIAL3
|
||||
#elif defined(CONFIG_SERIAL3)
|
||||
# if defined(CONFIG_TRAB)
|
||||
# #error "TRAB supports only CONFIG_SERIAL1"
|
||||
# endif
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Alex Zuepke <azu@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* (C) Copyright 2002-2004
|
||||
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
@@ -41,7 +44,15 @@ extern void reset_cpu(ulong addr);
|
||||
#define TIMER_LOAD_VAL 0xffffffff
|
||||
|
||||
/* macro to read the 32 bit timer */
|
||||
#ifdef CONFIG_OMAP
|
||||
#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+8))
|
||||
#endif
|
||||
#ifdef CONFIG_INTEGRATOR
|
||||
#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+4))
|
||||
#endif
|
||||
#ifdef CONFIG_VERSATILE
|
||||
#define READ_TIMER (*(volatile ulong *)(CFG_TIMERBASE+4))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USE_IRQ
|
||||
/* enable IRQ interrupts */
|
||||
@@ -182,12 +193,26 @@ static ulong lastdec;
|
||||
/* nothing really to do with interrupts, just starts up a counter. */
|
||||
int interrupt_init (void)
|
||||
{
|
||||
#ifdef CONFIG_OMAP
|
||||
int32_t val;
|
||||
|
||||
/* Start the decrementer ticking down from 0xffffffff */
|
||||
*((int32_t *) (CFG_TIMERBASE + LOAD_TIM)) = TIMER_LOAD_VAL;
|
||||
val = MPUTIM_ST | MPUTIM_AR | MPUTIM_CLOCK_ENABLE | (CFG_PVT << MPUTIM_PTV_BIT);
|
||||
*((int32_t *) (CFG_TIMERBASE + CNTL_TIMER)) = val;
|
||||
#endif /* CONFIG_OMAP */
|
||||
#ifdef CONFIG_INTEGRATOR
|
||||
/* Load timer with initial value */
|
||||
*(volatile ulong *)(CFG_TIMERBASE + 0) = TIMER_LOAD_VAL;
|
||||
/* Set timer to be enabled, free-running, no interrupts, 256 divider */
|
||||
*(volatile ulong *)(CFG_TIMERBASE + 8) = 0x8C;
|
||||
#endif /* CONFIG_INTEGRATOR */
|
||||
#ifdef CONFIG_VERSATILE
|
||||
*(volatile ulong *)(CFG_TIMERBASE + 0) = CFG_TIMER_RELOAD; /* TimerLoad */
|
||||
*(volatile ulong *)(CFG_TIMERBASE + 4) = CFG_TIMER_RELOAD; /* TimerValue */
|
||||
*(volatile ulong *)(CFG_TIMERBASE + 8) = 0x8C;
|
||||
/* *(volatile ulong *)(CFG_TIMERBASE + 8) = CFG_TIMER_CTRL | 0x40; Periodic */
|
||||
#endif /* CONFIG_VERSATILE */
|
||||
|
||||
/* init the timestamp and lastdec value */
|
||||
reset_timer_masked();
|
||||
@@ -268,7 +293,7 @@ ulong get_timer_masked (void)
|
||||
/* waits specified delay value and resets timestamp */
|
||||
void udelay_masked (unsigned long usec)
|
||||
{
|
||||
ulong tmo, tmp;
|
||||
ulong tmo;
|
||||
|
||||
if(usec >= 1000){ /* if "big" number, spread normalization to seconds */
|
||||
tmo = usec / 1000; /* start to normalize for usec to ticks per sec */
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@
|
||||
#include <asm/io.h>
|
||||
#include <asm/ibmpc.h>
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
#define asyncLSRRxFifoError1 0x80
|
||||
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
/*-----------------------------------------------------------------------------+
|
||||
| Fifo
|
||||
+-----------------------------------------------------------------------------*/
|
||||
@@ -193,7 +193,7 @@ int serial_getc(void)
|
||||
{
|
||||
unsigned char status = 0;
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
if (serial_buffer_active) {
|
||||
return serial_buffered_getc();
|
||||
}
|
||||
@@ -225,7 +225,7 @@ int serial_tstc(void)
|
||||
{
|
||||
unsigned char status;
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
if (serial_buffer_active) {
|
||||
return serial_buffered_tstc();
|
||||
}
|
||||
@@ -248,7 +248,7 @@ int serial_tstc(void)
|
||||
}
|
||||
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
|
||||
void serial_isr(void *arg)
|
||||
{
|
||||
|
||||
+6
-18
@@ -29,7 +29,9 @@
|
||||
|
||||
#define CALC_TIMING(t) (t + period - 1) / period
|
||||
|
||||
#define GPIO_PSC1_4 0x01000000ul
|
||||
#ifdef CONFIG_IDE_RESET
|
||||
extern void init_ide_reset (void);
|
||||
#endif
|
||||
|
||||
int ide_preinit (void)
|
||||
{
|
||||
@@ -70,24 +72,10 @@ int ide_preinit (void)
|
||||
|
||||
*(vu_long *) MPC5XXX_ATA_PIO2 = reg;
|
||||
|
||||
#if defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET)
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
#endif /* defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) */
|
||||
#ifdef CONFIG_IDE_RESET
|
||||
init_ide_reset ();
|
||||
#endif /* CONFIG_IDE_RESET */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET)
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
}
|
||||
#endif /* defined (CONFIG_ICECUBE) && defined (CONFIG_IDE_RESET) */
|
||||
#endif /* CFG_CMD_IDE */
|
||||
@@ -1532,10 +1532,13 @@ int usb_lowlevel_init(void)
|
||||
{
|
||||
|
||||
/* Set the USB Clock */
|
||||
*(vu_long *)MPC5XXX_CDM_48_FDC = 0x0001bbbb;
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00800000;
|
||||
*(vu_long *)MPC5XXX_CDM_48_FDC = CONFIG_USB_CLOCK;
|
||||
|
||||
/* remove all USB bits first before ORing in ours */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG &= ~0x00807000;
|
||||
|
||||
/* Activate USB port */
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00001000;
|
||||
*(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= CONFIG_USB_CONFIG;
|
||||
|
||||
memset (&gohci, 0, sizeof (ohci_t));
|
||||
memset (&urb_priv, 0, sizeof (urb_priv_t));
|
||||
|
||||
@@ -98,7 +98,9 @@ static void config_8260_ioports (volatile immap_t * immr)
|
||||
void cpu_init_f (volatile immap_t * immr)
|
||||
{
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if !defined(CONFIG_COGENT) /* done in start.S for the cogent */
|
||||
uint sccr;
|
||||
#endif
|
||||
volatile memctl8260_t *memctl = &immr->im_memctl;
|
||||
extern void m8260_cpm_reset (void);
|
||||
|
||||
@@ -131,7 +133,10 @@ void cpu_init_f (volatile immap_t * immr)
|
||||
|
||||
#if !defined(CONFIG_COGENT) /* done in start.S for the cogent */
|
||||
/* System clock control register (9-8) */
|
||||
immr->im_clkrst.car_sccr = CFG_SCCR;
|
||||
sccr = immr->im_clkrst.car_sccr &
|
||||
(SCCR_PCI_MODE | SCCR_PCI_MODCK | SCCR_PCIDF_MSK);
|
||||
immr->im_clkrst.car_sccr = sccr |
|
||||
(CFG_SCCR & ~(SCCR_PCI_MODE | SCCR_PCI_MODCK | SCCR_PCIDF_MSK) );
|
||||
#endif /* !CONFIG_COGENT */
|
||||
|
||||
/*
|
||||
|
||||
+8
-10
@@ -1205,7 +1205,7 @@ static void bitmap_plot (int x, int y)
|
||||
* Display the BMP file located at address bmp_image.
|
||||
* Only uncompressed
|
||||
*/
|
||||
int lcd_display_bitmap(ulong bmp_image)
|
||||
int lcd_display_bitmap(ulong bmp_image, int x, int y)
|
||||
{
|
||||
volatile immap_t *immr = (immap_t *) CFG_IMMR;
|
||||
volatile cpm8xx_t *cp = &(immr->im_cpm);
|
||||
@@ -1277,16 +1277,14 @@ int lcd_display_bitmap(ulong bmp_image)
|
||||
}
|
||||
|
||||
padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
|
||||
if (width>panel_info.vl_col)
|
||||
width = panel_info.vl_col;
|
||||
if (height>panel_info.vl_row)
|
||||
height = panel_info.vl_row;
|
||||
if ((x + width)>panel_info.vl_col)
|
||||
width = panel_info.vl_col - x;
|
||||
if ((y + height)>panel_info.vl_row)
|
||||
height = panel_info.vl_row - y;
|
||||
|
||||
bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
|
||||
fb = (uchar *)
|
||||
(lcd_base +
|
||||
(((height>=panel_info.vl_row) ? panel_info.vl_row : height)-1)
|
||||
* lcd_line_length);
|
||||
fb = (uchar *) (lcd_base +
|
||||
(y + height - 1) * lcd_line_length + x);
|
||||
for (i = 0; i < height; ++i) {
|
||||
WATCHDOG_RESET();
|
||||
for (j = 0; j < width ; j++)
|
||||
@@ -1317,7 +1315,7 @@ static void *lcd_logo (void)
|
||||
if ((s = getenv("splashimage")) != NULL) {
|
||||
addr = simple_strtoul(s, NULL, 16);
|
||||
|
||||
if (lcd_display_bitmap (addr) == 0) {
|
||||
if (lcd_display_bitmap (addr, 0, 0) == 0) {
|
||||
return ((void *)lcd_base);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ void pci_405gp_setup_vga(struct pci_controller *hose, pci_dev_t dev,
|
||||
*/
|
||||
static struct pci_config_table pci_405gp_config_table[] = {
|
||||
/*if VendID is 0 it terminates the table search (ie Walnut)*/
|
||||
#if CFG_PCI_SUBSYS_VENDORID
|
||||
#ifdef CFG_PCI_SUBSYS_VENDORID
|
||||
{CFG_PCI_SUBSYS_VENDORID, PCI_ANY_ID, PCI_CLASS_BRIDGE_HOST,
|
||||
PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, pci_405gp_setup_bridge},
|
||||
#endif
|
||||
|
||||
+128
-12
@@ -175,6 +175,100 @@ static void ppc_440x_eth_halt (struct eth_device *dev)
|
||||
extern int phy_setup_aneg (unsigned char addr);
|
||||
extern int miiphy_reset (unsigned char addr);
|
||||
|
||||
#if defined (CONFIG_440_GX)
|
||||
int ppc_440x_eth_setup_bridge(int devnum, bd_t * bis)
|
||||
{
|
||||
unsigned long pfc1;
|
||||
unsigned long zmiifer;
|
||||
unsigned long rmiifer;
|
||||
|
||||
mfsdr(sdr_pfc1, pfc1);
|
||||
pfc1 = SDR0_PFC1_EPS_DECODE(pfc1);
|
||||
|
||||
zmiifer = 0;
|
||||
rmiifer = 0;
|
||||
|
||||
switch (pfc1) {
|
||||
case 1:
|
||||
zmiifer |= ZMII_FER_RMII << ZMII_FER_V(0);
|
||||
zmiifer |= ZMII_FER_RMII << ZMII_FER_V(1);
|
||||
zmiifer |= ZMII_FER_RMII << ZMII_FER_V(2);
|
||||
zmiifer |= ZMII_FER_RMII << ZMII_FER_V(3);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_ZMII;
|
||||
break;
|
||||
case 2:
|
||||
zmiifer = ZMII_FER_SMII << ZMII_FER_V(0);
|
||||
zmiifer = ZMII_FER_SMII << ZMII_FER_V(1);
|
||||
zmiifer = ZMII_FER_SMII << ZMII_FER_V(2);
|
||||
zmiifer = ZMII_FER_SMII << ZMII_FER_V(3);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_ZMII;
|
||||
break;
|
||||
case 3:
|
||||
zmiifer |= ZMII_FER_RMII << ZMII_FER_V(0);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V(2);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_NONE;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_RGMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_NONE;
|
||||
break;
|
||||
case 4:
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V(0);
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V(1);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V (2);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V (3);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_RGMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_RGMII;
|
||||
break;
|
||||
case 5:
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V (0);
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V (1);
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V (2);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V(3);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_RGMII;
|
||||
break;
|
||||
case 6:
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V (0);
|
||||
zmiifer |= ZMII_FER_SMII << ZMII_FER_V (1);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V(2);
|
||||
rmiifer |= RGMII_FER_RGMII << RGMII_FER_V(3);
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_RGMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_RGMII;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
zmiifer = ZMII_FER_MII << ZMII_FER_V(devnum);
|
||||
rmiifer = 0x0;
|
||||
bis->bi_phymode[0] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[1] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[2] = BI_PHYMODE_ZMII;
|
||||
bis->bi_phymode[3] = BI_PHYMODE_ZMII;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ensure we setup mdio for this devnum and ONLY this devnum */
|
||||
zmiifer |= (ZMII_FER_MDI) << ZMII_FER_V(devnum);
|
||||
|
||||
out32 (ZMII_FER, zmiifer);
|
||||
out32 (RGMII_FER, rmiifer);
|
||||
|
||||
return ((int)pfc1);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
{
|
||||
int i;
|
||||
@@ -187,6 +281,7 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
unsigned short devnum;
|
||||
unsigned short reg_short;
|
||||
sys_info_t sysinfo;
|
||||
int ethgroup;
|
||||
|
||||
EMAC_440GX_HW_PST hw_p = dev->priv;
|
||||
|
||||
@@ -262,17 +357,26 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
reg = 0;
|
||||
out32 (ZMII_FER, 0);
|
||||
udelay (100);
|
||||
out32 (ZMII_FER, ZMII_FER_MDI << ZMII_FER_V (devnum));
|
||||
out32 (ZMII_SSR, 0x11110000);
|
||||
/* reset emac so we have access to the phy */
|
||||
__asm__ volatile ("eieio");
|
||||
|
||||
out32 (EMAC_M0 + hw_p->hw_addr, EMAC_M0_SRST);
|
||||
__asm__ volatile ("eieio");
|
||||
|
||||
if ((devnum == 2) || (devnum == 3))
|
||||
#if defined(CONFIG_440_GX)
|
||||
ethgroup = ppc_440x_eth_setup_bridge(devnum, bis);
|
||||
#else
|
||||
if ((devnum == 0) || (devnum == 1)) {
|
||||
out32 (ZMII_FER, (ZMII_FER_SMII | ZMII_FER_MDI) << ZMII_FER_V (devnum));
|
||||
}
|
||||
else { /* ((devnum == 2) || (devnum == 3)) */
|
||||
out32 (ZMII_FER, ZMII_FER_MDI << ZMII_FER_V (devnum));
|
||||
out32 (RGMII_FER, ((RGMII_FER_RGMII << RGMII_FER_V (2)) |
|
||||
(RGMII_FER_RGMII << RGMII_FER_V (3))));
|
||||
}
|
||||
|
||||
#endif
|
||||
out32 (ZMII_SSR, ZMII_SSR_SP << ZMII_SSR_V(devnum));
|
||||
__asm__ volatile ("eieio");
|
||||
|
||||
/* reset emac so we have access to the phy */
|
||||
|
||||
out32 (EMAC_M0 + hw_p->hw_addr, EMAC_M0_SRST);
|
||||
__asm__ volatile ("eieio");
|
||||
|
||||
failsafe = 1000;
|
||||
@@ -325,6 +429,17 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
/* Reset the phy */
|
||||
miiphy_reset (reg);
|
||||
|
||||
#if defined(CONFIG_440_GX)
|
||||
#if defined(CONFIG_CIS8201_PHY)
|
||||
/*
|
||||
* Cicada 8201 PHY needs to have an extended register whacked
|
||||
* for RGMII mode.
|
||||
*/
|
||||
if ( ((devnum == 2) || (devnum ==3)) && (4 == ethgroup) ) {
|
||||
miiphy_write (reg, 23, 0x1200);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/* Start/Restart autonegotiation */
|
||||
phy_setup_aneg (reg);
|
||||
udelay (1000);
|
||||
@@ -332,7 +447,7 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
miiphy_read (reg, PHY_BMSR, ®_short);
|
||||
|
||||
/*
|
||||
* Wait if PHY is able of autonegotiation and autonegotiation is not complete
|
||||
* Wait if PHY is capable of autonegotiation and autonegotiation is not complete
|
||||
*/
|
||||
if ((reg_short & PHY_BMSR_AUTN_ABLE)
|
||||
&& !(reg_short & PHY_BMSR_AUTN_COMP)) {
|
||||
@@ -369,7 +484,7 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
|
||||
/* Set ZMII/RGMII speed according to the phy link speed */
|
||||
reg = in32 (ZMII_SSR);
|
||||
if (speed == 100)
|
||||
if ( (speed == 100) || (speed == 1000) )
|
||||
out32 (ZMII_SSR, reg | (ZMII_SSR_SP << ZMII_SSR_V (devnum)));
|
||||
else
|
||||
out32 (ZMII_SSR,
|
||||
@@ -537,8 +652,9 @@ static int ppc_440x_eth_init (struct eth_device *dev, bd_t * bis)
|
||||
mode_reg |= EMAC_M1_RFS_4K | EMAC_M1_TX_FIFO_2K;
|
||||
|
||||
/* set speed */
|
||||
/* TBS: do 1GbE */
|
||||
if (speed == _100BASET)
|
||||
if (speed == _1000BASET)
|
||||
mode_reg = mode_reg | EMAC_M1_MF_1000MBPS | EMAC_M1_IST;
|
||||
else if (speed == _100BASET)
|
||||
mode_reg = mode_reg | EMAC_M1_MF_100MBPS | EMAC_M1_IST;
|
||||
else
|
||||
mode_reg = mode_reg & ~0x00C00000; /* 10 MBPS */
|
||||
|
||||
+5
-5
@@ -70,17 +70,17 @@ int checkcpu (void)
|
||||
|
||||
get_sys_info(&sys_info);
|
||||
|
||||
#if CONFIG_405GP
|
||||
#ifdef CONFIG_405GP
|
||||
puts ("IBM PowerPC 405GP");
|
||||
if (pvr == PVR_405GPR_RB) {
|
||||
putc('r');
|
||||
}
|
||||
puts (" Rev. ");
|
||||
#endif
|
||||
#if CONFIG_405CR
|
||||
#ifdef CONFIG_405CR
|
||||
puts ("IBM PowerPC 405CR Rev. ");
|
||||
#endif
|
||||
#if CONFIG_405EP
|
||||
#ifdef CONFIG_405EP
|
||||
puts ("IBM PowerPC 405EP Rev. ");
|
||||
#endif
|
||||
switch (pvr) {
|
||||
@@ -89,7 +89,7 @@ int checkcpu (void)
|
||||
putc('B');
|
||||
break;
|
||||
case PVR_405GP_RC:
|
||||
#if CONFIG_405CR
|
||||
#ifdef CONFIG_405CR
|
||||
case PVR_405CR_RC:
|
||||
#endif
|
||||
putc('C');
|
||||
@@ -97,7 +97,7 @@ int checkcpu (void)
|
||||
case PVR_405GP_RD:
|
||||
putc('D');
|
||||
break;
|
||||
#if CONFIG_405GP
|
||||
#ifdef CONFIG_405GP
|
||||
case PVR_405GP_RE:
|
||||
putc('E');
|
||||
break;
|
||||
|
||||
+23
-6
@@ -170,9 +170,21 @@ int interrupt_init_cpu (unsigned *decrementer_count)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_440_GX)
|
||||
/* Take the GX out of compatibility mode
|
||||
* Travis Sawyer, 9 Mar 2004
|
||||
* NOTE: 440gx user manual inconsistency here
|
||||
* Compatibility mode and Ethernet Clock select are not
|
||||
* correct in the manual
|
||||
*/
|
||||
mfsdr(sdr_mfr, val);
|
||||
val &= ~0x10000000;
|
||||
mtsdr(sdr_mfr,val);
|
||||
|
||||
/* Enable UIC interrupts via UIC Base Enable Register */
|
||||
mtdcr(uicb0er, UICB0_ALL);
|
||||
mtdcr(uicb0cr, UICB0_ALL);
|
||||
mtdcr(uicb0sr, UICB0_ALL);
|
||||
mtdcr(uicb0er, 0x54000000);
|
||||
/* None are critical */
|
||||
mtdcr(uicb0cr, 0);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
@@ -194,11 +206,16 @@ void external_interrupt(struct pt_regs *regs)
|
||||
/* 440 GX uses base uic register */
|
||||
uic_msr = mfdcr(uicb0msr);
|
||||
|
||||
uic0_interrupt(0);
|
||||
uic1_interrupt(0);
|
||||
uic2_interrupt(0);
|
||||
if ( (UICB0_UIC0CI & uic_msr) || (UICB0_UIC0NCI & uic_msr) )
|
||||
uic0_interrupt(0);
|
||||
|
||||
mtdcr(uicb0sr, UICB0_ALL);
|
||||
if ( (UICB0_UIC1CI & uic_msr) || (UICB0_UIC1NCI & uic_msr) )
|
||||
uic1_interrupt(0);
|
||||
|
||||
if ( (UICB0_UIC2CI & uic_msr) || (UICB0_UIC2NCI & uic_msr) )
|
||||
uic2_interrupt(0);
|
||||
|
||||
mtdcr(uicb0sr, uic_msr);
|
||||
|
||||
return;
|
||||
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@
|
||||
#include <watchdog.h>
|
||||
#include "vecnum.h"
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
@@ -351,7 +351,7 @@ int serial_tstc ()
|
||||
/*#define asyncRxBufferport1 ACTING_UART0_BASE+0x00 */
|
||||
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
/*-----------------------------------------------------------------------------+
|
||||
| Fifo
|
||||
+-----------------------------------------------------------------------------*/
|
||||
@@ -637,7 +637,7 @@ int serial_tstc ()
|
||||
}
|
||||
|
||||
|
||||
#if CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
|
||||
|
||||
void serial_isr (void *arg)
|
||||
{
|
||||
|
||||
+3
-2
@@ -247,7 +247,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
||||
unsigned long temp1;
|
||||
unsigned long lfdiv;
|
||||
unsigned long m;
|
||||
|
||||
unsigned long prbdv0;
|
||||
|
||||
/* Extract configured divisors */
|
||||
mfsdr( sdr_sdstp0,strp0 );
|
||||
@@ -263,6 +263,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
||||
sysInfo->pllOpbDiv = temp ? temp : 4;
|
||||
temp = (strp1 & PLLSYS1_PERCLK_DIV_MASK) >> 24;
|
||||
sysInfo->pllExtBusDiv = temp ? temp : 4;
|
||||
prbdv0 = (strp0 >> 2) & 0x7;
|
||||
|
||||
/* Calculate 'M' based on feedback source */
|
||||
temp = (strp0 & PLLSYS0_SEL_MASK) >> 27;
|
||||
@@ -284,7 +285,7 @@ void get_sys_info (sys_info_t * sysInfo)
|
||||
/* Now calculate the individual clocks */
|
||||
sysInfo->freqVCOMhz = (m * CONFIG_SYS_CLK_FREQ) + (m>>1);
|
||||
sysInfo->freqProcessor = sysInfo->freqVCOMhz/sysInfo->pllFwdDivA;
|
||||
sysInfo->freqPLB = sysInfo->freqVCOMhz/sysInfo->pllFwdDivB;
|
||||
sysInfo->freqPLB = sysInfo->freqVCOMhz/sysInfo->pllFwdDivB/prbdv0;
|
||||
sysInfo->freqOPB = sysInfo->freqPLB/sysInfo->pllOpbDiv;
|
||||
sysInfo->freqEPB = sysInfo->freqOPB/sysInfo->pllExtBusDiv;
|
||||
|
||||
|
||||
+9
-10
@@ -71,16 +71,15 @@ _armboot_start:
|
||||
.word _start
|
||||
|
||||
/*
|
||||
* Note: _armboot_end_data and _armboot_end are defined
|
||||
* by the (board-dependent) linker script.
|
||||
* _armboot_end_data is the first usable FLASH address after armboot
|
||||
* These are defined in the board-specific linker script.
|
||||
*/
|
||||
.globl _armboot_end_data
|
||||
_armboot_end_data:
|
||||
.word armboot_end_data
|
||||
.globl _armboot_end
|
||||
_armboot_end:
|
||||
.word armboot_end
|
||||
.globl _bss_start
|
||||
_bss_start:
|
||||
.word __bss_start
|
||||
|
||||
.globl _bss_end
|
||||
_bss_end:
|
||||
.word _end
|
||||
|
||||
#ifdef CONFIG_USE_IRQ
|
||||
/* IRQ stack memory (calculated at run-time) */
|
||||
@@ -130,7 +129,7 @@ relocate: /* relocate U-Boot to RAM */
|
||||
beq stack_setup
|
||||
|
||||
ldr r2, _armboot_start
|
||||
ldr r3, _armboot_end
|
||||
ldr r3, _bss_start
|
||||
sub r2, r3, r2 /* r2 <- size of armboot */
|
||||
add r2, r0, r2 /* r2 <- source end address */
|
||||
|
||||
|
||||
@@ -218,3 +218,24 @@ 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;
|
||||
}
|
||||
+4
-4
@@ -66,7 +66,7 @@ void serial_setbrg (void)
|
||||
Ser1UTCR1 = 0;
|
||||
Ser1UTCR2 = (u32)reg;
|
||||
Ser1UTCR3 = ( UTCR3_RXE | UTCR3_TXE );
|
||||
#elif CONFIG_SERIAL3
|
||||
#elif defined(CONFIG_SERIAL3)
|
||||
/* Wait until port is ready ... */
|
||||
while (Ser3UTSR1 & UTSR1_TBY) {
|
||||
}
|
||||
@@ -107,7 +107,7 @@ void serial_putc (const char c)
|
||||
while ((Ser1UTSR0 & UTSR0_TFS) == 0);
|
||||
|
||||
Ser1UTDR = c;
|
||||
#elif CONFIG_SERIAL3
|
||||
#elif defined(CONFIG_SERIAL3)
|
||||
/* wait for room in the tx FIFO on SERIAL3 */
|
||||
while ((Ser3UTSR0 & UTSR0_TFS) == 0);
|
||||
|
||||
@@ -128,7 +128,7 @@ int serial_tstc (void)
|
||||
{
|
||||
#ifdef CONFIG_SERIAL1
|
||||
return Ser1UTSR1 & UTSR1_RNE;
|
||||
#elif CONFIG_SERIAL3
|
||||
#elif defined(CONFIG_SERIAL3)
|
||||
return Ser3UTSR1 & UTSR1_RNE;
|
||||
#endif
|
||||
}
|
||||
@@ -144,7 +144,7 @@ int serial_getc (void)
|
||||
while (!(Ser1UTSR1 & UTSR1_RNE));
|
||||
|
||||
return (char) Ser1UTDR & 0xff;
|
||||
#elif CONFIG_SERIAL3
|
||||
#elif defined(CONFIG_SERIAL3)
|
||||
while (!(Ser3UTSR1 & UTSR1_RNE));
|
||||
|
||||
return (char) Ser3UTDR & 0xff;
|
||||
|
||||
+26
-5
@@ -44,7 +44,11 @@
|
||||
*/
|
||||
void dev_print (block_dev_desc_t *dev_desc)
|
||||
{
|
||||
ulong lba512; /* number of blocks if 512bytes block size */
|
||||
#ifdef CONFIG_LBA48
|
||||
uint64_t lba512; /* number of blocks if 512bytes block size */
|
||||
#else
|
||||
lbaint_t lba512;
|
||||
#endif
|
||||
|
||||
if (dev_desc->type==DEV_TYPE_UNKNOWN) {
|
||||
puts ("not available\n");
|
||||
@@ -82,9 +86,15 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
puts ("\n");
|
||||
if ((dev_desc->lba * dev_desc->blksz)>0L) {
|
||||
ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem;
|
||||
lbaint_t lba;
|
||||
#ifdef CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
lba = dev_desc->lba48;
|
||||
else
|
||||
#endif
|
||||
lba = dev_desc->lba;
|
||||
|
||||
lba512 = (dev_desc->lba * (dev_desc->blksz/512));
|
||||
|
||||
lba512 = (lba * (dev_desc->blksz/512));
|
||||
mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */
|
||||
/* round to 1 digit */
|
||||
mb_quot = mb / 10;
|
||||
@@ -93,12 +103,23 @@ void dev_print (block_dev_desc_t *dev_desc)
|
||||
gb = mb / 1024;
|
||||
gb_quot = gb / 10;
|
||||
gb_rem = gb - (10 * gb_quot);
|
||||
|
||||
#ifdef CONFIG_LBA48
|
||||
if (dev_desc->lba48support)
|
||||
printf (" Supports 48-bit addressing\n");
|
||||
#endif
|
||||
#if defined(CFG_64BIT_LBA) && defined(CFG_64BIT_VSPRINTF)
|
||||
printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%qd x %ld)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
lba,
|
||||
dev_desc->blksz);
|
||||
#else
|
||||
printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
dev_desc->lba,
|
||||
(ulong)lba,
|
||||
dev_desc->blksz);
|
||||
#endif
|
||||
} else {
|
||||
puts (" Capacity: not available\n");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
|
||||
SSV ADNP/ESC1 Embedded Softcore Computing
|
||||
Nios Softcore, Altera Cyclone FPGA
|
||||
|
||||
Last Update: February 27, 2004
|
||||
====================================================================
|
||||
|
||||
This file contains information regarding U-Boot and the SSV Embedded
|
||||
Nios Softcore Computing platform ADNP/ESC1. For general Nios
|
||||
information see doc/README.nios.
|
||||
|
||||
Most stuff of this file was borrowed and based on README.dk1s10,
|
||||
the Altera DK-1S10 related information file.
|
||||
|
||||
For those interested in contributing ... see HELP WANTED section
|
||||
in doc/README.nios.
|
||||
|
||||
Contents:
|
||||
|
||||
1. Files
|
||||
2. Memory Organization
|
||||
3. CPU Variations
|
||||
4. Examples
|
||||
5. Programming U-Boot into FLASH with GERMS
|
||||
6. Autoboot
|
||||
7. U-Boot environment convention and update philosophy
|
||||
|
||||
====================================================================
|
||||
|
||||
1. Files
|
||||
=========
|
||||
board/ssv/adnpesc1/*
|
||||
include/configs/ADNPESC1.h
|
||||
include/configs/ADNPESC1_base_32.h
|
||||
|
||||
|
||||
2. Memory Organization
|
||||
=======================
|
||||
|
||||
For the most part, you can put things pretty much anywhere.
|
||||
This is pretty flexible for Nios. So here we make some arbitrary
|
||||
choices & assume that the monitor is placed at the end of a memory
|
||||
resource. So you must make sure TEXT_BASE is chosen appropriately.
|
||||
This is very important if you plan to move your memory to another
|
||||
place as configured at this time!
|
||||
|
||||
-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).
|
||||
|
||||
(see doc/README.adnpesc1_base32 too)
|
||||
|
||||
|
||||
3. CPU Variations
|
||||
=================
|
||||
|
||||
There are more than one NIOS CPU variation for the ADNP/ESC1 possible.
|
||||
U-Boot supports the following CPU configurations:
|
||||
|
||||
- SSV Basis 32 (make ADNPESC1_base_32_config)
|
||||
- SSV Basis 32 at DNP evaluation base board 2
|
||||
(make ADNPESC1_DNPEVA2_base_32_config)
|
||||
|
||||
|
||||
4. Examples
|
||||
============
|
||||
|
||||
The hello_world example works fine. To try out you have to change
|
||||
the default load address from 0x0100_0000 to 0x0204_0000 in
|
||||
examples/Makefile (the real SDRAM for default board configuration).
|
||||
|
||||
|
||||
5. Programming U-Boot into FLASH with GERMS
|
||||
============================================
|
||||
|
||||
The current version of the ADNP/ESC1 port with the default
|
||||
configuration settings occupies about 97 KBytes of flash.
|
||||
A minimal configuration occupies less than 70 KByte
|
||||
(network, SPI, POST and board command support disabled). You
|
||||
can save more memory by deactivating the Hu-Shell support and
|
||||
long command help (CFG_HUSH_PARSER, CFG_LONGHELP).
|
||||
|
||||
To program U-Boot into the ADNP/ESC1 flash using GERMS do the
|
||||
following:
|
||||
|
||||
1. Download U-Boot to its target run space in SDRAM:
|
||||
|
||||
a. Close jumper RCM_EN# and push the reset button.
|
||||
|
||||
b. From the command line, download U-Boot using the
|
||||
nios-run:
|
||||
|
||||
$ nios-run -r u-boot.srec
|
||||
|
||||
NOTE: In some cases this want fail. I don't know why,
|
||||
but try again.
|
||||
|
||||
This takes about 1 minute (GERMS is not very speedy here).
|
||||
After u-boot is downloaded it will be executed. You should
|
||||
see the following:
|
||||
|
||||
U-Boot 1.0.2 (Jan 30 2004 - 12:59:15)
|
||||
|
||||
CPU: Nios-32 Rev. 3.3 (0x3038)
|
||||
Reg file size: 512 LO_LIMIT/HI_LIMIT: 1/30
|
||||
Board: SSV DilNetPC ADNP/ESC1
|
||||
Conf.: SSV Base 32 (nios_32)
|
||||
In: serial
|
||||
Out: serial
|
||||
Err: serial
|
||||
ADNPESC1 >
|
||||
|
||||
|
||||
2. Quit nios-run and start your terminal application (e.g. start
|
||||
Hyperterminal or minicom).
|
||||
|
||||
3. Download the u-boot code to RAM. When using Hyperterminal, do the
|
||||
following:
|
||||
|
||||
a. From the u-boot command prompt start a binary download to SDRAM:
|
||||
|
||||
at the SSV Basis 32 to SDRAM:
|
||||
|
||||
==> loadb 2000100
|
||||
|
||||
b. Download u-boot.bin using kermit.
|
||||
|
||||
4. From the U-Boot command prompt, erase flash:
|
||||
|
||||
at the SSV Basis 32 from 0x1000000 to 0x103ffff:
|
||||
|
||||
==> protect off 1:0-3
|
||||
==> erase 1:0-3
|
||||
|
||||
5. Copy the binary image from SDRAM to flash:
|
||||
|
||||
at the SSV Basis 32 from SDRAM:
|
||||
|
||||
==> cp.b 2000100 1000000 $filesize
|
||||
|
||||
U-Boot will now automatically start when the board is powered on or
|
||||
reset using the SSV Basis 32 configuration without closed RCM jumper.
|
||||
To start U-Boot with closed RCM Jumper, enter the following GERMS
|
||||
command:
|
||||
|
||||
+ g 1000000
|
||||
|
||||
|
||||
6. Autoboot
|
||||
===========
|
||||
|
||||
U-Boot will try to boot a valid Nios application from Flash. For this
|
||||
it will use the deposited Hu-Shell script in environment variable
|
||||
'bootcmd' which is looking for a valid Nios application identifier
|
||||
string in Flash and go on at even its entry address. For more
|
||||
information see the next chapter.
|
||||
|
||||
|
||||
7. U-Boot environment convention and update philosophy
|
||||
======================================================
|
||||
|
||||
U-Boot for the SSV ADNP/ESC1 target knows about many environment
|
||||
variables used to control the startup process, update process for
|
||||
raw Nios applications, and optionally file system image updates.
|
||||
In default configuration there are two Hu-Shell scripts to update
|
||||
the Nios application and/or the file system image:
|
||||
|
||||
1. Update Nios application (ex. the uCLinux kernel):
|
||||
|
||||
run 'appl_update'
|
||||
|
||||
2. Update optional file system image (ex. RomFS image used by uCLinux):
|
||||
|
||||
run 'fs_update'
|
||||
|
||||
The Nios application can be any programm code generated in relation
|
||||
to the Nios application identifier -- the string "Nios" at offset
|
||||
address 0x0c. To use the scripts like described above in a secure way
|
||||
you have to check-up the next environment variables:
|
||||
|
||||
1. update_allowed
|
||||
|
||||
- Update switch -- must be set to '1' (one) to allow any update
|
||||
- default is '0' (zero)
|
||||
|
||||
NOTE: You should avoid to save this variable with non zero
|
||||
value to Flash. Otherwise it would be allow any
|
||||
update process at any time!
|
||||
|
||||
2. appl_entry_addr
|
||||
|
||||
- Nios application area start address (usually in Flash)
|
||||
- this is the startup address for autoboot
|
||||
- each Nios application code we want to update will be copied
|
||||
to this address
|
||||
- default is CFG_ADNPESC1_NIOS_APPL_ENTRY
|
||||
|
||||
3. appl_end_addr
|
||||
|
||||
- Nios application area end address (usually in Flash)
|
||||
- will be used to unprotect/erase the Flash area while updating
|
||||
- default is CFG_ADNPESC1_NIOS_APPL_END
|
||||
|
||||
4. appl_ident_addr
|
||||
|
||||
- address of the Nios application identification string
|
||||
- this is the address checked-up by autoboot
|
||||
- default is CFG_ADNPESC1_NIOS_APPL_IDENT
|
||||
|
||||
5. appl_ident_str
|
||||
|
||||
- the Nios application identification string itself
|
||||
- default is CFG_ADNPESC1_NIOS_IDENTIFIER
|
||||
|
||||
6. appl_name
|
||||
|
||||
- name of file we have to download/update
|
||||
- default is ADNPESC1/base32/linux.bin
|
||||
|
||||
7. fs_base_addr
|
||||
|
||||
- optionally file system area start address (usually in Flash)
|
||||
- each file system we want to update will be copied to this address
|
||||
- default is CFG_ADNPESC1_FILESYSTEM_BASE
|
||||
|
||||
8. fs_end_addr
|
||||
|
||||
- optionally file system area end address (usually in Flash)
|
||||
- will be used to unprotect/erase the Flash area while updating
|
||||
- default is CFG_ADNPESC1_FILESYSTEM_END
|
||||
|
||||
9. fs_name
|
||||
|
||||
- name of file we have to download/update
|
||||
- default is ADNPESC1/base32/romfs.img
|
||||
@@ -0,0 +1,469 @@
|
||||
|
||||
TODO: specify IDE i/f
|
||||
|
||||
|
||||
===============================================================================
|
||||
C P U , M E M O R Y , I N / O U T C O M P O N E N T S
|
||||
===============================================================================
|
||||
see also [1]-[5]
|
||||
|
||||
CPU: "DNP_ESC1"
|
||||
32 bit NIOS for 50 MHz
|
||||
512 Byte for register file (30 levels)
|
||||
with out instruction cache
|
||||
with out data cache
|
||||
2 KByte On Chip ROM with GERMS boot monitor
|
||||
with out On Chip RAM
|
||||
MSTEP multiplier
|
||||
no Debug Core
|
||||
no On Chip Instrumentation (OCI)
|
||||
|
||||
U-Boot CFG: CFG_NIOS_CPU_CLK = 50000000
|
||||
CFG_NIOS_CPU_ICACHE = (not present)
|
||||
CFG_NIOS_CPU_DCACHE = (not present)
|
||||
CFG_NIOS_CPU_REG_NUMS = 512
|
||||
CFG_NIOS_CPU_MUL = 0
|
||||
CFG_NIOS_CPU_MSTEP = 1
|
||||
CFG_NIOS_CPU_DBG_CORE = 0
|
||||
|
||||
IRQ: Nr. | used by
|
||||
------+--------------------------------------------------------
|
||||
16 | TIMER0 | CFG_NIOS_CPU_TIMER0_IRQ = 16
|
||||
17 | UART0 | CFG_NIOS_CPU_UART0_IRQ = 17
|
||||
18 | UART1 | CFG_NIOS_CPU_UART1_IRQ = 18
|
||||
20 | LAN91C111 | CFG_NIOS_CPU_LAN0_IRQ =
|
||||
| PIO6 | CFG_NIOS_CPU_PIO6_IRQ = 20
|
||||
25 | SPI0 | CFG_NIOS_CPU_SPI0_IRQ = 25
|
||||
31 | PIO7 | CFG_NIOS_CPU_PIO7_IRQ = 31
|
||||
32 | PIO8 | CFG_NIOS_CPU_PIO8_IRQ = 32
|
||||
33 | PIO9 | CFG_NIOS_CPU_PIO9_IRQ = 33
|
||||
34 | PIO10 | CFG_NIOS_CPU_PIO10_IRQ = 34
|
||||
35 | PIO11 | CFG_NIOS_CPU_PIO11_IRQ = 35
|
||||
36 | PIO12 | CFG_NIOS_CPU_PIO12_IRQ =
|
||||
| IDE0 | CFG_NIOS_CPU_IDE0_IRQ = 36
|
||||
37 | PIO13 | CFG_NIOS_CPU_PIO13_IRQ =
|
||||
| IDE1 | CFG_NIOS_CPU_IDE1_IRQ = 37
|
||||
|
||||
MEMORY: 8 MByte Flash
|
||||
16 MByte SDRAM
|
||||
|
||||
Timer: TIMER0: high priority programmable timer (IRQ16)
|
||||
|
||||
U-Boot CFG: CFG_NIOS_CPU_TICK_TIMER = 0
|
||||
CFG_NIOS_CPU_USER_TIMER = (not present)
|
||||
|
||||
PIO: Nr. | description
|
||||
------+--------------------------------------------------------
|
||||
PIO0 | PORTA: 8 in/outputs for general purpose usage
|
||||
PIO1 | PORTB: 8 in/outputs for general purpose usage
|
||||
PIO2 | PORTC: 4 in/outputs for general purpose usage
|
||||
PIO3 | RCM: 1 input for RCM_EN# jumper (Req.Conf.Mon.)
|
||||
PIO4 | WDTENA: 1 output to enable the on-board watchdog
|
||||
PIO5 | WDTTRIG: 1 output to trigger the on-board watchdog
|
||||
PIO6 | LAN0INT: 1 input for LAN91C111 irq input (IRQ20)
|
||||
PIO7 | INT1: 1 input for general purpose irq (IRQ31)
|
||||
PIO8 | INT2: 1 input for general purpose irq (IRQ32)
|
||||
PIO9 | INT3: 1 input for general purpose irq (IRQ33)
|
||||
PIO10| INT4: 1 input for general purpose irq (IRQ34)
|
||||
PIO11| INT5: 1 input for general purpose irq (IRQ35)
|
||||
PIO12| INT6: 1 input for general purpose irq (IRQ36)
|
||||
| IDE0INT: (same) for IDE0 irq input
|
||||
PIO13| INT7: 1 input for general purpose irq (IRQ37)
|
||||
| IDE1INT: (same) for IDE1 irq input
|
||||
|
||||
U-Boot CFG: CFG_NIOS_CPU_PORTA_PIO = 0
|
||||
CFG_NIOS_CPU_PORTB_PIO = 1
|
||||
CFG_NIOS_CPU_PORTC_PIO = 2
|
||||
CFG_NIOS_CPU_RCM_PIO = 3
|
||||
CFG_NIOS_CPU_WDTENA_PIO = 4
|
||||
CFG_NIOS_CPU_WDTTRIG_PIO = 5
|
||||
CFG_NIOS_CPU_LED_PIO = (not present)
|
||||
|
||||
UART: UART0: fixed baudrate of 115200, fixed protocol 8N1, RTS/CTS (IRQ17)
|
||||
UART1: fixed baudrate of 115200, fixed protocol 8N1,
|
||||
without handshake RTS/CTS (IRQ18)
|
||||
|
||||
SPI: SPI0: master capable, 1 slave selectable, 250kHz target clock,
|
||||
2 usec targets delay between slave select and clock,
|
||||
data is transferred MSB-first / LSB-last (IRQ25)
|
||||
|
||||
LAN: SMsC LAN91C111 with:
|
||||
- without offset
|
||||
- data bus width 16 bit (on-board hard wired at 32 bit bus)
|
||||
- !!! 32 bit bus access --> each address * 2 !!!
|
||||
|
||||
IDE: (TODO)
|
||||
|
||||
|
||||
===============================================================================
|
||||
M E M O R Y M A P
|
||||
===============================================================================
|
||||
|
||||
- - - - - - - - - - - external extension - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
0x44000000 ---32-----------16|15------------0-
|
||||
| | | \
|
||||
: (real size : : |
|
||||
EXT3 (CS4) : and content : : > CFG_NIOS_CPU_CS3_SIZE
|
||||
: unknown) : : | = 0x01000000
|
||||
| | | /
|
||||
0x43000000 ---32-----------16|15------------0- CFG_NIOS_CPU_CS3_BASE
|
||||
| | | \
|
||||
: (real size : : |
|
||||
EXT2 (CS3) : and content : : > CFG_NIOS_CPU_CS2_SIZE
|
||||
: unknown) : : | = 0x01000000
|
||||
| | | /
|
||||
0x42000000 ---32-----------16|15------------0- CFG_NIOS_CPU_CS2_BASE
|
||||
| | | \
|
||||
: (real size : : |
|
||||
EXT1 (CS2) : and content : : > CFG_NIOS_CPU_CS1_SIZE
|
||||
: unknown) : : | = 0x01000000
|
||||
| | | /
|
||||
0x41000000 ---32-----------16|15------------0- CFG_NIOS_CPU_CS1_BASE
|
||||
| | | \
|
||||
: (real size : : |
|
||||
EXT0 (CS1) : and content : : > CFG_NIOS_CPU_CS0_SIZE
|
||||
: unknown) : : | = 0x01000000
|
||||
| | | /
|
||||
0x40000000 ---32-----------16|15------------0- CFG_NIOS_CPU_CS0_BASE
|
||||
| |
|
||||
: gap :
|
||||
: :
|
||||
|
||||
- - - - - - - - - - - external memory - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
: :
|
||||
: gap :
|
||||
| |
|
||||
0x03000000 ---32-----------16|15------------0- CFG_NIOS_CPU_STACK
|
||||
| . | \
|
||||
| . | | (U-Boot run-time system)
|
||||
| . | |
|
||||
| . | > CFG_MONITOR_LEN
|
||||
| . | | = 0x00040000
|
||||
| . | |
|
||||
| . | /
|
||||
0x02fc0000 --+32-----------16|15------------0+ TEXT_BASE
|
||||
| . | \
|
||||
| . | > CFG_MALLOC_LEN (heap)
|
||||
| . | /
|
||||
--+32-----------16|15------------0+
|
||||
| . | \
|
||||
| . | > CFG_GBL_DATA_SIZE (global)
|
||||
| . | /
|
||||
--+32-----------16|15------------0+ CFG_INIT_SP (u-boot stack)
|
||||
| . | \ \
|
||||
| . | | |
|
||||
| . | | > stack area
|
||||
| . | | |
|
||||
| . | | V
|
||||
| . | |
|
||||
| . | |
|
||||
SDRAM | . | > CFG_NIOS_CPU_SDRAM_SIZE
|
||||
| . | | = 0x01000000
|
||||
| . | |
|
||||
0x02000100 |- - - - - - - - - - - - - - - -+-|-
|
||||
| . | | \
|
||||
| . | | |
|
||||
| . | | > CFG_NIOS_CPU_VEC_SIZE
|
||||
| . | | | = 0x00000100
|
||||
| | / /
|
||||
0x02000000 |- - - - - - - - - - - - - - - -+- - CFG_NIOS_CPU_VEC_BASE
|
||||
0x02000000 ---32-----------16|15------------0- CFG_NIOS_CPU_SDRAM_BASE
|
||||
| | \
|
||||
: gap : > (space for 2nd Flash)
|
||||
| | /
|
||||
0x01800000 ---32-----------16|15------------0-
|
||||
| sector 127 | \
|
||||
+ 0x7f0000 |- - - - - - - - - - - - - - - -| |
|
||||
| : | |
|
||||
Flash |- - - - : - - - -| > CFG_NIOS_CPU_FLASH_SIZE
|
||||
| sector 1 : | | = 0x00800000
|
||||
+ 0x010000 |- - - - - - - - - - - - - - - -| |
|
||||
| sector 0 (size = 0x10000) | /
|
||||
0x01000000 ---8-------------4|3-------------0- CFG_NIOS_CPU_FLASH_BASE
|
||||
| |
|
||||
: gap :
|
||||
: :
|
||||
|
||||
- - - - - - - - - - - external i/o - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
: :
|
||||
: gap :
|
||||
| |
|
||||
0x00010020 ---32-----------16|15------------0-
|
||||
| | \
|
||||
| register bank | |
|
||||
| size = (real_size << 1) | |
|
||||
| real_size = 0x10 | |
|
||||
| +--------.---.---.--- | |
|
||||
| | bank 0 \ 1 \ 2 \ 3 \ | |
|
||||
| |---------------------------+ | |
|
||||
LAN91C111 | | BANK | RESERVED | | > na_enet_size
|
||||
| |- - - - - - -|- - - - - - -| | | = 0x00000020
|
||||
| | RPCR | MIR | | |
|
||||
| |- - - - - - -|- - - - - - -| | |
|
||||
| | COUNTER | RCR | | |
|
||||
| |- - - - - - -|- - - - - - -| | |
|
||||
| | EPH STATUS | TCR | | |
|
||||
| +---------------------------+ | /
|
||||
0x00010000 ---32-----------16|15------------0- CFG_NIOS_CPU_LAN0_BASE
|
||||
| |
|
||||
: gap :
|
||||
: :
|
||||
|
||||
- - - - - - - - - - - on chip i/o - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
: :
|
||||
: gap :
|
||||
| |
|
||||
0x00001040 ---32-----------16|15------------0-
|
||||
| | | \
|
||||
: : : |
|
||||
IDE1 i/f : : : > 0x00000020
|
||||
[5] : : : |
|
||||
| | | /
|
||||
0x00001020 ---32-----------16|15------------0- CFG_NIOS_CPU_IDE1
|
||||
| | | \
|
||||
: : : |
|
||||
IDE0 i/f : : : > 0x00000020
|
||||
[5] : : : |
|
||||
| | | /
|
||||
0x00001000 ---32-----------16|15------------0- CFG_NIOS_CPU_IDE0
|
||||
| |
|
||||
: gap :
|
||||
| |
|
||||
0x00000980 ---32-----------16|15------------0-
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO13 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000970 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO13
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO12 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000960 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO12
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO11 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000950 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO11
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO10 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000940 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO10
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO9 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000930 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO9
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO8 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000920 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO8
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO7 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000910 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO7
|
||||
| edgecapture (1 bit) (rw) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO6 | interruptmask (1 bit) (rw) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000900 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO6
|
||||
| |
|
||||
: gap :
|
||||
| |
|
||||
0x000008e0 ---32-----------16|15------------0-
|
||||
| (unused) | \
|
||||
+ 0x1c |- - - - - - - - - - - - - - - -| |
|
||||
| endofpacket (16 bit) (rw) | |
|
||||
+ 0x18 |- - - - - - - - - - - - - - - -| |
|
||||
| slaveselect (1 bit) (rw) | |
|
||||
+ 0x14 |- - - - - - - - - - - - - - - -| |
|
||||
SPI0 | (reserved) | |
|
||||
[4] + 0x10 |- - - - - - - - - - - - - - - -| > 0x00000020
|
||||
| control (11 bit) (rw) | |
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
| status (9 bit) (rw) | |
|
||||
+ 0x08 |- - - - - - - - - - - - - - - -| |
|
||||
| txdata (16 bit) (wo) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| rxdata (16 bit) (ro) | /
|
||||
0x000008c0 ---32-----------16|15------------0- CFG_NIOS_CPU_SPI0
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO5 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (wo) | /
|
||||
0x000008b0 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO5
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO4 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (wo) | /
|
||||
0x000008a0 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO4
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO3 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| (unused) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (1 bit) (ro) | /
|
||||
0x00000890 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO3
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO2 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| direction (4 bit) (rw) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (4 bit) (rw) | /
|
||||
0x00000880 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO2
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO1 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| direction (8 bit) (rw) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (8 bit) (rw) | /
|
||||
0x00000870 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO1
|
||||
| (unused) | \
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
PIO0 | (unused) | |
|
||||
[3] + 0x08 |- - - - - - - - - - - - - - - -| > 0x00000010
|
||||
| direction (8 bit) (rw) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| data (8 bit) (rw) | /
|
||||
0x00000860 ---32-----------16|15------------0- CFG_NIOS_CPU_PIO0
|
||||
| (unused) | \
|
||||
+ 0x1c |- - - - - - - - - - - - - - - -| |
|
||||
| (unused) | |
|
||||
+ 0x18 |- - - - - - - - - - - - - - - -| |
|
||||
| snaph (16 bit) (rw) | |
|
||||
+ 0x14 |- - - - - - - - - - - - - - - -| |
|
||||
TIMER0 | snapl (16 bit) (rw) | |
|
||||
[2] + 0x10 |- - - - - - - - - - - - - - - -| > 0x00000020
|
||||
| periodh (16 bit) (rw) | |
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
| periodl (16 bit) (rw) | |
|
||||
+ 0x08 |- - - - - - - - - - - - - - - -| |
|
||||
| control (4 bit) (rw) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| status (2 bit) (rw) | /
|
||||
0x00000840 ---32-----------16|15------------0- CFG_NIOS_CPU_TIMER0
|
||||
| (unused) | \
|
||||
+ 0x1c |- - - - - - - - - - - - - - - -| |
|
||||
| (unused) | |
|
||||
+ 0x18 |- - - - - - - - - - - - - - - -| |
|
||||
| (unused) | |
|
||||
+ 0x14 |- - - - - - - - - - - - - - - -| |
|
||||
UART1 | (unused) | > 0x00000020
|
||||
[1] + 0x10 |- - - - - - - - - - - - - - - -| |
|
||||
| control (10 bit) (rw) | |
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
| status (10 bit) (rw) | |
|
||||
+ 0x08 |- - - - - - - - - - - - - - - -| |
|
||||
| txdata (8 bit) (wo) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| rxdata (8 bit) (ro) | /
|
||||
0x00000820 ---32-----------16|15------------0- CFG_NIOS_CPU_UART1
|
||||
| (unused) | \
|
||||
+ 0x1c |- - - - - - - - - - - - - - - -| |
|
||||
| (unused) | |
|
||||
+ 0x18 |- - - - - - - - - - - - - - - -| |
|
||||
| (unused) | |
|
||||
+ 0x14 |- - - - - - - - - - - - - - - -| |
|
||||
UART0 | (unused) | > 0x00000020
|
||||
[1] + 0x10 |- - - - - - - - - - - - - - - -| |
|
||||
| control (10 bit) (rw) | |
|
||||
+ 0x0c |- - - - - - - - - - - - - - - -| |
|
||||
| status (10 bit) (rw) | |
|
||||
+ 0x08 |- - - - - - - - - - - - - - - -| |
|
||||
| txdata (8 bit) (wo) | |
|
||||
+ 0x04 |- - - - - - - - - - - - - - - -| |
|
||||
| rxdata (8 bit) (ro) | /
|
||||
0x00000800 ---32-----------16|15------------0- CFG_NIOS_CPU_UART0
|
||||
|
||||
- - - - - - - - - - - on chip memory 1 - - - - - - - - - - -
|
||||
|
||||
0x00000800 ---32-----------16|15------------0-
|
||||
| : | \
|
||||
| : | |
|
||||
GERMS | : | > CFG_NIOS_CPU_ROM_SIZE
|
||||
| : | | = 0x00000800
|
||||
| : | /
|
||||
0x00000000 |- - - - - - - - - - - - - - - -+- - CFG_NIOS_CPU_RST_VECT
|
||||
0x00000000 ---32-----------16|15------------0- CFG_NIOS_CPU_ROM_BASE
|
||||
|
||||
|
||||
===============================================================================
|
||||
F L A S H M E M O R Y A L L O C A T I O N
|
||||
===============================================================================
|
||||
|
||||
0x01800000 ---8-------------4|3-------------0-
|
||||
| : | \
|
||||
| : | |
|
||||
| : | > 6 MByte ROM FS
|
||||
| : | |
|
||||
| : | /
|
||||
0x01200000 --+- - - - - - - -:- - - - - - - -+- - file system image(s)
|
||||
| : | \
|
||||
| : | |
|
||||
| : | > 1728 kByte ucLinux
|
||||
| : | |
|
||||
| : | /
|
||||
0x01050000 --+- - - - - - - -:- - - - - - - -+- - os image(s)
|
||||
| : | \
|
||||
0x01040000 --+- - - - - - - -:- - - - - - - -+-|- u-boot environment
|
||||
| : | |
|
||||
| : | > 320 kByte U-Boot
|
||||
| : | |
|
||||
| : | |
|
||||
| : | /
|
||||
0x01000000 --+- - - - - - - -:- - - - - - - -+- - u-boot _start()
|
||||
0x01000000 ---8-------------4|3-------------0-
|
||||
|
||||
|
||||
===============================================================================
|
||||
R E F E R E N C E S
|
||||
===============================================================================
|
||||
[1] http://www.altera.com/literature/ds/ds_nios_uart.pdf
|
||||
[2] http://www.altera.com/literature/ds/ds_nios_timer.pdf
|
||||
[3] http://www.altera.com/literature/ds/ds_nios_pio.pdf
|
||||
[4] http://www.altera.com/literature/ds/ds_nios_spi.pdf
|
||||
[5] http://www.t13.org/index.html
|
||||
|
||||
|
||||
===============================================================================
|
||||
Stephan Linz <linz@li-pro.net>
|
||||
@@ -0,0 +1,73 @@
|
||||
IBM Ocotea Board
|
||||
|
||||
Last Update: March 2, 2004
|
||||
=======================================================================
|
||||
|
||||
This file contains some handy info regarding U-Boot and the IBM
|
||||
Ocotea 440gx evalutation board. See the README.ppc440 for additional
|
||||
information.
|
||||
|
||||
|
||||
SWITCH SETTINGS & JUMPERS
|
||||
==========================
|
||||
|
||||
Here's what I've been using successfully. If you feel inclined to
|
||||
change things ... please read the docs!
|
||||
|
||||
DIPSW U46 U80
|
||||
------------------------
|
||||
SW 1 off off
|
||||
SW 2 on off
|
||||
SW 3 off off
|
||||
SW 4 off off
|
||||
SW 5 off off
|
||||
SW 6 on on
|
||||
SW 7 on off
|
||||
SW 8 on off
|
||||
|
||||
J41: strapped
|
||||
J42: open
|
||||
|
||||
All others are factory default.
|
||||
|
||||
|
||||
I2C Information
|
||||
=====================
|
||||
|
||||
See README.ebony for information.
|
||||
|
||||
PCI
|
||||
===========================
|
||||
|
||||
Untested at the time of writing.
|
||||
|
||||
PPC440GX Ethernet EMACs
|
||||
===========================
|
||||
|
||||
All EMAC ports have been tested and are known to work
|
||||
with EPS Group 4.
|
||||
|
||||
Special note about the Cicada CIS8201:
|
||||
The CIS8201 Gigabit PHY comes up in GMII mode by default.
|
||||
One must hit an extended register to allow use of RGMII mode.
|
||||
This has been done in the 440gx_enet.c file with a #ifdef/endif
|
||||
pair.
|
||||
|
||||
IBM does not store the EMAC ethernet addresses within their PIBS bootloader.
|
||||
The addresses contained in the config header file are from my particular
|
||||
board and you _*should*_ change them to reflect your board either in the
|
||||
config file and/or in your environment variables. I found the addresses on
|
||||
labels on the bottom side of the board.
|
||||
|
||||
|
||||
BDI2k or JTAG Debugging
|
||||
===========================
|
||||
|
||||
For ease of debugging you can swap the small boot flash and external SRAM
|
||||
by changing U46:3 to on. You can then use the sram as your boot flash by
|
||||
loading the sram via the jtag debugger.
|
||||
|
||||
|
||||
Regards,
|
||||
--Travis
|
||||
<tsawyer@sandburst.com>
|
||||
+2
-1
@@ -38,7 +38,8 @@ OBJS = 3c589.o 5701rls.o ali512x.o \
|
||||
pcnet.o plb2800_eth.o \
|
||||
ps2ser.o ps2mult.o pc_keyb.o keyboard.o \
|
||||
rtl8019.o rtl8139.o \
|
||||
s3c24x0_i2c.o sed13806.o serial.o serial_max3100.o \
|
||||
s3c24x0_i2c.o sed13806.o \
|
||||
serial.o serial_max3100.o serial_pl011.o serial_pl010.o \
|
||||
smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \
|
||||
ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \
|
||||
usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o
|
||||
|
||||
+791
-515
File diff suppressed because it is too large.
Load diff
+41
-26
@@ -101,9 +101,14 @@
|
||||
#define AMD_CMD_WRITE 0xA0
|
||||
#define AMD_CMD_ERASE_START 0x80
|
||||
#define AMD_CMD_ERASE_SECTOR 0x30
|
||||
#define AMD_CMD_UNLOCK_START 0xAA
|
||||
#define AMD_CMD_UNLOCK_ACK 0x55
|
||||
|
||||
#define AMD_STATUS_TOGGLE 0x40
|
||||
#define AMD_STATUS_ERROR 0x20
|
||||
#define AMD_ADDR_ERASE_START 0x555
|
||||
#define AMD_ADDR_START 0x555
|
||||
#define AMD_ADDR_ACK 0x2AA
|
||||
|
||||
#define FLASH_OFFSET_CFI 0x55
|
||||
#define FLASH_OFFSET_CFI_RESP 0x10
|
||||
@@ -377,7 +382,8 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
|
||||
case CFI_CMDSET_AMD_STANDARD:
|
||||
case CFI_CMDSET_AMD_EXTENDED:
|
||||
flash_unlock_seq (info, sect);
|
||||
flash_write_cmd (info, sect, 0x555, AMD_CMD_ERASE_START);
|
||||
flash_write_cmd (info, sect, AMD_ADDR_ERASE_START,
|
||||
AMD_CMD_ERASE_START);
|
||||
flash_unlock_seq (info, sect);
|
||||
flash_write_cmd (info, sect, 0, AMD_CMD_ERASE_SECTOR);
|
||||
break;
|
||||
@@ -479,24 +485,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
#ifdef CFG_FLASH_USE_BUFFER_WRITE
|
||||
int buffered_size;
|
||||
#endif
|
||||
int x8mode = 0;
|
||||
|
||||
/* special handling of 16 bit devices in 8 bit mode */
|
||||
if ((info->interface == FLASH_CFI_X8X16)
|
||||
&& (info->chipwidth == FLASH_CFI_BY8)) {
|
||||
switch (info->vendor) {
|
||||
case CFI_CMDSET_INTEL_STANDARD:
|
||||
case CFI_CMDSET_INTEL_EXTENDED:
|
||||
x8mode = info->portwidth;
|
||||
info->portwidth >>= 1; /* XXX - Need to test on x9/x16 in parallel. */
|
||||
/*info->portwidth = FLASH_CFI_8BIT; */ /* XXX - Need to test on x9/x16 in parallel. */
|
||||
break;
|
||||
case CFI_CMDSET_AMD_STANDARD:
|
||||
case CFI_CMDSET_AMD_EXTENDED:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* get lower aligned address */
|
||||
/* get lower aligned address */
|
||||
wp = (addr & ~(info->portwidth - 1));
|
||||
@@ -560,10 +548,6 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
|
||||
flash_add_byte (info, &cword, (*(uchar *) cp));
|
||||
}
|
||||
|
||||
/* special handling of 16 bit devices in 8 bit mode */
|
||||
if (x8mode) {
|
||||
info->portwidth = x8mode;;
|
||||
}
|
||||
return flash_write_cfiword (info, wp, cword);
|
||||
}
|
||||
|
||||
@@ -724,18 +708,42 @@ static int flash_full_status_check (flash_info_t * info, flash_sect_t sector,
|
||||
*/
|
||||
static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
unsigned short w;
|
||||
unsigned int l;
|
||||
unsigned long long ll;
|
||||
#endif
|
||||
|
||||
switch (info->portwidth) {
|
||||
case FLASH_CFI_8BIT:
|
||||
cword->c = c;
|
||||
break;
|
||||
case FLASH_CFI_16BIT:
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
w = c;
|
||||
w <<= 8;
|
||||
cword->w = (cword->w >> 8) | w;
|
||||
#else
|
||||
cword->w = (cword->w << 8) | c;
|
||||
#endif
|
||||
break;
|
||||
case FLASH_CFI_32BIT:
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
l = c;
|
||||
l <<= 24;
|
||||
cword->l = (cword->l >> 8) | l;
|
||||
#else
|
||||
cword->l = (cword->l << 8) | c;
|
||||
#endif
|
||||
break;
|
||||
case FLASH_CFI_64BIT:
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
ll = c;
|
||||
ll <<= 56;
|
||||
cword->ll = (cword->ll >> 8) | ll;
|
||||
#else
|
||||
cword->ll = (cword->ll << 8) | c;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -823,8 +831,8 @@ static void flash_write_cmd (flash_info_t * info, flash_sect_t sect, uint offset
|
||||
|
||||
static void flash_unlock_seq (flash_info_t * info, flash_sect_t sect)
|
||||
{
|
||||
flash_write_cmd (info, sect, 0x555, 0xAA);
|
||||
flash_write_cmd (info, sect, 0x2AA, 0x55);
|
||||
flash_write_cmd (info, sect, AMD_ADDR_START, AMD_CMD_UNLOCK_START);
|
||||
flash_write_cmd (info, sect, AMD_ADDR_ACK, AMD_CMD_UNLOCK_ACK);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
@@ -1054,6 +1062,9 @@ static ulong flash_get_size (ulong base, int banknum)
|
||||
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;
|
||||
if ((info->interface == FLASH_CFI_X8X16) && (info->chipwidth == FLASH_CFI_BY8)) {
|
||||
info->portwidth >>= 1; /* XXX - Need to test on x8/x16 in parallel. */
|
||||
}
|
||||
}
|
||||
|
||||
flash_write_cmd (info, 0, 0, FLASH_CMD_RESET);
|
||||
@@ -1107,7 +1118,7 @@ static int flash_write_cfiword (flash_info_t * info, ulong dest,
|
||||
case CFI_CMDSET_AMD_EXTENDED:
|
||||
case CFI_CMDSET_AMD_STANDARD:
|
||||
flash_unlock_seq (info, 0);
|
||||
flash_write_cmd (info, 0, 0x555, AMD_CMD_WRITE);
|
||||
flash_write_cmd (info, 0, AMD_ADDR_START, AMD_CMD_WRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1158,6 +1169,10 @@ static int flash_write_cfibuffer (flash_info_t * info, ulong dest, uchar * cp,
|
||||
int retcode;
|
||||
volatile cfiptr_t src;
|
||||
volatile cfiptr_t dst;
|
||||
/* buffered writes in the AMD chip set is not supported yet */
|
||||
if((info->vendor == CFI_CMDSET_AMD_STANDARD) ||
|
||||
(info->vendor == CFI_CMDSET_AMD_EXTENDED))
|
||||
return ERR_INVAL;
|
||||
|
||||
src.cp = cp;
|
||||
dst.cp = (uchar *) dest;
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
#define CS8900_OFF 0x02
|
||||
#define CS8900_BUS16_0 *(volatile u8 *)(CS8900_BASE+0x00)
|
||||
#define CS8900_BUS16_1 *(volatile u8 *)(CS8900_BASE+0x01)
|
||||
#elif CS8900_BUS32
|
||||
#elif defined(CS8900_BUS32)
|
||||
/* 32 bit aligned registers, 16 bit wide (we ignore upper 16 bits) */
|
||||
#define CS8900_REG u32
|
||||
#define CS8900_OFF 0x04
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
|
||||
|
||||
for (hose = hose_head; hose; hose = hose->next)
|
||||
{
|
||||
#if CFG_SCSI_SCAN_BUS_REVERSE
|
||||
#ifdef CFG_SCSI_SCAN_BUS_REVERSE
|
||||
for (bus = hose->last_busno; bus >= hose->first_busno; bus--)
|
||||
#else
|
||||
for (bus = hose->first_busno; bus <= hose->last_busno; bus++)
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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
|
||||
*/
|
||||
|
||||
/* Simple U-Boot driver for the PrimeCell PL011 UARTs on the IntegratorCP */
|
||||
/* Should be fairly simple to make it work with the PL010 as well */
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#ifdef CFG_PL010_SERIAL
|
||||
|
||||
#include "serial_pl011.h"
|
||||
|
||||
#define IO_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (val))
|
||||
#define IO_READ(addr) (*(volatile unsigned int *)(addr))
|
||||
|
||||
/* Integrator AP has two UARTs, we use the first one, at 38400-8-N-1 */
|
||||
#define NUM_PORTS 2
|
||||
#define CONSOLE_PORT CONFIG_CONS_INDEX
|
||||
#define baudRate CONFIG_BAUDRATE
|
||||
static volatile unsigned char *const port[NUM_PORTS] = {
|
||||
(void *) (CFG_SERIAL0),
|
||||
(void *) (CFG_SERIAL1)
|
||||
};
|
||||
|
||||
|
||||
static void pl010_putc (int portnum, char c);
|
||||
static int pl010_getc (int portnum);
|
||||
static int pl010_tstc (int portnum);
|
||||
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
unsigned int divisor;
|
||||
|
||||
/*
|
||||
** First, disable everything.
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL010_CR, 0x0);
|
||||
|
||||
/*
|
||||
** Set baud rate
|
||||
**
|
||||
*/
|
||||
switch (baudRate) {
|
||||
case 9600:
|
||||
divisor = UART_PL010_BAUD_9600;
|
||||
break;
|
||||
|
||||
case 19200:
|
||||
divisor = UART_PL010_BAUD_9600;
|
||||
break;
|
||||
|
||||
case 38400:
|
||||
divisor = UART_PL010_BAUD_38400;
|
||||
break;
|
||||
|
||||
case 57600:
|
||||
divisor = UART_PL010_BAUD_57600;
|
||||
break;
|
||||
|
||||
case 115200:
|
||||
divisor = UART_PL010_BAUD_115200;
|
||||
break;
|
||||
|
||||
default:
|
||||
divisor = UART_PL010_BAUD_38400;
|
||||
}
|
||||
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL010_LCRM,
|
||||
((divisor & 0xf00) >> 8));
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL010_LCRL, (divisor & 0xff));
|
||||
|
||||
/*
|
||||
** Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled.
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL010_LCRH,
|
||||
(UART_PL010_LCRH_WLEN_8 | UART_PL010_LCRH_FEN));
|
||||
|
||||
/*
|
||||
** Finally, enable the UART
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL010_CR, (UART_PL010_CR_UARTEN));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
if (c == '\n')
|
||||
pl010_putc (CONSOLE_PORT, '\r');
|
||||
|
||||
pl010_putc (CONSOLE_PORT, c);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc (void)
|
||||
{
|
||||
return pl010_getc (CONSOLE_PORT);
|
||||
}
|
||||
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return pl010_tstc (CONSOLE_PORT);
|
||||
}
|
||||
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void pl010_putc (int portnum, char c)
|
||||
{
|
||||
/* Wait until there is space in the FIFO */
|
||||
while (IO_READ (port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_TXFF);
|
||||
|
||||
/* Send the character */
|
||||
IO_WRITE (port[portnum] + UART_PL01x_DR, c);
|
||||
}
|
||||
|
||||
static int pl010_getc (int portnum)
|
||||
{
|
||||
unsigned int data;
|
||||
|
||||
/* Wait until there is data in the FIFO */
|
||||
while (IO_READ (port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE);
|
||||
|
||||
data = IO_READ (port[portnum] + UART_PL01x_DR);
|
||||
|
||||
/* Check for an error flag */
|
||||
if (data & 0xFFFFFF00) {
|
||||
/* Clear the error */
|
||||
IO_WRITE (port[portnum] + UART_PL01x_ECR, 0xFFFFFFFF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (int) data;
|
||||
}
|
||||
|
||||
static int pl010_tstc (int portnum)
|
||||
{
|
||||
return !(IO_READ (port[portnum] + UART_PL01x_FR) &
|
||||
UART_PL01x_FR_RXFE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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
|
||||
*/
|
||||
|
||||
/* Simple U-Boot driver for the PrimeCell PL011 UARTs on the IntegratorCP */
|
||||
/* Should be fairly simple to make it work with the PL010 as well */
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#ifdef CFG_PL011_SERIAL
|
||||
|
||||
#include "serial_pl011.h"
|
||||
|
||||
#define IO_WRITE(addr, val) (*(volatile unsigned int *)(addr) = (val))
|
||||
#define IO_READ(addr) (*(volatile unsigned int *)(addr))
|
||||
|
||||
/*
|
||||
* IntegratorCP has two UARTs, use the first one, at 38400-8-N-1
|
||||
* Versatile PB has four UARTs.
|
||||
*/
|
||||
#define NUM_PORTS 2
|
||||
#define CONSOLE_PORT CONFIG_CONS_INDEX
|
||||
#define baudRate CONFIG_BAUDRATE
|
||||
static volatile unsigned char *const port[NUM_PORTS] = {
|
||||
(void *) (CFG_SERIAL0),
|
||||
(void *) (CFG_SERIAL1)
|
||||
};
|
||||
|
||||
|
||||
static void pl011_putc (int portnum, char c);
|
||||
static int pl011_getc (int portnum);
|
||||
static int pl011_tstc (int portnum);
|
||||
|
||||
|
||||
int serial_init (void)
|
||||
{
|
||||
unsigned int temp;
|
||||
unsigned int divider;
|
||||
unsigned int remainder;
|
||||
unsigned int fraction;
|
||||
|
||||
/*
|
||||
** First, disable everything.
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL011_CR, 0x0);
|
||||
|
||||
/*
|
||||
** Set baud rate
|
||||
**
|
||||
** IBRD = UART_CLK / (16 * BAUD_RATE)
|
||||
** FBRD = ROUND((64 * MOD(UART_CLK,(16 * BAUD_RATE))) / (16 * BAUD_RATE))
|
||||
*/
|
||||
#ifdef CONFIG_VERSATILE
|
||||
temp = 16 * baudRate;
|
||||
divider = 24000000 / temp;
|
||||
remainder = 24000000 % temp;
|
||||
temp = (8 * remainder) / baudRate;
|
||||
fraction = (temp >> 1) + (temp & 1);
|
||||
#endif
|
||||
#ifdef CONFIG_INTEGRATOR
|
||||
temp = 16 * baudRate;
|
||||
divider = 14745600 / temp;
|
||||
remainder = 14745600 % temp;
|
||||
temp = (8 * remainder) / baudRate;
|
||||
fraction = (temp >> 1) + (temp & 1);
|
||||
#endif
|
||||
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL011_IBRD, divider);
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL011_FBRD, fraction);
|
||||
|
||||
/*
|
||||
** Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled.
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL011_LCRH,
|
||||
(UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN));
|
||||
|
||||
/*
|
||||
** Finally, enable the UART
|
||||
*/
|
||||
IO_WRITE (port[CONSOLE_PORT] + UART_PL011_CR,
|
||||
(UART_PL011_CR_UARTEN | UART_PL011_CR_TXE |
|
||||
UART_PL011_CR_RXE));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void serial_putc (const char c)
|
||||
{
|
||||
if (c == '\n')
|
||||
pl011_putc (CONSOLE_PORT, '\r');
|
||||
|
||||
pl011_putc (CONSOLE_PORT, c);
|
||||
}
|
||||
|
||||
void serial_puts (const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc (void)
|
||||
{
|
||||
return pl011_getc (CONSOLE_PORT);
|
||||
}
|
||||
|
||||
int serial_tstc (void)
|
||||
{
|
||||
return pl011_tstc (CONSOLE_PORT);
|
||||
}
|
||||
|
||||
void serial_setbrg (void)
|
||||
{
|
||||
}
|
||||
|
||||
static void pl011_putc (int portnum, char c)
|
||||
{
|
||||
/* Wait until there is space in the FIFO */
|
||||
while (IO_READ (port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_TXFF);
|
||||
|
||||
/* Send the character */
|
||||
IO_WRITE (port[portnum] + UART_PL01x_DR, c);
|
||||
}
|
||||
|
||||
static int pl011_getc (int portnum)
|
||||
{
|
||||
unsigned int data;
|
||||
|
||||
/* Wait until there is data in the FIFO */
|
||||
while (IO_READ (port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE);
|
||||
|
||||
data = IO_READ (port[portnum] + UART_PL01x_DR);
|
||||
|
||||
/* Check for an error flag */
|
||||
if (data & 0xFFFFFF00) {
|
||||
/* Clear the error */
|
||||
IO_WRITE (port[portnum] + UART_PL01x_ECR, 0xFFFFFFFF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (int) data;
|
||||
}
|
||||
|
||||
static int pl011_tstc (int portnum)
|
||||
{
|
||||
return !(IO_READ (port[portnum] + UART_PL01x_FR) &
|
||||
UART_PL01x_FR_RXFE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* (C) Copyright 2003, 2004
|
||||
* ARM Ltd.
|
||||
* Philippe Robin, <philippe.robin@arm.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
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM PrimeCell UART's (PL010 & PL011)
|
||||
* ------------------------------------
|
||||
*
|
||||
* Definitions common to both PL010 & PL011
|
||||
*
|
||||
*/
|
||||
#define UART_PL01x_DR 0x00 /* Data read or written from the interface. */
|
||||
#define UART_PL01x_RSR 0x04 /* Receive status register (Read). */
|
||||
#define UART_PL01x_ECR 0x04 /* Error clear register (Write). */
|
||||
#define UART_PL01x_FR 0x18 /* Flag register (Read only). */
|
||||
|
||||
#define UART_PL01x_RSR_OE 0x08
|
||||
#define UART_PL01x_RSR_BE 0x04
|
||||
#define UART_PL01x_RSR_PE 0x02
|
||||
#define UART_PL01x_RSR_FE 0x01
|
||||
|
||||
#define UART_PL01x_FR_TXFE 0x80
|
||||
#define UART_PL01x_FR_RXFF 0x40
|
||||
#define UART_PL01x_FR_TXFF 0x20
|
||||
#define UART_PL01x_FR_RXFE 0x10
|
||||
#define UART_PL01x_FR_BUSY 0x08
|
||||
#define UART_PL01x_FR_TMSK (UART_PL01x_FR_TXFF + UART_PL01x_FR_BUSY)
|
||||
|
||||
/*
|
||||
* PL010 definitions
|
||||
*
|
||||
*/
|
||||
#define UART_PL010_LCRH 0x08 /* Line control register, high byte. */
|
||||
#define UART_PL010_LCRM 0x0C /* Line control register, middle byte. */
|
||||
#define UART_PL010_LCRL 0x10 /* Line control register, low byte. */
|
||||
#define UART_PL010_CR 0x14 /* Control register. */
|
||||
#define UART_PL010_IIR 0x1C /* Interrupt indentification register (Read). */
|
||||
#define UART_PL010_ICR 0x1C /* Interrupt clear register (Write). */
|
||||
#define UART_PL010_ILPR 0x20 /* IrDA low power counter register. */
|
||||
|
||||
#define UART_PL010_CR_LPE (1 << 7)
|
||||
#define UART_PL010_CR_RTIE (1 << 6)
|
||||
#define UART_PL010_CR_TIE (1 << 5)
|
||||
#define UART_PL010_CR_RIE (1 << 4)
|
||||
#define UART_PL010_CR_MSIE (1 << 3)
|
||||
#define UART_PL010_CR_IIRLP (1 << 2)
|
||||
#define UART_PL010_CR_SIREN (1 << 1)
|
||||
#define UART_PL010_CR_UARTEN (1 << 0)
|
||||
|
||||
#define UART_PL010_LCRH_WLEN_8 (3 << 5)
|
||||
#define UART_PL010_LCRH_WLEN_7 (2 << 5)
|
||||
#define UART_PL010_LCRH_WLEN_6 (1 << 5)
|
||||
#define UART_PL010_LCRH_WLEN_5 (0 << 5)
|
||||
#define UART_PL010_LCRH_FEN (1 << 4)
|
||||
#define UART_PL010_LCRH_STP2 (1 << 3)
|
||||
#define UART_PL010_LCRH_EPS (1 << 2)
|
||||
#define UART_PL010_LCRH_PEN (1 << 1)
|
||||
#define UART_PL010_LCRH_BRK (1 << 0)
|
||||
|
||||
|
||||
#define UART_PL010_BAUD_460800 1
|
||||
#define UART_PL010_BAUD_230400 3
|
||||
#define UART_PL010_BAUD_115200 7
|
||||
#define UART_PL010_BAUD_57600 15
|
||||
#define UART_PL010_BAUD_38400 23
|
||||
#define UART_PL010_BAUD_19200 47
|
||||
#define UART_PL010_BAUD_14400 63
|
||||
#define UART_PL010_BAUD_9600 95
|
||||
#define UART_PL010_BAUD_4800 191
|
||||
#define UART_PL010_BAUD_2400 383
|
||||
#define UART_PL010_BAUD_1200 767
|
||||
/*
|
||||
* PL011 definitions
|
||||
*
|
||||
*/
|
||||
#define UART_PL011_IBRD 0x24
|
||||
#define UART_PL011_FBRD 0x28
|
||||
#define UART_PL011_LCRH 0x2C
|
||||
#define UART_PL011_CR 0x30
|
||||
#define UART_PL011_IMSC 0x38
|
||||
#define UART_PL011_PERIPH_ID0 0xFE0
|
||||
|
||||
#define UART_PL011_LCRH_SPS (1 << 7)
|
||||
#define UART_PL011_LCRH_WLEN_8 (3 << 5)
|
||||
#define UART_PL011_LCRH_WLEN_7 (2 << 5)
|
||||
#define UART_PL011_LCRH_WLEN_6 (1 << 5)
|
||||
#define UART_PL011_LCRH_WLEN_5 (0 << 5)
|
||||
#define UART_PL011_LCRH_FEN (1 << 4)
|
||||
#define UART_PL011_LCRH_STP2 (1 << 3)
|
||||
#define UART_PL011_LCRH_EPS (1 << 2)
|
||||
#define UART_PL011_LCRH_PEN (1 << 1)
|
||||
#define UART_PL011_LCRH_BRK (1 << 0)
|
||||
|
||||
#define UART_PL011_CR_CTSEN (1 << 15)
|
||||
#define UART_PL011_CR_RTSEN (1 << 14)
|
||||
#define UART_PL011_CR_OUT2 (1 << 13)
|
||||
#define UART_PL011_CR_OUT1 (1 << 12)
|
||||
#define UART_PL011_CR_RTS (1 << 11)
|
||||
#define UART_PL011_CR_DTR (1 << 10)
|
||||
#define UART_PL011_CR_RXE (1 << 9)
|
||||
#define UART_PL011_CR_TXE (1 << 8)
|
||||
#define UART_PL011_CR_LPE (1 << 7)
|
||||
#define UART_PL011_CR_IIRLP (1 << 2)
|
||||
#define UART_PL011_CR_SIREN (1 << 1)
|
||||
#define UART_PL011_CR_UARTEN (1 << 0)
|
||||
|
||||
#define UART_PL011_IMSC_OEIM (1 << 10)
|
||||
#define UART_PL011_IMSC_BEIM (1 << 9)
|
||||
#define UART_PL011_IMSC_PEIM (1 << 8)
|
||||
#define UART_PL011_IMSC_FEIM (1 << 7)
|
||||
#define UART_PL011_IMSC_RTIM (1 << 6)
|
||||
#define UART_PL011_IMSC_TXIM (1 << 5)
|
||||
#define UART_PL011_IMSC_RXIM (1 << 4)
|
||||
#define UART_PL011_IMSC_DSRMIM (1 << 3)
|
||||
#define UART_PL011_IMSC_DCDMIM (1 << 2)
|
||||
#define UART_PL011_IMSC_CTSMIM (1 << 1)
|
||||
#define UART_PL011_IMSC_RIMIM (1 << 0)
|
||||
+44
-48
@@ -7,7 +7,7 @@
|
||||
. Rolf Offermanns <rof@sysgo.de>
|
||||
.
|
||||
. Copyright (C) 2001 Standard Microsystems Corporation (SMSC)
|
||||
. Developed by Simple Network Magic Corporation (SNMC)
|
||||
. Developed by Simple Network Magic Corporation (SNMC)
|
||||
. Copyright (C) 1996 by Erik Stahlman (ES)
|
||||
.
|
||||
. This program is free software; you can redistribute it and/or modify
|
||||
@@ -17,12 +17,12 @@
|
||||
.
|
||||
. This program is distributed in the hope that it will be useful,
|
||||
. but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
. GNU General Public License for more details.
|
||||
.
|
||||
. You should have received a copy of the GNU General Public License
|
||||
. along with this program; if not, write to the Free Software
|
||||
. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
.
|
||||
. Information contained in this file was obtained from the LAN91C111
|
||||
. manual from SMC. To get a copy, if you really want one, you can find
|
||||
@@ -36,27 +36,27 @@
|
||||
. EEPROM interface for configuration
|
||||
.
|
||||
. Arguments:
|
||||
. io = for the base address
|
||||
. io = for the base address
|
||||
. irq = for the IRQ
|
||||
.
|
||||
. author:
|
||||
. Erik Stahlman ( erik@vt.edu )
|
||||
. Daris A Nevil ( dnevil@snmc.com )
|
||||
. Erik Stahlman ( erik@vt.edu )
|
||||
. Daris A Nevil ( dnevil@snmc.com )
|
||||
.
|
||||
.
|
||||
. Hardware multicast code from Peter Cammaert ( pc@denkart.be )
|
||||
.
|
||||
. Sources:
|
||||
. o SMSC LAN91C111 databook (www.smsc.com)
|
||||
. o smc9194.c by Erik Stahlman
|
||||
. o skeleton.c by Donald Becker ( becker@cesdis.gsfc.nasa.gov )
|
||||
. o SMSC LAN91C111 databook (www.smsc.com)
|
||||
. o smc9194.c by Erik Stahlman
|
||||
. o skeleton.c by Donald Becker ( becker@cesdis.gsfc.nasa.gov )
|
||||
.
|
||||
. History:
|
||||
. 06/19/03 Richard Woodruff Made u-boot environment aware and added mac addr checks.
|
||||
. 06/19/03 Richard Woodruff Made u-boot environment aware and added mac addr checks.
|
||||
. 10/17/01 Marco Hasewinkel Modify for DNP/1110
|
||||
. 07/25/01 Woojung Huh Modify for ADS Bitsy
|
||||
. 04/25/01 Daris A Nevil Initial public release through SMSC
|
||||
. 03/16/01 Daris A Nevil Modified smc9194.c for use with LAN91C111
|
||||
. 07/25/01 Woojung Huh Modify for ADS Bitsy
|
||||
. 04/25/01 Daris A Nevil Initial public release through SMSC
|
||||
. 03/16/01 Daris A Nevil Modified smc9194.c for use with LAN91C111
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include <common.h>
|
||||
@@ -113,7 +113,7 @@ static const char version[] =
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
.
|
||||
. The internal workings of the driver. If you are changing anything
|
||||
. The internal workings of the driver. If you are changing anything
|
||||
. here with the SMC stuff, you should have the datasheet and know
|
||||
. what you are doing.
|
||||
.
|
||||
@@ -138,7 +138,7 @@ static const char version[] =
|
||||
|
||||
#define ETH_ZLEN 60
|
||||
|
||||
#ifdef CONFIG_SMC_USE_32_BIT
|
||||
#ifdef CONFIG_SMC_USE_32_BIT
|
||||
#define USE_32_BIT 1
|
||||
#else
|
||||
#undef USE_32_BIT
|
||||
@@ -253,7 +253,7 @@ void smc_get_macaddr( byte *addr ) {
|
||||
#endif /* 0 */
|
||||
|
||||
/***********************************************
|
||||
* Show available memory *
|
||||
* Show available memory *
|
||||
***********************************************/
|
||||
void dump_memory_info(void)
|
||||
{
|
||||
@@ -337,8 +337,8 @@ static inline void smc_wait_mmu_release_complete (void)
|
||||
/*
|
||||
. Function: smc_reset( void )
|
||||
. Purpose:
|
||||
. This sets the SMC91111 chip to its normal state, hopefully from whatever
|
||||
. mess that any other DOS driver has put it in.
|
||||
. This sets the SMC91111 chip to its normal state, hopefully from whatever
|
||||
. mess that any other DOS driver has put it in.
|
||||
.
|
||||
. Maybe I should reset more registers to defaults in here? SOFTRST should
|
||||
. do that for me.
|
||||
@@ -436,7 +436,7 @@ static void smc_enable()
|
||||
. (1) maybe utilize power down mode.
|
||||
. Why not yet? Because while the chip will go into power down mode,
|
||||
. the manual says that it will wake up in response to any I/O requests
|
||||
. in the register space. Empirical results do not show this working.
|
||||
. in the register space. Empirical results do not show this working.
|
||||
*/
|
||||
static void smc_shutdown()
|
||||
{
|
||||
@@ -459,7 +459,7 @@ static void smc_shutdown()
|
||||
. This sends the actual packet to the SMC9xxx chip.
|
||||
.
|
||||
. Algorithm:
|
||||
. First, see if a saved_skb is available.
|
||||
. First, see if a saved_skb is available.
|
||||
. ( this should NOT be called if there is no 'saved_skb'
|
||||
. Now, find the packet number that the chip allocated
|
||||
. Point the data pointers at it in memory
|
||||
@@ -467,9 +467,9 @@ static void smc_shutdown()
|
||||
. Dump the packet to chip memory
|
||||
. Check if a last byte is needed ( odd length packet )
|
||||
. if so, set the control flag right
|
||||
. Tell the card to send it
|
||||
. Tell the card to send it
|
||||
. Enable the transmit interrupt, so I know if it failed
|
||||
. Free the kernel data if I actually sent it.
|
||||
. Free the kernel data if I actually sent it.
|
||||
*/
|
||||
static int smc_send_packet (volatile void *packet, int packet_length)
|
||||
{
|
||||
@@ -512,9 +512,9 @@ static int smc_send_packet (volatile void *packet, int packet_length)
|
||||
SMC_outw (MC_ALLOC | numPages, MMU_CMD_REG);
|
||||
|
||||
/* FIXME: the ALLOC_INT bit never gets set *
|
||||
* so the following will always give a *
|
||||
* memory allocation error. *
|
||||
* same code works in armboot though *
|
||||
* so the following will always give a *
|
||||
* memory allocation error. *
|
||||
* same code works in armboot though *
|
||||
* -ro
|
||||
*/
|
||||
|
||||
@@ -583,7 +583,7 @@ again:
|
||||
/* send the actual data
|
||||
. I _think_ it's faster to send the longs first, and then
|
||||
. mop up by sending the last word. It depends heavily
|
||||
. on alignment, at least on the 486. Maybe it would be
|
||||
. on alignment, at least on the 486. Maybe it would be
|
||||
. a good idea to check which is optimal? But that could take
|
||||
. almost as much time as is saved?
|
||||
*/
|
||||
@@ -596,7 +596,7 @@ again:
|
||||
SMC_outsw (SMC91111_DATA_REG, buf, (length) >> 1);
|
||||
#endif /* USE_32_BIT */
|
||||
|
||||
/* Send the last byte, if there is one. */
|
||||
/* Send the last byte, if there is one. */
|
||||
if ((length & 1) == 0) {
|
||||
SMC_outw (0, SMC91111_DATA_REG);
|
||||
} else {
|
||||
@@ -690,7 +690,7 @@ static int smc_open (bd_t * bd)
|
||||
|
||||
err = smc_get_ethaddr (bd); /* set smc_mac_addr, and sync it with u-boot globals */
|
||||
if (err < 0) {
|
||||
memset (bd->bi_enetaddr, 0, 6); /* hack to make error stick! upper code will abort if not set */
|
||||
memset (bd->bi_enetaddr, 0, 6); /* hack to make error stick! upper code will abort if not set */
|
||||
return (-1); /* upper code ignores this, but NOT bi_enetaddr */
|
||||
}
|
||||
#ifdef USE_32_BIT
|
||||
@@ -723,10 +723,10 @@ static int smc_open (bd_t * bd)
|
||||
*/
|
||||
static int smc_rcv()
|
||||
{
|
||||
int packet_number;
|
||||
int packet_number;
|
||||
word status;
|
||||
word packet_length;
|
||||
int is_error = 0;
|
||||
int is_error = 0;
|
||||
#ifdef USE_32_BIT
|
||||
dword stat_len;
|
||||
#endif
|
||||
@@ -749,8 +749,8 @@ static int smc_rcv()
|
||||
status = stat_len & 0xffff;
|
||||
packet_length = stat_len >> 16;
|
||||
#else
|
||||
status = SMC_inw( SMC91111_DATA_REG );
|
||||
packet_length = SMC_inw( SMC91111_DATA_REG );
|
||||
status = SMC_inw( SMC91111_DATA_REG );
|
||||
packet_length = SMC_inw( SMC91111_DATA_REG );
|
||||
#endif
|
||||
|
||||
packet_length &= 0x07ff; /* mask off top bits */
|
||||
@@ -773,7 +773,7 @@ static int smc_rcv()
|
||||
/* QUESTION: Like in the TX routine, do I want
|
||||
to send the DWORDs or the bytes first, or some
|
||||
mixture. A mixture might improve already slow PIO
|
||||
performance */
|
||||
performance */
|
||||
SMC_insl( SMC91111_DATA_REG , NetRxPackets[0], packet_length >> 2 );
|
||||
/* read the left over bytes */
|
||||
if (packet_length & 3) {
|
||||
@@ -825,7 +825,7 @@ static int smc_rcv()
|
||||
. smc_close
|
||||
.
|
||||
. this makes the board clean up everything that it can
|
||||
. and not talk to the outside world. Caused by
|
||||
. and not talk to the outside world. Caused by
|
||||
. an 'ifconfig ethX down'
|
||||
.
|
||||
-----------------------------------------------------*/
|
||||
@@ -1313,7 +1313,6 @@ static void smc_phy_configure ()
|
||||
#if SMC_DEBUG > 2
|
||||
static void print_packet( byte * buf, int length )
|
||||
{
|
||||
#if 0
|
||||
int i;
|
||||
int remainder;
|
||||
int lines;
|
||||
@@ -1345,7 +1344,6 @@ static void print_packet( byte * buf, int length )
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1382,7 +1380,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||
s = s_env_mac;
|
||||
}
|
||||
|
||||
for (reg = 0; reg < 6; ++reg) { /* turn string into mac value */
|
||||
for (reg = 0; reg < 6; ++reg) { /* turn string into mac value */
|
||||
v_env_mac[reg] = s ? simple_strtoul (s, &e, 16) : 0;
|
||||
if (s)
|
||||
s = (*e) ? e + 1 : e;
|
||||
@@ -1405,7 +1403,7 @@ int smc_get_ethaddr (bd_t * bd)
|
||||
v_mac = v_env_mac; /* always use a good env over a ROM */
|
||||
}
|
||||
|
||||
if (env_present && rom_valid) { /* if both env and ROM are good */
|
||||
if (env_present && rom_valid) { /* if both env and ROM are good */
|
||||
if (memcmp (v_env_mac, v_rom_mac, 6) != 0) {
|
||||
printf ("\nWarning: MAC addresses don't match:\n");
|
||||
printf ("\tHW MAC address: "
|
||||
@@ -1423,28 +1421,26 @@ int smc_get_ethaddr (bd_t * bd)
|
||||
}
|
||||
memcpy (bd->bi_enetaddr, v_mac, 6); /* update global address to match env (allows env changing) */
|
||||
smc_set_mac_addr (v_mac); /* use old function to update smc default */
|
||||
PRINTK("Using MAC Address %02X:%02X:%02X:%02X:%02X:%02X\n", v_mac[0], v_mac[1],
|
||||
v_mac[2], v_mac[3], v_mac[4], v_mac[5]);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int get_rom_mac (char *v_rom_mac)
|
||||
{
|
||||
int is_rom_present = 0;
|
||||
|
||||
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
|
||||
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
|
||||
|
||||
memcpy (v_rom_mac, hw_mac_addr, 6);
|
||||
return (1);
|
||||
#else
|
||||
if (is_rom_present) {
|
||||
/* if eeprom contents are valid
|
||||
* extract mac address into hw_mac_addr, 8 or 16 bit accesses
|
||||
* memcpy (v_rom_mac, hc_mac_addr, 6);
|
||||
* return(1);
|
||||
*/
|
||||
int i;
|
||||
SMC_SELECT_BANK (1);
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
v_rom_mac[i] = SMC_inb (ADDR0_REG + i);
|
||||
}
|
||||
memset (v_rom_mac, 0, 6);
|
||||
return (0);
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_DRIVER_SMC91111 */
|
||||
@@ -143,10 +143,18 @@ typedef unsigned long int dword;
|
||||
* We have only 16 Bit PCMCIA access on Socket 0
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ADNPESC1
|
||||
#define SMC_inw(r) (*((volatile word *)(SMC_BASE_ADDRESS+((r)<<1))))
|
||||
#else
|
||||
#define SMC_inw(r) (*((volatile word *)(SMC_BASE_ADDRESS+(r))))
|
||||
#endif
|
||||
#define SMC_inb(r) (((r)&1) ? SMC_inw((r)&~1)>>8 : SMC_inw(r)&0xFF)
|
||||
|
||||
#ifdef CONFIG_ADNPESC1
|
||||
#define SMC_outw(d,r) (*((volatile word *)(SMC_BASE_ADDRESS+((r)<<1))) = d)
|
||||
#else
|
||||
#define SMC_outw(d,r) (*((volatile word *)(SMC_BASE_ADDRESS+(r))) = d)
|
||||
#endif
|
||||
#define SMC_outb(d,r) ({ word __d = (byte)(d); \
|
||||
word __w = SMC_inw((r)&~1); \
|
||||
__w &= ((r)&1) ? 0x00FF : 0xFF00; \
|
||||
@@ -308,6 +316,11 @@ typedef unsigned long int dword;
|
||||
#define RPC_LED_RX (0x07) /* LED = RX packet occurred */
|
||||
#if defined(CONFIG_DK1C20) || defined(CONFIG_DK1S10)
|
||||
/* buggy schematic: LEDa -> yellow, LEDb --> green */
|
||||
#define RPC_DEFAULT ( RPC_SPEED | RPC_DPLX | RPC_ANEG \
|
||||
| (RPC_LED_TX_RX << RPC_LSXA_SHFT) \
|
||||
| (RPC_LED_100_10 << RPC_LSXB_SHFT) )
|
||||
#elif defined(CONFIG_ADNPESC1)
|
||||
/* SSV ADNP/ESC1 has only one LED: LEDa -> Rx/Tx indicator */
|
||||
#define RPC_DEFAULT ( RPC_SPEED | RPC_DPLX | RPC_ANEG \
|
||||
| (RPC_LED_TX_RX << RPC_LSXA_SHFT) \
|
||||
| (RPC_LED_100_10 << RPC_LSXB_SHFT) )
|
||||
|
||||
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user