提交 983fda83 编写于 作者: W wdenk

Patch by TsiChung Liew, 23 Sep 2004:

- add support for MPC8220 CPU
- Add support for Alaska and Yukon boards
上级 e3c9b9f9
......@@ -2,6 +2,10 @@
Changes since U-Boot 1.1.1:
======================================================================
* Patch by TsiChung Liew, 23 Sep 2004:
- add support for MPC8220 CPU
- Add support for Alaska and Yukon boards
* Fix configuration for ERIC board (needs more room)
* Adjust MIPS compiler options at run-time depending on tools version
......
......@@ -71,6 +71,14 @@ LIST_4xx=" \
WALNUT405 XPEDITE1K \
"
#########################################################################
## MPC8220 Systems
#########################################################################
LIST_8220=" \
Alaska8220 Yukon8220 \
"
#########################################################################
## MPC824x Systems
#########################################################################
......@@ -228,7 +236,7 @@ build_target() {
for arg in $@
do
case "$arg" in
ppc|5xx|5xxx|8xx|824x|8260|85xx|4xx|7xx|74xx| \
ppc|5xx|5xxx|8xx|8220|824x|8260|85xx|4xx|7xx|74xx| \
arm|SA|ARM7|ARM9|pxa|ixp| \
microblaze| \
mips| \
......
......@@ -825,6 +825,15 @@ WALNUT405_config: unconfig
XPEDITE1K_config: unconfig
@./mkconfig $(@:_config=) ppc ppc4xx xpedite1k
#########################################################################
## MPC8220 Systems
#########################################################################
Alaska8220_config: unconfig
@./mkconfig $(@:_config=) ppc mpc8220 alaska
Yukon8220_config: unconfig
@./mkconfig $(@:_config=) ppc mpc8220 yukon
#########################################################################
## MPC824x Systems
#########################################################################
......
......@@ -123,24 +123,25 @@ Directory Hierarchy:
- board Board dependent files
- common Misc architecture independent functions
- cpu CPU specific files
- 74xx_7xx Files specific to Motorola MPC74xx and 7xx CPUs
- 74xx_7xx Files specific to Freescale MPC74xx and 7xx CPUs
- arm720t Files specific to ARM 720 CPUs
- arm920t Files specific to ARM 920 CPUs
- imx Files specific to Motorola MC9328 i.MX CPUs
- imx Files specific to Freescale MC9328 i.MX CPUs
- s3c24x0 Files specific to Samsung S3C24X0 CPUs
- arm925t Files specific to ARM 925 CPUs
- arm926ejs Files specific to ARM 926 CPUs
- at91rm9200 Files specific to Atmel AT91RM9200 CPUs
- i386 Files specific to i386 CPUs
- ixp Files specific to Intel XScale IXP CPUs
- mcf52x2 Files specific to Motorola ColdFire MCF52x2 CPUs
- mcf52x2 Files specific to Freescale ColdFire MCF52x2 CPUs
- mips Files specific to MIPS CPUs
- mpc5xx Files specific to Motorola MPC5xx CPUs
- mpc5xxx Files specific to Motorola MPC5xxx CPUs
- mpc8xx Files specific to Motorola MPC8xx CPUs
- mpc824x Files specific to Motorola MPC824x CPUs
- mpc8260 Files specific to Motorola MPC8260 CPUs
- mpc85xx Files specific to Motorola MPC85xx CPUs
- mpc5xx Files specific to Freescale MPC5xx CPUs
- mpc5xxx Files specific to Freescale MPC5xxx CPUs
- mpc8xx Files specific to Freescale MPC8xx CPUs
- mpc8220 Files specific to Freescale MPC8220 CPUs
- mpc824x Files specific to Freescale MPC824x CPUs
- mpc8260 Files specific to Freescale MPC8260 CPUs
- mpc85xx Files specific to Freescale MPC85xx CPUs
- nios Files specific to Altera NIOS CPUs
- nios2 Files specific to Altera Nios-II CPUs
- ppc4xx Files specific to IBM PowerPC 4xx CPUs
......@@ -229,6 +230,7 @@ The following options need to be configured:
-------------------
CONFIG_MPC823, CONFIG_MPC850, CONFIG_MPC855, CONFIG_MPC860
or CONFIG_MPC5xx
or CONFIG_MPC8220
or CONFIG_MPC824X, CONFIG_MPC8260
or CONFIG_MPC85xx
or CONFIG_IOP480
......@@ -2140,6 +2142,7 @@ configurations; the following names are supported:
ADCIOP_config FPS860L_config omap730p2_config
ADS860_config GEN860T_config pcu_e_config
Alaska8220_config
AR405_config GENIETV_config PIP405_config
at91rm9200dk_config GTH_config QS823_config
CANBT_config hermes_config QS850_config
......@@ -2161,6 +2164,7 @@ configurations; the following names are supported:
FADS860T_config omap1610inn_config TQM855L_config
FPS850L_config omap5912osk_config TQM860L_config
WALNUT405_config
Yukon8220_config
ZPC1900_config
Note: for some board special configuration names may exist; check if
......
# (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$(BOARD).a
OBJS := $(BOARD).o flash.o extserial.o serial.o
$(LIB): $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS)
clean:
rm -f $(SOBJS) $(OBJS)
distclean: clean
rm -f $(LIB) core *.bak .depend
#########################################################################
.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
-include .depend
#########################################################################
/*
* (C) Copyright 2004, Freescale Inc.
* TsiChung Liew, Tsi-Chung.Liew@freescale.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 <mpc8220.h>
#include <asm/processor.h>
#include <asm/mmu.h>
void setupBat (ulong size)
{
ulong batu, batl;
int blocksize = 0;
/* Flash 0 */
#if defined (CFG_AMD_BOOT)
batu = CFG_FLASH0_BASE | (BL_512K << 2) | BPP_RW | BPP_RX;
#else
batu = CFG_FLASH0_BASE | (BL_16M << 2) | BPP_RW | BPP_RX;
#endif
batl = CFG_FLASH0_BASE | 0x22;
write_bat (IBAT0, batu, batl);
write_bat (DBAT0, batu, batl);
/* Flash 1 */
#if defined (CFG_AMD_BOOT)
batu = CFG_FLASH1_BASE | (BL_16M << 2) | BPP_RW | BPP_RX;
#else
batu = CFG_FLASH1_BASE | (BL_512K << 2) | BPP_RW | BPP_RX;
#endif
batl = CFG_FLASH1_BASE | 0x22;
write_bat (IBAT1, batu, batl);
write_bat (DBAT1, batu, batl);
/* CPLD */
batu = CFG_CPLD_BASE | (BL_512K << 2) | BPP_RW | BPP_RX;
batl = CFG_CPLD_BASE | 0x22;
write_bat (IBAT2, 0, 0);
write_bat (DBAT2, batu, batl);
/* FPGA */
batu = CFG_FPGA_BASE | (BL_512K << 2) | BPP_RW | BPP_RX;
batl = CFG_FPGA_BASE | 0x22;
write_bat (IBAT3, 0, 0);
write_bat (DBAT3, batu, batl);
/* MBAR - Data only */
batu = CFG_MBAR | BPP_RW | BPP_RX;
batl = CFG_MBAR | 0x22;
mtspr (IBAT4L, 0);
mtspr (IBAT4U, 0);
mtspr (DBAT4L, batl);
mtspr (DBAT4U, batu);
/* MBAR - SRAM */
batu = CFG_SRAM_BASE | BPP_RW | BPP_RX;
batl = CFG_SRAM_BASE | 0x42;
mtspr (IBAT5L, batl);
mtspr (IBAT5U, batu);
mtspr (DBAT5L, batl);
mtspr (DBAT5U, batu);
if (size <= 0x800000) /* 8MB */
blocksize = BL_8M << 2;
else if (size <= 0x1000000) /* 16MB */
blocksize = BL_16M << 2;
else if (size <= 0x2000000) /* 32MB */
blocksize = BL_32M << 2;
else if (size <= 0x4000000) /* 64MB */
blocksize = BL_64M << 2;
else if (size <= 0x8000000) /* 128MB */
blocksize = BL_128M << 2;
else if (size <= 0x10000000) /* 256MB */
blocksize = BL_256M << 2;
/* Memory */
batu = CFG_SDRAM_BASE | blocksize | BPP_RW | BPP_RX;
batl = CFG_SDRAM_BASE | 0x42;
mtspr (IBAT6L, batl);
mtspr (IBAT6U, batu);
mtspr (DBAT6L, batl);
mtspr (DBAT6U, batu);
/* memory size is less than 256MB */
if (size <= 0x10000000) {
/* Nothing */
batu = 0;
batl = 0;
} else {
size -= 0x10000000;
if (size <= 0x800000) /* 8MB */
blocksize = BL_8M << 2;
else if (size <= 0x1000000) /* 16MB */
blocksize = BL_16M << 2;
else if (size <= 0x2000000) /* 32MB */
blocksize = BL_32M << 2;
else if (size <= 0x4000000) /* 64MB */
blocksize = BL_64M << 2;
else if (size <= 0x8000000) /* 128MB */
blocksize = BL_128M << 2;
else if (size <= 0x10000000) /* 256MB */
blocksize = BL_256M << 2;
batu = (CFG_SDRAM_BASE +
0x10000000) | blocksize | BPP_RW | BPP_RX;
batl = (CFG_SDRAM_BASE + 0x10000000) | 0x42;
}
mtspr (IBAT7L, batl);
mtspr (IBAT7U, batu);
mtspr (DBAT7L, batl);
mtspr (DBAT7U, batu);
}
long int initdram (int board_type)
{
ulong size;
size = dramSetup ();
/* if iCache ad dCache is defined */
#if (CONFIG_COMMANDS & CFG_CMD_CACHE)
/* setupBat(size);*/
#endif
return size;
}
int checkboard (void)
{
puts ("Board: Alaska MPC8220 Evaluation Board\n");
return 0;
}
#
# (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
#
#
# alaska board
#
TEXT_BASE = 0xfff00000
# TEXT_BASE = 0x00100000
PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
/*
* (C) Copyright 2004, Freescale, Inc
* TsiChung Liew, Tsi-Chung.Liew@freescale.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
*
*/
/*
* Minimal serial functions needed to use one of the PSC ports
* as serial console interface.
*/
#include <common.h>
#include <mpc8220.h>
#if defined (CONFIG_EXTUART_CONSOLE)
# include <ns16550.h>
# define PADSERIAL_BAUD_115200 0x40
# define PADSERIAL_BAUD_57600 0x20
# define PADSERIAL_BAUD_9600 0
# define PADCARD_FREQ 18432000
const NS16550_t com_port = (NS16550_t) CFG_NS16550_COM1;
int ext_serial_init (void)
{
DECLARE_GLOBAL_DATA_PTR;
volatile u8 *dipswitch = (volatile u8 *) (CFG_CPLD_BASE + 0x1002);
int baud_divisor;
/* Find out the baud rate speed on debug card dip switches */
if (*dipswitch & PADSERIAL_BAUD_115200)
gd->baudrate = 115200;
else if (*dipswitch & PADSERIAL_BAUD_57600)
gd->baudrate = 57600;
else
gd->baudrate = 9600;
/* Debug card frequency */
baud_divisor = PADCARD_FREQ / (16 * gd->baudrate);
NS16550_init (com_port, baud_divisor);
return (0);
}
void ext_serial_putc (const char c)
{
if (c == '\n')
NS16550_putc (com_port, '\r');
NS16550_putc (com_port, c);
}
void ext_serial_puts (const char *s)
{
while (*s) {
serial_putc (*s++);
}
}
int ext_serial_getc (void)
{
return NS16550_getc (com_port);
}
int ext_serial_tstc (void)
{
return NS16550_tstc (com_port);
}
void ext_serial_setbrg (void)
{
DECLARE_GLOBAL_DATA_PTR;
volatile u8 *dipswitch = (volatile u8 *) (CFG_CPLD_BASE + 0x1002);
int baud_divisor;
/* Find out the baud rate speed on debug card dip switches */
if (*dipswitch & PADSERIAL_BAUD_115200)
gd->baudrate = 115200;
else if (*dipswitch & PADSERIAL_BAUD_57600)
gd->baudrate = 57600;
else
gd->baudrate = 9600;
/* Debug card frequency */
baud_divisor = PADCARD_FREQ / (16 * gd->baudrate);
NS16550_reinit (com_port, baud_divisor);
}
#endif /* CONFIG_EXTUART_CONSOLE */
此差异已折叠。
/*
* (C) Copyright 2004, Freescale, Inc
* TsiChung Liew, Tsi-Chung.Liew@freescale.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
*
*/
/*
* Minimal serial functions needed to use one of the PSC ports
* as serial console interface.
*/
#include <common.h>
#include <mpc8220.h>
int serial_init (void)
{
DECLARE_GLOBAL_DATA_PTR;
#if defined (CONFIG_EXTUART_CONSOLE)
volatile uchar *cpld = (volatile uchar *) CFG_CPLD_BASE;
#endif
/* Check CPLD Switch 2 whether is external or internal */
#if defined (CONFIG_EXTUART_CONSOLE)
if ((*cpld & 0x02) == 0x02) {
gd->bExtUart = 1;
return ext_serial_init ();
} else
#endif
{
#if defined(CONFIG_PSC_CONSOLE)
gd->bExtUart = 0;
return psc_serial_init ();
#endif
}
return (0);
}
void serial_putc (const char c)
{
DECLARE_GLOBAL_DATA_PTR;
if (gd->bExtUart) {
#if defined (CONFIG_EXTUART_CONSOLE)
ext_serial_putc (c);
#endif
} else {
#if defined(CONFIG_PSC_CONSOLE)
psc_serial_putc (c);
#endif
}
}
void serial_puts (const char *s)
{
DECLARE_GLOBAL_DATA_PTR;
if (gd->bExtUart) {
#if defined (CONFIG_EXTUART_CONSOLE)
ext_serial_puts (s);
#endif
} else {
#if defined(CONFIG_PSC_CONSOLE)
psc_serial_puts (s);
#endif
}
}
int serial_getc (void)
{
DECLARE_GLOBAL_DATA_PTR;
if (gd->bExtUart) {
#if defined (CONFIG_EXTUART_CONSOLE)
return ext_serial_getc ();
#endif
} else {
#if defined(CONFIG_PSC_CONSOLE)
return psc_serial_getc ();
#endif
}
}
int serial_tstc (void)
{
DECLARE_GLOBAL_DATA_PTR;
if (gd->bExtUart) {
#if defined (CONFIG_EXTUART_CONSOLE)
return ext_serial_tstc ();
#endif
} else {
#if defined(CONFIG_PSC_CONSOLE)
return psc_serial_tstc ();
#endif
}
}
void serial_setbrg (void)
{
DECLARE_GLOBAL_DATA_PTR;
if (gd->bExtUart) {
#if defined (CONFIG_EXTUART_CONSOLE)
ext_serial_setbrg ();
#endif
} else {
#if defined(CONFIG_PSC_CONSOLE)
psc_serial_setbrg ();
#endif
}
}
/*
* (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
*/
OUTPUT_ARCH(powerpc)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
/* Do we need any of these for elf?
__DYNAMIC = 0; */
SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
cpu/mpc8220/start.o (.text)
*(.text)
*(.fixup)
*(.got1)
. = ALIGN(16);
*(.rodata)
*(.rodata1)
*(.rodata.str1.4)
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
/* Read-write section, merged into data segment: */
. = (. + 0x0FFF) & 0xFFFFF000;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
_GOT2_TABLE_ = .;
*(.got2)
_FIXUP_TABLE_ = .;
*(.fixup)
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
}
_edata = .;
PROVIDE (edata = .);
__u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
. = ALIGN(4096);
__init_begin = .;
.text.init : { *(.text.init) }
.data.init : { *(.data.init) }
. = ALIGN(4096);
__init_end = .;
__bss_start = .;
.bss :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(COMMON)
}
_end = . ;
PROVIDE (end = .);
}
......@@ -63,9 +63,9 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
defined(CONFIG_405EP) || defined(CONFIG_XILINX_ML300)
print_str ("procfreq", strmhz(buf, bd->bi_procfreq));
print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_ML300)
print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
#endif
#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
#if defined(CONFIG_8260) || defined(CONFIG_MPC8560)
......@@ -79,6 +79,13 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
#endif
print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
#if defined(CONFIG_MPC8220)
print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
print_str ("pevfreq", strmhz(buf, bd->bi_pevfreq));
#endif
puts ("ethaddr =");
for (i=0; i<6; ++i) {
......
......@@ -573,6 +573,13 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
/* convert all clock information to MHz */
kbd->bi_intfreq /= 1000000L;
kbd->bi_busfreq /= 1000000L;
#if defined(CONFIG_MPC8220)
kbd->bi_inpfreq /= 1000000L;
kbd->bi_pcifreq /= 1000000L;
kbd->bi_pevfreq /= 1000000L;
kbd->bi_flbfreq /= 1000000L;
kbd->bi_vcofreq /= 1000000L;
#endif
#if defined(CONFIG_8260) || defined(CONFIG_MPC8560)
kbd->bi_cpmfreq /= 1000000L;
kbd->bi_brgfreq /= 1000000L;
......
#
# (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$(CPU).a
START = start.o
ASOBJS = io.o fec_dma_tasks.o
OBJS = i2c.o traps.o cpu.o cpu_init.o fec.o dramSetup.o interrupts.o \
loadtask.o uart.o speed.o
all: .depend $(START) $(ASOBJS) $(LIB)
$(LIB): $(OBJS)
$(AR) crv $@ $(ASOBJS) $(OBJS)
#########################################################################
.depend: Makefile $(START:.o=.S) $(OBJS:.o=.c)
$(CC) -M $(CFLAGS) $(START:.o=.S) $(ASOBJS:.o=.S) $(OBJS:.o=.c) > $@
sinclude .depend
#########################################################################
#
# (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
#
PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi
PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 -ffixed-r29 \
-mstring -mcpu=603e -mmultiple
/*
* (C) Copyright 2000-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
*/
/*
* CPU specific code for the MPC8220 CPUs
*/
#include <common.h>
#include <watchdog.h>
#include <command.h>
#include <mpc8220.h>
#include <asm/processor.h>
int checkcpu (void)
{
DECLARE_GLOBAL_DATA_PTR;
ulong clock = gd->cpu_clk;
char buf[32];
puts ("CPU: ");
printf (CPU_ID_STR);
printf (" (JTAG ID %08lx)", *(vu_long *) (CFG_MBAR + 0x50));
printf (" at %s MHz\n", strmhz (buf, clock));
return 0;
}
/* ------------------------------------------------------------------------- */
int do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
volatile gptmr8220_t *gptmr = (volatile gptmr8220_t *) MMAP_GPTMR;
ulong msr;
/* Interrupts and MMU off */
__asm__ __volatile__ ("mfmsr %0":"=r" (msr):);
msr &= ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR);
__asm__ __volatile__ ("mtmsr %0"::"r" (msr));
/* Charge the watchdog timer */
gptmr->Prescl = 10;
gptmr->Count = 1;
gptmr->Mode = GPT_TMS_SGPIO;
gptmr->Control = GPT_CTRL_WDEN | GPT_CTRL_CE;
return 1;
}
/* ------------------------------------------------------------------------- */
/*
* Get timebase clock frequency (like cpu_clk in Hz)
*
*/
unsigned long get_tbclk (void)
{
DECLARE_GLOBAL_DATA_PTR;
ulong tbclk;
tbclk = (gd->bus_clk + 3L) / 4L;
return (tbclk);
}
/* ------------------------------------------------------------------------- */
/*
* (C) Copyright 2000-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 <common.h>
#include <mpc8220.h>
/*
* Breath some life into the CPU...
*
* Set up the memory map,
* initialize a bunch of registers.
*/
void cpu_init_f (void)
{
DECLARE_GLOBAL_DATA_PTR;
volatile flexbus8220_t *flexbus = (volatile flexbus8220_t *) MMAP_FB;
volatile pcfg8220_t *portcfg = (volatile pcfg8220_t *) MMAP_PCFG;
volatile xlbarb8220_t *xlbarb = (volatile xlbarb8220_t *) MMAP_XLBARB;
/* Pointer is writable since we allocated a register for it */
gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
/* Clear initial global data */
memset ((void *) gd, 0, sizeof (gd_t));
/* Clear all port configuration */
portcfg->pcfg0 = 0;
portcfg->pcfg1 = 0;
portcfg->pcfg2 = 0;
portcfg->pcfg3 = 0;
/*
* Flexbus Controller: configure chip selects and enable them
*/
#if defined (CFG_CS0_BASE)
flexbus->csar0 = CFG_CS0_BASE;
flexbus->cscr0 = CFG_CS0_CTRL;
flexbus->csmr0 = ((CFG_CS0_MASK - 1) & 0xffff0000) | 1;
__asm__ volatile ("sync");
#endif
#if defined (CFG_CS1_BASE)
flexbus->csar1 = CFG_CS1_BASE;
flexbus->cscr1 = CFG_CS1_CTRL;
flexbus->csmr1 = ((CFG_CS1_MASK - 1) & 0xffff0000) | 1;
__asm__ volatile ("sync");
#endif
#if defined (CFG_CS2_BASE)
flexbus->csar2 = CFG_CS2_BASE;
flexbus->cscr2 = CFG_CS2_CTRL;
flexbus->csmr2 = ((CFG_CS2_MASK - 1) & 0xffff0000) | 1;
portcfg->pcfg3 |= CFG_CS2_PORT3_CONFIG;
__asm__ volatile ("sync");
#endif
#if defined (CFG_CS3_BASE)
flexbus->csar3 = CFG_CS3_BASE;
flexbus->cscr3 = CFG_CS3_CTRL;
flexbus->csmr3 = ((CFG_CS3_MASK - 1) & 0xffff0000) | 1;
portcfg->pcfg3 |= CFG_CS3_PORT3_CONFIG;
__asm__ volatile ("sync");
#endif
#if defined (CFG_CS4_BASE)
flexbus->csar4 = CFG_CS4_BASE;
flexbus->cscr4 = CFG_CS4_CTRL;
flexbus->csmr4 = ((CFG_CS4_MASK - 1) & 0xffff0000) | 1;
portcfg->pcfg3 |= CFG_CS4_PORT3_CONFIG;
__asm__ volatile ("sync");
#endif
#if defined (CFG_CS5_BASE)
flexbus->csar5 = CFG_CS5_BASE;
flexbus->cscr5 = CFG_CS5_CTRL;
flexbus->csmr5 = ((CFG_CS5_MASK - 1) & 0xffff0000) | 1;
portcfg->pcfg3 |= CFG_CS5_PORT3_CONFIG;
__asm__ volatile ("sync");
#endif
/* This section of the code cannot place in cpu_init_r(),
it will cause the system to hang */
/* enable timebase */
xlbarb->config = 0x00002000;
xlbarb->addrTenTimeOut = 0x1000;
xlbarb->dataTenTimeOut = 0x1000;
xlbarb->busActTimeOut = 0x2000;
/* Master Priority Enable */
xlbarb->mastPriEn = 0x1f;
xlbarb->mastPriority = 0;
}
/*
* initialize higher level parts of CPU like time base and timers
*/
int cpu_init_r (void)
{
/* this may belongs to disable interrupt section */
/* mask all interrupts */
*(vu_long *) 0xf0000700 = 0xfffffc00;
*(vu_long *) 0xf0000714 |= 0x0001ffff;
*(vu_long *) 0xf0000710 &= ~0x00000f00;
/* route critical ints to normal ints */
*(vu_long *) 0xf0000710 |= 0x00000001;
#if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_MPC8220_FEC)
/* load FEC microcode */
loadtask (0, 2);
#endif
return (0);
}
/*
* (C) Copyright 2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* This file is based on code
* (C) Copyright Motorola, Inc., 2000
*
* MPC8220 dma header file
*/
#ifndef __MPC8220_DMA_H
#define __MPC8220_DMA_H
#include <common.h>
#include <mpc8220.h>
/* Task number assignment */
#define FEC_RECV_TASK_NO 0
#define FEC_XMIT_TASK_NO 1
/*---------------------------------------------------------------------
* Stuff for Ethernet Tx/Rx tasks
*---------------------------------------------------------------------
*/
/* Layout of Ethernet controller Parameter SRAM area:
* ----------------------------------------------------------------
* 0x00: TBD_BASE, base address of TX BD ring
* 0x04: TBD_NEXT, address of next TX BD to be processed
* 0x08: RBD_BASE, base address of RX BD ring
* 0x0C: RBD_NEXT, address of next RX BD to be processed
* ---------------------------------------------------------------
* ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
*/
/* base address of SRAM area to store parameters used by Ethernet tasks */
#define FEC_PARAM_BASE (MMAP_SRAM + 0x5b00)
/* base address of SRAM area for buffer descriptors */
#define FEC_BD_BASE (MMAP_SRAM + 0x5b20)
/*---------------------------------------------------------------------
* common shortcuts used by driver C code
*---------------------------------------------------------------------
*/
/* Disable SmartDMA task */
#define DMA_TASK_DISABLE(tasknum) \
{ \
volatile ushort *tcr = (ushort *)(MMAP_DMA + 0x0000001c + 2 * tasknum); \
*tcr = (*tcr) & (~0x8000); \
}
/* Enable SmartDMA task */
#define DMA_TASK_ENABLE(tasknum) \
{ \
volatile ushort *tcr = (ushort *) (MMAP_DMA + 0x0000001c + 2 * tasknum);\
*tcr = (*tcr) | 0x8000; \
}
/* Clear interrupt pending bits */
#define DMA_CLEAR_IEVENT(tasknum) \
{ \
struct mpc8220_dma *dma = (struct mpc8220_dma *)MMAP_DMA; \
dma->IntPend = (1 << tasknum); \
}
#endif /* __MPC8220_DMA_H */
此差异已折叠。
/*
* dramSetup.h
*
* Prototypes, etc. for the Motorola MPC8220
* embedded cpu chips
*
* 2004 (c) Freescale, Inc.
* Author: TsiChung Liew <Tsi-Chung.Liew@freescale.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 __INCdramsetuph
#define __INCdramsetuph
#ifndef __ASSEMBLY__
/* Where various things are in the SPD */
#define LOC_TYPE 2
#define LOC_CHECKSUM 63
#define LOC_PHYS_BANKS 5
#define LOC_LOGICAL_BANKS 17
#define LOC_ROWS 3
#define LOC_COLS 4
#define LOC_WIDTH_HIGH 7
#define LOC_WIDTH_LOW 6
#define LOC_REFRESH 12
#define LOC_BURSTS 16
#define LOC_CAS 18
#define LOC_CS 19
#define LOC_WE 20
#define LOC_Tcyc 9
#define LOC_Tac 10
#define LOC_Trp 27
#define LOC_Trrd 28
#define LOC_Trcd 29
#define LOC_Tras 30
#define LOC_Buffered 21
/* Types of memory the SPD can tell us about.
* We can actually only use SDRAM and DDR.
*/
#define TYPE_DRAM 1 /* plain old dram */
#define TYPE_EDO 2 /* EDO dram */
#define TYPE_Nibble 3 /* serial nibble memory */
#define TYPE_SDR 4 /* SDRAM */
#define TYPE_ROM 5 /* */
#define TYPE_SGRRAM 6 /* graphics memory */
#define TYPE_DDR 7 /* DDR sdram */
#define SDRAMDS_MASK 0x3 /* each field is 2 bits wide */
#define SDRAMDS_SBE_SHIFT 8 /* Clock enable drive strength */
#define SDRAMDS_SBC_SHIFT 6 /* Clocks drive strength */
#define SDRAMDS_SBA_SHIFT 4 /* Address drive strength */
#define SDRAMDS_SBS_SHIFT 2 /* SDR DQS drive strength */
#define SDRAMDS_SBD_SHIFT 0 /* Data and DQS drive strength */
#define DRIVE_STRENGTH_HIGH 0
#define DRIVE_STRENGTH_MED 1
#define DRIVE_STRENGTH_LOW 2
#define DRIVE_STRENGTH_OFF 3
#define OK 0
#define ERROR -1
/* Structure to hold information about address muxing. */
typedef struct tagMuxDescriptor {
u8 MuxValue;
u8 Columns;
u8 Rows;
u8 MoreColumns;
} muxdesc_t;
/* Structure to define one physical bank of
* memory. Note that dram size in bytes is
* (2^^(rows+columns)) * width * banks / 8
*/
typedef struct tagDramInfo {
u32 size; /* size in bytes */
u32 base; /* base address */
u8 ordinal; /* where in the memory map will we put this */
u8 type;
u8 rows;
u8 cols;
u16 width; /* width of each chip in bits */
u8 banks; /* number of chips, aka logical banks */
u8 bursts; /* bit-encoded allowable burst length */
u8 CAS; /* bit-encoded CAS latency values */
u8 CS; /* bit-encoded CS latency values */
u8 WE; /* bit-encoded WE latency values */
u8 Trp; /* bit-encoded row precharge time */
u8 Trcd; /* bit-encoded RAS to CAS delay */
u8 buffered; /* buffered or not */
u8 refresh; /* encoded refresh rate */
} draminfo_t;
#endif /* __ASSEMBLY__ */
#endif /* __INCdramsetuph */
此差异已折叠。
/*
* (C) Copyright 2003-2004
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* This file is based on mpc4200fec.h
* (C) Copyright Motorola, Inc., 2000
*
* odin ethernet header file
*/
#ifndef __MPC8220_FEC_H
#define __MPC8220_FEC_H
#include <common.h>
#include <mpc8220.h>
#include "dma.h"
typedef struct ethernet_register_set {
/* [10:2]addr = 00 */
/* Control and status Registers (offset 000-1FF) */
volatile u32 fec_id; /* MBAR_ETH + 0x000 */
volatile u32 ievent; /* MBAR_ETH + 0x004 */
volatile u32 imask; /* MBAR_ETH + 0x008 */
volatile u32 RES0[1]; /* MBAR_ETH + 0x00C */
volatile u32 r_des_active; /* MBAR_ETH + 0x010 */
volatile u32 x_des_active; /* MBAR_ETH + 0x014 */
volatile u32 r_des_active_cl; /* MBAR_ETH + 0x018 */
volatile u32 x_des_active_cl; /* MBAR_ETH + 0x01C */
volatile u32 ivent_set; /* MBAR_ETH + 0x020 */
volatile u32 ecntrl; /* MBAR_ETH + 0x024 */
volatile u32 RES1[6]; /* MBAR_ETH + 0x028-03C */
volatile u32 mii_data; /* MBAR_ETH + 0x040 */
volatile u32 mii_speed; /* MBAR_ETH + 0x044 */
volatile u32 mii_status; /* MBAR_ETH + 0x048 */
volatile u32 RES2[5]; /* MBAR_ETH + 0x04C-05C */
volatile u32 mib_data; /* MBAR_ETH + 0x060 */
volatile u32 mib_control; /* MBAR_ETH + 0x064 */
volatile u32 RES3[6]; /* MBAR_ETH + 0x068-7C */
volatile u32 r_activate; /* MBAR_ETH + 0x080 */
volatile u32 r_cntrl; /* MBAR_ETH + 0x084 */
volatile u32 r_hash; /* MBAR_ETH + 0x088 */
volatile u32 r_data; /* MBAR_ETH + 0x08C */
volatile u32 ar_done; /* MBAR_ETH + 0x090 */
volatile u32 r_test; /* MBAR_ETH + 0x094 */
volatile u32 r_mib; /* MBAR_ETH + 0x098 */
volatile u32 r_da_low; /* MBAR_ETH + 0x09C */
volatile u32 r_da_high; /* MBAR_ETH + 0x0A0 */
volatile u32 RES4[7]; /* MBAR_ETH + 0x0A4-0BC */
volatile u32 x_activate; /* MBAR_ETH + 0x0C0 */
volatile u32 x_cntrl; /* MBAR_ETH + 0x0C4 */
volatile u32 backoff; /* MBAR_ETH + 0x0C8 */
volatile u32 x_data; /* MBAR_ETH + 0x0CC */
volatile u32 x_status; /* MBAR_ETH + 0x0D0 */
volatile u32 x_mib; /* MBAR_ETH + 0x0D4 */
volatile u32 x_test; /* MBAR_ETH + 0x0D8 */
volatile u32 fdxfc_da1; /* MBAR_ETH + 0x0DC */
volatile u32 fdxfc_da2; /* MBAR_ETH + 0x0E0 */
volatile u32 paddr1; /* MBAR_ETH + 0x0E4 */
volatile u32 paddr2; /* MBAR_ETH + 0x0E8 */
volatile u32 op_pause; /* MBAR_ETH + 0x0EC */
volatile u32 RES5[4]; /* MBAR_ETH + 0x0F0-0FC */
volatile u32 instr_reg; /* MBAR_ETH + 0x100 */
volatile u32 context_reg; /* MBAR_ETH + 0x104 */
volatile u32 test_cntrl; /* MBAR_ETH + 0x108 */
volatile u32 acc_reg; /* MBAR_ETH + 0x10C */
volatile u32 ones; /* MBAR_ETH + 0x110 */
volatile u32 zeros; /* MBAR_ETH + 0x114 */
volatile u32 iaddr1; /* MBAR_ETH + 0x118 */
volatile u32 iaddr2; /* MBAR_ETH + 0x11C */
volatile u32 gaddr1; /* MBAR_ETH + 0x120 */
volatile u32 gaddr2; /* MBAR_ETH + 0x124 */
volatile u32 random; /* MBAR_ETH + 0x128 */
volatile u32 rand1; /* MBAR_ETH + 0x12C */
volatile u32 tmp; /* MBAR_ETH + 0x130 */
volatile u32 RES6[3]; /* MBAR_ETH + 0x134-13C */
volatile u32 fifo_id; /* MBAR_ETH + 0x140 */
volatile u32 x_wmrk; /* MBAR_ETH + 0x144 */
volatile u32 fcntrl; /* MBAR_ETH + 0x148 */
volatile u32 r_bound; /* MBAR_ETH + 0x14C */
volatile u32 r_fstart; /* MBAR_ETH + 0x150 */
volatile u32 r_count; /* MBAR_ETH + 0x154 */
volatile u32 r_lag; /* MBAR_ETH + 0x158 */
volatile u32 r_read; /* MBAR_ETH + 0x15C */
volatile u32 r_write; /* MBAR_ETH + 0x160 */
volatile u32 x_count; /* MBAR_ETH + 0x164 */
volatile u32 x_lag; /* MBAR_ETH + 0x168 */
volatile u32 x_retry; /* MBAR_ETH + 0x16C */
volatile u32 x_write; /* MBAR_ETH + 0x170 */
volatile u32 x_read; /* MBAR_ETH + 0x174 */
volatile u32 RES7[2]; /* MBAR_ETH + 0x178-17C */
volatile u32 fm_cntrl; /* MBAR_ETH + 0x180 */
volatile u32 rfifo_data; /* MBAR_ETH + 0x184 */
volatile u32 rfifo_status; /* MBAR_ETH + 0x188 */
volatile u32 rfifo_cntrl; /* MBAR_ETH + 0x18C */
volatile u32 rfifo_lrf_ptr; /* MBAR_ETH + 0x190 */
volatile u32 rfifo_lwf_ptr; /* MBAR_ETH + 0x194 */
volatile u32 rfifo_alarm; /* MBAR_ETH + 0x198 */
volatile u32 rfifo_rdptr; /* MBAR_ETH + 0x19C */
volatile u32 rfifo_wrptr; /* MBAR_ETH + 0x1A0 */
volatile u32 tfifo_data; /* MBAR_ETH + 0x1A4 */
volatile u32 tfifo_status; /* MBAR_ETH + 0x1A8 */
volatile u32 tfifo_cntrl; /* MBAR_ETH + 0x1AC */
volatile u32 tfifo_lrf_ptr; /* MBAR_ETH + 0x1B0 */
volatile u32 tfifo_lwf_ptr; /* MBAR_ETH + 0x1B4 */
volatile u32 tfifo_alarm; /* MBAR_ETH + 0x1B8 */
volatile u32 tfifo_rdptr; /* MBAR_ETH + 0x1BC */
volatile u32 tfifo_wrptr; /* MBAR_ETH + 0x1C0 */
volatile u32 reset_cntrl; /* MBAR_ETH + 0x1C4 */
volatile u32 xmit_fsm; /* MBAR_ETH + 0x1C8 */
volatile u32 RES8[3]; /* MBAR_ETH + 0x1CC-1D4 */
volatile u32 rdes_data0; /* MBAR_ETH + 0x1D8 */
volatile u32 rdes_data1; /* MBAR_ETH + 0x1DC */
volatile u32 r_length; /* MBAR_ETH + 0x1E0 */
volatile u32 x_length; /* MBAR_ETH + 0x1E4 */
volatile u32 x_addr; /* MBAR_ETH + 0x1E8 */
volatile u32 cdes_data; /* MBAR_ETH + 0x1EC */
volatile u32 status; /* MBAR_ETH + 0x1F0 */
volatile u32 dma_control; /* MBAR_ETH + 0x1F4 */
volatile u32 des_cmnd; /* MBAR_ETH + 0x1F8 */
volatile u32 data; /* MBAR_ETH + 0x1FC */
/* MIB COUNTERS (Offset 200-2FF) */
volatile u32 rmon_t_drop; /* MBAR_ETH + 0x200 */
volatile u32 rmon_t_packets; /* MBAR_ETH + 0x204 */
volatile u32 rmon_t_bc_pkt; /* MBAR_ETH + 0x208 */
volatile u32 rmon_t_mc_pkt; /* MBAR_ETH + 0x20C */
volatile u32 rmon_t_crc_align; /* MBAR_ETH + 0x210 */
volatile u32 rmon_t_undersize; /* MBAR_ETH + 0x214 */
volatile u32 rmon_t_oversize; /* MBAR_ETH + 0x218 */
volatile u32 rmon_t_frag; /* MBAR_ETH + 0x21C */
volatile u32 rmon_t_jab; /* MBAR_ETH + 0x220 */
volatile u32 rmon_t_col; /* MBAR_ETH + 0x224 */
volatile u32 rmon_t_p64; /* MBAR_ETH + 0x228 */
volatile u32 rmon_t_p65to127; /* MBAR_ETH + 0x22C */
volatile u32 rmon_t_p128to255; /* MBAR_ETH + 0x230 */
volatile u32 rmon_t_p256to511; /* MBAR_ETH + 0x234 */
volatile u32 rmon_t_p512to1023; /* MBAR_ETH + 0x238 */
volatile u32 rmon_t_p1024to2047;/* MBAR_ETH + 0x23C */
volatile u32 rmon_t_p_gte2048; /* MBAR_ETH + 0x240 */
volatile u32 rmon_t_octets; /* MBAR_ETH + 0x244 */
volatile u32 ieee_t_drop; /* MBAR_ETH + 0x248 */
volatile u32 ieee_t_frame_ok; /* MBAR_ETH + 0x24C */
volatile u32 ieee_t_1col; /* MBAR_ETH + 0x250 */
volatile u32 ieee_t_mcol; /* MBAR_ETH + 0x254 */
volatile u32 ieee_t_def; /* MBAR_ETH + 0x258 */
volatile u32 ieee_t_lcol; /* MBAR_ETH + 0x25C */
volatile u32 ieee_t_excol; /* MBAR_ETH + 0x260 */
volatile u32 ieee_t_macerr; /* MBAR_ETH + 0x264 */
volatile u32 ieee_t_cserr; /* MBAR_ETH + 0x268 */
volatile u32 ieee_t_sqe; /* MBAR_ETH + 0x26C */
volatile u32 t_fdxfc; /* MBAR_ETH + 0x270 */
volatile u32 ieee_t_octets_ok; /* MBAR_ETH + 0x274 */
volatile u32 RES9[2]; /* MBAR_ETH + 0x278-27C */
volatile u32 rmon_r_drop; /* MBAR_ETH + 0x280 */
volatile u32 rmon_r_packets; /* MBAR_ETH + 0x284 */
volatile u32 rmon_r_bc_pkt; /* MBAR_ETH + 0x288 */
volatile u32 rmon_r_mc_pkt; /* MBAR_ETH + 0x28C */
volatile u32 rmon_r_crc_align; /* MBAR_ETH + 0x290 */
volatile u32 rmon_r_undersize; /* MBAR_ETH + 0x294 */
volatile u32 rmon_r_oversize; /* MBAR_ETH + 0x298 */
volatile u32 rmon_r_frag; /* MBAR_ETH + 0x29C */
volatile u32 rmon_r_jab; /* MBAR_ETH + 0x2A0 */
volatile u32 rmon_r_resvd_0; /* MBAR_ETH + 0x2A4 */
volatile u32 rmon_r_p64; /* MBAR_ETH + 0x2A8 */
volatile u32 rmon_r_p65to127; /* MBAR_ETH + 0x2AC */
volatile u32 rmon_r_p128to255; /* MBAR_ETH + 0x2B0 */
volatile u32 rmon_r_p256to511; /* MBAR_ETH + 0x2B4 */
volatile u32 rmon_r_p512to1023; /* MBAR_ETH + 0x2B8 */
volatile u32 rmon_r_p1024to2047;/* MBAR_ETH + 0x2BC */
volatile u32 rmon_r_p_gte2048; /* MBAR_ETH + 0x2C0 */
volatile u32 rmon_r_octets; /* MBAR_ETH + 0x2C4 */
volatile u32 ieee_r_drop; /* MBAR_ETH + 0x2C8 */
volatile u32 ieee_r_frame_ok; /* MBAR_ETH + 0x2CC */
volatile u32 ieee_r_crc; /* MBAR_ETH + 0x2D0 */
volatile u32 ieee_r_align; /* MBAR_ETH + 0x2D4 */
volatile u32 r_macerr; /* MBAR_ETH + 0x2D8 */
volatile u32 r_fdxfc; /* MBAR_ETH + 0x2DC */
volatile u32 ieee_r_octets_ok; /* MBAR_ETH + 0x2E0 */
volatile u32 RES10[6]; /* MBAR_ETH + 0x2E4-2FC */
volatile u32 RES11[64]; /* MBAR_ETH + 0x300-3FF */
} ethernet_regs;
/* Receive & Transmit Buffer Descriptor definitions */
typedef struct BufferDescriptor {
u16 status;
u16 dataLength;
u32 dataPointer;
} FEC_RBD;
typedef struct {
u16 status;
u16 dataLength;
u32 dataPointer;
} FEC_TBD;
/* private structure */
typedef enum {
SEVENWIRE, /* 7-wire */
MII10, /* MII 10Mbps */
MII100 /* MII 100Mbps */
} xceiver_type;
typedef struct {
ethernet_regs *eth;
xceiver_type xcv_type; /* transceiver type */
FEC_RBD *rbdBase; /* RBD ring */
FEC_TBD *tbdBase; /* TBD ring */
u16 rbdIndex; /* next receive BD to read */
u16 tbdIndex; /* next transmit BD to send */
u16 usedTbdIndex; /* next transmit BD to clean */
u16 cleanTbdNum; /* the number of available transmit BDs */
} mpc8220_fec_priv;
/* Ethernet parameter area */
#define FEC_TBD_BASE (FEC_PARAM_BASE + 0x00)
#define FEC_TBD_NEXT (FEC_PARAM_BASE + 0x04)
#define FEC_RBD_BASE (FEC_PARAM_BASE + 0x08)
#define FEC_RBD_NEXT (FEC_PARAM_BASE + 0x0c)
/* BD Numer definitions */
#define FEC_TBD_NUM 48 /* The user can adjust this value */
#define FEC_RBD_NUM 32 /* The user can adjust this value */
/* packet size limit */
#define FEC_MAX_PKT_SIZE 1536
/* RBD bits definitions */
#define FEC_RBD_EMPTY 0x8000 /* Buffer is empty */
#define FEC_RBD_WRAP 0x2000 /* Last BD in ring */
#define FEC_RBD_INT 0x1000 /* Interrupt */
#define FEC_RBD_LAST 0x0800 /* Buffer is last in frame(useless) */
#define FEC_RBD_MISS 0x0100 /* Miss bit for prom mode */
#define FEC_RBD_BC 0x0080 /* The received frame is broadcast frame */
#define FEC_RBD_MC 0x0040 /* The received frame is multicast frame */
#define FEC_RBD_LG 0x0020 /* Frame length violation */
#define FEC_RBD_NO 0x0010 /* Nonoctet align frame */
#define FEC_RBD_SH 0x0008 /* Short frame */
#define FEC_RBD_CR 0x0004 /* CRC error */
#define FEC_RBD_OV 0x0002 /* Receive FIFO overrun */
#define FEC_RBD_TR 0x0001 /* Frame is truncated */
#define FEC_RBD_ERR (FEC_RBD_LG | FEC_RBD_NO | FEC_RBD_CR | \
FEC_RBD_OV | FEC_RBD_TR)
/* TBD bits definitions */
#define FEC_TBD_READY 0x8000 /* Buffer is ready */
#define FEC_TBD_WRAP 0x2000 /* Last BD in ring */
#define FEC_TBD_INT 0x1000 /* Interrupt */
#define FEC_TBD_LAST 0x0800 /* Buffer is last in frame */
#define FEC_TBD_TC 0x0400 /* Transmit the CRC */
#define FEC_TBD_ABC 0x0200 /* Append bad CRC */
/* MII-related definitios */
#define FEC_MII_DATA_ST 0x40000000 /* Start of frame delimiter */
#define FEC_MII_DATA_OP_RD 0x20000000 /* Perform a read operation */
#define FEC_MII_DATA_OP_WR 0x10000000 /* Perform a write operation */
#define FEC_MII_DATA_PA_MSK 0x0f800000 /* PHY Address field mask */
#define FEC_MII_DATA_RA_MSK 0x007c0000 /* PHY Register field mask */
#define FEC_MII_DATA_TA 0x00020000 /* Turnaround */
#define FEC_MII_DATA_DATAMSK 0x0000ffff /* PHY data field */
#define FEC_MII_DATA_RA_SHIFT 18 /* MII Register address bits */
#define FEC_MII_DATA_PA_SHIFT 23 /* MII PHY address bits */
#endif /* __MPC8220_FEC_H */
/*
* Copyright (C) 2004, Freescale Semiconductor, Inc.
*
* This file contains microcode for the FEC controller of the MPC8220.
*/
#include <config.h>
#if defined(CONFIG_MPC8220)
/* sas/sccg, gas target */
.section smartdmaInitData,"aw",@progbits /* Initialized data for task variables */
.section smartdmaTaskTable,"aw",@progbits /* Task tables */
.align 9
.globl taskTable
taskTable:
.globl scEthernetRecv_Entry
scEthernetRecv_Entry: /* Task 0 */
.long scEthernetRecv_TDT - taskTable /* Task 0 Descriptor Table */
.long scEthernetRecv_TDT - taskTable + 0x00000094
.long scEthernetRecv_VarTab - taskTable /* Task 0 Variable Table */
.long scEthernetRecv_FDT - taskTable + 0x03 /* Task 0 Function Descriptor Table & Flags */
.long 0x00000000
.long 0x00000000
.long scEthernetRecv_CSave - taskTable /* Task 0 context save space */
.long 0xf0000000
.globl scEthernetXmit_Entry
scEthernetXmit_Entry: /* Task 1 */
.long scEthernetXmit_TDT - taskTable /* Task 1 Descriptor Table */
.long scEthernetXmit_TDT - taskTable + 0x000000e0
.long scEthernetXmit_VarTab - taskTable /* Task 1 Variable Table */
.long scEthernetXmit_FDT - taskTable + 0x03 /* Task 1 Function Descriptor Table & Flags */
.long 0x00000000
.long 0x00000000
.long scEthernetXmit_CSave - taskTable /* Task 1 context save space */
.long 0xf0000000
.globl scEthernetRecv_TDT
scEthernetRecv_TDT: /* Task 0 Descriptor Table */
.long 0xc4c50000 /* 0000(153): LCDEXT: idx0 = var9 + var10; idx0 once var0; idx0 += inc0 */
.long 0x84c5e000 /* 0004(153): LCD: idx1 = var9 + var11; ; idx1 += inc0 */
.long 0x10001f08 /* 0008(156): DRD1A: var7 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x10000380 /* 000C(157): DRD1A: var0 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x00000f88 /* 0010(158): DRD1A: var3 = *idx1; FN=0 init=0 WS=0 RS=0 */
.long 0x81980000 /* 0014(162): LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
.long 0x10000780 /* 0018(164): DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x60000000 /* 001C(165): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
.long 0x010cf04c /* 0020(165): DRD2B1: var4 = EU3(); EU3(var1,var12) */
.long 0x82180349 /* 0024(169): LCD: idx0 = var4; idx0 != var13; idx0 += inc1 */
.long 0x81c68004 /* 0028(172): LCD: idx1 = var3 + var13 + 4; idx1 once var0; idx1 += inc0 */
.long 0x70000000 /* 002C(174): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x018cf04e /* 0030(174): DRD2B1: var6 = EU3(); EU3(var1,var14) */
.long 0x70000000 /* 0034(175): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x020cf04f /* 0038(175): DRD2B1: var8 = EU3(); EU3(var1,var15) */
.long 0x00000b88 /* 003C(176): DRD1A: var2 = *idx1; FN=0 init=0 WS=0 RS=0 */
.long 0x80025184 /* 0040(205): LCDEXT: idx1 = 0xf0009184; ; */
.long 0x86810412 /* 0044(205): LCD: idx2 = var13, idx3 = var2; idx2 < var16; idx2 += inc2, idx3 += inc2 */
.long 0x0200cf88 /* 0048(209): DRD1A: *idx3 = *idx1; FN=0 init=16 WS=0 RS=0 */
.long 0x80025184 /* 004C(217): LCDEXT: idx1 = 0xf0009184; ; */
.long 0x8681845b /* 0050(217): LCD: idx2 = var13, idx3 = var3; idx2 < var17; idx2 += inc3, idx3 += inc3 */
.long 0x0000cf88 /* 0054(221): DRD1A: *idx3 = *idx1; FN=0 init=0 WS=0 RS=0 */
.long 0xc31883a4 /* 0058(225): LCDEXT: idx1 = var6; idx1 == var14; idx1 += inc4 */
.long 0x80190000 /* 005C(225): LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
.long 0x04008468 /* 0060(227): DRD1A: idx1 = var13; FN=0 INT init=0 WS=0 RS=0 */
.long 0xc4038360 /* 0064(232): LCDEXT: idx1 = var8, idx2 = var7; idx1 == var13; idx1 += inc4, idx2 += inc0 */
.long 0x81c50000 /* 0068(233): LCD: idx3 = var3 + var10; idx3 once var0; idx3 += inc0 */
.long 0x1000cb18 /* 006C(235): DRD1A: *idx2 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x00000f18 /* 0070(236): DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
.long 0xc418836d /* 0074(238): LCDEXT: idx1 = var8; idx1 > var13; idx1 += inc5 */
.long 0x83990000 /* 0078(238): LCD: idx2 = var7; idx2 once var0; idx2 += inc0 */
.long 0x10000c00 /* 007C(240): DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x0000c800 /* 0080(241): DRD1A: *idx2 = var0; FN=0 init=0 WS=0 RS=0 */
.long 0x81988000 /* 0084(245): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
.long 0x10000788 /* 0088(247): DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x60000000 /* 008C(248): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
.long 0x080cf04c /* 0090(248): DRD2B1: idx0 = EU3(); EU3(var1,var12) */
.long 0x000001f8 /* 0094(:0): NOP */
.globl scEthernetXmit_TDT
scEthernetXmit_TDT: /* Task 1 Descriptor Table */
.long 0x80095b00 /* 0000(280): LCDEXT: idx0 = 0xf0025b00; ; */
.long 0x85c60004 /* 0004(280): LCD: idx1 = var11 + var12 + 4; idx1 once var0; idx1 += inc0 */
.long 0x10002308 /* 0008(283): DRD1A: var8 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x10000f88 /* 000C(284): DRD1A: var3 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x00000380 /* 0010(285): DRD1A: var0 = *idx0; FN=0 init=0 WS=0 RS=0 */
.long 0x81980000 /* 0014(288): LCD: idx0 = var3; idx0 once var0; idx0 += inc0 */
.long 0x10000780 /* 0018(290): DRD1A: var1 = *idx0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x60000000 /* 001C(291): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
.long 0x024cf04d /* 0020(291): DRD2B1: var9 = EU3(); EU3(var1,var13) */
.long 0x84980309 /* 0024(294): LCD: idx0 = var9; idx0 != var12; idx0 += inc1 */
.long 0xc0004003 /* 0028(297): LCDEXT: idx1 = 0x00000003; ; */
.long 0x81c60004 /* 002C(297): LCD: idx2 = var3 + var12 + 4; idx2 once var0; idx2 += inc0 */
.long 0x70000000 /* 0030(299): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x010cf04e /* 0034(299): DRD2B1: var4 = EU3(); EU3(var1,var14) */
.long 0x70000000 /* 0038(300): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x014cf04f /* 003C(300): DRD2B1: var5 = EU3(); EU3(var1,var15) */
.long 0x70000000 /* 0040(301): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x028cf050 /* 0044(301): DRD2B1: var10 = EU3(); EU3(var1,var16) */
.long 0x70000000 /* 0048(302): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT MORE init=0 WS=0 RS=0 */
.long 0x018cf051 /* 004C(302): DRD2B1: var6 = EU3(); EU3(var1,var17) */
.long 0x10000b90 /* 0050(303): DRD1A: var2 = *idx2; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x60000000 /* 0054(304): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
.long 0x01ccf0a1 /* 0058(304): DRD2B1: var7 = EU3(); EU3(var2,idx1) */
.long 0xc2988312 /* 005C(308): LCDEXT: idx1 = var5; idx1 > var12; idx1 += inc2 */
.long 0x83490000 /* 0060(308): LCD: idx2 = var6 + var18; idx2 once var0; idx2 += inc0 */
.long 0x00001b10 /* 0064(310): DRD1A: var6 = idx2; FN=0 init=0 WS=0 RS=0 */
.long 0x800251a4 /* 0068(315): LCDEXT: idx1 = 0xf00091a4; ; */
.long 0xc30104dc /* 006C(315): LCDEXT: idx2 = var6, idx3 = var2; idx2 >= var19; idx2 += inc3, idx3 += inc4 */
.long 0x839a032d /* 0070(316): LCD: idx4 = var7; idx4 == var12; idx4 += inc5 */
.long 0x0220c798 /* 0074(321): DRD1A: *idx1 = *idx3; FN=0 init=17 WS=0 RS=0 */
.long 0x800251a4 /* 0078(329): LCDEXT: idx1 = 0xf00091a4; ; */
.long 0x99198337 /* 007C(329): LCD: idx2 = idx2, idx3 = idx3; idx2 > var12; idx2 += inc6, idx3 += inc7 */
.long 0x022ac798 /* 0080(333): DRD1A: *idx1 = *idx3; FN=0 init=17 WS=1 RS=1 */
.long 0x800251a4 /* 0084(350): LCDEXT: idx1 = 0xf00091a4; ; */
.long 0xc1430000 /* 0088(350): LCDEXT: idx2 = var2 + var6; idx2 once var0; idx2 += inc0 */
.long 0x82998312 /* 008C(351): LCD: idx3 = var5; idx3 > var12; idx3 += inc2 */
.long 0x0a2ac790 /* 0090(354): DRD1A: *idx1 = *idx2; FN=0 TFD init=17 WS=1 RS=1 */
.long 0x81988000 /* 0094(359): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
.long 0x60000002 /* 0098(361): DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=0 RS=0 */
.long 0x0c4cfc4d /* 009C(361): DRD2B1: *idx1 = EU3(); EU3(*idx1,var13) */
.long 0xc21883ad /* 00A0(365): LCDEXT: idx1 = var4; idx1 == var14; idx1 += inc5 */
.long 0x80190000 /* 00A4(365): LCD: idx2 = var0; idx2 once var0; idx2 += inc0 */
.long 0x04008460 /* 00A8(367): DRD1A: idx1 = var12; FN=0 INT init=0 WS=0 RS=0 */
.long 0xc4052305 /* 00AC(371): LCDEXT: idx1 = var8, idx2 = var10; idx2 == var12; idx1 += inc0, idx2 += inc5 */
.long 0x81ca0000 /* 00B0(372): LCD: idx3 = var3 + var20; idx3 once var0; idx3 += inc0 */
.long 0x1000c718 /* 00B4(374): DRD1A: *idx1 = idx3; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x00000f18 /* 00B8(375): DRD1A: var3 = idx3; FN=0 init=0 WS=0 RS=0 */
.long 0xc4188000 /* 00BC(378): LCDEXT: idx1 = var8; idx1 once var0; idx1 += inc0 */
.long 0x85190312 /* 00C0(378): LCD: idx2 = var10; idx2 > var12; idx2 += inc2 */
.long 0x10000c00 /* 00C4(380): DRD1A: var3 = var0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x1000c400 /* 00C8(381): DRD1A: *idx1 = var0; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x00008860 /* 00CC(382): DRD1A: idx2 = var12; FN=0 init=0 WS=0 RS=0 */
.long 0x81988000 /* 00D0(386): LCD: idx1 = var3; idx1 once var0; idx1 += inc0 */
.long 0x10000788 /* 00D4(388): DRD1A: var1 = *idx1; FN=0 MORE init=0 WS=0 RS=0 */
.long 0x60000000 /* 00D8(389): DRD2A: EU0=0 EU1=0 EU2=0 EU3=0 EXT init=0 WS=0 RS=0 */
.long 0x080cf04d /* 00DC(389): DRD2B1: idx0 = EU3(); EU3(var1,var13) */
.long 0x000001f8 /* 00E0(:0): NOP */
.align 8
.globl scEthernetRecv_VarTab
scEthernetRecv_VarTab: /* Task 0 Variable Table */
.long 0x00000000 /* var[0] */
.long 0x00000000 /* var[1] */
.long 0x00000000 /* var[2] */
.long 0x00000000 /* var[3] */
.long 0x00000000 /* var[4] */
.long 0x00000000 /* var[5] */
.long 0x00000000 /* var[6] */
.long 0x00000000 /* var[7] */
.long 0x00000000 /* var[8] */
.long 0xf0025b00 /* var[9] */
.long 0x00000008 /* var[10] */
.long 0x0000000c /* var[11] */
.long 0x80000000 /* var[12] */
.long 0x00000000 /* var[13] */
.long 0x10000000 /* var[14] */
.long 0x20000000 /* var[15] */
.long 0x00000800 /* var[16] */
.long 0x00000001 /* var[17] */
.long 0x00000000 /* var[18] */
.long 0x00000000 /* var[19] */
.long 0x00000000 /* var[20] */
.long 0x00000000 /* var[21] */
.long 0x00000000 /* var[22] */
.long 0x00000000 /* var[23] */
.long 0x00000000 /* inc[0] */
.long 0x60000000 /* inc[1] */
.long 0x20000004 /* inc[2] */
.long 0x20000001 /* inc[3] */
.long 0x80000000 /* inc[4] */
.long 0x40000000 /* inc[5] */
.long 0x00000000 /* inc[6] */
.long 0x00000000 /* inc[7] */
.align 8
.globl scEthernetXmit_VarTab
scEthernetXmit_VarTab: /* Task 1 Variable Table */
.long 0x00000000 /* var[0] */
.long 0x00000000 /* var[1] */
.long 0x00000000 /* var[2] */
.long 0x00000000 /* var[3] */
.long 0x00000000 /* var[4] */
.long 0x00000000 /* var[5] */
.long 0x00000000 /* var[6] */
.long 0x00000000 /* var[7] */
.long 0x00000000 /* var[8] */
.long 0x00000000 /* var[9] */
.long 0x00000000 /* var[10] */
.long 0xf0025b00 /* var[11] */
.long 0x00000000 /* var[12] */
.long 0x80000000 /* var[13] */
.long 0x10000000 /* var[14] */
.long 0x08000000 /* var[15] */
.long 0x20000000 /* var[16] */
.long 0x0000ffff /* var[17] */
.long 0xffffffff /* var[18] */
.long 0x00000004 /* var[19] */
.long 0x00000008 /* var[20] */
.long 0x00000000 /* var[21] */
.long 0x00000000 /* var[22] */
.long 0x00000000 /* var[23] */
.long 0x00000000 /* inc[0] */
.long 0x60000000 /* inc[1] */
.long 0x40000000 /* inc[2] */
.long 0xc000fffc /* inc[3] */
.long 0xe0000004 /* inc[4] */
.long 0x80000000 /* inc[5] */
.long 0x4000ffff /* inc[6] */
.long 0xe0000001 /* inc[7] */
.align 8
.globl scEthernetRecv_FDT
scEthernetRecv_FDT: /* Task 0 Function Descriptor Table */
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x21800000 /* and(), EU# 3 */
.long 0x21e00000 /* or(), EU# 3 */
.long 0x21400000 /* andn(), EU# 3 */
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.align 8
.globl scEthernetXmit_FDT
scEthernetXmit_FDT: /* Task 1 Function Descriptor Table */
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x21800000 /* and(), EU# 3 */
.long 0x21e00000 /* or(), EU# 3 */
.long 0x21400000 /* andn(), EU# 3 */
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.long 0x00000000
.globl scEthernetRecv_CSave
scEthernetRecv_CSave: /* Task 0 context save space */
.space 128, 0x0
.globl scEthernetXmit_CSave
scEthernetXmit_CSave: /* Task 1 context save space */
.space 128, 0x0
#endif
/*
* (C) Copyright 2004, Freescale, Inc
* TsiChung Liew, Tsi-Chung.Liew@freescale.com.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#ifdef CONFIG_HARD_I2C
#include <mpc8220.h>
#include <i2c.h>
typedef struct mpc8220_i2c {
volatile u32 adr; /* I2Cn + 0x00 */
volatile u32 fdr; /* I2Cn + 0x04 */
volatile u32 cr; /* I2Cn + 0x08 */
volatile u32 sr; /* I2Cn + 0x0C */
volatile u32 dr; /* I2Cn + 0x10 */
} i2c_t;
/* I2Cn control register bits */
#define I2C_EN 0x80
#define I2C_IEN 0x40
#define I2C_STA 0x20
#define I2C_TX 0x10
#define I2C_TXAK 0x08
#define I2C_RSTA 0x04
#define I2C_INIT_MASK (I2C_EN | I2C_STA | I2C_TX | I2C_RSTA)
/* I2Cn status register bits */
#define I2C_CF 0x80
#define I2C_AAS 0x40
#define I2C_BB 0x20
#define I2C_AL 0x10
#define I2C_SRW 0x04
#define I2C_IF 0x02
#define I2C_RXAK 0x01
#define I2C_TIMEOUT 100
#define I2C_RETRIES 1
struct mpc8220_i2c_tap {
int scl2tap;
int tap2tap;
};
static int mpc_reg_in (volatile u32 * reg);
static void mpc_reg_out (volatile u32 * reg, int val, int mask);
static int wait_for_bb (void);
static int wait_for_pin (int *status);
static int do_address (uchar chip, char rdwr_flag);
static int send_bytes (uchar chip, char *buf, int len);
static int receive_bytes (uchar chip, char *buf, int len);
static int mpc_get_fdr (int);
static int mpc_reg_in (volatile u32 * reg)
{
return *reg >> 24;
__asm__ __volatile__ ("eieio");
}
static void mpc_reg_out (volatile u32 * reg, int val, int mask)
{
int tmp;
if (!mask) {
*reg = val << 24;
} else {
tmp = mpc_reg_in (reg);
*reg = ((tmp & ~mask) | (val & mask)) << 24;
}
__asm__ __volatile__ ("eieio");
return;
}
static int wait_for_bb (void)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int timeout = I2C_TIMEOUT;
int status;
status = mpc_reg_in (&regs->sr);
while (timeout-- && (status & I2C_BB)) {
#if 1
volatile int temp;
mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
temp = mpc_reg_in (&regs->dr);
mpc_reg_out (&regs->cr, 0, I2C_STA);
mpc_reg_out (&regs->cr, 0, 0);
mpc_reg_out (&regs->cr, I2C_EN, 0);
#endif
udelay (1000);
status = mpc_reg_in (&regs->sr);
}
return (status & I2C_BB);
}
static int wait_for_pin (int *status)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int timeout = I2C_TIMEOUT;
*status = mpc_reg_in (&regs->sr);
while (timeout-- && !(*status & I2C_IF)) {
udelay (1000);
*status = mpc_reg_in (&regs->sr);
}
if (!(*status & I2C_IF)) {
return -1;
}
mpc_reg_out (&regs->sr, 0, I2C_IF);
return 0;
}
static int do_address (uchar chip, char rdwr_flag)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int status;
chip <<= 1;
if (rdwr_flag)
chip |= 1;
mpc_reg_out (&regs->cr, I2C_TX, I2C_TX);
mpc_reg_out (&regs->dr, chip, 0);
if (wait_for_pin (&status))
return -2;
if (status & I2C_RXAK)
return -3;
return 0;
}
static int send_bytes (uchar chip, char *buf, int len)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int wrcount;
int status;
for (wrcount = 0; wrcount < len; ++wrcount) {
mpc_reg_out (&regs->dr, buf[wrcount], 0);
if (wait_for_pin (&status))
break;
if (status & I2C_RXAK)
break;
}
return !(wrcount == len);
return 0;
}
static int receive_bytes (uchar chip, char *buf, int len)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int dummy = 1;
int rdcount = 0;
int status;
int i;
mpc_reg_out (&regs->cr, 0, I2C_TX);
for (i = 0; i < len; ++i) {
buf[rdcount] = mpc_reg_in (&regs->dr);
if (dummy)
dummy = 0;
else
rdcount++;
if (wait_for_pin (&status))
return -4;
}
mpc_reg_out (&regs->cr, I2C_TXAK, I2C_TXAK);
buf[rdcount++] = mpc_reg_in (&regs->dr);
if (wait_for_pin (&status))
return -5;
mpc_reg_out (&regs->cr, 0, I2C_TXAK);
return 0;
}
/**************** I2C API ****************/
void i2c_init (int speed, int saddr)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
mpc_reg_out (&regs->cr, 0, 0);
mpc_reg_out (&regs->adr, saddr << 1, 0);
/* Set clock
*/
mpc_reg_out (&regs->fdr, mpc_get_fdr (speed), 0);
/* Enable module
*/
mpc_reg_out (&regs->cr, I2C_EN, I2C_INIT_MASK);
mpc_reg_out (&regs->sr, 0, I2C_IF);
return;
}
static int mpc_get_fdr (int speed)
{
DECLARE_GLOBAL_DATA_PTR;
static int fdr = -1;
if (fdr == -1) {
ulong best_speed = 0;
ulong divider;
ulong ipb, scl;
ulong bestmatch = 0xffffffffUL;
int best_i = 0, best_j = 0, i, j;
int SCL_Tap[] = { 9, 10, 12, 15, 5, 6, 7, 8 };
struct mpc8220_i2c_tap scltap[] = {
{4, 1},
{4, 2},
{6, 4},
{6, 8},
{14, 16},
{30, 32},
{62, 64},
{126, 128}
};
ipb = gd->bus_clk;
for (i = 7; i >= 0; i--) {
for (j = 7; j >= 0; j--) {
scl = 2 * (scltap[j].scl2tap +
(SCL_Tap[i] -
1) * scltap[j].tap2tap + 2);
if (ipb <= speed * scl) {
if ((speed * scl - ipb) < bestmatch) {
bestmatch = speed * scl - ipb;
best_i = i;
best_j = j;
best_speed = ipb / scl;
}
}
}
}
divider = (best_i & 3) | ((best_i & 4) << 3) | (best_j << 2);
if (gd->flags & GD_FLG_RELOC) {
fdr = divider;
} else {
printf ("%ld kHz, ", best_speed / 1000);
return divider;
}
}
return fdr;
}
int i2c_probe (uchar chip)
{
i2c_t *regs = (i2c_t *) MMAP_I2C;
int i;
for (i = 0; i < I2C_RETRIES; i++) {
mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
if (!do_address (chip, 0)) {
mpc_reg_out (&regs->cr, 0, I2C_STA);
break;
}
mpc_reg_out (&regs->cr, 0, I2C_STA);
udelay (50);
}
return (i == I2C_RETRIES);
}
int i2c_read (uchar chip, uint addr, int alen, uchar * buf, int len)
{
uchar xaddr[4];
i2c_t *regs = (i2c_t *) MMAP_I2C;
int ret = -1;
xaddr[0] = (addr >> 24) & 0xFF;
xaddr[1] = (addr >> 16) & 0xFF;
xaddr[2] = (addr >> 8) & 0xFF;
xaddr[3] = addr & 0xFF;
if (wait_for_bb ()) {
printf ("i2c_read: bus is busy\n");
goto Done;
}
mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
if (do_address (chip, 0)) {
printf ("i2c_read: failed to address chip\n");
goto Done;
}
if (send_bytes (chip, &xaddr[4 - alen], alen)) {
printf ("i2c_read: send_bytes failed\n");
goto Done;
}
mpc_reg_out (&regs->cr, I2C_RSTA, I2C_RSTA);
if (do_address (chip, 1)) {
printf ("i2c_read: failed to address chip\n");
goto Done;
}
if (receive_bytes (chip, buf, len)) {
printf ("i2c_read: receive_bytes failed\n");
goto Done;
}
ret = 0;
Done:
mpc_reg_out (&regs->cr, 0, I2C_STA);
return ret;
}
int i2c_write (uchar chip, uint addr, int alen, uchar * buf, int len)
{
uchar xaddr[4];
i2c_t *regs = (i2c_t *) MMAP_I2C;
int ret = -1;
xaddr[0] = (addr >> 24) & 0xFF;
xaddr[1] = (addr >> 16) & 0xFF;
xaddr[2] = (addr >> 8) & 0xFF;
xaddr[3] = addr & 0xFF;
if (wait_for_bb ()) {
printf ("i2c_write: bus is busy\n");
goto Done;
}
mpc_reg_out (&regs->cr, I2C_STA, I2C_STA);
if (do_address (chip, 0)) {
printf ("i2c_write: failed to address chip\n");
goto Done;
}
if (send_bytes (chip, &xaddr[4 - alen], alen)) {
printf ("i2c_write: send_bytes failed\n");
goto Done;
}
if (send_bytes (chip, buf, len)) {
printf ("i2c_write: send_bytes failed\n");
goto Done;
}
ret = 0;
Done:
mpc_reg_out (&regs->cr, 0, I2C_STA);
return ret;
}
uchar i2c_reg_read (uchar chip, uchar reg)
{
char buf;
i2c_read (chip, reg, 1, &buf, 1);
return buf;
}
void i2c_reg_write (uchar chip, uchar reg, uchar val)
{
i2c_write (chip, reg, 1, &val, 1);
return;
}
#endif /* CONFIG_HARD_I2C */
此差异已折叠。
/*
* i2cCore.h
*
* Prototypes, etc. for the Motorola MPC8220
* embedded cpu chips
*
* 2004 (c) Freescale, Inc.
* Author: TsiChung Liew <Tsi-Chung.Liew@freescale.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 __INCi2ccoreh
#define __INCi2ccoreh
#ifndef __ASSEMBLY__
/* device types */
#define I2C_DEVICE_TYPE_EEPROM 0
#define I2C_EEPROM_ADRS 0xa0
#define I2C_CTRL_ADRS I2C_EEPROM_ADRS
#define EEPROM_ADDR0 0xA2 /* on Dimm SPD eeprom */
#define EEPROM_ADDR1 0xA4 /* on Board SPD eeprom */
#define EEPROM_ADDR2 0xD2 /* non-standard eeprom - clock generator */
/* Control Register */
#define I2C_CTL_EN 0x80 /* I2C Enable */
#define I2C_CTL_IEN 0x40 /* I2C Interrupt Enable */
#define I2C_CTL_STA 0x20 /* Master/Slave Mode select */
#define I2C_CTL_TX 0x10 /* Transmit/Receive Mode Select */
#define I2C_CTL_TXAK 0x08 /* Transmit Acknowledge Enable */
#define I2C_CTL_RSTA 0x04 /* Repeat Start */
/* Status Register */
#define I2C_STA_CF 0x80 /* Data Transfer */
#define I2C_STA_AAS 0x40 /* Adressed As Slave */
#define I2C_STA_BB 0x20 /* Bus Busy */
#define I2C_STA_AL 0x10 /* Arbitration Lost */
#define I2C_STA_SRW 0x04 /* Slave Read/Write */
#define I2C_STA_IF 0x02 /* I2C Interrupt */
#define I2C_STA_RXAK 0x01 /* Receive Acknowledge */
/* Interrupt Contol Register */
#define I2C_INT_BNBE2 0x80 /* Bus Not Busy Enable 2 */
#define I2C_INT_TE2 0x40 /* Transmit Enable 2 */
#define I2C_INT_RE2 0x20 /* Receive Enable 2 */
#define I2C_INT_IE2 0x10 /* Interrupt Enable 2 */
#define I2C_INT_BNBE1 0x08 /* Bus Not Busy Enable 1 */
#define I2C_INT_TE1 0x04 /* Transmit Enable 1 */
#define I2C_INT_RE1 0x02 /* Receive Enable 1 */
#define I2C_INT_IE1 0x01 /* Interrupt Enable 1 */
#define I2C_POLL_COUNT 0x100000
#define I2C_ENABLE 0x00000001
#define I2C_DISABLE 0x00000002
#define I2C_START 0x00000004
#define I2C_REPSTART 0x00000008
#define I2C_STOP 0x00000010
#define I2C_BITRATE 0x00000020
#define I2C_SLAVEADR 0x00000040
#define I2C_STARTADR 0x00000080
#undef TWOBYTES
typedef struct i2c_settings {
/* Device settings */
int bit_rate; /* Device bit rate */
u8 i2c_adr; /* I2C address */
u8 slv_adr; /* Slave address */
#ifdef TWOBYTES
u16 str_adr; /* Start address */
#else
u8 str_adr; /* Start address */
#endif
int xfer_size; /* Transfer Size */
int bI2c_en; /* Enable or Disable */
int cmdFlag; /* I2c Command Flags */
} i2cset_t;
/*
int check_status(PSI2C pi2c, u8 sta_bit, u8 truefalse);
int i2c_enable(PSI2C pi2c, PI2CSET pi2cSet);
int i2c_disable(PSI2C pi2c);
int i2c_start(PSI2C pi2c, PI2CSET pi2cSet);
int i2c_stop(PSI2C pi2c);
int i2c_clear(PSI2C pi2c);
int i2c_readblock (PSI2C pi2c, PI2CSET pi2cSet, u8 *Data);
int i2c_writeblock (PSI2C pi2c, PI2CSET pi2cSet, u8 *Data);
int i2c_readbyte(PSI2C pi2c, u8 *readb, int *index);
int i2c_writebyte(PSI2C pi2c, u8 *writeb);
int SetI2cFDR( PSI2C pi2cRegs, int bitrate );
*/
#endif /* __ASSEMBLY__ */
#endif /* __INCi2ccoreh */
/*
* (C) Copyright -2003
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2001
* Josh Huber <huber@mclx.com>, Mission Critical Linux, Inc.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
/*
* interrupts.c - just enough support for the decrementer/timer
*/
#include <common.h>
#include <asm/processor.h>
#include <command.h>
int interrupt_init_cpu (ulong * decrementer_count)
{
*decrementer_count = get_tbclk () / CFG_HZ;
return (0);
}
/****************************************************************************/
/*
* Handle external interrupts
*/
void external_interrupt (struct pt_regs *regs)
{
puts ("external_interrupt (oops!)\n");
}
void timer_interrupt_cpu (struct pt_regs *regs)
{
/* nothing to do here */
return;
}
/****************************************************************************/
/*
* Install and free a interrupt handler.
*/
void irq_install_handler (int vec, interrupt_handler_t * handler, void *arg)
{
}
void irq_free_handler (int vec)
{
}
/****************************************************************************/
void
do_irqinfo (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
{
puts ("IRQ related functions are unimplemented currently.\n");
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -175,7 +175,7 @@
#define IM_IMMR (IM_REGBASE+0x01a8)
#define IM_SCCR (IM_REGBASE+0x0c80)
#elif defined(CONFIG_MPC5xxx)
#elif defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC8220)
#define HID0_ICE_BITPOS 16
#define HID0_DCE_BITPOS 17
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册