mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-12 22:49:43 +03:00
Compare commits
8 Commits
LABEL_2004
...
LABEL_2004
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cf91d6bdc | ||
|
|
e35745bb64 | ||
|
|
2471111d35 | ||
|
|
498b8db7f5 | ||
|
|
a8bd82de46 | ||
|
|
7abf0c5886 | ||
|
|
d4326aca18 | ||
|
|
507bbe3e80 |
79
CHANGELOG
79
CHANGELOG
@@ -1,7 +1,84 @@
|
||||
======================================================================
|
||||
Changes for U-Boot 1.1.1:
|
||||
======================================================================
|
||||
|
||||
|
||||
* Modify KUP4X board configuration to use SL811 driver for USB memory
|
||||
sticks (including FAT / VFAT filesystem support)
|
||||
|
||||
* Add SL811 Host Controller Interface driver for USB
|
||||
|
||||
* Add CFG_I2C_EEPROM_ADDR_OVERFLOW desription to README
|
||||
|
||||
* Patch by Pantelis Antoniou, 19 Apr 2004:
|
||||
Allow to use shell style syntax (i. e. ${var} ) with standard parser.
|
||||
Minor patches for Intracom boards.
|
||||
|
||||
* Patch by Christian Pell, 19 Apr 2004:
|
||||
cleanup support for CF/IDE on PCMCIA for PXA25X
|
||||
|
||||
* Temporarily disabled John Kerl's extended MII command code because
|
||||
"miivals.h" is missing
|
||||
|
||||
* Patches by Mark Jonas, 13 Apr 2004:
|
||||
- Remove CS0 chip select timing setting from cpu/mpc5xxx/start.S
|
||||
- Add sync instructions to IceCube SDRAM init code
|
||||
- Move SDRAM chip constants into seperate include files
|
||||
- Unify DDR and SDR initialization code
|
||||
- Unify all IceCube (Lite5xxx) target names
|
||||
|
||||
* Patch by John Kerl, 16 Apr 2004:
|
||||
Enable ranges in mii command, e.g. mii read 0-1f 0 or
|
||||
mii read 4-7 18-1a. Also add mii dump subcommand for
|
||||
pretty-printing standard regs 0-5.
|
||||
|
||||
* Patch by Stephen Williams, 16 April 2004:
|
||||
fix typo in JSE.h; update MAINTAINERS
|
||||
|
||||
* Patch by Matthew S. McClintock, 14 Apr 2004:
|
||||
fix initdram function for utx8245 board
|
||||
|
||||
* Patch by Markus Pietrek, 14 Apr 2004:
|
||||
use ATAG_INITRD2 instead of deprecated ATAG_INITRD tag
|
||||
|
||||
* Patch by Reinhard Meyer, 18 Apr 2004:
|
||||
provide the IDE Reset Function for EMK 5200 boards
|
||||
|
||||
* Patch by Masami Komiya, 12 Apr 2004:
|
||||
fix pci_hose_write_config_{byte,word}_via_dword problems
|
||||
|
||||
* Patch by Sangmoon Kim, 12 Apr 2004:
|
||||
Update max RAM size for debris board
|
||||
|
||||
* Patch by Travis Sawyer, 08 Apr 2004:
|
||||
Add TLB entry for second DIMM slot on ocotea
|
||||
|
||||
* Patch by Masami Komiya, 08 Apr 2004:
|
||||
add RTL8169 network driver
|
||||
|
||||
* Patch by Dan Malek, 07 Apr 2004:
|
||||
- Add support for RPC/STx GP3, Motorola 8560 board
|
||||
- Update 85xx TSEC driver so it searches MII for first available PHY
|
||||
and uses that one.
|
||||
- Add functions to support console MII commands.
|
||||
|
||||
* Patch by Tolunay Orkun, 07 Apr 2004:
|
||||
Move initialization of bi_iic_fast[]
|
||||
from board_init_f() to board_init_r()
|
||||
|
||||
* Patch by Yasushi Shoji, 07 Apr 2004:
|
||||
Cleanup microblaze port
|
||||
|
||||
* Patch by Sangmoon Kim, 07 Apr 2004:
|
||||
Add auto SDRAM module detection for Debris board
|
||||
|
||||
* Patch by Rune Torgersen, 06 Apr 2004:
|
||||
- Fix some PCI problems on the MPC8266ADS board
|
||||
- Fix the location of some PCI entries in the immap structure
|
||||
|
||||
* Patch by Yasushi Shoji, 07 Apr 2004:
|
||||
- add support for microblaze processors
|
||||
- add support for AtmarkTechno "suzaku" board
|
||||
|
||||
* Configure PPChameleon board to use redundand environment in flash
|
||||
|
||||
* Configure PPChameleon board to use JFFS2 NAND support.
|
||||
|
||||
@@ -255,6 +255,10 @@ Rune Torgersen <runet@innovsys.com>
|
||||
|
||||
MPC8266ADS MPC8266
|
||||
|
||||
Stephen Williams <steve@icarus.com>
|
||||
|
||||
JSE PPC405GPr
|
||||
|
||||
John Zhan <zhanz@sinovee.com>
|
||||
|
||||
svm_sc8xx MPC8xx
|
||||
@@ -264,6 +268,10 @@ Xianghua Xiao <x.xiao@motorola.com>
|
||||
MPC8540ADS MPC8540
|
||||
MPC8560ADS MPC8560
|
||||
|
||||
Dan Malek <dan@embeddededge.com>
|
||||
|
||||
STxGP3 MPC85xx
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Unknown / orphaned boards:
|
||||
|
||||
4
MAKEALL
4
MAKEALL
@@ -25,7 +25,7 @@ LIST_5xx=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_5xxx=" \
|
||||
IceCube_5100 IceCube_5200 EVAL5200 PM520 \
|
||||
icecube_5100 icecube_5200 EVAL5200 PM520 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
@@ -97,7 +97,7 @@ LIST_8260=" \
|
||||
#########################################################################
|
||||
|
||||
LIST_85xx=" \
|
||||
MPC8540ADS MPC8560ADS \
|
||||
MPC8540ADS MPC8560ADS stxgp3 \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
|
||||
43
Makefile
43
Makefile
@@ -75,6 +75,9 @@ endif
|
||||
ifeq ($(ARCH),m68k)
|
||||
CROSS_COMPILE = m68k-elf-
|
||||
endif
|
||||
ifeq ($(ARCH),microblaze)
|
||||
CROSS_COMPILE = mb-
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -209,16 +212,16 @@ PATI_config: unconfig
|
||||
#########################################################################
|
||||
## MPC5xxx Systems
|
||||
#########################################################################
|
||||
MPC5200LITE_config \
|
||||
MPC5200LITE_LOWBOOT_config \
|
||||
MPC5200LITE_LOWBOOT08_config \
|
||||
icecube_5200_DDR_config \
|
||||
IceCube_5200_DDR_config \
|
||||
icecube_5200_DDR_LOWBOOT_config \
|
||||
icecube_5200_DDR_LOWBOOT08_config \
|
||||
icecube_5200_config \
|
||||
IceCube_5200_config \
|
||||
IceCube_5100_config: unconfig
|
||||
Lite5200_config \
|
||||
Lite5200_LOWBOOT_config \
|
||||
Lite5200_LOWBOOT08_config \
|
||||
icecube_5200_config \
|
||||
icecube_5200_LOWBOOT_config \
|
||||
icecube_5200_LOWBOOT08_config \
|
||||
icecube_5200_DDR_config \
|
||||
icecube_5200_DDR_LOWBOOT_config \
|
||||
icecube_5200_DDR_LOWBOOT08_config \
|
||||
icecube_5100_config: unconfig
|
||||
@ >include/config.h
|
||||
@[ -z "$(findstring LOWBOOT_,$@)" ] || \
|
||||
{ if [ "$(findstring DDR,$@)" ] ; \
|
||||
@@ -719,6 +722,9 @@ CPC45_ROMBOOT_config: unconfig
|
||||
CU824_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x cu824
|
||||
|
||||
debris_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x debris etin
|
||||
|
||||
eXalion_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x eXalion
|
||||
|
||||
@@ -944,6 +950,9 @@ MPC8540ADS_config: unconfig
|
||||
MPC8560ADS_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc85xx mpc8560ads
|
||||
|
||||
stxgp3_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc85xx stxgp3
|
||||
|
||||
#########################################################################
|
||||
## 74xx/7xx Systems
|
||||
#########################################################################
|
||||
@@ -960,9 +969,6 @@ DB64360_config: unconfig
|
||||
DB64460_config: unconfig
|
||||
@./mkconfig DB64460 ppc 74xx_7xx db64460 Marvell
|
||||
|
||||
debris_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc mpc824x debris etin
|
||||
|
||||
ELPPC_config: unconfig
|
||||
@./mkconfig $(@:_config=) ppc 74xx_7xx elppc eltec
|
||||
|
||||
@@ -1250,6 +1256,17 @@ ADNPESC1_config: unconfig
|
||||
@./mkconfig -a ADNPESC1 nios nios adnpesc1 ssv
|
||||
|
||||
|
||||
#========================================================================
|
||||
# MicroBlaze
|
||||
#========================================================================
|
||||
#########################################################################
|
||||
## Microblaze
|
||||
#########################################################################
|
||||
suzaku_config: unconfig
|
||||
@ >include/config.h
|
||||
@echo "#define CONFIG_SUZAKU 1" >> include/config.h
|
||||
@./mkconfig -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
|
||||
|
||||
#########################################################################
|
||||
## MIPS32 AU1X00
|
||||
#########################################################################
|
||||
|
||||
46
README
46
README
@@ -240,6 +240,10 @@ The following options need to be configured:
|
||||
CONFIG_ARM7
|
||||
CONFIG_PXA250
|
||||
|
||||
MicroBlaze based CPUs:
|
||||
----------------------
|
||||
CONFIG_MICROBLZE
|
||||
|
||||
|
||||
- Board Type: Define exactly one of
|
||||
|
||||
@@ -277,11 +281,11 @@ The following options need to be configured:
|
||||
CONFIG_RPXlite, CONFIG_RPXsuper, CONFIG_rsdproto,
|
||||
CONFIG_sacsng, CONFIG_Sandpoint8240, CONFIG_Sandpoint8245,
|
||||
CONFIG_sbc8260, CONFIG_SM850, CONFIG_SPD823TS,
|
||||
CONFIG_SXNI855T, CONFIG_TQM823L, CONFIG_TQM8260,
|
||||
CONFIG_TQM850L, CONFIG_TQM855L, CONFIG_TQM860L,
|
||||
CONFIG_TTTech, CONFIG_UTX8245, CONFIG_V37,
|
||||
CONFIG_W7OLMC, CONFIG_W7OLMG, CONFIG_WALNUT405,
|
||||
CONFIG_ZPC1900, CONFIG_ZUMA,
|
||||
CONFIG_STXGP3, CONFIG_SXNI855T, CONFIG_TQM823L,
|
||||
CONFIG_TQM8260, CONFIG_TQM850L, CONFIG_TQM855L,
|
||||
CONFIG_TQM860L, CONFIG_TTTech, CONFIG_UTX8245,
|
||||
CONFIG_V37, CONFIG_W7OLMC, CONFIG_W7OLMG,
|
||||
CONFIG_WALNUT405, CONFIG_ZPC1900, CONFIG_ZUMA,
|
||||
|
||||
ARM based boards:
|
||||
-----------------
|
||||
@@ -292,6 +296,11 @@ The following options need to be configured:
|
||||
CONFIG_LUBBOCK, CONFIG_SHANNON, CONFIG_SMDK2400,
|
||||
CONFIG_SMDK2410, CONFIG_TRAB, CONFIG_VCMA9,
|
||||
|
||||
MicroBlaze based boards:
|
||||
------------------------
|
||||
|
||||
CONFIG_SUZAKU
|
||||
|
||||
|
||||
- CPU Module Type: (if CONFIG_COGENT is defined)
|
||||
Define exactly one of
|
||||
@@ -1742,6 +1751,17 @@ to save the current settings.
|
||||
The length in bytes of the EEPROM memory array address. Note
|
||||
that this is NOT the chip address length!
|
||||
|
||||
- CFG_I2C_EEPROM_ADDR_OVERFLOW:
|
||||
EEPROM chips that implement "address overflow" are ones
|
||||
like Catalyst 24WC04/08/16 which has 9/10/11 bits of
|
||||
address and the extra bits end up in the "chip address" bit
|
||||
slots. This makes a 24WC08 (1Kbyte) chip look like four 256
|
||||
byte chips.
|
||||
|
||||
Note that we consider the length of the address field to
|
||||
still be one byte because the extra address bits are hidden
|
||||
in the chip address.
|
||||
|
||||
- CFG_EEPROM_SIZE:
|
||||
The size in bytes of the EEPROM device.
|
||||
|
||||
@@ -1963,6 +1983,16 @@ Low Level (hardware related) configuration options:
|
||||
Note that this is a global option, we can't
|
||||
have one FEC in standard MII mode and another in RMII mode.
|
||||
|
||||
- CONFIG_CRC32_VERIFY
|
||||
Add a verify option to the crc32 command.
|
||||
The syntax is:
|
||||
|
||||
=> crc32 -v <address> <count> <crc32>
|
||||
|
||||
Where address/count indicate a memory area
|
||||
and crc32 is the correct crc32 which the
|
||||
area should have.
|
||||
|
||||
Building the Software:
|
||||
======================
|
||||
|
||||
@@ -2008,9 +2038,9 @@ configurations; the following names are supported:
|
||||
QS850_config QS860T_config RPXlite_config
|
||||
RPXsuper_config rsdproto_config Sandpoint8240_config
|
||||
sbc8260_config SM850_config SPD823TS_config
|
||||
SXNI855T_config TQM823L_config TQM850L_config
|
||||
TQM855L_config TQM860L_config WALNUT405_config
|
||||
ZPC1900_config
|
||||
stxgp3_config SXNI855T_config TQM823L_config
|
||||
TQM850L_config TQM855L_config TQM860L_config
|
||||
WALNUT405_config ZPC1900_config
|
||||
|
||||
Note: for some board special configuration names may exist; check if
|
||||
additional information is available from the board vendor; for
|
||||
|
||||
40
board/AtmarkTechno/suzaku/Makefile
Normal file
40
board/AtmarkTechno/suzaku/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# (C) Copyright 2003
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o flash.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
29
board/AtmarkTechno/suzaku/config.mk
Normal file
29
board/AtmarkTechno/suzaku/config.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# (C) Copyright 2004 Atmark Techno, Inc.
|
||||
#
|
||||
# Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
TEXT_BASE = 0x80F00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-mul
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-div
|
||||
PLATFORM_CPPFLAGS += -mxl-barrel-shift
|
||||
46
board/AtmarkTechno/suzaku/flash.c
Normal file
46
board/AtmarkTechno/suzaku/flash.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
|
||||
|
||||
unsigned long flash_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void flash_print_info(flash_info_t *info)
|
||||
{
|
||||
}
|
||||
|
||||
int flash_erase(flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
29
board/AtmarkTechno/suzaku/suzaku.c
Normal file
29
board/AtmarkTechno/suzaku/suzaku.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
void do_reset(void)
|
||||
{
|
||||
}
|
||||
65
board/AtmarkTechno/suzaku/u-boot.lds
Normal file
65
board/AtmarkTechno/suzaku/u-boot.lds
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(microblaze)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text ALIGN(0x4):
|
||||
{
|
||||
__text_start = .;
|
||||
cpu/microblaze/start.o (.text)
|
||||
*(.text)
|
||||
__text_end = .;
|
||||
}
|
||||
|
||||
.rodata ALIGN(0x4):
|
||||
{
|
||||
__rodata_start = .;
|
||||
*(.rodata)
|
||||
__rodata_end = .;
|
||||
}
|
||||
|
||||
.data ALIGN(0x4):
|
||||
{
|
||||
__data_start = .;
|
||||
*(.data)
|
||||
__data_end = .;
|
||||
}
|
||||
|
||||
.u_boot_cmd ALIGN(0x4):
|
||||
{
|
||||
__u_boot_cmd_start = .;
|
||||
*(.u_boot_cmd)
|
||||
__u_boot_cmd_end = .;
|
||||
}
|
||||
|
||||
.bss ALIGN(0x4):
|
||||
{
|
||||
__bss_start = .;
|
||||
*(.bss)
|
||||
__bss_start = .;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ SECTIONS
|
||||
}
|
||||
|
||||
. = 0xFFFF8000;
|
||||
.ppcenv :
|
||||
.ppcenv :
|
||||
{
|
||||
common/environment.o(.ppcenv);
|
||||
}
|
||||
|
||||
@@ -182,21 +182,29 @@ void pci_init_board(void)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* provide the PCI Reset Function
|
||||
* provide the IDE Reset Function
|
||||
*****************************************************************************/
|
||||
#ifdef CFG_CMD_IDE
|
||||
#define GPIO_PSC1_4 0x01000000ul
|
||||
#if defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET)
|
||||
|
||||
#define GPIO_PSC1_4 0x01000000UL
|
||||
|
||||
void init_ide_reset (void)
|
||||
{
|
||||
debug ("init_ide_reset\n");
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
void ide_set_reset (int idereset)
|
||||
{
|
||||
debug ("ide_reset(%d)\n", idereset);
|
||||
|
||||
if (idereset) {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA &= ~GPIO_PSC1_4;
|
||||
} else {
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC1_4;
|
||||
}
|
||||
|
||||
/* Configure PSC1_4 as GPIO output for ATA reset */
|
||||
/* (it does not matter we do this every time) */
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4;
|
||||
*(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <common.h>
|
||||
#include <mpc824x.h>
|
||||
#include <pci.h>
|
||||
#include <i2c.h>
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
@@ -52,28 +53,70 @@ int checkflash (void)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long size;
|
||||
#if 0
|
||||
long new_bank0_end;
|
||||
long mear1;
|
||||
long emear1;
|
||||
#endif
|
||||
int m, row, col, bank, i;
|
||||
unsigned long start, end;
|
||||
uint32_t mccr1;
|
||||
uint32_t mear1 = 0, emear1 = 0, msar1 = 0, emsar1 = 0;
|
||||
uint32_t mear2 = 0, emear2 = 0, msar2 = 0, emsar2 = 0;
|
||||
uint8_t mber = 0;
|
||||
|
||||
size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
|
||||
i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
|
||||
|
||||
#if 0
|
||||
new_bank0_end = size - 1;
|
||||
mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
#endif
|
||||
if (i2c_reg_read (0x50, 2) != 0x04) return 0; /* Memory type */
|
||||
m = i2c_reg_read (0x50, 5); /* # of physical banks */
|
||||
row = i2c_reg_read (0x50, 3); /* # of rows */
|
||||
col = i2c_reg_read (0x50, 4); /* # of columns */
|
||||
bank = i2c_reg_read (0x50, 17); /* # of logical banks */
|
||||
|
||||
return (size);
|
||||
CONFIG_READ_WORD(MCCR1, mccr1);
|
||||
mccr1 &= 0xffff0000;
|
||||
|
||||
start = CFG_SDRAM_BASE;
|
||||
end = start + (1 << (col + row + 3) ) * bank - 1;
|
||||
|
||||
for (i = 0; i < m; i++) {
|
||||
mccr1 |= ((row == 13)? 2 : (bank == 4)? 0 : 3) << i * 2;
|
||||
if (i < 4) {
|
||||
msar1 |= ((start >> 20) & 0xff) << i * 8;
|
||||
emsar1 |= ((start >> 28) & 0xff) << i * 8;
|
||||
mear1 |= ((end >> 20) & 0xff) << i * 8;
|
||||
emear1 |= ((end >> 28) & 0xff) << i * 8;
|
||||
} else {
|
||||
msar2 |= ((start >> 20) & 0xff) << (i-4) * 8;
|
||||
emsar2 |= ((start >> 28) & 0xff) << (i-4) * 8;
|
||||
mear2 |= ((end >> 20) & 0xff) << (i-4) * 8;
|
||||
emear2 |= ((end >> 28) & 0xff) << (i-4) * 8;
|
||||
}
|
||||
mber |= 1 << i;
|
||||
start += (1 << (col + row + 3) ) * bank;
|
||||
end += (1 << (col + row + 3) ) * bank;
|
||||
}
|
||||
for (; i < 8; i++) {
|
||||
if (i < 4) {
|
||||
msar1 |= 0xff << i * 8;
|
||||
emsar1 |= 0x30 << i * 8;
|
||||
mear1 |= 0xff << i * 8;
|
||||
emear1 |= 0x30 << i * 8;
|
||||
} else {
|
||||
msar2 |= 0xff << (i-4) * 8;
|
||||
emsar2 |= 0x30 << (i-4) * 8;
|
||||
mear2 |= 0xff << (i-4) * 8;
|
||||
emear2 |= 0x30 << (i-4) * 8;
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_WRITE_WORD(MCCR1, mccr1);
|
||||
CONFIG_WRITE_WORD(MSAR1, msar1);
|
||||
CONFIG_WRITE_WORD(EMSAR1, emsar1);
|
||||
CONFIG_WRITE_WORD(MEAR1, mear1);
|
||||
CONFIG_WRITE_WORD(EMEAR1, emear1);
|
||||
CONFIG_WRITE_WORD(MSAR2, msar2);
|
||||
CONFIG_WRITE_WORD(EMSAR2, emsar2);
|
||||
CONFIG_WRITE_WORD(MEAR2, mear2);
|
||||
CONFIG_WRITE_WORD(EMEAR2, emear2);
|
||||
CONFIG_WRITE_BYTE(MBER, mber);
|
||||
|
||||
return (1 << (col + row + 3) ) * bank * m;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
@@ -25,90 +28,84 @@
|
||||
#include <mpc5xxx.h>
|
||||
#include <pci.h>
|
||||
|
||||
#if defined(CONFIG_MPC5200_DDR)
|
||||
#include "mt46v16m16-75.h"
|
||||
#else
|
||||
#include "mt48lc16m16a2-75.h"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_RAMBOOT
|
||||
static void sdram_start (int hi_addr)
|
||||
{
|
||||
long hi_addr_bit = hi_addr ? 0x01000000 : 0;
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f00 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f02 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#if SDRAM_DDR
|
||||
/* set mode register: extended mode */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x40090000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_EMODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register: reset DLL */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x058d0000;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f02 | hi_addr_bit;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xf05f0f04 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x018d0000;
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x705f0f00 | hi_addr_bit;
|
||||
#else
|
||||
/* unlock mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0000 | hi_addr_bit;
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0002 | hi_addr_bit;
|
||||
/* set mode register */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x00cd0000;
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x008d0000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE | 0x04000000;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
/* precharge all banks */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004 | hi_addr_bit;
|
||||
/* auto refresh */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0xd04f0004 | hi_addr_bit;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set mode register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = 0x00cd0000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_MODE = SDRAM_MODE;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* normal operation */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = 0x504f0000 | hi_addr_bit;
|
||||
#endif
|
||||
*(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | hi_addr_bit;
|
||||
__asm__ volatile ("sync");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATTENTION: Although partially referenced initdram does NOT make real use
|
||||
* use of CFG_SDRAM_BASE. The code does not work if CFG_SDRAM_BASE
|
||||
* is something else than 0x00000000.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
ulong dramsize2 = 0;
|
||||
#endif
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* configure SDRAM start/end */
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* setup SDRAM chip selects */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x0000001e;/* 2G at 0x0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = 0x80000000;/* disabled */
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0x73722930;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x47770000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* set tap delay to 0x10 */
|
||||
*(vu_long *)MPC5XXX_CDM_PORCFG = 0x10000000;
|
||||
#else
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xd2322800;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x8ad70000;
|
||||
#if SDRAM_DDR
|
||||
/* set tap delay */
|
||||
*(vu_long *)MPC5XXX_CDM_PORCFG = SDRAM_TAPDELAY;
|
||||
__asm__ volatile ("sync");
|
||||
#endif
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = 0xc2222600;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = 0x88b70004;
|
||||
|
||||
/* address select register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_XLBSEL = 0x03000000;
|
||||
#endif
|
||||
/* find RAM size using SDRAM CS0 only */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
sdram_start(1);
|
||||
@@ -119,11 +116,23 @@ long int initdram (int board_type)
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
#if defined(CONFIG_MPC5200)
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG =
|
||||
(0x13 + __builtin_ffs(dramsize >> 20) - 1);
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize < (1 << 20)) {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS0 size according to the amount of RAM found */
|
||||
if (dramsize > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0x13 + __builtin_ffs(dramsize >> 20) - 1;
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS0CFG = 0; /* disabled */
|
||||
}
|
||||
|
||||
/* let SDRAM CS1 start right after CS0 */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize + 0x0000001e;/* 2G */
|
||||
|
||||
/* find RAM size using SDRAM CS1 only */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)(CFG_SDRAM_BASE + dramsize), 0x80000000);
|
||||
sdram_start(1);
|
||||
@@ -134,34 +143,94 @@ long int initdram (int board_type)
|
||||
} else {
|
||||
dramsize2 = test2;
|
||||
}
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG =
|
||||
dramsize + (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
|
||||
#else
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
#endif
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
|
||||
#endif
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
#ifdef CONFIG_MGT5100
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
|
||||
#else
|
||||
dramsize = ((1 << (*(vu_long *)MPC5XXX_SDRAM_CS0CFG - 0x13)) << 20);
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
dramsize2 = ((1 << (*(vu_long *)MPC5XXX_SDRAM_CS1CFG - 0x13)) << 20);
|
||||
#endif
|
||||
#endif
|
||||
/* memory smaller than 1MB is impossible */
|
||||
if (dramsize2 < (1 << 20)) {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
|
||||
/* set SDRAM CS1 size according to the amount of RAM found */
|
||||
if (dramsize2 > 0) {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize
|
||||
| (0x13 + __builtin_ffs(dramsize2 >> 20) - 1);
|
||||
} else {
|
||||
*(vu_long *)MPC5XXX_SDRAM_CS1CFG = dramsize; /* disabled */
|
||||
}
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS0 */
|
||||
dramsize = *(vu_long *)MPC5XXX_SDRAM_CS0CFG & 0xFF;
|
||||
if (dramsize >= 0x13) {
|
||||
dramsize = (1 << (dramsize - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize = 0;
|
||||
}
|
||||
|
||||
/* retrieve size of memory connected to SDRAM CS1 */
|
||||
dramsize2 = *(vu_long *)MPC5XXX_SDRAM_CS1CFG & 0xFF;
|
||||
if (dramsize2 >= 0x13) {
|
||||
dramsize2 = (1 << (dramsize2 - 0x13)) << 20;
|
||||
} else {
|
||||
dramsize2 = 0;
|
||||
}
|
||||
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
return dramsize + dramsize2;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
ulong dramsize = 0;
|
||||
#ifndef CFG_RAMBOOT
|
||||
ulong test1, test2;
|
||||
|
||||
/* setup and enable SDRAM chip selects */
|
||||
*(vu_long *)MPC5XXX_SDRAM_START = 0x00000000;
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = 0x0000ffff;/* 2G */
|
||||
*(vu_long *)MPC5XXX_ADDECR |= (1 << 22); /* Enable SDRAM */
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* setup config registers */
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG1 = SDRAM_CONFIG1;
|
||||
*(vu_long *)MPC5XXX_SDRAM_CONFIG2 = SDRAM_CONFIG2;
|
||||
|
||||
/* address select register */
|
||||
*(vu_long *)MPC5XXX_SDRAM_XLBSEL = SDRAM_ADDRSEL;
|
||||
__asm__ volatile ("sync");
|
||||
|
||||
/* find RAM size */
|
||||
sdram_start(0);
|
||||
test1 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
sdram_start(1);
|
||||
test2 = get_ram_size((ulong *)CFG_SDRAM_BASE, 0x80000000);
|
||||
if (test1 > test2) {
|
||||
sdram_start(0);
|
||||
dramsize = test1;
|
||||
} else {
|
||||
dramsize = test2;
|
||||
}
|
||||
|
||||
/* set SDRAM end address according to size */
|
||||
*(vu_long *)MPC5XXX_SDRAM_STOP = ((dramsize - 1) >> 15);
|
||||
|
||||
#else /* CFG_RAMBOOT */
|
||||
|
||||
/* Retrieve amount of SDRAM available */
|
||||
dramsize = ((*(vu_long *)MPC5XXX_SDRAM_STOP + 1) << 15);
|
||||
|
||||
#endif /* CFG_RAMBOOT */
|
||||
|
||||
#ifdef CONFIG_MPC5200_DDR
|
||||
dramsize += dramsize2;
|
||||
#endif
|
||||
/* return total ram size */
|
||||
return dramsize;
|
||||
}
|
||||
|
||||
#else
|
||||
#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
|
||||
#endif
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
#if defined(CONFIG_MPC5200)
|
||||
|
||||
37
board/icecube/mt46v16m16-75.h
Normal file
37
board/icecube/mt46v16m16-75.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define SDRAM_DDR 1 /* is DDR */
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* Settings for XLB = 132 MHz */
|
||||
#define SDRAM_MODE 0x018D0000
|
||||
#define SDRAM_EMODE 0x40090000
|
||||
#define SDRAM_CONTROL 0x705f0f00
|
||||
#define SDRAM_CONFIG1 0x73722930
|
||||
#define SDRAM_CONFIG2 0x47770000
|
||||
#define SDRAM_TAPDELAY 0x10000000
|
||||
|
||||
#else
|
||||
#error CONFIG_MPC5200 not defined
|
||||
#endif
|
||||
43
board/icecube/mt48lc16m16a2-75.h
Normal file
43
board/icecube/mt48lc16m16a2-75.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Mark Jonas, Freescale Semiconductor, mark.jonas@motorola.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#define SDRAM_DDR 0 /* is SDR */
|
||||
|
||||
#if defined(CONFIG_MPC5200)
|
||||
/* Settings for XLB = 132 MHz */
|
||||
#define SDRAM_MODE 0x00CD0000
|
||||
#define SDRAM_CONTROL 0x504F0000
|
||||
#define SDRAM_CONFIG1 0xD2322800
|
||||
#define SDRAM_CONFIG2 0x8AD70000
|
||||
|
||||
#elif defined(CONFIG_MGT5100)
|
||||
/* Settings for XLB = 66 MHz */
|
||||
#define SDRAM_MODE 0x008D0000
|
||||
#define SDRAM_CONTROL 0x504F0000
|
||||
#define SDRAM_CONFIG1 0xC2222600
|
||||
#define SDRAM_CONFIG2 0x88B70004
|
||||
#define SDRAM_ADDRSEL 0x02000000
|
||||
|
||||
#else
|
||||
#error Neither CONFIG_MPC5200 or CONFIG_MGT5100 defined
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o usb.o
|
||||
OBJS = $(BOARD).o ../common/flash.o ../common/kup.o
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Klaus Heydeck, Kieback & Peter GmbH & Co KG, heydeck@kieback-peter.de
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <mpc8xx.h>
|
||||
#include "../common/kup.h"
|
||||
|
||||
|
||||
#define SL811_ADR (0x50000000)
|
||||
#define SL811_DAT (0x50000001)
|
||||
|
||||
|
||||
static void sl811_write_index_data (__u8 index, __u8 data)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
*(volatile unsigned char *) (SL811_DAT) = data;
|
||||
__asm__ ("eieio");
|
||||
}
|
||||
|
||||
static __u8 sl811_read_index_data (__u8 index)
|
||||
{
|
||||
__u8 data;
|
||||
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
__asm__ ("eieio");
|
||||
data = *(volatile unsigned char *) (SL811_DAT);
|
||||
__asm__ ("eieio");
|
||||
return (data);
|
||||
}
|
||||
|
||||
int usb_init_kup4x (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
int i;
|
||||
unsigned char tmp;
|
||||
|
||||
memctl = &immap->im_memctl;
|
||||
memctl->memc_or7 = 0xFFFF8726;
|
||||
memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */
|
||||
/* BP 14 low = USB ON */
|
||||
immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
|
||||
/* PB 14 nomal port */
|
||||
immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
|
||||
/* output */
|
||||
immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
|
||||
|
||||
puts ("USB: ");
|
||||
|
||||
for (i = 0x10; i < 0xff; i++) {
|
||||
sl811_write_index_data (i, i);
|
||||
tmp = (sl811_read_index_data (i));
|
||||
if (tmp != i) {
|
||||
printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
printf ("SL811 ready\n");
|
||||
return (0);
|
||||
}
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <common.h>
|
||||
#include <miiphy.h>
|
||||
#include <sed156x.h>
|
||||
#include <status_led.h>
|
||||
|
||||
#include "mpc8xx.h"
|
||||
|
||||
@@ -659,6 +660,7 @@ int overwrite_console(void)
|
||||
|
||||
extern int drv_phone_init(void);
|
||||
extern int drv_phone_use_me(void);
|
||||
extern int drv_phone_is_idle(void);
|
||||
|
||||
int misc_init_r(void)
|
||||
{
|
||||
@@ -691,6 +693,12 @@ int last_stage_init(void)
|
||||
do_poll();
|
||||
|
||||
if (drv_phone_use_me()) {
|
||||
status_led_set(0, STATUS_LED_ON);
|
||||
while (!drv_phone_is_idle()) {
|
||||
do_poll();
|
||||
udelay(1000000 / CFG_HZ);
|
||||
}
|
||||
|
||||
console_assign(stdin, "phone");
|
||||
console_assign(stdout, "phone");
|
||||
console_assign(stderr, "phone");
|
||||
|
||||
@@ -179,7 +179,6 @@ static int last_input_mode;
|
||||
static int refresh_time;
|
||||
static int blink_time;
|
||||
static char last_fast_punct;
|
||||
static int last_tab_indicator = -1;
|
||||
|
||||
/*************************************************************************************************/
|
||||
|
||||
@@ -239,8 +238,6 @@ static void console_init(void)
|
||||
refresh_time = REFRESH_HZ;
|
||||
blink_time = BLINK_HZ;
|
||||
|
||||
tab_indicator = 1;
|
||||
|
||||
memset(vty_buf, ' ', sizeof(vty_buf));
|
||||
|
||||
memset(last_visible_buf, ' ', sizeof(last_visible_buf));
|
||||
@@ -253,6 +250,8 @@ static void console_init(void)
|
||||
sed156x_init();
|
||||
width = sed156x_text_width;
|
||||
height = sed156x_text_height - 1;
|
||||
|
||||
tab_indicator = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -718,8 +717,10 @@ static void update(void)
|
||||
if (input_mode != last_input_mode)
|
||||
sed156x_output_at(sed156x_text_width - 3, sed156x_text_height - 1, input_mode_txt[input_mode], 3);
|
||||
|
||||
if (tab_indicator != last_tab_indicator)
|
||||
if (tab_indicator == 0) {
|
||||
sed156x_output_at(0, sed156x_text_height - 1, "\\t", 2);
|
||||
tab_indicator = 1;
|
||||
}
|
||||
|
||||
if (fast_punct != last_fast_punct)
|
||||
sed156x_output_at(4, sed156x_text_height - 1, &fast_punct, 1);
|
||||
@@ -779,7 +780,6 @@ static void update(void)
|
||||
|
||||
last_input_mode = input_mode;
|
||||
last_fast_punct = fast_punct;
|
||||
last_tab_indicator = tab_indicator;
|
||||
}
|
||||
|
||||
/* ensure visibility; the trick is to minimize the screen movement */
|
||||
@@ -891,7 +891,8 @@ void phone_putc(const char c)
|
||||
blink_time = BLINK_HZ;
|
||||
|
||||
switch (c) {
|
||||
case 13: /* ignore */
|
||||
case '\a': /* ignore bell */
|
||||
case '\r': /* ignore carriage return */
|
||||
break;
|
||||
|
||||
case '\n': /* next line */
|
||||
@@ -1141,3 +1142,10 @@ static void kp_do_poll(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
int drv_phone_is_idle(void)
|
||||
{
|
||||
return kp_state == SCAN;
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ tlbtab:
|
||||
tlbentry( CFG_ISRAM_BASE, SZ_4K, 0x80000000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_ISRAM_BASE + 0x1000, SZ_4K, 0x80001000, 0, AC_R|AC_W|AC_X )
|
||||
tlbentry( CFG_SDRAM_BASE, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_SDRAM_BASE+0x10000000, SZ_256M, 0x00000000, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_BASE, SZ_256M, 0x00000000, 2, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbentry( CFG_PCI_MEMBASE, SZ_256M, 0x00000000, 3, AC_R|AC_W|SA_G|SA_I )
|
||||
tlbtab_end
|
||||
|
||||
48
board/stxgp3/Makefile
Normal file
48
board/stxgp3/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# (C) Copyright 2001
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(BOARD).a
|
||||
|
||||
OBJS := $(BOARD).o flash.o
|
||||
SOBJS := init.o
|
||||
#SOBJS :=
|
||||
|
||||
$(LIB): $(OBJS) $(SOBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) $(SOBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak .depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
|
||||
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
|
||||
|
||||
-include .depend
|
||||
|
||||
#########################################################################
|
||||
33
board/stxgp3/config.mk
Normal file
33
board/stxgp3/config.mk
Normal file
@@ -0,0 +1,33 @@
|
||||
# Modified by Xianghua Xiao, X.Xiao@motorola.com
|
||||
# (C) Copyright 2002,2003 Motorola Inc.
|
||||
#
|
||||
# Copied from ADS85xx for STx GP3 - Dan Malek
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
#
|
||||
# default CCARBAR is at 0xff700000
|
||||
# assume U-Boot is less than 0.5MB
|
||||
#
|
||||
TEXT_BASE = 0xfff80000
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx=1
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_MPC8560=1
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_E500=1
|
||||
517
board/stxgp3/flash.c
Normal file
517
board/stxgp3/flash.c
Normal file
@@ -0,0 +1,517 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Dan Malek, Embedded Edge, LLC. <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updated to support the Silicon Tx GP3 8560. We should only find
|
||||
* two Intel 28F640 parts in 16-bit mode (i.e. 32-bit wide flash),
|
||||
* but I left other code here in case people order custom boards.
|
||||
*
|
||||
* (C) Copyright 2003 Motorola Inc.
|
||||
* Xianghua Xiao,(X.Xiao@motorola.com)
|
||||
*
|
||||
* (C) Copyright 2000, 2001
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com
|
||||
* Add support the Sharp chips on the mpc8260ads.
|
||||
* I started with board/ip860/flash.c and made changes I found in
|
||||
* the MTD project by David Schleef.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#if !defined(CFG_NO_FLASH)
|
||||
|
||||
flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
|
||||
|
||||
#if defined(CFG_ENV_IS_IN_FLASH)
|
||||
# ifndef CFG_ENV_ADDR
|
||||
# define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
|
||||
# endif
|
||||
# ifndef CFG_ENV_SIZE
|
||||
# define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
|
||||
# endif
|
||||
# ifndef CFG_ENV_SECT_SIZE
|
||||
# define CFG_ENV_SECT_SIZE CFG_ENV_SIZE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Functions
|
||||
*/
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info);
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data);
|
||||
static int clear_block_lock_bit(vu_long * addr);
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
unsigned long flash_init (void)
|
||||
{
|
||||
unsigned long size;
|
||||
int i;
|
||||
|
||||
/* Init: enable write,
|
||||
* or we cannot even write flash commands
|
||||
*/
|
||||
for (i=0; i<CFG_MAX_FLASH_BANKS; ++i) {
|
||||
flash_info[i].flash_id = FLASH_UNKNOWN;
|
||||
|
||||
/* set the default sector offset */
|
||||
}
|
||||
|
||||
/* Static FLASH Bank configuration here - FIXME XXX */
|
||||
|
||||
size = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
if (flash_info[0].flash_id == FLASH_UNKNOWN) {
|
||||
printf ("## Unknown FLASH on Bank 0 - Size = 0x%08lx = %ld MB\n",
|
||||
size, size<<20);
|
||||
}
|
||||
|
||||
/* Re-do sizing to get full correct info */
|
||||
size = flash_get_size((vu_long *)CFG_FLASH_BASE, &flash_info[0]);
|
||||
|
||||
flash_info[0].size = size;
|
||||
|
||||
#if !defined(CONFIG_RAM_AS_FLASH)
|
||||
#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
|
||||
/* monitor protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_MONITOR_BASE,
|
||||
CFG_MONITOR_BASE+monitor_flash_len-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
|
||||
#ifdef CFG_ENV_IS_IN_FLASH
|
||||
/* ENV protection ON by default */
|
||||
flash_protect(FLAG_PROTECT_SET,
|
||||
CFG_ENV_ADDR,
|
||||
CFG_ENV_ADDR+CFG_ENV_SECT_SIZE-1,
|
||||
&flash_info[0]);
|
||||
#endif
|
||||
#endif
|
||||
return (size);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
void flash_print_info (flash_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("missing or unknown FLASH type\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_VENDMASK) {
|
||||
case FLASH_MAN_INTEL: printf ("Intel "); break;
|
||||
case FLASH_MAN_SHARP: printf ("Sharp "); break;
|
||||
default: printf ("Unknown Vendor "); break;
|
||||
}
|
||||
|
||||
switch (info->flash_id & FLASH_TYPEMASK) {
|
||||
case FLASH_28F640C3T: printf ("28F640C3T (64 Mbit x 2, 128 x 128k)\n");
|
||||
break;
|
||||
default: printf ("Unknown Chip Type\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf (" Size: %ld MB in %d Sectors\n",
|
||||
info->size >> 20, info->sector_count);
|
||||
|
||||
printf (" Sector Start Addresses:");
|
||||
for (i=0; i<info->sector_count; ++i) {
|
||||
if ((i % 5) == 0)
|
||||
printf ("\n ");
|
||||
printf (" %08lX%s",
|
||||
info->start[i],
|
||||
info->protect[i] ? " (RO)" : " "
|
||||
);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* The following code cannot be run from FLASH!
|
||||
*/
|
||||
|
||||
static ulong flash_get_size (vu_long *addr, flash_info_t *info)
|
||||
{
|
||||
short i;
|
||||
ulong value;
|
||||
ulong base = (ulong)addr;
|
||||
ulong sector_offset;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Check flash at 0x%08x\n",(uint)addr);
|
||||
#endif
|
||||
/* Write "Intelligent Identifier" command: read Manufacturer ID */
|
||||
*addr = 0x90909090;
|
||||
udelay(20);
|
||||
asm("sync");
|
||||
|
||||
value = addr[0] & 0x00FF00FF;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("manufacturer=0x%x\n",(uint)value);
|
||||
#endif
|
||||
switch (value) {
|
||||
case MT_MANUFACT: /* SHARP, MT or => Intel */
|
||||
case INTEL_ALT_MANU:
|
||||
info->flash_id = FLASH_MAN_INTEL;
|
||||
break;
|
||||
default:
|
||||
printf("unknown manufacturer: %x\n", (unsigned int)value);
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
info->sector_count = 0;
|
||||
info->size = 0;
|
||||
return (0); /* no or unknown flash */
|
||||
}
|
||||
|
||||
value = addr[1]; /* device ID */
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("deviceID=0x%x\n",(uint)value);
|
||||
#endif
|
||||
switch (value) {
|
||||
|
||||
case (INTEL_ID_28F640C3T):
|
||||
info->flash_id += FLASH_28F640C3T;
|
||||
info->sector_count = 135;
|
||||
info->size = 0x01000000;
|
||||
sector_offset = 0x20000;
|
||||
break; /* => 2x8 MB */
|
||||
|
||||
default:
|
||||
info->flash_id = FLASH_UNKNOWN;
|
||||
return (0); /* => no or unknown flash */
|
||||
|
||||
}
|
||||
|
||||
/* set up sector start address table
|
||||
* The first 127 blocks are large, the last 8 are small.
|
||||
*/
|
||||
for (i = 0; i < 127; i++) {
|
||||
info->start[i] = base;
|
||||
base += sector_offset;
|
||||
/* Sectors are locked upon reset */
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
for (i = 127; i < 135; i++) {
|
||||
info->start[i] = base;
|
||||
base += 0x4000;
|
||||
/* Sectors are locked upon reset */
|
||||
info->protect[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prevent writes to uninitialized FLASH.
|
||||
*/
|
||||
if (info->flash_id != FLASH_UNKNOWN) {
|
||||
addr = (vu_long *)info->start[0];
|
||||
*addr = 0xFFFFFF; /* reset bank to read array mode */
|
||||
asm("sync");
|
||||
}
|
||||
|
||||
return (info->size);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int flash_erase (flash_info_t *info, int s_first, int s_last)
|
||||
{
|
||||
int flag, prot, sect;
|
||||
ulong start, now, last;
|
||||
|
||||
if ((s_first < 0) || (s_first > s_last)) {
|
||||
if (info->flash_id == FLASH_UNKNOWN) {
|
||||
printf ("- missing\n");
|
||||
} else {
|
||||
printf ("- no sectors to erase\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL)
|
||||
&& ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_SHARP) ) {
|
||||
printf ("Can't erase unknown flash type %08lx - aborted\n",
|
||||
info->flash_id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
prot = 0;
|
||||
for (sect=s_first; sect<=s_last; ++sect) {
|
||||
if (info->protect[sect]) {
|
||||
prot++;
|
||||
}
|
||||
}
|
||||
|
||||
if (prot) {
|
||||
printf ("- Warning: %d protected sectors will not be erased!\n",
|
||||
prot);
|
||||
} else {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("\nFlash Erase:\n");
|
||||
#endif
|
||||
/* Make Sure Block Lock Bit is not set. */
|
||||
if(clear_block_lock_bit((vu_long *)(info->start[s_first]))){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Start erase on unprotected sectors */
|
||||
#if defined(DEBUG)
|
||||
printf("Begin to erase now,s_first=0x%x s_last=0x%x...\n",s_first,s_last);
|
||||
#endif
|
||||
for (sect = s_first; sect<=s_last; sect++) {
|
||||
if (info->protect[sect] == 0) { /* not protected */
|
||||
vu_long *addr = (vu_long *)(info->start[sect]);
|
||||
asm("sync");
|
||||
|
||||
last = start = get_timer (0);
|
||||
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Reset Array */
|
||||
*addr = 0xffffffff;
|
||||
asm("sync");
|
||||
/* Clear Status Register */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
/* Single Block Erase Command */
|
||||
*addr = 0x20202020;
|
||||
asm("sync");
|
||||
/* Confirm */
|
||||
*addr = 0xD0D0D0D0;
|
||||
asm("sync");
|
||||
|
||||
if((info->flash_id & FLASH_TYPEMASK) != FLASH_LH28F016SCT) {
|
||||
/* Resume Command, as per errata update */
|
||||
*addr = 0xD0D0D0D0;
|
||||
asm("sync");
|
||||
}
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* wait at least 80us - let's wait 1 ms */
|
||||
udelay (1000);
|
||||
while ((*addr & 0x00800080) != 0x00800080) {
|
||||
if(*addr & 0x00200020){
|
||||
printf("Error in Block Erase - Lock Bit may be set!\n");
|
||||
printf("Status Register = 0x%X\n", (uint)*addr);
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout\n");
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
/* show that we're waiting */
|
||||
if ((now - last) > 1000) { /* every second */
|
||||
putc ('.');
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
||||
/* reset to read mode */
|
||||
*addr = 0xFFFFFFFF;
|
||||
asm("sync");
|
||||
}
|
||||
}
|
||||
|
||||
printf ("flash erase done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Copy memory to flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
|
||||
int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
|
||||
{
|
||||
ulong cp, wp, data;
|
||||
int i, l, rc;
|
||||
|
||||
wp = (addr & ~3); /* get lower word aligned address */
|
||||
|
||||
/*
|
||||
* handle unaligned start bytes
|
||||
*/
|
||||
if ((l = addr - wp) != 0) {
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<l; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
for (; i<4 && cnt>0; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
++cp;
|
||||
}
|
||||
for (; cnt==0 && i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* handle word aligned part
|
||||
*/
|
||||
while (cnt >= 4) {
|
||||
data = 0;
|
||||
for (i=0; i<4; ++i) {
|
||||
data = (data << 8) | *src++;
|
||||
}
|
||||
if ((rc = write_word(info, wp, data)) != 0) {
|
||||
return (rc);
|
||||
}
|
||||
wp += 4;
|
||||
cnt -= 4;
|
||||
}
|
||||
|
||||
if (cnt == 0) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* handle unaligned tail bytes
|
||||
*/
|
||||
data = 0;
|
||||
for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
|
||||
data = (data << 8) | *src++;
|
||||
--cnt;
|
||||
}
|
||||
for (; i<4; ++i, ++cp) {
|
||||
data = (data << 8) | (*(uchar *)cp);
|
||||
}
|
||||
|
||||
return (write_word(info, wp, data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Write a word to Flash, returns:
|
||||
* 0 - OK
|
||||
* 1 - write timeout
|
||||
* 2 - Flash not erased
|
||||
*/
|
||||
static int write_word (flash_info_t *info, ulong dest, ulong data)
|
||||
{
|
||||
vu_long *addr = (vu_long *)dest;
|
||||
ulong start, csr;
|
||||
int flag;
|
||||
|
||||
/* Check if Flash is (sufficiently) erased */
|
||||
if ((*addr & data) != data) {
|
||||
return (2);
|
||||
}
|
||||
/* Disable interrupts which might cause a timeout here */
|
||||
flag = disable_interrupts();
|
||||
|
||||
/* Write Command */
|
||||
*addr = 0x10101010;
|
||||
asm("sync");
|
||||
|
||||
/* Write Data */
|
||||
*addr = data;
|
||||
|
||||
/* re-enable interrupts if necessary */
|
||||
if (flag)
|
||||
enable_interrupts();
|
||||
|
||||
/* data polling for D7 */
|
||||
start = get_timer (0);
|
||||
flag = 0;
|
||||
|
||||
while (((csr = *addr) & 0x00800080) != 0x00800080) {
|
||||
if (get_timer(start) > CFG_FLASH_WRITE_TOUT) {
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (csr & 0x40404040) {
|
||||
printf ("CSR indicates write error (%08lx) at %08lx\n", csr, (ulong)addr);
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
/* Clear Status Registers Command */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
/* Reset to read array mode */
|
||||
*addr = 0xFFFFFFFF;
|
||||
asm("sync");
|
||||
|
||||
return (flag);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Clear Block Lock Bit, returns:
|
||||
* 0 - OK
|
||||
* 1 - Timeout
|
||||
*/
|
||||
|
||||
static int clear_block_lock_bit(vu_long * addr)
|
||||
{
|
||||
ulong start, now;
|
||||
|
||||
/* Reset Array */
|
||||
*addr = 0xffffffff;
|
||||
asm("sync");
|
||||
/* Clear Status Register */
|
||||
*addr = 0x50505050;
|
||||
asm("sync");
|
||||
|
||||
*addr = 0x60606060;
|
||||
asm("sync");
|
||||
*addr = 0xd0d0d0d0;
|
||||
asm("sync");
|
||||
|
||||
start = get_timer (0);
|
||||
while((*addr & 0x00800080) != 0x00800080){
|
||||
if ((now=get_timer(start)) > CFG_FLASH_ERASE_TOUT) {
|
||||
printf ("Timeout on clearing Block Lock Bit\n");
|
||||
*addr = 0xFFFFFFFF; /* reset bank */
|
||||
asm("sync");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !CFG_NO_FLASH */
|
||||
153
board/stxgp3/init.S
Normal file
153
board/stxgp3/init.S
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Embedded Edge, LLC
|
||||
* Dan Malek <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560. We only support 32-bit flash
|
||||
* and DDR with SPD EEPROM configuration.
|
||||
*
|
||||
* Copyright (C) 2002,2003, Motorola Inc.
|
||||
* Xianghua Xiao <X.Xiao@motorola.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <ppc_asm.tmpl>
|
||||
#include <ppc_defs.h>
|
||||
#include <asm/cache.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <config.h>
|
||||
#include <mpc85xx.h>
|
||||
|
||||
#define entry_start \
|
||||
mflr r1 ; \
|
||||
bl 0f ;
|
||||
|
||||
#define entry_end \
|
||||
0: mflr r0 ; \
|
||||
mtlr r1 ; \
|
||||
blr ;
|
||||
|
||||
/* TLB1 entries configuration: */
|
||||
|
||||
.section .bootpg, "ax"
|
||||
.globl tlb1_entry
|
||||
tlb1_entry:
|
||||
entry_start
|
||||
|
||||
/* If RAMBOOT, we are testing and the BDI has set up
|
||||
* much of the MMU already.
|
||||
* TLB 4,5 SDRAM
|
||||
* TLB 15 is default CCSRBAR.
|
||||
*/
|
||||
.long 0x09 /* the following data table uses a few of 16 TLB entries */
|
||||
|
||||
.long TLB1_MAS0(1,1,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_CCSRBAR>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_CCSRBAR>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,2,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_16M)
|
||||
.long TLB1_MAS2(((CFG_FLASH_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_FLASH_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,3,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_LBC_LCLDEVS_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_LBC_LCLDEVS_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
.long TLB1_MAS0(1,4,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,5,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,6,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_64M)
|
||||
#if defined(CONFIG_RAM_AS_FLASH)
|
||||
.long TLB1_MAS2(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
#else
|
||||
.long TLB1_MAS2(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,0,0,0,0)
|
||||
#endif
|
||||
.long TLB1_MAS3(((CFG_LBC_SDRAM_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,7,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_16K)
|
||||
#ifdef CONFIG_L2_INIT_RAM
|
||||
.long TLB1_MAS2(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,1,0,0,0,0)
|
||||
#else
|
||||
.long TLB1_MAS2(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,0,0,0,0,0)
|
||||
#endif
|
||||
.long TLB1_MAS3(((CFG_INIT_RAM_ADDR>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
.long TLB1_MAS0(1,8,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_256M)
|
||||
.long TLB1_MAS2(((CFG_PCI_MEM_BASE>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_PCI_MEM_BASE>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
|
||||
#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR)
|
||||
.long TLB1_MAS0(1,15,0)
|
||||
.long TLB1_MAS1(1,1,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(((CFG_CCSRBAR_DEFAULT>>12) & 0xfffff),0,0,0,0,1,0,1,0)
|
||||
.long TLB1_MAS3(((CFG_CCSRBAR_DEFAULT>>12) & 0xfffff),0,0,0,0,0,1,0,1,0,1)
|
||||
#else
|
||||
.long TLB1_MAS0(1,15,0)
|
||||
.long TLB1_MAS1(0,0,0,0,BOOKE_PAGESZ_1M)
|
||||
.long TLB1_MAS2(0,0,0,0,0,0,0,0,0)
|
||||
.long TLB1_MAS3(0,0,0,0,0,0,1,0,1,0,1)
|
||||
#endif
|
||||
entry_end
|
||||
|
||||
/* LAW(Local Access Window) configuration:
|
||||
* 0000_0000-8000_0000: Up to 2G DDR
|
||||
* f000_0000-f3ff_ffff: PCI(256M)
|
||||
* f400_0000-f7ff_ffff: RapidIO(128M)
|
||||
* f800_0000-ffff_ffff: localbus(128M)
|
||||
* f800_0000-fbff_ffff: LBC SDRAM(64M)
|
||||
* fc00_0000-fcff_ffff: LBC BCSR (1M, Chip select 1)
|
||||
* fdf0_0000-fdff_ffff: CCSRBAR(1M)
|
||||
* ff00_0000-ffff_ffff: Flash(16M)
|
||||
* We don't need a local window for CCSRBAR and flash because they
|
||||
* reside in their default mapped spaces.
|
||||
*/
|
||||
|
||||
#define LAWBAR0 0
|
||||
#define LAWAR0 ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_2G)) & ~LAWAR_EN)
|
||||
|
||||
#define LAWBAR1 ((CFG_PCI_MEM_BASE>>12) & 0xfffff)
|
||||
#define LAWAR1 (LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_256M))
|
||||
|
||||
#if !defined(CONFIG_RAM_AS_FLASH)
|
||||
#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff)
|
||||
#define LAWAR2 (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_128M))
|
||||
#else
|
||||
#define LAWBAR2 0
|
||||
#define LAWAR2 ((LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN)
|
||||
#endif
|
||||
|
||||
.section .bootpg, "ax"
|
||||
.globl law_entry
|
||||
law_entry:
|
||||
entry_start
|
||||
.long 0x03
|
||||
.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2
|
||||
entry_end
|
||||
424
board/stxgp3/stxgp3.c
Normal file
424
board/stxgp3/stxgp3.c
Normal file
@@ -0,0 +1,424 @@
|
||||
/*
|
||||
* (C) Copyright 2003, Embedded Edge, LLC
|
||||
* Dan Malek, <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560
|
||||
*
|
||||
* (C) Copyright 2003,Motorola Inc.
|
||||
* Xianghua Xiao, (X.Xiao@motorola.com)
|
||||
*
|
||||
* (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
extern long int spd_sdram (void);
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/immap_85xx.h>
|
||||
#include <ioports.h>
|
||||
#include <asm/io.h>
|
||||
#include <spd.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
long int fixed_sdram (void);
|
||||
|
||||
/*
|
||||
* I/O Port configuration table
|
||||
*
|
||||
* if conf is 1, then that port pin will be configured at boot time
|
||||
* according to the five values podr/pdir/ppar/psor/pdat for that entry
|
||||
*/
|
||||
|
||||
const iop_conf_t iop_conf_tab[4][32] = {
|
||||
|
||||
/* Port A configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
|
||||
/* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
|
||||
/* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
|
||||
/* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
|
||||
/* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
|
||||
/* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
|
||||
/* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
|
||||
/* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
|
||||
/* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
|
||||
/* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
|
||||
/* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
|
||||
/* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
|
||||
/* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
|
||||
/* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
|
||||
/* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
|
||||
/* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
|
||||
/* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
|
||||
/* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
|
||||
/* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
|
||||
/* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
|
||||
/* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
|
||||
/* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
|
||||
/* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
|
||||
/* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
|
||||
/* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
|
||||
/* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
|
||||
/* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
|
||||
/* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
|
||||
/* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
|
||||
/* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
|
||||
/* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
|
||||
/* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
|
||||
},
|
||||
|
||||
/* Port B configuration */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
|
||||
/* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
|
||||
/* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
|
||||
/* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
|
||||
/* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
|
||||
/* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
|
||||
/* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
|
||||
/* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
|
||||
/* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
|
||||
/* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
|
||||
/* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
|
||||
/* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
|
||||
/* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
|
||||
/* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
|
||||
/* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
|
||||
/* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
|
||||
/* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
|
||||
/* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
|
||||
/* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
|
||||
/* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
|
||||
/* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
|
||||
/* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
|
||||
/* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
},
|
||||
|
||||
/* Port C */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
|
||||
/* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
|
||||
/* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
|
||||
/* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
|
||||
/* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
|
||||
/* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
|
||||
/* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
|
||||
/* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
|
||||
/* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
|
||||
/* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
|
||||
/* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
|
||||
/* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
|
||||
/* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
|
||||
/* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
|
||||
/* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
|
||||
/* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
|
||||
/* PC15 */ { 0, 1, 0, 0, 0, 0 }, /* PC15 */
|
||||
/* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
|
||||
/* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
|
||||
/* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
|
||||
/* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
|
||||
/* PC10 */ { 0, 0, 0, 1, 0, 0 }, /* FETHMDC */
|
||||
/* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* FETHMDIO */
|
||||
/* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
|
||||
/* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
|
||||
/* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
|
||||
/* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
|
||||
/* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
|
||||
/* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
|
||||
/* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
|
||||
/* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
|
||||
/* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
|
||||
},
|
||||
|
||||
/* Port D */
|
||||
{ /* conf ppar psor pdir podr pdat */
|
||||
/* PD31 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
|
||||
/* PD30 */ { 0, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
|
||||
/* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
|
||||
/* PD28 */ { 1, 1, 0, 0, 0, 0 }, /* SCC2 RxD */
|
||||
/* PD27 */ { 1, 1, 0, 1, 0, 0 }, /* SCC2 TxD */
|
||||
/* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
|
||||
/* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
|
||||
/* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
|
||||
/* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
|
||||
/* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
|
||||
/* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
|
||||
/* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
|
||||
/* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
|
||||
/* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
|
||||
/* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
|
||||
/* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
|
||||
/* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
|
||||
/* PD14 */ { 1, 1, 1, 0, 0, 0 }, /* I2C CLK */
|
||||
/* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
|
||||
/* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
|
||||
/* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
|
||||
/* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
|
||||
/* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
|
||||
/* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
|
||||
/* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
|
||||
/* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
|
||||
/* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
|
||||
/* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
|
||||
/* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
|
||||
/* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
|
||||
}
|
||||
};
|
||||
|
||||
static uint64_t blinky_increment;
|
||||
static uint64_t next_led_update;
|
||||
static uint led_bit;
|
||||
|
||||
int board_pre_init (void)
|
||||
{
|
||||
#if defined(CONFIG_PCI)
|
||||
volatile immap_t *immr = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_pcix_t *pci = &immr->im_pcix;
|
||||
|
||||
pci->peer &= 0xfffffffdf; /* disable master abort */
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reset_phy (void)
|
||||
{
|
||||
volatile uint *blatch;
|
||||
|
||||
blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
|
||||
|
||||
/* reset Giga bit Ethernet port if needed here */
|
||||
|
||||
*blatch &= ~0x000000c0;
|
||||
udelay(100);
|
||||
*blatch = 0x000000c1; /* Light one led, too */
|
||||
udelay(1000);
|
||||
|
||||
#if 0 /* This is the port we really want to use for debugging. */
|
||||
/* reset the CPM FEC port */
|
||||
#if (CONFIG_ETHER_INDEX == 2)
|
||||
bcsr->bcsr2 &= ~FETH2_RST;
|
||||
udelay(2);
|
||||
bcsr->bcsr2 |= FETH2_RST;
|
||||
udelay(1000);
|
||||
#elif (CONFIG_ETHER_INDEX == 3)
|
||||
bcsr->bcsr3 &= ~FETH3_RST;
|
||||
udelay(2);
|
||||
bcsr->bcsr3 |= FETH3_RST;
|
||||
udelay(1000);
|
||||
#endif
|
||||
#if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
|
||||
miiphy_reset(0x0); /* reset PHY */
|
||||
miiphy_write(0, PHY_MIPSCR, 0xf028); /* change PHY address to 0x02 */
|
||||
miiphy_write(0x02, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
|
||||
#endif /* CONFIG_MII */
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkboard (void)
|
||||
{
|
||||
sys_info_t sysinfo;
|
||||
|
||||
get_sys_info (&sysinfo);
|
||||
|
||||
printf ("Board: Silicon Tx GPPP 8560 Board\n");
|
||||
printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
|
||||
printf ("\tCCB: %lu MHz\n", sysinfo.freqSystemBus / 1000000);
|
||||
printf ("\tDDR: %lu MHz\n", sysinfo.freqSystemBus / 2000000);
|
||||
if((CFG_LBC_LCRR & 0x0f) == 2 || (CFG_LBC_LCRR & 0x0f) == 4 \
|
||||
|| (CFG_LBC_LCRR & 0x0f) == 8) {
|
||||
printf ("\tLBC: %lu MHz\n", sysinfo.freqSystemBus / 1000000 /(CFG_LBC_LCRR & 0x0f));
|
||||
} else {
|
||||
printf("\tLBC: unknown\n");
|
||||
}
|
||||
printf("\tCPM: %lu Mhz\n", sysinfo.freqSystemBus / 1000000);
|
||||
printf("L1 D-cache 32KB, L1 I-cache 32KB enabled.\n");
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Blinkin' LEDS for Robert.
|
||||
*/
|
||||
void
|
||||
show_activity(int flag)
|
||||
{
|
||||
volatile uint *blatch;
|
||||
|
||||
if (next_led_update > get_ticks())
|
||||
return;
|
||||
|
||||
blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
|
||||
|
||||
led_bit >>= 1;
|
||||
if (led_bit == 0)
|
||||
led_bit = 0x08;
|
||||
*blatch = (0xc0 | led_bit);
|
||||
eieio();
|
||||
next_led_update += (get_tbclk() / 4);
|
||||
}
|
||||
|
||||
long int initdram (int board_type)
|
||||
{
|
||||
long dram_size = 0;
|
||||
extern long spd_sdram (void);
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
|
||||
#if defined(CONFIG_DDR_DLL)
|
||||
volatile ccsr_gur_t *gur= &immap->im_gur;
|
||||
uint temp_ddrdll = 0;
|
||||
|
||||
/* Work around to stabilize DDR DLL */
|
||||
temp_ddrdll = gur->ddrdllcr;
|
||||
gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000;
|
||||
asm("sync;isync;msync");
|
||||
#endif
|
||||
|
||||
dram_size = spd_sdram ();
|
||||
|
||||
#if defined(CONFIG_DDR_ECC)
|
||||
{
|
||||
/* Initialize all of memory for ECC, then
|
||||
* enable errors */
|
||||
uint *p = 0;
|
||||
uint i = 0;
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_ddr_t *ddr= &immap->im_ddr;
|
||||
dma_init();
|
||||
for (*p = 0; p < (uint *)(8 * 1024); p++) {
|
||||
if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
|
||||
*p = (unsigned int)0xdeadbeef;
|
||||
if (((unsigned int)p & 0x1c) == 0x1c) { dcbf(p); }
|
||||
}
|
||||
|
||||
/* 8K */
|
||||
dma_xfer((uint *)0x2000,0x2000,(uint *)0);
|
||||
/* 16K */
|
||||
dma_xfer((uint *)0x4000,0x4000,(uint *)0);
|
||||
/* 32K */
|
||||
dma_xfer((uint *)0x8000,0x8000,(uint *)0);
|
||||
/* 64K */
|
||||
dma_xfer((uint *)0x10000,0x10000,(uint *)0);
|
||||
/* 128k */
|
||||
dma_xfer((uint *)0x20000,0x20000,(uint *)0);
|
||||
/* 256k */
|
||||
dma_xfer((uint *)0x40000,0x40000,(uint *)0);
|
||||
/* 512k */
|
||||
dma_xfer((uint *)0x80000,0x80000,(uint *)0);
|
||||
/* 1M */
|
||||
dma_xfer((uint *)0x100000,0x100000,(uint *)0);
|
||||
/* 2M */
|
||||
dma_xfer((uint *)0x200000,0x200000,(uint *)0);
|
||||
/* 4M */
|
||||
dma_xfer((uint *)0x400000,0x400000,(uint *)0);
|
||||
|
||||
for (i = 1; i < dram_size / 0x800000; i++) {
|
||||
dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
|
||||
}
|
||||
|
||||
/* Enable errors for ECC */
|
||||
ddr->err_disable = 0x00000000;
|
||||
asm("sync;isync;msync");
|
||||
}
|
||||
#endif
|
||||
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
|
||||
#if defined(CFG_DRAM_TEST)
|
||||
int testdram (void)
|
||||
{
|
||||
uint *pstart = (uint *) CFG_MEMTEST_START;
|
||||
uint *pend = (uint *) CFG_MEMTEST_END;
|
||||
uint *p;
|
||||
|
||||
printf("SDRAM test phase 1:\n");
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0xaaaaaaaa;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0xaaaaaaaa) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("SDRAM test phase 2:\n");
|
||||
for (p = pstart; p < pend; p++)
|
||||
*p = 0x55555555;
|
||||
|
||||
for (p = pstart; p < pend; p++) {
|
||||
if (*p != 0x55555555) {
|
||||
printf ("SDRAM test fails at: %08x\n", (uint) p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("SDRAM test passed.\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SPD_EEPROM)
|
||||
/*************************************************************************
|
||||
* fixed sdram init -- doesn't use serial presence detect.
|
||||
************************************************************************/
|
||||
long int fixed_sdram (void)
|
||||
{
|
||||
#ifndef CFG_RAMBOOT
|
||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||
volatile ccsr_ddr_t *ddr= &immap->im_ddr;
|
||||
|
||||
ddr->cs0_bnds = CFG_DDR_CS0_BNDS;
|
||||
ddr->cs0_config = CFG_DDR_CS0_CONFIG;
|
||||
ddr->timing_cfg_1 = CFG_DDR_TIMING_1;
|
||||
ddr->timing_cfg_2 = CFG_DDR_TIMING_2;
|
||||
ddr->sdram_mode = CFG_DDR_MODE;
|
||||
ddr->sdram_interval = CFG_DDR_INTERVAL;
|
||||
#if defined (CONFIG_DDR_ECC)
|
||||
ddr->err_disable = 0x0000000D;
|
||||
ddr->err_sbe = 0x00ff0000;
|
||||
#endif
|
||||
asm("sync;isync;msync");
|
||||
udelay(500);
|
||||
#if defined (CONFIG_DDR_ECC)
|
||||
/* Enable ECC checking */
|
||||
ddr->sdram_cfg = (CFG_DDR_CONTROL | 0x20000000);
|
||||
#else
|
||||
ddr->sdram_cfg = CFG_DDR_CONTROL;
|
||||
#endif
|
||||
asm("sync; isync; msync");
|
||||
udelay(500);
|
||||
#endif
|
||||
return ( CFG_SDRAM_SIZE * 1024 * 1024);
|
||||
}
|
||||
#endif /* !defined(CONFIG_SPD_EEPROM) */
|
||||
157
board/stxgp3/u-boot.lds
Normal file
157
board/stxgp3/u-boot.lds
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* (C) Copyright 2003 Embedded Edge, LLC
|
||||
* Dan Malek, <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560.
|
||||
*
|
||||
* (C) Copyright 2002,2003,Motorola,Inc.
|
||||
* Xianghua Xiao, X.Xiao@motorola.com.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(powerpc)
|
||||
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
SECTIONS
|
||||
{
|
||||
.resetvec 0xFFFFFFFC :
|
||||
{
|
||||
*(.resetvec)
|
||||
} = 0xffff
|
||||
|
||||
.bootpg 0xFFFFF000 :
|
||||
{
|
||||
cpu/mpc85xx/start.o (.bootpg)
|
||||
board/stxgp3/init.o (.bootpg)
|
||||
} = 0xffff
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = + SIZEOF_HEADERS;
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rel.text : { *(.rel.text) }
|
||||
.rela.text : { *(.rela.text) }
|
||||
.rel.data : { *(.rel.data) }
|
||||
.rela.data : { *(.rela.data) }
|
||||
.rel.rodata : { *(.rel.rodata) }
|
||||
.rela.rodata : { *(.rela.rodata) }
|
||||
.rel.got : { *(.rel.got) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rel.ctors : { *(.rel.ctors) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rel.dtors : { *(.rel.dtors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rel.bss : { *(.rel.bss) }
|
||||
.rela.bss : { *(.rela.bss) }
|
||||
.rel.plt : { *(.rel.plt) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) }
|
||||
.plt : { *(.plt) }
|
||||
.text :
|
||||
{
|
||||
cpu/mpc85xx/start.o (.text)
|
||||
board/stxgp3/init.o (.text)
|
||||
cpu/mpc85xx/commproc.o (.text)
|
||||
cpu/mpc85xx/traps.o (.text)
|
||||
cpu/mpc85xx/interrupts.o (.text)
|
||||
cpu/mpc85xx/serial_scc.o (.text)
|
||||
cpu/mpc85xx/ether_fcc.o (.text)
|
||||
cpu/mpc85xx/cpu_init.o (.text)
|
||||
cpu/mpc85xx/cpu.o (.text)
|
||||
cpu/mpc85xx/tsec.o (.text)
|
||||
cpu/mpc85xx/speed.o (.text)
|
||||
cpu/mpc85xx/i2c.o (.text)
|
||||
cpu/mpc85xx/spd_sdram.o (.text)
|
||||
common/dlmalloc.o (.text)
|
||||
lib_generic/crc32.o (.text)
|
||||
lib_ppc/extable.o (.text)
|
||||
lib_generic/zlib.o (.text)
|
||||
*(.text)
|
||||
*(.fixup)
|
||||
*(.got1)
|
||||
}
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.rodata1)
|
||||
*(.rodata.str1.4)
|
||||
}
|
||||
.fini : { *(.fini) } =0
|
||||
.ctors : { *(.ctors) }
|
||||
.dtors : { *(.dtors) }
|
||||
|
||||
/* Read-write section, merged into data segment: */
|
||||
. = (. + 0x00FF) & 0xFFFFFF00;
|
||||
_erotext = .;
|
||||
PROVIDE (erotext = .);
|
||||
.reloc :
|
||||
{
|
||||
*(.got)
|
||||
_GOT2_TABLE_ = .;
|
||||
*(.got2)
|
||||
_FIXUP_TABLE_ = .;
|
||||
*(.fixup)
|
||||
}
|
||||
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
|
||||
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data1)
|
||||
*(.sdata)
|
||||
*(.sdata2)
|
||||
*(.dynamic)
|
||||
CONSTRUCTORS
|
||||
}
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
__start___ex_table = .;
|
||||
__ex_table : { *(__ex_table) }
|
||||
__stop___ex_table = .;
|
||||
|
||||
. = ALIGN(256);
|
||||
__init_begin = .;
|
||||
.text.init : { *(.text.init) }
|
||||
.data.init : { *(.data.init) }
|
||||
. = ALIGN(256);
|
||||
__init_end = .;
|
||||
|
||||
__bss_start = .;
|
||||
.bss :
|
||||
{
|
||||
*(.sbss) *(.scommon)
|
||||
*(.dynbss)
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
}
|
||||
_end = . ;
|
||||
PROVIDE (end = .);
|
||||
}
|
||||
@@ -48,35 +48,30 @@ int checkboard(void)
|
||||
|
||||
long int initdram(int board_type)
|
||||
{
|
||||
#if 1
|
||||
long size;
|
||||
long new_bank0_end;
|
||||
long new_bank1_end;
|
||||
long mear1;
|
||||
long emear1;
|
||||
/*
|
||||
write_bat(IBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
|
||||
( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
|
||||
|
||||
write_bat(DBAT1, ((CFG_MAX_RAM_SIZE/2) | BATU_BL_256M | BATU_VS | BATU_VP),
|
||||
( (CFG_MAX_RAM_SIZE/2)| BATL_PP_10 | BATL_MEMCOHERENCE));
|
||||
*/
|
||||
size = get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE);
|
||||
|
||||
new_bank0_end = size - 1;
|
||||
new_bank0_end = size/2 - 1;
|
||||
new_bank1_end = size - 1;
|
||||
mear1 = mpc824x_mpc107_getreg(MEAR1);
|
||||
emear1 = mpc824x_mpc107_getreg(EMEAR1);
|
||||
mear1 = (mear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
|
||||
emear1 = (emear1 & 0xFFFFFF00) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
|
||||
|
||||
mear1 = (mear1 & 0xFFFF0000) |
|
||||
((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) |
|
||||
((new_bank1_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT << 8);
|
||||
emear1 = (emear1 & 0xFFFF0000) |
|
||||
((new_bank0_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) |
|
||||
((new_bank1_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT << 8);
|
||||
|
||||
mpc824x_mpc107_setreg(MEAR1, mear1);
|
||||
mpc824x_mpc107_setreg(EMEAR1, emear1);
|
||||
|
||||
return (size);
|
||||
#else
|
||||
return (CFG_MAX_RAM_SIZE);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -242,6 +242,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
|
||||
if (hdr->ih_arch != IH_CPU_NIOS)
|
||||
#elif defined(__M68K__)
|
||||
if (hdr->ih_arch != IH_CPU_M68K)
|
||||
#elif defined(__microblaze__)
|
||||
if (hdr->ih_arch != IH_CPU_MICROBLAZE)
|
||||
#else
|
||||
# error Unknown CPU type
|
||||
#endif
|
||||
@@ -1185,6 +1187,7 @@ print_type (image_header_t *hdr)
|
||||
case IH_CPU_SPARC: arch = "SPARC"; break;
|
||||
case IH_CPU_SPARC64: arch = "SPARC 64 Bit"; break;
|
||||
case IH_CPU_M68K: arch = "M68K"; break;
|
||||
case IH_CPU_MICROBLAZE: arch = "Microblaze"; break;
|
||||
default: arch = "Unknown Architecture"; break;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,11 @@ static unsigned long mips_io_port_base = 0;
|
||||
# define SHOW_BOOT_PROGRESS(arg)
|
||||
#endif
|
||||
|
||||
#ifdef __PPC__
|
||||
# define EIEIO __asm__ volatile ("eieio")
|
||||
#else
|
||||
# define EIEIO /* nothing */
|
||||
#endif
|
||||
|
||||
#undef IDE_DEBUG
|
||||
|
||||
@@ -790,9 +795,7 @@ ide_outb(int dev, int port, unsigned char val)
|
||||
dev, port, val, (ATA_CURR_BASE(dev)+port));
|
||||
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
|
||||
}
|
||||
#else /* ! __PPC__ */
|
||||
@@ -810,9 +813,7 @@ ide_inb(int dev, int port)
|
||||
{
|
||||
uchar val;
|
||||
/* Ensure I/O operations complete */
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
val = *((uchar *)(ATA_CURR_BASE(dev)+port));
|
||||
PRINTF ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
|
||||
dev, port, (ATA_CURR_BASE(dev)+port), val);
|
||||
@@ -837,9 +838,9 @@ output_data_short(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
if (words&1)
|
||||
@@ -895,13 +896,9 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -913,13 +910,13 @@ output_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
dbuf = (uchar *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -946,13 +943,9 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
PRINTF("in input data base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (words--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -964,13 +957,13 @@ input_data(int dev, ulong *sect_buf, int words)
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
dbuf = (uchar *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -994,9 +987,9 @@ input_data_short(int dev, ulong *sect_buf, int words)
|
||||
pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG);
|
||||
dbuf = (ushort *)sect_buf;
|
||||
while (words--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
if (words&1) {
|
||||
@@ -1608,9 +1601,7 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
PRINTF("in output data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*pbuf = *dbuf++;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1621,9 +1612,9 @@ output_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
while (shorts--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_even = *dbuf++;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*pbuf_odd = *dbuf++;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
@@ -1642,9 +1633,7 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
PRINTF("in input data shorts base for read is %lx\n", (unsigned long) pbuf);
|
||||
|
||||
while (shorts--) {
|
||||
#ifdef __PPC__
|
||||
__asm__ volatile ("eieio");
|
||||
#endif
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf;
|
||||
}
|
||||
#else /* CONFIG_HMI10 */
|
||||
@@ -1655,9 +1644,9 @@ input_data_shorts(int dev, ushort *sect_buf, int shorts)
|
||||
pbuf_even = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_EVEN);
|
||||
pbuf_odd = (uchar *)(ATA_CURR_BASE(dev)+ATA_DATA_ODD);
|
||||
while (shorts--) {
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_even;
|
||||
__asm__ volatile ("eieio");
|
||||
EIEIO;
|
||||
*dbuf++ = *pbuf_odd;
|
||||
}
|
||||
#endif /* CONFIG_HMI10 */
|
||||
|
||||
419
common/cmd_mii.c
419
common/cmd_mii.c
@@ -27,10 +27,13 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <miiphy.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_MII)
|
||||
#include <miiphy.h>
|
||||
|
||||
#define CONFIG_TERSE_MII /* XXX necessary here because "miivals.h" is missing */
|
||||
|
||||
#ifdef CONFIG_TERSE_MII
|
||||
/*
|
||||
* Display values from last command.
|
||||
*/
|
||||
@@ -144,5 +147,419 @@ U_BOOT_CMD(
|
||||
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
|
||||
);
|
||||
|
||||
#else /* ! CONFIG_TERSE_MII ================================================= */
|
||||
|
||||
#include <miivals.h>
|
||||
|
||||
typedef struct _MII_reg_desc_t {
|
||||
ushort regno;
|
||||
char * name;
|
||||
} MII_reg_desc_t;
|
||||
|
||||
MII_reg_desc_t reg_0_5_desc_tbl[] = {
|
||||
{ 0, "PHY control register" },
|
||||
{ 1, "PHY status register" },
|
||||
{ 2, "PHY ID 1 register" },
|
||||
{ 3, "PHY ID 2 register" },
|
||||
{ 4, "Autonegotiation advertisement register" },
|
||||
{ 5, "Autonegotiation partner abilities register" },
|
||||
};
|
||||
|
||||
typedef struct _MII_field_desc_t {
|
||||
ushort hi;
|
||||
ushort lo;
|
||||
ushort mask;
|
||||
char * name;
|
||||
} MII_field_desc_t;
|
||||
|
||||
MII_field_desc_t reg_0_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "reset" },
|
||||
{ 14, 14, 0x01, "loopback" },
|
||||
{ 13, 6, 0x81, "speed selection" }, /* special */
|
||||
{ 12, 12, 0x01, "A/N enable" },
|
||||
{ 11, 11, 0x01, "power-down" },
|
||||
{ 10, 10, 0x01, "isolate" },
|
||||
{ 9, 9, 0x01, "restart A/N" },
|
||||
{ 8, 8, 0x01, "duplex" }, /* special */
|
||||
{ 7, 7, 0x01, "collision test enable" },
|
||||
{ 5, 0, 0x3f, "(reserved)" }
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_1_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "100BASE-T4 able" },
|
||||
{ 14, 14, 0x01, "100BASE-X full duplex able" },
|
||||
{ 13, 13, 0x01, "100BASE-X half duplex able" },
|
||||
{ 12, 12, 0x01, "10 Mbps full duplex able" },
|
||||
{ 11, 11, 0x01, "10 Mbps half duplex able" },
|
||||
{ 10, 10, 0x01, "100BASE-T2 full duplex able" },
|
||||
{ 9, 9, 0x01, "100BASE-T2 half duplex able" },
|
||||
{ 8, 8, 0x01, "extended status" },
|
||||
{ 7, 7, 0x01, "(reserved)" },
|
||||
{ 6, 6, 0x01, "MF preamble suppression" },
|
||||
{ 5, 5, 0x01, "A/N complete" },
|
||||
{ 4, 4, 0x01, "remote fault" },
|
||||
{ 3, 3, 0x01, "A/N able" },
|
||||
{ 2, 2, 0x01, "link status" },
|
||||
{ 1, 1, 0x01, "jabber detect" },
|
||||
{ 0, 0, 0x01, "extended capabilities" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_2_desc_tbl[] = {
|
||||
{ 15, 0, 0xffff, "OUI portion" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_3_desc_tbl[] = {
|
||||
{ 15, 10, 0x3f, "OUI portion" },
|
||||
{ 9, 4, 0x3f, "manufacturer part number" },
|
||||
{ 3, 0, 0x0f, "manufacturer rev. number" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_4_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "next page able" },
|
||||
{ 14, 14, 0x01, "reserved" },
|
||||
{ 13, 13, 0x01, "remote fault" },
|
||||
{ 12, 12, 0x01, "reserved" },
|
||||
{ 11, 11, 0x01, "asymmetric pause" },
|
||||
{ 10, 10, 0x01, "pause enable" },
|
||||
{ 9, 9, 0x01, "100BASE-T4 able" },
|
||||
{ 8, 8, 0x01, "100BASE-TX full duplex able" },
|
||||
{ 7, 7, 0x01, "100BASE-TX able" },
|
||||
{ 6, 6, 0x01, "10BASE-T full duplex able" },
|
||||
{ 5, 5, 0x01, "10BASE-T able" },
|
||||
{ 4, 0, 0x1f, "xxx to do" },
|
||||
};
|
||||
|
||||
MII_field_desc_t reg_5_desc_tbl[] = {
|
||||
{ 15, 15, 0x01, "next page able" },
|
||||
{ 14, 14, 0x01, "acknowledge" },
|
||||
{ 13, 13, 0x01, "remote fault" },
|
||||
{ 12, 12, 0x01, "(reserved)" },
|
||||
{ 11, 11, 0x01, "asymmetric pause able" },
|
||||
{ 10, 10, 0x01, "pause able" },
|
||||
{ 9, 9, 0x01, "100BASE-T4 able" },
|
||||
{ 8, 8, 0x01, "100BASE-X full duplex able" },
|
||||
{ 7, 7, 0x01, "100BASE-TX able" },
|
||||
{ 6, 6, 0x01, "10BASE-T full duplex able" },
|
||||
{ 5, 5, 0x01, "10BASE-T able" },
|
||||
{ 4, 0, 0x1f, "xxx to do" },
|
||||
};
|
||||
|
||||
#define DESC0LEN (sizeof(reg_0_desc_tbl)/sizeof(reg_0_desc_tbl[0]))
|
||||
#define DESC1LEN (sizeof(reg_1_desc_tbl)/sizeof(reg_1_desc_tbl[0]))
|
||||
#define DESC2LEN (sizeof(reg_2_desc_tbl)/sizeof(reg_2_desc_tbl[0]))
|
||||
#define DESC3LEN (sizeof(reg_3_desc_tbl)/sizeof(reg_3_desc_tbl[0]))
|
||||
#define DESC4LEN (sizeof(reg_4_desc_tbl)/sizeof(reg_4_desc_tbl[0]))
|
||||
#define DESC5LEN (sizeof(reg_5_desc_tbl)/sizeof(reg_5_desc_tbl[0]))
|
||||
|
||||
typedef struct _MII_field_desc_and_len_t {
|
||||
MII_field_desc_t * pdesc;
|
||||
ushort len;
|
||||
} MII_field_desc_and_len_t;
|
||||
|
||||
MII_field_desc_and_len_t desc_and_len_tbl[] = {
|
||||
{ reg_0_desc_tbl, DESC0LEN },
|
||||
{ reg_1_desc_tbl, DESC1LEN },
|
||||
{ reg_2_desc_tbl, DESC2LEN },
|
||||
{ reg_3_desc_tbl, DESC3LEN },
|
||||
{ reg_4_desc_tbl, DESC4LEN },
|
||||
{ reg_5_desc_tbl, DESC5LEN },
|
||||
};
|
||||
|
||||
static void dump_reg(
|
||||
ushort regval,
|
||||
MII_reg_desc_t * prd,
|
||||
MII_field_desc_and_len_t * pdl);
|
||||
|
||||
static int special_field(
|
||||
ushort regno,
|
||||
MII_field_desc_t * pdesc,
|
||||
ushort regval);
|
||||
|
||||
void MII_dump_0_to_5(
|
||||
ushort regvals[6],
|
||||
uchar reglo,
|
||||
uchar reghi)
|
||||
{
|
||||
ulong i;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if ((reglo <= i) && (i <= reghi))
|
||||
dump_reg(regvals[i], ®_0_5_desc_tbl[i],
|
||||
&desc_and_len_tbl[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_reg(
|
||||
ushort regval,
|
||||
MII_reg_desc_t * prd,
|
||||
MII_field_desc_and_len_t * pdl)
|
||||
{
|
||||
ulong i;
|
||||
ushort mask_in_place;
|
||||
MII_field_desc_t * pdesc;
|
||||
|
||||
printf("%u. (%04hx) -- %s --\n",
|
||||
prd->regno, regval, prd->name);
|
||||
|
||||
for (i = 0; i < pdl->len; i++) {
|
||||
pdesc = &pdl->pdesc[i];
|
||||
|
||||
mask_in_place = pdesc->mask << pdesc->lo;
|
||||
|
||||
printf(" (%04hx:%04hx) %u.",
|
||||
mask_in_place,
|
||||
regval & mask_in_place,
|
||||
prd->regno);
|
||||
|
||||
if (special_field(prd->regno, pdesc, regval)) {
|
||||
}
|
||||
else {
|
||||
if (pdesc->hi == pdesc->lo)
|
||||
printf("%2u ", pdesc->lo);
|
||||
else
|
||||
printf("%2u-%2u", pdesc->hi, pdesc->lo);
|
||||
printf(" = %5u %s",
|
||||
(regval & mask_in_place) >> pdesc->lo,
|
||||
pdesc->name);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* Special fields:
|
||||
** 0.6,13
|
||||
** 0.8
|
||||
** 2.15-0
|
||||
** 3.15-0
|
||||
** 4.4-0
|
||||
** 5.4-0
|
||||
*/
|
||||
|
||||
static int special_field(
|
||||
ushort regno,
|
||||
MII_field_desc_t * pdesc,
|
||||
ushort regval)
|
||||
{
|
||||
if ((regno == 0) && (pdesc->lo == 6)) {
|
||||
ushort speed_bits = regval & MII_CTL_SPEED_MASK;
|
||||
printf("%2u,%2u = b%u%u speed selection = %s Mbps",
|
||||
6, 13,
|
||||
(regval >> 6) & 1,
|
||||
(regval >> 13) & 1,
|
||||
speed_bits == MII_CTL_SPEED_1000_MBPS ? "1000" :
|
||||
speed_bits == MII_CTL_SPEED_100_MBPS ? "100" :
|
||||
speed_bits == MII_CTL_SPEED_10_MBPS ? "10" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 0) && (pdesc->lo == 8)) {
|
||||
printf("%2u = %5u duplex = %s",
|
||||
pdesc->lo,
|
||||
(regval >> pdesc->lo) & 1,
|
||||
((regval >> pdesc->lo) & 1) ? "full" : "half");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 4) && (pdesc->lo == 0)) {
|
||||
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
|
||||
printf("%2u-%2u = %5u selector = %s",
|
||||
pdesc->hi, pdesc->lo, sel_bits,
|
||||
sel_bits == MII_AN_ADV_IEEE_802_3 ?
|
||||
"IEEE 802.3" :
|
||||
sel_bits == MII_AN_ADV_IEEE_802_9_ISLAN_16T ?
|
||||
"IEEE 802.9 ISLAN-16T" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
else if ((regno == 5) && (pdesc->lo == 0)) {
|
||||
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
|
||||
printf("%2u-%2u = %u selector = %s",
|
||||
pdesc->hi, pdesc->lo, sel_bits,
|
||||
sel_bits == MII_AN_PARTNER_IEEE_802_3 ?
|
||||
"IEEE 802.3" :
|
||||
sel_bits == MII_AN_PARTNER_IEEE_802_9_ISLAN_16T ?
|
||||
"IEEE 802.9 ISLAN-16T" :
|
||||
"???");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint last_op;
|
||||
uint last_data;
|
||||
uint last_addr_lo;
|
||||
uint last_addr_hi;
|
||||
uint last_reg_lo;
|
||||
uint last_reg_hi;
|
||||
|
||||
static void extract_range(
|
||||
char * input,
|
||||
unsigned char * plo,
|
||||
unsigned char * phi)
|
||||
{
|
||||
char * end;
|
||||
*plo = simple_strtoul(input, &end, 16);
|
||||
if (*end == '-') {
|
||||
end++;
|
||||
*phi = simple_strtoul(end, NULL, 16);
|
||||
}
|
||||
else {
|
||||
*phi = *plo;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
int do_mii (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
||||
{
|
||||
char op;
|
||||
unsigned char addrlo, addrhi, reglo, reghi;
|
||||
unsigned char addr, reg;
|
||||
unsigned short data;
|
||||
int rcode = 0;
|
||||
|
||||
#ifdef CONFIG_8xx
|
||||
mii_init ();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We use the last specified parameters, unless new ones are
|
||||
* entered.
|
||||
*/
|
||||
op = last_op;
|
||||
addrlo = last_addr_lo;
|
||||
addrhi = last_addr_hi;
|
||||
reglo = last_reg_lo;
|
||||
reghi = last_reg_hi;
|
||||
data = last_data;
|
||||
|
||||
if ((flag & CMD_FLAG_REPEAT) == 0) {
|
||||
op = argv[1][0];
|
||||
if (argc >= 3)
|
||||
extract_range(argv[2], &addrlo, &addrhi);
|
||||
if (argc >= 4)
|
||||
extract_range(argv[3], ®lo, ®hi);
|
||||
if (argc >= 5)
|
||||
data = simple_strtoul (argv[4], NULL, 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* check info/read/write.
|
||||
*/
|
||||
if (op == 'i') {
|
||||
unsigned char j, start, end;
|
||||
unsigned int oui;
|
||||
unsigned char model;
|
||||
unsigned char rev;
|
||||
|
||||
/*
|
||||
* Look for any and all PHYs. Valid addresses are 0..31.
|
||||
*/
|
||||
if (argc >= 3) {
|
||||
start = addr; end = addr + 1;
|
||||
} else {
|
||||
start = 0; end = 32;
|
||||
}
|
||||
|
||||
for (j = start; j < end; j++) {
|
||||
if (miiphy_info (j, &oui, &model, &rev) == 0) {
|
||||
printf("PHY 0x%02X: "
|
||||
"OUI = 0x%04X, "
|
||||
"Model = 0x%02X, "
|
||||
"Rev = 0x%02X, "
|
||||
"%3dbaseT, %s\n",
|
||||
j, oui, model, rev,
|
||||
miiphy_speed (j),
|
||||
miiphy_duplex (j) == FULL ? "FDX" : "HDX");
|
||||
}
|
||||
}
|
||||
} else if (op == 'r') {
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = reglo; reg <= reghi; reg++) {
|
||||
data = 0xffff;
|
||||
if (miiphy_read (addr, reg, &data) != 0) {
|
||||
printf(
|
||||
"Error reading from the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
else {
|
||||
if ((addrlo != addrhi) || (reglo != reghi))
|
||||
printf("addr=%02x reg=%02x data=",
|
||||
(uint)addr, (uint)reg);
|
||||
printf("%04X\n", data & 0x0000FFFF);
|
||||
}
|
||||
}
|
||||
if ((addrlo != addrhi) && (reglo != reghi))
|
||||
printf("\n");
|
||||
}
|
||||
} else if (op == 'w') {
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = reglo; reg <= reghi; reg++) {
|
||||
if (miiphy_write (addr, reg, data) != 0) {
|
||||
printf("Error writing to the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (op == 'd') {
|
||||
ushort regs[6];
|
||||
int ok = 1;
|
||||
if ((reglo > 5) || (reghi > 5)) {
|
||||
printf(
|
||||
"The MII dump command only formats the "
|
||||
"standard MII registers, 0-5.\n");
|
||||
return 1;
|
||||
}
|
||||
for (addr = addrlo; addr <= addrhi; addr++) {
|
||||
for (reg = 0; reg < 6; reg++) {
|
||||
if (miiphy_read(addr, reg, ®s[reg]) != 0) {
|
||||
ok = 0;
|
||||
printf(
|
||||
"Error reading from the PHY addr=%02x reg=%02x\n",
|
||||
addr, reg);
|
||||
rcode = 1;
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
MII_dump_0_to_5(regs, reglo, reghi);
|
||||
printf("\n");
|
||||
}
|
||||
} else {
|
||||
printf("Usage:\n%s\n", cmdtp->usage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the parameters for repeats.
|
||||
*/
|
||||
last_op = op;
|
||||
last_addr_lo = addrlo;
|
||||
last_addr_hi = addrhi;
|
||||
last_reg_lo = reglo;
|
||||
last_reg_hi = reghi;
|
||||
last_data = data;
|
||||
|
||||
return rcode;
|
||||
}
|
||||
|
||||
/***************************************************/
|
||||
|
||||
U_BOOT_CMD(
|
||||
mii, 5, 1, do_mii,
|
||||
"mii - MII utility commands\n",
|
||||
"info <addr> - display MII PHY info\n"
|
||||
"mii read <addr> <reg> - read MII PHY <addr> register <reg>\n"
|
||||
"mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>\n"
|
||||
"mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)\n"
|
||||
"Addr and/or reg may be ranges, e.g. 2-7.\n"
|
||||
);
|
||||
|
||||
#endif /* CONFIG_TERSE_MII */
|
||||
|
||||
#endif /* CFG_CMD_MII */
|
||||
|
||||
@@ -598,14 +598,14 @@ U_BOOT_CMD(
|
||||
usb, 5, 1, do_usb,
|
||||
"usb - USB sub-system\n",
|
||||
"reset - reset (rescan) USB controller\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\n"
|
||||
"usb tree - show USB device tree\n"
|
||||
"usb info [dev] - show available USB devices\n"
|
||||
"usb scan - (re-)scan USB bus for storage devices\n"
|
||||
"usb device [dev] - show or set current USB storage device\n"
|
||||
"usb part [dev] - print partition table of one or all USB storage devices\n"
|
||||
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
|
||||
" to memory address `addr'\n"
|
||||
"usb stop [f] - stop USB [f]=force stop\n"
|
||||
"usb tree - show USB device tree\n"
|
||||
"usb info [dev] - show available USB devices\n"
|
||||
"usb scan - (re-)scan USB bus for storage devices\n"
|
||||
"usb device [dev] - show or set current USB storage device\n"
|
||||
"usb part [dev] - print partition table of one or all USB storage devices\n"
|
||||
"usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'\n"
|
||||
" to memory address `addr'\n"
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -726,8 +726,8 @@ static void process_macros (const char *input, char *output)
|
||||
int inputcnt = strlen (input);
|
||||
int outputcnt = CFG_CBSIZE;
|
||||
int state = 0; /* 0 = waiting for '$' */
|
||||
/* 1 = waiting for '(' */
|
||||
/* 2 = waiting for ')' */
|
||||
/* 1 = waiting for '(' or '{' */
|
||||
/* 2 = waiting for ')' or '}' */
|
||||
/* 3 = waiting for ''' */
|
||||
#ifdef DEBUG_PARSER
|
||||
char *output_start = output;
|
||||
@@ -765,7 +765,7 @@ static void process_macros (const char *input, char *output)
|
||||
}
|
||||
break;
|
||||
case 1: /* Waiting for ( */
|
||||
if (c == '(') {
|
||||
if (c == '(' || c == '{') {
|
||||
state++;
|
||||
varname_start = input;
|
||||
} else {
|
||||
@@ -780,7 +780,7 @@ static void process_macros (const char *input, char *output)
|
||||
}
|
||||
break;
|
||||
case 2: /* Waiting for ) */
|
||||
if (c == ')') {
|
||||
if (c == ')' || c == '}') {
|
||||
int i;
|
||||
char envname[CFG_CBSIZE], *envval;
|
||||
int envcnt = input-varname_start-1; /* Varname # of chars */
|
||||
|
||||
43
cpu/microblaze/Makefile
Normal file
43
cpu/microblaze/Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# (C) Copyright 2000
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
LIB = lib$(CPU).a
|
||||
|
||||
START = start.o
|
||||
OBJS = cpu.o interrupts.o
|
||||
|
||||
all: .depend $(START) $(LIB)
|
||||
|
||||
$(LIB): $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c) $(AOBJS:.o=.S)
|
||||
$(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) $(AOBJS:.o=.S) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
25
cpu/microblaze/cpu.c
Normal file
25
cpu/microblaze/cpu.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* EMPTY FILE */
|
||||
32
cpu/microblaze/interrupts.c
Normal file
32
cpu/microblaze/interrupts.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
void enable_interrupts(void)
|
||||
{
|
||||
}
|
||||
|
||||
int disable_interrupts(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
36
cpu/microblaze/start.S
Normal file
36
cpu/microblaze/start.S
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
.text
|
||||
.global _start
|
||||
_start:
|
||||
|
||||
addi r1, r0, CFG_SDRAM_BASE /* init stack pointer */
|
||||
addi r1, r1, CFG_SDRAM_SIZE /* set sp to high up */
|
||||
|
||||
brai board_init
|
||||
|
||||
1: bri 1b
|
||||
@@ -103,6 +103,9 @@ boot_cold:
|
||||
boot_warm:
|
||||
mfmsr r5 /* save msr contents */
|
||||
|
||||
/* Move CSBoot and adjust instruction pointer */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
#if defined(CFG_LOWBOOT)
|
||||
#if defined(CFG_RAMBOOT)
|
||||
#error CFG_LOWBOOT is incompatible with CFG_RAMBOOT
|
||||
@@ -113,19 +116,15 @@ boot_warm:
|
||||
stw r3, 0x4(r4) /* CS0 start */
|
||||
lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
|
||||
ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
|
||||
|
||||
stw r3, 0x8(r4) /* CS0 stop */
|
||||
lis r3, 0x00047800@h
|
||||
ori r3, r3, 0x00047800@l
|
||||
stw r3, 0x300(r4) /* set timing, CS0/boot conf reg */
|
||||
lis r3, 0x02010000@h
|
||||
ori r3, r3, 0x02010000@l
|
||||
stw r3, 0x54(r4) /* CS0 and Boot enable, IPBI ctrl reg */
|
||||
stw r3, 0x54(r4) /* CS0 and Boot enable */
|
||||
|
||||
lis r3, lowboot_reentry@h
|
||||
ori r3, r3, lowboot_reentry@l
|
||||
lis r3, lowboot_reentry@h /* jump from bootlow address space (0x0000xxxx) */
|
||||
ori r3, r3, lowboot_reentry@l /* to the address space the linker used */
|
||||
mtlr r3
|
||||
blr /* jump to flash based address */
|
||||
blr
|
||||
|
||||
lowboot_reentry:
|
||||
lis r3, START_REG(CFG_BOOTCS_START)@h
|
||||
@@ -134,12 +133,9 @@ lowboot_reentry:
|
||||
lis r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@h
|
||||
ori r3, r3, STOP_REG(CFG_BOOTCS_START, CFG_BOOTCS_SIZE)@l
|
||||
stw r3, 0x50(r4) /* Boot stop */
|
||||
lis r3, 0x00047800@h
|
||||
ori r3, r3, 0x00047800@l
|
||||
stw r3, 0x300(r4) /* set timing, CS0/boot conf reg */
|
||||
lis r3, 0x02000001@h
|
||||
ori r3, r3, 0x02000001@l
|
||||
stw r3, 0x54(r4) /* Boot enable, CS0 disable, wait state enable */
|
||||
stw r3, 0x54(r4) /* Boot enable, CS0 disable */
|
||||
#endif /* CFG_LOWBOOT */
|
||||
|
||||
#if defined(CFG_DEFAULT_MBAR) && !defined(CFG_RAMBOOT)
|
||||
|
||||
@@ -291,8 +291,8 @@ void pci_mpc8250_init (struct pci_controller *hose)
|
||||
immap->im_memctl.memc_pcibr0 = PCI_MSTR0_LOCAL | PCIBR_ENABLE;
|
||||
|
||||
#ifdef CONFIG_MPC8266ADS
|
||||
immap->im_memctl.memc_pcimsk0 = PCIMSK1_MASK;
|
||||
immap->im_memctl.memc_pcibr0 = PCI_MSTR1_LOCAL | PCIBR_ENABLE;
|
||||
immap->im_memctl.memc_pcimsk1 = PCIMSK1_MASK;
|
||||
immap->im_memctl.memc_pcibr1 = PCI_MSTR1_LOCAL | PCIBR_ENABLE;
|
||||
#endif
|
||||
|
||||
/* Release PCI RST (by default the PCI RST signal is held low) */
|
||||
|
||||
@@ -49,9 +49,12 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length);
|
||||
static int tsec_recv(struct eth_device* dev);
|
||||
static int tsec_init(struct eth_device* dev, bd_t * bd);
|
||||
static void tsec_halt(struct eth_device* dev);
|
||||
static void init_registers(volatile tsec_t *regs);
|
||||
static void startup_tsec(volatile tsec_t *regs);
|
||||
static void init_phy(volatile tsec_t *regs);
|
||||
static void init_registers(tsec_t *regs);
|
||||
static void startup_tsec(tsec_t *regs);
|
||||
static void init_phy(tsec_t *regs);
|
||||
uint read_phy_reg(tsec_t *regbase, uint phyid, uint offset);
|
||||
|
||||
static int phy_id = -1;
|
||||
|
||||
/* Initialize device structure. returns 0 on failure, 1 on
|
||||
* success */
|
||||
@@ -59,6 +62,7 @@ int tsec_initialize(bd_t *bis)
|
||||
{
|
||||
struct eth_device* dev;
|
||||
int i;
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
dev = (struct eth_device*) malloc(sizeof *dev);
|
||||
|
||||
@@ -67,7 +71,7 @@ int tsec_initialize(bd_t *bis)
|
||||
|
||||
memset(dev, 0, sizeof *dev);
|
||||
|
||||
sprintf(dev->name, "MOTOROLA ETHERNET");
|
||||
sprintf(dev->name, "MOTO ETHERNET");
|
||||
dev->iobase = 0;
|
||||
dev->priv = 0;
|
||||
dev->init = tsec_init;
|
||||
@@ -81,6 +85,45 @@ int tsec_initialize(bd_t *bis)
|
||||
|
||||
eth_register(dev);
|
||||
|
||||
/* Reconfigure the PHY to advertise everything here
|
||||
* so that it works with both gigabit and 10/100 */
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
/* Assign a Physical address to the TBI */
|
||||
regs->tbipa=TBIPA_VALUE;
|
||||
|
||||
/* reset the management interface */
|
||||
regs->miimcfg=MIIMCFG_RESET;
|
||||
|
||||
regs->miimcfg=MIIMCFG_INIT_VALUE;
|
||||
|
||||
/* Wait until the bus is free */
|
||||
while(regs->miimind & MIIMIND_BUSY);
|
||||
|
||||
/* Locate PHYs. Skip TBIPA, which we know is 31.
|
||||
*/
|
||||
for (i=0; i<31; i++) {
|
||||
if (read_phy_reg(regs, i, 2) == 0x141) {
|
||||
if (phy_id == -1)
|
||||
phy_id = i;
|
||||
#ifdef TSEC_DEBUG
|
||||
printf("Found Marvell PHY at 0x%02x\n", i);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef TSEC_DEBUG
|
||||
printf("Using PHY ID 0x%02x\n", phy_id);
|
||||
#endif
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_RESET);
|
||||
|
||||
RESET_ERRATA(regs, phy_id);
|
||||
|
||||
/* Configure the PHY to advertise gbit and 10/100 */
|
||||
write_phy_reg(regs, phy_id, MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT);
|
||||
write_phy_reg(regs, phy_id, MIIM_ANAR, MIIM_ANAR_INIT);
|
||||
|
||||
/* Reset the PHY so the new settings take effect */
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_RESET);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -89,12 +132,12 @@ int tsec_initialize(bd_t *bis)
|
||||
* and brings the interface up */
|
||||
int tsec_init(struct eth_device* dev, bd_t * bd)
|
||||
{
|
||||
volatile tsec_t *regs;
|
||||
tsec_t *regs;
|
||||
uint tempval;
|
||||
char tmpbuf[MAC_ADDR_LEN];
|
||||
int i;
|
||||
|
||||
regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
/* Make sure the controller is stopped */
|
||||
tsec_halt(dev);
|
||||
@@ -146,7 +189,7 @@ int tsec_init(struct eth_device* dev, bd_t * bd)
|
||||
/* and then passes those bits on to the variable specified in */
|
||||
/* value */
|
||||
/* Before it does the read, it needs to clear the command field */
|
||||
uint read_phy_reg(volatile tsec_t *regbase, uint phyid, uint offset)
|
||||
uint read_phy_reg(tsec_t *regbase, uint phyid, uint offset)
|
||||
{
|
||||
uint value;
|
||||
|
||||
@@ -173,7 +216,7 @@ uint read_phy_reg(volatile tsec_t *regbase, uint phyid, uint offset)
|
||||
}
|
||||
|
||||
/* Setup the PHY */
|
||||
static void init_phy(volatile tsec_t *regs)
|
||||
static void init_phy(tsec_t *regs)
|
||||
{
|
||||
uint testval;
|
||||
unsigned int timeout = TSEC_TIMEOUT;
|
||||
@@ -198,17 +241,17 @@ static void init_phy(volatile tsec_t *regs)
|
||||
#endif
|
||||
|
||||
/* Set the PHY to gigabit, full duplex, Auto-negotiate */
|
||||
write_phy_reg(regs, 0, MIIM_CONTROL, MIIM_CONTROL_INIT);
|
||||
write_phy_reg(regs, phy_id, MIIM_CONTROL, MIIM_CONTROL_INIT);
|
||||
|
||||
/* Wait until TBI_STATUS indicates AN is done */
|
||||
/* Wait until STATUS indicates Auto-Negotiation is done */
|
||||
DBGPRINT("Waiting for Auto-negotiation to complete\n");
|
||||
testval=read_phy_reg(regs, 0, MIIM_TBI_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_STATUS);
|
||||
|
||||
while((!(testval & MIIM_TBI_STATUS_AN_DONE))&& timeout--) {
|
||||
testval=read_phy_reg(regs, 0, MIIM_TBI_STATUS);
|
||||
while((!(testval & MIIM_STATUS_AN_DONE))&& timeout--) {
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_STATUS);
|
||||
}
|
||||
|
||||
if(testval & MIIM_TBI_STATUS_AN_DONE)
|
||||
if(testval & MIIM_STATUS_AN_DONE)
|
||||
DBGPRINT("Auto-negotiation done\n");
|
||||
else
|
||||
DBGPRINT("Auto-negotiation timed-out.\n");
|
||||
@@ -216,7 +259,7 @@ static void init_phy(volatile tsec_t *regs)
|
||||
#ifdef CONFIG_PHY_CIS8201
|
||||
/* Find out what duplexity (duplicity?) we have */
|
||||
/* Read it twice to make sure */
|
||||
testval=read_phy_reg(regs, 0, MIIM_AUX_CONSTAT);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_AUX_CONSTAT);
|
||||
|
||||
if(testval & MIIM_AUXCONSTAT_DUPLEX) {
|
||||
DBGPRINT("Enet starting in full duplex\n");
|
||||
@@ -246,17 +289,17 @@ static void init_phy(volatile tsec_t *regs)
|
||||
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
/* Read the PHY to see what speed and duplex we are */
|
||||
testval=read_phy_reg(regs, 0, MIIM_PHY_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_PHY_STATUS);
|
||||
|
||||
timeout = TSEC_TIMEOUT;
|
||||
while((!(testval & MIIM_PHYSTAT_SPDDONE)) && timeout--) {
|
||||
testval = read_phy_reg(regs,0,MIIM_PHY_STATUS);
|
||||
testval = read_phy_reg(regs,phy_id,MIIM_PHY_STATUS);
|
||||
}
|
||||
|
||||
if(!(testval & MIIM_PHYSTAT_SPDDONE))
|
||||
DBGPRINT("Enet: Speed not resolved\n");
|
||||
|
||||
testval=read_phy_reg(regs, 0, MIIM_PHY_STATUS);
|
||||
testval=read_phy_reg(regs, phy_id, MIIM_PHY_STATUS);
|
||||
if(testval & MIIM_PHYSTAT_DUPLEX) {
|
||||
DBGPRINT("Enet starting in Full Duplex\n");
|
||||
regs->maccfg2 |= MACCFG2_FULL_DUPLEX;
|
||||
@@ -280,7 +323,7 @@ static void init_phy(volatile tsec_t *regs)
|
||||
}
|
||||
|
||||
|
||||
static void init_registers(volatile tsec_t *regs)
|
||||
static void init_registers(tsec_t *regs)
|
||||
{
|
||||
/* Clear IEVENT */
|
||||
regs->ievent = IEVENT_INIT_CLEAR;
|
||||
@@ -322,7 +365,7 @@ static void init_registers(volatile tsec_t *regs)
|
||||
|
||||
}
|
||||
|
||||
static void startup_tsec(volatile tsec_t *regs)
|
||||
static void startup_tsec(tsec_t *regs)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -363,7 +406,7 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
{
|
||||
int i;
|
||||
int result = 0;
|
||||
volatile tsec_t * regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t * regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
/* Find an empty buffer descriptor */
|
||||
for(i=0; rtx.txbd[txIdx].status & TXBD_READY; i++) {
|
||||
@@ -397,7 +440,7 @@ static int tsec_send(struct eth_device* dev, volatile void *packet, int length)
|
||||
static int tsec_recv(struct eth_device* dev)
|
||||
{
|
||||
int length;
|
||||
volatile tsec_t *regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
while(!(rtx.rxbd[rxIdx].status & RXBD_EMPTY)) {
|
||||
|
||||
@@ -428,7 +471,7 @@ static int tsec_recv(struct eth_device* dev)
|
||||
|
||||
static void tsec_halt(struct eth_device* dev)
|
||||
{
|
||||
volatile tsec_t *regs = (volatile tsec_t *)(TSEC_BASE_ADDR);
|
||||
tsec_t *regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
|
||||
regs->dmactrl &= ~(DMACTRL_GRS | DMACTRL_GTS);
|
||||
regs->dmactrl |= (DMACTRL_GRS | DMACTRL_GTS);
|
||||
@@ -438,4 +481,44 @@ static void tsec_halt(struct eth_device* dev)
|
||||
regs->maccfg1 &= ~(MACCFG1_TX_EN | MACCFG1_RX_EN);
|
||||
|
||||
}
|
||||
|
||||
#ifndef CONFIG_BITBANGMII
|
||||
/*
|
||||
* Read a MII PHY register.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success
|
||||
*/
|
||||
int miiphy_read(unsigned char addr,
|
||||
unsigned char reg,
|
||||
unsigned short *value)
|
||||
{
|
||||
tsec_t *regs;
|
||||
unsigned short rv;
|
||||
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
rv = (unsigned short)read_phy_reg(regs, addr, reg);
|
||||
*value = rv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a MII PHY register.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success
|
||||
*/
|
||||
int miiphy_write(unsigned char addr,
|
||||
unsigned char reg,
|
||||
unsigned short value)
|
||||
{
|
||||
tsec_t *regs;
|
||||
|
||||
regs = (tsec_t *)(TSEC_BASE_ADDR);
|
||||
write_phy_reg(regs, addr, reg, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BITBANGMII */
|
||||
#endif /* CONFIG_TSEC_ENET */
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
#include <net.h>
|
||||
#include <mpc85xx.h>
|
||||
|
||||
/* TSEC1 is offset 0x24000, TSEC2 is offset 0x25000
|
||||
#define TSEC_BASE_ADDR (CFG_IMMR + 0x25000)
|
||||
*/
|
||||
#define TSEC_BASE_ADDR (CFG_IMMR + 0x24000)
|
||||
#define TSEC_MEM_SIZE 0x01000
|
||||
|
||||
@@ -56,16 +59,16 @@
|
||||
#define MIIMIND_BUSY 0x00000001
|
||||
#define MIIMIND_NOTVALID 0x00000004
|
||||
|
||||
#define MIIM_TBICON 0x11
|
||||
#define MIIM_TBICON_GMII 0x00000010
|
||||
#define MIIM_TBICON_AN 0x00000100
|
||||
|
||||
#define MIIM_CONTROL 0x00
|
||||
#define MIIM_CONTROL_INIT 0x00001140
|
||||
#define MIIM_ANEN 0x00001000
|
||||
#define MIIM_CONTROL_RESET 0x00009140
|
||||
|
||||
#define MIIM_TBI_STATUS 0x1
|
||||
#define MIIM_TBI_STATUS_AN_DONE 0x00000020
|
||||
#define MIIM_STATUS 0x1
|
||||
#define MIIM_STATUS_AN_DONE 0x00000020
|
||||
|
||||
#define MIIM_GBIT_CONTROL 0x9
|
||||
#define MIIM_GBIT_CONTROL_INIT 0xe00
|
||||
|
||||
#define MIIM_TBI_ANEX 0x6
|
||||
#define MIIM_TBI_ANEX_NP 0x00000004
|
||||
@@ -89,11 +92,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PHY_M88E1011
|
||||
#define MIIM_ANAR 0x04
|
||||
#define MIIM_ANAR_ADVERTISEMENT 0x01e1
|
||||
#define MIIM_ANAR 0x4
|
||||
#define MIIM_ANAR_INIT 0x1e1
|
||||
|
||||
#define MIIM_GBIT_CON 0x09
|
||||
#define MIIM_GBIT_CON_ADVERT 0x1e00
|
||||
#define MIIM_GBIT_CON_ADVERT 0x0e00
|
||||
|
||||
#define MIIM_PHY_STATUS 0x11
|
||||
#define MIIM_PHYSTAT_SPEED 0xc000
|
||||
@@ -130,6 +133,15 @@
|
||||
} while(0)
|
||||
|
||||
|
||||
/* This works around errata in reseting the PHY */
|
||||
#define RESET_ERRATA(regs, ID) do { \
|
||||
write_phy_reg(regs, (ID), 0x1d, 0x1f); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x200c); \
|
||||
write_phy_reg(regs, (ID), 0x1d, 0x5); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x0); \
|
||||
write_phy_reg(regs, (ID), 0x1e, 0x100); \
|
||||
} while(0)
|
||||
|
||||
#define IEVENT_INIT_CLEAR 0xffffffff
|
||||
#define IEVENT_BABR 0x80000000
|
||||
#define IEVENT_RXC 0x40000000
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
---------------------------------------------------------------------------
|
||||
Build target Flash address | BDI "go" command | Reset Vector
|
||||
---------------------------------------------------------------------------
|
||||
MPC5200LITE 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
MPC5200LITE_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
MPC5200LITE_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
Lite5200 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
Lite5200_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
Lite5200_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
icecube_5200_LOWBOOT 0xFF000000 | 0xFF000100 | 0x00000100
|
||||
icecube_5200_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR 0xFFF00000 | 0xFFF00100 | 0xFFF00100
|
||||
icecube_5200_DDR_LOWBOOT 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
icecube_5200_DDR_LOWBOOT08 0xFF800000 | 0xFF800100 | 0x00000100
|
||||
|
||||
@@ -37,9 +37,10 @@ OBJS = 3c589.o 5701rls.o ali512x.o \
|
||||
pci.o pci_auto.o pci_indirect.o \
|
||||
pcnet.o plb2800_eth.o \
|
||||
ps2ser.o ps2mult.o pc_keyb.o keyboard.o \
|
||||
rtl8019.o rtl8139.o \
|
||||
rtl8019.o rtl8139.o rtl8169.o \
|
||||
s3c24x0_i2c.o sed13806.o sed156x.o \
|
||||
serial.o serial_max3100.o serial_pl011.o serial_pl010.o \
|
||||
serial.o serial_max3100.o serial_pl010.o serial_pl011.o \
|
||||
serial_xuartlite.o sl811_usb.o \
|
||||
smc91111.o smiLynxEM.o status_led.o sym53c8xx.o \
|
||||
ti_pci1410a.o tigon3.o w83c553f.o omap1510_i2c.o \
|
||||
usbdcore.o usbdcore_ep0.o usbdcore_omap1510.o usbtty.o \
|
||||
|
||||
@@ -103,14 +103,14 @@ int pci_hose_write_config_##size##_via_dword(struct pci_controller *hose,\
|
||||
pci_dev_t dev, \
|
||||
int offset, type val) \
|
||||
{ \
|
||||
u32 val32, mask, ldata; \
|
||||
u32 val32, mask, ldata, shift; \
|
||||
\
|
||||
if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0)\
|
||||
return -1; \
|
||||
\
|
||||
mask = val_mask; \
|
||||
ldata = (((unsigned long)val) & mask) << ((offset & (int)off_mask) * 8);\
|
||||
mask <<= ((mask & (int)off_mask) * 8); \
|
||||
shift = ((offset & (int)off_mask) * 8); \
|
||||
ldata = (((unsigned long)val) & val_mask) << shift; \
|
||||
mask = val_mask << shift; \
|
||||
val32 = (val32 & ~mask) | ldata; \
|
||||
\
|
||||
if (pci_hose_write_config_dword(hose, dev, offset & 0xfc, val32) < 0)\
|
||||
|
||||
888
drivers/rtl8169.c
Normal file
888
drivers/rtl8169.c
Normal file
@@ -0,0 +1,888 @@
|
||||
/*
|
||||
* rtl8169.c : U-Boot driver for the RealTek RTL8169
|
||||
*
|
||||
* Masami Komiya (mkomiya@sonare.it)
|
||||
*
|
||||
* Most part is taken from r8169.c of etherboot
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
* r8169.c: Etherboot device driver for the RealTek RTL-8169 Gigabit
|
||||
* Written 2003 by Timothy Legge <tlegge@rogers.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* Portions of this code based on:
|
||||
* r8169.c: A RealTek RTL-8169 Gigabit Ethernet driver
|
||||
* for Linux kernel 2.4.x.
|
||||
*
|
||||
* Written 2002 ShuChen <shuchen@realtek.com.tw>
|
||||
* See Linux Driver for full information
|
||||
*
|
||||
* Linux Driver Version 1.27a, 10.02.2002
|
||||
*
|
||||
* Thanks to:
|
||||
* Jean Chen of RealTek Semiconductor Corp. for
|
||||
* providing the evaluation NIC used to develop
|
||||
* this driver. RealTek's support for Etherboot
|
||||
* is appreciated.
|
||||
*
|
||||
* REVISION HISTORY:
|
||||
* ================
|
||||
*
|
||||
* v1.0 11-26-2003 timlegge Initial port of Linux driver
|
||||
* v1.5 01-17-2004 timlegge Initial driver output cleanup
|
||||
*
|
||||
* Indent Options: indent -kr -i8
|
||||
***************************************************************************/
|
||||
|
||||
#include <common.h>
|
||||
#include <malloc.h>
|
||||
#include <net.h>
|
||||
#include <asm/io.h>
|
||||
#include <pci.h>
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
|
||||
defined(CONFIG_RTL8169)
|
||||
|
||||
#undef DEBUG_RTL8169
|
||||
#undef DEBUG_RTL8169_TX
|
||||
#undef DEBUG_RTL8169_RX
|
||||
|
||||
#define drv_version "v1.5"
|
||||
#define drv_date "01-17-2004"
|
||||
|
||||
static u32 ioaddr;
|
||||
|
||||
/* Condensed operations for readability. */
|
||||
#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
|
||||
#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
|
||||
|
||||
#define currticks() get_timer(0)
|
||||
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a)
|
||||
#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
|
||||
|
||||
/* media options */
|
||||
#define MAX_UNITS 8
|
||||
static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
|
||||
/* MAC address length*/
|
||||
#define MAC_ADDR_LEN 6
|
||||
|
||||
/* max supported gigabit ethernet frame size -- must be at least (dev->mtu+14+4).*/
|
||||
#define MAX_ETH_FRAME_SIZE 1536
|
||||
|
||||
#define TX_FIFO_THRESH 256 /* In bytes */
|
||||
|
||||
#define RX_FIFO_THRESH 7 /* 7 means NO threshold, Rx buffer level before first PCI xfer. */
|
||||
#define RX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
|
||||
#define TX_DMA_BURST 6 /* Maximum PCI burst, '6' is 1024 */
|
||||
#define EarlyTxThld 0x3F /* 0x3F means NO early transmit */
|
||||
#define RxPacketMaxSize 0x0800 /* Maximum size supported is 16K-1 */
|
||||
#define InterFrameGap 0x03 /* 3 means InterFrameGap = the shortest one */
|
||||
|
||||
#define NUM_TX_DESC 1 /* Number of Tx descriptor registers */
|
||||
#define NUM_RX_DESC 4 /* Number of Rx descriptor registers */
|
||||
#define RX_BUF_SIZE 1536 /* Rx Buffer size */
|
||||
#define RX_BUF_LEN 8192
|
||||
|
||||
#define RTL_MIN_IO_SIZE 0x80
|
||||
#define TX_TIMEOUT (6*HZ)
|
||||
|
||||
/* write/read MMIO register */
|
||||
#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
|
||||
#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
|
||||
#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
|
||||
#define RTL_R8(reg) readb (ioaddr + (reg))
|
||||
#define RTL_R16(reg) readw (ioaddr + (reg))
|
||||
#define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg)))
|
||||
|
||||
#define ETH_FRAME_LEN MAX_ETH_FRAME_SIZE
|
||||
#define ETH_ALEN MAC_ADDR_LEN
|
||||
#define ETH_ZLEN 60
|
||||
|
||||
enum RTL8169_registers {
|
||||
MAC0 = 0, /* Ethernet hardware address. */
|
||||
MAR0 = 8, /* Multicast filter. */
|
||||
TxDescStartAddr = 0x20,
|
||||
TxHDescStartAddr = 0x28,
|
||||
FLASH = 0x30,
|
||||
ERSR = 0x36,
|
||||
ChipCmd = 0x37,
|
||||
TxPoll = 0x38,
|
||||
IntrMask = 0x3C,
|
||||
IntrStatus = 0x3E,
|
||||
TxConfig = 0x40,
|
||||
RxConfig = 0x44,
|
||||
RxMissed = 0x4C,
|
||||
Cfg9346 = 0x50,
|
||||
Config0 = 0x51,
|
||||
Config1 = 0x52,
|
||||
Config2 = 0x53,
|
||||
Config3 = 0x54,
|
||||
Config4 = 0x55,
|
||||
Config5 = 0x56,
|
||||
MultiIntr = 0x5C,
|
||||
PHYAR = 0x60,
|
||||
TBICSR = 0x64,
|
||||
TBI_ANAR = 0x68,
|
||||
TBI_LPAR = 0x6A,
|
||||
PHYstatus = 0x6C,
|
||||
RxMaxSize = 0xDA,
|
||||
CPlusCmd = 0xE0,
|
||||
RxDescStartAddr = 0xE4,
|
||||
EarlyTxThres = 0xEC,
|
||||
FuncEvent = 0xF0,
|
||||
FuncEventMask = 0xF4,
|
||||
FuncPresetState = 0xF8,
|
||||
FuncForceEvent = 0xFC,
|
||||
};
|
||||
|
||||
enum RTL8169_register_content {
|
||||
/*InterruptStatusBits */
|
||||
SYSErr = 0x8000,
|
||||
PCSTimeout = 0x4000,
|
||||
SWInt = 0x0100,
|
||||
TxDescUnavail = 0x80,
|
||||
RxFIFOOver = 0x40,
|
||||
RxUnderrun = 0x20,
|
||||
RxOverflow = 0x10,
|
||||
TxErr = 0x08,
|
||||
TxOK = 0x04,
|
||||
RxErr = 0x02,
|
||||
RxOK = 0x01,
|
||||
|
||||
/*RxStatusDesc */
|
||||
RxRES = 0x00200000,
|
||||
RxCRC = 0x00080000,
|
||||
RxRUNT = 0x00100000,
|
||||
RxRWT = 0x00400000,
|
||||
|
||||
/*ChipCmdBits */
|
||||
CmdReset = 0x10,
|
||||
CmdRxEnb = 0x08,
|
||||
CmdTxEnb = 0x04,
|
||||
RxBufEmpty = 0x01,
|
||||
|
||||
/*Cfg9346Bits */
|
||||
Cfg9346_Lock = 0x00,
|
||||
Cfg9346_Unlock = 0xC0,
|
||||
|
||||
/*rx_mode_bits */
|
||||
AcceptErr = 0x20,
|
||||
AcceptRunt = 0x10,
|
||||
AcceptBroadcast = 0x08,
|
||||
AcceptMulticast = 0x04,
|
||||
AcceptMyPhys = 0x02,
|
||||
AcceptAllPhys = 0x01,
|
||||
|
||||
/*RxConfigBits */
|
||||
RxCfgFIFOShift = 13,
|
||||
RxCfgDMAShift = 8,
|
||||
|
||||
/*TxConfigBits */
|
||||
TxInterFrameGapShift = 24,
|
||||
TxDMAShift = 8, /* DMA burst value (0-7) is shift this many bits */
|
||||
|
||||
/*rtl8169_PHYstatus */
|
||||
TBI_Enable = 0x80,
|
||||
TxFlowCtrl = 0x40,
|
||||
RxFlowCtrl = 0x20,
|
||||
_1000bpsF = 0x10,
|
||||
_100bps = 0x08,
|
||||
_10bps = 0x04,
|
||||
LinkStatus = 0x02,
|
||||
FullDup = 0x01,
|
||||
|
||||
/*GIGABIT_PHY_registers */
|
||||
PHY_CTRL_REG = 0,
|
||||
PHY_STAT_REG = 1,
|
||||
PHY_AUTO_NEGO_REG = 4,
|
||||
PHY_1000_CTRL_REG = 9,
|
||||
|
||||
/*GIGABIT_PHY_REG_BIT */
|
||||
PHY_Restart_Auto_Nego = 0x0200,
|
||||
PHY_Enable_Auto_Nego = 0x1000,
|
||||
|
||||
/* PHY_STAT_REG = 1; */
|
||||
PHY_Auto_Neco_Comp = 0x0020,
|
||||
|
||||
/* PHY_AUTO_NEGO_REG = 4; */
|
||||
PHY_Cap_10_Half = 0x0020,
|
||||
PHY_Cap_10_Full = 0x0040,
|
||||
PHY_Cap_100_Half = 0x0080,
|
||||
PHY_Cap_100_Full = 0x0100,
|
||||
|
||||
/* PHY_1000_CTRL_REG = 9; */
|
||||
PHY_Cap_1000_Full = 0x0200,
|
||||
|
||||
PHY_Cap_Null = 0x0,
|
||||
|
||||
/*_MediaType*/
|
||||
_10_Half = 0x01,
|
||||
_10_Full = 0x02,
|
||||
_100_Half = 0x04,
|
||||
_100_Full = 0x08,
|
||||
_1000_Full = 0x10,
|
||||
|
||||
/*_TBICSRBit*/
|
||||
TBILinkOK = 0x02000000,
|
||||
};
|
||||
|
||||
static struct {
|
||||
const char *name;
|
||||
u8 version; /* depend on RTL8169 docs */
|
||||
u32 RxConfigMask; /* should clear the bits supported by this chip */
|
||||
} rtl_chip_info[] = {
|
||||
{"RTL-8169", 0x00, 0xff7e1880,},
|
||||
{"RTL-8169", 0x04, 0xff7e1880,},
|
||||
};
|
||||
|
||||
enum _DescStatusBit {
|
||||
OWNbit = 0x80000000,
|
||||
EORbit = 0x40000000,
|
||||
FSbit = 0x20000000,
|
||||
LSbit = 0x10000000,
|
||||
};
|
||||
|
||||
struct TxDesc {
|
||||
u32 status;
|
||||
u32 vlan_tag;
|
||||
u32 buf_addr;
|
||||
u32 buf_Haddr;
|
||||
};
|
||||
|
||||
struct RxDesc {
|
||||
u32 status;
|
||||
u32 vlan_tag;
|
||||
u32 buf_addr;
|
||||
u32 buf_Haddr;
|
||||
};
|
||||
|
||||
/* Define the TX Descriptor */
|
||||
static u8 tx_ring[NUM_TX_DESC * sizeof(struct TxDesc) + 256];
|
||||
/* __attribute__ ((aligned(256))); */
|
||||
|
||||
/* Create a static buffer of size RX_BUF_SZ for each
|
||||
TX Descriptor. All descriptors point to a
|
||||
part of this buffer */
|
||||
static unsigned char txb[NUM_TX_DESC * RX_BUF_SIZE];
|
||||
|
||||
/* Define the RX Descriptor */
|
||||
static u8 rx_ring[NUM_RX_DESC * sizeof(struct TxDesc) + 256];
|
||||
/* __attribute__ ((aligned(256))); */
|
||||
|
||||
/* Create a static buffer of size RX_BUF_SZ for each
|
||||
RX Descriptor All descriptors point to a
|
||||
part of this buffer */
|
||||
static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE];
|
||||
|
||||
struct rtl8169_private {
|
||||
void *mmio_addr; /* memory map physical address */
|
||||
int chipset;
|
||||
unsigned long cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. */
|
||||
unsigned long cur_tx; /* Index into the Tx descriptor buffer of next Rx pkt. */
|
||||
unsigned long dirty_tx;
|
||||
unsigned char *TxDescArrays; /* Index of Tx Descriptor buffer */
|
||||
unsigned char *RxDescArrays; /* Index of Rx Descriptor buffer */
|
||||
struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
|
||||
struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
|
||||
unsigned char *RxBufferRings; /* Index of Rx Buffer */
|
||||
unsigned char *RxBufferRing[NUM_RX_DESC]; /* Index of Rx Buffer array */
|
||||
unsigned char *Tx_skbuff[NUM_TX_DESC];
|
||||
} tpx;
|
||||
|
||||
static struct rtl8169_private *tpc;
|
||||
|
||||
static const u16 rtl8169_intr_mask =
|
||||
SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr |
|
||||
TxOK | RxErr | RxOK;
|
||||
static const unsigned int rtl8169_rx_config =
|
||||
(RX_FIFO_THRESH << RxCfgFIFOShift) | (RX_DMA_BURST << RxCfgDMAShift);
|
||||
|
||||
static struct pci_device_id supported[] = {
|
||||
{PCI_VENDOR_ID_REALTEK, 0x8169},
|
||||
{}
|
||||
};
|
||||
|
||||
void mdio_write(int RegAddr, int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
RTL_W32(PHYAR, 0x80000000 | (RegAddr & 0xFF) << 16 | value);
|
||||
udelay(1000);
|
||||
|
||||
for (i = 2000; i > 0; i--) {
|
||||
/* Check if the RTL8169 has completed writing to the specified MII register */
|
||||
if (!(RTL_R32(PHYAR) & 0x80000000)) {
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mdio_read(int RegAddr)
|
||||
{
|
||||
int i, value = -1;
|
||||
|
||||
RTL_W32(PHYAR, 0x0 | (RegAddr & 0xFF) << 16);
|
||||
udelay(1000);
|
||||
|
||||
for (i = 2000; i > 0; i--) {
|
||||
/* Check if the RTL8169 has completed retrieving data from the specified MII register */
|
||||
if (RTL_R32(PHYAR) & 0x80000000) {
|
||||
value = (int) (RTL_R32(PHYAR) & 0xFFFF);
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
static int rtl8169_init_board(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
u32 tmp;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* Soft reset the chip. */
|
||||
RTL_W8(ChipCmd, CmdReset);
|
||||
|
||||
/* Check that the chip has finished the reset. */
|
||||
for (i = 1000; i > 0; i--)
|
||||
if ((RTL_R8(ChipCmd) & CmdReset) == 0)
|
||||
break;
|
||||
else
|
||||
udelay(10);
|
||||
|
||||
/* identify chip attached to board */
|
||||
tmp = RTL_R32(TxConfig);
|
||||
tmp = ((tmp & 0x7c000000) + ((tmp & 0x00800000) << 2)) >> 24;
|
||||
|
||||
for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--){
|
||||
if (tmp == rtl_chip_info[i].version) {
|
||||
tpc->chipset = i;
|
||||
goto match;
|
||||
}
|
||||
}
|
||||
|
||||
/* if unknown chip, assume array element #0, original RTL-8169 in this case */
|
||||
printf("PCI device %s: unknown chip version, assuming RTL-8169\n", dev->name);
|
||||
printf("PCI device: TxConfig = 0x%hX\n", (unsigned long) RTL_R32(TxConfig));
|
||||
tpc->chipset = 0;
|
||||
|
||||
match:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
RECV - Receive a frame
|
||||
***************************************************************************/
|
||||
static int rtl_recv(struct eth_device *dev)
|
||||
{
|
||||
/* return true if there's an ethernet packet ready to read */
|
||||
/* nic->packet should contain data on return */
|
||||
/* nic->packetlen should contain length of data */
|
||||
int cur_rx;
|
||||
int length = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169_RX
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
cur_rx = tpc->cur_rx;
|
||||
if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
|
||||
if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
|
||||
unsigned char rxdata[RX_BUF_LEN];
|
||||
length = (int) (tpc->RxDescArray[cur_rx].
|
||||
status & 0x00001FFF) - 4;
|
||||
|
||||
memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);
|
||||
NetReceive(rxdata, length);
|
||||
|
||||
if (cur_rx == NUM_RX_DESC - 1)
|
||||
tpc->RxDescArray[cur_rx].status =
|
||||
(OWNbit | EORbit) + RX_BUF_SIZE;
|
||||
else
|
||||
tpc->RxDescArray[cur_rx].status =
|
||||
OWNbit + RX_BUF_SIZE;
|
||||
tpc->RxDescArray[cur_rx].buf_addr =
|
||||
virt_to_bus(tpc->RxBufferRing[cur_rx]);
|
||||
} else {
|
||||
puts("Error Rx");
|
||||
}
|
||||
cur_rx = (cur_rx + 1) % NUM_RX_DESC;
|
||||
tpc->cur_rx = cur_rx;
|
||||
return 1;
|
||||
|
||||
}
|
||||
tpc->cur_rx = cur_rx;
|
||||
return (0); /* initially as this is called to flush the input */
|
||||
}
|
||||
|
||||
#define HZ 1000
|
||||
/**************************************************************************
|
||||
SEND - Transmit a frame
|
||||
***************************************************************************/
|
||||
static int rtl_send(struct eth_device *dev, volatile void *packet, int length)
|
||||
{
|
||||
/* send the packet to destination */
|
||||
|
||||
u32 to;
|
||||
u8 *ptxb;
|
||||
int entry = tpc->cur_tx % NUM_TX_DESC;
|
||||
u32 len = length;
|
||||
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
printf("sending %d bytes\n", len);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* point to the current txb incase multiple tx_rings are used */
|
||||
ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];
|
||||
memcpy(ptxb, (char *)packet, (int)length);
|
||||
|
||||
while (len < ETH_ZLEN)
|
||||
ptxb[len++] = '\0';
|
||||
|
||||
tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
|
||||
if (entry != (NUM_TX_DESC - 1)) {
|
||||
tpc->TxDescArray[entry].status =
|
||||
(OWNbit | FSbit | LSbit) | ((len > ETH_ZLEN) ?
|
||||
len : ETH_ZLEN);
|
||||
} else {
|
||||
tpc->TxDescArray[entry].status =
|
||||
(OWNbit | EORbit | FSbit | LSbit) |
|
||||
((len > ETH_ZLEN) ? length : ETH_ZLEN);
|
||||
}
|
||||
RTL_W8(TxPoll, 0x40); /* set polling bit */
|
||||
|
||||
tpc->cur_tx++;
|
||||
to = currticks() + TX_TIMEOUT;
|
||||
while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
|
||||
|
||||
if (currticks() >= to) {
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
puts ("tx timeout/error\n");
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
return 0;
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169_TX
|
||||
puts("tx done\n");
|
||||
#endif
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtl8169_set_rx_mode(struct eth_device *dev)
|
||||
{
|
||||
u32 mc_filter[2]; /* Multicast hash filter */
|
||||
int rx_mode;
|
||||
u32 tmp = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
/* IFF_ALLMULTI */
|
||||
/* Too many to filter perfectly -- accept all multicasts. */
|
||||
rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys;
|
||||
mc_filter[1] = mc_filter[0] = 0xffffffff;
|
||||
|
||||
tmp = rtl8169_rx_config | rx_mode | (RTL_R32(RxConfig) &
|
||||
rtl_chip_info[tpc->chipset].RxConfigMask);
|
||||
|
||||
RTL_W32(RxConfig, tmp);
|
||||
RTL_W32(MAR0 + 0, mc_filter[0]);
|
||||
RTL_W32(MAR0 + 4, mc_filter[1]);
|
||||
}
|
||||
|
||||
static void rtl8169_hw_start(struct eth_device *dev)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Soft reset the chip. */
|
||||
RTL_W8(ChipCmd, CmdReset);
|
||||
|
||||
/* Check that the chip has finished the reset. */
|
||||
for (i = 1000; i > 0; i--) {
|
||||
if ((RTL_R8(ChipCmd) & CmdReset) == 0)
|
||||
break;
|
||||
else
|
||||
udelay(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
RTL_W8(Cfg9346, Cfg9346_Unlock);
|
||||
RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
|
||||
RTL_W8(EarlyTxThres, EarlyTxThld);
|
||||
|
||||
/* For gigabit rtl8169 */
|
||||
RTL_W16(RxMaxSize, RxPacketMaxSize);
|
||||
|
||||
/* Set Rx Config register */
|
||||
i = rtl8169_rx_config | (RTL_R32(RxConfig) &
|
||||
rtl_chip_info[tpc->chipset].RxConfigMask);
|
||||
RTL_W32(RxConfig, i);
|
||||
|
||||
/* Set DMA burst size and Interframe Gap Time */
|
||||
RTL_W32(TxConfig, (TX_DMA_BURST << TxDMAShift) |
|
||||
(InterFrameGap << TxInterFrameGapShift));
|
||||
|
||||
|
||||
tpc->cur_rx = 0;
|
||||
|
||||
RTL_W32(TxDescStartAddr, virt_to_le32desc(tpc->TxDescArray));
|
||||
RTL_W32(RxDescStartAddr, virt_to_le32desc(tpc->RxDescArray));
|
||||
RTL_W8(Cfg9346, Cfg9346_Lock);
|
||||
udelay(10);
|
||||
|
||||
RTL_W32(RxMissed, 0);
|
||||
|
||||
rtl8169_set_rx_mode(dev);
|
||||
|
||||
/* no early-rx interrupts */
|
||||
RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xF000);
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rtl8169_init_ring(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
tpc->cur_rx = 0;
|
||||
tpc->cur_tx = 0;
|
||||
tpc->dirty_tx = 0;
|
||||
memset(tpc->TxDescArray, 0x0, NUM_TX_DESC * sizeof(struct TxDesc));
|
||||
memset(tpc->RxDescArray, 0x0, NUM_RX_DESC * sizeof(struct RxDesc));
|
||||
|
||||
for (i = 0; i < NUM_TX_DESC; i++) {
|
||||
tpc->Tx_skbuff[i] = &txb[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
||||
if (i == (NUM_RX_DESC - 1))
|
||||
tpc->RxDescArray[i].status =
|
||||
(OWNbit | EORbit) + RX_BUF_SIZE;
|
||||
else
|
||||
tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
|
||||
|
||||
tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
|
||||
tpc->RxDescArray[i].buf_addr =
|
||||
virt_to_bus(tpc->RxBufferRing[i]);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
RESET - Finish setting up the ethernet interface
|
||||
***************************************************************************/
|
||||
static void rtl_reset(struct eth_device *dev, bd_t *bis)
|
||||
{
|
||||
int i;
|
||||
u8 diff;
|
||||
u32 TxPhyAddr, RxPhyAddr;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
int stime = currticks();
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
tpc->TxDescArrays = tx_ring;
|
||||
if (tpc->TxDescArrays == 0)
|
||||
puts("Allot Error");
|
||||
/* Tx Desscriptor needs 256 bytes alignment; */
|
||||
TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
|
||||
diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
|
||||
TxPhyAddr += diff;
|
||||
tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
|
||||
|
||||
tpc->RxDescArrays = rx_ring;
|
||||
/* Rx Desscriptor needs 256 bytes alignment; */
|
||||
RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
|
||||
diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
|
||||
RxPhyAddr += diff;
|
||||
tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
|
||||
|
||||
if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
|
||||
puts("Allocate RxDescArray or TxDescArray failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rtl8169_init_ring(dev);
|
||||
rtl8169_hw_start(dev);
|
||||
/* Construct a perfect filter frame with the mac address as first match
|
||||
* and broadcast for all others */
|
||||
for (i = 0; i < 192; i++)
|
||||
txb[i] = 0xFF;
|
||||
|
||||
txb[0] = dev->enetaddr[0];
|
||||
txb[1] = dev->enetaddr[1];
|
||||
txb[2] = dev->enetaddr[2];
|
||||
txb[3] = dev->enetaddr[3];
|
||||
txb[4] = dev->enetaddr[4];
|
||||
txb[5] = dev->enetaddr[5];
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
HALT - Turn off ethernet interface
|
||||
***************************************************************************/
|
||||
static void rtl_halt(struct eth_device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
/* Stop the chip's Tx and Rx DMA processes. */
|
||||
RTL_W8(ChipCmd, 0x00);
|
||||
|
||||
/* Disable interrupts by clearing the interrupt mask. */
|
||||
RTL_W16(IntrMask, 0x0000);
|
||||
|
||||
RTL_W32(RxMissed, 0);
|
||||
|
||||
tpc->TxDescArrays = NULL;
|
||||
tpc->RxDescArrays = NULL;
|
||||
tpc->TxDescArray = NULL;
|
||||
tpc->RxDescArray = NULL;
|
||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
||||
tpc->RxBufferRing[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
INIT - Look for an adapter, this routine's visible to the outside
|
||||
***************************************************************************/
|
||||
|
||||
#define board_found 1
|
||||
#define valid_link 0
|
||||
static int rtl_init(struct eth_device *dev, bd_t *bis)
|
||||
{
|
||||
static int board_idx = -1;
|
||||
static int printed_version = 0;
|
||||
int i, rc;
|
||||
int option = -1, Cap10_100 = 0, Cap1000 = 0;
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf ("%s\n", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
ioaddr = dev->iobase;
|
||||
|
||||
board_idx++;
|
||||
|
||||
printed_version = 1;
|
||||
|
||||
/* point to private storage */
|
||||
tpc = &tpx;
|
||||
|
||||
rc = rtl8169_init_board(dev);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
/* Get MAC address. FIXME: read EEPROM */
|
||||
for (i = 0; i < MAC_ADDR_LEN; i++)
|
||||
dev->enetaddr[i] = RTL_R8(MAC0 + i);
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("MAC Address");
|
||||
for (i = 0; i < MAC_ADDR_LEN; i++)
|
||||
printf(":%02x", dev->enetaddr[i]);
|
||||
putc('\n');
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RTL8169
|
||||
/* Print out some hardware info */
|
||||
printf("%s: at ioaddr 0x%x\n", dev->name, ioaddr);
|
||||
#endif
|
||||
|
||||
/* if TBI is not endbled */
|
||||
if (!(RTL_R8(PHYstatus) & TBI_Enable)) {
|
||||
int val = mdio_read(PHY_AUTO_NEGO_REG);
|
||||
|
||||
option = (board_idx >= MAX_UNITS) ? 0 : media[board_idx];
|
||||
/* Force RTL8169 in 10/100/1000 Full/Half mode. */
|
||||
if (option > 0) {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: Force-mode Enabled.\n", dev->name);
|
||||
#endif
|
||||
Cap10_100 = 0, Cap1000 = 0;
|
||||
switch (option) {
|
||||
case _10_Half:
|
||||
Cap10_100 = PHY_Cap_10_Half;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _10_Full:
|
||||
Cap10_100 = PHY_Cap_10_Full;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _100_Half:
|
||||
Cap10_100 = PHY_Cap_100_Half;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _100_Full:
|
||||
Cap10_100 = PHY_Cap_100_Full;
|
||||
Cap1000 = PHY_Cap_Null;
|
||||
break;
|
||||
case _1000_Full:
|
||||
Cap10_100 = PHY_Cap_Null;
|
||||
Cap1000 = PHY_Cap_1000_Full;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mdio_write(PHY_AUTO_NEGO_REG, Cap10_100 | (val & 0x1F)); /* leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
|
||||
mdio_write(PHY_1000_CTRL_REG, Cap1000);
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: Auto-negotiation Enabled.\n",
|
||||
dev->name);
|
||||
#endif
|
||||
/* enable 10/100 Full/Half Mode, leave PHY_AUTO_NEGO_REG bit4:0 unchanged */
|
||||
mdio_write(PHY_AUTO_NEGO_REG,
|
||||
PHY_Cap_10_Half | PHY_Cap_10_Full |
|
||||
PHY_Cap_100_Half | PHY_Cap_100_Full |
|
||||
(val & 0x1F));
|
||||
|
||||
/* enable 1000 Full Mode */
|
||||
mdio_write(PHY_1000_CTRL_REG, PHY_Cap_1000_Full);
|
||||
|
||||
}
|
||||
|
||||
/* Enable auto-negotiation and restart auto-nigotiation */
|
||||
mdio_write(PHY_CTRL_REG,
|
||||
PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego);
|
||||
udelay(100);
|
||||
|
||||
/* wait for auto-negotiation process */
|
||||
for (i = 10000; i > 0; i--) {
|
||||
/* check if auto-negotiation complete */
|
||||
if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
|
||||
udelay(100);
|
||||
option = RTL_R8(PHYstatus);
|
||||
if (option & _1000bpsF) {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf("%s: 1000Mbps Full-duplex operation.\n",
|
||||
dev->name);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf
|
||||
("%s: %sMbps %s-duplex operation.\n",
|
||||
dev->name,
|
||||
(option & _100bps) ? "100" :
|
||||
"10",
|
||||
(option & FullDup) ? "Full" :
|
||||
"Half");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
udelay(100);
|
||||
}
|
||||
} /* end for-loop to wait for auto-negotiation process */
|
||||
|
||||
} else {
|
||||
udelay(100);
|
||||
#ifdef DEBUG_RTL8169
|
||||
printf
|
||||
("%s: 1000Mbps Full-duplex operation, TBI Link %s!\n",
|
||||
dev->name,
|
||||
(RTL_R32(TBICSR) & TBILinkOK) ? "OK" : "Failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rtl8169_initialize(bd_t *bis)
|
||||
{
|
||||
pci_dev_t devno;
|
||||
int card_number = 0;
|
||||
struct eth_device *dev;
|
||||
u32 iobase;
|
||||
int idx=0;
|
||||
|
||||
while(1){
|
||||
/* Find RTL8169 */
|
||||
if ((devno = pci_find_devices(supported, idx++)) < 0)
|
||||
break;
|
||||
|
||||
pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase);
|
||||
iobase &= ~0xf;
|
||||
|
||||
debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase);
|
||||
|
||||
dev = (struct eth_device *)malloc(sizeof *dev);
|
||||
|
||||
sprintf (dev->name, "RTL8169#%d", card_number);
|
||||
|
||||
dev->priv = (void *) devno;
|
||||
dev->iobase = (int)bus_to_phys(iobase);
|
||||
|
||||
dev->init = rtl_reset;
|
||||
dev->halt = rtl_halt;
|
||||
dev->send = rtl_send;
|
||||
dev->recv = rtl_recv;
|
||||
|
||||
eth_register (dev);
|
||||
|
||||
rtl_init(dev, bis);
|
||||
|
||||
card_number++;
|
||||
}
|
||||
return card_number;
|
||||
}
|
||||
|
||||
#endif
|
||||
77
drivers/serial_xuartlite.c
Normal file
77
drivers/serial_xuartlite.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef CONFIG_MICROBLZE
|
||||
|
||||
#include <asm/serial_xuartlite.h>
|
||||
|
||||
/* FIXME: we should convert these to in32 and out32 */
|
||||
#define IO_WORD(offset) (*(volatile unsigned long *)(offset))
|
||||
#define IO_SERIAL(offset) IO_WORD(CONFIG_SERIAL_BASE + (offset))
|
||||
|
||||
#define IO_SERIAL_RX_FIFO IO_SERIAL(XUL_RX_FIFO_OFFSET)
|
||||
#define IO_SERIAL_TX_FIFO IO_SERIAL(XUL_TX_FIFO_OFFSET)
|
||||
#define IO_SERIAL_STATUS IO_SERIAL(XUL_STATUS_REG_OFFSET)
|
||||
#define IO_SERIAL_CONTROL IO_SERIAL(XUL_CONTROL_REG_OFFSET)
|
||||
|
||||
int serial_init(void)
|
||||
{
|
||||
/* FIXME: Nothing for now. We should initialize fifo, etc */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_setbrg(void)
|
||||
{
|
||||
/* FIXME: what's this for? */
|
||||
}
|
||||
|
||||
void serial_putc(const char c)
|
||||
{
|
||||
if (c == '\n') serial_putc('\r');
|
||||
while (IO_SERIAL_STATUS & XUL_SR_TX_FIFO_FULL);
|
||||
IO_SERIAL_TX_FIFO = (unsigned char) (c & 0xff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_puts(const char * s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int serial_getc(void)
|
||||
{
|
||||
while (!(IO_SERIAL_STATUS & XUL_SR_RX_FIFO_VALID_DATA));
|
||||
return IO_SERIAL_RX_FIFO & 0xff;
|
||||
}
|
||||
|
||||
int serial_tstc(void)
|
||||
{
|
||||
return (IO_SERIAL_STATUS & XUL_SR_RX_FIFO_VALID_DATA);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MICROBLZE */
|
||||
104
drivers/sl811.h
Normal file
104
drivers/sl811.h
Normal file
@@ -0,0 +1,104 @@
|
||||
#ifndef __UBOOT_SL811_H
|
||||
#define __UBOOT_SL811_H
|
||||
|
||||
#undef SL811_DEBUG
|
||||
|
||||
#ifdef SL811_DEBUG
|
||||
#define PDEBUG(level, fmt, args...) \
|
||||
if (debug >= (level)) printf("[%s:%d] " fmt, \
|
||||
__PRETTY_FUNCTION__, __LINE__ , ## args)
|
||||
#else
|
||||
#define PDEBUG(level, fmt, args...) do {} while(0)
|
||||
#endif
|
||||
|
||||
/* Sl811 host control register */
|
||||
#define SL811_CTRL_A 0x00
|
||||
#define SL811_ADDR_A 0x01
|
||||
#define SL811_LEN_A 0x02
|
||||
#define SL811_STS_A 0x03 /* read */
|
||||
#define SL811_PIDEP_A 0x03 /* write */
|
||||
#define SL811_CNT_A 0x04 /* read */
|
||||
#define SL811_DEV_A 0x04 /* write */
|
||||
#define SL811_CTRL1 0x05
|
||||
#define SL811_INTR 0x06
|
||||
#define SL811_CTRL_B 0x08
|
||||
#define SL811_ADDR_B 0x09
|
||||
#define SL811_LEN_B 0x0A
|
||||
#define SL811_STS_B 0x0B /* read */
|
||||
#define SL811_PIDEP_B 0x0B /* write */
|
||||
#define SL811_CNT_B 0x0C /* read */
|
||||
#define SL811_DEV_B 0x0C /* write */
|
||||
#define SL811_INTRSTS 0x0D /* write clears bitwise */
|
||||
#define SL811_HWREV 0x0E /* read */
|
||||
#define SL811_SOFLOW 0x0E /* write */
|
||||
#define SL811_SOFCNTDIV 0x0F /* read */
|
||||
#define SL811_CTRL2 0x0F /* write */
|
||||
|
||||
/* USB control register bits (addr 0x00 and addr 0x08) */
|
||||
#define SL811_USB_CTRL_ARM 0x01
|
||||
#define SL811_USB_CTRL_ENABLE 0x02
|
||||
#define SL811_USB_CTRL_DIR_OUT 0x04
|
||||
#define SL811_USB_CTRL_ISO 0x10
|
||||
#define SL811_USB_CTRL_SOF 0x20
|
||||
#define SL811_USB_CTRL_TOGGLE_1 0x40
|
||||
#define SL811_USB_CTRL_PREAMBLE 0x80
|
||||
|
||||
/* USB status register bits (addr 0x03 and addr 0x0B) */
|
||||
#define SL811_USB_STS_ACK 0x01
|
||||
#define SL811_USB_STS_ERROR 0x02
|
||||
#define SL811_USB_STS_TIMEOUT 0x04
|
||||
#define SL811_USB_STS_TOGGLE_1 0x08
|
||||
#define SL811_USB_STS_SETUP 0x10
|
||||
#define SL811_USB_STS_OVERFLOW 0x20
|
||||
#define SL811_USB_STS_NAK 0x40
|
||||
#define SL811_USB_STS_STALL 0x80
|
||||
|
||||
/* Control register 1 bits (addr 0x05) */
|
||||
#define SL811_CTRL1_SOF 0x01
|
||||
#define SL811_CTRL1_RESET 0x08
|
||||
#define SL811_CTRL1_JKSTATE 0x10
|
||||
#define SL811_CTRL1_SPEED_LOW 0x20
|
||||
#define SL811_CTRL1_SUSPEND 0x40
|
||||
|
||||
/* Interrut enable (addr 0x06) and interrupt status register bits (addr 0x0D) */
|
||||
#define SL811_INTR_DONE_A 0x01
|
||||
#define SL811_INTR_DONE_B 0x02
|
||||
#define SL811_INTR_SOF 0x10
|
||||
#define SL811_INTR_INSRMV 0x20
|
||||
#define SL811_INTR_DETECT 0x40
|
||||
#define SL811_INTR_NOTPRESENT 0x40
|
||||
#define SL811_INTR_SPEED_FULL 0x80 /* only in status reg */
|
||||
|
||||
/* HW rev and SOF lo register bits (addr 0x0E) */
|
||||
#define SL811_HWR_HWREV 0xF0
|
||||
|
||||
/* SOF counter and control reg 2 (addr 0x0F) */
|
||||
#define SL811_CTL2_SOFHI 0x3F
|
||||
#define SL811_CTL2_DSWAP 0x40
|
||||
#define SL811_CTL2_HOST 0x80
|
||||
|
||||
/* Set up for 1-ms SOF time. */
|
||||
#define SL811_12M_LOW 0xE0
|
||||
#define SL811_12M_HI 0x2E
|
||||
|
||||
#define SL811_DATA_START 0x10
|
||||
#define SL811_DATA_LIMIT 240
|
||||
|
||||
/* Requests: bRequest << 8 | bmRequestType */
|
||||
#define RH_GET_STATUS 0x0080
|
||||
#define RH_CLEAR_FEATURE 0x0100
|
||||
#define RH_SET_FEATURE 0x0300
|
||||
#define RH_SET_ADDRESS 0x0500
|
||||
#define RH_GET_DESCRIPTOR 0x0680
|
||||
#define RH_SET_DESCRIPTOR 0x0700
|
||||
#define RH_GET_CONFIGURATION 0x0880
|
||||
#define RH_SET_CONFIGURATION 0x0900
|
||||
#define RH_GET_STATE 0x0280
|
||||
#define RH_GET_INTERFACE 0x0A80
|
||||
#define RH_SET_INTERFACE 0x0B00
|
||||
#define RH_SYNC_FRAME 0x0C80
|
||||
|
||||
|
||||
#define PIDEP(pid, ep) (((pid) & 0x0f) << 4 | (ep))
|
||||
|
||||
#endif /* __UBOOT_SL811_H */
|
||||
705
drivers/sl811_usb.c
Normal file
705
drivers/sl811_usb.c
Normal file
@@ -0,0 +1,705 @@
|
||||
/*
|
||||
* (C) Copyright 2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* This code is based on linux driver for sl811hs chip, source at
|
||||
* drivers/usb/host/sl811.c:
|
||||
*
|
||||
* SL811 Host Controller Interface driver for USB.
|
||||
*
|
||||
* Copyright (c) 2003/06, Courage Co., Ltd.
|
||||
*
|
||||
* Based on:
|
||||
* 1.uhci.c by Linus Torvalds, Johannes Erdfelt, Randy Dunlap,
|
||||
* Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber,
|
||||
* Adam Richter, Gregory P. Smith;
|
||||
* 2.Original SL811 driver (hc_sl811.o) by Pei Liu <pbl@cypress.com>
|
||||
* 3.Rewrited as sl811.o by Yin Aihua <yinah:couragetech.com.cn>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#ifdef CONFIG_USB_SL811HS
|
||||
#include <mpc8xx.h>
|
||||
#include <usb.h>
|
||||
#include "sl811.h"
|
||||
|
||||
#include "../board/kup/common/kup.h"
|
||||
|
||||
#ifdef __PPC__
|
||||
# define EIEIO __asm__ volatile ("eieio")
|
||||
#else
|
||||
# define EIEIO /* nothing */
|
||||
#endif
|
||||
|
||||
#define SL811_ADR (0x50000000)
|
||||
#define SL811_DAT (0x50000001)
|
||||
|
||||
#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
|
||||
|
||||
#ifdef SL811_DEBUG
|
||||
static int debug = 9;
|
||||
#endif
|
||||
|
||||
static int root_hub_devnum = 0;
|
||||
static struct usb_port_status rh_status = { 0 };/* root hub port status */
|
||||
|
||||
static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
|
||||
void *data, int buf_len, struct devrequest *cmd);
|
||||
|
||||
static void sl811_write (__u8 index, __u8 data)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
EIEIO;
|
||||
*(volatile unsigned char *) (SL811_DAT) = data;
|
||||
EIEIO;
|
||||
}
|
||||
|
||||
static __u8 sl811_read (__u8 index)
|
||||
{
|
||||
__u8 data;
|
||||
|
||||
*(volatile unsigned char *) (SL811_ADR) = index;
|
||||
EIEIO;
|
||||
data = *(volatile unsigned char *) (SL811_DAT);
|
||||
EIEIO;
|
||||
return (data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read consecutive bytes of data from the SL811H/SL11H buffer
|
||||
*/
|
||||
static void inline sl811_read_buf(__u8 offset, __u8 *buf, __u8 size)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = offset;
|
||||
EIEIO;
|
||||
while (size--) {
|
||||
*buf++ = *(volatile unsigned char *) (SL811_DAT);
|
||||
EIEIO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write consecutive bytes of data to the SL811H/SL11H buffer
|
||||
*/
|
||||
static void inline sl811_write_buf(__u8 offset, __u8 *buf, __u8 size)
|
||||
{
|
||||
*(volatile unsigned char *) (SL811_ADR) = offset;
|
||||
EIEIO;
|
||||
while (size--) {
|
||||
*(volatile unsigned char *) (SL811_DAT) = *buf++;
|
||||
EIEIO;
|
||||
}
|
||||
}
|
||||
|
||||
int usb_init_kup4x (void)
|
||||
{
|
||||
volatile immap_t *immap = (immap_t *) CFG_IMMR;
|
||||
volatile memctl8xx_t *memctl = &immap->im_memctl;
|
||||
int i;
|
||||
unsigned char tmp;
|
||||
|
||||
memctl = &immap->im_memctl;
|
||||
memctl->memc_or7 = 0xFFFF8726;
|
||||
memctl->memc_br7 = 0x50000401; /* start at 0x50000000 */
|
||||
/* BP 14 low = USB ON */
|
||||
immap->im_cpm.cp_pbdat &= ~(BP_USB_VCC);
|
||||
/* PB 14 nomal port */
|
||||
immap->im_cpm.cp_pbpar &= ~(BP_USB_VCC);
|
||||
/* output */
|
||||
immap->im_cpm.cp_pbdir |= (BP_USB_VCC);
|
||||
|
||||
puts ("USB: ");
|
||||
|
||||
for (i = 0x10; i < 0xff; i++) {
|
||||
sl811_write(i, i);
|
||||
tmp = (sl811_read(i));
|
||||
if (tmp != i) {
|
||||
printf ("SL811 compare error index=0x%02x read=0x%02x\n", i, tmp);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
printf ("SL811 ready\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function resets SL811HS controller and detects the speed of
|
||||
* the connecting device
|
||||
*
|
||||
* Return: 0 = no device attached; 1 = USB device attached
|
||||
*/
|
||||
static int sl811_hc_reset(void)
|
||||
{
|
||||
int status ;
|
||||
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
|
||||
mdelay(20);
|
||||
|
||||
/* Disable hardware SOF generation, clear all irq status. */
|
||||
sl811_write(SL811_CTRL1, 0);
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
status = sl811_read(SL811_INTRSTS);
|
||||
|
||||
if (status & SL811_INTR_NOTPRESENT) {
|
||||
/* Device is not present */
|
||||
PDEBUG(0, "Device not present\n");
|
||||
rh_status.wPortStatus &= ~(USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE);
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_CONNECTION;
|
||||
sl811_write(SL811_INTR, SL811_INTR_INSRMV);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Send SOF to address 0, endpoint 0. */
|
||||
sl811_write(SL811_LEN_B, 0);
|
||||
sl811_write(SL811_PIDEP_B, PIDEP(USB_PID_SOF, 0));
|
||||
sl811_write(SL811_DEV_B, 0x00);
|
||||
sl811_write(SL811_SOFLOW, SL811_12M_LOW);
|
||||
|
||||
if (status & SL811_INTR_SPEED_FULL) {
|
||||
/* full speed device connect directly to root hub */
|
||||
PDEBUG (0, "Full speed Device attached\n");
|
||||
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
mdelay(20);
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_SOF);
|
||||
|
||||
/* start the SOF or EOP */
|
||||
sl811_write(SL811_CTRL_B, SL811_USB_CTRL_ARM);
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_CONNECTION;
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_LOW_SPEED;
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
} else {
|
||||
/* slow speed device connect directly to root-hub */
|
||||
PDEBUG(0, "Low speed Device attached\n");
|
||||
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_RESET);
|
||||
mdelay(20);
|
||||
sl811_write(SL811_CTRL2, SL811_CTL2_HOST | SL811_CTL2_DSWAP | SL811_12M_HI);
|
||||
sl811_write(SL811_CTRL1, SL811_CTRL1_SPEED_LOW | SL811_CTRL1_SOF);
|
||||
|
||||
/* start the SOF or EOP */
|
||||
sl811_write(SL811_CTRL_B, SL811_USB_CTRL_ARM);
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_CONNECTION | USB_PORT_STAT_LOW_SPEED;
|
||||
mdelay(2);
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
}
|
||||
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_CONNECTION;
|
||||
sl811_write(SL811_INTR, /*SL811_INTR_INSRMV*/SL811_INTR_DONE_A);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int usb_lowlevel_init(void)
|
||||
{
|
||||
root_hub_devnum = 0;
|
||||
sl811_hc_reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usb_lowlevel_stop(void)
|
||||
{
|
||||
sl811_hc_reset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sl811_send_packet(int dir_to_host, int data1, __u8 *buffer, int len)
|
||||
{
|
||||
__u8 ctrl = SL811_USB_CTRL_ARM | SL811_USB_CTRL_ENABLE;
|
||||
__u16 status;
|
||||
int err = 0;
|
||||
|
||||
if (len > 239)
|
||||
return -1;
|
||||
|
||||
if (!dir_to_host)
|
||||
ctrl |= SL811_USB_CTRL_DIR_OUT;
|
||||
if (data1)
|
||||
ctrl |= SL811_USB_CTRL_TOGGLE_1;
|
||||
|
||||
sl811_write(SL811_ADDR_A, 0x10);
|
||||
sl811_write(SL811_LEN_A, len);
|
||||
if (!dir_to_host && len)
|
||||
sl811_write_buf(0x10, buffer, len);
|
||||
|
||||
while (err < 3) {
|
||||
if (sl811_read(SL811_SOFCNTDIV)*64 < len * 8 * 2)
|
||||
ctrl |= SL811_USB_CTRL_SOF;
|
||||
else
|
||||
ctrl &= ~SL811_USB_CTRL_SOF;
|
||||
sl811_write(SL811_CTRL_A, ctrl);
|
||||
while (!(sl811_read(SL811_INTRSTS) & SL811_INTR_DONE_A))
|
||||
; /* do nothing */
|
||||
|
||||
sl811_write(SL811_INTRSTS, 0xff);
|
||||
status = sl811_read(SL811_STS_A);
|
||||
|
||||
if (status & SL811_USB_STS_ACK) {
|
||||
int remainder = sl811_read(SL811_CNT_A);
|
||||
if (remainder) {
|
||||
PDEBUG(0, "usb transfer remainder = %d\n", remainder);
|
||||
len -= remainder;
|
||||
}
|
||||
if (dir_to_host && len)
|
||||
sl811_read_buf(0x10, buffer, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
if ((status & SL811_USB_STS_NAK) == SL811_USB_STS_NAK)
|
||||
continue;
|
||||
|
||||
PDEBUG(0, "usb transfer error %#x\n", (int)status);
|
||||
err++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len)
|
||||
{
|
||||
int dir_out = usb_pipeout(pipe);
|
||||
int ep = usb_pipeendpoint(pipe);
|
||||
__u8* buf = (__u8*)buffer;
|
||||
int max = usb_maxpacket(dev, pipe);
|
||||
int done = 0;
|
||||
|
||||
PDEBUG(7, "dev = %ld pipe = %ld buf = %p size = %d dir_out = %d\n",
|
||||
usb_pipedevice(pipe), usb_pipeendpoint(pipe), buffer, len, dir_out);
|
||||
|
||||
dev->status = 0;
|
||||
|
||||
sl811_write(SL811_DEV_A, usb_pipedevice(pipe));
|
||||
sl811_write(SL811_PIDEP_A, PIDEP(!dir_out ? USB_PID_IN : USB_PID_OUT, ep));
|
||||
while (done < len) {
|
||||
int res = sl811_send_packet(!dir_out, usb_gettoggle(dev, ep, dir_out),
|
||||
buf+done,
|
||||
max > len - done ? len - done : max);
|
||||
if (res < 0) {
|
||||
dev->status = res;
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!dir_out && res < max) /* short packet */
|
||||
break;
|
||||
|
||||
done += res;
|
||||
usb_dotoggle(dev, ep, dir_out);
|
||||
}
|
||||
|
||||
dev->act_len = done;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len,struct devrequest *setup)
|
||||
{
|
||||
int done = 0;
|
||||
int devnum = usb_pipedevice(pipe);
|
||||
|
||||
dev->status = 0;
|
||||
|
||||
if (devnum == root_hub_devnum)
|
||||
return sl811_rh_submit_urb(dev, pipe, buffer, len, setup);
|
||||
|
||||
PDEBUG(7, "dev = %d pipe = %ld buf = %p size = %d rt = %#x req = %#x\n",
|
||||
devnum, usb_pipeendpoint(pipe), buffer, len, (int)setup->requesttype,
|
||||
(int)setup->request);
|
||||
|
||||
sl811_write(SL811_DEV_A, devnum);
|
||||
sl811_write(SL811_PIDEP_A, PIDEP(USB_PID_SETUP, 0));
|
||||
/* setup phase */
|
||||
if (sl811_send_packet(0, 0, (__u8*)setup, sizeof(*setup)) == sizeof(*setup)) {
|
||||
int dir_in = setup->requesttype & USB_DIR_IN;
|
||||
__u8* buf = (__u8*)buffer;
|
||||
int data1 = 1;
|
||||
int max = usb_maxpacket(dev, pipe);
|
||||
|
||||
/* data phase */
|
||||
sl811_write(SL811_PIDEP_A,
|
||||
PIDEP(dir_in ? USB_PID_IN : USB_PID_OUT, 0));
|
||||
while (done < len) {
|
||||
int res = sl811_send_packet(dir_in, data1, buf+done,
|
||||
max > len - done ? len - done : max);
|
||||
if (res < 0)
|
||||
return res;
|
||||
done += res;
|
||||
|
||||
if (dir_in && res < max) /* short packet */
|
||||
break;
|
||||
|
||||
data1 = !data1;
|
||||
}
|
||||
|
||||
/* status phase */
|
||||
sl811_write(SL811_PIDEP_A,
|
||||
PIDEP(!dir_in ? USB_PID_IN : USB_PID_OUT, 0));
|
||||
if (sl811_send_packet(!dir_in, 1, 0, 0) < 0) {
|
||||
PDEBUG(0, "status phase failed!\n");
|
||||
dev->status = -1;
|
||||
}
|
||||
} else {
|
||||
PDEBUG(0, "setup phase failed!\n");
|
||||
dev->status = -1;
|
||||
}
|
||||
|
||||
dev->act_len = done;
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
int len, int interval)
|
||||
{
|
||||
PDEBUG(7, "dev = %p pipe = %#lx buf = %p size = %d int = %d\n", dev, pipe,
|
||||
buffer, len, interval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* SL811 Virtual Root Hub
|
||||
*/
|
||||
|
||||
/* Device descriptor */
|
||||
static __u8 sl811_rh_dev_des[] =
|
||||
{
|
||||
0x12, /* __u8 bLength; */
|
||||
0x01, /* __u8 bDescriptorType; Device */
|
||||
0x10, /* __u16 bcdUSB; v1.1 */
|
||||
0x01,
|
||||
0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
|
||||
0x00, /* __u8 bDeviceSubClass; */
|
||||
0x00, /* __u8 bDeviceProtocol; */
|
||||
0x08, /* __u8 bMaxPacketSize0; 8 Bytes */
|
||||
0x00, /* __u16 idVendor; */
|
||||
0x00,
|
||||
0x00, /* __u16 idProduct; */
|
||||
0x00,
|
||||
0x00, /* __u16 bcdDevice; */
|
||||
0x00,
|
||||
0x00, /* __u8 iManufacturer; */
|
||||
0x02, /* __u8 iProduct; */
|
||||
0x01, /* __u8 iSerialNumber; */
|
||||
0x01 /* __u8 bNumConfigurations; */
|
||||
};
|
||||
|
||||
/* Configuration descriptor */
|
||||
static __u8 sl811_rh_config_des[] =
|
||||
{
|
||||
0x09, /* __u8 bLength; */
|
||||
0x02, /* __u8 bDescriptorType; Configuration */
|
||||
0x19, /* __u16 wTotalLength; */
|
||||
0x00,
|
||||
0x01, /* __u8 bNumInterfaces; */
|
||||
0x01, /* __u8 bConfigurationValue; */
|
||||
0x00, /* __u8 iConfiguration; */
|
||||
0x40, /* __u8 bmAttributes;
|
||||
Bit 7: Bus-powered, 6: Self-powered, 5 Remote-wakwup,
|
||||
4..0: resvd */
|
||||
0x00, /* __u8 MaxPower; */
|
||||
|
||||
/* interface */
|
||||
0x09, /* __u8 if_bLength; */
|
||||
0x04, /* __u8 if_bDescriptorType; Interface */
|
||||
0x00, /* __u8 if_bInterfaceNumber; */
|
||||
0x00, /* __u8 if_bAlternateSetting; */
|
||||
0x01, /* __u8 if_bNumEndpoints; */
|
||||
0x09, /* __u8 if_bInterfaceClass; HUB_CLASSCODE */
|
||||
0x00, /* __u8 if_bInterfaceSubClass; */
|
||||
0x00, /* __u8 if_bInterfaceProtocol; */
|
||||
0x00, /* __u8 if_iInterface; */
|
||||
|
||||
/* endpoint */
|
||||
0x07, /* __u8 ep_bLength; */
|
||||
0x05, /* __u8 ep_bDescriptorType; Endpoint */
|
||||
0x81, /* __u8 ep_bEndpointAddress; IN Endpoint 1 */
|
||||
0x03, /* __u8 ep_bmAttributes; Interrupt */
|
||||
0x08, /* __u16 ep_wMaxPacketSize; */
|
||||
0x00,
|
||||
0xff /* __u8 ep_bInterval; 255 ms */
|
||||
};
|
||||
|
||||
/* root hub class descriptor*/
|
||||
static __u8 sl811_rh_hub_des[] =
|
||||
{
|
||||
0x09, /* __u8 bLength; */
|
||||
0x29, /* __u8 bDescriptorType; Hub-descriptor */
|
||||
0x01, /* __u8 bNbrPorts; */
|
||||
0x00, /* __u16 wHubCharacteristics; */
|
||||
0x00,
|
||||
0x50, /* __u8 bPwrOn2pwrGood; 2ms */
|
||||
0x00, /* __u8 bHubContrCurrent; 0 mA */
|
||||
0xfc, /* __u8 DeviceRemovable; *** 7 Ports max *** */
|
||||
0xff /* __u8 PortPwrCtrlMask; *** 7 ports max *** */
|
||||
};
|
||||
|
||||
/*
|
||||
* helper routine for returning string descriptors in UTF-16LE
|
||||
* input can actually be ISO-8859-1; ASCII is its 7-bit subset
|
||||
*/
|
||||
static int ascii2utf (char *s, u8 *utf, int utfmax)
|
||||
{
|
||||
int retval;
|
||||
|
||||
for (retval = 0; *s && utfmax > 1; utfmax -= 2, retval += 2) {
|
||||
*utf++ = *s++;
|
||||
*utf++ = 0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* root_hub_string is used by each host controller's root hub code,
|
||||
* so that they're identified consistently throughout the system.
|
||||
*/
|
||||
int usb_root_hub_string (int id, int serial, char *type, __u8 *data, int len)
|
||||
{
|
||||
char buf [30];
|
||||
|
||||
/* assert (len > (2 * (sizeof (buf) + 1)));
|
||||
assert (strlen (type) <= 8);*/
|
||||
|
||||
/* language ids */
|
||||
if (id == 0) {
|
||||
*data++ = 4; *data++ = 3; /* 4 bytes data */
|
||||
*data++ = 0; *data++ = 0; /* some language id */
|
||||
return 4;
|
||||
|
||||
/* serial number */
|
||||
} else if (id == 1) {
|
||||
sprintf (buf, "%x", serial);
|
||||
|
||||
/* product description */
|
||||
} else if (id == 2) {
|
||||
sprintf (buf, "USB %s Root Hub", type);
|
||||
|
||||
/* id 3 == vendor description */
|
||||
|
||||
/* unsupported IDs --> "stall" */
|
||||
} else
|
||||
return 0;
|
||||
|
||||
data [0] = 2 + ascii2utf (buf, data + 2, len - 2);
|
||||
data [1] = 3;
|
||||
return data [0];
|
||||
}
|
||||
|
||||
/* helper macro */
|
||||
#define OK(x) len = (x); break
|
||||
|
||||
/*
|
||||
* This function handles all USB request to the the virtual root hub
|
||||
*/
|
||||
static int sl811_rh_submit_urb(struct usb_device *usb_dev, unsigned long pipe,
|
||||
void *data, int buf_len, struct devrequest *cmd)
|
||||
{
|
||||
__u8 data_buf[16];
|
||||
__u8 *bufp = data_buf;
|
||||
int len = 0;
|
||||
int status = 0;
|
||||
|
||||
__u16 bmRType_bReq;
|
||||
__u16 wValue;
|
||||
__u16 wIndex;
|
||||
__u16 wLength;
|
||||
|
||||
if (usb_pipeint(pipe)) {
|
||||
PDEBUG(0, "interrupt transfer unimplemented!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bmRType_bReq = cmd->requesttype | (cmd->request << 8);
|
||||
wValue = le16_to_cpu (cmd->value);
|
||||
wIndex = le16_to_cpu (cmd->index);
|
||||
wLength = le16_to_cpu (cmd->length);
|
||||
|
||||
PDEBUG(5, "submit rh urb, req = %d(%x) val = %#x index = %#x len=%d\n",
|
||||
bmRType_bReq, bmRType_bReq, wValue, wIndex, wLength);
|
||||
|
||||
/* Request Destination:
|
||||
without flags: Device,
|
||||
USB_RECIP_INTERFACE: interface,
|
||||
USB_RECIP_ENDPOINT: endpoint,
|
||||
USB_TYPE_CLASS means HUB here,
|
||||
USB_RECIP_OTHER | USB_TYPE_CLASS almost ever means HUB_PORT here
|
||||
*/
|
||||
switch (bmRType_bReq) {
|
||||
case RH_GET_STATUS:
|
||||
*(__u16 *)bufp = cpu_to_le16(1);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_INTERFACE:
|
||||
*(__u16 *)bufp = cpu_to_le16(0);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_ENDPOINT:
|
||||
*(__u16 *)bufp = cpu_to_le16(0);
|
||||
OK(2);
|
||||
|
||||
case RH_GET_STATUS | USB_TYPE_CLASS:
|
||||
*(__u32 *)bufp = cpu_to_le32(0);
|
||||
OK(4);
|
||||
|
||||
case RH_GET_STATUS | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
*(__u32 *)bufp = cpu_to_le32(rh_status.wPortChange<<16 | rh_status.wPortStatus);
|
||||
OK(4);
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_RECIP_ENDPOINT:
|
||||
switch (wValue) {
|
||||
case 1:
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case C_HUB_LOCAL_POWER:
|
||||
OK(0);
|
||||
|
||||
case C_HUB_OVER_CURRENT:
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_CLEAR_FEATURE | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case USB_PORT_FEAT_ENABLE:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_POWER;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_CONNECTION:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_CONNECTION;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_ENABLE:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_SUSPEND:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_OVER_CURRENT:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_OVERCURRENT;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_C_RESET:
|
||||
rh_status.wPortChange &= ~USB_PORT_STAT_C_RESET;
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_SET_FEATURE | USB_RECIP_OTHER | USB_TYPE_CLASS:
|
||||
switch (wValue) {
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_SUSPEND;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_RESET:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_RESET;
|
||||
rh_status.wPortChange = 0;
|
||||
rh_status.wPortChange |= USB_PORT_STAT_C_RESET;
|
||||
rh_status.wPortStatus &= ~USB_PORT_STAT_RESET;
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_POWER;
|
||||
OK(0);
|
||||
|
||||
case USB_PORT_FEAT_ENABLE:
|
||||
rh_status.wPortStatus |= USB_PORT_STAT_ENABLE;
|
||||
OK(0);
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_SET_ADDRESS:
|
||||
root_hub_devnum = wValue;
|
||||
OK(0);
|
||||
|
||||
case RH_GET_DESCRIPTOR:
|
||||
switch ((wValue & 0xff00) >> 8) {
|
||||
case USB_DT_DEVICE:
|
||||
len = sizeof(sl811_rh_dev_des);
|
||||
bufp = sl811_rh_dev_des;
|
||||
OK(len);
|
||||
|
||||
case USB_DT_CONFIG:
|
||||
len = sizeof(sl811_rh_config_des);
|
||||
bufp = sl811_rh_config_des;
|
||||
OK(len);
|
||||
|
||||
case USB_DT_STRING:
|
||||
len = usb_root_hub_string(wValue & 0xff, (int)(long)0, "SL811HS", data, wLength);
|
||||
if (len > 0) {
|
||||
bufp = data;
|
||||
OK(len);
|
||||
}
|
||||
|
||||
default:
|
||||
status = -32;
|
||||
}
|
||||
break;
|
||||
|
||||
case RH_GET_DESCRIPTOR | USB_TYPE_CLASS:
|
||||
len = sizeof(sl811_rh_hub_des);
|
||||
bufp = sl811_rh_hub_des;
|
||||
OK(len);
|
||||
|
||||
case RH_GET_CONFIGURATION:
|
||||
bufp[0] = 0x01;
|
||||
OK(1);
|
||||
|
||||
case RH_SET_CONFIGURATION:
|
||||
OK(0);
|
||||
|
||||
default:
|
||||
PDEBUG(1, "unsupported root hub command\n");
|
||||
status = -32;
|
||||
}
|
||||
|
||||
len = min(len, buf_len);
|
||||
if (data != bufp)
|
||||
memcpy(data, bufp, len);
|
||||
|
||||
PDEBUG(5, "len = %d, status = %d\n", len, status);
|
||||
|
||||
usb_dev->status = status;
|
||||
usb_dev->act_len = len;
|
||||
|
||||
return status == 0 ? len : status;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USB_SL811HS */
|
||||
@@ -45,6 +45,10 @@ ifeq ($(ARCH),m68k)
|
||||
LOAD_ADDR = 0x20000 -L $(clibdir)
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),microblaze)
|
||||
LOAD_ADDR = 0x80F00000
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/config.mk
|
||||
|
||||
SREC = hello_world.srec
|
||||
|
||||
@@ -94,6 +94,18 @@ gd_t *global_data;
|
||||
" move.l (%%a0), %%a0\n" \
|
||||
" jmp (%%a0)\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "a0");
|
||||
#elif defined(CONFIG_MICROBLZE)
|
||||
/*
|
||||
* r31 holds the pointer to the global_data. r5 is a call-clobbered.
|
||||
*/
|
||||
#define EXPORT_FUNC(x) \
|
||||
asm volatile ( \
|
||||
" .globl " #x "\n" \
|
||||
#x ":\n" \
|
||||
" lwi r5, r31, %0\n" \
|
||||
" lwi r5, r5, %1\n" \
|
||||
" bra r5\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "r5");
|
||||
#else
|
||||
#error stubs definition missing for this architecture
|
||||
#endif
|
||||
|
||||
@@ -182,8 +182,8 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
|
||||
if (!nand_cache) {
|
||||
/* This memory never gets freed but 'cause
|
||||
it's a bootloader, nobody cares */
|
||||
nand_cache = malloc(NAND_CACHE_SIZE);
|
||||
if (!nand_cache) {
|
||||
nand_cache = malloc(NAND_CACHE_SIZE);
|
||||
if (!nand_cache) {
|
||||
printf("read_nand_cached: can't alloc cache size %d bytes\n",
|
||||
NAND_CACHE_SIZE);
|
||||
return -1;
|
||||
@@ -241,7 +241,7 @@ static void *get_node_mem(u32 off)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void put_fl_mem(void *buf)
|
||||
static void put_fl_mem(void *buf)
|
||||
{
|
||||
free(buf);
|
||||
}
|
||||
@@ -258,7 +258,7 @@ static inline void *get_node_mem(u32 off)
|
||||
return (void*)off;
|
||||
}
|
||||
|
||||
static inline void put_fl_mem(void *buf)
|
||||
static inline void put_fl_mem(void *buf)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ static int compare_dirents(struct b_node *new, struct b_node *old)
|
||||
struct jffs2_raw_dirent ojOld;
|
||||
struct jffs2_raw_dirent *jNew =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(new->offset, sizeof(ojNew), &ojNew);
|
||||
struct jffs2_raw_dirent *jOld =
|
||||
struct jffs2_raw_dirent *jOld =
|
||||
(struct jffs2_raw_dirent *)get_fl_mem(old->offset, sizeof(ojOld), &ojOld);
|
||||
int cmp;
|
||||
|
||||
@@ -511,7 +511,7 @@ jffs2_1pass_read_inode(struct b_lists *pL, u32 inode, char *dest)
|
||||
* we will live with it.
|
||||
*/
|
||||
for (b = pL->frag.listHead; b != NULL; b = b->next) {
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
jNode = (struct jffs2_raw_inode *) get_fl_mem(b->offset,
|
||||
sizeof(struct jffs2_raw_inode), NULL);
|
||||
if ((inode == jNode->ino)) {
|
||||
/* get actual file length from the newest node */
|
||||
|
||||
301
include/asm-microblaze/arch-microblaze/xbasic_types.h
Normal file
301
include/asm-microblaze/arch-microblaze/xbasic_types.h
Normal file
@@ -0,0 +1,301 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Author: Xilinx, Inc.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*
|
||||
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
|
||||
* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
|
||||
* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
|
||||
* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
|
||||
* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
|
||||
* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
|
||||
* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
|
||||
* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
|
||||
* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
|
||||
* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* Xilinx hardware products are not intended for use in life support
|
||||
* appliances, devices, or systems. Use in such applications is
|
||||
* expressly prohibited.
|
||||
*
|
||||
*
|
||||
* (c) Copyright 2002-2003 Xilinx Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xbasic_types.h
|
||||
*
|
||||
* This file contains basic types for Xilinx software IP. These types do not
|
||||
* follow the standard naming convention with respect to using the component
|
||||
* name in front of each name because they are considered to be primitives.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* This file contains items which are architecture dependent.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00a rmm 12/14/01 First release
|
||||
* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab
|
||||
* compiler warnings
|
||||
* </pre>
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef XBASIC_TYPES_H /* prevent circular inclusions */
|
||||
#define XBASIC_TYPES_H /* by using protection macros */
|
||||
|
||||
/***************************** Include Files *********************************/
|
||||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
/** Null */
|
||||
|
||||
#define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
|
||||
#define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
|
||||
|
||||
/* the following constants and declarations are for unit test purposes and are
|
||||
* designed to be used in test applications.
|
||||
*/
|
||||
#define XTEST_PASSED 0
|
||||
#define XTEST_FAILED 1
|
||||
|
||||
#define XASSERT_NONE 0
|
||||
#define XASSERT_OCCURRED 1
|
||||
|
||||
extern unsigned int XAssertStatus;
|
||||
extern void XAssert(char *, int);
|
||||
|
||||
/**************************** Type Definitions *******************************/
|
||||
|
||||
/** @name Primitive types
|
||||
* These primitive types are created for transportability.
|
||||
* They are dependent upon the target architecture.
|
||||
* @{
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
|
||||
typedef struct {
|
||||
u32 Upper;
|
||||
u32 Lower;
|
||||
} Xuint64;
|
||||
|
||||
/* Xilinx's unsigned integer types */
|
||||
typedef u32 Xuint32;
|
||||
typedef u16 Xuint16;
|
||||
typedef u8 Xuint8;
|
||||
|
||||
/* and signed integer types */
|
||||
typedef s32 Xint32;
|
||||
typedef s16 Xint16;
|
||||
typedef s8 Xint8;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
typedef unsigned long Xboolean;
|
||||
#define XNULL NULL
|
||||
|
||||
#define XTRUE 1
|
||||
#define XFALSE 0
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* This data type defines an interrupt handler for a device.
|
||||
* The argument points to the instance of the component
|
||||
*/
|
||||
typedef void (*XInterruptHandler) (void *InstancePtr);
|
||||
|
||||
/**
|
||||
* This data type defines a callback to be invoked when an
|
||||
* assert occurs. The callback is invoked only when asserts are enabled
|
||||
*/
|
||||
typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber);
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Return the most significant half of the 64 bit data type.
|
||||
*
|
||||
* @param x is the 64 bit word.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The upper 32 bits of the 64 bit word.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XUINT64_MSW(x) ((x).Upper)
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Return the least significant half of the 64 bit data type.
|
||||
*
|
||||
* @param x is the 64 bit word.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The lower 32 bits of the 64 bit word.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XUINT64_LSW(x) ((x).Lower)
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This assert macro is to be used for functions that do not return anything
|
||||
* (void). This in conjunction with the XWaitInAssert boolean can be used to
|
||||
* accomodate tests so that asserts which fail allow execution to continue.
|
||||
*
|
||||
* @param expression is the expression to evaluate. If it evaluates to false,
|
||||
* the assert occurs.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_VOID(expression) \
|
||||
{ \
|
||||
if (expression) { \
|
||||
XAssertStatus = XASSERT_NONE; \
|
||||
} else { \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* This assert macro is to be used for functions that do return a value. This in
|
||||
* conjunction with the XWaitInAssert boolean can be used to accomodate tests so
|
||||
* that asserts which fail allow execution to continue.
|
||||
*
|
||||
* @param expression is the expression to evaluate. If it evaluates to false,
|
||||
* the assert occurs.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns 0 unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_NONVOID(expression) \
|
||||
{ \
|
||||
if (expression) { \
|
||||
XAssertStatus = XASSERT_NONE; \
|
||||
} else { \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Always assert. This assert macro is to be used for functions that do not
|
||||
* return anything (void). Use for instances where an assert should always
|
||||
* occur.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_VOID_ALWAYS() \
|
||||
{ \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return; \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Always assert. This assert macro is to be used for functions that do return
|
||||
* a value. Use for instances where an assert should always occur.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Returns void unless the XWaitInAssert variable is true, in which case
|
||||
* no return is made and an infinite loop is entered.
|
||||
*
|
||||
* @note
|
||||
*
|
||||
* None.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define XASSERT_NONVOID_ALWAYS() \
|
||||
{ \
|
||||
XAssert(__FILE__, __LINE__); \
|
||||
XAssertStatus = XASSERT_OCCURRED; \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define XASSERT_VOID(expression)
|
||||
#define XASSERT_VOID_ALWAYS()
|
||||
#define XASSERT_NONVOID(expression)
|
||||
#define XASSERT_NONVOID_ALWAYS()
|
||||
#endif
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
|
||||
void XAssertSetCallback(XAssertCallback Routine);
|
||||
|
||||
#endif /* end of protection macro */
|
||||
63
include/asm-microblaze/arch-microblaze/xio.h
Normal file
63
include/asm-microblaze/arch-microblaze/xio.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* xio.h
|
||||
*
|
||||
* Defines XIo functions for Xilinx OCP in terms of Linux primitives
|
||||
*
|
||||
* Author: MontaVista Software, Inc.
|
||||
* source@mvista.com
|
||||
*
|
||||
* 2002 (c) MontaVista, Software, Inc. This file is licensed under the terms
|
||||
* of the GNU General Public License version 2. This program is licensed
|
||||
* "as is" without any warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#ifndef XIO_H
|
||||
#define XIO_H
|
||||
|
||||
#include "xbasic_types.h"
|
||||
#include <asm/io.h>
|
||||
|
||||
typedef u32 XIo_Address;
|
||||
|
||||
extern inline u8
|
||||
XIo_In8(XIo_Address InAddress)
|
||||
{
|
||||
return (u8) in_8((volatile unsigned char *) InAddress);
|
||||
}
|
||||
extern inline u16
|
||||
XIo_In16(XIo_Address InAddress)
|
||||
{
|
||||
return (u16) in_be16((volatile unsigned short *) InAddress);
|
||||
}
|
||||
extern inline u32
|
||||
XIo_In32(XIo_Address InAddress)
|
||||
{
|
||||
return (u32) in_be32((volatile unsigned *) InAddress);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out8(XIo_Address OutAddress, u8 Value)
|
||||
{
|
||||
out_8((volatile unsigned char *) OutAddress, Value);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out16(XIo_Address OutAddress, u16 Value)
|
||||
{
|
||||
out_be16((volatile unsigned short *) OutAddress, Value);
|
||||
}
|
||||
extern inline void
|
||||
XIo_Out32(XIo_Address OutAddress, u32 Value)
|
||||
{
|
||||
out_be32((volatile unsigned *) OutAddress, Value);
|
||||
}
|
||||
|
||||
#define XIo_ToLittleEndian16(s,d) (*(u16*)(d) = cpu_to_le16((u16)(s)))
|
||||
#define XIo_ToLittleEndian32(s,d) (*(u32*)(d) = cpu_to_le32((u32)(s)))
|
||||
#define XIo_ToBigEndian16(s,d) (*(u16*)(d) = cpu_to_be16((u16)(s)))
|
||||
#define XIo_ToBigEndian32(s,d) (*(u32*)(d) = cpu_to_be32((u32)(s)))
|
||||
|
||||
#define XIo_FromLittleEndian16(s,d) (*(u16*)(d) = le16_to_cpu((u16)(s)))
|
||||
#define XIo_FromLittleEndian32(s,d) (*(u32*)(d) = le32_to_cpu((u32)(s)))
|
||||
#define XIo_FromBigEndian16(s,d) (*(u16*)(d) = be16_to_cpu((u16)(s)))
|
||||
#define XIo_FromBigEndian32(s,d) (*(u32*)(d) = be32_to_cpu((u32)(s)))
|
||||
|
||||
#endif /* XIO_H */
|
||||
256
include/asm-microblaze/arch-microblaze/xuartlite_l.h
Normal file
256
include/asm-microblaze/arch-microblaze/xuartlite_l.h
Normal file
@@ -0,0 +1,256 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
|
||||
* AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND
|
||||
* SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE,
|
||||
* OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,
|
||||
* APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION
|
||||
* THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
|
||||
* AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
|
||||
* FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
|
||||
* WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
|
||||
* IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
|
||||
* REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
|
||||
* INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* (c) Copyright 2002 Xilinx Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
*****************************************************************************/
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* @file xuartlite_l.h
|
||||
*
|
||||
* This header file contains identifiers and low-level driver functions (or
|
||||
* macros) that can be used to access the device. High-level driver functions
|
||||
* are defined in xuartlite.h.
|
||||
*
|
||||
* <pre>
|
||||
* MODIFICATION HISTORY:
|
||||
*
|
||||
* Ver Who Date Changes
|
||||
* ----- ---- -------- -----------------------------------------------
|
||||
* 1.00b rpm 04/25/02 First release
|
||||
* </pre>
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef XUARTLITE_L_H /* prevent circular inclusions */
|
||||
#define XUARTLITE_L_H /* by using protection macros */
|
||||
|
||||
/***************************** Include Files ********************************/
|
||||
|
||||
#include "xbasic_types.h"
|
||||
#include "xio.h"
|
||||
|
||||
/************************** Constant Definitions ****************************/
|
||||
|
||||
/* UART Lite register offsets */
|
||||
|
||||
#define XUL_RX_FIFO_OFFSET 0 /* receive FIFO, read only */
|
||||
#define XUL_TX_FIFO_OFFSET 4 /* transmit FIFO, write only */
|
||||
#define XUL_STATUS_REG_OFFSET 8 /* status register, read only */
|
||||
#define XUL_CONTROL_REG_OFFSET 12 /* control register, write only */
|
||||
|
||||
/* control register bit positions */
|
||||
|
||||
#define XUL_CR_ENABLE_INTR 0x10 /* enable interrupt */
|
||||
#define XUL_CR_FIFO_RX_RESET 0x02 /* reset receive FIFO */
|
||||
#define XUL_CR_FIFO_TX_RESET 0x01 /* reset transmit FIFO */
|
||||
|
||||
/* status register bit positions */
|
||||
|
||||
#define XUL_SR_PARITY_ERROR 0x80
|
||||
#define XUL_SR_FRAMING_ERROR 0x40
|
||||
#define XUL_SR_OVERRUN_ERROR 0x20
|
||||
#define XUL_SR_INTR_ENABLED 0x10 /* interrupt enabled */
|
||||
#define XUL_SR_TX_FIFO_FULL 0x08 /* transmit FIFO full */
|
||||
#define XUL_SR_TX_FIFO_EMPTY 0x04 /* transmit FIFO empty */
|
||||
#define XUL_SR_RX_FIFO_FULL 0x02 /* receive FIFO full */
|
||||
#define XUL_SR_RX_FIFO_VALID_DATA 0x01 /* data in receive FIFO */
|
||||
|
||||
/* the following constant specifies the size of the FIFOs, the size of the
|
||||
* FIFOs includes the transmitter and receiver such that it is the total number
|
||||
* of bytes that the UART can buffer
|
||||
*/
|
||||
#define XUL_FIFO_SIZE 16
|
||||
|
||||
/* Stop bits are fixed at 1. Baud, parity, and data bits are fixed on a
|
||||
* per instance basis
|
||||
*/
|
||||
#define XUL_STOP_BITS 1
|
||||
|
||||
/* Parity definitions
|
||||
*/
|
||||
#define XUL_PARITY_NONE 0
|
||||
#define XUL_PARITY_ODD 1
|
||||
#define XUL_PARITY_EVEN 2
|
||||
|
||||
/**************************** Type Definitions ******************************/
|
||||
|
||||
/***************** Macros (Inline Functions) Definitions ********************/
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Low-level driver macros and functions. The list below provides signatures
|
||||
* to help the user use the macros.
|
||||
*
|
||||
* void XUartLite_mSetControlReg(u32 BaseAddress, u32 Mask)
|
||||
* u32 XUartLite_mGetControlReg(u32 BaseAddress)
|
||||
* u32 XUartLite_mGetStatusReg(u32 BaseAddress)
|
||||
*
|
||||
* Xboolean XUartLite_mIsReceiveEmpty(u32 BaseAddress)
|
||||
* Xboolean XUartLite_mIsTransmitFull(u32 BaseAddress)
|
||||
* Xboolean XUartLite_mIsIntrEnabled(u32 BaseAddress)
|
||||
*
|
||||
* void XUartLite_mEnableIntr(u32 BaseAddress)
|
||||
* void XUartLite_mDisableIntr(u32 BaseAddress)
|
||||
*
|
||||
* void XUartLite_SendByte(u32 BaseAddress, u8 Data);
|
||||
* u8 XUartLite_RecvByte(u32 BaseAddress);
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Set the contents of the control register. Use the XUL_CR_* constants defined
|
||||
* above to create the bit-mask to be written to the register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
* @param Mask is the 32-bit value to write to the control register
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mSetControlReg(BaseAddress, Mask) \
|
||||
XIo_Out32((BaseAddress) + XUL_CONTROL_REG_OFFSET, (Mask))
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Get the contents of the control register. Use the XUL_CR_* constants defined
|
||||
* above to interpret the bit-mask returned.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return A 32-bit value representing the contents of the control register.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mGetControlReg(BaseAddress) \
|
||||
XIo_In32((BaseAddress) + XUL_CONTROL_REG_OFFSET)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Get the contents of the status register. Use the XUL_SR_* constants defined
|
||||
* above to interpret the bit-mask returned.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return A 32-bit value representing the contents of the status register.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mGetStatusReg(BaseAddress) \
|
||||
XIo_In32((BaseAddress) + XUL_STATUS_REG_OFFSET)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the receiver has data.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the receiver is empty, XFALSE if there is data present.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsReceiveEmpty(BaseAddress) \
|
||||
(!(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_RX_FIFO_VALID_DATA))
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the transmitter is full.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the transmitter is full, XFALSE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsTransmitFull(BaseAddress) \
|
||||
(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_TX_FIFO_FULL)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Check to see if the interrupt is enabled.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return XTRUE if the interrupt is enabled, XFALSE otherwise.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mIsIntrEnabled(BaseAddress) \
|
||||
(XUartLite_mGetStatusReg((BaseAddress)) & XUL_SR_INTR_ENABLED)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Enable the device interrupt. Preserve the contents of the control register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mEnableIntr(BaseAddress) \
|
||||
XUartLite_mSetControlReg((BaseAddress), \
|
||||
XUartLite_mGetControlReg((BaseAddress)) | XUL_CR_ENABLE_INTR)
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* Disable the device interrupt. Preserve the contents of the control register.
|
||||
*
|
||||
* @param BaseAddress is the base address of the device
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define XUartLite_mDisableIntr(BaseAddress) \
|
||||
XUartLite_mSetControlReg((BaseAddress), \
|
||||
XUartLite_mGetControlReg((BaseAddress)) & ~XUL_CR_ENABLE_INTR)
|
||||
|
||||
|
||||
/************************** Function Prototypes *****************************/
|
||||
|
||||
void XUartLite_SendByte(u32 BaseAddress, u8 Data);
|
||||
u8 XUartLite_RecvByte(u32 BaseAddress);
|
||||
|
||||
|
||||
#endif /* end of protection macro */
|
||||
392
include/asm-microblaze/bitops.h
Normal file
392
include/asm-microblaze/bitops.h
Normal file
@@ -0,0 +1,392 @@
|
||||
#ifndef _MICROBLAZE_BITOPS_H
|
||||
#define _MICROBLAZE_BITOPS_H
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <asm/byteorder.h> /* swab32 */
|
||||
#include <asm/system.h> /* save_flags */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* Function prototypes to keep gcc -Wall happy
|
||||
*/
|
||||
|
||||
/*
|
||||
* The __ functions are not atomic
|
||||
*/
|
||||
|
||||
extern void set_bit(int nr, volatile void * addr);
|
||||
extern void __set_bit(int nr, volatile void * addr);
|
||||
|
||||
extern void clear_bit(int nr, volatile void * addr);
|
||||
#define __clear_bit(nr, addr) clear_bit(nr, addr)
|
||||
|
||||
extern void change_bit(int nr, volatile void * addr);
|
||||
extern void __change_bit(int nr, volatile void * addr);
|
||||
extern int test_and_set_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_set_bit(int nr, volatile void * addr);
|
||||
extern int test_and_clear_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_clear_bit(int nr, volatile void * addr);
|
||||
extern int test_and_change_bit(int nr, volatile void * addr);
|
||||
extern int __test_and_change_bit(int nr, volatile void * addr);
|
||||
extern int __constant_test_bit(int nr, const volatile void * addr);
|
||||
extern int __test_bit(int nr, volatile void * addr);
|
||||
extern int find_first_zero_bit(void * addr, unsigned size);
|
||||
extern int find_next_zero_bit (void * addr, int size, int offset);
|
||||
|
||||
/*
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
extern __inline__ unsigned long ffz(unsigned long word)
|
||||
{
|
||||
unsigned long result = 0;
|
||||
|
||||
while(word & 1) {
|
||||
result++;
|
||||
word >>= 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
extern __inline__ void set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void __set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
*a |= mask;
|
||||
}
|
||||
|
||||
/*
|
||||
* clear_bit() doesn't provide any barrier for the compiler.
|
||||
*/
|
||||
#define smp_mb__before_clear_bit() barrier()
|
||||
#define smp_mb__after_clear_bit() barrier()
|
||||
|
||||
extern __inline__ void clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long flags;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
save_flags_cli(flags);
|
||||
*ADDR ^= mask;
|
||||
restore_flags(flags);
|
||||
}
|
||||
|
||||
extern __inline__ void __change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
unsigned long *ADDR = (unsigned long *) addr;
|
||||
|
||||
ADDR += nr >> 5;
|
||||
mask = 1 << (nr & 31);
|
||||
*ADDR ^= mask;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a |= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a &= ~mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int test_and_change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
restore_flags(flags);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_and_change_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
volatile unsigned int *a = (volatile unsigned int *) addr;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
retval = (mask & *a) != 0;
|
||||
*a ^= mask;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine doesn't need to be atomic.
|
||||
*/
|
||||
extern __inline__ int __constant_test_bit(int nr, const volatile void * addr)
|
||||
{
|
||||
return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
|
||||
}
|
||||
|
||||
extern __inline__ int __test_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int * a = (int *) addr;
|
||||
int mask;
|
||||
|
||||
a += nr >> 5;
|
||||
mask = 1 << (nr & 0x1f);
|
||||
return ((mask & *a) != 0);
|
||||
}
|
||||
|
||||
#define test_bit(nr,addr) \
|
||||
(__builtin_constant_p(nr) ? \
|
||||
__constant_test_bit((nr),(addr)) : \
|
||||
__test_bit((nr),(addr)))
|
||||
|
||||
#define find_first_zero_bit(addr, size) \
|
||||
find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
extern __inline__ int find_next_zero_bit (void * addr, int size, int offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if (offset) {
|
||||
tmp = *(p++);
|
||||
tmp |= ~0UL >> (32-offset);
|
||||
if (size < 32)
|
||||
goto found_first;
|
||||
if (~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while (size & ~31UL) {
|
||||
if (~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if (!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
tmp |= ~0UL >> size;
|
||||
found_middle:
|
||||
return result + ffz(tmp);
|
||||
}
|
||||
|
||||
#define ffs(x) generic_ffs(x)
|
||||
|
||||
/*
|
||||
* hweightN: returns the hamming weight (i.e. the number
|
||||
* of bits set) of a N-bit word
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
|
||||
extern __inline__ int ext2_set_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR |= mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int ext2_clear_bit(int nr, volatile void * addr)
|
||||
{
|
||||
int mask, retval;
|
||||
unsigned long flags;
|
||||
volatile unsigned char *ADDR = (unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
save_flags_cli(flags);
|
||||
retval = (mask & *ADDR) != 0;
|
||||
*ADDR &= ~mask;
|
||||
restore_flags(flags);
|
||||
return retval;
|
||||
}
|
||||
|
||||
extern __inline__ int ext2_test_bit(int nr, const volatile void * addr)
|
||||
{
|
||||
int mask;
|
||||
const volatile unsigned char *ADDR = (const unsigned char *) addr;
|
||||
|
||||
ADDR += nr >> 3;
|
||||
mask = 1 << (nr & 0x07);
|
||||
return ((mask & *ADDR) != 0);
|
||||
}
|
||||
|
||||
#define ext2_find_first_zero_bit(addr, size) \
|
||||
ext2_find_next_zero_bit((addr), (size), 0)
|
||||
|
||||
extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
|
||||
{
|
||||
unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
|
||||
unsigned long result = offset & ~31UL;
|
||||
unsigned long tmp;
|
||||
|
||||
if (offset >= size)
|
||||
return size;
|
||||
size -= result;
|
||||
offset &= 31UL;
|
||||
if(offset) {
|
||||
/* We hold the little endian value in tmp, but then the
|
||||
* shift is illegal. So we could keep a big endian value
|
||||
* in tmp, like this:
|
||||
*
|
||||
* tmp = __swab32(*(p++));
|
||||
* tmp |= ~0UL >> (32-offset);
|
||||
*
|
||||
* but this would decrease preformance, so we change the
|
||||
* shift:
|
||||
*/
|
||||
tmp = *(p++);
|
||||
tmp |= __swab32(~0UL >> (32-offset));
|
||||
if(size < 32)
|
||||
goto found_first;
|
||||
if(~tmp)
|
||||
goto found_middle;
|
||||
size -= 32;
|
||||
result += 32;
|
||||
}
|
||||
while(size & ~31UL) {
|
||||
if(~(tmp = *(p++)))
|
||||
goto found_middle;
|
||||
result += 32;
|
||||
size -= 32;
|
||||
}
|
||||
if(!size)
|
||||
return result;
|
||||
tmp = *p;
|
||||
|
||||
found_first:
|
||||
/* tmp is little endian, so we would have to swab the shift,
|
||||
* see above. But then we have to swab tmp below for ffz, so
|
||||
* we might as well do this here.
|
||||
*/
|
||||
return result + ffz(__swab32(tmp) | (~0UL << size));
|
||||
found_middle:
|
||||
return result + ffz(__swab32(tmp));
|
||||
}
|
||||
|
||||
/* Bitmap functions for the minix filesystem. */
|
||||
#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
|
||||
#define minix_set_bit(nr,addr) set_bit(nr,addr)
|
||||
#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
|
||||
#define minix_test_bit(nr,addr) test_bit(nr,addr)
|
||||
#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
|
||||
|
||||
/**
|
||||
* hweightN - returns the hamming weight of a N-bit word
|
||||
* @x: the word to weigh
|
||||
*
|
||||
* The Hamming Weight of a number is the total number of bits set in it.
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _MICROBLAZE_BITOPS_H */
|
||||
53
include/asm-microblaze/byteorder.h
Normal file
53
include/asm-microblaze/byteorder.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* include/asm-microblaze/byteorder.h -- Endian id and conversion ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_BYTEORDER_H__
|
||||
#define __MICROBLAZE_BYTEORDER_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/* This is effectively a dupe of the arch-independent byteswap
|
||||
code in include/linux/byteorder/swab.h, however we force a cast
|
||||
of the result up to 32 bits. This in turn forces the compiler
|
||||
to explicitly clear the high 16 bits, which it wasn't doing otherwise.
|
||||
|
||||
I think this is a symptom of a bug in mb-gcc. JW 20040303
|
||||
*/
|
||||
static __inline__ __const__ __u16 ___arch__swab16 (__u16 half_word)
|
||||
{
|
||||
/* 32 bit temp to cast result, forcing clearing of high word */
|
||||
__u32 temp;
|
||||
|
||||
temp = ((half_word & 0x00FFU) << 8) | ((half_word & 0xFF00U) >> 8);
|
||||
|
||||
return (__u16) temp;
|
||||
}
|
||||
|
||||
#define __arch__swab16(x) ___arch__swab16(x)
|
||||
|
||||
/* Microblaze has no arch-specific endian conversion insns */
|
||||
|
||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
||||
# define __BYTEORDER_HAS_U64__
|
||||
# define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
|
||||
#endif /* __MICROBLAZE_BYTEORDER_H__ */
|
||||
58
include/asm-microblaze/global_data.h
Normal file
58
include/asm-microblaze/global_data.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __ASM_GBL_DATA_H
|
||||
#define __ASM_GBL_DATA_H
|
||||
/*
|
||||
* The following data structure is placed in some memory wich is
|
||||
* available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
|
||||
* some locked parts of the data cache) to allow for a minimum set of
|
||||
* global variables during system initialization (until we have set
|
||||
* up the memory controller so that we can use RAM).
|
||||
*
|
||||
* Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t)
|
||||
*/
|
||||
|
||||
typedef struct global_data {
|
||||
bd_t *bd;
|
||||
unsigned long flags;
|
||||
unsigned long baudrate;
|
||||
unsigned long have_console; /* serial_init() was called */
|
||||
unsigned long reloc_off; /* Relocation Offset */
|
||||
unsigned long env_addr; /* Address of Environment struct */
|
||||
unsigned long env_valid; /* Checksum of Environment valid? */
|
||||
unsigned long fb_base; /* base address of frame buffer */
|
||||
void **jt; /* jump table */
|
||||
} gd_t;
|
||||
|
||||
/*
|
||||
* Global Data Flags
|
||||
*/
|
||||
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
|
||||
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
|
||||
#define GD_FLG_SILENT 0x00004 /* Silent mode */
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
||||
128
include/asm-microblaze/io.h
Normal file
128
include/asm-microblaze/io.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* include/asm-microblaze/io.h -- Misc I/O operations
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,02 NEC Corporation
|
||||
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_IO_H__
|
||||
#define __MICROBLAZE_IO_H__
|
||||
|
||||
#define IO_SPACE_LIMIT 0xFFFFFFFF
|
||||
|
||||
#define readb(addr) \
|
||||
({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
|
||||
#define readw(addr) \
|
||||
({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
|
||||
#define readl(addr) \
|
||||
({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
|
||||
|
||||
#define writeb(b, addr) \
|
||||
(void)((*(volatile unsigned char *) (addr)) = (b))
|
||||
#define writew(b, addr) \
|
||||
(void)((*(volatile unsigned short *) (addr)) = (b))
|
||||
#define writel(b, addr) \
|
||||
(void)((*(volatile unsigned int *) (addr)) = (b))
|
||||
|
||||
#define memset_io(a,b,c) memset((void *)(a),(b),(c))
|
||||
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
|
||||
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
|
||||
|
||||
#define inb(addr) readb (addr)
|
||||
#define inw(addr) readw (addr)
|
||||
#define inl(addr) readl (addr)
|
||||
#define outb(x, addr) ((void) writeb (x, addr))
|
||||
#define outw(x, addr) ((void) writew (x, addr))
|
||||
#define outl(x, addr) ((void) writel (x, addr))
|
||||
|
||||
/* Some #definitions to keep strange Xilinx code happy */
|
||||
#define in_8(addr) readb (addr)
|
||||
#define in_be16(addr) readw (addr)
|
||||
#define in_be32(addr) readl (addr)
|
||||
|
||||
#define out_8(addr,x ) outb (x,addr)
|
||||
#define out_be16(addr,x ) outw (x,addr)
|
||||
#define out_be32(addr,x ) outl (x,addr)
|
||||
|
||||
|
||||
#define inb_p(port) inb((port))
|
||||
#define outb_p(val, port) outb((val), (port))
|
||||
#define inw_p(port) inw((port))
|
||||
#define outw_p(val, port) outw((val), (port))
|
||||
#define inl_p(port) inl((port))
|
||||
#define outl_p(val, port) outl((val), (port))
|
||||
|
||||
/* Some defines to keep the MTD flash drivers happy */
|
||||
|
||||
#define __raw_readb readb
|
||||
#define __raw_readw readw
|
||||
#define __raw_readl readl
|
||||
#define __raw_writeb writeb
|
||||
#define __raw_writew writew
|
||||
#define __raw_writel writel
|
||||
|
||||
static inline void io_insb (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
while (count--)
|
||||
*p++ = inb (port);
|
||||
}
|
||||
static inline void io_insw (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned short *p = dst;
|
||||
while (count--)
|
||||
*p++ = inw (port);
|
||||
}
|
||||
static inline void io_insl (unsigned long port, void *dst, unsigned long count)
|
||||
{
|
||||
unsigned long *p = dst;
|
||||
while (count--)
|
||||
*p++ = inl (port);
|
||||
}
|
||||
|
||||
static inline void
|
||||
io_outsb (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
while (count--)
|
||||
outb (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsw (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned short *p = src;
|
||||
while (count--)
|
||||
outw (*p++, port);
|
||||
}
|
||||
static inline void
|
||||
io_outsl (unsigned long port, const void *src, unsigned long count)
|
||||
{
|
||||
const unsigned long *p = src;
|
||||
while (count--)
|
||||
outl (*p++, port);
|
||||
}
|
||||
|
||||
#define outsb(a,b,l) io_outsb(a,b,l)
|
||||
#define outsw(a,b,l) io_outsw(a,b,l)
|
||||
#define outsl(a,b,l) io_outsl(a,b,l)
|
||||
|
||||
#define insb(a,b,l) io_insb(a,b,l)
|
||||
#define insw(a,b,l) io_insw(a,b,l)
|
||||
#define insl(a,b,l) io_insl(a,b,l)
|
||||
|
||||
|
||||
#define iounmap(addr) ((void)0)
|
||||
#define ioremap(physaddr, size) (physaddr)
|
||||
#define ioremap_nocache(physaddr, size) (physaddr)
|
||||
#define ioremap_writethrough(physaddr, size) (physaddr)
|
||||
#define ioremap_fullcache(physaddr, size) (physaddr)
|
||||
|
||||
#endif /* __MICROBLAZE_IO_H__ */
|
||||
29
include/asm-microblaze/platform.h
Normal file
29
include/asm-microblaze/platform.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef CONFIG_SUZAKU
|
||||
#include <asm/suzaku.h>
|
||||
#endif
|
||||
76
include/asm-microblaze/posix_types.h
Normal file
76
include/asm-microblaze/posix_types.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* include/asm-microblaze/posix_types.h -- Kernel versions of standard types
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_POSIX_TYPES_H__
|
||||
#define __MICROBLAZE_POSIX_TYPES_H__
|
||||
|
||||
#include <asm/bitops.h>
|
||||
|
||||
|
||||
typedef unsigned int __kernel_dev_t;
|
||||
typedef unsigned long __kernel_ino_t;
|
||||
typedef unsigned long long __kernel_ino64_t;
|
||||
typedef unsigned int __kernel_mode_t;
|
||||
typedef unsigned int __kernel_nlink_t;
|
||||
typedef long __kernel_off_t;
|
||||
typedef long long __kernel_loff_t;
|
||||
typedef int __kernel_pid_t;
|
||||
typedef unsigned short __kernel_ipc_pid_t;
|
||||
typedef unsigned int __kernel_uid_t;
|
||||
typedef unsigned int __kernel_gid_t;
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
typedef long __kernel_time_t;
|
||||
typedef long __kernel_suseconds_t;
|
||||
typedef long __kernel_clock_t;
|
||||
typedef int __kernel_daddr_t;
|
||||
typedef char * __kernel_caddr_t;
|
||||
typedef unsigned short __kernel_uid16_t;
|
||||
typedef unsigned short __kernel_gid16_t;
|
||||
typedef unsigned int __kernel_uid32_t;
|
||||
typedef unsigned int __kernel_gid32_t;
|
||||
|
||||
typedef unsigned short __kernel_old_uid_t;
|
||||
typedef unsigned short __kernel_old_gid_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
#if defined(__KERNEL__) || defined(__USE_ALL)
|
||||
int val[2];
|
||||
#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
|
||||
int __val[2];
|
||||
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
|
||||
} __kernel_fsid_t;
|
||||
|
||||
|
||||
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
|
||||
|
||||
#undef __FD_SET
|
||||
#define __FD_SET(fd, fd_set) \
|
||||
__set_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_CLR
|
||||
#define __FD_CLR(fd, fd_set) \
|
||||
__clear_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ISSET
|
||||
#define __FD_ISSET(fd, fd_set) \
|
||||
__test_bit (fd, (void *)&((__kernel_fd_set *)fd_set)->fds_bits)
|
||||
#undef __FD_ZERO
|
||||
#define __FD_ZERO(fd_set) \
|
||||
memset (fd_set, 0, sizeof (*(fd_set *)fd_set))
|
||||
|
||||
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
|
||||
|
||||
#endif /* __MICROBLAZE_POSIX_TYPES_H__ */
|
||||
116
include/asm-microblaze/ptrace.h
Normal file
116
include/asm-microblaze/ptrace.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* include/asm-microblaze/ptrace.h -- Access to CPU registers
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_PTRACE_H__
|
||||
#define __MICROBLAZE_PTRACE_H__
|
||||
|
||||
|
||||
/* Microblaze general purpose registers with special meanings. */
|
||||
#define GPR_ZERO 0 /* constant zero */
|
||||
#define GPR_ASM 18 /* reserved for assembler */
|
||||
#define GPR_SP 1 /* stack pointer */
|
||||
#define GPR_GP 2 /* global data pointer */
|
||||
#define GPR_EP 30 /* `element pointer' */
|
||||
#define GPR_LP 15 /* link pointer (current return address) */
|
||||
|
||||
/* These aren't official names, but they make some code more descriptive. */
|
||||
#define GPR_ARG0 5
|
||||
#define GPR_ARG1 6
|
||||
#define GPR_ARG2 7
|
||||
#define GPR_ARG3 8
|
||||
#define GPR_ARG4 9
|
||||
#define GPR_ARG5 10
|
||||
#define GPR_RVAL0 3
|
||||
#define GPR_RVAL1 4
|
||||
#define GPR_RVAL GPR_RVAL0
|
||||
|
||||
#define NUM_GPRS 32
|
||||
|
||||
/* `system' registers. */
|
||||
/* Note these are old v850 values, microblaze has many fewer */
|
||||
#define SR_EIPC 0
|
||||
#define SR_EIPSW 1
|
||||
#define SR_FEPC 2
|
||||
#define SR_FEPSW 3
|
||||
#define SR_ECR 4
|
||||
#define SR_PSW 5
|
||||
#define SR_CTPC 16
|
||||
#define SR_CTPSW 17
|
||||
#define SR_DBPC 18
|
||||
#define SR_DBPSW 19
|
||||
#define SR_CTBP 20
|
||||
#define SR_DIR 21
|
||||
#define SR_ASID 23
|
||||
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
typedef unsigned long microblaze_reg_t;
|
||||
|
||||
/* How processor state is stored on the stack during a syscall/signal.
|
||||
If you change this structure, change the associated assembly-language
|
||||
macros below too (PT_*)! */
|
||||
struct pt_regs
|
||||
{
|
||||
/* General purpose registers. */
|
||||
microblaze_reg_t gpr[NUM_GPRS];
|
||||
|
||||
microblaze_reg_t pc; /* program counter */
|
||||
microblaze_reg_t psw; /* program status word */
|
||||
|
||||
microblaze_reg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */
|
||||
microblaze_reg_t single_step; /* 1 if in single step mode */
|
||||
};
|
||||
|
||||
|
||||
#define instruction_pointer(regs) ((regs)->pc)
|
||||
#define user_mode(regs) (!(regs)->kernel_mode)
|
||||
|
||||
/* When a struct pt_regs is used to save user state for a system call in
|
||||
the kernel, the system call is stored in the space for R0 (since it's
|
||||
never used otherwise, R0 being a constant 0). Non-system-calls
|
||||
simply store 0 there. */
|
||||
#define PT_REGS_SYSCALL(regs) (regs)->gpr[0]
|
||||
#define PT_REGS_SET_SYSCALL(regs, val) ((regs)->gpr[0] = (val))
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
|
||||
/* The number of bytes used to store each register. */
|
||||
#define _PT_REG_SIZE 4
|
||||
|
||||
/* Offset of a general purpose register in a stuct pt_regs. */
|
||||
#define PT_GPR(num) ((num) * _PT_REG_SIZE)
|
||||
|
||||
/* Offsets of various special registers & fields in a struct pt_regs. */
|
||||
#define NUM_SPECIAL 4
|
||||
#define PT_PC ((NUM_GPRS + 0) * _PT_REG_SIZE)
|
||||
#define PT_PSW ((NUM_GPRS + 1) * _PT_REG_SIZE)
|
||||
#define PT_KERNEL_MODE ((NUM_GPRS + 2) * _PT_REG_SIZE)
|
||||
#define PT_SINGLESTEP ((NUM_GPRS + 3) * _PT_REG_SIZE)
|
||||
|
||||
#define PT_SYSCALL PT_GPR(0)
|
||||
|
||||
/* Size of struct pt_regs, including alignment. */
|
||||
#define PT_SIZE ((NUM_GPRS + NUM_SPECIAL) * _PT_REG_SIZE)
|
||||
|
||||
/* These are `magic' values for PTRACE_PEEKUSR that return info about where
|
||||
a process is located in memory. */
|
||||
#define PT_TEXT_ADDR (PT_SIZE + 1)
|
||||
#define PT_TEXT_LEN (PT_SIZE + 2)
|
||||
#define PT_DATA_ADDR (PT_SIZE + 3)
|
||||
#define PT_DATA_LEN (PT_SIZE + 4)
|
||||
|
||||
#endif /* __MICROBLAZE_PTRACE_H__ */
|
||||
25
include/asm-microblaze/serial_xuartlite.h
Normal file
25
include/asm-microblaze/serial_xuartlite.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <asm/arch/xuartlite_l.h>
|
||||
31
include/asm-microblaze/string.h
Normal file
31
include/asm-microblaze/string.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* include/asm-microblaze/string.h -- Architecture specific string routines
|
||||
*
|
||||
* Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
|
||||
* Copyright (C) 2001,2002 NEC Corporation
|
||||
* Copyright (C) 2001,2002 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_STRING_H__
|
||||
#define __MICROBLAZE_STRING_H__
|
||||
|
||||
#if 0
|
||||
#define __HAVE_ARCH_BCOPY
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
|
||||
extern void *memcpy (void *, const void *, __kernel_size_t);
|
||||
extern void bcopy (const char *, char *, int);
|
||||
extern void *memset (void *, int, __kernel_size_t);
|
||||
extern void *memmove (void *, const void *, __kernel_size_t);
|
||||
#endif
|
||||
|
||||
#endif /* __MICROBLAZE_STRING_H__ */
|
||||
25
include/asm-microblaze/suzaku.h
Normal file
25
include/asm-microblaze/suzaku.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* EMPTY FILE */
|
||||
161
include/asm-microblaze/system.h
Normal file
161
include/asm-microblaze/system.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* include/asm-microblaze/system.h -- Low-level interrupt/thread ops
|
||||
*
|
||||
* Copyright (C) 2003 John Williams (jwilliams@itee.uq.edu.au)
|
||||
* based upon microblaze version
|
||||
* Copyright (C) 2001 NEC Corporation
|
||||
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General
|
||||
* Public License. See the file COPYING in the main directory of this
|
||||
* archive for more details.
|
||||
*
|
||||
* Written by Miles Bader <miles@gnu.org>
|
||||
* Microblaze port by John Williams
|
||||
* Microblaze port by John Williams
|
||||
*/
|
||||
|
||||
#ifndef __MICROBLAZE_SYSTEM_H__
|
||||
#define __MICROBLAZE_SYSTEM_H__
|
||||
|
||||
#if 0
|
||||
#include <linux/linkage.h>
|
||||
#endif
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
#define prepare_to_switch() do { } while (0)
|
||||
|
||||
/*
|
||||
* switch_to(n) should switch tasks to task ptr, first checking that
|
||||
* ptr isn't the current task, in which case it does nothing.
|
||||
*/
|
||||
struct thread_struct;
|
||||
extern void *switch_thread (struct thread_struct *last,
|
||||
struct thread_struct *next);
|
||||
#define switch_to(prev,next,last) do { \
|
||||
if (prev != next) { \
|
||||
(last) = switch_thread (&prev->thread, &next->thread); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* Enable/disable interrupts. */
|
||||
#define __sti() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %0, %0, 2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __cli() \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %0, %0, ~2; \
|
||||
mts rmsr, %0" \
|
||||
: "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags(flags) \
|
||||
__asm__ __volatile__ ("mfs %0, rmsr" : "=r" (flags))
|
||||
#define __restore_flags(flags) \
|
||||
__asm__ __volatile__ ("mts rmsr, %0" :: "r" (flags))
|
||||
|
||||
#define __save_flags_cli(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
andi %1, %0, ~2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags), "=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
#define __save_flags_sti(flags) \
|
||||
{ \
|
||||
register unsigned tmp; \
|
||||
__asm__ __volatile__ (" \
|
||||
mfs %0, rmsr; \
|
||||
ori %1, %0, 2; \
|
||||
mts rmsr, %1;" \
|
||||
: "=r" (flags) ,"=r" (tmp) \
|
||||
: \
|
||||
: "memory"); \
|
||||
}
|
||||
|
||||
/* For spinlocks etc */
|
||||
#define local_irq_save(flags) __save_flags_cli (flags)
|
||||
#define local_irq_set(flags) __save_flags_sti (flags)
|
||||
#define local_irq_restore(flags) __restore_flags (flags)
|
||||
#define local_irq_disable() __cli ()
|
||||
#define local_irq_enable() __sti ()
|
||||
|
||||
#define cli() __cli ()
|
||||
#define sti() __sti ()
|
||||
#define save_flags(flags) __save_flags (flags)
|
||||
#define restore_flags(flags) __restore_flags (flags)
|
||||
#define save_flags_cli(flags) __save_flags_cli (flags)
|
||||
|
||||
/*
|
||||
* Force strict CPU ordering.
|
||||
* Not really required on microblaze...
|
||||
*/
|
||||
#define nop() __asm__ __volatile__ ("nop")
|
||||
#define mb() __asm__ __volatile__ ("nop" ::: "memory")
|
||||
#define rmb() mb ()
|
||||
#define wmb() mb ()
|
||||
#define set_mb(var, value) do { var = value; mb(); } while (0)
|
||||
#define set_wmb(var, value) do { var = value; wmb (); } while (0)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#define smp_mb() mb ()
|
||||
#define smp_rmb() rmb ()
|
||||
#define smp_wmb() wmb ()
|
||||
#else
|
||||
#define smp_mb() barrier ()
|
||||
#define smp_rmb() barrier ()
|
||||
#define smp_wmb() barrier ()
|
||||
#endif
|
||||
|
||||
#define xchg(ptr, with) \
|
||||
((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr))))
|
||||
#define tas(ptr) (xchg ((ptr), 1))
|
||||
|
||||
extern inline unsigned long __xchg (unsigned long with,
|
||||
__volatile__ void *ptr, int size)
|
||||
{
|
||||
unsigned long tmp, flags;
|
||||
|
||||
save_flags_cli (flags);
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
tmp = *(unsigned char *)ptr;
|
||||
*(unsigned char *)ptr = with;
|
||||
break;
|
||||
case 2:
|
||||
tmp = *(unsigned short *)ptr;
|
||||
*(unsigned short *)ptr = with;
|
||||
break;
|
||||
case 4:
|
||||
tmp = *(unsigned long *)ptr;
|
||||
*(unsigned long *)ptr = with;
|
||||
break;
|
||||
}
|
||||
|
||||
restore_flags (flags);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif /* __MICROBLAZE_SYSTEM_H__ */
|
||||
57
include/asm-microblaze/types.h
Normal file
57
include/asm-microblaze/types.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef _ASM_TYPES_H
|
||||
#define _ASM_TYPES_H
|
||||
|
||||
/*
|
||||
* This file is never included by application software unless
|
||||
* explicitly requested (e.g., via linux/types.h) in which case the
|
||||
* application is Linux specific so (user-) name space pollution is
|
||||
* not a major issue. However, for interoperability, libraries still
|
||||
* need to be careful to avoid a name clashes.
|
||||
*/
|
||||
|
||||
typedef unsigned short umode_t;
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
|
||||
/* Dma addresses are 32-bits wide. */
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_TYPES_H */
|
||||
42
include/asm-microblaze/u-boot.h
Normal file
42
include/asm-microblaze/u-boot.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _U_BOOT_H_
|
||||
#define _U_BOOT_H_
|
||||
|
||||
typedef struct bd_info {
|
||||
unsigned long bi_memstart; /* start of DRAM memory */
|
||||
unsigned long bi_memsize; /* size of DRAM memory in bytes */
|
||||
unsigned long bi_flashstart; /* start of FLASH memory */
|
||||
unsigned long bi_flashsize; /* size of FLASH memory */
|
||||
unsigned long bi_flashoffset; /* reserved area for startup monitor */
|
||||
unsigned long bi_sramstart; /* start of SRAM memory */
|
||||
unsigned long bi_sramsize; /* size of SRAM memory */
|
||||
unsigned long bi_ip_addr; /* IP Address */
|
||||
unsigned char bi_enetaddr[6]; /* Ethernet adress */
|
||||
unsigned long bi_baudrate; /* Console Baudrate */
|
||||
} bd_t;
|
||||
|
||||
|
||||
#endif /* _U_BOOT_H_ */
|
||||
@@ -135,17 +135,21 @@ typedef struct pci_config {
|
||||
uint pci_imimr;
|
||||
char res5[24];
|
||||
uint pci_ifhpr;
|
||||
char res5_2[4];
|
||||
uint pci_iftpr;
|
||||
char res6[8];
|
||||
char res6[4];
|
||||
uint pci_iphpr;
|
||||
char res6_2[4];
|
||||
uint pci_iptpr;
|
||||
char res7[8];
|
||||
char res7[4];
|
||||
uint pci_ofhpr;
|
||||
char res7_2[4];
|
||||
uint pci_oftpr;
|
||||
char res8[8];
|
||||
char res8[4];
|
||||
uint pci_ophpr;
|
||||
char res8_2[4];
|
||||
uint pci_optpr;
|
||||
char res9[12];
|
||||
char res9[8];
|
||||
uint pci_mucr;
|
||||
char res10[8];
|
||||
uint pci_qbar;
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
/* watchdog disabled */
|
||||
#undef CONFIG_WATCHDOG
|
||||
/* SPD EEPROM (sdram speed config) disabled */
|
||||
#undef CONFIG_SPD_EEPRO
|
||||
#undef CONFIG_SPD_EEPROM
|
||||
#undef SPD_EEPROM_ADDRESS
|
||||
|
||||
/*
|
||||
|
||||
@@ -118,7 +118,9 @@
|
||||
#define CONFIG_COMMANDS ( CONFIG_CMD_DFL | \
|
||||
CFG_CMD_DHCP | \
|
||||
CFG_CMD_I2C | \
|
||||
CFG_CMD_IDE )
|
||||
CFG_CMD_IDE | \
|
||||
CFG_CMD_USB | \
|
||||
CFG_CMD_FAT)
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
@@ -386,4 +388,7 @@
|
||||
#define CONFIG_AUTOBOOT_STOP_STR "." /* easy to stop for now */
|
||||
#define CONFIG_SILENT_CONSOLE 1
|
||||
|
||||
#define CONFIG_USB_STORAGE 1
|
||||
#define CONFIG_USB_SL811HS 1
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
#undef CONFIG_BOOTARGS
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"tftpboot; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) " \
|
||||
"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} " \
|
||||
"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " \
|
||||
"bootm"
|
||||
|
||||
#define CONFIG_AUTOSCRIPT
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
#undef CONFIG_BOOTARGS
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"tftpboot; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) " \
|
||||
"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} " \
|
||||
"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " \
|
||||
"bootm"
|
||||
|
||||
#define CONFIG_LOADS_ECHO 0 /* echo off for serial download */
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
#undef CONFIG_BOOTARGS
|
||||
#define CONFIG_BOOTCOMMAND \
|
||||
"tftpboot; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) " \
|
||||
"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off; " \
|
||||
"setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} " \
|
||||
"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; " \
|
||||
"bootm"
|
||||
|
||||
#define CONFIG_LOADS_ECHO 0 /* echo off for serial download */
|
||||
|
||||
@@ -94,7 +94,11 @@
|
||||
|
||||
# define CONFIG_USB_OHCI
|
||||
# define CONFIG_USB_CLOCK 0x0001bbbb
|
||||
# define CONFIG_USB_CONFIG 0x00005000
|
||||
# if defined (CONFIG_EVAL5200)
|
||||
# define CONFIG_USB_CONFIG 0x00005100
|
||||
# else
|
||||
# define CONFIG_USB_CONFIG 0x00001000
|
||||
# endif
|
||||
# define ADD_USB_CMD CFG_CMD_USB | CFG_CMD_FAT
|
||||
# define CONFIG_DOS_PARTITION
|
||||
# define CONFIG_USB_STORAGE
|
||||
@@ -325,7 +329,7 @@
|
||||
* PCI disabled
|
||||
* Ethernet 100 with MD
|
||||
*/
|
||||
#define CFG_GPS_PORT_CONFIG 0x00058444
|
||||
#define CFG_GPS_PORT_CONFIG 0x00058044
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
|
||||
@@ -175,7 +175,8 @@
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x00000000
|
||||
#define CFG_MAX_RAM_SIZE 0x10000000
|
||||
#define CFG_MAX_RAM_SIZE 0x20000000
|
||||
#define CONFIG_VERY_BIG_RAM
|
||||
|
||||
#define CFG_RESET_ADDRESS 0xFFF00100
|
||||
|
||||
|
||||
403
include/configs/stxgp3.h
Normal file
403
include/configs/stxgp3.h
Normal file
@@ -0,0 +1,403 @@
|
||||
/*
|
||||
* (C) Copyright 2003 Embedded Edge, LLC
|
||||
* Dan Malek <dan@embeddededge.com>
|
||||
* Copied from ADS85xx.
|
||||
* Updates for Silicon Tx GP3 8560 board.
|
||||
*
|
||||
* (C) Copyright 2002,2003 Motorola,Inc.
|
||||
* Xianghua Xiao <X.Xiao@motorola.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* mpc8560ads board configuration file */
|
||||
/* please refer to doc/README.mpc85xx for more info */
|
||||
/* make sure you change the MAC address and other network params first,
|
||||
* search for CONFIG_ETHADDR,CONFIG_SERVERIP,etc in this file
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
/* High Level Configuration Options */
|
||||
#define CONFIG_BOOKE 1 /* BOOKE */
|
||||
#define CONFIG_E500 1 /* BOOKE e500 family */
|
||||
#define CONFIG_MPC85xx 1 /* MPC8540/MPC8560 */
|
||||
#define CONFIG_MPC85xx_REV1 1 /* MPC85xx Rev 1.0 chip */
|
||||
#define CONFIG_MPC8560 1 /* MPC8560 specific */
|
||||
#define CONFIG_STXGP3 1 /* Silicon Tx GPPP board specific*/
|
||||
|
||||
#undef CONFIG_PCI /* pci ethernet support */
|
||||
#define CONFIG_TSEC_ENET /* tsec ethernet support*/
|
||||
#undef CONFIG_ETHER_ON_FCC /* cpm FCC ethernet support */
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
#define CONFIG_SPD_EEPROM /* Use SPD EEPROM for DDR setup */
|
||||
#undef CONFIG_DDR_ECC /* only for ECC DDR module */
|
||||
|
||||
#if defined(CONFIG_MPC85xx_REV1)
|
||||
#define CONFIG_DDR_DLL /* possible DLL fix needed */
|
||||
#endif
|
||||
|
||||
/* Using Localbus SDRAM to emulate flash before we can program the flash,
|
||||
* normally you need a flash-boot image(u-boot.bin), if so undef this.
|
||||
*/
|
||||
#undef CONFIG_RAM_AS_FLASH
|
||||
|
||||
#define CONFIG_SYS_CLK_FREQ 33333333 /* most pci cards are 33Mhz */
|
||||
|
||||
/* Blinkin' LEDs for Robert :-)
|
||||
*/
|
||||
#define CONFIG_SHOW_ACTIVITY 1
|
||||
|
||||
#if !defined(CONFIG_SPD_EEPROM) /* manually set up DDR parameters */
|
||||
#define CONFIG_DDR_SETTING
|
||||
#endif
|
||||
|
||||
/* below can be toggled for performance analysis. otherwise use default */
|
||||
#define CONFIG_L2_CACHE /* toggle L2 cache */
|
||||
#undef CONFIG_BTB /* toggle branch predition */
|
||||
#undef CONFIG_ADDR_STREAMING /* toggle addr streaming */
|
||||
|
||||
#define CONFIG_BOARD_PRE_INIT 1 /* Call board_pre_init */
|
||||
|
||||
#undef CFG_DRAM_TEST /* memory test, takes time */
|
||||
#define CFG_MEMTEST_START 0x00200000 /* memtest region */
|
||||
#define CFG_MEMTEST_END 0x00400000
|
||||
|
||||
#if (defined(CONFIG_PCI) && defined(CONFIG_TSEC_ENET) || \
|
||||
defined(CONFIG_PCI) && defined(CONFIG_ETHER_ON_FCC) || \
|
||||
defined(CONFIG_TSEC_ENET) && defined(CONFIG_ETHER_ON_FCC))
|
||||
#error "You can only use ONE of PCI Ethernet Card or TSEC Ethernet or CPM FCC."
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Base addresses -- Note these are effective addresses where the
|
||||
* actual resources get mapped (not physical addresses)
|
||||
*/
|
||||
#define CFG_DDR_SDRAM_BASE 0x00000000 /* DDR is system memory */
|
||||
#define CFG_SDRAM_BASE CFG_DDR_SDRAM_BASE
|
||||
|
||||
/* GPPP supports up to 2G of DRAM. Allocate up to 1G until we get
|
||||
* a chance to try it out. Actual size is always read from sdram eeprom.
|
||||
*/
|
||||
#define CFG_SDRAM_SIZE 1024 /* DDR is 1GB */
|
||||
|
||||
/* Localbus SDRAM is an option, not all boards have it.
|
||||
*/
|
||||
#if defined(CONFIG_RAM_AS_FLASH)
|
||||
#define CFG_LBC_SDRAM_BASE 0xfc000000 /* Localbus SDRAM */
|
||||
#else
|
||||
#define CFG_LBC_SDRAM_BASE 0xf8000000 /* Localbus SDRAM */
|
||||
#endif
|
||||
#define CFG_LBC_SDRAM_SIZE 64 /* LBC SDRAM is 64MB */
|
||||
|
||||
#if defined(CONFIG_RAM_AS_FLASH)
|
||||
#define CFG_FLASH_BASE 0xf8000000 /* start of FLASH 16M */
|
||||
#define CFG_BR0_PRELIM 0xf8001801 /* port size 32bit */
|
||||
#else /* Boot from real Flash */
|
||||
#define CFG_FLASH_BASE 0xff000000 /* start of FLASH 16M */
|
||||
#define CFG_BR0_PRELIM 0xff001801 /* port size 32bit */
|
||||
#endif
|
||||
|
||||
#define CFG_OR0_PRELIM 0xff000ff7 /* 16 MB Flash */
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* number of banks */
|
||||
#define CFG_MAX_FLASH_SECT 136 /* sectors per device */
|
||||
#undef CFG_FLASH_CHECKSUM
|
||||
#define CFG_FLASH_ERASE_TOUT 60000 /* Timeout for Flash Erase (in ms) */
|
||||
#define CFG_FLASH_WRITE_TOUT 500 /* Timeout for Flash Write (in ms) */
|
||||
|
||||
/* The configuration latch is Chip Select 1.
|
||||
* It's an 8-bit latch in the upper 8 bits of the word.
|
||||
*/
|
||||
#define CFG_BR1_PRELIM 0xfc001801 /* 32-bit port */
|
||||
#define CFG_OR1_PRELIM 0xffff0ff7 /* 64K is enough */
|
||||
#define CFG_LBC_LCLDEVS_BASE 0xfc000000 /* Base of localbus devices */
|
||||
|
||||
#define CFG_MONITOR_BASE TEXT_BASE /* start of monitor */
|
||||
|
||||
#if (CFG_MONITOR_BASE < CFG_FLASH_BASE)
|
||||
#define CFG_RAMBOOT
|
||||
#else
|
||||
#undef CFG_RAMBOOT
|
||||
#endif
|
||||
|
||||
#ifdef CFG_RAMBOOT
|
||||
#define CFG_CCSRBAR_DEFAULT 0x40000000 /* CCSRBAR by BDI cfg */
|
||||
#else
|
||||
#define CFG_CCSRBAR_DEFAULT 0xff700000 /* CCSRBAR Default */
|
||||
#endif
|
||||
#define CFG_CCSRBAR 0xfdf00000 /* relocated CCSRBAR */
|
||||
#define CFG_IMMR CFG_CCSRBAR /* PQII uses CFG_IMMR */
|
||||
|
||||
|
||||
#define SPD_EEPROM_ADDRESS 0x54 /* DDR DIMM */
|
||||
|
||||
#if defined(CONFIG_DDR_SETTING)
|
||||
#define CFG_DDR_CS0_BNDS 0x00000007 /* 0-128MB */
|
||||
#define CFG_DDR_CS0_CONFIG 0x80000002
|
||||
#define CFG_DDR_TIMING_1 0x37344321
|
||||
#define CFG_DDR_TIMING_2 0x00000800 /* P9-45,may need tuning*/
|
||||
#define CFG_DDR_CONTROL 0xc2000000 /* unbuffered,no DYN_PWR*/
|
||||
#define CFG_DDR_MODE 0x00000062 /* DLL,normal,seq,4/2.5 */
|
||||
#define CFG_DDR_INTERVAL 0x05200100 /* autocharge,no open page*/
|
||||
#endif
|
||||
|
||||
#undef CONFIG_CLOCKS_IN_MHZ
|
||||
|
||||
/* local bus definitions */
|
||||
#define CFG_BR2_PRELIM 0xf8001861 /* 64MB localbus SDRAM */
|
||||
#define CFG_OR2_PRELIM 0xfc006901
|
||||
#define CFG_LBC_LCRR 0x00030004 /* local bus freq */
|
||||
#define CFG_LBC_LBCR 0x00000000
|
||||
#define CFG_LBC_LSRT 0x20000000
|
||||
#define CFG_LBC_MRTPR 0x20000000
|
||||
#define CFG_LBC_LSDMR_1 0x2861b723
|
||||
#define CFG_LBC_LSDMR_2 0x0861b723
|
||||
#define CFG_LBC_LSDMR_3 0x0861b723
|
||||
#define CFG_LBC_LSDMR_4 0x1861b723
|
||||
#define CFG_LBC_LSDMR_5 0x4061b723
|
||||
|
||||
#define CONFIG_L1_INIT_RAM
|
||||
#define CFG_INIT_RAM_LOCK 1
|
||||
#define CFG_INIT_RAM_ADDR 0x60000000 /* Initial RAM address */
|
||||
#define CFG_INIT_RAM_END 0x4000 /* End of used area in RAM */
|
||||
|
||||
#define CFG_GBL_DATA_SIZE 128 /* num bytes initial data */
|
||||
#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
|
||||
#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET
|
||||
|
||||
#define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256 kB for Mon */
|
||||
#define CFG_MALLOC_LEN (128 * 1024) /* Reserved for malloc */
|
||||
|
||||
/* Serial Port */
|
||||
#define CONFIG_CONS_ON_SCC /* define if console on SCC */
|
||||
#undef CONFIG_CONS_NONE /* define if console on something else */
|
||||
#define CONFIG_CONS_INDEX 2 /* which serial channel for console */
|
||||
|
||||
#define CONFIG_BAUDRATE 38400
|
||||
|
||||
#define CFG_BAUDRATE_TABLE \
|
||||
{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}
|
||||
|
||||
/* Use the HUSH parser */
|
||||
#define CFG_HUSH_PARSER
|
||||
#ifdef CFG_HUSH_PARSER
|
||||
#define CFG_PROMPT_HUSH_PS2 "> "
|
||||
#endif
|
||||
|
||||
/* I2C */
|
||||
#define CONFIG_HARD_I2C /* I2C with hardware support*/
|
||||
#undef CONFIG_SOFT_I2C /* I2C bit-banged */
|
||||
#define CFG_I2C_SPEED 400000 /* I2C speed and slave address */
|
||||
#define CFG_I2C_SLAVE 0x7F
|
||||
#if 0
|
||||
#define CFG_I2C_NOPROBES {0x00} /* Don't probe these addrs */
|
||||
#else
|
||||
/* I did the 'if 0' so we could keep the syntax above if ever needed. */
|
||||
#undef CFG_I2C_NOPROBES
|
||||
#endif
|
||||
|
||||
#define CFG_PCI_MEM_BASE 0xe0000000
|
||||
#define CFG_PCI_MEM_PHYS 0xe0000000
|
||||
#define CFG_PCI_MEM_SIZE 0x10000000
|
||||
|
||||
#if defined(CONFIG_PCI) /* PCI Ethernet card */
|
||||
#define CONFIG_NET_MULTI
|
||||
#define CONFIG_EEPRO100
|
||||
#undef CONFIG_TULIP
|
||||
#define CONFIG_PCI_PNP /* do pci plug-and-play */
|
||||
#if !defined(CONFIG_PCI_PNP)
|
||||
#define PCI_ENET0_IOADDR 0xe0000000
|
||||
#define PCI_ENET0_MEMADDR 0xe0000000
|
||||
#define PCI_IDSEL_NUMBER 0x0c /* slot0->3(IDSEL)=12->15 */
|
||||
#endif
|
||||
#define CONFIG_PCI_SCAN_SHOW 1 /* show pci devices on startup */
|
||||
#define CFG_PCI_SUBSYS_VENDORID 0x1057 /* Motorola */
|
||||
#if defined(CONFIG_MPC85xx_REV1) /* Errata PCI 7 */
|
||||
#define CFG_PCI_SUBSYS_DEVICEID 0x0003
|
||||
#else
|
||||
#define CFG_PCI_SUBSYS_DEVICEID 0x0009
|
||||
#endif
|
||||
#elif defined(CONFIG_TSEC_ENET) /* TSEC Ethernet port */
|
||||
#define CONFIG_NET_MULTI 1
|
||||
#define CONFIG_PHY_M88E1011 1 /* GigaBit Ether PHY */
|
||||
#define CONFIG_MII 1 /* MII PHY management */
|
||||
#define CONFIG_PHY_ADDR 8 /* PHY address */
|
||||
#elif defined(CONFIG_ETHER_ON_FCC) /* CPM FCC Ethernet */
|
||||
#define CONFIG_ETHER_ON_FCC2 /* define if ether on FCC */
|
||||
#undef CONFIG_ETHER_NONE /* define if ether on something else */
|
||||
#define CONFIG_ETHER_INDEX 2 /* which channel for ether */
|
||||
#if (CONFIG_ETHER_INDEX == 2)
|
||||
/*
|
||||
* - Rx-CLK is CLK13
|
||||
* - Tx-CLK is CLK14
|
||||
* - Select bus for bd/buffers
|
||||
* - Full duplex
|
||||
*/
|
||||
#define CFG_CMXFCR_MASK (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
|
||||
#define CFG_CMXFCR_VALUE (CMXFCR_RF2CS_CLK13 | CMXFCR_TF2CS_CLK14)
|
||||
#define CFG_CPMFCR_RAMTYPE 0
|
||||
#if 0
|
||||
#define CFG_FCC_PSMR (FCC_PSMR_FDE)
|
||||
#else
|
||||
#define CFG_FCC_PSMR 0
|
||||
#endif
|
||||
#define FETH2_RST 0x01
|
||||
#elif (CONFIG_ETHER_INDEX == 3)
|
||||
/* need more definitions here for FE3 */
|
||||
#define FETH3_RST 0x80
|
||||
#endif /* CONFIG_ETHER_INDEX */
|
||||
#define CONFIG_MII /* MII PHY management */
|
||||
#undef CONFIG_BITBANGMII /* bit-bang MII PHY management */
|
||||
/*
|
||||
* GPIO pins used for bit-banged MII communications
|
||||
*/
|
||||
#define MDIO_PORT 2 /* Port C */
|
||||
#define MDIO_ACTIVE (iop->pdir |= 0x00400000)
|
||||
#define MDIO_TRISTATE (iop->pdir &= ~0x00400000)
|
||||
#define MDIO_READ ((iop->pdat & 0x00400000) != 0)
|
||||
|
||||
#define MDIO(bit) if(bit) iop->pdat |= 0x00400000; \
|
||||
else iop->pdat &= ~0x00400000
|
||||
|
||||
#define MDC(bit) if(bit) iop->pdat |= 0x00200000; \
|
||||
else iop->pdat &= ~0x00200000
|
||||
|
||||
#define MIIDELAY udelay(1)
|
||||
#endif
|
||||
|
||||
/* Environment */
|
||||
/* We use the top boot sector flash, so we have some 16K sectors for env
|
||||
* But....functions don't seem smart enough yet.
|
||||
*/
|
||||
#ifndef CFG_RAMBOOT
|
||||
#if defined(CONFIG_RAM_AS_FLASH)
|
||||
#define CFG_ENV_IS_NOWHERE
|
||||
#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x100000)
|
||||
#define CFG_ENV_SIZE 0x2000
|
||||
#else
|
||||
#define CFG_ENV_IS_IN_FLASH 1
|
||||
#define CFG_ENV_ADDR (CFG_MONITOR_BASE + 0x60000)
|
||||
#define CFG_ENV_SECT_SIZE 0x4000 /* 16K (one top sector) for env */
|
||||
#endif
|
||||
#define CFG_ENV_SIZE 0x2000
|
||||
#else
|
||||
#define CFG_NO_FLASH 1 /* Flash is not usable now */
|
||||
#define CFG_ENV_IS_NOWHERE 1 /* Store ENV in memory only */
|
||||
#define CFG_ENV_ADDR (CFG_MONITOR_BASE - 0x1000)
|
||||
#define CFG_ENV_SIZE 0x2000
|
||||
#endif
|
||||
|
||||
#define CONFIG_BOOTARGS "root=/dev/nfs rw ip=any console=ttyS1,38400"
|
||||
#define CONFIG_BOOTCOMMAND "bootm 0xff800000 0xff900000"
|
||||
#define CONFIG_BOOTDELAY 3 /* -1 disable autoboot */
|
||||
|
||||
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
|
||||
#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */
|
||||
|
||||
#if defined(CFG_RAMBOOT) || defined(CONFIG_RAM_AS_FLASH)
|
||||
#if defined(CONFIG_PCI)
|
||||
#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_PCI | \
|
||||
CFG_CMD_PING | CFG_CMD_I2C) & \
|
||||
~(CFG_CMD_ENV | \
|
||||
CFG_CMD_LOADS ))
|
||||
#elif defined(CONFIG_TSEC_ENET)
|
||||
#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_PING | \
|
||||
CFG_CMD_MII | CFG_CMD_I2C ) & \
|
||||
~(CFG_CMD_ENV))
|
||||
#elif defined(CONFIG_ETHER_ON_FCC)
|
||||
#define CONFIG_COMMANDS ((CONFIG_CMD_DFL | CFG_CMD_MII | \
|
||||
CFG_CMD_PING | CFG_CMD_I2C) & \
|
||||
~(CFG_CMD_ENV))
|
||||
#endif
|
||||
#else
|
||||
#if defined(CONFIG_PCI)
|
||||
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_PCI | \
|
||||
CFG_CMD_PING | CFG_CMD_I2C)
|
||||
#elif defined(CONFIG_TSEC_ENET)
|
||||
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_PING | \
|
||||
CFG_CMD_MII | CFG_CMD_I2C)
|
||||
#elif defined(CONFIG_ETHER_ON_FCC)
|
||||
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | CFG_CMD_MII | \
|
||||
CFG_CMD_PING | CFG_CMD_I2C)
|
||||
#endif
|
||||
#endif
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
#undef CONFIG_WATCHDOG /* watchdog disabled */
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "GPPP=> " /* Monitor Command Prompt */
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
|
||||
#else
|
||||
#define CFG_CBSIZE 256 /* Console I/O Buffer Size */
|
||||
#endif
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
|
||||
#define CFG_LOAD_ADDR 0x1000000 /* default load address */
|
||||
#define CFG_HZ 1000 /* decrementer freq: 1 ms ticks */
|
||||
|
||||
/*
|
||||
* For booting Linux, the board info and command line data
|
||||
* have to be in the first 8 MB of memory, since this is
|
||||
* the maximum mapped by the Linux kernel during initialization.
|
||||
*/
|
||||
#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux */
|
||||
|
||||
/* Cache Configuration */
|
||||
#define CFG_DCACHE_SIZE 32768
|
||||
#define CFG_CACHELINE_SIZE 32
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CFG_CACHELINE_SHIFT 5 /* log base 2 of the above value */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Internal Definitions
|
||||
*
|
||||
* Boot Flags
|
||||
*/
|
||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
|
||||
#define CONFIG_KGDB_BAUDRATE 230400 /* speed to run kgdb serial port */
|
||||
#define CONFIG_KGDB_SER_INDEX 2 /* which serial port to use */
|
||||
#endif
|
||||
|
||||
/*Note: change below for your network setting!!! */
|
||||
#if defined(CONFIG_TSEC_ENET) || defined(CONFIG_ETHER_ON_FCC)
|
||||
#define CONFIG_ETHADDR 00:01:af:07:9b:8a
|
||||
#define CONFIG_ETH1ADDR 00:01:af:07:9b:8b
|
||||
#define CONFIG_ETH2ADDR 00:01:af:07:9b:8c
|
||||
#endif
|
||||
|
||||
#define CONFIG_SERVERIP 192.168.85.1
|
||||
#define CONFIG_IPADDR 192.168.85.60
|
||||
#define CONFIG_GATEWAYIP 192.168.85.1
|
||||
#define CONFIG_NETMASK 255.255.255.0
|
||||
#define CONFIG_HOSTNAME STX_GP3
|
||||
#define CONFIG_ROOTPATH /gppproot
|
||||
#define CONFIG_BOOTFILE uImage
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
90
include/configs/suzaku.h
Normal file
90
include/configs/suzaku.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
/*
|
||||
* If we are developing, we might want to start armboot from ram
|
||||
* so we MUST NOT initialize critical regs like mem-timing ...
|
||||
*/
|
||||
#define CONFIG_INIT_CRITICAL /* undef for developing */
|
||||
|
||||
/*
|
||||
* High Level Configuration Options
|
||||
* (easy to change)
|
||||
*/
|
||||
|
||||
#define CONFIG_MICROBLZE 1 /* This is an MicroBlaze CPU */
|
||||
#define CONFIG_SUZAKU 1 /* on an SUZAKU Board */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* Start addresses for the final memory configuration
|
||||
* (Set up by the startup code)
|
||||
* Please note that CFG_SDRAM_BASE _must_ start at 0
|
||||
*/
|
||||
#define CFG_SDRAM_BASE 0x80000000
|
||||
#define CFG_SDRAM_SIZE 0x01000000
|
||||
#define CFG_FLASH_BASE 0xfff00000
|
||||
#define CFG_RESET_ADDRESS 0xfff00100
|
||||
#define CFG_MONITOR_LEN (256 << 10) /* Reserve 256 kB for Monitor */
|
||||
#define CFG_MONITOR_BASE (CFG_SDRAM_BASE + CFG_SDRAM_SIZE - (1024 * 1024))
|
||||
#define CFG_MALLOC_LEN (256 << 10) /* Reserve 256 kB for malloc */
|
||||
|
||||
#define CONFIG_BAUDRATE 115200
|
||||
#define CFG_BAUDRATE_TABLE { 115200 }
|
||||
|
||||
#define CONFIG_COMMANDS (CONFIG__CMD_DFL)
|
||||
|
||||
/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
|
||||
#include <cmd_confdefs.h>
|
||||
|
||||
#define CFG_UART1_BASE (0xFFFF2000)
|
||||
#define CONFIG_SERIAL_BASE CFG_UART1_BASE
|
||||
|
||||
/*
|
||||
* Miscellaneous configurable options
|
||||
*/
|
||||
#define CFG_LONGHELP /* undef to save memory */
|
||||
#define CFG_PROMPT "SUZAKU> " /* Monitor Command Prompt */
|
||||
#define CFG_CBSIZE 256
|
||||
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
|
||||
#define CFG_MAXARGS 16 /* max number of command args */
|
||||
|
||||
#define CFG_LOAD_ADDR CFG_SDRAM_BASE /* default load address */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* FLASH organization
|
||||
*/
|
||||
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
|
||||
#define CFG_MAX_FLASH_SECT 1 /* max number of sectors on one chip */
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
* NVRAM organization
|
||||
*/
|
||||
#define CFG_ENV_IS_NOWHERE 1
|
||||
#define CFG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
|
||||
#define CFG_ENV_SECT_SIZE 0x10000 /* see README - env sector total size */
|
||||
|
||||
#endif /* __CONFIG_H */
|
||||
@@ -27,6 +27,8 @@
|
||||
#ifndef _FAT_H_
|
||||
#define _FAT_H_
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define CONFIG_SUPPORT_VFAT
|
||||
|
||||
#define SECTOR_SIZE FS_BLOCK_SIZE
|
||||
@@ -210,11 +212,4 @@ long file_fat_read(const char *filename, void *buffer, unsigned long maxsize);
|
||||
const char *file_getfsname(int idx);
|
||||
int fat_register_device(block_dev_desc_t *dev_desc, int part_no);
|
||||
|
||||
#ifdef CONFIG_PXA250
|
||||
#undef FAT2CPU16
|
||||
#define FAT2CPU16(x) x
|
||||
#undef FAT2CPU32
|
||||
#define FAT2CPU32(x) x
|
||||
#endif
|
||||
|
||||
#endif /* _FAT_H_ */
|
||||
|
||||
@@ -64,8 +64,9 @@
|
||||
#define IH_CPU_SH 9 /* SuperH */
|
||||
#define IH_CPU_SPARC 10 /* Sparc */
|
||||
#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */
|
||||
#define IH_CPU_M68K 12 /* M68K */
|
||||
#define IH_CPU_NIOS 13 /* Nios-32 */
|
||||
#define IH_CPU_M68K 12 /* M68K */
|
||||
#define IH_CPU_NIOS 13 /* Nios-32 */
|
||||
#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */
|
||||
|
||||
/*
|
||||
* Image Types
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
@@ -29,15 +29,15 @@
|
||||
#include <usb_defs.h>
|
||||
|
||||
/* Everything is aribtrary */
|
||||
#define USB_ALTSETTINGALLOC 4
|
||||
#define USB_MAXALTSETTING 128 /* Hard limit */
|
||||
#define USB_ALTSETTINGALLOC 4
|
||||
#define USB_MAXALTSETTING 128 /* Hard limit */
|
||||
|
||||
#define USB_MAX_DEVICE 32
|
||||
#define USB_MAXCONFIG 8
|
||||
#define USB_MAXINTERFACES 8
|
||||
#define USB_MAXENDPOINTS 16
|
||||
#define USB_MAXCHILDREN 8 /* This is arbitrary */
|
||||
#define USB_MAX_HUB 16
|
||||
#define USB_MAX_DEVICE 32
|
||||
#define USB_MAXCONFIG 8
|
||||
#define USB_MAXINTERFACES 8
|
||||
#define USB_MAXENDPOINTS 16
|
||||
#define USB_MAXCHILDREN 8 /* This is arbitrary */
|
||||
#define USB_MAX_HUB 16
|
||||
|
||||
#define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
|
||||
|
||||
@@ -125,19 +125,19 @@ struct usb_config_descriptor {
|
||||
unsigned char bmAttributes;
|
||||
unsigned char MaxPower;
|
||||
|
||||
unsigned char no_of_if; /* number of interfaces */
|
||||
unsigned char no_of_if; /* number of interfaces */
|
||||
struct usb_interface_descriptor if_desc[USB_MAXINTERFACES];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct usb_device {
|
||||
int devnum; /* Device number on USB bus */
|
||||
int slow; /* Slow device? */
|
||||
char mf[32]; /* manufacturer */
|
||||
char prod[32]; /* product */
|
||||
char serial[32]; /* serial number */
|
||||
int devnum; /* Device number on USB bus */
|
||||
int slow; /* Slow device? */
|
||||
char mf[32]; /* manufacturer */
|
||||
char prod[32]; /* product */
|
||||
char serial[32]; /* serial number */
|
||||
|
||||
int maxpacketsize; /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
|
||||
int maxpacketsize; /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
|
||||
unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */
|
||||
unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */
|
||||
/* [0] = IN, [1] = OUT */
|
||||
@@ -152,7 +152,7 @@ struct usb_device {
|
||||
int string_langid; /* language ID for strings */
|
||||
int (*irq_handle)(struct usb_device *dev);
|
||||
unsigned long irq_status;
|
||||
int irq_act_len; /* transfered bytes */
|
||||
int irq_act_len; /* transfered bytes */
|
||||
void *privptr;
|
||||
/*
|
||||
* Child devices - if this is a hub device
|
||||
@@ -169,7 +169,7 @@ struct usb_device {
|
||||
* this is how the lowlevel part communicate with the outer world
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI)
|
||||
#if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || defined (CONFIG_USB_SL811HS)
|
||||
int usb_lowlevel_init(void);
|
||||
int usb_lowlevel_stop(void);
|
||||
int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,int transfer_len);
|
||||
@@ -180,7 +180,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
|
||||
|
||||
/* Defines */
|
||||
#define USB_UHCI_VEND_ID 0x8086
|
||||
#define USB_UHCI_DEV_ID 0x7112
|
||||
#define USB_UHCI_DEV_ID 0x7112
|
||||
|
||||
#else
|
||||
#error USB Lowlevel not defined
|
||||
@@ -242,8 +242,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
|
||||
({ unsigned long x_ = (unsigned long)x; \
|
||||
(unsigned long)( \
|
||||
((x_ & 0x000000FFUL) << 24) | \
|
||||
((x_ & 0x0000FF00UL) << 8) | \
|
||||
((x_ & 0x00FF0000UL) >> 8) | \
|
||||
((x_ & 0x0000FF00UL) << 8) | \
|
||||
((x_ & 0x00FF0000UL) >> 8) | \
|
||||
((x_ & 0xFF000000UL) >> 24) ); \
|
||||
})
|
||||
#endif /* LITTLEENDIAN */
|
||||
@@ -298,7 +298,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
|
||||
|
||||
/* The D0/D1 toggle bits */
|
||||
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
|
||||
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
|
||||
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
|
||||
#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
|
||||
|
||||
/* Endpoint halt control/status */
|
||||
|
||||
@@ -340,7 +340,7 @@ static void setup_initrd_tag (bd_t *bd, ulong initrd_start, ulong initrd_end)
|
||||
/* an ATAG_INITRD node tells the kernel where the compressed
|
||||
* ramdisk can be found. ATAG_RDIMG is a better name, actually.
|
||||
*/
|
||||
params->hdr.tag = ATAG_INITRD;
|
||||
params->hdr.tag = ATAG_INITRD2;
|
||||
params->hdr.size = tag_size (tag_initrd);
|
||||
|
||||
params->u.initrd.start = initrd_start;
|
||||
|
||||
44
lib_microblaze/Makefile
Normal file
44
lib_microblaze/Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# (C) Copyright 2003-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$(ARCH).a
|
||||
|
||||
AOBJS =
|
||||
|
||||
COBJS = board.o microblaze_linux.o time.o
|
||||
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
$(LIB): .depend $(OBJS)
|
||||
$(AR) crv $@ $(OBJS)
|
||||
|
||||
#########################################################################
|
||||
|
||||
.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
|
||||
$(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@
|
||||
|
||||
sinclude .depend
|
||||
|
||||
#########################################################################
|
||||
95
lib_microblaze/board.c
Normal file
95
lib_microblaze/board.c
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <malloc.h>
|
||||
#include <version.h>
|
||||
#include <watchdog.h>
|
||||
|
||||
const char version_string[] =
|
||||
U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
|
||||
|
||||
/*
|
||||
* Begin and End of memory area for malloc(), and current "brk"
|
||||
*/
|
||||
static ulong mem_malloc_start;
|
||||
static ulong mem_malloc_end;
|
||||
static ulong mem_malloc_brk;
|
||||
|
||||
|
||||
void *sbrk (ptrdiff_t increment)
|
||||
{
|
||||
ulong old = mem_malloc_brk;
|
||||
ulong new = old + increment;
|
||||
|
||||
if ((new < mem_malloc_start) || (new > mem_malloc_end)) {
|
||||
return (NULL);
|
||||
}
|
||||
mem_malloc_brk = new;
|
||||
return ((void *) old);
|
||||
}
|
||||
|
||||
/*
|
||||
* All attempts to come up with a "common" initialization sequence
|
||||
* that works for all boards and architectures failed: some of the
|
||||
* requirements are just _too_ different. To get rid of the resulting
|
||||
* mess of board dependend #ifdef'ed code we now make the whole
|
||||
* initialization sequence configurable to the user.
|
||||
*
|
||||
* The requirements for any new initalization function is simple: it
|
||||
* receives a pointer to the "global data" structure as it's only
|
||||
* argument, and returns an integer return code, where 0 means
|
||||
* "continue" and != 0 means "fatal error, hang the system".
|
||||
*/
|
||||
typedef int (init_fnc_t) (void);
|
||||
|
||||
init_fnc_t *init_sequence[] = {
|
||||
serial_init, /* serial communications setup */
|
||||
NULL,
|
||||
};
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
init_fnc_t **init_fnc_ptr;
|
||||
|
||||
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
|
||||
WATCHDOG_RESET ();
|
||||
if ((*init_fnc_ptr) () != 0) {
|
||||
hang ();
|
||||
}
|
||||
}
|
||||
|
||||
/* main_loop */
|
||||
for (;;) {
|
||||
WATCHDOG_RESET ();
|
||||
main_loop ();
|
||||
}
|
||||
}
|
||||
|
||||
void hang (void)
|
||||
{
|
||||
puts ("### ERROR ### Please RESET the board ###\n");
|
||||
for (;;);
|
||||
}
|
||||
31
lib_microblaze/microblaze_linux.c
Normal file
31
lib_microblaze/microblaze_linux.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
|
||||
void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
|
||||
ulong addr, ulong *len_ptr, int verify)
|
||||
{
|
||||
}
|
||||
27
lib_microblaze/time.c
Normal file
27
lib_microblaze/time.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* (C) Copyright 2004 Atmark Techno, Inc.
|
||||
*
|
||||
* Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
void udelay(unsigned long usec)
|
||||
{
|
||||
}
|
||||
@@ -510,27 +510,6 @@ void board_init_f (ulong bootflag)
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
|
||||
bd->bi_pci_busfreq = get_PCI_freq ();
|
||||
bd->bi_opbfreq = get_OPB_freq ();
|
||||
|
||||
#if defined(CONFIG_I2CFAST)
|
||||
/*
|
||||
* set bi_iic_fast for linux taking environment variable
|
||||
* "i2cfast" into account
|
||||
*/
|
||||
{
|
||||
char *s = getenv ("i2cfast");
|
||||
if (s && ((*s == 'y') || (*s == 'Y'))) {
|
||||
bd->bi_iic_fast[0] = 1;
|
||||
bd->bi_iic_fast[1] = 1;
|
||||
} else {
|
||||
bd->bi_iic_fast[0] = 0;
|
||||
bd->bi_iic_fast[1] = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
bd->bi_iic_fast[0] = 0;
|
||||
bd->bi_iic_fast[1] = 0;
|
||||
#endif
|
||||
|
||||
#elif defined(CONFIG_XILINX_ML300)
|
||||
bd->bi_pci_busfreq = get_PCI_freq ();
|
||||
#endif
|
||||
@@ -743,6 +722,31 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
||||
* where had to use getenv_r(), which can be pretty slow when
|
||||
* the environment is in EEPROM.
|
||||
*/
|
||||
|
||||
#if defined(CFG_EXTBDINFO)
|
||||
#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
|
||||
#if defined(CONFIG_I2CFAST)
|
||||
/*
|
||||
* set bi_iic_fast for linux taking environment variable
|
||||
* "i2cfast" into account
|
||||
*/
|
||||
{
|
||||
char *s = getenv ("i2cfast");
|
||||
if (s && ((*s == 'y') || (*s == 'Y'))) {
|
||||
bd->bi_iic_fast[0] = 1;
|
||||
bd->bi_iic_fast[1] = 1;
|
||||
} else {
|
||||
bd->bi_iic_fast[0] = 0;
|
||||
bd->bi_iic_fast[1] = 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
bd->bi_iic_fast[0] = 0;
|
||||
bd->bi_iic_fast[1] = 0;
|
||||
#endif /* CONFIG_I2CFAST */
|
||||
#endif /* CONFIG_405GP, CONFIG_405EP */
|
||||
#endif /* CFG_EXTBDINFO */
|
||||
|
||||
s = getenv ("ethaddr");
|
||||
#if defined (CONFIG_MBX) || defined (CONFIG_RPXCLASSIC) || defined(CONFIG_IAD210)
|
||||
if (s == NULL)
|
||||
@@ -867,6 +871,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
|
||||
defined(CONFIG_MPC8560ADS) || \
|
||||
defined(CONFIG_PCU_E) || \
|
||||
defined(CONFIG_RPXSUPER) || \
|
||||
defined(CONFIG_STXGP3) || \
|
||||
defined(CONFIG_SPD823TS) )
|
||||
|
||||
WATCHDOG_RESET ();
|
||||
|
||||
35
microblaze_config.mk
Normal file
35
microblaze_config.mk
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# (C) Copyright 2004 Atmark Techno, Inc.
|
||||
#
|
||||
# Yasushi SHOJI <yashi@atmark-techno.com>
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
# MA 02111-1307 USA
|
||||
#
|
||||
|
||||
ifdef CONFIG_MICROBLAZE_HARD_MULT
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-mul
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MICROBLAZE_HARD_DIV
|
||||
PLATFORM_CPPFLAGS += -mno-xl-soft-div
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MICROBLAZE_HARD_BARREL
|
||||
PLATFORM_CPPFLAGS += -mxl-barrel-shift
|
||||
endif
|
||||
@@ -48,6 +48,7 @@ extern int plb2800_eth_initialize(bd_t*);
|
||||
extern int ppc_4xx_eth_initialize(bd_t *);
|
||||
extern int ppc_440x_eth_initialize(bd_t *);
|
||||
extern int rtl8139_initialize(bd_t*);
|
||||
extern int rtl8169_initialize(bd_t*);
|
||||
extern int scc_initialize(bd_t*);
|
||||
extern int skge_initialize(bd_t*);
|
||||
extern int tsec_initialize(bd_t*);
|
||||
@@ -178,6 +179,9 @@ int eth_initialize(bd_t *bis)
|
||||
#if defined(CONFIG_RTL8139)
|
||||
rtl8139_initialize(bis);
|
||||
#endif
|
||||
#if defined(CONFIG_RTL8169)
|
||||
rtl8169_initialize(bis);
|
||||
#endif
|
||||
|
||||
if (!eth_devices) {
|
||||
puts ("No ethernet found.\n");
|
||||
|
||||
Reference in New Issue
Block a user