diff options
145 files changed, 5032 insertions, 4067 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index c2c7075cf..ef16d688d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -682,6 +682,10 @@ Nobuhiro Iwmaatsu <iwamatsu@nigauri.org>  	MS7750SE		SH7750  	MS7722SE		SH7722 +Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + +	MS7720SE		SH7720 +  #########################################################################  # End of MAINTAINERS list						#  ######################################################################### @@ -686,8 +686,9 @@ LIST_sh4="		\  	ms7722se	\  " -LIST_sh3="" - +LIST_sh3="		\ +	ms7720se	\ +"  LIST_sh="		\  	${LIST_sh3}	\ @@ -230,6 +230,7 @@ LIBS += drivers/net/libnet.a  LIBS += drivers/net/sk98lin/libsk98lin.a  LIBS += drivers/pci/libpci.a  LIBS += drivers/pcmcia/libpcmcia.a +LIBS += drivers/spi/libspi.a  ifeq ($(CPU),mpc83xx)  LIBS += drivers/qe/qe.a  endif @@ -377,6 +378,7 @@ TAG_SUBDIRS += drivers/pcmcia  TAG_SUBDIRS += drivers/qe  TAG_SUBDIRS += drivers/rtc  TAG_SUBDIRS += drivers/serial +TAG_SUBDIRS += drivers/spi  TAG_SUBDIRS += drivers/usb  TAG_SUBDIRS += drivers/video @@ -2759,6 +2761,14 @@ atstk1004_config	:	unconfig  #########################################################################  ######################################################################### +## sh3 (Renesas SuperH) +######################################################################### +ms7720se_config: unconfig +	@ >include/config.h +	@echo "#define CONFIG_MS7720SE 1" >> include/config.h +	@./mkconfig -a $(@:_config=) sh sh3 ms7720se + +#########################################################################  ## sh4 (Renesas SuperH)  #########################################################################  ms7750se_config: unconfig @@ -1377,6 +1377,14 @@ The following options need to be configured:  		SPI configuration items (port pins to use, etc). For  		an example, see include/configs/sacsng.h. +		CONFIG_HARD_SPI + +		Enables a hardware SPI driver for general-purpose reads +		and writes.  As with CONFIG_SOFT_SPI, the board configuration +		must define a list of chip-select function pointers. +		Currently supported on some MPC8xxx processors.  For an +		example, see include/configs/mpc8349emds.h. +  - FPGA Support: CONFIG_FPGA  		Enables FPGA subsystem. diff --git a/board/atum8548/Makefile b/board/atum8548/Makefile index e198062fb..ac4e58385 100644 --- a/board/atum8548/Makefile +++ b/board/atum8548/Makefile @@ -29,9 +29,7 @@ endif  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o - -SOBJS	:= init.o +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/atum8548/init.S b/board/atum8548/init.S deleted file mode 100644 index 654a56990..000000000 --- a/board/atum8548/init.S +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 2007 - * Robert Lazarski, Instituto Atlantico, robertlazarski@gmail.com - * Copyright 2004, 2007 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - -#define LAWAR_TRGT_PCI1		0x00000000 -#define LAWAR_TRGT_PCI2		0x00100000 -#define LAWAR_TRGT_PCIE		0x00200000 -#define LAWAR_TRGT_DDR		0x00f00000 - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1	;	\ -	bl	0f	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long (2f-1f)/16 - -1: -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, guarded -	 * Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, MAS2_G) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, MAS2_G) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, MAS2_G) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, MAS2_G) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* TLB 1 Initializations */ -	/* -	 * TLB 0, 1:	128M	Non-cacheable, guarded -	 * 0xf8000000	128M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE + 0x4000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE + 0x4000000, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	1G	Non-cacheable, guarded -	 * 0x80000000	1G	PCI1/PCIE  8,9,a,b -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1G) -	.long FSL_BOOKE_MAS2(CFG_PCI_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3, 4:	512M	Non-cacheable, guarded -	 * 0xc0000000	1G	PCI2 -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_PHYS,	0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_PHYS + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_PHYS + 0x10000000, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	1M	PCI1 IO -	 * 0xe210_0000	1M	PCI2 IO -	 * 0xe300_0000	1M	PCIe IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -2: -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000	   0x7fff_ffff	   DDR			   2G - * 0x8000_0000	   0x9fff_ffff	   PCI1 MEM		   512M - * 0xa000_0000	   0xbfff_ffff	   PCIe MEM		   512M - * 0xc000_0000	   0xdfff_ffff	   PCI2 MEM		   512M - * 0xe000_0000	   0xe000_ffff	   CCSR			   1M - * 0xe200_0000	   0xe10f_ffff	   PCI1 IO		   1M - * 0xe280_0000	   0xe20f_ffff	   PCI2 IO		   1M - * 0xe300_0000	   0xe30f_ffff	   PCIe IO		   1M - * 0xf800_0000	   0xffff_ffff	   FLASH (boot bank)	   128M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * LAW 0 is reserved for boot mapping - */ - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start - -	.long (4f-3f)/8 -3: -	.long  0 -	.long  (LAWAR_TRGT_DDR | (LAWAR_SIZE & LAWAR_SIZE_1G)) & ~LAWAR_EN - -	.long	(CFG_PCI1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCI1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_1M) - -	.long	(CFG_PCI2_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCI2_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_1M) - -	.long	(CFG_PCIE1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCIE | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCIE1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_PCIE | (LAWAR_SIZE & LAWAR_SIZE_1M) - -	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ -	.long	(CFG_LBC_CACHE_BASE>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M) - -4: -	entry_end diff --git a/board/atum8548/law.c b/board/atum8548/law.c new file mode 100644 index 000000000..3606cbb52 --- /dev/null +++ b/board/atum8548/law.c @@ -0,0 +1,61 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000	   0x7fff_ffff	   DDR			   2G + * 0x8000_0000	   0x9fff_ffff	   PCI1 MEM		   512M + * 0xa000_0000	   0xbfff_ffff	   PCIe MEM		   512M + * 0xc000_0000	   0xdfff_ffff	   PCI2 MEM		   512M + * 0xe000_0000	   0xe000_ffff	   CCSR			   1M + * 0xe200_0000	   0xe10f_ffff	   PCI1 IO		   1M + * 0xe280_0000	   0xe20f_ffff	   PCI2 IO		   1M + * 0xe300_0000	   0xe30f_ffff	   PCIe IO		   1M + * 0xf800_0000	   0xffff_ffff	   FLASH (boot bank)	   128M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + * + * LAW 0 is reserved for boot mapping + */ + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1), +	SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAWAR_SIZE_1M, LAW_TRGT_IF_PCI_1), +	SET_LAW_ENTRY(4, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(6, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(7, CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1), +	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ +	SET_LAW_ENTRY(8, CFG_LBC_CACHE_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/atum8548/tlb.c b/board/atum8548/tlb.c new file mode 100644 index 000000000..bb6ce761a --- /dev/null +++ b/board/atum8548/tlb.c @@ -0,0 +1,90 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* TLB 1 Initializations */ +	/* +	 * TLB 0, 1:	128M	Non-cacheable, guarded +	 * 0xf8000000	128M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x4000000, CFG_FLASH_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 2:	1G	Non-cacheable, guarded +	 * 0x80000000	1G	PCI1/PCIE  8,9,a,b +	 */ +	SET_TLB_ENTRY(1, CFG_PCI_PHYS, CFG_PCI_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_1G, 1), + +	/* +	 * TLB 3, 4:	512M	Non-cacheable, guarded +	 * 0xc0000000	1G	PCI2 +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS, CFG_PCI2_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS + 0x10000000, CFG_PCI2_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	1M	PCI1 IO +	 * 0xe210_0000	1M	PCI2 IO +	 * 0xe300_0000	1M	PCIe IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/atum8548/u-boot.lds b/board/atum8548/u-boot.lds index 0d1c21766..3f04cae3d 100644 --- a/board/atum8548/u-boot.lds +++ b/board/atum8548/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/atum8548/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/atum8548/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index bb91e6726..44c097867 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -28,16 +28,19 @@  #include <linux/ctype.h>  typedef struct { -	unsigned char id[4];		/* 0x0000 - 0x0003 */ -	unsigned char sn[12];		/* 0x0004 - 0x000F */ -	unsigned char errata[5];	/* 0x0010 - 0x0014 */ -	unsigned char date[7];		/* 0x0015 - 0x001a */ -	unsigned char res_1[37];	/* 0x001b - 0x003f */ -	unsigned char tab_size;		/* 0x0040 */ -	unsigned char tab_flag;		/* 0x0041 */ -	unsigned char mac[8][6];	/* 0x0042 - 0x0071 */ -	unsigned char res_2[126];	/* 0x0072 - 0x00ef */ -	unsigned int crc;		/* 0x00f0 - 0x00f3 crc32 checksum */ +	u8 id[4];		/* 0x0000 - 0x0003 EEPROM Tag */ +	u8 sn[12];		/* 0x0004 - 0x000F Serial Number */ +	u8 errata[5];		/* 0x0010 - 0x0014 Errata Level */ +	u8 date[6];		/* 0x0015 - 0x001a Build Date */ +	u8 res_0;		/* 0x001b 	   Reserved */ +	u8 version[4];		/* 0x001c - 0x001f Version */ +	u8 tempcal[8];		/* 0x0020 - 0x0027 Temperature Calibration Factors*/ +	u8 tempcalsys[2]; 	/* 0x0028 - 0x0029 System Temperature Calibration Factors*/ +	u8 res_1[22];		/* 0x0020 - 0x003f Reserved */ +	u8 mac_size;		/* 0x0040 	   Mac table size */ +	u8 mac_flag;		/* 0x0041 	   Mac table flags */ +	u8 mac[8][6];		/* 0x0042 - 0x0071 Mac addresses */ +	u32 crc;		/* 0x0072 	   crc32 checksum */  } EEPROM_data;  static EEPROM_data mac_data; @@ -45,28 +48,57 @@ static EEPROM_data mac_data;  int mac_show(void)  {  	int i; +	u8 mac_size;  	unsigned char ethaddr[8][18]; +	unsigned char enetvar[32]; + +	/* Show EEPROM tagID, +	 * always the four characters 'NXID'. +	 */ +	printf("ID "); +	for (i = 0; i < 4; i++) +		printf("%c", mac_data.id[i]); +	printf("\n"); + +	/* Show Serial number, +	 * 0 to 11 charaters of errata information. +	 */ +	printf("SN "); +	for (i = 0; i < 12; i++) +		printf("%c", mac_data.sn[i]); +	printf("\n"); -	printf("ID %c%c%c%c\n", -	       mac_data.id[0], -	       mac_data.id[1], -	       mac_data.id[2], -	       mac_data.id[3]); -	printf("Errata %c%c%c%c%c\n", -	       mac_data.errata[0], -	       mac_data.errata[1], -	       mac_data.errata[2], -	       mac_data.errata[3], -	       mac_data.errata[4]); -	printf("Date %c%c%c%c%c%c%c\n", +	/* Show Errata Level, +	 * 0 to 4 characters of errata information. +	 */ +	printf("Errata "); +	for (i = 0; i < 5; i++) +		printf("%c", mac_data.errata[i]); +	printf("\n"); + +	/* Show Build Date, +	 * BCD date values, as YYMMDDhhmmss. +	 */ +	printf("Date 20%02x\/%02x\/%02x %02x:%02x:%02x\n",  	       mac_data.date[0],  	       mac_data.date[1],  	       mac_data.date[2],  	       mac_data.date[3],  	       mac_data.date[4], -	       mac_data.date[5], -	       mac_data.date[6]); -	for (i = 0; i < 8; i++) { +	       mac_data.date[5]); + +	/* Show MAC table size, +	 * Value from 0 to 7 indicating how many MAC +	 * addresses are stored in the system EEPROM. +	 */ +	if((mac_data.mac_size > 0) && (mac_data.mac_size <= 8)) +		mac_size = mac_data.mac_size; +	else +		mac_size = 8; /* Set the max size */ +	printf("MACSIZE %x\n", mac_size); + +	/* Show Mac addresses */ +	for (i = 0; i < mac_size; i++) {  		sprintf((char *)ethaddr[i],  			"%02x:%02x:%02x:%02x:%02x:%02x",  			mac_data.mac[i][0], @@ -76,12 +108,12 @@ int mac_show(void)  			mac_data.mac[i][4],  			mac_data.mac[i][5]);  		printf("MAC %d %s\n", i, ethaddr[i]); -	} -	setenv("ethaddr",  (char *)ethaddr[0]); -	setenv("eth1addr", (char *)ethaddr[1]); -	setenv("eth2addr", (char *)ethaddr[2]); -	setenv("eth3addr", (char *)ethaddr[3]); +		sprintf((char *)enetvar, +			i ? "eth%daddr" : "ethaddr", i); +		setenv((char *)enetvar, (char *)ethaddr[i]); + +	}  	return 0;  } @@ -120,17 +152,14 @@ int mac_prog(void)  	unsigned char dev = ID_EEPROM_ADDR, *ptr;  	unsigned char *eeprom_data = (unsigned char *)(&mac_data); -	for (i = 0; i < sizeof(mac_data.res_1); i++) -		mac_data.res_1[i] = 0; -	for (i = 0; i < sizeof(mac_data.res_2); i++) -		mac_data.res_2[i] = 0; +	mac_data.res_0 = 0; +	memset((void *)mac_data.res_1, 0, sizeof(mac_data.res_1)); +  	length = sizeof(EEPROM_data);  	crc = crc32(crc, eeprom_data, length - 4);  	mac_data.crc = crc;  	for (i = 0, ptr = eeprom_data; i < length; i += 8, ptr += 8) { -		ret = -		    i2c_write(dev, i, 1, ptr, -			      (length - i) < 8 ? (length - i) : 8); +		ret = i2c_write(dev, i, 1, ptr, min((length - i),8));  		udelay(5000);	/* 5ms write cycle timing */  		if (ret)  			break; @@ -179,12 +208,13 @@ int do_mac(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])  			}  			break;  		case 'd':	/* date */ -			for (i = 0; i < 7; i++) { -				mac_data.date[i] = argv[2][i]; +			mac_val = simple_strtoull(argv[2], NULL, 16); +			for (i = 0; i < 6; i++) { +				mac_data.date[i] = (mac_val >> (40 - 8 * i));  			}  			break; -		case 'p':	/* number of ports */ -			mac_data.tab_size = +		case 'p':	/* mac table size */ +			mac_data.mac_size =  			    (unsigned char)simple_strtoul(argv[2], NULL, 16);  			break;  		case '0':	/* mac 0 */ diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c index 3d72eb7d8..9f4ac8e41 100644 --- a/board/freescale/mpc8349emds/mpc8349emds.c +++ b/board/freescale/mpc8349emds/mpc8349emds.c @@ -27,6 +27,7 @@  #include <mpc83xx.h>  #include <asm/mpc8349_pci.h>  #include <i2c.h> +#include <spi.h>  #include <spd.h>  #include <miiphy.h>  #if defined(CONFIG_SPD_EEPROM) @@ -251,6 +252,34 @@ void sdram_init(void)  }  #endif +/* + * The following are used to control the SPI chip selects for the SPI command. + */ +#ifdef CONFIG_HARD_SPI + +#define SPI_CS_MASK	0x80000000 + +void spi_eeprom_chipsel(int cs) +{ +	volatile gpio83xx_t *iopd = &((immap_t *)CFG_IMMR)->gpio[0]; + +	if (cs) +		iopd->dat &= ~SPI_CS_MASK; +	else +		iopd->dat |=  SPI_CS_MASK; +} + +/* + * The SPI command uses this table of functions for controlling the SPI + * chip selects. + */ +spi_chipsel_type spi_chipsel[] = { +	spi_eeprom_chipsel, +}; +int spi_chipsel_cnt = sizeof(spi_chipsel) / sizeof(spi_chipsel[0]); + +#endif /* CONFIG_HARD_SPI */ +  #if defined(CONFIG_OF_BOARD_SETUP)  void ft_board_setup(void *blob, bd_t *bd)  { diff --git a/board/freescale/mpc8540ads/Makefile b/board/freescale/mpc8540ads/Makefile index 29136508f..be243885b 100644 --- a/board/freescale/mpc8540ads/Makefile +++ b/board/freescale/mpc8540ads/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/freescale/mpc8540ads/init.S b/board/freescale/mpc8540ads/init.S deleted file mode 100644 index 74d71c632..000000000 --- a/board/freescale/mpc8540ads/init.S +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4*1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4*1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8*1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8*1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12*1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12*1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	16K	Non-cacheable, guarded -	 * 0xf8000000	16K	BCSR registers -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16K) -	.long FSL_BOOKE_MAS2(CFG_BCSR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BCSR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	/* -	 * TLB 8, 9:	128M	DDR -	 * 0x00000000	64M	DDR System memory -	 * 0x04000000	64M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ -#error("Update the number of table entries in tlb1_entry") -	.long FSL_BOOKE_MAS0(1, 8, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1, 9, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE + 0x4000000, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE + 0x4000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     BCSR                    1M - * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* - * This is not so much the SDRAM map as it is the whole localbus map. - */ -#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/freescale/mpc8540ads/law.c b/board/freescale/mpc8540ads/law.c new file mode 100644 index 000000000..785576a35 --- /dev/null +++ b/board/freescale/mpc8540ads/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     BCSR                    1M + * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	/* This is not so much the SDRAM map as it is the whole localbus map. */ +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8540ads/tlb.c b/board/freescale/mpc8540ads/tlb.c new file mode 100644 index 000000000..3eaff013f --- /dev/null +++ b/board/freescale/mpc8540ads/tlb.c @@ -0,0 +1,130 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	16K	Non-cacheable, guarded +	 * 0xf8000000	16K	BCSR registers +	 */ +	SET_TLB_ENTRY(1, CFG_BCSR, CFG_BCSR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_16K, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	/* +	 * TLB 8, 9:	128M	DDR +	 * 0x00000000	64M	DDR System memory +	 * 0x04000000	64M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ +#error("Update the number of table entries in tlb1_entry") +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 8, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x4000000, CFG_DDR_SDRAM_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 9, BOOKE_PAGESZ_64M, 1), +#endif +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8540ads/u-boot.lds b/board/freescale/mpc8540ads/u-boot.lds index bc0db5514..86f8f1359 100644 --- a/board/freescale/mpc8540ads/u-boot.lds +++ b/board/freescale/mpc8540ads/u-boot.lds @@ -35,7 +35,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8540ads/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -65,7 +64,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8540ads/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/mpc8541cds/Makefile b/board/freescale/mpc8541cds/Makefile index 7f5309885..d1a585ad6 100644 --- a/board/freescale/mpc8541cds/Makefile +++ b/board/freescale/mpc8541cds/Makefile @@ -29,14 +29,12 @@ endif  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o \ +COBJS	:= $(BOARD).o law.o tlb.o \  	   ../common/cadmus.o \  	   ../common/eeprom.o \  	   ../common/ft_board.o \  	   ../common/via.o -SOBJS	:= init.o -  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS))  SOBJS	:= $(addprefix $(obj),$(SOBJS)) diff --git a/board/freescale/mpc8541cds/init.S b/board/freescale/mpc8541cds/init.S deleted file mode 100644 index 8c8c087c4..000000000 --- a/board/freescale/mpc8541cds/init.S +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xa0000000	256M	PCI2 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xb0000000	256M	PCI2 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 * 0xe300_0000	16M	PCI2 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	1M	Non-cacheable, guarded -	 * 0xf8000000	1M	CADMUS registers -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CADMUS_BASE_ADDR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CADMUS_BASE_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe20f_ffff     PCI1 IO                 1M - * 0xe210_0000     0xe21f_ffff     PCI2 IO                 1M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M - * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M - * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * The defines below are 1-off of the actual LAWAR0 usage. - * So LAWAR3 define uses the LAWAR4 register in the ECM. - */ - -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_PCI2_MEM_BASE>>12) & 0xfffff) -#define LAWAR2 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -#define LAWBAR4 ((CFG_PCI2_IO_PHYS>>12) & 0xfffff) -#define LAWAR4 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ -#define LAWBAR5 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR5 	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -	.section .bootpg, "ax" -	.globl	law_entry - -law_entry: -	entry_start -	.long 6 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4,LAWBAR5,LAWAR5 -	entry_end diff --git a/board/freescale/mpc8541cds/law.c b/board/freescale/mpc8541cds/law.c new file mode 100644 index 000000000..0ac223c53 --- /dev/null +++ b/board/freescale/mpc8541cds/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe20f_ffff     PCI1 IO                 1M + * 0xe210_0000     0xe21f_ffff     PCI2 IO                 1M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M + * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M + * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2), +	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ +	SET_LAW_ENTRY(6, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8541cds/tlb.c b/board/freescale/mpc8541cds/tlb.c new file mode 100644 index 000000000..92f759b31 --- /dev/null +++ b/board/freescale/mpc8541cds/tlb.c @@ -0,0 +1,112 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xa0000000	256M	PCI2 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS, CFG_PCI2_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xb0000000	256M	PCI2 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS + 0x10000000, CFG_PCI2_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 * 0xe300_0000	16M	PCI2 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	1M	Non-cacheable, guarded +	 * 0xf8000000	1M	CADMUS registers +	 */ +	SET_TLB_ENTRY(1, CADMUS_BASE_ADDR, CADMUS_BASE_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_1M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8541cds/u-boot.lds b/board/freescale/mpc8541cds/u-boot.lds index 1e490d04a..1cbadf223 100644 --- a/board/freescale/mpc8541cds/u-boot.lds +++ b/board/freescale/mpc8541cds/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8541cds/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8541cds/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/mpc8544ds/Makefile b/board/freescale/mpc8544ds/Makefile index c6f159ac8..53368b22b 100644 --- a/board/freescale/mpc8544ds/Makefile +++ b/board/freescale/mpc8544ds/Makefile @@ -26,9 +26,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o - -SOBJS	:= init.o +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/freescale/mpc8544ds/init.S b/board/freescale/mpc8544ds/init.S deleted file mode 100644 index 544dc07c8..000000000 --- a/board/freescale/mpc8544ds/init.S +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2007 Freescale Semiconductor, Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1	;	\ -	bl	0f	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long (2f-1f)/16 -1: -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB0		16K	Cacheable, guarded -	 * Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	64M	Non-cacheable, guarded -	 * 0xfc000000	64M	Covers FLASH at 0xFE800000 and 0xFF800000 -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_BOOT_BLOCK, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BOOT_BLOCK, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	1G	Non-cacheable, guarded -	 * 0x80000000	1G	PCIE  8,9,a,b -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1G) -	.long FSL_BOOKE_MAS2(CFG_PCIE_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCIE_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI_PHYS + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_PHYS + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe100_0000	255M	PCI IO range -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#ifdef CFG_LBC_CACHE_BASE -	/* -	 * TLB 5:	64M	Cacheable, non-guarded -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_CACHE_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_CACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif -	/* -	 * TLB 6:	64M	Non-cacheable, guarded -	 * 0xf8000000	64M	PIXIS 0xF8000000 - 0xFBFFFFFF -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_NONCACHE_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_LBC_NONCACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -2: -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * LAW 0 is reserved for boot mapping - */ - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start - -	.long (4f-3f)/8 -3: -	.long	0 -	.long	(LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN - -	.long	(CFG_PCI1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCI1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_64K) - -	.long	(CFG_LBC_CACHE_BASE>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M) - -	.long	(CFG_PCIE1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_256M) - -	.long	(CFG_PCIE1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_64K) - -	.long	(CFG_PCIE2_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE2 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCIE2_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE2 | (LAWAR_SIZE & LAWAR_SIZE_64K) - -	/* contains both PCIE3 MEM & IO space */ -	.long	(CFG_PCIE3_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE3 | (LAWAR_SIZE & LAWAR_SIZE_4M) -4: -	entry_end diff --git a/board/freescale/mpc8544ds/law.c b/board/freescale/mpc8544ds/law.c new file mode 100644 index 000000000..433e509fc --- /dev/null +++ b/board/freescale/mpc8544ds/law.c @@ -0,0 +1,42 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(4, CFG_LBC_CACHE_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(5, CFG_PCIE1_MEM_PHYS, LAWAR_SIZE_256M, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(6, CFG_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(7, CFG_PCIE2_MEM_PHYS, LAWAR_SIZE_512M, LAW_TRGT_IF_PCIE_2), +	SET_LAW_ENTRY(8, CFG_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2), +	/* contains both PCIE3 MEM & IO space */ +	SET_LAW_ENTRY(9, CFG_PCIE3_MEM_PHYS, LAW_SIZE_4M, LAW_TRGT_IF_PCIE_3), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8544ds/tlb.c b/board/freescale/mpc8544ds/tlb.c new file mode 100644 index 000000000..34cfb38f0 --- /dev/null +++ b/board/freescale/mpc8544ds/tlb.c @@ -0,0 +1,99 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	/* +	 * TLB 0:	64M	Non-cacheable, guarded +	 * 0xfc000000	64M	Covers FLASH at 0xFE800000 and 0xFF800000 +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_BOOT_BLOCK, CFG_BOOT_BLOCK, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_64M, 1), +	/* +	 * TLB 1:	1G	Non-cacheable, guarded +	 * 0x80000000	1G	PCIE  8,9,a,b +	 */ +	SET_TLB_ENTRY(1, CFG_PCIE_PHYS, CFG_PCIE_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_1G, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 */ +	SET_TLB_ENTRY(1, CFG_PCI_PHYS, CFG_PCI_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 */ +	SET_TLB_ENTRY(1, CFG_PCI_PHYS + 0x10000000, CFG_PCI_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe100_0000	255M	PCI IO range +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_64M, 1), + +#ifdef CFG_LBC_CACHE_BASE +	/* +	 * TLB 5:	64M	Cacheable, non-guarded +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_CACHE_BASE, CFG_LBC_CACHE_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 5, BOOKE_PAGESZ_64M, 1), +#endif +	/* +	 * TLB 6:	64M	Non-cacheable, guarded +	 * 0xf8000000	64M	PIXIS 0xF8000000 - 0xFBFFFFFF +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_NONCACHE_BASE, CFG_LBC_NONCACHE_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 6, BOOKE_PAGESZ_64M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8544ds/u-boot.lds b/board/freescale/mpc8544ds/u-boot.lds index 66bd4b6df..17db8c0cc 100644 --- a/board/freescale/mpc8544ds/u-boot.lds +++ b/board/freescale/mpc8544ds/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8544ds/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8544ds/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/mpc8548cds/Makefile b/board/freescale/mpc8548cds/Makefile index 7f5309885..d1a585ad6 100644 --- a/board/freescale/mpc8548cds/Makefile +++ b/board/freescale/mpc8548cds/Makefile @@ -29,14 +29,12 @@ endif  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o \ +COBJS	:= $(BOARD).o law.o tlb.o \  	   ../common/cadmus.o \  	   ../common/eeprom.o \  	   ../common/ft_board.o \  	   ../common/via.o -SOBJS	:= init.o -  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS))  SOBJS	:= $(addprefix $(obj),$(SOBJS)) diff --git a/board/freescale/mpc8548cds/init.S b/board/freescale/mpc8548cds/init.S deleted file mode 100644 index ed0fc4493..000000000 --- a/board/freescale/mpc8548cds/init.S +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2004, 2007 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1	;	\ -	bl	0f	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long (2f-1f)/16 - -1: -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, guarded -	 * Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, (MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_BOOT_BLOCK, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BOOT_BLOCK, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	1G	Non-cacheable, guarded -	 * 0x80000000	1G	PCI1/PCIE  8,9,a,b -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1G) -	.long FSL_BOOKE_MAS2(CFG_PCI_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_PHYS, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#ifdef CFG_RIO_MEM_PHYS -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_PHYS, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_PHYS,	0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_PHYS + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_PHYS + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	1M	PCI1 IO -	 * 0xe210_0000	1M	PCI2 IO -	 * 0xe300_0000	1M	PCIe IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_CACHE_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_CACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	64M	Non-cacheable, guarded -	 * 0xf8000000	64M	CADMUS registers, relocated L2SRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_NONCACHE_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_LBC_NONCACHE_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -2: -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xa000_0000     0xbfff_ffff     PCIe MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe10f_ffff     PCI1 IO                 1M - * 0xe280_0000     0xe20f_ffff     PCI2 IO                 1M - * 0xe300_0000     0xe30f_ffff     PCIe IO                 1M - * 0xf000_0000     0xf3ff_ffff     SDRAM                   64M - * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M - * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M - * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * LAW 0 is reserved for boot mapping - */ - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start - -	.long (4f-3f)/8 -3: -	.long  0 -	.long  (LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN - -#ifdef CFG_PCI1_MEM_PHYS -	.long	(CFG_PCI1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCI1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_1M) -#endif - -#ifdef CFG_PCI2_MEM_PHYS -	.long	(CFG_PCI2_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCI2_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_1M) -#endif - -#ifdef CFG_PCIE1_MEM_PHYS -	.long	(CFG_PCIE1_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_512M) - -	.long	(CFG_PCIE1_IO_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_1M) -#endif - -	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ -	.long	(CFG_LBC_CACHE_BASE>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M) - -#ifdef CFG_RIO_MEM_PHYS -	.long	(CFG_RIO_MEM_PHYS>>12) & 0xfffff -	.long	LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M) -#endif -4: -	entry_end diff --git a/board/freescale/mpc8548cds/law.c b/board/freescale/mpc8548cds/law.c new file mode 100644 index 000000000..0ee53e2c1 --- /dev/null +++ b/board/freescale/mpc8548cds/law.c @@ -0,0 +1,73 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xa000_0000     0xbfff_ffff     PCIe MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe10f_ffff     PCI1 IO                 1M + * 0xe280_0000     0xe20f_ffff     PCI2 IO                 1M + * 0xe300_0000     0xe30f_ffff     PCIe IO                 1M + * 0xf000_0000     0xf3ff_ffff     SDRAM                   64M + * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M + * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M + * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + * + * LAW 0 is reserved for boot mapping + */ + +struct law_entry law_table[] = { +#ifdef CFG_PCI1_MEM_PHYS +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI), +#endif +#ifdef CFG_PCI2_MEM_PHYS +	SET_LAW_ENTRY(4, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2), +#endif +#ifdef CFG_PCIE1_MEM_PHYS +	SET_LAW_ENTRY(6, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(7, CFG_PCIE1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCIE_1), +#endif +	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ +	SET_LAW_ENTRY(8, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +#ifdef CFG_RIO_MEM_PHYS +	SET_LAW_ENTRY(9, CFG_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO), +#endif +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8548cds/tlb.c b/board/freescale/mpc8548cds/tlb.c new file mode 100644 index 000000000..b21f71bd1 --- /dev/null +++ b/board/freescale/mpc8548cds/tlb.c @@ -0,0 +1,104 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_BOOT_BLOCK, CFG_BOOT_BLOCK, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	1G	Non-cacheable, guarded +	 * 0x80000000	1G	PCI1/PCIE  8,9,a,b +	 */ +	SET_TLB_ENTRY(1, CFG_PCI_PHYS, CFG_PCI_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_1G, 1), + +#ifdef CFG_RIO_MEM_PHYS +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), +#endif +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	1M	PCI1 IO +	 * 0xe210_0000	1M	PCI2 IO +	 * 0xe300_0000	1M	PCIe IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_CACHE_BASE, CFG_LBC_CACHE_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	64M	Non-cacheable, guarded +	 * 0xf8000000	64M	CADMUS registers, relocated L2SRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_NONCACHE_BASE, CFG_LBC_NONCACHE_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_64M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8548cds/u-boot.lds b/board/freescale/mpc8548cds/u-boot.lds index acf25e344..d701096f1 100644 --- a/board/freescale/mpc8548cds/u-boot.lds +++ b/board/freescale/mpc8548cds/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8548cds/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8548cds/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/mpc8555cds/Makefile b/board/freescale/mpc8555cds/Makefile index 7f5309885..d1a585ad6 100644 --- a/board/freescale/mpc8555cds/Makefile +++ b/board/freescale/mpc8555cds/Makefile @@ -29,14 +29,12 @@ endif  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o \ +COBJS	:= $(BOARD).o law.o tlb.o \  	   ../common/cadmus.o \  	   ../common/eeprom.o \  	   ../common/ft_board.o \  	   ../common/via.o -SOBJS	:= init.o -  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS))  SOBJS	:= $(addprefix $(obj),$(SOBJS)) diff --git a/board/freescale/mpc8555cds/init.S b/board/freescale/mpc8555cds/init.S deleted file mode 100644 index 8c8c087c4..000000000 --- a/board/freescale/mpc8555cds/init.S +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xa0000000	256M	PCI2 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xb0000000	256M	PCI2 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 * 0xe300_0000	16M	PCI2 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	1M	Non-cacheable, guarded -	 * 0xf8000000	1M	CADMUS registers -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CADMUS_BASE_ADDR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CADMUS_BASE_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe20f_ffff     PCI1 IO                 1M - * 0xe210_0000     0xe21f_ffff     PCI2 IO                 1M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M - * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M - * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * The defines below are 1-off of the actual LAWAR0 usage. - * So LAWAR3 define uses the LAWAR4 register in the ECM. - */ - -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_PCI2_MEM_BASE>>12) & 0xfffff) -#define LAWAR2 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -#define LAWBAR4 ((CFG_PCI2_IO_PHYS>>12) & 0xfffff) -#define LAWAR4 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ -#define LAWBAR5 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR5 	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -	.section .bootpg, "ax" -	.globl	law_entry - -law_entry: -	entry_start -	.long 6 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4,LAWBAR5,LAWAR5 -	entry_end diff --git a/board/freescale/mpc8555cds/law.c b/board/freescale/mpc8555cds/law.c new file mode 100644 index 000000000..0ac223c53 --- /dev/null +++ b/board/freescale/mpc8555cds/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe20f_ffff     PCI1 IO                 1M + * 0xe210_0000     0xe21f_ffff     PCI2 IO                 1M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     NVRAM/CADMUS (*)        1M + * 0xff00_0000     0xff7f_ffff     FLASH (2nd bank)        8M + * 0xff80_0000     0xffff_ffff     FLASH (boot bank)       8M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI_2), +	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ +	SET_LAW_ENTRY(6, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8555cds/tlb.c b/board/freescale/mpc8555cds/tlb.c new file mode 100644 index 000000000..92f759b31 --- /dev/null +++ b/board/freescale/mpc8555cds/tlb.c @@ -0,0 +1,112 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xa0000000	256M	PCI2 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS, CFG_PCI2_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xb0000000	256M	PCI2 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS + 0x10000000, CFG_PCI2_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 * 0xe300_0000	16M	PCI2 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	1M	Non-cacheable, guarded +	 * 0xf8000000	1M	CADMUS registers +	 */ +	SET_TLB_ENTRY(1, CADMUS_BASE_ADDR, CADMUS_BASE_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_1M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8555cds/u-boot.lds b/board/freescale/mpc8555cds/u-boot.lds index e9fa51ea6..1cbadf223 100644 --- a/board/freescale/mpc8555cds/u-boot.lds +++ b/board/freescale/mpc8555cds/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8555cds/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8555cds/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/freescale/mpc8560ads/Makefile b/board/freescale/mpc8560ads/Makefile index 29136508f..be243885b 100644 --- a/board/freescale/mpc8560ads/Makefile +++ b/board/freescale/mpc8560ads/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/freescale/mpc8560ads/init.S b/board/freescale/mpc8560ads/init.S deleted file mode 100644 index 37fd0c6f4..000000000 --- a/board/freescale/mpc8560ads/init.S +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	16K	Non-cacheable, guarded -	 * 0xf8000000	16K	BCSR registers -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16K) -	.long FSL_BOOKE_MAS2(CFG_BCSR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BCSR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	/* -	 * TLB 8, 9:	128M	DDR -	 * 0x00000000	64M	DDR System memory -	 * 0x04000000	64M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ -#error("Update the number of table entries in tlb1_entry") -	.long FSL_BOOKE_MAS0(1, 8, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1, 9, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE + 0x4000000, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE + 0x4000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     BCSR                    1M - * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* - * This is not so much the SDRAM map as it is the whole localbus map. - */ -#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_1M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/freescale/mpc8560ads/law.c b/board/freescale/mpc8560ads/law.c new file mode 100644 index 000000000..785576a35 --- /dev/null +++ b/board/freescale/mpc8560ads/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     BCSR                    1M + * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	/* This is not so much the SDRAM map as it is the whole localbus map. */ +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8560ads/tlb.c b/board/freescale/mpc8560ads/tlb.c new file mode 100644 index 000000000..3eaff013f --- /dev/null +++ b/board/freescale/mpc8560ads/tlb.c @@ -0,0 +1,130 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	16K	Non-cacheable, guarded +	 * 0xf8000000	16K	BCSR registers +	 */ +	SET_TLB_ENTRY(1, CFG_BCSR, CFG_BCSR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_16K, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	/* +	 * TLB 8, 9:	128M	DDR +	 * 0x00000000	64M	DDR System memory +	 * 0x04000000	64M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ +#error("Update the number of table entries in tlb1_entry") +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 8, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x4000000, CFG_DDR_SDRAM_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 9, BOOKE_PAGESZ_64M, 1), +#endif +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8560ads/u-boot.lds b/board/freescale/mpc8560ads/u-boot.lds index 96af2b157..e2474e562 100644 --- a/board/freescale/mpc8560ads/u-boot.lds +++ b/board/freescale/mpc8560ads/u-boot.lds @@ -35,7 +35,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/freescale/mpc8560ads/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -65,7 +64,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8560ads/init.o (.text)      cpu/mpc85xx/commproc.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text) diff --git a/board/freescale/mpc8568mds/Makefile b/board/freescale/mpc8568mds/Makefile index 643fbc041..d9f20f96f 100644 --- a/board/freescale/mpc8568mds/Makefile +++ b/board/freescale/mpc8568mds/Makefile @@ -29,9 +29,7 @@ endif  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o bcsr.o - -SOBJS	:= init.o +COBJS	:= $(BOARD).o bcsr.o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/freescale/mpc8568mds/init.S b/board/freescale/mpc8568mds/init.S deleted file mode 100644 index 2748c51f3..000000000 --- a/board/freescale/mpc8568mds/init.S +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2004-2007 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ -#define	entry_start \ -	mflr	r1	;	\ -	bl	0f	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long (2f-1f)/16 - -1: -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* TLB 1 Initializations */ -	/* -	 * TLBe 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH (upper half) -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE + 0x1000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE + 0x1000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLBe 1:	16M	Non-cacheable, guarded -	 * 0xfe000000	16M	FLASH (lower half) -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLBe 2:	1G	Non-cacheable, guarded -	 * 0x80000000	512M	PCI1 MEM -	 * 0xa0000000 	512M	PCIe MEM -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_1G) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLBe 3:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	8M	PCI1 IO -	 * 0xe280_0000	8M	PCIe IO -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLBe 4:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLBe 5:	256K	Non-cacheable, guarded -	 * 0xf8000000	32K BCSR -	 * 0xf8008000	32K PIB (CS4) -	 * 0xf8010000	32K PIB (CS5) -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256K) -	.long FSL_BOOKE_MAS2(CFG_BCSR_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BCSR_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -2: -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - *0)   0x0000_0000   0x7fff_ffff     DDR                     2G - *1)   0x8000_0000   0x9fff_ffff     PCI1 MEM                512MB - *2)   0xa000_0000   0xbfff_ffff     PCIe MEM                512MB - *-)   0xe000_0000   0xe00f_ffff     CCSR                    1M - *3)   0xe200_0000   0xe27f_ffff     PCI1 I/O                8M - *4)   0xe280_0000   0xe2ff_ffff     PCIe I/O                8M - *5)   0xc000_0000   0xdfff_ffff     SRIO                    512MB - *6.a) 0xf000_0000   0xf3ff_ffff     SDRAM                   64MB - *6.b) 0xf800_0000   0xf800_7fff     BCSR                    32KB - *6.c) 0xf800_8000   0xf800_ffff     PIB (CS4)		     32KB - *6.d) 0xf801_0000   0xf801_7fff     PIB (CS5)		     32KB - *6.e) 0xfe00_0000   0xffff_ffff     Flash                   32MB - * - *Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - * - * The defines below are 1-off of the actual LAWAR0 usage. - * So LAWAR3 define uses the LAWAR4 register in the ECM. - */ - -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_PCIE1_MEM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_8M)) - -#define LAWBAR4 ((CFG_PCIE1_IO_PHYS>>12) & 0xfffff) -#define LAWAR4  (LAWAR_EN | LAWAR_TRGT_IF_PCIE1 | (LAWAR_SIZE & LAWAR_SIZE_8M)) - -#define LAWBAR5 ((CFG_SRIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR5	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* LBC window - maps 256M.  That's SDRAM, BCSR, PIBs, and Flash */ -#define LAWBAR6 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR6	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -	.section .bootpg, "ax" -	.globl	law_entry - -law_entry: -	entry_start -	.long (4f-3f)/8 -3: -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4,LAWBAR5,LAWAR5,LAWBAR6,LAWAR6 -4: -	entry_end diff --git a/board/freescale/mpc8568mds/law.c b/board/freescale/mpc8568mds/law.c new file mode 100644 index 000000000..5e96ea73a --- /dev/null +++ b/board/freescale/mpc8568mds/law.c @@ -0,0 +1,62 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + *0)   0x0000_0000   0x7fff_ffff     DDR                     2G + *1)   0x8000_0000   0x9fff_ffff     PCI1 MEM                512MB + *2)   0xa000_0000   0xbfff_ffff     PCIe MEM                512MB + *-)   0xe000_0000   0xe00f_ffff     CCSR                    1M + *3)   0xe200_0000   0xe27f_ffff     PCI1 I/O                8M + *4)   0xe280_0000   0xe2ff_ffff     PCIe I/O                8M + *5)   0xc000_0000   0xdfff_ffff     SRIO                    512MB + *6.a) 0xf000_0000   0xf3ff_ffff     SDRAM                   64MB + *6.b) 0xf800_0000   0xf800_7fff     BCSR                    32KB + *6.c) 0xf800_8000   0xf800_ffff     PIB (CS4)		     32KB + *6.d) 0xf801_0000   0xf801_7fff     PIB (CS5)		     32KB + *6.e) 0xfe00_0000   0xffff_ffff     Flash                   32MB + * + *Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + * + */ + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_PCIE1_IO_PHYS, LAW_SIZE_8M, LAW_TRGT_IF_PCIE_1), +	SET_LAW_ENTRY(6, CFG_SRIO_MEM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_RIO), +	/* LBC window - maps 256M.  That's SDRAM, BCSR, PIBs, and Flash */ +	SET_LAW_ENTRY(7, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/freescale/mpc8568mds/tlb.c b/board/freescale/mpc8568mds/tlb.c new file mode 100644 index 000000000..225fc9465 --- /dev/null +++ b/board/freescale/mpc8568mds/tlb.c @@ -0,0 +1,100 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* TLB 1 Initializations */ +	/* +	 * TLBe 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH (upper half) +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x1000000, CFG_FLASH_BASE + 0x1000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLBe 1:	16M	Non-cacheable, guarded +	 * 0xfe000000	16M	FLASH (lower half) +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLBe 2:	1G	Non-cacheable, guarded +	 * 0x80000000	512M	PCI1 MEM +	 * 0xa0000000 	512M	PCIe MEM +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_1G, 1), + +	/* +	 * TLBe 3:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	8M	PCI1 IO +	 * 0xe280_0000	8M	PCIe IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLBe 4:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 4, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLBe 5:	256K	Non-cacheable, guarded +	 * 0xf8000000	32K BCSR +	 * 0xf8008000	32K PIB (CS4) +	 * 0xf8010000	32K PIB (CS5) +	 */ +	SET_TLB_ENTRY(1, CFG_BCSR_BASE, CFG_BCSR_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_256K, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/freescale/mpc8568mds/u-boot.lds b/board/freescale/mpc8568mds/u-boot.lds index 7917409c1..6b30f1551 100644 --- a/board/freescale/mpc8568mds/u-boot.lds +++ b/board/freescale/mpc8568mds/u-boot.lds @@ -37,7 +37,6 @@ SECTIONS    .bootpg 0xFFFFF000:    {  	cpu/mpc85xx/start.o	(.bootpg) -	board/freescale/mpc8568mds/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -67,7 +66,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/freescale/mpc8568mds/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/mpc8540eval/Makefile b/board/mpc8540eval/Makefile index d649c60af..28d6cb997 100644 --- a/board/mpc8540eval/Makefile +++ b/board/mpc8540eval/Makefile @@ -25,10 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o flash.o -#COBJS	:= $(BOARD).o flash.o $(BOARD)_slave.o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o flash.o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/mpc8540eval/init.S b/board/mpc8540eval/init.S deleted file mode 100644 index a8ac3fb8c..000000000 --- a/board/mpc8540eval/init.S +++ /dev/null @@ -1,178 +0,0 @@ -/* -* 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 - -	.long 0x0a	/* the following data table uses a few of 16 TLB entries */ - -	.long FSL_BOOKE_MAS0(1,1,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -  #if defined(CFG_FLASH_PORT_WIDTH_16) -	.long FSL_BOOKE_MAS0(1,2,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_4M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,3,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_4M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE+0x400000,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE+0x400000,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #else -	.long FSL_BOOKE_MAS0(1,2,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,3,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #endif - -  #if !defined(CONFIG_SPD_EEPROM) -	.long FSL_BOOKE_MAS0(1,4,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE,0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,5,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE+0x4000000,0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE+0x4000000,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #else -	.long FSL_BOOKE_MAS0(1,4,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,5,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #endif - -	.long FSL_BOOKE_MAS0(1,6,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_64M) -  #if defined(CONFIG_RAM_AS_FLASH) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE,(MAS2_I|MAS2_G)) -  #else -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE,0) -  #endif -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,7,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_16K) -  #ifdef CONFIG_L2_INIT_RAM -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR,0,0,0,1,0,0,0,0) -  #else -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR,0) -  #endif -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,8,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI_MEM_BASE,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_MEM_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,9,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_16K) -	.long FSL_BOOKE_MAS2(CFG_BCSR,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_BCSR,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -  #if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	.long FSL_BOOKE_MAS0(1,15,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #else -	.long FSL_BOOKE_MAS0(1,15,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -  #endif -	entry_end - -/* LAW(Local Access Window) configuration: - * 0000_0000-0800_0000: DDR(128M) -or- larger - * 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-fdef_ffff: LBC BCSR,RTC,etc(31M) - *   fdf0_0000-fdff_ffff: CCSRBAR(1M) - *   fe00_0000-ffff_ffff: Flash(32M) - * Note: CCSRBAR and L2-as-SRAM don't need configure Local Access - *       Window. - * Note: If flash is 8M at default position(last 8M),no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0 	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#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 diff --git a/board/mpc8540eval/law.c b/board/mpc8540eval/law.c new file mode 100644 index 000000000..273ec5c06 --- /dev/null +++ b/board/mpc8540eval/law.c @@ -0,0 +1,54 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* LAW(Local Access Window) configuration: + * 0000_0000-0800_0000: DDR(128M) -or- larger + * 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-fdef_ffff: LBC BCSR,RTC,etc(31M) + *   fdf0_0000-fdff_ffff: CCSRBAR(1M) + *   fe00_0000-ffff_ffff: Flash(32M) + * Note: CCSRBAR and L2-as-SRAM don't need configure Local Access + *       Window. + * Note: If flash is 8M at default position(last 8M),no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI), +#ifndef CONFIG_RAM_AS_FLASH +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC), +#endif +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/mpc8540eval/tlb.c b/board/mpc8540eval/tlb.c new file mode 100644 index 000000000..f04123636 --- /dev/null +++ b/board/mpc8540eval/tlb.c @@ -0,0 +1,78 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_1M, 1), + +  #if defined(CFG_FLASH_PORT_WIDTH_16) +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_4M, 1), +	SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x400000, CFG_FLASH_BASE + 0x400000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_4M, 1), +  #else +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_16M, 1), +  #endif + +  #if !defined(CONFIG_SPD_EEPROM) +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 4, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x4000000, CFG_DDR_SDRAM_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 5, BOOKE_PAGESZ_64M, 1), +  #endif + +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +  #if defined(CONFIG_RAM_AS_FLASH) +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +  #else +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +  #endif +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 7, BOOKE_PAGESZ_16K, 1), + +	SET_TLB_ENTRY(1, CFG_PCI_MEM_PHYS, CFG_PCI_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 8, BOOKE_PAGESZ_256M, 1), + +	SET_TLB_ENTRY(1, CFG_BCSR, CFG_BCSR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 9, BOOKE_PAGESZ_16K, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/mpc8540eval/u-boot.lds b/board/mpc8540eval/u-boot.lds index 4b342c7fb..9bbba3046 100644 --- a/board/mpc8540eval/u-boot.lds +++ b/board/mpc8540eval/u-boot.lds @@ -56,7 +56,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/mpc8540eval/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) @@ -143,7 +142,6 @@ SECTIONS    .bootpg   :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/mpc8540eval/init.o (.bootpg)    } = 0xffff    . = (. & 0xFFF80000) + 0x0007FFFC; diff --git a/board/ms7720se/Makefile b/board/ms7720se/Makefile new file mode 100644 index 000000000..d1af93700 --- /dev/null +++ b/board/ms7720se/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2007 +# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> +# +# Copyright (C) 2007 +# Nobuhiro Iwamatsu <iwamatsu@nigauri.org> +# +# Copyright (C) 2007 +# Kenati Technologies, Inc. +# +# board/ms7720se/Makefile +# +# 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	:= ms7720se.o +SOBJS	:= lowlevel_init.o + +$(LIB):	$(OBJS) $(SOBJS) +	$(AR) crv $@ $(OBJS) $(SOBJS) + +clean: +	rm -f $(SOBJS) $(OBJS) + +distclean:	clean +	rm -f $(LIB) core *.bak .depend + +######################################################################### + +.depend:	Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) +		$(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@ + +-include .depend + +######################################################################### diff --git a/board/ms7720se/config.mk b/board/ms7720se/config.mk new file mode 100644 index 000000000..cad8d3a36 --- /dev/null +++ b/board/ms7720se/config.mk @@ -0,0 +1,34 @@ +# +# Copyright (C) 2007 +# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> +# +# Copyright (C) 2007 +# Nobuhiro Iwamatsu <iwamatsu@nigauri.org> +# +# Copyright (C) 2007 +# Kenati Technologies, Inc. +# +# board/ms7720se/config.mk +# +# 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 refers to image _after_ relocation. +# +# NOTE: Must match value used in u-boot.lds (in this directory). +# + +TEXT_BASE = 0x8FFC0000 diff --git a/board/ms7720se/lowlevel_init.S b/board/ms7720se/lowlevel_init.S new file mode 100644 index 000000000..dcb77ef26 --- /dev/null +++ b/board/ms7720se/lowlevel_init.S @@ -0,0 +1,268 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +	.global	lowlevel_init + +	.text +	.align	2 + +lowlevel_init: + +	mov.l	WTCSR_A,r1 +	mov.l	WTCSR_D,r0 +	mov.w	r0,@r1 + +	mov.l	WTCNT_A,r1 +	mov.l	WTCNT_D,r0 +	mov.w	r0,@r1 + +	mov.l	FRQCR_A,r1 +	mov.l	FRQCR_D,r0 +	mov.w	r0,@r1 + +	mov.l	UCLKCR_A,r1 +	mov.l	UCLKCR_D,r0 +	mov.w	r0,@r1 + +	mov.l	CMNCR_A, r1 +	mov.l	CMNCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS0BCR_A, r1 +	mov.l	CS0BCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS2BCR_A, r1 +	mov.l	CS2BCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS3BCR_A, r1 +	mov.l	CS3BCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS4BCR_A, r1 +	mov.l	CS4BCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS5ABCR_A, r1 +	mov.l	CS5ABCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS5BBCR_A, r1 +	mov.l	CS5BBCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS6ABCR_A, r1 +	mov.l	CS6ABCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS6BBCR_A, r1 +	mov.l	CS6BBCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS0WCR_A, r1 +	mov.l	CS0WCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS2WCR_A, r1 +	mov.l	CS2WCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS3WCR_A, r1 +	mov.l	CS3WCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS4WCR_A, r1 +	mov.l	CS4WCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS5AWCR_A, r1 +	mov.l	CS5AWCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS5BWCR_A, r1 +	mov.l	CS5BWCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS6AWCR_A, r1 +	mov.l	CS6AWCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	CS6BWCR_A, r1 +	mov.l	CS6BWCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	SDCR_A, r1 +	mov.l	SDCR_D1, r0 +	mov.l	r0, @r1 + +	mov.l	RTCSR_A, r1 +	mov.l	RTCSR_D, r0 +	mov.l	r0, @r1 + +	mov.l	RTCNT_A, r1 +	mov.l	RTCNT_D, r0 +	mov.l	r0, @r1 + +	mov.l	RTCOR_A, r1 +	mov.l	RTCOR_D, r0 +	mov.l	r0, @r1 + +	mov.l	SDCR_A, r1 +	mov.l	SDCR_D2, r0 +	mov.l	r0, @r1 + +	mov.l	SDMR3_A, r1 +	mov.l	SDMR3_D, r0 +	mov.w	r0, @r1 + +	mov.l	PCCR_A, r1 +	mov.l	PCCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PDCR_A, r1 +	mov.l	PDCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PECR_A, r1 +	mov.l	PECR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PGCR_A, r1 +	mov.l	PGCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PHCR_A, r1 +	mov.l	PHCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PPCR_A, r1 +	mov.l	PPCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PTCR_A, r1 +	mov.l	PTCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PVCR_A, r1 +	mov.l	PVCR_D, r0 +	mov.w	r0, @r1 + +	mov.l	PSELA_A, r1 +	mov.l	PSELA_D, r0 +	mov.w	r0, @r1 + +	mov.l	CCR_A, r1 +	mov.l	CCR_D, r0 +	mov.l	r0, @r1 + +	mov.l	LED_A, r1 +	mov.l	LED_D, r0 +	mov.b	r0, @r1 + +	rts +	 nop + +	.align 4 + +FRQCR_A:	.long	0xA415FF80	/* FRQCR Address */ +WTCNT_A:	.long	0xA415FF84 +WTCSR_A:	.long	0xA415FF86 +UCLKCR_A:	.long	0xA40A0008 +FRQCR_D:	.long	0x1103		/* I:B:P=8:4:2 */ +WTCNT_D:	.long	0x5A00 +WTCSR_D:	.long	0xA506 +UCLKCR_D:	.long	0xA5C0 + +#define BSC_BASE	0xA4FD0000 +CMNCR_A:	.long	BSC_BASE +CS0BCR_A:	.long	BSC_BASE + 0x04 +CS2BCR_A:	.long	BSC_BASE + 0x08 +CS3BCR_A:	.long	BSC_BASE + 0x0C +CS4BCR_A:	.long	BSC_BASE + 0x10 +CS5ABCR_A:	.long	BSC_BASE + 0x14 +CS5BBCR_A:	.long	BSC_BASE + 0x18 +CS6ABCR_A:	.long	BSC_BASE + 0x1C +CS6BBCR_A:	.long	BSC_BASE + 0x20 +CS0WCR_A:	.long	BSC_BASE + 0x24 +CS2WCR_A:	.long	BSC_BASE + 0x28 +CS3WCR_A:	.long	BSC_BASE + 0x2C +CS4WCR_A:	.long	BSC_BASE + 0x30 +CS5AWCR_A:	.long	BSC_BASE + 0x34 +CS5BWCR_A:	.long	BSC_BASE + 0x38 +CS6AWCR_A:	.long	BSC_BASE + 0x3C +CS6BWCR_A:	.long	BSC_BASE + 0x40 +SDCR_A:		.long	BSC_BASE + 0x44 +RTCSR_A:	.long	BSC_BASE + 0x48 +RTCNT_A:	.long	BSC_BASE + 0x4C +RTCOR_A:	.long	BSC_BASE + 0x50 +SDMR3_A:	.long	BSC_BASE + 0x58C0 + +CMNCR_D:	.long	0x00000010 +CS0BCR_D:	.long	0x36DB0400 +CS2BCR_D:	.long	0x36DB0400 +CS3BCR_D:	.long	0x36DB4600 +CS4BCR_D:	.long	0x36DB0400 +CS5ABCR_D:	.long	0x36DB0400 +CS5BBCR_D:	.long	0x36DB0200 +CS6ABCR_D:	.long	0x36DB0400 +CS6BBCR_D:	.long	0x36DB0400 +CS0WCR_D:	.long	0x00000B01 +CS2WCR_D:	.long	0x00000500 +CS3WCR_D:	.long	0x00006D1B +CS4WCR_D:	.long	0x00000500 +CS5AWCR_D:	.long	0x00000500 +CS5BWCR_D:	.long	0x00000500 +CS6AWCR_D:	.long	0x00000500 +CS6BWCR_D:	.long	0x00000500 +SDCR_D1:	.long	0x00000011 +RTCSR_D:	.long	0xA55A0010 +RTCNT_D:	.long	0xA55A001F +RTCOR_D:	.long	0xA55A001F +SDMR3_D:	.long	0x0000 +SDCR_D2:	.long	0x00000811 + +#define PFC_BASE	0xA4050100 +PCCR_A:		.long	PFC_BASE + 0x04 +PDCR_A:		.long	PFC_BASE + 0x06 +PECR_A:		.long	PFC_BASE + 0x08 +PGCR_A:		.long	PFC_BASE + 0x0C +PHCR_A:		.long	PFC_BASE + 0x0E +PPCR_A:		.long	PFC_BASE + 0x18 +PTCR_A:		.long	PFC_BASE + 0x1E +PVCR_A:		.long	PFC_BASE + 0x22 +PSELA_A:	.long	PFC_BASE + 0x24 + +PCCR_D:		.long	0x0000 +PDCR_D:		.long	0x0000 +PECR_D:		.long	0x0000 +PGCR_D:		.long	0x0000 +PHCR_D:		.long	0x0000 +PPCR_D:		.long	0x00AA +PTCR_D:		.long	0x0280 +PVCR_D:		.long	0x0000 +PSELA_D:	.long	0x0000 + +CCR_A:		.long	0xFFFFFFEC +!CCR_D:		.long	0x0000000D +CCR_D:		.long	0x0000000B + +LED_A:		.long	0xB6800000 +LED_D:		.long	0xFF diff --git a/board/ms7720se/ms7720se.c b/board/ms7720se/ms7720se.c new file mode 100644 index 000000000..ad76c0b2c --- /dev/null +++ b/board/ms7720se/ms7720se.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * Copyright (C) 2007 + * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * Copyright (C) 2007 + * Kenati Technologies, Inc. + * + * board/ms7720se/ms7720se.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/io.h> +#include <asm/processor.h> + +#define LED_BASE	0xB0800000 + +int checkboard(void) +{ +	puts("BOARD: Hitachi UL MS7720SE\n"); +	return 0; +} + +int board_init(void) +{ + +	return 0; +} + +int dram_init(void) +{ +	DECLARE_GLOBAL_DATA_PTR; + +	gd->bd->bi_memstart = CFG_SDRAM_BASE; +	gd->bd->bi_memsize = CFG_SDRAM_SIZE; +	printf("DRAM:  %dMB\n", CFG_SDRAM_SIZE / (1024 * 1024)); +	return 0; +} + +void led_set_state(unsigned short value) +{ +	outw(value & 0xFF, LED_BASE); +} diff --git a/board/ms7720se/u-boot.lds b/board/ms7720se/u-boot.lds new file mode 100644 index 000000000..ba71a9195 --- /dev/null +++ b/board/ms7720se/u-boot.lds @@ -0,0 +1,108 @@ +/* + * Copyrigth (c) 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * Copyrigth (c) 2007 + * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") +OUTPUT_ARCH(sh) +ENTRY(_start) + +SECTIONS +{ +	/* +	   Base address of internal SDRAM is 0x0C000000. +	   Although size of SDRAM can be either 16 or 32 MBytes, +	   we assume 16 MBytes (ie ignore upper half if the full +	   32 MBytes is present). + +	   NOTE: This address must match with the definition of +	   TEXT_BASE in config.mk (in this directory). + +	*/ +	. = 0x8C000000 + (64*1024*1024) - (256*1024); + +	PROVIDE (reloc_dst = .); + +	PROVIDE (_ftext = .); +	PROVIDE (_fcode = .); +	PROVIDE (_start = .); + +	.text : +	{ +		cpu/sh3/start.o		(.text) +		. = ALIGN(8192); +		common/environment.o	(.ppcenv) +		. = ALIGN(8192); +		common/environment.o	(.ppcenvr) +		. = ALIGN(8192); +		*(.text) +		. = ALIGN(4); +	} =0xFF +	PROVIDE (_ecode = .); +	.rodata : +	{ +		*(.rodata) +		. = ALIGN(4); +	} +	PROVIDE (_etext = .); + + +	PROVIDE (_fdata = .); +	.data : +	{ +		*(.data) +		. = ALIGN(4); +	} +	PROVIDE (_edata = .); + +	PROVIDE (_fgot = .); +	.got : +	{ +		*(.got) +		. = ALIGN(4); +	} +	PROVIDE (_egot = .); + +	PROVIDE (__u_boot_cmd_start = .); +	.u_boot_cmd : +	{ +		*(.u_boot_cmd) +		. = ALIGN(4); +	} +	PROVIDE (__u_boot_cmd_end = .); + +	PROVIDE (reloc_dst_end = .); +	/* _reloc_dst_end = .; */ + +	PROVIDE (bss_start = .); +	PROVIDE (__bss_start = .); +	.bss : +	{ +		*(.bss) +		. = ALIGN(4); +	} +	PROVIDE (bss_end = .); + +	PROVIDE (_end = .); +} diff --git a/board/pm854/Makefile b/board/pm854/Makefile index 29136508f..be243885b 100644 --- a/board/pm854/Makefile +++ b/board/pm854/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/pm854/init.S b/board/pm854/init.S deleted file mode 100644 index 0a403abb1..000000000 --- a/board/pm854/init.S +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	64M	Non-cacheable, guarded -	 * 0xfc000000	64M	FLASH (8,16,32 or 64 MB) -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(0xfc000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(0xfc000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	/* -	 * TLB 7:	256M	DDR -	 * 0x00000000	256M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ - -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     BCSR                    1M - * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_256M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* - * This is not so much the SDRAM map as it is the whole localbus map. - */ -#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR3 ((CFG_PCI1_IO_BASE>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/pm854/law.c b/board/pm854/law.c new file mode 100644 index 000000000..cb6b37f95 --- /dev/null +++ b/board/pm854/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     BCSR                    1M + * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	/* This is not so much the SDRAM map as it is the whole localbus map. */ +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/pm854/tlb.c b/board/pm854/tlb.c new file mode 100644 index 000000000..5d8753798 --- /dev/null +++ b/board/pm854/tlb.c @@ -0,0 +1,117 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	64M	Non-cacheable, guarded +	 * 0xfc000000	64M	FLASH (8,16,32 or 64 MB) +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, 0xfc000000, 0xfc000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	/* +	 * TLB 7:	256M	DDR +	 * 0x00000000	256M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 7, BOOKE_PAGESZ_256M, 1), +#endif +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/pm854/u-boot.lds b/board/pm854/u-boot.lds index 9feaf55cd..86f8f1359 100644 --- a/board/pm854/u-boot.lds +++ b/board/pm854/u-boot.lds @@ -35,7 +35,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/pm854/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -65,7 +64,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/pm854/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/pm856/Makefile b/board/pm856/Makefile index 29136508f..be243885b 100644 --- a/board/pm856/Makefile +++ b/board/pm856/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/pm856/init.S b/board/pm856/init.S deleted file mode 100644 index 0a403abb1..000000000 --- a/board/pm856/init.S +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	64M	Non-cacheable, guarded -	 * 0xfc000000	64M	FLASH (8,16,32 or 64 MB) -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(0xfc000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(0xfc000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	/* -	 * TLB 7:	256M	DDR -	 * 0x00000000	256M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ - -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xf800_0000     0xf80f_ffff     BCSR                    1M - * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_256M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* - * This is not so much the SDRAM map as it is the whole localbus map. - */ -#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR3 ((CFG_PCI1_IO_BASE>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/pm856/law.c b/board/pm856/law.c new file mode 100644 index 000000000..cb6b37f95 --- /dev/null +++ b/board/pm856/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xf800_0000     0xf80f_ffff     BCSR                    1M + * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	/* This is not so much the SDRAM map as it is the whole localbus map. */ +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/pm856/tlb.c b/board/pm856/tlb.c new file mode 100644 index 000000000..5d8753798 --- /dev/null +++ b/board/pm856/tlb.c @@ -0,0 +1,117 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	64M	Non-cacheable, guarded +	 * 0xfc000000	64M	FLASH (8,16,32 or 64 MB) +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, 0xfc000000, 0xfc000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	/* +	 * TLB 7:	256M	DDR +	 * 0x00000000	256M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 7, BOOKE_PAGESZ_256M, 1), +#endif +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/pm856/u-boot.lds b/board/pm856/u-boot.lds index c68f05a3f..6cfddea2d 100644 --- a/board/pm856/u-boot.lds +++ b/board/pm856/u-boot.lds @@ -36,7 +36,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/pm856/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -66,7 +65,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/pm856/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/sbc8548/Makefile b/board/sbc8548/Makefile index 15965252f..4b2a9f61b 100644 --- a/board/sbc8548/Makefile +++ b/board/sbc8548/Makefile @@ -28,9 +28,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/sbc8548/init.S b/board/sbc8548/init.S deleted file mode 100644 index cafa214fd..000000000 --- a/board/sbc8548/init.S +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2007 Wind River Systemes, Inc. <www.windriver.com> - * Copyright 2007 Embedded Specialties, Inc. - * - * Copyright 2004 Freescale Semiconductor. - * Copyright 2002,2003, Motorola Inc. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <ppc_asm.tmpl> -#include <ppc_defs.h> -#include <asm/cache.h> -#include <asm/mmu.h> -#include <config.h> -#include <mpc85xx.h> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - -	.section	.bootpg, "ax" -	.globl	tlb1_entry - -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xe4010000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff800000	16M	TLB for 8MB FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M Cacheable, non-guarded -	 * 0x0		256M DDR SDRAM -	 */ -	#if !defined(CONFIG_SPD_EEPROM) -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -	#endif - -	/* -	 * TLB 4:	64M	Non-cacheable, guarded -	 * 0xe0000000	1M	CCSRBAR -	 * 0xe2000000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Cacheable, non-guarded -	 * 0xf0000000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	16M	Cacheable, non-guarded -	 * 0xf8000000	1M	7-segment LED display -	 * 0xf8100000	1M	User switches -	 * 0xf8300000	1M	Board revision -	 * 0xf8b00000	1M	EEPROM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_EPLD_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_EPLD_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000	0x0fff_ffff	DDR			256M - * 0x8000_0000	0x9fff_ffff	PCI1 MEM		512M - * 0xe000_0000	0xe000_ffff	CCSR			1M - * 0xe200_0000	0xe2ff_ffff	PCI1 IO			16M - * 0xf000_0000	0xf7ff_ffff	SDRAM			128M - * 0xf8b0_0000	0xf80f_ffff	EEPROM			1M - * 0xfb80_0000	0xff7f_ffff	FLASH (2nd bank)	64M - * 0xff80_0000	0xffff_ffff	FLASH (boot bank)	8M - * - * Notes: - * 	CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *	If flash is 8M at default position (last 8M), no LAW needed. - * - *	The defines below are 1-off of the actual LAWAR0 usage. - *	So LAWAR3 define uses the LAWAR4 register in the ECM. - */ - - -#if !defined(CONFIG_SPD_EEPROM) -	#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -	#define LAWAR0  (LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_256M)) -#else -	#define LAWBAR0 0 -	#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_256M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_PCI1_IO_BASE>>12) & 0xfffff) -#define LAWAR2 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ -#define LAWBAR3 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR3 	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -	.section .bootpg, "ax" -	.globl	law_entry - -law_entry: -	entry_start -	.long 4 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	entry_end diff --git a/board/sbc8548/law.c b/board/sbc8548/law.c new file mode 100644 index 000000000..d903cdc2b --- /dev/null +++ b/board/sbc8548/law.c @@ -0,0 +1,57 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000	0x0fff_ffff	DDR			256M + * 0x8000_0000	0x9fff_ffff	PCI1 MEM		512M + * 0xe000_0000	0xe000_ffff	CCSR			1M + * 0xe200_0000	0xe2ff_ffff	PCI1 IO			16M + * 0xf000_0000	0xf7ff_ffff	SDRAM			128M + * 0xf8b0_0000	0xf80f_ffff	EEPROM			1M + * 0xfb80_0000	0xff7f_ffff	FLASH (2nd bank)	64M + * 0xff80_0000	0xffff_ffff	FLASH (boot bank)	8M + * + * Notes: + * 	CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *	If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI), +	/* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ +	SET_LAW_ENTRY(4, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/sbc8548/tlb.c b/board/sbc8548/tlb.c new file mode 100644 index 000000000..8d6625e54 --- /dev/null +++ b/board/sbc8548/tlb.c @@ -0,0 +1,108 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff800000	16M	TLB for 8MB FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M Cacheable, non-guarded +	 * 0x0		256M DDR SDRAM +	 */ +	#if !defined(CONFIG_SPD_EEPROM) +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 3, BOOKE_PAGESZ_256M, 1), +	#endif + +	/* +	 * TLB 4:	64M	Non-cacheable, guarded +	 * 0xe0000000	1M	CCSRBAR +	 * 0xe2000000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 5:	64M	Cacheable, non-guarded +	 * 0xf0000000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	16M	Cacheable, non-guarded +	 * 0xf8000000	1M	7-segment LED display +	 * 0xf8100000	1M	User switches +	 * 0xf8300000	1M	Board revision +	 * 0xf8b00000	1M	EEPROM +	 */ +	SET_TLB_ENTRY(1, CFG_EPLD_BASE, CFG_EPLD_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 6, BOOKE_PAGESZ_16M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/sbc8548/u-boot.lds b/board/sbc8548/u-boot.lds index 8e301d47a..d701096f1 100644 --- a/board/sbc8548/u-boot.lds +++ b/board/sbc8548/u-boot.lds @@ -34,7 +34,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/sbc8548/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -64,7 +63,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/sbc8548/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/board/sbc8560/Makefile b/board/sbc8560/Makefile index 15965252f..4b2a9f61b 100644 --- a/board/sbc8560/Makefile +++ b/board/sbc8560/Makefile @@ -28,9 +28,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/sbc8560/init.S b/board/sbc8560/init.S deleted file mode 100644 index 95cb85abf..000000000 --- a/board/sbc8560/init.S +++ /dev/null @@ -1,165 +0,0 @@ -/* -* Copyright (C) 2002,2003, Motorola Inc. -* Xianghua Xiao <X.Xiao@motorola.com> -* -* (C) Copyright 2004 Wind River Systems Inc <www.windriver.com>. -* Added support for Wind River SBC8560 board -* -* 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		; - - -/* LAW(Local Access Window) configuration: - * 0000_0000-0800_0000: DDR(512M) -or- larger - * c000_0000-cfff_ffff: PCI(256M) - * d000_0000-dfff_ffff: RapidIO(256M) - * e000_0000-ffff_ffff: localbus(512M) - *   e000_0000-e3ff_ffff: LBC 64M, 32-bit flash on CS6 - *   e400_0000-e7ff_ffff: LBC 64M, 32-bit flash on CS1 - *   e800_0000-efff_ffff: LBC 128M, nothing here - *   f000_0000-f3ff_ffff: LBC 64M, SDRAM on CS3 - *   f400_0000-f7ff_ffff: LBC 64M, SDRAM on CS4 - *   f800_0000-fdff_ffff: LBC 64M, nothing here - *   fc00_0000-fcff_ffff: LBC 16M, CSR,RTC,UART,etc on CS5 - *   fd00_0000-fdff_ffff: LBC 16M, nothing here - *   fe00_0000-feff_ffff: LBC 16M, nothing here - *   ff00_0000-ff6f_ffff: LBC 7M, nothing here - *   ff70_0000-ff7f_ffff: CCSRBAR 1M - *   ff80_0000-ffff_ffff: LBC 8M, 8-bit flash on CS0 - * Note: CCSRBAR and L2-as-SRAM don't need configure Local Access - *       Window. - * Note: If flash is 8M at default position(last 8M),no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -  #define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -  #define LAWAR0  (LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_512M)) -#else -  #define LAWBAR0 0 -  #define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_512M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI_MEM_BASE>>12) & 0xfffff) -#define LAWAR1  (LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR2 ((0xe0000000>>12) & 0xfffff) -#define LAWAR2  (LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -	.section .bootpg, "ax" -	.globl  law_entry -law_entry: -	entry_start -	.long 0x03 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2 -	entry_end - -/* TLB1 entries configuration: */ - -	.section	.bootpg, "ax" -	.globl		tlb1_entry - -tlb1_entry: -	entry_start - -	.long 0x08	/* the following data table uses a few of 16 TLB entries */ - -/* TLB for CCSRBAR (IMMR) */ - -	.long FSL_BOOKE_MAS0(1,1,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -/* TLB for Local Bus stuff, just map the whole 512M */ -/* note that the LBC SDRAM is cache-inhibit and guarded, like everything else */ - -	.long FSL_BOOKE_MAS0(1,2,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(0xe0000000,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(0xe0000000,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,3,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(0xf0000000,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(0xf0000000,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	.long FSL_BOOKE_MAS0(1,4,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE,0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,5,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE+0x10000000,0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE+0x10000000,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -#else -	.long FSL_BOOKE_MAS0(1,4,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,5,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	.long FSL_BOOKE_MAS0(1,6,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_16K) -#ifdef CONFIG_L2_INIT_RAM -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR,0,0,0,1,0,0,0,0) -#else -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR,0) -#endif -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1,7,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI_MEM_BASE,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI_MEM_BASE,0,(MAS3_SX|MAS3_SW|MAS3_SR)) - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	.long FSL_BOOKE_MAS0(1,15,0) -	.long FSL_BOOKE_MAS1(1,1,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT,(MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -#else -	.long FSL_BOOKE_MAS0(1,15,0) -	.long FSL_BOOKE_MAS1(0,0,0,0,BOOKE_PAGESZ_1M) -	.long FSL_BOOKE_MAS2(0,0) -	.long FSL_BOOKE_MAS3(0,0,(MAS3_SX|MAS3_SW|MAS3_SR)) -#endif -	entry_end diff --git a/board/sbc8560/law.c b/board/sbc8560/law.c new file mode 100644 index 000000000..e370853e9 --- /dev/null +++ b/board/sbc8560/law.c @@ -0,0 +1,60 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* LAW(Local Access Window) configuration: + * 0000_0000-0800_0000: DDR(512M) -or- larger + * c000_0000-cfff_ffff: PCI(256M) + * d000_0000-dfff_ffff: RapidIO(256M) + * e000_0000-ffff_ffff: localbus(512M) + *   e000_0000-e3ff_ffff: LBC 64M, 32-bit flash on CS6 + *   e400_0000-e7ff_ffff: LBC 64M, 32-bit flash on CS1 + *   e800_0000-efff_ffff: LBC 128M, nothing here + *   f000_0000-f3ff_ffff: LBC 64M, SDRAM on CS3 + *   f400_0000-f7ff_ffff: LBC 64M, SDRAM on CS4 + *   f800_0000-fdff_ffff: LBC 64M, nothing here + *   fc00_0000-fcff_ffff: LBC 16M, CSR,RTC,UART,etc on CS5 + *   fd00_0000-fdff_ffff: LBC 16M, nothing here + *   fe00_0000-feff_ffff: LBC 16M, nothing here + *   ff00_0000-ff6f_ffff: LBC 7M, nothing here + *   ff70_0000-ff7f_ffff: CCSRBAR 1M + *   ff80_0000-ffff_ffff: LBC 8M, 8-bit flash on CS0 + * Note: CCSRBAR and L2-as-SRAM don't need configure Local Access + *       Window. + * Note: If flash is 8M at default position(last 8M),no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI_MEM_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/sbc8560/tlb.c b/board/sbc8560/tlb.c new file mode 100644 index 000000000..155ff64bb --- /dev/null +++ b/board/sbc8560/tlb.c @@ -0,0 +1,65 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +/* TLB for CCSRBAR (IMMR) */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_1M, 1), + +/* TLB for Local Bus stuff, just map the whole 512M */ +/* note that the LBC SDRAM is cache-inhibit and guarded, like everything else */ + +	SET_TLB_ENTRY(1, 0xe0000000, 0xe0000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	SET_TLB_ENTRY(1, 0xf0000000, 0xf0000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x10000000, CFG_DDR_SDRAM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 5, BOOKE_PAGESZ_256M, 1), +#endif + +	SET_TLB_ENTRY(1, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_16K, 1), + +	SET_TLB_ENTRY(1, CFG_PCI_MEM_PHYS, CFG_PCI_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_256M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/sbc8560/u-boot.lds b/board/sbc8560/u-boot.lds index 449fed8f7..f3dbf26a4 100644 --- a/board/sbc8560/u-boot.lds +++ b/board/sbc8560/u-boot.lds @@ -38,7 +38,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/sbc8560/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -68,7 +67,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/sbc8560/init.o (.text)      cpu/mpc85xx/commproc.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text) diff --git a/board/stxgp3/Makefile b/board/stxgp3/Makefile index 7d52f8cac..28d6cb997 100644 --- a/board/stxgp3/Makefile +++ b/board/stxgp3/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o flash.o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o flash.o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/stxgp3/init.S b/board/stxgp3/init.S deleted file mode 100644 index f491a57ce..000000000 --- a/board/stxgp3/init.S +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2004 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 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	16M	Non-cacheable, guarded -	 * 0xff000000	16M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_16M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Cacheable, non-guarded -	 * 0xf000_0000	64M	LBC SDRAM -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_LBC_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_LBC_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7:	16K	Non-cacheable, guarded -	 * 0xfc000000	16K	Configuration Latch register -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64K) -	.long FSL_BOOKE_MAS2(CFG_LBC_LCLDEVS_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_LBC_LCLDEVS_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -#if !defined(CONFIG_SPD_EEPROM) -	/* -	 * TLB 8, 9:	128M	DDR -	 * 0x00000000	64M	DDR System memory -	 * 0x04000000	64M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ -#error("Update the number of table entries in tlb1_entry") -	.long FSL_BOOKE_MAS0(1, 8, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(1, 9, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE + 0x4000000, 0) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE + 0x4000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#endif - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xc000_0000     0xdfff_ffff     RapidIO                 512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M - * 0xfc00_0000     0xfc00_ffff     Config Latch            64K - * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -/* - * This is not so much the SDRAM map as it is the whole localbus map. - */ -#define LAWBAR2 ((CFG_LBC_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - -#define LAWBAR3 ((CFG_PCI1_IO_BASE>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/stxgp3/law.c b/board/stxgp3/law.c new file mode 100644 index 000000000..312b3c557 --- /dev/null +++ b/board/stxgp3/law.c @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xf000_0000     0xf7ff_ffff     SDRAM                   128M + * 0xfc00_0000     0xfc00_ffff     Config Latch            64K + * 0xff00_0000     0xffff_ffff     FLASH (boot bank)       16M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	/* This is not so much the SDRAM map as it is the whole localbus map. */ +	SET_LAW_ENTRY(3, CFG_LBC_SDRAM_BASE, LAW_SIZE_256M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/stxgp3/tlb.c b/board/stxgp3/tlb.c new file mode 100644 index 000000000..529f23042 --- /dev/null +++ b/board/stxgp3/tlb.c @@ -0,0 +1,130 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	16M	Non-cacheable, guarded +	 * 0xff000000	16M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_16M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	64M	Cacheable, non-guarded +	 * 0xf000_0000	64M	LBC SDRAM +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_SDRAM_BASE, CFG_LBC_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7:	16K	Non-cacheable, guarded +	 * 0xfc000000	16K	Configuration Latch register +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_LCLDEVS_BASE, CFG_LBC_LCLDEVS_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_16K, 1), + +#if !defined(CONFIG_SPD_EEPROM) +	/* +	 * TLB 8, 9:	128M	DDR +	 * 0x00000000	64M	DDR System memory +	 * 0x04000000	64M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ +#error("Update the number of table entries in tlb1_entry") +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 8, BOOKE_PAGESZ_64M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x4000000, CFG_DDR_SDRAM_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 9, BOOKE_PAGESZ_64M, 1), +#endif +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/stxgp3/u-boot.lds b/board/stxgp3/u-boot.lds index 3f9bc55b3..4a9a103bc 100644 --- a/board/stxgp3/u-boot.lds +++ b/board/stxgp3/u-boot.lds @@ -40,7 +40,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/stxgp3/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -70,7 +69,6 @@ SECTIONS    .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) diff --git a/board/stxssa/Makefile b/board/stxssa/Makefile index 344ecdfd7..f1f5d0b1b 100644 --- a/board/stxssa/Makefile +++ b/board/stxssa/Makefile @@ -25,8 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o -SOBJS	:= init.o +COBJS	:= $(BOARD).o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/stxssa/init.S b/board/stxssa/init.S deleted file mode 100644 index 82dafb80b..000000000 --- a/board/stxssa/init.S +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2005 Embedded Alley Solutions, Inc. - * Dan Malek <dan@embeddedalley.com> - * Copied from STx GP3. - * Updates for Silicon Tx GP3 SSA.  We only support 32-bit flash - * and DDR with SPD EEPROM configuration. - * - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define	entry_start \ -	mflr	r1 	;	\ -	bl	0f 	; - -#define	entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 12 - -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* -	 * TLB0		4K	Non-cacheable, guarded -	 * 0xff700000	4K	Initial CCSRBAR mapping -	 * -	 * This ends up at a TLB0 Index==0 entry, and must not collide -	 * with other TLB0 Entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR_DEFAULT, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR_DEFAULT, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -#else -#error("Update the number of table entries in tlb1_entry") -#endif - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0:	64M	Non-cacheable, guarded -	 * 0xfc000000	6M4	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 1:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0xa0000000	256M	PCI2 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xb0000000	256M	PCI2 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI2_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI2_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 * 0xe300_0000	16M	PCI2 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	256M	Non-cacheable, guarded -	 * 0xf0000000		Local bus expansion option. -	 * 0xfb000000		Configuration Latch register (one word) -	 * 0xfc000000		Up to 64M flash -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_LBC_OPTION_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_LBC_OPTION_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000     0x7fff_ffff     DDR                     2G - * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M - * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M - * 0xe000_0000     0xe000_ffff     CCSR                    1M - * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M - * 0xe300_0000     0xe3ff_ffff     PCI2 IO                 16M - * 0xf000_0000     0xfaff_ffff     Local bus               128M - * 0xfb00_0000     0xfb00_ffff     Config Latch            64K - * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#if !defined(CONFIG_SPD_EEPROM) -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) -#else -#define LAWBAR0 0 -#define LAWAR0  ((LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_128M)) & ~LAWAR_EN) -#endif - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_PCI2_MEM_BASE>>12) & 0xfffff) -#define LAWAR2 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR3 ((CFG_PCI1_IO_PHYS>>12) & 0xfffff) -#define LAWAR3 	(LAWAR_EN | LAWAR_TRGT_IF_PCI1 | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -#define LAWBAR4 ((CFG_PCI2_IO_PHYS>>12) & 0xfffff) -#define LAWAR4 	(LAWAR_EN | LAWAR_TRGT_IF_PCI2 | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* Map the whole localbus, including flash and reset latch. -*/ -#define LAWBAR5 ((CFG_LBC_OPTION_BASE>>12) & 0xfffff) -#define LAWAR5	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 6 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4,LAWBAR5,LAWAR5 -	entry_end diff --git a/board/stxssa/law.c b/board/stxssa/law.c new file mode 100644 index 000000000..2b2529298 --- /dev/null +++ b/board/stxssa/law.c @@ -0,0 +1,60 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000     0x7fff_ffff     DDR                     2G + * 0x8000_0000     0x9fff_ffff     PCI1 MEM                512M + * 0xa000_0000     0xbfff_ffff     PCI2 MEM                512M + * 0xe000_0000     0xe000_ffff     CCSR                    1M + * 0xe200_0000     0xe2ff_ffff     PCI1 IO                 16M + * 0xe300_0000     0xe3ff_ffff     PCI2 IO                 16M + * 0xf000_0000     0xfaff_ffff     Local bus               128M + * 0xfb00_0000     0xfb00_ffff     Config Latch            64K + * 0xfc00_0000     0xffff_ffff     FLASH (boot bank)       64M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +#ifndef CONFIG_SPD_EEPROM +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_128M, LAW_TRGT_IF_DDR), +#endif +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_1), +	SET_LAW_ENTRY(3, CFG_PCI2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI_2), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_1), +	SET_LAW_ENTRY(5, CFG_PCI2_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI_2), +	/* Map the whole localbus, including flash and reset latch. */ +	SET_LAW_ENTRY(6, CFG_LBC_OPTION_BASE, LAWAR_SIZE_256M, LAW_TRGT_IF_LBC), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/stxssa/tlb.c b/board/stxssa/tlb.c new file mode 100644 index 000000000..46b14406d --- /dev/null +++ b/board/stxssa/tlb.c @@ -0,0 +1,106 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + +	/* +	 * TLB 0:	64M	Non-cacheable, guarded +	 * 0xfc000000	6M4	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 1:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0xa0000000	256M	PCI2 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS, CFG_PCI2_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xb0000000	256M	PCI2 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI2_MEM_PHYS + 0x10000000, CFG_PCI2_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 * 0xe300_0000	16M	PCI2 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 6:	256M	Non-cacheable, guarded +	 * 0xf0000000		Local bus expansion option. +	 * 0xfb000000		Configuration Latch register (one word) +	 * 0xfc000000		Up to 64M flash +	 */ +	SET_TLB_ENTRY(1, CFG_LBC_OPTION_BASE, CFG_LBC_OPTION_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_256M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/stxssa/u-boot.lds b/board/stxssa/u-boot.lds index a0ba12595..99a8a8b37 100644 --- a/board/stxssa/u-boot.lds +++ b/board/stxssa/u-boot.lds @@ -40,7 +40,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o	(.bootpg) -    board/stxssa/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -70,7 +69,6 @@ SECTIONS    .text      :    {      cpu/mpc85xx/start.o	(.text) -    board/stxssa/init.o (.text)      cpu/mpc85xx/commproc.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text) diff --git a/board/tqm85xx/Makefile b/board/tqm85xx/Makefile index cad7e1e1e..52f5ef945 100644 --- a/board/tqm85xx/Makefile +++ b/board/tqm85xx/Makefile @@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).a -COBJS	:= $(BOARD).o sdram.o -SOBJS	:= init.o -#SOBJS	:= +COBJS	:= $(BOARD).o sdram.o law.o tlb.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/tqm85xx/init.S b/board/tqm85xx/init.S deleted file mode 100644 index dcb9386c0..000000000 --- a/board/tqm85xx/init.S +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor. - * 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> - - -/* - * TLB0 and TLB1 Entries - * - * Out of reset, TLB1's Entry 0 maps the highest 4K for CCSRBAR. - * However, CCSRBAR is then relocated to CFG_CCSRBAR right after - * these TLB entries are established. - * - * The TLB entries for DDR are dynamically setup in spd_sdram() - * and use TLB1 Entries 8 through 15 as needed according to the - * size of DDR memory. - * - * MAS0: tlbsel, esel, nv - * MAS1: valid, iprot, tid, ts, tsize - * MAS2: epn, x0, x1, w, i, m, g, e - * MAS3: rpn, u0-u3, ux, sx, uw, sw, ur, sr - */ - -#define entry_start \ -	mflr	r1	;	\ -	bl	0f	; - -#define entry_end \ -0:	mflr	r0	;	\ -	mtlr	r1	;	\ -	blr		; - - -	.section	.bootpg, "ax" -	.globl	tlb1_entry -tlb1_entry: -	entry_start - -	/* -	 * Number of TLB0 and TLB1 entries in the following table -	 */ -	.long 13 - -	/* -	 * TLB0		16K	Cacheable, non-guarded -	 * 0xd001_0000	16K	Temporary Global data for initialization -	 * -	 * Use four 4K TLB0 entries.  These entries must be cacheable -	 * as they provide the bootstrap memory before the memory -	 * controler and real memory have been configured. -	 * -	 * These entries end up at TLB0 Indicies 0x10, 0x14, 0x18 and 0x1c, -	 * and must not collide with other TLB0 entries. -	 */ -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 4 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 4 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 8 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 8 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	.long FSL_BOOKE_MAS0(0, 0, 0) -	.long FSL_BOOKE_MAS1(1, 0, 0, 0, 0) -	.long FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR + 12 * 1024, 0) -	.long FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR + 12 * 1024, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - - -	/* -	 * TLB 0, 1:	128M	Non-cacheable, guarded -	 * 0xf8000000	128M	FLASH -	 * Out of reset this entry is only 4K. -	 */ -	.long FSL_BOOKE_MAS0(1, 1, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -	.long FSL_BOOKE_MAS0(1, 0, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_FLASH_BASE+0x4000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_FLASH_BASE+0x4000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 2:	256M	Non-cacheable, guarded -	 * 0x80000000	256M	PCI1 MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 2, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 3:	256M	Non-cacheable, guarded -	 * 0x90000000	256M	PCI1 MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 3, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_PCI1_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_PCI1_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 4:	256M	Non-cacheable, guarded -	 * 0xc0000000	256M	Rapid IO MEM First half -	 */ -	.long FSL_BOOKE_MAS0(1, 4, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 5:	256M	Non-cacheable, guarded -	 * 0xd0000000	256M	Rapid IO MEM Second half -	 */ -	.long FSL_BOOKE_MAS0(1, 5, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_RIO_MEM_BASE + 0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_RIO_MEM_BASE + 0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 6:	64M	Non-cacheable, guarded -	 * 0xe000_0000	1M	CCSRBAR -	 * 0xe200_0000	16M	PCI1 IO -	 */ -	.long FSL_BOOKE_MAS0(1, 6, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_64M) -	.long FSL_BOOKE_MAS2(CFG_CCSRBAR, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_CCSRBAR, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	/* -	 * TLB 7+8:	512M	DDR, cache disabled (needed for memory test) -	 * 0x00000000  512M	DDR System memory -	 * Without SPD EEPROM configured DDR, this must be setup manually. -	 * Make sure the TLB count at the top of this table is correct. -	 * Likely it needs to be increased by two for these entries. -	 */ -	.long FSL_BOOKE_MAS0(1, 7, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) -	.long FSL_BOOKE_MAS0(1, 8, 0) -	.long FSL_BOOKE_MAS1(1, 1, 0, 0, BOOKE_PAGESZ_256M) -	.long FSL_BOOKE_MAS2(CFG_DDR_SDRAM_BASE+0x10000000, (MAS2_I|MAS2_G)) -	.long FSL_BOOKE_MAS3(CFG_DDR_SDRAM_BASE+0x10000000, 0, (MAS3_SX|MAS3_SW|MAS3_SR)) - -	entry_end - -/* - * LAW(Local Access Window) configuration: - * - * 0x0000_0000	   0x7fff_ffff	   DDR			   2G - * 0x8000_0000	   0x9fff_ffff	   PCI1 MEM		   512M - * 0xc000_0000	   0xdfff_ffff	   RapidIO		   512M - * 0xe000_0000	   0xe000_ffff	   CCSR			   1M - * 0xe200_0000	   0xe2ff_ffff	   PCI1 IO		   16M - * 0xf800_0000	   0xf80f_ffff	   BCSR			   1M - * 0xfe00_0000	   0xffff_ffff	   FLASH (boot bank)	   32M - * - * Notes: - *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. - *    If flash is 8M at default position (last 8M), no LAW needed. - */ - -#define LAWBAR0 ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff) -#define LAWAR0	(LAWAR_EN | LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR1 ((CFG_PCI1_MEM_BASE>>12) & 0xfffff) -#define LAWAR1	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_512M)) - -#define LAWBAR2 ((CFG_LBC_FLASH_BASE>>12) & 0xfffff) -#define LAWAR2	(LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_128M)) - -#define LAWBAR3 ((CFG_PCI1_IO_BASE>>12) & 0xfffff) -#define LAWAR3	(LAWAR_EN | LAWAR_TRGT_IF_PCIX | (LAWAR_SIZE & LAWAR_SIZE_16M)) - -/* - * Rapid IO at 0xc000_0000 for 512 M - */ -#define LAWBAR4 ((CFG_RIO_MEM_BASE>>12) & 0xfffff) -#define LAWAR4	(LAWAR_EN | LAWAR_TRGT_IF_RIO | (LAWAR_SIZE & LAWAR_SIZE_512M)) - - -	.section .bootpg, "ax" -	.globl	law_entry -law_entry: -	entry_start -	.long 0x05 -	.long LAWBAR0,LAWAR0,LAWBAR1,LAWAR1,LAWBAR2,LAWAR2,LAWBAR3,LAWAR3 -	.long LAWBAR4,LAWAR4 -	entry_end diff --git a/board/tqm85xx/law.c b/board/tqm85xx/law.c new file mode 100644 index 000000000..224af6ca7 --- /dev/null +++ b/board/tqm85xx/law.c @@ -0,0 +1,54 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/mmu.h> + +/* + * LAW(Local Access Window) configuration: + * + * 0x0000_0000	   0x7fff_ffff	   DDR			   2G + * 0x8000_0000	   0x9fff_ffff	   PCI1 MEM		   512M + * 0xc000_0000	   0xdfff_ffff	   RapidIO		   512M + * 0xe000_0000	   0xe000_ffff	   CCSR			   1M + * 0xe200_0000	   0xe2ff_ffff	   PCI1 IO		   16M + * 0xf800_0000	   0xf80f_ffff	   BCSR			   1M + * 0xfe00_0000	   0xffff_ffff	   FLASH (boot bank)	   32M + * + * Notes: + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. + *    If flash is 8M at default position (last 8M), no LAW needed. + */ + +struct law_entry law_table[] = { +	SET_LAW_ENTRY(1, CFG_DDR_SDRAM_BASE, LAW_SIZE_512M, LAW_TRGT_IF_DDR), +	SET_LAW_ENTRY(2, CFG_PCI1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(3, CFG_LBC_FLASH_BASE, LAW_SIZE_128M, LAW_TRGT_IF_LBC), +	SET_LAW_ENTRY(4, CFG_PCI1_IO_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_PCI), +	SET_LAW_ENTRY(5, CFG_RIO_MEM_BASE, LAWAR_SIZE_512M, LAW_TRGT_IF_RIO), +}; + +int num_law_entries = ARRAY_SIZE(law_table); diff --git a/board/tqm85xx/tlb.c b/board/tqm85xx/tlb.c new file mode 100644 index 000000000..a178cfef3 --- /dev/null +++ b/board/tqm85xx/tlb.c @@ -0,0 +1,114 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/mmu.h> + +struct fsl_e_tlb_entry tlb_table[] = { +	/* TLB 0 - for temp stack in cache */ +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR, CFG_INIT_RAM_ADDR, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 4 * 1024 , CFG_INIT_RAM_ADDR + 4 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 8 * 1024 , CFG_INIT_RAM_ADDR + 8 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), +	SET_TLB_ENTRY(0, CFG_INIT_RAM_ADDR + 12 * 1024 , CFG_INIT_RAM_ADDR + 12 * 1024, +		      MAS3_SX|MAS3_SW|MAS3_SR, 0, +		      0, 0, BOOKE_PAGESZ_4K, 0), + + +	/* +	 * TLB 0, 1:	128M	Non-cacheable, guarded +	 * 0xf8000000	128M	FLASH +	 * Out of reset this entry is only 4K. +	 */ +	SET_TLB_ENTRY(1, CFG_FLASH_BASE, CFG_FLASH_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 1, BOOKE_PAGESZ_64M, 1), +	SET_TLB_ENTRY(1, CFG_FLASH_BASE + 0x4000000, CFG_FLASH_BASE + 0x4000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 0, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 2:	256M	Non-cacheable, guarded +	 * 0x80000000	256M	PCI1 MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS, CFG_PCI1_MEM_PHYS, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 2, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 3:	256M	Non-cacheable, guarded +	 * 0x90000000	256M	PCI1 MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_PCI1_MEM_PHYS + 0x10000000, CFG_PCI1_MEM_PHYS + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 3, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 4:	256M	Non-cacheable, guarded +	 * 0xc0000000	256M	Rapid IO MEM First half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE, CFG_RIO_MEM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 4, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 5:	256M	Non-cacheable, guarded +	 * 0xd0000000	256M	Rapid IO MEM Second half +	 */ +	SET_TLB_ENTRY(1, CFG_RIO_MEM_BASE + 0x10000000, CFG_RIO_MEM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 5, BOOKE_PAGESZ_256M, 1), + +	/* +	 * TLB 6:	64M	Non-cacheable, guarded +	 * 0xe000_0000	1M	CCSRBAR +	 * 0xe200_0000	16M	PCI1 IO +	 */ +	SET_TLB_ENTRY(1, CFG_CCSRBAR, CFG_CCSRBAR, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 6, BOOKE_PAGESZ_64M, 1), + +	/* +	 * TLB 7+8:	512M	DDR, cache disabled (needed for memory test) +	 * 0x00000000  512M	DDR System memory +	 * Without SPD EEPROM configured DDR, this must be setup manually. +	 * Make sure the TLB count at the top of this table is correct. +	 * Likely it needs to be increased by two for these entries. +	 */ +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE, CFG_DDR_SDRAM_BASE, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 7, BOOKE_PAGESZ_256M, 1), + +	SET_TLB_ENTRY(1, CFG_DDR_SDRAM_BASE + 0x10000000, CFG_DDR_SDRAM_BASE + 0x10000000, +		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		      0, 8, BOOKE_PAGESZ_256M, 1), +}; + +int num_tlb_entries = ARRAY_SIZE(tlb_table); diff --git a/board/tqm85xx/u-boot.lds b/board/tqm85xx/u-boot.lds index a8ca3c89d..6c1f90483 100644 --- a/board/tqm85xx/u-boot.lds +++ b/board/tqm85xx/u-boot.lds @@ -35,7 +35,6 @@ SECTIONS    .bootpg 0xFFFFF000 :    {      cpu/mpc85xx/start.o (.bootpg) -    board/tqm85xx/init.o (.bootpg)    } = 0xffff    /* Read-only sections, merged into text segment: */ @@ -65,7 +64,6 @@ SECTIONS    .text	     :    {      cpu/mpc85xx/start.o (.text) -    board/tqm85xx/init.o (.text)      cpu/mpc85xx/traps.o (.text)      cpu/mpc85xx/interrupts.o (.text)      cpu/mpc85xx/cpu_init.o (.text) diff --git a/common/cmd_mac.c b/common/cmd_mac.c index 0add43285..faed8f763 100644 --- a/common/cmd_mac.c +++ b/common/cmd_mac.c @@ -33,7 +33,7 @@ U_BOOT_CMD(  	"mac     - display and program the system ID and MAC addresses in EEPROM\n",  	"[read|save|id|num|errata|date|ports|0|1|2|3|4|5|6|7]\n"  	"read\n" -	"    - show content of mac\n" +	"    - show content of EEPROM\n"  	"mac save\n"  	"    - save to the EEPROM\n"  	"mac id\n" @@ -43,7 +43,7 @@ U_BOOT_CMD(  	"mac errata\n"  	"    - program errata data\n"  	"mac date\n" -	"    - program data date\n" +	"    - program date\n"  	"mac ports\n"  	"    - program the number of ports\n"  	"mac 0\n" diff --git a/cpu/mpc83xx/cpu_init.c b/cpu/mpc83xx/cpu_init.c index 3337d8cc3..e643037d2 100644 --- a/cpu/mpc83xx/cpu_init.c +++ b/cpu/mpc83xx/cpu_init.c @@ -73,11 +73,6 @@ void cpu_init_f (volatile immap_t * im)  			  (CFG_ACR_PIPE_DEP << ACR_PIPE_DEP_SHIFT);  #endif -#ifdef CFG_SPCR_TSECEP -	/* eTSEC Emergency priority */ -	im->sysconf.spcr = (im->sysconf.spcr & ~SPCR_TSECEP) | (CFG_SPCR_TSECEP << SPCR_TSECEP_SHIFT); -#endif -  #ifdef CFG_ACR_RPTCNT  	/* Arbiter repeat count */  	im->arbiter.acr = (im->arbiter.acr & ~(ACR_RPTCNT)) | @@ -85,7 +80,7 @@ void cpu_init_f (volatile immap_t * im)  #endif  #ifdef CFG_SPCR_TSECEP -	/* all TSEC's Emergency priority */ +	/* all eTSEC's Emergency priority */  	im->sysconf.spcr = (im->sysconf.spcr & ~SPCR_TSECEP) |  			   (CFG_SPCR_TSECEP << SPCR_TSECEP_SHIFT);  #endif diff --git a/cpu/mpc83xx/speed.c b/cpu/mpc83xx/speed.c index 61c937981..f598699b2 100644 --- a/cpu/mpc83xx/speed.c +++ b/cpu/mpc83xx/speed.c @@ -367,17 +367,17 @@ int get_clocks(void)  #endif  #if defined(CONFIG_MPC837X) || defined(CONFIG_MPC8315) -	switch ((sccr & SCCR_SATACM) >> SCCR_SATACM_SHIFT) { -	case SCCR_SATACM_0: +	switch ((sccr & SCCR_SATA1CM) >> SCCR_SATA1CM_SHIFT) { +	case 0:  		sata_clk = 0;  		break; -	case SCCR_SATACM_1: +	case 1:  		sata_clk = csb_clk;  		break; -	case SCCR_SATACM_2: +	case 2:  		sata_clk = csb_clk / 2;  		break; -	case SCCR_SATACM_3: +	case 3:  		sata_clk = csb_clk / 3;  		break;  	default: diff --git a/cpu/mpc85xx/Makefile b/cpu/mpc85xx/Makefile index d179d701b..2205dca02 100644 --- a/cpu/mpc85xx/Makefile +++ b/cpu/mpc85xx/Makefile @@ -30,7 +30,7 @@ LIB	= $(obj)lib$(CPU).a  START	= start.o resetvec.o  COBJS-$(CONFIG_OF_LIBFDT) += fdt.o -COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o \ +COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o tlb.o \  	  pci.o serial_scc.o commproc.o ether_fcc.o spd_sdram.o qe_io.o \  	  $(COBJS-y) diff --git a/cpu/mpc85xx/cpu_init.c b/cpu/mpc85xx/cpu_init.c index fdb9ecbd5..c0ff1d512 100644 --- a/cpu/mpc85xx/cpu_init.c +++ b/cpu/mpc85xx/cpu_init.c @@ -31,6 +31,8 @@  #include <asm/processor.h>  #include <ioports.h>  #include <asm/io.h> +#include <asm/mmu.h> +#include <asm/fsl_law.h>  DECLARE_GLOBAL_DATA_PTR; @@ -122,6 +124,34 @@ void config_8560_ioports (volatile ccsr_cpm_t * cpm)  }  #endif +/* We run cpu_init_early_f in AS = 1 */ +void cpu_init_early_f(void) +{ +	set_tlb(0, CFG_CCSRBAR, CFG_CCSRBAR, +		MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +		1, 0, BOOKE_PAGESZ_4K, 0); + +	/* set up CCSR if we want it moved */ +#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) +	{ +		u32 temp; + +		set_tlb(0, CFG_CCSRBAR_DEFAULT, CFG_CCSRBAR_DEFAULT, +			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, +			1, 1, BOOKE_PAGESZ_4K, 0); + +		temp = in_be32((volatile u32 *)CFG_CCSRBAR_DEFAULT); +		out_be32((volatile u32 *)CFG_CCSRBAR_DEFAULT, CFG_CCSRBAR >> 12); + +		temp = in_be32((volatile u32 *)CFG_CCSRBAR); +	} +#endif + +	init_laws(); +	invalidate_tlb(0); +	init_tlbs(); +} +  /*   * Breathe some life into the CPU...   * @@ -134,13 +164,15 @@ void cpu_init_f (void)  	volatile ccsr_lbc_t *memctl = (void *)(CFG_MPC85xx_LBC_ADDR);  	extern void m8560_cpm_reset (void); +	disable_tlb(14); +	disable_tlb(15); +  	/* 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)); -  #ifdef CONFIG_CPM2  	config_8560_ioports((ccsr_cpm_t *)CFG_MPC85xx_CPM_ADDR);  #endif @@ -222,11 +254,15 @@ void cpu_init_f (void)  int cpu_init_r(void)  {  #ifdef CONFIG_CLEAR_LAW0 +#ifdef CONFIG_FSL_LAW +	disable_law(0); +#else  	volatile ccsr_local_ecm_t *ecm = (void *)(CFG_MPC85xx_ECM_ADDR);  	/* clear alternate boot location LAW (used for sdram, or ddr bank) */  	ecm->lawar0 = 0;  #endif +#endif  #if defined(CONFIG_L2_CACHE)  	volatile ccsr_l2cache_t *l2cache = (void *)CFG_MPC85xx_L2_ADDR; diff --git a/cpu/mpc85xx/spd_sdram.c b/cpu/mpc85xx/spd_sdram.c index adc9c4dd4..abc63c414 100644 --- a/cpu/mpc85xx/spd_sdram.c +++ b/cpu/mpc85xx/spd_sdram.c @@ -27,6 +27,7 @@  #include <i2c.h>  #include <spd.h>  #include <asm/mmu.h> +#include <asm/fsl_law.h>  #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER) @@ -1022,7 +1023,6 @@ spd_sdram(void)  static unsigned int  setup_laws_and_tlbs(unsigned int memsize)  { -	volatile ccsr_local_ecm_t *ecm = (void *)(CFG_MPC85xx_ECM_ADDR);  	unsigned int tlb_size;  	unsigned int law_size;  	unsigned int ram_tlb_index; @@ -1071,19 +1071,9 @@ setup_laws_and_tlbs(unsigned int memsize)  	ram_tlb_address = (unsigned int)CFG_DDR_SDRAM_BASE;  	while (ram_tlb_address < (memsize * 1024 * 1024)  	      && ram_tlb_index < 16) { -		mtspr(MAS0, FSL_BOOKE_MAS0(1, ram_tlb_index, 0)); -		mtspr(MAS1, FSL_BOOKE_MAS1(1, 1, 0, 0, tlb_size)); -		mtspr(MAS2, FSL_BOOKE_MAS2(ram_tlb_address, 0)); -		mtspr(MAS3, FSL_BOOKE_MAS3(ram_tlb_address, 0, -			(MAS3_SX|MAS3_SW|MAS3_SR))); -		asm volatile("isync;msync;tlbwe;isync"); - -		debug("DDR: MAS0=0x%08x\n", FSL_BOOKE_MAS0(1, ram_tlb_index, 0)); -		debug("DDR: MAS1=0x%08x\n", FSL_BOOKE_MAS1(1, 1, 0, 0, tlb_size)); -		debug("DDR: MAS2=0x%08x\n", FSL_BOOKE_MAS2(ram_tlb_address, 0)); -		debug("DDR: MAS3=0x%08x\n", -			FSL_BOOKE_MAS3(ram_tlb_address, 0, -			              (MAS3_SX|MAS3_SW|MAS3_SR))); +		set_tlb(1, ram_tlb_address, ram_tlb_address, +			MAS3_SX|MAS3_SW|MAS3_SR, 0, +			0, ram_tlb_index, tlb_size, 1);  		ram_tlb_address += (0x1000 << ((tlb_size - 1) * 2));  		ram_tlb_index++; @@ -1098,12 +1088,10 @@ setup_laws_and_tlbs(unsigned int memsize)  	/*  	 * Set up LAWBAR for all of DDR.  	 */ -	ecm->lawbar1 = ((CFG_DDR_SDRAM_BASE >> 12) & 0xfffff); -	ecm->lawar1 = (LAWAR_EN -		       | LAWAR_TRGT_IF_DDR -		       | (LAWAR_SIZE & law_size)); -	debug("DDR: LAWBAR1=0x%08x\n", ecm->lawbar1); -	debug("DDR: LARAR1=0x%08x\n", ecm->lawar1); + +#ifdef CONFIG_FSL_LAW +	set_law(1, CFG_DDR_SDRAM_BASE, law_size, LAW_TRGT_IF_DDR); +#endif  	/*  	 * Confirm that the requested amount of memory was mapped. diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index b489d2ff0..e8e5eb297 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -143,84 +143,8 @@ _start_e500:  	li	r1,0x0f00  	mtspr	IVOR15,r1	/* 15: Debug */ - -	/* -	 * After reset, CCSRBAR is located at CFG_CCSRBAR_DEFAULT, i.e. -	 * 0xff700000-0xff800000. We need add a TLB1 entry for this 1MB -	 * region before we can access any CCSR registers such as L2 -	 * registers, Local Access Registers,etc. We will also re-allocate -	 * CFG_CCSRBAR_DEFAULT to CFG_CCSRBAR immediately after TLB1 setup. -	 * -	 * Please refer to board-specif directory for TLB1 entry configuration. -	 * (e.g. board/<yourboard>/init.S) -	 * -	 */ -	bl	tlb1_entry -	mr	r5,r0 -	lwzu	r4,0(r5)	/* how many TLB1 entries we actually use */ -	mtctr	r4 - -0:	lwzu	r6,4(r5) -	lwzu	r7,4(r5) -	lwzu	r8,4(r5) -	lwzu	r9,4(r5) -	mtspr	MAS0,r6 -	mtspr	MAS1,r7 -	mtspr	MAS2,r8 -	mtspr	MAS3,r9 -	isync -	msync -	tlbwe -	isync -	bdnz	0b - -1: -#if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) -	/* Special sequence needed to update CCSRBAR itself */ -	lis	r4,CFG_CCSRBAR_DEFAULT@h -	ori	r4,r4,CFG_CCSRBAR_DEFAULT@l - -	lis	r5,CFG_CCSRBAR@h -	ori	r5,r5,CFG_CCSRBAR@l -	srwi	r6,r5,12 -	stw	r6,0(r4) -	isync - -	lis	r5,0xffff -	ori	r5,r5,0xf000 -	lwz	r5,0(r5) -	isync - -	lis	r3,CFG_CCSRBAR@h -	lwz	r5,CFG_CCSRBAR@l(r3) -	isync -#endif - - -	/* set up local access windows, defined at board/<boardname>/init.S */ -	lis	r7,CFG_CCSRBAR@h -	ori	r7,r7,CFG_CCSRBAR@l - -	bl	law_entry -	mr	r6,r0 -	lwzu	r5,0(r6)	/* how many windows we actually use */ -	mtctr	r5 - -	li	r2,0x0c28	/* the first pair is reserved for */ -	li	r1,0x0c30	/* boot-over-rio-or-pci */ - -0:	lwzu	r4,4(r6) -	lwzu	r3,4(r6) -	stwx	r4,r7,r2 -	stwx	r3,r7,r1 -	addi	r2,r2,0x0020 -	addi	r1,r1,0x0020 -	bdnz	0b -  	/* Clear and set up some registers. */ -	li      r0,0 -	mtmsr   r0 -	li	r0,0x0000 +	li      r0,0x0000  	lis	r1,0xffff  	mtspr	DEC,r0			/* prevent dec exceptions */  	mttbl	r0			/* prevent fit & wdt exceptions */ @@ -230,18 +154,13 @@ _start_e500:  	mtspr	ESR,r0			/* clear exception syndrome register */  	mtspr	MCSR,r0			/* machine check syndrome register */  	mtxer	r0			/* clear integer exception register */ -	lis	r1,0x0002		/* set CE bit (Critical Exceptions) */ -	ori	r1,r1,0x1200		/* set ME/DE bit */ -	mtmsr	r1			/* change MSR */ -	isync  	/* Enable Time Base and Select Time Base Clock */  	lis	r0,HID0_EMCP@h		/* Enable machine check */  #if defined(CONFIG_ENABLE_36BIT_PHYS) -	ori	r0,r0,(HID0_TBEN|HID0_ENMAS7)@l	/* Enable Timebase & MAS7 */ -#else -	ori	r0,r0,HID0_TBEN@l	/* enable Timebase */ +	ori	r0,r0,HID0_ENMAS7@l	/* Enable MAS7 */  #endif +	ori	r0,r0,HID0_TBEN@l	/* Enable Timebase */  	mtspr	HID0,r0  	li	r0,(HID1_ASTME|HID1_ABE)@l	/* Addr streaming & broadcast */ @@ -262,6 +181,58 @@ _start_e500:  	mtspr	DBCR0,r0  #endif +	/* create a temp mapping in AS=1 to the boot window */ +	lis     r6,FSL_BOOKE_MAS0(1, 15, 0)@h +	ori     r6,r6,FSL_BOOKE_MAS0(1, 15, 0)@l + +	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@h +	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16M)@l + +	lis     r8,FSL_BOOKE_MAS2(TEXT_BASE, (MAS2_I|MAS2_G))@h +	ori     r8,r8,FSL_BOOKE_MAS2(TEXT_BASE, (MAS2_I|MAS2_G))@l + +	lis     r9,FSL_BOOKE_MAS3(0xff800000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@h +	ori     r9,r9,FSL_BOOKE_MAS3(0xff800000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@l + +	mtspr   MAS0,r6 +	mtspr   MAS1,r7 +	mtspr   MAS2,r8 +	mtspr   MAS3,r9 +	isync +	msync +	tlbwe + +	/* create a temp mapping in AS=1 to the stack */ +	lis     r6,FSL_BOOKE_MAS0(1, 14, 0)@h +	ori     r6,r6,FSL_BOOKE_MAS0(1, 14, 0)@l + +	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16K)@h +	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_16K)@l + +	lis     r8,FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0)@h +	ori     r8,r8,FSL_BOOKE_MAS2(CFG_INIT_RAM_ADDR, 0)@l + +	lis     r9,FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@h +	ori     r9,r9,FSL_BOOKE_MAS3(CFG_INIT_RAM_ADDR, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@l + +	mtspr   MAS0,r6 +	mtspr   MAS1,r7 +	mtspr   MAS2,r8 +	mtspr   MAS3,r9 +	isync +	msync +	tlbwe + +	lis	r6,MSR_CE|MSR_ME|MSR_DE|MSR_IS|MSR_DS@h +	ori	r6,r6,MSR_CE|MSR_ME|MSR_DE|MSR_IS|MSR_DS@l +	lis	r7,switch_as@h +	ori	r7,r7,switch_as@l + +	mtspr	SPRN_SRR0,r7 +	mtspr	SPRN_SRR1,r6 +	rfi + +switch_as:  /* L1 DCache is used for initial RAM */  	/* Allocate Initial RAM in data cache. @@ -321,6 +292,14 @@ _start_cont:  	stw	r0,+12(r1)		/* Save return addr (underflow vect) */  	GET_GOT +	bl	cpu_init_early_f + +	/* switch back to AS = 0 */ +	lis	r3,(MSR_CE|MSR_ME|MSR_DE)@h +	ori	r3,r3,(MSR_CE|MSR_ME|MSR_DE)@l +	mtmsr	r3 +	isync +  	bl	cpu_init_f  	bl	board_init_f  	isync diff --git a/cpu/mpc85xx/tlb.c b/cpu/mpc85xx/tlb.c new file mode 100644 index 000000000..b2c799ad1 --- /dev/null +++ b/cpu/mpc85xx/tlb.c @@ -0,0 +1,93 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/processor.h> +#include <asm/mmu.h> + +void set_tlb(u8 tlb, u32 epn, u64 rpn, +	     u8 perms, u8 wimge, +	     u8 ts, u8 esel, u8 tsize, u8 iprot) +{ +	u32 _mas0, _mas1, _mas2, _mas3, _mas7; + +	_mas0 = FSL_BOOKE_MAS0(tlb, esel, 0); +	_mas1 = FSL_BOOKE_MAS1(1, iprot, 0, ts, tsize); +	_mas2 = FSL_BOOKE_MAS2(epn, wimge); +	_mas3 = FSL_BOOKE_MAS3(rpn, 0, perms); +	_mas7 = rpn >> 32; + +	mtspr(MAS0, _mas0); +	mtspr(MAS1, _mas1); +	mtspr(MAS2, _mas2); +	mtspr(MAS3, _mas3); +#ifdef CONFIG_ENABLE_36BIT_PHYS +	mtspr(MAS7, _mas7); +#endif +	asm volatile("isync;msync;tlbwe;isync"); +} + +void disable_tlb(u8 esel) +{ +	u32 _mas0, _mas1, _mas2, _mas3, _mas7; + +	_mas0 = FSL_BOOKE_MAS0(1, esel, 0); +	_mas1 = 0; +	_mas2 = 0; +	_mas3 = 0; +	_mas7 = 0; + +	mtspr(MAS0, _mas0); +	mtspr(MAS1, _mas1); +	mtspr(MAS2, _mas2); +	mtspr(MAS3, _mas3); +#ifdef CONFIG_ENABLE_36BIT_PHYS +	mtspr(MAS7, _mas7); +#endif +	asm volatile("isync;msync;tlbwe;isync"); +} + +void invalidate_tlb(u8 tlb) +{ +	if (tlb == 0) +		mtspr(MMUCSR0, 0x4); +	if (tlb == 1) +		mtspr(MMUCSR0, 0x2); +} + +void init_tlbs(void) +{ +	int i; + +	for (i = 0; i < num_tlb_entries; i++) { +		set_tlb(tlb_table[i].tlb, tlb_table[i].epn, tlb_table[i].rpn, +			tlb_table[i].perms, tlb_table[i].wimge, +			tlb_table[i].ts, tlb_table[i].esel, tlb_table[i].tsize, +			tlb_table[i].iprot); +	} + +	return ; +} + diff --git a/cpu/sh3/Makefile b/cpu/sh3/Makefile new file mode 100644 index 000000000..7679248bf --- /dev/null +++ b/cpu/sh3/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# (C) Copyright 2007 +# Nobuhiro Iwamatsu <iwamatsu@nigauri.org> +# +# (C) Copyright 2007 +# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB	= $(obj)lib$(CPU).a + +START	= start.o +OBJS	= cpu.o interrupts.o watchdog.o time.o cache.o + +all:	.depend $(START) $(LIB) + +$(LIB):	$(OBJS) +	$(AR) crv $@ $(OBJS) + +######################################################################### + +.depend:	Makefile $(START:.o=.S) $(OBJS:.o=.c) +		$(CC) -M $(CFLAGS) $(START:.o=.S) $(OBJS:.o=.c) > $@ + +sinclude .depend + +######################################################################### diff --git a/cpu/sh3/cache.c b/cpu/sh3/cache.c new file mode 100644 index 000000000..c294a2b91 --- /dev/null +++ b/cpu/sh3/cache.c @@ -0,0 +1,112 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * (C) Copyright 2007 + * Nobobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * 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 <asm/processor.h> +#include <asm/io.h> + +/* + * Jump to P2 area. + * When handling TLB or caches, we need to do it from P2 area. + */ +#define jump_to_P2()                    \ +  do {                                    \ +    unsigned long __dummy;		\ +    __asm__ __volatile__(			\ +		"mov.l  1f, %0\n\t"     \ +		"or     %1, %0\n\t"     \ +		"jmp    @%0\n\t"        \ +		" nop\n\t"              \ +		".balign 4\n"           \ +		"1:     .long 2f\n"     \ +		"2:"                    \ +		: "=&r" (__dummy)       \ +		: "r" (0x20000000));    \ +  } while (0) + +/* + * Back to P1 area. + */ +#define back_to_P1()                                    \ +  do {                                                    \ +    unsigned long __dummy;                          \ +    __asm__ __volatile__(                           \ +		"nop;nop;nop;nop;nop;nop;nop\n\t"       \ +		"mov.l  1f, %0\n\t"                     \ +		"jmp    @%0\n\t"                        \ +		" nop\n\t"                              \ +		".balign 4\n"                           \ +		"1:     .long 2f\n"                     \ +		"2:"                                    \ +		: "=&r" (__dummy));                     \ +  } while (0) + +#define CACHE_VALID       1 +#define CACHE_UPDATED     2 + +static inline void cache_wback_all(void) +{ +	unsigned long addr, data, i, j; + +	jump_to_P2(); +	for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++) { +		for (j = 0; j < CACHE_OC_NUM_WAYS; j++) { +			addr = CACHE_OC_ADDRESS_ARRAY +				| (j << CACHE_OC_WAY_SHIFT) +				| (i << CACHE_OC_ENTRY_SHIFT); +			data = inl(addr); +			if (data & CACHE_UPDATED) { +				data &= ~CACHE_UPDATED; +				outl(data, addr); +			} +		} +	} +	back_to_P1(); +} + + +#define CACHE_ENABLE      0 +#define CACHE_DISABLE     1 + +int cache_control(unsigned int cmd) +{ +	unsigned long ccr; + +	jump_to_P2(); +	ccr = inl(CCR); + +	if (ccr & CCR_CACHE_ENABLE) +		cache_wback_all(); + +	if (cmd == CACHE_DISABLE) +		outl(CCR_CACHE_STOP, CCR); +	else +		outl(CCR_CACHE_INIT, CCR); +	back_to_P1(); + +	return 0; +} diff --git a/cpu/sh3/config.mk b/cpu/sh3/config.mk new file mode 100644 index 000000000..f2da3686e --- /dev/null +++ b/cpu/sh3/config.mk @@ -0,0 +1,31 @@ +# +# (C) Copyright 2000-2004 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# (C) Copyright 2007 +# Nobuhiro Iwamatsu <iwamatsu@nigauri.org> +# +# (C) Copyright 2007 +# Yoshihiro Shimoda <shimoda.yoshihiro@renesas.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 +# +# +PLATFORM_CPPFLAGS += -m3 +PLATFORM_RELFLAGS += -ffixed-r13 diff --git a/cpu/sh3/cpu.c b/cpu/sh3/cpu.c new file mode 100644 index 000000000..8261d29d4 --- /dev/null +++ b/cpu/sh3/cpu.c @@ -0,0 +1,84 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * (C) Copyright 2007 + * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * 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 <asm/processor.h> + +int checkcpu(void) +{ +	puts("CPU: SH3\n"); +	return 0; +} + +int cpu_init(void) +{ +	return 0; +} + +int cleanup_before_linux(void) +{ +	disable_interrupts(); +	return 0; +} + +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ +	disable_interrupts(); +	reset_cpu(0); +	return 0; +} + +void flush_cache(unsigned long addr, unsigned long size) +{ + +} + +void icache_enable(void) +{ +} + +void icache_disable(void) +{ +} + +int icache_status(void) +{ +	return 0; +} + +void dcache_enable(void) +{ +} + +void dcache_disable(void) +{ +} + +int dcache_status(void) +{ +	return 0; +} diff --git a/cpu/sh3/interrupts.c b/cpu/sh3/interrupts.c new file mode 100644 index 000000000..55284ccc0 --- /dev/null +++ b/cpu/sh3/interrupts.c @@ -0,0 +1,42 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * (C) Copyright 2007 + * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * 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> + +int interrupt_init(void) +{ +	return 0; +} + +void enable_interrupts(void) +{ + +} + +int disable_interrupts(void) +{ +	return 0; +} diff --git a/cpu/sh3/start.S b/cpu/sh3/start.S new file mode 100644 index 000000000..ee0bcdf7b --- /dev/null +++ b/cpu/sh3/start.S @@ -0,0 +1,77 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * (C) Copyright 2007 + * Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <config.h> +#include <version.h> + +	.text +	.align	2 + +	.global	_start +_start: +	mov.l	._lowlevel_init, r0 +100:	bsrf	r0 +	nop + +	bsr	1f +	nop +1:	sts	pr, r5 +	mov.l	._reloc_dst, r4 +	add	#(_start-1b), r5 +	mov.l	._reloc_dst_end, r6 + +2:	mov.l	@r5+, r1 +	mov.l	r1, @r4 +	add	#4, r4 +	cmp/hs	r6, r4 +	bf	2b + +	mov.l	._bss_start, r4 +	mov.l	._bss_end, r5 +	mov	#0, r1 + +3:	mov.l	r1, @r4			/* bss clear */ +	add	#4, r4 +	cmp/hs	r5, r4 +	bf	3b + +	mov.l	._gd_init, r13		/* global data */ +	mov.l	._stack_init, r15	/* stack */ + +	mov.l	._sh_generic_init, r0 +	jsr	@r0 +	nop + +loop: +	bra	loop + +	.align	2 + +._lowlevel_init:	.long	(lowlevel_init - (100b + 4)) +._reloc_dst:		.long	reloc_dst +._reloc_dst_end:	.long	reloc_dst_end +._bss_start:		.long	bss_start +._bss_end:		.long	bss_end +._gd_init:		.long	(_start - CFG_GBL_DATA_SIZE) +._stack_init:	.long	(_start - CFG_GBL_DATA_SIZE - CFG_MALLOC_LEN - 16) +._sh_generic_init:	.long	sh_generic_init diff --git a/cpu/sh3/time.c b/cpu/sh3/time.c new file mode 100644 index 000000000..0c273dde3 --- /dev/null +++ b/cpu/sh3/time.c @@ -0,0 +1,103 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * (C) Copyright 2007 + * Nobobuhiro Iwamatsu <iwamatsu@nigauri.org> + * + * (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 <common.h> +#include <asm/processor.h> +#include <asm/io.h> + +#define TMU_MAX_COUNTER (~0UL) + +static void tmu_timer_start(unsigned int timer) +{ +	if (timer > 2) +		return; + +	outb(inb(TSTR) | (1 << timer), TSTR); +} + +static void tmu_timer_stop(unsigned int timer) +{ +	u8 val = inb(TSTR); + +	if (timer > 2) +		return; +	outb(val & ~(1 << timer), TSTR); +} + +int timer_init(void) +{ +	/* Divide clock by 4 */ +	outw(0, TCR0); + +	tmu_timer_stop(0); +	tmu_timer_start(0); +	return 0; +} + +/* +   In theory we should return a true 64bit value (ie something that doesn't +   overflow). However, we don't. Therefore if TMU runs at fastest rate of +   6.75 MHz this value will wrap after u-boot has been running for approx +   10 minutes. +*/ +unsigned long long get_ticks(void) +{ +	return (0 - inl(TCNT0)); +} + +unsigned long get_timer(unsigned long base) +{ +	return ((0 - inl(TCNT0)) - base); +} + +void set_timer(unsigned long t) +{ +	outl(0 - t, TCNT0); +} + +void reset_timer(void) +{ +	tmu_timer_stop(0); +	set_timer(0); +	tmu_timer_start(0); +} + +void udelay(unsigned long usec) +{ +	unsigned int start = get_timer(0); +	unsigned int end = start + (usec * ((CFG_HZ + 500000) / 1000000)); + +	while (get_timer(0) < end) +		continue; +} + +unsigned long get_tbclk(void) +{ +	return CFG_HZ; +} diff --git a/cpu/sh3/watchdog.c b/cpu/sh3/watchdog.c new file mode 100644 index 000000000..92bea7471 --- /dev/null +++ b/cpu/sh3/watchdog.c @@ -0,0 +1,33 @@ +/* + * (C) Copyright 2007 + * Yoshihiro Shimoda <shimoda.yoshihiro@renesas.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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/processor.h> + +int watchdog_init(void) +{ +	return 0; +} + +void reset_cpu(unsigned long ignored) +{ +	while (1) +		; +} diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 78cec21fb..67521720e 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -28,6 +28,7 @@ LIB 	:= $(obj)libmisc.a  COBJS-y += ali512x.o  COBJS-y += ns87308.o  COBJS-y += status_led.o +COBJS-$(CONFIG_FSL_LAW) += fsl_law.o  COBJS	:= $(COBJS-y)  SRCS 	:= $(COBJS:.o=.c) diff --git a/drivers/misc/fsl_law.c b/drivers/misc/fsl_law.c new file mode 100644 index 000000000..8bdf5a7f4 --- /dev/null +++ b/drivers/misc/fsl_law.c @@ -0,0 +1,70 @@ +/* + * Copyright 2008 Freescale Semiconductor, Inc. + * + * (C) Copyright 2000 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <asm/fsl_law.h> +#include <asm/io.h> + +#define LAWAR_EN	0x80000000 + +void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id) +{ +	volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08); +	volatile u32 *lawbar = base + 8 * idx; +	volatile u32 *lawar = base + 8 * idx + 2; + +	out_be32(lawbar, addr >> 12); +	out_be32(lawar, LAWAR_EN | ((u32)id << 20) | (u32)sz); + +	return ; +} + +void disable_law(u8 idx) +{ +	volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08); +	volatile u32 *lawbar = base + 8 * idx; +	volatile u32 *lawar = base + 8 * idx + 2; + +	out_be32(lawar, 0); +	out_be32(lawbar, 0); + +	return; +} + +void init_laws(void) +{ +	int i; +	u8 law_idx = 0; + +	for (i = 0; i < num_law_entries; i++) { +		if (law_table[i].index != -1) +			law_idx = law_table[i].index; + +		set_law(law_idx++, law_table[i].addr, +			law_table[i].size, law_table[i].trgt_id); +	} + +	return ; +} diff --git a/drivers/pcmcia/marubun_pcmcia.c b/drivers/pcmcia/marubun_pcmcia.c index 7b112af92..2479a6662 100644 --- a/drivers/pcmcia/marubun_pcmcia.c +++ b/drivers/pcmcia/marubun_pcmcia.c @@ -25,11 +25,13 @@  #include <pcmcia.h>  #include <asm/io.h> -#if	(CONFIG_COMMANDS & CFG_CMD_PCMCIA) +#undef CONFIG_PCMCIA + +#if defined(CONFIG_CMD_PCMCIA)  #define	CONFIG_PCMCIA  #endif -#if	(CONFIG_COMMANDS & CFG_CMD_IDE) +#if	defined(CONFIG_CMD_IDE)  #define	CONFIG_PCMCIA  #endif diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index ee44ba264..00a9b3919 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -30,24 +30,39 @@  #error "Default SCIF doesn't set....."  #endif -#define SCSMR 	(vu_short *)(SCIF_BASE + 0x0) -#define SCBRR 	(vu_char  *)(SCIF_BASE + 0x4) -#define SCSCR 	(vu_short *)(SCIF_BASE + 0x8) +/* Base register */ +#define SCSMR	(vu_short *)(SCIF_BASE + 0x0) +#define SCBRR	(vu_char  *)(SCIF_BASE + 0x4) +#define SCSCR	(vu_short *)(SCIF_BASE + 0x8) +#define SCFCR	(vu_short *)(SCIF_BASE + 0x18) +#define SCFDR	(vu_short *)(SCIF_BASE + 0x1C) +#ifdef CONFIG_SH7720 /* SH7720 specific */ +#define SCFSR	(vu_short *)(SCIF_BASE + 0x14)   /* SCSSR */ +#define SCFTDR	(vu_char  *)(SCIF_BASE + 0x20) +#define SCFRDR	(vu_char  *)(SCIF_BASE + 0x24) +#else  #define SCFTDR 	(vu_char  *)(SCIF_BASE + 0xC)  #define SCFSR 	(vu_short *)(SCIF_BASE + 0x10)  #define SCFRDR 	(vu_char  *)(SCIF_BASE + 0x14) -#define SCFCR 	(vu_short *)(SCIF_BASE + 0x18) -#define SCFDR 	(vu_short *)(SCIF_BASE + 0x1C) +#endif +  #if defined(CONFIG_SH4A)  #define SCRFDR	(vu_short *)(SCIF_BASE + 0x20)  #define SCSPTR	(vu_short *)(SCIF_BASE + 0x24)  #define SCLSR   (vu_short *)(SCIF_BASE + 0x28)  #define SCRER	(vu_short *)(SCIF_BASE + 0x2C) +#define LSR_ORER	1  #elif defined (CONFIG_SH4)  #define SCSPTR 	(vu_short *)(SCIF_BASE + 0x20)  #define SCLSR 	(vu_short *)(SCIF_BASE + 0x24) +#define LSR_ORER	1  #elif defined (CONFIG_SH3) -#define SCLSR 	(vu_short *)(SCIF_BASE + 0x24) +#ifdef CONFIG_SH7720 /* SH7720 specific */ +# define SCLSR	SCFSR	/* SCSSR */ +#else +# define SCLSR   (vu_short *)(SCIF_BASE + 0x24) +#endif +#define LSR_ORER	0x0200  #endif  #define SCR_RE 		(1 << 4) @@ -67,10 +82,18 @@  void serial_setbrg (void)  {  	DECLARE_GLOBAL_DATA_PTR; + +#if defined(CONFIG_CPU_SH7720) +	int divisor = gd->baudrate * 16; + +	*SCBRR = (CONFIG_SYS_CLK_FREQ * 2 + (divisor / 2)) / +						(gd->baudrate * 32) - 1; +#else  	int divisor = gd->baudrate * 32;  	*SCBRR = (CONFIG_SYS_CLK_FREQ + (divisor / 2)) /  						(gd->baudrate * 32) - 1; +#endif  }  int serial_init (void) @@ -133,7 +156,6 @@ int serial_tstc (void)  #define FSR_ERR_CLEAR   0x0063  #define RDRF_CLEAR      0x00fc -#define LSR_ORER        1  void handle_error( void ){  	(void)*SCFSR ; diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile new file mode 100644 index 000000000..0b7a2dfd3 --- /dev/null +++ b/drivers/spi/Makefile @@ -0,0 +1,46 @@ +# +# (C) Copyright 2000-2007 +# 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	:= $(obj)libspi.a + +COBJS-y += mpc8xxx_spi.o + +COBJS	:= $(COBJS-y) +SRCS	:= $(COBJS:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS)) + +all:	$(LIB) + +$(LIB):	$(obj).depend $(OBJS) +	$(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c new file mode 100644 index 000000000..a3d1c9551 --- /dev/null +++ b/drivers/spi/mpc8xxx_spi.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2006 Ben Warren, Qstreams Networks Inc. + * With help from the common/soft_spi and cpu/mpc8260 drivers + * + * 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 <spi.h> +#include <asm/mpc8xxx_spi.h> + +#ifdef CONFIG_HARD_SPI + +#define SPI_EV_NE	(0x80000000 >> 22)	/* Receiver Not Empty */ +#define SPI_EV_NF	(0x80000000 >> 23)	/* Transmitter Not Full */ + +#define SPI_MODE_LOOP	(0x80000000 >> 1)	/* Loopback mode */ +#define SPI_MODE_REV	(0x80000000 >> 5)	/* Reverse mode - MSB first */ +#define SPI_MODE_MS	(0x80000000 >> 6)	/* Always master */ +#define SPI_MODE_EN	(0x80000000 >> 7)	/* Enable interface */ + +#define SPI_TIMEOUT	1000 + +void spi_init(void) +{ +	volatile spi8xxx_t *spi = &((immap_t *) (CFG_IMMR))->spi; + +	/* +	 * SPI pins on the MPC83xx are not muxed, so all we do is initialize +	 * some registers +	 */ +	spi->mode = SPI_MODE_REV | SPI_MODE_MS | SPI_MODE_EN; +	spi->mode = (spi->mode & 0xfff0ffff) | (1 << 16); /* Use SYSCLK / 8 +							     (16.67MHz typ.) */ +	spi->event = 0xffffffff;	/* Clear all SPI events */ +	spi->mask = 0x00000000;	/* Mask  all SPI interrupts */ +	spi->com = 0;		/* LST bit doesn't do anything, so disregard */ +} + +int spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din) +{ +	volatile spi8xxx_t *spi = &((immap_t *) (CFG_IMMR))->spi; +	unsigned int tmpdout, tmpdin, event; +	int numBlks = bitlen / 32 + (bitlen % 32 ? 1 : 0); +	int tm, isRead = 0; +	unsigned char charSize = 32; + +	debug("spi_xfer: chipsel %08X dout %08X din %08X bitlen %d\n", +	      (int)chipsel, *(uint *) dout, *(uint *) din, bitlen); + +	if (chipsel != NULL) +		(*chipsel) (1);	/* select the target chip */ + +	spi->event = 0xffffffff;	/* Clear all SPI events */ + +	/* handle data in 32-bit chunks */ +	while (numBlks--) { +		tmpdout = 0; +		charSize = (bitlen >= 32 ? 32 : bitlen); + +		/* Shift data so it's msb-justified */ +		tmpdout = *(u32 *) dout >> (32 - charSize); + +		/* The LEN field of the SPMODE register is set as follows: +		 * +		 * Bit length             setting +		 * len <= 4               3 +		 * 4 < len <= 16          len - 1 +		 * len > 16               0 +		 */ + +		if (bitlen <= 16) { +			if (bitlen <= 4) +				spi->mode = (spi->mode & 0xff0fffff) | +				            (3 << 20); +			else +				spi->mode = (spi->mode & 0xff0fffff) | +				            ((bitlen - 1) << 20); +		} else { +			spi->mode = (spi->mode & 0xff0fffff); +			/* Set up the next iteration if sending > 32 bits */ +			bitlen -= 32; +			dout += 4; +		} + +		spi->tx = tmpdout;	/* Write the data out */ +		debug("*** spi_xfer: ... %08x written\n", tmpdout); + +		/* +		 * Wait for SPI transmit to get out +		 * or time out (1 second = 1000 ms) +		 * The NE event must be read and cleared first +		 */ +		for (tm = 0, isRead = 0; tm < SPI_TIMEOUT; ++tm) { +			event = spi->event; +			if (event & SPI_EV_NE) { +				tmpdin = spi->rx; +				spi->event |= SPI_EV_NE; +				isRead = 1; + +				*(u32 *) din = (tmpdin << (32 - charSize)); +				if (charSize == 32) { +					/* Advance output buffer by 32 bits */ +					din += 4; +				} +			} +			/* +			 * Only bail when we've had both NE and NF events. +			 * This will cause timeouts on RO devices, so maybe +			 * in the future put an arbitrary delay after writing +			 * the device.  Arbitrary delays suck, though... +			 */ +			if (isRead && (event & SPI_EV_NF)) +				break; +		} +		if (tm >= SPI_TIMEOUT) +			puts("*** spi_xfer: Time out during SPI transfer"); + +		debug("*** spi_xfer: transfer ended. Value=%08x\n", tmpdin); +	} + +	if (chipsel != NULL) +		(*chipsel) (0);	/* deselect the target chip */ + +	return 0; +} +#endif				/* CONFIG_HARD_SPI */ diff --git a/include/asm-ppc/fsl_law.h b/include/asm-ppc/fsl_law.h new file mode 100644 index 000000000..7cb8840dd --- /dev/null +++ b/include/asm-ppc/fsl_law.h @@ -0,0 +1,80 @@ +#ifndef _FSL_LAW_H_ +#define _FSL_LAW_H_ + +#include <asm/io.h> + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define SET_LAW_ENTRY(idx, a, sz, trgt) \ +	{ .index = idx, .addr = a, .size = sz, .trgt_id = trgt } + +enum law_size { +	LAW_SIZE_4K = 0xb, +	LAW_SIZE_8K, +	LAW_SIZE_16K, +	LAW_SIZE_32K, +	LAW_SIZE_64K, +	LAW_SIZE_128K, +	LAW_SIZE_256K, +	LAW_SIZE_512K, +	LAW_SIZE_1M, +	LAW_SIZE_2M, +	LAW_SIZE_4M, +	LAW_SIZE_8M, +	LAW_SIZE_16M, +	LAW_SIZE_32M, +	LAW_SIZE_64M, +	LAW_SIZE_128M, +	LAW_SIZE_256M, +	LAW_SIZE_512M, +	LAW_SIZE_1G, +	LAW_SIZE_2G, +	LAW_SIZE_4G, +	LAW_SIZE_8G, +	LAW_SIZE_16G, +	LAW_SIZE_32G, +}; + +enum law_trgt_if { +	LAW_TRGT_IF_PCI = 0x00, +	LAW_TRGT_IF_PCI_2 = 0x01, +#ifndef CONFIG_MPC8641 +	LAW_TRGT_IF_PCIE_1 = 0x02, +#endif +#ifndef CONFIG_MPC8572 +	LAW_TRGT_IF_PCIE_3 = 0x03, +#endif +	LAW_TRGT_IF_LBC = 0x04, +	LAW_TRGT_IF_CCSR = 0x08, +	LAW_TRGT_IF_DDR_INTRLV = 0x0b, +	LAW_TRGT_IF_RIO = 0x0c, +	LAW_TRGT_IF_DDR = 0x0f, +	LAW_TRGT_IF_DDR_2 = 0x16,	/* 2nd controller */ +}; +#define LAW_TRGT_IF_DDR_1	LAW_TRGT_IF_DDR +#define LAW_TRGT_IF_PCI_1	LAW_TRGT_IF_PCI +#define LAW_TRGT_IF_PCIX	LAW_TRGT_IF_PCI +#define LAW_TRGT_IF_PCIE_2	LAW_TRGT_IF_PCI_2 + +#ifdef CONFIG_MPC8641 +#define LAW_TRGT_IF_PCIE_1	LAW_TRGT_IF_PCI +#endif + +#ifdef CONFIG_MPC8572 +#define LAW_TRGT_IF_PCIE_3	LAW_TRGT_IF_PCI +#endif + +struct law_entry { +	int index; +	phys_addr_t addr; +	enum law_size size; +	enum law_trgt_if trgt_id; +}; + +extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id); +extern void disable_law(u8 idx); +extern void init_laws(void); + +/* define in board code */ +extern struct law_entry law_table[]; +extern int num_law_entries; +#endif diff --git a/include/asm-ppc/immap_83xx.h b/include/asm-ppc/immap_83xx.h index 34ea29599..5b215393e 100644 --- a/include/asm-ppc/immap_83xx.h +++ b/include/asm-ppc/immap_83xx.h @@ -30,6 +30,7 @@  #include <asm/types.h>  #include <asm/fsl_i2c.h> +#include <asm/mpc8xxx_spi.h>  /*   * Local Access Window @@ -384,20 +385,6 @@ typedef struct lbus83xx {  } lbus83xx_t;  /* - * Serial Peripheral Interface - */ -typedef struct spi83xx { -	u32 mode;		/* mode register */ -	u32 event;		/* event register */ -	u32 mask;		/* mask register */ -	u32 com;		/* command register */ -	u8 res0[0x10]; -	u32 tx;			/* transmit register */ -	u32 rx;			/* receive register */ -	u8 res1[0xFD8]; -} spi83xx_t; - -/*   * DMA/Messaging Unit   */  typedef struct dma83xx { @@ -627,7 +614,7 @@ typedef struct immap {  	u8			res3[0x900];  	lbus83xx_t		lbus;		/* Local Bus Controller Registers */  	u8			res4[0x1000]; -	spi83xx_t		spi;		/* Serial Peripheral Interface */ +	spi8xxx_t		spi;		/* Serial Peripheral Interface */  	dma83xx_t		dma;		/* DMA */  	pciconf83xx_t		pci_conf[2];	/* PCI Software Configuration Registers */  	ios83xx_t		ios;		/* Sequencer */ @@ -661,7 +648,7 @@ typedef struct immap {  	u8			res2[0x900];  	lbus83xx_t		lbus;		/* Local Bus Controller Registers */  	u8			res3[0x1000]; -	spi83xx_t		spi;		/* Serial Peripheral Interface */ +	spi8xxx_t		spi;		/* Serial Peripheral Interface */  	dma83xx_t		dma;		/* DMA */  	pciconf83xx_t		pci_conf[1];	/* PCI Software Configuration Registers */  	u8			res4[0x80]; @@ -696,7 +683,7 @@ typedef struct immap {  	u8			res2[0x900];  	lbus83xx_t		lbus;		/* Local Bus Controller Registers */  	u8			res3[0x1000]; -	spi83xx_t		spi;		/* Serial Peripheral Interface */ +	spi8xxx_t		spi;		/* Serial Peripheral Interface */  	dma83xx_t		dma;		/* DMA */  	pciconf83xx_t		pci_conf[1];	/* PCI Software Configuration Registers */  	u8			res4[0x80]; @@ -741,7 +728,7 @@ typedef struct immap {  	u8			res2[0x900];  	lbus83xx_t		lbus;		/* Local Bus Controller Registers */  	u8			res3[0x1000]; -	spi83xx_t		spi;		/* Serial Peripheral Interface */ +	spi8xxx_t		spi;		/* Serial Peripheral Interface */  	dma83xx_t		dma;		/* DMA */  	pciconf83xx_t		pci_conf[1];	/* PCI Software Configuration Registers */  	u8			res4[0x80]; diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 45a47645e..ec1ca53cc 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h @@ -418,6 +418,37 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);  #define BOOKE_PAGESZ_256GB	14  #define BOOKE_PAGESZ_1TB	15 +#ifdef CONFIG_E500 +#ifndef __ASSEMBLY__ +extern void set_tlb(u8 tlb, u32 epn, u64 rpn, +		    u8 perms, u8 wimge, +		    u8 ts, u8 esel, u8 tsize, u8 iprot); +extern void disable_tlb(u8 esel); +extern void invalidate_tlb(u8 tlb); +extern void init_tlbs(void); + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \ +	{ .tlb = _tlb, .epn = _epn, .rpn = _rpn, .perms = _perms, \ +	  .wimge = _wimge, .ts = _ts, .esel = _esel, .tsize = _sz, .iprot = _iprot } + +struct fsl_e_tlb_entry { +	u8	tlb; +	u32	epn; +	u64	rpn; +	u8	perms; +	u8	wimge; +	u8	ts; +	u8	esel; +	u8	tsize; +	u8	iprot; +}; + +extern struct fsl_e_tlb_entry tlb_table[]; +extern int num_tlb_entries; +#endif +#endif +  #if defined(CONFIG_MPC86xx)  #define LAWBAR_BASE_ADDR	0x00FFFFFF  #define LAWAR_TRGT_IF		0x01F00000 diff --git a/include/asm-ppc/mpc8xxx_spi.h b/include/asm-ppc/mpc8xxx_spi.h new file mode 100644 index 000000000..48b15e4f3 --- /dev/null +++ b/include/asm-ppc/mpc8xxx_spi.h @@ -0,0 +1,48 @@ +/* + * Freescale non-CPM SPI Controller + * + * Copyright 2008 Qstreams Networks, Inc. + * + * This software may be used and distributed according to the + * terms of the GNU Public License, Version 2, incorporated + * herein by reference. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * Version 2 as published by the Free Software Foundation. + * + * 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_MPC8XXX_SPI_H_ +#define _ASM_MPC8XXX_SPI_H_ + +#include <asm/types.h> + +#if defined(CONFIG_MPC834X) || \ +	defined(CONFIG_MPC8313) || \ +	defined(CONFIG_MPC8315) || \ +	defined(CONFIG_MPC837X) + +typedef struct spi8xxx { +	u8 res0[0x20];	/* 0x0-0x01f reserved */ +	u32 mode;	/* mode register  */ +	u32 event;	/* event register */ +	u32 mask;	/* mask register  */ +	u32 com;	/* command register */ +	u32 tx;		/* transmit register */ +	u32 rx;		/* receive register */ +	u8 res1[0xFC8];	/* fill up to 0x1000 */ +} spi8xxx_t; + +#endif + +#endif	/* _ASM_MPC8XXX_SPI_H_ */ diff --git a/include/asm-sh/cpu_sh3.h b/include/asm-sh/cpu_sh3.h new file mode 100644 index 000000000..6db38a2f8 --- /dev/null +++ b/include/asm-sh/cpu_sh3.h @@ -0,0 +1,42 @@ +/* + * (C) Copyright 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> + * (C) Copyright 2007 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef _ASM_CPU_SH3_H_ +#define _ASM_CPU_SH3_H_ + +/* cache control */ +#define CCR_CACHE_STOP   0x00000008 +#define CCR_CACHE_ENABLE 0x00000005 +#define CCR_CACHE_ICI    0x00000008 + +#define CACHE_OC_ADDRESS_ARRAY	0xf0000000 +#define CACHE_OC_WAY_SHIFT	13 +#define CACHE_OC_NUM_ENTRIES	256 +#define CACHE_OC_ENTRY_SHIFT	4 + +#if defined(CONFIG_CPU_SH7710) +#include <asm/cpu_sh7710.h> +#elif defined(CONFIG_CPU_SH7720) +#include <asm/cpu_sh7720.h> +#else +#error "Unknown SH3 variant" +#endif + +#endif	/* _ASM_CPU_SH3_H_ */ diff --git a/include/asm-sh/cpu_sh7710.h b/include/asm-sh/cpu_sh7710.h new file mode 100644 index 000000000..e223f1ca1 --- /dev/null +++ b/include/asm-sh/cpu_sh7710.h @@ -0,0 +1,64 @@ +#ifndef _ASM_CPU_SH7710_H_ +#define _ASM_CPU_SH7710_H_ + +#define CACHE_OC_NUM_WAYS	4 +#define CCR_CACHE_INIT	0x0000000D + +/* MMU and Cache control */ +#define MMUCR		0xFFFFFFE0 +#define CCR		0xFFFFFFEC + +/* PFC */ +#define PACR		0xA4050100 +#define PBCR		0xA4050102 +#define PCCR		0xA4050104 +#define PETCR		0xA4050106 + +/* Port Data Registers */ +#define PADR		0xA4050120 +#define PBDR		0xA4050122 +#define PCDR		0xA4050124 + +/* BSC */ +#define CMNCR		0xA4FD0000 +#define CS0BCR		0xA4FD0004 +#define CS2BCR		0xA4FD0008 +#define CS3BCR		0xA4FD000C +#define CS4BCR		0xA4FD0010 +#define CS5ABCR		0xA4FD0014 +#define CS5BBCR		0xA4FD0018 +#define CS6ABCR		0xA4FD001C +#define CS6BBCR		0xA4FD0020 +#define CS0WCR		0xA4FD0024 +#define CS2WCR		0xA4FD0028 +#define CS3WCR		0xA4FD002C +#define CS4WCR		0xA4FD0030 +#define CS5AWCR		0xA4FD0034 +#define CS5BWCR		0xA4FD0038 +#define CS6AWCR		0xA4FD003C +#define CS6BWCR		0xA4FD0040 + +/* SDRAM controller */ +#define SDCR		0xA4FD0044 +#define RTCSR		0xA4FD0048 +#define RTCNT		0xA4FD004C +#define RTCOR		0xA4FD0050 + +/* SCIF */ +#define SCSMR_0		0xA4400000 +#define SCIF0_BASE	SCSMR_0 +#define SCSMR_0		0xA4410000 +#define SCIF1_BASE	SCSMR_1 + +/* Timer */ +#define TSTR0		0xA412FE92 +#define TSTR		TSTR0 +#define TCNT0		0xa412FE98 +#define TCR0		0xa412FE9C + +/* On chip oscillator circuits */ +#define FRQCR		0xA415FF80 +#define WTCNT		0xA415FF84 +#define WTCSR		0xA415FF86 + +#endif	/* _ASM_CPU_SH7710_H_ */ diff --git a/include/asm-sh/cpu_sh7720.h b/include/asm-sh/cpu_sh7720.h new file mode 100644 index 000000000..bafb8deb1 --- /dev/null +++ b/include/asm-sh/cpu_sh7720.h @@ -0,0 +1,207 @@ +/* + * (C) Copyright 2007 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> + * + * SH7720 Internal I/O register + * + * 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_CPU_SH7720_H_ +#define _ASM_CPU_SH7720_H_ + +#define CACHE_OC_NUM_WAYS	4 +#define CCR_CACHE_INIT		0x0000000B + +/*	EXP	*/ +#define TRA		0xFFFFFFD0 +#define EXPEVT		0xFFFFFFD4 +#define INTEVT		0xFFFFFFD8 + +/*	MMU	*/ +#define MMUCR		0xFFFFFFE0 +#define PTEH		0xFFFFFFF0 +#define PTEL		0xFFFFFFF4 +#define TTB		0xFFFFFFF8 + +/*	CACHE	*/ +#define CCR		0xFFFFFFEC + +/*	INTC	*/ +#define IPRF		0xA4080000 +#define IPRG		0xA4080002 +#define IPRH		0xA4080004 +#define IPRI		0xA4080006 +#define IPRJ		0xA4080008 +#define IRR5		0xA4080020 +#define IRR6		0xA4080022 +#define IRR7		0xA4080024 +#define IRR8		0xA4080026 +#define IRR9		0xA4080028 +#define IRR0		0xA4140004 +#define IRR1		0xA4140006 +#define IRR2		0xA4140008 +#define IRR3		0xA414000A +#define IRR4		0xA414000C +#define ICR1		0xA4140010 +#define ICR2		0xA4140012 +#define PINTER		0xA4140014 +#define IPRC		0xA4140016 +#define IPRD		0xA4140018 +#define IPRE		0xA414001A +#define ICR0		0xA414FEE0 +#define IPRA		0xA414FEE2 +#define IPRB		0xA414FEE4 + +/*	BSC	*/ +#define BSC_BASE	0xA4FD0000 +#define CMNCR		(BSC_BASE + 0x00) +#define CS0BCR		(BSC_BASE + 0x04) +#define CS2BCR		(BSC_BASE + 0x08) +#define CS3BCR		(BSC_BASE + 0x0C) +#define CS4BCR		(BSC_BASE + 0x10) +#define CS5ABCR		(BSC_BASE + 0x14) +#define CS5BBCR		(BSC_BASE + 0x18) +#define CS6ABCR		(BSC_BASE + 0x1C) +#define CS6BBCR		(BSC_BASE + 0x20) +#define CS0WCR		(BSC_BASE + 0x24) +#define CS2WCR		(BSC_BASE + 0x28) +#define CS3WCR		(BSC_BASE + 0x2C) +#define CS4WCR		(BSC_BASE + 0x30) +#define CS5AWCR		(BSC_BASE + 0x34) +#define CS5BWCR		(BSC_BASE + 0x38) +#define CS6AWCR		(BSC_BASE + 0x3C) +#define CS6BWCR		(BSC_BASE + 0x40) +#define SDCR		(BSC_BASE + 0x44) +#define RTCSR		(BSC_BASE + 0x48) +#define RTCNR		(BSC_BASE + 0x4C) +#define RTCOR		(BSC_BASE + 0x50) +#define SDMR2		(BSC_BASE + 0x4000) +#define SDMR3		(BSC_BASE + 0x5000) + +/*	DMAC	*/ + +/*	CPG	*/ +#define UCLKCR		0xA40A0008 +#define FRQCR		0xA415FF80 + +/*	LOW POWER MODE	*/ + +/*	TMU	*/ +#define TMU_BASE	0xA412FE90 +#define TSTR		(TMU_BASE + 0x02) +#define TCOR0		(TMU_BASE + 0x04) +#define TCNT0		(TMU_BASE + 0x08) +#define TCR0		(TMU_BASE + 0x0C) +#define TCOR1		(TMU_BASE + 0x10) +#define TCNT1		(TMU_BASE + 0x14) +#define TCR1		(TMU_BASE + 0x18) +#define TCOR2		(TMU_BASE + 0x1C) +#define TCNT2		(TMU_BASE + 0x20) +#define TCR2		(TMU_BASE + 0x24) + +/*	TPU	*/ +#define TPU_BASE	0xA4480000 +#define TPU_TSTR	(TPU_BASE + 0x00) +#define TPU_TCR0	(TPU_BASE + 0x10) +#define TPU_TMDR0	(TPU_BASE + 0x14) +#define TPU_TIOR0	(TPU_BASE + 0x18) +#define TPU_TIER0	(TPU_BASE + 0x1C) +#define TPU_TSR0	(TPU_BASE + 0x20) +#define TPU_TCNT0	(TPU_BASE + 0x24) +#define TPU_TGRA0	(TPU_BASE + 0x28) +#define TPU_TGRB0	(TPU_BASE + 0x2C) +#define TPU_TGRC0	(TPU_BASE + 0x30) +#define TPU_TGRD0	(TPU_BASE + 0x34) +#define TPU_TCR1	(TPU_BASE + 0x50) +#define TPU_TMDR1	(TPU_BASE + 0x54) +#define TPU_TIOR1	(TPU_BASE + 0x58) +#define TPU_TIER1	(TPU_BASE + 0x5C) +#define TPU_TSR1	(TPU_BASE + 0x60) +#define TPU_TCNT1	(TPU_BASE + 0x64) +#define TPU_TGRA1	(TPU_BASE + 0x68) +#define TPU_TGRB1	(TPU_BASE + 0x6C) +#define TPU_TGRC1	(TPU_BASE + 0x70) +#define TPU_TGRD1	(TPU_BASE + 0x74) +#define TPU_TCR2	(TPU_BASE + 0x90) +#define TPU_TMDR2	(TPU_BASE + 0x94) +#define TPU_TIOR2	(TPU_BASE + 0x98) +#define TPU_TIER2	(TPU_BASE + 0x9C) +#define TPU_TSR2	(TPU_BASE + 0xB0) +#define TPU_TCNT2	(TPU_BASE + 0xB4) +#define TPU_TGRA2	(TPU_BASE + 0xB8) +#define TPU_TGRB2	(TPU_BASE + 0xBC) +#define TPU_TGRC2	(TPU_BASE + 0xC0) +#define TPU_TGRD2	(TPU_BASE + 0xC4) +#define TPU_TCR3	(TPU_BASE + 0xD0) +#define TPU_TMDR3	(TPU_BASE + 0xD4) +#define TPU_TIOR3	(TPU_BASE + 0xD8) +#define TPU_TIER3	(TPU_BASE + 0xDC) +#define TPU_TSR3	(TPU_BASE + 0xE0) +#define TPU_TCNT3	(TPU_BASE + 0xE4) +#define TPU_TGRA3	(TPU_BASE + 0xE8) +#define TPU_TGRB3	(TPU_BASE + 0xEC) +#define TPU_TGRC3	(TPU_BASE + 0xF0) +#define TPU_TGRD3	(TPU_BASE + 0xF4) + +/*	CMT	*/ + +/*	SIOF	*/ + +/*	SCIF	*/ +#define SCIF0_BASE	0xA4430000 + +/*	SIM	*/ + +/*	IrDA	*/ + +/*	IIC	*/ + +/*	LCDC	*/ + +/*	USBF	*/ + +/*	MMCIF	*/ + +/*	PFC	*/ +#define PFC_BASE	0xA4050100 +#define PACR		(PFC_BASE + 0x00) +#define PBCR		(PFC_BASE + 0x02) +#define PCCR		(PFC_BASE + 0x04) +#define PDCR		(PFC_BASE + 0x06) +#define PECR		(PFC_BASE + 0x08) +#define PFCR		(PFC_BASE + 0x0A) +#define PGCR		(PFC_BASE + 0x0C) +#define PHCR		(PFC_BASE + 0x0E) +#define PJCR		(PFC_BASE + 0x10) +#define PKCR		(PFC_BASE + 0x12) +#define PLCR		(PFC_BASE + 0x14) +#define PMCR		(PFC_BASE + 0x16) +#define PPCR		(PFC_BASE + 0x18) +#define PRCR		(PFC_BASE + 0x1A) +#define PSCR		(PFC_BASE + 0x1C) +#define PTCR		(PFC_BASE + 0x1E) +#define PUCR		(PFC_BASE + 0x20) +#define PVCR		(PFC_BASE + 0x22) +#define PSELA		(PFC_BASE + 0x24) +#define PSELB		(PFC_BASE + 0x26) +#define PSELC		(PFC_BASE + 0x28) +#define PSELD		(PFC_BASE + 0x2A) + +/*	I/O Port	*/ + +/*	H-UDI	*/ + +#endif /* _ASM_CPU_SH7720_H_ */ diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h index 03427ad33..51fd10b56 100644 --- a/include/asm-sh/io.h +++ b/include/asm-sh/io.h @@ -227,5 +227,32 @@ out:  static inline void sync(void)  {  } + +/* + * Given a physical address and a length, return a virtual address + * that can be used to access the memory range with the caching + * properties specified by "flags". + */ +typedef unsigned long phys_addr_t; + +#define MAP_NOCACHE     (0) +#define MAP_WRCOMBINE   (0) +#define MAP_WRBACK      (0) +#define MAP_WRTHROUGH   (0) + +static inline void * +map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags) +{ +	return (void *)paddr; +} + +/* + * Take down a mapping set up by map_physmem(). + */ +static inline void unmap_physmem(void *vaddr, unsigned long flags) +{ + +} +  #endif	/* __KERNEL__ */  #endif	/* __ASM_SH_IO_H */ diff --git a/include/configs/ATUM8548.h b/include/configs/ATUM8548.h index f7020b495..c14376e7f 100644 --- a/include/configs/ATUM8548.h +++ b/include/configs/ATUM8548.h @@ -63,6 +63,8 @@  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef  #define CONFIG_INTERRUPTS		/* enable pci, srio, ddr interrupts */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */ +  #define MPC85xx_DDR_SDRAM_CLK_CNTL	/* 85xx has clock control reg */  #define CONFIG_SYS_CLK_FREQ	33000000 diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h index 437a9a5f7..07f2f30ef 100644 --- a/include/configs/MPC8349EMDS.h +++ b/include/configs/MPC8349EMDS.h @@ -355,6 +355,15 @@  #define CFG_I2C_OFFSET		0x3000  #define CFG_I2C2_OFFSET		0x3100 +/* SPI */ +#define CONFIG_HARD_SPI			/* SPI with hardware support */ +#undef CONFIG_SOFT_SPI			/* SPI bit-banged */ + +/* GPIOs.  Used as SPI chip selects */ +#define CFG_GPIO1_PRELIM +#define CFG_GPIO1_DIR		0xC0000000  /* SPI CS on 0, LED on 1 */ +#define CFG_GPIO1_DAT		0xC0000000  /* Both are active LOW */ +  /* TSEC */  #define CFG_TSEC1_OFFSET 0x24000  #define CFG_TSEC1 (CFG_IMMR+CFG_TSEC1_OFFSET) diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h index afce7fb78..5ea7b2504 100644 --- a/include/configs/MPC8540ADS.h +++ b/include/configs/MPC8540ADS.h @@ -55,6 +55,7 @@  #define CONFIG_DDR_ECC			/* only for ECC DDR module */  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * sysclk for MPC85xx diff --git a/include/configs/MPC8540EVAL.h b/include/configs/MPC8540EVAL.h index 2868dcb8a..bf64f2704 100644 --- a/include/configs/MPC8540EVAL.h +++ b/include/configs/MPC8540EVAL.h @@ -43,6 +43,8 @@  #undef  CONFIG_DDR_ECC			    /* only for ECC DDR module */  #define CONFIG_DDR_DLL                      /* possible DLL fix needed */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */ +  /* Using Localbus SDRAM to emulate flash before we can program the flash,   * normally you only need a flash-boot image(u-boot.bin),if unsure undef this.   * Not availabe for EVAL board diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index c83382f0d..7334088b1 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -47,6 +47,7 @@  #define CONFIG_DDR_ECC			/* only for ECC DDR module */  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * When initializing flash, if we cannot find the manufacturer ID, diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index 5a96db5ab..a8942095c 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -42,6 +42,8 @@  #define CONFIG_FSL_PCI_INIT	1	/* Use common FSL init code */  #define CONFIG_FSL_PCIE_RESET	1	/* need PCIe reset errata */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */ +  #define CONFIG_TSEC_ENET		/* tsec ethernet support */  #define CONFIG_ENV_OVERWRITE  #define CONFIG_SPD_EEPROM		/* Use SPD EEPROM for DDR setup */ diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 90beb2521..a3db9f445 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -55,6 +55,7 @@  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef  #define CONFIG_INTERRUPTS		/* enable pci, srio, ddr interrupts */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * When initializing flash, if we cannot find the manufacturer ID, diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 76d673cd0..93877aedb 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -47,6 +47,7 @@  #define CONFIG_DDR_ECC			/* only for ECC DDR module */  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * When initializing flash, if we cannot find the manufacturer ID, diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h index 5f105552f..08884b36f 100644 --- a/include/configs/MPC8560ADS.h +++ b/include/configs/MPC8560ADS.h @@ -52,6 +52,7 @@  #define CONFIG_DDR_ECC			/* only for ECC DDR module */  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * sysclk for MPC85xx diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index 2b089d90d..a12d193c7 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -49,6 +49,7 @@  /*#define CONFIG_ECC_INIT_VIA_DDRCONTROLLER*/	/* DDR controller or DMA? */  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * When initializing flash, if we cannot find the manufacturer ID, diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h index ac4b3e133..a53953c29 100644 --- a/include/configs/MPC8610HPCD.h +++ b/include/configs/MPC8610HPCD.h @@ -493,6 +493,7 @@   * Miscellaneous configurable options   */  #define CFG_LONGHELP			/* undef to save memory	*/ +#define CONFIG_CMDLINE_EDITING          /* Command-line editing */  #define CFG_LOAD_ADDR	0x2000000	/* default load address */  #define CFG_PROMPT	"=> "		/* Monitor Command Prompt */ diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index ab875f036..985182fde 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -555,6 +555,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);   * Miscellaneous configurable options   */  #define CFG_LONGHELP			/* undef to save memory	*/ +#define CONFIG_CMDLINE_EDITING          /* Command-line editing */  #define CFG_LOAD_ADDR	0x2000000	/* default load address */  #define CFG_PROMPT	"=> "		/* Monitor Command Prompt */ diff --git a/include/configs/PM854.h b/include/configs/PM854.h index f0d0399a9..819bee70a 100644 --- a/include/configs/PM854.h +++ b/include/configs/PM854.h @@ -51,6 +51,7 @@  #define CONFIG_DDR_ECC			/* only for ECC DDR module */  #define CONFIG_MEM_INIT_VALUE		0xDEADBEEF +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * sysclk for MPC85xx diff --git a/include/configs/PM856.h b/include/configs/PM856.h index ae2645c07..8902f42ff 100644 --- a/include/configs/PM856.h +++ b/include/configs/PM856.h @@ -51,6 +51,7 @@  #define CONFIG_DDR_2T_TIMING		/* Sets the 2T timing bit */  #define CONFIG_MEM_INIT_VALUE		0xDEADBEEF +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /*   * sysclk for MPC85xx diff --git a/include/configs/SBC8540.h b/include/configs/SBC8540.h index 3ca85b8a9..2bbfe9aa6 100644 --- a/include/configs/SBC8540.h +++ b/include/configs/SBC8540.h @@ -56,6 +56,7 @@  #undef	CONFIG_PCI			/* pci ethernet support		*/  #undef  CONFIG_ETHER_ON_FCC		/* cpm FCC ethernet support	*/ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/TQM85xx.h b/include/configs/TQM85xx.h index f3b1a53fe..dd0654b70 100644 --- a/include/configs/TQM85xx.h +++ b/include/configs/TQM85xx.h @@ -50,6 +50,8 @@  #define CONFIG_CPM2		1	/* has CPM2			*/  #endif +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */ +  /*   * sysclk for MPC85xx   * diff --git a/include/configs/ms7720se.h b/include/configs/ms7720se.h new file mode 100644 index 000000000..8a94c2823 --- /dev/null +++ b/include/configs/ms7720se.h @@ -0,0 +1,134 @@ +/* + * Configuation settings for the Hitachi Solution Engine 7720 + * + * Copyright (C) 2007 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.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 __MS7720SE_H +#define __MS7720SE_H + +#undef DEBUG +#define CONFIG_SH		1 +#define CONFIG_SH3		1 +#define CONFIG_CPU_SH7720	1 +#define CONFIG_MS7720SE		1 + +#define CONFIG_CMD_FLASH +#define CONFIG_CMD_ENV +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_MEMORY +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_PCMCIA +#define CONFIG_CMD_IDE +#define CONFIG_CMD_EXT2 + +#define CFG_CMD_PCMCIA	0x01 +#define CFG_CMD_IDE	0x02 + +#define CONFIG_COMMANDS		((CONFIG_CMD_DFL	| \ +				 CFG_CMD_IDE|CFG_CMD_PCMCIA)	& \ +				~(CFG_CMD_FPGA)) + +#define CONFIG_BAUDRATE		115200 +#define CONFIG_BOOTARGS		"console=ttySC0,115200" +#define CONFIG_BOOTFILE		/boot/zImage +#define CONFIG_LOADADDR		0x8E000000 + +#define CONFIG_VERSION_VARIABLE +#undef  CONFIG_SHOW_BOOT_PROGRESS + +/* MEMORY */ +#define MS7720SE_SDRAM_BASE		0x8C000000 +#define MS7720SE_FLASH_BASE_1		0xA0000000 +#define MS7720SE_FLASH_BANK_SIZE	(8 * 1024 * 1024) + +#define CFG_LONGHELP		/* undef to save memory	*/ +#define CFG_PROMPT	"=> "	/* Monitor Command Prompt */ +#define CFG_CBSIZE	256	/* Buffer size for input from the Console */ +#define CFG_PBSIZE	256	/* Buffer size for Console output */ +#define CFG_MAXARGS	16	/* max args accepted for monitor commands */ +/* Buffer size for Boot Arguments passed to kernel */ +#define CFG_BARGSIZE	512 +/* List of legal baudrate settings for this board */ +#define CFG_BAUDRATE_TABLE	{ 115200 } + +/* SCIF */ +#define CFG_SCIF_CONSOLE	1 +#define CONFIG_CONS_SCIF0	1 + +#define CFG_MEMTEST_START	MS7720SE_SDRAM_BASE +#define CFG_MEMTEST_END		(CFG_MEMTEST_START + (60 * 1024 * 1024)) + +#define CFG_SDRAM_BASE		MS7720SE_SDRAM_BASE +#define CFG_SDRAM_SIZE		(64 * 1024 * 1024) + +#define CFG_LOAD_ADDR		(CFG_SDRAM_BASE + 32 * 1024 * 1024) +#define CFG_MONITOR_BASE	MS7720SE_FLASH_BASE_1 +#define CFG_MONITOR_LEN		(128 * 1024) +#define CFG_MALLOC_LEN		(256 * 1024) +#define CFG_GBL_DATA_SIZE	256 +#define CFG_BOOTMAPSZ		(8 * 1024 * 1024) + + +/* FLASH */ +#define CFG_FLASH_CFI +#define CFG_FLASH_CFI_DRIVER +#undef  CFG_FLASH_QUIET_TEST +#define CFG_FLASH_EMPTY_INFO	/* print 'E' for empty sector on flinfo */ + +#define CFG_FLASH_BASE		MS7720SE_FLASH_BASE_1 + +#define CFG_MAX_FLASH_SECT	150 +#define CFG_MAX_FLASH_BANKS	1 +#define CFG_FLASH_BANKS_LIST	{ CFG_FLASH_BASE } + +#define CFG_ENV_IS_IN_FLASH +#define CFG_ENV_SECT_SIZE	(64 * 1024) +#define CFG_ENV_SIZE		CFG_ENV_SECT_SIZE +#define CFG_ENV_ADDR		(CFG_MONITOR_BASE + CFG_MONITOR_LEN) +#define CFG_FLASH_ERASE_TOUT  	120000 +#define CFG_FLASH_WRITE_TOUT	500 + +/* Board Clock */ +#define CONFIG_SYS_CLK_FREQ	33333333 +#define TMU_CLK_DIVIDER		4	/* 4 (default), 16, 64, 256 or 1024 */ +#define CFG_HZ			(CONFIG_SYS_CLK_FREQ / TMU_CLK_DIVIDER) + +/* PCMCIA */ +#define CONFIG_IDE_PCMCIA	1 +#define CONFIG_MARUBUN_PCCARD	1 +#define CONFIG_PCMCIA_SLOT_A	1 +#define CFG_IDE_MAXDEVICE	1 +#define CFG_MARUBUN_MRSHPC	0xb83fffe0 +#define CFG_MARUBUN_MW1		0xb8400000 +#define CFG_MARUBUN_MW2		0xb8500000 +#define CFG_MARUBUN_IO		0xb8600000 + +#define CFG_PIO_MODE		1 +#define CFG_IDE_MAXBUS		1 +#define CONFIG_DOS_PARTITION	1 +#define CFG_ATA_BASE_ADDR	CFG_MARUBUN_IO	/* base address */ +#define CFG_ATA_IDE0_OFFSET	0x01F0		/* ide0 offste */ +#define CFG_ATA_DATA_OFFSET	0		/* data reg offset */ +#define CFG_ATA_REG_OFFSET	0		/* reg offset */ +#define CFG_ATA_ALT_OFFSET	0x200		/* alternate register offset */ + +#endif	/* __MS7720SE_H */ diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h index c050a061b..0a7a90497 100644 --- a/include/configs/sbc8548.h +++ b/include/configs/sbc8548.h @@ -56,6 +56,7 @@  #define CONFIG_MEM_INIT_VALUE		0xDeadBeef  #define CONFIG_INTERRUPTS		/* enable pci, srio, ddr interrupts */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  #define MPC85xx_DDR_SDRAM_CLK_CNTL	/* 85xx has clock control reg */ diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index b71ba785b..f9ede5f18 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -50,6 +50,7 @@  #undef	CONFIG_PCI			/* pci ethernet support		*/  #undef  CONFIG_ETHER_ON_FCC		/* cpm FCC ethernet support	*/ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  #define CONFIG_ENV_OVERWRITE diff --git a/include/configs/stxgp3.h b/include/configs/stxgp3.h index 3baa32c8d..047e1cf99 100644 --- a/include/configs/stxgp3.h +++ b/include/configs/stxgp3.h @@ -51,6 +51,7 @@  #define CONFIG_DDR_DLL                  /* possible DLL fix needed */  #define CONFIG_DDR_2T_TIMING		/* Sets the 2T timing bit */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /* sysclk for MPC85xx   */ diff --git a/include/configs/stxssa.h b/include/configs/stxssa.h index 9457bce0a..e09dd7163 100644 --- a/include/configs/stxssa.h +++ b/include/configs/stxssa.h @@ -51,6 +51,7 @@  #undef CONFIG_DDR_DLL			/* possible DLL fix needed */  #define CONFIG_DDR_2T_TIMING		/* Sets the 2T timing bit */ +#define CONFIG_FSL_LAW		1	/* Use common FSL init code */  /* sysclk for MPC85xx   */ diff --git a/include/mpc512x.h b/include/mpc512x.h index a06b5c650..d1c6fb29f 100644 --- a/include/mpc512x.h +++ b/include/mpc512x.h @@ -185,7 +185,7 @@  /* SCFR1 System Clock Frequency Register 1   */ -#define SCFR1_IPS_DIV			0x2 +#define SCFR1_IPS_DIV			0x4  #define SCFR1_IPS_DIV_MASK		0x03800000  #define SCFR1_IPS_DIV_SHIFT		23 diff --git a/include/mpc83xx.h b/include/mpc83xx.h index 39cecf21c..df052e3d4 100644 --- a/include/mpc83xx.h +++ b/include/mpc83xx.h @@ -725,6 +725,7 @@  #define SCCR_USBCM_3			0x00F00000  #elif defined(CONFIG_MPC8313) +/* TSEC1 bits are for TSEC2 as well */  #define SCCR_TSEC1CM			0xc0000000  #define SCCR_TSEC1CM_SHIFT		30  #define SCCR_TSEC1CM_0			0x00000000 @@ -732,13 +733,6 @@  #define SCCR_TSEC1CM_2			0x80000000  #define SCCR_TSEC1CM_3			0xC0000000 -#define SCCR_TSEC2CM			0x30000000 -#define SCCR_TSEC2CM_SHIFT		28 -#define SCCR_TSEC2CM_0			0x00000000 -#define SCCR_TSEC2CM_1			0x10000000 -#define SCCR_TSEC2CM_2			0x20000000 -#define SCCR_TSEC2CM_3			0x30000000 -  #define SCCR_TSEC1ON			0x20000000  #define SCCR_TSEC1ON_SHIFT		29  #define SCCR_TSEC2ON			0x10000000 @@ -838,6 +832,8 @@  #define SCCR_PCIEXP2CM_3		0x000c0000  /* All of the four SATA controllers must have the same clock ratio */ +#define SCCR_SATA1CM			0x000000c0 +#define SCCR_SATA1CM_SHIFT		6  #define SCCR_SATACM			0x000000ff  #define SCCR_SATACM_SHIFT		0  #define SCCR_SATACM_0			0x00000000 diff --git a/lib_ppc/board.c b/lib_ppc/board.c index 7b95246e1..45d1328f2 100644 --- a/lib_ppc/board.c +++ b/lib_ppc/board.c @@ -87,6 +87,9 @@ void doc_init (void);      defined(CONFIG_SOFT_I2C)  #include <i2c.h>  #endif +#if defined(CONFIG_HARD_SPI) +#include <spi.h> +#endif  #if defined(CONFIG_CMD_NAND)  void nand_init (void);  #endif @@ -247,6 +250,16 @@ static int init_func_i2c (void)  }  #endif +#if defined(CONFIG_HARD_SPI) +static int init_func_spi (void) +{ +	puts ("SPI:   "); +	spi_init (); +	puts ("ready\n"); +	return (0); +} +#endif +  /***********************************************************************/  #if defined(CONFIG_WATCHDOG) @@ -329,6 +342,9 @@ init_fnc_t *init_sequence[] = {  #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)  	init_func_i2c,  #endif +#if defined(CONFIG_HARD_SPI) +	init_func_spi, +#endif  #if defined(CONFIG_DTT)		/* Digital Thermometers and Thermostats */  	dtt_init,  #endif @@ -835,6 +851,11 @@ void board_init_r (gd_t *id, ulong dest_addr)  #if defined(CONFIG_SC3)  	sc3_read_eeprom();  #endif + +#ifdef CFG_ID_EEPROM +	mac_read_from_eeprom(); +#endif +  	s = getenv ("ethaddr");  #if defined (CONFIG_MBX) || \      defined (CONFIG_RPXCLASSIC) || \ @@ -902,10 +923,6 @@ void board_init_r (gd_t *id, ulong dest_addr)  	}  #endif -#ifdef CFG_ID_EEPROM -	mac_read_from_eeprom(); -#endif -  #if defined(CONFIG_TQM8xxL) || defined(CONFIG_TQM8260) || \      defined(CONFIG_TQM8272) || \      defined(CONFIG_CCM) || defined(CONFIG_KUP4K) || \  |